copyXml()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 8
rs 10
cc 1
nc 1
nop 0
1
<?php declare(strict_types=1);
2
3
/*
4
 * You may not change or alter any portion of this comment or credits
5
 * of supporting developers from this source code or any supporting source code
6
 * which is considered copyrighted (c) material of the original comment or credit authors.
7
 *
8
 * This program is distributed in the hope that it will be useful,
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 */
12
13
/**
14
 * @copyright    XOOPS Project (https://xoops.org)
15
 * @license      GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
16
 * @author       XOOPS Development Team
17
 * @author       Pascal Le Boustouller: original author ([email protected])
18
 * @author       Luc Bizet (www.frxoops.org)
19
 * @author       jlm69 (www.jlmzone.com)
20
 * @author       mamba (www.xoops.org)
21
 */
22
23
use Xmf\Request;
24
use XoopsModules\Adslight\{
25
    Helper,
26
    Tree
27
};
28
29
require_once __DIR__ . '/admin_header.php';
30
31
$op = Request::getString('op', 'list');
32
33
#  function Index
34
#####################################################
35
function index(): void
36
{
37
    global $xoopsDB, $myts, $desctext;
38
39
    $mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
0 ignored issues
show
Unused Code introduced by
The assignment to $mytree is dead and can be removed.
Loading history...
40
41
    //    require_once __DIR__ . '/admin_header.php';
42
    //  require "adsligh_rsslib.php";
43
44
    xoops_cp_header();
45
    //    loadModuleAdminMenu(0, "");
46
47
    echo '<table width="50%" border="0" cellspacing="8" cellpadding="0">
48
  <tr>
49
    <td class="top">';
50
51
    /*
52
    /// Test Release ///
53
    $resultat_site = "https://www.i-luc.fr/release/release.html";
54
    $page1 = implode("", file("$resultat_site"));
55
    if (preg_match("1.07",$page1)) { echo "<table class='outer' border=0 cellspacing=5 cellpadding=0><tr><td width=40>";
56
      echo "<img src='../assets/images/admin/info_button_32.png' border=0 alt=\"._AM_ADSLIGHT_RELEASEOK.\" ></td><td>";
57
      echo "<span style='color: #00B4C4'><b>"._AM_ADSLIGHT_RELEASEOK."- AdsLigh 1.07</b></span>";
58
      echo "</td></tr></table><br>";
59
60
    } else {
61
62
      echo "<table class='outer' border=0 cellspacing=5 cellpadding=0><tr><td width=40>";
63
      echo "<img src='../assets/images/admin/error_button_32.png' border=0 alt=\"._AM_ADSLIGHT_RELEASEDOWNLOAD.\" ></td><td>";
64
      echo "<span style='color: #FE0101'><b>"._AM_ADSLIGHT_RELEASEISNOTOK."</b></span><br>";
65
      echo "<a href='https://www.i-luc.fr/adslight/modules/TDMDownloads/visit.php?cid=1&lid=3'>"._AM_ADSLIGHT_RELEASEDOWNLOAD." > AdsLight 1.08</a></td></tr></table><br>";
66
67
      }
68
      */
69
70
    ///////// Il y a [..] Annonces en attente d'être approuvées //////
71
    $sql     = 'SELECT lid FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid='No'";
72
    $result  = $xoopsDB->query($sql);
73
    $numrows = $xoopsDB->getRowsNum($result);
74
    if ($numrows > 0) {
75
        echo "<table class='outer' border=0 cellspacing=5 cellpadding=0><tr><td width=40>";
76
        echo "<img src='../assets/images/admin/error_button.png' border=0 ></td><td>";
77
        echo "<span style='color:#00B4C4;'><b>" . _AM_ADSLIGHT_THEREIS . "</b></span> <b>{$numrows}</b> <span style='color:#00B4C4;'>" . _AM_ADSLIGHT_WAIT . '</b></span>';
78
        echo '</td></tr></table><br>';
79
    } else {
80
        echo "<table class='outer' width='50%' border='0'><tr><td width=40>";
81
        echo "<img src='../assets/images/admin/search_button_green_32.png' border=0 alt=\"._AM_ADSLIGHT_RELEASEOK.\" ></td><td>";
82
        echo "<span style='color: #00B4C4;'><b>" . _AM_ADSLIGHT_NOANNVAL . '</b></span>';
83
        echo '</td></tr></table><br>';
84
    }
85
86
    //// Center menu
87
88
    /// Annonces
89
90
    echo '<table width="50%" border="0" class="outer">
91
                  <tr><th align="left">' . _AM_ADSLIGHT_ADSMENU_TITLE . '</th></tr>
92
93
                 <tr class="odd"><td><img src="../assets/images/admin/report_go.png" border=0 >
94
                  <a href="' . XOOPS_URL . '/modules/adslight/admin/validate_ads.php">' . _AM_ADSLIGHT_ADSMENU_VALIDADS . '</a>
95
                  </td></tr>
96
97
                 <tr class="even"><td><img src="../assets/images/admin/report_magnify.png" border=0 >
98
                  <a href="' . XOOPS_URL . '/modules/adslight/admin/view_ads.php">' . _AM_ADSLIGHT_ADSMENU_VIEWADS . '</a>
99
                  </td></tr>
100
101
                  <tr class="odd"><td><img src="../assets/images/admin/report_add.png" border=0 >
102
                  <a href="' . XOOPS_URL . '/modules/adslight/admin/modify_ads.php">' . _AM_ADSLIGHT_ADS_MODIFADS . '</a>
103
                  </td></tr>
104
105
              </table><br>';
106
107
    echo '<table width="50%" border="0" class="outer">
108
                  <tr colspan="2"><th align="left">' . _AM_ADSLIGHT_ADSMENU_PLUGIN . '</th></tr>
109
110
                 <tr class="odd">
111
                 <td>
112
                 <strong>Plugin Waiting Module :</strong> <a href="https://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/Plugin%20Waiting%20Module/">Download</a><br><br>
113
                 <strong>Plugin Sitemap Module :</strong> <a href="https://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/Plugin%20Sitemap%20Module/">Download</a><br><br>
114
                <strong>Plugin Waiting Rssfit :</strong> <a href="https://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/Plugin%20Waiting%20Rssfit/">Download</a><br><br>
115
                <strong>Plugin Xpayment :</strong> <a href="https://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/Plugin%20xpayment%20Module/">Download</a><br><br>
116
                 </td>
117
                  </tr>
118
                  <tr class="even">
119
                 <td>
120
                 <a href="mailto:[email protected]?subject=Plugin for AdsLight">' . _AM_ADSLIGHT_SEND_PLUGIN . '</a> |
121
                 <a href="mailto:[email protected]?subject=Translation for AdsLight">' . _AM_ADSLIGHT_SEND_TRANSLATION . '</a>
122
                 </td>
123
                  </tr>
124
125
                  </table><br>';
126
127
    echo '<table width="50%" border="0" class="outer">
128
                  <tr colspan="2"><th align="left">' . _AM_ADSLIGHT_ADSMENU_NEW . '</th></tr>
129
130
                 <tr class="odd">
131
                 <td>' . _AM_ADSLIGHT_ADSMENU_NEWTXT . '</td>
132
133
                  </tr>
134
                  </table><br>';
135
136
    /*
137
 ////   RSS AdsLight Forum
138
139
          echo '<table width="50%" border="0" class="outer">
140
                  <tr><th align="left">'._AM_ADSLIGHT_MENURSSFORUM_TITLE.'</th></tr>
141
                  <tr class="even"><td width="300">';
142
143
144
    $url = _AM_ADSLIGHT_MENURSSFORUM_URL;
145
          echo rssDisplayForum($url, 5, false, true);
146
147
148
          echo '</td></tr>
149
                  <tr class="odd"><td><img src="../assets/images/admin/user_go.png" border=0 >
150
                  <a href="'._AM_ADSLIGHT_MENURSSFORUM_LINK1.'">'._AM_ADSLIGHT_MENURSSFORUM_GOFORUM.'</a>  |
151
152
                  <img src="../assets/images/admin/vcard_add.png" border=0 >
153
                  <a href="'._AM_ADSLIGHT_MENURSSFORUM_LINK2.'">'._AM_ADSLIGHT_MENURSSFORUM_SUBSCRIT.'</a>  |
154
                  </td></tr>
155
                  </table>';
156
157
 ////   RSS AdsLight News
158
159
        echo '<table width="50%" border="0" class="outer">
160
                <tr><th align="left">'._AM_ADSLIGHT_MENURSS_TITLE.'</th></tr>';
161
162
                  $url = "https://www.i-luc.fr/adslight/backend.php";
163
        echo rssDisplay($url, 3, false, true);
164
165
166
            echo '</table><br>
167
168
*/
169
    echo '</td>
170
          <td valign="top">';
171
172
    ////// Right Menu Admin
173
174
    /// Statistiques
175
    $sql  = 'SELECT * FROM ' . $xoopsDB->prefix('adslight_listing') . "  WHERE (valid='Yes' AND status!='1')";
176
    $Num1 = $xoopsDB->getRowsNum($xoopsDB->query($sql));
177
    $sql2 = 'SELECT * FROM ' . $xoopsDB->prefix('adslight_categories') . ' ';
178
    $Num2 = $xoopsDB->getRowsNum($xoopsDB->query($sql2));
179
    $sql3 = 'SELECT * FROM ' . $xoopsDB->prefix('users') . "  WHERE (level = '1')";
180
    $Num3 = $xoopsDB->getRowsNum($xoopsDB->query($sql3));
181
    $sql4 = 'SELECT * FROM ' . $xoopsDB->prefix('xoopscomments') . "  WHERE (com_status = '2')";
182
    $Num4 = $xoopsDB->getRowsNum($xoopsDB->query($sql4));
183
184
    echo '<table width=100 border="0" class="outer"><tr>
185
                <th align="left">' . _AM_ADSLIGHT_STAT_TITLE . '</th></tr>
186
187
                  <tr class="odd"><td>
188
                  <b>' . $Num1 . '</b> ' . _AM_ADSLIGHT_STAT_NUM1 . '
189
                  </td></tr>
190
191
192
                 <tr class="even"><td>
193
                 <b>' . $Num2 . '</b> ' . _AM_ADSLIGHT_STAT_NUM2 . '
194
                 </td></tr>
195
196
                  <tr class="odd"><td>
197
                  <b>' . $Num3 . '</b> ' . _AM_ADSLIGHT_STAT_NUM3 . '
198
                  </td></tr>
199
200
                 <tr class="odd"><td>
201
                 <b>' . $Num4 . '</b> ' . _AM_ADSLIGHT_STAT_NUM4 . '
202
                 </td></tr>
203
204
                  </table><br>';
205
206
    /// Menu Catégories
207
    echo '<table width=100 border="0" class="outer"><tr>
208
                   <th width="50%" align="left">' . _AM_ADSLIGHT_CATMENU_TITLE . '</th></tr>
209
210
                  <tr class="odd"><td><img src="../assets/images/admin/chart_organisation_add.png" border=0 >
211
                  <a href="' . XOOPS_URL . '/modules/adslight/admin/category.php?op=AdsNewCat&cid=0">' . _AM_ADSLIGHT_CATMENU_CATEGORY . '</a>
212
                  </td></tr>
213
214
                  <tr class="even"><td><img src="../assets/images/admin/chart_organisation.png" border=0 >
215
                  <a href="' . XOOPS_URL . '/modules/adslight/admin/map.php">' . _AM_ADSLIGHT_CATMENU_MODIFCAT . '</a>
216
                  </td></tr>
217
218
          </table><br>';
219
220
    /// Menu Gestion
221
    echo '<table width=100 border="0" class="outer"><tr>
222
                <th align="left">' . _AM_ADSLIGHT_USERMENU_TITLE . '</th></tr>
223
224
                  <tr class="odd"><td><img src="../assets/images/admin/email_forward.png" border=0 >
225
                  <a href="' . XOOPS_URL . '/modules/system/admin.php?fct=mailusers">' . _AM_ADSLIGHT_USERMENU_SENDMAIL . '</a>
226
                  </td></tr>
227
228
                  <tr class="even"><td><img src="../assets/images/admin/comment_user.png" border=0 >
229
                  <a href="' . XOOPS_URL . '/modules/system/admin.php?fct=comments">' . _AM_ADSLIGHT_USERMENU_COMMENT . '</a>
230
                  </td></tr>
231
232
                 <tr class="odd"><td><img src="../assets/images/admin/web_layout.png" border=0 >
233
                 <a href="' . XOOPS_URL . '/modules/system/admin.php?fct=banners">' . _AM_ADSLIGHT_USERMENU_BAMMIER . '</a>
234
                 </td></tr>
235
236
                  </table><br>';
237
238
    /// Menu Downloads
239
    echo '<table width=100 border="0" class="outer"><tr>
240
                <th align="left">' . _AM_ADSLIGHT_DOWNLOADS_TITLE . '</th></tr>
241
242
                  <tr class="odd"><td><img src="../assets/images/admin/brick.png" border=0 >
243
                  <a href="https://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/">' . _AM_ADSLIGHT_DOWNLOADS_PLUGINS . '</a>
244
                  </td></tr>
245
246
                  <!-- <tr class="even"><td><img src="../assets/images/admin/world.png" border=0 >
247
                  <a href="https://www.i-luc.fr/adslight/modules/TDMDownloads/index.php">' . _AM_ADSLIGHT_DOWNLOADS_MAPS . '</a>
248
                  </td></tr> -->
249
250
                  </table><br>';
251
252
    /// Menu Devellopement
253
    echo '<table width=100 border="0" class="outer">
254
255
                  <tr><th align="left">' . _AM_ADSLIGHT_DEVLLP_TITLE . '</th></tr>
256
257
                 <tr class="odd"><td><img src="../assets/images/admin/page_white_code.png" border=0 >
258
                 <a href="mailto:[email protected]?subject=Hack AdsLight">' . _AM_ADSLIGHT_DEVLLP_HACK . '</a>
259
                 </td></tr>
260
261
                 <tr class="even"><td><img src="../assets/images/admin/page_white_world.png" border=0 >
262
                 <a href="mailto:[email protected]?subject=Traduction AdsLight">' . _AM_ADSLIGHT_DEVLLP_TRANSLATE . '</a>
263
                 </td></tr>
264
265
                  <tr class="odd"><td><img src="../assets/images/admin/page_white_text.png" border=0 >
266
                  <a href="mailto:[email protected]?subject=Correction AdsLight">' . _AM_ADSLIGHT_DEVLLP_CORRECTION . '</a>
267
                  </td></tr>
268
269
                  <tr class="even"><td><img src="../assets/images/admin/page_white_flash.png" border=0 >
270
                  <a href="mailto:[email protected]?subject=Correction AdsLight">' . _AM_ADSLIGHT_DEVLLP_MAPFLASH . '</a>
271
                  </td></tr>
272
273
              <!--  <tr class="odd"><td><img src="../assets/images/admin/group.png" border=0 >
274
                  <a href="' . XOOPS_URL . '/modules/adslight/admin/support_forum.php">' . _AM_ADSLIGHT_DEVLLP_FORUM . '</a>
275
                  </td></tr> -->
276
277
                  </table><br>';
278
279
    /// Faire un don
280
    /*    echo '<table width=100 border="0" class="outer">
281
282
                  <tr><th align="left">'._AM_ADSLIGHT_DONATE_TITLE.'</th></tr>
283
284
                 <tr class="odd"><td width=100>
285
                 '._AM_ADSLIGHT_DONATE.'
286
                 </td></tr>
287
288
                 <tr class="even"><td><div class='center;'>
289
                 '._AM_ADSLIGHT_DONATE_LOGO.'
290
                 </div></td></tr>
291
292
                  </table><br>';  */
293
294
    ////// AND Right Menu Admin /////
295
    echo '</td>
296
            </tr>
297
                </table>';
298
299
    xoops_cp_footer();
300
}
301
302
#  function CopyXml
303
#####################################################
304
function copyXml(): void
305
{
306
    $helper        = Helper::getInstance();
307
    $adslight_maps = $helper->getConfig('adslight_maps_set');
308
309
    $indexFile = XOOPS_ROOT_PATH . "/modules/adslight/maps/{$adslight_maps}/datas.xml";
310
    copy($indexFile, XOOPS_ROOT_PATH . '/modules/adslight/datas.xml');
311
    $helper->redirect('admin/index.php', 3, _AM_ADSLIGHT_ANNVALID);
312
}
313
314
#####################################################
315
#####################################################
316
//@todo REMOVE THIS ASAP. This code is extremely unsafe
317
foreach ($_POST as $k => $v) {
318
    ${$k} = $v;
319
}
320
321
$pa  = Request::getString('pa', '', 'GET');
322
$lid = Request::getInt('lid', 0);
323
$op  = Request::getString('op', '');
324
325
switch ($op) {
326
    case 'CopyXml':
327
        copyXml();
328
        break;
329
    default:
330
        index();
331
        break;
332
}
333