Completed
Push — master ( 48ecb4...5fe85d )
by Michael
01:45
created
class/utility.php 4 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -39,6 +39,11 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,5 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-use Xmf\Request;
4
-
5 3
 require_once __DIR__ . '/common/traitversionchecks.php';
6 4
 require_once __DIR__ . '/common/traitserverstats.php';
7 5
 require_once __DIR__ . '/common/traitfilesmgmt.php';
Please login to merge, or discard this patch.
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -13,63 +13,63 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
                 break;
65 65
             case 'int':
66 66
             default:
67
-                $ret = isset($global[$key]) ? (int)$global[$key] : (int)$default;
67
+                $ret = isset($global[$key]) ? (int) $global[$key] : (int) $default;
68 68
                 break;
69 69
         }
70 70
         if (false === $ret) {
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
@@ -5,12 +5,12 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
include/config.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 $moduleDirName = basename(dirname(__DIR__));
23 23
 $capsDirName   = strtoupper($moduleDirName);
24 24
 
25
-if (!defined($capsDirName . '_DIRNAME')) {
25
+if ( ! defined($capsDirName . '_DIRNAME')) {
26 26
     //if (!defined(constant($capsDirName . '_DIRNAME'))) {
27 27
     define($capsDirName . '_DIRNAME', $GLOBALS['xoopsModule']->dirname());
28 28
     define($capsDirName . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME'));
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 }
36 36
 
37 37
 //Configurator
38
-return (object)[
38
+return (object) [
39 39
     'name'          => strtoupper($moduleDirName) . ' Module Configurator',
40 40
     'paths'         => [
41 41
         'dirname'    => $moduleDirName,
Please login to merge, or discard this patch.
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -23,58 +23,58 @@
 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'        => [
66
+	],
67
+	'oldFiles'        => [
68 68
 //        '/sql/mysql.sql',
69
-    ],
70
-    'oldFolders'      => [
71
-        '/images',
72
-        '/css',
73
-        '/js',
74
-        '/tree',
75
-        '/images/icons/16',
76
-        '/images/icons/32',
77
-    ],
78
-    'modCopyright'    => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'>
69
+	],
70
+	'oldFolders'      => [
71
+		'/images',
72
+		'/css',
73
+		'/js',
74
+		'/tree',
75
+		'/images/icons/16',
76
+		'/images/icons/32',
77
+	],
78
+	'modCopyright'    => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'>
79 79
                      <img src='" . $capsDirName . '_AUTHOR_LOGOIMG' . '\' alt=\'XOOPS Project\' /></a>',
80 80
 ];
Please login to merge, or discard this patch.
include/pagetypes.inc.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
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
 ];
Please login to merge, or discard this patch.
include/common.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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__));
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  * @author       XOOPS Development Team
18 18
  */
19 19
 
20
-if (!defined('INSTRUCTION_MODULE_PATH')) {
20
+if ( ! defined('INSTRUCTION_MODULE_PATH')) {
21 21
     define('INSTRUCTION_DIRNAME', basename(dirname(__DIR__)));
22 22
     define('INSTRUCTION_URL', XOOPS_URL . '/modules/' . INSTRUCTION_DIRNAME);
23 23
     define('INSTRUCTION_IMAGE_URL', INSTRUCTION_URL . '/assets/images/');
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 $instruction = Instruction::getInstance();
46 46
 $instruction->loadLanguage('common');
47 47
 
48
-if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) {
48
+if ( ! isset($GLOBALS['xoopsTpl']) || ! ($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) {
49 49
     require_once $GLOBALS['xoops']->path('class/template.php');
50 50
     $xoopsTpl = new XoopsTpl();
51 51
 }
Please login to merge, or discard this patch.
include/plugin.tag.php 3 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -3,66 +3,66 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@  discard block
 block discarded – undo
3 3
 // Информация об теге
4 4
 function instruction_tag_iteminfo(&$items)
5 5
 {
6
-    if (empty($items) || !is_array($items)) {
6
+    if (empty($items) || ! is_array($items)) {
7 7
         return false;
8 8
     }
9 9
 
10 10
     $items_id = [];
11 11
     foreach (array_keys($items) as $cat_id) {
12 12
         foreach (array_keys($items[$cat_id]) as $item_id) {
13
-            $items_id[] = (int)$item_id;
13
+            $items_id[] = (int) $item_id;
14 14
         }
15 15
     }
16 16
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                . '            OR aa.status < 1'
63 63
                . '        )';
64 64
     endif;
65
-    if (!$result = $linkHandler->db->queryF($sql)) {
65
+    if ( ! $result = $linkHandler->db->queryF($sql)) {
66 66
         //xoops_error($linkHandler->db->error());
67 67
     }
68 68
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,8 @@  discard block
 block discarded – undo
52 52
                . "                FROM {$itemHandler->table} "
53 53
                . "                WHERE {$itemHandler->table}.status > 0"
54 54
                . '            ) '
55
-               . '        )'; else:
55
+               . '        )'; else {
56
+               	:
56 57
         $sql = "    DELETE {$linkHandler->table} FROM {$linkHandler->table}"
57 58
                . "    LEFT JOIN {$itemHandler->table} AS aa ON {$linkHandler->table}.tag_itemid = aa.{$itemHandler->keyName} "
58 59
                . '    WHERE '
@@ -60,7 +61,8 @@  discard block
 block discarded – undo
60 61
                . '        AND '
61 62
                . "        ( aa.{$itemHandler->keyName} IS NULL"
62 63
                . '            OR aa.status < 1'
63
-               . '        )';
64
+               . '        )';
65
+               }
64 66
     endif;
65 67
     if (!$result = $linkHandler->db->queryF($sql)) {
66 68
         //xoops_error($linkHandler->db->error());
Please login to merge, or discard this patch.
include/search.inc.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 
10 10
     $sql = 'SELECT p.pageid, p.title, p.uid, p.datecreated, i.title FROM ' . $GLOBALS['xoopsDB']->prefix('instruction_page') . ' p, ' . $GLOBALS['xoopsDB']->prefix('instruction_instr') . ' i WHERE i.instrid = p.instrid AND i.status > 0 AND p.status > 0 AND p.type > 0';
11 11
     if (0 != $userid) {
12
-        $sql .= ' AND p.uid = ' . (int)$userid . ' ';
12
+        $sql .= ' AND p.uid = ' . (int) $userid . ' ';
13 13
         //return NULL;
14 14
     }
15 15
 
Please login to merge, or discard this patch.
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -4,45 +4,45 @@
 block discarded – undo
4 4
 
5 5
 function instruction_search($queryarray, $andor, $limit, $offset, $userid)
6 6
 {
7
-    // Подключаем функции
8
-    include_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/class/utility.php');
7
+	// Подключаем функции
8
+	include_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/class/utility.php');
9 9
 
10
-    $sql = 'SELECT p.pageid, p.title, p.uid, p.datecreated, i.title FROM ' . $GLOBALS['xoopsDB']->prefix('instruction_page') . ' p, ' . $GLOBALS['xoopsDB']->prefix('instruction_instr') . ' i WHERE i.instrid = p.instrid AND i.status > 0 AND p.status > 0 AND p.type > 0';
11
-    if (0 != $userid) {
12
-        $sql .= ' AND p.uid = ' . (int)$userid . ' ';
13
-        //return NULL;
14
-    }
10
+	$sql = 'SELECT p.pageid, p.title, p.uid, p.datecreated, i.title FROM ' . $GLOBALS['xoopsDB']->prefix('instruction_page') . ' p, ' . $GLOBALS['xoopsDB']->prefix('instruction_instr') . ' i WHERE i.instrid = p.instrid AND i.status > 0 AND p.status > 0 AND p.type > 0';
11
+	if (0 != $userid) {
12
+		$sql .= ' AND p.uid = ' . (int)$userid . ' ';
13
+		//return NULL;
14
+	}
15 15
 
16
-    // Права на просмотр
17
-    $categories = InstructionUtility::getItemIds();
18
-    if (is_array($categories) && count($categories) > 0) {
19
-        $sql .= ' AND i.cid IN ( ' . implode(', ', $categories) . ' ) ';
20
-        // Если пользователь не имеет прав просмотра ни одной категории
21
-    } else {
22
-        return null;
23
-    }
16
+	// Права на просмотр
17
+	$categories = InstructionUtility::getItemIds();
18
+	if (is_array($categories) && count($categories) > 0) {
19
+		$sql .= ' AND i.cid IN ( ' . implode(', ', $categories) . ' ) ';
20
+		// Если пользователь не имеет прав просмотра ни одной категории
21
+	} else {
22
+		return null;
23
+	}
24 24
 
25
-    // Добавляем в условие ключевые слова поиска
26
-    if (is_array($queryarray) && $count = count($queryarray)) {
27
-        $sql .= " AND ( ( p.title LIKE '%$queryarray[0]%' OR p.hometext LIKE '%$queryarray[0]%' )";
28
-        for ($i = 1; $i < $count; $i++) {
29
-            $sql .= " $andor ";
30
-            $sql .= "( p.title LIKE '%$queryarray[$i]%' OR p.hometext LIKE '%$queryarray[$i]%' )";
31
-        }
32
-        $sql .= ' ) ';
33
-    }
34
-    //$sql .= "ORDER BY date DESC";
35
-    $result = $GLOBALS['xoopsDB']->query($sql, $limit, $offset);
36
-    $ret    = [];
37
-    $i      = 0;
38
-    // Перебираем все результаты
39
-    while (list($pageid, $ptitle, $puid, $pdatecreated, $ititle) = $GLOBALS['xoopsDB']->fetchRow($result)) {
40
-        $ret[$i]['image'] = 'assets/images/size2.gif';
41
-        $ret[$i]['link']  = 'page.php?id=' . $pageid;
42
-        $ret[$i]['title'] = $ititle . ': ' . $ptitle;
43
-        $ret[$i]['time']  = $pdatecreated;
44
-        $ret[$i]['uid']   = $puid;
45
-        $i++;
46
-    }
47
-    return $ret;
25
+	// Добавляем в условие ключевые слова поиска
26
+	if (is_array($queryarray) && $count = count($queryarray)) {
27
+		$sql .= " AND ( ( p.title LIKE '%$queryarray[0]%' OR p.hometext LIKE '%$queryarray[0]%' )";
28
+		for ($i = 1; $i < $count; $i++) {
29
+			$sql .= " $andor ";
30
+			$sql .= "( p.title LIKE '%$queryarray[$i]%' OR p.hometext LIKE '%$queryarray[$i]%' )";
31
+		}
32
+		$sql .= ' ) ';
33
+	}
34
+	//$sql .= "ORDER BY date DESC";
35
+	$result = $GLOBALS['xoopsDB']->query($sql, $limit, $offset);
36
+	$ret    = [];
37
+	$i      = 0;
38
+	// Перебираем все результаты
39
+	while (list($pageid, $ptitle, $puid, $pdatecreated, $ititle) = $GLOBALS['xoopsDB']->fetchRow($result)) {
40
+		$ret[$i]['image'] = 'assets/images/size2.gif';
41
+		$ret[$i]['link']  = 'page.php?id=' . $pageid;
42
+		$ret[$i]['title'] = $ititle . ': ' . $ptitle;
43
+		$ret[$i]['time']  = $pdatecreated;
44
+		$ret[$i]['uid']   = $puid;
45
+		$i++;
46
+	}
47
+	return $ret;
48 48
 }
Please login to merge, or discard this patch.
page.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
88 88
 //
89 89
 // Если админ, рисуем админлинк
90 90
 if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid())) {
91
-    $pages['adminlink'] = '&nbsp;<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>&nbsp;<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>&nbsp;';
91
+	$pages['adminlink'] = '&nbsp;<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>&nbsp;<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>&nbsp;';
112 112
 } else {
113
-    $pages['adminlink'] = '&nbsp;';
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'] .= '&nbsp;';
120
-    // Если нет админлика
121
-    if ('[&nbsp;&nbsp;]' == $pages['adminlink']) {
122
-        $pages['adminlink'] = '';
123
-    }
113
+	$pages['adminlink'] = '&nbsp;';
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'] .= '&nbsp;';
120
+	// Если нет админлика
121
+	if ('[&nbsp;&nbsp;]' == $pages['adminlink']) {
122
+		$pages['adminlink'] = '';
123
+	}
124 124
 }
125 125
 // Выводим в шаблон
126 126
 $GLOBALS['xoopsTpl']->assign('insPage', $pages);
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 $nav_parent_id = array_reverse($nav_parent_id);
140 140
 $navigation    = '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/">' . $GLOBALS['xoopsModule']->name() . '</a>&nbsp;:&nbsp;';
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>&nbsp;:&nbsp;';
142
+	$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 143
 }
144 144
 $navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/index.php?cid=' . $objInscat->getVar('cid') . '">' . $objInscat->getVar('title') . '</a>&nbsp;:&nbsp;';
145 145
 $navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/instr.php?id=' . $pages['instrid'] . '">' . $objInsinstr->getVar('title') . '</a>';
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
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
 // Мета теги
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 // Получаем данные
21 21
 // ID страницы
22
-$pageid = isset($_GET['id']) ? (int)$_GET['id'] : 0;
22
+$pageid = isset($_GET['id']) ? (int) $_GET['id'] : 0;
23 23
 // Без кэша
24 24
 $nocache = InstructionUtility::cleanVars($_GET, 'nocache', 0, 'int');
25 25
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
 // Права на просмотр инструкции
60 60
 $categories = InstructionUtility::getItemIds();
61
-if (!in_array($objInsinstr->getVar('cid'), $categories)) {
61
+if ( ! in_array($objInsinstr->getVar('cid'), $categories)) {
62 62
     redirect_header(XOOPS_URL . '/modules/' . $moduleDirName . '/', 3, _NOPERM);
63 63
     exit();
64 64
 }
Please login to merge, or discard this patch.
class/common/traitserverstats.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -16,60 +16,60 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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";
Please login to merge, or discard this patch.