Completed
Push — master ( 923121...f83415 )
by Michael
02:52
created

admin/main.php (1 issue)

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
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
$op = XoopsRequest::getCmd('op', 'liste');
26
27
#  function Index
28
#####################################################
29
function Index()
30
{
31
    global $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $myts, $desctext, $moduleDirName;
1 ignored issue
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
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) {
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
289
#  function CopyXml
290
#####################################################
291
function CopyXml()
292
{
293
    global $xoopsModuleConfig;
294
295
    $adslight_maps = $xoopsModuleConfig['adslight_maps_set'];
296
297
    $indexFile = XOOPS_ROOT_PATH . "/modules/adslight/maps/$adslight_maps/datas.xml";
298
    copy($indexFile, XOOPS_ROOT_PATH . '/modules/adslight/datas.xml');
299
300
    redirect_header('index.php', 3, _AM_ADSLIGHT_ANNVALID);
301
}
302
303
#####################################################
304
#####################################################
305
//@todo REMOVE THIS ASAP. This code is extremely unsafe
306
foreach ($_POST as $k => $v) {
307
    ${$k} = $v;
308
}
309
310
$pa  = XoopsRequest::getString('pa', '', 'GET');
311
$lid = XoopsRequest::getInt('lid', 0);
312
$op  = XoopsRequest::getCmd('op', '');
313
314
switch ($op) {
315
    case 'CopyXml':
316
        CopyXml();
317
        break;
318
    default:
319
        Index();
320
        break;
321
}
322