<?php
ini_set("display_errors","1");
ini_set("display_startup_errors","1");
header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");
set_magic_quotes_runtime(0);
include("include/dbcommon.php");
include("include/chosen_comments_variables.php");
if(!@$_SESSION["UserID"])
{
return;
}
if(!CheckSecurity(@$_SESSION["_".$strTableName."_OwnerID"],"Search"))
{
return;
}
$conn=db_connect();
$recordsCounter = 0;
// process masterkey value
$mastertable=postvalue("mastertable");
if($mastertable!="")
{
$_SESSION[$strTableName."_mastertable"]=$mastertable;
// copy keys to session
$i=1;
while(isset($_REQUEST["masterkey".$i]))
{
$_SESSION[$strTableName."_masterkey".$i]=$_REQUEST["masterkey".$i];
$i++;
}
if(isset($_SESSION[$strTableName."_masterkey".$i]))
unset($_SESSION[$strTableName."_masterkey".$i]);
}
else
$mastertable=$_SESSION[$strTableName."_mastertable"];
//$strSQL = $gstrSQL;
if($mastertable=="_blogs")
{
$where ="";
$where.= GetFullFieldName("blogfirstline")."=".make_db_value("blogfirstline",$_SESSION[$strTableName."_masterkey1"]);
}
$str = SecuritySQL("Search");
if(strlen($str))
$where.=" and ".$str;
$strSQL = gSQLWhere($where);
//$strSQL = AddWhere($strSQL,$where);
$strSQL.=" ".$gstrOrderBy;
$rowcount=gSQLRowCount($where);
if ( $rowcount ) {
$rs=db_query($strSQL,$conn);
echo "Details found".": <strong>".$rowcount."</strong>";
echo ( $rowcount > 10 ) ? ". Displaying first: <strong>10</strong>.<br /><br />" : "<br /><br />";
echo "<table cellpadding=1 cellspacing=1 border=0 align=left class=\"detailtable\"><tr>";
echo "<td><strong>blogfirstline</strong></td>";
echo "<td><strong>username</strong></td>";
echo "<td><strong>date</strong></td>";
echo "<td><strong>time</strong></td>";
echo "<td><strong>rate</strong></td>";
echo "<td><strong>comment</strong></td>";
echo "</tr>";
while ($data = db_fetch_array($rs)) {
$recordsCounter++;
if ( $recordsCounter > 10 ) { break; }
echo "<tr>";
$keylink="";
$keylink.="&key1=".htmlspecialchars(rawurlencode($data["id"]));
// 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_PRINT);
}
else
$value="";
echo "<td>".$value."</td>";
// username -
$value="";
$value = ProcessLargeText(GetData($data,"username", ""),"field=username".$keylink,"",MODE_PRINT);
echo "<td>".$value."</td>";
// date - Short Date
$value="";
$value = ProcessLargeText(GetData($data,"date", "Short Date"),"field=date".$keylink,"",MODE_PRINT);
echo "<td>".$value."</td>";
// time - Time
$value="";
$value = ProcessLargeText(GetData($data,"time", "Time"),"field=time".$keylink,"",MODE_PRINT);
echo "<td>".$value."</td>";
// 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_PRINT);
}
else
$value="";
echo "<td>".$value."</td>";
// comment - HTML
$value="";
$value = GetData($data,"comment", "HTML");
echo "<td>".$value."</td>";
echo "</tr>";
}
echo "</table>";
} else {
echo "Details found".": <strong>".$rowcount."</strong>";
}
echo "counterSeparator".postvalue("counter");
?>