These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* |
||
3 | ------------------------------------------------------------------------- |
||
4 | ADSLIGHT 2 : Module for Xoops |
||
5 | |||
6 | Redesigned and ameliorate By 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 | |||
25 | require_once __DIR__ . '/header.php'; |
||
26 | //include XOOPS_ROOT_PATH . '/modules/adslight/class/utility.php'; |
||
0 ignored issues
–
show
|
|||
27 | |||
28 | $myts = MyTextSanitizer::getInstance(); // MyTextSanitizer object |
||
29 | $module_id = $xoopsModule->getVar('mid'); |
||
30 | $groups = ($GLOBALS['xoopsUser'] instanceof XoopsUser) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; |
||
0 ignored issues
–
show
The class
XoopsUser does not exist. Did you forget a USE statement, or did you not list all dependencies?
This error could be the result of: 1. Missing dependenciesPHP Analyzer uses your Are you sure this class is defined by one of your dependencies, or did you maybe
not list a dependency in either the 2. Missing use statementPHP does not complain about undefined classes in if ($x instanceof DoesNotExist) {
// Do something.
}
If you have not tested against this specific condition, such errors might go unnoticed. ![]() |
|||
31 | /** @var XoopsGroupPermHandler $gpermHandler */ |
||
32 | $gpermHandler = xoops_getHandler('groupperm'); |
||
33 | $perm_itemid = Request::getInt('item_id', 0, 'POST'); |
||
34 | |||
35 | //If no access |
||
36 | View Code Duplication | if (!$gpermHandler->checkRight('adslight_premium', $perm_itemid, $groups, $module_id)) { |
|
37 | redirect_header(XOOPS_URL . '/modules/adslight/index.php', 3, _NOPERM); |
||
38 | } |
||
39 | require_once XOOPS_ROOT_PATH . '/modules/adslight/class/classifiedstree.php'; |
||
40 | $mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||
41 | |||
42 | $lid = Request::getInt('lid', 0, 'GET'); |
||
43 | $GLOBALS['xoopsOption']['template_main'] = 'adslight_replies.tpl'; |
||
44 | include XOOPS_ROOT_PATH . '/header.php'; |
||
45 | |||
46 | $xoopsTpl->assign('nav_main', '<a href="index.php">' . _ADSLIGHT_MAIN . '</a>'); |
||
47 | $show = 1; |
||
48 | $min = Request::getInt('min', 0, 'GET'); |
||
49 | if (!isset($max)) { |
||
50 | $max = $min + $show; |
||
51 | } |
||
52 | $orderby = 'date Desc'; |
||
53 | |||
54 | $xoopsTpl->assign('lid', $lid); |
||
55 | $countresult = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_replies') . ' WHERE lid=' . $xoopsDB->escape($lid)); |
||
56 | list($trow) = $xoopsDB->fetchRow($countresult); |
||
57 | $trows = $trow; |
||
58 | $pagenav = ''; |
||
59 | |||
60 | if ($trows < '1') { |
||
61 | $xoopsTpl->assign('has_replies', false); |
||
62 | $xoopsTpl->assign('no_more_replies', _ADSLIGHT_NO_REPLIES); |
||
63 | } |
||
64 | |||
65 | if ($trows > '0') { |
||
66 | $xoopsTpl->assign('has_replies', true); |
||
67 | $xoopsTpl->assign('last_head', _ADSLIGHT_THE . ' ' . $GLOBALS['xoopsModuleConfig']['adslight_newcount'] . ' ' . _ADSLIGHT_LASTADD); |
||
68 | $xoopsTpl->assign('last_head_title', _ADSLIGHT_TITLE); |
||
69 | $xoopsTpl->assign('last_head_price', _ADSLIGHT_PRICE); |
||
70 | $xoopsTpl->assign('last_head_date', _ADSLIGHT_DATE); |
||
71 | $xoopsTpl->assign('last_head_local', _ADSLIGHT_LOCAL2); |
||
72 | $xoopsTpl->assign('last_head_views', _ADSLIGHT_VIEW); |
||
73 | $xoopsTpl->assign('last_head_photo', _ADSLIGHT_PHOTO); |
||
74 | $xoopsTpl->assign('min', $min); |
||
75 | |||
76 | $sql = 'SELECT r_lid, lid, title, date, submitter, message, tele, email, r_usid FROM ' . $xoopsDB->prefix('adslight_replies') . ' WHERE lid=' . $xoopsDB->escape($lid) . " ORDER BY $orderby"; |
||
77 | $result = $xoopsDB->query($sql, $show, $min); |
||
78 | |||
79 | if ($trows > '1') { |
||
80 | $xoopsTpl->assign('has_replies', true); |
||
81 | $xoopsTpl->assign('show_nav', true); |
||
82 | $xoopsTpl->assign('lang_sortby', _ADSLIGHT_SORTBY); |
||
83 | $xoopsTpl->assign('lang_title', _ADSLIGHT_TITLE); |
||
84 | $xoopsTpl->assign('lang_titleatoz', _ADSLIGHT_TITLEATOZ); |
||
85 | $xoopsTpl->assign('lang_titleztoa', _ADSLIGHT_TITLEZTOA); |
||
86 | $xoopsTpl->assign('lang_date', _ADSLIGHT_DATE); |
||
87 | $xoopsTpl->assign('lang_dateold', _ADSLIGHT_DATEOLD); |
||
88 | $xoopsTpl->assign('lang_datenew', _ADSLIGHT_DATENEW); |
||
89 | $xoopsTpl->assign('lang_popularity', _ADSLIGHT_POPULARITY); |
||
90 | $xoopsTpl->assign('lang_popularityleast', _ADSLIGHT_POPULARITYLTOM); |
||
91 | $xoopsTpl->assign('lang_popularitymost', _ADSLIGHT_POPULARITYMTOL); |
||
92 | $xoopsTpl->assign('lang_cursortedby', _ADSLIGHT_CURSORTEDBY . '' . $orderby); |
||
93 | } |
||
94 | |||
95 | while (list($r_lid, $lid, $title, $date, $submitter, $message, $tele, $email, $r_usid) = $xoopsDB->fetchRow($result)) { |
||
96 | $useroffset = ''; |
||
97 | if ($GLOBALS['xoopsUser']) { |
||
98 | $timezone = $GLOBALS['xoopsUser']->timezone(); |
||
99 | if (isset($timezone)) { |
||
100 | $useroffset = $GLOBALS['xoopsUser']->timezone(); |
||
101 | } else { |
||
102 | $useroffset = $xoopsConfig['default_TZ']; |
||
103 | } |
||
104 | } |
||
105 | $r_usid = $r_usid; |
||
106 | $xoopsTpl->assign('submitter', " <a href='" . XOOPS_URL . "/userinfo.php?uid=$r_usid'>$submitter</a>"); |
||
107 | $date = ($useroffset * 3600) + $date; |
||
108 | $date = formatTimestamp($date, 's'); |
||
109 | $xoopsTpl->assign('title', "<a href='viewads.php?lid=$lid'>$title</a>"); |
||
110 | $xoopsTpl->assign('title_head', _ADSLIGHT_REPLY_TITLE); |
||
111 | $xoopsTpl->assign('date_head', _ADSLIGHT_REPLIED_ON); |
||
112 | $xoopsTpl->assign('submitter_head', _ADSLIGHT_REPLIED_BY); |
||
113 | $xoopsTpl->assign('message_head', _ADSLIGHT_REPLY_MESSAGE); |
||
114 | $xoopsTpl->assign('email_head', _ADSLIGHT_EMAIL); |
||
115 | $xoopsTpl->assign('tele_head', _ADSLIGHT_TEL); |
||
116 | $xoopsTpl->assign('email', "<a href ='mailto:$email'>$email</a>"); |
||
117 | $xoopsTpl->assign('delete_reply', "<a href='modify.php?op=DelReply&r_lid=$r_lid'>" . _ADSLIGHT_DELETE_REPLY . '</a>'); |
||
118 | $xoopsTpl->append('items', array( |
||
119 | 'id' => $lid, |
||
120 | 'title' => $myts->htmlSpecialChars($title), |
||
121 | 'date' => $date, |
||
122 | 'message' => $myts->displayTarea($message), |
||
123 | 'tele' => $myts->htmlSpecialChars($tele) |
||
124 | )); |
||
125 | } |
||
126 | $lid = Request::getInt('lid', 0, 'GET'); |
||
127 | //Calculates how many pages exist. Which page one should be on, etc... |
||
128 | $linkpages = ceil($trows / $show); |
||
129 | //Page Numbering |
||
130 | View Code Duplication | if ($linkpages != 1 && $linkpages != 0) { |
|
131 | $prev = $min - $show; |
||
132 | if ($prev >= 0) { |
||
133 | $pagenav .= "<a href='replies.php?lid=$lid&min=$prev&show=$show'><strong><u>«</u></strong></a> "; |
||
134 | } |
||
135 | $counter = 1; |
||
136 | $currentpage = ($max / $show); |
||
137 | while ($counter <= $linkpages) { |
||
138 | $mintemp = ($show * $counter) - $show; |
||
139 | if ($counter == $currentpage) { |
||
140 | $pagenav .= "<strong>($counter)</strong> "; |
||
141 | } else { |
||
142 | $pagenav .= "<a href='replies.php?lid=$lid&min=$mintemp&show=$show'>$counter</a> "; |
||
143 | } |
||
144 | ++$counter; |
||
145 | } |
||
146 | if ($trows > $max) { |
||
147 | $pagenav .= "<a href='replies.php?lid=$lid&min=$max&show=$show'>"; |
||
148 | $pagenav .= '<strong><u>»</u></strong></a>'; |
||
149 | } |
||
150 | $xoopsTpl->assign('nav_page', '<strong>' . _ADSLIGHT_REPLY . "</strong> $pagenav"); |
||
151 | } |
||
152 | } |
||
153 | |||
154 | include XOOPS_ROOT_PATH . '/footer.php'; |
||
155 |
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.