Location: PHPKode > projects > Blogs manager > blogs/chosen_comments_view.php
<?php 
ini_set("display_errors","1");
ini_set("display_startup_errors","1");
set_magic_quotes_runtime(0);

include("include/dbcommon.php");
include("include/chosen_comments_variables.php");


//	check if logged in
if(!@$_SESSION["UserID"] || !CheckSecurity(@$_SESSION["_".$strTableName."_OwnerID"],"Search"))
{ 
	$_SESSION["MyURL"]=$_SERVER["SCRIPT_NAME"]."?".$_SERVER["QUERY_STRING"];
	header("Location: login.php?message=expired"); 
	return;
}

$filename="";	
$message="";

//connect database
$conn = db_connect();

//	Before Process event
if(function_exists("BeforeProcessView"))
	BeforeProcessView($conn);


$keys=array();
$keys["id"]=postvalue("editid1");

//	get current values and show edit controls

$strWhereClause = KeyWhere($keys);


//	select only owned records
$strWhereClause=whereAdd($strWhereClause,SecuritySQL("Search"));

$strSQL=gSQLWhere($strWhereClause);

$strSQLbak = $strSQL;
if(function_exists("BeforeQueryView"))
	BeforeQueryView($strSQL,$strWhereClause);
if($strSQLbak == $strSQL)
	$strSQL=gSQLWhere($strWhereClause);

LogInfo($strSQL);
$rs=db_query($strSQL,$conn);
$data=db_fetch_array($rs);


include('libs/Smarty.class.php');
$smarty = new Smarty();

	$smarty->assign("show_key1", htmlspecialchars(GetData($data,"id", "")));

$keylink="";
$keylink.="&key1=".htmlspecialchars(rawurlencode($data["id"]));

////////////////////////////////////////////
//	username - 
	$value="";
		$value = ProcessLargeText(GetData($data,"username", ""),"","",MODE_VIEW);
	$smarty->assign("show_username",$value);
////////////////////////////////////////////
//	blogfirstline - 
	$value="";
		if(strlen($data["blogfirstline"]))
	{
		$strdata = make_db_value("blogfirstline",$data["blogfirstline"]);
		$LookupSQL="SELECT ";
					$LookupSQL.="concat(firstline,' ',username,' ',date)";
		$LookupSQL.=" FROM `_blogs` WHERE `firstline` = " . $strdata;
					LogInfo($LookupSQL);
		$rsLookup = db_query($LookupSQL,$conn);
		$lookupvalue=$data["blogfirstline"];
		if($lookuprow=db_fetch_numarray($rsLookup))
			$lookupvalue=$lookuprow[0];
		$value=ProcessLargeText(GetDataInt($lookupvalue,$data,"blogfirstline", ""),"field=blogfirstline".$keylink,"",MODE_VIEW);
	}
	else
		$value="";
	$smarty->assign("show_blogfirstline",$value);
////////////////////////////////////////////
//	date - Short Date
	$value="";
		$value = ProcessLargeText(GetData($data,"date", "Short Date"),"","",MODE_VIEW);
	$smarty->assign("show_date",$value);
////////////////////////////////////////////
//	time - Time
	$value="";
		$value = ProcessLargeText(GetData($data,"time", "Time"),"","",MODE_VIEW);
	$smarty->assign("show_time",$value);
////////////////////////////////////////////
//	rate - 
	$value="";
		if(strlen($data["rate"]))
	{
		$strdata = make_db_value("rate",$data["rate"]);
		$LookupSQL="SELECT ";
					$LookupSQL.="concat(rate,'  if: ',meanning)";
		$LookupSQL.=" FROM `_rate` WHERE `rate` = " . $strdata;
					LogInfo($LookupSQL);
		$rsLookup = db_query($LookupSQL,$conn);
		$lookupvalue=$data["rate"];
		if($lookuprow=db_fetch_numarray($rsLookup))
			$lookupvalue=$lookuprow[0];
		$value=ProcessLargeText(GetDataInt($lookupvalue,$data,"rate", ""),"field=rate".$keylink,"",MODE_VIEW);
	}
	else
		$value="";
	$smarty->assign("show_rate",$value);
////////////////////////////////////////////
//	comment - HTML
	$value="";
		$value = GetData($data,"comment", "HTML");
	$smarty->assign("show_comment",$value);

$templatefile = "chosen_comments_view.htm";
if(function_exists("BeforeShowView"))
	BeforeShowView($smarty,$templatefile,$data);

$smarty->display($templatefile);

?>
Return current item: Blogs manager