Completed
Push — master ( 66731e...5478d6 )
by Michael
02:20
created

main.php ➔ AddEditMarqueeForm()   F

Complexity

Conditions 10
Paths 512

Size

Total Lines 79
Code Lines 58

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 10
eloc 58
nc 512
nop 18
dl 0
loc 79
rs 3.8504
c 0
b 0
f 0

How to fix   Long Method    Complexity    Many Parameters   

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:

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

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 40 and the first side effect is on line 22.

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
 * marquee - MODULE FOR XOOPS
5
 * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com)
6
 *
7
 * You may not change or alter any portion of this comment or credits
8
 * of supporting developers from this source code or any supporting source code
9
 * which is considered copyrighted (c) material of the original comment or credit authors.
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 *
14
 * @copyright          Hervé Thouzard (http://www.herve-thouzard.com)
15
 * @license            http://www.fsf.org/copyleft/gpl.html GNU public license
16
 * @package            marquee
17
 * @author             Hervé Thouzard (http://www.herve-thouzard.com)
18
 *
19
 * @version            $Id $
20
 * ****************************************************************************
21
 */
22
include_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php';
23
require_once XOOPS_ROOT_PATH . '/modules/marquee/admin/functions.php';
24
require_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php';
25
require_once XOOPS_ROOT_PATH . '/modules/marquee/class/marquee_utils.php';
26
include_once __DIR__ . '/admin_header.php';
27
28
$indexAdmin = new ModuleAdmin();
29
30
$op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', 'default', 'POST'), 'GET');
31
32
// Verify that a field exists inside a mysql table
33
34
/**
35
 * @param $fieldname
36
 * @param $table
37
 *
38
 * @return bool
39
 */
40
function marquee_FieldExists($fieldname, $table)
41
{
42
    global $xoopsDB;
0 ignored issues
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...
43
    $result = $xoopsDB->queryF("SHOW COLUMNS FROM   $table LIKE '$fieldname'");
44
45
    return ($xoopsDB->getRowsNum($result) > 0);
46
}
47
48
// Verify if the table is up to date
49
if (!marquee_FieldExists('marquee_marqueeid', $xoopsDB->prefix('marquee'))) {
50
    $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . ' CHANGE `marqueeid` `marquee_marqueeid` INT( 8 ) NOT NULL AUTO_INCREMENT');
51
    $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `uid` `marquee_uid` MEDIUMINT( 8 ) NOT NULL DEFAULT '0'");
52
    $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `direction` `marquee_direction` SMALLINT( 6 ) NOT NULL DEFAULT '0'");
53
    $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `scrollamount` `marquee_scrollamount` INT( 11 ) NOT NULL DEFAULT '0'");
54
    $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `behaviour` `marquee_behaviour` SMALLINT( 6 ) NOT NULL DEFAULT '0'");
55
    $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . ' CHANGE `bgcolor` `marquee_bgcolor` VARCHAR( 7 ) NOT NULL');
56
    $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `align` `marquee_align` SMALLINT( 6 ) NOT NULL DEFAULT '0'");
57
    $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `height` `marquee_height` SMALLINT( 6 ) NOT NULL DEFAULT '0'");
58
    $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . ' CHANGE `width` `marquee_width` VARCHAR( 4 ) NOT NULL');
59
    $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `hspace` `marquee_hspace` SMALLINT( 6 ) NOT NULL DEFAULT '0'");
60
    $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `scrolldelay` `marquee_scrolldelay` SMALLINT( 6 ) NOT NULL DEFAULT '0'");
61
    $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `stoponmouseover` `marquee_stoponmouseover` SMALLINT( 6 ) NOT NULL DEFAULT '0'");
62
    $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `loop` `marquee_loop` SMALLINT( 6 ) NOT NULL DEFAULT '0'");
63
    $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `vspace` `marquee_vspace` SMALLINT( 6 ) NOT NULL DEFAULT '0'");
64
    $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . ' CHANGE `content` `marquee_content` TEXT NOT NULL');
65
    $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `source` `marquee_source` VARCHAR( 255 ) NOT NULL DEFAULT 'fixed'");
66
}
67
68
$marqueeHandler = xoops_getModuleHandler('marquee', 'marquee');
69
70
// Function used to add and modify an element
71
/**
72
 * @param        $marqueeid
73
 * @param        $Action
74
 * @param        $FormTitle
75
 * @param        $contentvalue
76
 * @param        $bgcolorvalue
77
 * @param        $widthvalue
78
 * @param        $heightvalue
79
 * @param        $scrollamountvalue
80
 * @param        $hspacevalue
81
 * @param        $vspacevalue
82
 * @param        $scrolldelayvalue
83
 * @param        $directionvalue
84
 * @param        $behaviourvalue
85
 * @param        $alignvalue
86
 * @param        $loopvalue
87
 * @param        $stopvalue
88
 * @param        $LabelSubmitButton
89
 * @param string $sourcevalue
90
 */
91
function AddEditMarqueeForm($marqueeid, $Action, $FormTitle, $contentvalue, $bgcolorvalue, $widthvalue, $heightvalue, $scrollamountvalue, $hspacevalue, $vspacevalue, $scrolldelayvalue, $directionvalue, $behaviourvalue, $alignvalue, $loopvalue, $stopvalue, $LabelSubmitButton, $sourcevalue = 'fixed')
92
{
93
    require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
94
    global $xoopsModule, $xoopsModuleConfig;
0 ignored issues
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...
95
96
    $sform = new XoopsThemeForm($FormTitle, 'marqueeform', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/main.php');
97
98
    $source = new XoopsFormSelect(_AM_MARQUEE_SOURCE, 'source', $sourcevalue);
99
    $source->addOption('fixed', _AM_MARQUEE_SOURCE_FIXED);
100
    $fileslst = myglob(XOOPS_ROOT_PATH . '/modules/marquee/plugins/', 'php');
101
    foreach ($fileslst as $onefile) {
0 ignored issues
show
Bug introduced by
The expression $fileslst of type array|null is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
102
        $onefile = basename($onefile, '.php');
103
        $source->addOption($onefile, $onefile);
104
    }
105
    $sform->addElement($source);
106
107
    $editor = MarqueeUtilities::getWysiwygForm(_AM_MARQUEE_CONTENT, 'content', $contentvalue, 15, 60, 'content_text_hidden');
108
    if ($editor) {
109
        $sform->addElement($editor, false);
110
    }
111
112
    if (marquee_getmoduleoption('methodtouse') !== 'DHTML') {
113
        // $sform->addElement(new XoopsFormText(_AM_MARQUEE_BGCOLOR, 'bgcolor', 7, 7, $bgcolorvalue), false);
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% 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...
114
        $sform->addElement(new XoopsFormColorPicker(_AM_MARQUEE_BGCOLOR, 'bgcolor', $bgcolorvalue), false);
115
    }
116
    $sform->addElement(new XoopsFormText(_AM_MARQUEE_WIDTH, 'width', 4, 4, $widthvalue), false);
117
    $sform->addElement(new XoopsFormText(_AM_MARQUEE_HEIGHT, 'height', 4, 4, $heightvalue), false);
118
    $sform->addElement(new XoopsFormText(_AM_MARQUEE_SCRAMOUNT, 'scrollamount', 4, 4, $scrollamountvalue), false);
119
    if (marquee_getmoduleoption('methodtouse') !== 'DHTML') {
120
        $sform->addElement(new XoopsFormText(_AM_MARQUEE_HSPACE, 'hspace', 4, 4, $hspacevalue), false);
121
        $sform->addElement(new XoopsFormText(_AM_MARQUEE_VSPACE, 'vspace', 4, 4, $vspacevalue), false);
122
    }
123
124
    $sform->addElement(new XoopsFormText(_AM_MARQUEE_SCRDELAY, 'scrolldelay', 6, 6, $scrolldelayvalue), false);
125
    $direction = new XoopsFormSelect(_AM_MARQUEE_DIRECTION, 'direction', $directionvalue);
126
    $direction->addOption('0', _AM_MARQUEE_DIRECTION1);
127
    $direction->addOption('1', _AM_MARQUEE_DIRECTION2);
128
    $direction->addOption('2', _AM_MARQUEE_DIRECTION3);
129
    $direction->addOption('3', _AM_MARQUEE_DIRECTION4);
130
    $sform->addElement($direction, true);
131
132
    $behaviour = new XoopsFormSelect(_AM_MARQUEE_BEHAVIOUR, 'behaviour', $behaviourvalue);
133
    $behaviour->addOption('0', _AM_MARQUEE_BEHAVIOUR1);
134
    if (marquee_getmoduleoption('methodtouse') !== 'DHTML') {
135
        $behaviour->addOption('1', _AM_MARQUEE_BEHAVIOUR2);
136
    }
137
    $behaviour->addOption('2', _AM_MARQUEE_BEHAVIOUR3);
138
    $sform->addElement($behaviour, true);
139
140
    if (marquee_getmoduleoption('methodtouse') !== 'DHTML') {
141
        $align = new XoopsFormSelect(_AM_MARQUEE_ALIGN, 'align', $alignvalue);
142
        $align->addOption('0', _AM_MARQUEE_ALIGN1);
143
        $align->addOption('1', _AM_MARQUEE_ALIGN2);
144
        $align->addOption('2', _AM_MARQUEE_ALIGN3);
145
        $sform->addElement($align, true);
146
    }
147
148
    $loop = new XoopsFormSelect(_AM_MARQUEE_LOOP, 'loop', $loopvalue);
149
    $loop->addOption('0', _AM_MARQUEE_INFINITELOOP);
150
    for ($i = 1; $i <= 100; ++$i) {
151
        $loop->addOption($i, $i);
152
    }
153
    if (marquee_getmoduleoption('methodtouse') !== 'DHTML') {
154
        $sform->addElement($loop, true);
155
        $sform->addElement(new XoopsFormRadioYN(_AM_MARQUEE_STOP, 'stoponmouseover', $stopvalue, _YES, _NO));
156
    }
157
158
    $sform->addElement(new XoopsFormHidden('op', $Action), false);
159
    if (!empty($marqueeid)) {
160
        $sform->addElement(new XoopsFormHidden('marqueeid', $marqueeid), false);
161
    }
162
    $button_tray = new XoopsFormElementTray('', '');
163
    $submit_btn  = new XoopsFormButton('', 'submit', $LabelSubmitButton, 'submit');
164
    $button_tray->addElement($submit_btn);
165
    $cancel_btn = new XoopsFormButton('', 'reset', _AM_MARQUEE_RESETBUTTON, 'reset');
166
    $button_tray->addElement($cancel_btn);
167
    $sform->addElement($button_tray);
168
    $sform->display();
169
}
170
171
// ******************************************************************************************************************************************
172
// **** Main ********************************************************************************************************************************
173
// ******************************************************************************************************************************************
174
switch ($op) {
175
    // Verify before to edit an element
176
    case 'verifybeforeedit':
177
        if ('' !== XoopsRequest::getString('submit', '', 'POST')) {
178
            $marquee = $marqueeHandler->get(XoopsRequest::getInt('marqueeid', 0, 'POST'));
179
            if (is_object($marquee)) {
180
                $marquee->setVar('marquee_uid', $xoopsUser->getVar('uid'));
181
                $marquee->setVar('marquee_direction', XoopsRequest::getString('direction', '', 'POST'));
182
                $marquee->setVar('marquee_scrollamount', XoopsRequest::getInt('scrollamount', 0, 'POST'));
183
                $marquee->setVar('marquee_behaviour', XoopsRequest::getInt('behaviour', 0, 'POST'));
184
                $marquee->setVar('marquee_bgcolor', XoopsRequest::getString('bgcolor', '', 'POST'));
185
                $marquee->setVar('marquee_align', XoopsRequest::getInt('align', 0, 'POST'));
186
                $marquee->setVar('marquee_height', XoopsRequest::getInt('height', 0, 'POST'));
187
                $marquee->setVar('marquee_width', XoopsRequest::getString('width', '', 'POST'));
188
                $marquee->setVar('marquee_hspace', XoopsRequest::getInt('hspace', 0, 'POST'));
189
                $marquee->setVar('marquee_scrolldelay', XoopsRequest::getInt('scrolldelay', 0, 'POST'));
190
                $marquee->setVar('marquee_stoponmouseover', XoopsRequest::getInt('stoponmouseover', 0, 'POST'));
191
                $marquee->setVar('marquee_loop', XoopsRequest::getInt('loop', 0, 'POST'));
192
                $marquee->setVar('marquee_vspace', XoopsRequest::getInt('vspace', 0, 'POST'));
193
                $marquee->setVar('marquee_content', XoopsRequest::getString('content', '', 'POST'));
194
                $marquee->setVar('marquee_source', XoopsRequest::getString('source', '', 'POST'));
195
                if (!$marqueeHandler->insert($marquee)) {
196
                    redirect_header('main.php', 1, _AM_MARQUEE_ERROR_MODIFY_DB);
197
                }
198
                redirect_header('main.php', 1, _AM_MARQUEE_DBUPDATED);
199
            } else {
200
                redirect_header('main.php', 3, _ERRORS);
201
            }
202
        }
203
        break;
204
205
    // Edit an element
206
    case 'edit':
207
        xoops_cp_header();
208
        echo $indexAdmin->addNavigation(basename(__FILE__));
209
210
        echo '<br />';
211
        if (isset($_GET['marqueeid'])) {
212
            $marqueeid = XoopsRequest::getInt('marqueeid', 0, 'GET');
213
            $marquee   = $marqueeHandler->get($marqueeid);
214
            AddEditMarqueeForm($marqueeid, 'verifybeforeedit', _AM_MARQUEE_CONFIG, $marquee->getVar('marquee_content', 'e'), $marquee->getVar('marquee_bgcolor', 'e'), $marquee->getVar('marquee_width', 'e'), $marquee->getVar('marquee_height', 'e'), $marquee->getVar('marquee_scrollamount', 'e'), $marquee->getVar('marquee_hspace', 'e'), $marquee->getVar('marquee_vspace', 'e'), $marquee->getVar('marquee_scrolldelay', 'e'), $marquee->getVar('marquee_direction', 'e'), $marquee->getVar('marquee_behaviour', 'e'), $marquee->getVar('marquee_align', 'e'), $marquee->getVar('marquee_loop', 'e'), $marquee->getVar('marquee_stoponmouseover', 'e'), _AM_MARQUEE_UPDATE, $marquee->getVar('marquee_source', 'e'));
215
        }
216
        break;
217
218
    // Delete an element
219
    case 'delete':
220
        if ('' !== XoopsRequest::getString('ok', '', 'POST')) {
221
            xoops_cp_header();
222
            echo $indexAdmin->addNavigation(basename(__FILE__));
223
            // echo '<h4>' . _AM_MARQUEE_CONFIG . '</h4>';
224
            xoops_confirm(array('op' => 'delete', 'marqueeid' => XoopsRequest::getInt('marqueeid', 0, 'GET'), 'ok' => 1), 'main.php', _AM_MARQUEE_RUSUREDEL);
225
        } else {
226
            if (empty($_POST['marqueeid'])) {
227
                redirect_header('main.php', 2, _AM_MARQUEE_ERROR_ADD_MARQUEE);
228
            }
229
            $marqueeid = XoopsRequest::getInt('marqueeid', 0, 'POST');
230
            $marquee   = $marqueeHandler->deleteAll(new Criteria('marquee_marqueeid', $marqueeid, '='));
231
            redirect_header('main.php', 1, _AM_MARQUEE_DBUPDATED);
232
        }
233
        break;
234
235
    // Verify before to add an element
236
    case 'verifytoadd':
237
        if ('' !== XoopsRequest::getString('submit', '', 'POST')) {
238
            $vres = $marqueeHandler->quickInsert(array(
239
                                                      'marquee_uid'             => $xoopsUser->getVar('uid'),
240
                                                      'marquee_direction'       => XoopsRequest::getString('direction', '', 'POST'),
241
                                                      'marquee_scrollamount'    => XoopsRequest::getInt('scrollamount', 0, 'POST'),
242
                                                      'marquee_behaviour'       => XoopsRequest::getInt('behaviour', 0, 'POST'),
243
                                                      'marquee_bgcolor'         => XoopsRequest::getString('bgcolor', '', 'POST'),
244
                                                      'marquee_align'           => XoopsRequest::getInt('align', 0, 'POST'),
245
                                                      'marquee_height'          => XoopsRequest::getInt('height', 0, 'POST'),
246
                                                      'marquee_width'           => XoopsRequest::getString('width', '', 'POST'),
247
                                                      'marquee_hspace'          => XoopsRequest::getInt('hspace', 0, 'POST'),
248
                                                      'marquee_scrolldelay'     => XoopsRequest::getInt('scrolldelay', 0, 'POST'),
249
                                                      'marquee_stoponmouseover' => XoopsRequest::getInt('stoponmouseover', 0, 'POST'),
250
                                                      'marquee_loop'            => XoopsRequest::getInt('loop', 0, 'POST'),
251
                                                      'marquee_vspace'          => XoopsRequest::getInt('vspace', 0, 'POST'),
252
                                                      'marquee_content'         => XoopsRequest::getString('content', '', 'POST'),
253
                                                      'marquee_source'          => XoopsRequest::getString('source', '', 'POST')
254
                                                  ));
255
            if (!$vres) {
256
                redirect_header('main.php', 1, _AM_MARQUEE_ERROR_ADD_MARQUEE);
257
            }
258
            redirect_header('main.php', 1, _AM_MARQUEE_ADDED_OK);
259
        }
260
        break;
261
262
    // Display the form to add an element
263
    case 'addmarquee':
264
        xoops_cp_header();
265
        echo $indexAdmin->addNavigation(basename(__FILE__));
266
267
        echo '<br />';
268
        AddEditMarqueeForm(0, 'verifytoadd', _AM_MARQUEE_CONFIG, '', '', '', '', '', 0, 0, '', 0, 0, 0, 0, 0, _AM_MARQUEE_ADDBUTTON, 'fixed');
269
        break;
270
271
    // Default action, list all elements
272
    case 'default':
273
        xoops_cp_header();
274
        echo $indexAdmin->addNavigation(basename(__FILE__));
275
276
        //        echo '<h4>' . _AM_MARQUEE_CONFIG . "</h4><br />\n";
277
        echo "<table width='100%' border='0' cellspacing='1' class='outer'>\n";
278
        echo "<tr><th align='center'>" . _AM_MARQUEE_ID . "</th><th align='center'>" . _AM_MARQUEE_CONTENT . "</th><th align='center'>" . _AM_MARQUEE_BGCOLOR_SHORT . "</th><th align='center'>" . _AM_MARQUEE_BEHAVIOUR . "</th><th align='center'>" . _AM_MARQUEE_SOURCE . "</th><th align='center'>" . _AM_MARQUEE_STOP . "</th><th align='center'>" . _AM_MARQUEE_DIRECTION . "</th><th align='center'>" . _AM_MARQUEE_ACTION . "</th></tr>\n";
279
        $marqueearray = $marqueeHandler->getObjects();
280
        $class        = 'even';
281
        $baseurl      = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/main.php';
282
        $tbldirection = array(_AM_MARQUEE_DIRECTION1, _AM_MARQUEE_DIRECTION2, _AM_MARQUEE_DIRECTION3, _AM_MARQUEE_DIRECTION4);
283
        $tblbehaviour = array(_AM_MARQUEE_BEHAVIOUR1, _AM_MARQUEE_BEHAVIOUR2, _AM_MARQUEE_BEHAVIOUR3);
284
        if (count($marqueearray) > 0) {
285
            foreach ($marqueearray as $marquee) {
286
                //              $action_edit="<a href='".$baseurl."?op=edit&marqueeid=".$marquee->getVar('marquee_marqueeid')."'>"._AM_MARQUEE_EDIT."</a>";
0 ignored issues
show
Unused Code Comprehensibility introduced by
55% 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...
287
                //              $action_delete="<a href='".$baseurl."?op=delete&marqueeid=".$marquee->getVar('marquee_marqueeid')."'>"._AM_MARQUEE_DELETE."</a>";
0 ignored issues
show
Unused Code Comprehensibility introduced by
55% 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...
288
289
                $action_edit   = '<a href=' . $baseurl . '?op=edit&marqueeid=' . $marquee->getVar('marquee_marqueeid') . '><img src=' . $pathIcon16 . '/edit.png title=' . _AM_MARQUEE_EDIT . '></a>';
290
                $action_delete = '<a href=' . $baseurl . '?op=delete&marqueeid=' . $marquee->getVar('marquee_marqueeid') . '><img src=' . $pathIcon16 . '/delete.png title=' . _AM_MARQUEE_DELETE . '></a>';
291
292
                $bgcolorvalue = $marquee->getVar('marquee_bgcolor');
293
                $direction    = $tbldirection[$marquee->getVar('marquee_direction')];
294
                $behaviour    = $tblbehaviour[$marquee->getVar('marquee_behaviour')];
295
                $stop         = _YES;
296
                if ($marquee->getVar('marquee_stoponmouseover') == 0) {
297
                    $stop = _NO;
298
                }
299
                $source = $marquee->getVar('marquee_source');
300
                if ($marquee->getVar('marquee_source') === 'fixed') {
301
                    $source = _AM_MARQUEE_SOURCE_FIXED;
302
                }
303
                echo "<tr class='" . $class . "'><td align='center'>" . $marquee->getVar('marquee_marqueeid') . "</td><td align='center'>" . xoops_substr(strip_tags($marquee->getVar('marquee_content')), 0, 60) . "</td><td align='center'>" . "<div style='height:12px; width:12px; background-color:" . $bgcolorvalue . "; border:1px solid black;float:left; margin-right:5px;'></div>" . $bgcolorvalue
304
305
                     . "</td><td align='center'>" . $behaviour . "</td><td align='center'>" . $source . "</td><td align='center'>" . $stop . "</td><td align='center'>" . $direction . "</td><td align='center'>" . $action_edit . '&nbsp;&nbsp;' . $action_delete . "</td></tr>\n";
306
                $class = ($class === 'even') ? 'odd' : 'even';
307
            }
308
        }
309
310
        //      echo "<tr class='".$class."'><td colspan='7' align='center'><form name='faddmarquee' method='post' action='main.php'><input type='hidden' name='op' value='addmarquee' /><input type='submit' name='submit' value='"._AM_MARQUEE_ADDMARQUEE."' /></td></tr>";
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...
311
        $indexAdmin->addItemButton(_AM_MARQUEE_ADDMARQUEE, 'main.php?op=addmarquee', 'add', '');
312
        echo $indexAdmin->renderButton('left', '');
313
        echo '</table>';
314
        break;
315
}
316
317
include_once __DIR__ . '/admin_footer.php';
318
//xoops_cp_footer();
319