XoopsModules25x /
oledrion
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 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 http://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 __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 = Oledrion_utils::getCurrentUserID(); |
||
| 30 | if ($uid == 0) { |
||
| 31 | Oledrion_utils::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 | View Code Duplication | 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 | Oledrion_utils::loadLanguageFile('modinfo.php'); |
||
| 45 | Oledrion_utils::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) |
||
| 54 | { |
||
| 55 | global $handlers, $baseurl; |
||
| 56 | if ($op === 'edit') { |
||
| 57 | $title = _OLEDRION_EDIT_LIST; |
||
| 58 | $label_submit = _AM_OLEDRION_MODIFY; |
||
| 59 | $list_id = isset($_GET['list_id']) ? (int)$_GET['list_id'] : 0; |
||
| 60 | if (empty($list_id)) { |
||
| 61 | Oledrion_utils::redirect(_AM_OLEDRION_ERROR_21, $baseurl, 5); |
||
| 62 | } |
||
| 63 | $item = null; |
||
| 64 | $item = $handlers->h_oledrion_lists->get($list_id); |
||
| 65 | if (!is_object($item)) { |
||
| 66 | Oledrion_utils::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 | Oledrion_utils::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); |
||
| 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(); |
||
| 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; |
||
| 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 =& Oledrion_utils::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
|
|||
| 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 | Oledrion_utils::redirect(_OLEDRION_ERROR14, $baseurl, 4); |
||
| 161 | } |
||
| 162 | $userListsCount = $handlers->h_oledrion_lists->getRecentListsCount(OLEDRION_LISTS_ALL, $uid); |
||
|
0 ignored issues
–
show
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 <?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
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 <?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
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 <?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()) { |
|
| 186 | $xoopsTpl->assign('product', $product->toArray()); |
||
| 187 | } else { |
||
| 188 | Oledrion_utils::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 | Oledrion_utils::redirect(_OLEDRION_ERROR14, $baseurl, 4); |
||
| 209 | } |
||
| 210 | $product = null; |
||
| 211 | $product = $handlers->h_oledrion_products->get($product_id); |
||
|
0 ignored issues
–
show
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 <?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
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 | Oledrion_utils::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
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 <?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 | Oledrion_utils::redirect(_OLEDRION_ERROR25, $baseurl, 8); |
||
| 232 | } |
||
| 233 | if ($handlers->h_oledrion_products_list->isProductAlreadyInList($list_id, $product_id)) { |
||
|
0 ignored issues
–
show
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 <?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 | Oledrion_utils::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
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 <?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
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 <?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
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 <?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 | Oledrion_utils::updateCache(); |
||
| 244 | Oledrion_utils::redirect(_OLEDRION_PRODUCT_LIST_ADD_OK, $product->getLink(), 2); |
||
| 245 | } else { |
||
| 246 | Oledrion_utils::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 | Oledrion_utils::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
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 <?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 | Oledrion_utils::redirect(_OLEDRION_ERROR25, $baseurl, 8); |
||
| 263 | } |
||
| 264 | $item = $handlers->h_oledrion_lists->get($list_id); |
||
|
0 ignored issues
–
show
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 <?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 | Oledrion_utils::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 | Oledrion_utils::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
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 <?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 | Oledrion_utils::redirect(_OLEDRION_ERROR25, $baseurl, 8); |
||
| 281 | } |
||
| 282 | $item = $handlers->h_oledrion_lists->get($list_id); |
||
|
0 ignored issues
–
show
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 <?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 | Oledrion_utils::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5); |
||
| 285 | } |
||
| 286 | if ($handlers->h_oledrion_lists->deleteList($item)) { |
||
|
0 ignored issues
–
show
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 <?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 | Oledrion_utils::updateCache(); |
||
| 288 | Oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl, 2); |
||
| 289 | } else { |
||
| 290 | Oledrion_utils::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
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 <?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 | Oledrion_utils::redirect(_OLEDRION_ERROR25, $baseurl, 8); |
||
| 302 | } |
||
| 303 | $edit = true; |
||
| 304 | $item = $handlers->h_oledrion_lists->get($list_id); |
||
|
0 ignored issues
–
show
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 <?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 | Oledrion_utils::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
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 <?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 | Oledrion_utils::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
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 <?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
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 <?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
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 <?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
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 <?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() |
||
| 344 | ) { // On peut ajouter le produit à cette nouvelle liste |
||
| 345 | $res = $handlers->h_oledrion_products_list->addProductToUserList($item->getVar('list_id'), $product_id); |
||
|
0 ignored issues
–
show
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 <?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...
|
|||
| 346 | if ($res) { // Mise à jour du nombre de produits de la liste |
||
| 347 | $handlers->h_oledrion_lists->incrementListProductsCount($item); |
||
|
0 ignored issues
–
show
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 <?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...
|
|||
| 348 | Oledrion_utils::updateCache(); |
||
| 349 | Oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $product->getLink(), 2); |
||
| 350 | } |
||
| 351 | } |
||
| 352 | } |
||
| 353 | } |
||
| 354 | Oledrion_utils::updateCache(); |
||
| 355 | Oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl, 2); |
||
| 356 | } else { |
||
| 357 | Oledrion_utils::redirect(_AM_OLEDRION_SAVE_PB, $baseurl, 5); |
||
| 358 | } |
||
| 359 | break; |
||
| 360 | |||
| 361 | // ************************************************************************ |
||
| 362 | case 'edit': // Edition d'une liste *************************************** |
||
| 363 | case 'addList': // Ajout d'une liste ************************************** |
||
| 364 | // ************************************************************************ |
||
| 365 | $xoopsTpl->assign('op', $op); |
||
| 366 | $sform = listForm($op, 0); |
||
| 367 | if ($op === 'edit') { |
||
| 368 | $title = _OLEDRION_EDIT_LIST; |
||
| 369 | } else { |
||
| 370 | $title = _OLEDRION_ADD_LIST; |
||
| 371 | } |
||
| 372 | $breadcrumb = array( |
||
| 373 | OLEDRION_URL . 'all-lists.php' => _MI_OLEDRION_SMNAME11, |
||
| 374 | OLEDRION_URL . basename(__FILE__) => _MI_OLEDRION_SMNAME10, |
||
| 375 | OLEDRION_URL => $title |
||
| 376 | ); |
||
| 377 | |||
| 378 | $xoopsTpl->assign('form', $sform->render()); |
||
| 379 | break; |
||
| 380 | } |
||
| 381 | |||
| 382 | Oledrion_utils::setCSS(); |
||
| 383 | Oledrion_utils::setLocalCSS($xoopsConfig['language']); |
||
| 384 | |||
| 385 | $xoopsTpl->assign('mod_pref', $mod_pref); |
||
| 386 | $xoopsTpl->assign('breadcrumb', Oledrion_utils::breadcrumb($breadcrumb)); |
||
|
0 ignored issues
–
show
It seems like
$breadcrumb defined by '' on line 46 can also be of type string; however, Oledrion_utils::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...
|
|||
| 387 | |||
| 388 | $title = _MI_OLEDRION_SMNAME10 . ' - ' . Oledrion_utils::getModuleName(); |
||
| 389 | Oledrion_utils::setMetas($title, $title); |
||
| 390 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||
| 391 |
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@propertyannotation to your class or interface to document the existence of this variable.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.