mambax7 /
adslight
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /* |
||
| 3 | ------------------------------------------------------------------------- |
||
| 4 | ADSLIGHT 2 : Module for Xoops |
||
| 5 | |||
| 6 | Redesigned and ameliorate By iluc user at www.frxoops.org |
||
| 7 | Started with the Classifieds module and made MANY changes |
||
| 8 | Website : http://www.limonads.com |
||
| 9 | Contact : [email protected] |
||
| 10 | ------------------------------------------------------------------------- |
||
| 11 | Original credits below Version History |
||
| 12 | ########################################################################## |
||
| 13 | # Classified Module for Xoops # |
||
| 14 | # By John Mordo user jlm69 at www.xoops.org and www.jlmzone.com # |
||
| 15 | # Started with the MyAds module and made MANY changes # |
||
| 16 | ########################################################################## |
||
| 17 | Original Author: Pascal Le Boustouller |
||
| 18 | Author Website : [email protected] |
||
| 19 | Licence Type : GPL |
||
| 20 | ------------------------------------------------------------------------- |
||
| 21 | */ |
||
| 22 | |||
| 23 | include_once __DIR__ . '/header.php'; |
||
| 24 | require XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php'; |
||
| 25 | |||
| 26 | $myts = MyTextSanitizer::getInstance(); |
||
| 27 | $module_id = $xoopsModule->getVar('mid'); |
||
| 28 | |||
| 29 | is_object($GLOBALS['xoopsUser']) ? $groups = $GLOBALS['xoopsUser']->getGroups() : $groups = XOOPS_GROUP_ANONYMOUS; |
||
| 30 | |||
| 31 | /** @var XoopsGroupPermHandler $gpermHandler */ |
||
| 32 | $gpermHandler = xoops_getHandler('groupperm'); |
||
| 33 | |||
| 34 | $perm_itemid = XoopsRequest::getInt('item_id', 0, 'POST'); |
||
| 35 | |||
| 36 | View Code Duplication | if (!$gpermHandler->checkRight('adslight_view', $perm_itemid, $groups, $module_id)) { |
|
| 37 | redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM); |
||
| 38 | } |
||
| 39 | |||
| 40 | (!$gpermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $module_id)) ? $prem_perm = '0' : $prem_perm = '1'; |
||
| 41 | |||
| 42 | include XOOPS_ROOT_PATH . '/modules/adslight/class/classifiedstree.php'; |
||
| 43 | //include XOOPS_ROOT_PATH . '/modules/adslight/class/utilities.php'; |
||
| 44 | $mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||
| 45 | |||
| 46 | # function index |
||
| 47 | ##################################################### |
||
| 48 | function index() |
||
| 49 | { |
||
| 50 | global $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsTpl, $myts, $mytree, $meta, $mid, $moduleDirName, $main_lang, $prem_perm, $xoopsModule; |
||
| 51 | $pathIcon16 = $xoopsModule->getInfo('icons16'); |
||
| 52 | |||
| 53 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_index.tpl'; |
||
| 54 | |||
| 55 | include XOOPS_ROOT_PATH . '/header.php'; |
||
| 56 | |||
| 57 | $xoopsTpl->assign('xmid', $xoopsModule->getVar('mid')); |
||
| 58 | $xoopsTpl->assign('add_from', _ADSLIGHT_ADDFROM . ' ' . $xoopsConfig['sitename']); |
||
| 59 | $xoopsTpl->assign('add_from_title', _ADSLIGHT_ADDFROM); |
||
| 60 | $xoopsTpl->assign('add_from_sitename', $xoopsConfig['sitename']); |
||
| 61 | $xoopsTpl->assign('only_pix', _ADSLIGHT_ONLYPIX); |
||
| 62 | $xoopsTpl->assign('adslight_logolink', _ADSLIGHT_LOGOLINK); |
||
| 63 | $xoopsTpl->assign('permit', $prem_perm); |
||
| 64 | |||
| 65 | $xoopsTpl->assign('xoops_module_header', '<link rel="stylesheet" href="' . XOOPS_URL . '/modules/adslight/assets/css/adslight.css" type="text/css" media="all" />'); |
||
| 66 | |||
| 67 | $banner = xoops_getbanner(); |
||
| 68 | $xoopsTpl->assign('banner', $banner); |
||
| 69 | $xoopsTpl->assign('use_extra_code', $GLOBALS['xoopsModuleConfig']['adslight_use_index_code']); |
||
| 70 | $xoopsTpl->assign('adslight_use_banner', $GLOBALS['xoopsModuleConfig']['adslight_use_banner']); |
||
| 71 | $xoopsTpl->assign('index_extra_code', $GLOBALS['xoopsModuleConfig']['adslight_index_code']); |
||
| 72 | $xoopsTpl->assign('index_code_place', $GLOBALS['xoopsModuleConfig']['adslight_index_code_place']); |
||
| 73 | $xoopsTpl->assign('category_title2', _ADSLIGHT_ANNONCES); |
||
| 74 | // adslight 2 |
||
| 75 | $xoopsTpl->assign('adslight_active_menu', $GLOBALS['xoopsModuleConfig']['adslight_active_menu']); |
||
| 76 | $xoopsTpl->assign('adslight_active_rss', $GLOBALS['xoopsModuleConfig']['adslight_active_rss']); |
||
| 77 | |||
| 78 | // ExpireAd(); |
||
| 79 | AdslightUtilities::expireAd(); |
||
| 80 | |||
| 81 | if ($GLOBALS['xoopsUser']) { |
||
| 82 | $member_usid = $GLOBALS['xoopsUser']->getVar('uid'); |
||
| 83 | if ($usid = $member_usid) { |
||
| 84 | $xoopsTpl->assign('istheirs', true); |
||
| 85 | |||
| 86 | list($show_user) = $xoopsDB->fetchRow($xoopsDB->query('SELECT SQL_CACHE COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE usid='" . $member_usid . "'")); |
||
| 87 | |||
| 88 | $xoopsTpl->assign('show_user', $show_user); |
||
| 89 | $xoopsTpl->assign('show_user_link', 'members.php?usid=' . $member_usid); |
||
| 90 | } |
||
| 91 | } |
||
| 92 | |||
| 93 | $result = $xoopsDB->query('SELECT SQL_CACHE COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE valid="No"'); |
||
| 94 | list($propo) = $xoopsDB->fetchRow($result); |
||
| 95 | |||
| 96 | if ($propo > 0) { |
||
| 97 | $xoopsTpl->assign('moderated', true); |
||
| 98 | } |
||
| 99 | if ($GLOBALS['xoopsUser']) { |
||
| 100 | if ($GLOBALS['xoopsUser']->isAdmin()) { |
||
| 101 | $xoopsTpl->assign('admin_block', _ADSLIGHT_ADMINCADRE); |
||
| 102 | if ($propo == 0) { |
||
| 103 | $xoopsTpl->assign('confirm_ads', _ADSLIGHT_NO_CLA); |
||
| 104 | } else { |
||
| 105 | $xoopsTpl->assign('confirm_ads', |
||
| 106 | _ADSLIGHT_THEREIS . ' ' . $propo . ' ' . _ADSLIGHT_WAIT . '<br><a href="' . XOOPS_URL . '/modules/adslight/admin/validate_ads.php">' . _ADSLIGHT_SEEIT . '</a>'); |
||
| 107 | } |
||
| 108 | } |
||
| 109 | |||
| 110 | $categories = AdslightUtilities::getMyItemIds('adslight_submit'); |
||
| 111 | if (is_array($categories) && count($categories) > 0) { |
||
| 112 | $intro = _ADSLIGHT_INTRO; |
||
| 113 | } else { |
||
| 114 | $intro = ''; |
||
| 115 | } |
||
| 116 | $xoopsTpl->assign('intro', $intro); |
||
| 117 | } |
||
| 118 | |||
| 119 | $sql = 'SELECT SQL_CACHE cid, title, img FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE pid = 0 '; |
||
| 120 | |||
| 121 | $categories = AdslightUtilities::getMyItemIds('adslight_view'); |
||
| 122 | if (is_array($categories) && count($categories) > 0) { |
||
| 123 | $sql .= ' AND cid IN (' . implode(',', $categories) . ') '; |
||
| 124 | } else { |
||
| 125 | redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM); |
||
| 126 | } |
||
| 127 | |||
| 128 | if ($GLOBALS['xoopsModuleConfig']['adslight_csortorder'] === 'ordre') { |
||
| 129 | $sql .= 'ORDER BY ordre'; |
||
| 130 | } else { |
||
| 131 | $sql .= 'ORDER BY title'; |
||
| 132 | } |
||
| 133 | |||
| 134 | $result = $xoopsDB->query($sql); |
||
| 135 | |||
| 136 | $count = 1; |
||
| 137 | $content = ''; |
||
| 138 | while ($myrow = $xoopsDB->fetchArray($result)) { |
||
| 139 | $title = $myts->htmlSpecialChars($myrow['title']); |
||
| 140 | |||
| 141 | if ($myrow['img'] && $myrow['img'] !== 'http://') { |
||
| 142 | $cat_img = $myts->htmlSpecialChars($myrow['img']); |
||
| 143 | $img = '<a href="viewcats.php?cid=' |
||
| 144 | . $myrow['cid'] |
||
| 145 | . '"><img src="' |
||
| 146 | . XOOPS_URL |
||
| 147 | . '/modules/adslight/assets/images/img_cat/' |
||
| 148 | . $cat_img |
||
| 149 | . '" align="middle" alt="' |
||
| 150 | . $title |
||
| 151 | . '" /></a>'; |
||
| 152 | } else { |
||
| 153 | $img = ''; |
||
| 154 | } |
||
| 155 | |||
| 156 | $totallisting = AdslightUtilities::getTotalItems($myrow['cid'], 1); |
||
| 157 | $content .= $title . ' '; |
||
| 158 | |||
| 159 | $arr = array(); |
||
| 160 | if (in_array($myrow['cid'], $categories)) { |
||
| 161 | $arr = $mytree->getFirstChild($myrow['cid'], 'title'); |
||
| 162 | $space = 0; |
||
| 163 | $chcount = 1; |
||
| 164 | $subcategories = ''; |
||
| 165 | if ($GLOBALS['xoopsModuleConfig']['adslight_souscat'] == 1) { |
||
| 166 | foreach ($arr as $ele) { |
||
| 167 | if (in_array($ele['cid'], $categories)) { |
||
| 168 | $chtitle = $myts->htmlSpecialChars($ele['title']); |
||
| 169 | if ($chcount > $GLOBALS['xoopsModuleConfig']['adslight_nbsouscat']) { |
||
| 170 | $subcategories .= '<a href="viewcats.php?cid=' . $myrow['cid'] . '">' . _ADSLIGHT_CATPLUS . '</a>'; |
||
| 171 | break; |
||
| 172 | } |
||
| 173 | if ($space > 0) { |
||
| 174 | $subcategories .= '<br>'; |
||
| 175 | } |
||
| 176 | $subcategories .= '- <a href="' . XOOPS_URL . '/modules/adslight/viewcats.php?cid=' . $ele['cid'] . '">' . $chtitle . '</a>'; |
||
| 177 | ++$space; |
||
| 178 | ++$chcount; |
||
| 179 | $content .= $ele['title'] . ' '; |
||
| 180 | } |
||
| 181 | } |
||
| 182 | } |
||
| 183 | $xoopsTpl->append('categories', array( |
||
| 184 | 'image' => $img, |
||
| 185 | 'id' => $myrow['cid'], |
||
| 186 | 'title' => $myts->htmlSpecialChars($myrow['title']), |
||
| 187 | 'new' => categorynewgraphic($myrow['cid']), |
||
| 188 | 'subcategories' => $subcategories, |
||
| 189 | 'totallisting' => $totallisting, |
||
| 190 | 'count' => $count |
||
| 191 | )); |
||
| 192 | ++$count; |
||
| 193 | } |
||
| 194 | } |
||
| 195 | $cat_perms = ''; |
||
| 196 | if (is_array($categories) && count($categories) > 0) { |
||
| 197 | $cat_perms .= ' AND cid IN (' . implode(',', $categories) . ') '; |
||
| 198 | } |
||
| 199 | |||
| 200 | list($ads) = $xoopsDB->fetchRow($xoopsDB->query('SELECT SQL_CACHE COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid='Yes' AND status!='1' $cat_perms")); |
||
| 201 | |||
| 202 | list($catt) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('' . $moduleDirName . '_categories') . '')); |
||
| 203 | |||
| 204 | $submit_perms = AdslightUtilities::getMyItemIds('adslight_submit'); |
||
| 205 | |||
| 206 | if ($GLOBALS['xoopsUser']) { |
||
| 207 | $add_listing = '' . _ADSLIGHT_ADD_LISTING_BULLOK . '<a href="add.php">' . _ADSLIGHT_ADD_LISTING_SUBOK . '</a>'; |
||
| 208 | } else { |
||
| 209 | $add_listing = '' . _ADSLIGHT_ADD_LISTING_BULL . '<a href="' . XOOPS_URL . '/register.php">' . _ADSLIGHT_ADD_LISTING_SUB . '</a>.'; |
||
| 210 | } |
||
| 211 | |||
| 212 | $xoopsTpl->assign('bullinfotext', _ADSLIGHT_ACTUALY . ' ' . $ads . ' ' . _ADSLIGHT_ADVERTISEMENTS . '<br>' . $add_listing); |
||
| 213 | $xoopsTpl->assign('total_confirm', _ADSLIGHT_AND . " $propo " . _ADSLIGHT_WAIT3); |
||
| 214 | |||
| 215 | if ($GLOBALS['xoopsModuleConfig']['adslight_newad'] == 1) { |
||
| 216 | $cat_perms = ''; |
||
| 217 | if (is_array($categories) && count($categories) > 0) { |
||
| 218 | $cat_perms .= ' AND cid IN (' . implode(',', $categories) . ') '; |
||
| 219 | } |
||
| 220 | |||
| 221 | $result = $xoopsDB->query('SELECT SQL_CACHE lid, title, status, type, price, typeprice, date, town, country, usid, premium, valid, photo, hits FROM ' |
||
| 222 | . $xoopsDB->prefix('adslight_listing') |
||
| 223 | . " WHERE valid='Yes' AND status!='1' $cat_perms ORDER BY date DESC LIMIT " |
||
| 224 | . $GLOBALS['xoopsModuleConfig']['adslight_newcount']); |
||
| 225 | if ($result) { |
||
| 226 | $xoopsTpl->assign('last_head', _ADSLIGHT_THE . ' ' . $GLOBALS['xoopsModuleConfig']['adslight_newcount'] . ' ' . _ADSLIGHT_LASTADD); |
||
| 227 | $xoopsTpl->assign('last_head_title', _ADSLIGHT_TITLE); |
||
| 228 | $xoopsTpl->assign('last_head_price', _ADSLIGHT_PRICE); |
||
| 229 | $xoopsTpl->assign('last_head_date', _ADSLIGHT_DATE); |
||
| 230 | $xoopsTpl->assign('last_head_local', _ADSLIGHT_LOCAL2); |
||
| 231 | $xoopsTpl->assign('last_head_hits', _ADSLIGHT_VIEW); |
||
| 232 | $xoopsTpl->assign('last_head_photo', _ADSLIGHT_PHOTO); |
||
| 233 | $rank = 1; |
||
| 234 | |||
| 235 | while (list($lid, $title, $status, $type, $price, $typeprice, $date, $town, $country, $usid, $premium, $valid, $photo, $hits) = $xoopsDB->fetchRow($result)) { |
||
| 236 | $title = $myts->htmlSpecialChars($title); |
||
| 237 | $type = $myts->htmlSpecialChars($type); |
||
| 238 | $price = number_format($price, 2, ',', ' '); |
||
| 239 | $town = $myts->htmlSpecialChars($town); |
||
| 240 | $country = $myts->htmlSpecialChars($country); |
||
| 241 | $premium = $myts->htmlSpecialChars($premium); |
||
| 242 | $a_item = array(); |
||
| 243 | $newcount = $GLOBALS['xoopsModuleConfig']['adslight_countday']; |
||
| 244 | $startdate = (time() - (86400 * $newcount)); |
||
| 245 | |||
| 246 | View Code Duplication | if ($startdate < $date) { |
|
| 247 | $newitem = '<img src="' . XOOPS_URL . '/modules/adslight/assets/images/newred.gif" alt="new" />'; |
||
| 248 | $a_item['new'] = $newitem; |
||
| 249 | } |
||
| 250 | |||
| 251 | $useroffset = ''; |
||
| 252 | if ($GLOBALS['xoopsUser']) { |
||
| 253 | $timezone = $GLOBALS['xoopsUser']->timezone(); |
||
| 254 | if (isset($timezone)) { |
||
| 255 | $useroffset = $GLOBALS['xoopsUser']->timezone(); |
||
| 256 | } else { |
||
| 257 | $useroffset = $xoopsConfig['default_TZ']; |
||
| 258 | } |
||
| 259 | } |
||
| 260 | |||
| 261 | $date = ($useroffset * 3600) + $date; |
||
| 262 | $date = formatTimestamp($date, 's'); |
||
| 263 | View Code Duplication | if ($GLOBALS['xoopsUser']) { |
|
|
1 ignored issue
–
show
|
|||
| 264 | if ($GLOBALS['xoopsUser']->isAdmin()) { |
||
| 265 | $a_item['admin'] = '<a href="' |
||
| 266 | . XOOPS_URL |
||
| 267 | . '/modules/adslight/admin/validate_ads.php?op=ModifyAds&lid=' |
||
| 268 | . $lid |
||
| 269 | . '"><img src="' |
||
| 270 | . $pathIcon16 |
||
| 271 | . '/edit.png' |
||
| 272 | . '" border=0 alt="' |
||
| 273 | . _ADSLIGHT_MODADMIN |
||
| 274 | . '" /></a>'; |
||
| 275 | } |
||
| 276 | } |
||
| 277 | |||
| 278 | $result7 = $xoopsDB->query('SELECT nom_type FROM ' . $xoopsDB->prefix('adslight_type') . " WHERE id_type='" . $xoopsDB->escape($type) . "'"); |
||
| 279 | list($nom_type) = $xoopsDB->fetchRow($result7); |
||
| 280 | |||
| 281 | $a_item['type'] = $myts->htmlSpecialChars($nom_type); |
||
| 282 | $a_item['title'] = '<a href="' . XOOPS_URL . '/modules/adslight/viewads.php?lid=' . $lid . '"><strong>' . $title . '</strong></a>'; |
||
| 283 | |||
| 284 | $result8 = $xoopsDB->query('SELECT nom_price FROM ' . $xoopsDB->prefix('adslight_price') . " WHERE id_price='" . $xoopsDB->escape($typeprice) . "'"); |
||
| 285 | list($nom_price) = $xoopsDB->fetchRow($result8); |
||
| 286 | |||
| 287 | if ($price > 0) { |
||
| 288 | $a_item['price'] = $price . ' ' . $GLOBALS['xoopsModuleConfig']['adslight_money'] . ''; |
||
| 289 | $a_item['price_typeprice'] = $myts->htmlSpecialChars($nom_price); |
||
| 290 | } else { |
||
| 291 | $a_item['price'] = ''; |
||
| 292 | $a_item['price_typeprice'] = $myts->htmlSpecialChars($nom_price); |
||
| 293 | } |
||
| 294 | $a_item['premium'] = $premium; |
||
| 295 | $a_item['date'] = $date; |
||
| 296 | $a_item['local'] = ''; |
||
| 297 | if ($town) { |
||
| 298 | $a_item['local'] .= $town; |
||
| 299 | } |
||
| 300 | $a_item['country'] = ''; |
||
| 301 | if ($country) { |
||
| 302 | $a_item['country'] = $country; |
||
| 303 | } |
||
| 304 | |||
| 305 | if ($status == 2) { |
||
| 306 | $a_item['sold'] = _ADSLIGHT_RESERVEDMEMBER; |
||
| 307 | } |
||
| 308 | |||
| 309 | View Code Duplication | if ($GLOBALS['xoopsModuleConfig']['active_thumbsindex'] > 0) { |
|
| 310 | $a_item['no_photo'] = '<a href="' |
||
| 311 | . XOOPS_URL |
||
| 312 | . '/modules/adslight/viewads.php?lid=' |
||
| 313 | . $lid |
||
| 314 | . '"><img class="thumb" src="' |
||
| 315 | . XOOPS_URL |
||
| 316 | . '/modules/adslight/assets/images/nophoto.jpg" align="left" width="100px" alt="' |
||
| 317 | . $title |
||
| 318 | . '" /></a>'; |
||
| 319 | |||
| 320 | $updir = $GLOBALS['xoopsModuleConfig']['adslight_link_upload']; |
||
| 321 | $sql = 'SELECT cod_img, lid, uid_owner, url FROM ' |
||
| 322 | . $xoopsDB->prefix('adslight_pictures') |
||
| 323 | . ' WHERE uid_owner=' |
||
| 324 | . $xoopsDB->escape($usid) |
||
| 325 | . ' AND lid=' |
||
| 326 | . $xoopsDB->escape($lid) |
||
| 327 | . ' ORDER BY date_added ASC limit 1'; |
||
| 328 | $resultp = $xoopsDB->query($sql); |
||
| 329 | |||
| 330 | while (list($cod_img, $pic_lid, $uid_owner, $url) = $xoopsDB->fetchRow($resultp)) { |
||
| 331 | if ($photo) { |
||
| 332 | $a_item['photo'] = '<a href="' |
||
| 333 | . XOOPS_URL |
||
| 334 | . '/modules/adslight/viewads.php?lid=' |
||
| 335 | . $lid |
||
| 336 | . '"><img class="thumb" src="' |
||
| 337 | . $updir |
||
| 338 | . '/thumbs/thumb_' |
||
| 339 | . $url |
||
| 340 | . '" align="left" width="100px" alt="' |
||
| 341 | . $title |
||
| 342 | . '" /></a>'; |
||
| 343 | } |
||
| 344 | } |
||
| 345 | } else { |
||
| 346 | $a_item['no_photo'] = '<img src="' . XOOPS_URL . '/modules/adslight/assets/images/camera_nophoto.png" align="left" width="24" alt="' . $title . '" />'; |
||
| 347 | $updir = $GLOBALS['xoopsModuleConfig']['adslight_link_upload']; |
||
| 348 | $sql = 'SELECT cod_img, lid, uid_owner, url FROM ' |
||
| 349 | . $xoopsDB->prefix('adslight_pictures') |
||
| 350 | . ' WHERE uid_owner=' |
||
| 351 | . $xoopsDB->escape($usid) |
||
| 352 | . ' AND lid=' |
||
| 353 | . $xoopsDB->escape($lid) |
||
| 354 | . ' ORDER BY date_added ASC limit 1'; |
||
| 355 | $resultp = $xoopsDB->query($sql); |
||
| 356 | |||
| 357 | while (list($cod_img, $pic_lid, $uid_owner, $url) = $xoopsDB->fetchRow($resultp)) { |
||
| 358 | if ($photo) { |
||
| 359 | $a_item['photo'] = '<img src="' . XOOPS_URL . '/modules/adslight/assets/images/camera_photo.png" align="left" width="24" alt="' . $title . '" />'; |
||
| 360 | } |
||
| 361 | } |
||
| 362 | } |
||
| 363 | $a_item['hits'] = $hits; |
||
| 364 | ++$rank; |
||
| 365 | $xoopsTpl->append('items', $a_item); |
||
| 366 | } |
||
| 367 | } |
||
| 368 | } |
||
| 369 | } |
||
| 370 | |||
| 371 | # function categorynewgraphic |
||
| 372 | ##################################################### |
||
| 373 | /** |
||
| 374 | * @param $cid |
||
| 375 | */ |
||
| 376 | function categorynewgraphic($cid) |
||
| 377 | { |
||
| 378 | global $xoopsDB; |
||
| 379 | } |
||
| 380 | |||
| 381 | ###################################################### |
||
| 382 | |||
| 383 | $pa = XoopsRequest::getInt('pa', null, 'GET'); |
||
| 384 | $lid = XoopsRequest::getInt('lid', null, 'GET'); |
||
| 385 | $cid = XoopsRequest::getInt('cid', null, 'GET'); |
||
| 386 | $usid = XoopsRequest::getString('usid', '', 'GET'); |
||
| 387 | $min = XoopsRequest::getInt('min', null, 'GET'); |
||
| 388 | $show = XoopsRequest::getInt('show', null, 'GET'); |
||
| 389 | $orderby = XoopsRequest::getInt('orderby', null, 'GET'); |
||
| 390 | |||
| 391 | switch ($pa) { |
||
| 392 | case 'Adsview': |
||
| 393 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_category.tpl'; |
||
| 394 | adsView($cid, $min, $orderby, $show); |
||
| 395 | break; |
||
| 396 | case 'viewads': |
||
| 397 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_item.tpl'; |
||
| 398 | viewAds($lid); |
||
| 399 | break; |
||
| 400 | default: |
||
| 401 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_index.tpl'; |
||
| 402 | index(); |
||
| 403 | break; |
||
| 404 | } |
||
| 405 | include XOOPS_ROOT_PATH . '/footer.php'; |
||
| 406 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.