@@ -32,88 +32,88 @@ |
||
32 | 32 | |
33 | 33 | // defined('XOOPS_ROOT_PATH') || die('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; |
@@ -20,12 +20,12 @@ |
||
20 | 20 | */ |
21 | 21 | |
22 | 22 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
23 | -require_once __DIR__ . '/common.php'; |
|
23 | +require_once __DIR__.'/common.php'; |
|
24 | 24 | |
25 | 25 | $moduleDirName = basename(dirname(__DIR__)); |
26 | 26 | $uploadFolders = [ |
27 | 27 | NEWBB_UPLOAD_PATH, |
28 | - NEWBB_UPLOAD_PATH . '/thumbs' |
|
28 | + NEWBB_UPLOAD_PATH.'/thumbs' |
|
29 | 29 | ]; |
30 | 30 | |
31 | 31 | //$copyFiles = array( |
@@ -22,12 +22,12 @@ |
||
22 | 22 | */ |
23 | 23 | class PlanetCorePreload extends XoopsPreloadItem |
24 | 24 | { |
25 | - // to add PSR-4 autoloader |
|
26 | - /** |
|
27 | - * @param $args |
|
28 | - */ |
|
29 | - public static function eventCoreIncludeCommonEnd($args) |
|
30 | - { |
|
31 | - include __DIR__ . '/autoloader.php'; |
|
32 | - } |
|
25 | + // to add PSR-4 autoloader |
|
26 | + /** |
|
27 | + * @param $args |
|
28 | + */ |
|
29 | + public static function eventCoreIncludeCommonEnd($args) |
|
30 | + { |
|
31 | + include __DIR__ . '/autoloader.php'; |
|
32 | + } |
|
33 | 33 | } |
@@ -28,6 +28,6 @@ |
||
28 | 28 | */ |
29 | 29 | public static function eventCoreIncludeCommonEnd($args) |
30 | 30 | { |
31 | - include __DIR__ . '/autoloader.php'; |
|
31 | + include __DIR__.'/autoloader.php'; |
|
32 | 32 | } |
33 | 33 | } |
@@ -4,29 +4,29 @@ |
||
4 | 4 | * @see http://www.php-fig.org/psr/psr-4/examples/ |
5 | 5 | */ |
6 | 6 | spl_autoload_register(function ($class) { |
7 | - // project-specific namespace prefix |
|
8 | - $prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__))); |
|
7 | + // project-specific namespace prefix |
|
8 | + $prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__))); |
|
9 | 9 | |
10 | - // base directory for the namespace prefix |
|
11 | - $base_dir = __DIR__ . '/../class/'; |
|
10 | + // base directory for the namespace prefix |
|
11 | + $base_dir = __DIR__ . '/../class/'; |
|
12 | 12 | |
13 | - // does the class use the namespace prefix? |
|
14 | - $len = strlen($prefix); |
|
13 | + // does the class use the namespace prefix? |
|
14 | + $len = strlen($prefix); |
|
15 | 15 | |
16 | - if (0 !== strncmp($prefix, $class, $len)) { |
|
17 | - return; |
|
18 | - } |
|
16 | + if (0 !== strncmp($prefix, $class, $len)) { |
|
17 | + return; |
|
18 | + } |
|
19 | 19 | |
20 | - // get the relative class name |
|
21 | - $relative_class = substr($class, $len); |
|
20 | + // get the relative class name |
|
21 | + $relative_class = substr($class, $len); |
|
22 | 22 | |
23 | - // replace the namespace prefix with the base directory, replace namespace |
|
24 | - // separators with directory separators in the relative class name, append |
|
25 | - // with .php |
|
26 | - $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
23 | + // replace the namespace prefix with the base directory, replace namespace |
|
24 | + // separators with directory separators in the relative class name, append |
|
25 | + // with .php |
|
26 | + $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
27 | 27 | |
28 | - // if the file exists, require it |
|
29 | - if (file_exists($file)) { |
|
30 | - require $file; |
|
31 | - } |
|
28 | + // if the file exists, require it |
|
29 | + if (file_exists($file)) { |
|
30 | + require $file; |
|
31 | + } |
|
32 | 32 | }); |
@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | /** |
4 | 4 | * @see http://www.php-fig.org/psr/psr-4/examples/ |
5 | 5 | */ |
6 | -spl_autoload_register(function ($class) { |
|
6 | +spl_autoload_register(function($class) { |
|
7 | 7 | // project-specific namespace prefix |
8 | - $prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__))); |
|
8 | + $prefix = 'XoopsModules\\'.ucfirst(basename(dirname(__DIR__))); |
|
9 | 9 | |
10 | 10 | // base directory for the namespace prefix |
11 | - $base_dir = __DIR__ . '/../class/'; |
|
11 | + $base_dir = __DIR__.'/../class/'; |
|
12 | 12 | |
13 | 13 | // does the class use the namespace prefix? |
14 | 14 | $len = strlen($prefix); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | // replace the namespace prefix with the base directory, replace namespace |
24 | 24 | // separators with directory separators in the relative class name, append |
25 | 25 | // with .php |
26 | - $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
26 | + $file = $base_dir.str_replace('\\', '/', $relative_class).'.php'; |
|
27 | 27 | |
28 | 28 | // if the file exists, require it |
29 | 29 | if (file_exists($file)) { |
@@ -32,8 +32,8 @@ |
||
32 | 32 | $current_path = str_replace(strpos($current_path, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, '/', $current_path); |
33 | 33 | } |
34 | 34 | $url_arr = explode('/', strstr($current_path, '/modules/')); |
35 | -include XOOPS_ROOT_PATH . '/modules/' . $url_arr[2] . '/include/vars.php'; |
|
36 | -include XOOPS_ROOT_PATH . '/modules/' . $url_arr[2] . '/class/Utility.php'; |
|
35 | +include XOOPS_ROOT_PATH.'/modules/'.$url_arr[2].'/include/vars.php'; |
|
36 | +include XOOPS_ROOT_PATH.'/modules/'.$url_arr[2].'/class/Utility.php'; |
|
37 | 37 | //require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/functions.php'; |
38 | 38 | |
39 | 39 | /** |
@@ -25,10 +25,10 @@ |
||
25 | 25 | // Project: Article Project // |
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | |
28 | -include __DIR__ . '/../../mainfile.php'; |
|
29 | -include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
28 | +include __DIR__.'/../../mainfile.php'; |
|
29 | +include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
30 | 30 | //require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/functions.php'; |
31 | -require_once __DIR__ . '/class/Utility.php'; |
|
31 | +require_once __DIR__.'/class/Utility.php'; |
|
32 | 32 | |
33 | 33 | planet_define_url_delimiter(); |
34 | 34 | $myts = \MyTextSanitizer::getInstance(); |
@@ -37,17 +37,17 @@ discard block |
||
37 | 37 | * |
38 | 38 | */ |
39 | 39 | if (preg_match("/(\/comment_[^\.]*\.php\?.*=.*)/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) {//$_SERVER['REQUEST_URI'] |
40 | - header('location: ' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . $matches[1]); |
|
41 | - exit(); |
|
40 | + header('location: ' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . $matches[1]); |
|
41 | + exit(); |
|
42 | 42 | } |
43 | 43 | if (preg_match("/\/notification_update\.php/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) { |
44 | - include XOOPS_ROOT_PATH . '/include/notification_update.php'; |
|
45 | - exit(); |
|
44 | + include XOOPS_ROOT_PATH . '/include/notification_update.php'; |
|
45 | + exit(); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | if ($REQUEST_URI_parsed = PlanetUtility::planetParseArguments($args_num, $args, $args_str)) { |
49 | - $args['article'] = @$args_num[0]; |
|
50 | - $args['blog'] = @$args['blog']; |
|
49 | + $args['article'] = @$args_num[0]; |
|
50 | + $args['blog'] = @$args['blog']; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | $article_id = Request::getInt('article', @$args['article'], 'POST');//(int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | // restore $_SERVER['REQUEST_URI'] |
62 | 62 | if (!empty($REQUEST_URI_parsed)) { |
63 | - $_SERVER['REQUEST_URI'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . (empty($article_id) ? '' : '?article=' . $article_id); |
|
63 | + $_SERVER['REQUEST_URI'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . (empty($article_id) ? '' : '?article=' . $article_id); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | $xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name') . ' - ' . $article_obj->getVar('art_title'); |
@@ -69,29 +69,29 @@ discard block |
||
69 | 69 | include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
70 | 70 | |
71 | 71 | $article_data = [ |
72 | - 'id' => $article_id, |
|
73 | - 'title' => $article_obj->getVar('art_title'), |
|
74 | - 'content' => $article_obj->getVar('art_content'), |
|
75 | - 'author' => $article_obj->getVar('art_author'), |
|
76 | - 'time' => $article_obj->getTime(), |
|
77 | - 'link' => $article_obj->getVar('art_link'), |
|
78 | - 'views' => $article_obj->getVar('art_views'), |
|
79 | - 'comments' => $article_obj->getVar('art_comments'), |
|
80 | - 'star' => $article_obj->getStar(), |
|
81 | - 'rates' => $article_obj->getVar('art_rates'), |
|
82 | - 'blog' => ['id' => $article_obj->getVar('blog_id'), 'title' => $blog_obj->getVar('blog_title')] |
|
72 | + 'id' => $article_id, |
|
73 | + 'title' => $article_obj->getVar('art_title'), |
|
74 | + 'content' => $article_obj->getVar('art_content'), |
|
75 | + 'author' => $article_obj->getVar('art_author'), |
|
76 | + 'time' => $article_obj->getTime(), |
|
77 | + 'link' => $article_obj->getVar('art_link'), |
|
78 | + 'views' => $article_obj->getVar('art_views'), |
|
79 | + 'comments' => $article_obj->getVar('art_comments'), |
|
80 | + 'star' => $article_obj->getStar(), |
|
81 | + 'rates' => $article_obj->getVar('art_rates'), |
|
82 | + 'blog' => ['id' => $article_obj->getVar('blog_id'), 'title' => $blog_obj->getVar('blog_title')] |
|
83 | 83 | ]; |
84 | 84 | |
85 | 85 | if (!empty($helper->getConfig('do_sibling'))) { |
86 | - $articles_sibling = $articleHandler->getSibling($article_obj, $blog_id); |
|
87 | - if (!empty($articles_sibling['previous'])) { |
|
88 | - $articles_sibling['previous']['url'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_sibling['previous']['id'] . '/b' . $blog_id; |
|
89 | - $articles_sibling['previous']['title'] = $articles_sibling['previous']['title']; |
|
90 | - } |
|
91 | - if (!empty($articles_sibling['next'])) { |
|
92 | - $articles_sibling['next']['url'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_sibling['next']['id'] . '/b' . $blog_id; |
|
93 | - $articles_sibling['next']['title'] = $articles_sibling['next']['title']; |
|
94 | - } |
|
86 | + $articles_sibling = $articleHandler->getSibling($article_obj, $blog_id); |
|
87 | + if (!empty($articles_sibling['previous'])) { |
|
88 | + $articles_sibling['previous']['url'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_sibling['previous']['id'] . '/b' . $blog_id; |
|
89 | + $articles_sibling['previous']['title'] = $articles_sibling['previous']['title']; |
|
90 | + } |
|
91 | + if (!empty($articles_sibling['next'])) { |
|
92 | + $articles_sibling['next']['url'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_sibling['next']['id'] . '/b' . $blog_id; |
|
93 | + $articles_sibling['next']['title'] = $articles_sibling['next']['title']; |
|
94 | + } |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | $xoopsTpl->assign('modulename', $xoopsModule->getVar('name')); |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | $xoopsTpl->assign('user_level', !is_object($xoopsUser) ? 0 : ($xoopsUser->isAdmin() ? 2 : 1)); |
103 | 103 | if (empty($helper->getConfig('anonymous_rate')) && !is_object($xoopsUser)) { |
104 | 104 | } else { |
105 | - $xoopsTpl->assign('canrate', 1); |
|
105 | + $xoopsTpl->assign('canrate', 1); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | if ($transferbar = @include XOOPS_ROOT_PATH . '/Frameworks/transfer/bar.transfer.php') { |
109 | - $xoopsTpl->assign('transfer', $transferbar); |
|
109 | + $xoopsTpl->assign('transfer', $transferbar); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | // Loading module meta data, NOT THE RIGHT WAY DOING IT |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** @var Planet\Helper $helper */ |
30 | 30 | $helper = Planet\Helper::getInstance(); |
31 | 31 | |
32 | -include __DIR__ . '/header.php'; |
|
32 | +include __DIR__.'/header.php'; |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * The comment detection scripts should be removed once absolute url is used in comment_view.php |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | * |
38 | 38 | */ |
39 | 39 | if (preg_match("/(\/comment_[^\.]*\.php\?.*=.*)/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) {//$_SERVER['REQUEST_URI'] |
40 | - header('location: ' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . $matches[1]); |
|
40 | + header('location: '.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].$matches[1]); |
|
41 | 41 | exit(); |
42 | 42 | } |
43 | 43 | if (preg_match("/\/notification_update\.php/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) { |
44 | - include XOOPS_ROOT_PATH . '/include/notification_update.php'; |
|
44 | + include XOOPS_ROOT_PATH.'/include/notification_update.php'; |
|
45 | 45 | exit(); |
46 | 46 | } |
47 | 47 | |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | $args['blog'] = @$args['blog']; |
51 | 51 | } |
52 | 52 | |
53 | -$article_id = Request::getInt('article', @$args['article'], 'POST');//(int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']); |
|
54 | -$blog_id = Request::getInt('blog', @$args['blog'], 'POST');//(int)(empty($_GET['blog']) ? @$args['blog'] : $_GET['blog']); |
|
53 | +$article_id = Request::getInt('article', @$args['article'], 'POST'); //(int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']); |
|
54 | +$blog_id = Request::getInt('blog', @$args['blog'], 'POST'); //(int)(empty($_GET['blog']) ? @$args['blog'] : $_GET['blog']); |
|
55 | 55 | |
56 | 56 | $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
57 | 57 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | |
61 | 61 | // restore $_SERVER['REQUEST_URI'] |
62 | 62 | if (!empty($REQUEST_URI_parsed)) { |
63 | - $_SERVER['REQUEST_URI'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . (empty($article_id) ? '' : '?article=' . $article_id); |
|
63 | + $_SERVER['REQUEST_URI'] = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.(empty($article_id) ? '' : '?article='.$article_id); |
|
64 | 64 | } |
65 | 65 | |
66 | -$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name') . ' - ' . $article_obj->getVar('art_title'); |
|
66 | +$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name').' - '.$article_obj->getVar('art_title'); |
|
67 | 67 | $xoopsOption['template_main'] = PlanetUtility::planetGetTemplate('article'); |
68 | -require_once XOOPS_ROOT_PATH . '/header.php'; |
|
69 | -include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
68 | +require_once XOOPS_ROOT_PATH.'/header.php'; |
|
69 | +include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
70 | 70 | |
71 | 71 | $article_data = [ |
72 | 72 | 'id' => $article_id, |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | if (!empty($helper->getConfig('do_sibling'))) { |
86 | 86 | $articles_sibling = $articleHandler->getSibling($article_obj, $blog_id); |
87 | 87 | if (!empty($articles_sibling['previous'])) { |
88 | - $articles_sibling['previous']['url'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_sibling['previous']['id'] . '/b' . $blog_id; |
|
88 | + $articles_sibling['previous']['url'] = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$articles_sibling['previous']['id'].'/b'.$blog_id; |
|
89 | 89 | $articles_sibling['previous']['title'] = $articles_sibling['previous']['title']; |
90 | 90 | } |
91 | 91 | if (!empty($articles_sibling['next'])) { |
92 | - $articles_sibling['next']['url'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_sibling['next']['id'] . '/b' . $blog_id; |
|
92 | + $articles_sibling['next']['url'] = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$articles_sibling['next']['id'].'/b'.$blog_id; |
|
93 | 93 | $articles_sibling['next']['title'] = $articles_sibling['next']['title']; |
94 | 94 | } |
95 | 95 | } |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | |
102 | 102 | $xoopsTpl->assign('user_level', !is_object($xoopsUser) ? 0 : ($xoopsUser->isAdmin() ? 2 : 1)); |
103 | 103 | if (empty($helper->getConfig('anonymous_rate')) && !is_object($xoopsUser)) { |
104 | -} else { |
|
104 | +}else { |
|
105 | 105 | $xoopsTpl->assign('canrate', 1); |
106 | 106 | } |
107 | 107 | |
108 | -if ($transferbar = @include XOOPS_ROOT_PATH . '/Frameworks/transfer/bar.transfer.php') { |
|
108 | +if ($transferbar = @include XOOPS_ROOT_PATH.'/Frameworks/transfer/bar.transfer.php') { |
|
109 | 109 | $xoopsTpl->assign('transfer', $transferbar); |
110 | 110 | } |
111 | 111 | |
@@ -115,6 +115,6 @@ discard block |
||
115 | 115 | // for comment and notification |
116 | 116 | //$_SERVER['REQUEST_URI'] = XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/view.article.php"; |
117 | 117 | $_GET['article'] = $article_id; |
118 | -include XOOPS_ROOT_PATH . '/include/comment_view.php'; |
|
118 | +include XOOPS_ROOT_PATH.'/include/comment_view.php'; |
|
119 | 119 | |
120 | -require_once __DIR__ . '/footer.php'; |
|
120 | +require_once __DIR__.'/footer.php'; |
@@ -31,21 +31,21 @@ discard block |
||
31 | 31 | |
32 | 32 | use Xmf\Request; |
33 | 33 | |
34 | -include __DIR__ . '/header.php'; |
|
34 | +include __DIR__.'/header.php'; |
|
35 | 35 | global $pdf_data; |
36 | 36 | if (!empty($_POST['pdf_data'])) { |
37 | 37 | $pdf_data = unserialize(base64_decode(Request::getText('pdf_data', '', 'POST'))); |
38 | 38 | } elseif (!empty($pdf_data)) { |
39 | -} else { |
|
39 | +}else { |
|
40 | 40 | error_reporting(0); |
41 | - include __DIR__ . '/header.php'; |
|
41 | + include __DIR__.'/header.php'; |
|
42 | 42 | error_reporting(0); |
43 | 43 | |
44 | 44 | if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) { |
45 | 45 | $args['article'] = @$args_num[0]; |
46 | 46 | } |
47 | 47 | |
48 | - $article_id = (int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']); |
|
48 | + $article_id = (int) (empty($_GET['article']) ? @$args['article'] : $_GET['article']); |
|
49 | 49 | |
50 | 50 | $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
51 | 51 | $article_obj = $articleHandler->get($article_id); |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | $pdf_data['date'] = $article_data['time']; |
76 | 76 | $pdf_data['content'] = ''; |
77 | 77 | if ($article_data['summary']) { |
78 | - $pdf_data['content'] .= planet_constant('MD_SUMMARY') . ': ' . $article_data['summary'] . '<br><br>'; |
|
78 | + $pdf_data['content'] .= planet_constant('MD_SUMMARY').': '.$article_data['summary'].'<br><br>'; |
|
79 | 79 | } |
80 | - $pdf_data['content'] .= $article_data['text'] . '<br>'; |
|
81 | - $pdf_data['url'] = XOOPS_URL . '/modules/' . $GLOBALS['artdirname'] . '/view.article.php' . URL_DELIMITER . $article_obj->getVar('art_id'); |
|
80 | + $pdf_data['content'] .= $article_data['text'].'<br>'; |
|
81 | + $pdf_data['url'] = XOOPS_URL.'/modules/'.$GLOBALS['artdirname'].'/view.article.php'.URL_DELIMITER.$article_obj->getVar('art_id'); |
|
82 | 82 | } |
83 | 83 | $pdf_data['filename'] = preg_replace("/[^0-9a-z\-_\.]/i", '', $pdf_data['title']); |
84 | 84 | |
85 | -require_once XOOPS_ROOT_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php'; |
|
85 | +require_once XOOPS_ROOT_PATH.'/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php'; |
|
86 | 86 | |
87 | 87 | error_reporting(0); |
88 | 88 | ob_end_clean(); |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | include __DIR__ . '/header.php'; |
33 | 33 | |
34 | 34 | if (preg_match("/\/notification_update\.php/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) { |
35 | - include XOOPS_ROOT_PATH . '/include/notification_update.php'; |
|
36 | - exit(); |
|
35 | + include XOOPS_ROOT_PATH . '/include/notification_update.php'; |
|
36 | + exit(); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | if ($REQUEST_URI_parsed = PlanetUtility::planetParseArguments($args_num, $args, $args_str)) { |
40 | - $args['start'] = @$args_num[0]; |
|
41 | - $args['sort'] = @$args_str[0]; |
|
40 | + $args['start'] = @$args_num[0]; |
|
41 | + $args['sort'] = @$args_str[0]; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /* Start */ |
@@ -85,28 +85,28 @@ discard block |
||
85 | 85 | $blog_prefix = ''; |
86 | 86 | /* Specific category */ |
87 | 87 | if ($category_id > 0) { |
88 | - $category_obj = $categoryHandler->get($category_id); |
|
89 | - $criteria->add(new \Criteria('bc.cat_id', $category_id)); |
|
90 | - $uid = 0; |
|
91 | - $blog_id = 0; |
|
92 | - $category_data = ['id' => $category_id, 'title' => $category_obj->getVar('cat_title')]; |
|
93 | - $query_type = 'category'; |
|
94 | - $blog_prefix = 'b.'; |
|
88 | + $category_obj = $categoryHandler->get($category_id); |
|
89 | + $criteria->add(new \Criteria('bc.cat_id', $category_id)); |
|
90 | + $uid = 0; |
|
91 | + $blog_id = 0; |
|
92 | + $category_data = ['id' => $category_id, 'title' => $category_obj->getVar('cat_title')]; |
|
93 | + $query_type = 'category'; |
|
94 | + $blog_prefix = 'b.'; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /* User bookmarks(favorites) */ |
98 | 98 | if ($uid > 0) { |
99 | - $criteria->add(new \Criteria('bm.bm_uid', $uid)); |
|
100 | - $category_id = 0; |
|
101 | - $blog_id = 0; |
|
102 | - $bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']); |
|
103 | - $user_data = [ |
|
104 | - 'uid' => $uid, |
|
105 | - 'name' => XoopsUser::getUnameFromId($uid), |
|
106 | - 'marks' => $bookmarkHandler->getCount(new \Criteria('bm_uid', $uid)) |
|
107 | - ]; |
|
108 | - $query_type = 'bookmark'; |
|
109 | - $blog_prefix = 'b.'; |
|
99 | + $criteria->add(new \Criteria('bm.bm_uid', $uid)); |
|
100 | + $category_id = 0; |
|
101 | + $blog_id = 0; |
|
102 | + $bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']); |
|
103 | + $user_data = [ |
|
104 | + 'uid' => $uid, |
|
105 | + 'name' => XoopsUser::getUnameFromId($uid), |
|
106 | + 'marks' => $bookmarkHandler->getCount(new \Criteria('bm_uid', $uid)) |
|
107 | + ]; |
|
108 | + $query_type = 'bookmark'; |
|
109 | + $blog_prefix = 'b.'; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | $criteria->add(new \Criteria($blog_prefix . 'blog_status', 0, '>')); |
@@ -115,20 +115,20 @@ discard block |
||
115 | 115 | $order = 'DESC'; |
116 | 116 | $sort = empty($sort) ? 'default' : $sort; |
117 | 117 | switch ($sort) { |
118 | - case 'marks': |
|
119 | - $sortby = $blog_prefix . 'blog_marks'; |
|
120 | - break; |
|
121 | - case 'rating': |
|
122 | - $sortby = $blog_prefix . 'blog_rating'; |
|
123 | - break; |
|
124 | - case 'time': |
|
125 | - $sortby = $blog_prefix . 'blog_time'; |
|
126 | - break; |
|
127 | - case 'default': |
|
128 | - default: |
|
129 | - $sort = 'default'; |
|
130 | - $sortby = $blog_prefix . 'blog_id'; |
|
131 | - break; |
|
118 | + case 'marks': |
|
119 | + $sortby = $blog_prefix . 'blog_marks'; |
|
120 | + break; |
|
121 | + case 'rating': |
|
122 | + $sortby = $blog_prefix . 'blog_rating'; |
|
123 | + break; |
|
124 | + case 'time': |
|
125 | + $sortby = $blog_prefix . 'blog_time'; |
|
126 | + break; |
|
127 | + case 'default': |
|
128 | + default: |
|
129 | + $sort = 'default'; |
|
130 | + $sortby = $blog_prefix . 'blog_id'; |
|
131 | + break; |
|
132 | 132 | } |
133 | 133 | $criteria->setSort($sortby); |
134 | 134 | $criteria->setOrder($order); |
@@ -137,93 +137,93 @@ discard block |
||
137 | 137 | |
138 | 138 | $tags = empty($list) ? '' : [$blog_prefix . 'blog_title', $blog_prefix . 'blog_time']; |
139 | 139 | switch ($query_type) { |
140 | - case 'category': |
|
141 | - $blogs_obj = $blogHandler->getByCategory($criteria, $tags); |
|
142 | - $count_blog = $blogHandler->getCountByCategory($criteria); |
|
143 | - break; |
|
144 | - case 'bookmark': |
|
145 | - $blogs_obj = $blogHandler->getByBookmark($criteria, $tags); |
|
146 | - $count_blog = $blogHandler->getCountByBookmark($criteria); |
|
147 | - break; |
|
148 | - default: |
|
149 | - $blogs_obj = $blogHandler->getAll($criteria, $tags); |
|
150 | - $count_blog = $blogHandler->getCount($criteria); |
|
151 | - break; |
|
140 | + case 'category': |
|
141 | + $blogs_obj = $blogHandler->getByCategory($criteria, $tags); |
|
142 | + $count_blog = $blogHandler->getCountByCategory($criteria); |
|
143 | + break; |
|
144 | + case 'bookmark': |
|
145 | + $blogs_obj = $blogHandler->getByBookmark($criteria, $tags); |
|
146 | + $count_blog = $blogHandler->getCountByBookmark($criteria); |
|
147 | + break; |
|
148 | + default: |
|
149 | + $blogs_obj = $blogHandler->getAll($criteria, $tags); |
|
150 | + $count_blog = $blogHandler->getCount($criteria); |
|
151 | + break; |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /* Objects to array */ |
155 | 155 | $blogs = []; |
156 | 156 | foreach (array_keys($blogs_obj) as $id) { |
157 | - $_blog = [ |
|
158 | - 'id' => $id, |
|
159 | - 'title' => $blogs_obj[$id]->getVar('blog_title'), |
|
160 | - 'time' => $blogs_obj[$id]->getTime() |
|
161 | - ]; |
|
162 | - if (empty($list)) { |
|
163 | - $_blog = array_merge($_blog, [ |
|
164 | - 'image' => $blogs_obj[$id]->getImage(), |
|
165 | - 'feed' => $blogs_obj[$id]->getVar('blog_feed'), |
|
166 | - 'link' => $blogs_obj[$id]->getVar('blog_link'), |
|
167 | - 'desc' => $blogs_obj[$id]->getVar('blog_desc'), |
|
168 | - 'star' => $blogs_obj[$id]->getStar(), |
|
169 | - 'rates' => $blogs_obj[$id]->getVar('blog_rates'), |
|
170 | - 'marks' => $blogs_obj[$id]->getVar('blog_marks') |
|
171 | - ]); |
|
172 | - } |
|
173 | - $blogs[] = $_blog; |
|
174 | - unset($_blog); |
|
157 | + $_blog = [ |
|
158 | + 'id' => $id, |
|
159 | + 'title' => $blogs_obj[$id]->getVar('blog_title'), |
|
160 | + 'time' => $blogs_obj[$id]->getTime() |
|
161 | + ]; |
|
162 | + if (empty($list)) { |
|
163 | + $_blog = array_merge($_blog, [ |
|
164 | + 'image' => $blogs_obj[$id]->getImage(), |
|
165 | + 'feed' => $blogs_obj[$id]->getVar('blog_feed'), |
|
166 | + 'link' => $blogs_obj[$id]->getVar('blog_link'), |
|
167 | + 'desc' => $blogs_obj[$id]->getVar('blog_desc'), |
|
168 | + 'star' => $blogs_obj[$id]->getStar(), |
|
169 | + 'rates' => $blogs_obj[$id]->getVar('blog_rates'), |
|
170 | + 'marks' => $blogs_obj[$id]->getVar('blog_marks') |
|
171 | + ]); |
|
172 | + } |
|
173 | + $blogs[] = $_blog; |
|
174 | + unset($_blog); |
|
175 | 175 | } |
176 | 176 | unset($blogs_obj); |
177 | 177 | |
178 | 178 | if ($count_blog > $limit) { |
179 | - include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
180 | - $start_link = []; |
|
181 | - if ($sort) { |
|
182 | - $start_link[] = 'sort=' . $sort; |
|
183 | - } |
|
184 | - if ($category_id) { |
|
185 | - $start_link[] = 'category=' . $category_id; |
|
186 | - } |
|
187 | - if ($list) { |
|
188 | - $start_link[] = 'list=' . $list; |
|
189 | - } |
|
190 | - $nav = new \XoopsPageNav($count_blog, $limit, $start, 'start', implode('&', $start_link)); |
|
191 | - $pagenav = $nav->renderNav(4); |
|
179 | + include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
180 | + $start_link = []; |
|
181 | + if ($sort) { |
|
182 | + $start_link[] = 'sort=' . $sort; |
|
183 | + } |
|
184 | + if ($category_id) { |
|
185 | + $start_link[] = 'category=' . $category_id; |
|
186 | + } |
|
187 | + if ($list) { |
|
188 | + $start_link[] = 'list=' . $list; |
|
189 | + } |
|
190 | + $nav = new \XoopsPageNav($count_blog, $limit, $start, 'start', implode('&', $start_link)); |
|
191 | + $pagenav = $nav->renderNav(4); |
|
192 | 192 | } else { |
193 | - $pagenav = ''; |
|
193 | + $pagenav = ''; |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | $xoopsTpl->assign('xoops_pagetitle', $xoopsOption['xoops_pagetitle']); |
197 | 197 | $xoopsTpl->assign('link_home', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php" title="' . planet_constant('MD_HOME') . '" target="_self">' . planet_constant('MD_HOME') . '</a>'); |
198 | 198 | |
199 | 199 | if ($category_id || $uid) { |
200 | - $xoopsTpl->assign('link_index', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php" title="' . planet_constant('MD_INDEX') . '" target="_self">' . planet_constant('MD_INDEX') . '</a>'); |
|
200 | + $xoopsTpl->assign('link_index', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php" title="' . planet_constant('MD_INDEX') . '" target="_self">' . planet_constant('MD_INDEX') . '</a>'); |
|
201 | 201 | |
202 | - $link_articles = '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) . '" title="' . planet_constant('MD_ARTICLES') . '">' . planet_constant('MD_ARTICLES') . '</a>'; |
|
203 | - $xoopsTpl->assign('link_articles', $link_articles); |
|
202 | + $link_articles = '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) . '" title="' . planet_constant('MD_ARTICLES') . '">' . planet_constant('MD_ARTICLES') . '</a>'; |
|
203 | + $xoopsTpl->assign('link_articles', $link_articles); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | $link_switch = '<a href="' |
207 | - . XOOPS_URL |
|
208 | - . '/modules/' |
|
209 | - . $GLOBALS['moddirname'] |
|
210 | - . '/view.blogs.php' |
|
211 | - . (empty($category_id) ? '' : '/c' . $category_id) |
|
212 | - . (empty($uid) ? '' : '/u' . $uid) |
|
213 | - . (empty($list) ? '/l1' : '') |
|
214 | - . '" title="' |
|
215 | - . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW')) |
|
216 | - . '">' |
|
217 | - . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW')) |
|
218 | - . '</a>'; |
|
207 | + . XOOPS_URL |
|
208 | + . '/modules/' |
|
209 | + . $GLOBALS['moddirname'] |
|
210 | + . '/view.blogs.php' |
|
211 | + . (empty($category_id) ? '' : '/c' . $category_id) |
|
212 | + . (empty($uid) ? '' : '/u' . $uid) |
|
213 | + . (empty($list) ? '/l1' : '') |
|
214 | + . '" title="' |
|
215 | + . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW')) |
|
216 | + . '">' |
|
217 | + . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW')) |
|
218 | + . '</a>'; |
|
219 | 219 | $xoopsTpl->assign('link_switch', $link_switch); |
220 | 220 | |
221 | 221 | if (empty($uid) && is_object($xoopsUser)) { |
222 | - $xoopsTpl->assign('link_bookmark', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' . URL_DELIMITER . 'u' . $xoopsUser->getVar('uid') . '" title="' . planet_constant('MD_BOOKMARKS') . '" target="_self">' . planet_constant('MD_BOOKMARKS') . '</a>'); |
|
222 | + $xoopsTpl->assign('link_bookmark', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' . URL_DELIMITER . 'u' . $xoopsUser->getVar('uid') . '" title="' . planet_constant('MD_BOOKMARKS') . '" target="_self">' . planet_constant('MD_BOOKMARKS') . '</a>'); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | if (1 == $helper->getConfig('newblog_submit') || is_object($xoopsUser)) { |
226 | - $xoopsTpl->assign('link_submit', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/action.blog.php" title="' . _SUBMIT . '" target="_blank">' . _SUBMIT . '</a>'); |
|
226 | + $xoopsTpl->assign('link_submit', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/action.blog.php" title="' . _SUBMIT . '" target="_blank">' . _SUBMIT . '</a>'); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | $xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name') . '::' . planet_constant('MD_BLOGS')); |
@@ -237,35 +237,35 @@ discard block |
||
237 | 237 | $xoopsTpl->assign('user_level', !is_object($xoopsUser) ? 0 : ($xoopsUser->isAdmin() ? 2 : 1)); |
238 | 238 | if (empty($helper->getConfig('anonymous_rate')) && !is_object($xoopsUser)) { |
239 | 239 | } elseif (!$list) { |
240 | - $xoopsTpl->assign('canrate', 1); |
|
240 | + $xoopsTpl->assign('canrate', 1); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | $sort_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' . URL_DELIMITER; |
244 | 244 | $vars = []; |
245 | 245 | if (!empty($category_id)) { |
246 | - $vars[] = 'c' . $category_id; |
|
246 | + $vars[] = 'c' . $category_id; |
|
247 | 247 | } |
248 | 248 | if (!empty($uid)) { |
249 | - $vars[] = 'u' . $uid; |
|
249 | + $vars[] = 'u' . $uid; |
|
250 | 250 | } |
251 | 251 | if (!empty($list)) { |
252 | - $vars[] = 'li'; |
|
252 | + $vars[] = 'li'; |
|
253 | 253 | } |
254 | 254 | if (!empty($vars)) { |
255 | - $sort_link .= implode('/', $vars) . '/'; |
|
255 | + $sort_link .= implode('/', $vars) . '/'; |
|
256 | 256 | } |
257 | 257 | $sortlinks = []; |
258 | 258 | $valid_sorts = [ |
259 | - 'marks' => planet_constant('MD_BOOKMARKS'), |
|
260 | - 'rating' => planet_constant('MD_RATING'), |
|
261 | - 'time' => planet_constant('MD_TIME'), |
|
262 | - 'default' => planet_constant('MD_DEFAULT') |
|
259 | + 'marks' => planet_constant('MD_BOOKMARKS'), |
|
260 | + 'rating' => planet_constant('MD_RATING'), |
|
261 | + 'time' => planet_constant('MD_TIME'), |
|
262 | + 'default' => planet_constant('MD_DEFAULT') |
|
263 | 263 | ]; |
264 | 264 | foreach ($valid_sorts as $val => $name) { |
265 | - if ($val == $sort) { |
|
266 | - continue; |
|
267 | - } |
|
268 | - $sortlinks[] = '<a href="' . $sort_link . $val . '">' . $name . '</a>'; |
|
265 | + if ($val == $sort) { |
|
266 | + continue; |
|
267 | + } |
|
268 | + $sortlinks[] = '<a href="' . $sort_link . $val . '">' . $name . '</a>'; |
|
269 | 269 | } |
270 | 270 | $xoopsTpl->assign('link_sort', implode(' | ', $sortlinks)); |
271 | 271 |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | /** @var Planet\Helper $helper */ |
30 | 30 | $helper = Planet\Helper::getInstance(); |
31 | 31 | |
32 | -include __DIR__ . '/header.php'; |
|
32 | +include __DIR__.'/header.php'; |
|
33 | 33 | |
34 | 34 | if (preg_match("/\/notification_update\.php/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) { |
35 | - include XOOPS_ROOT_PATH . '/include/notification_update.php'; |
|
35 | + include XOOPS_ROOT_PATH.'/include/notification_update.php'; |
|
36 | 36 | exit(); |
37 | 37 | } |
38 | 38 | |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | } |
70 | 70 | */ |
71 | 71 | |
72 | -$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name') . ' - ' . planet_constant('MD_BLOGS'); |
|
72 | +$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name').' - '.planet_constant('MD_BLOGS'); |
|
73 | 73 | $xoopsOption['template_main'] = PlanetUtility::planetGetTemplate('blogs'); |
74 | -require_once XOOPS_ROOT_PATH . '/header.php'; |
|
75 | -include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
74 | +require_once XOOPS_ROOT_PATH.'/header.php'; |
|
75 | +include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
76 | 76 | |
77 | 77 | // Following part will not be executed after cache |
78 | 78 | $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $criteria = new \CriteriaCompo(); |
85 | 85 | $blog_prefix = ''; |
86 | 86 | /* Specific category */ |
87 | -if ($category_id > 0) { |
|
87 | +if ($category_id>0) { |
|
88 | 88 | $category_obj = $categoryHandler->get($category_id); |
89 | 89 | $criteria->add(new \Criteria('bc.cat_id', $category_id)); |
90 | 90 | $uid = 0; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | /* User bookmarks(favorites) */ |
98 | -if ($uid > 0) { |
|
98 | +if ($uid>0) { |
|
99 | 99 | $criteria->add(new \Criteria('bm.bm_uid', $uid)); |
100 | 100 | $category_id = 0; |
101 | 101 | $blog_id = 0; |
@@ -109,25 +109,25 @@ discard block |
||
109 | 109 | $blog_prefix = 'b.'; |
110 | 110 | } |
111 | 111 | |
112 | -$criteria->add(new \Criteria($blog_prefix . 'blog_status', 0, '>')); |
|
112 | +$criteria->add(new \Criteria($blog_prefix.'blog_status', 0, '>')); |
|
113 | 113 | |
114 | 114 | /* Sort */ |
115 | 115 | $order = 'DESC'; |
116 | 116 | $sort = empty($sort) ? 'default' : $sort; |
117 | 117 | switch ($sort) { |
118 | 118 | case 'marks': |
119 | - $sortby = $blog_prefix . 'blog_marks'; |
|
119 | + $sortby = $blog_prefix.'blog_marks'; |
|
120 | 120 | break; |
121 | 121 | case 'rating': |
122 | - $sortby = $blog_prefix . 'blog_rating'; |
|
122 | + $sortby = $blog_prefix.'blog_rating'; |
|
123 | 123 | break; |
124 | 124 | case 'time': |
125 | - $sortby = $blog_prefix . 'blog_time'; |
|
125 | + $sortby = $blog_prefix.'blog_time'; |
|
126 | 126 | break; |
127 | 127 | case 'default': |
128 | 128 | default: |
129 | 129 | $sort = 'default'; |
130 | - $sortby = $blog_prefix . 'blog_id'; |
|
130 | + $sortby = $blog_prefix.'blog_id'; |
|
131 | 131 | break; |
132 | 132 | } |
133 | 133 | $criteria->setSort($sortby); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $criteria->setStart($start); |
136 | 136 | $criteria->setLimit($limit); |
137 | 137 | |
138 | -$tags = empty($list) ? '' : [$blog_prefix . 'blog_title', $blog_prefix . 'blog_time']; |
|
138 | +$tags = empty($list) ? '' : [$blog_prefix.'blog_title', $blog_prefix.'blog_time']; |
|
139 | 139 | switch ($query_type) { |
140 | 140 | case 'category': |
141 | 141 | $blogs_obj = $blogHandler->getByCategory($criteria, $tags); |
@@ -175,31 +175,31 @@ discard block |
||
175 | 175 | } |
176 | 176 | unset($blogs_obj); |
177 | 177 | |
178 | -if ($count_blog > $limit) { |
|
179 | - include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
178 | +if ($count_blog>$limit) { |
|
179 | + include XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
180 | 180 | $start_link = []; |
181 | 181 | if ($sort) { |
182 | - $start_link[] = 'sort=' . $sort; |
|
182 | + $start_link[] = 'sort='.$sort; |
|
183 | 183 | } |
184 | 184 | if ($category_id) { |
185 | - $start_link[] = 'category=' . $category_id; |
|
185 | + $start_link[] = 'category='.$category_id; |
|
186 | 186 | } |
187 | 187 | if ($list) { |
188 | - $start_link[] = 'list=' . $list; |
|
188 | + $start_link[] = 'list='.$list; |
|
189 | 189 | } |
190 | 190 | $nav = new \XoopsPageNav($count_blog, $limit, $start, 'start', implode('&', $start_link)); |
191 | 191 | $pagenav = $nav->renderNav(4); |
192 | -} else { |
|
192 | +}else { |
|
193 | 193 | $pagenav = ''; |
194 | 194 | } |
195 | 195 | |
196 | 196 | $xoopsTpl->assign('xoops_pagetitle', $xoopsOption['xoops_pagetitle']); |
197 | -$xoopsTpl->assign('link_home', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php" title="' . planet_constant('MD_HOME') . '" target="_self">' . planet_constant('MD_HOME') . '</a>'); |
|
197 | +$xoopsTpl->assign('link_home', '<a href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php" title="'.planet_constant('MD_HOME').'" target="_self">'.planet_constant('MD_HOME').'</a>'); |
|
198 | 198 | |
199 | 199 | if ($category_id || $uid) { |
200 | - $xoopsTpl->assign('link_index', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php" title="' . planet_constant('MD_INDEX') . '" target="_self">' . planet_constant('MD_INDEX') . '</a>'); |
|
200 | + $xoopsTpl->assign('link_index', '<a href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.blogs.php" title="'.planet_constant('MD_INDEX').'" target="_self">'.planet_constant('MD_INDEX').'</a>'); |
|
201 | 201 | |
202 | - $link_articles = '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) . '" title="' . planet_constant('MD_ARTICLES') . '">' . planet_constant('MD_ARTICLES') . '</a>'; |
|
202 | + $link_articles = '<a href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.(empty($category_id) ? '' : '/c'.$category_id).(empty($uid) ? '' : '/u'.$uid).'" title="'.planet_constant('MD_ARTICLES').'">'.planet_constant('MD_ARTICLES').'</a>'; |
|
203 | 203 | $xoopsTpl->assign('link_articles', $link_articles); |
204 | 204 | } |
205 | 205 | |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | . '/modules/' |
209 | 209 | . $GLOBALS['moddirname'] |
210 | 210 | . '/view.blogs.php' |
211 | - . (empty($category_id) ? '' : '/c' . $category_id) |
|
212 | - . (empty($uid) ? '' : '/u' . $uid) |
|
211 | + . (empty($category_id) ? '' : '/c'.$category_id) |
|
212 | + . (empty($uid) ? '' : '/u'.$uid) |
|
213 | 213 | . (empty($list) ? '/l1' : '') |
214 | 214 | . '" title="' |
215 | 215 | . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW')) |
@@ -219,14 +219,14 @@ discard block |
||
219 | 219 | $xoopsTpl->assign('link_switch', $link_switch); |
220 | 220 | |
221 | 221 | if (empty($uid) && is_object($xoopsUser)) { |
222 | - $xoopsTpl->assign('link_bookmark', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' . URL_DELIMITER . 'u' . $xoopsUser->getVar('uid') . '" title="' . planet_constant('MD_BOOKMARKS') . '" target="_self">' . planet_constant('MD_BOOKMARKS') . '</a>'); |
|
222 | + $xoopsTpl->assign('link_bookmark', '<a href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.blogs.php'.URL_DELIMITER.'u'.$xoopsUser->getVar('uid').'" title="'.planet_constant('MD_BOOKMARKS').'" target="_self">'.planet_constant('MD_BOOKMARKS').'</a>'); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | if (1 == $helper->getConfig('newblog_submit') || is_object($xoopsUser)) { |
226 | - $xoopsTpl->assign('link_submit', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/action.blog.php" title="' . _SUBMIT . '" target="_blank">' . _SUBMIT . '</a>'); |
|
226 | + $xoopsTpl->assign('link_submit', '<a href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/action.blog.php" title="'._SUBMIT.'" target="_blank">'._SUBMIT.'</a>'); |
|
227 | 227 | } |
228 | 228 | |
229 | -$xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name') . '::' . planet_constant('MD_BLOGS')); |
|
229 | +$xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name').'::'.planet_constant('MD_BLOGS')); |
|
230 | 230 | $xoopsTpl->assign('category', @$category_data); |
231 | 231 | $xoopsTpl->assign('user', @$user_data); |
232 | 232 | $xoopsTpl->assign('blogs', $blogs); |
@@ -240,19 +240,19 @@ discard block |
||
240 | 240 | $xoopsTpl->assign('canrate', 1); |
241 | 241 | } |
242 | 242 | |
243 | -$sort_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' . URL_DELIMITER; |
|
243 | +$sort_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.blogs.php'.URL_DELIMITER; |
|
244 | 244 | $vars = []; |
245 | 245 | if (!empty($category_id)) { |
246 | - $vars[] = 'c' . $category_id; |
|
246 | + $vars[] = 'c'.$category_id; |
|
247 | 247 | } |
248 | 248 | if (!empty($uid)) { |
249 | - $vars[] = 'u' . $uid; |
|
249 | + $vars[] = 'u'.$uid; |
|
250 | 250 | } |
251 | 251 | if (!empty($list)) { |
252 | 252 | $vars[] = 'li'; |
253 | 253 | } |
254 | 254 | if (!empty($vars)) { |
255 | - $sort_link .= implode('/', $vars) . '/'; |
|
255 | + $sort_link .= implode('/', $vars).'/'; |
|
256 | 256 | } |
257 | 257 | $sortlinks = []; |
258 | 258 | $valid_sorts = [ |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | if ($val == $sort) { |
266 | 266 | continue; |
267 | 267 | } |
268 | - $sortlinks[] = '<a href="' . $sort_link . $val . '">' . $name . '</a>'; |
|
268 | + $sortlinks[] = '<a href="'.$sort_link.$val.'">'.$name.'</a>'; |
|
269 | 269 | } |
270 | 270 | $xoopsTpl->assign('link_sort', implode(' | ', $sortlinks)); |
271 | 271 | |
272 | -require_once __DIR__ . '/footer.php'; |
|
272 | +require_once __DIR__.'/footer.php'; |