mambax7 /
adslight
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php declare(strict_types=1); |
||
| 2 | |||
| 3 | /* |
||
| 4 | * You may not change or alter any portion of this comment or credits |
||
| 5 | * of supporting developers from this source code or any supporting source code |
||
| 6 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 7 | * |
||
| 8 | * This program is distributed in the hope that it will be useful, |
||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 11 | */ |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @copyright XOOPS Project (https://xoops.org) |
||
| 15 | * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
| 16 | * @author XOOPS Development Team |
||
| 17 | * @author Pascal Le Boustouller: original author ([email protected]) |
||
| 18 | * @author Luc Bizet (www.frxoops.org) |
||
| 19 | * @author jlm69 (www.jlmzone.com) |
||
| 20 | * @author mamba (www.xoops.org) |
||
| 21 | */ |
||
| 22 | |||
| 23 | use Xmf\Module\Admin; |
||
| 24 | use Xmf\Request; |
||
| 25 | use XoopsModules\Adslight\{ |
||
| 26 | Form\GoogleMapForm, |
||
| 27 | Helper, |
||
| 28 | PicturesHandler, |
||
| 29 | Tree, |
||
| 30 | Utility |
||
| 31 | }; |
||
| 32 | |||
| 33 | /** @var Helper $helper */ |
||
| 34 | require_once __DIR__ . '/header.php'; |
||
| 35 | //require_once XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php'; |
||
| 36 | xoops_load('XoopsLocal'); |
||
| 37 | |||
| 38 | $myts = \MyTextSanitizer::getInstance(); |
||
| 39 | $moduleId = $xoopsModule->getVar('mid'); |
||
| 40 | |||
| 41 | if (is_object($GLOBALS['xoopsUser'])) { |
||
| 42 | $groups = $GLOBALS['xoopsUser']->getGroups(); |
||
| 43 | } else { |
||
| 44 | $groups = XOOPS_GROUP_ANONYMOUS; |
||
| 45 | } |
||
| 46 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||
| 47 | $grouppermHandler = xoops_getHandler('groupperm'); |
||
| 48 | $perm_itemid = Request::getInt('item_id', 0, 'POST'); |
||
| 49 | //If no access |
||
| 50 | if (!$grouppermHandler->checkRight('adslight_view', $perm_itemid, $groups, $moduleId)) { |
||
| 51 | redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM); |
||
| 52 | } |
||
| 53 | if ($grouppermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $moduleId)) { |
||
| 54 | $prem_perm = '1'; |
||
| 55 | } else { |
||
| 56 | $prem_perm = '0'; |
||
| 57 | } |
||
| 58 | |||
| 59 | $mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||
| 60 | |||
| 61 | # function viewads |
||
| 62 | ##################################################### |
||
| 63 | /** |
||
| 64 | * @param int $lid |
||
| 65 | */ |
||
| 66 | function viewAds($lid = 0): void |
||
| 67 | { |
||
| 68 | global $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsTpl, $myts, $meta, $prem_perm, $xoopsUser; |
||
| 69 | |||
| 70 | $helper = Helper::getInstance(); |
||
| 71 | |||
| 72 | $moduleDirName = \basename(__DIR__); |
||
| 73 | |||
| 74 | $pathIcon16 = Admin::iconUrl('', '16'); |
||
| 75 | $contact_pm = $contact = ''; |
||
| 76 | $picturesArray = []; |
||
| 77 | $cid = 0; |
||
| 78 | |||
| 79 | $tempXoopsLocal = new \XoopsLocal(); |
||
| 80 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_item.tpl'; |
||
| 81 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
| 82 | // require_once XOOPS_ROOT_PATH . '/include/comment_view.php'; |
||
| 83 | $lid = max((int)$lid, 0); |
||
| 84 | $rate = ('1' === $helper->getConfig('adslight_rate_item')) ? '1' : '0'; |
||
| 85 | $GLOBALS['xoopsTpl']->assign('rate', $rate); |
||
| 86 | $GLOBALS['xoopsTpl']->assign('xmid', $xoopsModule->getVar('mid')); |
||
| 87 | $GLOBALS['xoopsTpl']->assign('adslight_logolink', _ADSLIGHT_LOGOLINK); |
||
| 88 | |||
| 89 | // Hack redirection erreur 404 si lid=null |
||
| 90 | if ('' === $lid) { |
||
| 91 | header('Status: 301 Moved Permanently', false, 301); |
||
| 92 | // header('Location: '.XOOPS_URL.'/modules/adslight/404.php'); |
||
| 93 | // exit(); |
||
| 94 | $helper->redirect('404.php', 1); |
||
| 95 | } |
||
| 96 | |||
| 97 | $GLOBALS['xoopsTpl']->assign('adslight_active_bookmark', $helper->getConfig('adslight_active_bookmark')); |
||
| 98 | $GLOBALS['xoopsTpl']->assign('adslight_style_bookmark', $helper->getConfig('adslight_style_bookmark')); |
||
| 99 | // $GLOBALS['xoopsTpl']->assign('adslight_active_xpayement', $helper->getConfig('adslight_active_xpayment')); |
||
| 100 | |||
| 101 | // adslight 2 |
||
| 102 | $GLOBALS['xoopsTpl']->assign('adslight_active_menu', $helper->getConfig('adslight_active_menu')); |
||
| 103 | $GLOBALS['xoopsTpl']->assign('adslight_active_rss', $helper->getConfig('adslight_active_rss')); |
||
| 104 | |||
| 105 | if ($GLOBALS['xoopsUser']) { |
||
| 106 | $member_usid = $GLOBALS['xoopsUser']->getVar('uid'); |
||
| 107 | if ($usid = $member_usid) { |
||
| 108 | $GLOBALS['xoopsTpl']->assign('istheirs', true); |
||
| 109 | |||
| 110 | if ('' !== $GLOBALS['xoopsUser']->getVar('name')) { |
||
| 111 | $GLOBALS['xoopsTpl']->assign('user_name', $GLOBALS['xoopsUser']->getVar('name') . ' (' . $GLOBALS['xoopsUser']->getVar('uname') . ')'); |
||
| 112 | } else { |
||
| 113 | $GLOBALS['xoopsTpl']->assign('user_name', $GLOBALS['xoopsUser']->getVar('uname')); |
||
| 114 | } |
||
| 115 | |||
| 116 | $GLOBALS['xoopsTpl']->assign('user_email', $GLOBALS['xoopsUser']->getVar('email')); |
||
| 117 | |||
| 118 | $sql = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE usid={$member_usid}"; |
||
| 119 | $result = $xoopsDB->query($sql); |
||
| 120 | if (!$xoopsDB->isResultSet($result)) { |
||
| 121 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||
| 122 | } |
||
| 123 | if (!$xoopsDB->isResultSet($result)) { |
||
| 124 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||
| 125 | } |
||
| 126 | [$show_user] = $xoopsDB->fetchRow($result); |
||
| 127 | |||
| 128 | $GLOBALS['xoopsTpl']->assign('show_user', $show_user); |
||
| 129 | $GLOBALS['xoopsTpl']->assign('show_user_link', 'members.php?uid=' . $member_usid); |
||
| 130 | } |
||
| 131 | } |
||
| 132 | |||
| 133 | if ($GLOBALS['xoopsUser']) { |
||
| 134 | $currentid = $GLOBALS['xoopsUser']->getVar('uid', 'E'); |
||
| 135 | } |
||
| 136 | |||
| 137 | $cat_perms = ''; |
||
| 138 | $categories = Utility::getMyItemIds('adslight_view'); |
||
| 139 | if (is_array($categories) && count($categories) > 0) { |
||
| 140 | $cat_perms .= ' AND cid IN (' . implode(',', $categories) . ') '; |
||
| 141 | } |
||
| 142 | |||
| 143 | $sql = |
||
| 144 | 'SELECT l.lid, l.cid, l.title, l.status, l.expire, l.type, l.desctext, l.tel, l.price, l.typeprice, l.typecondition, l.date_created, l.email, l.submitter, l.usid, l.town, l.country, l.contactby, l.premium, l.valid, l.photo, l.hits, l.item_rating, l.item_votes, l.user_rating, l.user_votes, l.comments, p.cod_img, p.lid, p.uid_owner, p.url FROM ' |
||
| 145 | . $xoopsDB->prefix('adslight_listing') |
||
| 146 | . ' l LEFT JOIN ' |
||
| 147 | . $xoopsDB->prefix('adslight_pictures') |
||
| 148 | . " p ON l.lid=p.lid WHERE l.valid='Yes' AND l.lid = " |
||
| 149 | . $xoopsDB->escape($lid) |
||
| 150 | . " and l.status!='1' {$cat_perms}"; |
||
| 151 | $result = $xoopsDB->query($sql); |
||
| 152 | if (!$xoopsDB->isResultSet($result)) { |
||
| 153 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||
| 154 | } |
||
| 155 | $recordexist = $xoopsDB->getRowsNum($result); |
||
| 156 | |||
| 157 | // Hack redirection erreur 404 si recordexist=null |
||
| 158 | if ('' === $recordexist) { |
||
| 159 | header('Status: 301 Moved Permanently', false, 301); |
||
| 160 | // header('Location: '.XOOPS_URL.'/modules/adslight/404.php'); |
||
| 161 | // exit(); |
||
| 162 | $helper->redirect('404.php', 1); |
||
| 163 | } |
||
| 164 | |||
| 165 | if ($recordexist) { |
||
| 166 | [ |
||
| 167 | $lid, |
||
| 168 | $cid, |
||
| 169 | $title, |
||
| 170 | $status, |
||
| 171 | $expire, |
||
| 172 | $type, |
||
| 173 | $desctext, |
||
| 174 | $tel, |
||
| 175 | $price, |
||
| 176 | $typeprice, |
||
| 177 | $typecondition, |
||
| 178 | $date_created, |
||
| 179 | $email, |
||
| 180 | $submitter, |
||
| 181 | $usid, |
||
| 182 | $town, |
||
| 183 | $country, |
||
| 184 | $contactby, |
||
| 185 | $premium, |
||
| 186 | $valid, |
||
| 187 | $photo, |
||
| 188 | $hits, |
||
| 189 | $item_rating, |
||
| 190 | $item_votes, |
||
| 191 | $user_rating, |
||
| 192 | $user_votes, |
||
| 193 | $comments, |
||
| 194 | $cod_img, |
||
| 195 | $pic_lid, |
||
| 196 | $uid_owner, |
||
| 197 | $url, |
||
| 198 | ] = $xoopsDB->fetchRow($result); |
||
| 199 | |||
| 200 | $newcount = $helper->getConfig('adslight_countday'); |
||
| 201 | $startdate = time() - (86400 * $newcount); |
||
| 202 | if ($startdate < $date_created) { |
||
| 203 | $newitem = '<img src="' . XOOPS_URL . '/modules/adslight/assets/images/newred.gif" alt="new" >'; |
||
| 204 | $GLOBALS['xoopsTpl']->assign('new', $newitem); |
||
| 205 | } |
||
| 206 | |||
| 207 | $updir = $helper->getConfig('adslight_link_upload'); |
||
| 208 | $GLOBALS['xoopsTpl']->assign('add_from', _ADSLIGHT_ADDFROM . ' ' . $xoopsConfig['sitename']); |
||
| 209 | $GLOBALS['xoopsTpl']->assign('add_from_title', _ADSLIGHT_ADDFROM); |
||
| 210 | $GLOBALS['xoopsTpl']->assign('add_from_sitename', $xoopsConfig['sitename']); |
||
| 211 | $GLOBALS['xoopsTpl']->assign('ad_exists', $recordexist); |
||
| 212 | $GLOBALS['xoopsTpl']->assign('mydirname', $moduleDirName); |
||
| 213 | |||
| 214 | $count = 0; |
||
| 215 | $x = 0; |
||
| 216 | $i = 0; |
||
| 217 | $sql = 'SELECT cid, pid, title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . $xoopsDB->escape($cid); |
||
| 218 | $result3 = $xoopsDB->query($sql); |
||
| 219 | if (!$xoopsDB->isResultSet($result3)) { |
||
| 220 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||
| 221 | } |
||
| 222 | [$ccid, $pid, $ctitle] = $xoopsDB->fetchRow($result3); |
||
| 223 | |||
| 224 | $GLOBALS['xoopsTpl']->assign('category_title', $ctitle); |
||
| 225 | |||
| 226 | $moduleId = $xoopsModule->getVar('mid'); |
||
| 227 | if (is_object($GLOBALS['xoopsUser'])) { |
||
| 228 | $groups = $GLOBALS['xoopsUser']->getGroups(); |
||
| 229 | } else { |
||
| 230 | $groups = XOOPS_GROUP_ANONYMOUS; |
||
| 231 | } |
||
| 232 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||
| 233 | $grouppermHandler = xoops_getHandler('groupperm'); |
||
| 234 | $GLOBALS['xoopsTpl']->assign('purchasable', $grouppermHandler->checkRight('adslight_purchase', $cid, $groups, $moduleId)); |
||
| 235 | |||
| 236 | $ctitle = \htmlspecialchars($ctitle, ENT_QUOTES | ENT_HTML5); |
||
| 237 | $varid[$x] = $ccid; |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
| 238 | $varnom[$x] = $ctitle; |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 239 | |||
| 240 | $sql = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE valid="Yes" AND cid=' . $xoopsDB->escape($cid) . ' AND status!="1"'; |
||
| 241 | $result = $xoopsDB->query($sql); |
||
| 242 | if (!$xoopsDB->isResultSet($result)) { |
||
| 243 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||
| 244 | } |
||
| 245 | [$nbe] = $xoopsDB->fetchRow($result); |
||
| 246 | if (0 !== (int)$pid) { |
||
| 247 | $x = 1; |
||
| 248 | while (0 !== (int)$pid) { |
||
| 249 | $sql = 'SELECT cid, pid, title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . $xoopsDB->escape($pid); |
||
| 250 | $result4 = $xoopsDB->query($sql); |
||
| 251 | if (!$xoopsDB->isResultSet($result4)) { |
||
| 252 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||
| 253 | } |
||
| 254 | [$ccid, $pid, $ctitle] = $xoopsDB->fetchRow($result4); |
||
| 255 | |||
| 256 | $ctitle = \htmlspecialchars($ctitle, ENT_QUOTES | ENT_HTML5); |
||
| 257 | $varid[$x] = $ccid; |
||
| 258 | $varnom[$x] = $ctitle; |
||
| 259 | ++$x; |
||
| 260 | } |
||
| 261 | --$x; |
||
| 262 | } |
||
| 263 | $subcats = ''; |
||
| 264 | $arrow = ' <img src="' . XOOPS_URL . '/modules/adslight/assets/images/arrow.gif" alt="»" >'; |
||
| 265 | while (-1 !== $x) { |
||
| 266 | $subcats .= ' ' . $arrow . ' <a href="viewcats.php?cid=' . $varid[$x] . '">' . $varnom[$x] . '</a>'; |
||
| 267 | --$x; |
||
| 268 | } |
||
| 269 | $GLOBALS['xoopsTpl']->assign('nav_main', '<a href="index.php">' . _ADSLIGHT_MAIN . '</a>'); |
||
| 270 | $GLOBALS['xoopsTpl']->assign('nav_sub', $subcats); |
||
| 271 | $GLOBALS['xoopsTpl']->assign('nav_subcount', $nbe); |
||
| 272 | $viewcount_judge = true; |
||
| 273 | $useroffset = ''; |
||
| 274 | if ($GLOBALS['xoopsUser']) { |
||
| 275 | $timezone = $GLOBALS['xoopsUser']->timezone(); |
||
| 276 | if (isset($timezone)) { |
||
| 277 | $useroffset = $GLOBALS['xoopsUser']->timezone(); |
||
| 278 | } else { |
||
| 279 | $useroffset = $xoopsConfig['default_TZ']; |
||
| 280 | } |
||
| 281 | if ($GLOBALS['xoopsUser']->isAdmin()) { |
||
| 282 | $adslight_admin = true; |
||
| 283 | } else { |
||
| 284 | $adslight_admin = false; |
||
| 285 | } |
||
| 286 | |||
| 287 | if (($adslight_admin = true) |
||
| 288 | || ($GLOBALS['xoopsUser']->getVar('uid') === $usid)) { |
||
| 289 | $viewcount_judge = false; |
||
| 290 | } |
||
| 291 | |||
| 292 | $contact_pm = '<a href="' . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . addslashes($usid) . '"> ' . _ADSLIGHT_CONTACT_BY_PM . '</a>'; |
||
| 293 | } |
||
| 294 | if ($viewcount_judge) { |
||
| 295 | $xoopsDB->queryF('UPDATE ' . $xoopsDB->prefix('adslight_listing') . ' SET hits=hits+1 WHERE lid = ' . $xoopsDB->escape($lid)); |
||
| 296 | } |
||
| 297 | if (1 === $item_votes) { |
||
| 298 | $votestring = _ADSLIGHT_ONEVOTE; |
||
| 299 | } else { |
||
| 300 | $votestring = sprintf(_ADSLIGHT_NUMVOTES, $item_votes); |
||
| 301 | } |
||
| 302 | $date_created = ((int)$useroffset * 3600) + $date_created; |
||
| 303 | $date2 = $date_created + ($expire * 86400); |
||
| 304 | $date_created = formatTimestamp($date_created, 's'); |
||
| 305 | $date2 = formatTimestamp($date2, 's'); |
||
| 306 | |||
| 307 | $title = \htmlspecialchars($title, ENT_QUOTES | ENT_HTML5); |
||
| 308 | $status = \htmlspecialchars($status, ENT_QUOTES | ENT_HTML5); |
||
| 309 | $expire = \htmlspecialchars($expire, ENT_QUOTES | ENT_HTML5); |
||
| 310 | $type = \htmlspecialchars($type, ENT_QUOTES | ENT_HTML5); |
||
| 311 | $desctext = $myts->displayTarea($desctext, 1, 1, 1); |
||
| 312 | $tel = \htmlspecialchars($tel, ENT_QUOTES | ENT_HTML5); |
||
| 313 | // $price = XoopsLocal::number_format($price, 2, ',', ' '); |
||
| 314 | $typeprice = \htmlspecialchars($typeprice, ENT_QUOTES | ENT_HTML5); |
||
| 315 | $typecondition = \htmlspecialchars($typecondition, ENT_QUOTES | ENT_HTML5); |
||
| 316 | $submitter = \htmlspecialchars($submitter, ENT_QUOTES | ENT_HTML5); |
||
| 317 | $usid = \htmlspecialchars($usid, ENT_QUOTES | ENT_HTML5); |
||
| 318 | $town = \htmlspecialchars($town, ENT_QUOTES | ENT_HTML5); |
||
| 319 | $country = \htmlspecialchars($country, ENT_QUOTES | ENT_HTML5); |
||
| 320 | $contactby = \htmlspecialchars($contactby, ENT_QUOTES | ENT_HTML5); |
||
| 321 | $premium = \htmlspecialchars($premium, ENT_QUOTES | ENT_HTML5); |
||
| 322 | if (2 === (int)$status) { |
||
| 323 | $sold = _ADSLIGHT_RESERVED; |
||
| 324 | } else { |
||
| 325 | $sold = ''; |
||
| 326 | } |
||
| 327 | |||
| 328 | $GLOBALS['xoopsTpl']->assign('printA', '<a href="print.php?op=PrintAd&lid=' . $lid . '" ><img src="assets/images/print.gif" border=0 alt="' . _ADSLIGHT_PRINT . '" ></a> '); |
||
| 329 | |||
| 330 | if ($usid > 0) { |
||
| 331 | $GLOBALS['xoopsTpl']->assign('submitter', '<img src="assets/images/lesannonces.png" border="0" alt="' . _ADSLIGHT_VIEW_MY_ADS . '" > <a href="members.php?usid=' . addslashes($usid) . '" >' . _ADSLIGHT_VIEW_MY_ADS . ' ' . $submitter . '</a>'); |
||
| 332 | } else { |
||
| 333 | $GLOBALS['xoopsTpl']->assign('submitter', _ADSLIGHT_VIEW_MY_ADS . ' $submitter'); |
||
| 334 | } |
||
| 335 | $GLOBALS['xoopsTpl']->assign('lid', $lid); |
||
| 336 | $GLOBALS['xoopsTpl']->assign('read', "{$hits} " . _ADSLIGHT_VIEW2); |
||
| 337 | $GLOBALS['xoopsTpl']->assign('rating', $tempXoopsLocal->number_format($item_rating)); |
||
| 338 | $GLOBALS['xoopsTpl']->assign('votes', $votestring); |
||
| 339 | $GLOBALS['xoopsTpl']->assign('lang_rating', _ADSLIGHT_RATINGC); |
||
| 340 | $GLOBALS['xoopsTpl']->assign('lang_ratethisitem', _ADSLIGHT_RATETHISITEM); |
||
| 341 | $GLOBALS['xoopsTpl']->assign('xoop_user', false); |
||
| 342 | $isOwner = ''; |
||
| 343 | if ($GLOBALS['xoopsUser']) { |
||
| 344 | $GLOBALS['xoopsTpl']->assign('xoop_user', true); |
||
| 345 | $currentid = $GLOBALS['xoopsUser']->getVar('uid', 'E'); |
||
| 346 | if ($usid == $currentid) { |
||
| 347 | $GLOBALS['xoopsTpl']->assign('modifyads', '<img src=' . $pathIcon16 . '/edit.png border="0" alt="' . _ADSLIGHT_MODIFANN . '" > <a href="modify.php?op=modad&lid=' . $lid . '">' . _ADSLIGHT_MODIFANN . '</a>'); |
||
| 348 | $GLOBALS['xoopsTpl']->assign('deleteads', '<img src=' . $pathIcon16 . '/delete.png border="0" alt="' . _ADSLIGHT_SUPPRANN . '" > <a href="modify.php?op=ListingDel&lid=' . $lid . '">' . _ADSLIGHT_SUPPRANN . '</a>'); |
||
| 349 | $GLOBALS['xoopsTpl']->assign('add_photos', '<img src="assets/images/shape_square_add.png" border="0" alt="' . _ADSLIGHT_SUPPRANN . '" > <a href="view_photos.php?lid=' . $lid . '&uid=' . $usid . '">' . _ADSLIGHT_ADD_PHOTOS . '</a>'); |
||
| 350 | |||
| 351 | $isOwner = true; |
||
| 352 | $GLOBALS['xoopsTpl']->assign('isOwner', $isOwner); |
||
| 353 | } |
||
| 354 | if ($GLOBALS['xoopsUser']->isAdmin()) { |
||
| 355 | $GLOBALS['xoopsTpl']->assign('admin', '<a href="' . XOOPS_URL . '/modules/adslight/admin/modify_ads.php?op=modifyAds&lid=' . $lid . '"><img src=' . $pathIcon16 . '/edit.png border=0 alt="' . _ADSLIGHT_MODADMIN . '" ></a>'); |
||
| 356 | } |
||
| 357 | } |
||
| 358 | |||
| 359 | $sql = 'SELECT nom_type FROM ' . $xoopsDB->prefix('adslight_type') . " WHERE id_type='" . $xoopsDB->escape($type) . "'"; |
||
| 360 | $result7 = $xoopsDB->query($sql); |
||
| 361 | if (!$xoopsDB->isResultSet($result7)) { |
||
| 362 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||
| 363 | } |
||
| 364 | [$nom_type] = $xoopsDB->fetchRow($result7); |
||
| 365 | |||
| 366 | $sql = 'SELECT nom_price FROM ' . $xoopsDB->prefix('adslight_price') . " WHERE id_price='" . $xoopsDB->escape($typeprice) . "'"; |
||
| 367 | $result8 = $xoopsDB->query($sql); |
||
| 368 | if (!$xoopsDB->isResultSet($result8)) { |
||
| 369 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||
| 370 | } |
||
| 371 | [$nom_price] = $xoopsDB->fetchRow($result8); |
||
| 372 | |||
| 373 | $sql = 'SELECT nom_condition FROM ' . $xoopsDB->prefix('adslight_condition') . " WHERE id_condition='" . $xoopsDB->escape($typecondition) . "'"; |
||
| 374 | $result9 = $xoopsDB->query($sql); |
||
| 375 | if (!$xoopsDB->isResultSet($result9)) { |
||
| 376 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||
| 377 | } |
||
| 378 | [$nom_condition] = $xoopsDB->fetchRow($result9); |
||
| 379 | |||
| 380 | $GLOBALS['xoopsTpl']->assign('type', htmlspecialchars($nom_type, ENT_QUOTES | ENT_HTML5)); |
||
| 381 | $GLOBALS['xoopsTpl']->assign('title', $title); |
||
| 382 | $GLOBALS['xoopsTpl']->assign('status', $status); |
||
| 383 | $GLOBALS['xoopsTpl']->assign('desctext', $desctext); |
||
| 384 | $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title . ' - ' . $town . ': ' . $country . ' - ' . $ctitle); |
||
| 385 | |||
| 386 | // meta description tags for ads |
||
| 387 | $desctextclean = strip_tags($desctext, '<span><img><strong><i><u>'); |
||
| 388 | $GLOBALS['xoTheme']->addMeta('meta', 'description', "{$title} - " . mb_substr($desctextclean, 0, 150)); |
||
| 389 | |||
| 390 | $currencyCode = $helper->getConfig('adslight_currency_code'); |
||
| 391 | $currencySymbol = $helper->getConfig('adslight_currency_symbol'); |
||
| 392 | $currencyPosition = $helper->getConfig('currency_position'); |
||
| 393 | $formattedCurrencyUtilityTemp = Utility::formatCurrencyTemp($price, $currencyCode, $currencySymbol, $currencyPosition); |
||
| 394 | |||
| 395 | if ($price > 0) { |
||
| 396 | $GLOBALS['xoopsTpl']->assign('price', '<strong>' . _ADSLIGHT_PRICE2 . '</strong>' . $price . ' ' . $helper->getConfig('adslight_currency_symbol') . ' - ' . $typeprice); |
||
| 397 | $GLOBALS['xoopsTpl']->assign('price_head', _ADSLIGHT_PRICE2); |
||
| 398 | $GLOBALS['xoopsTpl']->assign('price_price', $formattedCurrencyUtilityTemp); |
||
| 399 | |||
| 400 | $priceTypeprice = \htmlspecialchars($nom_price, ENT_QUOTES | ENT_HTML5); |
||
| 401 | $GLOBALS['xoopsTpl']->assign('price_typeprice', $priceTypeprice); |
||
| 402 | $priceCurrency = $helper->getConfig('adslight_currency_code'); |
||
| 403 | $GLOBALS['xoopsTpl']->assign('price_currency', $priceCurrency); |
||
| 404 | |||
| 405 | // $priceHtml = '<strong>' . _ADSLIGHT_PRICE2 . '</strong>' . $price . ' ' . $helper->getConfig('adslight_currency_symbol') . ' - ' . $typeprice; |
||
| 406 | |||
| 407 | $priceHtml = '<strong>' . _ADSLIGHT_PRICE2 . '</strong>' . $formattedCurrencyUtilityTemp . ' - ' . $priceTypeprice; |
||
| 408 | |||
| 409 | $GLOBALS['xoopsTpl']->assign('price', $priceHtml); |
||
| 410 | |||
| 411 | $GLOBALS['xoopsTpl']->assign('price_amount', $price); |
||
| 412 | } |
||
| 413 | |||
| 414 | $GLOBALS['xoopsTpl']->assign('condition_typecondition', $nom_condition); |
||
| 415 | $GLOBALS['xoopsTpl']->assign('premium', $premium); |
||
| 416 | |||
| 417 | // $GLOBALS['xoopsTpl']->assign('mustlogin', _ADSLIGHT_MUSTLOGIN); |
||
| 418 | $GLOBALS['xoopsTpl']->assign('redirect', '?xoops_redirect=/modules/adslight/index.php'); |
||
| 419 | |||
| 420 | if ($town) { |
||
| 421 | $GLOBALS['xoopsTpl']->assign('local_town', $town); |
||
| 422 | } |
||
| 423 | if (1 === $helper->getConfig('adslight_use_country')) { |
||
| 424 | if ($country) { |
||
| 425 | $GLOBALS['xoopsTpl']->assign('local_country', $country); |
||
| 426 | $GLOBALS['xoopsTpl']->assign('country_head', '<img src="assets/images/world_go.png" border="0" alt="country" > ' . _ADSLIGHT_COUNTRY); |
||
| 427 | } |
||
| 428 | } |
||
| 429 | |||
| 430 | $tphon = ''; |
||
| 431 | if ($tel) { |
||
| 432 | $tphon = '<br>' . _ADSLIGHT_ORBY . ' <strong>' . _ADSLIGHT_TEL . '</strong> ' . $tel; |
||
| 433 | } |
||
| 434 | if (1 === (int)$contactby) { |
||
| 435 | $contact = '<a rel="nofollow" href="contact.php?lid=' . $lid . '">' . _ADSLIGHT_BYMAIL2 . '</a>' . $tphon; |
||
| 436 | } |
||
| 437 | if (2 === (int)$contactby) { |
||
| 438 | $contact = $contact_pm . $tphon; |
||
| 439 | } |
||
| 440 | if (3 === (int)$contactby) { |
||
| 441 | $contact = '<a rel="nofollow" href="contact.php?lid=' . $lid . '">' . _ADSLIGHT_BYMAIL2 . '</a>' . $tphon . '<br>' . _ADSLIGHT_ORBY . $contact_pm; |
||
| 442 | } |
||
| 443 | if (4 === (int)$contactby) { |
||
| 444 | $contact = '<br><strong>' . _ADSLIGHT_TEL . '</strong> ' . $tel; |
||
| 445 | } |
||
| 446 | // $GLOBALS['xoopsTpl']->assign('contact', $contact); |
||
| 447 | $GLOBALS['xoopsTpl']->assign('local_head', '<img src="assets/images/house.png" border="0" alt="local_head" > ' . _ADSLIGHT_LOCAL); |
||
| 448 | |||
| 449 | if ($lid) { |
||
| 450 | if ($sold) { |
||
| 451 | $GLOBALS['xoopsTpl']->assign('bullinfotext', $sold); |
||
| 452 | } elseif ($GLOBALS['xoopsUser']) { |
||
| 453 | $GLOBALS['xoopsTpl']->assign('bullinfotext', _ADSLIGHT_CONTACT_SUBMITTER . ' ' . $submitter . ' ' . _ADSLIGHT_CONTACTBY2 . ' ' . $contact); |
||
| 454 | } else { |
||
| 455 | $GLOBALS['xoopsTpl']->assign('bullinfotext', '<span style="color: #de090e;"><b>' . _ADSLIGHT_MUSTLOGIN . '</b></span>'); |
||
| 456 | } |
||
| 457 | } |
||
| 458 | |||
| 459 | $user_profile = \XoopsUser::getUnameFromId($usid); |
||
| 460 | $GLOBALS['xoopsTpl']->assign('user_profile', '<img src="assets/images/profil.png" border="0" alt="' . _ADSLIGHT_PROFILE . '" > <a rel="nofollow" href="' . XOOPS_URL . '/user.php?usid=' . addslashes($usid) . '">' . _ADSLIGHT_PROFILE . ' ' . $user_profile . '</a>'); |
||
| 461 | if ('' !== $photo) { |
||
| 462 | $criteria_lid = new \Criteria('lid', $lid); |
||
| 463 | $criteria_uid = new \Criteria('uid', $usid); |
||
| 464 | /** @var PicturesHandler $picturesHandler */ |
||
| 465 | $picturesHandler = $helper->getHandler('Pictures'); |
||
| 466 | $pictures_object_array = $picturesHandler->getObjects($criteria_lid, $criteria_uid); |
||
| 467 | $pictures_number = $picturesHandler->getCount($criteria_lid); |
||
| 468 | if (0 === $pictures_number) { |
||
| 469 | $nopicturesyet = _ADSLIGHT_NOTHINGYET; |
||
| 470 | $GLOBALS['xoopsTpl']->assign('lang_nopicyet', $nopicturesyet); |
||
| 471 | } else { |
||
| 472 | /** |
||
| 473 | * Let's populate an array with the data from the pictures |
||
| 474 | */ |
||
| 475 | $i = 0; |
||
| 476 | foreach ($pictures_object_array as $picture) { |
||
| 477 | $picturesArray[$i]['url'] = $picture->getVar('url', 's'); |
||
| 478 | $picturesArray[$i]['desc'] = $picture->getVar('title', 's'); |
||
| 479 | $picturesArray[$i]['cod_img'] = $picture->getVar('cod_img', 's'); |
||
| 480 | $picturesArray[$i]['lid'] = $picture->getVar('lid', 's'); |
||
| 481 | $GLOBALS['xoopsTpl']->assign('pics_array', $picturesArray); |
||
| 482 | |||
| 483 | ++$i; |
||
| 484 | } |
||
| 485 | } |
||
| 486 | $owner = new \XoopsUser(); |
||
| 487 | $identifier = $owner::getUnameFromId($usid); |
||
| 488 | |||
| 489 | Utility::loadLightbox(); // JJDai |
||
| 490 | /* |
||
| 491 | if (1 === $helper->getConfig('adslight_lightbox')) { |
||
| 492 | |||
| 493 | $header_lightbox = '<link rel="stylesheet" href="' . XOOPS_URL . '/modules/adslight/assets/css/adslight.css" type="text/css" media="all" > |
||
| 494 | <script type="text/javascript" src="assets/lightbox/js/jquery-1.7.2.min.js"></script> |
||
| 495 | <script type="text/javascript" src="assets/lightbox/js/jquery-ui-1.8.18.custom.min"></script> |
||
| 496 | <script type="text/javascript" src="assets/lightbox/js/jquery.smooth-scroll.min.js"></script> |
||
| 497 | <script type="text/javascript" src="assets/lightbox/js/lightbox.js"></script> |
||
| 498 | <link rel="stylesheet" href="assets/css/galery.css" type="text/css" media="screen" > |
||
| 499 | <link rel="stylesheet" type="text/css" media="screen" href="assets/lightbox/css/lightbox.css"></link>'; |
||
| 500 | } else { |
||
| 501 | $header_lightbox = '<link rel="stylesheet" href="' . XOOPS_URL . '/modules/adslight/assets/css/adslight.css" type="text/css" media="all" > |
||
| 502 | <link rel="stylesheet" href="assets/css/galery.css" type="text/css" media="screen" >'; |
||
| 503 | } |
||
| 504 | */ |
||
| 505 | |||
| 506 | $GLOBALS['xoopsTpl']->assign('path_uploads', $helper->getConfig('adslight_link_upload')); |
||
| 507 | |||
| 508 | $GLOBALS['xoopsTpl']->assign('permit', $prem_perm); |
||
| 509 | if ($helper->getConfig('active_rewriteurl') > 0) { |
||
| 510 | /* ici le meta Canonicale pour le Rewrite */ |
||
| 511 | //$GLOBALS['xoopsTpl']->assign('xoops_module_header', $header_lightbox); |
||
| 512 | } |
||
| 513 | //$GLOBALS['xoopsTpl']->assign('xoops_module_header', $header_lightbox); |
||
| 514 | |||
| 515 | $GLOBALS['xoopsTpl']->assign('photo', $photo); |
||
| 516 | $GLOBALS['xoopsTpl']->assign('pic_lid', $pic_lid); |
||
| 517 | $GLOBALS['xoopsTpl']->assign('pic_owner', $uid_owner); |
||
| 518 | } else { |
||
| 519 | $GLOBALS['xoopsTpl']->assign('photo', ''); |
||
| 520 | } |
||
| 521 | $GLOBALS['xoopsTpl']->assign( |
||
| 522 | 'date_created', |
||
| 523 | '<img alt="date_created" border="0" src="assets/images/date.png" > <strong>' . _ADSLIGHT_DATE2 . ':</strong> ' . $date_created . '<br><img alt="date_error" border="0" src="assets/images/date_error.png" > <strong>' . _ADSLIGHT_DISPO . ':</strong> ' . $date2 |
||
| 524 | ); |
||
| 525 | } else { |
||
| 526 | $GLOBALS['xoopsTpl']->assign('no_ad', _ADSLIGHT_NOCLAS); |
||
| 527 | } |
||
| 528 | $sql = 'SELECT title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . $xoopsDB->escape($cid); |
||
| 529 | $result8 = $xoopsDB->query($sql); |
||
| 530 | if (!$xoopsDB->isResultSet($result8)) { |
||
| 531 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||
| 532 | } |
||
| 533 | |||
| 534 | [$ctitle] = $xoopsDB->fetchRow($result8); |
||
| 535 | $GLOBALS['xoopsTpl']->assign('friend', '<img src="assets/images/friend.gif" border="0" alt="' . _ADSLIGHT_SENDFRIENDS . '" > <a rel="nofollow" href="sendfriend.php?op=SendFriend&lid=' . $lid . '">' . _ADSLIGHT_SENDFRIENDS . '</a>'); |
||
| 536 | |||
| 537 | $GLOBALS['xoopsTpl']->assign('alerteabus', '<img src="assets/images/error.png" border="0" alt="' . _ADSLIGHT_ALERTEABUS . '" > <a rel="nofollow" href="report-abuse.php?op=ReportAbuse&lid=' . $lid . '">' . _ADSLIGHT_ALERTEABUS . '</a>'); |
||
| 538 | |||
| 539 | $GLOBALS['xoopsTpl']->assign('link_main', '<a href="../adslight/">' . _ADSLIGHT_MAIN . '</a>'); |
||
| 540 | $GLOBALS['xoopsTpl']->assign('link_cat', '<a href="viewcats.php?cid=' . addslashes((string)$cid) . '">' . _ADSLIGHT_GORUB . ' ' . $ctitle . '</a>'); |
||
| 541 | |||
| 542 | $GLOBALS['xoopsTpl']->assign('printA', '<img src="assets/images/print.gif" border="0" alt="' . _ADSLIGHT_PRINT . '" > <a rel="nofollow" href="print.php?op=PrintAd&lid=' . $lid . '">' . _ADSLIGHT_PRINT . '</a>'); |
||
| 543 | |||
| 544 | //Google Maps |
||
| 545 | $GLOBALS['xoopsTpl']->assign('adslight_googlemaps', false); |
||
| 546 | if ('' !== $helper->getConfig('GoogleMapsAPIKey') && (1 === $helper->getConfig('adslight_use_GoogleMaps'))) { |
||
| 547 | $GLOBALS['xoopsTpl']->assign('adslight_googlemaps', $helper->getConfig('adslight_use_GoogleMaps')); |
||
| 548 | |||
| 549 | |||
| 550 | } |
||
| 551 | |||
| 552 | |||
| 553 | //($helper->getConfig('useRating') == 1); |
||
| 554 | // if ((is_dir('../rating') && $xoops->isActiveModule('rating'))) { |
||
| 555 | $moduleHandler = xoops_getHandler('module'); |
||
| 556 | $module = $moduleHandler->getByDirname('rating'); |
||
| 557 | if ($module && $module->isactive()) { |
||
| 558 | require XOOPS_ROOT_PATH . '/modules/rating/include/rating.php'; |
||
| 559 | $GLOBALS['xoopsTpl']->assign('ratingPerm', true); |
||
| 560 | $GLOBALS['xoopsTpl']->assign('ratings', rating($lid)); |
||
| 561 | } else { |
||
| 562 | $GLOBALS['xoopsTpl']->assign('ratingPerm', false); |
||
| 563 | } |
||
| 564 | } |
||
| 565 | |||
| 566 | # function categorynewgraphic |
||
| 567 | ##################################################### |
||
| 568 | /** |
||
| 569 | * @param $cid |
||
| 570 | * @return string |
||
| 571 | */ |
||
| 572 | function categorynewgraphic($cid): string |
||
| 573 | { |
||
| 574 | global $xoopsDB; |
||
| 575 | $helper = Helper::getInstance(); |
||
| 576 | |||
| 577 | $cat_perms = ''; |
||
| 578 | $categories = Utility::getMyItemIds('adslight_view'); |
||
| 579 | if (is_array($categories) && count($categories) > 0) { |
||
| 580 | $cat_perms .= ' AND cid IN (' . implode(',', $categories) . ') '; |
||
| 581 | } |
||
| 582 | |||
| 583 | $sql = 'SELECT date_created FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE cid=' . $xoopsDB->escape($cid) . ' AND valid = "Yes" ' . $cat_perms . ' ORDER BY date_created DESC LIMIT 1'; |
||
| 584 | $newresult = $xoopsDB->query($sql); |
||
| 585 | if (!$xoopsDB->isResultSet($newresult)) { |
||
| 586 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||
| 587 | } |
||
| 588 | [$date_created] = $xoopsDB->fetchRow($newresult); |
||
| 589 | |||
| 590 | $newcount = $helper->getConfig('adslight_countday'); |
||
| 591 | $startdate = time() - (86400 * $newcount); |
||
| 592 | if ($startdate < $date_created) { |
||
| 593 | return '<img src="' . XOOPS_URL . '/modules/adslight/assets/images/newred.gif" alt="new" >'; |
||
| 594 | } |
||
|
0 ignored issues
–
show
The function implicitly returns
null when the if condition on line 592 is false. This is incompatible with the type-hinted return string. Consider adding a return statement or allowing null as return value.
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: interface ReturnsInt {
public function returnsIntHinted(): int;
}
class MyClass implements ReturnsInt {
public function returnsIntHinted(): int
{
if (foo()) {
return 123;
}
// here: null is implicitly returned
}
}
Loading history...
|
|||
| 595 | } |
||
| 596 | |||
| 597 | ###################################################### |
||
| 598 | |||
| 599 | $pa = Request::getInt('pa', null, 'GET'); |
||
| 600 | $lid = Request::getInt('lid', null, 'GET'); |
||
| 601 | $cid = Request::getInt('cid', null, 'GET'); |
||
| 602 | $usid = Request::getString('usid', '', 'GET'); |
||
| 603 | $min = Request::getInt('min', null, 'GET'); |
||
| 604 | $show = Request::getInt('show', null, 'GET'); |
||
| 605 | $orderby = Request::getInt('orderby', null, 'GET'); |
||
| 606 | |||
| 607 | switch ($pa) { |
||
| 608 | default: |
||
| 609 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_item.tpl'; |
||
| 610 | |||
| 611 | viewAds($lid); |
||
| 612 | require XOOPS_ROOT_PATH . '/include/comment_view.php'; |
||
| 613 | break; |
||
| 614 | } |
||
| 615 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||
| 616 |