require("config.php");
require "lang/".$LANGFILE;
$error = false;
if(ereg("^[0-9]+$",$ar["lid"] = $_GET['lid']))
{
$query = mysql_query("SELECT * FROM main WHERE lid = '$lid'");
if(!$query || mysql_result($query,0,'type') != 1) $error = true;
$ar["lid"] = $lid;
$ar["title"] = mysql_result($query,0,'title');
$title = mysql_result($query,0,'title');
$ar["gin"] = mysql_result($query,0,'gin');
$ar["gout"] = mysql_result($query,0,'gout');
$ar["moder_vote"] = mysql_result($query,0,'moder_vote');
$ar["description"] = mysql_result($query,0,'description');
$ar["url"] = mysql_result($query,0,'url');
if(!preg_match("/^http:\/\//",$ar["url"])) $ar["url"]="http://".$ar["url"];
$meta = "\n";
$meta .= "";
}
else $error = true;
include "_top.php";
function ShowParts($cid)
{
global $cat,$TMPL;
$r=mysql_query("SELECT name,cid,count FROM cat WHERE parent='$cid'") or die(mysql_error());
$num=0;
$cnt=mysql_num_rows($r);
if ($cnt==0) return;
print $TMPL["partstop"];
for ($i=0;$i<$cnt;$i++)
{
$num++;
if ($num==1)
print $TMPL["partsdelimtop"];
$template=$TMPL["partsbit"];
$template=str_replace("%CTITLE",mysql_result($r,$i,0),$template);
$template=str_replace("%CID",mysql_result($r,$i,1),$template);
$template=str_replace("%CCOUNT",mysql_result($r,$i,2),$template);
print $template;
if($num==$cat["rows"])
{
print $TMPL["partsdelimbottom"];
$num=0;
}
}
print $TMPL["partsbottom"];
}
$template=$TMPL["bmenu"];
$template=str_replace("%MODERATORSTEXT",$LANG["moderators"],$template);
$template=str_replace("%ADDLINKTEXT",$LANG["addlink"],$template);
$template=str_replace("%MAINTEXT",$LANG["main"],$template);
print $template;
$template=$TMPL["brokenscript"];
$template=str_replace("%YESTEXT",$LANG["yes"],$template);
$template=str_replace("%NOTEXT",$LANG["no"],$template);
$template=str_replace("%BROKENSURETEXT",$LANG["brokensure"],$template);
print $template;
$sform=$TMPL["searchform"];
$sform=str_replace("%SEARCHTEXT",$LANG["search"],$sform);
$sform=str_replace("%QUERYTEXT",$q,$sform);
print $sform;
if($error == false)
Show();
else
echo "