@@ -39,6 +39,11 @@ |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | // Редактор |
42 | + |
|
43 | + /** |
|
44 | + * @param string $caption |
|
45 | + * @param string $name |
|
46 | + */ |
|
42 | 47 | public static function getWysiwygForm($caption, $name, $value = '') |
43 | 48 | { |
44 | 49 | $editor = false; |
@@ -13,63 +13,63 @@ |
||
13 | 13 | */ |
14 | 14 | class InstructionUtility |
15 | 15 | { |
16 | - use VersionChecks; //checkVerXoops, checkVerPhp Traits |
|
16 | + use VersionChecks; //checkVerXoops, checkVerPhp Traits |
|
17 | 17 | |
18 | - use ServerStats; // getServerStats Trait |
|
18 | + use ServerStats; // getServerStats Trait |
|
19 | 19 | |
20 | - use FilesManagement; // Files Management Trait |
|
20 | + use FilesManagement; // Files Management Trait |
|
21 | 21 | |
22 | - // Права |
|
23 | - public static function getItemIds($permtype = 'instruction_view') |
|
24 | - { |
|
25 | - //global $xoopsUser; |
|
26 | - static $permissions = []; |
|
27 | - // Если есть в статике |
|
28 | - if (is_array($permissions) && array_key_exists($permtype, $permissions)) { |
|
29 | - return $permissions[$permtype]; |
|
30 | - } |
|
31 | - // Находим из базы |
|
32 | - $moduleHandler = xoops_getHandler('module'); |
|
33 | - $instrModule = $moduleHandler->getByDirname('instruction'); |
|
34 | - $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
35 | - $gpermHandler = xoops_getHandler('groupperm'); |
|
36 | - $categories = $gpermHandler->getItemIds($permtype, $groups, $instrModule->getVar('mid')); |
|
37 | - $permissions[$permtype] = $categories; |
|
38 | - return $categories; |
|
39 | - } |
|
22 | + // Права |
|
23 | + public static function getItemIds($permtype = 'instruction_view') |
|
24 | + { |
|
25 | + //global $xoopsUser; |
|
26 | + static $permissions = []; |
|
27 | + // Если есть в статике |
|
28 | + if (is_array($permissions) && array_key_exists($permtype, $permissions)) { |
|
29 | + return $permissions[$permtype]; |
|
30 | + } |
|
31 | + // Находим из базы |
|
32 | + $moduleHandler = xoops_getHandler('module'); |
|
33 | + $instrModule = $moduleHandler->getByDirname('instruction'); |
|
34 | + $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
35 | + $gpermHandler = xoops_getHandler('groupperm'); |
|
36 | + $categories = $gpermHandler->getItemIds($permtype, $groups, $instrModule->getVar('mid')); |
|
37 | + $permissions[$permtype] = $categories; |
|
38 | + return $categories; |
|
39 | + } |
|
40 | 40 | |
41 | - // Редактор |
|
42 | - public static function getWysiwygForm($caption, $name, $value = '') |
|
43 | - { |
|
44 | - $editor = false; |
|
45 | - $editor_configs = []; |
|
46 | - $editor_configs['name'] = $name; |
|
47 | - $editor_configs['value'] = $value; |
|
48 | - $editor_configs['rows'] = 35; |
|
49 | - $editor_configs['cols'] = 60; |
|
50 | - $editor_configs['width'] = '100%'; |
|
51 | - $editor_configs['height'] = '350px'; |
|
52 | - $editor_configs['editor'] = strtolower(xoops_getModuleOption('form_options', 'instruction')); |
|
41 | + // Редактор |
|
42 | + public static function getWysiwygForm($caption, $name, $value = '') |
|
43 | + { |
|
44 | + $editor = false; |
|
45 | + $editor_configs = []; |
|
46 | + $editor_configs['name'] = $name; |
|
47 | + $editor_configs['value'] = $value; |
|
48 | + $editor_configs['rows'] = 35; |
|
49 | + $editor_configs['cols'] = 60; |
|
50 | + $editor_configs['width'] = '100%'; |
|
51 | + $editor_configs['height'] = '350px'; |
|
52 | + $editor_configs['editor'] = strtolower(xoops_getModuleOption('form_options', 'instruction')); |
|
53 | 53 | |
54 | - $editor = new XoopsFormEditor($caption, $name, $editor_configs); |
|
55 | - return $editor; |
|
56 | - } |
|
54 | + $editor = new XoopsFormEditor($caption, $name, $editor_configs); |
|
55 | + return $editor; |
|
56 | + } |
|
57 | 57 | |
58 | - // Получение значения переменной, переданной через GET или POST запрос |
|
59 | - public static function cleanVars(&$global, $key, $default = '', $type = 'int') |
|
60 | - { |
|
61 | - switch ($type) { |
|
62 | - case 'string': |
|
63 | - $ret = isset($global[$key]) ? $global[$key] : $default; |
|
64 | - break; |
|
65 | - case 'int': |
|
66 | - default: |
|
67 | - $ret = isset($global[$key]) ? (int)$global[$key] : (int)$default; |
|
68 | - break; |
|
69 | - } |
|
70 | - if (false === $ret) { |
|
71 | - return $default; |
|
72 | - } |
|
73 | - return $ret; |
|
74 | - } |
|
58 | + // Получение значения переменной, переданной через GET или POST запрос |
|
59 | + public static function cleanVars(&$global, $key, $default = '', $type = 'int') |
|
60 | + { |
|
61 | + switch ($type) { |
|
62 | + case 'string': |
|
63 | + $ret = isset($global[$key]) ? $global[$key] : $default; |
|
64 | + break; |
|
65 | + case 'int': |
|
66 | + default: |
|
67 | + $ret = isset($global[$key]) ? (int)$global[$key] : (int)$default; |
|
68 | + break; |
|
69 | + } |
|
70 | + if (false === $ret) { |
|
71 | + return $default; |
|
72 | + } |
|
73 | + return $ret; |
|
74 | + } |
|
75 | 75 | } |
@@ -5,12 +5,12 @@ |
||
5 | 5 | // Функция вызывается при добавлении комментария |
6 | 6 | function instruction_com_update($pageid, $total_num) |
7 | 7 | { |
8 | - $db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
9 | - $sql = 'UPDATE ' . $db->prefix('instruction_page') . ' SET comments = ' . $total_num . ' WHERE pageid = ' . $pageid; |
|
10 | - $db->query($sql); |
|
8 | + $db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
9 | + $sql = 'UPDATE ' . $db->prefix('instruction_page') . ' SET comments = ' . $total_num . ' WHERE pageid = ' . $pageid; |
|
10 | + $db->query($sql); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | function instruction_com_approve(&$comment) |
14 | 14 | { |
15 | - // notification mail here |
|
15 | + // notification mail here |
|
16 | 16 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | // Типы страницы |
3 | 3 | return [ |
4 | - 0 => _AM_INSTR_PT_0, |
|
5 | - 1 => _AM_INSTR_PT_1 |
|
4 | + 0 => _AM_INSTR_PT_0, |
|
5 | + 1 => _AM_INSTR_PT_1 |
|
6 | 6 | ]; |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | */ |
19 | 19 | |
20 | 20 | if (!defined('INSTRUCTION_MODULE_PATH')) { |
21 | - define('INSTRUCTION_DIRNAME', basename(dirname(__DIR__))); |
|
22 | - define('INSTRUCTION_URL', XOOPS_URL . '/modules/' . INSTRUCTION_DIRNAME); |
|
23 | - define('INSTRUCTION_IMAGE_URL', INSTRUCTION_URL . '/assets/images/'); |
|
24 | - define('INSTRUCTION_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . INSTRUCTION_DIRNAME); |
|
25 | - define('INSTRUCTION_IMAGE_PATH', INSTRUCTION_ROOT_PATH . '/assets/images'); |
|
26 | - define('INSTRUCTION_ADMIN_URL', INSTRUCTION_URL . '/admin/'); |
|
27 | - define('INSTRUCTION_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . INSTRUCTION_DIRNAME); |
|
28 | - define('INSTRUCTION_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . INSTRUCTION_DIRNAME); |
|
21 | + define('INSTRUCTION_DIRNAME', basename(dirname(__DIR__))); |
|
22 | + define('INSTRUCTION_URL', XOOPS_URL . '/modules/' . INSTRUCTION_DIRNAME); |
|
23 | + define('INSTRUCTION_IMAGE_URL', INSTRUCTION_URL . '/assets/images/'); |
|
24 | + define('INSTRUCTION_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . INSTRUCTION_DIRNAME); |
|
25 | + define('INSTRUCTION_IMAGE_PATH', INSTRUCTION_ROOT_PATH . '/assets/images'); |
|
26 | + define('INSTRUCTION_ADMIN_URL', INSTRUCTION_URL . '/admin/'); |
|
27 | + define('INSTRUCTION_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . INSTRUCTION_DIRNAME); |
|
28 | + define('INSTRUCTION_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . INSTRUCTION_DIRNAME); |
|
29 | 29 | } |
30 | 30 | xoops_loadLanguage('common', INSTRUCTION_DIRNAME); |
31 | 31 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | $instruction->loadLanguage('common'); |
47 | 47 | |
48 | 48 | if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) { |
49 | - require_once $GLOBALS['xoops']->path('class/template.php'); |
|
50 | - $xoopsTpl = new XoopsTpl(); |
|
49 | + require_once $GLOBALS['xoops']->path('class/template.php'); |
|
50 | + $xoopsTpl = new XoopsTpl(); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | $moduleDirName = basename(dirname(__DIR__)); |
@@ -3,66 +3,66 @@ |
||
3 | 3 | // Информация об теге |
4 | 4 | function instruction_tag_iteminfo(&$items) |
5 | 5 | { |
6 | - if (empty($items) || !is_array($items)) { |
|
7 | - return false; |
|
8 | - } |
|
6 | + if (empty($items) || !is_array($items)) { |
|
7 | + return false; |
|
8 | + } |
|
9 | 9 | |
10 | - $items_id = []; |
|
11 | - foreach (array_keys($items) as $cat_id) { |
|
12 | - foreach (array_keys($items[$cat_id]) as $item_id) { |
|
13 | - $items_id[] = (int)$item_id; |
|
14 | - } |
|
15 | - } |
|
10 | + $items_id = []; |
|
11 | + foreach (array_keys($items) as $cat_id) { |
|
12 | + foreach (array_keys($items[$cat_id]) as $item_id) { |
|
13 | + $items_id[] = (int)$item_id; |
|
14 | + } |
|
15 | + } |
|
16 | 16 | |
17 | - $itemHandler = xoops_getModuleHandler('instruction', 'instruction'); |
|
18 | - $items_obj = $itemHandler->getObjects(new Criteria('instrid', '(' . implode(', ', $items_id) . ')', 'IN'), true); |
|
17 | + $itemHandler = xoops_getModuleHandler('instruction', 'instruction'); |
|
18 | + $items_obj = $itemHandler->getObjects(new Criteria('instrid', '(' . implode(', ', $items_id) . ')', 'IN'), true); |
|
19 | 19 | |
20 | - foreach (array_keys($items) as $cat_id) { |
|
21 | - foreach (array_keys($items[$cat_id]) as $item_id) { |
|
22 | - if (isset($items_obj[$item_id])) { |
|
23 | - $item_obj = $items_obj[$item_id]; |
|
24 | - $items[$cat_id][$item_id] = [ |
|
25 | - 'title' => $item_obj->getVar('title'), |
|
26 | - 'uid' => $item_obj->getVar('uid'), |
|
27 | - 'link' => "instr.php?id={$item_id}", |
|
28 | - 'time' => $item_obj->getVar('datecreated'), |
|
29 | - 'tags' => '', |
|
30 | - 'content' => '', |
|
31 | - ]; |
|
32 | - } |
|
33 | - } |
|
34 | - } |
|
35 | - unset($items_obj); |
|
20 | + foreach (array_keys($items) as $cat_id) { |
|
21 | + foreach (array_keys($items[$cat_id]) as $item_id) { |
|
22 | + if (isset($items_obj[$item_id])) { |
|
23 | + $item_obj = $items_obj[$item_id]; |
|
24 | + $items[$cat_id][$item_id] = [ |
|
25 | + 'title' => $item_obj->getVar('title'), |
|
26 | + 'uid' => $item_obj->getVar('uid'), |
|
27 | + 'link' => "instr.php?id={$item_id}", |
|
28 | + 'time' => $item_obj->getVar('datecreated'), |
|
29 | + 'tags' => '', |
|
30 | + 'content' => '', |
|
31 | + ]; |
|
32 | + } |
|
33 | + } |
|
34 | + } |
|
35 | + unset($items_obj); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | // Синхронизация тегов |
39 | 39 | function instruction_tag_synchronization($mid) |
40 | 40 | { |
41 | - $itemHandler = xoops_getModuleHandler('instruction', 'instruction'); |
|
42 | - $linkHandler = xoops_getModuleHandler('link', 'tag'); |
|
41 | + $itemHandler = xoops_getModuleHandler('instruction', 'instruction'); |
|
42 | + $linkHandler = xoops_getModuleHandler('link', 'tag'); |
|
43 | 43 | |
44 | - /* clear tag-item links */ |
|
45 | - if (version_compare(mysqli_get_server_info(), '4.1.0', 'ge')): |
|
46 | - $sql = " DELETE FROM {$linkHandler->table}" |
|
47 | - . ' WHERE ' |
|
48 | - . " tag_modid = {$mid}" |
|
49 | - . ' AND ' |
|
50 | - . ' ( tag_itemid NOT IN ' |
|
51 | - . " ( SELECT DISTINCT {$itemHandler->keyName} " |
|
52 | - . " FROM {$itemHandler->table} " |
|
53 | - . " WHERE {$itemHandler->table}.status > 0" |
|
54 | - . ' ) ' |
|
55 | - . ' )'; else: |
|
56 | - $sql = " DELETE {$linkHandler->table} FROM {$linkHandler->table}" |
|
57 | - . " LEFT JOIN {$itemHandler->table} AS aa ON {$linkHandler->table}.tag_itemid = aa.{$itemHandler->keyName} " |
|
58 | - . ' WHERE ' |
|
59 | - . " tag_modid = {$mid}" |
|
60 | - . ' AND ' |
|
61 | - . " ( aa.{$itemHandler->keyName} IS NULL" |
|
62 | - . ' OR aa.status < 1' |
|
63 | - . ' )'; |
|
64 | - endif; |
|
65 | - if (!$result = $linkHandler->db->queryF($sql)) { |
|
66 | - //xoops_error($linkHandler->db->error()); |
|
67 | - } |
|
44 | + /* clear tag-item links */ |
|
45 | + if (version_compare(mysqli_get_server_info(), '4.1.0', 'ge')): |
|
46 | + $sql = " DELETE FROM {$linkHandler->table}" |
|
47 | + . ' WHERE ' |
|
48 | + . " tag_modid = {$mid}" |
|
49 | + . ' AND ' |
|
50 | + . ' ( tag_itemid NOT IN ' |
|
51 | + . " ( SELECT DISTINCT {$itemHandler->keyName} " |
|
52 | + . " FROM {$itemHandler->table} " |
|
53 | + . " WHERE {$itemHandler->table}.status > 0" |
|
54 | + . ' ) ' |
|
55 | + . ' )'; else: |
|
56 | + $sql = " DELETE {$linkHandler->table} FROM {$linkHandler->table}" |
|
57 | + . " LEFT JOIN {$itemHandler->table} AS aa ON {$linkHandler->table}.tag_itemid = aa.{$itemHandler->keyName} " |
|
58 | + . ' WHERE ' |
|
59 | + . " tag_modid = {$mid}" |
|
60 | + . ' AND ' |
|
61 | + . " ( aa.{$itemHandler->keyName} IS NULL" |
|
62 | + . ' OR aa.status < 1' |
|
63 | + . ' )'; |
|
64 | + endif; |
|
65 | + if (!$result = $linkHandler->db->queryF($sql)) { |
|
66 | + //xoops_error($linkHandler->db->error()); |
|
67 | + } |
|
68 | 68 | } |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | $criteria->add(new Criteria('pageid ', $pageid)); |
29 | 29 | $criteria->add(new Criteria('status ', '0', '>')); |
30 | 30 | if (0 == $inspageHandler->getCount($criteria)) { |
31 | - redirect_header('index.php', 3, _MD_INSTRUCTION_PAGENOTEXIST); |
|
32 | - exit(); |
|
31 | + redirect_header('index.php', 3, _MD_INSTRUCTION_PAGENOTEXIST); |
|
32 | + exit(); |
|
33 | 33 | } |
34 | 34 | // |
35 | 35 | unset($criteria); |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | |
42 | 42 | // Если админ и ссылка на отключение кэша |
43 | 43 | if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin() && $nocache) { |
44 | - // Отключаем кэш |
|
45 | - $GLOBALS['xoopsConfig']['module_cache'][$GLOBALS['xoopsModule']->getVar('mid')] = 0; |
|
44 | + // Отключаем кэш |
|
45 | + $GLOBALS['xoopsConfig']['module_cache'][$GLOBALS['xoopsModule']->getVar('mid')] = 0; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | // Задание тайтла |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | // Права на просмотр инструкции |
60 | 60 | $categories = InstructionUtility::getItemIds(); |
61 | 61 | if (!in_array($objInsinstr->getVar('cid'), $categories)) { |
62 | - redirect_header(XOOPS_URL . '/modules/' . $moduleDirName . '/', 3, _NOPERM); |
|
63 | - exit(); |
|
62 | + redirect_header(XOOPS_URL . '/modules/' . $moduleDirName . '/', 3, _NOPERM); |
|
63 | + exit(); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | // Массив данных о странице |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | $footnote = $objInspage->getVar('footnote'); |
78 | 78 | // Если есть сноски |
79 | 79 | if ($footnote) { |
80 | - $pages['footnotes'] = explode('|', $objInspage->getVar('footnote')); |
|
80 | + $pages['footnotes'] = explode('|', $objInspage->getVar('footnote')); |
|
81 | 81 | } else { |
82 | - $pages['footnotes'] = false; |
|
82 | + $pages['footnotes'] = false; |
|
83 | 83 | } |
84 | 84 | // Мета-теги ключевых слов |
85 | 85 | $pages['keywords'] = $objInspage->getVar('keywords'); |
@@ -88,39 +88,39 @@ discard block |
||
88 | 88 | // |
89 | 89 | // Если админ, рисуем админлинк |
90 | 90 | if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid())) { |
91 | - $pages['adminlink'] = ' <a href="' |
|
92 | - . XOOPS_URL |
|
93 | - . '/modules/' |
|
94 | - . $moduleDirName |
|
95 | - . '/admin/instr.php?op=editpage&pageid=' |
|
96 | - . $pages['pageid'] |
|
97 | - . '"><img style="width:16px;" src="./assets/icons/edit_mini.png" alt=' |
|
98 | - . _EDIT |
|
99 | - . ' title=' |
|
100 | - . _EDIT |
|
101 | - . '></a> <a href="' |
|
102 | - . XOOPS_URL |
|
103 | - . '/modules/' |
|
104 | - . $moduleDirName |
|
105 | - . '/admin/instr.php?op=delpage&pageid=' |
|
106 | - . $pages['pageid'] |
|
107 | - . '"><img style="width:16px;" src="./assets/icons/delete_mini.png" alt=' |
|
108 | - . _DELETE |
|
109 | - . ' title=' |
|
110 | - . _DELETE |
|
111 | - . '></a> '; |
|
91 | + $pages['adminlink'] = ' <a href="' |
|
92 | + . XOOPS_URL |
|
93 | + . '/modules/' |
|
94 | + . $moduleDirName |
|
95 | + . '/admin/instr.php?op=editpage&pageid=' |
|
96 | + . $pages['pageid'] |
|
97 | + . '"><img style="width:16px;" src="./assets/icons/edit_mini.png" alt=' |
|
98 | + . _EDIT |
|
99 | + . ' title=' |
|
100 | + . _EDIT |
|
101 | + . '></a> <a href="' |
|
102 | + . XOOPS_URL |
|
103 | + . '/modules/' |
|
104 | + . $moduleDirName |
|
105 | + . '/admin/instr.php?op=delpage&pageid=' |
|
106 | + . $pages['pageid'] |
|
107 | + . '"><img style="width:16px;" src="./assets/icons/delete_mini.png" alt=' |
|
108 | + . _DELETE |
|
109 | + . ' title=' |
|
110 | + . _DELETE |
|
111 | + . '></a> '; |
|
112 | 112 | } else { |
113 | - $pages['adminlink'] = ' '; |
|
114 | - // Если можно редактировать |
|
115 | - if ($gpermHandler->checkRight($moduleDirName . '_edit', $objInsinstr->getVar('cid'), $groups, $GLOBALS['xoopsModule']->getVar('mid'))) { |
|
116 | - $pages['adminlink'] .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/submit.php?op=editpage&pageid=' . $pages['pageid'] . '"><img style="width:16px;" src="./assets/icons/edit_mini.png" alt=' . _EDIT . ' title=' . _EDIT . '></a>'; |
|
117 | - } |
|
118 | - |
|
119 | - $pages['adminlink'] .= ' '; |
|
120 | - // Если нет админлика |
|
121 | - if ('[ ]' == $pages['adminlink']) { |
|
122 | - $pages['adminlink'] = ''; |
|
123 | - } |
|
113 | + $pages['adminlink'] = ' '; |
|
114 | + // Если можно редактировать |
|
115 | + if ($gpermHandler->checkRight($moduleDirName . '_edit', $objInsinstr->getVar('cid'), $groups, $GLOBALS['xoopsModule']->getVar('mid'))) { |
|
116 | + $pages['adminlink'] .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/submit.php?op=editpage&pageid=' . $pages['pageid'] . '"><img style="width:16px;" src="./assets/icons/edit_mini.png" alt=' . _EDIT . ' title=' . _EDIT . '></a>'; |
|
117 | + } |
|
118 | + |
|
119 | + $pages['adminlink'] .= ' '; |
|
120 | + // Если нет админлика |
|
121 | + if ('[ ]' == $pages['adminlink']) { |
|
122 | + $pages['adminlink'] = ''; |
|
123 | + } |
|
124 | 124 | } |
125 | 125 | // Выводим в шаблон |
126 | 126 | $GLOBALS['xoopsTpl']->assign('insPage', $pages); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $nav_parent_id = array_reverse($nav_parent_id); |
140 | 140 | $navigation = '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/">' . $GLOBALS['xoopsModule']->name() . '</a> : '; |
141 | 141 | foreach (array_keys($nav_parent_id) as $i) { |
142 | - $navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/index.php?cid=' . $nav_parent_id[$i]->getVar('cid') . '">' . $nav_parent_id[$i]->getVar('title') . '</a> : '; |
|
142 | + $navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/index.php?cid=' . $nav_parent_id[$i]->getVar('cid') . '">' . $nav_parent_id[$i]->getVar('title') . '</a> : '; |
|
143 | 143 | } |
144 | 144 | $navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/index.php?cid=' . $objInscat->getVar('cid') . '">' . $objInscat->getVar('title') . '</a> : '; |
145 | 145 | $navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/instr.php?id=' . $pages['instrid'] . '">' . $objInsinstr->getVar('title') . '</a>'; |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | |
172 | 172 | // Рейтинг |
173 | 173 | if (xoops_getModuleOption('userat', 'instruction')) { |
174 | - $xoopsTpl->assign('insUserat', true); |
|
174 | + $xoopsTpl->assign('insUserat', true); |
|
175 | 175 | } else { |
176 | - $xoopsTpl->assign('insUserat', false); |
|
176 | + $xoopsTpl->assign('insUserat', false); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | // Мета теги |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |