/********************************************************* * DO NOT REMOVE * Project: PHP Weby directory software version 1.2 Url: http://phpweby.com Copyright: (C) 2009 Blagoj Janevski - bl@blagoj.com Project Manager: Blagoj Janevski For help, comments, feedback, discussion ... please join our Webmaster forums - http://forums.phpweby.com License------------------------------------------------: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. End License---------------------------------------------- *********************************************************/ require_once('jadro/base.php'); definevars("where id='LINK_NEW_WINDOW' or id='META_CATEGORY_DESCRIPTION' or id='RSS_ENABLE' or id='CATEGORY_DESCRIPTION' or id='META_DESC' or id='REWRITE_ENABLED' or id='SITE_DESC' or id='LINKS_PER_PAGE_TOP' or id='CATEGS_PER_COLUMN' or id='FRONT_SUBCATEGS_PER_COLUMN' or id='SUBCATEGS_PER_COLUMN' or id='LINKS_PER_PAGE' or id='FEAT_PER_CAT' or id='SHOW_LATEST_LINKS' or id='SHOW_PREMIUM_LINKS' or id='ENABLE_NUMLINKS' or id='ITEM_DEFAULT_ORDER'"); require_once('jadro/redircat.php'); if(PHPLD=='0') { require_once('jadro/smartyfunc.php'); $categoryid=''; $uri=rawurlencode($_GET['uri']); $uri=str_replace('%2F','/',$uri); $sq=''; if($_GET['c']!='') $sq="SELECT id,info,catpath,catname,chid,meta_desc from categories where id='" . intval($_GET['c']) . "'"; if($uri!='') $sq="SELECT id,info,catpath,catname,chid,meta_desc from categories where catpath='" . $uri . "'"; if($sq!='') { $rez=$db->Execute($sq); if(!$rez->EOF) { $row=$rez->FetchRow(); $categoryid=$row['id']; if(REWRITE_ENABLED==0) $smarty->assign('chid',$row['chid']); $smarty->assign('info',$row['info']); $smarty->assign('categoryid',$row['id']); if(META_CATEGORY_DESCRIPTION==1 && $_GET['p']=='') $smarty->assign('meta_description',$row['meta_desc']); if(CATEGORY_DESCRIPTION==1 && $_GET['p']=='') $smarty->assign('category_description',$row['info']); $smarty->assign('uri',$row['catpath']); $smarty->assign('catname',$row['catname']); unset($row); } $rez->Close(); unset($rez); } if($uri!='' && $categoryid=='') { @header('HTTP/1.1 301 Moved Permanently'); @header('Location: ' . SITE_URL); die(); } if($categoryid=='' && $_GET['l']=='' && $_GET['pm']=='') { $smarty->assign('categs_per_col',CATEGS_PER_COLUMN); $sq="SELECT catname,id,catpath,numlinks from categories where parrentcatid='0' order by catname"; $rez=$db->Execute($sq); $cats=array(); while(!$rez->EOF) { $red=$rez->FetchRow(); $subcats=array(); $sq="SELECT catname,id,catpath from categories where parrentcatid='" . $red['id'] ."' order by catname limit 0," . FRONT_SUBCATEGS_PER_COLUMN; $rez1=$db->Execute($sq); while(!$rez1->EOF) { $red2=$rez1->FetchRow(); $subcats[]=array('catname'=>$red2['catname'],'id'=>$red2['id'],'catpath'=>$red2['catpath']); } $rez1->Close(); $cats[]=array('id'=>$red['id'],'catname'=>$red['catname'],'subcats'=>$subcats,'catpath'=>$red['catpath'],'numlinks'=>$red['numlinks']); unset($subcats); } $rez->Close(); $smarty->assign('meta_description',META_DESC); $smarty->assign('site_desc',SITE_DESC); $smarty->assign('categories',$cats); unset($cats,$red,$red2,$rez,$rez1); } else { $list=htmlspecialchars_m($_GET['l']); $links_per_page=$br=LINKS_PER_PAGE; $feat_per_cat=FEAT_PER_CAT; if($br=='') $feat_per_cat=$links_per_page=$br='10'; $smarty->assign('sort',$list); switch($list) { case 'A': { $order='caption'; break; } case 'H': { $order='hits'; break; } case 'P': { $order='pr'; break; } case 'l': { $order='id desc'; $smarty->assign('catname','Latest links'); break; } default: { $order=ITEM_DEFAULT_ORDER; break; } } if($categoryid!='') { $_GET['p']=(int) $_GET['p']; if($_GET['p']=='' || $_GET['p']==0) $_GET['p']=1; if($_GET['p']<2) { $smarty->assign('categs_per_col',SUBCATEGS_PER_COLUMN); $sq="SELECT catpath,id,info,catname,numlinks from categories where parrentcatid='" . $categoryid . "' order by catname"; $rez=$db->Execute($sq); $subcats=array(); while(!$rez->EOF) { $red=$rez->FetchRow(); $subcats[]=array('id'=>$red['id'],'catname'=>$red['catname'],'catpath'=>$red['catpath'],'numlinks'=>$red['numlinks']); } $smarty->assign('categories',$subcats); $rez->Close(); unset($subcats,$rez); } $sq="SELECT count(*) from link where featured='0' and approved='yes' and categoryid='" . $categoryid . "'"; $o_links=$db->GetOne($sq); $sq="SELECT count(*) from link where featured='1' and approved='yes' and categoryid='" . $categoryid . "'"; $num_splinks=$db->GetOne($sq); $br=($_GET['p']-1)*$br; $sq="SELECT id,sitedesc,url,caption from link where featured='1' and approved='yes' and categoryid='$categoryid' order by $order limit 0,$feat_per_cat"; $linkovi=$db->GetAll($sq); $smarty->assign('featlinks',$linkovi); $sq="SELECT id,sitedesc,url,caption from link where featured='0' and approved='yes' and categoryid='$categoryid' order by $order limit $br,$links_per_page"; $linkovi=$db->GetAll($sq); $smarty->assign('links',$linkovi); $smarty->assign('linksperpage',$links_per_page); $smarty->assign('numfeatlinks',$num_splinks); $smarty->assign('numlinks',$o_links); $smarty->assign('page',$_GET['p']); unset($linkovi,$o_links,$links_per_page,$num_splinks); } else { if($_GET['pm']=='') { $sq="SELECT id,sitedesc,url,caption from link where approved='yes' order by $order limit 0," . LINKS_PER_PAGE_TOP; $linkovi=$db->GetAll($sq); $smarty->assign('links',$linkovi); $smarty->assign('numlinks',count($linkovi)); } elseif($_GET['pm']!='') { $sq="SELECT id,sitedesc,url,caption from link where featured='1' and approved='yes' order by id desc limit 0," . LINKS_PER_PAGE_TOP; $linkovi=$db->GetAll($sq); $smarty->assign('catname','Premium listings'); $smarty->assign('featlinks',$linkovi); $smarty->assign('numlinks',count($linkovi)); } unset($linkovi); } } } else require_once('jadro/phpld_comp.php'); $smarty->display('main.tpl');