Location: PHPKode > projects > Chirp: The Microblog > chirp.v.1.1/stream.php
<?php

	session_start();

	header ("Cache-control: private");

	header("Refresh: 20; url=stream.php");

	error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

	

	include("includes/config.inc.php");

	include("includes/db.inc.php");

	include("language/language.".$language.".php");

	include("includes/functions.inc.php");

	include("includes/messages.inc.php");

	

	$chirp_query = "SELECT chirpmsg.ID, chirpmsg.USERID, chirpmsg.USERMSG, chirpmsg.ENTRYDATE, users.USERNAME FROM chirpmsg INNER JOIN users ON chirpmsg.USERID = users.USERID WHERE (chirpmsg.USERID = users.USERID)";

	

	$strpage = MSG_STREAM($chirp_query);

	echo MSG_PROCESSING($strpage);

	

	mysql_close($connection);

	

function MSG_PROCESSING($wpage){

	include("includes/config.inc.php");

	include("language/language.".$language.".php");

	

	$mpage 	= file_get_contents('themes/'.$theme.'/stream_php_full_page.theme.html');

	

	if (strpos($mpage,"%STREAMMSGBLOCK%") !== false){

		$wpage = str_replace('%STREAMMSGBLOCK%',$wpage,$mpage);

	}

	if(strpos($wpage,"%SITENAME%") !== false){

		$wpage = str_replace('%SITENAME%',$sitename,$wpage);

	}

	if(strpos($wpage,"%URL%") !== false){

		$wpage = str_replace('%URL%',$url,$wpage);

	}

	

	return $wpage;

}

function MSG_STREAM($sesquery) {

	include("includes/config.inc.php");

	include("includes/emoticon.inc.php");

	include("language/language.".$language.".php");

	

	$msgblock = file_get_contents('themes/'.$theme.'/stream_php_msg_block.theme.html');

	$msgstream = '';

	

	$result = mysql_query($sesquery." ORDER BY ENTRYDATE DESC LIMIT 50");



	if (mysql_errno()) {

          die("<br />" . mysql_errno() . ": " . mysql_error() . "<br />");

     }

	$num = @mysql_num_rows($result);

	if ( $num > 0 ) {

		while($row = @mysql_fetch_assoc($result)){

			$myuser = mysql_query("SELECT users.USERNAME FROM users WHERE users.USERID = " . $row['USERID'] . " LIMIT 1");

			$myrow = @mysql_fetch_array($myuser);

			$username 	= '<a href="%URL%@'.$myrow['USERNAME'].'" target="_blank" title="'.$myrow['USERNAME'].'">'.$myrow['USERNAME'].'</a>';

			$userimg 	= '<img src="%URL%image.php?img='. $row['USERID'].'" width="48" height="48" />';

			$usermsg 	= stripslashes($row['USERMSG']);

			$userdate 	= TimeToJourJ($row['ENTRYDATE']);

			

//==========================================================

//============= START MANIPULATE $usermsg HERE =============

//==========================================================

			$usermsg = stripslashes($usermsg);

			$usermsg = autolink($usermsg);

			$usermsg = findnames($usermsg);

			if ($enable_emoticons == 1){

				$usermsg = smiley2emoticons($usermsg);

			}

//========================================================

//============= END MANIPULATE $usermsg HERE =============

//========================================================



//========================================================

//================ THEME INDUCTION SECTION ===============

//========================================================

			if(strpos($msgblock,"%PROFPIX%") !== false){

				$msglist = str_replace('%PROFPIX%',$userimg,$msgblock);

			}

			if(strpos($msglist,"%USERNAME%") !== false){

				$msglist = str_replace('%USERNAME%',$username,$msglist);

			}

			if(strpos($msglist,"%MSSGSTREAM%") !== false){

				$msglist = str_replace('%MSSGSTREAM%',$usermsg,$msglist);

			}

			if(strpos($msglist,"%ENTRYDATE%") !== false){

				$msglist = str_replace('%ENTRYDATE%',$userdate,$msglist);

			}

			$msgstream .= $msglist;

		}

	}



	return $msgstream;

}



?>
Return current item: Chirp: The Microblog