=")) $ob=TRUE; else $ob=FALSE; if ($ob) {ob_start();ob_implicit_flush(0);} require "config.php"; require "lang/".$LANGFILE; if ($ob) {ob_clean();ob_implicit_flush(1);} if (is_file("install.php")) die($LANG["remove_install"]); $o=$_GET["o"]; $w=$_GET["w"]; $c=GetCatID($w); $p=intval($_GET["p"]); $defaultorder=intval($cat["defaultorder"]); if ($defaultorder<0 || $defaultorder>3) $defaultorder=0; if (($o<0 && $o>3) || !isset($o)) $o=$defaultorder; if ($c!=0) { $r=mysql_query("SELECT cid FROM ".$db["prefix"]."cat WHERE cid='$c';") or die(mysql_error()); // if (mysql_num_rows($r)==0 || strrpos($_SERVER['REQUEST_URI'],"?") ) { if (mysql_num_rows($r)==0) { header("HTTP/1.1 404 Not Found"); include ("./404.html"); exit(); } if (strrpos($_SERVER['REQUEST_URI'],"?") && !strpos($_SERVER['REQUEST_URI'],"?p=")) { header("HTTP/1.1 404 Not Found"); include ("./404.html"); exit(); } } $r=mysql_query("SELECT name,html FROM ".$db["prefix"]."templates;") or die(mysql_error()); while ($a=mysql_fetch_assoc($r)) $TMPL[$a["name"]]=$a["html"]; function GetCatID($pth, $parent=0) { GLOBAL $db; //list ($catname, $pth) = explode("/", $pth, 2); if ($pth != '') { list ($catname, $other) = explode("/", $pth, 2); $r = mysql_query(" SELECT cid FROM ".$db["prefix"]."cat WHERE pname='$catname' AND parent='$parent' ") or die(mysql_error()); //print "catname=[".$catname."]"; //print"
"; //print "other=[".$other."]"; //print"
"; if (mysql_num_rows($r) != 1) { header("HTTP/1.1 404 Not Found"); include ("./404.html"); exit; } $cid=mysql_result($r,0); $parent=GetCatID($other, $cid); //print "parent=".$parent; //print"
"; //print "cid=".$cid; //print"
"; } return $parent; } function ShowParts($cid) { GLOBAL $cat,$TMPL,$db; $r=mysql_query("SELECT c.name,c.cid,c.count,cl.pname FROM ".$db["prefix"]."cat AS c,".$db["prefix"]."cat_linear AS cl WHERE c.parent='$cid' AND c.cid=cl.cid ORDER BY name") 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); $template=str_replace("%CPATH",mysql_result($r,$i,3),$template); print $template; if ($num==$cat["rows"]) {print $TMPL["partsdelimbottom"];$num=0;} } print $TMPL["partsbottom"]; } function ShowCat($cid,$best=0) { GLOBAL $p,$pp,$o,$LANG,$TMPL,$db; if ($best==1) $bestsql="AND moder_vote=10"; else $bestsql="AND moder_vote!=10"; if ($o==0) $order="ORDER BY gin DESC,gout DESC"; if ($o==1) $order="ORDER BY title"; if ($o==2) $order="ORDER BY moder_vote DESC, gout DESC"; if ($o==3) $order="ORDER BY insert_date DESC"; if ($cid!=0) $Q="SELECT lid,url,title,description,gin,gout,moder_vote,resfield1,resfield2,resfield3 FROM ".$db["prefix"]."main WHERE type=1 $bestsql AND cat1=$cid $order LIMIT ".($p*$pp).",$pp;"; else $Q="SELECT lid,url,title,description,gin,gout,moder_vote,resfield1,resfield2,resfield3 FROM ".$db["prefix"]."main WHERE type=1 $bestsql $order LIMIT ".($p*$pp).",$pp;"; $r=mysql_query($Q) or die(mysql_error()); $cnt=mysql_num_rows($r); if ($cnt==0 && $best!=1) print "".$LANG["linksnotfound"].""; while ($ar=mysql_fetch_array($r)) { $admin=""; if ($_SESSION["cncatsid"]=="thisissomestring") { $admin.="(".$ar["gin"]."/".$ar["gout"].")/".$ar["moder_vote"]." [".$LANG["edit"]."]"; $admin.="[".$LANG["delete"]."] ["; for ($j=1;$j<11;$j++) { if ($j==$ar["moder_vote"]) $admin.="".$j." "; else $admin.="".$j." "; } $admin.="] [x]"; $admin.=" [D]"; } $template=($best==1)?$TMPL["bestlinksbit"]:$TMPL["linksbit"]; $template=str_replace("%ID",$ar["lid"],$template); $template=str_replace("%TITLE",$ar["title"],$template); $template=str_replace("%GIN",$ar["gin"],$template); $template=str_replace("%GOUT",$ar["gout"],$template); $template=str_replace("%MODERVOTE",$ar["moder_vote"],$template); $template=str_replace("%DESC",$ar["description"],$template); $template=str_replace("%URL",$ar["url"],$template); $template=str_replace("%BEST","",$template); $template=str_replace("%BROKENTEXT",$LANG["broken"],$template); $template=str_replace("%RESFIELD1",$ar["resfield1"],$template); $template=str_replace("%RESFIELD2",$ar["resfield2"],$template); $template=str_replace("%RESFIELD3",$ar["resfield3"],$template); $template=str_replace("%ADMINIFACE",$admin,$template); print $template; } if ($best!=1) { if ($cid!=0) return(mysql_result(mysql_query("SELECT count(*) FROM ".$db["prefix"]."main WHERE type=1 $bestsql AND cat1=$cid;"),0,0)); else return(mysql_result(mysql_query("SELECT count(*) FROM ".$db["prefix"]."main WHERE type=1 $bestsql;"),0,0)); } } $pp=10; //items per page $cid=$c;$l=""; do { $r=mysql_query("SELECT c.parent,c.name,c.cid,cl.pname FROM ".$db["prefix"]."cat as c,".$db["prefix"]."cat_linear as cl WHERE c.cid='$cid' AND cl.cid='$cid';") or die(mysql_error()); if (mysql_num_rows($r)==1) { $id=mysql_result($r,0,2); $pnm=mysql_result($r,0,3); $title=mysql_result($r,0,1); if ($cid==$c) $l=mysql_result($r,0,1).$l; else $l="".$title." » ".$l; $cid=mysql_result($r,0,0); } else $cid=0; } while ($cid!=0); $r=mysql_query("SELECT name FROM ".$db["prefix"]."cat WHERE cid='$c';") or die(mysql_error()); if (mysql_num_rows($r)!=0) $title=mysql_result($r,0,0)." - ".$CATNAME; else $title=$MAINCATNAME; include "_top.php"; $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; if ($_SESSION["cncatsid"]=="thisissomestring") { $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; $template=$TMPL["directscript"]; $template=str_replace("%YESTEXT",$LANG["yes"],$template); $template=str_replace("%NOTEXT",$LANG["no"],$template); $template=str_replace("%DIRECTSURETEXT",$LANG["directsure"],$template); print $template; } //print "PHP_SELF=".$_SERVER['PHP_SELF']; //print "
"; //print "REQUEST_URI=".$_SERVER['REQUEST_URI']; //print "
"; //print "QUERY_STRING=".strpos($_SERVER['REQUEST_URI'],"?z"); //print "
"; //print "ww=".$w; //print "
"; //$mytmp=GetCatID($c); //print "mytmp=".$mytmp; //print "
"; $sform=$TMPL["searchform"]; $sform=str_replace("%SEARCHTEXT",$LANG["search"],$sform); $sform=str_replace("%QUERYTEXT",$q,$sform); $sform=str_replace("%ADDLINKTEXT",$LANG["addlink"],$sform); print $sform; $template=$TMPL["catname"]; $template=str_replace("%MAINTEXT",$CATNAME,$template); $template=str_replace("%OTHERTEXT",$l,$template); print $template; ShowParts($c); if ($cat["showorder"]==1) { if ($o==0) $sortbypop="".$LANG["popuarity"].""; else $sortbypop="".$LANG["popuarity"].""; if ($o==1) $sortbytitle="".$LANG["title"].""; else $sortbytitle="".$LANG["title"].""; if ($o==2) $sortbymoder="".$LANG["modervote"].""; else $sortbymoder="".$LANG["modervote"].""; if ($o==3) $sortbyin="".$LANG["sortbyin"].""; else $sortbyin="".$LANG["sortbyin"].""; $template=$TMPL["sortby"]; $template=str_replace("%SORTBYPOP",$sortbypop,$template); $template=str_replace("%SORTBYTITLE",$sortbytitle,$template); $template=str_replace("%SORTBYMODER",$sortbymoder,$template); $template=str_replace("%SORTBYIN",$sortbyin,$template); $template=str_replace("%SORTBYTEXT",$LANG["sortby"],$template); print $template; } if (intval($c)==0 && $cat["shownew"]==1) { $newlinkstop=$TMPL["newlinkstop"]; $newlinkstop=str_replace("%NEWLINKSTEXT",$LANG["newlinks"],$newlinkstop); print $newlinkstop; $r=mysql_query("SELECT lid,title,description,resfield1,resfield2,resfield3 FROM ".$db["prefix"]."main WHERE type=1 ORDER by lid DESC LIMIT ".$cat["shownewcount"].";"); while ($ar=mysql_fetch_array($r)) { if (strlen($ar["description"])>75) $ar["description75"]=substr($ar["description"],0,75)."..."; else $ar["description75"]=$ar["description"]; $template=$TMPL["newlinkstbit"]; $template=str_replace("%ID",$ar["lid"],$template); $template=str_replace("%TITLE",$ar["title"],$template); $template=str_replace("%GIN",$ar["gin"],$template); $template=str_replace("%GOUT",$ar["gout"],$template); $template=str_replace("%MODERVOTE",$ar["moder_vote"],$template); $template=str_replace("%DESC75",$ar["description75"],$template); $template=str_replace("%DESC",$ar["description"],$template); $template=str_replace("%URL",$ar["url"],$template); $template=str_replace("%RESFIELD1",$ar["resfield1"],$template); $template=str_replace("%RESFIELD2",$ar["resfield2"],$template); $template=str_replace("%RESFIELD3",$ar["resfield3"],$template); print $template; } print $TMPL["newlinkstbottom"]; } if ($cat["linksatmain"]==1 || $c!=0) { print $TMPL["linkstop"]; ShowCat($c,1); print str_replace("%NUM",(1+$p*$pp),$TMPL["linksmiddle"]); $total=ShowCat($c); print $TMPL["linksbottom"]; print "

".$LANG["linkcount"].": $total

"; } if ($total>$pp) { print "
"; if ($p!=0) print "<< | "; else print "<< | "; $sstart=$p*pp-60; if ($sstart<0) $sstart=0; $send=$p*pp+60;if ($send>$total) $send=$total; for ($i=$sstart;$i<$send;$i+=$pp) { if ($p*$pp==$i) print "".($i/$pp+1).""; elseif ($i==0) print "".($i/$pp+1).""; else print "".($i/$pp+1).""; print " | "; } if ($p*$pp==$i-$pp) print ">>"; else print ">>"; print "
"; } //if($_SERVER['REQUEST_URI'] == '/') { $template=$TMPL["friends"]; $template=str_replace("%FRIENDS",$LANG["friends"],$template); $template=str_replace("%FRIENDTITLE",$LANG["friendtitle"],$template); print $template; } //$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; print $COPY; include "_bottom.php"; ?>