Completed
Push — master ( 10bab4...a0a78b )
by Michael
02:06
created
include/plugin.transfer.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 // defined('XOOPS_ROOT_PATH') || die('Restricted access');
16 16
 
17 17
 if (!@require_once XOOPS_ROOT_PATH . '/Frameworks/transfer/transfer.php') {
18
-    return null;
18
+	return null;
19 19
 }
20 20
 
21 21
 // Specify the addons to skip for the module
@@ -28,41 +28,41 @@  discard block
 block discarded – undo
28 28
  */
29 29
 class ModuleTransferHandler extends TransferHandler
30 30
 {
31
-    /**
32
-     * ModuleTransferHandler constructor.
33
-     */
34
-    public function __construct()
35
-    {
36
-        parent::__construct();
37
-    }
31
+	/**
32
+	 * ModuleTransferHandler constructor.
33
+	 */
34
+	public function __construct()
35
+	{
36
+		parent::__construct();
37
+	}
38 38
 
39
-    /**
40
-     * Get valid addon list
41
-     *
42
-     * @param array   $skip Addons to skip
43
-     * @param boolean $sort To sort the list upon 'level'
44
-     *                      return  array   $list
45
-     */
46
-    public function &getList($skip = [], $sort = true)
47
-    {
48
-        $list = parent::getList($skip, $sort);
39
+	/**
40
+	 * Get valid addon list
41
+	 *
42
+	 * @param array   $skip Addons to skip
43
+	 * @param boolean $sort To sort the list upon 'level'
44
+	 *                      return  array   $list
45
+	 */
46
+	public function &getList($skip = [], $sort = true)
47
+	{
48
+		$list = parent::getList($skip, $sort);
49 49
 
50
-        return $list;
51
-    }
50
+		return $list;
51
+	}
52 52
 
53
-    /**
54
-     * If need change config of an item
55
-     * 1 parent::load_item
56
-     * 2 $this->config
57
-     * 3 $this->do_transfer
58
-     * @param $item
59
-     * @param $data
60
-     * @return
61
-     */
62
-    public function do_transfer($item, &$data)
63
-    {
64
-        $ret = parent::do_transfer($item, $data);
53
+	/**
54
+	 * If need change config of an item
55
+	 * 1 parent::load_item
56
+	 * 2 $this->config
57
+	 * 3 $this->do_transfer
58
+	 * @param $item
59
+	 * @param $data
60
+	 * @return
61
+	 */
62
+	public function do_transfer($item, &$data)
63
+	{
64
+		$ret = parent::do_transfer($item, $data);
65 65
 
66
-        return $ret;
67
-    }
66
+		return $ret;
67
+	}
68 68
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 // defined('XOOPS_ROOT_PATH') || die('Restricted access');
16 16
 
17
-if (!@require_once XOOPS_ROOT_PATH . '/Frameworks/transfer/transfer.php') {
17
+if (!@require_once XOOPS_ROOT_PATH.'/Frameworks/transfer/transfer.php') {
18 18
     return null;
19 19
 }
20 20
 
Please login to merge, or discard this patch.
include/oninstall.php 2 patches
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -28,20 +28,20 @@  discard block
 block discarded – undo
28 28
  */
29 29
 function xoops_module_pre_install_planet(\XoopsModule $module)
30 30
 {
31
-    include __DIR__ . '/../preloads/autoloader.php';
32
-    /** @var \Utility $utility */
33
-    $utility = new \XoopsModules\Planet\Utility();
34
-    $xoopsSuccess = $utility::checkVerXoops($module);
35
-    $phpSuccess   = $utility::checkVerPhp($module);
36
-
37
-    if (false !== $xoopsSuccess && false !==  $phpSuccess) {
38
-        $moduleTables =& $module->getInfo('tables');
39
-        foreach ($moduleTables as $table) {
40
-            $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';');
41
-        }
42
-    }
43
-
44
-    return $xoopsSuccess && $phpSuccess;
31
+	include __DIR__ . '/../preloads/autoloader.php';
32
+	/** @var \Utility $utility */
33
+	$utility = new \XoopsModules\Planet\Utility();
34
+	$xoopsSuccess = $utility::checkVerXoops($module);
35
+	$phpSuccess   = $utility::checkVerPhp($module);
36
+
37
+	if (false !== $xoopsSuccess && false !==  $phpSuccess) {
38
+		$moduleTables =& $module->getInfo('tables');
39
+		foreach ($moduleTables as $table) {
40
+			$GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';');
41
+		}
42
+	}
43
+
44
+	return $xoopsSuccess && $phpSuccess;
45 45
 }
46 46
 
47 47
 /**
@@ -53,51 +53,51 @@  discard block
 block discarded – undo
53 53
  */
54 54
 function xoops_module_install_planet(\XoopsModule $module)
55 55
 {
56
-    require_once  __DIR__ . '/../../../mainfile.php';
57
-    require_once  __DIR__ . '/../include/config.php';
58
-
59
-    $moduleDirName = basename(dirname(__DIR__));
60
-
61
-    $helper       = Planet\Helper::getInstance();
62
-    $utility      = new Planet\Utility();
63
-    $configurator = new Planet\Configurator();
64
-    // Load language files
65
-    $helper->loadLanguage('admin');
66
-    $helper->loadLanguage('modinfo');
67
-
68
-    // default Permission Settings ----------------------
69
-    global $xoopsModule;
70
-    $moduleId     = $xoopsModule->getVar('mid');
71
-    $moduleId2    = $helper->getModule()->mid();
72
-    $gpermHandler = xoops_getHandler('groupperm');
73
-    // access rights ------------------------------------------
74
-    $gpermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId);
75
-    $gpermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId);
76
-    $gpermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId);
77
-    $gpermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId);
78
-    $gpermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId);
79
-
80
-    //  ---  CREATE FOLDERS ---------------
81
-    if (count($configurator->uploadFolders) > 0) {
82
-        //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
83
-        foreach (array_keys($configurator->uploadFolders) as $i) {
84
-            $utilityClass::createFolder($configurator->uploadFolders[$i]);
85
-        }
86
-    }
87
-
88
-    //  ---  COPY blank.png FILES ---------------
89
-    if (count($configurator->copyBlankFiles) > 0) {
90
-        $file = __DIR__ . '/../assets/images/blank.png';
91
-        foreach (array_keys($configurator->copyBlankFiles) as $i) {
92
-            $dest = $configurator->copyBlankFiles[$i] . '/blank.png';
93
-            $utilityClass::copyFile($file, $dest);
94
-        }
95
-    }
96
-    //delete .html entries from the tpl table
97
-    $sql = 'DELETE FROM ' . $xoopsDB->prefix('tplfile') . " WHERE `tpl_module` = '" . $xoopsModule->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'";
98
-    $xoopsDB->queryF($sql);
99
-
100
-    return true;
56
+	require_once  __DIR__ . '/../../../mainfile.php';
57
+	require_once  __DIR__ . '/../include/config.php';
58
+
59
+	$moduleDirName = basename(dirname(__DIR__));
60
+
61
+	$helper       = Planet\Helper::getInstance();
62
+	$utility      = new Planet\Utility();
63
+	$configurator = new Planet\Configurator();
64
+	// Load language files
65
+	$helper->loadLanguage('admin');
66
+	$helper->loadLanguage('modinfo');
67
+
68
+	// default Permission Settings ----------------------
69
+	global $xoopsModule;
70
+	$moduleId     = $xoopsModule->getVar('mid');
71
+	$moduleId2    = $helper->getModule()->mid();
72
+	$gpermHandler = xoops_getHandler('groupperm');
73
+	// access rights ------------------------------------------
74
+	$gpermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId);
75
+	$gpermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId);
76
+	$gpermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId);
77
+	$gpermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId);
78
+	$gpermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId);
79
+
80
+	//  ---  CREATE FOLDERS ---------------
81
+	if (count($configurator->uploadFolders) > 0) {
82
+		//    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
83
+		foreach (array_keys($configurator->uploadFolders) as $i) {
84
+			$utilityClass::createFolder($configurator->uploadFolders[$i]);
85
+		}
86
+	}
87
+
88
+	//  ---  COPY blank.png FILES ---------------
89
+	if (count($configurator->copyBlankFiles) > 0) {
90
+		$file = __DIR__ . '/../assets/images/blank.png';
91
+		foreach (array_keys($configurator->copyBlankFiles) as $i) {
92
+			$dest = $configurator->copyBlankFiles[$i] . '/blank.png';
93
+			$utilityClass::copyFile($file, $dest);
94
+		}
95
+	}
96
+	//delete .html entries from the tpl table
97
+	$sql = 'DELETE FROM ' . $xoopsDB->prefix('tplfile') . " WHERE `tpl_module` = '" . $xoopsModule->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'";
98
+	$xoopsDB->queryF($sql);
99
+
100
+	return true;
101 101
 }
102 102
 
103 103
 //======================================================
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 //Creation du dossier "uploads" pour le module à la racine du site
109 109
 $module_uploads = $GLOBALS['xoops']->path('uploads/randomquote');
110 110
 if (!is_dir($module_uploads)) {
111
-    mkdir($module_uploads, 0777);
111
+	mkdir($module_uploads, 0777);
112 112
 }
113 113
 chmod($module_uploads, 0777);
114 114
 copy($indexFile, $GLOBALS['xoops']->path('uploads/randomquote/index.html'));
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 //Creation du fichier citas dans uploads
117 117
 $module_uploads = $GLOBALS['xoops']->path('uploads/randomquote/citas');
118 118
 if (!is_dir($module_uploads)) {
119
-    mkdir($module_uploads, 0777);
119
+	mkdir($module_uploads, 0777);
120 120
 }
121 121
 chmod($module_uploads, 0777);
122 122
 copy($indexFile, $GLOBALS['xoops']->path('uploads/randomquote/citas/index.html'));
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -28,16 +28,16 @@  discard block
 block discarded – undo
28 28
  */
29 29
 function xoops_module_pre_install_planet(\XoopsModule $module)
30 30
 {
31
-    include __DIR__ . '/../preloads/autoloader.php';
31
+    include __DIR__.'/../preloads/autoloader.php';
32 32
     /** @var \Utility $utility */
33 33
     $utility = new \XoopsModules\Planet\Utility();
34 34
     $xoopsSuccess = $utility::checkVerXoops($module);
35 35
     $phpSuccess   = $utility::checkVerPhp($module);
36 36
 
37
-    if (false !== $xoopsSuccess && false !==  $phpSuccess) {
38
-        $moduleTables =& $module->getInfo('tables');
37
+    if (false !== $xoopsSuccess && false !== $phpSuccess) {
38
+        $moduleTables = & $module->getInfo('tables');
39 39
         foreach ($moduleTables as $table) {
40
-            $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';');
40
+            $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS '.$GLOBALS['xoopsDB']->prefix($table).';');
41 41
         }
42 42
     }
43 43
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
  */
54 54
 function xoops_module_install_planet(\XoopsModule $module)
55 55
 {
56
-    require_once  __DIR__ . '/../../../mainfile.php';
57
-    require_once  __DIR__ . '/../include/config.php';
56
+    require_once  __DIR__.'/../../../mainfile.php';
57
+    require_once  __DIR__.'/../include/config.php';
58 58
 
59 59
     $moduleDirName = basename(dirname(__DIR__));
60 60
 
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
     $moduleId2    = $helper->getModule()->mid();
72 72
     $gpermHandler = xoops_getHandler('groupperm');
73 73
     // access rights ------------------------------------------
74
-    $gpermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId);
75
-    $gpermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId);
76
-    $gpermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId);
77
-    $gpermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId);
78
-    $gpermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId);
74
+    $gpermHandler->addRight($moduleDirName.'_approve', 1, XOOPS_GROUP_ADMIN, $moduleId);
75
+    $gpermHandler->addRight($moduleDirName.'_submit', 1, XOOPS_GROUP_ADMIN, $moduleId);
76
+    $gpermHandler->addRight($moduleDirName.'_view', 1, XOOPS_GROUP_ADMIN, $moduleId);
77
+    $gpermHandler->addRight($moduleDirName.'_view', 1, XOOPS_GROUP_USERS, $moduleId);
78
+    $gpermHandler->addRight($moduleDirName.'_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId);
79 79
 
80 80
     //  ---  CREATE FOLDERS ---------------
81
-    if (count($configurator->uploadFolders) > 0) {
81
+    if (count($configurator->uploadFolders)>0) {
82 82
         //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
83 83
         foreach (array_keys($configurator->uploadFolders) as $i) {
84 84
             $utilityClass::createFolder($configurator->uploadFolders[$i]);
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
     }
87 87
 
88 88
     //  ---  COPY blank.png FILES ---------------
89
-    if (count($configurator->copyBlankFiles) > 0) {
90
-        $file = __DIR__ . '/../assets/images/blank.png';
89
+    if (count($configurator->copyBlankFiles)>0) {
90
+        $file = __DIR__.'/../assets/images/blank.png';
91 91
         foreach (array_keys($configurator->copyBlankFiles) as $i) {
92
-            $dest = $configurator->copyBlankFiles[$i] . '/blank.png';
92
+            $dest = $configurator->copyBlankFiles[$i].'/blank.png';
93 93
             $utilityClass::copyFile($file, $dest);
94 94
         }
95 95
     }
96 96
     //delete .html entries from the tpl table
97
-    $sql = 'DELETE FROM ' . $xoopsDB->prefix('tplfile') . " WHERE `tpl_module` = '" . $xoopsModule->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'";
97
+    $sql = 'DELETE FROM '.$xoopsDB->prefix('tplfile')." WHERE `tpl_module` = '".$xoopsModule->getVar('dirname', 'n')."' AND `tpl_file` LIKE '%.html%'";
98 98
     $xoopsDB->queryF($sql);
99 99
 
100 100
     return true;
Please login to merge, or discard this patch.
include/functions.php 2 patches
Indentation   +511 added lines, -511 removed lines patch added patch discarded remove patch
@@ -33,523 +33,523 @@
 block discarded – undo
33 33
 
34 34
 $current_path = __FILE__;
35 35
 if (DIRECTORY_SEPARATOR !== '/') {
36
-    $current_path = str_replace(strpos($current_path, '\\\\', 2) ? '\\\\' : DIRECTORY_SEPARATOR, '/', $current_path);
36
+	$current_path = str_replace(strpos($current_path, '\\\\', 2) ? '\\\\' : DIRECTORY_SEPARATOR, '/', $current_path);
37 37
 }
38 38
 $url_arr               = explode('/', strstr($current_path, '/modules/'));
39 39
 $GLOBALS['moddirname'] = $url_arr[2];
40 40
 
41 41
 if (!defined('planet_FUNCTIONS')):
42
-    define('planet_FUNCTIONS', 1);
43
-
44
-    require XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/vars.php';
45
-    require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
46
-    require_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.php';
47
-
48
-    /**
49
-     * Function to display messages
50
-     *
51
-     * @var mixed $messages
52
-     * @return bool
53
-     */
54
-    function planetDisplayMessage($message)
55
-    {
56
-        return mod_message($message);
57
-    }
58
-
59
-    /**
60
-     * Function to parse arguments for a page according to $_SERVER['REQUEST_URI']
61
-     *
62
-     * @var array $args_numeric array of numeric variable values
63
-     * @var array $args         array of indexed variables: name and value
64
-     * @var array $args_string  array of string variable values
65
-     *
66
-     * @return bool true on args parsed
67
-     */
68
-
69
-    /* known issues:
42
+	define('planet_FUNCTIONS', 1);
43
+
44
+	require XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/vars.php';
45
+	require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
46
+	require_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.php';
47
+
48
+	/**
49
+	 * Function to display messages
50
+	 *
51
+	 * @var mixed $messages
52
+	 * @return bool
53
+	 */
54
+	function planetDisplayMessage($message)
55
+	{
56
+		return mod_message($message);
57
+	}
58
+
59
+	/**
60
+	 * Function to parse arguments for a page according to $_SERVER['REQUEST_URI']
61
+	 *
62
+	 * @var array $args_numeric array of numeric variable values
63
+	 * @var array $args         array of indexed variables: name and value
64
+	 * @var array $args_string  array of string variable values
65
+	 *
66
+	 * @return bool true on args parsed
67
+	 */
68
+
69
+	/* known issues:
70 70
      * - "/" in a string
71 71
      * - "&" in a string
72 72
     */
73
-    function planetParseArguments(&$args_numeric, &$args, &$args_string)
74
-    {
75
-        $args_abb     = [
76
-            'a' => 'article',
77
-            'b' => 'blog',
78
-            'c' => 'category',
79
-            'l' => 'list',
80
-            'o' => 'sort',
81
-            's' => 'start',
82
-            'u' => 'uid'
83
-        ];
84
-        $args         = [];
85
-        $args_numeric = [];
86
-        $args_string  = [];
87
-        if (preg_match("/[^\?]*\.php[\/|\?]([^\?]*)/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) {
88
-            $vars = preg_split("/[\/|&]/", $matches[1]);
89
-            $vars = array_map('trim', $vars);
90
-            if (count($vars) > 0) {
91
-                foreach ($vars as $var) {
92
-                    if (is_numeric($var)) {
93
-                        $args_numeric[] = $var;
94
-                    } elseif (false === strpos($var, '=')) {
95
-                        if (is_numeric(substr($var, 1))) {
96
-                            $args[$args_abb[strtolower($var{0})]] = (int)substr($var, 1);
97
-                        } else {
98
-                            $args_string[] = urldecode($var);
99
-                        }
100
-                    } else {
101
-                        parse_str($var, $args);
102
-                    }
103
-                }
104
-            }
105
-        }
106
-
107
-        return (0 == count($args) + count($args_numeric) + count($args_string)) ? null : true;
108
-    }
109
-
110
-    /**
111
-     * Function to parse class prefix
112
-     *
113
-     * @var string $class_string string to be parsed
114
-     * @var mixed  $pattern
115
-     * @var mixed  $replacement
116
-     *
117
-     * @return bool true on success
118
-     */
119
-    function planetParseClass($class_string, $pattern = '', $replacement = '')
120
-    {
121
-        if (empty($class_string)) {
122
-            return;
123
-        }
124
-        $patterns     = ["/\[CLASS_PREFIX\]/"];
125
-        $replacements = [ucfirst(strtolower($GLOBALS['moddirname']))];
126
-        if (!empty($pattern) && !is_array($pattern) && !is_array($replacement)) {
127
-            $pattern     = [$pattern];
128
-            $replacement = [$replacement];
129
-        }
130
-        if (is_array($pattern) && count($pattern) > 0) {
131
-            $ii = 0;
132
-            foreach ($pattern as $pat) {
133
-                if (!in_array($pat, $patterns)) {
134
-                    $patterns[]     = $pat;
135
-                    $replacements[] = isset($replacement[$ii]) ? $replacement[$ii] : '';
136
-                }
137
-                ++$ii;
138
-            }
139
-        }
140
-        $class_string = preg_replace($patterns, $replacements, $class_string);
141
-        eval($class_string);
142
-
143
-        return true;
144
-    }
145
-
146
-    /**
147
-     * Function to parse function prefix
148
-     *
149
-     * @var string $function_string string to be parsed
150
-     * @var mixed  $pattern
151
-     * @var mixed  $replacement
152
-     *
153
-     * @return bool true on success
154
-     */
155
-    function planetParseFunction($function_string, $pattern = '', $replacement = '')
156
-    {
157
-        if (empty($function_string)) {
158
-            return;
159
-        }
160
-        $patterns     = ["/\[DIRNAME\]/", "/\[VAR_PREFIX\]/"];
161
-        $replacements = [$GLOBALS['moddirname'], $GLOBALS['VAR_PREFIX']];
162
-        if (!empty($pattern) && !is_array($pattern) && !is_array($replacement)) {
163
-            $pattern     = [$pattern];
164
-            $replacement = [$replacement];
165
-        }
166
-        if (is_array($pattern) && count($pattern) > 0) {
167
-            $ii = 0;
168
-            foreach ($pattern as $pat) {
169
-                if (!in_array($pat, $patterns)) {
170
-                    $patterns[]     = $pat;
171
-                    $replacements[] = isset($replacement[$ii]) ? $replacement[$ii] : '';
172
-                }
173
-                ++$ii;
174
-            }
175
-        }
176
-        $function_string = preg_replace($patterns, $replacements, $function_string);
177
-        eval($function_string);
178
-
179
-        return true;
180
-    }
181
-
182
-    /**
183
-     * Function to convert UNIX time to formatted time string
184
-     * @param        $time
185
-     * @param string $format
186
-     * @return string
187
-     */
188
-    function planet_formatTimestamp($time, $format = '')
189
-    {
190
-        if (empty($time)) {
191
-            return '';
192
-        }
193
-
194
-        return formatTimestamp($time, $format);
195
-    }
196
-
197
-    /**
198
-     * Function to a list of user names associated with their user IDs
199
-     * @param int  $userid
200
-     * @param int  $usereal
201
-     * @param bool $linked
202
-     * @return array
203
-     */
204
-    function &planetGetUnameFromId($userid, $usereal = 0, $linked = false)
205
-    {
206
-        if (!is_array($userid)) {
207
-            $userid = [$userid];
208
-        }
209
-        $users =& mod_getUnameFromIds($userid, $usereal, $linked);
210
-
211
-        return $users;
212
-    }
213
-
214
-    /**
215
-     * Function to parse links, links are delimited by link break, URL and title of a link are delimited by space
216
-     *
217
-     * @var string $text raw content
218
-     *
219
-     * @return array associative array of link url and title
220
-     */
221
-    function &planetParseLinks($text)
222
-    {
223
-        $myts       = \MyTextSanitizer::getInstance();
224
-        $link_array = preg_split("/(\r\n|\r|\n)( *)/", $text);
225
-        $links      = [];
226
-        if (count($link_array) > 0) {
227
-            foreach ($link_array as $link) {
228
-                @list($url, $title) = array_map('trim', preg_split('/ /', $link, 2));
229
-                if (empty($url)) {
230
-                    continue;
231
-                }
232
-                //if(empty($title)) $title = $url;
233
-                $links[] = ['url' => $url, 'title' => $myts->htmlSpecialChars($title)];
234
-            }
235
-        }
236
-
237
-        return $links;
238
-    }
239
-
240
-    /**
241
-     * @param $pagename
242
-     * @return string
243
-     */
244
-    function planetGetTemplate($pagename)
245
-    {
246
-        return $GLOBALS['VAR_PREFIX'] . '_' . $pagename . '.tpl';
247
-    }
248
-
249
-    /**
250
-     * @param int $currentoption
251
-     */
252
-    function planet_adminmenu($currentoption = -1)
253
-    {
254
-        loadModuleAdminMenu($currentoption, '');
255
-
256
-        return;
257
-    }
258
-
259
-    /**
260
-     * Function to send a trackback
261
-     *
262
-     * @param $article
263
-     * @param $comment
264
-     * @return bool
265
-     */
266
-    function planet_com_trackback(&$article, &$comment)
267
-    {
268
-        $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']);
269
-        $blog_obj    = $blogHandler->get($article->getVar('blog_id'));
270
-        if (!$pattern = $blog_obj->getVar('blog_trackback')) {
271
-            return false;
272
-        }
273
-        @list($pat, $rep) = array_map('trim', preg_split("#[\s]+#", $pattern));
274
-        $trackback_url = preg_replace('#' . $pat . '#', $rep, $article_obj->getVar('art_link'));
275
-
276
-        return planetTrackback($trackback_url, $article);
277
-    }
278
-
279
-    /**
280
-     * @param $trackback_url
281
-     * @param $article
282
-     * @return bool
283
-     */
284
-    function planetTrackback($trackback_url, $article)
285
-    {
286
-        global $myts, $xoopsConfig, $xoopsModule;
287
-        /** @var Planet\Helper $helper */
288
-        $helper = Planet\Helper::getInstance();
289
-
290
-        $title         = $article->getVar('art_title');
291
-        $excerpt       = $article->getVar('art_content');
292
-        $blog_name     = $xoopsConfig['sitename'] . '-' . $xoopsModule->getVar('name');
293
-        $title         = xoops_utf8_encode($title);
294
-        $excerpt       = xoops_utf8_encode($excerpt);
295
-        $blog_name     = xoops_utf8_encode($blog_name);
296
-        $charset       = 'utf-8';
297
-        $title1        = urlencode($title);
298
-        $excerpt1      = urlencode($excerpt);
299
-        $name1         = urlencode($blog_name);
300
-        $url           = urlencode(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article->getVar('art_id'));
301
-        $query_string  = "title=$title1&url=$url&blog_name=$name1&excerpt=$excerpt1&charset=$charset";
302
-        $trackback_url = parse_url($trackback_url);
303
-
304
-        $http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?' . $trackback_url['query'] : '') . " HTTP/1.0\r\n";
305
-        $http_request .= 'Host: ' . $trackback_url['host'] . "\r\n";
306
-        $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . $charset . "\r\n";
307
-        $http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n";
308
-        $http_request .= 'User-Agent: XOOPS Blogs/' . XOOPS_VERSION;
309
-        $http_request .= "\r\n\r\n";
310
-        $http_request .= $query_string;
311
-        if ('' == $trackback_url['port']) {
312
-            $trackback_url['port'] = 80;
313
-        }
314
-        $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4);
315
-        @fwrite($fs, $http_request);
316
-        if ($helper->getConfig('do_debug')) {
317
-            $debug_file = XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '_trackback.log';
318
-            $fr         = "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n";
319
-            $fr         .= "CHARSET:$charset\n";
320
-            $fr         .= "NAME:$blog_name\n";
321
-            $fr         .= 'TITLE:' . $title . "\n";
322
-            $fr         .= "EXCERPT:$excerpt\n\n";
323
-            while (!@feof($fs)) {
324
-                $fr .= @fgets($fs, 4096);
325
-            }
326
-            $fr .= "\n\n";
327
-
328
-            if ($fp = fopen($debug_file, 'a')) {
329
-                fwrite($fp, $fr);
330
-                fclose($fp);
331
-            } else {
332
-            }
333
-        }
334
-        @fclose($fs);
335
-
336
-        return true;
337
-    }
338
-
339
-    /**
340
-     * Function to ping servers
341
-     * @param $server
342
-     * @param $id
343
-     */
344
-    function planetGetPing($server, $id)
345
-    {
346
-        if (is_array($server)) {
347
-            foreach ($server as $serv) {
348
-                planetGetPing($serv, $id);
349
-            }
350
-        }
351
-        require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/class-IXR.php';
352
-
353
-        // using a timeout of 3 seconds should be enough to cover slow servers
354
-        $client            = new IXR_Client($server, false);
355
-        $client->timeout   = 3;
356
-        $client->useragent .= ' -- XOOPS Article/' . XOOPS_VERSION;
357
-
358
-        // when set to true, this outputs debug messages by itself
359
-        $client->debug = false;
360
-
361
-        $blogname = xoops_utf8_encode($GLOBALS['xoopsModule']->getVar('name'));
362
-        $home     = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/';
363
-        $rss2_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php' . URL_DELIMITER . 'rss2.0/' . $id;
364
-
365
-        if (!$client->query('weblogUpdates.extendedPing', $blogname, $home, $rss2_url)) { // then try a normal ping
366
-            $client->query('weblogUpdates.ping', $blogname, $home);
367
-        }
368
-    }
369
-
370
-    /**
371
-     * Function to respond to a trackback
372
-     * @param int    $error
373
-     * @param string $error_message
374
-     */
375
-    function planetRespondToTrackback($error = 0, $error_message = '')
376
-    {
377
-        $charset       = 'utf-8';
378
-        $error_message = xoops_utf8_encode($error_message);
379
-        header('Content-Type: text/xml; charset="' . $charset . '"');
380
-        if ($error) {
381
-            echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n";
382
-            echo "<response>\n";
383
-            echo "<error>1</error>\n";
384
-            echo "<message>$error_message</message>\n";
385
-            echo '</response>';
386
-            die();
387
-        } else {
388
-            echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n";
389
-            echo "<response>\n";
390
-            echo "<error>0</error>\n";
391
-            echo '</response>';
392
-        }
393
-    }
394
-
395
-    /**
396
-     * Function to set a cookie with module-specified name
397
-     *
398
-     * using customized serialization method
399
-     * @param        $name
400
-     * @param string $string
401
-     * @param int    $expire
402
-     */
403
-    function planetSetCookie($name, $string = '', $expire = 0)
404
-    {
405
-        if (is_array($string)) {
406
-            $value = [];
407
-            foreach ($string as $key => $val) {
408
-                $value[] = $key . '|' . $val;
409
-            }
410
-            $string = implode(',', $value);
411
-        }
412
-        setcookie($GLOBALS['VAR_PREFIX'] . $name, $string, (int)$expire, '/');
413
-    }
414
-
415
-    /**
416
-     * @param      $name
417
-     * @param bool $isArray
418
-     * @return array|null
419
-     */
420
-    function planetGetCookie($name, $isArray = false)
421
-    {
422
-        $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'] . $name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'] . $name] : null;
423
-        if ($isArray) {
424
-            $_value = $value ? explode(',', $value) : [];
425
-            $value  = [];
426
-            if (count($_value) > 0) {
427
-                foreach ($_value as $string) {
428
-                    $key         = substr($string, 0, strpos($string, '|'));
429
-                    $val         = substr($string, strpos($string, '|') + 1);
430
-                    $value[$key] = $val;
431
-                }
432
-            }
433
-            unset($_value);
434
-        }
435
-
436
-        return $value;
437
-    }
438
-
439
-    /**
440
-     * Function to filter text
441
-     *
442
-     * @param $document
443
-     * @return string filtered text
444
-     */
445
-    function &planetHtml2text(&$document)
446
-    {
447
-        $document = strip_tags($document);
448
-
449
-        return $document;
450
-    }
451
-
452
-    // Adapted from PMA_getIp() [phpmyadmin project]
453
-    /**
454
-     * @param bool $asString
455
-     * @return mixed
456
-     */
457
-    function planetGetIP($asString = false)
458
-    {
459
-        return mod_getIP($asString);
460
-    }
461
-
462
-    /**
463
-     * @param $url
464
-     * @return bool|mixed|string
465
-     */
466
-    function planetGetRemoteContent($url)
467
-    {
468
-        if ($data = planet_fetch_snoopy($url)) {
469
-            return $data;
470
-        }
471
-        if ($data = planet_fetch_CURL($url)) {
472
-            return $data;
473
-        }
474
-        if ($data = planet_fetch_fopen($url)) {
475
-            return $data;
476
-        }
477
-
478
-        return false;
479
-    }
480
-
481
-    /**
482
-     * @param $url
483
-     * @return string
484
-     */
485
-    function planet_fetch_snoopy($url)
486
-    {
487
-        require_once XOOPS_ROOT_PATH . '/class/snoopy.php';
488
-        $snoopy = new Snoopy;
489
-        $data   = '';
490
-        if (@$snoopy->fetch($url)) {
491
-            $data = is_array($snoopy->results) ? implode("\n", $snoopy->results) : $snoopy->results;
492
-        }
493
-
494
-        return $data;
495
-    }
496
-
497
-    /**
498
-     * @param $url
499
-     * @return bool|mixed
500
-     */
501
-    function planet_fetch_CURL($url)
502
-    {
503
-        if (!function_exists('curl_init')) {
504
-            return false;
505
-        }
506
-        $ch = curl_init();    // initialize curl handle
507
-        curl_setopt($ch, CURLOPT_URL, $url); // set url to post to
508
-        curl_setopt($ch, CURLOPT_FAILONERROR, 1);
509
-        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
510
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable
511
-        curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 31s
512
-        $data = curl_exec($ch); // run the whole process
513
-        curl_close($ch);
514
-
515
-        return $data;
516
-    }
517
-
518
-    /**
519
-     * @param $url
520
-     * @return bool|string
521
-     */
522
-    function planet_fetch_fopen($url)
523
-    {
524
-        if (!$fp = @fopen($url, 'r')) {
525
-            return false;
526
-        }
527
-        $data = '';
528
-        while (!feof($fp)) {
529
-            $data .= fgets($fp, 1024);
530
-        }
531
-        fclose($fp);
532
-
533
-        return $data;
534
-    }
535
-
536
-    /**
537
-     * @param     $haystack
538
-     * @param     $needle
539
-     * @param int $offset
540
-     * @return bool|int
541
-     */
542
-    function planetStrrPos($haystack, $needle, $offset = 0)
543
-    {
544
-        if (5 == substr(PHP_VERSION, 0, 1)) {
545
-            return strrpos($haystack, $needle, $offset);
546
-        }
547
-        $index = strpos(strrev($haystack), strrev($needle));
548
-        if (false === $index) {
549
-            return false;
550
-        }
551
-        $index = strlen($haystack) - strlen($needle) - $index;
552
-
553
-        return $index;
554
-    }
73
+	function planetParseArguments(&$args_numeric, &$args, &$args_string)
74
+	{
75
+		$args_abb     = [
76
+			'a' => 'article',
77
+			'b' => 'blog',
78
+			'c' => 'category',
79
+			'l' => 'list',
80
+			'o' => 'sort',
81
+			's' => 'start',
82
+			'u' => 'uid'
83
+		];
84
+		$args         = [];
85
+		$args_numeric = [];
86
+		$args_string  = [];
87
+		if (preg_match("/[^\?]*\.php[\/|\?]([^\?]*)/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) {
88
+			$vars = preg_split("/[\/|&]/", $matches[1]);
89
+			$vars = array_map('trim', $vars);
90
+			if (count($vars) > 0) {
91
+				foreach ($vars as $var) {
92
+					if (is_numeric($var)) {
93
+						$args_numeric[] = $var;
94
+					} elseif (false === strpos($var, '=')) {
95
+						if (is_numeric(substr($var, 1))) {
96
+							$args[$args_abb[strtolower($var{0})]] = (int)substr($var, 1);
97
+						} else {
98
+							$args_string[] = urldecode($var);
99
+						}
100
+					} else {
101
+						parse_str($var, $args);
102
+					}
103
+				}
104
+			}
105
+		}
106
+
107
+		return (0 == count($args) + count($args_numeric) + count($args_string)) ? null : true;
108
+	}
109
+
110
+	/**
111
+	 * Function to parse class prefix
112
+	 *
113
+	 * @var string $class_string string to be parsed
114
+	 * @var mixed  $pattern
115
+	 * @var mixed  $replacement
116
+	 *
117
+	 * @return bool true on success
118
+	 */
119
+	function planetParseClass($class_string, $pattern = '', $replacement = '')
120
+	{
121
+		if (empty($class_string)) {
122
+			return;
123
+		}
124
+		$patterns     = ["/\[CLASS_PREFIX\]/"];
125
+		$replacements = [ucfirst(strtolower($GLOBALS['moddirname']))];
126
+		if (!empty($pattern) && !is_array($pattern) && !is_array($replacement)) {
127
+			$pattern     = [$pattern];
128
+			$replacement = [$replacement];
129
+		}
130
+		if (is_array($pattern) && count($pattern) > 0) {
131
+			$ii = 0;
132
+			foreach ($pattern as $pat) {
133
+				if (!in_array($pat, $patterns)) {
134
+					$patterns[]     = $pat;
135
+					$replacements[] = isset($replacement[$ii]) ? $replacement[$ii] : '';
136
+				}
137
+				++$ii;
138
+			}
139
+		}
140
+		$class_string = preg_replace($patterns, $replacements, $class_string);
141
+		eval($class_string);
142
+
143
+		return true;
144
+	}
145
+
146
+	/**
147
+	 * Function to parse function prefix
148
+	 *
149
+	 * @var string $function_string string to be parsed
150
+	 * @var mixed  $pattern
151
+	 * @var mixed  $replacement
152
+	 *
153
+	 * @return bool true on success
154
+	 */
155
+	function planetParseFunction($function_string, $pattern = '', $replacement = '')
156
+	{
157
+		if (empty($function_string)) {
158
+			return;
159
+		}
160
+		$patterns     = ["/\[DIRNAME\]/", "/\[VAR_PREFIX\]/"];
161
+		$replacements = [$GLOBALS['moddirname'], $GLOBALS['VAR_PREFIX']];
162
+		if (!empty($pattern) && !is_array($pattern) && !is_array($replacement)) {
163
+			$pattern     = [$pattern];
164
+			$replacement = [$replacement];
165
+		}
166
+		if (is_array($pattern) && count($pattern) > 0) {
167
+			$ii = 0;
168
+			foreach ($pattern as $pat) {
169
+				if (!in_array($pat, $patterns)) {
170
+					$patterns[]     = $pat;
171
+					$replacements[] = isset($replacement[$ii]) ? $replacement[$ii] : '';
172
+				}
173
+				++$ii;
174
+			}
175
+		}
176
+		$function_string = preg_replace($patterns, $replacements, $function_string);
177
+		eval($function_string);
178
+
179
+		return true;
180
+	}
181
+
182
+	/**
183
+	 * Function to convert UNIX time to formatted time string
184
+	 * @param        $time
185
+	 * @param string $format
186
+	 * @return string
187
+	 */
188
+	function planet_formatTimestamp($time, $format = '')
189
+	{
190
+		if (empty($time)) {
191
+			return '';
192
+		}
193
+
194
+		return formatTimestamp($time, $format);
195
+	}
196
+
197
+	/**
198
+	 * Function to a list of user names associated with their user IDs
199
+	 * @param int  $userid
200
+	 * @param int  $usereal
201
+	 * @param bool $linked
202
+	 * @return array
203
+	 */
204
+	function &planetGetUnameFromId($userid, $usereal = 0, $linked = false)
205
+	{
206
+		if (!is_array($userid)) {
207
+			$userid = [$userid];
208
+		}
209
+		$users =& mod_getUnameFromIds($userid, $usereal, $linked);
210
+
211
+		return $users;
212
+	}
213
+
214
+	/**
215
+	 * Function to parse links, links are delimited by link break, URL and title of a link are delimited by space
216
+	 *
217
+	 * @var string $text raw content
218
+	 *
219
+	 * @return array associative array of link url and title
220
+	 */
221
+	function &planetParseLinks($text)
222
+	{
223
+		$myts       = \MyTextSanitizer::getInstance();
224
+		$link_array = preg_split("/(\r\n|\r|\n)( *)/", $text);
225
+		$links      = [];
226
+		if (count($link_array) > 0) {
227
+			foreach ($link_array as $link) {
228
+				@list($url, $title) = array_map('trim', preg_split('/ /', $link, 2));
229
+				if (empty($url)) {
230
+					continue;
231
+				}
232
+				//if(empty($title)) $title = $url;
233
+				$links[] = ['url' => $url, 'title' => $myts->htmlSpecialChars($title)];
234
+			}
235
+		}
236
+
237
+		return $links;
238
+	}
239
+
240
+	/**
241
+	 * @param $pagename
242
+	 * @return string
243
+	 */
244
+	function planetGetTemplate($pagename)
245
+	{
246
+		return $GLOBALS['VAR_PREFIX'] . '_' . $pagename . '.tpl';
247
+	}
248
+
249
+	/**
250
+	 * @param int $currentoption
251
+	 */
252
+	function planet_adminmenu($currentoption = -1)
253
+	{
254
+		loadModuleAdminMenu($currentoption, '');
255
+
256
+		return;
257
+	}
258
+
259
+	/**
260
+	 * Function to send a trackback
261
+	 *
262
+	 * @param $article
263
+	 * @param $comment
264
+	 * @return bool
265
+	 */
266
+	function planet_com_trackback(&$article, &$comment)
267
+	{
268
+		$blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']);
269
+		$blog_obj    = $blogHandler->get($article->getVar('blog_id'));
270
+		if (!$pattern = $blog_obj->getVar('blog_trackback')) {
271
+			return false;
272
+		}
273
+		@list($pat, $rep) = array_map('trim', preg_split("#[\s]+#", $pattern));
274
+		$trackback_url = preg_replace('#' . $pat . '#', $rep, $article_obj->getVar('art_link'));
275
+
276
+		return planetTrackback($trackback_url, $article);
277
+	}
278
+
279
+	/**
280
+	 * @param $trackback_url
281
+	 * @param $article
282
+	 * @return bool
283
+	 */
284
+	function planetTrackback($trackback_url, $article)
285
+	{
286
+		global $myts, $xoopsConfig, $xoopsModule;
287
+		/** @var Planet\Helper $helper */
288
+		$helper = Planet\Helper::getInstance();
289
+
290
+		$title         = $article->getVar('art_title');
291
+		$excerpt       = $article->getVar('art_content');
292
+		$blog_name     = $xoopsConfig['sitename'] . '-' . $xoopsModule->getVar('name');
293
+		$title         = xoops_utf8_encode($title);
294
+		$excerpt       = xoops_utf8_encode($excerpt);
295
+		$blog_name     = xoops_utf8_encode($blog_name);
296
+		$charset       = 'utf-8';
297
+		$title1        = urlencode($title);
298
+		$excerpt1      = urlencode($excerpt);
299
+		$name1         = urlencode($blog_name);
300
+		$url           = urlencode(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article->getVar('art_id'));
301
+		$query_string  = "title=$title1&url=$url&blog_name=$name1&excerpt=$excerpt1&charset=$charset";
302
+		$trackback_url = parse_url($trackback_url);
303
+
304
+		$http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?' . $trackback_url['query'] : '') . " HTTP/1.0\r\n";
305
+		$http_request .= 'Host: ' . $trackback_url['host'] . "\r\n";
306
+		$http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . $charset . "\r\n";
307
+		$http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n";
308
+		$http_request .= 'User-Agent: XOOPS Blogs/' . XOOPS_VERSION;
309
+		$http_request .= "\r\n\r\n";
310
+		$http_request .= $query_string;
311
+		if ('' == $trackback_url['port']) {
312
+			$trackback_url['port'] = 80;
313
+		}
314
+		$fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4);
315
+		@fwrite($fs, $http_request);
316
+		if ($helper->getConfig('do_debug')) {
317
+			$debug_file = XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '_trackback.log';
318
+			$fr         = "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n";
319
+			$fr         .= "CHARSET:$charset\n";
320
+			$fr         .= "NAME:$blog_name\n";
321
+			$fr         .= 'TITLE:' . $title . "\n";
322
+			$fr         .= "EXCERPT:$excerpt\n\n";
323
+			while (!@feof($fs)) {
324
+				$fr .= @fgets($fs, 4096);
325
+			}
326
+			$fr .= "\n\n";
327
+
328
+			if ($fp = fopen($debug_file, 'a')) {
329
+				fwrite($fp, $fr);
330
+				fclose($fp);
331
+			} else {
332
+			}
333
+		}
334
+		@fclose($fs);
335
+
336
+		return true;
337
+	}
338
+
339
+	/**
340
+	 * Function to ping servers
341
+	 * @param $server
342
+	 * @param $id
343
+	 */
344
+	function planetGetPing($server, $id)
345
+	{
346
+		if (is_array($server)) {
347
+			foreach ($server as $serv) {
348
+				planetGetPing($serv, $id);
349
+			}
350
+		}
351
+		require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/class-IXR.php';
352
+
353
+		// using a timeout of 3 seconds should be enough to cover slow servers
354
+		$client            = new IXR_Client($server, false);
355
+		$client->timeout   = 3;
356
+		$client->useragent .= ' -- XOOPS Article/' . XOOPS_VERSION;
357
+
358
+		// when set to true, this outputs debug messages by itself
359
+		$client->debug = false;
360
+
361
+		$blogname = xoops_utf8_encode($GLOBALS['xoopsModule']->getVar('name'));
362
+		$home     = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/';
363
+		$rss2_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php' . URL_DELIMITER . 'rss2.0/' . $id;
364
+
365
+		if (!$client->query('weblogUpdates.extendedPing', $blogname, $home, $rss2_url)) { // then try a normal ping
366
+			$client->query('weblogUpdates.ping', $blogname, $home);
367
+		}
368
+	}
369
+
370
+	/**
371
+	 * Function to respond to a trackback
372
+	 * @param int    $error
373
+	 * @param string $error_message
374
+	 */
375
+	function planetRespondToTrackback($error = 0, $error_message = '')
376
+	{
377
+		$charset       = 'utf-8';
378
+		$error_message = xoops_utf8_encode($error_message);
379
+		header('Content-Type: text/xml; charset="' . $charset . '"');
380
+		if ($error) {
381
+			echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n";
382
+			echo "<response>\n";
383
+			echo "<error>1</error>\n";
384
+			echo "<message>$error_message</message>\n";
385
+			echo '</response>';
386
+			die();
387
+		} else {
388
+			echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n";
389
+			echo "<response>\n";
390
+			echo "<error>0</error>\n";
391
+			echo '</response>';
392
+		}
393
+	}
394
+
395
+	/**
396
+	 * Function to set a cookie with module-specified name
397
+	 *
398
+	 * using customized serialization method
399
+	 * @param        $name
400
+	 * @param string $string
401
+	 * @param int    $expire
402
+	 */
403
+	function planetSetCookie($name, $string = '', $expire = 0)
404
+	{
405
+		if (is_array($string)) {
406
+			$value = [];
407
+			foreach ($string as $key => $val) {
408
+				$value[] = $key . '|' . $val;
409
+			}
410
+			$string = implode(',', $value);
411
+		}
412
+		setcookie($GLOBALS['VAR_PREFIX'] . $name, $string, (int)$expire, '/');
413
+	}
414
+
415
+	/**
416
+	 * @param      $name
417
+	 * @param bool $isArray
418
+	 * @return array|null
419
+	 */
420
+	function planetGetCookie($name, $isArray = false)
421
+	{
422
+		$value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'] . $name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'] . $name] : null;
423
+		if ($isArray) {
424
+			$_value = $value ? explode(',', $value) : [];
425
+			$value  = [];
426
+			if (count($_value) > 0) {
427
+				foreach ($_value as $string) {
428
+					$key         = substr($string, 0, strpos($string, '|'));
429
+					$val         = substr($string, strpos($string, '|') + 1);
430
+					$value[$key] = $val;
431
+				}
432
+			}
433
+			unset($_value);
434
+		}
435
+
436
+		return $value;
437
+	}
438
+
439
+	/**
440
+	 * Function to filter text
441
+	 *
442
+	 * @param $document
443
+	 * @return string filtered text
444
+	 */
445
+	function &planetHtml2text(&$document)
446
+	{
447
+		$document = strip_tags($document);
448
+
449
+		return $document;
450
+	}
451
+
452
+	// Adapted from PMA_getIp() [phpmyadmin project]
453
+	/**
454
+	 * @param bool $asString
455
+	 * @return mixed
456
+	 */
457
+	function planetGetIP($asString = false)
458
+	{
459
+		return mod_getIP($asString);
460
+	}
461
+
462
+	/**
463
+	 * @param $url
464
+	 * @return bool|mixed|string
465
+	 */
466
+	function planetGetRemoteContent($url)
467
+	{
468
+		if ($data = planet_fetch_snoopy($url)) {
469
+			return $data;
470
+		}
471
+		if ($data = planet_fetch_CURL($url)) {
472
+			return $data;
473
+		}
474
+		if ($data = planet_fetch_fopen($url)) {
475
+			return $data;
476
+		}
477
+
478
+		return false;
479
+	}
480
+
481
+	/**
482
+	 * @param $url
483
+	 * @return string
484
+	 */
485
+	function planet_fetch_snoopy($url)
486
+	{
487
+		require_once XOOPS_ROOT_PATH . '/class/snoopy.php';
488
+		$snoopy = new Snoopy;
489
+		$data   = '';
490
+		if (@$snoopy->fetch($url)) {
491
+			$data = is_array($snoopy->results) ? implode("\n", $snoopy->results) : $snoopy->results;
492
+		}
493
+
494
+		return $data;
495
+	}
496
+
497
+	/**
498
+	 * @param $url
499
+	 * @return bool|mixed
500
+	 */
501
+	function planet_fetch_CURL($url)
502
+	{
503
+		if (!function_exists('curl_init')) {
504
+			return false;
505
+		}
506
+		$ch = curl_init();    // initialize curl handle
507
+		curl_setopt($ch, CURLOPT_URL, $url); // set url to post to
508
+		curl_setopt($ch, CURLOPT_FAILONERROR, 1);
509
+		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
510
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable
511
+		curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 31s
512
+		$data = curl_exec($ch); // run the whole process
513
+		curl_close($ch);
514
+
515
+		return $data;
516
+	}
517
+
518
+	/**
519
+	 * @param $url
520
+	 * @return bool|string
521
+	 */
522
+	function planet_fetch_fopen($url)
523
+	{
524
+		if (!$fp = @fopen($url, 'r')) {
525
+			return false;
526
+		}
527
+		$data = '';
528
+		while (!feof($fp)) {
529
+			$data .= fgets($fp, 1024);
530
+		}
531
+		fclose($fp);
532
+
533
+		return $data;
534
+	}
535
+
536
+	/**
537
+	 * @param     $haystack
538
+	 * @param     $needle
539
+	 * @param int $offset
540
+	 * @return bool|int
541
+	 */
542
+	function planetStrrPos($haystack, $needle, $offset = 0)
543
+	{
544
+		if (5 == substr(PHP_VERSION, 0, 1)) {
545
+			return strrpos($haystack, $needle, $offset);
546
+		}
547
+		$index = strpos(strrev($haystack), strrev($needle));
548
+		if (false === $index) {
549
+			return false;
550
+		}
551
+		$index = strlen($haystack) - strlen($needle) - $index;
552
+
553
+		return $index;
554
+	}
555 555
 endif;
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 if (!defined('planet_FUNCTIONS')):
42 42
     define('planet_FUNCTIONS', 1);
43 43
 
44
-    require XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/vars.php';
45
-    require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
46
-    require_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.php';
44
+    require XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/vars.php';
45
+    require_once XOOPS_ROOT_PATH.'/class/xoopslists.php';
46
+    require_once XOOPS_ROOT_PATH.'/Frameworks/art/functions.php';
47 47
 
48 48
     /**
49 49
      * Function to display messages
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     */
73 73
     function planetParseArguments(&$args_numeric, &$args, &$args_string)
74 74
     {
75
-        $args_abb     = [
75
+        $args_abb = [
76 76
             'a' => 'article',
77 77
             'b' => 'blog',
78 78
             'c' => 'category',
@@ -87,24 +87,24 @@  discard block
 block discarded – undo
87 87
         if (preg_match("/[^\?]*\.php[\/|\?]([^\?]*)/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) {
88 88
             $vars = preg_split("/[\/|&]/", $matches[1]);
89 89
             $vars = array_map('trim', $vars);
90
-            if (count($vars) > 0) {
90
+            if (count($vars)>0) {
91 91
                 foreach ($vars as $var) {
92 92
                     if (is_numeric($var)) {
93 93
                         $args_numeric[] = $var;
94 94
                     } elseif (false === strpos($var, '=')) {
95 95
                         if (is_numeric(substr($var, 1))) {
96
-                            $args[$args_abb[strtolower($var{0})]] = (int)substr($var, 1);
97
-                        } else {
96
+                            $args[$args_abb[strtolower($var{0})]] = (int) substr($var, 1);
97
+                        }else {
98 98
                             $args_string[] = urldecode($var);
99 99
                         }
100
-                    } else {
100
+                    }else {
101 101
                         parse_str($var, $args);
102 102
                     }
103 103
                 }
104 104
             }
105 105
         }
106 106
 
107
-        return (0 == count($args) + count($args_numeric) + count($args_string)) ? null : true;
107
+        return (0 == count($args)+count($args_numeric)+count($args_string)) ? null : true;
108 108
     }
109 109
 
110 110
     /**
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             $pattern     = [$pattern];
128 128
             $replacement = [$replacement];
129 129
         }
130
-        if (is_array($pattern) && count($pattern) > 0) {
130
+        if (is_array($pattern) && count($pattern)>0) {
131 131
             $ii = 0;
132 132
             foreach ($pattern as $pat) {
133 133
                 if (!in_array($pat, $patterns)) {
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             $pattern     = [$pattern];
164 164
             $replacement = [$replacement];
165 165
         }
166
-        if (is_array($pattern) && count($pattern) > 0) {
166
+        if (is_array($pattern) && count($pattern)>0) {
167 167
             $ii = 0;
168 168
             foreach ($pattern as $pat) {
169 169
                 if (!in_array($pat, $patterns)) {
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         if (!is_array($userid)) {
207 207
             $userid = [$userid];
208 208
         }
209
-        $users =& mod_getUnameFromIds($userid, $usereal, $linked);
209
+        $users = & mod_getUnameFromIds($userid, $usereal, $linked);
210 210
 
211 211
         return $users;
212 212
     }
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
         $myts       = \MyTextSanitizer::getInstance();
224 224
         $link_array = preg_split("/(\r\n|\r|\n)( *)/", $text);
225 225
         $links      = [];
226
-        if (count($link_array) > 0) {
226
+        if (count($link_array)>0) {
227 227
             foreach ($link_array as $link) {
228 228
                 @list($url, $title) = array_map('trim', preg_split('/ /', $link, 2));
229 229
                 if (empty($url)) {
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
      */
244 244
     function planetGetTemplate($pagename)
245 245
     {
246
-        return $GLOBALS['VAR_PREFIX'] . '_' . $pagename . '.tpl';
246
+        return $GLOBALS['VAR_PREFIX'].'_'.$pagename.'.tpl';
247 247
     }
248 248
 
249 249
     /**
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
             return false;
272 272
         }
273 273
         @list($pat, $rep) = array_map('trim', preg_split("#[\s]+#", $pattern));
274
-        $trackback_url = preg_replace('#' . $pat . '#', $rep, $article_obj->getVar('art_link'));
274
+        $trackback_url = preg_replace('#'.$pat.'#', $rep, $article_obj->getVar('art_link'));
275 275
 
276 276
         return planetTrackback($trackback_url, $article);
277 277
     }
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 
290 290
         $title         = $article->getVar('art_title');
291 291
         $excerpt       = $article->getVar('art_content');
292
-        $blog_name     = $xoopsConfig['sitename'] . '-' . $xoopsModule->getVar('name');
292
+        $blog_name     = $xoopsConfig['sitename'].'-'.$xoopsModule->getVar('name');
293 293
         $title         = xoops_utf8_encode($title);
294 294
         $excerpt       = xoops_utf8_encode($excerpt);
295 295
         $blog_name     = xoops_utf8_encode($blog_name);
@@ -297,15 +297,15 @@  discard block
 block discarded – undo
297 297
         $title1        = urlencode($title);
298 298
         $excerpt1      = urlencode($excerpt);
299 299
         $name1         = urlencode($blog_name);
300
-        $url           = urlencode(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article->getVar('art_id'));
300
+        $url           = urlencode(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$article->getVar('art_id'));
301 301
         $query_string  = "title=$title1&url=$url&blog_name=$name1&excerpt=$excerpt1&charset=$charset";
302 302
         $trackback_url = parse_url($trackback_url);
303 303
 
304
-        $http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?' . $trackback_url['query'] : '') . " HTTP/1.0\r\n";
305
-        $http_request .= 'Host: ' . $trackback_url['host'] . "\r\n";
306
-        $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . $charset . "\r\n";
307
-        $http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n";
308
-        $http_request .= 'User-Agent: XOOPS Blogs/' . XOOPS_VERSION;
304
+        $http_request = 'POST '.$trackback_url['path'].($trackback_url['query'] ? '?'.$trackback_url['query'] : '')." HTTP/1.0\r\n";
305
+        $http_request .= 'Host: '.$trackback_url['host']."\r\n";
306
+        $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.$charset."\r\n";
307
+        $http_request .= 'Content-Length: '.strlen($query_string)."\r\n";
308
+        $http_request .= 'User-Agent: XOOPS Blogs/'.XOOPS_VERSION;
309 309
         $http_request .= "\r\n\r\n";
310 310
         $http_request .= $query_string;
311 311
         if ('' == $trackback_url['port']) {
@@ -314,11 +314,11 @@  discard block
 block discarded – undo
314 314
         $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4);
315 315
         @fwrite($fs, $http_request);
316 316
         if ($helper->getConfig('do_debug')) {
317
-            $debug_file = XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '_trackback.log';
317
+            $debug_file = XOOPS_CACHE_PATH.'/'.$GLOBALS['moddirname'].'_trackback.log';
318 318
             $fr         = "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n";
319 319
             $fr         .= "CHARSET:$charset\n";
320 320
             $fr         .= "NAME:$blog_name\n";
321
-            $fr         .= 'TITLE:' . $title . "\n";
321
+            $fr         .= 'TITLE:'.$title."\n";
322 322
             $fr         .= "EXCERPT:$excerpt\n\n";
323 323
             while (!@feof($fs)) {
324 324
                 $fr .= @fgets($fs, 4096);
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
             if ($fp = fopen($debug_file, 'a')) {
329 329
                 fwrite($fp, $fr);
330 330
                 fclose($fp);
331
-            } else {
331
+            }else {
332 332
             }
333 333
         }
334 334
         @fclose($fs);
@@ -348,19 +348,19 @@  discard block
 block discarded – undo
348 348
                 planetGetPing($serv, $id);
349 349
             }
350 350
         }
351
-        require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/class-IXR.php';
351
+        require_once XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/class-IXR.php';
352 352
 
353 353
         // using a timeout of 3 seconds should be enough to cover slow servers
354 354
         $client            = new IXR_Client($server, false);
355 355
         $client->timeout   = 3;
356
-        $client->useragent .= ' -- XOOPS Article/' . XOOPS_VERSION;
356
+        $client->useragent .= ' -- XOOPS Article/'.XOOPS_VERSION;
357 357
 
358 358
         // when set to true, this outputs debug messages by itself
359 359
         $client->debug = false;
360 360
 
361 361
         $blogname = xoops_utf8_encode($GLOBALS['xoopsModule']->getVar('name'));
362
-        $home     = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/';
363
-        $rss2_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php' . URL_DELIMITER . 'rss2.0/' . $id;
362
+        $home     = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/';
363
+        $rss2_url = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/xml.php'.URL_DELIMITER.'rss2.0/'.$id;
364 364
 
365 365
         if (!$client->query('weblogUpdates.extendedPing', $blogname, $home, $rss2_url)) { // then try a normal ping
366 366
             $client->query('weblogUpdates.ping', $blogname, $home);
@@ -376,16 +376,16 @@  discard block
 block discarded – undo
376 376
     {
377 377
         $charset       = 'utf-8';
378 378
         $error_message = xoops_utf8_encode($error_message);
379
-        header('Content-Type: text/xml; charset="' . $charset . '"');
379
+        header('Content-Type: text/xml; charset="'.$charset.'"');
380 380
         if ($error) {
381
-            echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n";
381
+            echo '<?xml version="1.0" encoding="'.$charset.'"?'.">\n";
382 382
             echo "<response>\n";
383 383
             echo "<error>1</error>\n";
384 384
             echo "<message>$error_message</message>\n";
385 385
             echo '</response>';
386 386
             die();
387
-        } else {
388
-            echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n";
387
+        }else {
388
+            echo '<?xml version="1.0" encoding="'.$charset.'"?'.">\n";
389 389
             echo "<response>\n";
390 390
             echo "<error>0</error>\n";
391 391
             echo '</response>';
@@ -405,11 +405,11 @@  discard block
 block discarded – undo
405 405
         if (is_array($string)) {
406 406
             $value = [];
407 407
             foreach ($string as $key => $val) {
408
-                $value[] = $key . '|' . $val;
408
+                $value[] = $key.'|'.$val;
409 409
             }
410 410
             $string = implode(',', $value);
411 411
         }
412
-        setcookie($GLOBALS['VAR_PREFIX'] . $name, $string, (int)$expire, '/');
412
+        setcookie($GLOBALS['VAR_PREFIX'].$name, $string, (int) $expire, '/');
413 413
     }
414 414
 
415 415
     /**
@@ -419,14 +419,14 @@  discard block
 block discarded – undo
419 419
      */
420 420
     function planetGetCookie($name, $isArray = false)
421 421
     {
422
-        $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'] . $name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'] . $name] : null;
422
+        $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'].$name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'].$name] : null;
423 423
         if ($isArray) {
424 424
             $_value = $value ? explode(',', $value) : [];
425 425
             $value  = [];
426
-            if (count($_value) > 0) {
426
+            if (count($_value)>0) {
427 427
                 foreach ($_value as $string) {
428 428
                     $key         = substr($string, 0, strpos($string, '|'));
429
-                    $val         = substr($string, strpos($string, '|') + 1);
429
+                    $val         = substr($string, strpos($string, '|')+1);
430 430
                     $value[$key] = $val;
431 431
                 }
432 432
             }
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
      */
485 485
     function planet_fetch_snoopy($url)
486 486
     {
487
-        require_once XOOPS_ROOT_PATH . '/class/snoopy.php';
487
+        require_once XOOPS_ROOT_PATH.'/class/snoopy.php';
488 488
         $snoopy = new Snoopy;
489 489
         $data   = '';
490 490
         if (@$snoopy->fetch($url)) {
@@ -503,10 +503,10 @@  discard block
 block discarded – undo
503 503
         if (!function_exists('curl_init')) {
504 504
             return false;
505 505
         }
506
-        $ch = curl_init();    // initialize curl handle
506
+        $ch = curl_init(); // initialize curl handle
507 507
         curl_setopt($ch, CURLOPT_URL, $url); // set url to post to
508 508
         curl_setopt($ch, CURLOPT_FAILONERROR, 1);
509
-        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
509
+        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects
510 510
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable
511 511
         curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 31s
512 512
         $data = curl_exec($ch); // run the whole process
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
         if (false === $index) {
549 549
             return false;
550 550
         }
551
-        $index = strlen($haystack) - strlen($needle) - $index;
551
+        $index = strlen($haystack)-strlen($needle)-$index;
552 552
 
553 553
         return $index;
554 554
     }
Please login to merge, or discard this patch.
include/search.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 
28 28
 // defined('XOOPS_ROOT_PATH') || die('Restricted access');
29 29
 
30
-include __DIR__ . '/vars.php';
30
+include __DIR__.'/vars.php';
31 31
 //mod_loadFunctions('', $GLOBALS['moddirname']);
32 32
 
33 33
 PlanetUtility::planetParseFunction('
Please login to merge, or discard this patch.
include/action.module.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 
28 28
 // defined('XOOPS_ROOT_PATH') || die('Restricted access');
29 29
 
30
-include __DIR__ . '/vars.php';
30
+include __DIR__.'/vars.php';
31 31
 //mod_loadFunctions('', $GLOBALS['moddirname']);
32 32
 
33 33
 PlanetUtility::planetParseFunction('
Please login to merge, or discard this patch.
include/onuninstall.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 
19 19
 function xoops_module_pre_uninstall_xxxx(\XoopsModule $module)
20 20
 {
21
-    // Do some synchronization
22
-    return true;
21
+	// Do some synchronization
22
+	return true;
23 23
 }
24 24
 
25 25
 /**
@@ -33,36 +33,36 @@  discard block
 block discarded – undo
33 33
 {
34 34
 //    return true;
35 35
 
36
-    $moduleDirName = basename(dirname(__DIR__));
37
-    $xsitemapHelper      = \Xmf\Module\Helper::getHelper($moduleDirName);
36
+	$moduleDirName = basename(dirname(__DIR__));
37
+	$xsitemapHelper      = \Xmf\Module\Helper::getHelper($moduleDirName);
38 38
 
39
-    /** @var XXXXXXUtility $utilityClass */
40
-    $utilityClass     = ucfirst($moduleDirName) . 'Utility';
41
-    if (!class_exists($utilityClass)) {
42
-        xoops_load('utility', $moduleDirName);
43
-    }
39
+	/** @var XXXXXXUtility $utilityClass */
40
+	$utilityClass     = ucfirst($moduleDirName) . 'Utility';
41
+	if (!class_exists($utilityClass)) {
42
+		xoops_load('utility', $moduleDirName);
43
+	}
44 44
 
45
-    $success = true;
46
-    $xsitemapHelper->loadLanguage('admin');
45
+	$success = true;
46
+	$xsitemapHelper->loadLanguage('admin');
47 47
 
48 48
 
49
-    //------------------------------------------------------------------
50
-    // Remove uploads folder (and all subfolders) if they exist
51
-    //------------------------------------------------------------------
49
+	//------------------------------------------------------------------
50
+	// Remove uploads folder (and all subfolders) if they exist
51
+	//------------------------------------------------------------------
52 52
 
53
-    $old_directories = [$GLOBALS['xoops']->path("uploads/{$moduleDirName}")];
54
-    foreach ($old_directories as $old_dir) {
55
-        $dirInfo = new \SplFileInfo($old_dir);
56
-        if ($dirInfo->isDir()) {
57
-            // The directory exists so delete it
58
-            if (false === $utilityClass::rrmdir($old_dir)) {
59
-                $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $old_dir));
60
-                $success = false;
61
-            }
62
-        }
63
-        unset($dirInfo);
64
-    }
65
-    /*
53
+	$old_directories = [$GLOBALS['xoops']->path("uploads/{$moduleDirName}")];
54
+	foreach ($old_directories as $old_dir) {
55
+		$dirInfo = new \SplFileInfo($old_dir);
56
+		if ($dirInfo->isDir()) {
57
+			// The directory exists so delete it
58
+			if (false === $utilityClass::rrmdir($old_dir)) {
59
+				$module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $old_dir));
60
+				$success = false;
61
+			}
62
+		}
63
+		unset($dirInfo);
64
+	}
65
+	/*
66 66
     //------------ START ----------------
67 67
     //------------------------------------------------------------------
68 68
     // Remove xsitemap.xml from XOOPS root folder if it exists
@@ -76,6 +76,6 @@  discard block
 block discarded – undo
76 76
 //    return $success && $delOk; // use this if you're using this routine
77 77
 */
78 78
 
79
-    return $success;
80
-    //------------ END  ----------------
79
+	return $success;
80
+	//------------ END  ----------------
81 81
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 //    return true;
35 35
 
36 36
     $moduleDirName = basename(dirname(__DIR__));
37
-    $xsitemapHelper      = \Xmf\Module\Helper::getHelper($moduleDirName);
37
+    $xsitemapHelper = \Xmf\Module\Helper::getHelper($moduleDirName);
38 38
 
39 39
     /** @var XXXXXXUtility $utilityClass */
40
-    $utilityClass     = ucfirst($moduleDirName) . 'Utility';
40
+    $utilityClass = ucfirst($moduleDirName).'Utility';
41 41
     if (!class_exists($utilityClass)) {
42 42
         xoops_load('utility', $moduleDirName);
43 43
     }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         if ($dirInfo->isDir()) {
57 57
             // The directory exists so delete it
58 58
             if (false === $utilityClass::rrmdir($old_dir)) {
59
-                $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $old_dir));
59
+                $module->setErrors(sprintf(constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_DEL_PATH'), $old_dir));
60 60
                 $success = false;
61 61
             }
62 62
         }
Please login to merge, or discard this patch.
include/notification.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 
20 20
 // defined('XOOPS_ROOT_PATH') || die('Restricted access');
21 21
 
22
-include __DIR__ . '/vars.php';
22
+include __DIR__.'/vars.php';
23 23
 //mod_loadFunctions('', $GLOBALS['moddirname']);
24 24
 
25 25
 PlanetUtility::planetParseFunction('
Please login to merge, or discard this patch.
include/form.blog.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -43,28 +43,28 @@
 block discarded – undo
43 43
 $categories_option = $categoryHandler->getList();
44 44
 natsort($categories_option);
45 45
 if (count($categories_option)) {
46
-    $cat_option_tray = new \XoopsFormElementTray(planet_constant('MD_CATEGORY'), '<br>');
47
-    $options         = [0 => _NONE];
48
-    foreach ($categories_option as $id => $title) {
49
-        $options[$id] = $title;
50
-    }
51
-    $cat_select = new \XoopsFormSelect('', 'categories', $categories, 3, true);
52
-    $cat_select->addOptionArray($options);
53
-    $cat_option_tray->addElement($cat_select);
54
-    $form->addElement($cat_option_tray);
46
+	$cat_option_tray = new \XoopsFormElementTray(planet_constant('MD_CATEGORY'), '<br>');
47
+	$options         = [0 => _NONE];
48
+	foreach ($categories_option as $id => $title) {
49
+		$options[$id] = $title;
50
+	}
51
+	$cat_select = new \XoopsFormSelect('', 'categories', $categories, 3, true);
52
+	$cat_select->addOptionArray($options);
53
+	$cat_option_tray->addElement($cat_select);
54
+	$form->addElement($cat_option_tray);
55 55
 }
56 56
 
57 57
 /* For admin only */
58 58
 if (is_object($xoopsUser) && $xoopsUser->isAdmin()) {
59
-    $status_option_tray = new \XoopsFormElementTray(planet_constant('MD_STATUS'), '<br>');
60
-    $status_select      = new \XoopsFormSelect('', 'blog_status', $blog_obj->getVar('blog_status'));
61
-    $status_select->addOptionArray([
62
-                                       '0' => planet_constant('MD_PENDING'),
63
-                                       '1' => planet_constant('MD_ACTIVE'),
64
-                                       '2' => planet_constant('MD_FEATURED')
65
-                                   ]);
66
-    $status_option_tray->addElement($status_select);
67
-    $form->addElement($status_option_tray);
59
+	$status_option_tray = new \XoopsFormElementTray(planet_constant('MD_STATUS'), '<br>');
60
+	$status_select      = new \XoopsFormSelect('', 'blog_status', $blog_obj->getVar('blog_status'));
61
+	$status_select->addOptionArray([
62
+									   '0' => planet_constant('MD_PENDING'),
63
+									   '1' => planet_constant('MD_ACTIVE'),
64
+									   '2' => planet_constant('MD_FEATURED')
65
+								   ]);
66
+	$status_option_tray->addElement($status_select);
67
+	$form->addElement($status_option_tray);
68 68
 }
69 69
 
70 70
 $form->addElement(new \XoopsFormHidden('blog', $blog_id));
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 // ------------------------------------------------------------------------ //
27 27
 // defined('XOOPS_ROOT_PATH') || die('Restricted access');
28 28
 
29
-require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
29
+require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
30 30
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
31 31
 
32 32
 $form = new \XoopsThemeForm(_EDIT, 'formblog', xoops_getenv('PHP_SELF'), 'POST', true);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 $butt_save = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
77 77
 $button_tray->addElement($butt_save);
78 78
 $butt_cancel = new \XoopsFormButton('', 'cancel', _CANCEL, 'button');
79
-$butt_cancel->setExtra("onclick='window.document.location=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . (int)$blog_id . "\"'");
79
+$butt_cancel->setExtra("onclick='window.document.location=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.(int) $blog_id."\"'");
80 80
 $button_tray->addElement($butt_cancel);
81 81
 $form->addElement($button_tray);
82 82
 $form->display();
Please login to merge, or discard this patch.
include/onupdate.php 2 patches
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
  */
19 19
 
20 20
 if ((!defined('XOOPS_ROOT_PATH')) || !($GLOBALS['xoopsUser'] instanceof \XoopsUser)
21
-    || !$GLOBALS['xoopsUser']->IsAdmin()
21
+	|| !$GLOBALS['xoopsUser']->IsAdmin()
22 22
 ) {
23
-    exit('Restricted access' . PHP_EOL);
23
+	exit('Restricted access' . PHP_EOL);
24 24
 }
25 25
 
26 26
 /**
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
  */
31 31
 function tableExists($tablename)
32 32
 {
33
-    $result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'");
33
+	$result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'");
34 34
 
35
-    return ($GLOBALS['xoopsDB']->getRowsNum($result) > 0) ? true : false;
35
+	return ($GLOBALS['xoopsDB']->getRowsNum($result) > 0) ? true : false;
36 36
 }
37 37
 
38 38
 /**
@@ -44,15 +44,15 @@  discard block
 block discarded – undo
44 44
  */
45 45
 function xoops_module_pre_update_planet(\XoopsModule $module)
46 46
 {
47
-    $moduleDirName = basename(dirname(__DIR__));
48
-    /** @var Planet\Helper $helper */
49
-    /** @var Planet\Utility $utility */
50
-    $helper       = Planet\Helper::getInstance();
51
-    $utility      = new Planet\Utility();
52
-
53
-    $xoopsSuccess = $utility::checkVerXoops($module);
54
-    $phpSuccess   = $utility::checkVerPhp($module);
55
-    return $xoopsSuccess && $phpSuccess;
47
+	$moduleDirName = basename(dirname(__DIR__));
48
+	/** @var Planet\Helper $helper */
49
+	/** @var Planet\Utility $utility */
50
+	$helper       = Planet\Helper::getInstance();
51
+	$utility      = new Planet\Utility();
52
+
53
+	$xoopsSuccess = $utility::checkVerXoops($module);
54
+	$phpSuccess   = $utility::checkVerPhp($module);
55
+	return $xoopsSuccess && $phpSuccess;
56 56
 }
57 57
 
58 58
 /**
@@ -66,96 +66,96 @@  discard block
 block discarded – undo
66 66
 
67 67
 function xoops_module_update_planet(\XoopsModule $module, $previousVersion = null)
68 68
 {
69
-    $moduleDirName = basename(dirname(__DIR__));
70
-    $capsDirName   = strtoupper($moduleDirName);
71
-
72
-    /** @var Planet\Helper $helper */
73
-    /** @var Planet\Utility $utility */
74
-    /** @var Planet\Configurator $configurator */
75
-    $helper  = Planet\Helper::getInstance();
76
-    $utility = new Planet\Utility();
77
-    $configurator = new Planet\Configurator();
78
-
79
-    if ($previousVersion < 240) {
80
-
81
-        //rename column EXAMPLE
82
-        $tables     = new Tables();
83
-        $table      = 'planetx_categories';
84
-        $column     = 'ordre';
85
-        $newName    = 'order';
86
-        $attributes = "INT(5) NOT NULL DEFAULT '0'";
87
-        if ($tables->useTable($table)) {
88
-            $tables->alterColumn($table, $column, $attributes, $newName);
89
-            if (!$tables->executeQueue()) {
90
-                echo '<br>' . _AM_XXXXX_UPGRADEFAILED0 . ' ' . $migrate->getLastError();
91
-            }
92
-        }
93
-
94
-        //delete old HTML templates
95
-        if (count($configurator->templateFolders) > 0) {
96
-            foreach ($configurator->templateFolders as $folder) {
97
-                $templateFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $folder);
98
-                if (is_dir($templateFolder)) {
99
-                    $templateList = array_diff(scandir($templateFolder, SCANDIR_SORT_NONE), ['..', '.']);
100
-                    foreach ($templateList as $k => $v) {
101
-                        $fileInfo = new \SplFileInfo($templateFolder . $v);
102
-                        if ('html' === $fileInfo->getExtension() && 'index.html' !== $fileInfo->getFilename()) {
103
-                            if (file_exists($templateFolder . $v)) {
104
-                                unlink($templateFolder . $v);
105
-                            }
106
-                        }
107
-                    }
108
-                }
109
-            }
110
-        }
111
-
112
-        //  ---  DELETE OLD FILES ---------------
113
-        if (count($configurator->oldFiles) > 0) {
114
-            //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
115
-            foreach (array_keys($configurator->oldFiles) as $i) {
116
-                $tempFile = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFiles[$i]);
117
-                if (is_file($tempFile)) {
118
-                    unlink($tempFile);
119
-                }
120
-            }
121
-        }
122
-
123
-        //  ---  DELETE OLD FOLDERS ---------------
124
-        xoops_load('XoopsFile');
125
-        if (count($configurator->oldFolders) > 0) {
126
-            //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
127
-            foreach (array_keys($configurator->oldFolders) as $i) {
128
-                $tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]);
129
-                /* @var $folderHandler XoopsObjectHandler */
130
-                $folderHandler = XoopsFile::getHandler('folder', $tempFolder);
131
-                $folderHandler->delete($tempFolder);
132
-            }
133
-        }
134
-
135
-        //  ---  CREATE FOLDERS ---------------
136
-        if (count($configurator->uploadFolders) > 0) {
137
-            //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
138
-            foreach (array_keys($configurator->uploadFolders) as $i) {
139
-                $utilityClass::createFolder($configurator->uploadFolders[$i]);
140
-            }
141
-        }
142
-
143
-        //  ---  COPY blank.png FILES ---------------
144
-        if (count($configurator->copyBlankFiles) > 0) {
145
-            $file = __DIR__ . '/../assets/images/blank.png';
146
-            foreach (array_keys($configurator->copyBlankFiles) as $i) {
147
-                $dest = $configurator->copyBlankFiles[$i] . '/blank.png';
148
-                $utilityClass::copyFile($file, $dest);
149
-            }
150
-        }
151
-
152
-        //delete .html entries from the tpl table
153
-        $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . '\' AND `tpl_file` LIKE \'%.html%\'';
154
-        $GLOBALS['xoopsDB']->queryF($sql);
155
-
156
-        /** @var XoopsGroupPermHandler $gpermHandler */
157
-        $gpermHandler = xoops_getHandler('groupperm');
158
-        return $gpermHandler->deleteByModule($module->getVar('mid'), 'item_read');
159
-    }
160
-    return true;
69
+	$moduleDirName = basename(dirname(__DIR__));
70
+	$capsDirName   = strtoupper($moduleDirName);
71
+
72
+	/** @var Planet\Helper $helper */
73
+	/** @var Planet\Utility $utility */
74
+	/** @var Planet\Configurator $configurator */
75
+	$helper  = Planet\Helper::getInstance();
76
+	$utility = new Planet\Utility();
77
+	$configurator = new Planet\Configurator();
78
+
79
+	if ($previousVersion < 240) {
80
+
81
+		//rename column EXAMPLE
82
+		$tables     = new Tables();
83
+		$table      = 'planetx_categories';
84
+		$column     = 'ordre';
85
+		$newName    = 'order';
86
+		$attributes = "INT(5) NOT NULL DEFAULT '0'";
87
+		if ($tables->useTable($table)) {
88
+			$tables->alterColumn($table, $column, $attributes, $newName);
89
+			if (!$tables->executeQueue()) {
90
+				echo '<br>' . _AM_XXXXX_UPGRADEFAILED0 . ' ' . $migrate->getLastError();
91
+			}
92
+		}
93
+
94
+		//delete old HTML templates
95
+		if (count($configurator->templateFolders) > 0) {
96
+			foreach ($configurator->templateFolders as $folder) {
97
+				$templateFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $folder);
98
+				if (is_dir($templateFolder)) {
99
+					$templateList = array_diff(scandir($templateFolder, SCANDIR_SORT_NONE), ['..', '.']);
100
+					foreach ($templateList as $k => $v) {
101
+						$fileInfo = new \SplFileInfo($templateFolder . $v);
102
+						if ('html' === $fileInfo->getExtension() && 'index.html' !== $fileInfo->getFilename()) {
103
+							if (file_exists($templateFolder . $v)) {
104
+								unlink($templateFolder . $v);
105
+							}
106
+						}
107
+					}
108
+				}
109
+			}
110
+		}
111
+
112
+		//  ---  DELETE OLD FILES ---------------
113
+		if (count($configurator->oldFiles) > 0) {
114
+			//    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
115
+			foreach (array_keys($configurator->oldFiles) as $i) {
116
+				$tempFile = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFiles[$i]);
117
+				if (is_file($tempFile)) {
118
+					unlink($tempFile);
119
+				}
120
+			}
121
+		}
122
+
123
+		//  ---  DELETE OLD FOLDERS ---------------
124
+		xoops_load('XoopsFile');
125
+		if (count($configurator->oldFolders) > 0) {
126
+			//    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
127
+			foreach (array_keys($configurator->oldFolders) as $i) {
128
+				$tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]);
129
+				/* @var $folderHandler XoopsObjectHandler */
130
+				$folderHandler = XoopsFile::getHandler('folder', $tempFolder);
131
+				$folderHandler->delete($tempFolder);
132
+			}
133
+		}
134
+
135
+		//  ---  CREATE FOLDERS ---------------
136
+		if (count($configurator->uploadFolders) > 0) {
137
+			//    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
138
+			foreach (array_keys($configurator->uploadFolders) as $i) {
139
+				$utilityClass::createFolder($configurator->uploadFolders[$i]);
140
+			}
141
+		}
142
+
143
+		//  ---  COPY blank.png FILES ---------------
144
+		if (count($configurator->copyBlankFiles) > 0) {
145
+			$file = __DIR__ . '/../assets/images/blank.png';
146
+			foreach (array_keys($configurator->copyBlankFiles) as $i) {
147
+				$dest = $configurator->copyBlankFiles[$i] . '/blank.png';
148
+				$utilityClass::copyFile($file, $dest);
149
+			}
150
+		}
151
+
152
+		//delete .html entries from the tpl table
153
+		$sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . '\' AND `tpl_file` LIKE \'%.html%\'';
154
+		$GLOBALS['xoopsDB']->queryF($sql);
155
+
156
+		/** @var XoopsGroupPermHandler $gpermHandler */
157
+		$gpermHandler = xoops_getHandler('groupperm');
158
+		return $gpermHandler->deleteByModule($module->getVar('mid'), 'item_read');
159
+	}
160
+	return true;
161 161
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 if ((!defined('XOOPS_ROOT_PATH')) || !($GLOBALS['xoopsUser'] instanceof \XoopsUser)
21 21
     || !$GLOBALS['xoopsUser']->IsAdmin()
22 22
 ) {
23
-    exit('Restricted access' . PHP_EOL);
23
+    exit('Restricted access'.PHP_EOL);
24 24
 }
25 25
 
26 26
 /**
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 {
33 33
     $result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'");
34 34
 
35
-    return ($GLOBALS['xoopsDB']->getRowsNum($result) > 0) ? true : false;
35
+    return ($GLOBALS['xoopsDB']->getRowsNum($result)>0) ? true : false;
36 36
 }
37 37
 
38 38
 /**
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     $utility = new Planet\Utility();
77 77
     $configurator = new Planet\Configurator();
78 78
 
79
-    if ($previousVersion < 240) {
79
+    if ($previousVersion<240) {
80 80
 
81 81
         //rename column EXAMPLE
82 82
         $tables     = new Tables();
@@ -87,21 +87,21 @@  discard block
 block discarded – undo
87 87
         if ($tables->useTable($table)) {
88 88
             $tables->alterColumn($table, $column, $attributes, $newName);
89 89
             if (!$tables->executeQueue()) {
90
-                echo '<br>' . _AM_XXXXX_UPGRADEFAILED0 . ' ' . $migrate->getLastError();
90
+                echo '<br>'._AM_XXXXX_UPGRADEFAILED0.' '.$migrate->getLastError();
91 91
             }
92 92
         }
93 93
 
94 94
         //delete old HTML templates
95
-        if (count($configurator->templateFolders) > 0) {
95
+        if (count($configurator->templateFolders)>0) {
96 96
             foreach ($configurator->templateFolders as $folder) {
97
-                $templateFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $folder);
97
+                $templateFolder = $GLOBALS['xoops']->path('modules/'.$moduleDirName.$folder);
98 98
                 if (is_dir($templateFolder)) {
99 99
                     $templateList = array_diff(scandir($templateFolder, SCANDIR_SORT_NONE), ['..', '.']);
100 100
                     foreach ($templateList as $k => $v) {
101
-                        $fileInfo = new \SplFileInfo($templateFolder . $v);
101
+                        $fileInfo = new \SplFileInfo($templateFolder.$v);
102 102
                         if ('html' === $fileInfo->getExtension() && 'index.html' !== $fileInfo->getFilename()) {
103
-                            if (file_exists($templateFolder . $v)) {
104
-                                unlink($templateFolder . $v);
103
+                            if (file_exists($templateFolder.$v)) {
104
+                                unlink($templateFolder.$v);
105 105
                             }
106 106
                         }
107 107
                     }
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
         }
111 111
 
112 112
         //  ---  DELETE OLD FILES ---------------
113
-        if (count($configurator->oldFiles) > 0) {
113
+        if (count($configurator->oldFiles)>0) {
114 114
             //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
115 115
             foreach (array_keys($configurator->oldFiles) as $i) {
116
-                $tempFile = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFiles[$i]);
116
+                $tempFile = $GLOBALS['xoops']->path('modules/'.$moduleDirName.$configurator->oldFiles[$i]);
117 117
                 if (is_file($tempFile)) {
118 118
                     unlink($tempFile);
119 119
                 }
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
 
123 123
         //  ---  DELETE OLD FOLDERS ---------------
124 124
         xoops_load('XoopsFile');
125
-        if (count($configurator->oldFolders) > 0) {
125
+        if (count($configurator->oldFolders)>0) {
126 126
             //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
127 127
             foreach (array_keys($configurator->oldFolders) as $i) {
128
-                $tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]);
128
+                $tempFolder = $GLOBALS['xoops']->path('modules/'.$moduleDirName.$configurator->oldFolders[$i]);
129 129
                 /* @var $folderHandler XoopsObjectHandler */
130 130
                 $folderHandler = XoopsFile::getHandler('folder', $tempFolder);
131 131
                 $folderHandler->delete($tempFolder);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         }
134 134
 
135 135
         //  ---  CREATE FOLDERS ---------------
136
-        if (count($configurator->uploadFolders) > 0) {
136
+        if (count($configurator->uploadFolders)>0) {
137 137
             //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
138 138
             foreach (array_keys($configurator->uploadFolders) as $i) {
139 139
                 $utilityClass::createFolder($configurator->uploadFolders[$i]);
@@ -141,16 +141,16 @@  discard block
 block discarded – undo
141 141
         }
142 142
 
143 143
         //  ---  COPY blank.png FILES ---------------
144
-        if (count($configurator->copyBlankFiles) > 0) {
145
-            $file = __DIR__ . '/../assets/images/blank.png';
144
+        if (count($configurator->copyBlankFiles)>0) {
145
+            $file = __DIR__.'/../assets/images/blank.png';
146 146
             foreach (array_keys($configurator->copyBlankFiles) as $i) {
147
-                $dest = $configurator->copyBlankFiles[$i] . '/blank.png';
147
+                $dest = $configurator->copyBlankFiles[$i].'/blank.png';
148 148
                 $utilityClass::copyFile($file, $dest);
149 149
             }
150 150
         }
151 151
 
152 152
         //delete .html entries from the tpl table
153
-        $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . '\' AND `tpl_file` LIKE \'%.html%\'';
153
+        $sql = 'DELETE FROM '.$GLOBALS['xoopsDB']->prefix('tplfile')." WHERE `tpl_module` = '".$module->getVar('dirname', 'n').'\' AND `tpl_file` LIKE \'%.html%\'';
154 154
         $GLOBALS['xoopsDB']->queryF($sql);
155 155
 
156 156
         /** @var XoopsGroupPermHandler $gpermHandler */
Please login to merge, or discard this patch.