Completed
Push — master ( 8ca430...3024c9 )
by Michael
03:12
created

blocksadmin.php ➔ listBlocks()   F

Complexity

Conditions 23
Paths 6914

Size

Total Lines 168
Code Lines 125

Duplication

Lines 12
Ratio 7.14 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 23
eloc 125
c 2
b 0
f 0
nc 6914
nop 0
dl 12
loc 168
rs 2

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

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
 * Module: XoopsTube
4
 *
5
 * You may not change or alter any portion of this comment or credits
6
 * of supporting developers from this source code or any supporting source code
7
 * which is considered copyrighted (c) material of the original comment or credit authors.
8
 *
9
 * PHP version 5
10
 *
11
 * @category        Module
12
 * @package         Xoopstube
13
 * @author          Fernando Santos (topet05), [email protected]
14
 * @copyright       Mastop InfoDigital (c) 2003-2007
15
 * @link            http://www.mastop.com.br
16
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
17
 * @since           1.0.6
18
 * @version         $Id$
19
 */
20
21
include_once __DIR__ . '/admin_header.php';
22
if (!is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid())) {
23
    exit(_AM_XOOPSTUBE_ERROR403);
24
}
25
if ($xoopsUser->isAdmin($xoopsModule->mid())) {
26
    include_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
27
    $op = "list";
28
    if (isset($_POST)) {
29
        foreach ($_POST as $k => $v) {
30
            $$k = $v;
31
        }
32
    }
33
34
    if (isset($_GET['op'])) {
35
        if ($_GET['op'] == "edit" || $_GET['op'] == "delete" || $_GET['op'] == "delete_ok" || $_GET['op'] == "clone"
36
            || $_GET['op'] == "edit"
37
        ) {
38
            $op  = $_GET['op'];
39
            $bid = isset($_GET['bid']) ? intval($_GET['bid']) : 0;
40
        }
41
    }
42
43
    /**
44
     *
45
     */
46
    function listBlocks()
0 ignored issues
show
Coding Style introduced by
listBlocks uses the super-global variable $_SERVER which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
Coding Style introduced by
listBlocks uses the super-global variable $GLOBALS which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
47
    {
48
        global $xoopsUser, $xoopsConfig, $xoopsModule, $pathIcon16;
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...
49
        include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
50
        $db =& XoopsDatabaseFactory::getDatabaseConnection();
51 View Code Duplication
        if (file_exists(
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
52
            XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin/blocksadmin.php"
53
        )
54
        ) {
55
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin.php");
56
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin/blocksadmin.php");
57
            //include_once(XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin/groups.php");
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% 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...
58
        } else {
59
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/portuguesebr/admin.php");
60
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/portuguesebr/admin/blocksadmin.php");
61
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/portuguesebr/admin/groups.php");
62
        }
63
        $module_handler     =& xoops_gethandler('module');
64
        $member_handler     =& xoops_gethandler('member');
65
        $moduleperm_handler =& xoops_gethandler('groupperm');
66
        $groups             =& $member_handler->getGroups();
67
        $criteria           = new CriteriaCompo(new Criteria('hasmain', 1));
68
        $criteria->add(new Criteria('isactive', 1));
69
        $module_list     =& $module_handler->getList($criteria);
70
        $module_list[-1] = _AM_SYSTEM_BLOCKS_TOPPAGE;
71
        $module_list[0]  = _AM_SYSTEM_BLOCKS_ALLPAGES;
72
        ksort($module_list);
73
        echo "
74
        <h4 style='text-align:left;'>" . _AM_XOOPSTUBE_BADMIN . "</h4>";
75
        $module_handler =& xoops_gethandler('module');
76
        echo "<form action='" . $_SERVER['PHP_SELF'] . "' name='blockadmin' method='post'>
77
        <table width='100%' class='outer' cellpadding='4' cellspacing='1'>
78
        <tr valign='middle'><th align='center'>" . _AM_XOOPSTUBE_TITLE . "</th><th align='center' nowrap='nowrap'>" . _AM_XOOPSTUBE_SIDE . "<br />" . _LEFT . "-" . _CENTER . "-" . _RIGHT
79
            . "</th><th align='center'>" . _AM_XOOPSTUBE_WEIGHT . "</th><th align='center'>" . _AM_XOOPSTUBE_VISIBLE . "</th><th align='center'>" . _AM_SYSTEM_BLOCKS_VISIBLEIN
80
            . "</th><th align='center'>" . _AM_SYSTEM_ADGS . "</th><th align='center'>" . _AM_SYSTEM_BLOCKS_BCACHETIME . "</th><th align='center'>" . _AM_XOOPSTUBE_ACTION . "</th></tr>
81
        ";
82
        $block_arr   =& XoopsBlock::getByModule($xoopsModule->mid());
83
        $block_count = count($block_arr);
0 ignored issues
show
Unused Code introduced by
$block_count is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
84
        $class       = 'even';
85
        $cachetimes  = array(
86
            '0'       => _NOCACHE,
87
            '30'      => sprintf(_SECONDS, 30),
88
            '60'      => _MINUTE,
89
            '300'     => sprintf(_MINUTES, 5),
90
            '1800'    => sprintf(_MINUTES, 30),
91
            '3600'    => _HOUR,
92
            '18000'   => sprintf(_HOURS, 5),
93
            '86400'   => _DAY,
94
            '259200'  => sprintf(_DAYS, 3),
95
            '604800'  => _WEEK,
96
            '2592000' => _MONTH
97
        );
98
        foreach ($block_arr as $i) {
99
            $groups_perms =& $moduleperm_handler->getGroupIds('block_read', $i->getVar("bid"));
100
            $sql
101
                          = 'SELECT module_id FROM ' . $db->prefix('block_module_link') . ' WHERE block_id=' . $i->getVar("bid");
102
            $result       = $db->query($sql);
103
            $modules      = array();
104
            while ($row = $db->fetchArray($result)) {
105
                $modules[] = intval($row['module_id']);
106
            }
107
108
            $cachetime_options = '';
109
            foreach ($cachetimes as $cachetime => $cachetime_name) {
110
                if ($i->getVar('bcachetime') == $cachetime) {
111
                    $cachetime_options .= "<option value='$cachetime' selected='selected'>$cachetime_name</option>\n";
112
                } else {
113
                    $cachetime_options .= "<option value='$cachetime'>$cachetime_name</option>\n";
114
                }
115
            }
116
117
            $sel0 = $sel1 = $ssel0 = $ssel1 = $ssel2 = $ssel3 = $ssel4 = $ssel5 = $ssel6 = $ssel7 = "";
118
            if ($i->getVar("visible") == 1) {
119
                $sel1 = " checked='checked'";
120
            } else {
121
                $sel0 = " checked='checked'";
122
            }
123
            if ($i->getVar("side") == XOOPS_SIDEBLOCK_LEFT) {
124
                $ssel0 = " checked='checked'";
125
            } elseif ($i->getVar("side") == XOOPS_SIDEBLOCK_RIGHT) {
126
                $ssel1 = " checked='checked'";
127
            } elseif ($i->getVar("side") == XOOPS_CENTERBLOCK_LEFT) {
128
                $ssel2 = " checked='checked'";
129
            } elseif ($i->getVar("side") == XOOPS_CENTERBLOCK_RIGHT) {
130
                $ssel4 = " checked='checked'";
131
            } elseif ($i->getVar("side") == XOOPS_CENTERBLOCK_CENTER) {
132
                $ssel3 = " checked='checked'";
133
            } elseif ($i->getVar("side") == XOOPS_CENTERBLOCK_BOTTOMLEFT) {
134
                $ssel5 = " checked='checked'";
135
            } elseif ($i->getVar("side") == XOOPS_CENTERBLOCK_BOTTOMRIGHT) {
136
                $ssel6 = " checked='checked'";
137
            } elseif ($i->getVar("side") == XOOPS_CENTERBLOCK_BOTTOM) {
138
                $ssel7 = " checked='checked'";
139
            }
140
            if ($i->getVar("title") == "") {
141
                $title = "&nbsp;";
142
            } else {
143
                $title = $i->getVar("title");
144
            }
145
            $name = $i->getVar("name");
0 ignored issues
show
Unused Code introduced by
$name is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
146
            echo "<tr valign='top'><td class='$class' align='center'><input type='text' name='title[" . $i->getVar("bid") . "]' value='" . $title . "'></td><td class='$class' align='center' nowrap='nowrap'>
147
                    <div align='center' >
148
                    <input type='radio' name='side[" . $i->getVar("bid") . "]' value='" . XOOPS_CENTERBLOCK_LEFT . "'$ssel2 />
149
                        <input type='radio' name='side[" . $i->getVar("bid") . "]' value='" . XOOPS_CENTERBLOCK_CENTER . "'$ssel3 />
150
                    <input type='radio' name='side[" . $i->getVar("bid") . "]' value='" . XOOPS_CENTERBLOCK_RIGHT . "'$ssel4 />
151
                    </div>
152
                    <div>
153
                        <span style='float:right'><input type='radio' name='side[" . $i->getVar("bid") . "]' value='" . XOOPS_SIDEBLOCK_RIGHT . "'$ssel1 /></span>
154
                    <div align='left'><input type='radio' name='side[" . $i->getVar("bid") . "]' value='" . XOOPS_SIDEBLOCK_LEFT . "'$ssel0 /></div>
155
                    </div>
156
                    <div align='center'>
157
                    <input type='radio' name='side[" . $i->getVar("bid") . "]' value='" . XOOPS_CENTERBLOCK_BOTTOMLEFT . "'$ssel5 />
158
                        <input type='radio' name='side[" . $i->getVar("bid") . "]' value='" . XOOPS_CENTERBLOCK_BOTTOM . "'$ssel7 />
159
                    <input type='radio' name='side[" . $i->getVar("bid") . "]' value='" . XOOPS_CENTERBLOCK_BOTTOMRIGHT . "'$ssel6 />
160
                    </div>
161
                </td><td class='$class' align='center'><input type='text' name='weight[" . $i->getVar("bid") . "]' value='" . $i->getVar("weight") . "' size='5' maxlength='5' /></td><td class='$class' align='center' nowrap><input type='radio' name='visible["
162
                . $i->getVar("bid") . "]' value='1'$sel1>" . _YES . "&nbsp;<input type='radio' name='visible[" . $i->getVar("bid") . "]' value='0'$sel0>" . _NO . "</td>";
163
164
            echo "<td class='$class' align='center'><select size='5' name='bmodule[" . $i->getVar("bid") . "][]' id='bmodule[" . $i->getVar("bid") . "][]' multiple='multiple'>";
165
            foreach ($module_list as $k => $v) {
166
                echo "<option value='$k'" . ((in_array($k, $modules)) ? " selected='selected'" : "") . ">$v</option>";
167
            }
168
            echo "</select></td>";
169
170
            echo "<td class='$class' align='center'><select size='5' name='groups[" . $i->getVar("bid") . "][]' id='groups[" . $i->getVar("bid") . "][]' multiple='multiple'>";
171
            foreach ($groups as $grp) {
172
                echo "<option value='" . $grp->getVar('groupid') . "' " . ((in_array(
173
                        $grp->getVar('groupid'),
174
                        $groups_perms
175
                    )) ? " selected='selected'" : "") . ">" . $grp->getVar('name') . "</option>";
176
            }
177
            echo "</select></td>";
178
179
            // Cache lifetime
180
            echo '<td class="' . $class . '" align="center"> <select name="bcachetime[' . $i->getVar("bid") . ']" size="1">' . $cachetime_options . '</select>
181
                                    </td>';
182
183
// Actions
184
185
            echo
186
                "<td class='$class' align='center'><a href='blocksadmin.php?op=edit&amp;bid=" . $i->getVar("bid") . "'><img src=" . $pathIcon16 . '/edit.png' . " alt='" . _EDIT . "' title='" . _EDIT . "' />
187
                 </a> <a href='blocksadmin.php?op=clone&amp;bid=" . $i->getVar("bid") . "'><img src=" . $pathIcon16 . '/editcopy.png' . " alt='" . _CLONE . "' title='" . _CLONE . "' />
188
                 </a>";
189
            if ($i->getVar('block_type') != 'S' && $i->getVar('block_type') != 'M') {
190
                echo "&nbsp;<a href='" . XOOPS_URL . "/modules/system/admin.php?fct=blocksadmin&amp;op=delete&amp;bid=" . $i->getVar("bid") . "'><img src=" . $pathIcon16 . '/delete.png' . " alt='"
191
                    . _DELETE . "' title='" . _DELETE . "' />
192
                     </a>";
193
            }
194
            echo "
195
            <input type='hidden' name='oldtitle[" . $i->getVar("bid") . "]' value='" . $i->getVar('title') . "' />
196
            <input type='hidden' name='oldside[" . $i->getVar("bid") . "]' value='" . $i->getVar('side') . "' />
197
            <input type='hidden' name='oldweight[" . $i->getVar("bid") . "]' value='" . $i->getVar('weight') . "' />
198
            <input type='hidden' name='oldvisible[" . $i->getVar("bid") . "]' value='" . $i->getVar('visible') . "' />
199
            <input type='hidden' name='oldgroups[" . $i->getVar("groups") . "]' value='" . $i->getVar('groups') . "' />
200
            <input type='hidden' name='oldbcachetime[" . $i->getVar("bid") . "]' value='" . $i->getVar('bcachetime') . "' />
201
            <input type='hidden' name='bid[" . $i->getVar("bid") . "]' value='" . $i->getVar("bid") . "' />
202
            </td></tr>
203
            ";
204
            $class = ($class == 'even') ? 'odd' : 'even';
205
        }
206
        echo "<tr><td class='foot' align='center' colspan='7'>
207
        <input type='hidden' name='op' value='order' />
208
        " . $GLOBALS['xoopsSecurity']->getTokenHTML() . "
209
        <input type='submit' name='submit' value='" . _SUBMIT . "' />
210
        </td></tr></table>
211
        </form>
212
        <br /><br />";
213
    }
214
215
    /**
216
     * @param $bid
217
     */
218
    function cloneBlock($bid)
219
    {
220
        include_once __DIR__ . '/admin_header.php';
221
        //include_once __DIR__ . '/admin_header.php';
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
222
        xoops_cp_header();
223
224
        global $xoopsConfig;
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...
225
226
//xoops_loadLanguage('admin', XTUBE_DIRNAME);
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% 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...
227
//xoops_loadLanguage('modinfo', XTUBE_DIRNAME);
228
//xoops_loadLanguage('main', XTUBE_DIRNAME);
229
230 View Code Duplication
        if (file_exists(
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
231
            XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin/blocksadmin.php"
232
        )
233
        ) {
234
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin.php");
235
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin/blocksadmin.php");
236
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin/groups.php");
237
        } else {
238
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/portuguesebr/admin.php");
239
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/portuguesebr/admin/blocksadmin.php");
240
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/portuguesebr/admin/groups.php");
241
        }
242
//        mpu_adm_menu();
243
        $myblock = new XoopsBlock($bid);
244
        $db      =& XoopsDatabaseFactory::getDatabaseConnection();
245
        $sql     = 'SELECT module_id FROM ' . $db->prefix('block_module_link') . ' WHERE block_id=' . intval($bid);
246
        $result  = $db->query($sql);
247
        $modules = array();
248
        while ($row = $db->fetchArray($result)) {
249
            $modules[] = intval($row['module_id']);
250
        }
251
        $is_custom = ($myblock->getVar('block_type') == 'C' || $myblock->getVar('block_type') == 'E') ? true : false;
252
        $block     = array(
253
            'title'      => $myblock->getVar('title') . ' Clone',
254
            'form_title' => _AM_XOOPSTUBE_BLOCKS_CLONEBLOCK,
255
            'name'       => $myblock->getVar('name'),
256
            'side'       => $myblock->getVar('side'),
257
            'weight'     => $myblock->getVar('weight'),
258
            'visible'    => $myblock->getVar('visible'),
259
            'content'    => $myblock->getVar('content', 'N'),
260
            'modules'    => $modules,
261
            'is_custom'  => $is_custom,
262
            'ctype'      => $myblock->getVar('c_type'),
263
            'bcachetime' => $myblock->getVar('bcachetime'),
264
            'op'         => 'clone_ok',
265
            'bid'        => $myblock->getVar('bid'),
266
            'edit_form'  => $myblock->getOptions(),
267
            'template'   => $myblock->getVar('template'),
268
            'options'    => $myblock->getVar('options')
269
        );
270
        echo '<a href="blocksadmin.php">' . _AM_BADMIN . '</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;' . _AM_SYSTEM_BLOCKS_CLONEBLOCK . '<br /><br />';
271
        include __DIR__ . '/blockform.php';
272
        $form->display();
0 ignored issues
show
Bug introduced by
The variable $form does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
273
//        xoops_cp_footer();
274
        include_once __DIR__ . '/admin_footer.php';
275
        exit();
0 ignored issues
show
Coding Style Compatibility introduced by
The function cloneBlock() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
276
    }
277
278
    /**
279
     * @param $bid
280
     * @param $bside
281
     * @param $bweight
282
     * @param $bvisible
283
     * @param $bcachetime
284
     * @param $bmodule
285
     * @param $options
286
     */
287
    function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options)
0 ignored issues
show
Coding Style introduced by
isBlockCloned uses the super-global variable $_POST which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
Coding Style introduced by
isBlockCloned uses the super-global variable $GLOBALS which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
288
    {
289
        global $xoopsUser, $xoopsConfig;
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...
290 View Code Duplication
        if (file_exists(
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
291
            XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin/blocksadmin.php"
292
        )
293
        ) {
294
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin.php");
295
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin/blocksadmin.php");
296
            //include_once(XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin/groups.php");
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% 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...
297
        } else {
298
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/portuguesebr/admin.php");
299
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/portuguesebr/admin/blocksadmin.php");
300
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/portuguesebr/admin/groups.php");
301
        }
302
        $block = new XoopsBlock($bid);
303
        $clone =& $block->xoopsClone();
304
        if (empty($bmodule)) {
305
            xoops_cp_header();
306
            xoops_error(sprintf(_AM_NOTSELNG, _AM_VISIBLEIN));
307
            xoops_cp_footer();
308
            exit();
0 ignored issues
show
Coding Style Compatibility introduced by
The function isBlockCloned() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
309
        }
310
        $clone->setVar('side', $bside);
311
        $clone->setVar('weight', $bweight);
312
        $clone->setVar('visible', $bvisible);
313
        //$clone->setVar('content', $_POST['bcontent']);
0 ignored issues
show
Unused Code Comprehensibility introduced by
85% 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...
314
        $clone->setVar('title', $_POST['btitle']);
315
        $clone->setVar('bcachetime', $bcachetime);
316
        if (isset($options) && (count($options) > 0)) {
317
            $options = implode('|', $options);
318
            $clone->setVar('options', $options);
319
        }
320
        $clone->setVar('bid', 0);
321
        if ($block->getVar('block_type') == 'C' || $block->getVar('block_type') == 'E') {
322
            $clone->setVar('block_type', 'E');
323
        } else {
324
            $clone->setVar('block_type', 'D');
325
        }
326
        $newid = $clone->store();
327
        if (!$newid) {
328
            xoops_cp_header();
329
            $clone->getHtmlErrors();
330
            xoops_cp_footer();
331
            exit();
0 ignored issues
show
Coding Style Compatibility introduced by
The function isBlockCloned() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
332
        }
333
        if ($clone->getVar('template') != '') {
334
            $tplfile_handler =& xoops_gethandler('tplfile');
335
            $btemplate       =& $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $bid);
336
            if (count($btemplate) > 0) {
337
                $tplclone =& $btemplate[0]->xoopsClone();
338
                $tplclone->setVar('tpl_id', 0);
339
                $tplclone->setVar('tpl_refid', $newid);
340
                $tplfile_handler->insert($tplclone);
341
            }
342
        }
343
        $db =& XoopsDatabaseFactory::getDatabaseConnection();
344
        foreach ($bmodule as $bmid) {
345
            $sql = 'INSERT INTO ' . $db->prefix('block_module_link') . ' (block_id, module_id) VALUES (' . $newid . ', ' . $bmid . ')';
346
            $db->query($sql);
347
        }
348
        $groups =& $xoopsUser->getGroups();
349
        $count  = count($groups);
350
        for ($i = 0; $i < $count; ++$i) {
351
            $sql
352
                = "INSERT INTO " . $db->prefix('group_permission') . " (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES (" . $groups[$i] . ", " . $newid . ", 1, 'block_read')";
353
            $db->query($sql);
354
        }
355
        redirect_header('blocksadmin.php?op=listar', 1, _AM_DBUPDATED);
356
    }
357
358
    /**
359
     * @param $bid
360
     * @param $title
361
     * @param $weight
362
     * @param $visible
363
     * @param $side
364
     * @param $bcachetime
365
     */
366
    function xtubeSetOrder($bid, $title, $weight, $visible, $side, $bcachetime)
367
    {
368
        $myblock = new XoopsBlock($bid);
369
        $myblock->setVar('title', $title);
370
        $myblock->setVar('weight', $weight);
371
        $myblock->setVar('visible', $visible);
372
        $myblock->setVar('side', $side);
373
        $myblock->setVar('bcachetime', $bcachetime);
374
        $myblock->store();
375
    }
376
377
    /**
378
     * @param $bid
379
     */
380
    function xtubeEditBlock($bid)
381
    {
382
        include_once __DIR__ . '/admin_header.php';
383
        //include_once __DIR__ . '/admin_header.php';
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
384
        xoops_cp_header();
385
386
        global $xoopsConfig;
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...
387
388
//xoops_loadLanguage('admin', XTUBE_DIRNAME);
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% 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...
389
//xoops_loadLanguage('modinfo', XTUBE_DIRNAME);
390
//xoops_loadLanguage('main', XTUBE_DIRNAME);
391
392 View Code Duplication
        if (file_exists(
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
393
            XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin/blocksadmin.php"
394
        )
395
        ) {
396
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin.php");
397
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin/blocksadmin.php");
398
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin/groups.php");
399
        } else {
400
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/portuguesebr/admin.php");
401
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/portuguesebr/admin/blocksadmin.php");
402
            include_once(XOOPS_ROOT_PATH . "/modules/system/language/portuguesebr/admin/groups.php");
403
        }
404
//        mpu_adm_menu();
405
        $myblock = new XoopsBlock($bid);
406
        $db      =& XoopsDatabaseFactory::getDatabaseConnection();
407
        $sql     = 'SELECT module_id FROM ' . $db->prefix('block_module_link') . ' WHERE block_id=' . intval($bid);
408
        $result  = $db->query($sql);
409
        $modules = array();
410
        while ($row = $db->fetchArray($result)) {
411
            $modules[] = intval($row['module_id']);
412
        }
413
        $is_custom = ($myblock->getVar('block_type') == 'C' || $myblock->getVar('block_type') == 'E') ? true : false;
414
        $block     = array(
415
            'title'      => $myblock->getVar('title'),
416
            'form_title' => _AM_XOOPSTUBE_BLOCKS_EDITBLOCK,
417
            //        'name'       => $myblock->getVar('name'),
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...
418
            'side'       => $myblock->getVar('side'),
419
            'weight'     => $myblock->getVar('weight'),
420
            'visible'    => $myblock->getVar('visible'),
421
            'content'    => $myblock->getVar('content', 'N'),
422
            'modules'    => $modules,
423
            'is_custom'  => $is_custom,
424
            'ctype'      => $myblock->getVar('c_type'),
425
            'bcachetime' => $myblock->getVar('bcachetime'),
426
            'op'         => 'edit_ok',
427
            'bid'        => $myblock->getVar('bid'),
428
            'edit_form'  => $myblock->getOptions(),
429
            'template'   => $myblock->getVar('template'),
430
            'options'    => $myblock->getVar('options')
431
        );
432
        echo '<a href="blocksadmin.php">' . _AM_BADMIN . '</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;' . _AM_SYSTEM_BLOCKS_EDITBLOCK . '<br /><br />';
433
        include 'blockform.php';
434
        $form->display();
0 ignored issues
show
Bug introduced by
The variable $form does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
435
//        xoops_cp_footer();
436
        include_once __DIR__ . '/admin_footer.php';
437
        exit();
0 ignored issues
show
Coding Style Compatibility introduced by
The function xtubeEditBlock() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
438
    }
439
440
    /**
441
     * @param $bid
442
     * @param $btitle
443
     * @param $bside
444
     * @param $bweight
445
     * @param $bvisible
446
     * @param $bcachetime
447
     * @param $bmodule
448
     * @param $options
449
     * @param $groups
450
     */
451
    function xtubeUpdateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups)
0 ignored issues
show
Coding Style introduced by
xtubeUpdateBlock uses the super-global variable $_SERVER which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
452
    {
453
        $myblock = new XoopsBlock($bid);
454
        $myblock->setVar('title', $btitle);
455
        $myblock->setVar('weight', $bweight);
456
        $myblock->setVar('visible', $bvisible);
457
        $myblock->setVar('side', $bside);
458
        $myblock->setVar('bcachetime', $bcachetime);
459
        $myblock->store();
460
461
        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...
462
463
        if (!empty($bmodule) && count($bmodule) > 0) {
464
            $sql = sprintf("DELETE FROM %s WHERE block_id = %u", $xoopsDB->prefix('block_module_link'), $bid);
465
            $xoopsDB->query($sql);
466
            if (in_array(0, $bmodule)) {
467
                $sql = sprintf(
468
                    "INSERT INTO %s (block_id, module_id) VALUES (%u, %d)",
469
                    $xoopsDB->prefix('block_module_link'),
470
                    $bid,
471
                    0
472
                );
473
                $xoopsDB->query($sql);
474 View Code Duplication
            } else {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
475
                foreach ($bmodule as $bmid) {
476
                    $sql = sprintf(
477
                        "INSERT INTO %s (block_id, module_id) VALUES (%u, %d)",
478
                        $xoopsDB->prefix('block_module_link'),
479
                        $bid,
480
                        intval($bmid)
481
                    );
482
                    $xoopsDB->query($sql);
483
                }
484
            }
485
        }
486
        $sql = sprintf("DELETE FROM %s WHERE gperm_itemid = %u", $xoopsDB->prefix('group_permission'), $bid);
487
        $xoopsDB->query($sql);
488
        if (!empty($groups)) {
489 View Code Duplication
            foreach ($groups as $grp) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
490
                $sql = sprintf(
491
                    "INSERT INTO %s (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES (%u, %u, 1, 'block_read')",
492
                    $xoopsDB->prefix('group_permission'),
493
                    $grp,
494
                    $bid
495
                );
496
                $xoopsDB->query($sql);
497
            }
498
        }
499
        redirect_header($_SERVER['PHP_SELF'], 1, _AM_XOOPSTUBE_UPDATE_SUCCESS);
500
        exit();
0 ignored issues
show
Coding Style Compatibility introduced by
The function xtubeUpdateBlock() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
501
    }
502
503
    if ($op == "list") {
504
        xoops_cp_header();
505
//        mpu_adm_menu();
506
        listBlocks();
507
        include_once __DIR__ . '/admin_footer.php';
508
        exit();
509
    }
510
511
    if ($op == "order") {
512
        if (!$GLOBALS['xoopsSecurity']->check()) {
513
            redirect_header($_SERVER['PHP_SELF'], 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
514
            exit();
515
        }
516
        foreach (array_keys($bid) as $i) {
517
            if ($oldtitle[$i] != $title[$i] || $oldweight[$i] != $weight[$i] || $oldvisible[$i] != $visible[$i]
518
                || $oldside[$i] != $side[$i]
519
                || $oldbcachetime[$i] != $bcachetime[$i]
520
            ) {
521
                xtubeSetOrder(
522
                    $bid[$i],
523
                    $title[$i],
524
                    $weight[$i],
525
                    $visible[$i],
526
                    $side[$i],
527
                    $bcachetime[$i],
528
                    $bmodule[$i]
0 ignored issues
show
Unused Code introduced by
The call to xtubeSetOrder() has too many arguments starting with $bmodule[$i].

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
529
                );
530
            }
531
            if (!empty($bmodule[$i]) && count($bmodule[$i]) > 0) {
532
                $sql = sprintf("DELETE FROM %s WHERE block_id = %u", $xoopsDB->prefix('block_module_link'), $bid[$i]);
533
                $xoopsDB->query($sql);
534
                if (in_array(0, $bmodule[$i])) {
535
                    $sql = sprintf(
536
                        "INSERT INTO %s (block_id, module_id) VALUES (%u, %d)",
537
                        $xoopsDB->prefix('block_module_link'),
538
                        $bid[$i],
539
                        0
540
                    );
541
                    $xoopsDB->query($sql);
542 View Code Duplication
                } else {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
543
                    foreach ($bmodule[$i] as $bmid) {
544
                        $sql = sprintf(
545
                            "INSERT INTO %s (block_id, module_id) VALUES (%u, %d)",
546
                            $xoopsDB->prefix('block_module_link'),
547
                            $bid[$i],
548
                            intval($bmid)
549
                        );
550
                        $xoopsDB->query($sql);
551
                    }
552
                }
553
            }
554
            $sql = sprintf("DELETE FROM %s WHERE gperm_itemid = %u", $xoopsDB->prefix('group_permission'), $bid[$i]);
555
            $xoopsDB->query($sql);
556
            if (!empty($groups[$i])) {
557 View Code Duplication
                foreach ($groups[$i] as $grp) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
558
                    $sql = sprintf(
559
                        "INSERT INTO %s (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES (%u, %u, 1, 'block_read')",
560
                        $xoopsDB->prefix('group_permission'),
561
                        $grp,
562
                        $bid[$i]
563
                    );
564
                    $xoopsDB->query($sql);
565
                }
566
            }
567
        }
568
        redirect_header($_SERVER['PHP_SELF'], 1, _AM_XOOPSTUBE_UPDATE_SUCCESS);
569
        exit();
570
    }
571
    if ($op == 'clone') {
572
        cloneBlock($bid);
573
    }
574
575
    if ($op == 'edit') {
576
        xtubeEditBlock($bid);
577
    }
578
579
    if ($op == 'edit_ok') {
580
        xtubeUpdateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups);
581
582
    }
583
584
    if ($op == 'clone_ok') {
585
        isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options);
586
    }
587
} else {
588
    echo _AM_XOOPSTUBE_ERROR403;
589
}
590