These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
0 ignored issues
–
show
|
|||
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 | include_once __DIR__ . '/header.php'; |
||
24 | $moduleDirName = basename( __DIR__ ) ; |
||
25 | $main_lang = '_' . strtoupper( $moduleDirName ) ; |
||
26 | require_once( XOOPS_ROOT_PATH."/modules/adslight/include/gtickets.php" ) ; |
||
27 | $myts =& MyTextSanitizer::getInstance(); |
||
28 | $module_id = $xoopsModule->getVar('mid'); |
||
29 | |||
30 | if (is_object($xoopsUser)) { |
||
31 | $groups = $xoopsUser->getGroups(); |
||
32 | } else { |
||
33 | $groups = XOOPS_GROUP_ANONYMOUS; |
||
34 | } |
||
35 | $gperm_handler =& xoops_gethandler('groupperm'); |
||
36 | View Code Duplication | if (isset($_POST['item_id'])) { |
|
1 ignored issue
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
37 | $perm_itemid = intval($_POST['item_id']); |
||
38 | } else { |
||
39 | $perm_itemid = 0; |
||
40 | } |
||
41 | //If no access |
||
42 | View Code Duplication | if (!$gperm_handler->checkRight("adslight_submit", $perm_itemid, $groups, $module_id)) { |
|
1 ignored issue
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
43 | redirect_header(XOOPS_URL."/modules/adslight/index.php", 3, _NOPERM); |
||
44 | exit(); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @param $lid |
||
49 | * @param $ok |
||
50 | */ |
||
51 | function ListingDel($lid, $ok) |
||
0 ignored issues
–
show
The function
ListingDel() has been defined more than once; this definition is ignored, only the first definition in admin/modify_ads.php (L331-359) is considered.
This check looks for functions that have already been defined in other files. Some Codebases, like WordPress, make a practice of defining functions multiple times. This
may lead to problems with the detection of function parameters and types. If you really
need to do this, you can mark the duplicate definition with the /**
* @ignore
*/
function getUser() {
}
function getUser($id, $realm) {
}
See also the PhpDoc documentation for @ignore. ![]() |
|||
52 | { |
||
53 | global $xoopsDB, $xoopsUser, $xoopsConfig, $xoopsTheme, $xoopsLogger, $moduleDirName, $main_lang; |
||
54 | |||
55 | $result = $xoopsDB->query("select usid FROM ".$xoopsDB->prefix("adslight_listing")." where lid=".mysql_real_escape_string($lid).""); |
||
56 | list($usid) = $xoopsDB->fetchRow($result); |
||
57 | |||
58 | $result1 = $xoopsDB->query("select url FROM ".$xoopsDB->prefix("adslight_pictures")." where lid=".mysql_real_escape_string($lid).""); |
||
59 | |||
60 | if ($xoopsUser) { |
||
61 | $currentid = $xoopsUser->getVar("uid", "E"); |
||
62 | if ($usid == $currentid) { |
||
63 | if ($ok==1) { |
||
64 | while ( list( $purl ) = $xoopsDB->fetchRow( $result1 ) ) { |
||
65 | if ($purl) { |
||
66 | $destination = XOOPS_ROOT_PATH."/uploads/AdsLight"; |
||
67 | if (file_exists("$destination/$purl")) { |
||
68 | unlink("$destination/$purl"); |
||
69 | } |
||
70 | $destination2 = XOOPS_ROOT_PATH."/uploads/AdsLight/thumbs"; |
||
71 | if (file_exists("$destination2/thumb_$purl")) { |
||
72 | unlink("$destination2/thumb_$purl"); |
||
73 | } |
||
74 | $destination3 = XOOPS_ROOT_PATH."/uploads/AdsLight/midsize"; |
||
75 | if (file_exists("$destination3/resized_$purl")) { |
||
76 | unlink("$destination3/resized_$purl"); |
||
77 | } |
||
78 | |||
79 | $xoopsDB->queryf("delete from ".$xoopsDB->prefix("adslight_pictures")." where lid=".mysql_real_escape_string($lid).""); |
||
80 | } |
||
81 | } |
||
82 | $xoopsDB->queryf("delete from ".$xoopsDB->prefix("adslight_listing")." where lid=".mysql_real_escape_string($lid).""); |
||
83 | redirect_header("index.php",1,_ADSLIGHT_ANNDEL); |
||
84 | exit(); |
||
0 ignored issues
–
show
The function ListingDel() contains an exit expression.
An exit expression should only be used in rare cases. For example, if you write a short command line script. In most cases however, using an ![]() |
|||
85 | } else { |
||
86 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='8'><tr class='bg4'><td valign='top'>\n"; |
||
87 | echo "<br /><center>"; |
||
88 | echo "<strong>"._ADSLIGHT_SURDELANN."</strong><br /><br />"; |
||
89 | } |
||
90 | echo "[ <a href=\"modify.php?op=ListingDel&lid=".$lid."&ok=1\">"._ADSLIGHT_OUI."</a> | <a href=\"index.php\">"._ADSLIGHT_NON."</a> ]<br /><br />"; |
||
91 | echo "</td></tr></table>"; |
||
92 | } |
||
93 | } |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * @param $r_lid |
||
98 | * @param $ok |
||
99 | */ |
||
100 | function DelReply($r_lid, $ok) |
||
101 | { |
||
102 | global $xoopsDB, $xoopsUser, $xoopsConfig, $xoopsTheme, $xoopsLogger, $moduleDirName, $main_lang; |
||
103 | |||
104 | $result = $xoopsDB->query("select l.usid, r.r_lid, r.lid, r.title, r.date, r.submitter, r.message, r.tele, r.email, r.r_usid FROM ".$xoopsDB->prefix("adslight_listing")." l LEFT JOIN ".$xoopsDB->prefix("adslight_replies")." r ON l.lid=r.lid where r.r_lid=".mysql_real_escape_string($r_lid).""); |
||
105 | list($usid, $r_lid, $rlid, $title, $date, $submitter, $message, $tele, $email, $r_usid) = $xoopsDB->fetchRow($result); |
||
106 | |||
107 | if ($xoopsUser) { |
||
108 | $currentid = $xoopsUser->getVar("uid", "E"); |
||
109 | if ($usid == $currentid) { |
||
110 | if ($ok==1) { |
||
111 | $xoopsDB->queryf("delete from ".$xoopsDB->prefix("adslight_replies")." where r_lid=".mysql_real_escape_string($r_lid).""); |
||
112 | redirect_header("members.php?usid=".addslashes($usid)."",1,_ADSLIGHT_ANNDEL); |
||
113 | exit(); |
||
0 ignored issues
–
show
The function DelReply() contains an exit expression.
An exit expression should only be used in rare cases. For example, if you write a short command line script. In most cases however, using an ![]() |
|||
114 | } else { |
||
115 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='8'><tr class='bg4'><td valign='top'>\n"; |
||
116 | echo "<br /><center>"; |
||
117 | echo "<strong>"._ADSLIGHT_SURDELANN."</strong><br /><br />"; |
||
118 | } |
||
119 | echo "[ <a href=\"modify.php?op=DelReply&r_lid=".addslashes($r_lid)."&ok=1\">"._ADSLIGHT_OUI."</a> | <a href=\"members.php?usid=".addslashes($usid)."\">"._ADSLIGHT_NON."</a> ]<br /><br />"; |
||
120 | echo "</td></tr></table>"; |
||
121 | |||
122 | } |
||
123 | } |
||
124 | } |
||
125 | |||
126 | /** |
||
127 | * @param $lid |
||
128 | */ |
||
129 | function ModAd($lid) |
||
130 | { |
||
131 | global $xoopsDB, $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $xoopsUser, $xoopsTheme, $myts, $xoopsLogger, $moduleDirName, $main_lang; |
||
132 | |||
133 | include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php"; |
||
134 | include_once XOOPS_ROOT_PATH."/modules/adslight/include/functions.php"; |
||
135 | echo "<script language=\"javascript\">\nfunction CLA(CLA) { var MainWindow = window.open (CLA, \"_blank\",\"width=500,height=300,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no\");}\n</script>"; |
||
136 | |||
137 | include_once(XOOPS_ROOT_PATH."/modules/adslight/class/classifiedstree.php"); |
||
138 | $mytree = new ClassifiedsTree($xoopsDB->prefix("adslight_categories"),"cid","pid"); |
||
139 | |||
140 | $result = $xoopsDB->query("select lid, cid, title, status, expire, type, desctext, tel, price, typeprice, typeusure, date, email, submitter, usid, town, country, contactby, premium, valid from ".$xoopsDB->prefix("adslight_listing")." where lid=".mysql_real_escape_string($lid).""); |
||
141 | list($lid, $cide, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $usid, $town, $country, $contactby, $premium, $valid) = $xoopsDB->fetchRow($result); |
||
142 | |||
143 | $categories = adslight_MygetItemIds("adslight_submit"); |
||
144 | View Code Duplication | if (is_array($categories) && count($categories) > 0) { |
|
145 | if (!in_array($cide, $categories)) { |
||
146 | redirect_header(XOOPS_URL."/modules/adslight/index.php", 3, _NOPERM); |
||
147 | exit(); |
||
0 ignored issues
–
show
The function ModAd() contains an exit expression.
An exit expression should only be used in rare cases. For example, if you write a short command line script. In most cases however, using an ![]() |
|||
148 | } |
||
149 | } else { // User can't see any category |
||
150 | redirect_header(XOOPS_URL.'/index.php', 3, _NOPERM); |
||
151 | exit(); |
||
0 ignored issues
–
show
The function ModAd() contains an exit expression.
An exit expression should only be used in rare cases. For example, if you write a short command line script. In most cases however, using an ![]() |
|||
152 | } |
||
153 | |||
154 | if ($xoopsUser) { |
||
155 | $calusern = $xoopsUser->uid(); |
||
156 | if ($usid == $calusern) { |
||
157 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._ADSLIGHT_MODIFANN."</legend><br /><br />"; |
||
158 | $title = $myts->htmlSpecialChars($title); |
||
159 | $status = $myts->htmlSpecialChars($status); |
||
160 | $expire = $myts->htmlSpecialChars($expire); |
||
161 | $type = $myts->htmlSpecialChars($type); |
||
162 | $desctext = $myts->displayTarea($desctext,1); |
||
163 | $tel = $myts->htmlSpecialChars($tel); |
||
164 | $price = number_format($price, 2, ",", " "); |
||
165 | $typeprice = $myts->htmlSpecialChars($typeprice); |
||
166 | $typeusure = $myts->htmlSpecialChars($typeusure); |
||
167 | $submitter = $myts->htmlSpecialChars($submitter); |
||
168 | $town = $myts->htmlSpecialChars($town); |
||
169 | $country = $myts->htmlSpecialChars($country); |
||
170 | $contactby = $myts->htmlSpecialChars($contactby); |
||
171 | $premium = $myts->htmlSpecialChars($premium); |
||
172 | $useroffset = ""; |
||
173 | View Code Duplication | if ($xoopsUser) { |
|
174 | $timezone = $xoopsUser->timezone(); |
||
175 | if (isset($timezone)) { |
||
176 | $useroffset = $xoopsUser->timezone(); |
||
177 | } else { |
||
178 | $useroffset = $xoopsConfig['default_TZ']; |
||
179 | } |
||
180 | } |
||
181 | $dates = ($useroffset*3600) + $date; |
||
182 | $dates = formatTimestamp($date,"s"); |
||
183 | |||
184 | echo "<form action=\"modify.php\" method=post enctype=\"multipart/form-data\"> |
||
185 | <table><tr class=\"head\" border=\"2\"> |
||
186 | <td class=\"head\">"._ADSLIGHT_NUMANNN." </td><td class=\"head\" border=\"1\">$lid "._ADSLIGHT_DU." $dates</td> |
||
187 | </tr><tr>"; |
||
188 | |||
189 | if ($xoopsModuleConfig["adslight_diff_name"] == "1") { |
||
190 | echo "<td class=\"head\">"._ADSLIGHT_SENDBY." </td><td class=\"head\"><input type=\"text\" name=\"submitter\" size=\"50\" value=\"$submitter\" /></td>"; |
||
191 | } else { |
||
192 | echo "<td class=\"head\">"._ADSLIGHT_SENDBY." </td><td class=\"head\"><input type=\"hidden\" name=\"submitter\" value=\"$submitter\">$submitter</td>"; |
||
193 | } |
||
194 | echo "</tr><tr>"; |
||
195 | |||
196 | if ($contactby == 1) { $contactselect = _ADSLIGHT_CONTACT_BY_EMAIL; } |
||
197 | if ($contactby == 2) { $contactselect = _ADSLIGHT_CONTACT_BY_PM; } |
||
198 | if ($contactby == 3) { $contactselect = _ADSLIGHT_CONTACT_BY_BOTH; } |
||
199 | if ($contactby == 4) { $contactselect = _ADSLIGHT_CONTACT_BY_PHONE; } |
||
200 | |||
201 | echo " <td class='head'>"._ADSLIGHT_CONTACTBY." </td><td class='head'><select name=\"contactby\"> |
||
202 | <option value=\"".$contactby."\">".$contactselect."</option> |
||
203 | <option value=\"1\">"._ADSLIGHT_CONTACT_BY_EMAIL."</option> |
||
204 | <option value=\"2\">"._ADSLIGHT_CONTACT_BY_PM."</option> |
||
205 | <option value=\"3\">"._ADSLIGHT_CONTACT_BY_BOTH."</option> |
||
206 | <option value=\"4\">"._ADSLIGHT_CONTACT_BY_PHONE."</option></select></td></tr>"; |
||
207 | |||
208 | if ($xoopsModuleConfig["adslight_diff_email"] == '1') { |
||
209 | |||
210 | echo "<tr><td class=\"head\">"._ADSLIGHT_EMAIL." </td><td class=\"head\"><input type=\"text\" name=\"email\" size=\"50\" value=\"$email\" /></td>"; |
||
211 | } else { |
||
212 | echo "<tr><td class=\"head\">"._ADSLIGHT_EMAIL." </td><td class=\"head\">$email<input type=\"hidden\" name=\"email\" value=\"$email\" /></td>"; |
||
213 | } |
||
214 | echo "</tr><tr> |
||
215 | <td class=\"head\">"._ADSLIGHT_TEL." </td><td class=\"head\"><input type=\"text\" name=\"tel\" size=\"50\" value=\"$tel\" /></td> |
||
216 | </tr>"; |
||
217 | echo "<tr> |
||
218 | <td class=\"head\">"._ADSLIGHT_TOWN." </td><td class=\"head\"><input type=\"text\" name=\"town\" size=\"50\" value=\"$town\" /></td> |
||
219 | </tr>"; |
||
220 | if ($xoopsModuleConfig["adslight_use_country"] == '1') { |
||
221 | echo "<tr> |
||
222 | <td class=\"head\">"._ADSLIGHT_COUNTRY." </td><td class=\"head\"><input type=\"text\" name=\"country\" size=\"50\" value=\"$country\" /></td> |
||
223 | </tr>"; |
||
224 | } else { |
||
225 | echo "<input type=\"hidden\" name=\"country\" value=\"\">"; |
||
226 | } |
||
227 | |||
228 | echo "<tr><td class='head'>"._ADSLIGHT_STATUS."</td><td class='head'><input type=\"radio\" name=\"status\" value=\"0\""; |
||
229 | if ($status == "0") { |
||
230 | echo "checked"; |
||
231 | } |
||
232 | echo ">"._ADSLIGHT_ACTIVE." <input type=\"radio\" name=\"status\" value=\"1\""; |
||
233 | if ($status == "1") { |
||
234 | echo "checked"; |
||
235 | } |
||
236 | echo ">"._ADSLIGHT_INACTIVE." <input type=\"radio\" name=\"status\" value=\"2\""; |
||
237 | if ($status == "2") { |
||
238 | echo "checked"; |
||
239 | } |
||
240 | echo ">"._ADSLIGHT_SOLD."</td></tr>"; |
||
241 | echo "<tr> |
||
242 | <td class=\"head\">"._ADSLIGHT_TITLE2." </td><td class=\"head\"><input type=\"text\" name=\"title\" size=\"50\" value=\"$title\" /></td> |
||
243 | </tr>"; |
||
244 | echo "<tr><td class=\"head\">"._ADSLIGHT_PRICE2." </td><td class=\"head\"><input type=\"text\" name=\"price\" size=\"20\" value=\"$price\" /> ". $xoopsModuleConfig["adslight_money"]; |
||
245 | |||
246 | $result3 = $xoopsDB->query("select nom_price, id_price from ".$xoopsDB->prefix("adslight_price")." order by id_price"); |
||
247 | echo " <select name=\"typeprice\">"; |
||
248 | while (list($nom_price, $id_price) = $xoopsDB->fetchRow($result3)) { |
||
249 | $sel = ""; |
||
250 | if ($id_price == $typeprice) { |
||
251 | $sel = "selected"; |
||
252 | } |
||
253 | echo "<option value=\"$id_price\" $sel>$nom_price</option>"; |
||
254 | } |
||
255 | echo "</select></td></tr>"; |
||
256 | $module_id = $xoopsModule->getVar('mid'); |
||
257 | if (is_object($xoopsUser)) { |
||
258 | $groups = $xoopsUser->getGroups(); |
||
259 | } else { |
||
260 | $groups = XOOPS_GROUP_ANONYMOUS; |
||
261 | } |
||
262 | $gperm_handler =& xoops_gethandler('groupperm'); |
||
263 | View Code Duplication | if (isset($_POST['item_id'])) { |
|
1 ignored issue
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
264 | $perm_itemid = intval($_POST['item_id']); |
||
265 | } else { |
||
266 | $perm_itemid = 0; |
||
267 | } |
||
268 | //If no access |
||
269 | if (!$gperm_handler->checkRight("adslight_premium", $perm_itemid, $groups, $module_id)) { |
||
270 | echo "<tr> |
||
271 | <td width='30%' class='head'>"._ADSLIGHT_WILL_LAST." </td><td class='head'>$expire "._ADSLIGHT_DAY."</td> |
||
272 | </tr>"; |
||
273 | echo "<input type=\"hidden\" name=\"expire\" value=\"$expire\" />"; |
||
274 | } else { |
||
275 | echo "<tr> |
||
276 | <td width='30%' class='head'>"._ADSLIGHT_HOW_LONG." </td><td class='head'><input type=\"text\" name=\"expire\" size=\"3\" maxlength=\"3\" value=\"$expire\" /> "._ADSLIGHT_DAY."</td> |
||
277 | </tr>"; |
||
278 | } |
||
279 | |||
280 | /// Type d'annonce |
||
281 | echo "<tr> |
||
282 | <td class=\"head\">"._ADSLIGHT_TYPE." </td><td class=\"head\"><select name=\"type\">"; |
||
283 | |||
284 | $result5=$xoopsDB->query("select nom_type, id_type from ".$xoopsDB->prefix("adslight_type")." order by nom_type"); |
||
285 | while (list($nom_type, $id_type) = $xoopsDB->fetchRow($result5)) { |
||
286 | $sel = ""; |
||
287 | if ($id_type == $type) { |
||
288 | $sel = "selected"; |
||
289 | } |
||
290 | echo "<option value=\"$id_type\" $sel>$nom_type</option>"; |
||
291 | } |
||
292 | echo "</select></td></tr>"; |
||
293 | |||
294 | /// Etat de l'objet |
||
295 | echo "<tr> |
||
296 | <td class=\"head\">"._ADSLIGHT_TYPE_USURE." </td><td class=\"head\"><select name=\"typeusure\">"; |
||
297 | |||
298 | $result6=$xoopsDB->query("select nom_usure, id_usure from ".$xoopsDB->prefix("adslight_usure")." order by nom_usure"); |
||
299 | while (list($nom_usure, $id_usure) = $xoopsDB->fetchRow($result6)) { |
||
300 | $sel = ""; |
||
301 | if ($id_usure == $typeusure) { |
||
302 | $sel = "selected"; |
||
303 | } |
||
304 | echo "<option value=\"$id_usure\" $sel>$nom_usure</option>"; |
||
305 | } |
||
306 | echo "</select></td></tr>"; |
||
307 | |||
308 | echo "<tr> |
||
309 | <td class=\"head\">"._ADSLIGHT_CAT." </td><td class=\"head\">"; |
||
310 | $mytree->makeMySelBox('title','title', $cide,'','cid'); |
||
311 | echo "</td> |
||
312 | </tr><tr> |
||
313 | <td class=\"head\">"._ADSLIGHT_DESC." </td><td class=\"head\">"; |
||
314 | $wysiwyg_text_area= adslight_getEditor( _ADSLIGHT_DESC, "desctext", $desctext, '100%', '200px'); |
||
315 | echo $wysiwyg_text_area->render(); |
||
316 | echo "</td></tr> |
||
317 | <td colspan=2><br /><input type=\"submit\" value=\""._ADSLIGHT_MODIFANN."\" /></td> |
||
318 | </tr></table>"; |
||
319 | echo "<input type=\"hidden\" name=\"op\" value=\"ModAdS\" />"; |
||
320 | |||
321 | $module_id = $xoopsModule->getVar('mid'); |
||
322 | if (is_object($xoopsUser)) { |
||
323 | $groups = $xoopsUser->getGroups(); |
||
324 | } else { |
||
325 | $groups = XOOPS_GROUP_ANONYMOUS; |
||
326 | } |
||
327 | $gperm_handler =& xoops_gethandler('groupperm'); |
||
328 | View Code Duplication | if (isset($_POST['item_id'])) { |
|
1 ignored issue
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
329 | $perm_itemid = intval($_POST['item_id']); |
||
330 | } else { |
||
331 | $perm_itemid = 0; |
||
332 | } |
||
333 | //If no access |
||
334 | if (!$gperm_handler->checkRight("adslight_premium", $perm_itemid, $groups, $module_id)) { |
||
335 | |||
336 | if ($xoopsModuleConfig["adslight_moderated"] == '1') { |
||
337 | echo "<input type=\"hidden\" name=\"valid\" value=\"No\" />"; |
||
338 | echo "<br />"._ADSLIGHT_MODIFBEFORE."<br />"; |
||
339 | } else { |
||
340 | echo "<input type=\"hidden\" name=\"valid\" value=\"Yes\" />"; |
||
341 | } |
||
342 | } else { |
||
343 | echo "<input type=\"hidden\" name=\"valid\" value=\"Yes\" />"; |
||
344 | } |
||
345 | echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\" />"; |
||
346 | echo "<input type=\"hidden\" name=\"premium\" value=\"$premium\" />"; |
||
347 | echo "<input type=\"hidden\" name=\"date\" value=\"$date\" /> |
||
348 | ".$GLOBALS['xoopsGTicket']->getTicketHtml( __LINE__ , 1800 , 'token').""; |
||
349 | echo "</form><br /></fieldset><br />"; |
||
350 | } |
||
351 | } |
||
352 | } |
||
353 | |||
354 | /** |
||
355 | * @param $lid |
||
356 | * @param $cat |
||
357 | * @param $title |
||
358 | * @param $status |
||
359 | * @param $expire |
||
360 | * @param $type |
||
361 | * @param $desctext |
||
362 | * @param $tel |
||
363 | * @param $price |
||
364 | * @param $typeprice |
||
365 | * @param $typeusure |
||
366 | * @param $date |
||
367 | * @param $email |
||
368 | * @param $submitter |
||
369 | * @param $town |
||
370 | * @param $country |
||
371 | * @param $contactby |
||
372 | * @param $premium |
||
373 | * @param $valid |
||
374 | */ |
||
375 | function ModAdS($lid, $cat, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid) |
||
376 | { |
||
377 | global $xoopsDB, $xoopsConfig, $xoopsModuleConfig, $myts, $xoopsLogger, $moduleDirName, $main_lang, $xoopsGTicket; |
||
378 | |||
379 | if ( ! $xoopsGTicket->check( true , 'token' ) ) { |
||
380 | redirect_header(XOOPS_URL."/modules/adslight/index.php", 3,$xoopsGTicket->getErrors()); |
||
381 | } |
||
382 | $title = $myts->addSlashes($title); |
||
383 | $status = $myts->addSlashes($status); |
||
384 | $expire = $myts->addSlashes($expire); |
||
385 | $type = $myts->addSlashes($type); |
||
386 | $desctext = $myts->displayTarea($desctext,1,1,1,1,1); |
||
387 | $tel = $myts->addSlashes($tel); |
||
388 | $price = str_replace(array(' '), '', $price); |
||
389 | $typeprice = $myts->addSlashes($typeprice); |
||
390 | $typeusure = $myts->addSlashes($typeusure); |
||
391 | $submitter = $myts->addSlashes($submitter); |
||
392 | $town = $myts->addSlashes($town); |
||
393 | $country = $myts->addSlashes($country); |
||
394 | $contactby = $myts->addSlashes($contactby); |
||
395 | $premium = $myts->addSlashes($premium); |
||
396 | |||
397 | $xoopsDB->query("update ".$xoopsDB->prefix("adslight_listing")." set cid='$cat', title='$title', status='$status', expire='$expire', type='$type', desctext='$desctext', tel='$tel', price='$price', typeprice='$typeprice', typeusure='$typeusure', email='$email', submitter='$submitter', town='$town', country='$country', contactby='$contactby', premium='$premium', valid='$valid' where lid=$lid"); |
||
398 | |||
399 | redirect_header("index.php",1,_ADSLIGHT_ANNMOD2); |
||
400 | exit(); |
||
0 ignored issues
–
show
The function ModAdS() contains an exit expression.
An exit expression should only be used in rare cases. For example, if you write a short command line script. In most cases however, using an ![]() |
|||
401 | } |
||
402 | |||
403 | #################################################### |
||
404 | foreach ($_POST as $k => $v) { |
||
405 | ${$k} = $v; |
||
406 | } |
||
407 | $ok = isset( $_GET['ok'] ) ? $_GET['ok'] : '' ; |
||
408 | |||
409 | if (!isset($_POST['lid']) && isset($_GET['lid']) ) { |
||
410 | $lid = $_GET['lid'] ; |
||
411 | } |
||
412 | if (!isset($_POST['r_lid']) && isset($_GET['r_lid']) ) { |
||
413 | $r_lid = $_GET['r_lid'] ; |
||
414 | } |
||
415 | if (!isset($_POST['op']) && isset($_GET['op']) ) { |
||
416 | $op = $_GET['op'] ; |
||
417 | } |
||
418 | switch ($op) { |
||
419 | |||
420 | case "ModAd": |
||
421 | include(XOOPS_ROOT_PATH."/header.php"); |
||
422 | ModAd($lid); |
||
423 | include(XOOPS_ROOT_PATH."/footer.php"); |
||
424 | break; |
||
425 | |||
426 | case "ModAdS": |
||
427 | ModAdS($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid); |
||
428 | break; |
||
429 | |||
430 | case "ListingDel": |
||
431 | include(XOOPS_ROOT_PATH."/header.php"); |
||
432 | ListingDel($lid, $ok); |
||
433 | include(XOOPS_ROOT_PATH."/footer.php"); |
||
434 | break; |
||
435 | |||
436 | case "DelReply": |
||
437 | include(XOOPS_ROOT_PATH."/header.php"); |
||
438 | DelReply($r_lid, $ok); |
||
439 | include(XOOPS_ROOT_PATH."/footer.php"); |
||
440 | break; |
||
441 | |||
442 | default: |
||
443 | redirect_header("index.php",1,""._RETURNANN.""); |
||
444 | break; |
||
445 | } |
||
446 |
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.