@@ -16,60 +16,60 @@ |
||
16 | 16 | */ |
17 | 17 | trait ServerStats |
18 | 18 | { |
19 | - /** |
|
20 | - * serverStats() |
|
21 | - * |
|
22 | - * @return string |
|
23 | - */ |
|
24 | - public static function getServerStats() |
|
25 | - { |
|
26 | - //mb $wfdownloads = WfdownloadsWfdownloads::getInstance(); |
|
27 | - $moduleDirName = basename(dirname(dirname(__DIR__))); |
|
28 | - $moduleDirNameUpper = strtoupper($moduleDirName); |
|
29 | - xoops_loadLanguage('common', $moduleDirName); |
|
30 | - $html = ''; |
|
31 | - // $sql = 'SELECT metavalue'; |
|
32 | - // $sql .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta'); |
|
33 | - // $sql .= " WHERE metakey='version' LIMIT 1"; |
|
34 | - // $query = $GLOBALS['xoopsDB']->query($sql); |
|
35 | - // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); |
|
36 | - $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n"; |
|
37 | - $html .= "<div style='padding: 8px;'>\n"; |
|
38 | - // $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n"; |
|
39 | - // $html .= "<br>\n"; |
|
40 | - // $html .= "<br>\n"; |
|
41 | - $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n"; |
|
42 | - $html .= "<ul>\n"; |
|
43 | - // |
|
44 | - $gdlib = function_exists('gd_info') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>'; |
|
45 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; |
|
46 | - if (function_exists('gd_info')) { |
|
47 | - if ($gdlib = true === gd_info()) { |
|
48 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>'; |
|
49 | - } |
|
50 | - } |
|
51 | - // |
|
52 | - // $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF'); |
|
53 | - // $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; |
|
54 | - // |
|
55 | - // $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>'; |
|
56 | - // $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; |
|
57 | - // |
|
58 | - $downloads = ini_get('file_uploads') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>'; |
|
59 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; |
|
60 | - // |
|
61 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . ini_get('upload_max_filesize') . "</span></b>\n"; |
|
62 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . ini_get('post_max_size') . "</span></b>\n"; |
|
63 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . ini_get('memory_limit') . "</span></b>\n"; |
|
64 | - $html .= "</ul>\n"; |
|
65 | - $html .= "<ul>\n"; |
|
66 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n"; |
|
67 | - $html .= "</ul>\n"; |
|
68 | - $html .= "<br>\n"; |
|
69 | - $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n"; |
|
70 | - $html .= '</div>'; |
|
71 | - $html .= '</fieldset><br>'; |
|
19 | + /** |
|
20 | + * serverStats() |
|
21 | + * |
|
22 | + * @return string |
|
23 | + */ |
|
24 | + public static function getServerStats() |
|
25 | + { |
|
26 | + //mb $wfdownloads = WfdownloadsWfdownloads::getInstance(); |
|
27 | + $moduleDirName = basename(dirname(dirname(__DIR__))); |
|
28 | + $moduleDirNameUpper = strtoupper($moduleDirName); |
|
29 | + xoops_loadLanguage('common', $moduleDirName); |
|
30 | + $html = ''; |
|
31 | + // $sql = 'SELECT metavalue'; |
|
32 | + // $sql .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta'); |
|
33 | + // $sql .= " WHERE metakey='version' LIMIT 1"; |
|
34 | + // $query = $GLOBALS['xoopsDB']->query($sql); |
|
35 | + // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); |
|
36 | + $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n"; |
|
37 | + $html .= "<div style='padding: 8px;'>\n"; |
|
38 | + // $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n"; |
|
39 | + // $html .= "<br>\n"; |
|
40 | + // $html .= "<br>\n"; |
|
41 | + $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n"; |
|
42 | + $html .= "<ul>\n"; |
|
43 | + // |
|
44 | + $gdlib = function_exists('gd_info') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>'; |
|
45 | + $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; |
|
46 | + if (function_exists('gd_info')) { |
|
47 | + if ($gdlib = true === gd_info()) { |
|
48 | + $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>'; |
|
49 | + } |
|
50 | + } |
|
51 | + // |
|
52 | + // $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF'); |
|
53 | + // $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; |
|
54 | + // |
|
55 | + // $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>'; |
|
56 | + // $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; |
|
57 | + // |
|
58 | + $downloads = ini_get('file_uploads') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>'; |
|
59 | + $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; |
|
60 | + // |
|
61 | + $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . ini_get('upload_max_filesize') . "</span></b>\n"; |
|
62 | + $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . ini_get('post_max_size') . "</span></b>\n"; |
|
63 | + $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . ini_get('memory_limit') . "</span></b>\n"; |
|
64 | + $html .= "</ul>\n"; |
|
65 | + $html .= "<ul>\n"; |
|
66 | + $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n"; |
|
67 | + $html .= "</ul>\n"; |
|
68 | + $html .= "<br>\n"; |
|
69 | + $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n"; |
|
70 | + $html .= '</div>'; |
|
71 | + $html .= '</fieldset><br>'; |
|
72 | 72 | |
73 | - return $html; |
|
74 | - } |
|
73 | + return $html; |
|
74 | + } |
|
75 | 75 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $html .= "<ul>\n"; |
43 | 43 | // |
44 | 44 | $gdlib = function_exists('gd_info') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>'; |
45 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; |
|
45 | + $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; |
|
46 | 46 | if (function_exists('gd_info')) { |
47 | 47 | if ($gdlib = true === gd_info()) { |
48 | 48 | $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>'; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | // $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; |
57 | 57 | // |
58 | 58 | $downloads = ini_get('file_uploads') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>'; |
59 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; |
|
59 | + $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; |
|
60 | 60 | // |
61 | 61 | $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . ini_get('upload_max_filesize') . "</span></b>\n"; |
62 | 62 | $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . ini_get('post_max_size') . "</span></b>\n"; |
@@ -16,77 +16,77 @@ |
||
16 | 16 | */ |
17 | 17 | trait VersionChecks |
18 | 18 | { |
19 | - /** |
|
20 | - * |
|
21 | - * Verifies XOOPS version meets minimum requirements for this module |
|
22 | - * @static |
|
23 | - * @param XoopsModule $module |
|
24 | - * |
|
25 | - * @param null|string $requiredVer |
|
26 | - * @return bool true if meets requirements, false if not |
|
27 | - */ |
|
28 | - public static function checkVerXoops(XoopsModule $module = null, $requiredVer = null) |
|
29 | - { |
|
30 | - $moduleDirName = basename(dirname(__DIR__)); |
|
31 | - if (null === $module) { |
|
32 | - $module = XoopsModule::getByDirname($moduleDirName); |
|
33 | - } |
|
34 | - xoops_loadLanguage('admin', $moduleDirName); |
|
35 | - //check for minimum XOOPS version |
|
36 | - $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string |
|
37 | - $currArray = explode('.', $currentVer); |
|
38 | - if (null === $requiredVer) { |
|
39 | - $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string |
|
40 | - } |
|
41 | - $reqArray = explode('.', $requiredVer); |
|
42 | - $success = true; |
|
43 | - foreach ($reqArray as $k => $v) { |
|
44 | - if (isset($currArray[$k])) { |
|
45 | - if ($currArray[$k] > $v) { |
|
46 | - break; |
|
47 | - } elseif ($currArray[$k] == $v) { |
|
48 | - continue; |
|
49 | - } else { |
|
50 | - $success = false; |
|
51 | - break; |
|
52 | - } |
|
53 | - } else { |
|
54 | - if ((int)$v > 0) { // handles versions like x.x.x.0_RC2 |
|
55 | - $success = false; |
|
56 | - break; |
|
57 | - } |
|
58 | - } |
|
59 | - } |
|
19 | + /** |
|
20 | + * |
|
21 | + * Verifies XOOPS version meets minimum requirements for this module |
|
22 | + * @static |
|
23 | + * @param XoopsModule $module |
|
24 | + * |
|
25 | + * @param null|string $requiredVer |
|
26 | + * @return bool true if meets requirements, false if not |
|
27 | + */ |
|
28 | + public static function checkVerXoops(XoopsModule $module = null, $requiredVer = null) |
|
29 | + { |
|
30 | + $moduleDirName = basename(dirname(__DIR__)); |
|
31 | + if (null === $module) { |
|
32 | + $module = XoopsModule::getByDirname($moduleDirName); |
|
33 | + } |
|
34 | + xoops_loadLanguage('admin', $moduleDirName); |
|
35 | + //check for minimum XOOPS version |
|
36 | + $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string |
|
37 | + $currArray = explode('.', $currentVer); |
|
38 | + if (null === $requiredVer) { |
|
39 | + $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string |
|
40 | + } |
|
41 | + $reqArray = explode('.', $requiredVer); |
|
42 | + $success = true; |
|
43 | + foreach ($reqArray as $k => $v) { |
|
44 | + if (isset($currArray[$k])) { |
|
45 | + if ($currArray[$k] > $v) { |
|
46 | + break; |
|
47 | + } elseif ($currArray[$k] == $v) { |
|
48 | + continue; |
|
49 | + } else { |
|
50 | + $success = false; |
|
51 | + break; |
|
52 | + } |
|
53 | + } else { |
|
54 | + if ((int)$v > 0) { // handles versions like x.x.x.0_RC2 |
|
55 | + $success = false; |
|
56 | + break; |
|
57 | + } |
|
58 | + } |
|
59 | + } |
|
60 | 60 | |
61 | - if (false === $success) { |
|
62 | - $module->setErrors(sprintf(_AM_WFL_ERROR_BAD_XOOPS, $requiredVer, $currentVer)); |
|
63 | - } |
|
61 | + if (false === $success) { |
|
62 | + $module->setErrors(sprintf(_AM_WFL_ERROR_BAD_XOOPS, $requiredVer, $currentVer)); |
|
63 | + } |
|
64 | 64 | |
65 | - return $success; |
|
66 | - } |
|
65 | + return $success; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * |
|
70 | - * Verifies PHP version meets minimum requirements for this module |
|
71 | - * @static |
|
72 | - * @param XoopsModule $module |
|
73 | - * |
|
74 | - * @return bool true if meets requirements, false if not |
|
75 | - */ |
|
76 | - public static function checkVerPhp(XoopsModule $module) |
|
77 | - { |
|
78 | - xoops_loadLanguage('admin', $module->dirname()); |
|
79 | - // check for minimum PHP version |
|
80 | - $success = true; |
|
81 | - $verNum = PHP_VERSION; |
|
82 | - $reqVer = $module->getInfo('min_php'); |
|
83 | - if (false !== $reqVer && '' !== $reqVer) { |
|
84 | - if (version_compare($verNum, $reqVer, '<')) { |
|
85 | - $module->setErrors(sprintf(_AM_WFL_ERROR_BAD_PHP, $reqVer, $verNum)); |
|
86 | - $success = false; |
|
87 | - } |
|
88 | - } |
|
68 | + /** |
|
69 | + * |
|
70 | + * Verifies PHP version meets minimum requirements for this module |
|
71 | + * @static |
|
72 | + * @param XoopsModule $module |
|
73 | + * |
|
74 | + * @return bool true if meets requirements, false if not |
|
75 | + */ |
|
76 | + public static function checkVerPhp(XoopsModule $module) |
|
77 | + { |
|
78 | + xoops_loadLanguage('admin', $module->dirname()); |
|
79 | + // check for minimum PHP version |
|
80 | + $success = true; |
|
81 | + $verNum = PHP_VERSION; |
|
82 | + $reqVer = $module->getInfo('min_php'); |
|
83 | + if (false !== $reqVer && '' !== $reqVer) { |
|
84 | + if (version_compare($verNum, $reqVer, '<')) { |
|
85 | + $module->setErrors(sprintf(_AM_WFL_ERROR_BAD_PHP, $reqVer, $verNum)); |
|
86 | + $success = false; |
|
87 | + } |
|
88 | + } |
|
89 | 89 | |
90 | - return $success; |
|
91 | - } |
|
90 | + return $success; |
|
91 | + } |
|
92 | 92 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | break; |
52 | 52 | } |
53 | 53 | } else { |
54 | - if ((int)$v > 0) { // handles versions like x.x.x.0_RC2 |
|
54 | + if ((int) $v > 0) { // handles versions like x.x.x.0_RC2 |
|
55 | 55 | $success = false; |
56 | 56 | break; |
57 | 57 | } |
@@ -32,48 +32,48 @@ |
||
32 | 32 | */ |
33 | 33 | class PedigreeBreadcrumb |
34 | 34 | { |
35 | - public $dirname; |
|
36 | - private $bread = []; |
|
35 | + public $dirname; |
|
36 | + private $bread = []; |
|
37 | 37 | |
38 | - /** |
|
39 | - * |
|
40 | - */ |
|
41 | - public function __construct() |
|
42 | - { |
|
43 | - $this->dirname = basename(dirname(__DIR__)); |
|
44 | - } |
|
38 | + /** |
|
39 | + * |
|
40 | + */ |
|
41 | + public function __construct() |
|
42 | + { |
|
43 | + $this->dirname = basename(dirname(__DIR__)); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Add link to breadcrumb |
|
48 | - * |
|
49 | - * @param string $title |
|
50 | - * @param string $link |
|
51 | - */ |
|
52 | - public function addLink($title = '', $link = '') |
|
53 | - { |
|
54 | - $this->bread[] = [ |
|
55 | - 'link' => $link, |
|
56 | - 'title' => $title |
|
57 | - ]; |
|
58 | - } |
|
46 | + /** |
|
47 | + * Add link to breadcrumb |
|
48 | + * |
|
49 | + * @param string $title |
|
50 | + * @param string $link |
|
51 | + */ |
|
52 | + public function addLink($title = '', $link = '') |
|
53 | + { |
|
54 | + $this->bread[] = [ |
|
55 | + 'link' => $link, |
|
56 | + 'title' => $title |
|
57 | + ]; |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * Render Pedigree BreadCrumb |
|
62 | - * |
|
63 | - */ |
|
64 | - public function render() |
|
65 | - { |
|
66 | - if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { |
|
67 | - require_once $GLOBALS['xoops']->path('class/theme.php'); |
|
68 | - $GLOBALS['xoTheme'] = new xos_opal_Theme(); |
|
69 | - } |
|
60 | + /** |
|
61 | + * Render Pedigree BreadCrumb |
|
62 | + * |
|
63 | + */ |
|
64 | + public function render() |
|
65 | + { |
|
66 | + if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { |
|
67 | + require_once $GLOBALS['xoops']->path('class/theme.php'); |
|
68 | + $GLOBALS['xoTheme'] = new xos_opal_Theme(); |
|
69 | + } |
|
70 | 70 | |
71 | - require_once $GLOBALS['xoops']->path('class/template.php'); |
|
72 | - $breadcrumbTpl = new XoopsTpl(); |
|
73 | - $breadcrumbTpl->assign('breadcrumb', $this->bread); |
|
74 | - $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); |
|
75 | - unset($breadcrumbTpl); |
|
71 | + require_once $GLOBALS['xoops']->path('class/template.php'); |
|
72 | + $breadcrumbTpl = new XoopsTpl(); |
|
73 | + $breadcrumbTpl->assign('breadcrumb', $this->bread); |
|
74 | + $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); |
|
75 | + unset($breadcrumbTpl); |
|
76 | 76 | |
77 | - return $html; |
|
78 | - } |
|
77 | + return $html; |
|
78 | + } |
|
79 | 79 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | */ |
64 | 64 | public function render() |
65 | 65 | { |
66 | - if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { |
|
66 | + if ( ! isset($GLOBALS['xoTheme']) || ! is_object($GLOBALS['xoTheme'])) { |
|
67 | 67 | require_once $GLOBALS['xoops']->path('class/theme.php'); |
68 | 68 | $GLOBALS['xoTheme'] = new xos_opal_Theme(); |
69 | 69 | } |
@@ -16,226 +16,226 @@ |
||
16 | 16 | */ |
17 | 17 | trait FilesManagement |
18 | 18 | { |
19 | - /** |
|
20 | - * Function responsible for checking if a directory exists, we can also write in and create an index.html file |
|
21 | - * |
|
22 | - * @param string $folder The full path of the directory to check |
|
23 | - * |
|
24 | - * @return void |
|
25 | - */ |
|
26 | - public static function createFolder($folder) |
|
27 | - { |
|
28 | - try { |
|
29 | - if (!file_exists($folder)) { |
|
30 | - if (!mkdir($folder) && !is_dir($folder)) { |
|
31 | - throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
|
32 | - } |
|
33 | - |
|
34 | - file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
|
35 | - } |
|
36 | - } catch (Exception $e) { |
|
37 | - echo 'Caught exception: ', $e->getMessage(), "\n", '<br>'; |
|
38 | - } |
|
39 | - } |
|
40 | - |
|
41 | - /** |
|
42 | - * @param $file |
|
43 | - * @param $folder |
|
44 | - * @return bool |
|
45 | - */ |
|
46 | - public static function copyFile($file, $folder) |
|
47 | - { |
|
48 | - return copy($file, $folder); |
|
49 | - } |
|
50 | - |
|
51 | - /** |
|
52 | - * @param $src |
|
53 | - * @param $dst |
|
54 | - */ |
|
55 | - public static function recurseCopy($src, $dst) |
|
56 | - { |
|
57 | - $dir = opendir($src); |
|
58 | - @mkdir($dst); |
|
59 | - while (false !== ($file = readdir($dir))) { |
|
60 | - if (('.' !== $file) && ('..' !== $file)) { |
|
61 | - if (is_dir($src . '/' . $file)) { |
|
62 | - self::recurseCopy($src . '/' . $file, $dst . '/' . $file); |
|
63 | - } else { |
|
64 | - copy($src . '/' . $file, $dst . '/' . $file); |
|
65 | - } |
|
66 | - } |
|
67 | - } |
|
68 | - closedir($dir); |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * |
|
73 | - * Remove files and (sub)directories |
|
74 | - * |
|
75 | - * @param string $src source directory to delete |
|
76 | - * |
|
77 | - * @uses \Xmf\Module\Helper::getHelper() |
|
78 | - * @uses \Xmf\Module\Helper::isUserAdmin() |
|
79 | - * |
|
80 | - * @return bool true on success |
|
81 | - */ |
|
82 | - public static function deleteDirectory($src) |
|
83 | - { |
|
84 | - // Only continue if user is a 'global' Admin |
|
85 | - if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
86 | - return false; |
|
87 | - } |
|
88 | - |
|
89 | - $success = true; |
|
90 | - // remove old files |
|
91 | - $dirInfo = new SplFileInfo($src); |
|
92 | - // validate is a directory |
|
93 | - if ($dirInfo->isDir()) { |
|
94 | - $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']); |
|
95 | - foreach ($fileList as $k => $v) { |
|
96 | - $fileInfo = new SplFileInfo("{$src}/{$v}"); |
|
97 | - if ($fileInfo->isDir()) { |
|
98 | - // recursively handle subdirectories |
|
99 | - if (!$success = self::deleteDirectory($fileInfo->getRealPath())) { |
|
100 | - break; |
|
101 | - } |
|
102 | - } else { |
|
103 | - // delete the file |
|
104 | - if (!($success = unlink($fileInfo->getRealPath()))) { |
|
105 | - break; |
|
106 | - } |
|
107 | - } |
|
108 | - } |
|
109 | - // now delete this (sub)directory if all the files are gone |
|
110 | - if ($success) { |
|
111 | - $success = rmdir($dirInfo->getRealPath()); |
|
112 | - } |
|
113 | - } else { |
|
114 | - // input is not a valid directory |
|
115 | - $success = false; |
|
116 | - } |
|
117 | - return $success; |
|
118 | - } |
|
119 | - |
|
120 | - /** |
|
121 | - * |
|
122 | - * Recursively remove directory |
|
123 | - * |
|
124 | - * @todo currently won't remove directories with hidden files, should it? |
|
125 | - * |
|
126 | - * @param string $src directory to remove (delete) |
|
127 | - * |
|
128 | - * @return bool true on success |
|
129 | - */ |
|
130 | - public static function rrmdir($src) |
|
131 | - { |
|
132 | - // Only continue if user is a 'global' Admin |
|
133 | - if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
134 | - return false; |
|
135 | - } |
|
136 | - |
|
137 | - // If source is not a directory stop processing |
|
138 | - if (!is_dir($src)) { |
|
139 | - return false; |
|
140 | - } |
|
141 | - |
|
142 | - $success = true; |
|
143 | - |
|
144 | - // Open the source directory to read in files |
|
145 | - $iterator = new DirectoryIterator($src); |
|
146 | - foreach ($iterator as $fObj) { |
|
147 | - if ($fObj->isFile()) { |
|
148 | - $filename = $fObj->getPathname(); |
|
149 | - $fObj = null; // clear this iterator object to close the file |
|
150 | - if (!unlink($filename)) { |
|
151 | - return false; // couldn't delete the file |
|
152 | - } |
|
153 | - } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
154 | - // Try recursively on directory |
|
155 | - self::rrmdir($fObj->getPathname()); |
|
156 | - } |
|
157 | - } |
|
158 | - $iterator = null; // clear iterator Obj to close file/directory |
|
159 | - return rmdir($src); // remove the directory & return results |
|
160 | - } |
|
161 | - |
|
162 | - /** |
|
163 | - * Recursively move files from one directory to another |
|
164 | - * |
|
165 | - * @param string $src - Source of files being moved |
|
166 | - * @param string $dest - Destination of files being moved |
|
167 | - * |
|
168 | - * @return bool true on success |
|
169 | - */ |
|
170 | - public static function rmove($src, $dest) |
|
171 | - { |
|
172 | - // Only continue if user is a 'global' Admin |
|
173 | - if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
174 | - return false; |
|
175 | - } |
|
176 | - |
|
177 | - // If source is not a directory stop processing |
|
178 | - if (!is_dir($src)) { |
|
179 | - return false; |
|
180 | - } |
|
181 | - |
|
182 | - // If the destination directory does not exist and could not be created stop processing |
|
183 | - if (!is_dir($dest) && !mkdir($dest, 0755)) { |
|
184 | - return false; |
|
185 | - } |
|
186 | - |
|
187 | - // Open the source directory to read in files |
|
188 | - $iterator = new DirectoryIterator($src); |
|
189 | - foreach ($iterator as $fObj) { |
|
190 | - if ($fObj->isFile()) { |
|
191 | - rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
192 | - } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
193 | - // Try recursively on directory |
|
194 | - self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
195 | - // rmdir($fObj->getPath()); // now delete the directory |
|
196 | - } |
|
197 | - } |
|
198 | - $iterator = null; // clear iterator Obj to close file/directory |
|
199 | - return rmdir($src); // remove the directory & return results |
|
200 | - } |
|
201 | - |
|
202 | - /** |
|
203 | - * Recursively copy directories and files from one directory to another |
|
204 | - * |
|
205 | - * @param string $src - Source of files being moved |
|
206 | - * @param string $dest - Destination of files being moved |
|
207 | - * |
|
208 | - * @uses \Xmf\Module\Helper::getHelper() |
|
209 | - * @uses \Xmf\Module\Helper::isUserAdmin() |
|
210 | - * |
|
211 | - * @return bool true on success |
|
212 | - */ |
|
213 | - public static function rcopy($src, $dest) |
|
214 | - { |
|
215 | - // Only continue if user is a 'global' Admin |
|
216 | - if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
217 | - return false; |
|
218 | - } |
|
219 | - |
|
220 | - // If source is not a directory stop processing |
|
221 | - if (!is_dir($src)) { |
|
222 | - return false; |
|
223 | - } |
|
224 | - |
|
225 | - // If the destination directory does not exist and could not be created stop processing |
|
226 | - if (!is_dir($dest) && !mkdir($dest, 0755)) { |
|
227 | - return false; |
|
228 | - } |
|
229 | - |
|
230 | - // Open the source directory to read in files |
|
231 | - $iterator = new DirectoryIterator($src); |
|
232 | - foreach ($iterator as $fObj) { |
|
233 | - if ($fObj->isFile()) { |
|
234 | - copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
235 | - } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
236 | - self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
237 | - } |
|
238 | - } |
|
239 | - return true; |
|
240 | - } |
|
19 | + /** |
|
20 | + * Function responsible for checking if a directory exists, we can also write in and create an index.html file |
|
21 | + * |
|
22 | + * @param string $folder The full path of the directory to check |
|
23 | + * |
|
24 | + * @return void |
|
25 | + */ |
|
26 | + public static function createFolder($folder) |
|
27 | + { |
|
28 | + try { |
|
29 | + if (!file_exists($folder)) { |
|
30 | + if (!mkdir($folder) && !is_dir($folder)) { |
|
31 | + throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
|
32 | + } |
|
33 | + |
|
34 | + file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
|
35 | + } |
|
36 | + } catch (Exception $e) { |
|
37 | + echo 'Caught exception: ', $e->getMessage(), "\n", '<br>'; |
|
38 | + } |
|
39 | + } |
|
40 | + |
|
41 | + /** |
|
42 | + * @param $file |
|
43 | + * @param $folder |
|
44 | + * @return bool |
|
45 | + */ |
|
46 | + public static function copyFile($file, $folder) |
|
47 | + { |
|
48 | + return copy($file, $folder); |
|
49 | + } |
|
50 | + |
|
51 | + /** |
|
52 | + * @param $src |
|
53 | + * @param $dst |
|
54 | + */ |
|
55 | + public static function recurseCopy($src, $dst) |
|
56 | + { |
|
57 | + $dir = opendir($src); |
|
58 | + @mkdir($dst); |
|
59 | + while (false !== ($file = readdir($dir))) { |
|
60 | + if (('.' !== $file) && ('..' !== $file)) { |
|
61 | + if (is_dir($src . '/' . $file)) { |
|
62 | + self::recurseCopy($src . '/' . $file, $dst . '/' . $file); |
|
63 | + } else { |
|
64 | + copy($src . '/' . $file, $dst . '/' . $file); |
|
65 | + } |
|
66 | + } |
|
67 | + } |
|
68 | + closedir($dir); |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * |
|
73 | + * Remove files and (sub)directories |
|
74 | + * |
|
75 | + * @param string $src source directory to delete |
|
76 | + * |
|
77 | + * @uses \Xmf\Module\Helper::getHelper() |
|
78 | + * @uses \Xmf\Module\Helper::isUserAdmin() |
|
79 | + * |
|
80 | + * @return bool true on success |
|
81 | + */ |
|
82 | + public static function deleteDirectory($src) |
|
83 | + { |
|
84 | + // Only continue if user is a 'global' Admin |
|
85 | + if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
86 | + return false; |
|
87 | + } |
|
88 | + |
|
89 | + $success = true; |
|
90 | + // remove old files |
|
91 | + $dirInfo = new SplFileInfo($src); |
|
92 | + // validate is a directory |
|
93 | + if ($dirInfo->isDir()) { |
|
94 | + $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']); |
|
95 | + foreach ($fileList as $k => $v) { |
|
96 | + $fileInfo = new SplFileInfo("{$src}/{$v}"); |
|
97 | + if ($fileInfo->isDir()) { |
|
98 | + // recursively handle subdirectories |
|
99 | + if (!$success = self::deleteDirectory($fileInfo->getRealPath())) { |
|
100 | + break; |
|
101 | + } |
|
102 | + } else { |
|
103 | + // delete the file |
|
104 | + if (!($success = unlink($fileInfo->getRealPath()))) { |
|
105 | + break; |
|
106 | + } |
|
107 | + } |
|
108 | + } |
|
109 | + // now delete this (sub)directory if all the files are gone |
|
110 | + if ($success) { |
|
111 | + $success = rmdir($dirInfo->getRealPath()); |
|
112 | + } |
|
113 | + } else { |
|
114 | + // input is not a valid directory |
|
115 | + $success = false; |
|
116 | + } |
|
117 | + return $success; |
|
118 | + } |
|
119 | + |
|
120 | + /** |
|
121 | + * |
|
122 | + * Recursively remove directory |
|
123 | + * |
|
124 | + * @todo currently won't remove directories with hidden files, should it? |
|
125 | + * |
|
126 | + * @param string $src directory to remove (delete) |
|
127 | + * |
|
128 | + * @return bool true on success |
|
129 | + */ |
|
130 | + public static function rrmdir($src) |
|
131 | + { |
|
132 | + // Only continue if user is a 'global' Admin |
|
133 | + if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
134 | + return false; |
|
135 | + } |
|
136 | + |
|
137 | + // If source is not a directory stop processing |
|
138 | + if (!is_dir($src)) { |
|
139 | + return false; |
|
140 | + } |
|
141 | + |
|
142 | + $success = true; |
|
143 | + |
|
144 | + // Open the source directory to read in files |
|
145 | + $iterator = new DirectoryIterator($src); |
|
146 | + foreach ($iterator as $fObj) { |
|
147 | + if ($fObj->isFile()) { |
|
148 | + $filename = $fObj->getPathname(); |
|
149 | + $fObj = null; // clear this iterator object to close the file |
|
150 | + if (!unlink($filename)) { |
|
151 | + return false; // couldn't delete the file |
|
152 | + } |
|
153 | + } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
154 | + // Try recursively on directory |
|
155 | + self::rrmdir($fObj->getPathname()); |
|
156 | + } |
|
157 | + } |
|
158 | + $iterator = null; // clear iterator Obj to close file/directory |
|
159 | + return rmdir($src); // remove the directory & return results |
|
160 | + } |
|
161 | + |
|
162 | + /** |
|
163 | + * Recursively move files from one directory to another |
|
164 | + * |
|
165 | + * @param string $src - Source of files being moved |
|
166 | + * @param string $dest - Destination of files being moved |
|
167 | + * |
|
168 | + * @return bool true on success |
|
169 | + */ |
|
170 | + public static function rmove($src, $dest) |
|
171 | + { |
|
172 | + // Only continue if user is a 'global' Admin |
|
173 | + if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
174 | + return false; |
|
175 | + } |
|
176 | + |
|
177 | + // If source is not a directory stop processing |
|
178 | + if (!is_dir($src)) { |
|
179 | + return false; |
|
180 | + } |
|
181 | + |
|
182 | + // If the destination directory does not exist and could not be created stop processing |
|
183 | + if (!is_dir($dest) && !mkdir($dest, 0755)) { |
|
184 | + return false; |
|
185 | + } |
|
186 | + |
|
187 | + // Open the source directory to read in files |
|
188 | + $iterator = new DirectoryIterator($src); |
|
189 | + foreach ($iterator as $fObj) { |
|
190 | + if ($fObj->isFile()) { |
|
191 | + rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
192 | + } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
193 | + // Try recursively on directory |
|
194 | + self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
195 | + // rmdir($fObj->getPath()); // now delete the directory |
|
196 | + } |
|
197 | + } |
|
198 | + $iterator = null; // clear iterator Obj to close file/directory |
|
199 | + return rmdir($src); // remove the directory & return results |
|
200 | + } |
|
201 | + |
|
202 | + /** |
|
203 | + * Recursively copy directories and files from one directory to another |
|
204 | + * |
|
205 | + * @param string $src - Source of files being moved |
|
206 | + * @param string $dest - Destination of files being moved |
|
207 | + * |
|
208 | + * @uses \Xmf\Module\Helper::getHelper() |
|
209 | + * @uses \Xmf\Module\Helper::isUserAdmin() |
|
210 | + * |
|
211 | + * @return bool true on success |
|
212 | + */ |
|
213 | + public static function rcopy($src, $dest) |
|
214 | + { |
|
215 | + // Only continue if user is a 'global' Admin |
|
216 | + if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
217 | + return false; |
|
218 | + } |
|
219 | + |
|
220 | + // If source is not a directory stop processing |
|
221 | + if (!is_dir($src)) { |
|
222 | + return false; |
|
223 | + } |
|
224 | + |
|
225 | + // If the destination directory does not exist and could not be created stop processing |
|
226 | + if (!is_dir($dest) && !mkdir($dest, 0755)) { |
|
227 | + return false; |
|
228 | + } |
|
229 | + |
|
230 | + // Open the source directory to read in files |
|
231 | + $iterator = new DirectoryIterator($src); |
|
232 | + foreach ($iterator as $fObj) { |
|
233 | + if ($fObj->isFile()) { |
|
234 | + copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
235 | + } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
236 | + self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
237 | + } |
|
238 | + } |
|
239 | + return true; |
|
240 | + } |
|
241 | 241 | } |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | public static function createFolder($folder) |
27 | 27 | { |
28 | 28 | try { |
29 | - if (!file_exists($folder)) { |
|
30 | - if (!mkdir($folder) && !is_dir($folder)) { |
|
29 | + if ( ! file_exists($folder)) { |
|
30 | + if ( ! mkdir($folder) && ! is_dir($folder)) { |
|
31 | 31 | throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
32 | 32 | } |
33 | 33 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | public static function deleteDirectory($src) |
83 | 83 | { |
84 | 84 | // Only continue if user is a 'global' Admin |
85 | - if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
85 | + if ( ! ($GLOBALS['xoopsUser'] instanceof XoopsUser) || ! $GLOBALS['xoopsUser']->isAdmin()) { |
|
86 | 86 | return false; |
87 | 87 | } |
88 | 88 | |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | $fileInfo = new SplFileInfo("{$src}/{$v}"); |
97 | 97 | if ($fileInfo->isDir()) { |
98 | 98 | // recursively handle subdirectories |
99 | - if (!$success = self::deleteDirectory($fileInfo->getRealPath())) { |
|
99 | + if ( ! $success = self::deleteDirectory($fileInfo->getRealPath())) { |
|
100 | 100 | break; |
101 | 101 | } |
102 | 102 | } else { |
103 | 103 | // delete the file |
104 | - if (!($success = unlink($fileInfo->getRealPath()))) { |
|
104 | + if ( ! ($success = unlink($fileInfo->getRealPath()))) { |
|
105 | 105 | break; |
106 | 106 | } |
107 | 107 | } |
@@ -130,12 +130,12 @@ discard block |
||
130 | 130 | public static function rrmdir($src) |
131 | 131 | { |
132 | 132 | // Only continue if user is a 'global' Admin |
133 | - if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
133 | + if ( ! ($GLOBALS['xoopsUser'] instanceof XoopsUser) || ! $GLOBALS['xoopsUser']->isAdmin()) { |
|
134 | 134 | return false; |
135 | 135 | } |
136 | 136 | |
137 | 137 | // If source is not a directory stop processing |
138 | - if (!is_dir($src)) { |
|
138 | + if ( ! is_dir($src)) { |
|
139 | 139 | return false; |
140 | 140 | } |
141 | 141 | |
@@ -147,15 +147,15 @@ discard block |
||
147 | 147 | if ($fObj->isFile()) { |
148 | 148 | $filename = $fObj->getPathname(); |
149 | 149 | $fObj = null; // clear this iterator object to close the file |
150 | - if (!unlink($filename)) { |
|
150 | + if ( ! unlink($filename)) { |
|
151 | 151 | return false; // couldn't delete the file |
152 | 152 | } |
153 | - } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
153 | + } elseif ( ! $fObj->isDot() && $fObj->isDir()) { |
|
154 | 154 | // Try recursively on directory |
155 | 155 | self::rrmdir($fObj->getPathname()); |
156 | 156 | } |
157 | 157 | } |
158 | - $iterator = null; // clear iterator Obj to close file/directory |
|
158 | + $iterator = null; // clear iterator Obj to close file/directory |
|
159 | 159 | return rmdir($src); // remove the directory & return results |
160 | 160 | } |
161 | 161 | |
@@ -170,17 +170,17 @@ discard block |
||
170 | 170 | public static function rmove($src, $dest) |
171 | 171 | { |
172 | 172 | // Only continue if user is a 'global' Admin |
173 | - if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
173 | + if ( ! ($GLOBALS['xoopsUser'] instanceof XoopsUser) || ! $GLOBALS['xoopsUser']->isAdmin()) { |
|
174 | 174 | return false; |
175 | 175 | } |
176 | 176 | |
177 | 177 | // If source is not a directory stop processing |
178 | - if (!is_dir($src)) { |
|
178 | + if ( ! is_dir($src)) { |
|
179 | 179 | return false; |
180 | 180 | } |
181 | 181 | |
182 | 182 | // If the destination directory does not exist and could not be created stop processing |
183 | - if (!is_dir($dest) && !mkdir($dest, 0755)) { |
|
183 | + if ( ! is_dir($dest) && ! mkdir($dest, 0755)) { |
|
184 | 184 | return false; |
185 | 185 | } |
186 | 186 | |
@@ -189,13 +189,13 @@ discard block |
||
189 | 189 | foreach ($iterator as $fObj) { |
190 | 190 | if ($fObj->isFile()) { |
191 | 191 | rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
192 | - } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
192 | + } elseif ( ! $fObj->isDot() && $fObj->isDir()) { |
|
193 | 193 | // Try recursively on directory |
194 | 194 | self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
195 | 195 | // rmdir($fObj->getPath()); // now delete the directory |
196 | 196 | } |
197 | 197 | } |
198 | - $iterator = null; // clear iterator Obj to close file/directory |
|
198 | + $iterator = null; // clear iterator Obj to close file/directory |
|
199 | 199 | return rmdir($src); // remove the directory & return results |
200 | 200 | } |
201 | 201 | |
@@ -213,17 +213,17 @@ discard block |
||
213 | 213 | public static function rcopy($src, $dest) |
214 | 214 | { |
215 | 215 | // Only continue if user is a 'global' Admin |
216 | - if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
216 | + if ( ! ($GLOBALS['xoopsUser'] instanceof XoopsUser) || ! $GLOBALS['xoopsUser']->isAdmin()) { |
|
217 | 217 | return false; |
218 | 218 | } |
219 | 219 | |
220 | 220 | // If source is not a directory stop processing |
221 | - if (!is_dir($src)) { |
|
221 | + if ( ! is_dir($src)) { |
|
222 | 222 | return false; |
223 | 223 | } |
224 | 224 | |
225 | 225 | // If the destination directory does not exist and could not be created stop processing |
226 | - if (!is_dir($dest) && !mkdir($dest, 0755)) { |
|
226 | + if ( ! is_dir($dest) && ! mkdir($dest, 0755)) { |
|
227 | 227 | return false; |
228 | 228 | } |
229 | 229 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | foreach ($iterator as $fObj) { |
233 | 233 | if ($fObj->isFile()) { |
234 | 234 | copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
235 | - } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
235 | + } elseif ( ! $fObj->isDot() && $fObj->isDir()) { |
|
236 | 236 | self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
237 | 237 | } |
238 | 238 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'metadescription', 50, 255, $this->getVar('metadescription')), false); |
97 | 97 | |
98 | 98 | // Если мы редактируем категорию |
99 | - if (!$this->isNew()) { |
|
99 | + if ( ! $this->isNew()) { |
|
100 | 100 | $form->addElement(new XoopsFormHidden('instrid', $this->getVar('instrid'))); |
101 | 101 | } |
102 | 102 | // |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | public function updateDateupdated($instrid = 0, $time = null) |
119 | 119 | { |
120 | 120 | // Если не передали время |
121 | - $time = null === $time ? time() : (int)$time; |
|
121 | + $time = null === $time ? time() : (int) $time; |
|
122 | 122 | // |
123 | - $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `instrid` = %u', $this->table, $time, (int)$instrid); |
|
123 | + $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `instrid` = %u', $this->table, $time, (int) $instrid); |
|
124 | 124 | // |
125 | 125 | return $this->db->query($sql); |
126 | 126 | } |
@@ -8,138 +8,138 @@ |
||
8 | 8 | |
9 | 9 | class InstructionInstruction extends XoopsObject |
10 | 10 | { |
11 | - // constructor |
|
12 | - public function __construct() |
|
13 | - { |
|
14 | - // $this->XoopsObject(); |
|
15 | - $this->initVar('instrid', XOBJ_DTYPE_INT, null, false, 11); |
|
16 | - $this->initVar('cid', XOBJ_DTYPE_INT, 0, false, 5); |
|
17 | - $this->initVar('uid', XOBJ_DTYPE_INT, 0, false, 11); |
|
18 | - $this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false); |
|
19 | - $this->initVar('status', XOBJ_DTYPE_INT, 0, false, 1); |
|
20 | - $this->initVar('pages', XOBJ_DTYPE_INT, 0, false, 11); |
|
21 | - $this->initVar('description', XOBJ_DTYPE_TXTAREA, null, false); |
|
22 | - $this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10); |
|
23 | - $this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10); |
|
24 | - $this->initVar('metakeywords', XOBJ_DTYPE_TXTBOX, '', false); |
|
25 | - $this->initVar('metadescription', XOBJ_DTYPE_TXTBOX, '', false); |
|
26 | - |
|
27 | - // Нет в таблице |
|
28 | - $this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false); |
|
29 | - $this->initVar('dobr', XOBJ_DTYPE_INT, 0, false); |
|
30 | - } |
|
31 | - |
|
32 | - public function InstructionInstruction() |
|
33 | - { |
|
34 | - $this->__construct(); |
|
35 | - } |
|
36 | - |
|
37 | - public function get_new_enreg() |
|
38 | - { |
|
39 | - $new_enreg = $GLOBALS['xoopsDB']->getInsertId(); |
|
40 | - return $new_enreg; |
|
41 | - } |
|
42 | - |
|
43 | - // Получаем форму |
|
44 | - public function getForm($action = false) |
|
45 | - { |
|
46 | - global $xoopsDB, $xoopsModule, $xoopsModuleConfig; |
|
47 | - // Если нет $action |
|
48 | - if (false === $action) { |
|
49 | - $action = xoops_getenv('REQUEST_URI'); |
|
50 | - } |
|
51 | - // Подключаем формы |
|
52 | - include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
|
53 | - |
|
54 | - // Название формы |
|
55 | - $title = $this->isNew() ? sprintf(_AM_INSTRUCTION_FORMADDINSTR) : sprintf(_AM_INSTRUCTION_FORMEDITINSTR); |
|
56 | - |
|
57 | - // Форма |
|
58 | - $form = new XoopsThemeForm($title, 'forminstr', $action, 'post', true); |
|
59 | - //$form->setExtra('enctype="multipart/form-data"'); |
|
60 | - // Название инструкции |
|
61 | - $form->addElement(new XoopsFormText(_AM_INSTRUCTION_TITLEC, 'title', 50, 255, $this->getVar('title')), true); |
|
62 | - // Категория |
|
63 | - $instructioncatHandler = xoops_getModuleHandler('category', 'instruction'); |
|
64 | - $criteria = new CriteriaCompo(); |
|
65 | - $criteria->setSort('weight ASC, title'); |
|
66 | - $criteria->setOrder('ASC'); |
|
67 | - $instructioncat_arr = $instructioncatHandler->getall($criteria); |
|
68 | - unset($criteria); |
|
69 | - // Подключаем трей |
|
70 | - include_once $GLOBALS['xoops']->path('class/tree.php'); |
|
71 | - $mytree = new XoopsObjectTree($instructioncat_arr, 'cid', 'pid'); |
|
72 | - $form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_CATC, $mytree->makeSelBox('cid', 'title', '--', $this->getVar('cid'), true))); |
|
73 | - // Описание |
|
74 | - $form->addElement(InstructionUtility::getWysiwygForm(_AM_INSTRUCTION_DESCRIPTIONC, 'description', $this->getVar('description', 'e')), true); |
|
75 | - // Статус |
|
76 | - $form->addElement(new XoopsFormRadioYN(_AM_INSTRUCTION_ACTIVEC, 'status', $this->getVar('status')), false); |
|
77 | - |
|
78 | - // Теги |
|
79 | - if (is_dir('../../tag') || is_dir('../tag')) { |
|
80 | - $dir_tag_ok = true; |
|
81 | - } else { |
|
82 | - $dir_tag_ok = false; |
|
83 | - } |
|
84 | - // Если влючена поддержка тегов и есть модуль tag |
|
85 | - if (xoops_getModuleOption('usetag', 'instruction') && $dir_tag_ok) { |
|
86 | - $itemIdForTag = $this->isNew() ? 0 : $this->getVar('instrid'); |
|
87 | - // Подключаем форму тегов |
|
88 | - include_once $GLOBALS['xoops']->path('modules/tag/include/formtag.php'); |
|
89 | - // Добавляем элемент в форму |
|
90 | - $form->addElement(new XoopsFormTag('tag', 60, 255, $itemIdForTag, 0)); |
|
91 | - } |
|
92 | - |
|
93 | - // Мета-теги ключевых слов |
|
94 | - $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'metakeywords', 50, 255, $this->getVar('metakeywords')), false); |
|
95 | - // Мета-теги описания |
|
96 | - $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'metadescription', 50, 255, $this->getVar('metadescription')), false); |
|
97 | - |
|
98 | - // Если мы редактируем категорию |
|
99 | - if (!$this->isNew()) { |
|
100 | - $form->addElement(new XoopsFormHidden('instrid', $this->getVar('instrid'))); |
|
101 | - } |
|
102 | - // |
|
103 | - $form->addElement(new XoopsFormHidden('op', 'saveinstr')); |
|
104 | - // Кнопка |
|
105 | - $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
106 | - return $form; |
|
107 | - } |
|
11 | + // constructor |
|
12 | + public function __construct() |
|
13 | + { |
|
14 | + // $this->XoopsObject(); |
|
15 | + $this->initVar('instrid', XOBJ_DTYPE_INT, null, false, 11); |
|
16 | + $this->initVar('cid', XOBJ_DTYPE_INT, 0, false, 5); |
|
17 | + $this->initVar('uid', XOBJ_DTYPE_INT, 0, false, 11); |
|
18 | + $this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false); |
|
19 | + $this->initVar('status', XOBJ_DTYPE_INT, 0, false, 1); |
|
20 | + $this->initVar('pages', XOBJ_DTYPE_INT, 0, false, 11); |
|
21 | + $this->initVar('description', XOBJ_DTYPE_TXTAREA, null, false); |
|
22 | + $this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10); |
|
23 | + $this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10); |
|
24 | + $this->initVar('metakeywords', XOBJ_DTYPE_TXTBOX, '', false); |
|
25 | + $this->initVar('metadescription', XOBJ_DTYPE_TXTBOX, '', false); |
|
26 | + |
|
27 | + // Нет в таблице |
|
28 | + $this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false); |
|
29 | + $this->initVar('dobr', XOBJ_DTYPE_INT, 0, false); |
|
30 | + } |
|
31 | + |
|
32 | + public function InstructionInstruction() |
|
33 | + { |
|
34 | + $this->__construct(); |
|
35 | + } |
|
36 | + |
|
37 | + public function get_new_enreg() |
|
38 | + { |
|
39 | + $new_enreg = $GLOBALS['xoopsDB']->getInsertId(); |
|
40 | + return $new_enreg; |
|
41 | + } |
|
42 | + |
|
43 | + // Получаем форму |
|
44 | + public function getForm($action = false) |
|
45 | + { |
|
46 | + global $xoopsDB, $xoopsModule, $xoopsModuleConfig; |
|
47 | + // Если нет $action |
|
48 | + if (false === $action) { |
|
49 | + $action = xoops_getenv('REQUEST_URI'); |
|
50 | + } |
|
51 | + // Подключаем формы |
|
52 | + include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
|
53 | + |
|
54 | + // Название формы |
|
55 | + $title = $this->isNew() ? sprintf(_AM_INSTRUCTION_FORMADDINSTR) : sprintf(_AM_INSTRUCTION_FORMEDITINSTR); |
|
56 | + |
|
57 | + // Форма |
|
58 | + $form = new XoopsThemeForm($title, 'forminstr', $action, 'post', true); |
|
59 | + //$form->setExtra('enctype="multipart/form-data"'); |
|
60 | + // Название инструкции |
|
61 | + $form->addElement(new XoopsFormText(_AM_INSTRUCTION_TITLEC, 'title', 50, 255, $this->getVar('title')), true); |
|
62 | + // Категория |
|
63 | + $instructioncatHandler = xoops_getModuleHandler('category', 'instruction'); |
|
64 | + $criteria = new CriteriaCompo(); |
|
65 | + $criteria->setSort('weight ASC, title'); |
|
66 | + $criteria->setOrder('ASC'); |
|
67 | + $instructioncat_arr = $instructioncatHandler->getall($criteria); |
|
68 | + unset($criteria); |
|
69 | + // Подключаем трей |
|
70 | + include_once $GLOBALS['xoops']->path('class/tree.php'); |
|
71 | + $mytree = new XoopsObjectTree($instructioncat_arr, 'cid', 'pid'); |
|
72 | + $form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_CATC, $mytree->makeSelBox('cid', 'title', '--', $this->getVar('cid'), true))); |
|
73 | + // Описание |
|
74 | + $form->addElement(InstructionUtility::getWysiwygForm(_AM_INSTRUCTION_DESCRIPTIONC, 'description', $this->getVar('description', 'e')), true); |
|
75 | + // Статус |
|
76 | + $form->addElement(new XoopsFormRadioYN(_AM_INSTRUCTION_ACTIVEC, 'status', $this->getVar('status')), false); |
|
77 | + |
|
78 | + // Теги |
|
79 | + if (is_dir('../../tag') || is_dir('../tag')) { |
|
80 | + $dir_tag_ok = true; |
|
81 | + } else { |
|
82 | + $dir_tag_ok = false; |
|
83 | + } |
|
84 | + // Если влючена поддержка тегов и есть модуль tag |
|
85 | + if (xoops_getModuleOption('usetag', 'instruction') && $dir_tag_ok) { |
|
86 | + $itemIdForTag = $this->isNew() ? 0 : $this->getVar('instrid'); |
|
87 | + // Подключаем форму тегов |
|
88 | + include_once $GLOBALS['xoops']->path('modules/tag/include/formtag.php'); |
|
89 | + // Добавляем элемент в форму |
|
90 | + $form->addElement(new XoopsFormTag('tag', 60, 255, $itemIdForTag, 0)); |
|
91 | + } |
|
92 | + |
|
93 | + // Мета-теги ключевых слов |
|
94 | + $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'metakeywords', 50, 255, $this->getVar('metakeywords')), false); |
|
95 | + // Мета-теги описания |
|
96 | + $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'metadescription', 50, 255, $this->getVar('metadescription')), false); |
|
97 | + |
|
98 | + // Если мы редактируем категорию |
|
99 | + if (!$this->isNew()) { |
|
100 | + $form->addElement(new XoopsFormHidden('instrid', $this->getVar('instrid'))); |
|
101 | + } |
|
102 | + // |
|
103 | + $form->addElement(new XoopsFormHidden('op', 'saveinstr')); |
|
104 | + // Кнопка |
|
105 | + $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
106 | + return $form; |
|
107 | + } |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | class InstructionInstructionHandler extends XoopsPersistableObjectHandler |
111 | 111 | { |
112 | - public function __construct($db) |
|
113 | - { |
|
114 | - parent::__construct($db, 'instruction_instr', 'InstructionInstruction', 'instrid', 'title'); |
|
115 | - } |
|
116 | - |
|
117 | - // Обновление даты обновления инструкций |
|
118 | - public function updateDateupdated($instrid = 0, $time = null) |
|
119 | - { |
|
120 | - // Если не передали время |
|
121 | - $time = null === $time ? time() : (int)$time; |
|
122 | - // |
|
123 | - $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `instrid` = %u', $this->table, $time, (int)$instrid); |
|
124 | - // |
|
125 | - return $this->db->query($sql); |
|
126 | - } |
|
127 | - |
|
128 | - // Обновление числа страниц |
|
129 | - public function updatePages($instrid = 0) |
|
130 | - { |
|
131 | - $inspageHandler = xoops_getModuleHandler('page', 'instruction'); |
|
132 | - // Находим число активных страниц |
|
133 | - $criteria = new CriteriaCompo(); |
|
134 | - $criteria->add(new Criteria('instrid', $instrid, '=')); |
|
135 | - $criteria->add(new Criteria('status ', '0', '>')); |
|
136 | - // Число страниц |
|
137 | - $pages = $inspageHandler->getCount($criteria); |
|
138 | - unset($criteria); |
|
139 | - |
|
140 | - // Сохраняем это число |
|
141 | - $sql = sprintf('UPDATE `%s` SET `pages` = %u, `dateupdated` = %u WHERE `instrid` = %u', $this->table, $pages, time(), $instrid); |
|
142 | - // |
|
143 | - return $this->db->query($sql); |
|
144 | - } |
|
112 | + public function __construct($db) |
|
113 | + { |
|
114 | + parent::__construct($db, 'instruction_instr', 'InstructionInstruction', 'instrid', 'title'); |
|
115 | + } |
|
116 | + |
|
117 | + // Обновление даты обновления инструкций |
|
118 | + public function updateDateupdated($instrid = 0, $time = null) |
|
119 | + { |
|
120 | + // Если не передали время |
|
121 | + $time = null === $time ? time() : (int)$time; |
|
122 | + // |
|
123 | + $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `instrid` = %u', $this->table, $time, (int)$instrid); |
|
124 | + // |
|
125 | + return $this->db->query($sql); |
|
126 | + } |
|
127 | + |
|
128 | + // Обновление числа страниц |
|
129 | + public function updatePages($instrid = 0) |
|
130 | + { |
|
131 | + $inspageHandler = xoops_getModuleHandler('page', 'instruction'); |
|
132 | + // Находим число активных страниц |
|
133 | + $criteria = new CriteriaCompo(); |
|
134 | + $criteria->add(new Criteria('instrid', $instrid, '=')); |
|
135 | + $criteria->add(new Criteria('status ', '0', '>')); |
|
136 | + // Число страниц |
|
137 | + $pages = $inspageHandler->getCount($criteria); |
|
138 | + unset($criteria); |
|
139 | + |
|
140 | + // Сохраняем это число |
|
141 | + $sql = sprintf('UPDATE `%s` SET `pages` = %u, `dateupdated` = %u WHERE `instrid` = %u', $this->table, $pages, time(), $instrid); |
|
142 | + // |
|
143 | + return $this->db->query($sql); |
|
144 | + } |
|
145 | 145 | } |
@@ -23,37 +23,37 @@ |
||
23 | 23 | */ |
24 | 24 | class Instruction extends \Xmf\Module\Helper |
25 | 25 | { |
26 | - public $debugArray = []; |
|
26 | + public $debugArray = []; |
|
27 | 27 | |
28 | - /** |
|
29 | - * @internal param $debug |
|
30 | - */ |
|
31 | - protected function __construct() |
|
32 | - { |
|
33 | - // $this->debug = $debug; |
|
34 | - $this->dirname = basename(dirname(__DIR__)); |
|
35 | - } |
|
28 | + /** |
|
29 | + * @internal param $debug |
|
30 | + */ |
|
31 | + protected function __construct() |
|
32 | + { |
|
33 | + // $this->debug = $debug; |
|
34 | + $this->dirname = basename(dirname(__DIR__)); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * @param bool $debug |
|
39 | - * |
|
40 | - * @return Newbb |
|
41 | - */ |
|
42 | - public static function getInstance($debug = false) |
|
43 | - { |
|
44 | - static $instance; |
|
45 | - if (null === $instance) { |
|
46 | - $instance = new static($debug); |
|
47 | - } |
|
37 | + /** |
|
38 | + * @param bool $debug |
|
39 | + * |
|
40 | + * @return Newbb |
|
41 | + */ |
|
42 | + public static function getInstance($debug = false) |
|
43 | + { |
|
44 | + static $instance; |
|
45 | + if (null === $instance) { |
|
46 | + $instance = new static($debug); |
|
47 | + } |
|
48 | 48 | |
49 | - return $instance; |
|
50 | - } |
|
49 | + return $instance; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * @return string |
|
54 | - */ |
|
55 | - public function getDirname() |
|
56 | - { |
|
57 | - return $this->dirname; |
|
58 | - } |
|
52 | + /** |
|
53 | + * @return string |
|
54 | + */ |
|
55 | + public function getDirname() |
|
56 | + { |
|
57 | + return $this->dirname; |
|
58 | + } |
|
59 | 59 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | // Находим все страницы данной инструкции |
74 | 74 | $criteria->add(new Criteria('instrid', $instrid_page, '=')); |
75 | 75 | // Если мы редактируем, то убрать текущую страницу из списка выбора родительской |
76 | - if (!$this->isNew()) { |
|
76 | + if ( ! $this->isNew()) { |
|
77 | 77 | $criteria->add(new Criteria('pageid', $this->getVar('pageid'), '<>')); |
78 | 78 | } |
79 | 79 | $criteria->setSort('weight'); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $form->addElement($option_tray); |
129 | 129 | |
130 | 130 | // Если мы редактируем страницу |
131 | - if (!$this->isNew()) { |
|
131 | + if ( ! $this->isNew()) { |
|
132 | 132 | $form->addElement(new XoopsFormHidden('pageid', $this->getVar('pageid'))); |
133 | 133 | } else { |
134 | 134 | $form->addElement(new XoopsFormHidden('pageid', 0)); |
@@ -8,208 +8,208 @@ |
||
8 | 8 | |
9 | 9 | class InstructionPage extends XoopsObject |
10 | 10 | { |
11 | - // constructor |
|
12 | - public function __construct() |
|
13 | - { |
|
14 | - // $this->XoopsObject(); |
|
15 | - $this->initVar('pageid', XOBJ_DTYPE_INT, null, false, 11); |
|
16 | - $this->initVar('pid', XOBJ_DTYPE_INT, 0, false, 11); |
|
17 | - $this->initVar('instrid', XOBJ_DTYPE_INT, 0, false, 11); |
|
18 | - $this->initVar('uid', XOBJ_DTYPE_INT, 0, false, 11); |
|
19 | - $this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false, 255); |
|
20 | - $this->initVar('status', XOBJ_DTYPE_INT, 1, false, 1); |
|
21 | - $this->initVar('type', XOBJ_DTYPE_INT, 1, false, 1); |
|
22 | - $this->initVar('hometext', XOBJ_DTYPE_TXTAREA, null, false); |
|
23 | - $this->initVar('footnote', XOBJ_DTYPE_TXTAREA, '', false); |
|
24 | - $this->initVar('weight', XOBJ_DTYPE_INT, 0, false, 11); |
|
25 | - $this->initVar('keywords', XOBJ_DTYPE_TXTBOX, '', false, 255); |
|
26 | - $this->initVar('description', XOBJ_DTYPE_TXTBOX, '', false, 255); |
|
27 | - $this->initVar('comments', XOBJ_DTYPE_INT, 0, false, 11); |
|
28 | - $this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10); |
|
29 | - $this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10); |
|
30 | - $this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false, 1); |
|
31 | - $this->initVar('dosmiley', XOBJ_DTYPE_INT, 0, false, 1); |
|
32 | - $this->initVar('doxcode', XOBJ_DTYPE_INT, 1, false, 1); |
|
33 | - $this->initVar('dobr', XOBJ_DTYPE_INT, 0, false, 1); |
|
34 | - } |
|
35 | - |
|
36 | - public function InstructionPage() |
|
37 | - { |
|
38 | - $this->__construct(); |
|
39 | - } |
|
40 | - |
|
41 | - public function get_new_enreg() |
|
42 | - { |
|
43 | - $new_enreg = $GLOBALS['xoopsDB']->getInsertId(); |
|
44 | - return $new_enreg; |
|
45 | - } |
|
46 | - |
|
47 | - // Получаем форму |
|
48 | - public function getForm($action = false, $instrid = 0) |
|
49 | - { |
|
50 | - // Если нет $action |
|
51 | - if (false === $action) { |
|
52 | - $action = xoops_getenv('REQUEST_URI'); |
|
53 | - } |
|
54 | - |
|
55 | - // Подключаем формы |
|
56 | - include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
|
57 | - // Подключаем типы страниц |
|
58 | - $pagetypes = include $GLOBALS['xoops']->path('modules/instruction/include/pagetypes.inc.php'); |
|
59 | - |
|
60 | - // Название формы |
|
61 | - $title = $this->isNew() ? sprintf(_AM_INSTRUCTION_FORMADDPAGE) : sprintf(_AM_INSTRUCTION_FORMEDITPAGE); |
|
62 | - |
|
63 | - // Форма |
|
64 | - $form = new XoopsThemeForm($title, 'instr_form_page', $action, 'post', true); |
|
65 | - // Название |
|
66 | - $form->addElement(new XoopsFormText(_AM_INSTRUCTION_TITLEC, 'title', 50, 255, $this->getVar('title')), true); |
|
67 | - |
|
68 | - // Родительская страница |
|
69 | - $inspageHandler = xoops_getModuleHandler('page', 'instruction'); |
|
70 | - $criteria = new CriteriaCompo(); |
|
71 | - // ID инструкции в которой данная страница |
|
72 | - $instrid_page = $this->isNew() ? $instrid : $this->getVar('instrid'); |
|
73 | - // Находим все страницы данной инструкции |
|
74 | - $criteria->add(new Criteria('instrid', $instrid_page, '=')); |
|
75 | - // Если мы редактируем, то убрать текущую страницу из списка выбора родительской |
|
76 | - if (!$this->isNew()) { |
|
77 | - $criteria->add(new Criteria('pageid', $this->getVar('pageid'), '<>')); |
|
78 | - } |
|
79 | - $criteria->setSort('weight'); |
|
80 | - $criteria->setOrder('ASC'); |
|
81 | - $inspage_arr = $inspageHandler->getall($criteria); |
|
82 | - unset($criteria); |
|
83 | - // Подключаем трей |
|
84 | - include_once $GLOBALS['xoops']->path('class/tree.php'); |
|
85 | - $mytree = new XoopsObjectTree($inspage_arr, 'pageid', 'pid'); |
|
86 | - $form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_PPAGEC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true))); |
|
87 | - |
|
88 | - // Вес |
|
89 | - $form->addElement(new XoopsFormText(_AM_INSTRUCTION_WEIGHTC, 'weight', 5, 5, $this->getVar('weight')), true); |
|
90 | - // Основной текст |
|
91 | - $form->addElement(InstructionUtility::getWysiwygForm(_AM_INSTRUCTION_HOMETEXTC, 'hometext', $this->getVar('hometext', 'e')), true); |
|
92 | - // Сноска |
|
93 | - $form_footnote = new XoopsFormTextArea(_AM_INSTRUCTION_FOOTNOTEC, 'footnote', $this->getVar('footnote', 'e')); |
|
94 | - $form_footnote->setDescription(_AM_INSTRUCTION_FOOTNOTE_DSC); |
|
95 | - $form->addElement($form_footnote, false); |
|
96 | - unset($form_footnote); |
|
97 | - // Статус |
|
98 | - $form->addElement(new XoopsFormRadioYN(_AM_INSTRUCTION_ACTIVEC, 'status', $this->getVar('status')), false); |
|
99 | - // Тип страницы |
|
100 | - $form_type = new XoopsFormSelect(_AM_INSTR_PAGETYPEC, 'type', $this->getVar('type')); |
|
101 | - $form_type->setDescription(_AM_INSTR_PAGETYPEC_DESC); |
|
102 | - $form_type->addOptionArray($pagetypes); |
|
103 | - $form->addElement($form_type, false); |
|
104 | - // Мета-теги ключевых слов |
|
105 | - $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'keywords', 50, 255, $this->getVar('keywords')), false); |
|
106 | - // Мета-теги описания |
|
107 | - $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'description', 50, 255, $this->getVar('description')), false); |
|
108 | - |
|
109 | - // Настройки |
|
110 | - $option_tray = new XoopsFormElementTray(_OPTIONS, '<br>'); |
|
111 | - // HTML |
|
112 | - $html_checkbox = new XoopsFormCheckBox('', 'dohtml', $this->getVar('dohtml')); |
|
113 | - $html_checkbox->addOption(1, _AM_INSTR_DOHTML); |
|
114 | - $option_tray->addElement($html_checkbox); |
|
115 | - // Смайлы |
|
116 | - $smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $this->getVar('dosmiley')); |
|
117 | - $smiley_checkbox->addOption(1, _AM_INSTR_DOSMILEY); |
|
118 | - $option_tray->addElement($smiley_checkbox); |
|
119 | - // ББ коды |
|
120 | - $xcode_checkbox = new XoopsFormCheckBox('', 'doxcode', $this->getVar('doxcode')); |
|
121 | - $xcode_checkbox->addOption(1, _AM_INSTR_DOXCODE); |
|
122 | - $option_tray->addElement($xcode_checkbox); |
|
123 | - // |
|
124 | - $br_checkbox = new XoopsFormCheckBox('', 'dobr', $this->getVar('dobr')); |
|
125 | - $br_checkbox->addOption(1, _AM_INSTR_DOAUTOWRAP); |
|
126 | - $option_tray->addElement($br_checkbox); |
|
127 | - // |
|
128 | - $form->addElement($option_tray); |
|
129 | - |
|
130 | - // Если мы редактируем страницу |
|
131 | - if (!$this->isNew()) { |
|
132 | - $form->addElement(new XoopsFormHidden('pageid', $this->getVar('pageid'))); |
|
133 | - } else { |
|
134 | - $form->addElement(new XoopsFormHidden('pageid', 0)); |
|
135 | - } |
|
136 | - // ID инструкции |
|
137 | - if ($instrid) { |
|
138 | - $form->addElement(new XoopsFormHidden('instrid', $instrid)); |
|
139 | - } else { |
|
140 | - $form->addElement(new XoopsFormHidden('instrid', 0)); |
|
141 | - } |
|
142 | - // |
|
143 | - $form->addElement(new XoopsFormHidden('op', 'savepage')); |
|
144 | - // Кнопка |
|
145 | - $button_tray = new XoopsFormElementTray('', ''); |
|
146 | - $button_tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
147 | - $save_btn = new XoopsFormButton('', 'cancel', _AM_INSTR_SAVEFORM); |
|
148 | - $save_btn->setExtra('onclick="instrSavePage();"'); |
|
149 | - $button_tray->addElement($save_btn); |
|
150 | - $form->addElement($button_tray); |
|
151 | - |
|
152 | - return $form; |
|
153 | - } |
|
154 | - |
|
155 | - // |
|
156 | - public function getInstrid() |
|
157 | - { |
|
158 | - // Возвращаем ID инструкции |
|
159 | - return $this->getVar('instrid'); |
|
160 | - } |
|
11 | + // constructor |
|
12 | + public function __construct() |
|
13 | + { |
|
14 | + // $this->XoopsObject(); |
|
15 | + $this->initVar('pageid', XOBJ_DTYPE_INT, null, false, 11); |
|
16 | + $this->initVar('pid', XOBJ_DTYPE_INT, 0, false, 11); |
|
17 | + $this->initVar('instrid', XOBJ_DTYPE_INT, 0, false, 11); |
|
18 | + $this->initVar('uid', XOBJ_DTYPE_INT, 0, false, 11); |
|
19 | + $this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false, 255); |
|
20 | + $this->initVar('status', XOBJ_DTYPE_INT, 1, false, 1); |
|
21 | + $this->initVar('type', XOBJ_DTYPE_INT, 1, false, 1); |
|
22 | + $this->initVar('hometext', XOBJ_DTYPE_TXTAREA, null, false); |
|
23 | + $this->initVar('footnote', XOBJ_DTYPE_TXTAREA, '', false); |
|
24 | + $this->initVar('weight', XOBJ_DTYPE_INT, 0, false, 11); |
|
25 | + $this->initVar('keywords', XOBJ_DTYPE_TXTBOX, '', false, 255); |
|
26 | + $this->initVar('description', XOBJ_DTYPE_TXTBOX, '', false, 255); |
|
27 | + $this->initVar('comments', XOBJ_DTYPE_INT, 0, false, 11); |
|
28 | + $this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10); |
|
29 | + $this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10); |
|
30 | + $this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false, 1); |
|
31 | + $this->initVar('dosmiley', XOBJ_DTYPE_INT, 0, false, 1); |
|
32 | + $this->initVar('doxcode', XOBJ_DTYPE_INT, 1, false, 1); |
|
33 | + $this->initVar('dobr', XOBJ_DTYPE_INT, 0, false, 1); |
|
34 | + } |
|
35 | + |
|
36 | + public function InstructionPage() |
|
37 | + { |
|
38 | + $this->__construct(); |
|
39 | + } |
|
40 | + |
|
41 | + public function get_new_enreg() |
|
42 | + { |
|
43 | + $new_enreg = $GLOBALS['xoopsDB']->getInsertId(); |
|
44 | + return $new_enreg; |
|
45 | + } |
|
46 | + |
|
47 | + // Получаем форму |
|
48 | + public function getForm($action = false, $instrid = 0) |
|
49 | + { |
|
50 | + // Если нет $action |
|
51 | + if (false === $action) { |
|
52 | + $action = xoops_getenv('REQUEST_URI'); |
|
53 | + } |
|
54 | + |
|
55 | + // Подключаем формы |
|
56 | + include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
|
57 | + // Подключаем типы страниц |
|
58 | + $pagetypes = include $GLOBALS['xoops']->path('modules/instruction/include/pagetypes.inc.php'); |
|
59 | + |
|
60 | + // Название формы |
|
61 | + $title = $this->isNew() ? sprintf(_AM_INSTRUCTION_FORMADDPAGE) : sprintf(_AM_INSTRUCTION_FORMEDITPAGE); |
|
62 | + |
|
63 | + // Форма |
|
64 | + $form = new XoopsThemeForm($title, 'instr_form_page', $action, 'post', true); |
|
65 | + // Название |
|
66 | + $form->addElement(new XoopsFormText(_AM_INSTRUCTION_TITLEC, 'title', 50, 255, $this->getVar('title')), true); |
|
67 | + |
|
68 | + // Родительская страница |
|
69 | + $inspageHandler = xoops_getModuleHandler('page', 'instruction'); |
|
70 | + $criteria = new CriteriaCompo(); |
|
71 | + // ID инструкции в которой данная страница |
|
72 | + $instrid_page = $this->isNew() ? $instrid : $this->getVar('instrid'); |
|
73 | + // Находим все страницы данной инструкции |
|
74 | + $criteria->add(new Criteria('instrid', $instrid_page, '=')); |
|
75 | + // Если мы редактируем, то убрать текущую страницу из списка выбора родительской |
|
76 | + if (!$this->isNew()) { |
|
77 | + $criteria->add(new Criteria('pageid', $this->getVar('pageid'), '<>')); |
|
78 | + } |
|
79 | + $criteria->setSort('weight'); |
|
80 | + $criteria->setOrder('ASC'); |
|
81 | + $inspage_arr = $inspageHandler->getall($criteria); |
|
82 | + unset($criteria); |
|
83 | + // Подключаем трей |
|
84 | + include_once $GLOBALS['xoops']->path('class/tree.php'); |
|
85 | + $mytree = new XoopsObjectTree($inspage_arr, 'pageid', 'pid'); |
|
86 | + $form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_PPAGEC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true))); |
|
87 | + |
|
88 | + // Вес |
|
89 | + $form->addElement(new XoopsFormText(_AM_INSTRUCTION_WEIGHTC, 'weight', 5, 5, $this->getVar('weight')), true); |
|
90 | + // Основной текст |
|
91 | + $form->addElement(InstructionUtility::getWysiwygForm(_AM_INSTRUCTION_HOMETEXTC, 'hometext', $this->getVar('hometext', 'e')), true); |
|
92 | + // Сноска |
|
93 | + $form_footnote = new XoopsFormTextArea(_AM_INSTRUCTION_FOOTNOTEC, 'footnote', $this->getVar('footnote', 'e')); |
|
94 | + $form_footnote->setDescription(_AM_INSTRUCTION_FOOTNOTE_DSC); |
|
95 | + $form->addElement($form_footnote, false); |
|
96 | + unset($form_footnote); |
|
97 | + // Статус |
|
98 | + $form->addElement(new XoopsFormRadioYN(_AM_INSTRUCTION_ACTIVEC, 'status', $this->getVar('status')), false); |
|
99 | + // Тип страницы |
|
100 | + $form_type = new XoopsFormSelect(_AM_INSTR_PAGETYPEC, 'type', $this->getVar('type')); |
|
101 | + $form_type->setDescription(_AM_INSTR_PAGETYPEC_DESC); |
|
102 | + $form_type->addOptionArray($pagetypes); |
|
103 | + $form->addElement($form_type, false); |
|
104 | + // Мета-теги ключевых слов |
|
105 | + $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'keywords', 50, 255, $this->getVar('keywords')), false); |
|
106 | + // Мета-теги описания |
|
107 | + $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'description', 50, 255, $this->getVar('description')), false); |
|
108 | + |
|
109 | + // Настройки |
|
110 | + $option_tray = new XoopsFormElementTray(_OPTIONS, '<br>'); |
|
111 | + // HTML |
|
112 | + $html_checkbox = new XoopsFormCheckBox('', 'dohtml', $this->getVar('dohtml')); |
|
113 | + $html_checkbox->addOption(1, _AM_INSTR_DOHTML); |
|
114 | + $option_tray->addElement($html_checkbox); |
|
115 | + // Смайлы |
|
116 | + $smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $this->getVar('dosmiley')); |
|
117 | + $smiley_checkbox->addOption(1, _AM_INSTR_DOSMILEY); |
|
118 | + $option_tray->addElement($smiley_checkbox); |
|
119 | + // ББ коды |
|
120 | + $xcode_checkbox = new XoopsFormCheckBox('', 'doxcode', $this->getVar('doxcode')); |
|
121 | + $xcode_checkbox->addOption(1, _AM_INSTR_DOXCODE); |
|
122 | + $option_tray->addElement($xcode_checkbox); |
|
123 | + // |
|
124 | + $br_checkbox = new XoopsFormCheckBox('', 'dobr', $this->getVar('dobr')); |
|
125 | + $br_checkbox->addOption(1, _AM_INSTR_DOAUTOWRAP); |
|
126 | + $option_tray->addElement($br_checkbox); |
|
127 | + // |
|
128 | + $form->addElement($option_tray); |
|
129 | + |
|
130 | + // Если мы редактируем страницу |
|
131 | + if (!$this->isNew()) { |
|
132 | + $form->addElement(new XoopsFormHidden('pageid', $this->getVar('pageid'))); |
|
133 | + } else { |
|
134 | + $form->addElement(new XoopsFormHidden('pageid', 0)); |
|
135 | + } |
|
136 | + // ID инструкции |
|
137 | + if ($instrid) { |
|
138 | + $form->addElement(new XoopsFormHidden('instrid', $instrid)); |
|
139 | + } else { |
|
140 | + $form->addElement(new XoopsFormHidden('instrid', 0)); |
|
141 | + } |
|
142 | + // |
|
143 | + $form->addElement(new XoopsFormHidden('op', 'savepage')); |
|
144 | + // Кнопка |
|
145 | + $button_tray = new XoopsFormElementTray('', ''); |
|
146 | + $button_tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
147 | + $save_btn = new XoopsFormButton('', 'cancel', _AM_INSTR_SAVEFORM); |
|
148 | + $save_btn->setExtra('onclick="instrSavePage();"'); |
|
149 | + $button_tray->addElement($save_btn); |
|
150 | + $form->addElement($button_tray); |
|
151 | + |
|
152 | + return $form; |
|
153 | + } |
|
154 | + |
|
155 | + // |
|
156 | + public function getInstrid() |
|
157 | + { |
|
158 | + // Возвращаем ID инструкции |
|
159 | + return $this->getVar('instrid'); |
|
160 | + } |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | class InstructionPageHandler extends XoopsPersistableObjectHandler |
164 | 164 | { |
165 | - public function __construct($db) |
|
166 | - { |
|
167 | - parent::__construct($db, 'instruction_page', 'InstructionPage', 'pageid', 'title'); |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * Generate function for update user post |
|
172 | - * |
|
173 | - * @ Update user post count after send approve content |
|
174 | - * @ Update user post count after change status content |
|
175 | - * @ Update user post count after delete content |
|
176 | - */ |
|
177 | - public function updateposts($uid, $status, $action) |
|
178 | - { |
|
179 | - // |
|
180 | - switch ($action) { |
|
181 | - // Добавление страницы |
|
182 | - case 'add': |
|
183 | - if ($uid && $status) { |
|
184 | - $user = new xoopsUser($uid); |
|
185 | - $memberHandler = xoops_getHandler('member'); |
|
186 | - // Добавялем +1 к комментам |
|
187 | - $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') + 1); |
|
188 | - } |
|
189 | - break; |
|
190 | - // Удаление страницы |
|
191 | - case 'delete': |
|
192 | - if ($uid && $status) { |
|
193 | - $user = new xoopsUser($uid); |
|
194 | - $memberHandler = xoops_getHandler('member'); |
|
195 | - // Декримент комментов |
|
196 | - //$user->setVar( 'posts', $user->getVar( 'posts' ) - 1 ); |
|
197 | - // Сохраняем |
|
198 | - $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') - 1); |
|
199 | - } |
|
200 | - break; |
|
201 | - |
|
202 | - case 'status': |
|
203 | - if ($uid) { |
|
204 | - $user = new xoopsUser($uid); |
|
205 | - $memberHandler = xoops_getHandler('member'); |
|
206 | - if ($status) { |
|
207 | - $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') - 1); |
|
208 | - } else { |
|
209 | - $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') + 1); |
|
210 | - } |
|
211 | - } |
|
212 | - break; |
|
213 | - } |
|
214 | - } |
|
165 | + public function __construct($db) |
|
166 | + { |
|
167 | + parent::__construct($db, 'instruction_page', 'InstructionPage', 'pageid', 'title'); |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * Generate function for update user post |
|
172 | + * |
|
173 | + * @ Update user post count after send approve content |
|
174 | + * @ Update user post count after change status content |
|
175 | + * @ Update user post count after delete content |
|
176 | + */ |
|
177 | + public function updateposts($uid, $status, $action) |
|
178 | + { |
|
179 | + // |
|
180 | + switch ($action) { |
|
181 | + // Добавление страницы |
|
182 | + case 'add': |
|
183 | + if ($uid && $status) { |
|
184 | + $user = new xoopsUser($uid); |
|
185 | + $memberHandler = xoops_getHandler('member'); |
|
186 | + // Добавялем +1 к комментам |
|
187 | + $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') + 1); |
|
188 | + } |
|
189 | + break; |
|
190 | + // Удаление страницы |
|
191 | + case 'delete': |
|
192 | + if ($uid && $status) { |
|
193 | + $user = new xoopsUser($uid); |
|
194 | + $memberHandler = xoops_getHandler('member'); |
|
195 | + // Декримент комментов |
|
196 | + //$user->setVar( 'posts', $user->getVar( 'posts' ) - 1 ); |
|
197 | + // Сохраняем |
|
198 | + $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') - 1); |
|
199 | + } |
|
200 | + break; |
|
201 | + |
|
202 | + case 'status': |
|
203 | + if ($uid) { |
|
204 | + $user = new xoopsUser($uid); |
|
205 | + $memberHandler = xoops_getHandler('member'); |
|
206 | + if ($status) { |
|
207 | + $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') - 1); |
|
208 | + } else { |
|
209 | + $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') + 1); |
|
210 | + } |
|
211 | + } |
|
212 | + break; |
|
213 | + } |
|
214 | + } |
|
215 | 215 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $instructioncatHandler = xoops_getModuleHandler('category', 'instruction'); |
84 | 84 | $criteria = new CriteriaCompo(); |
85 | 85 | // Если мы редактируем, то убрать текущую категорию из списка выбора родительской |
86 | - if (!$this->isNew()) { |
|
86 | + if ( ! $this->isNew()) { |
|
87 | 87 | $criteria->add(new Criteria('cid', $this->getVar('cid'), '<>')); |
88 | 88 | } |
89 | 89 | $criteria->setSort('weight ASC, title'); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | // Права на просмотр |
129 | 129 | $groups_ids = []; |
130 | 130 | // Если мы редактируем |
131 | - if (!$this->isNew()) { |
|
131 | + if ( ! $this->isNew()) { |
|
132 | 132 | $groups_ids = $gpermHandler->getGroupIds('instruction_view', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid')); |
133 | 133 | $groups_ids = array_values($groups_ids); |
134 | 134 | $groups_instr_view = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_VIEW, 'groups_instr_view', $groups_ids); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | // Права на отправку |
142 | 142 | $groups_ids = []; |
143 | - if (!$this->isNew()) { |
|
143 | + if ( ! $this->isNew()) { |
|
144 | 144 | $groups_ids = $gpermHandler->getGroupIds('instruction_submit', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid')); |
145 | 145 | $groups_ids = array_values($groups_ids); |
146 | 146 | $groups_instr_submit = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_SUBMIT, 'groups_instr_submit', $groups_ids); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | // Права на редактирование |
154 | 154 | $groups_ids = []; |
155 | - if (!$this->isNew()) { |
|
155 | + if ( ! $this->isNew()) { |
|
156 | 156 | $groups_ids = $gpermHandler->getGroupIds('instruction_edit', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid')); |
157 | 157 | $groups_ids = array_values($groups_ids); |
158 | 158 | $groups_instr_edit = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_EDIT, 'groups_instr_edit', $groups_ids); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | // ========================================================== |
167 | 167 | |
168 | 168 | // Если мы редактируем категорию |
169 | - if (!$this->isNew()) { |
|
169 | + if ( ! $this->isNew()) { |
|
170 | 170 | $form->addElement(new XoopsFormHidden('cid', $this->getVar('cid'))); |
171 | 171 | //$form->addElement( new XoopsFormHidden( 'catmodify', true)); |
172 | 172 | } |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | public function updateDateupdated($cid = 0, $time = null) |
197 | 197 | { |
198 | 198 | // Если не передали время |
199 | - $time = null === $time ? time() : (int)$time; |
|
199 | + $time = null === $time ? time() : (int) $time; |
|
200 | 200 | // |
201 | - $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `cid` = %u', $this->table, $time, (int)$cid); |
|
201 | + $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `cid` = %u', $this->table, $time, (int) $cid); |
|
202 | 202 | // |
203 | 203 | return $this->db->query($sql); |
204 | 204 | } |
@@ -11,56 +11,56 @@ discard block |
||
11 | 11 | |
12 | 12 | class InstructionCategory extends XoopsObject |
13 | 13 | { |
14 | - // constructor |
|
15 | - public function __construct() |
|
16 | - { |
|
17 | - // $this->XoopsObject(); |
|
18 | - $this->initVar('cid', XOBJ_DTYPE_INT, null, false, 5); |
|
19 | - $this->initVar('pid', XOBJ_DTYPE_INT, 0, false, 5); |
|
20 | - $this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false); |
|
21 | - $this->initVar('imgurl', XOBJ_DTYPE_TXTBOX, '', false); |
|
22 | - $this->initVar('description', XOBJ_DTYPE_TXTAREA, null, false); |
|
23 | - $this->initVar('weight', XOBJ_DTYPE_INT, 0, false, 11); |
|
24 | - $this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10); |
|
25 | - $this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10); |
|
26 | - $this->initVar('metakeywords', XOBJ_DTYPE_TXTBOX, '', false); |
|
27 | - $this->initVar('metadescription', XOBJ_DTYPE_TXTBOX, '', false); |
|
28 | - } |
|
29 | - |
|
30 | - public function InstructionCategory() |
|
31 | - { |
|
32 | - $this->__construct(); |
|
33 | - } |
|
34 | - |
|
35 | - public function get_new_enreg() |
|
36 | - { |
|
37 | - $new_enreg = $GLOBALS['xoopsDB']->getInsertId(); |
|
38 | - return $new_enreg; |
|
39 | - } |
|
40 | - |
|
41 | - // Получаем форму |
|
42 | - public function getForm($action = false) |
|
43 | - { |
|
44 | - //global $xoopsDB, $xoopsModule, $xoopsModuleConfig; |
|
45 | - // Если нет $action |
|
46 | - if (false === $action) { |
|
47 | - $action = xoops_getenv('REQUEST_URI'); |
|
48 | - } |
|
49 | - // Подключаем формы |
|
50 | - include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
|
51 | - |
|
52 | - // Название формы |
|
53 | - $title = $this->isNew() ? sprintf(_AM_INSTRUCTION_FORMADDCAT) : sprintf(_AM_INSTRUCTION_FORMEDITCAT); |
|
54 | - |
|
55 | - // Форма |
|
56 | - $form = new XoopsThemeForm($title, 'formcat', $action, 'post', true); |
|
57 | - //$form->setExtra('enctype="multipart/form-data"'); |
|
58 | - // Название категории |
|
59 | - $form->addElement(new XoopsFormText(_AM_INSTRUCTION_TITLEC, 'title', 50, 255, $this->getVar('title')), true); |
|
60 | - // Редактор |
|
61 | - $form->addElement(new XoopsFormTextArea(_AM_INSTRUCTION_DSCC, 'description', $this->getVar('description', 'e')), true); |
|
62 | - //image |
|
63 | - /* |
|
14 | + // constructor |
|
15 | + public function __construct() |
|
16 | + { |
|
17 | + // $this->XoopsObject(); |
|
18 | + $this->initVar('cid', XOBJ_DTYPE_INT, null, false, 5); |
|
19 | + $this->initVar('pid', XOBJ_DTYPE_INT, 0, false, 5); |
|
20 | + $this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false); |
|
21 | + $this->initVar('imgurl', XOBJ_DTYPE_TXTBOX, '', false); |
|
22 | + $this->initVar('description', XOBJ_DTYPE_TXTAREA, null, false); |
|
23 | + $this->initVar('weight', XOBJ_DTYPE_INT, 0, false, 11); |
|
24 | + $this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10); |
|
25 | + $this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10); |
|
26 | + $this->initVar('metakeywords', XOBJ_DTYPE_TXTBOX, '', false); |
|
27 | + $this->initVar('metadescription', XOBJ_DTYPE_TXTBOX, '', false); |
|
28 | + } |
|
29 | + |
|
30 | + public function InstructionCategory() |
|
31 | + { |
|
32 | + $this->__construct(); |
|
33 | + } |
|
34 | + |
|
35 | + public function get_new_enreg() |
|
36 | + { |
|
37 | + $new_enreg = $GLOBALS['xoopsDB']->getInsertId(); |
|
38 | + return $new_enreg; |
|
39 | + } |
|
40 | + |
|
41 | + // Получаем форму |
|
42 | + public function getForm($action = false) |
|
43 | + { |
|
44 | + //global $xoopsDB, $xoopsModule, $xoopsModuleConfig; |
|
45 | + // Если нет $action |
|
46 | + if (false === $action) { |
|
47 | + $action = xoops_getenv('REQUEST_URI'); |
|
48 | + } |
|
49 | + // Подключаем формы |
|
50 | + include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
|
51 | + |
|
52 | + // Название формы |
|
53 | + $title = $this->isNew() ? sprintf(_AM_INSTRUCTION_FORMADDCAT) : sprintf(_AM_INSTRUCTION_FORMEDITCAT); |
|
54 | + |
|
55 | + // Форма |
|
56 | + $form = new XoopsThemeForm($title, 'formcat', $action, 'post', true); |
|
57 | + //$form->setExtra('enctype="multipart/form-data"'); |
|
58 | + // Название категории |
|
59 | + $form->addElement(new XoopsFormText(_AM_INSTRUCTION_TITLEC, 'title', 50, 255, $this->getVar('title')), true); |
|
60 | + // Редактор |
|
61 | + $form->addElement(new XoopsFormTextArea(_AM_INSTRUCTION_DSCC, 'description', $this->getVar('description', 'e')), true); |
|
62 | + //image |
|
63 | + /* |
|
64 | 64 | $downloadscat_img = $this->getVar('imgurl') ? $this->getVar('imgurl') : 'blank.gif'; |
65 | 65 | $uploadirectory='/uploads/tdmdownloads/images/cats'; |
66 | 66 | $imgtray = new XoopsFormElementTray(_AM_TDMDOWNLOADS_FORMIMG,'<br>'); |
@@ -79,127 +79,127 @@ discard block |
||
79 | 79 | $imgtray->addElement($fileseltray); |
80 | 80 | $form->addElement($imgtray); |
81 | 81 | */ |
82 | - // Родительская категория |
|
83 | - $instructioncatHandler = xoops_getModuleHandler('category', 'instruction'); |
|
84 | - $criteria = new CriteriaCompo(); |
|
85 | - // Если мы редактируем, то убрать текущую категорию из списка выбора родительской |
|
86 | - if (!$this->isNew()) { |
|
87 | - $criteria->add(new Criteria('cid', $this->getVar('cid'), '<>')); |
|
88 | - } |
|
89 | - $criteria->setSort('weight ASC, title'); |
|
90 | - $criteria->setOrder('ASC'); |
|
91 | - $instructioncat_arr = $instructioncatHandler->getall($criteria); |
|
92 | - unset($criteria); |
|
93 | - // Подключаем трей |
|
94 | - include_once $GLOBALS['xoops']->path('class/tree.php'); |
|
95 | - $mytree = new XoopsObjectTree($instructioncat_arr, 'cid', 'pid'); |
|
96 | - |
|
97 | - // $form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_PCATC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true))); |
|
98 | - $moduleDirName = basename(__DIR__); |
|
99 | - if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) { |
|
100 | - } else { |
|
101 | - $moduleHelper = Xmf\Module\Helper::getHelper('system'); |
|
102 | - } |
|
103 | - $module = $moduleHelper->getModule(); |
|
104 | - |
|
105 | - if (InstructionUtility::checkVerXoops($module, '2.5.9')) { |
|
106 | - $mytree_select = $mytree->makeSelectElement('pid', 'title', '--', $this->getVar('pid'), true, 0, '', _AM_INSTRUCTION_PCATC); |
|
107 | - $form->addElement($mytree_select); |
|
108 | - } else { |
|
109 | - $form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_PCATC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true))); |
|
110 | - } |
|
111 | - |
|
112 | - // Вес |
|
113 | - $form->addElement(new XoopsFormText(_AM_INSTRUCTION_WEIGHTC, 'weight', 5, 5, $this->getVar('weight')), true); |
|
114 | - // Мета-теги ключевых слов |
|
115 | - $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'metakeywords', 50, 255, $this->getVar('metakeywords')), false); |
|
116 | - // Мета-теги описания |
|
117 | - $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'metadescription', 50, 255, $this->getVar('metadescription')), false); |
|
118 | - |
|
119 | - // ========================================================== |
|
120 | - // ========================================================== |
|
121 | - |
|
122 | - // Права |
|
123 | - $memberHandler = xoops_getHandler('member'); |
|
124 | - $group_list = $memberHandler->getGroupList(); |
|
125 | - $gpermHandler = xoops_getHandler('groupperm'); |
|
126 | - $full_list = array_keys($group_list); |
|
127 | - |
|
128 | - // Права на просмотр |
|
129 | - $groups_ids = []; |
|
130 | - // Если мы редактируем |
|
131 | - if (!$this->isNew()) { |
|
132 | - $groups_ids = $gpermHandler->getGroupIds('instruction_view', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
133 | - $groups_ids = array_values($groups_ids); |
|
134 | - $groups_instr_view = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_VIEW, 'groups_instr_view', $groups_ids); |
|
135 | - } else { |
|
136 | - $groups_instr_view = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_VIEW, 'groups_instr_view', $full_list); |
|
137 | - } |
|
138 | - $groups_instr_view->addOptionArray($group_list); |
|
139 | - $form->addElement($groups_instr_view); |
|
140 | - |
|
141 | - // Права на отправку |
|
142 | - $groups_ids = []; |
|
143 | - if (!$this->isNew()) { |
|
144 | - $groups_ids = $gpermHandler->getGroupIds('instruction_submit', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
145 | - $groups_ids = array_values($groups_ids); |
|
146 | - $groups_instr_submit = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_SUBMIT, 'groups_instr_submit', $groups_ids); |
|
147 | - } else { |
|
148 | - $groups_instr_submit = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_SUBMIT, 'groups_instr_submit', $full_list); |
|
149 | - } |
|
150 | - $groups_instr_submit->addOptionArray($group_list); |
|
151 | - $form->addElement($groups_instr_submit); |
|
152 | - |
|
153 | - // Права на редактирование |
|
154 | - $groups_ids = []; |
|
155 | - if (!$this->isNew()) { |
|
156 | - $groups_ids = $gpermHandler->getGroupIds('instruction_edit', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
157 | - $groups_ids = array_values($groups_ids); |
|
158 | - $groups_instr_edit = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_EDIT, 'groups_instr_edit', $groups_ids); |
|
159 | - } else { |
|
160 | - $groups_instr_edit = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_EDIT, 'groups_instr_edit', $full_list); |
|
161 | - } |
|
162 | - $groups_instr_edit->addOptionArray($group_list); |
|
163 | - $form->addElement($groups_instr_edit); |
|
164 | - |
|
165 | - // ========================================================== |
|
166 | - // ========================================================== |
|
167 | - |
|
168 | - // Если мы редактируем категорию |
|
169 | - if (!$this->isNew()) { |
|
170 | - $form->addElement(new XoopsFormHidden('cid', $this->getVar('cid'))); |
|
171 | - //$form->addElement( new XoopsFormHidden( 'catmodify', true)); |
|
172 | - } |
|
173 | - // |
|
174 | - $form->addElement(new XoopsFormHidden('op', 'savecat')); |
|
175 | - // Кнопка |
|
176 | - $button_tray = new XoopsFormElementTray('', ''); |
|
177 | - $submit_btn = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
|
178 | - $button_tray->addElement($submit_btn); |
|
179 | - $cancel_btn = new XoopsFormButton('', 'cancel', _CANCEL, 'cancel'); |
|
180 | - $cancel_btn->setExtra('onclick="javascript:history.go(-1);"'); |
|
181 | - $button_tray->addElement($cancel_btn); |
|
182 | - $form->addElement($button_tray); |
|
183 | - |
|
184 | - return $form; |
|
185 | - } |
|
82 | + // Родительская категория |
|
83 | + $instructioncatHandler = xoops_getModuleHandler('category', 'instruction'); |
|
84 | + $criteria = new CriteriaCompo(); |
|
85 | + // Если мы редактируем, то убрать текущую категорию из списка выбора родительской |
|
86 | + if (!$this->isNew()) { |
|
87 | + $criteria->add(new Criteria('cid', $this->getVar('cid'), '<>')); |
|
88 | + } |
|
89 | + $criteria->setSort('weight ASC, title'); |
|
90 | + $criteria->setOrder('ASC'); |
|
91 | + $instructioncat_arr = $instructioncatHandler->getall($criteria); |
|
92 | + unset($criteria); |
|
93 | + // Подключаем трей |
|
94 | + include_once $GLOBALS['xoops']->path('class/tree.php'); |
|
95 | + $mytree = new XoopsObjectTree($instructioncat_arr, 'cid', 'pid'); |
|
96 | + |
|
97 | + // $form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_PCATC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true))); |
|
98 | + $moduleDirName = basename(__DIR__); |
|
99 | + if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) { |
|
100 | + } else { |
|
101 | + $moduleHelper = Xmf\Module\Helper::getHelper('system'); |
|
102 | + } |
|
103 | + $module = $moduleHelper->getModule(); |
|
104 | + |
|
105 | + if (InstructionUtility::checkVerXoops($module, '2.5.9')) { |
|
106 | + $mytree_select = $mytree->makeSelectElement('pid', 'title', '--', $this->getVar('pid'), true, 0, '', _AM_INSTRUCTION_PCATC); |
|
107 | + $form->addElement($mytree_select); |
|
108 | + } else { |
|
109 | + $form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_PCATC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true))); |
|
110 | + } |
|
111 | + |
|
112 | + // Вес |
|
113 | + $form->addElement(new XoopsFormText(_AM_INSTRUCTION_WEIGHTC, 'weight', 5, 5, $this->getVar('weight')), true); |
|
114 | + // Мета-теги ключевых слов |
|
115 | + $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'metakeywords', 50, 255, $this->getVar('metakeywords')), false); |
|
116 | + // Мета-теги описания |
|
117 | + $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'metadescription', 50, 255, $this->getVar('metadescription')), false); |
|
118 | + |
|
119 | + // ========================================================== |
|
120 | + // ========================================================== |
|
121 | + |
|
122 | + // Права |
|
123 | + $memberHandler = xoops_getHandler('member'); |
|
124 | + $group_list = $memberHandler->getGroupList(); |
|
125 | + $gpermHandler = xoops_getHandler('groupperm'); |
|
126 | + $full_list = array_keys($group_list); |
|
127 | + |
|
128 | + // Права на просмотр |
|
129 | + $groups_ids = []; |
|
130 | + // Если мы редактируем |
|
131 | + if (!$this->isNew()) { |
|
132 | + $groups_ids = $gpermHandler->getGroupIds('instruction_view', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
133 | + $groups_ids = array_values($groups_ids); |
|
134 | + $groups_instr_view = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_VIEW, 'groups_instr_view', $groups_ids); |
|
135 | + } else { |
|
136 | + $groups_instr_view = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_VIEW, 'groups_instr_view', $full_list); |
|
137 | + } |
|
138 | + $groups_instr_view->addOptionArray($group_list); |
|
139 | + $form->addElement($groups_instr_view); |
|
140 | + |
|
141 | + // Права на отправку |
|
142 | + $groups_ids = []; |
|
143 | + if (!$this->isNew()) { |
|
144 | + $groups_ids = $gpermHandler->getGroupIds('instruction_submit', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
145 | + $groups_ids = array_values($groups_ids); |
|
146 | + $groups_instr_submit = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_SUBMIT, 'groups_instr_submit', $groups_ids); |
|
147 | + } else { |
|
148 | + $groups_instr_submit = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_SUBMIT, 'groups_instr_submit', $full_list); |
|
149 | + } |
|
150 | + $groups_instr_submit->addOptionArray($group_list); |
|
151 | + $form->addElement($groups_instr_submit); |
|
152 | + |
|
153 | + // Права на редактирование |
|
154 | + $groups_ids = []; |
|
155 | + if (!$this->isNew()) { |
|
156 | + $groups_ids = $gpermHandler->getGroupIds('instruction_edit', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
157 | + $groups_ids = array_values($groups_ids); |
|
158 | + $groups_instr_edit = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_EDIT, 'groups_instr_edit', $groups_ids); |
|
159 | + } else { |
|
160 | + $groups_instr_edit = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_EDIT, 'groups_instr_edit', $full_list); |
|
161 | + } |
|
162 | + $groups_instr_edit->addOptionArray($group_list); |
|
163 | + $form->addElement($groups_instr_edit); |
|
164 | + |
|
165 | + // ========================================================== |
|
166 | + // ========================================================== |
|
167 | + |
|
168 | + // Если мы редактируем категорию |
|
169 | + if (!$this->isNew()) { |
|
170 | + $form->addElement(new XoopsFormHidden('cid', $this->getVar('cid'))); |
|
171 | + //$form->addElement( new XoopsFormHidden( 'catmodify', true)); |
|
172 | + } |
|
173 | + // |
|
174 | + $form->addElement(new XoopsFormHidden('op', 'savecat')); |
|
175 | + // Кнопка |
|
176 | + $button_tray = new XoopsFormElementTray('', ''); |
|
177 | + $submit_btn = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
|
178 | + $button_tray->addElement($submit_btn); |
|
179 | + $cancel_btn = new XoopsFormButton('', 'cancel', _CANCEL, 'cancel'); |
|
180 | + $cancel_btn->setExtra('onclick="javascript:history.go(-1);"'); |
|
181 | + $button_tray->addElement($cancel_btn); |
|
182 | + $form->addElement($button_tray); |
|
183 | + |
|
184 | + return $form; |
|
185 | + } |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | class InstructionCategoryHandler extends XoopsPersistableObjectHandler |
189 | 189 | { |
190 | - public function __construct($db) |
|
191 | - { |
|
192 | - parent::__construct($db, 'instruction_cat', 'InstructionCategory', 'cid', 'title'); |
|
193 | - } |
|
194 | - |
|
195 | - // Обновление даты обновления категории |
|
196 | - public function updateDateupdated($cid = 0, $time = null) |
|
197 | - { |
|
198 | - // Если не передали время |
|
199 | - $time = null === $time ? time() : (int)$time; |
|
200 | - // |
|
201 | - $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `cid` = %u', $this->table, $time, (int)$cid); |
|
202 | - // |
|
203 | - return $this->db->query($sql); |
|
204 | - } |
|
190 | + public function __construct($db) |
|
191 | + { |
|
192 | + parent::__construct($db, 'instruction_cat', 'InstructionCategory', 'cid', 'title'); |
|
193 | + } |
|
194 | + |
|
195 | + // Обновление даты обновления категории |
|
196 | + public function updateDateupdated($cid = 0, $time = null) |
|
197 | + { |
|
198 | + // Если не передали время |
|
199 | + $time = null === $time ? time() : (int)$time; |
|
200 | + // |
|
201 | + $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `cid` = %u', $this->table, $time, (int)$cid); |
|
202 | + // |
|
203 | + return $this->db->query($sql); |
|
204 | + } |
|
205 | 205 | } |
@@ -10,62 +10,62 @@ discard block |
||
10 | 10 | $xoops_url = parse_url(XOOPS_URL); |
11 | 11 | |
12 | 12 | $modversion = [ |
13 | - 'version' => 1.06, |
|
14 | - 'module_status' => 'Beta 3', |
|
15 | - 'release_date' => '2017/05/11', |
|
16 | - 'name' => _MI_INSTRUCTION_NAME, |
|
17 | - 'description' => _MI_INSTRUCTION_DESC, |
|
18 | - 'credits' => 'radio-hobby.org, www.shmel.org', |
|
19 | - 'author' => 'andrey3761, aerograf', |
|
20 | - 'nickname' => '', |
|
21 | - 'help' => 'page=help', |
|
22 | - 'license' => 'GNU GPL 2.0', |
|
23 | - 'license_url' => 'www.gnu.org/licenses/gpl-2.0.html/', |
|
24 | - 'official' => 0, |
|
25 | - 'image' => 'assets/images/slogo.png', |
|
26 | - 'dirname' => $moduleDirName, |
|
27 | - 'modicons16' => 'assets/images/icons/16', |
|
28 | - 'modicons32' => 'assets/images/icons/32', |
|
29 | - // О модуле |
|
30 | - 'module_website_url' => 'radio-hobby.org', |
|
31 | - 'module_website_name' => 'radio-hobby.org', |
|
13 | + 'version' => 1.06, |
|
14 | + 'module_status' => 'Beta 3', |
|
15 | + 'release_date' => '2017/05/11', |
|
16 | + 'name' => _MI_INSTRUCTION_NAME, |
|
17 | + 'description' => _MI_INSTRUCTION_DESC, |
|
18 | + 'credits' => 'radio-hobby.org, www.shmel.org', |
|
19 | + 'author' => 'andrey3761, aerograf', |
|
20 | + 'nickname' => '', |
|
21 | + 'help' => 'page=help', |
|
22 | + 'license' => 'GNU GPL 2.0', |
|
23 | + 'license_url' => 'www.gnu.org/licenses/gpl-2.0.html/', |
|
24 | + 'official' => 0, |
|
25 | + 'image' => 'assets/images/slogo.png', |
|
26 | + 'dirname' => $moduleDirName, |
|
27 | + 'modicons16' => 'assets/images/icons/16', |
|
28 | + 'modicons32' => 'assets/images/icons/32', |
|
29 | + // О модуле |
|
30 | + 'module_website_url' => 'radio-hobby.org', |
|
31 | + 'module_website_name' => 'radio-hobby.org', |
|
32 | 32 | |
33 | - 'author_website_url' => 'radio-hobby.org', |
|
34 | - 'author_website_name' => 'andrey3761', |
|
35 | - 'module_website_url' => 'www.xoops.org', |
|
36 | - 'module_website_name' => 'Support site', |
|
37 | - 'min_php' => '5.5', |
|
38 | - 'min_xoops' => '2.5.8', |
|
39 | - 'min_admin' => '1.1', |
|
40 | - 'min_db' => ['mysql' => '5.5'], |
|
41 | - // Файл базы данных |
|
42 | - 'sqlfile' => ['mysql' => 'sql/mysql.sql'], |
|
43 | - // Таблицы |
|
44 | - 'tables' => [ |
|
45 | - $moduleDirName . '_cat', |
|
46 | - $moduleDirName . '_instr', |
|
47 | - $moduleDirName . '_page' |
|
48 | - ], |
|
49 | - // Имеет админку |
|
50 | - 'hasAdmin' => 1, |
|
51 | - 'adminindex' => 'admin/index.php', |
|
52 | - 'adminmenu' => 'admin/menu.php', |
|
53 | - 'system_menu' => 1, |
|
54 | - // Меню |
|
55 | - 'hasMain' => 1, |
|
56 | - // Search |
|
57 | - 'hasSearch' => 1, |
|
58 | - 'search' => [ |
|
59 | - 'file' => 'include/search.inc.php', |
|
60 | - 'func' => $moduleDirName . '_search', |
|
61 | - ], |
|
33 | + 'author_website_url' => 'radio-hobby.org', |
|
34 | + 'author_website_name' => 'andrey3761', |
|
35 | + 'module_website_url' => 'www.xoops.org', |
|
36 | + 'module_website_name' => 'Support site', |
|
37 | + 'min_php' => '5.5', |
|
38 | + 'min_xoops' => '2.5.8', |
|
39 | + 'min_admin' => '1.1', |
|
40 | + 'min_db' => ['mysql' => '5.5'], |
|
41 | + // Файл базы данных |
|
42 | + 'sqlfile' => ['mysql' => 'sql/mysql.sql'], |
|
43 | + // Таблицы |
|
44 | + 'tables' => [ |
|
45 | + $moduleDirName . '_cat', |
|
46 | + $moduleDirName . '_instr', |
|
47 | + $moduleDirName . '_page' |
|
48 | + ], |
|
49 | + // Имеет админку |
|
50 | + 'hasAdmin' => 1, |
|
51 | + 'adminindex' => 'admin/index.php', |
|
52 | + 'adminmenu' => 'admin/menu.php', |
|
53 | + 'system_menu' => 1, |
|
54 | + // Меню |
|
55 | + 'hasMain' => 1, |
|
56 | + // Search |
|
57 | + 'hasSearch' => 1, |
|
58 | + 'search' => [ |
|
59 | + 'file' => 'include/search.inc.php', |
|
60 | + 'func' => $moduleDirName . '_search', |
|
61 | + ], |
|
62 | 62 | ]; |
63 | 63 | // Help files |
64 | 64 | $modversion['helpsection'] = [ |
65 | - ['name' => _MI_INSTRUCTION_HELP_OVERVIEW, 'link' => 'page=help'], |
|
66 | - ['name' => _MI_INSTRUCTION_DISCLAIMER, 'link' => 'page=disclaimer'], |
|
67 | - ['name' => _MI_INSTRUCTION_LICENSE, 'link' => 'page=license'], |
|
68 | - ['name' => _MI_INSTRUCTION_SUPPORT, 'link' => 'page=support'], |
|
65 | + ['name' => _MI_INSTRUCTION_HELP_OVERVIEW, 'link' => 'page=help'], |
|
66 | + ['name' => _MI_INSTRUCTION_DISCLAIMER, 'link' => 'page=disclaimer'], |
|
67 | + ['name' => _MI_INSTRUCTION_LICENSE, 'link' => 'page=license'], |
|
68 | + ['name' => _MI_INSTRUCTION_SUPPORT, 'link' => 'page=support'], |
|
69 | 69 | ]; |
70 | 70 | |
71 | 71 | // Comments |
@@ -78,144 +78,144 @@ discard block |
||
78 | 78 | |
79 | 79 | // Templates |
80 | 80 | $modversion['templates'] = [ |
81 | - [ |
|
82 | - 'file' => 'admin/' . $moduleDirName . '_admin_index.tpl', |
|
83 | - 'description' => '' |
|
84 | - ], |
|
85 | - [ |
|
86 | - 'file' => 'admin/' . $moduleDirName . '_admin_cat.tpl', |
|
87 | - 'description' => '' |
|
88 | - ], |
|
89 | - [ |
|
90 | - 'file' => 'admin/' . $moduleDirName . '_admin_editcat.tpl', |
|
91 | - 'description' => '' |
|
92 | - ], |
|
93 | - [ |
|
94 | - 'file' => 'admin/' . $moduleDirName . '_admin_savecat.tpl', |
|
95 | - 'description' => '' |
|
96 | - ], |
|
97 | - [ |
|
98 | - 'file' => 'admin/' . $moduleDirName . '_admin_viewcat.tpl', |
|
99 | - 'description' => '' |
|
100 | - ], |
|
101 | - [ |
|
102 | - 'file' => 'admin/' . $moduleDirName . '_admin_instr.tpl', |
|
103 | - 'description' => '' |
|
104 | - ], |
|
105 | - [ |
|
106 | - 'file' => 'admin/' . $moduleDirName . '_admin_editinstr.tpl', |
|
107 | - 'description' => '' |
|
108 | - ], |
|
109 | - [ |
|
110 | - 'file' => 'admin/' . $moduleDirName . '_admin_saveinstr.tpl', |
|
111 | - 'description' => '' |
|
112 | - ], |
|
113 | - [ |
|
114 | - 'file' => 'admin/' . $moduleDirName . '_admin_viewinstr.tpl', |
|
115 | - 'description' => '' |
|
116 | - ], |
|
117 | - [ |
|
118 | - 'file' => 'admin/' . $moduleDirName . '_admin_editpage.tpl', |
|
119 | - 'description' => '' |
|
120 | - ], |
|
121 | - [ |
|
122 | - 'file' => 'admin/' . $moduleDirName . '_admin_savepage.tpl', |
|
123 | - 'description' => '' |
|
124 | - ], |
|
125 | - [ |
|
126 | - 'file' => 'admin/' . $moduleDirName . '_admin_perm.tpl', |
|
127 | - 'description' => '' |
|
128 | - ], |
|
129 | - [ |
|
130 | - 'file' => 'admin/' . $moduleDirName . '_admin_about.tpl', |
|
131 | - 'description' => '' |
|
132 | - ], |
|
133 | - [ |
|
134 | - 'file' => $moduleDirName . '_page.tpl', |
|
135 | - 'description' => '' |
|
136 | - ], |
|
137 | - [ |
|
138 | - 'file' => $moduleDirName . '_instr.tpl', |
|
139 | - 'description' => '' |
|
140 | - ], |
|
141 | - [ |
|
142 | - 'file' => $moduleDirName . '_index.tpl', |
|
143 | - 'description' => '' |
|
144 | - ], |
|
145 | - [ |
|
146 | - 'file' => $moduleDirName . '_editpage.tpl', |
|
147 | - 'description' => '' |
|
148 | - ], |
|
149 | - [ |
|
150 | - 'file' => $moduleDirName . '_savepage.tpl', |
|
151 | - 'description' => '' |
|
152 | - ], |
|
81 | + [ |
|
82 | + 'file' => 'admin/' . $moduleDirName . '_admin_index.tpl', |
|
83 | + 'description' => '' |
|
84 | + ], |
|
85 | + [ |
|
86 | + 'file' => 'admin/' . $moduleDirName . '_admin_cat.tpl', |
|
87 | + 'description' => '' |
|
88 | + ], |
|
89 | + [ |
|
90 | + 'file' => 'admin/' . $moduleDirName . '_admin_editcat.tpl', |
|
91 | + 'description' => '' |
|
92 | + ], |
|
93 | + [ |
|
94 | + 'file' => 'admin/' . $moduleDirName . '_admin_savecat.tpl', |
|
95 | + 'description' => '' |
|
96 | + ], |
|
97 | + [ |
|
98 | + 'file' => 'admin/' . $moduleDirName . '_admin_viewcat.tpl', |
|
99 | + 'description' => '' |
|
100 | + ], |
|
101 | + [ |
|
102 | + 'file' => 'admin/' . $moduleDirName . '_admin_instr.tpl', |
|
103 | + 'description' => '' |
|
104 | + ], |
|
105 | + [ |
|
106 | + 'file' => 'admin/' . $moduleDirName . '_admin_editinstr.tpl', |
|
107 | + 'description' => '' |
|
108 | + ], |
|
109 | + [ |
|
110 | + 'file' => 'admin/' . $moduleDirName . '_admin_saveinstr.tpl', |
|
111 | + 'description' => '' |
|
112 | + ], |
|
113 | + [ |
|
114 | + 'file' => 'admin/' . $moduleDirName . '_admin_viewinstr.tpl', |
|
115 | + 'description' => '' |
|
116 | + ], |
|
117 | + [ |
|
118 | + 'file' => 'admin/' . $moduleDirName . '_admin_editpage.tpl', |
|
119 | + 'description' => '' |
|
120 | + ], |
|
121 | + [ |
|
122 | + 'file' => 'admin/' . $moduleDirName . '_admin_savepage.tpl', |
|
123 | + 'description' => '' |
|
124 | + ], |
|
125 | + [ |
|
126 | + 'file' => 'admin/' . $moduleDirName . '_admin_perm.tpl', |
|
127 | + 'description' => '' |
|
128 | + ], |
|
129 | + [ |
|
130 | + 'file' => 'admin/' . $moduleDirName . '_admin_about.tpl', |
|
131 | + 'description' => '' |
|
132 | + ], |
|
133 | + [ |
|
134 | + 'file' => $moduleDirName . '_page.tpl', |
|
135 | + 'description' => '' |
|
136 | + ], |
|
137 | + [ |
|
138 | + 'file' => $moduleDirName . '_instr.tpl', |
|
139 | + 'description' => '' |
|
140 | + ], |
|
141 | + [ |
|
142 | + 'file' => $moduleDirName . '_index.tpl', |
|
143 | + 'description' => '' |
|
144 | + ], |
|
145 | + [ |
|
146 | + 'file' => $moduleDirName . '_editpage.tpl', |
|
147 | + 'description' => '' |
|
148 | + ], |
|
149 | + [ |
|
150 | + 'file' => $moduleDirName . '_savepage.tpl', |
|
151 | + 'description' => '' |
|
152 | + ], |
|
153 | 153 | ]; |
154 | 154 | // Конфигурация |
155 | 155 | $modversion['config'][] = [ |
156 | - 'name' => 'form_options', |
|
157 | - 'title' => '_MI_INSTRUCTION_FORM_OPTIONS', |
|
158 | - 'description' => '_MI_INSTRUCTION_FORM_OPTIONS_DESC', |
|
159 | - 'formtype' => 'select', |
|
160 | - 'valuetype' => 'text', |
|
161 | - 'default' => 'dhtml', |
|
162 | - 'options' => array_flip($editorHandler->getList()) |
|
156 | + 'name' => 'form_options', |
|
157 | + 'title' => '_MI_INSTRUCTION_FORM_OPTIONS', |
|
158 | + 'description' => '_MI_INSTRUCTION_FORM_OPTIONS_DESC', |
|
159 | + 'formtype' => 'select', |
|
160 | + 'valuetype' => 'text', |
|
161 | + 'default' => 'dhtml', |
|
162 | + 'options' => array_flip($editorHandler->getList()) |
|
163 | 163 | ]; |
164 | 164 | $modversion['config'][] = [ |
165 | - 'name' => 'perpageadmin', |
|
166 | - 'title' => '_MI_INSTRUCTION_PERPAGEADMIN', |
|
167 | - 'description' => '_MI_INSTRUCTION_PERPAGEADMINDSC', |
|
168 | - 'formtype' => 'textbox', |
|
169 | - 'valuetype' => 'int', |
|
170 | - 'default' => 20 |
|
165 | + 'name' => 'perpageadmin', |
|
166 | + 'title' => '_MI_INSTRUCTION_PERPAGEADMIN', |
|
167 | + 'description' => '_MI_INSTRUCTION_PERPAGEADMINDSC', |
|
168 | + 'formtype' => 'textbox', |
|
169 | + 'valuetype' => 'int', |
|
170 | + 'default' => 20 |
|
171 | 171 | ]; |
172 | 172 | $modversion['config'][] = [ |
173 | - 'name' => 'perpagemain', |
|
174 | - 'title' => '_MI_INSTRUCTION_PERPAGEMAIN', |
|
175 | - 'description' => '_MI_INSTRUCTION_PERPAGEMAINDSC', |
|
176 | - 'formtype' => 'textbox', |
|
177 | - 'valuetype' => 'int', |
|
178 | - 'default' => 20 |
|
173 | + 'name' => 'perpagemain', |
|
174 | + 'title' => '_MI_INSTRUCTION_PERPAGEMAIN', |
|
175 | + 'description' => '_MI_INSTRUCTION_PERPAGEMAINDSC', |
|
176 | + 'formtype' => 'textbox', |
|
177 | + 'valuetype' => 'int', |
|
178 | + 'default' => 20 |
|
179 | 179 | ]; |
180 | 180 | // Теги |
181 | 181 | $modversion['config'][] = [ |
182 | - 'name' => 'usetag', |
|
183 | - 'title' => '_MI_INSTRUCTION_USETAG', |
|
184 | - 'description' => '_MI_INSTRUCTION_USETAGDSC', |
|
185 | - 'formtype' => 'yesno', |
|
186 | - 'valuetype' => 'int', |
|
187 | - 'default' => 0 |
|
182 | + 'name' => 'usetag', |
|
183 | + 'title' => '_MI_INSTRUCTION_USETAG', |
|
184 | + 'description' => '_MI_INSTRUCTION_USETAGDSC', |
|
185 | + 'formtype' => 'yesno', |
|
186 | + 'valuetype' => 'int', |
|
187 | + 'default' => 0 |
|
188 | 188 | ]; |
189 | 189 | // Оценки |
190 | 190 | $modversion['config'][] = [ |
191 | - 'name' => 'userat', |
|
192 | - 'title' => '_MI_INSTRUCTION_USERAT', |
|
193 | - 'description' => '_MI_INSTRUCTION_USERATDSC', |
|
194 | - 'formtype' => 'yesno', |
|
195 | - 'valuetype' => 'int', |
|
196 | - 'default' => 0 |
|
191 | + 'name' => 'userat', |
|
192 | + 'title' => '_MI_INSTRUCTION_USERAT', |
|
193 | + 'description' => '_MI_INSTRUCTION_USERATDSC', |
|
194 | + 'formtype' => 'yesno', |
|
195 | + 'valuetype' => 'int', |
|
196 | + 'default' => 0 |
|
197 | 197 | ]; |
198 | 198 | |
199 | 199 | // Блоки |
200 | 200 | // Блок последних страниц |
201 | 201 | $modversion['blocks'][] = [ |
202 | - 'file' => 'instr_lastpage.php', |
|
203 | - 'name' => _MI_INSTR_BLOCK_LASTPAGE, |
|
204 | - 'description' => _MI_INSTR_BLOCK_LASTPAGE_DESC, |
|
205 | - 'show_func' => 'b_instr_lastpage_show', |
|
206 | - 'edit_func' => 'b_instr_lastpage_edit', |
|
207 | - 'options' => '10|20', |
|
208 | - 'template' => $moduleDirName . '_block_lastpage.tpl' |
|
202 | + 'file' => 'instr_lastpage.php', |
|
203 | + 'name' => _MI_INSTR_BLOCK_LASTPAGE, |
|
204 | + 'description' => _MI_INSTR_BLOCK_LASTPAGE_DESC, |
|
205 | + 'show_func' => 'b_instr_lastpage_show', |
|
206 | + 'edit_func' => 'b_instr_lastpage_edit', |
|
207 | + 'options' => '10|20', |
|
208 | + 'template' => $moduleDirName . '_block_lastpage.tpl' |
|
209 | 209 | ]; |
210 | 210 | // Блок последних инструкций |
211 | 211 | $modversion['blocks'][] = [ |
212 | - 'file' => 'instr_lastinstr.php', |
|
213 | - 'name' => _MI_INSTR_BLOCK_LASTINSTR, |
|
214 | - 'description' => _MI_INSTR_BLOCK_LASTINSTR_DESC, |
|
215 | - 'show_func' => 'b_instr_lastinstr_show', |
|
216 | - 'edit_func' => 'b_instr_lastinstr_edit', |
|
217 | - 'options' => '10|20', |
|
218 | - 'template' => $moduleDirName . '_block_lastinstr.tpl' |
|
212 | + 'file' => 'instr_lastinstr.php', |
|
213 | + 'name' => _MI_INSTR_BLOCK_LASTINSTR, |
|
214 | + 'description' => _MI_INSTR_BLOCK_LASTINSTR_DESC, |
|
215 | + 'show_func' => 'b_instr_lastinstr_show', |
|
216 | + 'edit_func' => 'b_instr_lastinstr_edit', |
|
217 | + 'options' => '10|20', |
|
218 | + 'template' => $moduleDirName . '_block_lastinstr.tpl' |
|
219 | 219 | ]; |
220 | 220 | |
221 | 221 | // Notification |