@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $moduleDirName = basename(dirname(__DIR__)); |
| 23 | 23 | $capsDirName = strtoupper($moduleDirName); |
| 24 | 24 | |
| 25 | -if (!defined($capsDirName . '_DIRNAME')) { |
|
| 25 | +if ( ! defined($capsDirName . '_DIRNAME')) { |
|
| 26 | 26 | //if (!defined(constant($capsDirName . '_DIRNAME'))) { |
| 27 | 27 | define($capsDirName . '_DIRNAME', $GLOBALS['xoopsModule']->dirname()); |
| 28 | 28 | define($capsDirName . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME')); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | //Configurator |
| 38 | -return (object)[ |
|
| 38 | +return (object) [ |
|
| 39 | 39 | 'name' => strtoupper($moduleDirName) . ' Module Configurator', |
| 40 | 40 | 'paths' => [ |
| 41 | 41 | 'dirname' => $moduleDirName, |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | |
| 10 | 10 | $sql = 'SELECT p.pageid, p.title, p.uid, p.datecreated, i.title FROM ' . $GLOBALS['xoopsDB']->prefix('instruction_page') . ' p, ' . $GLOBALS['xoopsDB']->prefix('instruction_instr') . ' i WHERE i.instrid = p.instrid AND i.status > 0 AND p.status > 0 AND p.type > 0'; |
| 11 | 11 | if (0 != $userid) { |
| 12 | - $sql .= ' AND p.uid = ' . (int)$userid . ' '; |
|
| 12 | + $sql .= ' AND p.uid = ' . (int) $userid . ' '; |
|
| 13 | 13 | //return NULL; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | class InstructionHandler extends \XoopsPersistableObjectHandler |
| 16 | 16 | { |
| 17 | 17 | /** |
| 18 | - * @param null|mixed $db |
|
| 18 | + * @param null|\XoopsDatabase $db |
|
| 19 | 19 | */ |
| 20 | 20 | public function __construct(\XoopsDatabase $db = null) |
| 21 | 21 | { |
@@ -32,9 +32,9 @@ |
||
| 32 | 32 | public function updateDateupdated($instrid = 0, $time = null) |
| 33 | 33 | { |
| 34 | 34 | // Если не передали время |
| 35 | - $time = null === $time ? time() : (int)$time; |
|
| 35 | + $time = null === $time ? time() : (int) $time; |
|
| 36 | 36 | // |
| 37 | - $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `instrid` = %u', $this->table, $time, (int)$instrid); |
|
| 37 | + $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `instrid` = %u', $this->table, $time, (int) $instrid); |
|
| 38 | 38 | // |
| 39 | 39 | return $this->db->query($sql); |
| 40 | 40 | } |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | // } |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | - * @param $key |
|
| 27 | - * @param $ret |
|
| 28 | - * @param $prefix_orig |
|
| 26 | + * @param integer $key |
|
| 27 | + * @param string $ret |
|
| 28 | + * @param string $prefix_orig |
|
| 29 | 29 | * @param $objInsinstr |
| 30 | 30 | * @param string $class |
| 31 | 31 | * @param string $prefix_curr |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | // ================================== |
| 141 | 141 | |
| 142 | 142 | /** |
| 143 | - * @param $key |
|
| 144 | - * @param $ret |
|
| 145 | - * @param $prefix_orig |
|
| 143 | + * @param integer $key |
|
| 144 | + * @param string $ret |
|
| 145 | + * @param string $prefix_orig |
|
| 146 | 146 | * @param array $cidinstrids |
| 147 | 147 | * @param string $class |
| 148 | 148 | * @param string $prefix_curr |
@@ -239,8 +239,8 @@ discard block |
||
| 239 | 239 | // ====================================== |
| 240 | 240 | |
| 241 | 241 | /** |
| 242 | - * @param $key |
|
| 243 | - * @param $ret |
|
| 242 | + * @param integer $key |
|
| 243 | + * @param string $ret |
|
| 244 | 244 | * @param int $currpageid |
| 245 | 245 | * @param array $lastpageids |
| 246 | 246 | * @param int $level |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | // Находим предыдущую и следующую страницы. |
| 351 | 351 | // Находим последнии страницы на каждом уровне. |
| 352 | 352 | /** |
| 353 | - * @param $key |
|
| 353 | + * @param integer $key |
|
| 354 | 354 | * @param int $currpageid |
| 355 | 355 | * @param array $prevpages |
| 356 | 356 | * @param array $nextpages |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $prefix_curr .= $prefix_orig; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
|
| 81 | + if (isset($this->tree[$key]['child']) && ! empty($this->tree[$key]['child'])) { |
|
| 82 | 82 | foreach ($this->tree[$key]['child'] as $childkey) { |
| 83 | 83 | $this->_makePagesAdminOptions($childkey, $ret, $prefix_orig, $objInsinstr, $class, $prefix_curr); |
| 84 | 84 | } |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $prefix_curr .= $prefix_orig; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
|
| 175 | + if (isset($this->tree[$key]['child']) && ! empty($this->tree[$key]['child'])) { |
|
| 176 | 176 | foreach ($this->tree[$key]['child'] as $childkey) { |
| 177 | 177 | $this->_makeCatsAdminOptions($childkey, $ret, $prefix_orig, $cidinstrids, $class, $prefix_curr); |
| 178 | 178 | } |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | // Рекурсия |
| 292 | - if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
|
| 292 | + if (isset($this->tree[$key]['child']) && ! empty($this->tree[$key]['child'])) { |
|
| 293 | 293 | foreach ($this->tree[$key]['child'] as $childkey) { |
| 294 | 294 | $this->_makePagesUserTree($childkey, $ret, $currpageid, $lastpageids, $level); |
| 295 | 295 | } |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | // Рекурсия |
| 353 | - if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
|
| 353 | + if (isset($this->tree[$key]['child']) && ! empty($this->tree[$key]['child'])) { |
|
| 354 | 354 | foreach ($this->tree[$key]['child'] as $childkey) { |
| 355 | 355 | $this->_makePagesUserCalc($childkey, $currpageid, $prevpages, $nextpages, $lastpageids, $level); |
| 356 | 356 | } |
@@ -46,8 +46,8 @@ |
||
| 46 | 46 | // Редактор |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * @param $caption |
|
| 50 | - * @param $name |
|
| 49 | + * @param string $caption |
|
| 50 | + * @param string $name |
|
| 51 | 51 | * @param string $value |
| 52 | 52 | * @return bool|\XoopsFormEditor |
| 53 | 53 | */ |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | break; |
| 65 | 65 | case 'int': |
| 66 | 66 | default: |
| 67 | - $ret = isset($global[$key]) ? (int)$global[$key] : (int)$default; |
|
| 67 | + $ret = isset($global[$key]) ? (int) $global[$key] : (int) $default; |
|
| 68 | 68 | break; |
| 69 | 69 | } |
| 70 | 70 | if (false === $ret) { |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | //$categoryHandler = xoops_getModuleHandler('category', 'instruction'); |
| 13 | 13 | //$pageHandler = xoops_getModuleHandler('page', 'instruction'); |
| 14 | 14 | |
| 15 | -$instrid = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
| 15 | +$instrid = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
| 16 | 16 | |
| 17 | 17 | // Существует ли такая инструкция |
| 18 | 18 | $criteria = new \CriteriaCompo(); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // Права на просмотр инструкции |
| 43 | 43 | $categories = Xoopsmodules\instruction\Utility::getItemIds(); |
| 44 | -if (!in_array($objInsinstr->getVar('cid'), $categories)) { |
|
| 44 | +if ( ! in_array($objInsinstr->getVar('cid'), $categories)) { |
|
| 45 | 45 | redirect_header(XOOPS_URL . '/modules/' . $moduleDirName . '/', 3, _NOPERM); |
| 46 | 46 | exit(); |
| 47 | 47 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | case 'savecat': |
| 101 | 101 | |
| 102 | 102 | // Проверка |
| 103 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 103 | + if ( ! $GLOBALS['xoopsSecurity']->check()) { |
|
| 104 | 104 | redirect_header('cat.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
| 105 | 105 | } |
| 106 | 106 | // Если мы редактируем |
@@ -126,12 +126,12 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | // Проверка веса |
| 128 | 128 | if (0 == $weight) { |
| 129 | - $err = true; |
|
| 129 | + $err = true; |
|
| 130 | 130 | $message_err .= _AM_INSTRUCTION_ERR_WEIGHT . '<br>'; |
| 131 | 131 | } |
| 132 | 132 | // Проверка категорий |
| 133 | 133 | if ($cid && ($cid == $pid)) { |
| 134 | - $err = true; |
|
| 134 | + $err = true; |
|
| 135 | 135 | $message_err .= _AM_INSTRUCTION_ERR_PCAT . '<br>'; |
| 136 | 136 | } |
| 137 | 137 | // Если были ошибки |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | $objInscat = $categoryHandler->get($cid); |
| 239 | 239 | // Если нет такой категории |
| 240 | - if (!is_object($objInscat)) { |
|
| 240 | + if ( ! is_object($objInscat)) { |
|
| 241 | 241 | redirect_header('cat.php', 3, _AM_INSTRUCTION_ERR_CATNOTSELECT); |
| 242 | 242 | } |
| 243 | 243 | |
@@ -253,12 +253,12 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | // Нажали ли мы на кнопку OK |
| 256 | - $ok = isset($_POST['ok']) ? (int)$_POST['ok'] : 0; |
|
| 256 | + $ok = isset($_POST['ok']) ? (int) $_POST['ok'] : 0; |
|
| 257 | 257 | // Если мы нажали на кнопку |
| 258 | 258 | if ($ok) { |
| 259 | 259 | |
| 260 | 260 | // Проверка |
| 261 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 261 | + if ( ! $GLOBALS['xoopsSecurity']->check()) { |
|
| 262 | 262 | redirect_header('cat.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
| 263 | 263 | } |
| 264 | 264 | // Пытаемся удалить категорию |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | // Получаем объект категории |
| 62 | 62 | $objInscat = $categoryHandler->get($cid); |
| 63 | 63 | // Если нет такой категории |
| 64 | - if (!is_object($objInscat)) { |
|
| 64 | + if ( ! is_object($objInscat)) { |
|
| 65 | 65 | redirect_header('cat.php', 3, _AM_INSTRUCTION_ERR_CATNOTSELECT); |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | case 'saveinstr': |
| 168 | 168 | |
| 169 | 169 | // Проверка |
| 170 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 170 | + if ( ! $GLOBALS['xoopsSecurity']->check()) { |
|
| 171 | 171 | redirect_header('instr.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
| 172 | 172 | } |
| 173 | 173 | // Если мы редактируем |
@@ -198,18 +198,18 @@ discard block |
||
| 198 | 198 | $objInsinstr->setVar('metadescription', $_POST['metadescription']); |
| 199 | 199 | |
| 200 | 200 | // Проверка категорий |
| 201 | - if (!$cid) { |
|
| 202 | - $err = true; |
|
| 201 | + if ( ! $cid) { |
|
| 202 | + $err = true; |
|
| 203 | 203 | $message_err .= _AM_INSTRUCTION_ERR_CAT . '<br>'; |
| 204 | 204 | } |
| 205 | 205 | // Проверка названия |
| 206 | - if (!$instr_title) { |
|
| 207 | - $err = true; |
|
| 206 | + if ( ! $instr_title) { |
|
| 207 | + $err = true; |
|
| 208 | 208 | $message_err .= _AM_INSTR_ERR_TITLE . '<br>'; |
| 209 | 209 | } |
| 210 | 210 | // Проверка основного текста |
| 211 | - if (!$instr_description) { |
|
| 212 | - $err = true; |
|
| 211 | + if ( ! $instr_description) { |
|
| 212 | + $err = true; |
|
| 213 | 213 | $message_err .= _AM_INSTR_ERR_DESCRIPTION . '<br>'; |
| 214 | 214 | } |
| 215 | 215 | |
@@ -309,12 +309,12 @@ discard block |
||
| 309 | 309 | $objInsinstr = $instructionHandler->get($instrid); |
| 310 | 310 | |
| 311 | 311 | // Нажали ли мы на кнопку OK |
| 312 | - $ok = isset($_POST['ok']) ? (int)$_POST['ok'] : 0; |
|
| 312 | + $ok = isset($_POST['ok']) ? (int) $_POST['ok'] : 0; |
|
| 313 | 313 | // |
| 314 | 314 | if ($ok) { |
| 315 | 315 | |
| 316 | 316 | // Проверка |
| 317 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 317 | + if ( ! $GLOBALS['xoopsSecurity']->check()) { |
|
| 318 | 318 | redirect_header('instr.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
| 319 | 319 | } |
| 320 | 320 | // Находим все страницы, пренадлежащие этой инструкции |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | $message_err = ''; |
| 402 | 402 | |
| 403 | 403 | // Проверка сессии |
| 404 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 404 | + if ( ! $GLOBALS['xoopsSecurity']->check()) { |
|
| 405 | 405 | $err = true; |
| 406 | 406 | $err_txt = implode(', ', $GLOBALS['xoopsSecurity']->getErrors()); |
| 407 | 407 | $message_err .= $err_txt . '<br>'; |
@@ -447,10 +447,10 @@ discard block |
||
| 447 | 447 | // Мета-теги ключевых слов |
| 448 | 448 | $objInspage->setVar('description', Xoopsmodules\instruction\Utility::cleanVars($_POST, 'description', '', 'string')); |
| 449 | 449 | // |
| 450 | - $dosmiley = (isset($_POST['dosmiley']) && (int)$_POST['dosmiley'] > 0) ? 1 : 0; |
|
| 451 | - $doxcode = (isset($_POST['doxcode']) && (int)$_POST['doxcode'] > 0) ? 1 : 0; |
|
| 452 | - $dobr = (isset($_POST['dobr']) && (int)$_POST['dobr'] > 0) ? 1 : 0; |
|
| 453 | - $dohtml = (isset($_POST['dohtml']) && (int)$_POST['dohtml'] > 0) ? 1 : 0; |
|
| 450 | + $dosmiley = (isset($_POST['dosmiley']) && (int) $_POST['dosmiley'] > 0) ? 1 : 0; |
|
| 451 | + $doxcode = (isset($_POST['doxcode']) && (int) $_POST['doxcode'] > 0) ? 1 : 0; |
|
| 452 | + $dobr = (isset($_POST['dobr']) && (int) $_POST['dobr'] > 0) ? 1 : 0; |
|
| 453 | + $dohtml = (isset($_POST['dohtml']) && (int) $_POST['dohtml'] > 0) ? 1 : 0; |
|
| 454 | 454 | //$doimage = ( isset( $_POST['doimage'] ) && intval( $_POST['doimage'] ) > 0 ) ? 1 : 0; |
| 455 | 455 | $objInspage->setVar('dohtml', $dohtml); |
| 456 | 456 | $objInspage->setVar('dosmiley', $dosmiley); |
@@ -459,28 +459,28 @@ discard block |
||
| 459 | 459 | $objInspage->setVar('dobr', $dobr); |
| 460 | 460 | |
| 461 | 461 | // |
| 462 | - if (!$pageid && !$instrid) { |
|
| 463 | - $err = true; |
|
| 462 | + if ( ! $pageid && ! $instrid) { |
|
| 463 | + $err = true; |
|
| 464 | 464 | $message_err .= _AM_INSTRUCTION_ERR_INSTR . '<br>'; |
| 465 | 465 | } |
| 466 | 466 | // Проверка веса |
| 467 | 467 | if (0 == $weight) { |
| 468 | - $err = true; |
|
| 468 | + $err = true; |
|
| 469 | 469 | $message_err .= _AM_INSTRUCTION_ERR_WEIGHT . '<br>'; |
| 470 | 470 | } |
| 471 | 471 | // Проверка родительской страницы |
| 472 | 472 | if ($pageid && ($pageid == $pid)) { |
| 473 | - $err = true; |
|
| 473 | + $err = true; |
|
| 474 | 474 | $message_err .= _AM_INSTRUCTION_ERR_PPAGE . '<br>'; |
| 475 | 475 | } |
| 476 | 476 | // Проверка названия |
| 477 | - if (!$page_title) { |
|
| 478 | - $err = true; |
|
| 477 | + if ( ! $page_title) { |
|
| 478 | + $err = true; |
|
| 479 | 479 | $message_err .= _AM_INSTR_ERR_TITLE . '<br>'; |
| 480 | 480 | } |
| 481 | 481 | // Проверка основного текста |
| 482 | - if (!$page_hometext) { |
|
| 483 | - $err = true; |
|
| 482 | + if ( ! $page_hometext) { |
|
| 483 | + $err = true; |
|
| 484 | 484 | $message_err .= _AM_INSTR_ERR_HOMETEXT . '<br>'; |
| 485 | 485 | } |
| 486 | 486 | |
@@ -543,12 +543,12 @@ discard block |
||
| 543 | 543 | |
| 544 | 544 | $objInspage = $pageHandler->get($pageid); |
| 545 | 545 | // Нажали ли мы на кнопку OK |
| 546 | - $ok = isset($_POST['ok']) ? (int)$_POST['ok'] : 0; |
|
| 546 | + $ok = isset($_POST['ok']) ? (int) $_POST['ok'] : 0; |
|
| 547 | 547 | // Если мы нажали на кнопку |
| 548 | 548 | if ($ok) { |
| 549 | 549 | |
| 550 | 550 | // Проверка |
| 551 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 551 | + if ( ! $GLOBALS['xoopsSecurity']->check()) { |
|
| 552 | 552 | redirect_header('instr.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
| 553 | 553 | } |
| 554 | 554 | // ID инструкции |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | //if (is_object($GLOBALS['xoopsUser'])) { |
| 14 | 14 | if ($GLOBALS['xoopsUser'] instanceof XoopsUser) { |
| 15 | - if (!$helper->isUserAdmin()) { |
|
| 15 | + if ( ! $helper->isUserAdmin()) { |
|
| 16 | 16 | $helper->redirect(XOOPS_URL . '/', 3, _NOPERM); |
| 17 | 17 | } |
| 18 | 18 | } else { |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | /** @var Xmf\Module\Admin $adminObject */ |
| 23 | 23 | $adminObject = \Xmf\Module\Admin::getInstance(); |
| 24 | 24 | |
| 25 | -if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) { |
|
| 25 | +if ( ! isset($GLOBALS['xoopsTpl']) || ! ($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) { |
|
| 26 | 26 | require_once $GLOBALS['xoops']->path('class/template.php'); |
| 27 | 27 | $xoopsTpl = new \XoopsTpl(); |
| 28 | 28 | } |