importWfdownloads()   C
last analyzed

Complexity

Conditions 15
Paths 25

Size

Total Lines 98
Code Lines 74

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 15
eloc 74
nc 25
nop 2
dl 0
loc 98
rs 5.3006
c 1
b 0
f 0

How to fix   Long Method    Complexity   

Long Method

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:

1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * TDMDownload
7
 *
8
 * You may not change or alter any portion of this comment or credits
9
 * of supporting developers from this source code or any supporting source code
10
 * which is considered copyrighted (c) material of the original comment or credit authors.
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 *
15
 * @copyright   Gregory Mage (Aka Mage)
16
 * @license     GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
17
 * @author      Gregory Mage (Aka Mage)
18
 */
19
20
use Xmf\Database\TableLoad;
21
use Xmf\Database\Tables;
22
use Xmf\Module\Admin;
23
24
require __DIR__ . '/admin_header.php';
25
xoops_cp_header();
26
// Template
27
$templateMain = 'tdmdownloads_admin_import.tpl';
28
$adminObject  = Admin::getInstance();
29
//Action dans switch
30
$op = 'index';
31
if (\Xmf\Request::hasVar('op', 'REQUEST')) {
32
    $op = \Xmf\Request::getCmd('op', '', 'REQUEST');
33
}
34
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation(basename(__FILE__)));
35
// import depuis mydownloads
36
/**
37
 * @param string $path
38
 * @param string $imgurl
39
 */
40
function importMydownloads($path = '', $imgurl = '')
41
{
42
    $moduleDirName = basename(dirname(__DIR__));
43
    $ok            = \Xmf\Request::getInt('ok', 0, 'POST');
44
    global $xoopsDB;
45
    if (1 === $ok) {
46
        //Vider les tables
47
        $myTables = ['tdmdownloads_broken', 'tdmdownloads_cat', 'tdmdownloads_downloads', 'tdmdownloads_fielddata', 'tdmdownloads_modfielddata', 'tdmdownloads_votedata'];
48
        $table    = new TableLoad();
49
        $tables   = new Tables();
50
        foreach ($myTables as $myTable) {
51
            if ($tables->useTable($myTable)) { // if this returns false, there is no table
52
                $table::truncateTable($myTable);
53
            }
54
        }
55
        //Inserer les données des catégories
56
        $result = $xoopsDB->query('SELECT cid, pid, title, imgurl FROM ' . $xoopsDB->prefix('mydownloads_cat'));
57
        if ($result instanceof \mysqli_result) {
58
            while (false !== ($donnees = $xoopsDB->fetchArray($result))) {
59
                if ('' === $donnees['imgurl']) {
60
                    $img = 'blank.gif';
61
                } else {
62
                    $img = substr_replace($donnees['imgurl'], '', 0, mb_strlen($imgurl));
63
                    @copy($path . $img, XOOPS_ROOT_PATH . '/uploads/' . $moduleDirName . '/images/cats/' . $img);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition for copy(). This can introduce security issues, and is generally not recommended. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unhandled  annotation

63
                    /** @scrutinizer ignore-unhandled */ @copy($path . $img, XOOPS_ROOT_PATH . '/uploads/' . $moduleDirName . '/images/cats/' . $img);

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
Bug introduced by
Are you sure $img of type array|string can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

63
                    @copy($path . /** @scrutinizer ignore-type */ $img, XOOPS_ROOT_PATH . '/uploads/' . $moduleDirName . '/images/cats/' . $img);
Loading history...
64
                }
65
                $title  = $donnees['title'];
66
                $insert = $xoopsDB->queryF('INSERT INTO ' . $xoopsDB->prefix('tdmdownloads_cat') . " (cat_cid, cat_pid, cat_title, cat_imgurl, cat_description_main, cat_weight ) VALUES ('" . $donnees['cid'] . "', '" . $donnees['pid'] . "', '" . $title . "', '" . $img . "', '', '0')");
67
                if (!$insert) {
68
                    $errors[] = ['title' => _AM_TDMDOWNLOADS_IMPORT_ERROR_DATA, 'info' => $donnees['title']];
69
                }
70
                $successes[] = sprintf(_AM_TDMDOWNLOADS_IMPORT_CAT_IMP, $donnees['title']);
71
            }
72
        }
73
        echo '<br>';
74
        //Inserer les données des téléchargemnts
75
        $result = $xoopsDB->query('SELECT lid, cid, title, url, homepage, version, size, platform, logourl, submitter, status, date, hits, rating, votes, comments FROM ' . $xoopsDB->prefix('mydownloads_downloads'));
76
        if ($result instanceof \mysqli_result) {
77
            while (false !== ($donnees = $xoopsDB->fetchArray($result))) {
78
                //On recupere la description
79
                $requete = $xoopsDB->queryF('SELECT description FROM ' . $xoopsDB->prefix('mydownloads_text') . " WHERE lid = '" . $donnees['lid'] . "'");
80
                [$description] = $xoopsDB->fetchRow($requete);
81
                $insert = $xoopsDB->queryF(
82
                    'INSERT INTO '
83
                    . $xoopsDB->prefix('tdmdownloads_downloads')
84
                    . " (
85
            lid, cid, title, url, homepage, version, size, platform, description, logourl, submitter, status, date, hits, rating, votes, comments, top) VALUES
86
            ('"
87
                    . $donnees['lid']
88
                    . "', '"
89
                    . $donnees['cid']
90
                    . "', '"
91
                    . $donnees['title']
92
                    . "', '"
93
                    . $donnees['url']
94
                    . "', '"
95
                    . $donnees['homepage']
96
                    . "', '"
97
                    . $donnees['version']
98
                    . "', '"
99
                    . $donnees['size']
100
                    . "', '"
101
                    . $donnees['platform']
102
                    . "', '"
103
                    . $description
104
                    . "',  '"
105
                    . $donnees['logourl']
106
                    . "', '"
107
                    . $donnees['submitter']
108
                    . "', '"
109
                    . $donnees['status']
110
                    . "', '"
111
                    . $donnees['date']
112
                    . "', '"
113
                    . $donnees['hits']
114
                    . "', '"
115
                    . $donnees['rating']
116
                    . "', '"
117
                    . $donnees['votes']
118
                    . "', '0', '0' )"
119
                );
120
                if (!$insert) {
121
                    $errors[] = ['title' => _AM_TDMDOWNLOADS_IMPORT_ERROR_DATA, 'info' => $donnees['title']];
122
                }
123
                $successes[] = sprintf(_AM_TDMDOWNLOADS_IMPORT_DOWNLOADS_IMP, $donnees['title']);
124
                @copy($path . $donnees['logourl'], XOOPS_ROOT_PATH . '/uploads/' . $moduleDirName . '/images/shots/' . $donnees['logourl']);
125
            }
126
        }
127
        echo '<br>';
128
        //Inserer les données des votes
129
        $result = $xoopsDB->query('SELECT ratingid, lid, ratinguser, rating, ratinghostname, ratingtimestamp FROM ' . $xoopsDB->prefix('mydownloads_votedata'));
130
        if ($result instanceof \mysqli_result) {
131
            while (false !== ($donnees = $xoopsDB->fetchArray($result))) {
132
                $insert = $xoopsDB->queryF(
133
                    'INSERT INTO '
134
                    . $xoopsDB->prefix('tdmdownloads_votedata')
135
                    . " (ratingid, lid, ratinguser, rating, ratinghostname, ratingtimestamp ) VALUES ('"
136
                    . $donnees['ratingid']
137
                    . "', '"
138
                    . $donnees['lid']
139
                    . "', '"
140
                    . $donnees['ratinguser']
141
                    . "', '"
142
                    . $donnees['rating']
143
                    . "', '"
144
                    . $donnees['ratinghostname']
145
                    . "', '"
146
                    . $donnees['ratingtimestamp']
147
                    . "')"
148
                );
149
                if (!$insert) {
150
                    $errors[] = ['title' => _AM_TDMDOWNLOADS_IMPORT_ERROR_DATA, 'info' => $donnees['ratingid']];
151
                }
152
                $successes[] = sprintf(_AM_TDMDOWNLOADS_IMPORT_VOTE_IMP, $donnees['ratingid']);
153
            }
154
        }
155
        echo '<br><br>';
156
        echo "<div class='errorMsg'>";
157
        echo _AM_TDMDOWNLOADS_IMPORT_OK;
158
        echo '</div>';
159
    } else {
160
        xoops_confirm(['op' => 'importMydownloads', 'ok' => 1, 'path' => $path, 'imgurl' => $imgurl], 'import.php', _AM_TDMDOWNLOADS_IMPORT_CONF_MYDOWNLOADS . '<br>');
161
    }
162
}
163
164
// import depuis WF-Downloads
165
/**
166
 * @param string $shots
167
 * @param string $catimg
168
 */
169
function importWfdownloads($shots = '', $catimg = '')
170
{
171
    $moduleDirName = basename(dirname(__DIR__));
172
    $ok            = \Xmf\Request::getInt('ok', 0, 'POST');
173
    global $xoopsDB;
174
    if (1 === $ok) {
175
        //Vider les tables
176
        $myTables = ['tdmdownloads_broken', 'tdmdownloads_cat', 'tdmdownloads_downloads', 'tdmdownloads_fielddata', 'tdmdownloads_modfielddata', 'tdmdownloads_votedata'];
177
        $table    = new TableLoad();
178
        $tables   = new Tables();
179
        foreach ($myTables as $myTable) {
180
            if ($tables->useTable($myTable)) { // if this returns false, there is no table
181
                $table::truncateTable($myTable);
182
            }
183
        }
184
        //Inserer les données des catégories
185
        $result = $xoopsDB->query('SELECT cid, pid, title, imgurl, description, total, summary, spotlighttop, spotlighthis, dohtml, dosmiley, doxcode, doimage, dobr, weight, formulize_fid FROM ' . $xoopsDB->prefix('wfdownloads_cat'));
186
        if ($result instanceof \mysqli_result) {
187
            while (false !== ($donnees = $xoopsDB->fetchArray($result))) {
188
                if ('' === $donnees['imgurl']) {
189
                    $img = 'blank.gif';
190
                } else {
191
                    $img = $donnees['imgurl'];
192
                    @copy($catimg . $img, XOOPS_ROOT_PATH . '/uploads/' . $moduleDirName . '/images/cats/' . $img);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition for copy(). This can introduce security issues, and is generally not recommended. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unhandled  annotation

192
                    /** @scrutinizer ignore-unhandled */ @copy($catimg . $img, XOOPS_ROOT_PATH . '/uploads/' . $moduleDirName . '/images/cats/' . $img);

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
193
                }
194
                $insert = $xoopsDB->queryF(
195
                    'INSERT INTO ' . $xoopsDB->prefix('tdmdownloads_cat') . " (cat_cid, cat_pid, cat_title, cat_imgurl, cat_description_main, cat_weight ) VALUES ('" . $donnees['cid'] . "', '" . $donnees['pid'] . "', '" . addcslashes($donnees['title'], "'") . "', '" . $img . "', '" . addcslashes(
196
                        $donnees['description'],
197
                        "'"
198
                    ) . "', '" . $donnees['weight'] . "')"
199
                );
200
                if (!$insert) {
201
                    $errors[] = ['title' => _AM_TDMDOWNLOADS_IMPORT_ERROR_DATA, 'info' => $donnees['title']];
202
                }
203
                $successes[] = sprintf(_AM_TDMDOWNLOADS_IMPORT_CAT_IMP, $donnees['title']);
204
            }
205
        }
206
        echo '<br>';
207
        //Inserer les données des téléchargemnts
208
        $query_links = $xoopsDB->query(
209
            'SELECT lid, cid, title, url, filename, filetype, homepage, version, size, platform, screenshot, screenshot2, screenshot3, screenshot4, submitter, publisher, status, date, hits, rating, votes, comments, license, mirror, price, paypalemail, features, requirements, homepagetitle, forumid, limitations, versiontypes, dhistory, published, expired, updated, offline, summary, description, ipaddress, notifypub, formulize_idreq  FROM '
210
            . $xoopsDB->prefix('wfdownloads_downloads')
211
        );
212
        if ($query_links instanceof \mysqli_result) {
213
            while (false !== ($donnees = $xoopsDB->fetchArray($query_links))) {
214
                if ('' === $donnees['url']) {
215
                    $newurl = XOOPS_URL . '/uploads/' . $donnees['filename'];
216
                } else {
217
                    $newurl = $donnees['url'];
218
                }
219
                $insert = $xoopsDB->queryF(
220
                    'INSERT INTO ' . $xoopsDB->prefix('tdmdownloads_downloads') . " (
221
            lid, cid, title, url, homepage, version, size, platform, description, logourl, submitter, status, date, hits, rating, votes, comments, top) VALUES
222
            ('" . $donnees['lid'] . "', '" . $donnees['cid'] . "', '" . addcslashes($donnees['title'], "'") . "', '" . $newurl . "', '" . $donnees['homepage'] . "', '" . $donnees['version'] . "', '" . $donnees['size'] . "', '" . $donnees['platform'] . "', '" . addcslashes(
223
                        $donnees['description'],
224
                        "'"
225
                    ) . "',  '" . $donnees['screenshot'] . "', '" . $donnees['submitter'] . "', '" . $donnees['status'] . "', '" . $donnees['date'] . "', '" . $donnees['hits'] . "', '" . $donnees['rating'] . "', '" . $donnees['votes'] . "', '0', '0' )"
226
                );
227
                if (!$insert) {
228
                    $errors[] = ['title' => _AM_TDMDOWNLOADS_IMPORT_ERROR_DATA, 'info' => $donnees['title']];
229
                }
230
                $successes[] = sprintf(_AM_TDMDOWNLOADS_IMPORT_DOWNLOADS_IMP, $donnees['title']);
231
                @copy($shots . $donnees['screenshot'], XOOPS_ROOT_PATH . '/uploads/' . $moduleDirName . '/images/shots/' . $donnees['screenshot']);
232
            }
233
        }
234
        echo '<br>';
235
        //Inserer les données des votes
236
        $query_vote = $xoopsDB->query('SELECT ratingid, lid, ratinguser, rating, ratinghostname, ratingtimestamp FROM ' . $xoopsDB->prefix('wfdownloads_votedata'));
237
        if ($query_vote instanceof \mysqli_result) {
238
            while (false !== ($donnees = $xoopsDB->fetchArray($query_vote))) {
239
                $insert = $xoopsDB->queryF(
240
                    'INSERT INTO '
241
                    . $xoopsDB->prefix('tdmdownloads_votedata')
242
                    . " (ratingid, lid, ratinguser, rating, ratinghostname, ratingtimestamp ) VALUES ('"
243
                    . $donnees['ratingid']
244
                    . "', '"
245
                    . $donnees['lid']
246
                    . "', '"
247
                    . $donnees['ratinguser']
248
                    . "', '"
249
                    . $donnees['rating']
250
                    . "', '"
251
                    . $donnees['ratinghostname']
252
                    . "', '"
253
                    . $donnees['ratingtimestamp']
254
                    . "')"
255
                );
256
                if (!$insert) {
257
                    echo '<span style="color: #ff0000; ">' . _AM_TDMDOWNLOADS_IMPORT_ERROR_DATA . ': </span> ' . $donnees['ratingid'] . '<br>';
258
                }
259
                echo sprintf(_AM_TDMDOWNLOADS_IMPORT_VOTE_IMP . '<br>', $donnees['ratingid']);
260
            }
261
        }
262
        $successes[] = _AM_TDMDOWNLOADS_IMPORT_OK;
263
        $GLOBALS['xoopsTpl']->assign('successes', $successes);
264
        $GLOBALS['xoopsTpl']->assign('errors', $errors);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $errors does not seem to be defined for all execution paths leading up to this point.
Loading history...
265
    } else {
266
        xoops_confirm(['op' => 'importWfdownloads', 'ok' => 1, 'shots' => $shots, 'catimg' => $catimg], 'import.php', _AM_TDMDOWNLOADS_IMPORT_CONF_WFDOWNLOADS . '<br>');
267
    }
268
}
269
270
switch ($op) {
271
    case 'index':
272
    default:
273
        $adminObject->addItemButton(_AM_TDMDOWNLOADS_IMPORT_MYDOWNLOADS, 'import.php?op=form_mydownloads', 'add');
274
        $adminObject->addItemButton(_AM_TDMDOWNLOADS_IMPORT_WFDOWNLOADS, 'import.php?op=form_wfdownloads', 'add');
275
        $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('center'));
276
        $GLOBALS['xoopsTpl']->assign('intro', true);
277
        break;
278
    // import Mydownloads
279
    case 'importMydownloads':
280
        if ('' == \Xmf\Request::getString('path', '', 'REQUEST') || '' == \Xmf\Request::getString('imgurl', '', 'REQUEST')) {
281
            redirect_header('import.php?op=form_mydownloads', 3, _AM_TDMDOWNLOADS_IMPORT_ERREUR);
282
        } else {
283
            importMydownloads(\Xmf\Request::getString('path', '', 'REQUEST'), \Xmf\Request::getString('imgurl', '', 'REQUEST'));
284
        }
285
        break;
286
    case 'form_mydownloads':
287
        // Get Theme Form
288
        xoops_load('XoopsFormLoader');
289
        $form = new \XoopsThemeForm(_AM_TDMDOWNLOADS_IMPORT_MYDOWNLOADS, 'form_mydownloads', 'import.php', 'post', true);
290
        $form->setExtra('enctype="multipart/form-data"');
291
        // Form number
292
        $counter = 0;
293
        $check   = '<ul>';
294
        global $xoopsDB;
295
        $sql = $xoopsDB->query('SELECT COUNT(lid) AS count FROM ' . $xoopsDB->prefix('mydownloads_downloads'));
296
        [$count_downloads] = $xoopsDB->fetchRow($sql);
297
        if ($count_downloads < 1) {
298
            $check .= '<li>' . _AM_TDMDOWNLOADS_IMPORT_DONT_DOWNLOADS . '</li>';
299
        } else {
300
            $check .= '<li>' . sprintf(_AM_TDMDOWNLOADS_IMPORT_NB_DOWNLOADS, $count_downloads) . '</li>';
301
            $counter++;
302
        }
303
        $sql = $xoopsDB->query('SELECT COUNT(cid) AS count FROM ' . $xoopsDB->prefix('mydownloads_cat'));
304
        [$count_topic] = $xoopsDB->fetchRow($sql);
305
        if ($count_topic < 1) {
306
            $check .= '<li>' . _AM_TDMDOWNLOADS_IMPORT_DONT_TOPIC . '</li>';
307
        } else {
308
            $check .= '<li>' . sprintf('<br>' . _AM_TDMDOWNLOADS_IMPORT_NB_CAT, $count_topic) . '</li>';
309
            $counter++;
310
        }
311
        $check .= '</ul>';
312
        $form->addElement(new \XoopsFormLabel(_AM_TDMDOWNLOADS_IMPORT_NUMBER, $check));
313
        // Form path
314
        $form->addElement(new \XoopsFormText(_AM_TDMDOWNLOADS_IMPORT_MYDOWNLOADS_PATH, 'path', 100, 255, XOOPS_ROOT_PATH . '/modules/mydownloads/images/shots/'));
315
        // Form url
316
        $form->addElement(new \XoopsFormText(_AM_TDMDOWNLOADS_IMPORT_MYDOWNLOADS_URL, 'path', 100, 255, XOOPS_URL . '/modules/mydownloads/images/shots/'));
317
        // To execute
318
        if ($counter > 0) {
319
            $form->addElement(new \XoopsFormHidden('op', 'import_mydownloads'));
320
            $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false));
321
        } else {
322
            $form->addElement(new \XoopsFormHidden('op', 'cancel'));
323
            $form->addElement(new \XoopsFormButton('', 'submit', _CANCEL, 'submit'));
324
        }
325
        $GLOBALS['xoopsTpl']->assign('themeForm', $form->render());
326
        break;
327
    // import WF-Downloads
328
    case 'importWfdownloads':
329
        if ('' === \Xmf\Request::getString('shots') || '' === \Xmf\Request::getString('catimg')) {
330
            redirect_header('import.php?op=form_wfdownloads', 3, _AM_TDMDOWNLOADS_IMPORT_ERREUR);
331
        } else {
332
            importWfdownloads(\Xmf\Request::getString('shots'), \Xmf\Request::getString('catimg'));
333
        }
334
        break;
335
    case 'form_wfdownloads':
336
        global $xoopsDB;
337
        // Get Theme Form
338
        xoops_load('XoopsFormLoader');
339
        $form = new \XoopsThemeForm(_AM_TDMDOWNLOADS_IMPORT_MYDOWNLOADS, 'form_mydownloads', 'import.php', 'post', true);
340
        $form->setExtra('enctype="multipart/form-data"');
341
        // Form number
342
        $counter = 0;
343
        $check   = '<ul>';
344
        $sql     = $xoopsDB->query('SELECT COUNT(lid) AS count FROM ' . $xoopsDB->prefix('wfdownloads_downloads'));
345
        [$count_downloads] = $xoopsDB->fetchRow($sql);
346
        if ($count_downloads < 1) {
347
            $check .= '<li>' . _AM_TDMDOWNLOADS_IMPORT_DONT_DOWNLOADS . '</li>';
348
        } else {
349
            $check .= '<li>' . sprintf(_AM_TDMDOWNLOADS_IMPORT_NB_DOWNLOADS, $count_downloads) . '</li>';
350
            $counter++;
351
        }
352
        $sql = $xoopsDB->query('SELECT COUNT(cid) AS count FROM ' . $xoopsDB->prefix('wfdownloads_cat'));
353
        [$count_topic] = $xoopsDB->fetchRow($sql);
354
        if ($count_topic < 1) {
355
            $check .= '<li>' . _AM_TDMDOWNLOADS_IMPORT_DONT_TOPIC . '</li>';
356
        } else {
357
            $check .= '<li>' . sprintf('<br>' . _AM_TDMDOWNLOADS_IMPORT_NB_CAT, $count_topic) . '</li>';
358
            $counter++;
359
        }
360
        $check .= '</ul>';
361
        $form->addElement(new \XoopsFormLabel(_AM_TDMDOWNLOADS_IMPORT_NUMBER, $check));
362
        // Form path
363
        $form->addElement(new \XoopsFormText(_AM_TDMDOWNLOADS_IMPORT_WFDOWNLOADS_SHOTS, 'path', 100, 255, XOOPS_ROOT_PATH . '/modules/wfdownloads/assets/images/screenshots/'));
364
        // Form url
365
        $form->addElement(new \XoopsFormText(_AM_TDMDOWNLOADS_IMPORT_WFDOWNLOADS_CATIMG, 'catimg', 100, 255, XOOPS_ROOT_PATH . '/modules/wfdownloads/assets/images/category/'));
366
        // To execute
367
        if ($counter > 0) {
368
            $form->addElement(new \XoopsFormHidden('op', 'import_mydownloads'));
369
            $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false));
370
        } else {
371
            $form->addElement(new \XoopsFormHidden('op', 'cancel'));
372
            $form->addElement(new \XoopsFormButton('', 'submit', _CANCEL, 'submit'));
373
        }
374
        $GLOBALS['xoopsTpl']->assign('themeForm', $form->render());
375
        break;
376
}
377
require __DIR__ . '/admin_footer.php';
378