mambax7 /
adslight
| 1 | <?php |
||||||
|
0 ignored issues
–
show
|
|||||||
| 2 | /* |
||||||
| 3 | ------------------------------------------------------------------------- |
||||||
| 4 | ADSLIGHT 2 : Module for Xoops |
||||||
| 5 | |||||||
| 6 | Redesigned and ameliorate By iluc user at www.frxoops.org |
||||||
| 7 | Started with the Classifieds module and made MANY changes |
||||||
| 8 | Website : http://www.limonads.com |
||||||
| 9 | Contact : [email protected] |
||||||
| 10 | ------------------------------------------------------------------------- |
||||||
| 11 | Original credits below Version History |
||||||
| 12 | ########################################################################## |
||||||
| 13 | # Classified Module for Xoops # |
||||||
| 14 | # By John Mordo user jlm69 at www.xoops.org and www.jlmzone.com # |
||||||
| 15 | # Started with the MyAds module and made MANY changes # |
||||||
| 16 | ########################################################################## |
||||||
| 17 | Original Author: Pascal Le Boustouller |
||||||
| 18 | Author Website : [email protected] |
||||||
| 19 | Licence Type : GPL |
||||||
| 20 | ------------------------------------------------------------------------- |
||||||
| 21 | */ |
||||||
| 22 | |||||||
| 23 | use Xmf\Request; |
||||||
|
0 ignored issues
–
show
The type
Xmf\Request was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 24 | use XoopsModules\Adslight; |
||||||
| 25 | |||||||
| 26 | require_once __DIR__ . '/header.php'; |
||||||
| 27 | //require XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php'; |
||||||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
38% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||||||
| 28 | |||||||
| 29 | $myts = \MyTextSanitizer::getInstance(); |
||||||
|
0 ignored issues
–
show
The type
MyTextSanitizer was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 30 | $module_id = $xoopsModule->getVar('mid'); |
||||||
| 31 | |||||||
| 32 | $groups = ($GLOBALS['xoopsUser'] instanceof \XoopsUser) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; |
||||||
|
0 ignored issues
–
show
The type
XoopsUser was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 33 | |||||||
| 34 | /** @var XoopsGroupPermHandler $gpermHandler */ |
||||||
| 35 | $gpermHandler = xoops_getHandler('groupperm'); |
||||||
|
0 ignored issues
–
show
The function
xoops_getHandler was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 36 | |||||||
| 37 | $perm_itemid = Request::getInt('item_id', 0, 'POST'); |
||||||
| 38 | |||||||
| 39 | if (!$gpermHandler->checkRight('adslight_view', $perm_itemid, $groups, $module_id)) { |
||||||
| 40 | redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM); |
||||||
|
0 ignored issues
–
show
The function
redirect_header was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 41 | } |
||||||
| 42 | |||||||
| 43 | $prem_perm = (!$gpermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $module_id)) ? '0' : '1'; |
||||||
| 44 | |||||||
| 45 | include XOOPS_ROOT_PATH . '/modules/adslight/class/classifiedstree.php'; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 46 | //include XOOPS_ROOT_PATH . '/modules/adslight/class/Utility.php'; |
||||||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
38% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||||||
| 47 | $mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||||||
| 48 | |||||||
| 49 | |||||||
| 50 | # function index |
||||||
| 51 | ##################################################### |
||||||
| 52 | |||||||
| 53 | function index() |
||||||
| 54 | { |
||||||
| 55 | global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $mytree, $meta, $mid, $moduleDirName, $main_lang, $prem_perm, $xoopsModule; |
||||||
| 56 | $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
||||||
|
0 ignored issues
–
show
The type
Xmf\Module\Admin was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 57 | |||||||
| 58 | if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) { |
||||||
|
0 ignored issues
–
show
The type
XoopsTpl was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 59 | require_once $GLOBALS['xoops']->path('class/template.php'); |
||||||
| 60 | $GLOBALS['xoopsTpl'] = new \XoopsTpl(); |
||||||
| 61 | } |
||||||
| 62 | |||||||
| 63 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_index.tpl'; |
||||||
| 64 | |||||||
| 65 | // include XOOPS_ROOT_PATH . '/header.php'; |
||||||
| 66 | |||||||
| 67 | $GLOBALS['xoopsTpl']->assign('xmid', $xoopsModule->getVar('mid')); |
||||||
| 68 | $GLOBALS['xoopsTpl']->assign('add_from', _ADSLIGHT_ADDFROM . ' ' . $xoopsConfig['sitename']); |
||||||
| 69 | $GLOBALS['xoopsTpl']->assign('add_from_title', _ADSLIGHT_ADDFROM); |
||||||
| 70 | $GLOBALS['xoopsTpl']->assign('add_from_sitename', $xoopsConfig['sitename']); |
||||||
| 71 | $GLOBALS['xoopsTpl']->assign('only_pix', _ADSLIGHT_ONLYPIX); |
||||||
| 72 | $GLOBALS['xoopsTpl']->assign('adslight_logolink', _ADSLIGHT_LOGOLINK); |
||||||
| 73 | $GLOBALS['xoopsTpl']->assign('permit', $prem_perm); |
||||||
| 74 | |||||||
| 75 | $GLOBALS['xoopsTpl']->assign('xoops_module_header', '<link rel="stylesheet" href="' . XOOPS_URL . '/modules/adslight/assets/css/adslight.css" type="text/css" media="all" >'); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 76 | |||||||
| 77 | $banner = xoops_getbanner(); |
||||||
|
0 ignored issues
–
show
The function
xoops_getbanner was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 78 | $GLOBALS['xoopsTpl']->assign('banner', $banner); |
||||||
| 79 | $GLOBALS['xoopsTpl']->assign('use_extra_code', $GLOBALS['xoopsModuleConfig']['adslight_use_index_code']); |
||||||
| 80 | $GLOBALS['xoopsTpl']->assign('adslight_use_banner', $GLOBALS['xoopsModuleConfig']['adslight_use_banner']); |
||||||
| 81 | $GLOBALS['xoopsTpl']->assign('index_extra_code', $GLOBALS['xoopsModuleConfig']['adslight_index_code']); |
||||||
| 82 | $GLOBALS['xoopsTpl']->assign('index_code_place', $GLOBALS['xoopsModuleConfig']['adslight_index_code_place']); |
||||||
| 83 | $GLOBALS['xoopsTpl']->assign('category_title2', _ADSLIGHT_ANNONCES); |
||||||
| 84 | // adslight 2 |
||||||
| 85 | $GLOBALS['xoopsTpl']->assign('adslight_active_menu', $GLOBALS['xoopsModuleConfig']['adslight_active_menu']); |
||||||
| 86 | $GLOBALS['xoopsTpl']->assign('adslight_active_rss', $GLOBALS['xoopsModuleConfig']['adslight_active_rss']); |
||||||
| 87 | |||||||
| 88 | // ExpireAd(); |
||||||
| 89 | Adslight\Utility::expireAd(); |
||||||
| 90 | |||||||
| 91 | if ($GLOBALS['xoopsUser']) { |
||||||
| 92 | $member_usid = $GLOBALS['xoopsUser']->getVar('uid'); |
||||||
| 93 | if ($usid = $member_usid) { |
||||||
| 94 | $GLOBALS['xoopsTpl']->assign('istheirs', true); |
||||||
| 95 | |||||||
| 96 | list($show_user) = $xoopsDB->fetchRow($xoopsDB->query('SELECT SQL_CACHE COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE usid=' . $member_usid . '')); |
||||||
| 97 | |||||||
| 98 | $GLOBALS['xoopsTpl']->assign('show_user', $show_user); |
||||||
| 99 | $GLOBALS['xoopsTpl']->assign('show_user_link', 'members.php?usid=' . $member_usid . ''); |
||||||
| 100 | } |
||||||
| 101 | } |
||||||
| 102 | |||||||
| 103 | $result = $xoopsDB->query('SELECT SQL_CACHE COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE valid="No"'); |
||||||
| 104 | list($propo) = $xoopsDB->fetchRow($result); |
||||||
| 105 | |||||||
| 106 | if ($propo > 0) { |
||||||
| 107 | $GLOBALS['xoopsTpl']->assign('moderated', true); |
||||||
| 108 | } |
||||||
| 109 | if ($GLOBALS['xoopsUser'] instanceof \XoopsUser) { |
||||||
| 110 | if ($GLOBALS['xoopsUser']->isAdmin()) { |
||||||
| 111 | $GLOBALS['xoopsTpl']->assign('admin_block', _ADSLIGHT_ADMINCADRE); |
||||||
| 112 | if (0 == $propo) { |
||||||
| 113 | $GLOBALS['xoopsTpl']->assign('confirm_ads', _ADSLIGHT_NO_CLA); |
||||||
| 114 | } else { |
||||||
| 115 | $GLOBALS['xoopsTpl']->assign('confirm_ads', _ADSLIGHT_THEREIS . ' ' . $propo . ' ' . _ADSLIGHT_WAIT . '<br><a href="' . XOOPS_URL . '/modules/adslight/admin/validate_ads.php">' . _ADSLIGHT_SEEIT . '</a>'); |
||||||
| 116 | } |
||||||
| 117 | } |
||||||
| 118 | |||||||
| 119 | $categories = Adslight\Utility::getMyItemIds('adslight_submit'); |
||||||
| 120 | $intro = (is_array($categories) |
||||||
| 121 | && (count($categories) > 0)) ? _ADSLIGHT_INTRO : ''; |
||||||
| 122 | $GLOBALS['xoopsTpl']->assign('intro', $intro); |
||||||
| 123 | } |
||||||
| 124 | |||||||
| 125 | $sql = 'SELECT SQL_CACHE cid, title, img FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE pid = 0 '; |
||||||
| 126 | |||||||
| 127 | $categories = Adslight\Utility::getMyItemIds('adslight_view'); |
||||||
| 128 | if (is_array($categories) && count($categories) > 0) { |
||||||
| 129 | $sql .= ' AND cid IN (' . implode(',', $categories) . ') '; |
||||||
| 130 | } else { |
||||||
| 131 | redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM); |
||||||
|
0 ignored issues
–
show
The function
redirect_header was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 132 | } |
||||||
| 133 | |||||||
| 134 | $sql .= ('cat_order' == $GLOBALS['xoopsModuleConfig']['adslight_csortorder']) ? 'ORDER BY cat_order' : 'ORDER BY title'; |
||||||
| 135 | |||||||
| 136 | $result = $xoopsDB->query($sql); |
||||||
| 137 | |||||||
| 138 | $count = 1; |
||||||
| 139 | $content = ''; |
||||||
| 140 | while (false !== ($myrow = $xoopsDB->fetchArray($result))) { |
||||||
| 141 | $title = $myts->htmlSpecialChars($myrow['title']); |
||||||
| 142 | |||||||
| 143 | if ($myrow['img'] && 'http://' !== $myrow['img']) { |
||||||
| 144 | $cat_img = $myts->htmlSpecialChars($myrow['img']); |
||||||
| 145 | $img = "<a href=\"viewcats.php?cid={$myrow['cid']}\"><img src=\"" . XOOPS_URL . "/modules/adslight/assets/images/img_cat/{$cat_img}\" align=\"middle\" alt=\"{$title}\"></a>"; |
||||||
| 146 | } else { |
||||||
| 147 | $img = ''; |
||||||
| 148 | } |
||||||
| 149 | |||||||
| 150 | $totallisting = Adslight\Utility::getTotalItems($myrow['cid'], 1); |
||||||
| 151 | $content .= $title . ' '; |
||||||
| 152 | |||||||
| 153 | $arr = []; |
||||||
| 154 | if (in_array($myrow['cid'], $categories)) { |
||||||
| 155 | $arr = $mytree->getFirstChild($myrow['cid'], 'title'); |
||||||
| 156 | $space = 0; |
||||||
| 157 | $chcount = 1; |
||||||
| 158 | $subcategories = ''; |
||||||
| 159 | if (1 == $GLOBALS['xoopsModuleConfig']['adslight_souscat']) { |
||||||
| 160 | foreach ($arr as $ele) { |
||||||
| 161 | if (in_array($ele['cid'], $categories)) { |
||||||
| 162 | $chtitle = $myts->htmlSpecialChars($ele['title']); |
||||||
| 163 | if ($chcount > $GLOBALS['xoopsModuleConfig']['adslight_nbsouscat']) { |
||||||
| 164 | $subcategories .= "<a href=\"viewcats.php?cid={$myrow['cid']}\">" . _ADSLIGHT_CATPLUS . '</a>'; |
||||||
| 165 | break; |
||||||
| 166 | } |
||||||
| 167 | if ($space > 0) { |
||||||
| 168 | $subcategories .= '<br>'; |
||||||
| 169 | } |
||||||
| 170 | $subcategories .= '- <a href="' . XOOPS_URL . "/modules/adslight/viewcats.php?cid={$ele['cid']}\">{$chtitle}</a>"; |
||||||
| 171 | ++$space; |
||||||
| 172 | ++$chcount; |
||||||
| 173 | $content .= $ele['title'] . ' '; |
||||||
| 174 | } |
||||||
| 175 | } |
||||||
| 176 | } |
||||||
| 177 | $GLOBALS['xoopsTpl']->append('categories', [ |
||||||
| 178 | 'image' => $img, |
||||||
| 179 | 'id' => $myrow['cid'], |
||||||
| 180 | 'title' => $myts->htmlSpecialChars($myrow['title']), |
||||||
| 181 | 'new' => categorynewgraphic($myrow['cid']), |
||||||
| 182 | 'subcategories' => $subcategories, |
||||||
| 183 | 'totallisting' => $totallisting, |
||||||
| 184 | 'count' => $count |
||||||
| 185 | ]); |
||||||
| 186 | ++$count; |
||||||
| 187 | } |
||||||
| 188 | } |
||||||
| 189 | $cat_perms = ''; |
||||||
| 190 | if (is_array($categories) && count($categories) > 0) { |
||||||
| 191 | $cat_perms .= ' AND cid IN (' . implode(',', $categories) . ') '; |
||||||
| 192 | } |
||||||
| 193 | |||||||
| 194 | list($ads) = $xoopsDB->fetchRow($xoopsDB->query('SELECT SQL_CACHE COUNT(*) FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid='Yes' AND status!='1' {$cat_perms}")); |
||||||
| 195 | |||||||
| 196 | list($catt) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix("{$moduleDirName}_categories"))); |
||||||
| 197 | |||||||
| 198 | $submit_perms = Adslight\Utility::getMyItemIds('adslight_submit'); |
||||||
| 199 | |||||||
| 200 | if ($GLOBALS['xoopsUser'] instanceof \XoopsUser) { |
||||||
| 201 | $add_listing = '' . _ADSLIGHT_ADD_LISTING_BULLOK . '<a href="add.php">' . _ADSLIGHT_ADD_LISTING_SUBOK . '</a>'; |
||||||
| 202 | } else { |
||||||
| 203 | $add_listing = '' . _ADSLIGHT_ADD_LISTING_BULL . '<a href="' . XOOPS_URL . '/register.php">' . _ADSLIGHT_ADD_LISTING_SUB . '</a>.'; |
||||||
| 204 | } |
||||||
| 205 | |||||||
| 206 | $GLOBALS['xoopsTpl']->assign('bullinfotext', _ADSLIGHT_ACTUALY . ' ' . $ads . ' ' . _ADSLIGHT_ADVERTISEMENTS . '<br>' . $add_listing); |
||||||
| 207 | $GLOBALS['xoopsTpl']->assign('total_confirm', _ADSLIGHT_AND . " $propo " . _ADSLIGHT_WAIT3); |
||||||
| 208 | |||||||
| 209 | if (1 == $GLOBALS['xoopsModuleConfig']['adslight_newad']) { |
||||||
| 210 | $cat_perms = ''; |
||||||
| 211 | if (is_array($categories) && count($categories) > 0) { |
||||||
| 212 | $cat_perms .= ' AND cid IN (' . implode(',', $categories) . ') '; |
||||||
| 213 | } |
||||||
| 214 | |||||||
| 215 | $result = $xoopsDB->query('SELECT SQL_CACHE lid, title, status, type, price, typeprice, date, town, country, usid, premium, valid, photo, hits FROM ' |
||||||
| 216 | . $xoopsDB->prefix('adslight_listing') |
||||||
| 217 | . " WHERE valid='Yes' and status!='1' {$cat_perms} ORDER BY date DESC LIMIT {$GLOBALS['xoopsModuleConfig']['adslight_newcount']}"); |
||||||
| 218 | if ($result) { |
||||||
| 219 | $GLOBALS['xoopsTpl']->assign('last_head', _ADSLIGHT_THE . ' ' . $GLOBALS['xoopsModuleConfig']['adslight_newcount'] . ' ' . _ADSLIGHT_LASTADD); |
||||||
| 220 | $GLOBALS['xoopsTpl']->assign('last_head_title', _ADSLIGHT_TITLE); |
||||||
| 221 | $GLOBALS['xoopsTpl']->assign('last_head_price', _ADSLIGHT_PRICE); |
||||||
| 222 | $GLOBALS['xoopsTpl']->assign('last_head_date', _ADSLIGHT_DATE); |
||||||
| 223 | $GLOBALS['xoopsTpl']->assign('last_head_local', _ADSLIGHT_LOCAL2); |
||||||
| 224 | $GLOBALS['xoopsTpl']->assign('last_head_hits', _ADSLIGHT_VIEW); |
||||||
| 225 | $GLOBALS['xoopsTpl']->assign('last_head_photo', _ADSLIGHT_PHOTO); |
||||||
| 226 | $rank = 1; |
||||||
| 227 | |||||||
| 228 | while (false !== (list($lid, $title, $status, $type, $price, $typeprice, $date, $town, $country, $usid, $premium, $valid, $photo, $hits) = $xoopsDB->fetchRow($result))) { |
||||||
| 229 | $title = $myts->htmlSpecialChars($title); |
||||||
| 230 | $type = $myts->htmlSpecialChars($type); |
||||||
| 231 | // $price = number_format($price, 2, ',', ' '); |
||||||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||||||
| 232 | $town = $myts->htmlSpecialChars($town); |
||||||
| 233 | $country = $myts->htmlSpecialChars($country); |
||||||
| 234 | $premium = $myts->htmlSpecialChars($premium); |
||||||
| 235 | $a_item = []; |
||||||
| 236 | $newcount = $GLOBALS['xoopsModuleConfig']['adslight_countday']; |
||||||
| 237 | $startdate = (time() - (86400 * $newcount)); |
||||||
| 238 | |||||||
| 239 | if ($startdate < $date) { |
||||||
| 240 | $newitem = '<img src="' . XOOPS_URL . '/modules/adslight/assets/images/newred.gif" alt="new" >'; |
||||||
| 241 | $a_item['new'] = $newitem; |
||||||
| 242 | } |
||||||
| 243 | |||||||
| 244 | $useroffset = ''; |
||||||
| 245 | if ($GLOBALS['xoopsUser'] instanceof \XoopsUser) { |
||||||
| 246 | $timezone = $GLOBALS['xoopsUser']->timezone(); |
||||||
| 247 | $useroffset = (!empty($timezone)) ? $xoopsUser->timezone() : $xoopsConfig['default_TZ']; |
||||||
| 248 | if ($xoopsUser->isAdmin()) { |
||||||
| 249 | $a_item['admin'] = '<a href="' . XOOPS_URL . "/modules/adslight/admin/validate_ads.php?op=ModifyAds&lid={$lid}\"><img src=\"{$pathIcon16}/edit.png\" border=\"0\" alt=\"" . _ADSLIGHT_MODADMIN . '"></a>'; |
||||||
| 250 | } |
||||||
| 251 | } |
||||||
| 252 | |||||||
| 253 | $date = ($useroffset * 3600) + $date; |
||||||
| 254 | $date = formatTimestamp($date, 's'); |
||||||
|
0 ignored issues
–
show
The function
formatTimestamp was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 255 | |||||||
| 256 | $result7 = $xoopsDB->query('SELECT nom_type FROM ' . $xoopsDB->prefix('adslight_type') . ' WHERE id_type=' . (int)$type); |
||||||
| 257 | list($nom_type) = $xoopsDB->fetchRow($result7); |
||||||
| 258 | |||||||
| 259 | $a_item['type'] = $myts->htmlSpecialChars($nom_type); |
||||||
| 260 | $a_item['title'] = '<a href="' . XOOPS_URL . "/modules/adslight/viewads.php?lid={$lid}\"><strong>{$title}</strong></a>"; |
||||||
| 261 | |||||||
| 262 | $result8 = $xoopsDB->query('SELECT nom_price FROM ' . $xoopsDB->prefix('adslight_price') . ' WHERE id_price=' . (int)$typeprice); |
||||||
| 263 | list($nom_price) = $xoopsDB->fetchRow($result8); |
||||||
| 264 | |||||||
| 265 | if ($price > 0) { |
||||||
| 266 | $a_item['price'] = $price . ' ' . $GLOBALS['xoopsModuleConfig']['adslight_currency_symbol'] . ''; |
||||||
| 267 | $a_item['price_typeprice'] = $myts->htmlSpecialChars($nom_price); |
||||||
| 268 | } else { |
||||||
| 269 | $a_item['price'] = ''; |
||||||
| 270 | $a_item['price_typeprice'] = $myts->htmlSpecialChars($nom_price); |
||||||
| 271 | } |
||||||
| 272 | $a_item['premium'] = $premium; |
||||||
| 273 | $a_item['date'] = $date; |
||||||
| 274 | $a_item['local'] .= $town ?: ''; |
||||||
| 275 | $a_item['country'] = $country ?: ''; |
||||||
| 276 | |||||||
| 277 | if (2 == $status) { |
||||||
| 278 | $a_item['sold'] = _ADSLIGHT_RESERVEDMEMBER; |
||||||
| 279 | } |
||||||
| 280 | |||||||
| 281 | if ($xoopsModuleConfig['active_thumbsindex'] > 0) { |
||||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
| 282 | $a_item['no_photo'] = '<a href="' . XOOPS_URL . "/modules/adslight/viewads.php?lid={$lid}\"><img class=\"thumb\" src=\"" . XOOPS_URL . "/modules/adslight/assets/images/nophoto.jpg\" align=\"left\" width=\"100px\" alt=\"{$title}\"></a>"; |
||||||
| 283 | |||||||
| 284 | $updir = $GLOBALS['xoopsModuleConfig']['adslight_link_upload']; |
||||||
| 285 | $sql = 'SELECT cod_img, lid, uid_owner, url FROM ' . $xoopsDB->prefix('adslight_pictures') . ' WHERE uid_owner=' . (int)$usid . " AND lid={$lid} ORDER BY date_added ASC LIMIT 1"; |
||||||
| 286 | |||||||
| 287 | $resultp = $xoopsDB->query($sql); |
||||||
| 288 | |||||||
| 289 | while (false !== (list($cod_img, $pic_lid, $uid_owner, $url) = $xoopsDB->fetchRow($resultp))) { |
||||||
| 290 | if ($photo) { |
||||||
| 291 | $a_item['photo'] = '<a href="' . XOOPS_URL . "/modules/adslight/viewads.php?lid={$lid}\"><img class=\"thumb\" src=\"{$updir}/thumbs/thumb_{$url}\" align=\"left\" width=\"100px\" alt=\"{$title}\"></a>"; |
||||||
| 292 | } |
||||||
| 293 | } |
||||||
| 294 | } else { |
||||||
| 295 | $a_item['no_photo'] = '<img src="' . XOOPS_URL . "/modules/adslight/assets/images/camera_nophoto.png\" align=\"left\" width=\"24px\" alt=\"{$title}\">"; |
||||||
| 296 | $updir = $GLOBALS['xoopsModuleConfig']['adslight_link_upload']; |
||||||
| 297 | $sql = 'SELECT cod_img, lid, uid_owner, url FROM ' . $xoopsDB->prefix('adslight_pictures') . ' WHERE uid_owner=' . (int)$usid . " AND lid={$lid} ORDER BY date_added ASC LIMIT 1"; |
||||||
| 298 | $resultp = $xoopsDB->query($sql); |
||||||
| 299 | |||||||
| 300 | while (false !== (list($cod_img, $pic_lid, $uid_owner, $url) = $xoopsDB->fetchRow($resultp))) { |
||||||
| 301 | if ($photo) { |
||||||
| 302 | $a_item['photo'] = '<img src="' . XOOPS_URL . "/modules/adslight/assets/images/camera_photo.png\" align=\"left\" width=\"24\" alt=\"{$title}\">"; |
||||||
| 303 | } |
||||||
| 304 | } |
||||||
| 305 | } |
||||||
| 306 | $a_item['hits'] = $hits; |
||||||
| 307 | ++$rank; |
||||||
| 308 | $GLOBALS['xoopsTpl']->append('items', $a_item); |
||||||
| 309 | } |
||||||
| 310 | } |
||||||
| 311 | } |
||||||
| 312 | } |
||||||
| 313 | |||||||
| 314 | # function categorynewgraphic |
||||||
| 315 | ##################################################### |
||||||
| 316 | /** |
||||||
| 317 | * @param $cid |
||||||
| 318 | */ |
||||||
| 319 | function categorynewgraphic($cid) |
||||||
| 320 | { |
||||||
| 321 | global $xoopsDB; |
||||||
| 322 | } |
||||||
| 323 | |||||||
| 324 | ###################################################### |
||||||
| 325 | |||||||
| 326 | $pa = Request::getInt('pa', null, 'GET'); |
||||||
| 327 | $lid = Request::getInt('lid', null, 'GET'); |
||||||
| 328 | $cid = Request::getInt('cid', null, 'GET'); |
||||||
| 329 | $usid = Request::getString('usid', '', 'GET'); |
||||||
| 330 | $min = Request::getInt('min', null, 'GET'); |
||||||
| 331 | $show = Request::getInt('show', null, 'GET'); |
||||||
| 332 | $orderby = Request::getInt('orderby', null, 'GET'); |
||||||
| 333 | |||||||
| 334 | switch ($pa) { |
||||||
| 335 | case 'Adsview': |
||||||
| 336 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_category.tpl'; |
||||||
| 337 | adsView($cid, $min, $orderby, $show); |
||||||
| 338 | break; |
||||||
| 339 | case 'viewads': |
||||||
| 340 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_item.tpl'; |
||||||
| 341 | viewAds($lid); |
||||||
| 342 | break; |
||||||
| 343 | default: |
||||||
| 344 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_index.tpl'; |
||||||
| 345 | index(); |
||||||
| 346 | break; |
||||||
| 347 | } |
||||||
| 348 | |||||||
| 349 | include XOOPS_ROOT_PATH . '/footer.php'; |
||||||
| 350 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.