<?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/categoriesblogs_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=="_category")
{
$where ="";
$where.= GetFullFieldName("category")."=".make_db_value("category",$_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 > 5 ) ? ". Displaying first: <strong>5</strong>.<br /><br />" : "<br /><br />";
echo "<table cellpadding=1 cellspacing=1 border=0 align=left class=\"detailtable\"><tr>";
echo "<td><strong>username</strong></td>";
echo "<td><strong>date</strong></td>";
echo "<td><strong>Time</strong></td>";
echo "<td><strong>category</strong></td>";
echo "<td><strong>firstline</strong></td>";
echo "<td><strong>youtube</strong></td>";
echo "<td><strong>link</strong></td>";
echo "</tr>";
while ($data = db_fetch_array($rs)) {
$recordsCounter++;
if ( $recordsCounter > 5 ) { break; }
echo "<tr>";
$keylink="";
$keylink.="&key1=".htmlspecialchars(rawurlencode($data["id"]));
// 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>";
// 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);
}
else
$value="";
echo "<td>".$value."</td>";
// firstline -
$value="";
$value = ProcessLargeText(GetData($data,"firstline", ""),"field=firstline".$keylink,"",MODE_PRINT);
echo "<td>".$value."</td>";
// picture - File-based Image
$value="";
if(CheckImageExtension($data["picture"]))
{
// show thumbnail
$thumbname="th".$data["picture"];
if(substr("files/",0,7)!="http://" && !file_exists(GetUploadFolder("picture").$thumbname))
$thumbname=$data["picture"];
$value="<a target=_blank href=\"".htmlspecialchars(AddLinkPrefix("picture",$data["picture"]))."\">";
$value.="<img";
if($thumbname==$data["picture"])
{
}
$value.=" border=0";
$value.=" src=\"".htmlspecialchars(AddLinkPrefix("picture",$thumbname))."\"></a>";
}
echo "<td>".$value."</td>";
// link - Hyperlink
$value="";
$value = GetData($data,"link", "Hyperlink");
echo "<td>".$value."</td>";
echo "</tr>";
}
echo "</table>";
} else {
echo "Details found".": <strong>".$rowcount."</strong>";
}
echo "counterSeparator".postvalue("counter");
?>