Completed
Push — master ( 7c5656...a50592 )
by Michael
01:55
created
include/functions.ini.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -32,88 +32,88 @@
 block discarded – undo
32 32
 
33 33
 // defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
34 34
 if (!defined('PLANET_INI')) {
35
-    exit();
35
+	exit();
36 36
 }
37 37
 
38 38
 if (!defined('PLANET_FUNCTIONS_INI')):
39
-    define('PLANET_FUNCTIONS_INI', 1);
39
+	define('PLANET_FUNCTIONS_INI', 1);
40 40
 
41
-    /**
42
-     * @param $name
43
-     * @return mixed
44
-     */
45
-    function planet_constant($name)
46
-    {
47
-        return mod_constant($name);
48
-    }
41
+	/**
42
+	 * @param $name
43
+	 * @return mixed
44
+	 */
45
+	function planet_constant($name)
46
+	{
47
+		return mod_constant($name);
48
+	}
49 49
 
50
-    /**
51
-     * @param      $name
52
-     * @param bool $isRel
53
-     * @return string
54
-     */
55
-    function planet_DB_prefix($name, $isRel = false)
56
-    {
57
-        return mod_DB_prefix($name, $isRel);
58
-    }
50
+	/**
51
+	 * @param      $name
52
+	 * @param bool $isRel
53
+	 * @return string
54
+	 */
55
+	function planet_DB_prefix($name, $isRel = false)
56
+	{
57
+		return mod_DB_prefix($name, $isRel);
58
+	}
59 59
 
60
-    /**
61
-     * @return bool
62
-     */
63
-    function planet_load_object()
64
-    {
65
-        return load_object();
66
-    }
60
+	/**
61
+	 * @return bool
62
+	 */
63
+	function planet_load_object()
64
+	{
65
+		return load_object();
66
+	}
67 67
 
68
-    /**
69
-     * @return array|mixed
70
-     */
71
-    function planet_load_config()
72
-    {
73
-        static $moduleConfig;
74
-        if (isset($moduleConfig)) {
75
-            return $moduleConfig;
76
-        }
68
+	/**
69
+	 * @return array|mixed
70
+	 */
71
+	function planet_load_config()
72
+	{
73
+		static $moduleConfig;
74
+		if (isset($moduleConfig)) {
75
+			return $moduleConfig;
76
+		}
77 77
 
78
-        if (is_object($GLOBALS['xoopsModule'])
79
-            && $GLOBALS['xoopsModule']->getVar('dirname') == $GLOBALS['moddirname']) {
80
-            if (isset($GLOBALS['xoopsModuleConfig'])) {
81
-                $moduleConfig = $GLOBALS['xoopsModuleConfig'];
82
-            }
83
-        } else {
84
-            /** @var XoopsModuleHandler $moduleHandler */
85
-            $moduleHandler = xoops_getHandler('module');
86
-            $module        = $moduleHandler->getByDirname($GLOBALS['moddirname']);
78
+		if (is_object($GLOBALS['xoopsModule'])
79
+			&& $GLOBALS['xoopsModule']->getVar('dirname') == $GLOBALS['moddirname']) {
80
+			if (isset($GLOBALS['xoopsModuleConfig'])) {
81
+				$moduleConfig = $GLOBALS['xoopsModuleConfig'];
82
+			}
83
+		} else {
84
+			/** @var XoopsModuleHandler $moduleHandler */
85
+			$moduleHandler = xoops_getHandler('module');
86
+			$module        = $moduleHandler->getByDirname($GLOBALS['moddirname']);
87 87
 
88
-            $configHandler = xoops_getHandler('config');
89
-            $criteria      = new CriteriaCompo(new Criteria('conf_modid', $module->getVar('mid')));
90
-            $configs       = $configHandler->getConfigs($criteria);
91
-            foreach (array_keys($configs) as $i) {
92
-                $moduleConfig[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput();
93
-            }
94
-            unset($configs);
95
-        }
96
-        if ($customConfig = @include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/plugin.php') {
97
-            $moduleConfig = array_merge($moduleConfig, $customConfig);
98
-        }
88
+			$configHandler = xoops_getHandler('config');
89
+			$criteria      = new CriteriaCompo(new Criteria('conf_modid', $module->getVar('mid')));
90
+			$configs       = $configHandler->getConfigs($criteria);
91
+			foreach (array_keys($configs) as $i) {
92
+				$moduleConfig[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput();
93
+			}
94
+			unset($configs);
95
+		}
96
+		if ($customConfig = @include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/plugin.php') {
97
+			$moduleConfig = array_merge($moduleConfig, $customConfig);
98
+		}
99 99
 
100
-        return $moduleConfig;
101
-    }
100
+		return $moduleConfig;
101
+	}
102 102
 
103
-    function planet_define_url_delimiter()
104
-    {
105
-        if (defined('URL_DELIMITER')) {
106
-            if (!in_array(URL_DELIMITER, ['?', '/'])) {
107
-                die('Exit on security');
108
-            }
109
-        } else {
110
-            $moduleConfig = planet_load_config();
111
-            if (empty($moduleConfig['do_urw'])) {
112
-                define('URL_DELIMITER', '?');
113
-            } else {
114
-                define('URL_DELIMITER', '/');
115
-            }
116
-        }
117
-    }
103
+	function planet_define_url_delimiter()
104
+	{
105
+		if (defined('URL_DELIMITER')) {
106
+			if (!in_array(URL_DELIMITER, ['?', '/'])) {
107
+				die('Exit on security');
108
+			}
109
+		} else {
110
+			$moduleConfig = planet_load_config();
111
+			if (empty($moduleConfig['do_urw'])) {
112
+				define('URL_DELIMITER', '?');
113
+			} else {
114
+				define('URL_DELIMITER', '/');
115
+			}
116
+		}
117
+	}
118 118
 
119 119
 endif;
Please login to merge, or discard this patch.
include/functions.php 1 patch
Indentation   +509 added lines, -509 removed lines patch added patch discarded remove patch
@@ -30,521 +30,521 @@
 block discarded – undo
30 30
 
31 31
 $current_path = __FILE__;
32 32
 if (DIRECTORY_SEPARATOR !== '/') {
33
-    $current_path = str_replace(strpos($current_path, '\\\\', 2) ? '\\\\' : DIRECTORY_SEPARATOR, '/', $current_path);
33
+	$current_path = str_replace(strpos($current_path, '\\\\', 2) ? '\\\\' : DIRECTORY_SEPARATOR, '/', $current_path);
34 34
 }
35 35
 $url_arr               = explode('/', strstr($current_path, '/modules/'));
36 36
 $GLOBALS['moddirname'] = $url_arr[2];
37 37
 
38 38
 if (!defined('planet_FUNCTIONS')):
39
-    define('planet_FUNCTIONS', 1);
40
-
41
-    require XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/vars.php';
42
-    require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
43
-    require_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.php';
44
-
45
-    /**
46
-     * Function to display messages
47
-     *
48
-     * @var mixed $messages
49
-     * @return bool
50
-     */
51
-    function planetDisplayMessage($message)
52
-    {
53
-        return mod_message($message);
54
-    }
55
-
56
-    /**
57
-     * Function to parse arguments for a page according to $_SERVER['REQUEST_URI']
58
-     *
59
-     * @var array $args_numeric array of numeric variable values
60
-     * @var array $args         array of indexed variables: name and value
61
-     * @var array $args_string  array of string variable values
62
-     *
63
-     * @return bool true on args parsed
64
-     */
65
-
66
-    /* known issues:
39
+	define('planet_FUNCTIONS', 1);
40
+
41
+	require XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/vars.php';
42
+	require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
43
+	require_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.php';
44
+
45
+	/**
46
+	 * Function to display messages
47
+	 *
48
+	 * @var mixed $messages
49
+	 * @return bool
50
+	 */
51
+	function planetDisplayMessage($message)
52
+	{
53
+		return mod_message($message);
54
+	}
55
+
56
+	/**
57
+	 * Function to parse arguments for a page according to $_SERVER['REQUEST_URI']
58
+	 *
59
+	 * @var array $args_numeric array of numeric variable values
60
+	 * @var array $args         array of indexed variables: name and value
61
+	 * @var array $args_string  array of string variable values
62
+	 *
63
+	 * @return bool true on args parsed
64
+	 */
65
+
66
+	/* known issues:
67 67
      * - "/" in a string
68 68
      * - "&" in a string
69 69
     */
70
-    function planetParseArguments(&$args_numeric, &$args, &$args_string)
71
-    {
72
-        $args_abb     = [
73
-            'a' => 'article',
74
-            'b' => 'blog',
75
-            'c' => 'category',
76
-            'l' => 'list',
77
-            'o' => 'sort',
78
-            's' => 'start',
79
-            'u' => 'uid'
80
-        ];
81
-        $args         = [];
82
-        $args_numeric = [];
83
-        $args_string  = [];
84
-        if (preg_match("/[^\?]*\.php[\/|\?]([^\?]*)/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) {
85
-            $vars = preg_split("/[\/|&]/", $matches[1]);
86
-            $vars = array_map('trim', $vars);
87
-            if (count($vars) > 0) {
88
-                foreach ($vars as $var) {
89
-                    if (is_numeric($var)) {
90
-                        $args_numeric[] = $var;
91
-                    } elseif (false === strpos($var, '=')) {
92
-                        if (is_numeric(substr($var, 1))) {
93
-                            $args[$args_abb[strtolower($var{0})]] = (int)substr($var, 1);
94
-                        } else {
95
-                            $args_string[] = urldecode($var);
96
-                        }
97
-                    } else {
98
-                        parse_str($var, $args);
99
-                    }
100
-                }
101
-            }
102
-        }
103
-
104
-        return (count($args) + count($args_numeric) + count($args_string) == 0) ? null : true;
105
-    }
106
-
107
-    /**
108
-     * Function to parse class prefix
109
-     *
110
-     * @var string $class_string string to be parsed
111
-     * @var mixed  $pattern
112
-     * @var mixed  $replacement
113
-     *
114
-     * @return bool true on success
115
-     */
116
-    function planetParseClass($class_string, $pattern = '', $replacement = '')
117
-    {
118
-        if (empty($class_string)) {
119
-            return;
120
-        }
121
-        $patterns     = ["/\[CLASS_PREFIX\]/"];
122
-        $replacements = [ucfirst(strtolower($GLOBALS['moddirname']))];
123
-        if (!empty($pattern) && !is_array($pattern) && !is_array($replacement)) {
124
-            $pattern     = [$pattern];
125
-            $replacement = [$replacement];
126
-        }
127
-        if (is_array($pattern) && count($pattern) > 0) {
128
-            $ii = 0;
129
-            foreach ($pattern as $pat) {
130
-                if (!in_array($pat, $patterns)) {
131
-                    $patterns[]     = $pat;
132
-                    $replacements[] = isset($replacement[$ii]) ? $replacement[$ii] : '';
133
-                }
134
-                ++$ii;
135
-            }
136
-        }
137
-        $class_string = preg_replace($patterns, $replacements, $class_string);
138
-        eval($class_string);
139
-
140
-        return true;
141
-    }
142
-
143
-    /**
144
-     * Function to parse function prefix
145
-     *
146
-     * @var string $function_string string to be parsed
147
-     * @var mixed  $pattern
148
-     * @var mixed  $replacement
149
-     *
150
-     * @return bool true on success
151
-     */
152
-    function planetParseFunction($function_string, $pattern = '', $replacement = '')
153
-    {
154
-        if (empty($function_string)) {
155
-            return;
156
-        }
157
-        $patterns     = ["/\[DIRNAME\]/", "/\[VAR_PREFIX\]/"];
158
-        $replacements = [$GLOBALS['moddirname'], $GLOBALS['VAR_PREFIX']];
159
-        if (!empty($pattern) && !is_array($pattern) && !is_array($replacement)) {
160
-            $pattern     = [$pattern];
161
-            $replacement = [$replacement];
162
-        }
163
-        if (is_array($pattern) && count($pattern) > 0) {
164
-            $ii = 0;
165
-            foreach ($pattern as $pat) {
166
-                if (!in_array($pat, $patterns)) {
167
-                    $patterns[]     = $pat;
168
-                    $replacements[] = isset($replacement[$ii]) ? $replacement[$ii] : '';
169
-                }
170
-                ++$ii;
171
-            }
172
-        }
173
-        $function_string = preg_replace($patterns, $replacements, $function_string);
174
-        eval($function_string);
175
-
176
-        return true;
177
-    }
178
-
179
-    /**
180
-     * Function to convert UNIX time to formatted time string
181
-     * @param        $time
182
-     * @param string $format
183
-     * @return string
184
-     */
185
-    function planet_formatTimestamp($time, $format = '')
186
-    {
187
-        if (empty($time)) {
188
-            return '';
189
-        }
190
-
191
-        return formatTimestamp($time, $format);
192
-    }
193
-
194
-    /**
195
-     * Function to a list of user names associated with their user IDs
196
-     * @param int  $userid
197
-     * @param int  $usereal
198
-     * @param bool $linked
199
-     * @return array
200
-     */
201
-    function &planetGetUnameFromId($userid, $usereal = 0, $linked = false)
202
-    {
203
-        if (!is_array($userid)) {
204
-            $userid = [$userid];
205
-        }
206
-        $users =& mod_getUnameFromIds($userid, $usereal, $linked);
207
-
208
-        return $users;
209
-    }
210
-
211
-    /**
212
-     * Function to parse links, links are delimited by link break, URL and title of a link are delimited by space
213
-     *
214
-     * @var string $text raw content
215
-     *
216
-     * @return array associative array of link url and title
217
-     */
218
-    function &planetParseLinks($text)
219
-    {
220
-        $myts       = MyTextSanitizer::getInstance();
221
-        $link_array = preg_split("/(\r\n|\r|\n)( *)/", $text);
222
-        $links      = [];
223
-        if (count($link_array) > 0) {
224
-            foreach ($link_array as $link) {
225
-                @list($url, $title) = array_map('trim', preg_split('/ /', $link, 2));
226
-                if (empty($url)) {
227
-                    continue;
228
-                }
229
-                //if(empty($title)) $title = $url;
230
-                $links[] = ['url' => $url, 'title' => $myts->htmlSpecialChars($title)];
231
-            }
232
-        }
233
-
234
-        return $links;
235
-    }
236
-
237
-    /**
238
-     * @param $pagename
239
-     * @return string
240
-     */
241
-    function planetGetTemplate($pagename)
242
-    {
243
-        return $GLOBALS['VAR_PREFIX'] . '_' . $pagename . '.tpl';
244
-    }
245
-
246
-    /**
247
-     * @param int $currentoption
248
-     */
249
-    function planet_adminmenu($currentoption = -1)
250
-    {
251
-        loadModuleAdminMenu($currentoption, '');
252
-
253
-        return;
254
-    }
255
-
256
-    /**
257
-     * Function to send a trackback
258
-     *
259
-     * @param $article
260
-     * @param $comment
261
-     * @return bool
262
-     */
263
-    function planet_com_trackback(&$article, &$comment)
264
-    {
265
-        $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']);
266
-        $blog_obj    = $blogHandler->get($article->getVar('blog_id'));
267
-        if (!$pattern = $blog_obj->getVar('blog_trackback')) {
268
-            return false;
269
-        }
270
-        @list($pat, $rep) = array_map('trim', preg_split("#[\s]+#", $pattern));
271
-        $trackback_url = preg_replace('#' . $pat . '#', $rep, $article_obj->getVar('art_link'));
272
-
273
-        return planetTrackback($trackback_url, $article);
274
-    }
275
-
276
-    /**
277
-     * @param $trackback_url
278
-     * @param $article
279
-     * @return bool
280
-     */
281
-    function planetTrackback($trackback_url, $article)
282
-    {
283
-        global $myts, $xoopsConfig, $xoopsModule, $xoopsModuleConfig;
284
-
285
-        $title         = $article->getVar('art_title');
286
-        $excerpt       = $article->getVar('art_content');
287
-        $blog_name     = $xoopsConfig['sitename'] . '-' . $xoopsModule->getVar('name');
288
-        $title         = xoops_utf8_encode($title);
289
-        $excerpt       = xoops_utf8_encode($excerpt);
290
-        $blog_name     = xoops_utf8_encode($blog_name);
291
-        $charset       = 'utf-8';
292
-        $title1        = urlencode($title);
293
-        $excerpt1      = urlencode($excerpt);
294
-        $name1         = urlencode($blog_name);
295
-        $url           = urlencode(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article->getVar('art_id'));
296
-        $query_string  = "title=$title1&url=$url&blog_name=$name1&excerpt=$excerpt1&charset=$charset";
297
-        $trackback_url = parse_url($trackback_url);
298
-
299
-        $http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?' . $trackback_url['query'] : '') . " HTTP/1.0\r\n";
300
-        $http_request .= 'Host: ' . $trackback_url['host'] . "\r\n";
301
-        $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . $charset . "\r\n";
302
-        $http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n";
303
-        $http_request .= 'User-Agent: XOOPS Blogs/' . XOOPS_VERSION;
304
-        $http_request .= "\r\n\r\n";
305
-        $http_request .= $query_string;
306
-        if ('' == $trackback_url['port']) {
307
-            $trackback_url['port'] = 80;
308
-        }
309
-        $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4);
310
-        @fwrite($fs, $http_request);
311
-        if ($xoopsModuleConfig['do_debug']) {
312
-            $debug_file = XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '_trackback.log';
313
-            $fr         = "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n";
314
-            $fr         .= "CHARSET:$charset\n";
315
-            $fr         .= "NAME:$blog_name\n";
316
-            $fr         .= 'TITLE:' . $title . "\n";
317
-            $fr         .= "EXCERPT:$excerpt\n\n";
318
-            while (!@feof($fs)) {
319
-                $fr .= @fgets($fs, 4096);
320
-            }
321
-            $fr .= "\n\n";
322
-
323
-            if ($fp = fopen($debug_file, 'a')) {
324
-                fwrite($fp, $fr);
325
-                fclose($fp);
326
-            } else {
327
-            }
328
-        }
329
-        @fclose($fs);
330
-
331
-        return true;
332
-    }
333
-
334
-    /**
335
-     * Function to ping servers
336
-     * @param $server
337
-     * @param $id
338
-     */
339
-    function planetGetPing($server, $id)
340
-    {
341
-        if (is_array($server)) {
342
-            foreach ($server as $serv) {
343
-                planetGetPing($serv, $id);
344
-            }
345
-        }
346
-        require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/class-IXR.php';
347
-
348
-        // using a timeout of 3 seconds should be enough to cover slow servers
349
-        $client            = new IXR_Client($server, false);
350
-        $client->timeout   = 3;
351
-        $client->useragent .= ' -- XOOPS Article/' . XOOPS_VERSION;
352
-
353
-        // when set to true, this outputs debug messages by itself
354
-        $client->debug = false;
355
-
356
-        $blogname = xoops_utf8_encode($GLOBALS['xoopsModule']->getVar('name'));
357
-        $home     = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/';
358
-        $rss2_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php' . URL_DELIMITER . 'rss2.0/' . $id;
359
-
360
-        if (!$client->query('weblogUpdates.extendedPing', $blogname, $home, $rss2_url)) { // then try a normal ping
361
-            $client->query('weblogUpdates.ping', $blogname, $home);
362
-        }
363
-    }
364
-
365
-    /**
366
-     * Function to respond to a trackback
367
-     * @param int    $error
368
-     * @param string $error_message
369
-     */
370
-    function planetRespondToTrackback($error = 0, $error_message = '')
371
-    {
372
-        $charset       = 'utf-8';
373
-        $error_message = xoops_utf8_encode($error_message);
374
-        header('Content-Type: text/xml; charset="' . $charset . '"');
375
-        if ($error) {
376
-            echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n";
377
-            echo "<response>\n";
378
-            echo "<error>1</error>\n";
379
-            echo "<message>$error_message</message>\n";
380
-            echo '</response>';
381
-            die();
382
-        } else {
383
-            echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n";
384
-            echo "<response>\n";
385
-            echo "<error>0</error>\n";
386
-            echo '</response>';
387
-        }
388
-    }
389
-
390
-    /**
391
-     * Function to set a cookie with module-specified name
392
-     *
393
-     * using customized serialization method
394
-     * @param        $name
395
-     * @param string $string
396
-     * @param int    $expire
397
-     */
398
-    function planetSetCookie($name, $string = '', $expire = 0)
399
-    {
400
-        if (is_array($string)) {
401
-            $value = [];
402
-            foreach ($string as $key => $val) {
403
-                $value[] = $key . '|' . $val;
404
-            }
405
-            $string = implode(',', $value);
406
-        }
407
-        setcookie($GLOBALS['VAR_PREFIX'] . $name, $string, (int)$expire, '/');
408
-    }
409
-
410
-    /**
411
-     * @param      $name
412
-     * @param bool $isArray
413
-     * @return array|null
414
-     */
415
-    function planetGetCookie($name, $isArray = false)
416
-    {
417
-        $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'] . $name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'] . $name] : null;
418
-        if ($isArray) {
419
-            $_value = $value ? explode(',', $value) : [];
420
-            $value  = [];
421
-            if (count($_value) > 0) {
422
-                foreach ($_value as $string) {
423
-                    $key         = substr($string, 0, strpos($string, '|'));
424
-                    $val         = substr($string, strpos($string, '|') + 1);
425
-                    $value[$key] = $val;
426
-                }
427
-            }
428
-            unset($_value);
429
-        }
430
-
431
-        return $value;
432
-    }
433
-
434
-    /**
435
-     * Function to filter text
436
-     *
437
-     * @param $document
438
-     * @return string filtered text
439
-     */
440
-    function &planetHtml2text(&$document)
441
-    {
442
-        $document = strip_tags($document);
443
-
444
-        return $document;
445
-    }
446
-
447
-    // Adapted from PMA_getIp() [phpmyadmin project]
448
-    /**
449
-     * @param bool $asString
450
-     * @return mixed
451
-     */
452
-    function planetGetIP($asString = false)
453
-    {
454
-        return mod_getIP($asString);
455
-    }
456
-
457
-    /**
458
-     * @param $url
459
-     * @return bool|mixed|string
460
-     */
461
-    function planetGetRemoteContent($url)
462
-    {
463
-        if ($data = planet_fetch_snoopy($url)) {
464
-            return $data;
465
-        }
466
-        if ($data = planet_fetch_CURL($url)) {
467
-            return $data;
468
-        }
469
-        if ($data = planet_fetch_fopen($url)) {
470
-            return $data;
471
-        }
472
-
473
-        return false;
474
-    }
475
-
476
-    /**
477
-     * @param $url
478
-     * @return string
479
-     */
480
-    function planet_fetch_snoopy($url)
481
-    {
482
-        require_once XOOPS_ROOT_PATH . '/class/snoopy.php';
483
-        $snoopy = new Snoopy;
484
-        $data   = '';
485
-        if (@$snoopy->fetch($url)) {
486
-            $data = is_array($snoopy->results) ? implode("\n", $snoopy->results) : $snoopy->results;
487
-        }
488
-
489
-        return $data;
490
-    }
491
-
492
-    /**
493
-     * @param $url
494
-     * @return bool|mixed
495
-     */
496
-    function planet_fetch_CURL($url)
497
-    {
498
-        if (!function_exists('curl_init')) {
499
-            return false;
500
-        }
501
-        $ch = curl_init();    // initialize curl handle
502
-        curl_setopt($ch, CURLOPT_URL, $url); // set url to post to
503
-        curl_setopt($ch, CURLOPT_FAILONERROR, 1);
504
-        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
505
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable
506
-        curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 31s
507
-        $data = curl_exec($ch); // run the whole process
508
-        curl_close($ch);
509
-
510
-        return $data;
511
-    }
512
-
513
-    /**
514
-     * @param $url
515
-     * @return bool|string
516
-     */
517
-    function planet_fetch_fopen($url)
518
-    {
519
-        if (!$fp = @fopen($url, 'r')) {
520
-            return false;
521
-        }
522
-        $data = '';
523
-        while (!feof($fp)) {
524
-            $data .= fgets($fp, 1024);
525
-        }
526
-        fclose($fp);
527
-
528
-        return $data;
529
-    }
530
-
531
-    /**
532
-     * @param     $haystack
533
-     * @param     $needle
534
-     * @param int $offset
535
-     * @return bool|int
536
-     */
537
-    function planetStrrPos($haystack, $needle, $offset = 0)
538
-    {
539
-        if (substr(PHP_VERSION, 0, 1) == 5) {
540
-            return strrpos($haystack, $needle, $offset);
541
-        }
542
-        $index = strpos(strrev($haystack), strrev($needle));
543
-        if ($index === false) {
544
-            return false;
545
-        }
546
-        $index = strlen($haystack) - strlen($needle) - $index;
547
-
548
-        return $index;
549
-    }
70
+	function planetParseArguments(&$args_numeric, &$args, &$args_string)
71
+	{
72
+		$args_abb     = [
73
+			'a' => 'article',
74
+			'b' => 'blog',
75
+			'c' => 'category',
76
+			'l' => 'list',
77
+			'o' => 'sort',
78
+			's' => 'start',
79
+			'u' => 'uid'
80
+		];
81
+		$args         = [];
82
+		$args_numeric = [];
83
+		$args_string  = [];
84
+		if (preg_match("/[^\?]*\.php[\/|\?]([^\?]*)/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) {
85
+			$vars = preg_split("/[\/|&]/", $matches[1]);
86
+			$vars = array_map('trim', $vars);
87
+			if (count($vars) > 0) {
88
+				foreach ($vars as $var) {
89
+					if (is_numeric($var)) {
90
+						$args_numeric[] = $var;
91
+					} elseif (false === strpos($var, '=')) {
92
+						if (is_numeric(substr($var, 1))) {
93
+							$args[$args_abb[strtolower($var{0})]] = (int)substr($var, 1);
94
+						} else {
95
+							$args_string[] = urldecode($var);
96
+						}
97
+					} else {
98
+						parse_str($var, $args);
99
+					}
100
+				}
101
+			}
102
+		}
103
+
104
+		return (count($args) + count($args_numeric) + count($args_string) == 0) ? null : true;
105
+	}
106
+
107
+	/**
108
+	 * Function to parse class prefix
109
+	 *
110
+	 * @var string $class_string string to be parsed
111
+	 * @var mixed  $pattern
112
+	 * @var mixed  $replacement
113
+	 *
114
+	 * @return bool true on success
115
+	 */
116
+	function planetParseClass($class_string, $pattern = '', $replacement = '')
117
+	{
118
+		if (empty($class_string)) {
119
+			return;
120
+		}
121
+		$patterns     = ["/\[CLASS_PREFIX\]/"];
122
+		$replacements = [ucfirst(strtolower($GLOBALS['moddirname']))];
123
+		if (!empty($pattern) && !is_array($pattern) && !is_array($replacement)) {
124
+			$pattern     = [$pattern];
125
+			$replacement = [$replacement];
126
+		}
127
+		if (is_array($pattern) && count($pattern) > 0) {
128
+			$ii = 0;
129
+			foreach ($pattern as $pat) {
130
+				if (!in_array($pat, $patterns)) {
131
+					$patterns[]     = $pat;
132
+					$replacements[] = isset($replacement[$ii]) ? $replacement[$ii] : '';
133
+				}
134
+				++$ii;
135
+			}
136
+		}
137
+		$class_string = preg_replace($patterns, $replacements, $class_string);
138
+		eval($class_string);
139
+
140
+		return true;
141
+	}
142
+
143
+	/**
144
+	 * Function to parse function prefix
145
+	 *
146
+	 * @var string $function_string string to be parsed
147
+	 * @var mixed  $pattern
148
+	 * @var mixed  $replacement
149
+	 *
150
+	 * @return bool true on success
151
+	 */
152
+	function planetParseFunction($function_string, $pattern = '', $replacement = '')
153
+	{
154
+		if (empty($function_string)) {
155
+			return;
156
+		}
157
+		$patterns     = ["/\[DIRNAME\]/", "/\[VAR_PREFIX\]/"];
158
+		$replacements = [$GLOBALS['moddirname'], $GLOBALS['VAR_PREFIX']];
159
+		if (!empty($pattern) && !is_array($pattern) && !is_array($replacement)) {
160
+			$pattern     = [$pattern];
161
+			$replacement = [$replacement];
162
+		}
163
+		if (is_array($pattern) && count($pattern) > 0) {
164
+			$ii = 0;
165
+			foreach ($pattern as $pat) {
166
+				if (!in_array($pat, $patterns)) {
167
+					$patterns[]     = $pat;
168
+					$replacements[] = isset($replacement[$ii]) ? $replacement[$ii] : '';
169
+				}
170
+				++$ii;
171
+			}
172
+		}
173
+		$function_string = preg_replace($patterns, $replacements, $function_string);
174
+		eval($function_string);
175
+
176
+		return true;
177
+	}
178
+
179
+	/**
180
+	 * Function to convert UNIX time to formatted time string
181
+	 * @param        $time
182
+	 * @param string $format
183
+	 * @return string
184
+	 */
185
+	function planet_formatTimestamp($time, $format = '')
186
+	{
187
+		if (empty($time)) {
188
+			return '';
189
+		}
190
+
191
+		return formatTimestamp($time, $format);
192
+	}
193
+
194
+	/**
195
+	 * Function to a list of user names associated with their user IDs
196
+	 * @param int  $userid
197
+	 * @param int  $usereal
198
+	 * @param bool $linked
199
+	 * @return array
200
+	 */
201
+	function &planetGetUnameFromId($userid, $usereal = 0, $linked = false)
202
+	{
203
+		if (!is_array($userid)) {
204
+			$userid = [$userid];
205
+		}
206
+		$users =& mod_getUnameFromIds($userid, $usereal, $linked);
207
+
208
+		return $users;
209
+	}
210
+
211
+	/**
212
+	 * Function to parse links, links are delimited by link break, URL and title of a link are delimited by space
213
+	 *
214
+	 * @var string $text raw content
215
+	 *
216
+	 * @return array associative array of link url and title
217
+	 */
218
+	function &planetParseLinks($text)
219
+	{
220
+		$myts       = MyTextSanitizer::getInstance();
221
+		$link_array = preg_split("/(\r\n|\r|\n)( *)/", $text);
222
+		$links      = [];
223
+		if (count($link_array) > 0) {
224
+			foreach ($link_array as $link) {
225
+				@list($url, $title) = array_map('trim', preg_split('/ /', $link, 2));
226
+				if (empty($url)) {
227
+					continue;
228
+				}
229
+				//if(empty($title)) $title = $url;
230
+				$links[] = ['url' => $url, 'title' => $myts->htmlSpecialChars($title)];
231
+			}
232
+		}
233
+
234
+		return $links;
235
+	}
236
+
237
+	/**
238
+	 * @param $pagename
239
+	 * @return string
240
+	 */
241
+	function planetGetTemplate($pagename)
242
+	{
243
+		return $GLOBALS['VAR_PREFIX'] . '_' . $pagename . '.tpl';
244
+	}
245
+
246
+	/**
247
+	 * @param int $currentoption
248
+	 */
249
+	function planet_adminmenu($currentoption = -1)
250
+	{
251
+		loadModuleAdminMenu($currentoption, '');
252
+
253
+		return;
254
+	}
255
+
256
+	/**
257
+	 * Function to send a trackback
258
+	 *
259
+	 * @param $article
260
+	 * @param $comment
261
+	 * @return bool
262
+	 */
263
+	function planet_com_trackback(&$article, &$comment)
264
+	{
265
+		$blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']);
266
+		$blog_obj    = $blogHandler->get($article->getVar('blog_id'));
267
+		if (!$pattern = $blog_obj->getVar('blog_trackback')) {
268
+			return false;
269
+		}
270
+		@list($pat, $rep) = array_map('trim', preg_split("#[\s]+#", $pattern));
271
+		$trackback_url = preg_replace('#' . $pat . '#', $rep, $article_obj->getVar('art_link'));
272
+
273
+		return planetTrackback($trackback_url, $article);
274
+	}
275
+
276
+	/**
277
+	 * @param $trackback_url
278
+	 * @param $article
279
+	 * @return bool
280
+	 */
281
+	function planetTrackback($trackback_url, $article)
282
+	{
283
+		global $myts, $xoopsConfig, $xoopsModule, $xoopsModuleConfig;
284
+
285
+		$title         = $article->getVar('art_title');
286
+		$excerpt       = $article->getVar('art_content');
287
+		$blog_name     = $xoopsConfig['sitename'] . '-' . $xoopsModule->getVar('name');
288
+		$title         = xoops_utf8_encode($title);
289
+		$excerpt       = xoops_utf8_encode($excerpt);
290
+		$blog_name     = xoops_utf8_encode($blog_name);
291
+		$charset       = 'utf-8';
292
+		$title1        = urlencode($title);
293
+		$excerpt1      = urlencode($excerpt);
294
+		$name1         = urlencode($blog_name);
295
+		$url           = urlencode(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article->getVar('art_id'));
296
+		$query_string  = "title=$title1&url=$url&blog_name=$name1&excerpt=$excerpt1&charset=$charset";
297
+		$trackback_url = parse_url($trackback_url);
298
+
299
+		$http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?' . $trackback_url['query'] : '') . " HTTP/1.0\r\n";
300
+		$http_request .= 'Host: ' . $trackback_url['host'] . "\r\n";
301
+		$http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . $charset . "\r\n";
302
+		$http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n";
303
+		$http_request .= 'User-Agent: XOOPS Blogs/' . XOOPS_VERSION;
304
+		$http_request .= "\r\n\r\n";
305
+		$http_request .= $query_string;
306
+		if ('' == $trackback_url['port']) {
307
+			$trackback_url['port'] = 80;
308
+		}
309
+		$fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4);
310
+		@fwrite($fs, $http_request);
311
+		if ($xoopsModuleConfig['do_debug']) {
312
+			$debug_file = XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '_trackback.log';
313
+			$fr         = "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n";
314
+			$fr         .= "CHARSET:$charset\n";
315
+			$fr         .= "NAME:$blog_name\n";
316
+			$fr         .= 'TITLE:' . $title . "\n";
317
+			$fr         .= "EXCERPT:$excerpt\n\n";
318
+			while (!@feof($fs)) {
319
+				$fr .= @fgets($fs, 4096);
320
+			}
321
+			$fr .= "\n\n";
322
+
323
+			if ($fp = fopen($debug_file, 'a')) {
324
+				fwrite($fp, $fr);
325
+				fclose($fp);
326
+			} else {
327
+			}
328
+		}
329
+		@fclose($fs);
330
+
331
+		return true;
332
+	}
333
+
334
+	/**
335
+	 * Function to ping servers
336
+	 * @param $server
337
+	 * @param $id
338
+	 */
339
+	function planetGetPing($server, $id)
340
+	{
341
+		if (is_array($server)) {
342
+			foreach ($server as $serv) {
343
+				planetGetPing($serv, $id);
344
+			}
345
+		}
346
+		require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/class-IXR.php';
347
+
348
+		// using a timeout of 3 seconds should be enough to cover slow servers
349
+		$client            = new IXR_Client($server, false);
350
+		$client->timeout   = 3;
351
+		$client->useragent .= ' -- XOOPS Article/' . XOOPS_VERSION;
352
+
353
+		// when set to true, this outputs debug messages by itself
354
+		$client->debug = false;
355
+
356
+		$blogname = xoops_utf8_encode($GLOBALS['xoopsModule']->getVar('name'));
357
+		$home     = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/';
358
+		$rss2_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php' . URL_DELIMITER . 'rss2.0/' . $id;
359
+
360
+		if (!$client->query('weblogUpdates.extendedPing', $blogname, $home, $rss2_url)) { // then try a normal ping
361
+			$client->query('weblogUpdates.ping', $blogname, $home);
362
+		}
363
+	}
364
+
365
+	/**
366
+	 * Function to respond to a trackback
367
+	 * @param int    $error
368
+	 * @param string $error_message
369
+	 */
370
+	function planetRespondToTrackback($error = 0, $error_message = '')
371
+	{
372
+		$charset       = 'utf-8';
373
+		$error_message = xoops_utf8_encode($error_message);
374
+		header('Content-Type: text/xml; charset="' . $charset . '"');
375
+		if ($error) {
376
+			echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n";
377
+			echo "<response>\n";
378
+			echo "<error>1</error>\n";
379
+			echo "<message>$error_message</message>\n";
380
+			echo '</response>';
381
+			die();
382
+		} else {
383
+			echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n";
384
+			echo "<response>\n";
385
+			echo "<error>0</error>\n";
386
+			echo '</response>';
387
+		}
388
+	}
389
+
390
+	/**
391
+	 * Function to set a cookie with module-specified name
392
+	 *
393
+	 * using customized serialization method
394
+	 * @param        $name
395
+	 * @param string $string
396
+	 * @param int    $expire
397
+	 */
398
+	function planetSetCookie($name, $string = '', $expire = 0)
399
+	{
400
+		if (is_array($string)) {
401
+			$value = [];
402
+			foreach ($string as $key => $val) {
403
+				$value[] = $key . '|' . $val;
404
+			}
405
+			$string = implode(',', $value);
406
+		}
407
+		setcookie($GLOBALS['VAR_PREFIX'] . $name, $string, (int)$expire, '/');
408
+	}
409
+
410
+	/**
411
+	 * @param      $name
412
+	 * @param bool $isArray
413
+	 * @return array|null
414
+	 */
415
+	function planetGetCookie($name, $isArray = false)
416
+	{
417
+		$value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'] . $name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'] . $name] : null;
418
+		if ($isArray) {
419
+			$_value = $value ? explode(',', $value) : [];
420
+			$value  = [];
421
+			if (count($_value) > 0) {
422
+				foreach ($_value as $string) {
423
+					$key         = substr($string, 0, strpos($string, '|'));
424
+					$val         = substr($string, strpos($string, '|') + 1);
425
+					$value[$key] = $val;
426
+				}
427
+			}
428
+			unset($_value);
429
+		}
430
+
431
+		return $value;
432
+	}
433
+
434
+	/**
435
+	 * Function to filter text
436
+	 *
437
+	 * @param $document
438
+	 * @return string filtered text
439
+	 */
440
+	function &planetHtml2text(&$document)
441
+	{
442
+		$document = strip_tags($document);
443
+
444
+		return $document;
445
+	}
446
+
447
+	// Adapted from PMA_getIp() [phpmyadmin project]
448
+	/**
449
+	 * @param bool $asString
450
+	 * @return mixed
451
+	 */
452
+	function planetGetIP($asString = false)
453
+	{
454
+		return mod_getIP($asString);
455
+	}
456
+
457
+	/**
458
+	 * @param $url
459
+	 * @return bool|mixed|string
460
+	 */
461
+	function planetGetRemoteContent($url)
462
+	{
463
+		if ($data = planet_fetch_snoopy($url)) {
464
+			return $data;
465
+		}
466
+		if ($data = planet_fetch_CURL($url)) {
467
+			return $data;
468
+		}
469
+		if ($data = planet_fetch_fopen($url)) {
470
+			return $data;
471
+		}
472
+
473
+		return false;
474
+	}
475
+
476
+	/**
477
+	 * @param $url
478
+	 * @return string
479
+	 */
480
+	function planet_fetch_snoopy($url)
481
+	{
482
+		require_once XOOPS_ROOT_PATH . '/class/snoopy.php';
483
+		$snoopy = new Snoopy;
484
+		$data   = '';
485
+		if (@$snoopy->fetch($url)) {
486
+			$data = is_array($snoopy->results) ? implode("\n", $snoopy->results) : $snoopy->results;
487
+		}
488
+
489
+		return $data;
490
+	}
491
+
492
+	/**
493
+	 * @param $url
494
+	 * @return bool|mixed
495
+	 */
496
+	function planet_fetch_CURL($url)
497
+	{
498
+		if (!function_exists('curl_init')) {
499
+			return false;
500
+		}
501
+		$ch = curl_init();    // initialize curl handle
502
+		curl_setopt($ch, CURLOPT_URL, $url); // set url to post to
503
+		curl_setopt($ch, CURLOPT_FAILONERROR, 1);
504
+		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
505
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable
506
+		curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 31s
507
+		$data = curl_exec($ch); // run the whole process
508
+		curl_close($ch);
509
+
510
+		return $data;
511
+	}
512
+
513
+	/**
514
+	 * @param $url
515
+	 * @return bool|string
516
+	 */
517
+	function planet_fetch_fopen($url)
518
+	{
519
+		if (!$fp = @fopen($url, 'r')) {
520
+			return false;
521
+		}
522
+		$data = '';
523
+		while (!feof($fp)) {
524
+			$data .= fgets($fp, 1024);
525
+		}
526
+		fclose($fp);
527
+
528
+		return $data;
529
+	}
530
+
531
+	/**
532
+	 * @param     $haystack
533
+	 * @param     $needle
534
+	 * @param int $offset
535
+	 * @return bool|int
536
+	 */
537
+	function planetStrrPos($haystack, $needle, $offset = 0)
538
+	{
539
+		if (substr(PHP_VERSION, 0, 1) == 5) {
540
+			return strrpos($haystack, $needle, $offset);
541
+		}
542
+		$index = strpos(strrev($haystack), strrev($needle));
543
+		if ($index === false) {
544
+			return false;
545
+		}
546
+		$index = strlen($haystack) - strlen($needle) - $index;
547
+
548
+		return $index;
549
+	}
550 550
 endif;
Please login to merge, or discard this patch.
include/form.blog.php 1 patch
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.
include/plugin.transfer.php 1 patch
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') || exit('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.
index.php 1 patch
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 include __DIR__ . '/header.php';
28 28
 
29 29
 if (preg_match("/\/notification_update\.php/i", $_SERVER['REQUEST_URI'], $matches)) {
30
-    include XOOPS_ROOT_PATH . '/include/notification_update.php';
31
-    exit();
30
+	include XOOPS_ROOT_PATH . '/include/notification_update.php';
31
+	exit();
32 32
 }
33 33
 
34 34
 if ($REQUEST_URI_parsed = PlanetUtility::planetParseArguments($args_num, $args, $args_str)) {
35
-    $args['start'] = @$args_num[0];
36
-    $args['sort']  = @$args_str[0];
35
+	$args['start'] = @$args_num[0];
36
+	$args['sort']  = @$args_str[0];
37 37
 }
38 38
 
39 39
 /* Start */
@@ -51,20 +51,20 @@  discard block
 block discarded – undo
51 51
 
52 52
 // restore $_SERVER['REQUEST_URI']
53 53
 if (!empty($REQUEST_URI_parsed)) {
54
-    $args_REQUEST_URI = [];
55
-    $_args            = ['start', 'sort', 'uid', 'list'];
56
-    foreach ($_args as $arg) {
57
-        if (!empty(${$arg})) {
58
-            $args_REQUEST_URI[] = $arg . '=' . ${$arg};
59
-        }
60
-    }
61
-    if (!empty($blog_id)) {
62
-        $args_REQUEST_URI[] = 'blog=' . $blog_id;
63
-    }
64
-    if (!empty($category_id)) {
65
-        $args_REQUEST_URI[] = 'category=' . $category_id;
66
-    }
67
-    $_SERVER['REQUEST_URI'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . (empty($args_REQUEST_URI) ? '' : '?' . implode('&', $args_REQUEST_URI));
54
+	$args_REQUEST_URI = [];
55
+	$_args            = ['start', 'sort', 'uid', 'list'];
56
+	foreach ($_args as $arg) {
57
+		if (!empty(${$arg})) {
58
+			$args_REQUEST_URI[] = $arg . '=' . ${$arg};
59
+		}
60
+	}
61
+	if (!empty($blog_id)) {
62
+		$args_REQUEST_URI[] = 'blog=' . $blog_id;
63
+	}
64
+	if (!empty($category_id)) {
65
+		$args_REQUEST_URI[] = 'category=' . $category_id;
66
+	}
67
+	$_SERVER['REQUEST_URI'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . (empty($args_REQUEST_URI) ? '' : '?' . implode('&', $args_REQUEST_URI));
68 68
 }
69 69
 
70 70
 $GLOBALS['xoopsOption']['template_main'] = PlanetUtility::planetGetTemplate('index');
@@ -89,73 +89,73 @@  discard block
 block discarded – undo
89 89
 $article_prefix = '';
90 90
 /* Specific category */
91 91
 if ($category_id > 0) {
92
-    $category_obj = $categoryHandler->get($category_id);
93
-    $criteria->add(new Criteria('bc.cat_id', $category_id));
94
-    $uid            = 0;
95
-    $blog_id        = 0;
96
-    $category_data  = ['id' => $category_id, 'title' => $category_obj->getVar('cat_title')];
97
-    $query_type     = 'category';
98
-    $article_prefix = 'a.';
92
+	$category_obj = $categoryHandler->get($category_id);
93
+	$criteria->add(new Criteria('bc.cat_id', $category_id));
94
+	$uid            = 0;
95
+	$blog_id        = 0;
96
+	$category_data  = ['id' => $category_id, 'title' => $category_obj->getVar('cat_title')];
97
+	$query_type     = 'category';
98
+	$article_prefix = 'a.';
99 99
 }
100 100
 /* Specific blog */
101 101
 if ($blog_id > 0) {
102
-    $blog_obj = $blogHandler->get($blog_id);
103
-    if ($blog_obj->getVar('blog_status')
104
-        || (is_object($xoopsUser)
105
-            && $xoopsUser->getVar('uid') == $blog_obj->getVar('blog_submitter'))) {
106
-        $criteria->add(new Criteria('blog_id', $blog_id));
107
-        $category_id     = 0;
108
-        $uid             = 0;
109
-        $bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']);
110
-        $blog_data       = [
111
-            'id'    => $blog_id,
112
-            'title' => $blog_obj->getVar('blog_title'),
113
-            'image' => $blog_obj->getImage(),
114
-            'title' => $blog_obj->getVar('blog_title'),
115
-            'feed'  => $blog_obj->getVar('blog_feed'),
116
-            'link'  => $blog_obj->getVar('blog_link'),
117
-            'desc'  => $blog_obj->getVar('blog_desc'),
118
-            'time'  => $blog_obj->getTime(),
119
-            'star'  => $blog_obj->getStar(),
120
-            'rates' => $blog_obj->getVar('blog_rates'),
121
-            'marks' => $blog_obj->getVar('blog_marks')
122
-        ];
123
-    }
124
-    $query_type     = 'blog';
125
-    $article_prefix = '';
102
+	$blog_obj = $blogHandler->get($blog_id);
103
+	if ($blog_obj->getVar('blog_status')
104
+		|| (is_object($xoopsUser)
105
+			&& $xoopsUser->getVar('uid') == $blog_obj->getVar('blog_submitter'))) {
106
+		$criteria->add(new Criteria('blog_id', $blog_id));
107
+		$category_id     = 0;
108
+		$uid             = 0;
109
+		$bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']);
110
+		$blog_data       = [
111
+			'id'    => $blog_id,
112
+			'title' => $blog_obj->getVar('blog_title'),
113
+			'image' => $blog_obj->getImage(),
114
+			'title' => $blog_obj->getVar('blog_title'),
115
+			'feed'  => $blog_obj->getVar('blog_feed'),
116
+			'link'  => $blog_obj->getVar('blog_link'),
117
+			'desc'  => $blog_obj->getVar('blog_desc'),
118
+			'time'  => $blog_obj->getTime(),
119
+			'star'  => $blog_obj->getStar(),
120
+			'rates' => $blog_obj->getVar('blog_rates'),
121
+			'marks' => $blog_obj->getVar('blog_marks')
122
+		];
123
+	}
124
+	$query_type     = 'blog';
125
+	$article_prefix = '';
126 126
 }
127 127
 /* User bookmarks(favorites) */
128 128
 if ($uid > 0) {
129
-    $criteria->add(new Criteria('bm.bm_uid', $uid));
130
-    $category_id     = 0;
131
-    $blog_id         = 0;
132
-    $bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']);
133
-    $user_data       = [
134
-        'uid'   => $uid,
135
-        'name'  => XoopsUser::getUnameFromId($uid),
136
-        'marks' => $bookmarkHandler->getCount(new Criteria('bm_uid', $uid))
137
-    ];
138
-    $query_type      = 'bookmark';
139
-    $article_prefix  = 'a.';
129
+	$criteria->add(new Criteria('bm.bm_uid', $uid));
130
+	$category_id     = 0;
131
+	$blog_id         = 0;
132
+	$bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']);
133
+	$user_data       = [
134
+		'uid'   => $uid,
135
+		'name'  => XoopsUser::getUnameFromId($uid),
136
+		'marks' => $bookmarkHandler->getCount(new Criteria('bm_uid', $uid))
137
+	];
138
+	$query_type      = 'bookmark';
139
+	$article_prefix  = 'a.';
140 140
 }
141 141
 
142 142
 /* Sort */
143 143
 $order = 'DESC';
144 144
 $sort  = empty($sort) ? 'time' : $sort;
145 145
 switch ($sort) {
146
-    case 'views':
147
-        $sortby = $article_prefix . 'art_views';
148
-        break;
149
-    case 'rating':
150
-        $sortby = $article_prefix . 'art_rating';
151
-        break;
152
-    case 'time':
153
-        $sortby = $article_prefix . 'art_time';
154
-        break;
155
-    case 'default':
156
-    default:
157
-        $sortby = '';
158
-        break;
146
+	case 'views':
147
+		$sortby = $article_prefix . 'art_views';
148
+		break;
149
+	case 'rating':
150
+		$sortby = $article_prefix . 'art_rating';
151
+		break;
152
+	case 'time':
153
+		$sortby = $article_prefix . 'art_time';
154
+		break;
155
+	case 'default':
156
+	default:
157
+		$sortby = '';
158
+		break;
159 159
 }
160 160
 $criteria->setSort($sortby);
161 161
 $criteria->setOrder($order);
@@ -163,120 +163,120 @@  discard block
 block discarded – undo
163 163
 $criteria->setLimit($limit);
164 164
 
165 165
 $tags = empty($list) ? '' : [
166
-    $article_prefix . 'art_title',
167
-    $article_prefix . 'blog_id',
168
-    $article_prefix . 'art_time'
166
+	$article_prefix . 'art_title',
167
+	$article_prefix . 'blog_id',
168
+	$article_prefix . 'art_time'
169 169
 ];
170 170
 switch ($query_type) {
171
-    case 'category':
172
-        $articles_obj  = $articleHandler->getByCategory($criteria, $tags);
173
-        $count_article = $articleHandler->getCountByCategory($criteria);
174
-        break;
175
-    case 'bookmark':
176
-        $articles_obj  = $articleHandler->getByBookmark($criteria, $tags);
177
-        $count_article = $articleHandler->getCountByBookmark($criteria);
178
-        break;
179
-    default:
180
-        $articles_obj  = $articleHandler->getAll($criteria, $tags);
181
-        $count_article = $articleHandler->getCount($criteria);
182
-        break;
171
+	case 'category':
172
+		$articles_obj  = $articleHandler->getByCategory($criteria, $tags);
173
+		$count_article = $articleHandler->getCountByCategory($criteria);
174
+		break;
175
+	case 'bookmark':
176
+		$articles_obj  = $articleHandler->getByBookmark($criteria, $tags);
177
+		$count_article = $articleHandler->getCountByBookmark($criteria);
178
+		break;
179
+	default:
180
+		$articles_obj  = $articleHandler->getAll($criteria, $tags);
181
+		$count_article = $articleHandler->getCount($criteria);
182
+		break;
183 183
 }
184 184
 
185 185
 if (!empty($blog_data)) {
186
-    $blogs[$blog_data['id']] = $blog_data['title'];
186
+	$blogs[$blog_data['id']] = $blog_data['title'];
187 187
 } else {
188
-    $blog_array = [];
189
-    foreach (array_keys($articles_obj) as $id) {
190
-        $blog_array[$articles_obj[$id]->getVar('blog_id')] = 1;
191
-    }
192
-    $criteria_blog = new Criteria('blog_id', '(' . implode(',', array_keys($blog_array)) . ')', 'IN');
193
-    $blogs         = $blogHandler->getList($criteria_blog);
188
+	$blog_array = [];
189
+	foreach (array_keys($articles_obj) as $id) {
190
+		$blog_array[$articles_obj[$id]->getVar('blog_id')] = 1;
191
+	}
192
+	$criteria_blog = new Criteria('blog_id', '(' . implode(',', array_keys($blog_array)) . ')', 'IN');
193
+	$blogs         = $blogHandler->getList($criteria_blog);
194 194
 }
195 195
 
196 196
 /* Objects to array */
197 197
 $articles = [];
198 198
 foreach (array_keys($articles_obj) as $id) {
199
-    $_article = [
200
-        'id'    => $id,
201
-        'title' => $articles_obj[$id]->getVar('art_title'),
202
-        'time'  => $articles_obj[$id]->getTime(),
203
-        'blog'  => [
204
-            'id'    => $articles_obj[$id]->getVar('blog_id'),
205
-            'title' => $blogs[$articles_obj[$id]->getVar('blog_id')]
206
-        ]
207
-    ];
208
-    if (empty($list)) {
209
-        $_article = array_merge($_article, [
210
-            'author'   => $articles_obj[$id]->getVar('art_author'),
211
-            'views'    => $articles_obj[$id]->getVar('art_views'),
212
-            'comments' => $articles_obj[$id]->getVar('art_comments'),
213
-            'star'     => $articles_obj[$id]->getStar(),
214
-            'rates'    => $articles_obj[$id]->getVar('art_rates')
215
-        ]);
216
-        if (!empty($xoopsModuleConfig['display_summary'])) {
217
-            $_article['content'] = $articles_obj[$id]->getSummary();
218
-        } else {
219
-            $_article['content'] = $articles_obj[$id]->getVar('art_content');
220
-        }
221
-    }
222
-    $articles[] = $_article;
223
-    unset($_article);
199
+	$_article = [
200
+		'id'    => $id,
201
+		'title' => $articles_obj[$id]->getVar('art_title'),
202
+		'time'  => $articles_obj[$id]->getTime(),
203
+		'blog'  => [
204
+			'id'    => $articles_obj[$id]->getVar('blog_id'),
205
+			'title' => $blogs[$articles_obj[$id]->getVar('blog_id')]
206
+		]
207
+	];
208
+	if (empty($list)) {
209
+		$_article = array_merge($_article, [
210
+			'author'   => $articles_obj[$id]->getVar('art_author'),
211
+			'views'    => $articles_obj[$id]->getVar('art_views'),
212
+			'comments' => $articles_obj[$id]->getVar('art_comments'),
213
+			'star'     => $articles_obj[$id]->getStar(),
214
+			'rates'    => $articles_obj[$id]->getVar('art_rates')
215
+		]);
216
+		if (!empty($xoopsModuleConfig['display_summary'])) {
217
+			$_article['content'] = $articles_obj[$id]->getSummary();
218
+		} else {
219
+			$_article['content'] = $articles_obj[$id]->getVar('art_content');
220
+		}
221
+	}
222
+	$articles[] = $_article;
223
+	unset($_article);
224 224
 }
225 225
 unset($articles_obj);
226 226
 
227 227
 if ($count_article > $limit) {
228
-    include XOOPS_ROOT_PATH . '/class/pagenav.php';
229
-    $start_link = [];
230
-    if ($sort) {
231
-        $start_link[] = 'sort=' . $sort;
232
-    }
233
-    if ($category_id) {
234
-        $start_link[] = 'category=' . $category_id;
235
-    }
236
-    if ($blog_id) {
237
-        $start_link[] = 'blog=' . $blog_id;
238
-    }
239
-    if ($list) {
240
-        $start_link[] = 'list=' . $list;
241
-    }
242
-    $nav     = new XoopsPageNav($count_article, $limit, $start, 'start', implode('&amp;', $start_link));
243
-    $pagenav = $nav->renderNav(4);
228
+	include XOOPS_ROOT_PATH . '/class/pagenav.php';
229
+	$start_link = [];
230
+	if ($sort) {
231
+		$start_link[] = 'sort=' . $sort;
232
+	}
233
+	if ($category_id) {
234
+		$start_link[] = 'category=' . $category_id;
235
+	}
236
+	if ($blog_id) {
237
+		$start_link[] = 'blog=' . $blog_id;
238
+	}
239
+	if ($list) {
240
+		$start_link[] = 'list=' . $list;
241
+	}
242
+	$nav     = new XoopsPageNav($count_article, $limit, $start, 'start', implode('&amp;', $start_link));
243
+	$pagenav = $nav->renderNav(4);
244 244
 } else {
245
-    $pagenav = '';
245
+	$pagenav = '';
246 246
 }
247 247
 
248 248
 $xoopsTpl->assign('xoops_module_header', $xoops_module_header);
249 249
 $xoopsTpl->assign('dirname', $GLOBALS['moddirname']);
250 250
 
251 251
 if ($category_id || $blog_id || $uid) {
252
-    $xoopsTpl->assign('link_index', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/index.php\" title=\"" . planet_constant('MD_INDEX') . "\" target=\"_self\">" . planet_constant('MD_INDEX') . '</a>');
252
+	$xoopsTpl->assign('link_index', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/index.php\" title=\"" . planet_constant('MD_INDEX') . "\" target=\"_self\">" . planet_constant('MD_INDEX') . '</a>');
253 253
 }
254 254
 
255 255
 $link_switch = "<a href=\""
256
-               . XOOPS_URL
257
-               . '/modules/'
258
-               . $GLOBALS['moddirname']
259
-               . '/index.php'
260
-               . (empty($category_id) ? '' : '/c' . $category_id)
261
-               . (empty($uid) ? '' : '/u' . $uid)
262
-               . (empty($blog_id) ? '' : '/b' . $blog_id)
263
-               . (empty($list) ? '/l1' : '')
264
-               . "\" title=\""
265
-               . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
266
-               . "\">"
267
-               . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
268
-               . '</a>';
256
+			   . XOOPS_URL
257
+			   . '/modules/'
258
+			   . $GLOBALS['moddirname']
259
+			   . '/index.php'
260
+			   . (empty($category_id) ? '' : '/c' . $category_id)
261
+			   . (empty($uid) ? '' : '/u' . $uid)
262
+			   . (empty($blog_id) ? '' : '/b' . $blog_id)
263
+			   . (empty($list) ? '/l1' : '')
264
+			   . "\" title=\""
265
+			   . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
266
+			   . "\">"
267
+			   . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
268
+			   . '</a>';
269 269
 $xoopsTpl->assign('link_switch', $link_switch);
270 270
 
271 271
 $link_blogs = "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) . "\" title=\"" . planet_constant('MD_BLOGS') . "\">" . planet_constant('MD_BLOGS') . '</a>';
272 272
 $xoopsTpl->assign('link_blogs', $link_blogs);
273 273
 
274 274
 if (empty($uid) && is_object($xoopsUser)) {
275
-    $xoopsTpl->assign('link_bookmark', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $xoopsUser->getVar('uid') . "\" title=\"" . planet_constant('MD_BOOKMARKS') . "\" target=\"_self\">" . planet_constant('MD_BOOKMARKS') . '</a>');
275
+	$xoopsTpl->assign('link_bookmark', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $xoopsUser->getVar('uid') . "\" title=\"" . planet_constant('MD_BOOKMARKS') . "\" target=\"_self\">" . planet_constant('MD_BOOKMARKS') . '</a>');
276 276
 }
277 277
 
278 278
 if ($xoopsModuleConfig['newblog_submit'] == 1 || is_object($xoopsUser)) {
279
-    $xoopsTpl->assign('link_submit', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/action.blog.php\" title=\"" . _SUBMIT . "\" target=\"_blank\">" . _SUBMIT . '</a>');
279
+	$xoopsTpl->assign('link_submit', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/action.blog.php\" title=\"" . _SUBMIT . "\" target=\"_blank\">" . _SUBMIT . '</a>');
280 280
 }
281 281
 
282 282
 $xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name') . '::' . planet_constant('MD_ARTICLES'));
@@ -290,22 +290,22 @@  discard block
 block discarded – undo
290 290
 $xoopsTpl->assign('user_level', !is_object($xoopsUser) ? 0 : ($xoopsUser->isAdmin() ? 2 : 1));
291 291
 if (empty($xoopsModuleConfig['anonymous_rate']) && !is_object($xoopsUser)) {
292 292
 } elseif ($blog_id > 0) {
293
-    $xoopsTpl->assign('canrate', 1);
293
+	$xoopsTpl->assign('canrate', 1);
294 294
 }
295 295
 
296 296
 $sort_link   = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) . (empty($blog_id) ? '' : '/b' . $blog_id) . (empty($list) ? '' : '/l1');
297 297
 $valid_sorts = [
298
-    'views'   => planet_constant('MD_VIEWS'),
299
-    'rating'  => planet_constant('MD_RATING'),
300
-    'time'    => planet_constant('MD_TIME'),
301
-    'default' => planet_constant('MD_DEFAULT')
298
+	'views'   => planet_constant('MD_VIEWS'),
299
+	'rating'  => planet_constant('MD_RATING'),
300
+	'time'    => planet_constant('MD_TIME'),
301
+	'default' => planet_constant('MD_DEFAULT')
302 302
 ];
303 303
 $sortlinks   = [];
304 304
 foreach ($valid_sorts as $val => $name) {
305
-    if ($val == $sort) {
306
-        continue;
307
-    }
308
-    $sortlinks[] = "<a href=\"" . $sort_link . '/' . $val . "\">" . $name . '</a>';
305
+	if ($val == $sort) {
306
+		continue;
307
+	}
308
+	$sortlinks[] = "<a href=\"" . $sort_link . '/' . $val . "\">" . $name . '</a>';
309 309
 }
310 310
 $xoopsTpl->assign('link_sort', implode(' | ', $sortlinks));
311 311
 $xoopsTpl->assign('version', $xoopsModule->getVar('version'));
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
 
315 315
 // for notification
316 316
 if (!empty($blog_id)) {
317
-    //$_SERVER['REQUEST_URI'] = XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/index.php";
318
-    $_GET['blog'] = $blog_id;
317
+	//$_SERVER['REQUEST_URI'] = XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/index.php";
318
+	$_GET['blog'] = $blog_id;
319 319
 }
320 320
 
321 321
 require_once __DIR__ . '/footer.php';
Please login to merge, or discard this patch.
view.article.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -34,17 +34,17 @@  discard block
 block discarded – undo
34 34
  *
35 35
  */
36 36
 if (preg_match("/(\/comment_[^\.]*\.php\?.*=.*)/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) {//$_SERVER['REQUEST_URI']
37
-    header('location: ' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . $matches[1]);
38
-    exit();
37
+	header('location: ' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . $matches[1]);
38
+	exit();
39 39
 }
40 40
 if (preg_match("/\/notification_update\.php/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) {
41
-    include XOOPS_ROOT_PATH . '/include/notification_update.php';
42
-    exit();
41
+	include XOOPS_ROOT_PATH . '/include/notification_update.php';
42
+	exit();
43 43
 }
44 44
 
45 45
 if ($REQUEST_URI_parsed = PlanetUtility::planetParseArguments($args_num, $args, $args_str)) {
46
-    $args['article'] = @$args_num[0];
47
-    $args['blog']    = @$args['blog'];
46
+	$args['article'] = @$args_num[0];
47
+	$args['blog']    = @$args['blog'];
48 48
 }
49 49
 
50 50
 $article_id = Request::getInt('article', @$args['article'], 'POST');//(int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 // restore $_SERVER['REQUEST_URI']
59 59
 if (!empty($REQUEST_URI_parsed)) {
60
-    $_SERVER['REQUEST_URI'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . (empty($article_id) ? '' : '?article=' . $article_id);
60
+	$_SERVER['REQUEST_URI'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . (empty($article_id) ? '' : '?article=' . $article_id);
61 61
 }
62 62
 
63 63
 $xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name') . ' - ' . $article_obj->getVar('art_title');
@@ -66,29 +66,29 @@  discard block
 block discarded – undo
66 66
 include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
67 67
 
68 68
 $article_data = [
69
-    'id'       => $article_id,
70
-    'title'    => $article_obj->getVar('art_title'),
71
-    'content'  => $article_obj->getVar('art_content'),
72
-    'author'   => $article_obj->getVar('art_author'),
73
-    'time'     => $article_obj->getTime(),
74
-    'link'     => $article_obj->getVar('art_link'),
75
-    'views'    => $article_obj->getVar('art_views'),
76
-    'comments' => $article_obj->getVar('art_comments'),
77
-    'star'     => $article_obj->getStar(),
78
-    'rates'    => $article_obj->getVar('art_rates'),
79
-    'blog'     => ['id' => $article_obj->getVar('blog_id'), 'title' => $blog_obj->getVar('blog_title')]
69
+	'id'       => $article_id,
70
+	'title'    => $article_obj->getVar('art_title'),
71
+	'content'  => $article_obj->getVar('art_content'),
72
+	'author'   => $article_obj->getVar('art_author'),
73
+	'time'     => $article_obj->getTime(),
74
+	'link'     => $article_obj->getVar('art_link'),
75
+	'views'    => $article_obj->getVar('art_views'),
76
+	'comments' => $article_obj->getVar('art_comments'),
77
+	'star'     => $article_obj->getStar(),
78
+	'rates'    => $article_obj->getVar('art_rates'),
79
+	'blog'     => ['id' => $article_obj->getVar('blog_id'), 'title' => $blog_obj->getVar('blog_title')]
80 80
 ];
81 81
 
82 82
 if (!empty($xoopsModuleConfig['do_sibling'])) {
83
-    $articles_sibling = $articleHandler->getSibling($article_obj, $blog_id);
84
-    if (!empty($articles_sibling['previous'])) {
85
-        $articles_sibling['previous']['url']   = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_sibling['previous']['id'] . '/b' . $blog_id;
86
-        $articles_sibling['previous']['title'] = $articles_sibling['previous']['title'];
87
-    }
88
-    if (!empty($articles_sibling['next'])) {
89
-        $articles_sibling['next']['url']   = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_sibling['next']['id'] . '/b' . $blog_id;
90
-        $articles_sibling['next']['title'] = $articles_sibling['next']['title'];
91
-    }
83
+	$articles_sibling = $articleHandler->getSibling($article_obj, $blog_id);
84
+	if (!empty($articles_sibling['previous'])) {
85
+		$articles_sibling['previous']['url']   = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_sibling['previous']['id'] . '/b' . $blog_id;
86
+		$articles_sibling['previous']['title'] = $articles_sibling['previous']['title'];
87
+	}
88
+	if (!empty($articles_sibling['next'])) {
89
+		$articles_sibling['next']['url']   = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_sibling['next']['id'] . '/b' . $blog_id;
90
+		$articles_sibling['next']['title'] = $articles_sibling['next']['title'];
91
+	}
92 92
 }
93 93
 
94 94
 $xoopsTpl->assign('modulename', $xoopsModule->getVar('name'));
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 $xoopsTpl->assign('user_level', !is_object($xoopsUser) ? 0 : ($xoopsUser->isAdmin() ? 2 : 1));
100 100
 if (empty($xoopsModuleConfig['anonymous_rate']) && !is_object($xoopsUser)) {
101 101
 } else {
102
-    $xoopsTpl->assign('canrate', 1);
102
+	$xoopsTpl->assign('canrate', 1);
103 103
 }
104 104
 
105 105
 if ($transferbar = @include XOOPS_ROOT_PATH . '/Frameworks/transfer/bar.transfer.php') {
106
-    $xoopsTpl->assign('transfer', $transferbar);
106
+	$xoopsTpl->assign('transfer', $transferbar);
107 107
 }
108 108
 
109 109
 // Loading module meta data, NOT THE RIGHT WAY DOING IT
Please login to merge, or discard this patch.