define(array( mpage => "main.html", mcol => "main_col.html" )); $cat = 0; $cols = $Smain_col; } else { $tpl->define(array( mpage => "submain.html", mcol => "sub_col.html" )); $cols = $Ssub_col; } $tpl->dyn_define ( "tdcol", "mpage" ); //===================================== // Get this Category config Data //===================================== $db->query("update {$Stb_name}_CAT set count = count+1 where sid = '$cat'"); $db->query("select * from {$Stb_name}_CAT where sid = '$cat'"); if (!$db->numrow) errmsg($l_error_nocat); $cat_row = $db->nrecord(); //===================================== // Main page head //===================================== $col_width = ceil(100 / $cols) . "%"; $tpl->assign(array( DOMAIN => $Sdomain, TEMPLATE => $Stemplate, CHARSET => $Scharset, BGCOLOR => $Sbgcolor, MWIDTH => $Smain_width, ALIGN => $Salign, SID => $cat, CWIDTH => $col_width )); //==================================== // Sub category data //==================================== // parent = $cat $db->query("select * from {$Stb_name}_CAT where parent = '$cat' order by title"); $total_row = $db->numrow; for ($i = 0; $i <$total_row ;$i++) { $row[$i] = $db->nrecord(); $temp_ar[$row[$i]["sid"]] = $i; } // pparent = $cat if ($cat_row[c_sub] == 2) { $db->query("select sid,parent,title,relate from {$Stb_name}_CAT where pparent='$cat' order by parent,title"); while ($prow = $db->nrecord()) { $tsid = $temp_ar[$prow["parent"]]; if ($row[$tsid]["subnum"] < $Smain_sub_num) { $row[$tsid]["subnum"]++; $cat_sid = ($prow[relate]) ? $prow["relate"] : $prow["sid"]; $subsm[$tsid][] = " $prow[title] "; } } } //===================================== // Category Loop //===================================== $now_time = time(); // now timestamp for directory new mark for ($col=0; $col<$cols ; $col++) { $prev_col = ceil(count($row) * ($col / $cols )); $next_col = ceil(count($row) * (($col+1) / $cols )); for ($i = $prev_col; $i < $next_col; $i++ ) { // for directory new mark unset($dmark,$interval); if ($row[$i][bingo1]) { $interval = ceil( ($now_time - $row[$i][bingo1])/86400 ); if ($interval <=1) $dmark=""; elseif ($interval<=3) $dmark=""; elseif ($interval<=7) $dmark=""; else $dmark = ""; } // end directory new makr switch ($cat_row[c_sub]) { case 2 : $sm = @implode(", " ,$subsm[$i]);break; case 1 : $sm = $row[$i]["descript"]; break; default: $sm = ""; } if ($Smain_sub_num < $row[$i]["sub_cat"] && $cat_row["c_sub"]==2) $sm .="..."; if ($row[$i][relate]>0 ) { $row[$i]["title"] = "@".stripslashes($row[$i]["title"]); $row[$i]["sid"] = $row[$i]["relate"]; } $tmp=stripslashes($row[$i]["title"]); $newt=strtolower($tmp); $newtitle=ereg_replace(" ","_",$newt); $newtitle .= ".html"; $tpl->assign( array( CAT => $row[$i]["sid"], TITLE => stripslashes($row[$i]["title"]), NEWTITLE => $newtitle, DNEW => $dmark, SUBCAT => $row[$i]["sub_cat"], SUBLINK => $row[$i]["sub_link"], SM => $sm )); $tpl->parse("DROW",".mcol"); } $tpl->parse("TDCOL", ".tdcol"); $tpl->clear("DROW"); } //==================================== // LINK output part //==================================== if ($cat) { $tpl->define( array( link_row => "link_n.html")); $db->query("select count(*) as TotalLink from {$Stb_name}_LINK where parent='$cat'"); if ($db->numrow) $Trow = $db->nrecord(); $TotalLink = $Trow["TotalLink"]; $page_num = ceil($TotalLink / $Spagecut); $page = ($page) ? $page : 1; $vstart = $Spagecut * ($page-1); if ($Sorderpick) $pick_add = "c_pick desc,"; if (!$u_sort) $u_sort = $Ssort; if (!$u_order) $u_order = $Sorder; if ($Sordernew) { $newlink_time = time() - ( 7 * 86400 ); $new_add1 = ", uptime >= $newlink_time as newlink "; $new_add2 = " newlink desc,"; } $db->query("select sid,parent,pathtxt,title,url,name,email,scont,lcont,uptime,passwd," ."c_new,c_pick,count,visit,comment,upfile,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10," ."user1,user2,user3,user4,user5 $new_add1 from {$Stb_name}_LINK where " ."parent = '$cat' order by $new_add2 $pick_add $u_sort $u_order limit $vstart,$Spagecut") ; //============================ // Make Directbar button //============================ $cat_title = $cat_row["title"]; $$newt = strtolower($cat_title); $cat_title=ereg_replace(" ","_",$newt); $page_start = floor(($page-1)/ $Sdirectcut ) * $Sdirectcut ; $page_end = $page_start + $Sdirectcut; $np=$cat_title-sites-$next_p; $Skw='-sites'; $Stemplate2 = '../template/default'; for ($p=$page_start+2 ; ($p <= $page_end) && ($p <= $page_num) ; $p++ ) { if ($page == $p) $direct_bar .= "[$p]"; else $direct_bar .= "[$p]"; } if ($TotalLink > $vstart+$Spagecut ) { // Next button $next_p=$page+1; $next_list = " \n"; } if ($page>1) { // Prev button $prev_p=$page-1; if ($page!=2) {$prev_list=" \n";} else {$prev_list=" \n";} } //============================ // Link assign and make //============================ $cat_title = $cat_row["title"]; $cat_title = strtoupper($cat_title); $quot="'"; link_assign(); $num=0; while ($row = $db->nrecord()) { $link .= view_link($row); $num++; if ($num==10) { $link .= '
get access to several reality sites with ONE CHEAP MEMBERSHIP!!! DISCOUNT '.$cat_title.' REALITY SITES ...all here..
'; $num=1; } } } // if ($cat) //============================ // end if ($cat) //============================ else { $db->query("select count(*) as total from {$Stb_name}_CAT"); $t_catrow = $db->nrecord(); $db->query("select count(*) as total from {$Stb_name}_LINK"); $t_linkrow = $db->nrecord(); } //==================================== // Output Main page //==================================== show_menu($cat); show_here($cat_row["path"],$cat_row["pathtxt"]); // search bar $cat_count = $cat_row["count"]; $cat_path = $cat_row["path"]; if ($cat) { $total_cat = $total_row; $total_link = $TotalLink; show_search(1,1); show_linkbar(); $tpl->assign(array ( LINK => $link, PREV => $prev_list, DIRECT => $direct_bar, NEXT => $next_list )); $pagetitle = $cat_row["title"]; } else { $total_cat = $t_catrow["total"]; $total_link = $t_linkrow["total"]; show_search(1); if ($Stkword) show_tkword(5); if ($Sfmaillist) show_mailling(); $pagetitle = $Ssite_name; } if (!$cat_row["meta_key"]) $cat_row["meta_key"] = $cat_row["title"] ; $tpl->assign(array( SNAME => $pagetitle, CAT_HEADER => $cat_row["header"], CAT_FOOTER => $cat_row["footer"], META => $cat_row["meta_key"], PAGE_HEADER => implode("",file("$Stemplate/header.html")), PAGE_FOOTER => implode("",file("$Stemplate/footer.html")), MAIN_FOOTER => implode("",file("!main_cut.htm")) )); // index Language $tpl->assign(array( L_NOKWORD => $l_error_nokword, L_NOADDR => $l_noaddr )); $tpl->parse("MAIN","mpage"); $tpl->simprint("MAIN"); //==================================== // Eastablish Time //==================================== if ($Stime == "Y") check_time($time1); ?>