Location: PHPKode > projects > Blogs manager > blogs/include/_blogs_masterprint.php
<?php
include("include/_blogs_settings.php");

function DisplayMasterTableInfo($detailtable, $keys)
{
	global $conn,$strTableName,$smarty;
	
	$oldTableName=$strTableName;
	$strTableName="_blogs";

//$strSQL = "select `id`,   `username`,   `date`,   `TIME`,   `category`,   `firstline`,   `blog`,   `link`,   `picture`,   `int1`,   `int2`,   `char1`,   `char2`  From `_blogs`";

$sqlHead="select `id`,   `username`,   `date`,   `TIME`,   `category`,   `firstline`,   `blog`,   `link`,   `picture`,   `int1`,   `int2`,   `char1`,   `char2`  ";
$sqlFrom="From `_blogs`";
$sqlWhere="";
$sqlTail="";

$where="";

if($detailtable=="_comments")
{
		$where.= GetFullFieldName("username")."=".make_db_value("username",$keys[1-1]);
}
elseif($detailtable=="chosen comments")
{
		$where.= GetFullFieldName("firstline")."=".make_db_value("firstline",$keys[1-1]);
}
if(!$where)
{
	$strTableName=$oldTableName;
	return;
}
	$str = SecuritySQL("Export");
	if(strlen($str))
		$where.=" and ".$str;
	
	$strWhere=whereAdd($sqlWhere,$where);
	if(strlen($strWhere))
		$strWhere=" where ".$strWhere." ";
	$strSQL= $sqlHead.$sqlFrom.$strWhere.$sqlTail;

//	$strSQL=AddWhere($strSQL,$where);

	LogInfo($strSQL);
	$rs=db_query($strSQL,$conn);
	$data=db_fetch_array($rs);
	$keylink="";
	$keylink.="&key1=".htmlspecialchars(rawurlencode($data["id"]));
	

//	username - 
			$value="";
				$value = ProcessLargeText(GetData($data,"username", ""),"field=username".$keylink,"",MODE_PRINT);
			$smarty->assign("showmaster_username",$value);

//	date - Short Date
			$value="";
				$value = ProcessLargeText(GetData($data,"date", "Short Date"),"field=date".$keylink,"",MODE_PRINT);
			$smarty->assign("showmaster_date",$value);

//	TIME - Time
			$value="";
				$value = ProcessLargeText(GetData($data,"TIME", "Time"),"field=TIME".$keylink,"",MODE_PRINT);
			$smarty->assign("showmaster_TIME",$value);

//	category - 
			$value="";
				if(strlen($data["category"]))
			{
				$strdata = make_db_value("category",$data["category"]);
				$LookupSQL="SELECT ";
							$LookupSQL.="`category`";
				$LookupSQL.=" FROM `_category` WHERE `category` = " . $strdata;
							LogInfo($LookupSQL);
				$rsLookup = db_query($LookupSQL,$conn);
				$lookupvalue=$data["category"];
				if($lookuprow=db_fetch_numarray($rsLookup))
					$lookupvalue=$lookuprow[0];
				$value=ProcessLargeText(GetDataInt($lookupvalue,$data,"category", ""),"field=category".$keylink,"",MODE_PRINT);
			}
			$smarty->assign("showmaster_category",$value);

//	firstline - 
			$value="";
				$value = ProcessLargeText(GetData($data,"firstline", ""),"field=firstline".$keylink,"",MODE_PRINT);
			$smarty->assign("showmaster_firstline",$value);

//	picture - HTML
			$value="";
				$value = GetData($data,"picture", "HTML");
			$smarty->assign("showmaster_picture",$value);

//	link - Hyperlink
			$value="";
				$value = GetData($data,"link", "Hyperlink");
			$smarty->assign("showmaster_link",$value);
	$strTableName=$oldTableName;
}

// events

?>
Return current item: Blogs manager