@@ -9,7 +9,7 @@ |
||
| 9 | 9 | |
| 10 | 10 | /** @var InstructionUtility $utilityClass */ |
| 11 | 11 | $utilityClass = ucfirst($moduleDirName) . 'Utility'; |
| 12 | -if (!class_exists($utilityClass)) { |
|
| 12 | +if ( ! class_exists($utilityClass)) { |
|
| 13 | 13 | xoops_load('utility', $moduleDirName); |
| 14 | 14 | } |
| 15 | 15 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | // Подключаем трей |
| 33 | 33 | |
| 34 | - include_once __DIR__ . '/../class/tree.php'; |
|
| 34 | + include_once __DIR__ . '/../class/tree.php'; |
|
| 35 | 35 | //include_once $GLOBALS['xoops']->path('modules/instruction/class/tree.php'); |
| 36 | 36 | |
| 37 | 37 | // Заголовок админки |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | case 'savecat': |
| 103 | 103 | |
| 104 | 104 | // Проверка |
| 105 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 105 | + if ( ! $GLOBALS['xoopsSecurity']->check()) { |
|
| 106 | 106 | redirect_header('cat.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
| 107 | 107 | } |
| 108 | 108 | // Если мы редактируем |
@@ -128,12 +128,12 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | // Проверка веса |
| 130 | 130 | if (0 == $weight) { |
| 131 | - $err = true; |
|
| 131 | + $err = true; |
|
| 132 | 132 | $message_err .= _AM_INSTRUCTION_ERR_WEIGHT . '<br>'; |
| 133 | 133 | } |
| 134 | 134 | // Проверка категорий |
| 135 | 135 | if ($cid && ($cid == $pid)) { |
| 136 | - $err = true; |
|
| 136 | + $err = true; |
|
| 137 | 137 | $message_err .= _AM_INSTRUCTION_ERR_PCAT . '<br>'; |
| 138 | 138 | } |
| 139 | 139 | // Если были ошибки |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | $objInscat = $instructioncatHandler->get($cid); |
| 243 | 243 | // Если нет такой категории |
| 244 | - if (!is_object($objInscat)) { |
|
| 244 | + if ( ! is_object($objInscat)) { |
|
| 245 | 245 | redirect_header('cat.php', 3, _AM_INSTRUCTION_ERR_CATNOTSELECT); |
| 246 | 246 | } |
| 247 | 247 | |
@@ -257,12 +257,12 @@ discard block |
||
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | // Нажали ли мы на кнопку OK |
| 260 | - $ok = isset($_POST['ok']) ? (int)$_POST['ok'] : 0; |
|
| 260 | + $ok = isset($_POST['ok']) ? (int) $_POST['ok'] : 0; |
|
| 261 | 261 | // Если мы нажали на кнопку |
| 262 | 262 | if ($ok) { |
| 263 | 263 | |
| 264 | 264 | // Проверка |
| 265 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 265 | + if ( ! $GLOBALS['xoopsSecurity']->check()) { |
|
| 266 | 266 | redirect_header('cat.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
| 267 | 267 | } |
| 268 | 268 | // Пытаемся удалить категорию |
@@ -5,13 +5,13 @@ |
||
| 5 | 5 | //global $xoopsUser; |
| 6 | 6 | static $permissions = []; |
| 7 | 7 | // Если есть в статике |
| 8 | - if(is_array($permissions) && array_key_exists($permtype, $permissions)) {
|
|
| 8 | + if (is_array($permissions) && array_key_exists($permtype, $permissions)) {
|
|
| 9 | 9 | return $permissions[$permtype]; |
| 10 | 10 | } |
| 11 | 11 | // Находим из базы |
| 12 | 12 | $module_handler = xoops_gethandler('module');
|
| 13 | 13 | $instrModule = $module_handler->getByDirname('instruction');
|
| 14 | - $groups = is_object( $GLOBALS['xoopsUser'] ) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
| 14 | + $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
| 15 | 15 | $gperm_handler = xoops_gethandler('groupperm');
|
| 16 | 16 | $categories = $gperm_handler->getItemIds($permtype, $groups, $instrModule->getVar('mid'));
|
| 17 | 17 | $permissions[$permtype] = $categories; |
@@ -14,17 +14,17 @@ discard block |
||
| 14 | 14 | $time = time(); |
| 15 | 15 | |
| 16 | 16 | // ID инструкции |
| 17 | -$instrid = isset($_GET['instrid']) ? (int)$_GET['instrid'] : 0; |
|
| 18 | -$instrid = isset($_POST['instrid']) ? (int)$_POST['instrid'] : $instrid; |
|
| 17 | +$instrid = isset($_GET['instrid']) ? (int) $_GET['instrid'] : 0; |
|
| 18 | +$instrid = isset($_POST['instrid']) ? (int) $_POST['instrid'] : $instrid; |
|
| 19 | 19 | // ID страницы |
| 20 | -$pageid = isset($_GET['pageid']) ? (int)$_GET['pageid'] : 0; |
|
| 21 | -$pageid = isset($_POST['pageid']) ? (int)$_POST['pageid'] : $pageid; |
|
| 20 | +$pageid = isset($_GET['pageid']) ? (int) $_GET['pageid'] : 0; |
|
| 21 | +$pageid = isset($_POST['pageid']) ? (int) $_POST['pageid'] : $pageid; |
|
| 22 | 22 | // ID категории |
| 23 | -$cid = isset($_POST['cid']) ? (int)$_POST['cid'] : 0; |
|
| 23 | +$cid = isset($_POST['cid']) ? (int) $_POST['cid'] : 0; |
|
| 24 | 24 | // Вес |
| 25 | -$weight = isset($_POST['weight']) ? (int)$_POST['weight'] : 0; |
|
| 25 | +$weight = isset($_POST['weight']) ? (int) $_POST['weight'] : 0; |
|
| 26 | 26 | // |
| 27 | -$pid = isset($_POST['pid']) ? (int)$_POST['pid'] : 0; |
|
| 27 | +$pid = isset($_POST['pid']) ? (int) $_POST['pid'] : 0; |
|
| 28 | 28 | |
| 29 | 29 | // Права на добавление |
| 30 | 30 | $cat_submit = InstructionUtility::getItemIds($moduleDirName . '_submit'); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | // Объект инструкции |
| 55 | 55 | $objInsinstr = $insinstrHandler->get($instrid); |
| 56 | 56 | // Можно ли редактировать инструкцию в данной категории |
| 57 | - if (!in_array($objInsinstr->getVar('cid'), $cat_edit)) { |
|
| 57 | + if ( ! in_array($objInsinstr->getVar('cid'), $cat_edit)) { |
|
| 58 | 58 | redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_EDITPAGE); |
| 59 | 59 | } |
| 60 | 60 | // Создание новой страницы |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | // Объект инструкции |
| 68 | 68 | $objInsinstr = $insinstrHandler->get($instrid); |
| 69 | 69 | // Можно ли добавлять инструкции в данной категории |
| 70 | - if (!in_array($objInsinstr->getVar('cid'), $cat_submit)) { |
|
| 70 | + if ( ! in_array($objInsinstr->getVar('cid'), $cat_submit)) { |
|
| 71 | 71 | redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_SUBMITPAGE); |
| 72 | 72 | } |
| 73 | 73 | } else { |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | case 'savepage': |
| 103 | 103 | |
| 104 | 104 | // Проверка |
| 105 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 105 | + if ( ! $GLOBALS['xoopsSecurity']->check()) { |
|
| 106 | 106 | redirect_header('index.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | // Объект инструкции |
| 116 | 116 | $objInsinstr = $insinstrHandler->get($objInspage->getVar('instrid')); |
| 117 | 117 | // Можно ли редактировать инструкцию в данной категории |
| 118 | - if (!in_array($objInsinstr->getVar('cid'), $cat_edit)) { |
|
| 118 | + if ( ! in_array($objInsinstr->getVar('cid'), $cat_edit)) { |
|
| 119 | 119 | redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_EDITPAGE); |
| 120 | 120 | } |
| 121 | 121 | } elseif ($instrid) { |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | // Объект инструкции |
| 124 | 124 | $objInsinstr = $insinstrHandler->get($instrid); |
| 125 | 125 | // Можно ли добавлять инструкции в данной категории |
| 126 | - if (!in_array($objInsinstr->getVar('cid'), $cat_submit)) { |
|
| 126 | + if ( ! in_array($objInsinstr->getVar('cid'), $cat_submit)) { |
|
| 127 | 127 | redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_SUBMITPAGE); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -152,18 +152,18 @@ discard block |
||
| 152 | 152 | $objInspage->setVar('description', $_POST['description']); |
| 153 | 153 | |
| 154 | 154 | // Проверка категорий |
| 155 | - if (!$pageid && !$instrid) { |
|
| 156 | - $err = true; |
|
| 155 | + if ( ! $pageid && ! $instrid) { |
|
| 156 | + $err = true; |
|
| 157 | 157 | $message_err .= _MD_INSTRUCTION_ERR_INSTR . '<br>'; |
| 158 | 158 | } |
| 159 | 159 | // Проверка веса |
| 160 | 160 | if (0 == $weight) { |
| 161 | - $err = true; |
|
| 161 | + $err = true; |
|
| 162 | 162 | $message_err .= _MD_INSTRUCTION_ERR_WEIGHT . '<br>'; |
| 163 | 163 | } |
| 164 | 164 | // Проверка родительской страницы |
| 165 | 165 | if ($pageid && ($pageid == $pid)) { |
| 166 | - $err = true; |
|
| 166 | + $err = true; |
|
| 167 | 167 | $message_err .= _MD_INSTRUCTION_ERR_PPAGE . '<br>'; |
| 168 | 168 | } |
| 169 | 169 | // Если были ошибки |