mambax7 /
adslight
| 1 | <?php |
||||||
| 2 | /* |
||||||
| 3 | ------------------------------------------------------------------------- |
||||||
| 4 | ADSLIGHT 2 : Module for Xoops |
||||||
| 5 | |||||||
| 6 | Redesigned and ameliorate By Luc Bizet user at www.frxoops.org |
||||||
| 7 | Started with the Classifieds module and made MANY changes |
||||||
| 8 | Website : http://www.luc-bizet.fr |
||||||
| 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 | use Xmf\Request; |
||||||
| 24 | use XoopsModules\Adslight; |
||||||
| 25 | |||||||
| 26 | require_once __DIR__ . '/header.php'; |
||||||
| 27 | //require_once XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php'; |
||||||
| 28 | xoops_load('XoopsLocal'); |
||||||
| 29 | |||||||
| 30 | $myts = \MyTextSanitizer::getInstance(); |
||||||
| 31 | $module_id = $xoopsModule->getVar('mid'); |
||||||
| 32 | |||||||
| 33 | if (is_object($GLOBALS['xoopsUser'])) { |
||||||
| 34 | $groups = $GLOBALS['xoopsUser']->getGroups(); |
||||||
| 35 | } else { |
||||||
| 36 | $groups = XOOPS_GROUP_ANONYMOUS; |
||||||
| 37 | } |
||||||
| 38 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||||||
| 39 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||||
| 40 | $perm_itemid = Request::getInt('item_id', 0, 'POST'); |
||||||
| 41 | //If no access |
||||||
| 42 | if (!$grouppermHandler->checkRight('adslight_view', $perm_itemid, $groups, $module_id)) { |
||||||
| 43 | redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM); |
||||||
| 44 | } |
||||||
| 45 | if (!$grouppermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $module_id)) { |
||||||
| 46 | $prem_perm = '0'; |
||||||
| 47 | } else { |
||||||
| 48 | $prem_perm = '1'; |
||||||
| 49 | } |
||||||
| 50 | |||||||
| 51 | $mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||||||
| 52 | |||||||
| 53 | # function viewads |
||||||
| 54 | ##################################################### |
||||||
| 55 | /** |
||||||
| 56 | * @param int $lid |
||||||
| 57 | */ |
||||||
| 58 | function viewAds($lid = 0) |
||||||
| 59 | { |
||||||
| 60 | global $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsTpl, $myts, $meta, $prem_perm, $xoopsUser; |
||||||
| 61 | |||||||
| 62 | $moduleDirName = basename(__DIR__); |
||||||
| 63 | |||||||
| 64 | $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
||||||
| 65 | $contact_pm = $contact = ''; |
||||||
| 66 | $pictures_array = []; |
||||||
| 67 | $cid = 0; |
||||||
| 68 | |||||||
| 69 | $tempXoopsLocal = new \XoopsLocal(); |
||||||
| 70 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_item.tpl'; |
||||||
| 71 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||||||
| 72 | require_once XOOPS_ROOT_PATH . '/include/comment_view.php'; |
||||||
| 73 | $lid = ((int)$lid > 0) ? (int)$lid : 0; |
||||||
| 74 | $rate = ('1' == $GLOBALS['xoopsModuleConfig']['adslight_rate_item']) ? '1' : '0'; |
||||||
| 75 | $GLOBALS['xoopsTpl']->assign('rate', $rate); |
||||||
| 76 | $GLOBALS['xoopsTpl']->assign('xmid', $xoopsModule->getVar('mid')); |
||||||
| 77 | $GLOBALS['xoopsTpl']->assign('adslight_logolink', _ADSLIGHT_LOGOLINK); |
||||||
| 78 | |||||||
| 79 | // Hack redirection erreur 404 si lid=null |
||||||
| 80 | if ('' == $lid) { |
||||||
| 81 | header('Status: 301 Moved Permanently', false, 301); |
||||||
| 82 | // header('Location: '.XOOPS_URL.'/modules/adslight/404.php'); |
||||||
| 83 | // exit(); |
||||||
| 84 | redirect_header(XOOPS_URL . '/modules/adslight/404.php', 1); |
||||||
| 85 | } |
||||||
| 86 | |||||||
| 87 | $GLOBALS['xoopsTpl']->assign('adslight_active_bookmark', $GLOBALS['xoopsModuleConfig']['adslight_active_bookmark']); |
||||||
| 88 | $GLOBALS['xoopsTpl']->assign('adslight_style_bookmark', $GLOBALS['xoopsModuleConfig']['adslight_style_bookmark']); |
||||||
| 89 | $GLOBALS['xoopsTpl']->assign('adslight_active_xpayement', $GLOBALS['xoopsModuleConfig']['adslight_active_xpayment']); |
||||||
| 90 | |||||||
| 91 | // adslight 2 |
||||||
| 92 | $GLOBALS['xoopsTpl']->assign('adslight_active_menu', $GLOBALS['xoopsModuleConfig']['adslight_active_menu']); |
||||||
| 93 | $GLOBALS['xoopsTpl']->assign('adslight_active_rss', $GLOBALS['xoopsModuleConfig']['adslight_active_rss']); |
||||||
| 94 | |||||||
| 95 | if ($GLOBALS['xoopsUser']) { |
||||||
| 96 | $member_usid = $GLOBALS['xoopsUser']->getVar('uid'); |
||||||
| 97 | if ($usid = $member_usid) { |
||||||
|
0 ignored issues
–
show
Unused Code
introduced
by
Loading history...
|
|||||||
| 98 | $GLOBALS['xoopsTpl']->assign('istheirs', true); |
||||||
| 99 | |||||||
| 100 | if ('' !== $GLOBALS['xoopsUser']->getVar('name')) { |
||||||
| 101 | $GLOBALS['xoopsTpl']->assign('user_name', $GLOBALS['xoopsUser']->getVar('name') . ' (' . $GLOBALS['xoopsUser']->getVar('uname') . ')'); |
||||||
| 102 | } else { |
||||||
| 103 | $GLOBALS['xoopsTpl']->assign('user_name', $GLOBALS['xoopsUser']->getVar('uname')); |
||||||
| 104 | } |
||||||
| 105 | |||||||
| 106 | $GLOBALS['xoopsTpl']->assign('user_email', $GLOBALS['xoopsUser']->getVar('email')); |
||||||
| 107 | |||||||
| 108 | list($show_user) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE usid=$member_usid")); |
||||||
| 109 | |||||||
| 110 | $GLOBALS['xoopsTpl']->assign('show_user', $show_user); |
||||||
| 111 | $GLOBALS['xoopsTpl']->assign('show_user_link', 'members.php?usid=' . $member_usid); |
||||||
| 112 | } |
||||||
| 113 | } |
||||||
| 114 | |||||||
| 115 | if ($GLOBALS['xoopsUser']) { |
||||||
| 116 | $currentid = $GLOBALS['xoopsUser']->getVar('uid', 'E'); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 117 | } |
||||||
| 118 | |||||||
| 119 | $cat_perms = ''; |
||||||
| 120 | $categories = Adslight\Utility::getMyItemIds('adslight_view'); |
||||||
| 121 | if (is_array($categories) && count($categories) > 0) { |
||||||
| 122 | $cat_perms .= ' AND cid IN (' . implode(',', $categories) . ') '; |
||||||
| 123 | } |
||||||
| 124 | |||||||
| 125 | $result = $xoopsDB->query('SELECT l.lid, l.cid, l.title, l.status, l.expire, l.type, l.desctext, l.tel, l.price, l.typeprice, l.typeusure, l.date, 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 ' |
||||||
| 126 | . $xoopsDB->prefix('adslight_listing') |
||||||
| 127 | . ' l LEFT JOIN ' |
||||||
| 128 | . $xoopsDB->prefix('adslight_pictures') |
||||||
| 129 | . " p ON l.lid=p.lid WHERE l.valid='Yes' AND l.lid = " |
||||||
| 130 | . $xoopsDB->escape($lid) |
||||||
| 131 | . " and l.status!='1' $cat_perms"); |
||||||
| 132 | $recordexist = $xoopsDB->getRowsNum($result); |
||||||
| 133 | |||||||
| 134 | // Hack redirection erreur 404 si recordexist=null |
||||||
| 135 | if ('' == $recordexist) { |
||||||
| 136 | header('Status: 301 Moved Permanently', false, 301); |
||||||
| 137 | // header('Location: '.XOOPS_URL.'/modules/adslight/404.php'); |
||||||
| 138 | // exit(); |
||||||
| 139 | redirect_header(XOOPS_URL . '/modules/adslight/404.php', 1); |
||||||
| 140 | } |
||||||
| 141 | |||||||
| 142 | if ($recordexist) { |
||||||
| 143 | list($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $usid, $town, $country, $contactby, $premium, $valid, $photo, $hits, $item_rating, $item_votes, $user_rating, $user_votes, $comments, $cod_img, $pic_lid, $uid_owner, $url) = $xoopsDB->fetchRow($result); |
||||||
| 144 | |||||||
| 145 | $newcount = $GLOBALS['xoopsModuleConfig']['adslight_countday']; |
||||||
| 146 | $startdate = (time() - (86400 * $newcount)); |
||||||
| 147 | if ($startdate < $date) { |
||||||
| 148 | $newitem = '<img src="' . XOOPS_URL . '/modules/adslight/assets/images/newred.gif" alt="new" >'; |
||||||
| 149 | $GLOBALS['xoopsTpl']->assign('new', $newitem); |
||||||
| 150 | } |
||||||
| 151 | |||||||
| 152 | $updir = $GLOBALS['xoopsModuleConfig']['adslight_link_upload']; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 153 | $GLOBALS['xoopsTpl']->assign('add_from', _ADSLIGHT_ADDFROM . ' ' . $xoopsConfig['sitename']); |
||||||
| 154 | $GLOBALS['xoopsTpl']->assign('add_from_title', _ADSLIGHT_ADDFROM); |
||||||
| 155 | $GLOBALS['xoopsTpl']->assign('add_from_sitename', $xoopsConfig['sitename']); |
||||||
| 156 | $GLOBALS['xoopsTpl']->assign('ad_exists', $recordexist); |
||||||
| 157 | $GLOBALS['xoopsTpl']->assign('mydirname', $moduleDirName); |
||||||
| 158 | |||||||
| 159 | $count = 0; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 160 | $x = 0; |
||||||
| 161 | $i = 0; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 162 | |||||||
| 163 | $result3 = $xoopsDB->query('SELECT cid, pid, title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . $xoopsDB->escape($cid)); |
||||||
| 164 | list($ccid, $pid, $ctitle) = $xoopsDB->fetchRow($result3); |
||||||
| 165 | |||||||
| 166 | $GLOBALS['xoopsTpl']->assign('category_title', $ctitle); |
||||||
| 167 | |||||||
| 168 | $module_id = $xoopsModule->getVar('mid'); |
||||||
| 169 | if (is_object($GLOBALS['xoopsUser'])) { |
||||||
| 170 | $groups = $GLOBALS['xoopsUser']->getGroups(); |
||||||
| 171 | } else { |
||||||
| 172 | $groups = XOOPS_GROUP_ANONYMOUS; |
||||||
| 173 | } |
||||||
| 174 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||||||
| 175 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||||
| 176 | $GLOBALS['xoopsTpl']->assign('purchasable', $grouppermHandler->checkRight('adslight_purchase', $cid, $groups, $module_id)); |
||||||
| 177 | |||||||
| 178 | $ctitle = $myts->htmlSpecialChars($ctitle); |
||||||
| 179 | $varid[$x] = $ccid; |
||||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
| 180 | $varnom[$x] = $ctitle; |
||||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
| 181 | |||||||
| 182 | list($nbe) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE valid="Yes" AND cid=' . $xoopsDB->escape($cid) . ' AND status!="1"')); |
||||||
| 183 | |||||||
| 184 | if (0 != $pid) { |
||||||
| 185 | $x = 1; |
||||||
| 186 | while (0 != $pid) { |
||||||
| 187 | $result4 = $xoopsDB->query('SELECT cid, pid, title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . $xoopsDB->escape($pid)); |
||||||
| 188 | list($ccid, $pid, $ctitle) = $xoopsDB->fetchRow($result4); |
||||||
| 189 | |||||||
| 190 | $ctitle = $myts->htmlSpecialChars($ctitle); |
||||||
| 191 | $varid[$x] = $ccid; |
||||||
| 192 | $varnom[$x] = $ctitle; |
||||||
| 193 | ++$x; |
||||||
| 194 | } |
||||||
| 195 | --$x; |
||||||
| 196 | } |
||||||
| 197 | $subcats = ''; |
||||||
| 198 | $arrow = ' <img src="' . XOOPS_URL . '/modules/adslight/assets/images/arrow.gif" alt="»" >'; |
||||||
| 199 | while (-1 != $x) { |
||||||
| 200 | $subcats .= ' ' . $arrow . ' <a href="viewcats.php?cid=' . $varid[$x] . '">' . $varnom[$x] . '</a>'; |
||||||
| 201 | --$x; |
||||||
| 202 | } |
||||||
| 203 | $GLOBALS['xoopsTpl']->assign('nav_main', '<a href="index.php">' . _ADSLIGHT_MAIN . '</a>'); |
||||||
| 204 | $GLOBALS['xoopsTpl']->assign('nav_sub', $subcats); |
||||||
| 205 | $GLOBALS['xoopsTpl']->assign('nav_subcount', $nbe); |
||||||
| 206 | $viewcount_judge = true; |
||||||
| 207 | $useroffset = ''; |
||||||
| 208 | if ($GLOBALS['xoopsUser']) { |
||||||
| 209 | $timezone = $GLOBALS['xoopsUser']->timezone(); |
||||||
| 210 | if (isset($timezone)) { |
||||||
| 211 | $useroffset = $GLOBALS['xoopsUser']->timezone(); |
||||||
| 212 | } else { |
||||||
| 213 | $useroffset = $xoopsConfig['default_TZ']; |
||||||
| 214 | } |
||||||
| 215 | if ($GLOBALS['xoopsUser']->isAdmin()) { |
||||||
| 216 | $adslight_admin = true; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 217 | } else { |
||||||
| 218 | $adslight_admin = false; |
||||||
| 219 | } |
||||||
| 220 | |||||||
| 221 | if (($adslight_admin = true) |
||||||
| 222 | || ($GLOBALS['xoopsUser']->getVar('uid') == $usid)) { |
||||||
| 223 | $viewcount_judge = false; |
||||||
| 224 | } |
||||||
| 225 | |||||||
| 226 | $contact_pm = '<a href="' . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . addslashes($usid) . '"> ' . _ADSLIGHT_CONTACT_BY_PM . '</a>'; |
||||||
| 227 | } |
||||||
| 228 | if ($viewcount_judge) { |
||||||
| 229 | $xoopsDB->queryF('UPDATE ' . $xoopsDB->prefix('adslight_listing') . ' SET hits=hits+1 WHERE lid = ' . $xoopsDB->escape($lid)); |
||||||
| 230 | } |
||||||
| 231 | if (1 == $item_votes) { |
||||||
| 232 | $votestring = _ADSLIGHT_ONEVOTE; |
||||||
| 233 | } else { |
||||||
| 234 | $votestring = sprintf(_ADSLIGHT_NUMVOTES, $item_votes); |
||||||
| 235 | } |
||||||
| 236 | $date = ($useroffset * 3600) + $date; |
||||||
| 237 | $date2 = $date + ($expire * 86400); |
||||||
| 238 | $date = formatTimestamp($date, 's'); |
||||||
| 239 | $date2 = formatTimestamp($date2, 's'); |
||||||
| 240 | $title = $myts->htmlSpecialChars($title); |
||||||
| 241 | $status = $myts->htmlSpecialChars($status); |
||||||
| 242 | $expire = $myts->htmlSpecialChars($expire); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 243 | $type = $myts->htmlSpecialChars($type); |
||||||
| 244 | $desctext = $myts->displayTarea($desctext, 1, 1, 1); |
||||||
| 245 | $tel = $myts->htmlSpecialChars($tel); |
||||||
| 246 | // $price = XoopsLocal::number_format($price, 2, ',', ' '); |
||||||
| 247 | $typeprice = $myts->htmlSpecialChars($typeprice); |
||||||
| 248 | $typeusure = $myts->htmlSpecialChars($typeusure); |
||||||
| 249 | $submitter = $myts->htmlSpecialChars($submitter); |
||||||
| 250 | $usid = $myts->htmlSpecialChars($usid); |
||||||
| 251 | $town = $myts->htmlSpecialChars($town); |
||||||
| 252 | $country = $myts->htmlSpecialChars($country); |
||||||
| 253 | $contactby = $myts->htmlSpecialChars($contactby); |
||||||
| 254 | $premium = $myts->htmlSpecialChars($premium); |
||||||
| 255 | |||||||
| 256 | if (2 == $status) { |
||||||
| 257 | $sold = _ADSLIGHT_RESERVED; |
||||||
| 258 | } else { |
||||||
| 259 | $sold = ''; |
||||||
| 260 | } |
||||||
| 261 | |||||||
| 262 | $GLOBALS['xoopsTpl']->assign('printA', '<a href="print.php?op=PrintAd&lid=' . $lid . '" ><img src="assets/images/print.gif" border=0 alt="' . _ADSLIGHT_PRINT . '" ></a> '); |
||||||
| 263 | |||||||
| 264 | if ($usid > 0) { |
||||||
| 265 | $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>'); |
||||||
| 266 | } else { |
||||||
| 267 | $GLOBALS['xoopsTpl']->assign('submitter', _ADSLIGHT_VIEW_MY_ADS . ' $submitter'); |
||||||
| 268 | } |
||||||
| 269 | $GLOBALS['xoopsTpl']->assign('lid', $lid); |
||||||
| 270 | $GLOBALS['xoopsTpl']->assign('read', "$hits " . _ADSLIGHT_VIEW2); |
||||||
| 271 | $GLOBALS['xoopsTpl']->assign('rating', $tempXoopsLocal->number_format($item_rating, 2)); |
||||||
|
0 ignored issues
–
show
The call to
XoopsLocal::number_format() has too many arguments starting with 2.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. Loading history...
|
|||||||
| 272 | $GLOBALS['xoopsTpl']->assign('votes', $votestring); |
||||||
| 273 | $GLOBALS['xoopsTpl']->assign('lang_rating', _ADSLIGHT_RATINGC); |
||||||
| 274 | $GLOBALS['xoopsTpl']->assign('lang_ratethisitem', _ADSLIGHT_RATETHISITEM); |
||||||
| 275 | $GLOBALS['xoopsTpl']->assign('xoop_user', false); |
||||||
| 276 | $isOwner = ''; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 277 | if ($GLOBALS['xoopsUser']) { |
||||||
| 278 | $GLOBALS['xoopsTpl']->assign('xoop_user', true); |
||||||
| 279 | $currentid = $GLOBALS['xoopsUser']->getVar('uid', 'E'); |
||||||
| 280 | if ($usid == $currentid) { |
||||||
| 281 | $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>'); |
||||||
| 282 | $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>'); |
||||||
| 283 | $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>'); |
||||||
| 284 | |||||||
| 285 | $isOwner = true; |
||||||
| 286 | $GLOBALS['xoopsTpl']->assign('isOwner', $isOwner); |
||||||
| 287 | } |
||||||
| 288 | if ($GLOBALS['xoopsUser']->isAdmin()) { |
||||||
| 289 | $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>'); |
||||||
| 290 | } |
||||||
| 291 | } |
||||||
| 292 | |||||||
| 293 | $result7 = $xoopsDB->query('SELECT nom_type FROM ' . $xoopsDB->prefix('adslight_type') . " WHERE id_type='" . $xoopsDB->escape($type) . "'"); |
||||||
| 294 | list($nom_type) = $xoopsDB->fetchRow($result7); |
||||||
| 295 | |||||||
| 296 | $result8 = $xoopsDB->query('SELECT nom_price FROM ' . $xoopsDB->prefix('adslight_price') . " WHERE id_price='" . $xoopsDB->escape($typeprice) . "'"); |
||||||
| 297 | list($nom_price) = $xoopsDB->fetchRow($result8); |
||||||
| 298 | |||||||
| 299 | $result9 = $xoopsDB->query('SELECT nom_usure FROM ' . $xoopsDB->prefix('adslight_usure') . " WHERE id_usure='" . $xoopsDB->escape($typeusure) . "'"); |
||||||
| 300 | list($nom_usure) = $xoopsDB->fetchRow($result9); |
||||||
| 301 | |||||||
| 302 | $GLOBALS['xoopsTpl']->assign('type', $myts->htmlSpecialChars($nom_type)); |
||||||
| 303 | $GLOBALS['xoopsTpl']->assign('title', $title); |
||||||
| 304 | $GLOBALS['xoopsTpl']->assign('status', $status); |
||||||
| 305 | $GLOBALS['xoopsTpl']->assign('desctext', $desctext); |
||||||
| 306 | $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title . ' - ' . $town . ': ' . $country . ' - ' . $ctitle); |
||||||
| 307 | |||||||
| 308 | // meta description tags for ads |
||||||
| 309 | $desctextclean = strip_tags($desctext, '<span><img><strong><i><u>'); |
||||||
| 310 | $GLOBALS['xoTheme']->addMeta('meta', 'description', "$title - " . mb_substr($desctextclean, 0, 150)); |
||||||
| 311 | |||||||
| 312 | if ($price > 0) { |
||||||
| 313 | $GLOBALS['xoopsTpl']->assign('price', '<strong>' . _ADSLIGHT_PRICE2 . '</strong>' . $price . ' ' . $GLOBALS['xoopsModuleConfig']['adslight_currency_symbol'] . ' - ' . $typeprice); |
||||||
| 314 | $GLOBALS['xoopsTpl']->assign('price_head', _ADSLIGHT_PRICE2); |
||||||
| 315 | // $GLOBALS['xoopsTpl']->assign('price_price', $price.' '.$GLOBALS['xoopsModuleConfig']['adslight_currency_symbol'].' '); |
||||||
| 316 | |||||||
| 317 | $GLOBALS['xoopsTpl']->assign('price_price', Adslight\Utility::getMoneyFormat('%.2n', $price)); |
||||||
| 318 | |||||||
| 319 | $GLOBALS['xoopsTpl']->assign('price_typeprice', $myts->htmlSpecialChars($nom_price)); |
||||||
| 320 | $GLOBALS['xoopsTpl']->assign('price_currency', $GLOBALS['xoopsModuleConfig']['adslight_currency_code']); |
||||||
| 321 | $GLOBALS['xoopsTpl']->assign('price_amount', $price); |
||||||
| 322 | } |
||||||
| 323 | |||||||
| 324 | $GLOBALS['xoopsTpl']->assign('usure_typeusure', $nom_usure); |
||||||
| 325 | $GLOBALS['xoopsTpl']->assign('premium', $premium); |
||||||
| 326 | |||||||
| 327 | // $GLOBALS['xoopsTpl']->assign('mustlogin', _ADSLIGHT_MUSTLOGIN); |
||||||
| 328 | $GLOBALS['xoopsTpl']->assign('redirect', '' . '?xoops_redirect=/modules/adslight/index.php'); |
||||||
| 329 | |||||||
| 330 | if ($town) { |
||||||
| 331 | $GLOBALS['xoopsTpl']->assign('local_town', $town); |
||||||
| 332 | } |
||||||
| 333 | if (1 == $GLOBALS['xoopsModuleConfig']['adslight_use_country']) { |
||||||
| 334 | if ($country) { |
||||||
| 335 | $GLOBALS['xoopsTpl']->assign('local_country', $country); |
||||||
| 336 | $GLOBALS['xoopsTpl']->assign('country_head', '<img src="assets/images/world_go.png" border="0" alt="country" > ' . _ADSLIGHT_COUNTRY); |
||||||
| 337 | } |
||||||
| 338 | } |
||||||
| 339 | |||||||
| 340 | $tphon = ''; |
||||||
| 341 | if ($tel) { |
||||||
| 342 | $tphon = '<br>' . _ADSLIGHT_ORBY . ' <strong>' . _ADSLIGHT_TEL . '</strong> ' . $tel; |
||||||
| 343 | } |
||||||
| 344 | |||||||
| 345 | if (1 == $contactby) { |
||||||
| 346 | $contact = '<a rel="nofollow" href="contact.php?lid=' . $lid . '">' . _ADSLIGHT_BYMAIL2 . '</a>' . $tphon . ''; |
||||||
| 347 | } |
||||||
| 348 | if (2 == $contactby) { |
||||||
| 349 | $contact = $contact_pm . '' . $tphon; |
||||||
| 350 | } |
||||||
| 351 | if (3 == $contactby) { |
||||||
| 352 | $contact = '<a rel="nofollow" href="contact.php?lid=' . $lid . '">' . _ADSLIGHT_BYMAIL2 . '</a>' . $tphon . '<br>' . _ADSLIGHT_ORBY . '' . $contact_pm; |
||||||
| 353 | } |
||||||
| 354 | if (4 == $contactby) { |
||||||
| 355 | $contact = '<br><strong>' . _ADSLIGHT_TEL . '</strong> ' . $tel; |
||||||
| 356 | } |
||||||
| 357 | // $GLOBALS['xoopsTpl']->assign('contact', $contact); |
||||||
| 358 | $GLOBALS['xoopsTpl']->assign('local_head', '<img src="assets/images/house.png" border="0" alt="local_head" > ' . _ADSLIGHT_LOCAL); |
||||||
| 359 | |||||||
| 360 | if ($lid) { |
||||||
| 361 | if ($sold) { |
||||||
| 362 | $GLOBALS['xoopsTpl']->assign('bullinfotext', $sold); |
||||||
| 363 | } else { |
||||||
| 364 | if ($GLOBALS['xoopsUser']) { |
||||||
| 365 | $GLOBALS['xoopsTpl']->assign('bullinfotext', _ADSLIGHT_CONTACT_SUBMITTER . ' ' . $submitter . ' ' . _ADSLIGHT_CONTACTBY2 . ' ' . $contact); |
||||||
| 366 | } else { |
||||||
| 367 | $GLOBALS['xoopsTpl']->assign('bullinfotext', '<span style="color: #de090e;"><b>' . _ADSLIGHT_MUSTLOGIN . '</b></span>'); |
||||||
| 368 | } |
||||||
| 369 | } |
||||||
| 370 | } |
||||||
| 371 | |||||||
| 372 | $user_profile = \XoopsUser::getUnameFromId($usid); |
||||||
| 373 | $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>'); |
||||||
| 374 | |||||||
| 375 | if ('' != $photo) { |
||||||
| 376 | |||||||
| 377 | |||||||
| 378 | $criteria_lid = new \Criteria('lid', $lid); |
||||||
| 379 | $criteria_uid = new \Criteria('uid', $usid); |
||||||
| 380 | $album_factory = new Adslight\PicturesHandler($xoopsDB); |
||||||
| 381 | $pictures_object_array = $album_factory->getObjects($criteria_lid, $criteria_uid); |
||||||
|
0 ignored issues
–
show
$criteria_uid of type Criteria is incompatible with the type boolean expected by parameter $id_as_key of XoopsModules\Adslight\Pi...esHandler::getObjects().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 382 | $pictures_number = $album_factory->getCount($criteria_lid, $criteria_uid); |
||||||
|
0 ignored issues
–
show
The call to
XoopsModules\Adslight\PicturesHandler::getCount() has too many arguments starting with $criteria_uid.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. Loading history...
|
|||||||
| 383 | if (0 == $pictures_number) { |
||||||
| 384 | $nopicturesyet = _ADSLIGHT_NOTHINGYET; |
||||||
| 385 | $GLOBALS['xoopsTpl']->assign('lang_nopicyet', $nopicturesyet); |
||||||
| 386 | } else { |
||||||
| 387 | /** |
||||||
| 388 | * Lets populate an array with the data from the pictures |
||||||
| 389 | */ |
||||||
| 390 | $i = 0; |
||||||
| 391 | foreach ($pictures_object_array as $picture) { |
||||||
| 392 | $pictures_array[$i]['url'] = $picture->getVar('url', 's'); |
||||||
| 393 | $pictures_array[$i]['desc'] = $picture->getVar('title', 's'); |
||||||
| 394 | $pictures_array[$i]['cod_img'] = $picture->getVar('cod_img', 's'); |
||||||
| 395 | $pictures_array[$i]['lid'] = $picture->getVar('lid', 's'); |
||||||
| 396 | $GLOBALS['xoopsTpl']->assign('pics_array', $pictures_array); |
||||||
| 397 | |||||||
| 398 | ++$i; |
||||||
| 399 | } |
||||||
| 400 | } |
||||||
| 401 | $owner = new \XoopsUser(); |
||||||
| 402 | $identifier = $owner::getUnameFromId($usid); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 403 | if (1 == $GLOBALS['xoopsModuleConfig']['adslight_lightbox']) { |
||||||
| 404 | $header_lightbox = '<link rel="stylesheet" href="' . XOOPS_URL . '/modules/adslight/assets/css/adslight.css" type="text/css" media="all" > |
||||||
| 405 | <script type="text/javascript" src="assets/lightbox/js/jquery-1.7.2.min.js"></script> |
||||||
| 406 | <script type="text/javascript" src="assets/lightbox/js/jquery-ui-1.8.18.custom.min"></script> |
||||||
| 407 | <script type="text/javascript" src="assets/lightbox/js/jquery.smooth-scroll.min.js"></script> |
||||||
| 408 | <script type="text/javascript" src="assets/lightbox/js/lightbox.js"></script> |
||||||
| 409 | <link rel="stylesheet" href="assets/css/galery.css" type="text/css" media="screen" > |
||||||
| 410 | <link rel="stylesheet" type="text/css" media="screen" href="assets/lightbox/css/lightbox.css"></link>'; |
||||||
| 411 | } else { |
||||||
| 412 | $header_lightbox = '<link rel="stylesheet" href="' . XOOPS_URL . '/modules/adslight/assets/css/adslight.css" type="text/css" media="all" > |
||||||
| 413 | <link rel="stylesheet" href="assets/css/galery.css" type="text/css" media="screen" >'; |
||||||
| 414 | } |
||||||
| 415 | |||||||
| 416 | $GLOBALS['xoopsTpl']->assign('path_uploads', $GLOBALS['xoopsModuleConfig']['adslight_link_upload']); |
||||||
| 417 | |||||||
| 418 | $GLOBALS['xoopsTpl']->assign('permit', $prem_perm); |
||||||
| 419 | |||||||
| 420 | if ($GLOBALS['xoopsModuleConfig']['active_rewriteurl'] > 0) { |
||||||
| 421 | /* ici le meta Canonicale pour le Rewrite */ |
||||||
| 422 | $GLOBALS['xoopsTpl']->assign('xoops_module_header', $header_lightbox); |
||||||
| 423 | } else { |
||||||
| 424 | $GLOBALS['xoopsTpl']->assign('xoops_module_header', $header_lightbox); |
||||||
| 425 | } |
||||||
| 426 | $GLOBALS['xoopsTpl']->assign('photo', $photo); |
||||||
| 427 | $GLOBALS['xoopsTpl']->assign('pic_lid', $pic_lid); |
||||||
| 428 | $GLOBALS['xoopsTpl']->assign('pic_owner', $uid_owner); |
||||||
| 429 | } else { |
||||||
| 430 | $GLOBALS['xoopsTpl']->assign('photo', ''); |
||||||
| 431 | } |
||||||
| 432 | $GLOBALS['xoopsTpl']->assign('date', '<img alt="date" border="0" src="assets/images/date.png" > <strong>' |
||||||
| 433 | . _ADSLIGHT_DATE2 |
||||||
| 434 | . ':</strong> ' |
||||||
| 435 | . $date |
||||||
| 436 | . '<br><img alt="date_error" border="0" src="assets/images/date_error.png" > <strong>' |
||||||
| 437 | . _ADSLIGHT_DISPO |
||||||
| 438 | . ':</strong> ' |
||||||
| 439 | . $date2); |
||||||
| 440 | } else { |
||||||
| 441 | $GLOBALS['xoopsTpl']->assign('no_ad', _ADSLIGHT_NOCLAS); |
||||||
| 442 | } |
||||||
| 443 | $result8 = $xoopsDB->query('SELECT title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . $xoopsDB->escape($cid)); |
||||||
| 444 | |||||||
| 445 | list($ctitle) = $xoopsDB->fetchRow($result8); |
||||||
| 446 | $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>'); |
||||||
| 447 | |||||||
| 448 | $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>'); |
||||||
| 449 | |||||||
| 450 | $GLOBALS['xoopsTpl']->assign('link_main', '<a href="../adslight/">' . _ADSLIGHT_MAIN . '</a>'); |
||||||
| 451 | $GLOBALS['xoopsTpl']->assign('link_cat', '<a href="viewcats.php?cid=' . addslashes($cid) . '">' . _ADSLIGHT_GORUB . ' ' . $ctitle . '</a>'); |
||||||
| 452 | |||||||
| 453 | $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>'); |
||||||
| 454 | } |
||||||
| 455 | |||||||
| 456 | # function categorynewgraphic |
||||||
| 457 | ##################################################### |
||||||
| 458 | /** |
||||||
| 459 | * @param $cid |
||||||
| 460 | * |
||||||
| 461 | * @return string |
||||||
| 462 | */ |
||||||
| 463 | function categorynewgraphic($cid) |
||||||
| 464 | { |
||||||
| 465 | global $xoopsDB; |
||||||
| 466 | |||||||
| 467 | $cat_perms = ''; |
||||||
| 468 | $categories = Adslight\Utility::getMyItemIds('adslight_view'); |
||||||
| 469 | if (is_array($categories) && count($categories) > 0) { |
||||||
| 470 | $cat_perms .= ' AND cid IN (' . implode(',', $categories) . ') '; |
||||||
| 471 | } |
||||||
| 472 | |||||||
| 473 | $newresult = $xoopsDB->query('SELECT date FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE cid=' . $xoopsDB->escape($cid) . ' AND valid = "Yes" ' . $cat_perms . ' ORDER BY DATE DESC LIMIT 1'); |
||||||
| 474 | list($date) = $xoopsDB->fetchRow($newresult); |
||||||
| 475 | |||||||
| 476 | $newcount = $GLOBALS['xoopsModuleConfig']['adslight_countday']; |
||||||
| 477 | $startdate = (time() - (86400 * $newcount)); |
||||||
| 478 | if ($startdate < $date) { |
||||||
| 479 | return '<img src="' . XOOPS_URL . '/modules/adslight/assets/images/newred.gif" alt="new" >'; |
||||||
| 480 | } |
||||||
| 481 | } |
||||||
| 482 | |||||||
| 483 | ###################################################### |
||||||
| 484 | |||||||
| 485 | $pa = Request::getInt('pa', null, 'GET'); |
||||||
| 486 | $lid = Request::getInt('lid', null, 'GET'); |
||||||
| 487 | $cid = Request::getInt('cid', null, 'GET'); |
||||||
| 488 | $usid = Request::getString('usid', '', 'GET'); |
||||||
| 489 | $min = Request::getInt('min', null, 'GET'); |
||||||
| 490 | $show = Request::getInt('show', null, 'GET'); |
||||||
| 491 | $orderby = Request::getInt('orderby', null, 'GET'); |
||||||
| 492 | |||||||
| 493 | switch ($pa) { |
||||||
| 494 | default: |
||||||
| 495 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_item.tpl'; |
||||||
| 496 | |||||||
| 497 | viewAds($lid); |
||||||
| 498 | break; |
||||||
| 499 | } |
||||||
| 500 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||||
| 501 |