Passed
Push — master ( e12440...7742f2 )
by Michael
02:31
created
class/Common/ServerStats.php 2 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -19,66 +19,66 @@
 block discarded – undo
19 19
  */
20 20
 trait ServerStats
21 21
 {
22
-    /**
23
-     * serverStats()
24
-     *
25
-     * @return string
26
-     */
27
-    public static function getServerStats()
28
-    {
29
-        $moduleDirName = \basename(dirname(__DIR__, 2));
30
-        $moduleDirNameUpper = mb_strtoupper($moduleDirName);
31
-        \xoops_loadLanguage('common', $moduleDirName);
32
-        $html = '';
33
-
34
-        //        $sql   = 'SELECT metavalue';
35
-        //        $sql   .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta');
36
-        //        $sql   .= " WHERE metakey='version' LIMIT 1";
37
-        //        $query = $GLOBALS['xoopsDB']->query($sql);
38
-        //        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
39
-
40
-        $html .= '<fieldset>';
41
-        $html .= "<legend style='font-weight: bold; color: #900;'>" . \constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . '</legend>';
42
-        $html .= "<div style='padding: 8px;'>";
43
-        //        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>";
44
-        //        $html .= "<br>";
45
-        //        $html .= "<br>";
46
-        $html .= '<div>' . \constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . '</div>';
47
-        $html .= '<ul>';
48
-
49
-        $gdlib = \function_exists('gd_info') ? '<span style="color: #008000;">' . \constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: #ff0000;">' . \constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
50
-
51
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
52
-
53
-        if (\function_exists('gd_info')) {
54
-            if (true === ($gdlib = gd_info())) {
55
-                $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
56
-            }
57
-        }
58
-
59
-        //    $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF');
60
-
61
-        //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode;
62
-
63
-        //    $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: #008000;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: #ff0000;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>';
64
-
65
-        //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;
66
-
67
-        $downloads = \ini_get('file_uploads') ? '<span style="color: #008000;">' . \constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: #ff0000;">' . \constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
68
-
69
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
70
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: #0000ff;">' . \ini_get('upload_max_filesize') . '</span></b>';
71
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: #0000ff;">' . \ini_get('post_max_size') . '</span></b>';
72
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: #0000ff;">' . \ini_get('memory_limit') . '</span></b>';
73
-        $html .= '</ul>';
74
-        $html .= '<ul>';
75
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . '</b>';
76
-        $html .= '</ul>';
77
-        $html .= '<br>';
78
-        $html .= \constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . '';
79
-        $html .= '</div>';
80
-        $html .= '</fieldset><br>';
81
-
82
-        return $html;
83
-    }
22
+	/**
23
+	 * serverStats()
24
+	 *
25
+	 * @return string
26
+	 */
27
+	public static function getServerStats()
28
+	{
29
+		$moduleDirName = \basename(dirname(__DIR__, 2));
30
+		$moduleDirNameUpper = mb_strtoupper($moduleDirName);
31
+		\xoops_loadLanguage('common', $moduleDirName);
32
+		$html = '';
33
+
34
+		//        $sql   = 'SELECT metavalue';
35
+		//        $sql   .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta');
36
+		//        $sql   .= " WHERE metakey='version' LIMIT 1";
37
+		//        $query = $GLOBALS['xoopsDB']->query($sql);
38
+		//        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
39
+
40
+		$html .= '<fieldset>';
41
+		$html .= "<legend style='font-weight: bold; color: #900;'>" . \constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . '</legend>';
42
+		$html .= "<div style='padding: 8px;'>";
43
+		//        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>";
44
+		//        $html .= "<br>";
45
+		//        $html .= "<br>";
46
+		$html .= '<div>' . \constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . '</div>';
47
+		$html .= '<ul>';
48
+
49
+		$gdlib = \function_exists('gd_info') ? '<span style="color: #008000;">' . \constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: #ff0000;">' . \constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
50
+
51
+		$html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
52
+
53
+		if (\function_exists('gd_info')) {
54
+			if (true === ($gdlib = gd_info())) {
55
+				$html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
56
+			}
57
+		}
58
+
59
+		//    $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF');
60
+
61
+		//    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode;
62
+
63
+		//    $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: #008000;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: #ff0000;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>';
64
+
65
+		//    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;
66
+
67
+		$downloads = \ini_get('file_uploads') ? '<span style="color: #008000;">' . \constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: #ff0000;">' . \constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
68
+
69
+		$html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
70
+		$html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: #0000ff;">' . \ini_get('upload_max_filesize') . '</span></b>';
71
+		$html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: #0000ff;">' . \ini_get('post_max_size') . '</span></b>';
72
+		$html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: #0000ff;">' . \ini_get('memory_limit') . '</span></b>';
73
+		$html .= '</ul>';
74
+		$html .= '<ul>';
75
+		$html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . '</b>';
76
+		$html .= '</ul>';
77
+		$html .= '<br>';
78
+		$html .= \constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . '';
79
+		$html .= '</div>';
80
+		$html .= '</fieldset><br>';
81
+
82
+		return $html;
83
+	}
84 84
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -38,21 +38,21 @@  discard block
 block discarded – undo
38 38
         //        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
39 39
 
40 40
         $html .= '<fieldset>';
41
-        $html .= "<legend style='font-weight: bold; color: #900;'>" . \constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . '</legend>';
41
+        $html .= "<legend style='font-weight: bold; color: #900;'>".\constant('CO_'.$moduleDirNameUpper.'_IMAGEINFO').'</legend>';
42 42
         $html .= "<div style='padding: 8px;'>";
43 43
         //        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>";
44 44
         //        $html .= "<br>";
45 45
         //        $html .= "<br>";
46
-        $html .= '<div>' . \constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . '</div>';
46
+        $html .= '<div>'.\constant('CO_'.$moduleDirNameUpper.'_SPHPINI').'</div>';
47 47
         $html .= '<ul>';
48 48
 
49
-        $gdlib = \function_exists('gd_info') ? '<span style="color: #008000;">' . \constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: #ff0000;">' . \constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
49
+        $gdlib = \function_exists('gd_info') ? '<span style="color: #008000;">'.\constant('CO_'.$moduleDirNameUpper.'_GDON').'</span>' : '<span style="color: #ff0000;">'.\constant('CO_'.$moduleDirNameUpper.'_GDOFF').'</span>';
50 50
 
51
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
51
+        $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_GDLIBSTATUS').$gdlib;
52 52
 
53 53
         if (\function_exists('gd_info')) {
54 54
             if (true === ($gdlib = gd_info())) {
55
-                $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
55
+                $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_GDLIBVERSION').'<b>'.$gdlib['GD Version'].'</b>';
56 56
             }
57 57
         }
58 58
 
@@ -64,18 +64,18 @@  discard block
 block discarded – undo
64 64
 
65 65
         //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;
66 66
 
67
-        $downloads = \ini_get('file_uploads') ? '<span style="color: #008000;">' . \constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: #ff0000;">' . \constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
67
+        $downloads = \ini_get('file_uploads') ? '<span style="color: #008000;">'.\constant('CO_'.$moduleDirNameUpper.'_ON').'</span>' : '<span style="color: #ff0000;">'.\constant('CO_'.$moduleDirNameUpper.'_OFF').'</span>';
68 68
 
69
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
70
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: #0000ff;">' . \ini_get('upload_max_filesize') . '</span></b>';
71
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: #0000ff;">' . \ini_get('post_max_size') . '</span></b>';
72
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: #0000ff;">' . \ini_get('memory_limit') . '</span></b>';
69
+        $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_SERVERUPLOADSTATUS').$downloads;
70
+        $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_MAXUPLOADSIZE').' <b><span style="color: #0000ff;">'.\ini_get('upload_max_filesize').'</span></b>';
71
+        $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_MAXPOSTSIZE').' <b><span style="color: #0000ff;">'.\ini_get('post_max_size').'</span></b>';
72
+        $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_MEMORYLIMIT').' <b><span style="color: #0000ff;">'.\ini_get('memory_limit').'</span></b>';
73 73
         $html .= '</ul>';
74 74
         $html .= '<ul>';
75
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . '</b>';
75
+        $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_SERVERPATH').' <b>'.XOOPS_ROOT_PATH.'</b>';
76 76
         $html .= '</ul>';
77 77
         $html .= '<br>';
78
-        $html .= \constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . '';
78
+        $html .= \constant('CO_'.$moduleDirNameUpper.'_UPLOADPATHDSC').'';
79 79
         $html .= '</div>';
80 80
         $html .= '</fieldset><br>';
81 81
 
Please login to merge, or discard this patch.
class/Common/ModuleFeedback.php 1 patch
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -28,135 +28,135 @@
 block discarded – undo
28 28
  */
29 29
 class ModuleFeedback extends \XoopsObject
30 30
 {
31
-    public $name = '';
32
-    public $email = '';
33
-    public $site = '';
34
-    public $type = '';
35
-    public $content = '';
31
+	public $name = '';
32
+	public $email = '';
33
+	public $site = '';
34
+	public $type = '';
35
+	public $content = '';
36 36
 
37
-    /**
38
-     * Constructor
39
-     *
40
-     * @param null
41
-     */
42
-    public function __construct()
43
-    {
44
-    }
37
+	/**
38
+	 * Constructor
39
+	 *
40
+	 * @param null
41
+	 */
42
+	public function __construct()
43
+	{
44
+	}
45 45
 
46
-    /**
47
-     * @static function &getInstance
48
-     *
49
-     * @param null
50
-     */
51
-    public static function getInstance()
52
-    {
53
-        static $instance = false;
46
+	/**
47
+	 * @static function &getInstance
48
+	 *
49
+	 * @param null
50
+	 */
51
+	public static function getInstance()
52
+	{
53
+		static $instance = false;
54 54
 
55
-        if (!$instance) {
56
-            $instance = new self();
57
-        }
58
-    }
55
+		if (!$instance) {
56
+			$instance = new self();
57
+		}
58
+	}
59 59
 
60
-    /**
61
-     * @public function getFormFeedback:
62
-     * provide form for sending a feedback to module author
63
-     * @param bool $action
64
-     * @return \XoopsThemeForm
65
-     */
66
-    public function getFormFeedback($action = false)
67
-    {
68
-        if (false === $action) {
69
-            $action = $_SERVER['REQUEST_URI'];
70
-        }
60
+	/**
61
+	 * @public function getFormFeedback:
62
+	 * provide form for sending a feedback to module author
63
+	 * @param bool $action
64
+	 * @return \XoopsThemeForm
65
+	 */
66
+	public function getFormFeedback($action = false)
67
+	{
68
+		if (false === $action) {
69
+			$action = $_SERVER['REQUEST_URI'];
70
+		}
71 71
 
72
-        $moduleDirName = \basename(dirname(__DIR__, 2));
72
+		$moduleDirName = \basename(dirname(__DIR__, 2));
73 73
 
74
-        $moduleDirNameUpper = mb_strtoupper($moduleDirName);
74
+		$moduleDirNameUpper = mb_strtoupper($moduleDirName);
75 75
 
76
-        // Get Theme Form
76
+		// Get Theme Form
77 77
 
78
-        \xoops_load('XoopsFormLoader');
78
+		\xoops_load('XoopsFormLoader');
79 79
 
80
-        $form = new \XoopsThemeForm(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE'), 'formfeedback', 'feedback.php', 'post', true);
80
+		$form = new \XoopsThemeForm(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE'), 'formfeedback', 'feedback.php', 'post', true);
81 81
 
82
-        $form->setExtra('enctype="multipart/form-data"');
82
+		$form->setExtra('enctype="multipart/form-data"');
83 83
 
84
-        $recipient = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT'), 'recipient', 50, 255, $GLOBALS['xoopsModule']->getInfo('author_mail'));
84
+		$recipient = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT'), 'recipient', 50, 255, $GLOBALS['xoopsModule']->getInfo('author_mail'));
85 85
 
86
-        $recipient->setExtra('disabled="disabled"');
86
+		$recipient->setExtra('disabled="disabled"');
87 87
 
88
-        $form->addElement($recipient);
88
+		$form->addElement($recipient);
89 89
 
90
-        $your_name = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME'), 'your_name', 50, 255, $this->name);
90
+		$your_name = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME'), 'your_name', 50, 255, $this->name);
91 91
 
92
-        $your_name->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER') . '"');
92
+		$your_name->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER') . '"');
93 93
 
94
-        $form->addElement($your_name);
94
+		$form->addElement($your_name);
95 95
 
96
-        $your_site = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE'), 'your_site', 50, 255, $this->site);
96
+		$your_site = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE'), 'your_site', 50, 255, $this->site);
97 97
 
98
-        $your_site->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER') . '"');
98
+		$your_site->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER') . '"');
99 99
 
100
-        $form->addElement($your_site);
100
+		$form->addElement($your_site);
101 101
 
102
-        $your_mail = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL'), 'your_mail', 50, 255, $this->email);
102
+		$your_mail = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL'), 'your_mail', 50, 255, $this->email);
103 103
 
104
-        $your_mail->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER') . '"');
104
+		$your_mail->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER') . '"');
105 105
 
106
-        $form->addElement($your_mail);
106
+		$form->addElement($your_mail);
107 107
 
108
-        $fbtypeSelect = new \XoopsFormSelect(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE'), 'fb_type', $this->type);
108
+		$fbtypeSelect = new \XoopsFormSelect(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE'), 'fb_type', $this->type);
109 109
 
110
-        $fbtypeSelect->addOption('', '');
110
+		$fbtypeSelect->addOption('', '');
111 111
 
112
-        $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION'));
112
+		$fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION'));
113 113
 
114
-        $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS'));
114
+		$fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS'));
115 115
 
116
-        $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL'));
116
+		$fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL'));
117 117
 
118
-        $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES'));
118
+		$fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES'));
119 119
 
120
-        $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS'));
120
+		$fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS'));
121 121
 
122
-        $form->addElement($fbtypeSelect, true);
122
+		$form->addElement($fbtypeSelect, true);
123 123
 
124
-        $editorConfigs = [];
124
+		$editorConfigs = [];
125 125
 
126
-        $editorConfigs['name'] = 'fb_content';
126
+		$editorConfigs['name'] = 'fb_content';
127 127
 
128
-        $editorConfigs['value'] = $this->content;
128
+		$editorConfigs['value'] = $this->content;
129 129
 
130
-        $editorConfigs['rows'] = 5;
130
+		$editorConfigs['rows'] = 5;
131 131
 
132
-        $editorConfigs['cols'] = 40;
132
+		$editorConfigs['cols'] = 40;
133 133
 
134
-        $editorConfigs['width'] = '100%';
134
+		$editorConfigs['width'] = '100%';
135 135
 
136
-        $editorConfigs['height'] = '400px';
136
+		$editorConfigs['height'] = '400px';
137 137
 
138
-        /** @var \XoopsModuleHandler $moduleHandler */
138
+		/** @var \XoopsModuleHandler $moduleHandler */
139 139
 
140
-        $moduleHandler = \xoops_getHandler('module');
140
+		$moduleHandler = \xoops_getHandler('module');
141 141
 
142
-        $module = $moduleHandler->getByDirname('system');
142
+		$module = $moduleHandler->getByDirname('system');
143 143
 
144
-        /** @var \XoopsConfigHandler $configHandler */
144
+		/** @var \XoopsConfigHandler $configHandler */
145 145
 
146
-        $configHandler = \xoops_getHandler('config');
146
+		$configHandler = \xoops_getHandler('config');
147 147
 
148
-        $config = $configHandler->getConfigsByCat(0, $module->getVar('mid'));
148
+		$config = $configHandler->getConfigsByCat(0, $module->getVar('mid'));
149 149
 
150
-        $editorConfigs['editor'] = $config['general_editor'];
150
+		$editorConfigs['editor'] = $config['general_editor'];
151 151
 
152
-        $editor = new \XoopsFormEditor(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT'), 'fb_content', $editorConfigs);
152
+		$editor = new \XoopsFormEditor(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT'), 'fb_content', $editorConfigs);
153 153
 
154
-        $form->addElement($editor, true);
154
+		$form->addElement($editor, true);
155 155
 
156
-        $form->addElement(new \XoopsFormHidden('op', 'send'));
156
+		$form->addElement(new \XoopsFormHidden('op', 'send'));
157 157
 
158
-        $form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false));
158
+		$form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false));
159 159
 
160
-        return $form;
161
-    }
160
+		return $form;
161
+	}
162 162
 }
Please login to merge, or discard this patch.
class/Common/VersionChecks.php 1 patch
Indentation   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -19,170 +19,170 @@
 block discarded – undo
19 19
  */
20 20
 trait VersionChecks
21 21
 {
22
-    /**
23
-     * Verifies XOOPS version meets minimum requirements for this module
24
-     * @static
25
-     *
26
-     * @param null|string $requiredVer
27
-     * @return bool true if meets requirements, false if not
28
-     */
29
-    public static function checkVerXoops(?\XoopsModule $module = null, $requiredVer = null)
30
-    {
31
-        $moduleDirName = \basename(dirname(__DIR__, 2));
22
+	/**
23
+	 * Verifies XOOPS version meets minimum requirements for this module
24
+	 * @static
25
+	 *
26
+	 * @param null|string $requiredVer
27
+	 * @return bool true if meets requirements, false if not
28
+	 */
29
+	public static function checkVerXoops(?\XoopsModule $module = null, $requiredVer = null)
30
+	{
31
+		$moduleDirName = \basename(dirname(__DIR__, 2));
32 32
 
33
-        $moduleDirNameUpper = mb_strtoupper($moduleDirName);
33
+		$moduleDirNameUpper = mb_strtoupper($moduleDirName);
34 34
 
35
-        if (null === $module) {
36
-            $module = \XoopsModule::getByDirname($moduleDirName);
37
-        }
35
+		if (null === $module) {
36
+			$module = \XoopsModule::getByDirname($moduleDirName);
37
+		}
38 38
 
39
-        \xoops_loadLanguage('admin', $moduleDirName);
39
+		\xoops_loadLanguage('admin', $moduleDirName);
40 40
 
41
-        \xoops_loadLanguage('common', $moduleDirName);
41
+		\xoops_loadLanguage('common', $moduleDirName);
42 42
 
43
-        //check for minimum XOOPS version
44
-        $currentVer = mb_substr(\XOOPS_VERSION, 6); // get the numeric part of string
45
-        if (null === $requiredVer) {
46
-            $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
47
-        }
43
+		//check for minimum XOOPS version
44
+		$currentVer = mb_substr(\XOOPS_VERSION, 6); // get the numeric part of string
45
+		if (null === $requiredVer) {
46
+			$requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
47
+		}
48 48
 
49
-        $success = true;
49
+		$success = true;
50 50
 
51
-        if (\version_compare($currentVer, $requiredVer, '<')) {
52
-            $success = false;
51
+		if (\version_compare($currentVer, $requiredVer, '<')) {
52
+			$success = false;
53 53
 
54
-            $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer));
55
-        }
54
+			$module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer));
55
+		}
56 56
 
57
-        return $success;
58
-    }
57
+		return $success;
58
+	}
59 59
 
60
-    /**
61
-     * Verifies PHP version meets minimum requirements for this module
62
-     * @static
63
-     *
64
-     * @return bool true if meets requirements, false if not
65
-     */
66
-    public static function checkVerPhp(?\XoopsModule $module = null)
67
-    {
68
-        $moduleDirName = \basename(dirname(__DIR__, 2));
60
+	/**
61
+	 * Verifies PHP version meets minimum requirements for this module
62
+	 * @static
63
+	 *
64
+	 * @return bool true if meets requirements, false if not
65
+	 */
66
+	public static function checkVerPhp(?\XoopsModule $module = null)
67
+	{
68
+		$moduleDirName = \basename(dirname(__DIR__, 2));
69 69
 
70
-        $moduleDirNameUpper = mb_strtoupper($moduleDirName);
70
+		$moduleDirNameUpper = mb_strtoupper($moduleDirName);
71 71
 
72
-        if (null === $module) {
73
-            $module = \XoopsModule::getByDirname($moduleDirName);
74
-        }
72
+		if (null === $module) {
73
+			$module = \XoopsModule::getByDirname($moduleDirName);
74
+		}
75 75
 
76
-        \xoops_loadLanguage('admin', $moduleDirName);
76
+		\xoops_loadLanguage('admin', $moduleDirName);
77 77
 
78
-        \xoops_loadLanguage('common', $moduleDirName);
78
+		\xoops_loadLanguage('common', $moduleDirName);
79 79
 
80
-        // check for minimum PHP version
80
+		// check for minimum PHP version
81 81
 
82
-        $success = true;
82
+		$success = true;
83 83
 
84
-        $verNum = \PHP_VERSION;
84
+		$verNum = \PHP_VERSION;
85 85
 
86
-        $reqVer = &$module->getInfo('min_php');
86
+		$reqVer = &$module->getInfo('min_php');
87 87
 
88
-        if (false !== $reqVer && '' !== $reqVer && !\is_array($reqVer)) {
89
-            if (\version_compare($verNum, $reqVer, '<')) {
90
-                $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum));
88
+		if (false !== $reqVer && '' !== $reqVer && !\is_array($reqVer)) {
89
+			if (\version_compare($verNum, $reqVer, '<')) {
90
+				$module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum));
91 91
 
92
-                $success = false;
93
-            }
94
-        }
92
+				$success = false;
93
+			}
94
+		}
95 95
 
96
-        return $success;
97
-    }
96
+		return $success;
97
+	}
98 98
 
99
-    /**
100
-     * compares current module version with latest GitHub release
101
-     * @static
102
-     * @param \Xmf\Module\Helper $helper
103
-     * @param string|null        $source
104
-     * @param string|null        $default
105
-     *
106
-     * @return string|array info about the latest module version, if newer
107
-     */
108
-    public static function checkVerModule($helper, $source = 'github', $default = 'master')
109
-    {
110
-        $moduleDirName = \basename(dirname(__DIR__, 2));
99
+	/**
100
+	 * compares current module version with latest GitHub release
101
+	 * @static
102
+	 * @param \Xmf\Module\Helper $helper
103
+	 * @param string|null        $source
104
+	 * @param string|null        $default
105
+	 *
106
+	 * @return string|array info about the latest module version, if newer
107
+	 */
108
+	public static function checkVerModule($helper, $source = 'github', $default = 'master')
109
+	{
110
+		$moduleDirName = \basename(dirname(__DIR__, 2));
111 111
 
112
-        $moduleDirNameUpper = mb_strtoupper($moduleDirName);
112
+		$moduleDirNameUpper = mb_strtoupper($moduleDirName);
113 113
 
114
-        $update = '';
114
+		$update = '';
115 115
 
116
-        $repository = 'XoopsModules25x/' . $moduleDirName;
116
+		$repository = 'XoopsModules25x/' . $moduleDirName;
117 117
 
118
-        //        $repository         = 'XoopsModules25x/publisher'; //for testing only
118
+		//        $repository         = 'XoopsModules25x/publisher'; //for testing only
119 119
 
120
-        $ret = '';
120
+		$ret = '';
121 121
 
122
-        $infoReleasesUrl = "https://api.github.com/repos/$repository/releases";
122
+		$infoReleasesUrl = "https://api.github.com/repos/$repository/releases";
123 123
 
124
-        if ('github' === $source) {
125
-            if (\function_exists('curl_init') && false !== ($curlHandle = \curl_init())) {
126
-                \curl_setopt($curlHandle, \CURLOPT_URL, $infoReleasesUrl);
124
+		if ('github' === $source) {
125
+			if (\function_exists('curl_init') && false !== ($curlHandle = \curl_init())) {
126
+				\curl_setopt($curlHandle, \CURLOPT_URL, $infoReleasesUrl);
127 127
 
128
-                \curl_setopt($curlHandle, \CURLOPT_RETURNTRANSFER, true);
128
+				\curl_setopt($curlHandle, \CURLOPT_RETURNTRANSFER, true);
129 129
 
130
-                \curl_setopt($curlHandle, \CURLOPT_SSL_VERIFYPEER, true);
130
+				\curl_setopt($curlHandle, \CURLOPT_SSL_VERIFYPEER, true);
131 131
 
132
-                \curl_setopt($curlHandle, \CURLOPT_HTTPHEADER, ["User-Agent:Publisher\r\n"]);
132
+				\curl_setopt($curlHandle, \CURLOPT_HTTPHEADER, ["User-Agent:Publisher\r\n"]);
133 133
 
134
-                $curlReturn = \curl_exec($curlHandle);
134
+				$curlReturn = \curl_exec($curlHandle);
135 135
 
136
-                if (false === $curlReturn) {
137
-                    \trigger_error(\curl_error($curlHandle));
138
-                } elseif (false !== \mb_strpos($curlReturn, 'Not Found')) {
139
-                    \trigger_error('Repository Not Found: ' . $infoReleasesUrl);
140
-                } else {
141
-                    $file = \json_decode($curlReturn, false);
136
+				if (false === $curlReturn) {
137
+					\trigger_error(\curl_error($curlHandle));
138
+				} elseif (false !== \mb_strpos($curlReturn, 'Not Found')) {
139
+					\trigger_error('Repository Not Found: ' . $infoReleasesUrl);
140
+				} else {
141
+					$file = \json_decode($curlReturn, false);
142 142
 
143
-                    $latestVersionLink = \sprintf("https://github.com/$repository/archive/%s.zip", $file ? \reset($file)->tag_name : $default);
143
+					$latestVersionLink = \sprintf("https://github.com/$repository/archive/%s.zip", $file ? \reset($file)->tag_name : $default);
144 144
 
145
-                    $latestVersion = $file[0]->tag_name;
145
+					$latestVersion = $file[0]->tag_name;
146 146
 
147
-                    $prerelease = $file[0]->prerelease;
147
+					$prerelease = $file[0]->prerelease;
148 148
 
149
-                    if ('master' !== $latestVersionLink) {
150
-                        $update = \constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion;
151
-                    }
149
+					if ('master' !== $latestVersionLink) {
150
+						$update = \constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion;
151
+					}
152 152
 
153
-                    //"PHP-standardized" version
153
+					//"PHP-standardized" version
154 154
 
155
-                    $latestVersion = mb_strtolower($latestVersion);
155
+					$latestVersion = mb_strtolower($latestVersion);
156 156
 
157
-                    if (false !== mb_strpos($latestVersion, 'final')) {
158
-                        $latestVersion = \str_replace('_', '', mb_strtolower($latestVersion));
157
+					if (false !== mb_strpos($latestVersion, 'final')) {
158
+						$latestVersion = \str_replace('_', '', mb_strtolower($latestVersion));
159 159
 
160
-                        $latestVersion = \str_replace('final', '', mb_strtolower($latestVersion));
161
-                    }
160
+						$latestVersion = \str_replace('final', '', mb_strtolower($latestVersion));
161
+					}
162 162
 
163
-                    $moduleVersion = $helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status');
163
+					$moduleVersion = $helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status');
164 164
 
165
-                    //"PHP-standardized" version
165
+					//"PHP-standardized" version
166 166
 
167
-                    $moduleVersion = \str_replace(' ', '', mb_strtolower($moduleVersion));
167
+					$moduleVersion = \str_replace(' ', '', mb_strtolower($moduleVersion));
168 168
 
169
-                    //                    $moduleVersion = '1.0'; //for testing only
169
+					//                    $moduleVersion = '1.0'; //for testing only
170 170
 
171
-                    //                    $moduleDirName = 'publisher'; //for testing only
171
+					//                    $moduleDirName = 'publisher'; //for testing only
172 172
 
173
-                    if (!$prerelease && \version_compare($moduleVersion, $latestVersion, '<')) {
174
-                        $ret = [];
173
+					if (!$prerelease && \version_compare($moduleVersion, $latestVersion, '<')) {
174
+						$ret = [];
175 175
 
176
-                        $ret[] = $update;
176
+						$ret[] = $update;
177 177
 
178
-                        $ret[] = $latestVersionLink;
179
-                    }
180
-                }
178
+						$ret[] = $latestVersionLink;
179
+					}
180
+				}
181 181
 
182
-                \curl_close($curlHandle);
183
-            }
184
-        }
182
+				\curl_close($curlHandle);
183
+			}
184
+		}
185 185
 
186
-        return $ret;
187
-    }
186
+		return $ret;
187
+	}
188 188
 }
Please login to merge, or discard this patch.
class/Common/FileChecker.php 2 patches
Indentation   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -36,146 +36,146 @@
 block discarded – undo
36 36
  */
37 37
 class FileChecker
38 38
 {
39
-    /**
40
-     * @param string      $file_path
41
-     * @param string|null $original_file_path
42
-     * @param string      $redirectFile
43
-     * @return bool|string
44
-     */
45
-    public static function getFileStatus($file_path, $original_file_path, $redirectFile)
46
-    {
47
-        global $pathIcon16;
39
+	/**
40
+	 * @param string      $file_path
41
+	 * @param string|null $original_file_path
42
+	 * @param string      $redirectFile
43
+	 * @return bool|string
44
+	 */
45
+	public static function getFileStatus($file_path, $original_file_path, $redirectFile)
46
+	{
47
+		global $pathIcon16;
48 48
 
49
-        if (empty($file_path)) {
50
-            return false;
51
-        }
49
+		if (empty($file_path)) {
50
+			return false;
51
+		}
52 52
 
53
-        if (null === $redirectFile) {
54
-            $redirectFile = $_SERVER['SCRIPT_NAME'];
55
-        }
56
-
57
-        $moduleDirName = \basename(dirname(__DIR__, 2));
58
-
59
-        $moduleDirNameUpper = mb_strtoupper($moduleDirName);
60
-
61
-        if (null === $original_file_path) {
62
-            if (self::fileExists($file_path)) {
63
-                $path_status = "<img src='$pathIcon16/1.png' >";
64
-
65
-                $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_AVAILABLE') . ') ';
66
-            } else {
67
-                $path_status = "<img src='$pathIcon16/0.png' >";
68
-
69
-                $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_NOTAVAILABLE') . ') ';
70
-            }
71
-        } else {
72
-            if (self::compareFiles($file_path, $original_file_path)) {
73
-                $path_status = "<img src='$pathIcon16/1.png' >";
74
-
75
-                $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_AVAILABLE') . ') ';
76
-            } else {
77
-                $path_status = "<img src='$pathIcon16/0.png' >";
78
-
79
-                $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_NOTAVAILABLE') . ') ';
80
-
81
-                $path_status .= "<form action='" . $_SERVER['SCRIPT_NAME'] . "' method='post'>";
82
-
83
-                $path_status .= "<input type='hidden' name='op' value='copyfile'>";
84
-
85
-                $path_status .= "<input type='hidden' name='file_path' value='$file_path'>";
86
-
87
-                $path_status .= "<input type='hidden' name='original_file_path' value='$original_file_path'>";
88
-
89
-                $path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>";
90
-
91
-                $path_status .= "<button class='submit' onClick='this.form.submit();'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_CREATETHEFILE') . '</button>';
92
-
93
-                $path_status .= '</form>';
94
-            }
95
-        }
96
-
97
-        return $path_status;
98
-    }
99
-
100
-    /**
101
-     * @param   $source_path
102
-     * @param   $destination_path
103
-     *
104
-     * @return bool
105
-     */
106
-    public static function copyFile($source_path, $destination_path)
107
-    {
108
-        $source_path = \str_replace('..', '', $source_path);
109
-
110
-        $destination_path = \str_replace('..', '', $destination_path);
111
-
112
-        return @\copy($source_path, $destination_path);
113
-    }
114
-
115
-    /**
116
-     * @param   $file1_path
117
-     * @param   $file2_path
118
-     *
119
-     * @return bool
120
-     */
121
-    public static function compareFiles($file1_path, $file2_path)
122
-    {
123
-        if (!self::fileExists($file1_path) || !self::fileExists($file2_path)) {
124
-            return false;
125
-        }
126
-
127
-        if (\filetype($file1_path) !== \filetype($file2_path)) {
128
-            return false;
129
-        }
130
-
131
-        if (\filesize($file1_path) !== \filesize($file2_path)) {
132
-            return false;
133
-        }
134
-
135
-        $crc1 = mb_strtoupper(\dechex(\crc32(file_get_contents($file1_path))));
136
-
137
-        $crc2 = mb_strtoupper(\dechex(\crc32(file_get_contents($file2_path))));
138
-
139
-        return !($crc1 !== $crc2);
140
-    }
141
-
142
-    /**
143
-     * @param   $file_path
144
-     *
145
-     * @return bool
146
-     */
147
-    public static function fileExists($file_path)
148
-    {
149
-        return \is_file($file_path);
150
-    }
53
+		if (null === $redirectFile) {
54
+			$redirectFile = $_SERVER['SCRIPT_NAME'];
55
+		}
56
+
57
+		$moduleDirName = \basename(dirname(__DIR__, 2));
58
+
59
+		$moduleDirNameUpper = mb_strtoupper($moduleDirName);
60
+
61
+		if (null === $original_file_path) {
62
+			if (self::fileExists($file_path)) {
63
+				$path_status = "<img src='$pathIcon16/1.png' >";
64
+
65
+				$path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_AVAILABLE') . ') ';
66
+			} else {
67
+				$path_status = "<img src='$pathIcon16/0.png' >";
68
+
69
+				$path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_NOTAVAILABLE') . ') ';
70
+			}
71
+		} else {
72
+			if (self::compareFiles($file_path, $original_file_path)) {
73
+				$path_status = "<img src='$pathIcon16/1.png' >";
74
+
75
+				$path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_AVAILABLE') . ') ';
76
+			} else {
77
+				$path_status = "<img src='$pathIcon16/0.png' >";
78
+
79
+				$path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_NOTAVAILABLE') . ') ';
80
+
81
+				$path_status .= "<form action='" . $_SERVER['SCRIPT_NAME'] . "' method='post'>";
82
+
83
+				$path_status .= "<input type='hidden' name='op' value='copyfile'>";
84
+
85
+				$path_status .= "<input type='hidden' name='file_path' value='$file_path'>";
86
+
87
+				$path_status .= "<input type='hidden' name='original_file_path' value='$original_file_path'>";
88
+
89
+				$path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>";
90
+
91
+				$path_status .= "<button class='submit' onClick='this.form.submit();'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_CREATETHEFILE') . '</button>';
92
+
93
+				$path_status .= '</form>';
94
+			}
95
+		}
96
+
97
+		return $path_status;
98
+	}
99
+
100
+	/**
101
+	 * @param   $source_path
102
+	 * @param   $destination_path
103
+	 *
104
+	 * @return bool
105
+	 */
106
+	public static function copyFile($source_path, $destination_path)
107
+	{
108
+		$source_path = \str_replace('..', '', $source_path);
109
+
110
+		$destination_path = \str_replace('..', '', $destination_path);
111
+
112
+		return @\copy($source_path, $destination_path);
113
+	}
114
+
115
+	/**
116
+	 * @param   $file1_path
117
+	 * @param   $file2_path
118
+	 *
119
+	 * @return bool
120
+	 */
121
+	public static function compareFiles($file1_path, $file2_path)
122
+	{
123
+		if (!self::fileExists($file1_path) || !self::fileExists($file2_path)) {
124
+			return false;
125
+		}
126
+
127
+		if (\filetype($file1_path) !== \filetype($file2_path)) {
128
+			return false;
129
+		}
130
+
131
+		if (\filesize($file1_path) !== \filesize($file2_path)) {
132
+			return false;
133
+		}
134
+
135
+		$crc1 = mb_strtoupper(\dechex(\crc32(file_get_contents($file1_path))));
136
+
137
+		$crc2 = mb_strtoupper(\dechex(\crc32(file_get_contents($file2_path))));
138
+
139
+		return !($crc1 !== $crc2);
140
+	}
141
+
142
+	/**
143
+	 * @param   $file_path
144
+	 *
145
+	 * @return bool
146
+	 */
147
+	public static function fileExists($file_path)
148
+	{
149
+		return \is_file($file_path);
150
+	}
151 151
 
152
-    /**
153
-     * @param     $target
154
-     * @param int $mode
155
-     *
156
-     * @return bool
157
-     */
158
-    public static function setFilePermissions($target, $mode = 0777)
159
-    {
160
-        $target = \str_replace('..', '', $target);
161
-
162
-        return @\chmod($target, (int)$mode);
163
-    }
152
+	/**
153
+	 * @param     $target
154
+	 * @param int $mode
155
+	 *
156
+	 * @return bool
157
+	 */
158
+	public static function setFilePermissions($target, $mode = 0777)
159
+	{
160
+		$target = \str_replace('..', '', $target);
161
+
162
+		return @\chmod($target, (int)$mode);
163
+	}
164 164
 }
165 165
 
166 166
 $op = Request::getString('op', '', 'POST');
167 167
 switch ($op) {
168
-    case 'copyfile':
169
-        if (\Xmf\Request::hasVar('original_file_path', 'POST')) {
170
-            $original_file_path = $_POST['original_file_path'];
171
-        }
172
-        if (\Xmf\Request::hasVar('file_path', 'POST')) {
173
-            $file_path = $_POST['file_path'];
174
-        }
175
-        if (\Xmf\Request::hasVar('redirect', 'POST')) {
176
-            $redirect = $_POST['redirect'];
177
-        }
178
-        $msg = FileChecker::copyFile($original_file_path, $file_path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILECOPIED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILENOTCOPIED');
179
-        \redirect_header($redirect, 2, $msg . ': ' . $file_path);
180
-        break;
168
+	case 'copyfile':
169
+		if (\Xmf\Request::hasVar('original_file_path', 'POST')) {
170
+			$original_file_path = $_POST['original_file_path'];
171
+		}
172
+		if (\Xmf\Request::hasVar('file_path', 'POST')) {
173
+			$file_path = $_POST['file_path'];
174
+		}
175
+		if (\Xmf\Request::hasVar('redirect', 'POST')) {
176
+			$redirect = $_POST['redirect'];
177
+		}
178
+		$msg = FileChecker::copyFile($original_file_path, $file_path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILECOPIED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILENOTCOPIED');
179
+		\redirect_header($redirect, 2, $msg . ': ' . $file_path);
180
+		break;
181 181
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 //defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined');
27 27
 
28
-require_once dirname(__DIR__, 4) . '/mainfile.php';
28
+require_once dirname(__DIR__, 4).'/mainfile.php';
29 29
 $moduleDirName      = \basename(dirname(__DIR__, 2));
30 30
 $moduleDirNameUpper = mb_strtoupper($moduleDirName);
31 31
 \xoops_loadLanguage('filechecker', $moduleDirName);
@@ -62,23 +62,23 @@  discard block
 block discarded – undo
62 62
             if (self::fileExists($file_path)) {
63 63
                 $path_status = "<img src='$pathIcon16/1.png' >";
64 64
 
65
-                $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_AVAILABLE') . ') ';
65
+                $path_status .= "$file_path (".\constant('CO_'.$moduleDirNameUpper.'_'.'FC_AVAILABLE').') ';
66 66
             } else {
67 67
                 $path_status = "<img src='$pathIcon16/0.png' >";
68 68
 
69
-                $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_NOTAVAILABLE') . ') ';
69
+                $path_status .= "$file_path (".\constant('CO_'.$moduleDirNameUpper.'_'.'FC_NOTAVAILABLE').') ';
70 70
             }
71 71
         } else {
72 72
             if (self::compareFiles($file_path, $original_file_path)) {
73 73
                 $path_status = "<img src='$pathIcon16/1.png' >";
74 74
 
75
-                $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_AVAILABLE') . ') ';
75
+                $path_status .= "$file_path (".\constant('CO_'.$moduleDirNameUpper.'_'.'FC_AVAILABLE').') ';
76 76
             } else {
77 77
                 $path_status = "<img src='$pathIcon16/0.png' >";
78 78
 
79
-                $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_NOTAVAILABLE') . ') ';
79
+                $path_status .= "$file_path (".\constant('CO_'.$moduleDirNameUpper.'_'.'FC_NOTAVAILABLE').') ';
80 80
 
81
-                $path_status .= "<form action='" . $_SERVER['SCRIPT_NAME'] . "' method='post'>";
81
+                $path_status .= "<form action='".$_SERVER['SCRIPT_NAME']."' method='post'>";
82 82
 
83 83
                 $path_status .= "<input type='hidden' name='op' value='copyfile'>";
84 84
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
                 $path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>";
90 90
 
91
-                $path_status .= "<button class='submit' onClick='this.form.submit();'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_CREATETHEFILE') . '</button>';
91
+                $path_status .= "<button class='submit' onClick='this.form.submit();'>".\constant('CO_'.$moduleDirNameUpper.'_'.'FC_CREATETHEFILE').'</button>';
92 92
 
93 93
                 $path_status .= '</form>';
94 94
             }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     {
160 160
         $target = \str_replace('..', '', $target);
161 161
 
162
-        return @\chmod($target, (int)$mode);
162
+        return @\chmod($target, (int) $mode);
163 163
     }
164 164
 }
165 165
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
         if (\Xmf\Request::hasVar('redirect', 'POST')) {
176 176
             $redirect = $_POST['redirect'];
177 177
         }
178
-        $msg = FileChecker::copyFile($original_file_path, $file_path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILECOPIED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILENOTCOPIED');
179
-        \redirect_header($redirect, 2, $msg . ': ' . $file_path);
178
+        $msg = FileChecker::copyFile($original_file_path, $file_path) ? \constant('CO_'.$moduleDirNameUpper.'_'.'FC_FILECOPIED') : \constant('CO_'.$moduleDirNameUpper.'_'.'FC_FILENOTCOPIED');
179
+        \redirect_header($redirect, 2, $msg.': '.$file_path);
180 180
         break;
181 181
 }
Please login to merge, or discard this patch.
class/Common/Configurator.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -28,56 +28,56 @@
 block discarded – undo
28 28
  */
29 29
 class Configurator
30 30
 {
31
-    public $name;
32
-    public $paths = [];
33
-    public $uploadFolders = [];
34
-    public $copyBlankFiles = [];
35
-    public $copyTestFolders = [];
36
-    public $templateFolders = [];
37
-    public $oldFiles = [];
38
-    public $oldFolders = [];
39
-    public $renameTables = [];
40
-    public $moduleStats = [];
41
-    public $modCopyright;
42
-    public $icons;
31
+	public $name;
32
+	public $paths = [];
33
+	public $uploadFolders = [];
34
+	public $copyBlankFiles = [];
35
+	public $copyTestFolders = [];
36
+	public $templateFolders = [];
37
+	public $oldFiles = [];
38
+	public $oldFolders = [];
39
+	public $renameTables = [];
40
+	public $moduleStats = [];
41
+	public $modCopyright;
42
+	public $icons;
43 43
 
44
-    /**
45
-     * Configurator constructor.
46
-     */
47
-    public function __construct()
48
-    {
49
-        //        $moduleDirName      = basename(dirname(dirname(__DIR__)));
50
-        //        $moduleDirNameUpper = mb_strtoupper($moduleDirName);
44
+	/**
45
+	 * Configurator constructor.
46
+	 */
47
+	public function __construct()
48
+	{
49
+		//        $moduleDirName      = basename(dirname(dirname(__DIR__)));
50
+		//        $moduleDirNameUpper = mb_strtoupper($moduleDirName);
51 51
 
52
-        //        require dirname(dirname(__DIR__)) . '/config/config.php';
53
-        //        $config = getConfig();
52
+		//        require dirname(dirname(__DIR__)) . '/config/config.php';
53
+		//        $config = getConfig();
54 54
 
55
-        $config = include dirname(__DIR__, 2) . '/config/config.php';
55
+		$config = include dirname(__DIR__, 2) . '/config/config.php';
56 56
 
57
-        $this->name = $config->name;
57
+		$this->name = $config->name;
58 58
 
59
-        $this->paths = $config->paths;
59
+		$this->paths = $config->paths;
60 60
 
61
-        $this->uploadFolders = $config->uploadFolders;
61
+		$this->uploadFolders = $config->uploadFolders;
62 62
 
63
-        $this->copyBlankFiles = $config->copyBlankFiles;
63
+		$this->copyBlankFiles = $config->copyBlankFiles;
64 64
 
65
-        $this->copyTestFolders = $config->copyTestFolders;
65
+		$this->copyTestFolders = $config->copyTestFolders;
66 66
 
67
-        $this->templateFolders = $config->templateFolders;
67
+		$this->templateFolders = $config->templateFolders;
68 68
 
69
-        $this->oldFiles = $config->oldFiles;
69
+		$this->oldFiles = $config->oldFiles;
70 70
 
71
-        $this->oldFolders = $config->oldFolders;
71
+		$this->oldFolders = $config->oldFolders;
72 72
 
73
-        $this->renameTables = $config->renameTables;
73
+		$this->renameTables = $config->renameTables;
74 74
 
75
-        $this->moduleStats = $config->moduleStats;
75
+		$this->moduleStats = $config->moduleStats;
76 76
 
77
-        $this->modCopyright = $config->modCopyright;
77
+		$this->modCopyright = $config->modCopyright;
78 78
 
79
-        $this->icons = include dirname(__DIR__, 2) . '/config/icons.php';
79
+		$this->icons = include dirname(__DIR__, 2) . '/config/icons.php';
80 80
 
81
-        $this->paths = include dirname(__DIR__, 2) . '/config/paths.php';
82
-    }
81
+		$this->paths = include dirname(__DIR__, 2) . '/config/paths.php';
82
+	}
83 83
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         //        require dirname(dirname(__DIR__)) . '/config/config.php';
53 53
         //        $config = getConfig();
54 54
 
55
-        $config = include dirname(__DIR__, 2) . '/config/config.php';
55
+        $config = include dirname(__DIR__, 2).'/config/config.php';
56 56
 
57 57
         $this->name = $config->name;
58 58
 
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 
77 77
         $this->modCopyright = $config->modCopyright;
78 78
 
79
-        $this->icons = include dirname(__DIR__, 2) . '/config/icons.php';
79
+        $this->icons = include dirname(__DIR__, 2).'/config/icons.php';
80 80
 
81
-        $this->paths = include dirname(__DIR__, 2) . '/config/paths.php';
81
+        $this->paths = include dirname(__DIR__, 2).'/config/paths.php';
82 82
     }
83 83
 }
Please login to merge, or discard this patch.
class/Common/DirectoryChecker.php 2 patches
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -36,158 +36,158 @@
 block discarded – undo
36 36
  */
37 37
 class DirectoryChecker
38 38
 {
39
-    /**
40
-     * @param     $path
41
-     * @param int $mode
42
-     * @param     $redirectFile
43
-     *
44
-     * @return bool|string
45
-     */
46
-    public static function getDirectoryStatus($path, $mode = 0777, $redirectFile = null)
47
-    {
48
-        global $pathIcon16;
39
+	/**
40
+	 * @param     $path
41
+	 * @param int $mode
42
+	 * @param     $redirectFile
43
+	 *
44
+	 * @return bool|string
45
+	 */
46
+	public static function getDirectoryStatus($path, $mode = 0777, $redirectFile = null)
47
+	{
48
+		global $pathIcon16;
49 49
 
50
-        if (empty($path)) {
51
-            return false;
52
-        }
50
+		if (empty($path)) {
51
+			return false;
52
+		}
53 53
 
54
-        if (null === $redirectFile) {
55
-            $redirectFile = $_SERVER['SCRIPT_NAME'];
56
-        }
54
+		if (null === $redirectFile) {
55
+			$redirectFile = $_SERVER['SCRIPT_NAME'];
56
+		}
57 57
 
58
-        $moduleDirName = \basename(dirname(__DIR__, 2));
58
+		$moduleDirName = \basename(dirname(__DIR__, 2));
59 59
 
60
-        $moduleDirNameUpper = mb_strtoupper($moduleDirName);
60
+		$moduleDirNameUpper = mb_strtoupper($moduleDirName);
61 61
 
62
-        if (!@\is_dir($path)) {
63
-            $path_status = "<img src='$pathIcon16/0.png' >";
62
+		if (!@\is_dir($path)) {
63
+			$path_status = "<img src='$pathIcon16/0.png' >";
64 64
 
65
-            $path_status .= "$path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTAVAILABLE') . ') ';
65
+			$path_status .= "$path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTAVAILABLE') . ') ';
66 66
 
67
-            $path_status .= "<form action='" . $_SERVER['SCRIPT_NAME'] . "' method='post'>";
67
+			$path_status .= "<form action='" . $_SERVER['SCRIPT_NAME'] . "' method='post'>";
68 68
 
69
-            $path_status .= "<input type='hidden' name='op' value='createdir'>";
69
+			$path_status .= "<input type='hidden' name='op' value='createdir'>";
70 70
 
71
-            $path_status .= "<input type='hidden' name='path' value='$path'>";
71
+			$path_status .= "<input type='hidden' name='path' value='$path'>";
72 72
 
73
-            $path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>";
73
+			$path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>";
74 74
 
75
-            $path_status .= "<button class='submit' onClick='this.form.submit();'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_CREATETHEDIR') . '</button>';
75
+			$path_status .= "<button class='submit' onClick='this.form.submit();'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_CREATETHEDIR') . '</button>';
76 76
 
77
-            $path_status .= '</form>';
78
-        } elseif (@\is_writable($path)) {
79
-            $path_status = "<img src='$pathIcon16/1.png' >";
77
+			$path_status .= '</form>';
78
+		} elseif (@\is_writable($path)) {
79
+			$path_status = "<img src='$pathIcon16/1.png' >";
80 80
 
81
-            $path_status .= "$path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_AVAILABLE') . ') ';
81
+			$path_status .= "$path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_AVAILABLE') . ') ';
82 82
 
83
-            $currentMode = mb_substr(\decoct(\fileperms($path)), 2);
83
+			$currentMode = mb_substr(\decoct(\fileperms($path)), 2);
84 84
 
85
-            if ($currentMode != \decoct($mode)) {
86
-                $path_status = "<img src='$pathIcon16/0.png' >";
85
+			if ($currentMode != \decoct($mode)) {
86
+				$path_status = "<img src='$pathIcon16/0.png' >";
87 87
 
88
-                $path_status .= $path . \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTWRITABLE'), \decoct($mode), $currentMode);
88
+				$path_status .= $path . \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTWRITABLE'), \decoct($mode), $currentMode);
89 89
 
90
-                $path_status .= "<form action='" . $_SERVER['SCRIPT_NAME'] . "' method='post'>";
90
+				$path_status .= "<form action='" . $_SERVER['SCRIPT_NAME'] . "' method='post'>";
91 91
 
92
-                $path_status .= "<input type='hidden' name='op' value='setdirperm'>";
92
+				$path_status .= "<input type='hidden' name='op' value='setdirperm'>";
93 93
 
94
-                $path_status .= "<input type='hidden' name='mode' value='$mode'>";
94
+				$path_status .= "<input type='hidden' name='mode' value='$mode'>";
95 95
 
96
-                $path_status .= "<input type='hidden' name='path' value='$path'>";
96
+				$path_status .= "<input type='hidden' name='path' value='$path'>";
97 97
 
98
-                $path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>";
98
+				$path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>";
99 99
 
100
-                $path_status .= "<button class='submit' onClick='this.form.submit();'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_SETMPERM') . '</button>';
100
+				$path_status .= "<button class='submit' onClick='this.form.submit();'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_SETMPERM') . '</button>';
101 101
 
102
-                $path_status .= '</form>';
103
-            }
104
-        } else {
105
-            $currentMode = mb_substr(\decoct(\fileperms($path)), 2);
102
+				$path_status .= '</form>';
103
+			}
104
+		} else {
105
+			$currentMode = mb_substr(\decoct(\fileperms($path)), 2);
106 106
 
107
-            $path_status = "<img src='$pathIcon16/0.png' >";
107
+			$path_status = "<img src='$pathIcon16/0.png' >";
108 108
 
109
-            $path_status .= $path . \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTWRITABLE'), \decoct($mode), $currentMode);
109
+			$path_status .= $path . \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTWRITABLE'), \decoct($mode), $currentMode);
110 110
 
111
-            $path_status .= "<form action='" . $_SERVER['SCRIPT_NAME'] . "' method='post'>";
111
+			$path_status .= "<form action='" . $_SERVER['SCRIPT_NAME'] . "' method='post'>";
112 112
 
113
-            $path_status .= "<input type='hidden' name='op' value='setdirperm'>";
113
+			$path_status .= "<input type='hidden' name='op' value='setdirperm'>";
114 114
 
115
-            $path_status .= "<input type='hidden' name='mode' value='$mode'>";
115
+			$path_status .= "<input type='hidden' name='mode' value='$mode'>";
116 116
 
117
-            $path_status .= "<input type='hidden' name='path' value='$path'>";
117
+			$path_status .= "<input type='hidden' name='path' value='$path'>";
118 118
 
119
-            $path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>";
119
+			$path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>";
120 120
 
121
-            $path_status .= "<button class='submit' onClick='this.form.submit();'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_SETMPERM') . '</button>';
121
+			$path_status .= "<button class='submit' onClick='this.form.submit();'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_SETMPERM') . '</button>';
122 122
 
123
-            $path_status .= '</form>';
124
-        }
123
+			$path_status .= '</form>';
124
+		}
125 125
 
126
-        return $path_status;
127
-    }
126
+		return $path_status;
127
+	}
128 128
 
129
-    /**
130
-     * @param     $target
131
-     * @param int $mode
132
-     *
133
-     * @return bool
134
-     */
135
-    public static function createDirectory($target, $mode = 0777)
136
-    {
137
-        $target = \str_replace('..', '', $target);
129
+	/**
130
+	 * @param     $target
131
+	 * @param int $mode
132
+	 *
133
+	 * @return bool
134
+	 */
135
+	public static function createDirectory($target, $mode = 0777)
136
+	{
137
+		$target = \str_replace('..', '', $target);
138 138
 
139
-        // http://www.php.net/manual/en/function.mkdir.php
139
+		// http://www.php.net/manual/en/function.mkdir.php
140 140
 
141
-        return \is_dir($target) || (self::createDirectory(\dirname($target), $mode) && !\mkdir($target, $mode) && !\is_dir($target));
142
-    }
141
+		return \is_dir($target) || (self::createDirectory(\dirname($target), $mode) && !\mkdir($target, $mode) && !\is_dir($target));
142
+	}
143 143
 
144
-    /**
145
-     * @param     $target
146
-     * @param int $mode
147
-     *
148
-     * @return bool
149
-     */
150
-    public static function setDirectoryPermissions($target, $mode = 0777)
151
-    {
152
-        $target = \str_replace('..', '', $target);
144
+	/**
145
+	 * @param     $target
146
+	 * @param int $mode
147
+	 *
148
+	 * @return bool
149
+	 */
150
+	public static function setDirectoryPermissions($target, $mode = 0777)
151
+	{
152
+		$target = \str_replace('..', '', $target);
153 153
 
154
-        return @\chmod($target, (int)$mode);
155
-    }
154
+		return @\chmod($target, (int)$mode);
155
+	}
156 156
 
157
-    /**
158
-     * @param   $dir_path
159
-     *
160
-     * @return bool
161
-     */
162
-    public static function dirExists($dir_path)
163
-    {
164
-        return \is_dir($dir_path);
165
-    }
157
+	/**
158
+	 * @param   $dir_path
159
+	 *
160
+	 * @return bool
161
+	 */
162
+	public static function dirExists($dir_path)
163
+	{
164
+		return \is_dir($dir_path);
165
+	}
166 166
 }
167 167
 
168 168
 $op = Request::getString('op', '', 'POST');
169 169
 switch ($op) {
170
-    case 'createdir':
171
-        if (\Xmf\Request::hasVar('path', 'POST')) {
172
-            $path = $_POST['path'];
173
-        }
174
-        if (\Xmf\Request::hasVar('redirect', 'POST')) {
175
-            $redirect = $_POST['redirect'];
176
-        }
177
-        $msg = DirectoryChecker::createDirectory($path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRCREATED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRNOTCREATED');
178
-        \redirect_header($redirect, 2, $msg . ': ' . $path);
179
-        break;
180
-    case 'setdirperm':
181
-        if (\Xmf\Request::hasVar('path', 'POST')) {
182
-            $path = $_POST['path'];
183
-        }
184
-        if (\Xmf\Request::hasVar('redirect', 'POST')) {
185
-            $redirect = $_POST['redirect'];
186
-        }
187
-        if (\Xmf\Request::hasVar('mode', 'POST')) {
188
-            $mode = $_POST['mode'];
189
-        }
190
-        $msg = DirectoryChecker::setDirectoryPermissions($path, $mode) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMSET') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMNOTSET');
191
-        \redirect_header($redirect, 2, $msg . ': ' . $path);
192
-        break;
170
+	case 'createdir':
171
+		if (\Xmf\Request::hasVar('path', 'POST')) {
172
+			$path = $_POST['path'];
173
+		}
174
+		if (\Xmf\Request::hasVar('redirect', 'POST')) {
175
+			$redirect = $_POST['redirect'];
176
+		}
177
+		$msg = DirectoryChecker::createDirectory($path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRCREATED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRNOTCREATED');
178
+		\redirect_header($redirect, 2, $msg . ': ' . $path);
179
+		break;
180
+	case 'setdirperm':
181
+		if (\Xmf\Request::hasVar('path', 'POST')) {
182
+			$path = $_POST['path'];
183
+		}
184
+		if (\Xmf\Request::hasVar('redirect', 'POST')) {
185
+			$redirect = $_POST['redirect'];
186
+		}
187
+		if (\Xmf\Request::hasVar('mode', 'POST')) {
188
+			$mode = $_POST['mode'];
189
+		}
190
+		$msg = DirectoryChecker::setDirectoryPermissions($path, $mode) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMSET') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMNOTSET');
191
+		\redirect_header($redirect, 2, $msg . ': ' . $path);
192
+		break;
193 193
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 //defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined');
27 27
 
28
-require_once dirname(__DIR__, 4) . '/mainfile.php';
28
+require_once dirname(__DIR__, 4).'/mainfile.php';
29 29
 $moduleDirName      = \basename(dirname(__DIR__, 2));
30 30
 $moduleDirNameUpper = mb_strtoupper($moduleDirName);
31 31
 \xoops_loadLanguage('directorychecker', $moduleDirName);
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
         if (!@\is_dir($path)) {
63 63
             $path_status = "<img src='$pathIcon16/0.png' >";
64 64
 
65
-            $path_status .= "$path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTAVAILABLE') . ') ';
65
+            $path_status .= "$path (".\constant('CO_'.$moduleDirNameUpper.'_'.'DC_NOTAVAILABLE').') ';
66 66
 
67
-            $path_status .= "<form action='" . $_SERVER['SCRIPT_NAME'] . "' method='post'>";
67
+            $path_status .= "<form action='".$_SERVER['SCRIPT_NAME']."' method='post'>";
68 68
 
69 69
             $path_status .= "<input type='hidden' name='op' value='createdir'>";
70 70
 
@@ -72,22 +72,22 @@  discard block
 block discarded – undo
72 72
 
73 73
             $path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>";
74 74
 
75
-            $path_status .= "<button class='submit' onClick='this.form.submit();'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_CREATETHEDIR') . '</button>';
75
+            $path_status .= "<button class='submit' onClick='this.form.submit();'>".\constant('CO_'.$moduleDirNameUpper.'_'.'DC_CREATETHEDIR').'</button>';
76 76
 
77 77
             $path_status .= '</form>';
78 78
         } elseif (@\is_writable($path)) {
79 79
             $path_status = "<img src='$pathIcon16/1.png' >";
80 80
 
81
-            $path_status .= "$path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_AVAILABLE') . ') ';
81
+            $path_status .= "$path (".\constant('CO_'.$moduleDirNameUpper.'_'.'DC_AVAILABLE').') ';
82 82
 
83 83
             $currentMode = mb_substr(\decoct(\fileperms($path)), 2);
84 84
 
85 85
             if ($currentMode != \decoct($mode)) {
86 86
                 $path_status = "<img src='$pathIcon16/0.png' >";
87 87
 
88
-                $path_status .= $path . \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTWRITABLE'), \decoct($mode), $currentMode);
88
+                $path_status .= $path.\sprintf(\constant('CO_'.$moduleDirNameUpper.'_'.'DC_NOTWRITABLE'), \decoct($mode), $currentMode);
89 89
 
90
-                $path_status .= "<form action='" . $_SERVER['SCRIPT_NAME'] . "' method='post'>";
90
+                $path_status .= "<form action='".$_SERVER['SCRIPT_NAME']."' method='post'>";
91 91
 
92 92
                 $path_status .= "<input type='hidden' name='op' value='setdirperm'>";
93 93
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
                 $path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>";
99 99
 
100
-                $path_status .= "<button class='submit' onClick='this.form.submit();'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_SETMPERM') . '</button>';
100
+                $path_status .= "<button class='submit' onClick='this.form.submit();'>".\constant('CO_'.$moduleDirNameUpper.'_'.'DC_SETMPERM').'</button>';
101 101
 
102 102
                 $path_status .= '</form>';
103 103
             }
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 
107 107
             $path_status = "<img src='$pathIcon16/0.png' >";
108 108
 
109
-            $path_status .= $path . \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTWRITABLE'), \decoct($mode), $currentMode);
109
+            $path_status .= $path.\sprintf(\constant('CO_'.$moduleDirNameUpper.'_'.'DC_NOTWRITABLE'), \decoct($mode), $currentMode);
110 110
 
111
-            $path_status .= "<form action='" . $_SERVER['SCRIPT_NAME'] . "' method='post'>";
111
+            $path_status .= "<form action='".$_SERVER['SCRIPT_NAME']."' method='post'>";
112 112
 
113 113
             $path_status .= "<input type='hidden' name='op' value='setdirperm'>";
114 114
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
             $path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>";
120 120
 
121
-            $path_status .= "<button class='submit' onClick='this.form.submit();'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_SETMPERM') . '</button>';
121
+            $path_status .= "<button class='submit' onClick='this.form.submit();'>".\constant('CO_'.$moduleDirNameUpper.'_'.'DC_SETMPERM').'</button>';
122 122
 
123 123
             $path_status .= '</form>';
124 124
         }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     {
152 152
         $target = \str_replace('..', '', $target);
153 153
 
154
-        return @\chmod($target, (int)$mode);
154
+        return @\chmod($target, (int) $mode);
155 155
     }
156 156
 
157 157
     /**
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
         if (\Xmf\Request::hasVar('redirect', 'POST')) {
175 175
             $redirect = $_POST['redirect'];
176 176
         }
177
-        $msg = DirectoryChecker::createDirectory($path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRCREATED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRNOTCREATED');
178
-        \redirect_header($redirect, 2, $msg . ': ' . $path);
177
+        $msg = DirectoryChecker::createDirectory($path) ? \constant('CO_'.$moduleDirNameUpper.'_'.'DC_DIRCREATED') : \constant('CO_'.$moduleDirNameUpper.'_'.'DC_DIRNOTCREATED');
178
+        \redirect_header($redirect, 2, $msg.': '.$path);
179 179
         break;
180 180
     case 'setdirperm':
181 181
         if (\Xmf\Request::hasVar('path', 'POST')) {
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         if (\Xmf\Request::hasVar('mode', 'POST')) {
188 188
             $mode = $_POST['mode'];
189 189
         }
190
-        $msg = DirectoryChecker::setDirectoryPermissions($path, $mode) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMSET') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMNOTSET');
191
-        \redirect_header($redirect, 2, $msg . ': ' . $path);
190
+        $msg = DirectoryChecker::setDirectoryPermissions($path, $mode) ? \constant('CO_'.$moduleDirNameUpper.'_'.'DC_PERMSET') : \constant('CO_'.$moduleDirNameUpper.'_'.'DC_PERMNOTSET');
191
+        \redirect_header($redirect, 2, $msg.': '.$path);
192 192
         break;
193 193
 }
Please login to merge, or discard this patch.
class/Common/Breadcrumb.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -38,40 +38,40 @@  discard block
 block discarded – undo
38 38
  */
39 39
 class Breadcrumb
40 40
 {
41
-    public $dirname;
42
-    private $bread = [];
43
-
44
-    public function __construct()
45
-    {
46
-        $this->dirname = \basename(dirname(__DIR__, 2));
47
-    }
48
-
49
-    /**
50
-     * Add link to breadcrumb
51
-     *
52
-     * @param string $title
53
-     * @param string $link
54
-     */
55
-    public function addLink($title = '', $link = '')
56
-    {
57
-        $this->bread[] = [
58
-            'link'  => $link,
59
-            'title' => $title,
60
-        ];
61
-    }
62
-
63
-    /**
64
-     * Render BreadCrumb
65
-     */
66
-    public function render()
67
-    {
68
-        /*
41
+	public $dirname;
42
+	private $bread = [];
43
+
44
+	public function __construct()
45
+	{
46
+		$this->dirname = \basename(dirname(__DIR__, 2));
47
+	}
48
+
49
+	/**
50
+	 * Add link to breadcrumb
51
+	 *
52
+	 * @param string $title
53
+	 * @param string $link
54
+	 */
55
+	public function addLink($title = '', $link = '')
56
+	{
57
+		$this->bread[] = [
58
+			'link'  => $link,
59
+			'title' => $title,
60
+		];
61
+	}
62
+
63
+	/**
64
+	 * Render BreadCrumb
65
+	 */
66
+	public function render()
67
+	{
68
+		/*
69 69
         TODO if you want to use the render code below,
70 70
         1) create ./templates/chess_common_breadcrumb.tpl)
71 71
         2) add declaration to  xoops_version.php
72 72
         */
73 73
 
74
-        /*
74
+		/*
75 75
         if (!isset($GLOBALS['xoTheme']) || !\is_object($GLOBALS['xoTheme'])) {
76 76
             require $GLOBALS['xoops']->path('class/theme.php');
77 77
 
@@ -90,5 +90,5 @@  discard block
 block discarded – undo
90 90
 
91 91
         return $html;
92 92
         */
93
-    }
93
+	}
94 94
 }
Please login to merge, or discard this patch.
class/Common/Migrate.php 1 patch
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -25,110 +25,110 @@
 block discarded – undo
25 25
  */
26 26
 class Migrate extends \Xmf\Database\Migrate
27 27
 {
28
-    private $renameTables;
29
-
30
-    /**
31
-     * Migrate constructor.
32
-     * @param Common\Configurator $configurator
33
-     * @throws \RuntimeException
34
-     * @throws \InvalidArgumentException
35
-     */
36
-    public function __construct(?Common\Configurator $configurator = null)
37
-    {
38
-        if (null !== $configurator) {
39
-            $this->renameTables = $configurator->renameTables;
40
-
41
-            $moduleDirName = \basename(dirname(__DIR__, 2));
42
-
43
-            parent::__construct($moduleDirName);
44
-        }
45
-    }
46
-
47
-    /**
48
-     * change table prefix if needed
49
-     */
50
-    private function changePrefix()
51
-    {
52
-        foreach ($this->renameTables as $oldName => $newName) {
53
-            if ($this->tableHandler->useTable($oldName) && !$this->tableHandler->useTable($newName)) {
54
-                $this->tableHandler->renameTable($oldName, $newName);
55
-            }
56
-        }
57
-    }
58
-
59
-    /**
60
-     * Change integer IPv4 column to varchar IPv6 capable
61
-     *
62
-     * @param string $tableName  table to convert
63
-     * @param string $columnName column with IP address
64
-     */
65
-    private function convertIPAddresses($tableName, $columnName)
66
-    {
67
-        if ($this->tableHandler->useTable($tableName)) {
68
-            $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName);
69
-
70
-            if (false !== mb_strpos($attributes, ' int(')) {
71
-                if (false === mb_strpos($attributes, 'unsigned')) {
72
-                    $this->tableHandler->alterColumn($tableName, $columnName, " bigint(16) NOT NULL  DEFAULT '0' ");
73
-
74
-                    $this->tableHandler->update($tableName, [$columnName => "4294967296 + $columnName"], "WHERE $columnName < 0", false);
75
-                }
76
-
77
-                $this->tableHandler->alterColumn($tableName, $columnName, " varchar(45)  NOT NULL  DEFAULT '' ");
78
-
79
-                $this->tableHandler->update($tableName, [$columnName => "INET_NTOA($columnName)"], '', false);
80
-            }
81
-        }
82
-    }
83
-
84
-    /**
85
-     * Move do* columns from newbb_posts to newbb_posts_text table
86
-     */
87
-    private function moveDoColumns()
88
-    {
89
-        $tableName = 'newbb_posts_text';
90
-
91
-        $srcTableName = 'newbb_posts';
92
-
93
-        if ($this->tableHandler->useTable($tableName)
94
-            && $this->tableHandler->useTable($srcTableName)) {
95
-            $attributes = $this->tableHandler->getColumnAttributes($tableName, 'dohtml');
96
-
97
-            if (false === $attributes) {
98
-                $this->synchronizeTable($tableName);
99
-
100
-                $updateTable = $GLOBALS['xoopsDB']->prefix($tableName);
101
-
102
-                $joinTable = $GLOBALS['xoopsDB']->prefix($srcTableName);
103
-
104
-                $sql = "UPDATE `$updateTable` t1 INNER JOIN `$joinTable` t2 ON t1.post_id = t2.post_id \n" . "SET t1.dohtml = t2.dohtml,  t1.dosmiley = t2.dosmiley, t1.doxcode = t2.doxcode\n" . '  , t1.doimage = t2.doimage, t1.dobr = t2.dobr';
105
-
106
-                $this->tableHandler->addToQueue($sql);
107
-            }
108
-        }
109
-    }
110
-
111
-    /**
112
-     * Perform any upfront actions before synchronizing the schema
113
-     *
114
-     * Some typical uses include
115
-     *   table and column renames
116
-     *   data conversions
117
-     */
118
-    protected function preSyncActions()
119
-    {
120
-        // change 'bb' table prefix to 'newbb'
121
-
122
-        $this->changePrefix();
123
-
124
-        // columns dohtml, dosmiley, doxcode, doimage and dobr moved between tables as some point
125
-
126
-        $this->moveDoColumns();
127
-
128
-        // Convert IP address columns from int to readable varchar(45) for IPv6
129
-
130
-        $this->convertIPAddresses('newbb_posts', 'poster_ip');
131
-
132
-        $this->convertIPAddresses('newbb_report', 'reporter_ip');
133
-    }
28
+	private $renameTables;
29
+
30
+	/**
31
+	 * Migrate constructor.
32
+	 * @param Common\Configurator $configurator
33
+	 * @throws \RuntimeException
34
+	 * @throws \InvalidArgumentException
35
+	 */
36
+	public function __construct(?Common\Configurator $configurator = null)
37
+	{
38
+		if (null !== $configurator) {
39
+			$this->renameTables = $configurator->renameTables;
40
+
41
+			$moduleDirName = \basename(dirname(__DIR__, 2));
42
+
43
+			parent::__construct($moduleDirName);
44
+		}
45
+	}
46
+
47
+	/**
48
+	 * change table prefix if needed
49
+	 */
50
+	private function changePrefix()
51
+	{
52
+		foreach ($this->renameTables as $oldName => $newName) {
53
+			if ($this->tableHandler->useTable($oldName) && !$this->tableHandler->useTable($newName)) {
54
+				$this->tableHandler->renameTable($oldName, $newName);
55
+			}
56
+		}
57
+	}
58
+
59
+	/**
60
+	 * Change integer IPv4 column to varchar IPv6 capable
61
+	 *
62
+	 * @param string $tableName  table to convert
63
+	 * @param string $columnName column with IP address
64
+	 */
65
+	private function convertIPAddresses($tableName, $columnName)
66
+	{
67
+		if ($this->tableHandler->useTable($tableName)) {
68
+			$attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName);
69
+
70
+			if (false !== mb_strpos($attributes, ' int(')) {
71
+				if (false === mb_strpos($attributes, 'unsigned')) {
72
+					$this->tableHandler->alterColumn($tableName, $columnName, " bigint(16) NOT NULL  DEFAULT '0' ");
73
+
74
+					$this->tableHandler->update($tableName, [$columnName => "4294967296 + $columnName"], "WHERE $columnName < 0", false);
75
+				}
76
+
77
+				$this->tableHandler->alterColumn($tableName, $columnName, " varchar(45)  NOT NULL  DEFAULT '' ");
78
+
79
+				$this->tableHandler->update($tableName, [$columnName => "INET_NTOA($columnName)"], '', false);
80
+			}
81
+		}
82
+	}
83
+
84
+	/**
85
+	 * Move do* columns from newbb_posts to newbb_posts_text table
86
+	 */
87
+	private function moveDoColumns()
88
+	{
89
+		$tableName = 'newbb_posts_text';
90
+
91
+		$srcTableName = 'newbb_posts';
92
+
93
+		if ($this->tableHandler->useTable($tableName)
94
+			&& $this->tableHandler->useTable($srcTableName)) {
95
+			$attributes = $this->tableHandler->getColumnAttributes($tableName, 'dohtml');
96
+
97
+			if (false === $attributes) {
98
+				$this->synchronizeTable($tableName);
99
+
100
+				$updateTable = $GLOBALS['xoopsDB']->prefix($tableName);
101
+
102
+				$joinTable = $GLOBALS['xoopsDB']->prefix($srcTableName);
103
+
104
+				$sql = "UPDATE `$updateTable` t1 INNER JOIN `$joinTable` t2 ON t1.post_id = t2.post_id \n" . "SET t1.dohtml = t2.dohtml,  t1.dosmiley = t2.dosmiley, t1.doxcode = t2.doxcode\n" . '  , t1.doimage = t2.doimage, t1.dobr = t2.dobr';
105
+
106
+				$this->tableHandler->addToQueue($sql);
107
+			}
108
+		}
109
+	}
110
+
111
+	/**
112
+	 * Perform any upfront actions before synchronizing the schema
113
+	 *
114
+	 * Some typical uses include
115
+	 *   table and column renames
116
+	 *   data conversions
117
+	 */
118
+	protected function preSyncActions()
119
+	{
120
+		// change 'bb' table prefix to 'newbb'
121
+
122
+		$this->changePrefix();
123
+
124
+		// columns dohtml, dosmiley, doxcode, doimage and dobr moved between tables as some point
125
+
126
+		$this->moveDoColumns();
127
+
128
+		// Convert IP address columns from int to readable varchar(45) for IPv6
129
+
130
+		$this->convertIPAddresses('newbb_posts', 'poster_ip');
131
+
132
+		$this->convertIPAddresses('newbb_report', 'reporter_ip');
133
+	}
134 134
 }
Please login to merge, or discard this patch.
comment_post.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,6 +35,6 @@
 block discarded – undo
35 35
 
36 36
 /**#@+
37 37
  */
38
-require dirname(__DIR__, 2) . '/mainfile.php';
39
-require XOOPS_ROOT_PATH . '/include/comment_post.php';
38
+require dirname(__DIR__, 2).'/mainfile.php';
39
+require XOOPS_ROOT_PATH.'/include/comment_post.php';
40 40
 /**#@-*/
Please login to merge, or discard this patch.