Completed
Push — master ( 382ca7...8138ff )
by Michael
02:05
created
class/PageHandler.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -12,60 +12,60 @@
 block discarded – undo
12 12
  */
13 13
 class PageHandler extends \XoopsPersistableObjectHandler
14 14
 {
15
-    /**
16
-     * @param null|mixed $db
17
-     */
18
-    public function __construct(\XoopsDatabase $db = null)
19
-    {
20
-        parent::__construct($db, 'instruction_page', Page::class, 'pageid', 'title');
21
-    }
15
+	/**
16
+	 * @param null|mixed $db
17
+	 */
18
+	public function __construct(\XoopsDatabase $db = null)
19
+	{
20
+		parent::__construct($db, 'instruction_page', Page::class, 'pageid', 'title');
21
+	}
22 22
 
23
-    /**
24
-     * Generate function for update user post
25
-     *
26
-     * @ Update user post count after send approve content
27
-     * @ Update user post count after change status content
28
-     * @ Update user post count after delete content
29
-     * @param $uid
30
-     * @param $status
31
-     * @param $action
32
-     */
33
-    public function updateposts($uid, $status, $action)
34
-    {
35
-        //
36
-        switch ($action) {
37
-            // Добавление страницы
38
-            case 'add':
39
-                if ($uid && $status) {
40
-                    $user          = new \XoopsUser($uid);
41
-                    $memberHandler = xoops_getHandler('member');
42
-                    // Добавялем +1 к комментам
43
-                    $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') + 1);
44
-                }
45
-                break;
46
-            // Удаление страницы
47
-            case 'delete':
48
-                if ($uid && $status) {
49
-                    $user          = new \XoopsUser($uid);
50
-                    $memberHandler = xoops_getHandler('member');
51
-                    // Декримент комментов
52
-                    //$user->setVar( 'posts', $user->getVar( 'posts' ) - 1 );
53
-                    // Сохраняем
54
-                    $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') - 1);
55
-                }
56
-                break;
23
+	/**
24
+	 * Generate function for update user post
25
+	 *
26
+	 * @ Update user post count after send approve content
27
+	 * @ Update user post count after change status content
28
+	 * @ Update user post count after delete content
29
+	 * @param $uid
30
+	 * @param $status
31
+	 * @param $action
32
+	 */
33
+	public function updateposts($uid, $status, $action)
34
+	{
35
+		//
36
+		switch ($action) {
37
+			// Добавление страницы
38
+			case 'add':
39
+				if ($uid && $status) {
40
+					$user          = new \XoopsUser($uid);
41
+					$memberHandler = xoops_getHandler('member');
42
+					// Добавялем +1 к комментам
43
+					$memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') + 1);
44
+				}
45
+				break;
46
+			// Удаление страницы
47
+			case 'delete':
48
+				if ($uid && $status) {
49
+					$user          = new \XoopsUser($uid);
50
+					$memberHandler = xoops_getHandler('member');
51
+					// Декримент комментов
52
+					//$user->setVar( 'posts', $user->getVar( 'posts' ) - 1 );
53
+					// Сохраняем
54
+					$memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') - 1);
55
+				}
56
+				break;
57 57
 
58
-            case 'status':
59
-                if ($uid) {
60
-                    $user          = new \XoopsUser($uid);
61
-                    $memberHandler = xoops_getHandler('member');
62
-                    if ($status) {
63
-                        $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') - 1);
64
-                    } else {
65
-                        $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') + 1);
66
-                    }
67
-                }
68
-                break;
69
-        }
70
-    }
58
+			case 'status':
59
+				if ($uid) {
60
+					$user          = new \XoopsUser($uid);
61
+					$memberHandler = xoops_getHandler('member');
62
+					if ($status) {
63
+						$memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') - 1);
64
+					} else {
65
+						$memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') + 1);
66
+					}
67
+				}
68
+				break;
69
+		}
70
+	}
71 71
 }
Please login to merge, or discard this patch.
include/comment_functions.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
  */
10 10
 function instruction_com_update($pageid, $total_num)
11 11
 {
12
-    $db  = XoopsDatabaseFactory::getDatabaseConnection();
13
-    $sql = 'UPDATE ' . $db->prefix('instruction_page') . ' SET comments = ' . $total_num . ' WHERE pageid  = ' . $pageid;
14
-    $db->query($sql);
12
+	$db  = XoopsDatabaseFactory::getDatabaseConnection();
13
+	$sql = 'UPDATE ' . $db->prefix('instruction_page') . ' SET comments = ' . $total_num . ' WHERE pageid  = ' . $pageid;
14
+	$db->query($sql);
15 15
 }
16 16
 
17 17
 /**
@@ -19,5 +19,5 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function instruction_com_approve(&$comment)
21 21
 {
22
-    // notification mail here
22
+	// notification mail here
23 23
 }
Please login to merge, or discard this patch.
include/config.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -23,57 +23,57 @@
 block discarded – undo
23 23
 $capsDirName   = strtoupper($moduleDirName);
24 24
 
25 25
 if (!defined($capsDirName . '_DIRNAME')) {
26
-    //if (!defined(constant($capsDirName . '_DIRNAME'))) {
27
-    define($capsDirName . '_DIRNAME', $GLOBALS['xoopsModule']->dirname());
28
-    define($capsDirName . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME'));
29
-    define($capsDirName . '_URL', XOOPS_URL . '/modules/' . constant($capsDirName . '_DIRNAME'));
30
-    define($capsDirName . '_ADMIN', constant($capsDirName . '_URL') . '/admin/index.php');
31
-    define($capsDirName . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME'));
32
-    define($capsDirName . '_AUTHOR_LOGOIMG', constant($capsDirName . '_URL') . '/assets/images/logoModule.png');
33
-    define($capsDirName . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash
34
-    define($capsDirName . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash
26
+	//if (!defined(constant($capsDirName . '_DIRNAME'))) {
27
+	define($capsDirName . '_DIRNAME', $GLOBALS['xoopsModule']->dirname());
28
+	define($capsDirName . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME'));
29
+	define($capsDirName . '_URL', XOOPS_URL . '/modules/' . constant($capsDirName . '_DIRNAME'));
30
+	define($capsDirName . '_ADMIN', constant($capsDirName . '_URL') . '/admin/index.php');
31
+	define($capsDirName . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME'));
32
+	define($capsDirName . '_AUTHOR_LOGOIMG', constant($capsDirName . '_URL') . '/assets/images/logoModule.png');
33
+	define($capsDirName . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash
34
+	define($capsDirName . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash
35 35
 }
36 36
 
37 37
 //Configurator
38 38
 return (object)[
39
-    'name'          => strtoupper($moduleDirName) . ' Module Configurator',
40
-    'paths'         => [
41
-        'dirname'    => $moduleDirName,
42
-        'admin'      => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin',
43
-        //        'path'       => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName,
44
-        //        'url'        => XOOPS_URL . '/modules/' . $moduleDirName,
45
-        'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName,
46
-        'uploadUrl'  => XOOPS_UPLOAD_URL . '/' . $moduleDirName,
47
-    ],
48
-    'uploadFolders' => [
49
-        constant($capsDirName . '_UPLOAD_PATH'),
50
-        //constant($capsDirName . '_UPLOAD_PATH') . '/category',
51
-        //constant($capsDirName . '_UPLOAD_PATH') . '/screenshots',
52
-        //XOOPS_UPLOAD_PATH . '/flags'
53
-    ],
54
-    'blankFiles'    => [
55
-        constant($capsDirName . '_UPLOAD_PATH'),
56
-        //constant($capsDirName . '_UPLOAD_PATH') . '/category',
57
-        //constant($capsDirName . '_UPLOAD_PATH') . '/screenshots',
58
-        //XOOPS_UPLOAD_PATH . '/flags'
59
-    ],
39
+	'name'          => strtoupper($moduleDirName) . ' Module Configurator',
40
+	'paths'         => [
41
+		'dirname'    => $moduleDirName,
42
+		'admin'      => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin',
43
+		//        'path'       => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName,
44
+		//        'url'        => XOOPS_URL . '/modules/' . $moduleDirName,
45
+		'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName,
46
+		'uploadUrl'  => XOOPS_UPLOAD_URL . '/' . $moduleDirName,
47
+	],
48
+	'uploadFolders' => [
49
+		constant($capsDirName . '_UPLOAD_PATH'),
50
+		//constant($capsDirName . '_UPLOAD_PATH') . '/category',
51
+		//constant($capsDirName . '_UPLOAD_PATH') . '/screenshots',
52
+		//XOOPS_UPLOAD_PATH . '/flags'
53
+	],
54
+	'blankFiles'    => [
55
+		constant($capsDirName . '_UPLOAD_PATH'),
56
+		//constant($capsDirName . '_UPLOAD_PATH') . '/category',
57
+		//constant($capsDirName . '_UPLOAD_PATH') . '/screenshots',
58
+		//XOOPS_UPLOAD_PATH . '/flags'
59
+	],
60 60
 
61
-    'templateFolders' => [
62
-        '/templates/',
63
-        '/templates/blocks/',
64
-        '/templates/admin/'
61
+	'templateFolders' => [
62
+		'/templates/',
63
+		'/templates/blocks/',
64
+		'/templates/admin/'
65 65
 
66
-    ],
67
-    'oldFiles'        => [//        '/sql/mysql.sql',
68
-    ],
69
-    'oldFolders'      => [
70
-        '/images',
71
-        '/css',
72
-        '/js',
73
-        '/tree',
74
-        '/images/icons/16',
75
-        '/images/icons/32',
76
-    ],
77
-    'modCopyright'    => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'>
66
+	],
67
+	'oldFiles'        => [//        '/sql/mysql.sql',
68
+	],
69
+	'oldFolders'      => [
70
+		'/images',
71
+		'/css',
72
+		'/js',
73
+		'/tree',
74
+		'/images/icons/16',
75
+		'/images/icons/32',
76
+	],
77
+	'modCopyright'    => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'>
78 78
                      <img src='" . $capsDirName . '_AUTHOR_LOGOIMG' . '\' alt=\'XOOPS Project\' /></a>',
79 79
 ];
Please login to merge, or discard this patch.
include/common.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,8 +70,8 @@
 block discarded – undo
70 70
 $debug = false;
71 71
 
72 72
 if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) {
73
-    require_once $GLOBALS['xoops']->path('class/template.php');
74
-    $xoopsTpl = new \XoopsTpl();
73
+	require_once $GLOBALS['xoops']->path('class/template.php');
74
+	$xoopsTpl = new \XoopsTpl();
75 75
 }
76 76
 
77 77
 $moduleDirName = basename(dirname(__DIR__));
Please login to merge, or discard this patch.
page.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 $criteria->add(new \Criteria('pageid ', $pageid));
30 30
 $criteria->add(new \Criteria('status ', '0', '>'));
31 31
 if (0 == $pageHandler->getCount($criteria)) {
32
-    redirect_header('index.php', 3, _MD_INSTRUCTION_PAGENOTEXIST);
33
-    exit();
32
+	redirect_header('index.php', 3, _MD_INSTRUCTION_PAGENOTEXIST);
33
+	exit();
34 34
 }
35 35
 //
36 36
 unset($criteria);
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 
43 43
 // Если админ и ссылка на отключение кэша
44 44
 if (($GLOBALS['xoopsUser'] instanceof \XoopsUser) && $GLOBALS['xoopsUser']->isAdmin() && $nocache) {
45
-    // Отключаем кэш
46
-    $GLOBALS['xoopsConfig']['module_cache'][$GLOBALS['xoopsModule']->getVar('mid')] = 0;
45
+	// Отключаем кэш
46
+	$GLOBALS['xoopsConfig']['module_cache'][$GLOBALS['xoopsModule']->getVar('mid')] = 0;
47 47
 }
48 48
 
49 49
 // Задание тайтла
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 // Права на просмотр инструкции
61 61
 $categories = Xoopsmodules\instruction\Utility::getItemIds();
62 62
 if (!in_array($objInsinstr->getVar('cid'), $categories)) {
63
-    redirect_header(XOOPS_URL . '/modules/' . $moduleDirName . '/', 3, _NOPERM);
64
-    exit();
63
+	redirect_header(XOOPS_URL . '/modules/' . $moduleDirName . '/', 3, _NOPERM);
64
+	exit();
65 65
 }
66 66
 
67 67
 // Массив данных о странице
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 $footnote = $objInspage->getVar('footnote');
79 79
 // Если есть сноски
80 80
 if ($footnote) {
81
-    $pages['footnotes'] = explode('|', $objInspage->getVar('footnote'));
81
+	$pages['footnotes'] = explode('|', $objInspage->getVar('footnote'));
82 82
 } else {
83
-    $pages['footnotes'] = false;
83
+	$pages['footnotes'] = false;
84 84
 }
85 85
 // Мета-теги ключевых слов
86 86
 $pages['keywords'] = $objInspage->getVar('keywords');
@@ -89,39 +89,39 @@  discard block
 block discarded – undo
89 89
 //
90 90
 // Если админ, рисуем админлинк
91 91
 if (($GLOBALS['xoopsUser'] instanceof \XoopsUser) && $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid())) {
92
-    $pages['adminlink'] = '&nbsp;<a href="'
93
-                          . XOOPS_URL
94
-                          . '/modules/'
95
-                          . $moduleDirName
96
-                          . '/admin/instr.php?op=editpage&pageid='
97
-                          . $pages['pageid']
98
-                          . '"><img style="width:16px;" src="./assets/icons/edit_mini.png" alt='
99
-                          . _EDIT
100
-                          . ' title='
101
-                          . _EDIT
102
-                          . '></a>&nbsp;<a href="'
103
-                          . XOOPS_URL
104
-                          . '/modules/'
105
-                          . $moduleDirName
106
-                          . '/admin/instr.php?op=delpage&pageid='
107
-                          . $pages['pageid']
108
-                          . '"><img style="width:16px;" src="./assets/icons/delete_mini.png" alt='
109
-                          . _DELETE
110
-                          . ' title='
111
-                          . _DELETE
112
-                          . '></a>&nbsp;';
92
+	$pages['adminlink'] = '&nbsp;<a href="'
93
+						  . XOOPS_URL
94
+						  . '/modules/'
95
+						  . $moduleDirName
96
+						  . '/admin/instr.php?op=editpage&pageid='
97
+						  . $pages['pageid']
98
+						  . '"><img style="width:16px;" src="./assets/icons/edit_mini.png" alt='
99
+						  . _EDIT
100
+						  . ' title='
101
+						  . _EDIT
102
+						  . '></a>&nbsp;<a href="'
103
+						  . XOOPS_URL
104
+						  . '/modules/'
105
+						  . $moduleDirName
106
+						  . '/admin/instr.php?op=delpage&pageid='
107
+						  . $pages['pageid']
108
+						  . '"><img style="width:16px;" src="./assets/icons/delete_mini.png" alt='
109
+						  . _DELETE
110
+						  . ' title='
111
+						  . _DELETE
112
+						  . '></a>&nbsp;';
113 113
 } else {
114
-    $pages['adminlink'] = '&nbsp;';
115
-    // Если можно редактировать
116
-    if ($gpermHandler->checkRight($moduleDirName . '_edit', $objInsinstr->getVar('cid'), $groups, $GLOBALS['xoopsModule']->getVar('mid'))) {
117
-        $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>';
118
-    }
119
-
120
-    $pages['adminlink'] .= '&nbsp;';
121
-    // Если нет админлика
122
-    if ('[&nbsp;&nbsp;]' === $pages['adminlink']) {
123
-        $pages['adminlink'] = '';
124
-    }
114
+	$pages['adminlink'] = '&nbsp;';
115
+	// Если можно редактировать
116
+	if ($gpermHandler->checkRight($moduleDirName . '_edit', $objInsinstr->getVar('cid'), $groups, $GLOBALS['xoopsModule']->getVar('mid'))) {
117
+		$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>';
118
+	}
119
+
120
+	$pages['adminlink'] .= '&nbsp;';
121
+	// Если нет админлика
122
+	if ('[&nbsp;&nbsp;]' === $pages['adminlink']) {
123
+		$pages['adminlink'] = '';
124
+	}
125 125
 }
126 126
 // Выводим в шаблон
127 127
 $GLOBALS['xoopsTpl']->assign('insPage', $pages);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 $nav_parent_id = array_reverse($nav_parent_id);
141 141
 $navigation    = '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/">' . $GLOBALS['xoopsModule']->name() . '</a>&nbsp;:&nbsp;';
142 142
 foreach (array_keys($nav_parent_id) as $i) {
143
-    $navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/index.php?cid=' . $nav_parent_id[$i]->getVar('cid') . '">' . $nav_parent_id[$i]->getVar('title') . '</a>&nbsp;:&nbsp;';
143
+	$navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/index.php?cid=' . $nav_parent_id[$i]->getVar('cid') . '">' . $nav_parent_id[$i]->getVar('title') . '</a>&nbsp;:&nbsp;';
144 144
 }
145 145
 $navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/index.php?cid=' . $objInscat->getVar('cid') . '">' . $objInscat->getVar('title') . '</a>&nbsp;:&nbsp;';
146 146
 $navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/instr.php?id=' . $pages['instrid'] . '">' . $objInsinstr->getVar('title') . '</a>';
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
 
173 173
 // Рейтинг
174 174
 if (xoops_getModuleOption('userat', 'instruction')) {
175
-    $xoopsTpl->assign('insUserat', true);
175
+	$xoopsTpl->assign('insUserat', true);
176 176
 } else {
177
-    $xoopsTpl->assign('insUserat', false);
177
+	$xoopsTpl->assign('insUserat', false);
178 178
 }
179 179
 
180 180
 // Мета теги
Please login to merge, or discard this patch.
submit.php 1 patch
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -35,195 +35,195 @@
 block discarded – undo
35 35
 
36 36
 switch ($op) {
37 37
 
38
-    case 'editpage':
39
-
40
-        // Задание тайтла
41
-        $xoopsOption['xoops_pagetitle'] = '';
42
-        // Шаблон
43
-        $GLOBALS['xoopsOption']['template_main'] = $moduleDirName . '_editpage.tpl';
44
-        // Заголовок
45
-        include_once $GLOBALS['xoops']->path('header.php');
46
-
47
-        // Если мы редактируем страницу
48
-        if ($pageid) {
49
-            // Получаем объект страницы
50
-            $objInspage = $pageHandler->get($pageid);
51
-            // ID инструкции
52
-            $instrid = $objInspage->getVar('instrid');
53
-            // Объект инструкции
54
-            $objInsinstr = $instructionHandler->get($instrid);
55
-            // Можно ли редактировать инструкцию в данной категории
56
-            if (!in_array($objInsinstr->getVar('cid'), $cat_edit)) {
57
-                redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_EDITPAGE);
58
-            }
59
-            // Создание новой страницы
60
-        } elseif ($instrid) {
61
-
62
-            // Если нельзя добавлять не в одну категорию
63
-            //if( ! count( $cat_submit ) ) redirect_header( 'index.php', 3, _MD_INSTRUCTION_NOPERM_SUBMIT_PAGE );
64
-            // Создаём объект страницы
65
-            $objInspage = $pageHandler->create();
66
-            // Объект инструкции
67
-            $objInsinstr = $instructionHandler->get($instrid);
68
-            // Можно ли добавлять инструкции в данной категории
69
-            if (!in_array($objInsinstr->getVar('cid'), $cat_submit)) {
70
-                redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_SUBMITPAGE);
71
-            }
72
-        } else {
73
-            redirect_header('index.php', 3, _MD_INSTRUCTION_BADREQUEST);
74
-        }
75
-
76
-        // Информация об инструкции
77
-
78
-        // Массив данных об инструкции
79
-        $instrs = [];
80
-        // ID инструкции
81
-        $instrs['instrid'] = $objInsinstr->getVar('instrid');
82
-        // Название страницы
83
-        $instrs['title'] = $objInsinstr->getVar('title');
84
-        // Описание
85
-        $instrs['description'] = $objInsinstr->getVar('description');
86
-
87
-        // Выводим в шаблон
88
-        $GLOBALS['xoopsTpl']->assign('insInstr', $instrs);
89
-
90
-        //
91
-
92
-        $form = $objInspage->getForm('submit.php', $instrid);
93
-        // Форма
94
-        $GLOBALS['xoopsTpl']->assign('insFormPage', $form->render());
95
-
96
-        // Подвал
97
-        include_once $GLOBALS['xoops']->path('footer.php');
98
-
99
-        break;
100
-    // Сохранение страницы
101
-    case 'savepage':
102
-
103
-        // Проверка
104
-        if (!$GLOBALS['xoopsSecurity']->check()) {
105
-            redirect_header('index.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
106
-        }
107
-
108
-        $err         = false;
109
-        $message_err = '';
110
-
111
-        // Если мы редактируем
112
-        if ($pageid) {
113
-            $objInspage = $pageHandler->get($pageid);
114
-            // Объект инструкции
115
-            $objInsinstr = $instructionHandler->get($objInspage->getVar('instrid'));
116
-            // Можно ли редактировать инструкцию в данной категории
117
-            if (!in_array($objInsinstr->getVar('cid'), $cat_edit)) {
118
-                redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_EDITPAGE);
119
-            }
120
-        } elseif ($instrid) {
121
-            $objInspage = $pageHandler->create();
122
-            // Объект инструкции
123
-            $objInsinstr = $instructionHandler->get($instrid);
124
-            // Можно ли добавлять инструкции в данной категории
125
-            if (!in_array($objInsinstr->getVar('cid'), $cat_submit)) {
126
-                redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_SUBMITPAGE);
127
-            }
128
-
129
-            // Если мы создаём страницу необходимо указать к какой инструкции
130
-            $objInspage->setVar('instrid', $instrid);
131
-            // Указываем дату создания
132
-            $objInspage->setVar('datecreated', $time);
133
-            // Указываем пользователя
134
-            $objInspage->setVar('uid', $uid);
135
-        } else {
136
-            redirect_header('index.php', 3, _MD_INSTRUCTION_BADREQUEST);
137
-        }
138
-
139
-        // Родительская страница
140
-        $objInspage->setVar('pid', $pid);
141
-        // Дата обновления
142
-        $objInspage->setVar('dateupdated', $time);
143
-        //
144
-        $objInspage->setVar('title', Request::getString('title', '', 'POST'));
145
-        $objInspage->setVar('weight', $weight);
146
-        $objInspage->setVar('hometext', Request::getText('hometext', '', 'POST'));
147
-        // Сноска
148
-        $objInspage->setVar('footnote', Request::getText('footnote', '', 'POST'));
149
-        $objInspage->setVar('status', Request::getInt('status', 0, 'POST'));
150
-        $objInspage->setVar('keywords', Request::getString('keywords', '', 'POST'));
151
-        $objInspage->setVar('description', Request::getText('description', '', 'POST'));
152
-
153
-        // Проверка категорий
154
-        if (!$pageid && !$instrid) {
155
-            $err         = true;
156
-            $message_err .= _MD_INSTRUCTION_ERR_INSTR . '<br>';
157
-        }
158
-        // Проверка веса
159
-        if (0 == $weight) {
160
-            $err         = true;
161
-            $message_err .= _MD_INSTRUCTION_ERR_WEIGHT . '<br>';
162
-        }
163
-        // Проверка родительской страницы
164
-        if ($pageid && ($pageid == $pid)) {
165
-            $err         = true;
166
-            $message_err .= _MD_INSTRUCTION_ERR_PPAGE . '<br>';
167
-        }
168
-        // Если были ошибки
169
-        if (true === $err) {
170
-            // Задание тайтла
171
-            $xoopsOption['xoops_pagetitle'] = '';
172
-            // Шаблон
173
-            $GLOBALS['xoopsOption']['template_main'] = $moduleDirName . '_savepage.tpl';
174
-            // Заголовок
175
-            include_once $GLOBALS['xoops']->path('header.php');
176
-            // Сообщение об ошибке
177
-            $message_err = '<div class="errorMsg" style="text-align: left;">' . $message_err . '</div>';
178
-            // Выводим ошибки в шаблон
179
-            $GLOBALS['xoopsTpl']->assign('insErrorMsg', $message_err);
180
-            // Если небыло ошибок
181
-        } else {
182
-            // Вставляем данные в БД
183
-            if ($pageHandler->insert($objInspage)) {
184
-                // Если мы редактируем
185
-                if ($pageid) {
186
-                    // Обновление даты
187
-                    $sql = sprintf('UPDATE %s SET `dateupdated` = %u WHERE `instrid` = %u', $GLOBALS['xoopsDB']->prefix($moduleDirName . '_instr'), $time, $instrid);
188
-                    $GLOBALS['xoopsDB']->query($sql);
189
-                    // Запись в лог
190
-                    xoops_loadLanguage('main', 'userslog');
191
-                    //userslog_insert( $objInsinstr->getVar('title') . ': ' . $objInspage->getVar('title'), _MD_USERSLOG_MODIFY_PAGE );
192
-                    //
193
-                    redirect_header('index.php', 3, _MD_INSTRUCTION_PAGEMODIFY);
194
-                    // Если мы добавляем
195
-                } else {
196
-                    // Инкримент комментов
197
-                    $pageHandler->updateposts($uid, Request::getInt('status', 0, 'POST'), 'add');
198
-                    // Инкремент страниц и обновление даты
199
-                    $sql = sprintf('UPDATE %s SET `pages` = `pages` + 1, `dateupdated` = %u WHERE `instrid` = %u', $GLOBALS['xoopsDB']->prefix($moduleDirName . '_instr'), $time, $instrid);
200
-                    $GLOBALS['xoopsDB']->query($sql);
201
-                    // Запись в лог
202
-                    xoops_loadLanguage('main', 'userslog');
203
-                    //userslog_insert( $objInsinstr->getVar('title') . ': ' . $objInspage->getVar('title'), _MD_USERSLOG_SUBMIT_PAGE );
204
-                    //
205
-                    redirect_header('index.php', 3, _MD_INSTRUCTION_PAGEADDED);
206
-                }
207
-            }
208
-
209
-            // Задание тайтла
210
-            $xoopsOption['xoops_pagetitle'] = '';
211
-            // Шаблон
212
-            $GLOBALS['xoopsOption']['template_main'] = $moduleDirName . '_savepage.tpl';
213
-            // Заголовок
214
-            include_once $GLOBALS['xoops']->path('header.php');
215
-
216
-            // Выводим ошибки в шаблон
217
-            $GLOBALS['xoopsTpl']->assign('insErrorMsg', $objInspage->getHtmlErrors());
218
-        }
219
-        // Получаем форму
220
-        $form = $objInspage->getForm('submit.php', $instrid);
221
-
222
-        // Форма
223
-        $GLOBALS['xoopsTpl']->assign('insFormPage', $form->render());
224
-
225
-        // Подвал
226
-        include_once $GLOBALS['xoops']->path('footer.php');
227
-
228
-        break;
38
+	case 'editpage':
39
+
40
+		// Задание тайтла
41
+		$xoopsOption['xoops_pagetitle'] = '';
42
+		// Шаблон
43
+		$GLOBALS['xoopsOption']['template_main'] = $moduleDirName . '_editpage.tpl';
44
+		// Заголовок
45
+		include_once $GLOBALS['xoops']->path('header.php');
46
+
47
+		// Если мы редактируем страницу
48
+		if ($pageid) {
49
+			// Получаем объект страницы
50
+			$objInspage = $pageHandler->get($pageid);
51
+			// ID инструкции
52
+			$instrid = $objInspage->getVar('instrid');
53
+			// Объект инструкции
54
+			$objInsinstr = $instructionHandler->get($instrid);
55
+			// Можно ли редактировать инструкцию в данной категории
56
+			if (!in_array($objInsinstr->getVar('cid'), $cat_edit)) {
57
+				redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_EDITPAGE);
58
+			}
59
+			// Создание новой страницы
60
+		} elseif ($instrid) {
61
+
62
+			// Если нельзя добавлять не в одну категорию
63
+			//if( ! count( $cat_submit ) ) redirect_header( 'index.php', 3, _MD_INSTRUCTION_NOPERM_SUBMIT_PAGE );
64
+			// Создаём объект страницы
65
+			$objInspage = $pageHandler->create();
66
+			// Объект инструкции
67
+			$objInsinstr = $instructionHandler->get($instrid);
68
+			// Можно ли добавлять инструкции в данной категории
69
+			if (!in_array($objInsinstr->getVar('cid'), $cat_submit)) {
70
+				redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_SUBMITPAGE);
71
+			}
72
+		} else {
73
+			redirect_header('index.php', 3, _MD_INSTRUCTION_BADREQUEST);
74
+		}
75
+
76
+		// Информация об инструкции
77
+
78
+		// Массив данных об инструкции
79
+		$instrs = [];
80
+		// ID инструкции
81
+		$instrs['instrid'] = $objInsinstr->getVar('instrid');
82
+		// Название страницы
83
+		$instrs['title'] = $objInsinstr->getVar('title');
84
+		// Описание
85
+		$instrs['description'] = $objInsinstr->getVar('description');
86
+
87
+		// Выводим в шаблон
88
+		$GLOBALS['xoopsTpl']->assign('insInstr', $instrs);
89
+
90
+		//
91
+
92
+		$form = $objInspage->getForm('submit.php', $instrid);
93
+		// Форма
94
+		$GLOBALS['xoopsTpl']->assign('insFormPage', $form->render());
95
+
96
+		// Подвал
97
+		include_once $GLOBALS['xoops']->path('footer.php');
98
+
99
+		break;
100
+	// Сохранение страницы
101
+	case 'savepage':
102
+
103
+		// Проверка
104
+		if (!$GLOBALS['xoopsSecurity']->check()) {
105
+			redirect_header('index.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
106
+		}
107
+
108
+		$err         = false;
109
+		$message_err = '';
110
+
111
+		// Если мы редактируем
112
+		if ($pageid) {
113
+			$objInspage = $pageHandler->get($pageid);
114
+			// Объект инструкции
115
+			$objInsinstr = $instructionHandler->get($objInspage->getVar('instrid'));
116
+			// Можно ли редактировать инструкцию в данной категории
117
+			if (!in_array($objInsinstr->getVar('cid'), $cat_edit)) {
118
+				redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_EDITPAGE);
119
+			}
120
+		} elseif ($instrid) {
121
+			$objInspage = $pageHandler->create();
122
+			// Объект инструкции
123
+			$objInsinstr = $instructionHandler->get($instrid);
124
+			// Можно ли добавлять инструкции в данной категории
125
+			if (!in_array($objInsinstr->getVar('cid'), $cat_submit)) {
126
+				redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_SUBMITPAGE);
127
+			}
128
+
129
+			// Если мы создаём страницу необходимо указать к какой инструкции
130
+			$objInspage->setVar('instrid', $instrid);
131
+			// Указываем дату создания
132
+			$objInspage->setVar('datecreated', $time);
133
+			// Указываем пользователя
134
+			$objInspage->setVar('uid', $uid);
135
+		} else {
136
+			redirect_header('index.php', 3, _MD_INSTRUCTION_BADREQUEST);
137
+		}
138
+
139
+		// Родительская страница
140
+		$objInspage->setVar('pid', $pid);
141
+		// Дата обновления
142
+		$objInspage->setVar('dateupdated', $time);
143
+		//
144
+		$objInspage->setVar('title', Request::getString('title', '', 'POST'));
145
+		$objInspage->setVar('weight', $weight);
146
+		$objInspage->setVar('hometext', Request::getText('hometext', '', 'POST'));
147
+		// Сноска
148
+		$objInspage->setVar('footnote', Request::getText('footnote', '', 'POST'));
149
+		$objInspage->setVar('status', Request::getInt('status', 0, 'POST'));
150
+		$objInspage->setVar('keywords', Request::getString('keywords', '', 'POST'));
151
+		$objInspage->setVar('description', Request::getText('description', '', 'POST'));
152
+
153
+		// Проверка категорий
154
+		if (!$pageid && !$instrid) {
155
+			$err         = true;
156
+			$message_err .= _MD_INSTRUCTION_ERR_INSTR . '<br>';
157
+		}
158
+		// Проверка веса
159
+		if (0 == $weight) {
160
+			$err         = true;
161
+			$message_err .= _MD_INSTRUCTION_ERR_WEIGHT . '<br>';
162
+		}
163
+		// Проверка родительской страницы
164
+		if ($pageid && ($pageid == $pid)) {
165
+			$err         = true;
166
+			$message_err .= _MD_INSTRUCTION_ERR_PPAGE . '<br>';
167
+		}
168
+		// Если были ошибки
169
+		if (true === $err) {
170
+			// Задание тайтла
171
+			$xoopsOption['xoops_pagetitle'] = '';
172
+			// Шаблон
173
+			$GLOBALS['xoopsOption']['template_main'] = $moduleDirName . '_savepage.tpl';
174
+			// Заголовок
175
+			include_once $GLOBALS['xoops']->path('header.php');
176
+			// Сообщение об ошибке
177
+			$message_err = '<div class="errorMsg" style="text-align: left;">' . $message_err . '</div>';
178
+			// Выводим ошибки в шаблон
179
+			$GLOBALS['xoopsTpl']->assign('insErrorMsg', $message_err);
180
+			// Если небыло ошибок
181
+		} else {
182
+			// Вставляем данные в БД
183
+			if ($pageHandler->insert($objInspage)) {
184
+				// Если мы редактируем
185
+				if ($pageid) {
186
+					// Обновление даты
187
+					$sql = sprintf('UPDATE %s SET `dateupdated` = %u WHERE `instrid` = %u', $GLOBALS['xoopsDB']->prefix($moduleDirName . '_instr'), $time, $instrid);
188
+					$GLOBALS['xoopsDB']->query($sql);
189
+					// Запись в лог
190
+					xoops_loadLanguage('main', 'userslog');
191
+					//userslog_insert( $objInsinstr->getVar('title') . ': ' . $objInspage->getVar('title'), _MD_USERSLOG_MODIFY_PAGE );
192
+					//
193
+					redirect_header('index.php', 3, _MD_INSTRUCTION_PAGEMODIFY);
194
+					// Если мы добавляем
195
+				} else {
196
+					// Инкримент комментов
197
+					$pageHandler->updateposts($uid, Request::getInt('status', 0, 'POST'), 'add');
198
+					// Инкремент страниц и обновление даты
199
+					$sql = sprintf('UPDATE %s SET `pages` = `pages` + 1, `dateupdated` = %u WHERE `instrid` = %u', $GLOBALS['xoopsDB']->prefix($moduleDirName . '_instr'), $time, $instrid);
200
+					$GLOBALS['xoopsDB']->query($sql);
201
+					// Запись в лог
202
+					xoops_loadLanguage('main', 'userslog');
203
+					//userslog_insert( $objInsinstr->getVar('title') . ': ' . $objInspage->getVar('title'), _MD_USERSLOG_SUBMIT_PAGE );
204
+					//
205
+					redirect_header('index.php', 3, _MD_INSTRUCTION_PAGEADDED);
206
+				}
207
+			}
208
+
209
+			// Задание тайтла
210
+			$xoopsOption['xoops_pagetitle'] = '';
211
+			// Шаблон
212
+			$GLOBALS['xoopsOption']['template_main'] = $moduleDirName . '_savepage.tpl';
213
+			// Заголовок
214
+			include_once $GLOBALS['xoops']->path('header.php');
215
+
216
+			// Выводим ошибки в шаблон
217
+			$GLOBALS['xoopsTpl']->assign('insErrorMsg', $objInspage->getHtmlErrors());
218
+		}
219
+		// Получаем форму
220
+		$form = $objInspage->getForm('submit.php', $instrid);
221
+
222
+		// Форма
223
+		$GLOBALS['xoopsTpl']->assign('insFormPage', $form->render());
224
+
225
+		// Подвал
226
+		include_once $GLOBALS['xoops']->path('footer.php');
227
+
228
+		break;
229 229
 }
Please login to merge, or discard this patch.
blocks/instr_lastpage.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -12,63 +12,63 @@  discard block
 block discarded – undo
12 12
 function b_instr_lastpage_show($options = [])
13 13
 {
14 14
 
15
-    // Подключаем функции
16
-    $moduleDirName = basename(dirname(__DIR__));
17
-    include_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/include/common.php');
18
-    //
19
-    $myts = MyTextSanitizer::getInstance();
20
-    //
21
-    //mb    $instructionHandler = xoops_getModuleHandler('instruction', 'instruction');
22
-    //mb    $pageHandler  = xoops_getModuleHandler('page', 'instruction');
15
+	// Подключаем функции
16
+	$moduleDirName = basename(dirname(__DIR__));
17
+	include_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/include/common.php');
18
+	//
19
+	$myts = MyTextSanitizer::getInstance();
20
+	//
21
+	//mb    $instructionHandler = xoops_getModuleHandler('instruction', 'instruction');
22
+	//mb    $pageHandler  = xoops_getModuleHandler('page', 'instruction');
23 23
 
24
-    $db                 = \XoopsDatabaseFactory::getDatabase();
25
-    $instructionHandler = new \Xoopsmodules\instruction\InstructionHandler($db);
26
-    $pageHandler        = new \Xoopsmodules\instruction\PageHandler($db);
24
+	$db                 = \XoopsDatabaseFactory::getDatabase();
25
+	$instructionHandler = new \Xoopsmodules\instruction\InstructionHandler($db);
26
+	$pageHandler        = new \Xoopsmodules\instruction\PageHandler($db);
27 27
 
28
-    // Добавляем стили
29
-    //global $xoTheme;
30
-    //$xoTheme->addStylesheet( XOOPS_URL . '/modules/instruction/css/blocks.css' );
28
+	// Добавляем стили
29
+	//global $xoTheme;
30
+	//$xoTheme->addStylesheet( XOOPS_URL . '/modules/instruction/css/blocks.css' );
31 31
 
32
-    // Опции
33
-    // Количество страниц
34
-    $limit = $options[0];
35
-    // Количество символов
36
-    $numchars = $options[1];
32
+	// Опции
33
+	// Количество страниц
34
+	$limit = $options[0];
35
+	// Количество символов
36
+	$numchars = $options[1];
37 37
 
38
-    // Права на просмотр
39
-    $cat_view = Xoopsmodules\instruction\Utility::getItemIds();
40
-    // Массив выходных данных
41
-    $block = [];
38
+	// Права на просмотр
39
+	$cat_view = Xoopsmodules\instruction\Utility::getItemIds();
40
+	// Массив выходных данных
41
+	$block = [];
42 42
 
43
-    // Если есть категории для прасмотра
44
-    if (is_array($cat_view) && count($cat_view) > 0) {
43
+	// Если есть категории для прасмотра
44
+	if (is_array($cat_view) && count($cat_view) > 0) {
45 45
 
46
-        // Находим последние страницы
47
-        $sql = "SELECT p.pageid, p.instrid, p.title, p.dateupdated, i.title, i.cid FROM {$pageHandler->table} p, {$instructionHandler->table} i WHERE p.instrid = i.instrid AND i.cid IN (" . implode(', ', $cat_view) . ') AND p.status > 0 AND i.status > 0 ORDER BY p.dateupdated DESC';
48
-        // Лимит запроса
49
-        $result = $GLOBALS['xoopsDB']->query($sql, $limit);
50
-        // Перебираем все значения
51
-        $i = 0;
52
-        while (list($pageid, $instrid, $ptitle, $dateupdated, $ititle, $cid) = $GLOBALS['xoopsDB']->fetchRow($result)) {
53
-            // ID страницы
54
-            $block[$i]['pageid'] = $pageid;
55
-            // ID инструкции
56
-            $block[$i]['instrid'] = $instrid;
57
-            // Название страницы
58
-            $block[$i]['ptitle'] = $myts->htmlSpecialChars($ptitle);
59
-            // Название инструкции
60
-            $block[$i]['ititle'] = $myts->htmlSpecialChars($ititle);
61
-            // Дата обновления страницы
62
-            $block[$i]['dateupdated'] = formatTimeStamp($dateupdated, 's');
63
-            // Категория инстркции
64
-            $block[$i]['cid'] = $cid;
65
-            // Инкримент
66
-            $i++;
67
-        }
68
-    }
46
+		// Находим последние страницы
47
+		$sql = "SELECT p.pageid, p.instrid, p.title, p.dateupdated, i.title, i.cid FROM {$pageHandler->table} p, {$instructionHandler->table} i WHERE p.instrid = i.instrid AND i.cid IN (" . implode(', ', $cat_view) . ') AND p.status > 0 AND i.status > 0 ORDER BY p.dateupdated DESC';
48
+		// Лимит запроса
49
+		$result = $GLOBALS['xoopsDB']->query($sql, $limit);
50
+		// Перебираем все значения
51
+		$i = 0;
52
+		while (list($pageid, $instrid, $ptitle, $dateupdated, $ititle, $cid) = $GLOBALS['xoopsDB']->fetchRow($result)) {
53
+			// ID страницы
54
+			$block[$i]['pageid'] = $pageid;
55
+			// ID инструкции
56
+			$block[$i]['instrid'] = $instrid;
57
+			// Название страницы
58
+			$block[$i]['ptitle'] = $myts->htmlSpecialChars($ptitle);
59
+			// Название инструкции
60
+			$block[$i]['ititle'] = $myts->htmlSpecialChars($ititle);
61
+			// Дата обновления страницы
62
+			$block[$i]['dateupdated'] = formatTimeStamp($dateupdated, 's');
63
+			// Категория инстркции
64
+			$block[$i]['cid'] = $cid;
65
+			// Инкримент
66
+			$i++;
67
+		}
68
+	}
69 69
 
70
-    // Возвращаем массив
71
-    return $block;
70
+	// Возвращаем массив
71
+	return $block;
72 72
 }
73 73
 
74 74
 // Редактирование последних страниц
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
  */
79 79
 function b_instr_lastpage_edit($options = [])
80 80
 {
81
-    $form = '';
82
-    $form .= _MB_INSTR_DISPLAYPAGESC . ' <input name="options[0]" size="5" maxlength="255" value="' . $options[0] . '" type="text" /><br>' . "\n";
83
-    $form .= _MB_INSTR_NUMCHARSC . ' <input name="options[1]" size="5" maxlength="255" value="' . $options[1] . '" type="text" /><br>' . "\n";
81
+	$form = '';
82
+	$form .= _MB_INSTR_DISPLAYPAGESC . ' <input name="options[0]" size="5" maxlength="255" value="' . $options[0] . '" type="text" /><br>' . "\n";
83
+	$form .= _MB_INSTR_NUMCHARSC . ' <input name="options[1]" size="5" maxlength="255" value="' . $options[1] . '" type="text" /><br>' . "\n";
84 84
 
85
-    // Возвращаем форму
86
-    return $form;
85
+	// Возвращаем форму
86
+	return $form;
87 87
 }
Please login to merge, or discard this patch.
class/common/ServerStats.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -17,60 +17,60 @@
 block discarded – undo
17 17
  */
18 18
 trait ServerStats
19 19
 {
20
-    /**
21
-     * serverStats()
22
-     *
23
-     * @return string
24
-     */
25
-    public static function getServerStats()
26
-    {
27
-        //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
28
-        $moduleDirName      = basename(dirname(dirname(__DIR__)));
29
-        $moduleDirNameUpper = strtoupper($moduleDirName);
30
-        xoops_loadLanguage('common', $moduleDirName);
31
-        $html = '';
32
-        //        $sql   = 'SELECT metavalue';
33
-        //        $sql   .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta');
34
-        //        $sql   .= " WHERE metakey='version' LIMIT 1";
35
-        //        $query = $GLOBALS['xoopsDB']->query($sql);
36
-        //        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
37
-        $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n";
38
-        $html .= "<div style='padding: 8px;'>\n";
39
-        //        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n";
40
-        //        $html .= "<br>\n";
41
-        //        $html .= "<br>\n";
42
-        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n";
43
-        $html .= "<ul>\n";
44
-        //
45
-        $gdlib = function_exists('gd_info') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
46
-        $html  .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
47
-        if (function_exists('gd_info')) {
48
-            if (true === ($gdlib = gd_info())) {
49
-                $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
50
-            }
51
-        }
52
-        //
53
-        //    $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF');
54
-        //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode;
55
-        //
56
-        //    $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>';
57
-        //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;
58
-        //
59
-        $downloads = ini_get('file_uploads') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
60
-        $html      .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
61
-        //
62
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . ini_get('upload_max_filesize') . "</span></b>\n";
63
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . ini_get('post_max_size') . "</span></b>\n";
64
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . ini_get('memory_limit') . "</span></b>\n";
65
-        $html .= "</ul>\n";
66
-        $html .= "<ul>\n";
67
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n";
68
-        $html .= "</ul>\n";
69
-        $html .= "<br>\n";
70
-        $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n";
71
-        $html .= '</div>';
72
-        $html .= '</fieldset><br>';
20
+	/**
21
+	 * serverStats()
22
+	 *
23
+	 * @return string
24
+	 */
25
+	public static function getServerStats()
26
+	{
27
+		//mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
28
+		$moduleDirName      = basename(dirname(dirname(__DIR__)));
29
+		$moduleDirNameUpper = strtoupper($moduleDirName);
30
+		xoops_loadLanguage('common', $moduleDirName);
31
+		$html = '';
32
+		//        $sql   = 'SELECT metavalue';
33
+		//        $sql   .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta');
34
+		//        $sql   .= " WHERE metakey='version' LIMIT 1";
35
+		//        $query = $GLOBALS['xoopsDB']->query($sql);
36
+		//        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
37
+		$html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n";
38
+		$html .= "<div style='padding: 8px;'>\n";
39
+		//        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n";
40
+		//        $html .= "<br>\n";
41
+		//        $html .= "<br>\n";
42
+		$html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n";
43
+		$html .= "<ul>\n";
44
+		//
45
+		$gdlib = function_exists('gd_info') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
46
+		$html  .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
47
+		if (function_exists('gd_info')) {
48
+			if (true === ($gdlib = gd_info())) {
49
+				$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
50
+			}
51
+		}
52
+		//
53
+		//    $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF');
54
+		//    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode;
55
+		//
56
+		//    $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>';
57
+		//    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;
58
+		//
59
+		$downloads = ini_get('file_uploads') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
60
+		$html      .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
61
+		//
62
+		$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . ini_get('upload_max_filesize') . "</span></b>\n";
63
+		$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . ini_get('post_max_size') . "</span></b>\n";
64
+		$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . ini_get('memory_limit') . "</span></b>\n";
65
+		$html .= "</ul>\n";
66
+		$html .= "<ul>\n";
67
+		$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n";
68
+		$html .= "</ul>\n";
69
+		$html .= "<br>\n";
70
+		$html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n";
71
+		$html .= '</div>';
72
+		$html .= '</fieldset><br>';
73 73
 
74
-        return $html;
75
-    }
74
+		return $html;
75
+	}
76 76
 }
Please login to merge, or discard this patch.
admin/admin_header.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,19 +12,19 @@
 block discarded – undo
12 12
 
13 13
 //if (($GLOBALS['xoopsUser'] instanceof \XoopsUser)) {
14 14
 if ($GLOBALS['xoopsUser'] instanceof \XoopsUser) {
15
-    if (!$helper->isUserAdmin()) {
16
-        $helper->redirect(XOOPS_URL . '/', 3, _NOPERM);
17
-    }
15
+	if (!$helper->isUserAdmin()) {
16
+		$helper->redirect(XOOPS_URL . '/', 3, _NOPERM);
17
+	}
18 18
 } else {
19
-    $helper->redirect(XOOPS_URL . '/user.php', 1, _NOPERM);
19
+	$helper->redirect(XOOPS_URL . '/user.php', 1, _NOPERM);
20 20
 }
21 21
 
22 22
 /** @var Xmf\Module\Admin $adminObject */
23 23
 $adminObject = \Xmf\Module\Admin::getInstance();
24 24
 
25 25
 if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) {
26
-    require_once $GLOBALS['xoops']->path('class/template.php');
27
-    $xoopsTpl = new \XoopsTpl();
26
+	require_once $GLOBALS['xoops']->path('class/template.php');
27
+	$xoopsTpl = new \XoopsTpl();
28 28
 }
29 29
 
30 30
 $pathIcon16    = Xmf\Module\Admin::iconUrl('', 16);
Please login to merge, or discard this patch.