// --------------------------------------------------------------------------
//
// Esvon Classifieds v.2.7
// Copyright(C), Esvon LLC, 2001-2003, All Rights Reserved.
// E-mail: products@esvon.com
//
// All forms of reproduction, including, but not limited to, internet posting,
// printing, e-mailing, faxing and recording are strictly prohibited.
// One license required per site running Esvon Classifieds.
// To obtain a license for using Esvon Classifieds, please register at
// http://www.esvon.com/index.php?pg=products&subpg=p_classifieds
//
// 09-Jul-2003
//
// --------------------------------------------------------------------------
require './inc/application.php';
require './inc/class.categ_tree.php';
hwRealm('U_BROWSE_CATS');
if(!$cat) $cat = 0;
$o_cat = new HawkCategory(TBL_CAT,TBL_AD,'catid');
$o_cat->COL_NUM = 2;
$o_cat->HIDE_ZERO = FALSE;
$o_cat->NO_IMAGE = 'img/no_image.gif';
$HW_FILTER_SQL = hwFilterGetSQL();
$ql = 'AND approved="1"'.$HW_FILTER_SQL;
if(EN_EXP_DATE) $ql.=' AND exp_date>=NOW()';
$o_cat->SQL_AMT = $ql;
$o_cat->CAT_F = 'image,descr';
$o_cat->CAT_ORDER = 'weight,name';
$o_cat->TPL_SHOW = FALSE;
$buf = $o_cat->GetBrowsePage(TPL_PATH.'browse.htm',$cat,TRUE);
if($buf===FALSE){
header('Location: search.php?cid='.$cat.'&s_res=AND');
exit;
}
$parse_vars = '$hw_dummy';
// Last 10 Ads
$tpl = new HawkTpl;
$tpl->InitArray('last,featured');
$ql = "SELECT *,$TITLE_FIELD AS l_title,
DATE_FORMAT(date,'".DATE_FMT."') AS l_date
FROM ".TBL_AD." WHERE approved='1'".$HW_FILTER_SQL;
if($cat){
$hw_ql_cat = get_daughter_cats($cat);
$ql.=' AND catid IN ('.$hw_ql_cat.')';
}
if(EN_EXP_DATE) $ql.=' AND exp_date>=NOW()';
$ql.=' ORDER by updated DESC LIMIT 0,10';
$res = $db->query($ql);
while($v = $db->fetch_assoc($res)) {
$z = $O_LFS->FillCustomFieldsArray($v);
if($v['images']){
//list($v['images'])=explode("\n",$v['images']);
$v['images']='../../img/photo.gif';
$v['images'] = '
';
}
$z['l_title'] = $v['l_title'];
$z['l_date'] = $v['l_date'];
$z['l_id'] = $v['link_id'];
$z['l_img'] = $v['images'];
$tpl->AddCell('last',$z);
}
// featured start
if(FEAT_HOME>0){
define('F_COLS_NUM',4);
$feat_num = F_COLS_NUM;
$feat_w = intval(100/$feat_num);
$parse_vars.=',$feat_num,$feat_w';
$cur_i=0;
$ql = 'SELECT * FROM '.TBL_AD.' WHERE pick="1"'.$HW_FILTER_SQL;
if(EN_EXP_DATE) $ql.=' AND exp_date>=NOW()';
if($cat) $ql.=' AND catid IN ('.$hw_ql_cat.')';
$z = Rand_Sel($ql,FEAT_HOME);
foreach($z as $v){
if($v['images']) list($v['images']) = explode("\n",$v['images']);
else $v['images'] = '../../img/no_image.gif';
$tpl->AddCell('featured',$O_LFS->FillCustomFieldsArray($v));
$cur_i++;
if($cur_i>=F_COLS_NUM){
$cur_i=0;
$tpl->AddCell('featured','','br');
}
}
while($cur_iAddCell('featured','','blank');
$cur_i++;
}
}
// featured end
$tpl->SetBuf($buf);
$title = $cat ? GetCatPathCached($cat) : ucfirst($A_LNG['browse']);
$cid = $cat;
ShowHeader();
$tpl->Parse('',$parse_vars,TRUE);
ShowFooter();
?>