-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathcategory.php
More file actions
112 lines (99 loc) · 3.73 KB
/
category.php
File metadata and controls
112 lines (99 loc) · 3.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/**
* Silurus Classifieds Builder
*
*
* @author SnowHall - http://snowhall.com
* @website http://snowhall.com/silurus
* @email support@snowhall.com
*
* @version 2.0
* @date March 7, 2013
*
* Silurus is a professionally developed PHP Classifieds script that was built for you.
* Whether you are running classifieds for autos, motorcycles, bicycles, rv's, guns,
* horses, or general merchandise, our product is the right package for you.
* It has template system and no limit to usage with free for any changes.
*
* Copyright (c) 2009-2013
*/
include("./include_php/init.php");
include("./include_php/TemplVotingView.php");
$oVotingView = new TemplVotingView ('gvoting', 0);
if(intval($_REQUEST['ID']) > 0)
{
$categ = mysql_fetch_assoc(mysql_query("select * from StoreCategories where ID=".intval($_REQUEST['ID'])));
}
$q = mysql_query("select * from StoreCategories where Type=0 order by Title");
$rel_categ = array();
while($arr = mysql_fetch_assoc($q))
{
$rel_categ[$arr['ID']] = $arr;
}
$curUrl = 'category.php?';
$smarty->assign("rel_categ", $rel_categ);
$smarty->assign("cur_url", $curUrl);
if(is_array($_GET) && count($_GET)>0)
{
foreach($_GET as $key=>$value)
if ($key != 'border' && $key != 'bdesc')
$curUrl .= "$key=$value&";
}
$order = (isset($_REQUEST['border'])?$_REQUEST['border']:'title');
$desc = (isset($_REQUEST['bdesc'])?true:false);
$books = array('order'=>$order, 'desc'=>$desc, 'cur_url'=>$curUrl, 'prefix'=>'b', 'list'=>array());
if($order == 'date') {$order = 's.date';}
elseif($order == 'price') {$order = 's.price';}
elseif($order == 'quality') {$order = 'c.Title';}
else {$order = 's.Title';}
if(isset($_REQUEST['bdesc'])) $order .= ' desc ';
$featured = 's.featured DESC, s.featured_date DESC';
$iDivis = 10;
$iCurr = 1;
if (!isset($_REQUEST['commPage']))
{
$sLimit = ' LIMIT 0,'.$iDivis;
}
else
{
if($_REQUEST['commPage']<=0) $_REQUEST['commPage'] = 1;
$iCurr = (int)$_REQUEST['commPage'];
$sLimit = ' LIMIT '.($iCurr - 1)*$iDivis.','.$iDivis;
}
$sQuery = ("select s.*,c.Title as ctitle from Store s inner join StoreCategories c on c.ID=s.categoryID where ".($_SESSION['location']['condition']!=''?'s.userID in '.$_SESSION['location']['condition'].' and ':'')." s.type=0 and s.status=0 ".(intval($_REQUEST['ID'])>0?'and categoryID='.$_REQUEST['ID']:'')." order by $featured, $order ");
$rElems = mysql_query( $sQuery );
$iNums = mysql_num_rows($rElems);
$count = (int)($iNums/$iDivis);
if(($iNums/$iDivis) > (int)($iNums/$iDivis)) $count++;
$aPaging = ($iNums > $iDivis ? MakePaging($iNums,$iCurr,$iDivis,4,'commPage','') : '');
$rElems = mysql_query( $sQuery.$sLimit );
while($book = mysql_fetch_assoc($rElems))
{
if($color == 'f5f5f5') $color = 'ffffff'; else $color = 'f5f5f5';
$temp = array();
$temp['Color'] = $color;
$temp['ID'] = $book['ID'];
$temp['url'] = 'javascript:void(0);" onclick="show_book_info(\''.$book['ID'].'\',this,\'1\')';
$temp['Title'] = htmlspecialchars($book['Title']);
$temp['Date'] = date("F jS, Y",$book['date']);
$temp['Price'] = number_format($book['price'],2,".","");
$temp['Vote'] = $vote1;
$temp['ctitle'] = $book['ctitle'];
$temp['featured'] = $book['featured'];
$books['list'][] = $temp;
}
$smarty->assign("sbooks", $books);
$smarty->assign("aPaging", $aPaging);
$contact_type = 1;
include("./ap_contact.php");
$HEADERTEXT='Products for Sale';
addNavigation('category.php',$HEADERTEXT);
if(isset($categ['Title']))
{
addNavigation('',$categ['Title']);
$HEADERTEXT = $categ['Title'].' :: '.$HEADERTEXT;
}
$smarty->assign("site_title", $HEADERTEXT." :: ".$gConfig['site_title']);
$smarty->assign("HEADERTEXT", $HEADERTEXT);
show_smarty_template('catalog');
?>