zonder dit werk hij niet meer , maar hier vormt zich het probleem kan iemand helpen AUB ???
Code: Selecteer alles
		//
			// Begin IAI system
			//
			// Note: the switch statements here can be quite complicated, so I've used
			// some weird setting out. This helps to show exactly what is going on and
			// allows me to bear down on the problems that were occuring before.
			// Do seed for random replies
			list($usec, $sec) = explode(' ', microtime());
			mt_srand((float) $sec + ((float) $usec * 100000));
			$iai_rand = mt_rand(0, 100);
			// Initial should IAI run check
			$run_iai = 
			(
				(
					$mode == 'newtopic'
					||
					$mode == 'reply'
				) 
				&& 
				(
					$iai_rand <= $board_config['iai_percentage_all']
				) 
				&& 
				(
					$board_config['iai_percentage_all'] != 0
				) 
				&& 
				(
					$board_config['iai_active_all']
				)
			) ? TRUE : FALSE;
			// Check if forum has settings which overide this
			if($post_info['iai_override'])
			{
				$run_iai = (($iai_rand <= $post_info['iai_percentage']) && ($post_info['iai_percentage'] != 0)) ? TRUE : FALSE;
			}
			// If IAI is not currently set to run, then it should find any call words
			// in the post which might overide this.
			// Not in the usual set out, but it allows you to actually understand what's going on.
			if(
				(
					!($run_iai)
				) 
				&&
				( 
					(
						$post_info['iai_override'] 
						&& 
						$post_info['iai_stop_words']
					) 
					|| 
					(
						!($post_info['iai_override']) 
						&& 
						$board_config['iai_active_all']
					)
				)
			)
			{
				// See if there is any match in the respond words array.
				// I know this system is pretty bad (there must be a faster way), but I haven't had much experience with it, so any help would be greatly appreciated
				$res_words = str_replace(", ", ",", $board_config['iai_respond_words']);
				$res_words = str_replace("!", "", $res_words);
				$res_words = str_replace("?", "", $res_words);
				$res_words = str_replace("'", "", $res_words);
				$res_words = str_replace('"', '', $res_words);				
				$res_words = explode(",", $res_words);
				$words = str_replace(".", "", $HTTP_POST_VARS['message']);
				$words = str_replace("!", "", $words);
				$words = str_replace("?", "", $words);
				$words = str_replace(",", "", $words);
				$words = str_replace("'", "", $words);
				$words = str_replace('"', '', $words);
				$words = explode(" ", $words);
				for($i = 0; $i < count($res_words); $i++)
				{
					$words = str_replace($res_words[$i] . " ", " " . $res_words[$i] . " ", $words);
					$words = str_replace(" " . $res_words[$i], " " . $res_words[$i] . " ", $words);
					for($g = 0; $g < count($words); $g++)
					{
						if($res_words[$i] == $words[$g])
						{
							$run_iai = TRUE;
						}
					}
				}
	     		}
			// START IAI response and entry to db (if active)
			if ($run_iai)
			{
				$iai_root_path = $phpbb_root_path . "mods/iai/";
				include($iai_root_path . 'includes/iai_functions.'.$phpEx);
				
				// Initialise variables
				$iai_mode = 'reply';
				$iai_post_id = '';
				$iai_id = $board_config['iai_userid'];
				$iai_subject = '';
				$iai_username = $board_config['iai_username'];
				$iai_topic_type = POST_NORMAL;
				$numselects = 0;
				$user_id = ($userdata['session_logged_in']) ? $userdata['user_id'] : 0;
				// $topic_id should be set already
				$sesh_id = $userdata['session_id']; // should NOT be null in any situation
				$iai_reply_to = str_replace("is " .  $iai_username, "are you", $HTTP_POST_VARS['message']);
				$iai_reply_to = str_replace( $iai_username, "you", $iai_reply_to);
				
				// Get IAI reply
				$iai_reply = reply($iai_reply_to,$user_id,$topic_id,$sesh_id);
				$iai_message = $iai_reply->response;
				// prepare IAI message(IAI may have used html, smilies etc...)
				$bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';
				$iai_message = str_replace("'", "''", $iai_message);
				$iai_message = prepare_message(trim($iai_message), 0, 1, 1, $bbcode_uid);
				if ( $error_msg == '' && !empty($iai_message) )
				{
					// Submit IAI's response to DB & update stats
					iai_submit_post($iai_mode, $iai_id, $forum_id, $topic_id, $iai_post_id, $iai_topic_type, 1, 1, 1, 1, $bbcode_uid, str_replace("\'", "''", $iai_username), str_replace("\'", "''", $iai_subject), str_replace("\'", "''", $iai_message));
					iai_update_post_stats($forum_id, $topic_id, $iai_post_id, $iai_id);
				}
			}
			// END IAI response and entry to db
			//
			// END IAI system
			//