@@ -34,6 +34,9 @@ function parse_aiml_as_XML($convoArr)
3434 $ botsay = trim (implode_recursive (' ' , $ responseArray , __FILE__ , __FUNCTION__ , __LINE__ ));
3535 $ botsay = str_replace (' . ' , '. ' , $ botsay );
3636 $ botsay = str_replace (' ' , ' ' , $ botsay );
37+ $ botsay = str_replace (' ? ' , '? ' , $ botsay );
38+ $ botsay = str_replace (' , ' , ', ' , $ botsay );
39+ $ botsay = str_replace (' s ' , 's ' , $ botsay );
3740 $ convoArr ['aiml ' ]['parsed_template ' ] = $ botsay ;
3841 runDebug (__FILE__ , __FUNCTION__ , __LINE__ , "Completed parsing the template. The bot will say: $ botsay " , 4 );
3942 return $ convoArr ;
@@ -277,24 +280,17 @@ function parse_get_tag($convoArr, $element, $parentName, $level)
277280 $ response = 'undefined ' ;
278281 if (empty ($ response ))
279282 {
280-
281- if ((isset ($ convoArr ['client_properties ' ][(string )$ var_name ])) && ($ convoArr ['client_properties ' ][(string )$ var_name ]!="" ))
282- {
283- $ response = $ convoArr ['client_properties ' ][(string )$ var_name ];
284- } else {
285-
286- $ sql = "select `value` from ` $ dbn`.`client_properties` where `user_id` = $ user_id and `bot_id` = $ bot_id and `name` = ' $ var_name'; " ;
287- runDebug (__FILE__ , __FUNCTION__ , __LINE__ , "Checking the DB for $ var_name - sql: \n$ sql " , 3 );
288- $ result = db_query ($ sql , $ con );
289- if (($ result ) and (mysql_num_rows ($ result ) > 0 )) {
290- $ row = mysql_fetch_assoc ($ result );
291- $ response = $ row ['value ' ];
292- }
293- else {
294- $ response = 'undefined ' ;
295- }
296- mysql_free_result ($ result );
283+ $ sql = "select `value` from ` $ dbn`.`client_properties` where `user_id` = $ user_id and `bot_id` = $ bot_id and `name` = ' $ var_name'; " ;
284+ runDebug (__FILE__ , __FUNCTION__ , __LINE__ , "Checking the DB for $ var_name - sql: \n$ sql " , 3 );
285+ $ result = db_query ($ sql , $ con );
286+ if (($ result ) and (mysql_num_rows ($ result ) > 0 )) {
287+ $ row = mysql_fetch_assoc ($ result );
288+ $ response = $ row ['value ' ];
289+ }
290+ else {
291+ $ response = 'undefined ' ;
297292 }
293+ mysql_free_result ($ result );
298294 }
299295 runDebug (__FILE__ , __FUNCTION__ , __LINE__ , "The value for $ var_name is $ response. " , 4 );
300296 return $ response ;
@@ -318,8 +314,6 @@ function parse_set_tag($convoArr, $element, $parentName, $level)
318314 if ($ var_name == 'name ' )
319315 {
320316 $ user_name = $ var_value ;
321- $ convoArr ['client_properties ' ]['name ' ] = $ var_value ;
322- $ convoArr ['conversation ' ]['user_name ' ] = $ var_value ;
323317 $ sql = "UPDATE ` $ dbn`.`users` set `user_name` = ' $ var_value' where `id` = $ user_id; " ;
324318 $ sql = mysql_real_escape_string ($ sql );
325319 runDebug (__FILE__ , __FUNCTION__ , __LINE__ , "Updating user name in the DB. SQL: \n$ sql " , 3 );
0 commit comments