Completed
Push — master ( 9d3fbd...af269e )
by Michael
09:48
created

my-lists.php ➔ listForm()   C

Complexity

Conditions 12
Paths 153

Size

Total Lines 72
Code Lines 56

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 12
eloc 56
nc 153
nop 2
dl 0
loc 72
rs 5.0906
c 0
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
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 53 and the first side effect is on line 23.

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
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
/**
13
 * oledrion
14
 *
15
 * @copyright   {@link https://xoops.org/ XOOPS Project}
16
 * @license     {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
17
 * @author      Hervé Thouzard (http://www.herve-thouzard.com/)
18
 */
19
20
/**
21
 * Liste des listes de l'utilisateur
22
 */
23
require_once __DIR__ . '/header.php';
24
$GLOBALS['current_category']             = -1;
25
$GLOBALS['xoopsOption']['template_main'] = 'oledrion_mylists.tpl';
26
require_once XOOPS_ROOT_PATH . '/header.php';
27
require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
28
29
$uid = OledrionUtility::getCurrentUserID();
30
if ($uid == 0) {
31
    OledrionUtility::redirect(_OLEDRION_ERROR23, XOOPS_URL . '/register.php', 4);
32
}
33
34
$baseurl  = OLEDRION_URL . basename(__FILE__); // URL de ce script
35
$handlers = OledrionHandler::getInstance();
36
if (isset($_GET['op'])) {
37
    $op = $_GET['op'];
38
} elseif (isset($_POST['op'])) {
39
    $op = $_POST['op'];
40
} else {
41
    $op = 'default';
42
}
43
$xoopsTpl->assign('baseurl', $baseurl);
44
OledrionUtility::loadLanguageFile('modinfo.php');
45
OledrionUtility::loadLanguageFile('admin.php');
46
$breadcrumb = '';
47
48
/**
49
 * @param                        $op
50
 * @param  int                   $product_id
51
 * @return object|XoopsThemeForm
52
 */
53
function listForm($op, $product_id = 0)
0 ignored issues
show
Coding Style introduced by
listForm uses the super-global variable $_GET 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...
54
{
55
    global $handlers, $baseurl;
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...
56
    if ($op === 'edit') {
57
        $title        = _OLEDRION_EDIT_LIST;
58
        $label_submit = _AM_OLEDRION_MODIFY;
0 ignored issues
show
Unused Code introduced by
$label_submit 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...
59
        $list_id      = isset($_GET['list_id']) ? (int)$_GET['list_id'] : 0;
60
        if (empty($list_id)) {
61
            OledrionUtility::redirect(_AM_OLEDRION_ERROR_21, $baseurl, 5);
62
        }
63
        $item = null;
0 ignored issues
show
Unused Code introduced by
$item 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...
64
        $item = $handlers->h_oledrion_lists->get($list_id);
65
        if (!is_object($item)) {
66
            OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
67
        }
68
        // Vérification, est-ce que l'utilisateur courant est bien le propriétaire de cette liste ?
69
        if (!$handlers->h_oledrion_lists->isThisMyList($list_id)) {
70
            OledrionUtility::redirect(_OLEDRION_ERROR25, $baseurl, 8);
71
        }
72
        $edit         = true;
73
        $label_submit = _AM_OLEDRION_MODIFY;
74
    } else {
75
        $title        = _OLEDRION_ADD_LIST;
76
        $label_submit = _AM_OLEDRION_ADD;
77
        $item         = $handlers->h_oledrion_lists->create(true);
78
        $edit         = false;
79
    }
80
81
    $sform = new XoopsThemeForm($title, 'frmList', $baseurl);
82
    $sform->addElement(new XoopsFormHidden('op', 'save'));
83
    $sform->addElement(new XoopsFormHidden('list_id', $item->getVar('list_id')));
84
    $sform->addElement(new XoopsFormText(_AM_OLEDRION_TITLE, 'list_title', 50, 255, $item->getVar('list_title', 'e')), true);
85
    //$sform->addElement(new XoopsFormText(_OLEDRION_LIST_PASSWORD, 'list_password', 50, 50, $item->getVar('list_password','e')), false);
0 ignored issues
show
Unused Code Comprehensibility introduced by
71% 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...
86
    $selectTypes = Oledrion_lists::getTypesArray();
87
    $selectType  = new XoopsFormSelect(_OLEDRION_LIST_TYPE, 'list_type', $item->getVar('list_type', 'e'));
88
    $selectType->addOptionArray($selectTypes);
89
    $sform->addElement($selectType, true);
90
    $sform->addElement(new XoopsFormTextArea(_OLEDRION_DESCRIPTION, 'list_description', $item->getVar('list_description', 'e'), 7, 60), false);
91
    $listProducts = array();
0 ignored issues
show
Unused Code introduced by
$listProducts 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...
92
    if ($edit) {
93
        $listProducts = $handlers->h_oledrion_lists->getListProducts($item);
94
        if (count($listProducts) > 0) {
95
            $productsTray = new XoopsFormElementTray(_OLEDRION_PROD_IN_THIS_LIST, '<br>');
96
            $productsTray->addElement(new XoopsFormLabel(_OLEDRION_CHECK_PRODUCTS), false);
97
            foreach ($listProducts as $product) {
98
                $caption  = "<a target='_blank' href='" . $product->getLink() . "'>" . $product->getVar('product_title') . '</a>';
99
                $checkbox = new XoopsFormCheckBox($caption, 'productsList[]');
100
                $checkbox->addOption($product->getVar('product_id'), _DELETE);
101
                $productsTray->addElement($checkbox);
102
                unset($caption, $checkbox);
103
            }
104
            $sform->addElement($productsTray, false);
105
        }
106
    }
107
    if ($product_id > 0) {
108
        $product = null;
0 ignored issues
show
Unused Code introduced by
$product 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...
109
        $product = $handlers->h_oledrion_products->get($product_id);
110
        if (is_object($product) && $product->isProductVisible()) {
111
            $content = "<a target='_blank' href='" . $product->getLink() . "'>" . $product->getVar('product_title') . '</a>';
112
            $sform->addElement(new XoopsFormLabel(_OLEDRION_PRODUCT_DO_ADD, $content));
113
            $sform->addElement(new XoopsFormHidden('product_id', $product_id));
114
        }
115
    }
116
    $button_tray = new XoopsFormElementTray('', '');
117
    $submit_btn  = new XoopsFormButton('', 'post', $label_submit, 'submit');
118
    $button_tray->addElement($submit_btn);
119
    $sform->addElement($button_tray);
120
121
    $sform =& OledrionUtility::formMarkRequiredFields($sform);
122
123
    return $sform;
124
}
125
126
switch ($op) {
127
    // ************************************************************************
128
    case 'default': // Liste de toutes les listes de l'utilisateur ************
129
        // ************************************************************************
130
        $xoopsTpl->assign('op', $op);
131
        $lists   = array();
132
        $start   = $limit = 0;
133
        $idAsKey = true;
134
        $lists   = $handlers->h_oledrion_lists->getRecentLists(new Oledrion_parameters(array(
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
135
                                                                                           'start'    => $start,
136
                                                                                           'limit'    => $limit,
137
                                                                                           'sort'     => 'list_title',
138
                                                                                           'order'    => 'ASC',
139
                                                                                           'idAsKey'  => $idAsKey,
140
                                                                                           'listType' => OLEDRION_LISTS_ALL,
141
                                                                                           'list_uid' => $uid
142
                                                                                       )));
143
        if (count($lists) > 0) {
144
            foreach ($lists as $list) {
145
                $xoopsTpl->append('lists', $list->toArray());
146
            }
147
        }
148
        $breadcrumb = array(
149
            OLEDRION_URL . 'all-lists.php'    => _MI_OLEDRION_SMNAME11,
150
            OLEDRION_URL . basename(__FILE__) => _MI_OLEDRION_SMNAME10
151
        );
152
        break;
153
154
    // ************************************************************************
155
    case 'addProduct': // Ajout d'un produit à une liste *********************
156
        // ************************************************************************
157
        $xoopsTpl->assign('op', $op);
158
        $product_id = isset($_GET['product_id']) ? (int)$_GET['product_id'] : 0;
159
        if ($product_id == 0) {
160
            OledrionUtility::redirect(_OLEDRION_ERROR14, $baseurl, 4);
161
        }
162
        $userListsCount = $handlers->h_oledrion_lists->getRecentListsCount(OLEDRION_LISTS_ALL, $uid);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
163
        $xoopsTpl->assign('userListsCount', $userListsCount);
164
        $xoopsTpl->assign('product_id', $product_id);
165
        if ($userListsCount > 0) {
166
            $userLists = $handlers->h_oledrion_lists->getRecentLists(new Oledrion_parameters(array(
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
167
                                                                                                 'start'    => 0,
168
                                                                                                 'limit'    => 0,
169
                                                                                                 'sort'     => 'list_title',
170
                                                                                                 'order'    => 'ASC',
171
                                                                                                 'idAsKey'  => true,
172
                                                                                                 'listType' => OLEDRION_LISTS_ALL,
173
                                                                                                 'list_uid' => $uid
174
                                                                                             )));
175
            foreach ($userLists as $list) {
176
                $xoopsTpl->append('lists', $list->toArray());
177
            }
178
            $breadcrumb = array(
179
                OLEDRION_URL . 'all-lists.php'    => _MI_OLEDRION_SMNAME11,
180
                OLEDRION_URL . basename(__FILE__) => _MI_OLEDRION_SMNAME10,
181
                OLEDRION_URL                      => _OLEDRION_ADD_PRODUCT_LIST
182
            );
183
            $product    = null;
184
            $product    = $handlers->h_oledrion_products->get($product_id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
185 View Code Duplication
            if (is_object($product) && $product->isProductVisible()) {
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...
186
                $xoopsTpl->assign('product', $product->toArray());
187
            } else {
188
                OledrionUtility::redirect(_OLEDRION_ERROR1, $baseurl, 4);
189
            }
190
        } else {
191
            $sform      = listForm('addList', $product_id);
192
            $title      = _OLEDRION_ADD_LIST;
193
            $breadcrumb = array(
194
                OLEDRION_URL . 'all-lists.php'    => _MI_OLEDRION_SMNAME11,
195
                OLEDRION_URL . basename(__FILE__) => _MI_OLEDRION_SMNAME10,
196
                OLEDRION_URL                      => $title
197
            );
198
            $xoopsTpl->assign('form', $sform->render());
199
        }
200
        break;
201
202
    // ************************************************************************
203
    case 'addProductToList': // Ajout d'un produit à une liste, sélection de la liste
204
        // ************************************************************************
205
        $xoopsTpl->assign('op', $op);
206
        $product_id = isset($_POST['product_id']) ? (int)$_POST['product_id'] : 0;
207
        if ($product_id == 0) {
208
            OledrionUtility::redirect(_OLEDRION_ERROR14, $baseurl, 4);
209
        }
210
        $product = null;
211
        $product = $handlers->h_oledrion_products->get($product_id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
212 View Code Duplication
        if (is_object($product) && $product->isProductVisible()) {
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...
213
            $xoopsTpl->assign('product', $product->toArray());
214
        } else {
215
            OledrionUtility::redirect(_OLEDRION_ERROR1, $baseurl, 4);
216
        }
217
218
        $list_id = isset($_POST['list_id']) ? (int)$_POST['list_id'] : 0;
219
        if ($list_id == 0) { // Ajouter à une nouvelle liste
220
            $sform      = listForm('addList', $product_id);
221
            $title      = _OLEDRION_ADD_LIST;
222
            $breadcrumb = array(
223
                OLEDRION_URL . 'all-lists.php'    => _MI_OLEDRION_SMNAME11,
224
                OLEDRION_URL . basename(__FILE__) => _MI_OLEDRION_SMNAME10,
225
                OLEDRION_URL                      => $title
226
            );
227
            $xoopsTpl->assign('form', $sform->render());
228
            $xoopsTpl->assign('op', 'addList');
229
        } else { // Ajouter à une liste existante
230
            if (!$handlers->h_oledrion_lists->isThisMyList($list_id)) {
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
231
                OledrionUtility::redirect(_OLEDRION_ERROR25, $baseurl, 8);
232
            }
233
            if ($handlers->h_oledrion_products_list->isProductAlreadyInList($list_id, $product_id)) {
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products_list does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
234
                OledrionUtility::redirect(_OLEDRION_ERROR26, $baseurl . '?op=addProduct&product_id=' . $product_id, 4);
235
            } else {
236
                $res = $handlers->h_oledrion_products_list->addProductToUserList($list_id, $product_id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products_list does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
237
                if ($res) {
238
                    $list = null;
239
                    $list = $handlers->h_oledrion_lists->get($list_id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
240
                    if (is_object($list)) {
241
                        $handlers->h_oledrion_lists->incrementListProductsCount($list);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
242
                    }
243
                    OledrionUtility::updateCache();
244
                    OledrionUtility::redirect(_OLEDRION_PRODUCT_LIST_ADD_OK, $product->getLink(), 2);
245
                } else {
246
                    OledrionUtility::redirect(_OLEDRION_ERROR27, $product->getLink(), 4);
247
                }
248
            }
249
        }
250
        break;
251
252
    // ************************************************************************
253
    case 'delete': // Suppression d'une liste ********************************
254
        // ************************************************************************
255
        $xoopsTpl->assign('op', $op);
256
        $list_id = isset($_GET['list_id']) ? (int)$_GET['list_id'] : 0;
257
        if ($list_id == 0) {
258
            OledrionUtility::redirect(_OLEDRION_ERROR21, $baseurl, 4);
259
        }
260
        // Vérification, est-ce que l'utilisateur courant est bien le propriétaire de cette liste ?
261
        if (!$handlers->h_oledrion_lists->isThisMyList($list_id)) {
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
262
            OledrionUtility::redirect(_OLEDRION_ERROR25, $baseurl, 8);
263
        }
264
        $item = $handlers->h_oledrion_lists->get($list_id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
265
        if (!is_object($item)) {
266
            OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
267
        }
268
        xoops_confirm(array('op' => 'reallyDelete', 'list_id' => $list_id), $baseurl, _OLEDRION_DELETE_LIST . '<br>' . $item->getVar('list_title'));
269
        break;
270
271
    // ************************************************************************
272
    case 'reallyDelete': // Suppression effective d'une liste **************
273
        // ************************************************************************
274
        $list_id = isset($_POST['list_id']) ? (int)$_POST['list_id'] : 0;
275
        if ($list_id == 0) {
276
            OledrionUtility::redirect(_OLEDRION_ERROR21, $baseurl, 4);
277
        }
278
        // Vérification, est-ce que l'utilisateur courant est bien le propriétaire de cette liste ?
279
        if (!$handlers->h_oledrion_lists->isThisMyList($list_id)) {
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
280
            OledrionUtility::redirect(_OLEDRION_ERROR25, $baseurl, 8);
281
        }
282
        $item = $handlers->h_oledrion_lists->get($list_id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
283
        if (!is_object($item)) {
284
            OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
285
        }
286
        if ($handlers->h_oledrion_lists->deleteList($item)) {
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
287
            OledrionUtility::updateCache();
288
            OledrionUtility::redirect(_AM_OLEDRION_SAVE_OK, $baseurl, 2);
289
        } else {
290
            OledrionUtility::redirect(_AM_OLEDRION_SAVE_PB, $baseurl, 5);
291
        }
292
        break;
293
294
    // ************************************************************************
295
    case 'save': // Sauvegarde d'une liste *********************************
296
        // ************************************************************************
297
        $list_id = isset($_POST['list_id']) ? (int)$_POST['list_id'] : 0;
298
        if (!empty($list_id)) {
299
            // Vérification, est-ce que l'utilisateur courant est bien le propriétaire de cette liste ?
300
            if (!$handlers->h_oledrion_lists->isThisMyList($list_id)) {
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
301
                OledrionUtility::redirect(_OLEDRION_ERROR25, $baseurl, 8);
302
            }
303
            $edit = true;
304
            $item = $handlers->h_oledrion_lists->get($list_id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
305
            if (!is_object($item)) {
306
                OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
307
            }
308
            $item->unsetNew();
309
            $edit = true;
310
        } else {
311
            $item = $handlers->h_oledrion_lists->create(true);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
312
            $edit = false;
313
        }
314
        // Contrôle sur le titre
315
        if (!isset($_POST['list_title']) || (isset($_POST['list_title']) && xoops_trim($_POST['list_title']) == '')) {
316
            OledrionUtility::redirect(_OLEDRION_ERROR24, $baseurl, 5);
317
        }
318
        $item->setVars($_POST);
319
        if (!$edit) {
320
            $item->setVar('list_date', time());
321
            $item->setVar('list_uid', $uid);
322
        }
323
        if (isset($_POST['productsList'])) {
324
            $productsDeletedCount = 0;
325
            foreach ($_POST['productsList'] as $productId) {
326
                $res = $handlers->h_oledrion_products_list->deleteProductFromList($list_id, (int)$productId);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products_list does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
327
                if ($res) {
328
                    ++$productsDeletedCount;
329
                }
330
            }
331
            if ($productsDeletedCount > 0) {
332
                $handlers->h_oledrion_products_list->decrementListProductsCount($productsDeletedCount);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products_list does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
333
            }
334
        }
335
        $res = $handlers->h_oledrion_lists->insert($item);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
336
        if ($res) {
337
            if (isset($_POST['product_id'])) {
338
                $product_id = (int)$_POST['product_id'];
339
                if ($product_id > 0) {
340
                    $product = null;
341
                    $product = $handlers->h_oledrion_products->get($product_id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
342
                    if (is_object($product)
343
                        && $product->isProductVisible()) { // On peut ajouter le produit à cette nouvelle liste
344
                        $res = $handlers->h_oledrion_products_list->addProductToUserList($item->getVar('list_id'), $product_id);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_products_list does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
345
                        if ($res) { // Mise à jour du nombre de produits de la liste
346
                            $handlers->h_oledrion_lists->incrementListProductsCount($item);
0 ignored issues
show
Documentation introduced by
The property h_oledrion_lists does not exist on object<OledrionHandler>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
347
                            OledrionUtility::updateCache();
348
                            OledrionUtility::redirect(_AM_OLEDRION_SAVE_OK, $product->getLink(), 2);
349
                        }
350
                    }
351
                }
352
            }
353
            OledrionUtility::updateCache();
354
            OledrionUtility::redirect(_AM_OLEDRION_SAVE_OK, $baseurl, 2);
355
        } else {
356
            OledrionUtility::redirect(_AM_OLEDRION_SAVE_PB, $baseurl, 5);
357
        }
358
        break;
359
360
    // ************************************************************************
361
    case 'edit': // Edition d'une liste ***************************************
362
    case 'addList': // Ajout d'une liste **************************************
363
        // ************************************************************************
364
        $xoopsTpl->assign('op', $op);
365
        $sform = listForm($op, 0);
366
        if ($op === 'edit') {
367
            $title = _OLEDRION_EDIT_LIST;
368
        } else {
369
            $title = _OLEDRION_ADD_LIST;
370
        }
371
        $breadcrumb = array(
372
            OLEDRION_URL . 'all-lists.php'    => _MI_OLEDRION_SMNAME11,
373
            OLEDRION_URL . basename(__FILE__) => _MI_OLEDRION_SMNAME10,
374
            OLEDRION_URL                      => $title
375
        );
376
377
        $xoopsTpl->assign('form', $sform->render());
378
        break;
379
}
380
381
OledrionUtility::setCSS();
382
OledrionUtility::setLocalCSS($xoopsConfig['language']);
383
384
$xoopsTpl->assign('mod_pref', $mod_pref);
385
$xoopsTpl->assign('breadcrumb', OledrionUtility::breadcrumb($breadcrumb));
0 ignored issues
show
Bug introduced by
It seems like $breadcrumb defined by '' on line 46 can also be of type string; however, OledrionUtility::breadcrumb() does only seem to accept array, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
386
387
$title = _MI_OLEDRION_SMNAME10 . ' - ' . OledrionUtility::getModuleName();
388
OledrionUtility::setMetas($title, $title);
389
require_once XOOPS_ROOT_PATH . '/footer.php';
390