Conditions | 43 |
Paths | > 20000 |
Total Lines | 259 |
Code Lines | 241 |
Lines | 15 |
Ratio | 5.79 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
29 | function Index() |
||
30 | { |
||
31 | global $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $myts, $desctext, $moduleDirName; |
||
1 ignored issue
–
show
|
|||
32 | // include_once XOOPS_ROOT_PATH."/modules/adslight/class/classifiedstree.php"; |
||
33 | $mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||
34 | |||
35 | include_once __DIR__ . '/header.php'; |
||
36 | // require_once("adsligh_rsslib.php"); |
||
37 | |||
38 | xoops_cp_header(); |
||
39 | // loadModuleAdminMenu(0, ""); |
||
40 | |||
41 | echo "<table width=\"50%\" border=\"0\" cellspacing=\"8\" cellpadding=\"0\">\n" . " <tr>\n" . " <td class=\"top\">"; |
||
42 | |||
43 | /* |
||
44 | /// Test Release /// |
||
45 | $resultat_site = "http://www.i-luc.fr/release/release.html"; |
||
46 | $page1 = implode("", file("$resultat_site")); |
||
47 | if (preg_match("1.07",$page1)) { echo "<table class='outer' border=0 cellspacing=5 cellpadding=0><tr><td width=40>"; |
||
48 | echo "<img src='../assets/images/admin/info_button_32.png' border=0 alt=\"._AM_ADSLIGHT_RELEASEOK.\" /></td><td>"; |
||
49 | echo "<font color='#00B4C4'><b>"._AM_ADSLIGHT_RELEASEOK."- AdsLigh 1.07</b></font>"; |
||
50 | echo "</td></tr></table><br>"; |
||
51 | |||
52 | } else { |
||
53 | |||
54 | echo "<table class='outer' border=0 cellspacing=5 cellpadding=0><tr><td width=40>"; |
||
55 | echo "<img src='../assets/images/admin/error_button_32.png' border=0 alt=\"._AM_ADSLIGHT_RELEASEDOWNLOAD.\" /></td><td>"; |
||
56 | echo "<font color='#FE0101'><b>"._AM_ADSLIGHT_RELEASEISNOTOK."</b></font><br>"; |
||
57 | echo "<a href='http://www.i-luc.fr/adslight/modules/TDMDownloads/visit.php?cid=1&lid=3'>"._AM_ADSLIGHT_RELEASEDOWNLOAD." > AdsLight 1.08</a></td></tr></table><br>"; |
||
58 | |||
59 | } |
||
60 | */ |
||
61 | |||
62 | ///////// Il y a [..] Annonces en attente d'être approuvées ////// |
||
63 | $result = $xoopsDB->query('SELECT lid FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid='No'"); |
||
64 | $numrows = $xoopsDB->getRowsNum($result); |
||
65 | View Code Duplication | if ($numrows > 0) { |
|
1 ignored issue
–
show
|
|||
66 | echo "<table class='outer' border=0 cellspacing=5 cellpadding=0><tr><td width=40>"; |
||
67 | echo "<img src='../assets/images/admin/error_button.png' border=0 /></td><td>"; |
||
68 | echo "<font color=\"#00B4C4\"><b>" . _AM_ADSLIGHT_THEREIS . "</b></font> <b>$numrows</b> <font color=\"#00B4C4\">" . _AM_ADSLIGHT_WAIT . '</b></font>'; |
||
69 | echo '</td></tr></table><br>'; |
||
70 | } else { |
||
71 | echo "<table class='outer' width='50%' border='0'><tr><td width=40>"; |
||
72 | echo "<img src='../assets/images/admin/search_button_green_32.png' border=0 alt=\"._AM_ADSLIGHT_RELEASEOK.\" /></td><td>"; |
||
73 | echo "<font color='#00B4C4'><b>" . _AM_ADSLIGHT_NOANNVAL . '</b></font>'; |
||
74 | echo '</td></tr></table><br>'; |
||
75 | } |
||
76 | |||
77 | //// Center menu |
||
78 | |||
79 | /// Annonces |
||
80 | |||
81 | echo '<table width="50%" border="0" class="outer"> |
||
82 | <tr><th align="left">' . _AM_ADSLIGHT_ADSMENU_TITLE . '</th></tr> |
||
83 | |||
84 | <tr class="odd"><td><img src="../assets/images/admin/report_go.png" border=0 /> |
||
85 | <a href="' . XOOPS_URL . '/modules/adslight/admin/validate_ads.php">' . _AM_ADSLIGHT_ADSMENU_VALIDADS . '</a> |
||
86 | </td></tr> |
||
87 | |||
88 | <tr class="even"><td><img src="../assets/images/admin/report_magnify.png" border=0 /> |
||
89 | <a href="' . XOOPS_URL . '/modules/adslight/admin/view_ads.php">' . _AM_ADSLIGHT_ADSMENU_VIEWADS . '</a> |
||
90 | </td></tr> |
||
91 | |||
92 | <tr class="odd"><td><img src="../assets/images/admin/report_add.png" border=0 /> |
||
93 | <a href="' . XOOPS_URL . '/modules/adslight/admin/modify_ads.php">' . _AM_ADSLIGHT_ADS_MODIFADS . '</a> |
||
94 | </td></tr> |
||
95 | |||
96 | </table><br>'; |
||
97 | |||
98 | echo '<table width="50%" border="0" class="outer"> |
||
99 | <tr colspan="2"><th align="left">' . _AM_ADSLIGHT_ADSMENU_PLUGIN . '</th></tr> |
||
100 | |||
101 | <tr class="odd"> |
||
102 | <td> |
||
103 | <strong>Plugin Waiting Module :</strong> <a href="http://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/Plugin%20Waiting%20Module/">Download</a><br><br> |
||
104 | <strong>Plugin Sitemap Module :</strong> <a href="http://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/Plugin%20Sitemap%20Module/">Download</a><br><br> |
||
105 | <strong>Plugin Waiting Rssfit :</strong> <a href="http://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/Plugin%20Waiting%20Rssfit/">Download</a><br><br> |
||
106 | <strong>Plugin Xpayment :</strong> <a href="https://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/Plugin%20xpayment%20Module/">Download</a><br><br> |
||
107 | </td> |
||
108 | </tr> |
||
109 | <tr class="even"> |
||
110 | <td> |
||
111 | <a href="mailto:[email protected]?subject=Plugin for AdsLight">' . _AM_ADSLIGHT_SEND_PLUGIN . '</a> | |
||
112 | <a href="mailto:[email protected]?subject=Translation for AdsLight">' . _AM_ADSLIGHT_SEND_TRANSLATION . '</a> |
||
113 | </td> |
||
114 | </tr> |
||
115 | |||
116 | </table><br>'; |
||
117 | |||
118 | echo '<table width="50%" border="0" class="outer"> |
||
119 | <tr colspan="2"><th align="left">' . _AM_ADSLIGHT_ADSMENU_NEW . '</th></tr> |
||
120 | |||
121 | <tr class="odd"> |
||
122 | <td>' . _AM_ADSLIGHT_ADSMENU_NEWTXT . '</td> |
||
123 | |||
124 | </tr> |
||
125 | </table><br>'; |
||
126 | |||
127 | /* |
||
128 | //// RSS AdsLight Forum |
||
129 | |||
130 | echo '<table width="50%" border="0" class="outer"> |
||
131 | <tr><th align="left">'._AM_ADSLIGHT_MENURSSFORUM_TITLE.'</th></tr> |
||
132 | <tr class="even"><td width="300">'; |
||
133 | |||
134 | |||
135 | $url = _AM_ADSLIGHT_MENURSSFORUM_URL; |
||
136 | echo RSS_DisplayForum($url, 5, false, true); |
||
137 | |||
138 | |||
139 | echo '</td></tr> |
||
140 | <tr class="odd"><td><img src="../assets/images/admin/user_go.png" border=0 /> |
||
141 | <a href="'._AM_ADSLIGHT_MENURSSFORUM_LINK1.'">'._AM_ADSLIGHT_MENURSSFORUM_GOFORUM.'</a> | |
||
142 | |||
143 | <img src="../assets/images/admin/vcard_add.png" border=0 /> |
||
144 | <a href="'._AM_ADSLIGHT_MENURSSFORUM_LINK2.'">'._AM_ADSLIGHT_MENURSSFORUM_SUBSCRIT.'</a> | |
||
145 | </td></tr> |
||
146 | </table>'; |
||
147 | |||
148 | //// RSS AdsLight News |
||
149 | |||
150 | echo '<table width="50%" border="0" class="outer"> |
||
151 | <tr><th align="left">'._AM_ADSLIGHT_MENURSS_TITLE.'</th></tr>'; |
||
152 | |||
153 | $url = "http://www.i-luc.fr/adslight/backend.php"; |
||
154 | echo RSS_Display($url, 3, false, true); |
||
155 | |||
156 | |||
157 | echo '</table><br> |
||
158 | |||
159 | */ |
||
160 | echo '</td> |
||
161 | <td valign="top">'; |
||
162 | |||
163 | ////// Right Menu Admin |
||
164 | |||
165 | /// Statistiques |
||
166 | $Num1 = $xoopsDB->getRowsNum($xoopsDB->query('SELECT * FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE (valid='Yes' AND status!='1')")); |
||
167 | $Num2 = $xoopsDB->getRowsNum($xoopsDB->query('SELECT * FROM ' . $xoopsDB->prefix('adslight_categories') . '')); |
||
168 | $Num3 = $xoopsDB->getRowsNum($xoopsDB->query('SELECT * FROM ' . $xoopsDB->prefix('users') . " WHERE (level = '1')")); |
||
169 | $Num4 = $xoopsDB->getRowsNum($xoopsDB->query('SELECT * FROM ' . $xoopsDB->prefix('xoopscomments') . " WHERE (com_status = '2')")); |
||
170 | |||
171 | echo '<table width=100 border="0" class="outer"><tr> |
||
172 | <th align="left">' . _AM_ADSLIGHT_STAT_TITLE . '</th></tr> |
||
173 | |||
174 | <tr class="odd"><td> |
||
175 | <b>' . $Num1 . '</b> ' . _AM_ADSLIGHT_STAT_NUM1 . ' |
||
176 | </td></tr> |
||
177 | |||
178 | |||
179 | <tr class="even"><td> |
||
180 | <b>' . $Num2 . '</b> ' . _AM_ADSLIGHT_STAT_NUM2 . ' |
||
181 | </td></tr> |
||
182 | |||
183 | <tr class="odd"><td> |
||
184 | <b>' . $Num3 . '</b> ' . _AM_ADSLIGHT_STAT_NUM3 . ' |
||
185 | </td></tr> |
||
186 | |||
187 | <tr class="odd"><td> |
||
188 | <b>' . $Num4 . '</b> ' . _AM_ADSLIGHT_STAT_NUM4 . ' |
||
189 | </td></tr> |
||
190 | |||
191 | </table><br>'; |
||
192 | |||
193 | /// Menu Catégories |
||
194 | echo '<table width=100 border="0" class="outer"><tr> |
||
195 | <th width="50%" align="left">' . _AM_ADSLIGHT_CATMENU_TITLE . '</th></tr> |
||
196 | |||
197 | <tr class="odd"><td><img src="../assets/images/admin/chart_organisation_add.png" border=0 /> |
||
198 | <a href="' . XOOPS_URL . '/modules/adslight/admin/category.php?op=AdsNewCat&cid=0">' . _AM_ADSLIGHT_CATMENU_CATEGORY . '</a> |
||
199 | </td></tr> |
||
200 | |||
201 | <tr class="even"><td><img src="../assets/images/admin/chart_organisation.png" border=0 /> |
||
202 | <a href="' . XOOPS_URL . '/modules/adslight/admin/map.php">' . _AM_ADSLIGHT_CATMENU_MODIFCAT . '</a> |
||
203 | </td></tr> |
||
204 | |||
205 | </table><br>'; |
||
206 | |||
207 | /// Menu Gestion |
||
208 | echo '<table width=100 border="0" class="outer"><tr> |
||
209 | <th align="left">' . _AM_ADSLIGHT_USERMENU_TITLE . '</th></tr> |
||
210 | |||
211 | <tr class="odd"><td><img src="../assets/images/admin/email_forward.png" border=0 /> |
||
212 | <a href="' . XOOPS_URL . '/modules/system/admin.php?fct=mailusers">' . _AM_ADSLIGHT_USERMENU_SENDMAIL . '</a> |
||
213 | </td></tr> |
||
214 | |||
215 | <tr class="even"><td><img src="../assets/images/admin/comment_user.png" border=0 /> |
||
216 | <a href="' . XOOPS_URL . '/modules/system/admin.php?fct=comments">' . _AM_ADSLIGHT_USERMENU_COMMENT . '</a> |
||
217 | </td></tr> |
||
218 | |||
219 | <tr class="odd"><td><img src="../assets/images/admin/web_layout.png" border=0 /> |
||
220 | <a href="' . XOOPS_URL . '/modules/system/admin.php?fct=banners">' . _AM_ADSLIGHT_USERMENU_BAMMIER . '</a> |
||
221 | </td></tr> |
||
222 | |||
223 | </table><br>'; |
||
224 | |||
225 | /// Menu Downloads |
||
226 | echo '<table width=100 border="0" class="outer"><tr> |
||
227 | <th align="left">' . _AM_ADSLIGHT_DOWNLOADS_TITLE . '</th></tr> |
||
228 | |||
229 | <tr class="odd"><td><img src="../assets/images/admin/brick.png" border=0 /> |
||
230 | <a href="http://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/">' . _AM_ADSLIGHT_DOWNLOADS_PLUGINS . '</a> |
||
231 | </td></tr> |
||
232 | |||
233 | <!-- <tr class="even"><td><img src="../assets/images/admin/world.png" border=0 /> |
||
234 | <a href="http://www.i-luc.fr/adslight/modules/TDMDownloads/index.php">' . _AM_ADSLIGHT_DOWNLOADS_MAPS . '</a> |
||
235 | </td></tr> --> |
||
236 | |||
237 | </table><br>'; |
||
238 | |||
239 | /// Menu Devellopement |
||
240 | echo '<table width=100 border="0" class="outer"> |
||
241 | |||
242 | <tr><th align="left">' . _AM_ADSLIGHT_DEVLLP_TITLE . '</th></tr> |
||
243 | |||
244 | <tr class="odd"><td><img src="../assets/images/admin/page_white_code.png" border=0 /> |
||
245 | <a href="mailto:[email protected]?subject=Hack AdsLight">' . _AM_ADSLIGHT_DEVLLP_HACK . '</a> |
||
246 | </td></tr> |
||
247 | |||
248 | <tr class="even"><td><img src="../assets/images/admin/page_white_world.png" border=0 /> |
||
249 | <a href="mailto:[email protected]?subject=Traduction AdsLight">' . _AM_ADSLIGHT_DEVLLP_TRANSLATE . '</a> |
||
250 | </td></tr> |
||
251 | |||
252 | <tr class="odd"><td><img src="../assets/images/admin/page_white_text.png" border=0 /> |
||
253 | <a href="mailto:[email protected]?subject=Correction AdsLight">' . _AM_ADSLIGHT_DEVLLP_CORRECTION . '</a> |
||
254 | </td></tr> |
||
255 | |||
256 | <tr class="even"><td><img src="../assets/images/admin/page_white_flash.png" border=0 /> |
||
257 | <a href="mailto:[email protected]?subject=Correction AdsLight">' . _AM_ADSLIGHT_DEVLLP_MAPFLASH . '</a> |
||
258 | </td></tr> |
||
259 | |||
260 | <!-- <tr class="odd"><td><img src="../assets/images/admin/group.png" border=0 /> |
||
261 | <a href="' . XOOPS_URL . '/modules/adslight/admin/support_forum.php">' . _AM_ADSLIGHT_DEVLLP_FORUM . '</a> |
||
262 | </td></tr> --> |
||
263 | |||
264 | </table><br>'; |
||
265 | |||
266 | /// Faire un don |
||
267 | /* echo '<table width=100 border="0" class="outer"> |
||
268 | |||
269 | <tr><th align="left">'._AM_ADSLIGHT_DONATE_TITLE.'</th></tr> |
||
270 | |||
271 | <tr class="odd"><td width=100> |
||
272 | '._AM_ADSLIGHT_DONATE.' |
||
273 | </td></tr> |
||
274 | |||
275 | <tr class="even"><td><center> |
||
276 | '._AM_ADSLIGHT_DONATE_LOGO.' |
||
277 | </center></td></tr> |
||
278 | |||
279 | </table><br>'; */ |
||
280 | |||
281 | ////// AND Right Menu Admin ///// |
||
282 | echo '</td> |
||
283 | </tr> |
||
284 | </table>'; |
||
285 | |||
286 | xoops_cp_footer(); |
||
287 | } |
||
288 | |||
322 |
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.