Completed
Push — master ( 0424ea...923121 )
by Michael
03:57
created

admin/main.php (6 issues)

Upgrade to new PHP Analysis Engine

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
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 33 and the first side effect is on line 23.

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.

Loading history...
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__ . '/admin_header.php';
24
25
if (isset($_REQUEST['op'])) {
26
    $op = $_REQUEST['op'];
27
} else {
28
    $op = 'liste';
29
}
30
31
#  function Index
32
#####################################################
33
function Index()
34
{
35
    global $hlpfile, $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $myts, $desctext, $moduleDirName;
36
    //    include_once XOOPS_ROOT_PATH."/modules/adslight/class/classifiedstree.php";
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% 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...
37
    $mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
38
39
    include_once __DIR__ . '/header.php';
40
    //  require_once("adsligh_rsslib.php");
0 ignored issues
show
Unused Code Comprehensibility introduced by
84% 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...
41
42
    xoops_cp_header();
43
    //    loadModuleAdminMenu(0, "");
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% 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...
44
45
    echo "<table width=\"50%\" border=\"0\" cellspacing=\"8\" cellpadding=\"0\">
46
      <tr>
47
        <td valign=\"top\">";
48
49
    /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
47% 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...
50
    /// Test Release ///
51
    $resultat_site = "http://www.i-luc.fr/release/release.html";
52
    $page1 = implode("", file("$resultat_site"));
53
    if (preg_match("1.07",$page1)) { echo "<table class='outer' border=0 cellspacing=5 cellpadding=0><tr><td width=40>";
54
      echo "<img src='../assets/images/admin/info_button_32.png' border=0 alt=\"._AM_ADSLIGHT_RELEASEOK.\" /></td><td>";
55
      echo "<font color='#00B4C4'><b>"._AM_ADSLIGHT_RELEASEOK."- AdsLigh 1.07</b></font>";
56
      echo "</td></tr></table><br>";
57
58
    } else {
59
60
      echo "<table class='outer' border=0 cellspacing=5 cellpadding=0><tr><td width=40>";
61
      echo "<img src='../assets/images/admin/error_button_32.png' border=0 alt=\"._AM_ADSLIGHT_RELEASEDOWNLOAD.\" /></td><td>";
62
      echo "<font color='#FE0101'><b>"._AM_ADSLIGHT_RELEASEISNOTOK."</b></font><br>";
63
      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>";
64
65
      }
66
      */
67
68
    ///////// Il y a [..] Annonces en attente d'être approuvées //////
69
    $result  = $xoopsDB->query('select lid from ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid='no'");
70
    $numrows = $xoopsDB->getRowsNum($result);
71 View Code Duplication
    if ($numrows > 0) {
72
        echo "<table class='outer' border=0 cellspacing=5 cellpadding=0><tr><td width=40>";
73
        echo "<img src='../assets/images/admin/error_button.png' border=0 /></td><td>";
74
        echo "<font color=\"#00B4C4\"><b>" . _AM_ADSLIGHT_THEREIS . "</b></font> <b>$numrows</b> <font color=\"#00B4C4\">" . _AM_ADSLIGHT_WAIT . '</b></font>';
75
        echo '</td></tr></table><br>';
76
    } else {
77
        echo "<table class='outer' width='50%' border='0'><tr><td width=40>";
78
        echo "<img src='../assets/images/admin/search_button_green_32.png' border=0 alt=\"._AM_ADSLIGHT_RELEASEOK.\" /></td><td>";
79
        echo "<font color='#00B4C4'><b>" . _AM_ADSLIGHT_NOANNVAL . '</b></font>';
80
        echo '</td></tr></table><br>';
81
    }
82
83
    //// Center menu
84
85
    /// Annonces
86
87
    echo '<table width="50%" border="0" class="outer">
88
                  <tr><th align="left">' . _AM_ADSLIGHT_ADSMENU_TITLE . '</th></tr>
89
90
                 <tr class="odd"><td><img src="../assets/images/admin/report_go.png" border=0 />
91
                  <a href="' . XOOPS_URL . '/modules/adslight/admin/validate_ads.php">' . _AM_ADSLIGHT_ADSMENU_VALIDADS . '</a>
92
                  </td></tr>
93
94
                 <tr class="even"><td><img src="../assets/images/admin/report_magnify.png" border=0 />
95
                  <a href="' . XOOPS_URL . '/modules/adslight/admin/view_ads.php">' . _AM_ADSLIGHT_ADSMENU_VIEWADS . '</a>
96
                  </td></tr>
97
98
                  <tr class="odd"><td><img src="../assets/images/admin/report_add.png" border=0 />
99
                  <a href="' . XOOPS_URL . '/modules/adslight/admin/modify_ads.php">' . _AM_ADSLIGHT_ADS_MODIFADS . '</a>
100
                  </td></tr>
101
102
              </table><br>';
103
104
    echo '<table width="50%" border="0" class="outer">
105
                  <tr colspan="2"><th align="left">' . _AM_ADSLIGHT_ADSMENU_PLUGIN . '</th></tr>
106
107
                 <tr class="odd">
108
                 <td>
109
                 <strong>Plugin Waiting Module :</strong> <a href="http://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/Plugin%20Waiting%20Module/">Download</a><br><br>
110
                 <strong>Plugin Sitemap Module :</strong> <a href="http://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/Plugin%20Sitemap%20Module/">Download</a><br><br>
111
                <strong>Plugin Waiting Rssfit :</strong> <a href="http://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/Plugin%20Waiting%20Rssfit/">Download</a><br><br>
112
                <strong>Plugin Xpayment :</strong> <a href="https://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/Plugin%20xpayment%20Module/">Download</a><br><br>
113
                 </td>
114
                  </tr>
115
                  <tr class="even">
116
                 <td>
117
                 <a href="mailto:[email protected]?subject=Plugin for AdsLight">' . _AM_ADSLIGHT_SEND_PLUGIN . '</a> |
118
                 <a href="mailto:[email protected]?subject=Translation for AdsLight">' . _AM_ADSLIGHT_SEND_TRANSLATION . '</a>
119
                 </td>
120
                  </tr>
121
122
                  </table><br>';
123
124
    echo '<table width="50%" border="0" class="outer">
125
                  <tr colspan="2"><th align="left">' . _AM_ADSLIGHT_ADSMENU_NEW . '</th></tr>
126
127
                 <tr class="odd">
128
                 <td>' . _AM_ADSLIGHT_ADSMENU_NEWTXT . '</td>
129
130
                  </tr>
131
                  </table><br>';
132
133
    /*
134
 ////   RSS AdsLight Forum
135
136
          echo '<table width="50%" border="0" class="outer">
137
                  <tr><th align="left">'._AM_ADSLIGHT_MENURSSFORUM_TITLE.'</th></tr>
138
                  <tr class="even"><td width="300">';
139
140
141
    $url = _AM_ADSLIGHT_MENURSSFORUM_URL;
142
          echo RSS_DisplayForum($url, 5, false, true);
143
144
145
          echo '</td></tr>
146
                  <tr class="odd"><td><img src="../assets/images/admin/user_go.png" border=0 />
147
                  <a href="'._AM_ADSLIGHT_MENURSSFORUM_LINK1.'">'._AM_ADSLIGHT_MENURSSFORUM_GOFORUM.'</a>  |
148
149
                  <img src="../assets/images/admin/vcard_add.png" border=0 />
150
                  <a href="'._AM_ADSLIGHT_MENURSSFORUM_LINK2.'">'._AM_ADSLIGHT_MENURSSFORUM_SUBSCRIT.'</a>  |
151
                  </td></tr>
152
                  </table>';
153
154
 ////   RSS AdsLight News
155
156
        echo '<table width="50%" border="0" class="outer">
157
                <tr><th align="left">'._AM_ADSLIGHT_MENURSS_TITLE.'</th></tr>';
158
159
                  $url = "http://www.i-luc.fr/adslight/backend.php";
160
        echo RSS_Display($url, 3, false, true);
161
162
163
            echo '</table><br>
164
165
*/
166
    echo '</td>
167
          <td valign="top">';
168
169
    ////// Right Menu Admin
170
171
    /// Statistiques
172
    $Num1 = mysqli_num_rows($xoopsDB->query('select * from ' . $xoopsDB->prefix('adslight_listing') . "  where (valid='Yes' AND status!='1')"));
173
    $Num2 = mysqli_num_rows($xoopsDB->query('select * from ' . $xoopsDB->prefix('adslight_categories') . ''));
174
    $Num3 = mysqli_num_rows($xoopsDB->query('select * from ' . $xoopsDB->prefix('users') . "  where (level = '1')"));
175
    $Num4 = mysqli_num_rows($xoopsDB->query('select * from ' . $xoopsDB->prefix('xoopscomments') . "  where (com_status = '2')"));
176
177
    echo '<table width=100 border="0" class="outer"><tr>
178
                <th align="left">' . _AM_ADSLIGHT_STAT_TITLE . '</th></tr>
179
180
                  <tr class="odd"><td>
181
                  <b>' . $Num1 . '</b> ' . _AM_ADSLIGHT_STAT_NUM1 . '
182
                  </td></tr>
183
184
185
                 <tr class="even"><td>
186
                 <b>' . $Num2 . '</b> ' . _AM_ADSLIGHT_STAT_NUM2 . '
187
                 </td></tr>
188
189
                  <tr class="odd"><td>
190
                  <b>' . $Num3 . '</b> ' . _AM_ADSLIGHT_STAT_NUM3 . '
191
                  </td></tr>
192
193
                 <tr class="odd"><td>
194
                 <b>' . $Num4 . '</b> ' . _AM_ADSLIGHT_STAT_NUM4 . '
195
                 </td></tr>
196
197
                  </table><br>';
198
199
    /// Menu Catégories
200
    echo '<table width=100 border="0" class="outer"><tr>
201
                   <th width="50%" align="left">' . _AM_ADSLIGHT_CATMENU_TITLE . '</th></tr>
202
203
                  <tr class="odd"><td><img src="../assets/images/admin/chart_organisation_add.png" border=0 />
204
                  <a href="' . XOOPS_URL . '/modules/adslight/admin/category.php?op=AdsNewCat&cid=0">' . _AM_ADSLIGHT_CATMENU_CATEGORY . '</a>
205
                  </td></tr>
206
207
                  <tr class="even"><td><img src="../assets/images/admin/chart_organisation.png" border=0 />
208
                  <a href="' . XOOPS_URL . '/modules/adslight/admin/map.php">' . _AM_ADSLIGHT_CATMENU_MODIFCAT . '</a>
209
                  </td></tr>
210
211
          </table><br>';
212
213
    /// Menu Gestion
214
    echo '<table width=100 border="0" class="outer"><tr>
215
                <th align="left">' . _AM_ADSLIGHT_USERMENU_TITLE . '</th></tr>
216
217
                  <tr class="odd"><td><img src="../assets/images/admin/email_forward.png" border=0 />
218
                  <a href="' . XOOPS_URL . '/modules/system/admin.php?fct=mailusers">' . _AM_ADSLIGHT_USERMENU_SENDMAIL . '</a>
219
                  </td></tr>
220
221
                  <tr class="even"><td><img src="../assets/images/admin/comment_user.png" border=0 />
222
                  <a href="' . XOOPS_URL . '/modules/system/admin.php?fct=comments">' . _AM_ADSLIGHT_USERMENU_COMMENT . '</a>
223
                  </td></tr>
224
225
                 <tr class="odd"><td><img src="../assets/images/admin/web_layout.png" border=0 />
226
                 <a href="' . XOOPS_URL . '/modules/system/admin.php?fct=banners">' . _AM_ADSLIGHT_USERMENU_BAMMIER . '</a>
227
                 </td></tr>
228
229
                  </table><br>';
230
231
    /// Menu Downloads
232
    echo '<table width=100 border="0" class="outer"><tr>
233
                <th align="left">' . _AM_ADSLIGHT_DOWNLOADS_TITLE . '</th></tr>
234
235
                  <tr class="odd"><td><img src="../assets/images/admin/brick.png" border=0 />
236
                  <a href="http://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/">' . _AM_ADSLIGHT_DOWNLOADS_PLUGINS . '</a>
237
                  </td></tr>
238
239
                  <!-- <tr class="even"><td><img src="../assets/images/admin/world.png" border=0 />
240
                  <a href="http://www.i-luc.fr/adslight/modules/TDMDownloads/index.php">' . _AM_ADSLIGHT_DOWNLOADS_MAPS . '</a>
241
                  </td></tr> -->
242
243
                  </table><br>';
244
245
    /// Menu Devellopement
246
    echo '<table width=100 border="0" class="outer">
247
248
                  <tr><th align="left">' . _AM_ADSLIGHT_DEVLLP_TITLE . '</th></tr>
249
250
                 <tr class="odd"><td><img src="../assets/images/admin/page_white_code.png" border=0 />
251
                 <a href="mailto:[email protected]?subject=Hack AdsLight">' . _AM_ADSLIGHT_DEVLLP_HACK . '</a>
252
                 </td></tr>
253
254
                 <tr class="even"><td><img src="../assets/images/admin/page_white_world.png" border=0 />
255
                 <a href="mailto:[email protected]?subject=Traduction AdsLight">' . _AM_ADSLIGHT_DEVLLP_TRANSLATE . '</a>
256
                 </td></tr>
257
258
                  <tr class="odd"><td><img src="../assets/images/admin/page_white_text.png" border=0 />
259
                  <a href="mailto:[email protected]?subject=Correction AdsLight">' . _AM_ADSLIGHT_DEVLLP_CORRECTION . '</a>
260
                  </td></tr>
261
262
                  <tr class="even"><td><img src="../assets/images/admin/page_white_flash.png" border=0 />
263
                  <a href="mailto:[email protected]?subject=Correction AdsLight">' . _AM_ADSLIGHT_DEVLLP_MAPFLASH . '</a>
264
                  </td></tr>
265
266
              <!--  <tr class="odd"><td><img src="../assets/images/admin/group.png" border=0 />
267
                  <a href="' . XOOPS_URL . '/modules/adslight/admin/support_forum.php">' . _AM_ADSLIGHT_DEVLLP_FORUM . '</a>
268
                  </td></tr> -->
269
270
                  </table><br>';
271
272
    /// Faire un don
273
    /*    echo '<table width=100 border="0" class="outer">
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% 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...
274
275
                  <tr><th align="left">'._AM_ADSLIGHT_DONATE_TITLE.'</th></tr>
276
277
                 <tr class="odd"><td width=100>
278
                 '._AM_ADSLIGHT_DONATE.'
279
                 </td></tr>
280
281
                 <tr class="even"><td><center>
282
                 '._AM_ADSLIGHT_DONATE_LOGO.'
283
                 </center></td></tr>
284
285
                  </table><br>';  */
286
287
    ////// AND Right Menu Admin /////
288
    echo '</td>
289
            </tr>
290
                </table>';
291
292
    xoops_cp_footer();
293
}
294
295
#  function CopyXml
296
#####################################################
297
function CopyXml()
298
{
299
    global $xoopsModuleConfig;
300
301
    $adslight_maps = $xoopsModuleConfig['adslight_maps_set'];
302
303
    $indexFile = XOOPS_ROOT_PATH . "/modules/adslight/maps/$adslight_maps/datas.xml";
304
    copy($indexFile, XOOPS_ROOT_PATH . '/modules/adslight/datas.xml');
305
306
    redirect_header('index.php', 3, _AM_ADSLIGHT_ANNVALID);
307
}
308
309
#####################################################
310
#####################################################
311
312
foreach ($_POST as $k => $v) {
313
    ${$k} = $v;
314
}
315
316
$pa = isset($_GET['pa']) ? $_GET['pa'] : '';
317
318
if (!isset($_POST['lid']) && isset($_GET['lid'])) {
319
    $lid = $_GET['lid'];
320
}
321
if (!isset($_POST['op']) && isset($_GET['op'])) {
322
    $op = $_GET['op'];
323
}
324
if (!isset($op)) {
325
    $op = '';
326
}
327
328
switch ($op) {
329
330
    case 'CopyXml':
331
        CopyXml();
332
        break;
333
334
    default:
335
        Index();
336
        break;
337
338
}
339