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