Cheetah
classifieds.php
Go to the documentation of this file.
1 <?php
2 
8 require_once( '../../../inc/header.inc.php' );
9 require_once(CH_DIRECTORY_PATH_INC . 'admin.inc.php');
10 
11 ch_import('ChWsbModuleDb');
12 require_once( CH_DIRECTORY_PATH_MODULES . 'cheetah/ads/classes/ChAdsModule.php');
13 
14 // --------------- page variables and login
15 
16 $_page['name_index'] = 151;
17 
18 check_logged();
19 
21 $aModule = $oModuleDb->getModuleByUri('ads');
22 
24 $oAds->sCurrBrowsedFile = ch_html_attribute($_SERVER['PHP_SELF']);
25 $_page['header'] = $oAds->GetHeaderString();
26 $_page['header_text'] = $oAds->GetHeaderString();
27 
28 $_ni = $_page['name_index'];
29 $_page_cont[$_ni]['page_main_code'] = PageCompAds($oAds);
30 
31 $oAds->_oTemplate->addCss(array('ads.css', 'categories.css', 'entry_view.css'));
32 
33 function PageCompAds($oAds)
34 {
35  $sRetHtml = '';
36 
37  $sRetHtml .= $oAds->PrintCommandForms();
38 
39  if ($_REQUEST) {
40 
41  if (false !== ch_get('action')) {
42 
43  switch(ch_get('action')) {
44  case '3':
45  echo $oAds->actionSearch();exit;
46  break;
47  case '2':
48  $iClassifiedSubID = (int)ch_get('FilterSubCat');
49  $sRetHtml .= $oAds->PrintSubRecords($iClassifiedSubID);
50  break;
51  case '1':
52  $iClassifiedID = (int)ch_get('FilterCat');
53  $sRetHtml .= $oAds->PrintAllSubRecords($iClassifiedID);
54  break;
55  case 'report':
56  $iCommentID = (int)ch_get('commentID');
57  print $oAds->GenReportSubmitForm($iCommentID);
58  exit();
59  case 'post_report':
60  print $oAds->ActionReportSubmit();
61  exit();
62 
63  case 'show_calendar':
64  $sRetHtml .= $oAds->GenAdsCalendar();
65  break;
66  case 'show_calendar_ads':
67  $sRetHtml .= $oAds->GenAdsByDate();
68  break;
69 
70  case 'show_featured':
71  $sRetHtml .= $oAds->GenAllAds('featured');
72  break;
73 
74  case 'show_categories':
75  $sRetHtml .= $oAds->genCategoriesBlock();
76  break;
77 
78  case 'show_all_ads':
79  $sRetHtml .= $oAds->GenAllAds();
80  break;
81  case 'show_popular':
82  $sRetHtml .= $oAds->GenAllAds('popular');
83  break;
84  case 'show_top_rated':
85  $sRetHtml .= $oAds->GenAllAds('top');
86  break;
87 
88  case 'my_page':
89  $sRetHtml .= $oAds->GenMyPageAdmin();
90  break;
91 
92  case 'tags':
93  $sRetHtml .= $oAds->GenTagsPage();
94  break;
95 
96  }
97 
98  } elseif ((false !== ch_get('bClassifiedID') && (int)ch_get('bClassifiedID') > 0) || (false !== ch_get('catUri') && ch_get('catUri')!='')) {
99  $iClassifiedID = ((int)ch_get('bClassifiedID') > 0) ? (int)ch_get('bClassifiedID') : (int)db_value("SELECT `ID` FROM `{$oAds->_oConfig->sSQLCatTable}` WHERE `CEntryUri`='" . process_db_input(ch_get('catUri'), CH_TAGS_STRIP) . "' LIMIT 1");
100  if ($iClassifiedID > 0) {
101  $sRetHtml .= $oAds->PrintAllSubRecords($iClassifiedID);
102  }
103  } elseif ((false !== ch_get('bSubClassifiedID') && (int)ch_get('bSubClassifiedID') > 0) || (false !== ch_get('scatUri') && ch_get('scatUri')!='')) {
104  $iSubClassifiedID = ((int)ch_get('bSubClassifiedID') > 0) ? (int)ch_get('bSubClassifiedID') : (int)db_value("SELECT `ID` FROM `{$oAds->_oConfig->sSQLSubcatTable}` WHERE `SEntryUri`='" . process_db_input(ch_get('scatUri'), CH_TAGS_STRIP) . "' LIMIT 1");
105  if ($iSubClassifiedID > 0) {
106  $sRetHtml .= $oAds->PrintSubRecords($iSubClassifiedID);
107  }
108  } elseif ((false !== ch_get('ShowAdvertisementID') && (int)ch_get('ShowAdvertisementID')>0) || (false !== ch_get('entryUri') && ch_get('entryUri')!='')) {
109  $iID = ((int)ch_get('ShowAdvertisementID') > 0) ? (int)ch_get('ShowAdvertisementID') : (int)db_value("SELECT `ID` FROM `{$oAds->_oConfig->sSQLPostsTable}` WHERE `EntryUri`='" . process_db_input(ch_get('entryUri'), CH_TAGS_STRIP) . "' LIMIT 1");
110  $oAds->ActionPrintAdvertisement($iID);
111 
112  ch_import('PageView', $oAds->_aModule);
113  $oAPV = new ChAdsPageView($oAds, $iID);
114  $sRetHtml .= $oAPV->getCode();
115 
116  } elseif (false !== ch_get('UsersOtherListing')) {
117  $iProfileID = (int)ch_get('IDProfile');
118  if ($iProfileID > -1) {
119  $sRetHtml .= $oAds->getMemberAds($iProfileID);
120  }
121  }
122  //non safe functions
123  elseif (false !== ch_get('DeleteAdvertisementID')) {
124  $id = (int)ch_get('DeleteAdvertisementID');
125  if ($id > 0) {
126  $sRetHtml .= $oAds->ActionDeleteAdvertisement($id);
127  $sRetHtml .= $oAds->GenMyPageAdmin('manage');
128  }
129  } elseif (false !== ch_get('ActivateAdvertisementID')) {
130  $iAdID = (int)ch_get('ActivateAdvertisementID');
131  if ($iAdID > 0 && ($oAds->bAdminMode || isModerator($oAds->_iVisitorID))) {
132  $sStatus = ch_get('ActType') == 'active' ? 'active' : 'inactive';
133  $oAds->_oDb->setPostStatus($iAdID, $sStatus);
134  $oAds->ActionPrintAdvertisement($iAdID);
135 
136  ch_import('PageView', $oAds->_aModule);
137  $oAPV = new ChAdsPageView($oAds, $iAdID);
138  $sRetHtml .= $oAPV->getCode();
139  }
140  } elseif (false !== ch_get('BuyNow')) {
141  $advId = (int)ch_get('IDAdv');
142  if ($advId > 0) {
143  $sRetHtml .= $oAds->ActionBuyAdvertisement($advId);
144  }
145  } elseif (false !== ch_get('BuySendNow')) {
146  $advId = (int)ch_get('IDAdv');
147  if ($advId > 0) {
148  $sRetHtml .= $oAds->ActionBuySendMailAdvertisement($advId);
149  }
150  } else {
151  $sRetHtml .= $oAds->getAdsMainPage();
152  }
153  } else {
154  $sRetHtml .= $oAds->getAdsMainPage();
155  }
156 
157  return $sRetHtml;
158 }
159 
160 if ($oAds->_iVisitorID) {
161  $aOpt = array('only_menu' => 1);
162  $GLOBALS['oTopMenu']->setCustomSubActions($aOpt, 'ch_ads', true);
163 }
164 
165 PageCode($oAds->_oTemplate);
process_db_input
process_db_input($sText, $iStripTags=0)
Definition: utils.inc.php:256
PageCompAds
PageCompAds($oAds)
Definition: classifieds.php:33
check_logged
check_logged()
Definition: admin.inc.php:238
$aModule
$aModule
Definition: classifieds.php:21
$_ni
$_ni
Definition: classifieds.php:28
$oAds
$oAds
Definition: classifieds.php:23
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
ch_get
ch_get($sName)
Definition: utils.inc.php:1664
php
ChWsbModuleDb
Definition: ChWsbModuleDb.php:12
$_page
$_page['name_index']
Definition: classifieds.php:16
isModerator
isModerator($iId=0)
Definition: profiles.inc.php:58
ch_html_attribute
ch_html_attribute($mixedInput)
Definition: utils.inc.php:1324
exit
exit
Definition: cart.php:21
$oModuleDb
$oModuleDb
Definition: classifieds.php:20
$_REQUEST
$_REQUEST['action']
Definition: cmd.php:11
PageCode
PageCode($oTemplate=null)
Definition: design.inc.php:91
CH_TAGS_STRIP
const CH_TAGS_STRIP
Definition: utils.inc.php:22
ChAdsModule
Definition: ChAdsModule.php:109
db_value
db_value($query, $bindings=[], $error_checking=true, $index=0)
Definition: db.inc.php:98
$_page_cont
$_page_cont[$_ni]['page_main_code']
Definition: classifieds.php:29
$sStatus
$sStatus
Definition: actions.inc.php:11
ChAdsPageView
Definition: ChAdsPageView.php:11
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10