Completed
Push — master ( a50592...10bab4 )
by Michael
01:56
created
include/action.module.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 
28 28
 // defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
29 29
 
30
-include __DIR__ . '/vars.php';
30
+include __DIR__.'/vars.php';
31 31
 //mod_loadFunctions('', $GLOBALS['moddirname']);
32 32
 
33 33
 PlanetUtility::planetParseFunction('
Please login to merge, or discard this patch.
view.article.php 2 patches
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.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 // ------------------------------------------------------------------------ //
27 27
 use Xmf\Request;
28 28
 
29
-include __DIR__ . '/header.php';
29
+include __DIR__.'/header.php';
30 30
 
31 31
 /**
32 32
  * The comment detection scripts should be removed once absolute url is used in comment_view.php
@@ -34,11 +34,11 @@  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]);
37
+    header('location: '.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].$matches[1]);
38 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';
41
+    include XOOPS_ROOT_PATH.'/include/notification_update.php';
42 42
     exit();
43 43
 }
44 44
 
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
     $args['blog']    = @$args['blog'];
48 48
 }
49 49
 
50
-$article_id = Request::getInt('article', @$args['article'], 'POST');//(int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']);
51
-$blog_id    = Request::getInt('blog', @$args['blog'], 'POST');//(int)(empty($_GET['blog']) ? @$args['blog'] : $_GET['blog']);
50
+$article_id = Request::getInt('article', @$args['article'], 'POST'); //(int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']);
51
+$blog_id    = Request::getInt('blog', @$args['blog'], 'POST'); //(int)(empty($_GET['blog']) ? @$args['blog'] : $_GET['blog']);
52 52
 
53 53
 $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']);
54 54
 $blogHandler    = xoops_getModuleHandler('blog', $GLOBALS['moddirname']);
@@ -57,13 +57,13 @@  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
-$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name') . ' - ' . $article_obj->getVar('art_title');
63
+$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name').' - '.$article_obj->getVar('art_title');
64 64
 $xoopsOption['template_main']   = PlanetUtility::planetGetTemplate('article');
65
-require_once XOOPS_ROOT_PATH . '/header.php';
66
-include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
65
+require_once XOOPS_ROOT_PATH.'/header.php';
66
+include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
67 67
 
68 68
 $article_data = [
69 69
     'id'       => $article_id,
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 if (!empty($xoopsModuleConfig['do_sibling'])) {
83 83
     $articles_sibling = $articleHandler->getSibling($article_obj, $blog_id);
84 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;
85
+        $articles_sibling['previous']['url']   = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$articles_sibling['previous']['id'].'/b'.$blog_id;
86 86
         $articles_sibling['previous']['title'] = $articles_sibling['previous']['title'];
87 87
     }
88 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;
89
+        $articles_sibling['next']['url']   = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$articles_sibling['next']['id'].'/b'.$blog_id;
90 90
         $articles_sibling['next']['title'] = $articles_sibling['next']['title'];
91 91
     }
92 92
 }
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 
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
-} else {
101
+}else {
102 102
     $xoopsTpl->assign('canrate', 1);
103 103
 }
104 104
 
105
-if ($transferbar = @include XOOPS_ROOT_PATH . '/Frameworks/transfer/bar.transfer.php') {
105
+if ($transferbar = @include XOOPS_ROOT_PATH.'/Frameworks/transfer/bar.transfer.php') {
106 106
     $xoopsTpl->assign('transfer', $transferbar);
107 107
 }
108 108
 
@@ -112,6 +112,6 @@  discard block
 block discarded – undo
112 112
 // for comment and notification
113 113
 //$_SERVER['REQUEST_URI'] = XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/view.article.php";
114 114
 $_GET['article'] = $article_id;
115
-include XOOPS_ROOT_PATH . '/include/comment_view.php';
115
+include XOOPS_ROOT_PATH.'/include/comment_view.php';
116 116
 
117
-require_once __DIR__ . '/footer.php';
117
+require_once __DIR__.'/footer.php';
Please login to merge, or discard this patch.
action.blog.php 2 patches
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -33,15 +33,15 @@  discard block
 block discarded – undo
33 33
 $blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int)$blog_id;
34 34
 
35 35
 if (empty($xoopsModuleConfig['newblog_submit']) && (!is_object($xoopsUser) || !$xoopsUser->isAdmin())) {
36
-    redirect_header('index.php', 2, _NOPERM);
36
+	redirect_header('index.php', 2, _NOPERM);
37 37
 }
38 38
 
39 39
 if ('save' === $op && !empty(Request::getString('fetch', '', 'POST'))) {//!empty($_POST['fetch'])) {
40
-    $op = 'edit';
40
+	$op = 'edit';
41 41
 }
42 42
 
43 43
 if ('save' === $op && !$GLOBALS['xoopsSecurity']->check()) {
44
-    redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID') . ': security check failed');
44
+	redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID') . ': security check failed');
45 45
 }
46 46
 include XOOPS_ROOT_PATH . '/header.php';
47 47
 include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
@@ -50,110 +50,110 @@  discard block
 block discarded – undo
50 50
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
51 51
 
52 52
 switch ($op) {
53
-    /* save a single blog */
54
-    case 'save':
55
-
56
-        if ($blog_id) {
57
-            $blog_obj = $blogHandler->get($blog_id);
58
-            if ($xoopsUser->isAdmin()) {
59
-                $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST'));// @$_POST['blog_status']);
60
-            }
61
-        } else {
62
-            if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', $myts->addSlashes(trim(Request::getText('blog_feed', '', 'POST')))))  //$_POST['blog_feed']))))
63
-            ) {
64
-                redirect_header('index.php', 2, planet_constant('MD_BLOGEXISTS'));
65
-            }
66
-
67
-            $blog_obj = $blogHandler->create();
68
-            $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true));
69
-
70
-            switch ($xoopsModuleConfig['newblog_submit']) {
71
-                case 2:
72
-                    if (!is_object($xoopsUser)) {
73
-                        $status = 0;
74
-                    } else {
75
-                        $status = 1;
76
-                    }
77
-                    break;
78
-                case 0:
79
-                case 3:
80
-                    $status = 1;
81
-                    break;
82
-                case 1:
83
-                default:
84
-                    if (!is_object($xoopsUser) || !$xoopsUser->isAdmin()) {
85
-                        $status = 0;
86
-                    } else {
87
-                        $status = 1;
88
-                    }
89
-                    break;
90
-            }
91
-
92
-            $blog_obj->setVar('blog_status', $status);
93
-        }
94
-
95
-        $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST'));//$_POST['blog_title']);
96
-        $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST'));//$_POST['blog_desc']);
97
-        $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST'));//$_POST['blog_image']);
98
-        $blog_obj->setVar('blog_feed', Request::getText('blog_feed', '', 'POST'));//$_POST['blog_feed']);
99
-        $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST'));//$_POST['blog_link']);
100
-        $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST'));//$_POST['blog_language']);
101
-        $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST'));//$_POST['blog_charset']);
102
-        $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST'));//$_POST['blog_trackback']);
103
-        if ($blog_obj->isNew()) {
104
-            $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true));
105
-        }
106
-
107
-        if (!$blogHandler->insert($blog_obj)) {
108
-        } elseif (0 !== count(Request::getArray('categories', [], 'POST'))) {
109
-            $blog_id = $blog_obj->getVar('blog_id');
110
-            if (in_array(0, $_POST['categories'])) {
111
-                $_POST['categories'] = [];
112
-            }
113
-            $blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST'));//$_POST['categories']);
114
-        }
115
-        $message = planet_constant('MD_DBUPDATED');
116
-        redirect_header('index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message);
117
-
118
-    /* edit a single blog */
119
-    // no break
120
-    case 'edit':
121
-    default:
122
-        if (!empty(Request::getString('fetch', '', 'POST'))) {
123
-            $blog_obj = $blogHandler->fetch(Request::getText('blog_feed', '', 'POST'));
124
-            $blog_obj->setVar('blog_id', $blog_id);
125
-        } else {
126
-            $blog_obj = $blogHandler->get($blog_id);
127
-        }
128
-        $categories = Request::getArray('categories', [], 'POST');//isset($_POST['categories']) ? $_POST['categories'] : array();
129
-        if (in_array('-1', $categories)) {
130
-            $categories = [];
131
-        }
132
-        if (empty($categories) && $blog_id > 0) {
133
-            $crit       = new Criteria('bc.blog_id', $blog_id);
134
-            $categories = array_keys($categoryHandler->getByBlog($crit));
135
-        }
136
-        if (empty($categories)) {
137
-            $categories = [0 => _NONE];
138
-        }
139
-
140
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
141
-        echo '<br>';
142
-        if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
143
-            $criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
144
-            $blogs_obj = $blogHandler->getList($criteria);
145
-            if (count($blogs_obj) > 0) {
146
-                echo "<div class=\"errorMsg\">" . planet_constant('MD_BLOGEXISTS');
147
-                foreach (array_keys($blogs_obj) as $bid) {
148
-                    echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>';
149
-                }
150
-                echo '</div>';
151
-                unset($blogs_obj, $criteria);
152
-            }
153
-        }
154
-        include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
155
-        echo '</fieldset>';
156
-        break;
53
+	/* save a single blog */
54
+	case 'save':
55
+
56
+		if ($blog_id) {
57
+			$blog_obj = $blogHandler->get($blog_id);
58
+			if ($xoopsUser->isAdmin()) {
59
+				$blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST'));// @$_POST['blog_status']);
60
+			}
61
+		} else {
62
+			if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', $myts->addSlashes(trim(Request::getText('blog_feed', '', 'POST')))))  //$_POST['blog_feed']))))
63
+			) {
64
+				redirect_header('index.php', 2, planet_constant('MD_BLOGEXISTS'));
65
+			}
66
+
67
+			$blog_obj = $blogHandler->create();
68
+			$blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true));
69
+
70
+			switch ($xoopsModuleConfig['newblog_submit']) {
71
+				case 2:
72
+					if (!is_object($xoopsUser)) {
73
+						$status = 0;
74
+					} else {
75
+						$status = 1;
76
+					}
77
+					break;
78
+				case 0:
79
+				case 3:
80
+					$status = 1;
81
+					break;
82
+				case 1:
83
+				default:
84
+					if (!is_object($xoopsUser) || !$xoopsUser->isAdmin()) {
85
+						$status = 0;
86
+					} else {
87
+						$status = 1;
88
+					}
89
+					break;
90
+			}
91
+
92
+			$blog_obj->setVar('blog_status', $status);
93
+		}
94
+
95
+		$blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST'));//$_POST['blog_title']);
96
+		$blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST'));//$_POST['blog_desc']);
97
+		$blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST'));//$_POST['blog_image']);
98
+		$blog_obj->setVar('blog_feed', Request::getText('blog_feed', '', 'POST'));//$_POST['blog_feed']);
99
+		$blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST'));//$_POST['blog_link']);
100
+		$blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST'));//$_POST['blog_language']);
101
+		$blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST'));//$_POST['blog_charset']);
102
+		$blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST'));//$_POST['blog_trackback']);
103
+		if ($blog_obj->isNew()) {
104
+			$blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true));
105
+		}
106
+
107
+		if (!$blogHandler->insert($blog_obj)) {
108
+		} elseif (0 !== count(Request::getArray('categories', [], 'POST'))) {
109
+			$blog_id = $blog_obj->getVar('blog_id');
110
+			if (in_array(0, $_POST['categories'])) {
111
+				$_POST['categories'] = [];
112
+			}
113
+			$blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST'));//$_POST['categories']);
114
+		}
115
+		$message = planet_constant('MD_DBUPDATED');
116
+		redirect_header('index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message);
117
+
118
+	/* edit a single blog */
119
+	// no break
120
+	case 'edit':
121
+	default:
122
+		if (!empty(Request::getString('fetch', '', 'POST'))) {
123
+			$blog_obj = $blogHandler->fetch(Request::getText('blog_feed', '', 'POST'));
124
+			$blog_obj->setVar('blog_id', $blog_id);
125
+		} else {
126
+			$blog_obj = $blogHandler->get($blog_id);
127
+		}
128
+		$categories = Request::getArray('categories', [], 'POST');//isset($_POST['categories']) ? $_POST['categories'] : array();
129
+		if (in_array('-1', $categories)) {
130
+			$categories = [];
131
+		}
132
+		if (empty($categories) && $blog_id > 0) {
133
+			$crit       = new Criteria('bc.blog_id', $blog_id);
134
+			$categories = array_keys($categoryHandler->getByBlog($crit));
135
+		}
136
+		if (empty($categories)) {
137
+			$categories = [0 => _NONE];
138
+		}
139
+
140
+		echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
141
+		echo '<br>';
142
+		if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
143
+			$criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
144
+			$blogs_obj = $blogHandler->getList($criteria);
145
+			if (count($blogs_obj) > 0) {
146
+				echo "<div class=\"errorMsg\">" . planet_constant('MD_BLOGEXISTS');
147
+				foreach (array_keys($blogs_obj) as $bid) {
148
+					echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>';
149
+				}
150
+				echo '</div>';
151
+				unset($blogs_obj, $criteria);
152
+			}
153
+		}
154
+		include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
155
+		echo '</fieldset>';
156
+		break;
157 157
 }
158 158
 
159 159
 include XOOPS_ROOT_PATH . '/footer.php';
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 // ------------------------------------------------------------------------ //
27 27
 use Xmf\Request;
28 28
 
29
-include __DIR__ . '/header.php';
29
+include __DIR__.'/header.php';
30 30
 
31
-$op      = Request::getString('op', Request::getString('op', '', 'POST'), 'GET');//!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : '');
32
-$blog_id = Request::getArray('blog', Request::getArray('blog', [], 'POST'), 'GET');//!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0);
33
-$blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int)$blog_id;
31
+$op      = Request::getString('op', Request::getString('op', '', 'POST'), 'GET'); //!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : '');
32
+$blog_id = Request::getArray('blog', Request::getArray('blog', [], 'POST'), 'GET'); //!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0);
33
+$blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int) $blog_id;
34 34
 
35 35
 if (empty($xoopsModuleConfig['newblog_submit']) && (!is_object($xoopsUser) || !$xoopsUser->isAdmin())) {
36 36
     redirect_header('index.php', 2, _NOPERM);
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 }
42 42
 
43 43
 if ('save' === $op && !$GLOBALS['xoopsSecurity']->check()) {
44
-    redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID') . ': security check failed');
44
+    redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID').': security check failed');
45 45
 }
46
-include XOOPS_ROOT_PATH . '/header.php';
47
-include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
46
+include XOOPS_ROOT_PATH.'/header.php';
47
+include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
48 48
 
49 49
 $blogHandler     = xoops_getModuleHandler('blog', $GLOBALS['moddirname']);
50 50
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
         if ($blog_id) {
57 57
             $blog_obj = $blogHandler->get($blog_id);
58 58
             if ($xoopsUser->isAdmin()) {
59
-                $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST'));// @$_POST['blog_status']);
59
+                $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); // @$_POST['blog_status']);
60 60
             }
61
-        } else {
61
+        }else {
62 62
             if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', $myts->addSlashes(trim(Request::getText('blog_feed', '', 'POST')))))  //$_POST['blog_feed']))))
63 63
             ) {
64 64
                 redirect_header('index.php', 2, planet_constant('MD_BLOGEXISTS'));
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
                 case 2:
72 72
                     if (!is_object($xoopsUser)) {
73 73
                         $status = 0;
74
-                    } else {
74
+                    }else {
75 75
                         $status = 1;
76 76
                     }
77 77
                     break;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                 default:
84 84
                     if (!is_object($xoopsUser) || !$xoopsUser->isAdmin()) {
85 85
                         $status = 0;
86
-                    } else {
86
+                    }else {
87 87
                         $status = 1;
88 88
                     }
89 89
                     break;
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
             $blog_obj->setVar('blog_status', $status);
93 93
         }
94 94
 
95
-        $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST'));//$_POST['blog_title']);
96
-        $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST'));//$_POST['blog_desc']);
97
-        $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST'));//$_POST['blog_image']);
98
-        $blog_obj->setVar('blog_feed', Request::getText('blog_feed', '', 'POST'));//$_POST['blog_feed']);
99
-        $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST'));//$_POST['blog_link']);
100
-        $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST'));//$_POST['blog_language']);
101
-        $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST'));//$_POST['blog_charset']);
102
-        $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST'));//$_POST['blog_trackback']);
95
+        $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']);
96
+        $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']);
97
+        $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']);
98
+        $blog_obj->setVar('blog_feed', Request::getText('blog_feed', '', 'POST')); //$_POST['blog_feed']);
99
+        $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']);
100
+        $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']);
101
+        $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']);
102
+        $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']);
103 103
         if ($blog_obj->isNew()) {
104 104
             $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true));
105 105
         }
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
             if (in_array(0, $_POST['categories'])) {
111 111
                 $_POST['categories'] = [];
112 112
             }
113
-            $blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST'));//$_POST['categories']);
113
+            $blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST')); //$_POST['categories']);
114 114
         }
115 115
         $message = planet_constant('MD_DBUPDATED');
116
-        redirect_header('index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message);
116
+        redirect_header('index.php'.URL_DELIMITER.'b'.$blog_id, 2, $message);
117 117
 
118 118
     /* edit a single blog */
119 119
     // no break
@@ -122,14 +122,14 @@  discard block
 block discarded – undo
122 122
         if (!empty(Request::getString('fetch', '', 'POST'))) {
123 123
             $blog_obj = $blogHandler->fetch(Request::getText('blog_feed', '', 'POST'));
124 124
             $blog_obj->setVar('blog_id', $blog_id);
125
-        } else {
125
+        }else {
126 126
             $blog_obj = $blogHandler->get($blog_id);
127 127
         }
128
-        $categories = Request::getArray('categories', [], 'POST');//isset($_POST['categories']) ? $_POST['categories'] : array();
128
+        $categories = Request::getArray('categories', [], 'POST'); //isset($_POST['categories']) ? $_POST['categories'] : array();
129 129
         if (in_array('-1', $categories)) {
130 130
             $categories = [];
131 131
         }
132
-        if (empty($categories) && $blog_id > 0) {
132
+        if (empty($categories) && $blog_id>0) {
133 133
             $crit       = new Criteria('bc.blog_id', $blog_id);
134 134
             $categories = array_keys($categoryHandler->getByBlog($crit));
135 135
         }
@@ -137,23 +137,23 @@  discard block
 block discarded – undo
137 137
             $categories = [0 => _NONE];
138 138
         }
139 139
 
140
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
140
+        echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._EDIT.'</legend>';
141 141
         echo '<br>';
142 142
         if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
143 143
             $criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
144 144
             $blogs_obj = $blogHandler->getList($criteria);
145
-            if (count($blogs_obj) > 0) {
146
-                echo "<div class=\"errorMsg\">" . planet_constant('MD_BLOGEXISTS');
145
+            if (count($blogs_obj)>0) {
146
+                echo "<div class=\"errorMsg\">".planet_constant('MD_BLOGEXISTS');
147 147
                 foreach (array_keys($blogs_obj) as $bid) {
148
-                    echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>';
148
+                    echo "<br><a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$bid."\" target=\"_blank\">".$blogs_obj[$bid].'</a>';
149 149
                 }
150 150
                 echo '</div>';
151 151
                 unset($blogs_obj, $criteria);
152 152
             }
153 153
         }
154
-        include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
154
+        include XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/form.blog.php';
155 155
         echo '</fieldset>';
156 156
         break;
157 157
 }
158 158
 
159
-include XOOPS_ROOT_PATH . '/footer.php';
159
+include XOOPS_ROOT_PATH.'/footer.php';
Please login to merge, or discard this patch.
trackback.php 2 patches
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -38,159 +38,159 @@
 block discarded – undo
38 38
 $charset    = trim(Request::getString('charset', '', 'POST'));//trim($_POST['charset']);
39 39
 
40 40
 if (empty($xoopsModuleConfig['trackback_option'])) {
41
-    PlanetUtility::planetRespondToTrackback(1, 'Trackback is closed');
41
+	PlanetUtility::planetRespondToTrackback(1, 'Trackback is closed');
42 42
 }
43 43
 if (!strlen($title . $url . $blog_name)) {
44
-    PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
44
+	PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
45 45
 }
46 46
 
47 47
 if (!empty($article_id) && !empty($url)) {
48
-    $trackbackHandler = xoops_getModuleHandler('trackback', $GLOBALS['moddirname']);
49
-    $criteria         = new CriteriaCompo(new Criteria('art_id', $article_id));
50
-    $criteria->add(new Criteria('tb_url', $url));
51
-    if ($trackbackHandler->getCount($criteria) > 0) {
52
-        PlanetUtility::planetRespondToTrackback(1, 'We already have a ping from that URI for this article.');
53
-    }
48
+	$trackbackHandler = xoops_getModuleHandler('trackback', $GLOBALS['moddirname']);
49
+	$criteria         = new CriteriaCompo(new Criteria('art_id', $article_id));
50
+	$criteria->add(new Criteria('tb_url', $url));
51
+	if ($trackbackHandler->getCount($criteria) > 0) {
52
+		PlanetUtility::planetRespondToTrackback(1, 'We already have a ping from that URI for this article.');
53
+	}
54 54
 
55
-    $charset   = empty($charset) ? 'utf-8' : $charset;
56
-    $title     = XoopsLocal::convert_encoding($title, _CHARSET, $charset);
57
-    $excerpt   = XoopsLocal::convert_encoding($excerpt, _CHARSET, $charset);
58
-    $blog_name = XoopsLocal::convert_encoding($blog_name, _CHARSET, $charset);
59
-    $tb_status = (int)$xoopsModuleConfig['trackback_option'];
55
+	$charset   = empty($charset) ? 'utf-8' : $charset;
56
+	$title     = XoopsLocal::convert_encoding($title, _CHARSET, $charset);
57
+	$excerpt   = XoopsLocal::convert_encoding($excerpt, _CHARSET, $charset);
58
+	$blog_name = XoopsLocal::convert_encoding($blog_name, _CHARSET, $charset);
59
+	$tb_status = (int)$xoopsModuleConfig['trackback_option'];
60 60
 
61
-    $com_pid    = 0;
62
-    $com_itemid = $article_id;
63
-    $com_rootid = 0;
64
-    $com_title  = $title;
65
-    $com_text   = $excerpt;
66
-    $com_text   .= "\n\n[TRACKBACK]" . _POSTEDBY . ': ';
67
-    if (!empty($url)) {
68
-        $com_text .= '[url=' . $url . ']' . $blog_name . '[/url]';
69
-    } else {
70
-        $com_text .= $blog_name;
71
-    }
72
-    $com_modid = $xoopsModule->getVar('mid');
61
+	$com_pid    = 0;
62
+	$com_itemid = $article_id;
63
+	$com_rootid = 0;
64
+	$com_title  = $title;
65
+	$com_text   = $excerpt;
66
+	$com_text   .= "\n\n[TRACKBACK]" . _POSTEDBY . ': ';
67
+	if (!empty($url)) {
68
+		$com_text .= '[url=' . $url . ']' . $blog_name . '[/url]';
69
+	} else {
70
+		$com_text .= $blog_name;
71
+	}
72
+	$com_modid = $xoopsModule->getVar('mid');
73 73
 
74
-    $commentHandler = xoops_getHandler('comment');
75
-    $comment        = $commentHandler->create();
76
-    $comment->setVar('com_created', time());
77
-    $comment->setVar('com_pid', $com_pid);
78
-    $comment->setVar('com_itemid', $com_itemid);
79
-    $comment->setVar('com_rootid', $com_rootid);
80
-    $comment->setVar('com_ip', xoops_getenv('REMOTE_ADDR'));
81
-    switch ($tb_status) {
82
-        case 2:
83
-            $comment->setVar('com_status', 2);
84
-            $call_approvefunc = true;
85
-            $call_updatefunc  = true;
86
-            $notify_event     = 'comment';
87
-            break;
88
-        case 1:
89
-        default:
90
-            $comment->setVar('com_status', 1);
91
-            $notify_event = 'comment_submit';
92
-            break;
93
-    }
94
-    $comment->setVar('com_uid', 0);
95
-    $com_title = xoops_trim($com_title);
96
-    $com_title = empty($com_title) ? _NOTITLE : $com_title;
97
-    $comment->setVar('com_title', $com_title);
98
-    $comment->setVar('com_text', $com_text);
99
-    $comment->setVar('dohtml', 0);
100
-    $comment->setVar('dosmiley', 0);
101
-    $comment->setVar('doxcode', 1);
102
-    $comment->setVar('doimage', 0);
103
-    $comment->setVar('dobr', 1);
104
-    $comment->setVar('com_icon', '');
105
-    $comment->setVar('com_modified', time());
106
-    $comment->setVar('com_modid', $com_modid);
107
-    if (false != $commentHandler->insert($comment)) {
108
-        $newcid = $comment->getVar('com_id');
74
+	$commentHandler = xoops_getHandler('comment');
75
+	$comment        = $commentHandler->create();
76
+	$comment->setVar('com_created', time());
77
+	$comment->setVar('com_pid', $com_pid);
78
+	$comment->setVar('com_itemid', $com_itemid);
79
+	$comment->setVar('com_rootid', $com_rootid);
80
+	$comment->setVar('com_ip', xoops_getenv('REMOTE_ADDR'));
81
+	switch ($tb_status) {
82
+		case 2:
83
+			$comment->setVar('com_status', 2);
84
+			$call_approvefunc = true;
85
+			$call_updatefunc  = true;
86
+			$notify_event     = 'comment';
87
+			break;
88
+		case 1:
89
+		default:
90
+			$comment->setVar('com_status', 1);
91
+			$notify_event = 'comment_submit';
92
+			break;
93
+	}
94
+	$comment->setVar('com_uid', 0);
95
+	$com_title = xoops_trim($com_title);
96
+	$com_title = empty($com_title) ? _NOTITLE : $com_title;
97
+	$comment->setVar('com_title', $com_title);
98
+	$comment->setVar('com_text', $com_text);
99
+	$comment->setVar('dohtml', 0);
100
+	$comment->setVar('dosmiley', 0);
101
+	$comment->setVar('doxcode', 1);
102
+	$comment->setVar('doimage', 0);
103
+	$comment->setVar('dobr', 1);
104
+	$comment->setVar('com_icon', '');
105
+	$comment->setVar('com_modified', time());
106
+	$comment->setVar('com_modid', $com_modid);
107
+	if (false != $commentHandler->insert($comment)) {
108
+		$newcid = $comment->getVar('com_id');
109 109
 
110
-        // set own id as root id
111
-        $com_rootid = $newcid;
112
-        if (!$commentHandler->updateByField($comment, 'com_rootid', $com_rootid)) {
113
-            $commentHandler->delete($comment);
114
-            PlanetUtility::planetRespondToTrackback(1, xoops_error());
115
-        }
110
+		// set own id as root id
111
+		$com_rootid = $newcid;
112
+		if (!$commentHandler->updateByField($comment, 'com_rootid', $com_rootid)) {
113
+			$commentHandler->delete($comment);
114
+			PlanetUtility::planetRespondToTrackback(1, xoops_error());
115
+		}
116 116
 
117
-        // call custom approve function if any
118
-        if (false != $call_approvefunc && isset($comment_config['callback']['approve'])
119
-            && '' != trim($comment_config['callback']['approve'])) {
120
-            $skip = false;
121
-            if (!function_exists($comment_config['callback']['approve'])) {
122
-                if (isset($comment_config['callbackFile'])) {
123
-                    $callbackfile = trim($comment_config['callbackFile']);
124
-                    if ('' != $callbackfile
125
-                        && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile)) {
126
-                        require_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile;
127
-                    }
128
-                    if (!function_exists($comment_config['callback']['approve'])) {
129
-                        $skip = true;
130
-                    }
131
-                } else {
132
-                    $skip = true;
133
-                }
134
-            }
135
-            if (!$skip) {
136
-                $comment_config['callback']['approve']($comment);
137
-            }
138
-        }
117
+		// call custom approve function if any
118
+		if (false != $call_approvefunc && isset($comment_config['callback']['approve'])
119
+			&& '' != trim($comment_config['callback']['approve'])) {
120
+			$skip = false;
121
+			if (!function_exists($comment_config['callback']['approve'])) {
122
+				if (isset($comment_config['callbackFile'])) {
123
+					$callbackfile = trim($comment_config['callbackFile']);
124
+					if ('' != $callbackfile
125
+						&& file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile)) {
126
+						require_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile;
127
+					}
128
+					if (!function_exists($comment_config['callback']['approve'])) {
129
+						$skip = true;
130
+					}
131
+				} else {
132
+					$skip = true;
133
+				}
134
+			}
135
+			if (!$skip) {
136
+				$comment_config['callback']['approve']($comment);
137
+			}
138
+		}
139 139
 
140
-        // call custom update function if any
141
-        if (false != $call_updatefunc && isset($comment_config['callback']['update'])
142
-            && '' != trim($comment_config['callback']['update'])) {
143
-            $skip = false;
144
-            if (!function_exists($comment_config['callback']['update'])) {
145
-                if (isset($comment_config['callbackFile'])) {
146
-                    $callbackfile = trim($comment_config['callbackFile']);
147
-                    if ('' != $callbackfile
148
-                        && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile)) {
149
-                        require_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile;
150
-                    }
151
-                    if (!function_exists($comment_config['callback']['update'])) {
152
-                        $skip = true;
153
-                    }
154
-                } else {
155
-                    $skip = true;
156
-                }
157
-            }
158
-            if (!$skip) {
159
-                $criteria = new CriteriaCompo(new Criteria('com_modid', $com_modid));
160
-                $criteria->add(new Criteria('com_itemid', $com_itemid));
161
-                $criteria->add(new Criteria('com_status', XOOPS_COMMENT_ACTIVE));
162
-                $comment_count = $commentHandler->getCount($criteria);
163
-                $func          = $comment_config['callback']['update'];
164
-                call_user_func_array($func, [$com_itemid, $comment_count, $comment->getVar('com_id')]);
165
-            }
166
-        }
140
+		// call custom update function if any
141
+		if (false != $call_updatefunc && isset($comment_config['callback']['update'])
142
+			&& '' != trim($comment_config['callback']['update'])) {
143
+			$skip = false;
144
+			if (!function_exists($comment_config['callback']['update'])) {
145
+				if (isset($comment_config['callbackFile'])) {
146
+					$callbackfile = trim($comment_config['callbackFile']);
147
+					if ('' != $callbackfile
148
+						&& file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile)) {
149
+						require_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile;
150
+					}
151
+					if (!function_exists($comment_config['callback']['update'])) {
152
+						$skip = true;
153
+					}
154
+				} else {
155
+					$skip = true;
156
+				}
157
+			}
158
+			if (!$skip) {
159
+				$criteria = new CriteriaCompo(new Criteria('com_modid', $com_modid));
160
+				$criteria->add(new Criteria('com_itemid', $com_itemid));
161
+				$criteria->add(new Criteria('com_status', XOOPS_COMMENT_ACTIVE));
162
+				$comment_count = $commentHandler->getCount($criteria);
163
+				$func          = $comment_config['callback']['update'];
164
+				call_user_func_array($func, [$com_itemid, $comment_count, $comment->getVar('com_id')]);
165
+			}
166
+		}
167 167
 
168
-        // RMV-NOTIFY
169
-        // trigger notification event if necessary
170
-        if ($notify_event) {
171
-            $not_modid = $com_modid;
172
-            //            require_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
173
-            $not_catinfo  = notificationCommentCategoryInfo($not_modid);
174
-            $not_category = $not_catinfo['name'];
175
-            $not_itemid   = $com_itemid;
176
-            $not_event    = $notify_event;
177
-            // Build an ABSOLUTE URL to view the comment.  Make sure we
178
-            // point to a viewable page (i.e. not the system administration
179
-            // module).
180
-            $comment_tags = [];
181
-            $not_module   = $xoopsModule;
182
-            if (!isset($comment_url)) {
183
-                $com_config  = $not_module->getInfo('comments');
184
-                $comment_url = $com_config['pageName'] . '?';
185
-                $comment_url .= $com_config['itemName'];
186
-            }
187
-            $comment_tags['X_COMMENT_URL'] = XOOPS_URL . '/modules/' . $not_module->getVar('dirname') . '/' . $comment_url . '=' . $com_itemid . '&amp;com_id=' . $newcid . '&amp;com_rootid=' . $com_rootid . '&amp;com_mode=' . $com_mode . '&amp;com_order=' . $com_order . '#comment' . $newcid;
188
-            $notificationHandler           = xoops_getHandler('notification');
189
-            $notificationHandler->triggerEvent($not_category, $not_itemid, $not_event, $comment_tags, false, $not_modid);
190
-        }
168
+		// RMV-NOTIFY
169
+		// trigger notification event if necessary
170
+		if ($notify_event) {
171
+			$not_modid = $com_modid;
172
+			//            require_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
173
+			$not_catinfo  = notificationCommentCategoryInfo($not_modid);
174
+			$not_category = $not_catinfo['name'];
175
+			$not_itemid   = $com_itemid;
176
+			$not_event    = $notify_event;
177
+			// Build an ABSOLUTE URL to view the comment.  Make sure we
178
+			// point to a viewable page (i.e. not the system administration
179
+			// module).
180
+			$comment_tags = [];
181
+			$not_module   = $xoopsModule;
182
+			if (!isset($comment_url)) {
183
+				$com_config  = $not_module->getInfo('comments');
184
+				$comment_url = $com_config['pageName'] . '?';
185
+				$comment_url .= $com_config['itemName'];
186
+			}
187
+			$comment_tags['X_COMMENT_URL'] = XOOPS_URL . '/modules/' . $not_module->getVar('dirname') . '/' . $comment_url . '=' . $com_itemid . '&amp;com_id=' . $newcid . '&amp;com_rootid=' . $com_rootid . '&amp;com_mode=' . $com_mode . '&amp;com_order=' . $com_order . '#comment' . $newcid;
188
+			$notificationHandler           = xoops_getHandler('notification');
189
+			$notificationHandler->triggerEvent($not_category, $not_itemid, $not_event, $comment_tags, false, $not_modid);
190
+		}
191 191
 
192
-        PlanetUtility::planetRespondToTrackback(0);
193
-    } else {
194
-        PlanetUtility::planetRespondToTrackback(1, xoops_error($comment->getHtmlErrors()));
195
-    }
192
+		PlanetUtility::planetRespondToTrackback(0);
193
+	} else {
194
+		PlanetUtility::planetRespondToTrackback(1, xoops_error($comment->getHtmlErrors()));
195
+	}
196 196
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -26,21 +26,21 @@  discard block
 block discarded – undo
26 26
 // ------------------------------------------------------------------------ //
27 27
 use Xmf\Request;
28 28
 
29
-include __DIR__ . '/header.php';
29
+include __DIR__.'/header.php';
30 30
 
31 31
 // trackback is done by a POST
32 32
 $art_id     = explode('/', Request::getString('REQUEST_URI', '', 'SERVER'));
33
-$article_id = (int)$art_id[count($art_id) - 1];
34
-$url        = Request::getString('url', '', 'POST');//$_POST['url'];
35
-$title      = Request::getString('title', '', 'POST');//$_POST['title'];
36
-$excerpt    = Request::getString('excerpt', '', 'POST');//$_POST['excerpt'];
37
-$blog_name  = Request::getString('blog_name', '', 'POST');//$_POST['blog_name'];
38
-$charset    = trim(Request::getString('charset', '', 'POST'));//trim($_POST['charset']);
33
+$article_id = (int) $art_id[count($art_id)-1];
34
+$url        = Request::getString('url', '', 'POST'); //$_POST['url'];
35
+$title      = Request::getString('title', '', 'POST'); //$_POST['title'];
36
+$excerpt    = Request::getString('excerpt', '', 'POST'); //$_POST['excerpt'];
37
+$blog_name  = Request::getString('blog_name', '', 'POST'); //$_POST['blog_name'];
38
+$charset    = trim(Request::getString('charset', '', 'POST')); //trim($_POST['charset']);
39 39
 
40 40
 if (empty($xoopsModuleConfig['trackback_option'])) {
41 41
     PlanetUtility::planetRespondToTrackback(1, 'Trackback is closed');
42 42
 }
43
-if (!strlen($title . $url . $blog_name)) {
43
+if (!strlen($title.$url.$blog_name)) {
44 44
     PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
45 45
 }
46 46
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     $trackbackHandler = xoops_getModuleHandler('trackback', $GLOBALS['moddirname']);
49 49
     $criteria         = new CriteriaCompo(new Criteria('art_id', $article_id));
50 50
     $criteria->add(new Criteria('tb_url', $url));
51
-    if ($trackbackHandler->getCount($criteria) > 0) {
51
+    if ($trackbackHandler->getCount($criteria)>0) {
52 52
         PlanetUtility::planetRespondToTrackback(1, 'We already have a ping from that URI for this article.');
53 53
     }
54 54
 
@@ -56,17 +56,17 @@  discard block
 block discarded – undo
56 56
     $title     = XoopsLocal::convert_encoding($title, _CHARSET, $charset);
57 57
     $excerpt   = XoopsLocal::convert_encoding($excerpt, _CHARSET, $charset);
58 58
     $blog_name = XoopsLocal::convert_encoding($blog_name, _CHARSET, $charset);
59
-    $tb_status = (int)$xoopsModuleConfig['trackback_option'];
59
+    $tb_status = (int) $xoopsModuleConfig['trackback_option'];
60 60
 
61 61
     $com_pid    = 0;
62 62
     $com_itemid = $article_id;
63 63
     $com_rootid = 0;
64 64
     $com_title  = $title;
65 65
     $com_text   = $excerpt;
66
-    $com_text   .= "\n\n[TRACKBACK]" . _POSTEDBY . ': ';
66
+    $com_text .= "\n\n[TRACKBACK]"._POSTEDBY.': ';
67 67
     if (!empty($url)) {
68
-        $com_text .= '[url=' . $url . ']' . $blog_name . '[/url]';
69
-    } else {
68
+        $com_text .= '[url='.$url.']'.$blog_name.'[/url]';
69
+    }else {
70 70
         $com_text .= $blog_name;
71 71
     }
72 72
     $com_modid = $xoopsModule->getVar('mid');
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
                 if (isset($comment_config['callbackFile'])) {
123 123
                     $callbackfile = trim($comment_config['callbackFile']);
124 124
                     if ('' != $callbackfile
125
-                        && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile)) {
126
-                        require_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile;
125
+                        && file_exists(XOOPS_ROOT_PATH.'/modules/'.$moddir.'/'.$callbackfile)) {
126
+                        require_once XOOPS_ROOT_PATH.'/modules/'.$moddir.'/'.$callbackfile;
127 127
                     }
128 128
                     if (!function_exists($comment_config['callback']['approve'])) {
129 129
                         $skip = true;
130 130
                     }
131
-                } else {
131
+                }else {
132 132
                     $skip = true;
133 133
                 }
134 134
             }
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
                 if (isset($comment_config['callbackFile'])) {
146 146
                     $callbackfile = trim($comment_config['callbackFile']);
147 147
                     if ('' != $callbackfile
148
-                        && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile)) {
149
-                        require_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile;
148
+                        && file_exists(XOOPS_ROOT_PATH.'/modules/'.$moddir.'/'.$callbackfile)) {
149
+                        require_once XOOPS_ROOT_PATH.'/modules/'.$moddir.'/'.$callbackfile;
150 150
                     }
151 151
                     if (!function_exists($comment_config['callback']['update'])) {
152 152
                         $skip = true;
153 153
                     }
154
-                } else {
154
+                }else {
155 155
                     $skip = true;
156 156
                 }
157 157
             }
@@ -181,16 +181,16 @@  discard block
 block discarded – undo
181 181
             $not_module   = $xoopsModule;
182 182
             if (!isset($comment_url)) {
183 183
                 $com_config  = $not_module->getInfo('comments');
184
-                $comment_url = $com_config['pageName'] . '?';
184
+                $comment_url = $com_config['pageName'].'?';
185 185
                 $comment_url .= $com_config['itemName'];
186 186
             }
187
-            $comment_tags['X_COMMENT_URL'] = XOOPS_URL . '/modules/' . $not_module->getVar('dirname') . '/' . $comment_url . '=' . $com_itemid . '&amp;com_id=' . $newcid . '&amp;com_rootid=' . $com_rootid . '&amp;com_mode=' . $com_mode . '&amp;com_order=' . $com_order . '#comment' . $newcid;
187
+            $comment_tags['X_COMMENT_URL'] = XOOPS_URL.'/modules/'.$not_module->getVar('dirname').'/'.$comment_url.'='.$com_itemid.'&amp;com_id='.$newcid.'&amp;com_rootid='.$com_rootid.'&amp;com_mode='.$com_mode.'&amp;com_order='.$com_order.'#comment'.$newcid;
188 188
             $notificationHandler           = xoops_getHandler('notification');
189 189
             $notificationHandler->triggerEvent($not_category, $not_itemid, $not_event, $comment_tags, false, $not_modid);
190 190
         }
191 191
 
192 192
         PlanetUtility::planetRespondToTrackback(0);
193
-    } else {
193
+    }else {
194 194
         PlanetUtility::planetRespondToTrackback(1, xoops_error($comment->getHtmlErrors()));
195 195
     }
196 196
 }
Please login to merge, or discard this patch.
view.blogs.php 2 patches
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 include __DIR__ . '/header.php';
30 30
 
31 31
 if (preg_match("/\/notification_update\.php/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) {
32
-    include XOOPS_ROOT_PATH . '/include/notification_update.php';
33
-    exit();
32
+	include XOOPS_ROOT_PATH . '/include/notification_update.php';
33
+	exit();
34 34
 }
35 35
 
36 36
 if ($REQUEST_URI_parsed = PlanetUtility::planetParseArguments($args_num, $args, $args_str)) {
37
-    $args['start'] = @$args_num[0];
38
-    $args['sort']  = @$args_str[0];
37
+	$args['start'] = @$args_num[0];
38
+	$args['sort']  = @$args_str[0];
39 39
 }
40 40
 
41 41
 /* Start */
@@ -82,28 +82,28 @@  discard block
 block discarded – undo
82 82
 $blog_prefix = '';
83 83
 /* Specific category */
84 84
 if ($category_id > 0) {
85
-    $category_obj = $categoryHandler->get($category_id);
86
-    $criteria->add(new Criteria('bc.cat_id', $category_id));
87
-    $uid           = 0;
88
-    $blog_id       = 0;
89
-    $category_data = ['id' => $category_id, 'title' => $category_obj->getVar('cat_title')];
90
-    $query_type    = 'category';
91
-    $blog_prefix   = 'b.';
85
+	$category_obj = $categoryHandler->get($category_id);
86
+	$criteria->add(new Criteria('bc.cat_id', $category_id));
87
+	$uid           = 0;
88
+	$blog_id       = 0;
89
+	$category_data = ['id' => $category_id, 'title' => $category_obj->getVar('cat_title')];
90
+	$query_type    = 'category';
91
+	$blog_prefix   = 'b.';
92 92
 }
93 93
 
94 94
 /* User bookmarks(favorites) */
95 95
 if ($uid > 0) {
96
-    $criteria->add(new Criteria('bm.bm_uid', $uid));
97
-    $category_id     = 0;
98
-    $blog_id         = 0;
99
-    $bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']);
100
-    $user_data       = [
101
-        'uid'   => $uid,
102
-        'name'  => XoopsUser::getUnameFromId($uid),
103
-        'marks' => $bookmarkHandler->getCount(new Criteria('bm_uid', $uid))
104
-    ];
105
-    $query_type      = 'bookmark';
106
-    $blog_prefix     = 'b.';
96
+	$criteria->add(new Criteria('bm.bm_uid', $uid));
97
+	$category_id     = 0;
98
+	$blog_id         = 0;
99
+	$bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']);
100
+	$user_data       = [
101
+		'uid'   => $uid,
102
+		'name'  => XoopsUser::getUnameFromId($uid),
103
+		'marks' => $bookmarkHandler->getCount(new Criteria('bm_uid', $uid))
104
+	];
105
+	$query_type      = 'bookmark';
106
+	$blog_prefix     = 'b.';
107 107
 }
108 108
 
109 109
 $criteria->add(new Criteria($blog_prefix . 'blog_status', 0, '>'));
@@ -112,20 +112,20 @@  discard block
 block discarded – undo
112 112
 $order = 'DESC';
113 113
 $sort  = empty($sort) ? 'default' : $sort;
114 114
 switch ($sort) {
115
-    case 'marks':
116
-        $sortby = $blog_prefix . 'blog_marks';
117
-        break;
118
-    case 'rating':
119
-        $sortby = $blog_prefix . 'blog_rating';
120
-        break;
121
-    case 'time':
122
-        $sortby = $blog_prefix . 'blog_time';
123
-        break;
124
-    case 'default':
125
-    default:
126
-        $sort   = 'default';
127
-        $sortby = $blog_prefix . 'blog_id';
128
-        break;
115
+	case 'marks':
116
+		$sortby = $blog_prefix . 'blog_marks';
117
+		break;
118
+	case 'rating':
119
+		$sortby = $blog_prefix . 'blog_rating';
120
+		break;
121
+	case 'time':
122
+		$sortby = $blog_prefix . 'blog_time';
123
+		break;
124
+	case 'default':
125
+	default:
126
+		$sort   = 'default';
127
+		$sortby = $blog_prefix . 'blog_id';
128
+		break;
129 129
 }
130 130
 $criteria->setSort($sortby);
131 131
 $criteria->setOrder($order);
@@ -134,93 +134,93 @@  discard block
 block discarded – undo
134 134
 
135 135
 $tags = empty($list) ? '' : [$blog_prefix . 'blog_title', $blog_prefix . 'blog_time'];
136 136
 switch ($query_type) {
137
-    case 'category':
138
-        $blogs_obj  = $blogHandler->getByCategory($criteria, $tags);
139
-        $count_blog = $blogHandler->getCountByCategory($criteria);
140
-        break;
141
-    case 'bookmark':
142
-        $blogs_obj  = $blogHandler->getByBookmark($criteria, $tags);
143
-        $count_blog = $blogHandler->getCountByBookmark($criteria);
144
-        break;
145
-    default:
146
-        $blogs_obj  = $blogHandler->getAll($criteria, $tags);
147
-        $count_blog = $blogHandler->getCount($criteria);
148
-        break;
137
+	case 'category':
138
+		$blogs_obj  = $blogHandler->getByCategory($criteria, $tags);
139
+		$count_blog = $blogHandler->getCountByCategory($criteria);
140
+		break;
141
+	case 'bookmark':
142
+		$blogs_obj  = $blogHandler->getByBookmark($criteria, $tags);
143
+		$count_blog = $blogHandler->getCountByBookmark($criteria);
144
+		break;
145
+	default:
146
+		$blogs_obj  = $blogHandler->getAll($criteria, $tags);
147
+		$count_blog = $blogHandler->getCount($criteria);
148
+		break;
149 149
 }
150 150
 
151 151
 /* Objects to array */
152 152
 $blogs = [];
153 153
 foreach (array_keys($blogs_obj) as $id) {
154
-    $_blog = [
155
-        'id'    => $id,
156
-        'title' => $blogs_obj[$id]->getVar('blog_title'),
157
-        'time'  => $blogs_obj[$id]->getTime()
158
-    ];
159
-    if (empty($list)) {
160
-        $_blog = array_merge($_blog, [
161
-            'image' => $blogs_obj[$id]->getImage(),
162
-            'feed'  => $blogs_obj[$id]->getVar('blog_feed'),
163
-            'link'  => $blogs_obj[$id]->getVar('blog_link'),
164
-            'desc'  => $blogs_obj[$id]->getVar('blog_desc'),
165
-            'star'  => $blogs_obj[$id]->getStar(),
166
-            'rates' => $blogs_obj[$id]->getVar('blog_rates'),
167
-            'marks' => $blogs_obj[$id]->getVar('blog_marks')
168
-        ]);
169
-    }
170
-    $blogs[] = $_blog;
171
-    unset($_blog);
154
+	$_blog = [
155
+		'id'    => $id,
156
+		'title' => $blogs_obj[$id]->getVar('blog_title'),
157
+		'time'  => $blogs_obj[$id]->getTime()
158
+	];
159
+	if (empty($list)) {
160
+		$_blog = array_merge($_blog, [
161
+			'image' => $blogs_obj[$id]->getImage(),
162
+			'feed'  => $blogs_obj[$id]->getVar('blog_feed'),
163
+			'link'  => $blogs_obj[$id]->getVar('blog_link'),
164
+			'desc'  => $blogs_obj[$id]->getVar('blog_desc'),
165
+			'star'  => $blogs_obj[$id]->getStar(),
166
+			'rates' => $blogs_obj[$id]->getVar('blog_rates'),
167
+			'marks' => $blogs_obj[$id]->getVar('blog_marks')
168
+		]);
169
+	}
170
+	$blogs[] = $_blog;
171
+	unset($_blog);
172 172
 }
173 173
 unset($blogs_obj);
174 174
 
175 175
 if ($count_blog > $limit) {
176
-    include XOOPS_ROOT_PATH . '/class/pagenav.php';
177
-    $start_link = [];
178
-    if ($sort) {
179
-        $start_link[] = 'sort=' . $sort;
180
-    }
181
-    if ($category_id) {
182
-        $start_link[] = 'category=' . $category_id;
183
-    }
184
-    if ($list) {
185
-        $start_link[] = 'list=' . $list;
186
-    }
187
-    $nav     = new XoopsPageNav($count_blog, $limit, $start, 'start', implode('&amp;', $start_link));
188
-    $pagenav = $nav->renderNav(4);
176
+	include XOOPS_ROOT_PATH . '/class/pagenav.php';
177
+	$start_link = [];
178
+	if ($sort) {
179
+		$start_link[] = 'sort=' . $sort;
180
+	}
181
+	if ($category_id) {
182
+		$start_link[] = 'category=' . $category_id;
183
+	}
184
+	if ($list) {
185
+		$start_link[] = 'list=' . $list;
186
+	}
187
+	$nav     = new XoopsPageNav($count_blog, $limit, $start, 'start', implode('&amp;', $start_link));
188
+	$pagenav = $nav->renderNav(4);
189 189
 } else {
190
-    $pagenav = '';
190
+	$pagenav = '';
191 191
 }
192 192
 
193 193
 $xoopsTpl->assign('xoops_pagetitle', $xoopsOption['xoops_pagetitle']);
194 194
 $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>');
195 195
 
196 196
 if ($category_id || $uid) {
197
-    $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>');
197
+	$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>');
198 198
 
199
-    $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>';
200
-    $xoopsTpl->assign('link_articles', $link_articles);
199
+	$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>';
200
+	$xoopsTpl->assign('link_articles', $link_articles);
201 201
 }
202 202
 
203 203
 $link_switch = "<a href=\""
204
-               . XOOPS_URL
205
-               . '/modules/'
206
-               . $GLOBALS['moddirname']
207
-               . '/view.blogs.php'
208
-               . (empty($category_id) ? '' : '/c' . $category_id)
209
-               . (empty($uid) ? '' : '/u' . $uid)
210
-               . (empty($list) ? '/l1' : '')
211
-               . "\" title=\""
212
-               . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
213
-               . "\">"
214
-               . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
215
-               . '</a>';
204
+			   . XOOPS_URL
205
+			   . '/modules/'
206
+			   . $GLOBALS['moddirname']
207
+			   . '/view.blogs.php'
208
+			   . (empty($category_id) ? '' : '/c' . $category_id)
209
+			   . (empty($uid) ? '' : '/u' . $uid)
210
+			   . (empty($list) ? '/l1' : '')
211
+			   . "\" title=\""
212
+			   . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
213
+			   . "\">"
214
+			   . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
215
+			   . '</a>';
216 216
 $xoopsTpl->assign('link_switch', $link_switch);
217 217
 
218 218
 if (empty($uid) && is_object($xoopsUser)) {
219
-    $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>');
219
+	$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>');
220 220
 }
221 221
 
222 222
 if (1 == $xoopsModuleConfig['newblog_submit'] || is_object($xoopsUser)) {
223
-    $xoopsTpl->assign('link_submit', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/action.blog.php\" title=\"" . _SUBMIT . "\" target=\"_blank\">" . _SUBMIT . '</a>');
223
+	$xoopsTpl->assign('link_submit', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/action.blog.php\" title=\"" . _SUBMIT . "\" target=\"_blank\">" . _SUBMIT . '</a>');
224 224
 }
225 225
 
226 226
 $xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name') . '::' . planet_constant('MD_BLOGS'));
@@ -234,35 +234,35 @@  discard block
 block discarded – undo
234 234
 $xoopsTpl->assign('user_level', !is_object($xoopsUser) ? 0 : ($xoopsUser->isAdmin() ? 2 : 1));
235 235
 if (empty($xoopsModuleConfig['anonymous_rate']) && !is_object($xoopsUser)) {
236 236
 } elseif (!$list) {
237
-    $xoopsTpl->assign('canrate', 1);
237
+	$xoopsTpl->assign('canrate', 1);
238 238
 }
239 239
 
240 240
 $sort_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' . URL_DELIMITER;
241 241
 $vars      = [];
242 242
 if (!empty($category_id)) {
243
-    $vars[] = 'c' . $category_id;
243
+	$vars[] = 'c' . $category_id;
244 244
 }
245 245
 if (!empty($uid)) {
246
-    $vars[] = 'u' . $uid;
246
+	$vars[] = 'u' . $uid;
247 247
 }
248 248
 if (!empty($list)) {
249
-    $vars[] = 'li';
249
+	$vars[] = 'li';
250 250
 }
251 251
 if (!empty($vars)) {
252
-    $sort_link .= implode('/', $vars) . '/';
252
+	$sort_link .= implode('/', $vars) . '/';
253 253
 }
254 254
 $sortlinks   = [];
255 255
 $valid_sorts = [
256
-    'marks'   => planet_constant('MD_BOOKMARKS'),
257
-    'rating'  => planet_constant('MD_RATING'),
258
-    'time'    => planet_constant('MD_TIME'),
259
-    'default' => planet_constant('MD_DEFAULT')
256
+	'marks'   => planet_constant('MD_BOOKMARKS'),
257
+	'rating'  => planet_constant('MD_RATING'),
258
+	'time'    => planet_constant('MD_TIME'),
259
+	'default' => planet_constant('MD_DEFAULT')
260 260
 ];
261 261
 foreach ($valid_sorts as $val => $name) {
262
-    if ($val == $sort) {
263
-        continue;
264
-    }
265
-    $sortlinks[] = "<a href=\"" . $sort_link . $val . "\">" . $name . '</a>';
262
+	if ($val == $sort) {
263
+		continue;
264
+	}
265
+	$sortlinks[] = "<a href=\"" . $sort_link . $val . "\">" . $name . '</a>';
266 266
 }
267 267
 $xoopsTpl->assign('link_sort', implode(' | ', $sortlinks));
268 268
 
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
 // ------------------------------------------------------------------------ //
27 27
 use Xmf\Request;
28 28
 
29
-include __DIR__ . '/header.php';
29
+include __DIR__.'/header.php';
30 30
 
31 31
 if (preg_match("/\/notification_update\.php/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) {
32
-    include XOOPS_ROOT_PATH . '/include/notification_update.php';
32
+    include XOOPS_ROOT_PATH.'/include/notification_update.php';
33 33
     exit();
34 34
 }
35 35
 
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
 }
67 67
 */
68 68
 
69
-$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name') . ' - ' . planet_constant('MD_BLOGS');
69
+$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name').' - '.planet_constant('MD_BLOGS');
70 70
 $xoopsOption['template_main']   = PlanetUtility::planetGetTemplate('blogs');
71
-require_once XOOPS_ROOT_PATH . '/header.php';
72
-include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
71
+require_once XOOPS_ROOT_PATH.'/header.php';
72
+include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
73 73
 
74 74
 // Following part will not be executed after cache
75 75
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 $criteria    = new CriteriaCompo();
82 82
 $blog_prefix = '';
83 83
 /* Specific category */
84
-if ($category_id > 0) {
84
+if ($category_id>0) {
85 85
     $category_obj = $categoryHandler->get($category_id);
86 86
     $criteria->add(new Criteria('bc.cat_id', $category_id));
87 87
     $uid           = 0;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 }
93 93
 
94 94
 /* User bookmarks(favorites) */
95
-if ($uid > 0) {
95
+if ($uid>0) {
96 96
     $criteria->add(new Criteria('bm.bm_uid', $uid));
97 97
     $category_id     = 0;
98 98
     $blog_id         = 0;
@@ -106,25 +106,25 @@  discard block
 block discarded – undo
106 106
     $blog_prefix     = 'b.';
107 107
 }
108 108
 
109
-$criteria->add(new Criteria($blog_prefix . 'blog_status', 0, '>'));
109
+$criteria->add(new Criteria($blog_prefix.'blog_status', 0, '>'));
110 110
 
111 111
 /* Sort */
112 112
 $order = 'DESC';
113 113
 $sort  = empty($sort) ? 'default' : $sort;
114 114
 switch ($sort) {
115 115
     case 'marks':
116
-        $sortby = $blog_prefix . 'blog_marks';
116
+        $sortby = $blog_prefix.'blog_marks';
117 117
         break;
118 118
     case 'rating':
119
-        $sortby = $blog_prefix . 'blog_rating';
119
+        $sortby = $blog_prefix.'blog_rating';
120 120
         break;
121 121
     case 'time':
122
-        $sortby = $blog_prefix . 'blog_time';
122
+        $sortby = $blog_prefix.'blog_time';
123 123
         break;
124 124
     case 'default':
125 125
     default:
126 126
         $sort   = 'default';
127
-        $sortby = $blog_prefix . 'blog_id';
127
+        $sortby = $blog_prefix.'blog_id';
128 128
         break;
129 129
 }
130 130
 $criteria->setSort($sortby);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 $criteria->setStart($start);
133 133
 $criteria->setLimit($limit);
134 134
 
135
-$tags = empty($list) ? '' : [$blog_prefix . 'blog_title', $blog_prefix . 'blog_time'];
135
+$tags = empty($list) ? '' : [$blog_prefix.'blog_title', $blog_prefix.'blog_time'];
136 136
 switch ($query_type) {
137 137
     case 'category':
138 138
         $blogs_obj  = $blogHandler->getByCategory($criteria, $tags);
@@ -172,31 +172,31 @@  discard block
 block discarded – undo
172 172
 }
173 173
 unset($blogs_obj);
174 174
 
175
-if ($count_blog > $limit) {
176
-    include XOOPS_ROOT_PATH . '/class/pagenav.php';
175
+if ($count_blog>$limit) {
176
+    include XOOPS_ROOT_PATH.'/class/pagenav.php';
177 177
     $start_link = [];
178 178
     if ($sort) {
179
-        $start_link[] = 'sort=' . $sort;
179
+        $start_link[] = 'sort='.$sort;
180 180
     }
181 181
     if ($category_id) {
182
-        $start_link[] = 'category=' . $category_id;
182
+        $start_link[] = 'category='.$category_id;
183 183
     }
184 184
     if ($list) {
185
-        $start_link[] = 'list=' . $list;
185
+        $start_link[] = 'list='.$list;
186 186
     }
187 187
     $nav     = new XoopsPageNav($count_blog, $limit, $start, 'start', implode('&amp;', $start_link));
188 188
     $pagenav = $nav->renderNav(4);
189
-} else {
189
+}else {
190 190
     $pagenav = '';
191 191
 }
192 192
 
193 193
 $xoopsTpl->assign('xoops_pagetitle', $xoopsOption['xoops_pagetitle']);
194
-$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>');
194
+$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>');
195 195
 
196 196
 if ($category_id || $uid) {
197
-    $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>');
197
+    $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>');
198 198
 
199
-    $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>';
199
+    $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>';
200 200
     $xoopsTpl->assign('link_articles', $link_articles);
201 201
 }
202 202
 
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
                . '/modules/'
206 206
                . $GLOBALS['moddirname']
207 207
                . '/view.blogs.php'
208
-               . (empty($category_id) ? '' : '/c' . $category_id)
209
-               . (empty($uid) ? '' : '/u' . $uid)
208
+               . (empty($category_id) ? '' : '/c'.$category_id)
209
+               . (empty($uid) ? '' : '/u'.$uid)
210 210
                . (empty($list) ? '/l1' : '')
211 211
                . "\" title=\""
212 212
                . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
@@ -216,14 +216,14 @@  discard block
 block discarded – undo
216 216
 $xoopsTpl->assign('link_switch', $link_switch);
217 217
 
218 218
 if (empty($uid) && is_object($xoopsUser)) {
219
-    $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>');
219
+    $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>');
220 220
 }
221 221
 
222 222
 if (1 == $xoopsModuleConfig['newblog_submit'] || is_object($xoopsUser)) {
223
-    $xoopsTpl->assign('link_submit', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/action.blog.php\" title=\"" . _SUBMIT . "\" target=\"_blank\">" . _SUBMIT . '</a>');
223
+    $xoopsTpl->assign('link_submit', "<a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname']."/action.blog.php\" title=\""._SUBMIT."\" target=\"_blank\">"._SUBMIT.'</a>');
224 224
 }
225 225
 
226
-$xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name') . '::' . planet_constant('MD_BLOGS'));
226
+$xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name').'::'.planet_constant('MD_BLOGS'));
227 227
 $xoopsTpl->assign('category', @$category_data);
228 228
 $xoopsTpl->assign('user', @$user_data);
229 229
 $xoopsTpl->assign('blogs', $blogs);
@@ -237,19 +237,19 @@  discard block
 block discarded – undo
237 237
     $xoopsTpl->assign('canrate', 1);
238 238
 }
239 239
 
240
-$sort_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' . URL_DELIMITER;
240
+$sort_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.blogs.php'.URL_DELIMITER;
241 241
 $vars      = [];
242 242
 if (!empty($category_id)) {
243
-    $vars[] = 'c' . $category_id;
243
+    $vars[] = 'c'.$category_id;
244 244
 }
245 245
 if (!empty($uid)) {
246
-    $vars[] = 'u' . $uid;
246
+    $vars[] = 'u'.$uid;
247 247
 }
248 248
 if (!empty($list)) {
249 249
     $vars[] = 'li';
250 250
 }
251 251
 if (!empty($vars)) {
252
-    $sort_link .= implode('/', $vars) . '/';
252
+    $sort_link .= implode('/', $vars).'/';
253 253
 }
254 254
 $sortlinks   = [];
255 255
 $valid_sorts = [
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
     if ($val == $sort) {
263 263
         continue;
264 264
     }
265
-    $sortlinks[] = "<a href=\"" . $sort_link . $val . "\">" . $name . '</a>';
265
+    $sortlinks[] = "<a href=\"".$sort_link.$val."\">".$name.'</a>';
266 266
 }
267 267
 $xoopsTpl->assign('link_sort', implode(' | ', $sortlinks));
268 268
 
269
-require_once __DIR__ . '/footer.php';
269
+require_once __DIR__.'/footer.php';
Please login to merge, or discard this patch.
index.php 2 patches
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 (1 == $xoopsModuleConfig['newblog_submit'] || 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.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 // URL: https://xoops.org                         //
25 25
 // Project: Article Project                                                 //
26 26
 // ------------------------------------------------------------------------ //
27
-include __DIR__ . '/header.php';
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';
30
+    include XOOPS_ROOT_PATH.'/include/notification_update.php';
31 31
     exit();
32 32
 }
33 33
 
@@ -37,17 +37,17 @@  discard block
 block discarded – undo
37 37
 }
38 38
 
39 39
 /* Start */
40
-$start = (int)(empty($_GET['start']) ? @$args['start'] : $_GET['start']);
40
+$start = (int) (empty($_GET['start']) ? @$args['start'] : $_GET['start']);
41 41
 /* Specified Category */
42
-$category_id = (int)(empty($_GET['category']) ? @$args['category'] : $_GET['category']);
42
+$category_id = (int) (empty($_GET['category']) ? @$args['category'] : $_GET['category']);
43 43
 /* Specified Blog */
44
-$blog_id = (int)(empty($_GET['blog']) ? @$args['blog'] : $_GET['blog']);
44
+$blog_id = (int) (empty($_GET['blog']) ? @$args['blog'] : $_GET['blog']);
45 45
 /* Specified Bookmar(Favorite) UID */
46
-$uid = (int)(empty($_GET['uid']) ? @$args['uid'] : $_GET['uid']);
46
+$uid = (int) (empty($_GET['uid']) ? @$args['uid'] : $_GET['uid']);
47 47
 /* Sort by term */
48 48
 $sort = empty($_GET['sort']) ? @$args['sort'] : $_GET['sort'];
49 49
 /* Display as list */
50
-$list = (int)(empty($_GET['list']) ? @$args['list'] : $_GET['list']);
50
+$list = (int) (empty($_GET['list']) ? @$args['list'] : $_GET['list']);
51 51
 
52 52
 // restore $_SERVER['REQUEST_URI']
53 53
 if (!empty($REQUEST_URI_parsed)) {
@@ -55,28 +55,28 @@  discard block
 block discarded – undo
55 55
     $_args            = ['start', 'sort', 'uid', 'list'];
56 56
     foreach ($_args as $arg) {
57 57
         if (!empty(${$arg})) {
58
-            $args_REQUEST_URI[] = $arg . '=' . ${$arg};
58
+            $args_REQUEST_URI[] = $arg.'='.${$arg};
59 59
         }
60 60
     }
61 61
     if (!empty($blog_id)) {
62
-        $args_REQUEST_URI[] = 'blog=' . $blog_id;
62
+        $args_REQUEST_URI[] = 'blog='.$blog_id;
63 63
     }
64 64
     if (!empty($category_id)) {
65
-        $args_REQUEST_URI[] = 'category=' . $category_id;
65
+        $args_REQUEST_URI[] = 'category='.$category_id;
66 66
     }
67
-    $_SERVER['REQUEST_URI'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . (empty($args_REQUEST_URI) ? '' : '?' . implode('&', $args_REQUEST_URI));
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');
71 71
 $xoops_module_header                     = '
72
-    <link rel="alternate" type="application/rss+xml" title="' . $xoopsModule->getVar('name') . ' rss" href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php".URL_DELIMITER."rss/c' . $category_id . '/b' . $blog_id . '/u' . $uid . '">
73
-    <link rel="alternate" type="application/rss+xml" title="' . $xoopsModule->getVar('name') . ' rdf" href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php".URL_DELIMITER."rdf/c' . $category_id . '/b' . $blog_id . '/u' . $uid . '">
74
-    <link rel="alternate" type="application/atom+xml" title="' . $xoopsModule->getVar('name') . ' atom" href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php".URL_DELIMITER."atom/c' . $category_id . '/b' . $blog_id . '/u' . $uid . '">
72
+    <link rel="alternate" type="application/rss+xml" title="' . $xoopsModule->getVar('name').' rss" href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/xml.php".URL_DELIMITER."rss/c'.$category_id.'/b'.$blog_id.'/u'.$uid.'">
73
+    <link rel="alternate" type="application/rss+xml" title="' . $xoopsModule->getVar('name').' rdf" href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/xml.php".URL_DELIMITER."rdf/c'.$category_id.'/b'.$blog_id.'/u'.$uid.'">
74
+    <link rel="alternate" type="application/atom+xml" title="' . $xoopsModule->getVar('name').' atom" href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/xml.php".URL_DELIMITER."atom/c'.$category_id.'/b'.$blog_id.'/u'.$uid.'">
75 75
     ';
76 76
 
77 77
 $xoopsOption['xoops_module_header'] = $xoops_module_header;
78
-require_once XOOPS_ROOT_PATH . '/header.php';
79
-include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
78
+require_once XOOPS_ROOT_PATH.'/header.php';
79
+include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
80 80
 
81 81
 // Following part will not be executed after cache
82 82
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 $criteria       = new CriteriaCompo();
89 89
 $article_prefix = '';
90 90
 /* Specific category */
91
-if ($category_id > 0) {
91
+if ($category_id>0) {
92 92
     $category_obj = $categoryHandler->get($category_id);
93 93
     $criteria->add(new Criteria('bc.cat_id', $category_id));
94 94
     $uid            = 0;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     $article_prefix = 'a.';
99 99
 }
100 100
 /* Specific blog */
101
-if ($blog_id > 0) {
101
+if ($blog_id>0) {
102 102
     $blog_obj = $blogHandler->get($blog_id);
103 103
     if ($blog_obj->getVar('blog_status')
104 104
         || (is_object($xoopsUser)
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     $article_prefix = '';
126 126
 }
127 127
 /* User bookmarks(favorites) */
128
-if ($uid > 0) {
128
+if ($uid>0) {
129 129
     $criteria->add(new Criteria('bm.bm_uid', $uid));
130 130
     $category_id     = 0;
131 131
     $blog_id         = 0;
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 $sort  = empty($sort) ? 'time' : $sort;
145 145
 switch ($sort) {
146 146
     case 'views':
147
-        $sortby = $article_prefix . 'art_views';
147
+        $sortby = $article_prefix.'art_views';
148 148
         break;
149 149
     case 'rating':
150
-        $sortby = $article_prefix . 'art_rating';
150
+        $sortby = $article_prefix.'art_rating';
151 151
         break;
152 152
     case 'time':
153
-        $sortby = $article_prefix . 'art_time';
153
+        $sortby = $article_prefix.'art_time';
154 154
         break;
155 155
     case 'default':
156 156
     default:
@@ -163,9 +163,9 @@  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 171
     case 'category':
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
 
185 185
 if (!empty($blog_data)) {
186 186
     $blogs[$blog_data['id']] = $blog_data['title'];
187
-} else {
187
+}else {
188 188
     $blog_array = [];
189 189
     foreach (array_keys($articles_obj) as $id) {
190 190
         $blog_array[$articles_obj[$id]->getVar('blog_id')] = 1;
191 191
     }
192
-    $criteria_blog = new Criteria('blog_id', '(' . implode(',', array_keys($blog_array)) . ')', 'IN');
192
+    $criteria_blog = new Criteria('blog_id', '('.implode(',', array_keys($blog_array)).')', 'IN');
193 193
     $blogs         = $blogHandler->getList($criteria_blog);
194 194
 }
195 195
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         ]);
216 216
         if (!empty($xoopsModuleConfig['display_summary'])) {
217 217
             $_article['content'] = $articles_obj[$id]->getSummary();
218
-        } else {
218
+        }else {
219 219
             $_article['content'] = $articles_obj[$id]->getVar('art_content');
220 220
         }
221 221
     }
@@ -224,24 +224,24 @@  discard block
 block discarded – undo
224 224
 }
225 225
 unset($articles_obj);
226 226
 
227
-if ($count_article > $limit) {
228
-    include XOOPS_ROOT_PATH . '/class/pagenav.php';
227
+if ($count_article>$limit) {
228
+    include XOOPS_ROOT_PATH.'/class/pagenav.php';
229 229
     $start_link = [];
230 230
     if ($sort) {
231
-        $start_link[] = 'sort=' . $sort;
231
+        $start_link[] = 'sort='.$sort;
232 232
     }
233 233
     if ($category_id) {
234
-        $start_link[] = 'category=' . $category_id;
234
+        $start_link[] = 'category='.$category_id;
235 235
     }
236 236
     if ($blog_id) {
237
-        $start_link[] = 'blog=' . $blog_id;
237
+        $start_link[] = 'blog='.$blog_id;
238 238
     }
239 239
     if ($list) {
240
-        $start_link[] = 'list=' . $list;
240
+        $start_link[] = 'list='.$list;
241 241
     }
242 242
     $nav     = new XoopsPageNav($count_article, $limit, $start, 'start', implode('&amp;', $start_link));
243 243
     $pagenav = $nav->renderNav(4);
244
-} else {
244
+}else {
245 245
     $pagenav = '';
246 246
 }
247 247
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
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=\""
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
                . '/modules/'
258 258
                . $GLOBALS['moddirname']
259 259
                . '/index.php'
260
-               . (empty($category_id) ? '' : '/c' . $category_id)
261
-               . (empty($uid) ? '' : '/u' . $uid)
262
-               . (empty($blog_id) ? '' : '/b' . $blog_id)
260
+               . (empty($category_id) ? '' : '/c'.$category_id)
261
+               . (empty($uid) ? '' : '/u'.$uid)
262
+               . (empty($blog_id) ? '' : '/b'.$blog_id)
263 263
                . (empty($list) ? '/l1' : '')
264 264
                . "\" title=\""
265 265
                . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
@@ -268,18 +268,18 @@  discard block
 block discarded – undo
268 268
                . '</a>';
269 269
 $xoopsTpl->assign('link_switch', $link_switch);
270 270
 
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>';
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 (1 == $xoopsModuleConfig['newblog_submit'] || 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
-$xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name') . '::' . planet_constant('MD_ARTICLES'));
282
+$xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name').'::'.planet_constant('MD_ARTICLES'));
283 283
 $xoopsTpl->assign('category', @$category_data);
284 284
 $xoopsTpl->assign('blog', @$blog_data);
285 285
 $xoopsTpl->assign('user', @$user_data);
@@ -289,23 +289,23 @@  discard block
 block discarded – undo
289 289
 
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
-} elseif ($blog_id > 0) {
292
+} elseif ($blog_id>0) {
293 293
     $xoopsTpl->assign('canrate', 1);
294 294
 }
295 295
 
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');
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 298
     'views'   => planet_constant('MD_VIEWS'),
299 299
     'rating'  => planet_constant('MD_RATING'),
300 300
     'time'    => planet_constant('MD_TIME'),
301 301
     'default' => planet_constant('MD_DEFAULT')
302 302
 ];
303
-$sortlinks   = [];
303
+$sortlinks = [];
304 304
 foreach ($valid_sorts as $val => $name) {
305 305
     if ($val == $sort) {
306 306
         continue;
307 307
     }
308
-    $sortlinks[] = "<a href=\"" . $sort_link . '/' . $val . "\">" . $name . '</a>';
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'));
@@ -318,4 +318,4 @@  discard block
 block discarded – undo
318 318
     $_GET['blog'] = $blog_id;
319 319
 }
320 320
 
321
-require_once __DIR__ . '/footer.php';
321
+require_once __DIR__.'/footer.php';
Please login to merge, or discard this patch.
search.php 2 patches
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 $configHandler     = xoops_getHandler('config');
33 33
 $xoopsConfigSearch = $configHandler->getConfigsByCat(XOOPS_CONF_SEARCH);
34 34
 if (empty($xoopsConfigSearch['enable_search'])) {
35
-    redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php', 2, planet_constant('MD_NOACCESS'));
35
+	redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php', 2, planet_constant('MD_NOACCESS'));
36 36
 }
37 37
 
38 38
 $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0;
@@ -50,93 +50,93 @@  discard block
 block discarded – undo
50 50
 $blog     = Request::getInt('blog', Request::getInt('blog', 0, 'GET'), 'POST');//(int)(isset($_POST['blog']) ? $_POST['blog'] : (isset($_GET['blog']) ? $_GET['blog'] : null));
51 51
 $uid      = Request::getInt('uid', Request::getInt('uid', 0, 'GET'), 'POST');//(int)(isset($_POST['uid']) ? $_POST['uid'] : (isset($_GET['uid']) ? $_GET['uid'] : null));
52 52
 $searchin = Request::getArray(
53
-    'searchin',
54
-    0 !== count(Request::getArray('searchin', [], 'GET')) ? explode('|', Request::getArray('searchin', [], 'GET')) : [],
55
-                              'POST'
53
+	'searchin',
54
+	0 !== count(Request::getArray('searchin', [], 'GET')) ? explode('|', Request::getArray('searchin', [], 'GET')) : [],
55
+							  'POST'
56 56
 ); //isset($_POST['searchin']) ? $_POST['searchin'] : (isset($_GET['searchin']) ? explode('|', $_GET['searchin']) : array());
57 57
 $sortby   = Request::getString('sortby', Request::getString('sortby', null, 'GET'), 'POST');//isset($_POST['sortby']) ? $_POST['sortby'] : (isset($_GET['sortby']) ? $_GET['sortby'] : null);
58 58
 $term     = Request::getString('term', Request::getString('term', '', 'GET'), 'POST');//isset($_POST['term']) ? $_POST['term'] : (isset($_GET['term']) ? $_GET['term'] : '');
59 59
 
60 60
 $andor  = in_array(strtoupper($andor), ['OR', 'AND', 'EXACT']) ? strtoupper($andor) : 'OR';
61 61
 $sortby = in_array(strtolower($sortby), [
62
-    'a.art_id desc',
63
-    'a.art_time desc',
64
-    'a.art_title',
65
-    'a.blog_id',
66
-    'b.blog_id',
67
-    'b.blog_feed',
68
-    'b.blog_title',
69
-    'b.blog_time'
62
+	'a.art_id desc',
63
+	'a.art_time desc',
64
+	'a.art_title',
65
+	'a.blog_id',
66
+	'b.blog_id',
67
+	'b.blog_feed',
68
+	'b.blog_title',
69
+	'b.blog_time'
70 70
 ]) ? strtolower($sortby) : '';
71 71
 
72 72
 if (!(empty(Request::getString('submit', '', 'POST')) && empty(Request::getString('term', '', 'GET')))) {
73
-    $next_search['category'] = $category;
74
-    $next_search['blog']     = $blog;
75
-    $next_search['uid']      = $uid;
76
-    $next_search['andor']    = $andor;
73
+	$next_search['category'] = $category;
74
+	$next_search['blog']     = $blog;
75
+	$next_search['uid']      = $uid;
76
+	$next_search['andor']    = $andor;
77 77
 
78
-    $next_search['term'] = $term;
79
-    $query               = trim($term);
78
+	$next_search['term'] = $term;
79
+	$query               = trim($term);
80 80
 
81
-    if ('EXACT' !== $andor) {
82
-        $ignored_queries = []; // holds kewords that are shorter than allowed minmum length
83
-        $temp_queries    = preg_split("/[\s,]+/", $query);
84
-        foreach ($temp_queries as $q) {
85
-            $q = trim($q);
86
-            if (strlen($q) >= $xoopsConfigSearch['keyword_min']) {
87
-                $queries[] = $myts->addSlashes($q);
88
-            } else {
89
-                $ignored_queries[] = $myts->addSlashes($q);
90
-            }
91
-        }
92
-        if (0 == count($queries)) {
93
-            redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
94
-        }
95
-    } else {
96
-        if (strlen($query) < $xoopsConfigSearch['keyword_min']) {
97
-            redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
98
-        }
99
-        $queries = [$myts->addSlashes($query)];
100
-    }
81
+	if ('EXACT' !== $andor) {
82
+		$ignored_queries = []; // holds kewords that are shorter than allowed minmum length
83
+		$temp_queries    = preg_split("/[\s,]+/", $query);
84
+		foreach ($temp_queries as $q) {
85
+			$q = trim($q);
86
+			if (strlen($q) >= $xoopsConfigSearch['keyword_min']) {
87
+				$queries[] = $myts->addSlashes($q);
88
+			} else {
89
+				$ignored_queries[] = $myts->addSlashes($q);
90
+			}
91
+		}
92
+		if (0 == count($queries)) {
93
+			redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
94
+		}
95
+	} else {
96
+		if (strlen($query) < $xoopsConfigSearch['keyword_min']) {
97
+			redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
98
+		}
99
+		$queries = [$myts->addSlashes($query)];
100
+	}
101 101
 
102
-    $next_search['sortby']   = $sortby;
103
-    $next_search['searchin'] = implode('|', $searchin);
102
+	$next_search['sortby']   = $sortby;
103
+	$next_search['searchin'] = implode('|', $searchin);
104 104
 
105
-    /* To be added: year-month
105
+	/* To be added: year-month
106 106
      * see view.archive.php
107 107
      */
108
-    if (!empty($time)) {
109
-        $extra = '';
110
-    } else {
111
-        $extra = '';
112
-    }
108
+	if (!empty($time)) {
109
+		$extra = '';
110
+	} else {
111
+		$extra = '';
112
+	}
113 113
 
114
-    $results = planet_search($queries, $andor, $limit, $start, $uid, $category, $blog, $sortby, $searchin, $extra);
114
+	$results = planet_search($queries, $andor, $limit, $start, $uid, $category, $blog, $sortby, $searchin, $extra);
115 115
 
116
-    /*
116
+	/*
117 117
     if ( count($results) < 1 ) {
118 118
         redirect_header("javascript:history.go(-1);", 2, _SR_NOMATCH);
119 119
     } else
120 120
     */
121
-    {
122
-        $xoopsTpl->assign('results', $results);
121
+	{
122
+		$xoopsTpl->assign('results', $results);
123 123
 
124
-        if (count($next_search) > 0) {
125
-            $items = [];
126
-            foreach ($next_search as $para => $val) {
127
-                if (!empty($val)) {
128
-                    $items[] = "$para=$val";
129
-                }
130
-            }
131
-            if (count($items) > 0) {
132
-                $paras = implode('&', $items);
133
-            }
134
-            unset($next_search);
135
-            unset($items);
136
-        }
137
-        $search_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php?' . $paras;
124
+		if (count($next_search) > 0) {
125
+			$items = [];
126
+			foreach ($next_search as $para => $val) {
127
+				if (!empty($val)) {
128
+					$items[] = "$para=$val";
129
+				}
130
+			}
131
+			if (count($items) > 0) {
132
+				$paras = implode('&', $items);
133
+			}
134
+			unset($next_search);
135
+			unset($items);
136
+		}
137
+		$search_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php?' . $paras;
138 138
 
139
-        /*
139
+		/*
140 140
          $next_results =& planet_search($queries, $andor, 1, $start + $limit, $uid, $category, $sortby, $searchin, $extra);
141 141
       $next_count = count($next_results);
142 142
       $has_next = false;
@@ -145,41 +145,41 @@  discard block
 block discarded – undo
145 145
       }
146 146
       if (false != $has_next)
147 147
       */
148
-        if (count($results)) {
149
-            $next            = $start + $limit;
150
-            $queries         = implode(',', $queries);
151
-            $search_url_next = $search_url . "&start=$next";
152
-            $search_next     = "<a href=\"" . htmlspecialchars($search_url_next) . "\">" . _SR_NEXT . '</a>';
153
-            $xoopsTpl->assign('search_next', $search_next);
154
-        }
155
-        if ($start > 0) {
156
-            $prev            = $start - $limit;
157
-            $search_url_prev = $search_url . "&start=$prev";
158
-            $search_prev     = "<a href=\"" . htmlspecialchars($search_url_prev) . "\">" . _SR_PREVIOUS . '</a>';
159
-            $xoopsTpl->assign('search_prev', $search_prev);
160
-        }
161
-    }
148
+		if (count($results)) {
149
+			$next            = $start + $limit;
150
+			$queries         = implode(',', $queries);
151
+			$search_url_next = $search_url . "&start=$next";
152
+			$search_next     = "<a href=\"" . htmlspecialchars($search_url_next) . "\">" . _SR_NEXT . '</a>';
153
+			$xoopsTpl->assign('search_next', $search_next);
154
+		}
155
+		if ($start > 0) {
156
+			$prev            = $start - $limit;
157
+			$search_url_prev = $search_url . "&start=$prev";
158
+			$search_prev     = "<a href=\"" . htmlspecialchars($search_url_prev) . "\">" . _SR_PREVIOUS . '</a>';
159
+			$xoopsTpl->assign('search_prev', $search_prev);
160
+		}
161
+	}
162 162
 
163
-    unset($results);
164
-    $search_info = _SR_KEYWORDS . ': ' . $myts->htmlSpecialChars($term);
165
-    $xoopsTpl->assign('search_info', $search_info);
163
+	unset($results);
164
+	$search_info = _SR_KEYWORDS . ': ' . $myts->htmlSpecialChars($term);
165
+	$xoopsTpl->assign('search_info', $search_info);
166 166
 }
167 167
 
168 168
 /* type */
169 169
 $type_select = "<select name=\"andor\">";
170 170
 $type_select .= "<option value=\"OR\"";
171 171
 if ('OR' === $andor) {
172
-    $type_select .= " selected=\"selected\"";
172
+	$type_select .= " selected=\"selected\"";
173 173
 }
174 174
 $type_select .= '>' . _SR_ANY . '</option>';
175 175
 $type_select .= "<option value=\"AND\"";
176 176
 if ('AND' === $andor) {
177
-    $type_select .= " selected=\"selected\"";
177
+	$type_select .= " selected=\"selected\"";
178 178
 }
179 179
 $type_select .= '>' . _SR_ALL . '</option>';
180 180
 $type_select .= "<option value=\"EXACT\"";
181 181
 if ('exact' === $andor) {
182
-    $type_select .= " selected=\"selected\"";
182
+	$type_select .= " selected=\"selected\"";
183 183
 }
184 184
 $type_select .= '>' . _SR_EXACT . '</option>';
185 185
 $type_select .= '</select>';
@@ -188,32 +188,32 @@  discard block
 block discarded – undo
188 188
 $searchin_select = '';
189 189
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"title\"";
190 190
 if (in_array('title', $searchin)) {
191
-    $searchin_select .= ' checked';
191
+	$searchin_select .= ' checked';
192 192
 }
193 193
 $searchin_select .= '>' . planet_constant('MD_TITLE') . '&nbsp;&nbsp;';
194 194
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"text\"";
195 195
 if (in_array('text', $searchin)) {
196
-    $searchin_select .= ' checked';
196
+	$searchin_select .= ' checked';
197 197
 }
198 198
 $searchin_select .= '>' . planet_constant('MD_BODY') . '&nbsp;&nbsp;||&nbsp;&nbsp;';
199 199
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"blog\"";
200 200
 if (in_array('blog', $searchin)) {
201
-    $searchin_select .= ' checked';
201
+	$searchin_select .= ' checked';
202 202
 }
203 203
 $searchin_select .= '>' . planet_constant('MD_BLOG') . '&nbsp;&nbsp;';
204 204
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"feed\"";
205 205
 if (in_array('feed', $searchin)) {
206
-    $searchin_select .= ' checked';
206
+	$searchin_select .= ' checked';
207 207
 }
208 208
 $searchin_select .= '>' . planet_constant('MD_FEED') . '&nbsp;&nbsp;';
209 209
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"desc\"";
210 210
 if (in_array('desc', $searchin)) {
211
-    $searchin_select .= ' checked';
211
+	$searchin_select .= ' checked';
212 212
 }
213 213
 $searchin_select .= '>' . planet_constant('MD_DESC') . '&nbsp;&nbsp;';
214 214
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"all\"";
215 215
 if (empty($searchin)) {
216
-    $searchin_select .= ' checked';
216
+	$searchin_select .= ' checked';
217 217
 }
218 218
 $searchin_select .= '>' . _ALL . '&nbsp;&nbsp;';
219 219
 
@@ -221,28 +221,28 @@  discard block
 block discarded – undo
221 221
 $sortby_select = "<select name=\"sortby\">";
222 222
 $sortby_select .= "<option value=\"\"";
223 223
 if (empty($sortby)) {
224
-    $sortby_select .= " selected=\"selected\"";
224
+	$sortby_select .= " selected=\"selected\"";
225 225
 }
226 226
 $sortby_select .= '>' . _NONE . '</option>';
227 227
 $sortby_select .= "<option value=\"a.art_time\"";
228 228
 if ('a.art_time' === $sortby) {
229
-    $sortby_select .= " selected=\"selected\"";
229
+	$sortby_select .= " selected=\"selected\"";
230 230
 }
231 231
 $sortby_select .= '>' . planet_constant('MD_TIME') . '</option>';
232 232
 $sortby_select .= "<option value=\"a.art_title\"";
233 233
 if ('a.art_title' === $sortby) {
234
-    $sortby_select .= " selected=\"selected\"";
234
+	$sortby_select .= " selected=\"selected\"";
235 235
 }
236 236
 $sortby_select .= '>' . planet_constant('MD_TITLE') . '</option>';
237 237
 $sortby_select .= "<option value=\"\">&nbsp;&nbsp;----&nbsp;&nbsp;</option>";
238 238
 $sortby_select .= "<option value=\"a.blog_title\"";
239 239
 if ('a.blog_title' === $sortby) {
240
-    $sortby_select .= " selected=\"selected\"";
240
+	$sortby_select .= " selected=\"selected\"";
241 241
 }
242 242
 $sortby_select .= '>' . planet_constant('MD_BLOG') . '</option>';
243 243
 $sortby_select .= "<option value=\"a.blog_time\"";
244 244
 if ('b.blog_time' === $sortby) {
245
-    $sortby_select .= " selected=\"selected\"";
245
+	$sortby_select .= " selected=\"selected\"";
246 246
 }
247 247
 $sortby_select .= '>' . planet_constant('MD_UPDATE') . '</option>';
248 248
 $sortby_select .= '</select>';
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 $xoopsTpl->assign('uid', $uid);
260 260
 
261 261
 if ($xoopsConfigSearch['keyword_min'] > 0) {
262
-    $xoopsTpl->assign('search_rule', sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min']));
262
+	$xoopsTpl->assign('search_rule', sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min']));
263 263
 }
264 264
 
265 265
 include XOOPS_ROOT_PATH . '/footer.php';
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -27,35 +27,35 @@  discard block
 block discarded – undo
27 27
 use Xmf\Request;
28 28
 
29 29
 $xoopsOption['pagetype'] = 'search';
30
-include __DIR__ . '/header.php';
30
+include __DIR__.'/header.php';
31 31
 $xoopsModule->loadLanguage('main');
32 32
 $configHandler     = xoops_getHandler('config');
33 33
 $xoopsConfigSearch = $configHandler->getConfigsByCat(XOOPS_CONF_SEARCH);
34 34
 if (empty($xoopsConfigSearch['enable_search'])) {
35
-    redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php', 2, planet_constant('MD_NOACCESS'));
35
+    redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php', 2, planet_constant('MD_NOACCESS'));
36 36
 }
37 37
 
38 38
 $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0;
39 39
 $xoopsOption['template_main']                             = PlanetUtility::planetGetTemplate('search');
40
-include XOOPS_ROOT_PATH . '/header.php';
41
-include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
40
+include XOOPS_ROOT_PATH.'/header.php';
41
+include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
42 42
 
43
-require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/search.inc.php';
43
+require_once XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/search.inc.php';
44 44
 $limit = $xoopsModuleConfig['articles_perpage'];
45 45
 
46 46
 $queries  = [];
47
-$andor    = Request::getString('andor', Request::getString('andor', '', 'GET'), 'POST');//isset($_POST['andor']) ? $_POST['andor'] : (isset($_GET['andor']) ? $_GET['andor'] : '');
48
-$start    = Request::getInt('start', 0, 'GET');//isset($_GET['start']) ? $_GET['start'] : 0;
47
+$andor    = Request::getString('andor', Request::getString('andor', '', 'GET'), 'POST'); //isset($_POST['andor']) ? $_POST['andor'] : (isset($_GET['andor']) ? $_GET['andor'] : '');
48
+$start    = Request::getInt('start', 0, 'GET'); //isset($_GET['start']) ? $_GET['start'] : 0;
49 49
 $category = Request::getInt('category', Request::getInt('category', 0, 'GET'), 'POST'); //(int)(isset($_POST['category']) ? $_POST['category'] : (isset($_GET['category']) ? $_GET['category'] : null));
50
-$blog     = Request::getInt('blog', Request::getInt('blog', 0, 'GET'), 'POST');//(int)(isset($_POST['blog']) ? $_POST['blog'] : (isset($_GET['blog']) ? $_GET['blog'] : null));
51
-$uid      = Request::getInt('uid', Request::getInt('uid', 0, 'GET'), 'POST');//(int)(isset($_POST['uid']) ? $_POST['uid'] : (isset($_GET['uid']) ? $_GET['uid'] : null));
50
+$blog     = Request::getInt('blog', Request::getInt('blog', 0, 'GET'), 'POST'); //(int)(isset($_POST['blog']) ? $_POST['blog'] : (isset($_GET['blog']) ? $_GET['blog'] : null));
51
+$uid      = Request::getInt('uid', Request::getInt('uid', 0, 'GET'), 'POST'); //(int)(isset($_POST['uid']) ? $_POST['uid'] : (isset($_GET['uid']) ? $_GET['uid'] : null));
52 52
 $searchin = Request::getArray(
53 53
     'searchin',
54 54
     0 !== count(Request::getArray('searchin', [], 'GET')) ? explode('|', Request::getArray('searchin', [], 'GET')) : [],
55 55
                               'POST'
56 56
 ); //isset($_POST['searchin']) ? $_POST['searchin'] : (isset($_GET['searchin']) ? explode('|', $_GET['searchin']) : array());
57
-$sortby   = Request::getString('sortby', Request::getString('sortby', null, 'GET'), 'POST');//isset($_POST['sortby']) ? $_POST['sortby'] : (isset($_GET['sortby']) ? $_GET['sortby'] : null);
58
-$term     = Request::getString('term', Request::getString('term', '', 'GET'), 'POST');//isset($_POST['term']) ? $_POST['term'] : (isset($_GET['term']) ? $_GET['term'] : '');
57
+$sortby   = Request::getString('sortby', Request::getString('sortby', null, 'GET'), 'POST'); //isset($_POST['sortby']) ? $_POST['sortby'] : (isset($_GET['sortby']) ? $_GET['sortby'] : null);
58
+$term     = Request::getString('term', Request::getString('term', '', 'GET'), 'POST'); //isset($_POST['term']) ? $_POST['term'] : (isset($_GET['term']) ? $_GET['term'] : '');
59 59
 
60 60
 $andor  = in_array(strtoupper($andor), ['OR', 'AND', 'EXACT']) ? strtoupper($andor) : 'OR';
61 61
 $sortby = in_array(strtolower($sortby), [
@@ -83,18 +83,18 @@  discard block
 block discarded – undo
83 83
         $temp_queries    = preg_split("/[\s,]+/", $query);
84 84
         foreach ($temp_queries as $q) {
85 85
             $q = trim($q);
86
-            if (strlen($q) >= $xoopsConfigSearch['keyword_min']) {
86
+            if (strlen($q)>=$xoopsConfigSearch['keyword_min']) {
87 87
                 $queries[] = $myts->addSlashes($q);
88
-            } else {
88
+            }else {
89 89
                 $ignored_queries[] = $myts->addSlashes($q);
90 90
             }
91 91
         }
92 92
         if (0 == count($queries)) {
93
-            redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
93
+            redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
94 94
         }
95
-    } else {
96
-        if (strlen($query) < $xoopsConfigSearch['keyword_min']) {
97
-            redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
95
+    }else {
96
+        if (strlen($query)<$xoopsConfigSearch['keyword_min']) {
97
+            redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
98 98
         }
99 99
         $queries = [$myts->addSlashes($query)];
100 100
     }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      */
108 108
     if (!empty($time)) {
109 109
         $extra = '';
110
-    } else {
110
+    }else {
111 111
         $extra = '';
112 112
     }
113 113
 
@@ -121,20 +121,20 @@  discard block
 block discarded – undo
121 121
     {
122 122
         $xoopsTpl->assign('results', $results);
123 123
 
124
-        if (count($next_search) > 0) {
124
+        if (count($next_search)>0) {
125 125
             $items = [];
126 126
             foreach ($next_search as $para => $val) {
127 127
                 if (!empty($val)) {
128 128
                     $items[] = "$para=$val";
129 129
                 }
130 130
             }
131
-            if (count($items) > 0) {
131
+            if (count($items)>0) {
132 132
                 $paras = implode('&', $items);
133 133
             }
134 134
             unset($next_search);
135 135
             unset($items);
136 136
         }
137
-        $search_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php?' . $paras;
137
+        $search_url = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/search.php?'.$paras;
138 138
 
139 139
         /*
140 140
          $next_results =& planet_search($queries, $andor, 1, $start + $limit, $uid, $category, $sortby, $searchin, $extra);
@@ -146,22 +146,22 @@  discard block
 block discarded – undo
146 146
       if (false != $has_next)
147 147
       */
148 148
         if (count($results)) {
149
-            $next            = $start + $limit;
149
+            $next            = $start+$limit;
150 150
             $queries         = implode(',', $queries);
151
-            $search_url_next = $search_url . "&start=$next";
152
-            $search_next     = "<a href=\"" . htmlspecialchars($search_url_next) . "\">" . _SR_NEXT . '</a>';
151
+            $search_url_next = $search_url."&start=$next";
152
+            $search_next     = "<a href=\"".htmlspecialchars($search_url_next)."\">"._SR_NEXT.'</a>';
153 153
             $xoopsTpl->assign('search_next', $search_next);
154 154
         }
155
-        if ($start > 0) {
156
-            $prev            = $start - $limit;
157
-            $search_url_prev = $search_url . "&start=$prev";
158
-            $search_prev     = "<a href=\"" . htmlspecialchars($search_url_prev) . "\">" . _SR_PREVIOUS . '</a>';
155
+        if ($start>0) {
156
+            $prev            = $start-$limit;
157
+            $search_url_prev = $search_url."&start=$prev";
158
+            $search_prev     = "<a href=\"".htmlspecialchars($search_url_prev)."\">"._SR_PREVIOUS.'</a>';
159 159
             $xoopsTpl->assign('search_prev', $search_prev);
160 160
         }
161 161
     }
162 162
 
163 163
     unset($results);
164
-    $search_info = _SR_KEYWORDS . ': ' . $myts->htmlSpecialChars($term);
164
+    $search_info = _SR_KEYWORDS.': '.$myts->htmlSpecialChars($term);
165 165
     $xoopsTpl->assign('search_info', $search_info);
166 166
 }
167 167
 
@@ -171,17 +171,17 @@  discard block
 block discarded – undo
171 171
 if ('OR' === $andor) {
172 172
     $type_select .= " selected=\"selected\"";
173 173
 }
174
-$type_select .= '>' . _SR_ANY . '</option>';
174
+$type_select .= '>'._SR_ANY.'</option>';
175 175
 $type_select .= "<option value=\"AND\"";
176 176
 if ('AND' === $andor) {
177 177
     $type_select .= " selected=\"selected\"";
178 178
 }
179
-$type_select .= '>' . _SR_ALL . '</option>';
179
+$type_select .= '>'._SR_ALL.'</option>';
180 180
 $type_select .= "<option value=\"EXACT\"";
181 181
 if ('exact' === $andor) {
182 182
     $type_select .= " selected=\"selected\"";
183 183
 }
184
-$type_select .= '>' . _SR_EXACT . '</option>';
184
+$type_select .= '>'._SR_EXACT.'</option>';
185 185
 $type_select .= '</select>';
186 186
 
187 187
 /* scope */
@@ -190,32 +190,32 @@  discard block
 block discarded – undo
190 190
 if (in_array('title', $searchin)) {
191 191
     $searchin_select .= ' checked';
192 192
 }
193
-$searchin_select .= '>' . planet_constant('MD_TITLE') . '&nbsp;&nbsp;';
193
+$searchin_select .= '>'.planet_constant('MD_TITLE').'&nbsp;&nbsp;';
194 194
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"text\"";
195 195
 if (in_array('text', $searchin)) {
196 196
     $searchin_select .= ' checked';
197 197
 }
198
-$searchin_select .= '>' . planet_constant('MD_BODY') . '&nbsp;&nbsp;||&nbsp;&nbsp;';
198
+$searchin_select .= '>'.planet_constant('MD_BODY').'&nbsp;&nbsp;||&nbsp;&nbsp;';
199 199
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"blog\"";
200 200
 if (in_array('blog', $searchin)) {
201 201
     $searchin_select .= ' checked';
202 202
 }
203
-$searchin_select .= '>' . planet_constant('MD_BLOG') . '&nbsp;&nbsp;';
203
+$searchin_select .= '>'.planet_constant('MD_BLOG').'&nbsp;&nbsp;';
204 204
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"feed\"";
205 205
 if (in_array('feed', $searchin)) {
206 206
     $searchin_select .= ' checked';
207 207
 }
208
-$searchin_select .= '>' . planet_constant('MD_FEED') . '&nbsp;&nbsp;';
208
+$searchin_select .= '>'.planet_constant('MD_FEED').'&nbsp;&nbsp;';
209 209
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"desc\"";
210 210
 if (in_array('desc', $searchin)) {
211 211
     $searchin_select .= ' checked';
212 212
 }
213
-$searchin_select .= '>' . planet_constant('MD_DESC') . '&nbsp;&nbsp;';
213
+$searchin_select .= '>'.planet_constant('MD_DESC').'&nbsp;&nbsp;';
214 214
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"all\"";
215 215
 if (empty($searchin)) {
216 216
     $searchin_select .= ' checked';
217 217
 }
218
-$searchin_select .= '>' . _ALL . '&nbsp;&nbsp;';
218
+$searchin_select .= '>'._ALL.'&nbsp;&nbsp;';
219 219
 
220 220
 /* sortby */
221 221
 $sortby_select = "<select name=\"sortby\">";
@@ -223,28 +223,28 @@  discard block
 block discarded – undo
223 223
 if (empty($sortby)) {
224 224
     $sortby_select .= " selected=\"selected\"";
225 225
 }
226
-$sortby_select .= '>' . _NONE . '</option>';
226
+$sortby_select .= '>'._NONE.'</option>';
227 227
 $sortby_select .= "<option value=\"a.art_time\"";
228 228
 if ('a.art_time' === $sortby) {
229 229
     $sortby_select .= " selected=\"selected\"";
230 230
 }
231
-$sortby_select .= '>' . planet_constant('MD_TIME') . '</option>';
231
+$sortby_select .= '>'.planet_constant('MD_TIME').'</option>';
232 232
 $sortby_select .= "<option value=\"a.art_title\"";
233 233
 if ('a.art_title' === $sortby) {
234 234
     $sortby_select .= " selected=\"selected\"";
235 235
 }
236
-$sortby_select .= '>' . planet_constant('MD_TITLE') . '</option>';
236
+$sortby_select .= '>'.planet_constant('MD_TITLE').'</option>';
237 237
 $sortby_select .= "<option value=\"\">&nbsp;&nbsp;----&nbsp;&nbsp;</option>";
238 238
 $sortby_select .= "<option value=\"a.blog_title\"";
239 239
 if ('a.blog_title' === $sortby) {
240 240
     $sortby_select .= " selected=\"selected\"";
241 241
 }
242
-$sortby_select .= '>' . planet_constant('MD_BLOG') . '</option>';
242
+$sortby_select .= '>'.planet_constant('MD_BLOG').'</option>';
243 243
 $sortby_select .= "<option value=\"a.blog_time\"";
244 244
 if ('b.blog_time' === $sortby) {
245 245
     $sortby_select .= " selected=\"selected\"";
246 246
 }
247
-$sortby_select .= '>' . planet_constant('MD_UPDATE') . '</option>';
247
+$sortby_select .= '>'.planet_constant('MD_UPDATE').'</option>';
248 248
 $sortby_select .= '</select>';
249 249
 
250 250
 $xoopsTpl->assign('type_select', $type_select);
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 $xoopsTpl->assign('blog', $blog);
259 259
 $xoopsTpl->assign('uid', $uid);
260 260
 
261
-if ($xoopsConfigSearch['keyword_min'] > 0) {
261
+if ($xoopsConfigSearch['keyword_min']>0) {
262 262
     $xoopsTpl->assign('search_rule', sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min']));
263 263
 }
264 264
 
265
-include XOOPS_ROOT_PATH . '/footer.php';
265
+include XOOPS_ROOT_PATH.'/footer.php';
Please login to merge, or discard this patch.
admin/menu.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) {
31 31
 } else {
32
-    $moduleHelper = Xmf\Module\Helper::getHelper('system');
32
+	$moduleHelper = Xmf\Module\Helper::getHelper('system');
33 33
 }
34 34
 
35 35
 $pathIcon32 = \Xmf\Module\Admin::menuIconPath('');
@@ -38,33 +38,33 @@  discard block
 block discarded – undo
38 38
 $moduleHelper->loadLanguage('modinfo');
39 39
 
40 40
 $adminmenu[] = [
41
-    'title' => _AM_MODULEADMIN_HOME,
42
-    'link'  => 'admin/index.php',
43
-    'icon'  => $pathIcon32 . '/home.png',
41
+	'title' => _AM_MODULEADMIN_HOME,
42
+	'link'  => 'admin/index.php',
43
+	'icon'  => $pathIcon32 . '/home.png',
44 44
 ];
45 45
 
46 46
 $adminmenu[] = [
47
-    'title' => planet_constant('MI_ADMENU_INDEX'),
48
-    'link'  => 'admin/main.php',
49
-    'icon'  => $pathIcon32 . '/manage.png',
47
+	'title' => planet_constant('MI_ADMENU_INDEX'),
48
+	'link'  => 'admin/main.php',
49
+	'icon'  => $pathIcon32 . '/manage.png',
50 50
 ];
51 51
 
52 52
 $adminmenu[] = [
53
-    'title' => planet_constant('MI_ADMENU_CATEGORY'),
54
-    'link'  => 'admin/admin.category.php',
55
-    'icon'  => $pathIcon32 . '/category.png',
53
+	'title' => planet_constant('MI_ADMENU_CATEGORY'),
54
+	'link'  => 'admin/admin.category.php',
55
+	'icon'  => $pathIcon32 . '/category.png',
56 56
 ];
57 57
 
58 58
 $adminmenu[] = [
59
-    'title' => planet_constant('MI_ADMENU_BLOG'),
60
-    'link'  => 'admin/admin.blog.php',
61
-    'icon'  => $pathIcon32 . '/translations.png',
59
+	'title' => planet_constant('MI_ADMENU_BLOG'),
60
+	'link'  => 'admin/admin.blog.php',
61
+	'icon'  => $pathIcon32 . '/translations.png',
62 62
 ];
63 63
 
64 64
 $adminmenu[] = [
65
-    'title' => planet_constant('MI_ADMENU_ARTICLE'),
66
-    'link'  => 'admin/admin.article.php',
67
-    'icon'  => $pathIcon32 . '/content.png',
65
+	'title' => planet_constant('MI_ADMENU_ARTICLE'),
66
+	'link'  => 'admin/admin.article.php',
67
+	'icon'  => $pathIcon32 . '/content.png',
68 68
 ];
69 69
 
70 70
 //$adminmenu[] = [
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 //];
75 75
 
76 76
 $adminmenu[] = [
77
-    'title' => _AM_MODULEADMIN_ABOUT,
78
-    'link'  => 'admin/about.php',
79
-    'icon'  => $pathIcon32 . '/about.png',
77
+	'title' => _AM_MODULEADMIN_ABOUT,
78
+	'link'  => 'admin/about.php',
79
+	'icon'  => $pathIcon32 . '/about.png',
80 80
 ];
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 $moduleDirName = basename(dirname(__DIR__));
29 29
 
30 30
 if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) {
31
-} else {
31
+}else {
32 32
     $moduleHelper = Xmf\Module\Helper::getHelper('system');
33 33
 }
34 34
 
@@ -40,31 +40,31 @@  discard block
 block discarded – undo
40 40
 $adminmenu[] = [
41 41
     'title' => _AM_MODULEADMIN_HOME,
42 42
     'link'  => 'admin/index.php',
43
-    'icon'  => $pathIcon32 . '/home.png',
43
+    'icon'  => $pathIcon32.'/home.png',
44 44
 ];
45 45
 
46 46
 $adminmenu[] = [
47 47
     'title' => planet_constant('MI_ADMENU_INDEX'),
48 48
     'link'  => 'admin/main.php',
49
-    'icon'  => $pathIcon32 . '/manage.png',
49
+    'icon'  => $pathIcon32.'/manage.png',
50 50
 ];
51 51
 
52 52
 $adminmenu[] = [
53 53
     'title' => planet_constant('MI_ADMENU_CATEGORY'),
54 54
     'link'  => 'admin/admin.category.php',
55
-    'icon'  => $pathIcon32 . '/category.png',
55
+    'icon'  => $pathIcon32.'/category.png',
56 56
 ];
57 57
 
58 58
 $adminmenu[] = [
59 59
     'title' => planet_constant('MI_ADMENU_BLOG'),
60 60
     'link'  => 'admin/admin.blog.php',
61
-    'icon'  => $pathIcon32 . '/translations.png',
61
+    'icon'  => $pathIcon32.'/translations.png',
62 62
 ];
63 63
 
64 64
 $adminmenu[] = [
65 65
     'title' => planet_constant('MI_ADMENU_ARTICLE'),
66 66
     'link'  => 'admin/admin.article.php',
67
-    'icon'  => $pathIcon32 . '/content.png',
67
+    'icon'  => $pathIcon32.'/content.png',
68 68
 ];
69 69
 
70 70
 //$adminmenu[] = [
@@ -76,5 +76,5 @@  discard block
 block discarded – undo
76 76
 $adminmenu[] = [
77 77
     'title' => _AM_MODULEADMIN_ABOUT,
78 78
     'link'  => 'admin/about.php',
79
-    'icon'  => $pathIcon32 . '/about.png',
79
+    'icon'  => $pathIcon32.'/about.png',
80 80
 ];
Please login to merge, or discard this patch.
admin/admin.blog.php 3 patches
Indentation   +341 added lines, -341 removed lines patch added patch discarded remove patch
@@ -52,353 +52,353 @@
 block discarded – undo
52 52
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
53 53
 
54 54
 if ('save' === $op && !empty(Request::getString('fetch', '', 'POST'))) {
55
-    $op = 'edit';
55
+	$op = 'edit';
56 56
 }
57 57
 
58 58
 switch ($op) {
59
-    /* save a single blog */
60
-    case 'save':
61
-
62
-        if ($blog_id) {
63
-            $blog_obj = $blogHandler->get($blog_id);
64
-        } else {
65
-            if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) {
66
-                redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS'));
67
-            }
68
-            $blog_obj = $blogHandler->create();
69
-            $blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid'));
70
-        }
71
-
72
-        $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']);
73
-        $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']);
74
-        $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']);
75
-        $blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']);
76
-        $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']);
77
-        $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']);
78
-        $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']);
79
-        $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']);
80
-        $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']);
81
-
82
-        if (!$blogHandler->insert($blog_obj)) {
83
-        } elseif (!empty(Request::getArray('categories', [], 'POST'))) {
84
-            $blog_id = $blog_obj->getVar('blog_id');
85
-            if (in_array(0, Request::getArray('categories', [], 'POST'))) {
86
-                $_POST['categories'] = [];
87
-            }
88
-            $blogHandler->setCategories($blog_id, Request::getArray('categories', [], 'POST'));
89
-        }
90
-        $message = planet_constant('AM_DBUPDATED');
91
-        redirect_header('admin.blog.php', 2, $message);
92
-
93
-    /* fetch and add a list of blogs to a category */
94
-    // no break
95
-    case 'add':
96
-        $links = PlanetUtility::planetParseLinks(Request::getArray('links', [], 'POST'));
97
-        $blogs = [];
98
-        foreach ($links as $link) {
99
-            if ($blog_exist = $blogHandler->getCount(new Criteria('blog_feed', $link['url']))) {
100
-                continue;
101
-            }
102
-            $blog_obj = $blogHandler->fetch($link['url']);
103
-            if (!empty($link['title'])) {
104
-                $blog_obj->setVar('blog_title', $link['title']);
105
-            }
106
-            $blogHandler->insert($blog_obj);
107
-            $blogs[] = $blog_obj->getVar('blog_id');
108
-            unset($blog_obj);
109
-        }
110
-        if (!empty(Request::getArray('categories', [], 'POST'))) {
111
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
112
-            foreach (Request::getArray('categories', [], 'POST') as $cat_id) {
113
-                $categoryHandler->addBlogs($cat_id, $blogs);
114
-            }
115
-        }
116
-        $message = planet_constant('AM_DBUPDATED');
117
-        redirect_header('admin.blog.php', 2, $message);
118
-
119
-    /* update a list of blogs */
120
-    // no break
121
-    case 'update':
122
-        foreach ($blog_id as $bid) {
123
-            $blog_obj = $blogHandler->fetch($bid);
124
-            if (!$blogHandler->insert($blog_obj)) {
125
-            }
126
-            unset($blog_obj);
127
-        }
128
-        $message = planet_constant('AM_DBUPDATED');
129
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
130
-
131
-    /* add a list of blogs to a category */
132
-    // no break
133
-    case 'register':
134
-        if (!empty(Request::getArray('category_dest', [], 'POST'))) {
135
-            if (!is_array($blog_id)) {
136
-                $blog_id = [$blog_id];
137
-            }
138
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
139
-            $categoryHandler->addBlogs(Request::getArray('category_dest', [], 'POST'), $blog_id);
140
-        }
141
-        $message = planet_constant('AM_DBUPDATED');
142
-        redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', [], 'POST') . '&amp;start=' . $start, 2, $message);
143
-
144
-    /* remove a list of blogs from a category */
145
-    // no break
146
-    case 'remove':
147
-        if (!is_array($blog_id)) {
148
-            $blog_id = [$blog_id];
149
-        }
150
-        if (!empty($category_id)) {
151
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
152
-            $categoryHandler->removeBlogs($category_id, $blog_id);
153
-        }
154
-        $message = planet_constant('AM_DBUPDATED');
155
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
156
-
157
-    /* delete a single blog or a list blogs */
158
-    // no break
159
-    case 'del':
160
-        if (!is_array($blog_id)) {
161
-            $blog_id = [$blog_id];
162
-        }
163
-        foreach ($blog_id as $bid) {
164
-            $blog_obj = $blogHandler->get($bid);
165
-            if (!$blogHandler->delete($blog_obj, true)) {
166
-            }
167
-            unset($blog_obj);
168
-        }
169
-        $message = planet_constant('AM_DBUPDATED');
170
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
171
-
172
-    /* empty a single blog or a list blogs */
173
-    // no break
174
-    case 'empty':
175
-        if (!is_array($blog_id)) {
176
-            $blog_id = [$blog_id];
177
-        }
178
-        foreach ($blog_id as $bid) {
179
-            $blog_obj = $blogHandler->get($bid);
180
-            if (!$blogHandler->do_empty($blog_obj)) {
181
-            }
182
-        }
183
-        $message = planet_constant('AM_DBUPDATED');
184
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
185
-
186
-    /* approve a single blog or a list blogs */
187
-    // no break
188
-    case 'approve':
189
-        if (!is_array($blog_id)) {
190
-            $blog_id = [$blog_id];
191
-        }
192
-        $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
193
-        $blogHandler->updateAll('blog_status', 1, $criteria, true);
194
-        $message = planet_constant('AM_DBUPDATED');
195
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
196
-
197
-    /* mark a single blog or a list blogs as featured */
198
-    // no break
199
-    case 'feature':
200
-        if (!is_array($blog_id)) {
201
-            $blog_id = [$blog_id];
202
-        }
203
-        $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
204
-        $blogHandler->updateAll('blog_status', 2, $criteria, true);
205
-        $message = planet_constant('AM_DBUPDATED');
206
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
207
-
208
-    /* edit a single blog */
209
-    // no break
210
-    case 'edit':
211
-        if (!empty(Request::getString('fetch', '', 'POST'))) {
212
-            $blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST'));
213
-            $blog_obj->setVar('blog_id', $blog_id);
214
-        } else {
215
-            $blog_obj = $blogHandler->get($blog_id);
216
-        }
217
-        $categories = Request::getArray('categories', [], 'POST');
218
-        if (empty($categories) && $blog_id > 0) {
219
-            $crit       = new Criteria('bc.blog_id', $blog_id);
220
-            $categories = array_keys($categoryHandler->getByBlog($crit));
221
-        }
222
-        if (empty($categories)) {
223
-            $categories = [0 => _NONE];
224
-        }
225
-
226
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
227
-        echo '<br>';
228
-        if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
229
-            $criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
230
-            $blogs_obj = $blogHandler->getList($criteria);
231
-            if (count($blogs_obj) > 0) {
232
-                echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS');
233
-                foreach (array_keys($blogs_obj) as $bid) {
234
-                    echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>';
235
-                }
236
-                echo '</div>';
237
-            }
238
-            unset($blogs_obj, $criteria);
239
-        }
240
-        include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
241
-        echo '</fieldset>';
242
-        break;
243
-
244
-    default:
245
-
246
-        $crit = new Criteria('1', 1);
247
-        $crit->setSort('cat_order');
248
-        $crit->setOrder('ASC');
249
-        $categories = $categoryHandler->getList($crit);
250
-
251
-        // Display category option form
252
-        $opform    = new XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get');
253
-        $op_select = new XoopsFormSelect('', 'category', $category_id);
254
-        $op_select->setExtra('onchange="document.forms.opform.submit()"');
255
-        $options = [
256
-            '0'  => _ALL,
257
-            '-1' => planet_constant('MD_ACTIVE'),
258
-            '-2' => planet_constant('MD_FEATURED'),
259
-            '-3' => planet_constant('MD_PENDING')
260
-        ];
261
-        foreach (array_keys($categories) as $key) {
262
-            $options[$key] = $categories[$key];
263
-        }
264
-        $op_select->addOptionArray($options);
265
-        $opform->addElement($op_select);
266
-        $opform->display();
267
-
268
-        if ($category_id > 0) {
269
-            $criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>'));
270
-            $criteria->add(new Criteria('bc.cat_id', $category_id));
271
-            $blog_count = $blogHandler->getCountByCategory($criteria);
272
-            $criteria->setStart($start);
273
-            $criteria->setLimit($xoopsModuleConfig['list_perpage']);
274
-            $blog_objs = $blogHandler->getByCategory($criteria);
275
-        } else {
276
-            /* All active blogs */
277
-            if (0 == $category_id) {
278
-                $criteria = new Criteria('1', 1);
279
-                $criteria->setStart($start);
280
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
281
-                /* Active blogs */
282
-            } elseif ($category_id == -1) {
283
-                $criteria = new Criteria('blog_status', 1);
284
-                $criteria->setStart($start);
285
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
286
-                /* Featured blogs */
287
-            } elseif ($category_id == -2) {
288
-                $criteria = new Criteria('blog_status', 2);
289
-                $criteria->setStart($start);
290
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
291
-                /* Pending blogs */
292
-            } else {
293
-                $criteria = new Criteria('blog_status', 0);
294
-                $criteria->setStart($start);
295
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
296
-            }
297
-            $blog_count = $blogHandler->getCount($criteria);
298
-            $blog_objs  = $blogHandler->getAll($criteria);
299
-        }
300
-
301
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
302
-        echo "<br style=\"clear:both\">";
303
-
304
-        echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>";
305
-        echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
306
-        echo "<tr align='center'>";
307
-        echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>";
308
-        echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>';
309
-        echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>';
310
-        echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>';
311
-        //        echo "<th class='bg3' width='5%'>" . _EDIT . "</td>";
312
-        //        echo "<th class='bg3' width='5%'>" . _DELETE . "</td>";
313
-        echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>';
314
-        echo '</tr>';
315
-
316
-        $status = [
317
-            '0' => planet_constant('MD_PENDING'),
318
-            '1' => planet_constant('MD_ACTIVE'),
319
-            '2' => planet_constant('MD_FEATURED')
320
-        ];
321
-        foreach (array_keys($blog_objs) as $bid) {
322
-            echo "<tr class='odd' align='left'>";
323
-            echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>";
324
-            echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>';
325
-            echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>';
326
-            echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>';
327
-            echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a>
59
+	/* save a single blog */
60
+	case 'save':
61
+
62
+		if ($blog_id) {
63
+			$blog_obj = $blogHandler->get($blog_id);
64
+		} else {
65
+			if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) {
66
+				redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS'));
67
+			}
68
+			$blog_obj = $blogHandler->create();
69
+			$blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid'));
70
+		}
71
+
72
+		$blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']);
73
+		$blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']);
74
+		$blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']);
75
+		$blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']);
76
+		$blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']);
77
+		$blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']);
78
+		$blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']);
79
+		$blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']);
80
+		$blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']);
81
+
82
+		if (!$blogHandler->insert($blog_obj)) {
83
+		} elseif (!empty(Request::getArray('categories', [], 'POST'))) {
84
+			$blog_id = $blog_obj->getVar('blog_id');
85
+			if (in_array(0, Request::getArray('categories', [], 'POST'))) {
86
+				$_POST['categories'] = [];
87
+			}
88
+			$blogHandler->setCategories($blog_id, Request::getArray('categories', [], 'POST'));
89
+		}
90
+		$message = planet_constant('AM_DBUPDATED');
91
+		redirect_header('admin.blog.php', 2, $message);
92
+
93
+	/* fetch and add a list of blogs to a category */
94
+	// no break
95
+	case 'add':
96
+		$links = PlanetUtility::planetParseLinks(Request::getArray('links', [], 'POST'));
97
+		$blogs = [];
98
+		foreach ($links as $link) {
99
+			if ($blog_exist = $blogHandler->getCount(new Criteria('blog_feed', $link['url']))) {
100
+				continue;
101
+			}
102
+			$blog_obj = $blogHandler->fetch($link['url']);
103
+			if (!empty($link['title'])) {
104
+				$blog_obj->setVar('blog_title', $link['title']);
105
+			}
106
+			$blogHandler->insert($blog_obj);
107
+			$blogs[] = $blog_obj->getVar('blog_id');
108
+			unset($blog_obj);
109
+		}
110
+		if (!empty(Request::getArray('categories', [], 'POST'))) {
111
+			$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
112
+			foreach (Request::getArray('categories', [], 'POST') as $cat_id) {
113
+				$categoryHandler->addBlogs($cat_id, $blogs);
114
+			}
115
+		}
116
+		$message = planet_constant('AM_DBUPDATED');
117
+		redirect_header('admin.blog.php', 2, $message);
118
+
119
+	/* update a list of blogs */
120
+	// no break
121
+	case 'update':
122
+		foreach ($blog_id as $bid) {
123
+			$blog_obj = $blogHandler->fetch($bid);
124
+			if (!$blogHandler->insert($blog_obj)) {
125
+			}
126
+			unset($blog_obj);
127
+		}
128
+		$message = planet_constant('AM_DBUPDATED');
129
+		redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
130
+
131
+	/* add a list of blogs to a category */
132
+	// no break
133
+	case 'register':
134
+		if (!empty(Request::getArray('category_dest', [], 'POST'))) {
135
+			if (!is_array($blog_id)) {
136
+				$blog_id = [$blog_id];
137
+			}
138
+			$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
139
+			$categoryHandler->addBlogs(Request::getArray('category_dest', [], 'POST'), $blog_id);
140
+		}
141
+		$message = planet_constant('AM_DBUPDATED');
142
+		redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', [], 'POST') . '&amp;start=' . $start, 2, $message);
143
+
144
+	/* remove a list of blogs from a category */
145
+	// no break
146
+	case 'remove':
147
+		if (!is_array($blog_id)) {
148
+			$blog_id = [$blog_id];
149
+		}
150
+		if (!empty($category_id)) {
151
+			$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
152
+			$categoryHandler->removeBlogs($category_id, $blog_id);
153
+		}
154
+		$message = planet_constant('AM_DBUPDATED');
155
+		redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
156
+
157
+	/* delete a single blog or a list blogs */
158
+	// no break
159
+	case 'del':
160
+		if (!is_array($blog_id)) {
161
+			$blog_id = [$blog_id];
162
+		}
163
+		foreach ($blog_id as $bid) {
164
+			$blog_obj = $blogHandler->get($bid);
165
+			if (!$blogHandler->delete($blog_obj, true)) {
166
+			}
167
+			unset($blog_obj);
168
+		}
169
+		$message = planet_constant('AM_DBUPDATED');
170
+		redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
171
+
172
+	/* empty a single blog or a list blogs */
173
+	// no break
174
+	case 'empty':
175
+		if (!is_array($blog_id)) {
176
+			$blog_id = [$blog_id];
177
+		}
178
+		foreach ($blog_id as $bid) {
179
+			$blog_obj = $blogHandler->get($bid);
180
+			if (!$blogHandler->do_empty($blog_obj)) {
181
+			}
182
+		}
183
+		$message = planet_constant('AM_DBUPDATED');
184
+		redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
185
+
186
+	/* approve a single blog or a list blogs */
187
+	// no break
188
+	case 'approve':
189
+		if (!is_array($blog_id)) {
190
+			$blog_id = [$blog_id];
191
+		}
192
+		$criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
193
+		$blogHandler->updateAll('blog_status', 1, $criteria, true);
194
+		$message = planet_constant('AM_DBUPDATED');
195
+		redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
196
+
197
+	/* mark a single blog or a list blogs as featured */
198
+	// no break
199
+	case 'feature':
200
+		if (!is_array($blog_id)) {
201
+			$blog_id = [$blog_id];
202
+		}
203
+		$criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
204
+		$blogHandler->updateAll('blog_status', 2, $criteria, true);
205
+		$message = planet_constant('AM_DBUPDATED');
206
+		redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
207
+
208
+	/* edit a single blog */
209
+	// no break
210
+	case 'edit':
211
+		if (!empty(Request::getString('fetch', '', 'POST'))) {
212
+			$blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST'));
213
+			$blog_obj->setVar('blog_id', $blog_id);
214
+		} else {
215
+			$blog_obj = $blogHandler->get($blog_id);
216
+		}
217
+		$categories = Request::getArray('categories', [], 'POST');
218
+		if (empty($categories) && $blog_id > 0) {
219
+			$crit       = new Criteria('bc.blog_id', $blog_id);
220
+			$categories = array_keys($categoryHandler->getByBlog($crit));
221
+		}
222
+		if (empty($categories)) {
223
+			$categories = [0 => _NONE];
224
+		}
225
+
226
+		echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
227
+		echo '<br>';
228
+		if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
229
+			$criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
230
+			$blogs_obj = $blogHandler->getList($criteria);
231
+			if (count($blogs_obj) > 0) {
232
+				echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS');
233
+				foreach (array_keys($blogs_obj) as $bid) {
234
+					echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>';
235
+				}
236
+				echo '</div>';
237
+			}
238
+			unset($blogs_obj, $criteria);
239
+		}
240
+		include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
241
+		echo '</fieldset>';
242
+		break;
243
+
244
+	default:
245
+
246
+		$crit = new Criteria('1', 1);
247
+		$crit->setSort('cat_order');
248
+		$crit->setOrder('ASC');
249
+		$categories = $categoryHandler->getList($crit);
250
+
251
+		// Display category option form
252
+		$opform    = new XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get');
253
+		$op_select = new XoopsFormSelect('', 'category', $category_id);
254
+		$op_select->setExtra('onchange="document.forms.opform.submit()"');
255
+		$options = [
256
+			'0'  => _ALL,
257
+			'-1' => planet_constant('MD_ACTIVE'),
258
+			'-2' => planet_constant('MD_FEATURED'),
259
+			'-3' => planet_constant('MD_PENDING')
260
+		];
261
+		foreach (array_keys($categories) as $key) {
262
+			$options[$key] = $categories[$key];
263
+		}
264
+		$op_select->addOptionArray($options);
265
+		$opform->addElement($op_select);
266
+		$opform->display();
267
+
268
+		if ($category_id > 0) {
269
+			$criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>'));
270
+			$criteria->add(new Criteria('bc.cat_id', $category_id));
271
+			$blog_count = $blogHandler->getCountByCategory($criteria);
272
+			$criteria->setStart($start);
273
+			$criteria->setLimit($xoopsModuleConfig['list_perpage']);
274
+			$blog_objs = $blogHandler->getByCategory($criteria);
275
+		} else {
276
+			/* All active blogs */
277
+			if (0 == $category_id) {
278
+				$criteria = new Criteria('1', 1);
279
+				$criteria->setStart($start);
280
+				$criteria->setLimit($xoopsModuleConfig['list_perpage']);
281
+				/* Active blogs */
282
+			} elseif ($category_id == -1) {
283
+				$criteria = new Criteria('blog_status', 1);
284
+				$criteria->setStart($start);
285
+				$criteria->setLimit($xoopsModuleConfig['list_perpage']);
286
+				/* Featured blogs */
287
+			} elseif ($category_id == -2) {
288
+				$criteria = new Criteria('blog_status', 2);
289
+				$criteria->setStart($start);
290
+				$criteria->setLimit($xoopsModuleConfig['list_perpage']);
291
+				/* Pending blogs */
292
+			} else {
293
+				$criteria = new Criteria('blog_status', 0);
294
+				$criteria->setStart($start);
295
+				$criteria->setLimit($xoopsModuleConfig['list_perpage']);
296
+			}
297
+			$blog_count = $blogHandler->getCount($criteria);
298
+			$blog_objs  = $blogHandler->getAll($criteria);
299
+		}
300
+
301
+		echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
302
+		echo "<br style=\"clear:both\">";
303
+
304
+		echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>";
305
+		echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
306
+		echo "<tr align='center'>";
307
+		echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>";
308
+		echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>';
309
+		echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>';
310
+		echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>';
311
+		//        echo "<th class='bg3' width='5%'>" . _EDIT . "</td>";
312
+		//        echo "<th class='bg3' width='5%'>" . _DELETE . "</td>";
313
+		echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>';
314
+		echo '</tr>';
315
+
316
+		$status = [
317
+			'0' => planet_constant('MD_PENDING'),
318
+			'1' => planet_constant('MD_ACTIVE'),
319
+			'2' => planet_constant('MD_FEATURED')
320
+		];
321
+		foreach (array_keys($blog_objs) as $bid) {
322
+			echo "<tr class='odd' align='left'>";
323
+			echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>";
324
+			echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>';
325
+			echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>';
326
+			echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>';
327
+			echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a>
328 328
                       <a href='admin.blog.php?op=del&amp;blog=" . $bid . "' title='" . _DELETE . "'><img src='" . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a>&nbsp;
329 329
                       <a href='admin.blog.php?op=empty&amp;blog=" . $bid . "' title='" . planet_constant('MD_EMPTY_BLOG') . "'><img src='" . $pathIcon16 . "/empty.png '" . " alt='" . _EDIT . " title='" . planet_constant('MD_EMPTY_BLOG') . '</a></td>';
330 330
 
331
-            echo '</tr>';
332
-        }
333
-        echo "<tr class='even' align='center'>";
334
-        echo "<td colspan='7'>";
335
-        echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>";
336
-        echo "<option value=''>" . _SELECT . '</option>';
337
-        echo "<option value='del'>" . _DELETE . '</option>';
338
-        echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>';
339
-        echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>';
340
-        if ($category_id > 0) {
341
-            echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>';
342
-        }
343
-        echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>';
344
-        echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>';
345
-        echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>';
346
-
347
-        echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>';
348
-        echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>';
349
-
350
-        echo '</select>';
351
-        echo "<div id='catdiv' style='visibility:hidden;display:inline;'>";
352
-        echo "<select name='category_dest'>";
353
-        echo "<option value=''>" . _SELECT . '</option>';
354
-        foreach ($categories as $cid => $name) {
355
-            echo "<option value='" . $cid . "'>" . $name . '</option>';
356
-        }
357
-        echo '</select>';
358
-        echo '</div>';
359
-        echo "<input name='start' value='" . $start . "' type='hidden'>";
360
-        echo "<input name='category' value='" . $category_id . "' type='hidden'>";
361
-        echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
362
-        echo "<input name='' value='" . _CANCEL . "' type='reset'>";
363
-        echo '</td>';
364
-        echo '</tr>';
365
-        if ($blog_count > $xoopsModuleConfig['list_perpage']) {
366
-            include XOOPS_ROOT_PATH . '/class/pagenav.php';
367
-            $nav     = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category=' . $category_id);
368
-            $pagenav = $nav->renderNav(4);
369
-            echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>';
370
-        }
371
-        echo '</table></form>';
372
-        echo "</fieldset><br style='clear:both;'>";
373
-
374
-        if (empty($start) && empty($category_id)) {
375
-            $form = new XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true);
376
-            $form->addElement(new XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true);
377
-            $form->addElement(new XoopsFormHidden('op', 'edit'));
378
-            $button_tray = new XoopsFormElementTray('', '');
379
-            $butt_save   = new XoopsFormButton('', 'fetch', _SUBMIT, 'submit');
380
-            $button_tray->addElement($butt_save);
381
-            $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
382
-            $button_tray->addElement($butt_cancel);
383
-            $form->addElement($button_tray);
384
-
385
-            $form_add = new XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true);
386
-            $form_add->addElement(new XoopsFormTextArea(planet_constant('AM_FEED'), 'links'));
387
-            $form_add->addElement(new XoopsFormHidden('op', 'add'));
388
-            $button_tray = new XoopsFormElementTray('', '');
389
-            $butt_save   = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
390
-            $button_tray->addElement($butt_save);
391
-            $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
392
-            $button_tray->addElement($butt_cancel);
393
-            $form_add->addElement($button_tray);
394
-
395
-            echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
396
-            echo '<br>';
397
-            $form->display();
398
-            $form_add->display();
399
-            echo '</fieldset>';
400
-        }
401
-        break;
331
+			echo '</tr>';
332
+		}
333
+		echo "<tr class='even' align='center'>";
334
+		echo "<td colspan='7'>";
335
+		echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>";
336
+		echo "<option value=''>" . _SELECT . '</option>';
337
+		echo "<option value='del'>" . _DELETE . '</option>';
338
+		echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>';
339
+		echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>';
340
+		if ($category_id > 0) {
341
+			echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>';
342
+		}
343
+		echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>';
344
+		echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>';
345
+		echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>';
346
+
347
+		echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>';
348
+		echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>';
349
+
350
+		echo '</select>';
351
+		echo "<div id='catdiv' style='visibility:hidden;display:inline;'>";
352
+		echo "<select name='category_dest'>";
353
+		echo "<option value=''>" . _SELECT . '</option>';
354
+		foreach ($categories as $cid => $name) {
355
+			echo "<option value='" . $cid . "'>" . $name . '</option>';
356
+		}
357
+		echo '</select>';
358
+		echo '</div>';
359
+		echo "<input name='start' value='" . $start . "' type='hidden'>";
360
+		echo "<input name='category' value='" . $category_id . "' type='hidden'>";
361
+		echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
362
+		echo "<input name='' value='" . _CANCEL . "' type='reset'>";
363
+		echo '</td>';
364
+		echo '</tr>';
365
+		if ($blog_count > $xoopsModuleConfig['list_perpage']) {
366
+			include XOOPS_ROOT_PATH . '/class/pagenav.php';
367
+			$nav     = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category=' . $category_id);
368
+			$pagenav = $nav->renderNav(4);
369
+			echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>';
370
+		}
371
+		echo '</table></form>';
372
+		echo "</fieldset><br style='clear:both;'>";
373
+
374
+		if (empty($start) && empty($category_id)) {
375
+			$form = new XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true);
376
+			$form->addElement(new XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true);
377
+			$form->addElement(new XoopsFormHidden('op', 'edit'));
378
+			$button_tray = new XoopsFormElementTray('', '');
379
+			$butt_save   = new XoopsFormButton('', 'fetch', _SUBMIT, 'submit');
380
+			$button_tray->addElement($butt_save);
381
+			$butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
382
+			$button_tray->addElement($butt_cancel);
383
+			$form->addElement($button_tray);
384
+
385
+			$form_add = new XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true);
386
+			$form_add->addElement(new XoopsFormTextArea(planet_constant('AM_FEED'), 'links'));
387
+			$form_add->addElement(new XoopsFormHidden('op', 'add'));
388
+			$button_tray = new XoopsFormElementTray('', '');
389
+			$butt_save   = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
390
+			$button_tray->addElement($butt_save);
391
+			$butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
392
+			$button_tray->addElement($butt_cancel);
393
+			$form_add->addElement($button_tray);
394
+
395
+			echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
396
+			echo '<br>';
397
+			$form->display();
398
+			$form_add->display();
399
+			echo '</fieldset>';
400
+		}
401
+		break;
402 402
 }
403 403
 
404 404
 xoops_cp_footer();
Please login to merge, or discard this patch.
Switch Indentation   +339 added lines, -339 removed lines patch added patch discarded remove patch
@@ -57,348 +57,348 @@
 block discarded – undo
57 57
 
58 58
 switch ($op) {
59 59
     /* save a single blog */
60
-    case 'save':
61
-
62
-        if ($blog_id) {
63
-            $blog_obj = $blogHandler->get($blog_id);
64
-        } else {
65
-            if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) {
66
-                redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS'));
67
-            }
68
-            $blog_obj = $blogHandler->create();
69
-            $blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid'));
70
-        }
71
-
72
-        $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']);
73
-        $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']);
74
-        $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']);
75
-        $blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']);
76
-        $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']);
77
-        $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']);
78
-        $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']);
79
-        $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']);
80
-        $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']);
81
-
82
-        if (!$blogHandler->insert($blog_obj)) {
83
-        } elseif (!empty(Request::getArray('categories', [], 'POST'))) {
84
-            $blog_id = $blog_obj->getVar('blog_id');
85
-            if (in_array(0, Request::getArray('categories', [], 'POST'))) {
86
-                $_POST['categories'] = [];
87
-            }
88
-            $blogHandler->setCategories($blog_id, Request::getArray('categories', [], 'POST'));
89
-        }
90
-        $message = planet_constant('AM_DBUPDATED');
91
-        redirect_header('admin.blog.php', 2, $message);
92
-
93
-    /* fetch and add a list of blogs to a category */
94
-    // no break
95
-    case 'add':
96
-        $links = PlanetUtility::planetParseLinks(Request::getArray('links', [], 'POST'));
97
-        $blogs = [];
98
-        foreach ($links as $link) {
99
-            if ($blog_exist = $blogHandler->getCount(new Criteria('blog_feed', $link['url']))) {
100
-                continue;
101
-            }
102
-            $blog_obj = $blogHandler->fetch($link['url']);
103
-            if (!empty($link['title'])) {
104
-                $blog_obj->setVar('blog_title', $link['title']);
105
-            }
106
-            $blogHandler->insert($blog_obj);
107
-            $blogs[] = $blog_obj->getVar('blog_id');
108
-            unset($blog_obj);
109
-        }
110
-        if (!empty(Request::getArray('categories', [], 'POST'))) {
111
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
112
-            foreach (Request::getArray('categories', [], 'POST') as $cat_id) {
113
-                $categoryHandler->addBlogs($cat_id, $blogs);
114
-            }
115
-        }
116
-        $message = planet_constant('AM_DBUPDATED');
117
-        redirect_header('admin.blog.php', 2, $message);
118
-
119
-    /* update a list of blogs */
120
-    // no break
121
-    case 'update':
122
-        foreach ($blog_id as $bid) {
123
-            $blog_obj = $blogHandler->fetch($bid);
124
-            if (!$blogHandler->insert($blog_obj)) {
125
-            }
126
-            unset($blog_obj);
127
-        }
128
-        $message = planet_constant('AM_DBUPDATED');
129
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
130
-
131
-    /* add a list of blogs to a category */
132
-    // no break
133
-    case 'register':
134
-        if (!empty(Request::getArray('category_dest', [], 'POST'))) {
135
-            if (!is_array($blog_id)) {
136
-                $blog_id = [$blog_id];
137
-            }
138
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
139
-            $categoryHandler->addBlogs(Request::getArray('category_dest', [], 'POST'), $blog_id);
140
-        }
141
-        $message = planet_constant('AM_DBUPDATED');
142
-        redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', [], 'POST') . '&amp;start=' . $start, 2, $message);
143
-
144
-    /* remove a list of blogs from a category */
145
-    // no break
146
-    case 'remove':
147
-        if (!is_array($blog_id)) {
148
-            $blog_id = [$blog_id];
149
-        }
150
-        if (!empty($category_id)) {
151
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
152
-            $categoryHandler->removeBlogs($category_id, $blog_id);
153
-        }
154
-        $message = planet_constant('AM_DBUPDATED');
155
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
156
-
157
-    /* delete a single blog or a list blogs */
158
-    // no break
159
-    case 'del':
160
-        if (!is_array($blog_id)) {
161
-            $blog_id = [$blog_id];
162
-        }
163
-        foreach ($blog_id as $bid) {
164
-            $blog_obj = $blogHandler->get($bid);
165
-            if (!$blogHandler->delete($blog_obj, true)) {
166
-            }
167
-            unset($blog_obj);
168
-        }
169
-        $message = planet_constant('AM_DBUPDATED');
170
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
171
-
172
-    /* empty a single blog or a list blogs */
173
-    // no break
174
-    case 'empty':
175
-        if (!is_array($blog_id)) {
176
-            $blog_id = [$blog_id];
177
-        }
178
-        foreach ($blog_id as $bid) {
179
-            $blog_obj = $blogHandler->get($bid);
180
-            if (!$blogHandler->do_empty($blog_obj)) {
181
-            }
182
-        }
183
-        $message = planet_constant('AM_DBUPDATED');
184
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
185
-
186
-    /* approve a single blog or a list blogs */
187
-    // no break
188
-    case 'approve':
189
-        if (!is_array($blog_id)) {
190
-            $blog_id = [$blog_id];
191
-        }
192
-        $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
193
-        $blogHandler->updateAll('blog_status', 1, $criteria, true);
194
-        $message = planet_constant('AM_DBUPDATED');
195
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
196
-
197
-    /* mark a single blog or a list blogs as featured */
198
-    // no break
199
-    case 'feature':
200
-        if (!is_array($blog_id)) {
201
-            $blog_id = [$blog_id];
202
-        }
203
-        $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
204
-        $blogHandler->updateAll('blog_status', 2, $criteria, true);
205
-        $message = planet_constant('AM_DBUPDATED');
206
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
207
-
208
-    /* edit a single blog */
209
-    // no break
210
-    case 'edit':
211
-        if (!empty(Request::getString('fetch', '', 'POST'))) {
212
-            $blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST'));
213
-            $blog_obj->setVar('blog_id', $blog_id);
214
-        } else {
215
-            $blog_obj = $blogHandler->get($blog_id);
216
-        }
217
-        $categories = Request::getArray('categories', [], 'POST');
218
-        if (empty($categories) && $blog_id > 0) {
219
-            $crit       = new Criteria('bc.blog_id', $blog_id);
220
-            $categories = array_keys($categoryHandler->getByBlog($crit));
221
-        }
222
-        if (empty($categories)) {
223
-            $categories = [0 => _NONE];
224
-        }
225
-
226
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
227
-        echo '<br>';
228
-        if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
229
-            $criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
230
-            $blogs_obj = $blogHandler->getList($criteria);
231
-            if (count($blogs_obj) > 0) {
232
-                echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS');
233
-                foreach (array_keys($blogs_obj) as $bid) {
234
-                    echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>';
235
-                }
236
-                echo '</div>';
237
-            }
238
-            unset($blogs_obj, $criteria);
239
-        }
240
-        include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
241
-        echo '</fieldset>';
242
-        break;
243
-
244
-    default:
245
-
246
-        $crit = new Criteria('1', 1);
247
-        $crit->setSort('cat_order');
248
-        $crit->setOrder('ASC');
249
-        $categories = $categoryHandler->getList($crit);
250
-
251
-        // Display category option form
252
-        $opform    = new XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get');
253
-        $op_select = new XoopsFormSelect('', 'category', $category_id);
254
-        $op_select->setExtra('onchange="document.forms.opform.submit()"');
255
-        $options = [
256
-            '0'  => _ALL,
257
-            '-1' => planet_constant('MD_ACTIVE'),
258
-            '-2' => planet_constant('MD_FEATURED'),
259
-            '-3' => planet_constant('MD_PENDING')
260
-        ];
261
-        foreach (array_keys($categories) as $key) {
262
-            $options[$key] = $categories[$key];
263
-        }
264
-        $op_select->addOptionArray($options);
265
-        $opform->addElement($op_select);
266
-        $opform->display();
267
-
268
-        if ($category_id > 0) {
269
-            $criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>'));
270
-            $criteria->add(new Criteria('bc.cat_id', $category_id));
271
-            $blog_count = $blogHandler->getCountByCategory($criteria);
272
-            $criteria->setStart($start);
273
-            $criteria->setLimit($xoopsModuleConfig['list_perpage']);
274
-            $blog_objs = $blogHandler->getByCategory($criteria);
275
-        } else {
276
-            /* All active blogs */
277
-            if (0 == $category_id) {
278
-                $criteria = new Criteria('1', 1);
279
-                $criteria->setStart($start);
280
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
281
-                /* Active blogs */
282
-            } elseif ($category_id == -1) {
283
-                $criteria = new Criteria('blog_status', 1);
284
-                $criteria->setStart($start);
285
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
286
-                /* Featured blogs */
287
-            } elseif ($category_id == -2) {
288
-                $criteria = new Criteria('blog_status', 2);
289
-                $criteria->setStart($start);
290
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
291
-                /* Pending blogs */
292
-            } else {
293
-                $criteria = new Criteria('blog_status', 0);
294
-                $criteria->setStart($start);
295
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
296
-            }
297
-            $blog_count = $blogHandler->getCount($criteria);
298
-            $blog_objs  = $blogHandler->getAll($criteria);
299
-        }
300
-
301
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
302
-        echo "<br style=\"clear:both\">";
303
-
304
-        echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>";
305
-        echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
306
-        echo "<tr align='center'>";
307
-        echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>";
308
-        echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>';
309
-        echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>';
310
-        echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>';
311
-        //        echo "<th class='bg3' width='5%'>" . _EDIT . "</td>";
312
-        //        echo "<th class='bg3' width='5%'>" . _DELETE . "</td>";
313
-        echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>';
314
-        echo '</tr>';
315
-
316
-        $status = [
317
-            '0' => planet_constant('MD_PENDING'),
318
-            '1' => planet_constant('MD_ACTIVE'),
319
-            '2' => planet_constant('MD_FEATURED')
320
-        ];
321
-        foreach (array_keys($blog_objs) as $bid) {
322
-            echo "<tr class='odd' align='left'>";
323
-            echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>";
324
-            echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>';
325
-            echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>';
326
-            echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>';
327
-            echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a>
60
+    	case 'save':
61
+
62
+        	if ($blog_id) {
63
+            	$blog_obj = $blogHandler->get($blog_id);
64
+        	} else {
65
+            	if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) {
66
+                	redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS'));
67
+            	}
68
+            	$blog_obj = $blogHandler->create();
69
+            	$blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid'));
70
+        	}
71
+
72
+        	$blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']);
73
+        	$blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']);
74
+        	$blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']);
75
+        	$blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']);
76
+        	$blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']);
77
+        	$blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']);
78
+        	$blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']);
79
+        	$blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']);
80
+        	$blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']);
81
+
82
+        	if (!$blogHandler->insert($blog_obj)) {
83
+        	} elseif (!empty(Request::getArray('categories', [], 'POST'))) {
84
+            	$blog_id = $blog_obj->getVar('blog_id');
85
+            	if (in_array(0, Request::getArray('categories', [], 'POST'))) {
86
+                	$_POST['categories'] = [];
87
+            	}
88
+            	$blogHandler->setCategories($blog_id, Request::getArray('categories', [], 'POST'));
89
+        	}
90
+        	$message = planet_constant('AM_DBUPDATED');
91
+        	redirect_header('admin.blog.php', 2, $message);
92
+
93
+    	/* fetch and add a list of blogs to a category */
94
+    	// no break
95
+    	case 'add':
96
+        	$links = PlanetUtility::planetParseLinks(Request::getArray('links', [], 'POST'));
97
+        	$blogs = [];
98
+        	foreach ($links as $link) {
99
+            	if ($blog_exist = $blogHandler->getCount(new Criteria('blog_feed', $link['url']))) {
100
+                	continue;
101
+            	}
102
+            	$blog_obj = $blogHandler->fetch($link['url']);
103
+            	if (!empty($link['title'])) {
104
+                	$blog_obj->setVar('blog_title', $link['title']);
105
+            	}
106
+            	$blogHandler->insert($blog_obj);
107
+            	$blogs[] = $blog_obj->getVar('blog_id');
108
+            	unset($blog_obj);
109
+        	}
110
+        	if (!empty(Request::getArray('categories', [], 'POST'))) {
111
+            	$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
112
+            	foreach (Request::getArray('categories', [], 'POST') as $cat_id) {
113
+                	$categoryHandler->addBlogs($cat_id, $blogs);
114
+            	}
115
+        	}
116
+        	$message = planet_constant('AM_DBUPDATED');
117
+        	redirect_header('admin.blog.php', 2, $message);
118
+
119
+    	/* update a list of blogs */
120
+    	// no break
121
+    	case 'update':
122
+        	foreach ($blog_id as $bid) {
123
+            	$blog_obj = $blogHandler->fetch($bid);
124
+            	if (!$blogHandler->insert($blog_obj)) {
125
+            	}
126
+            	unset($blog_obj);
127
+        	}
128
+        	$message = planet_constant('AM_DBUPDATED');
129
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
130
+
131
+    	/* add a list of blogs to a category */
132
+    	// no break
133
+    	case 'register':
134
+        	if (!empty(Request::getArray('category_dest', [], 'POST'))) {
135
+            	if (!is_array($blog_id)) {
136
+                	$blog_id = [$blog_id];
137
+            	}
138
+            	$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
139
+            	$categoryHandler->addBlogs(Request::getArray('category_dest', [], 'POST'), $blog_id);
140
+        	}
141
+        	$message = planet_constant('AM_DBUPDATED');
142
+        	redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', [], 'POST') . '&amp;start=' . $start, 2, $message);
143
+
144
+    	/* remove a list of blogs from a category */
145
+    	// no break
146
+    	case 'remove':
147
+        	if (!is_array($blog_id)) {
148
+            	$blog_id = [$blog_id];
149
+        	}
150
+        	if (!empty($category_id)) {
151
+            	$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
152
+            	$categoryHandler->removeBlogs($category_id, $blog_id);
153
+        	}
154
+        	$message = planet_constant('AM_DBUPDATED');
155
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
156
+
157
+    	/* delete a single blog or a list blogs */
158
+    	// no break
159
+    	case 'del':
160
+        	if (!is_array($blog_id)) {
161
+            	$blog_id = [$blog_id];
162
+        	}
163
+        	foreach ($blog_id as $bid) {
164
+            	$blog_obj = $blogHandler->get($bid);
165
+            	if (!$blogHandler->delete($blog_obj, true)) {
166
+            	}
167
+            	unset($blog_obj);
168
+        	}
169
+        	$message = planet_constant('AM_DBUPDATED');
170
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
171
+
172
+    	/* empty a single blog or a list blogs */
173
+    	// no break
174
+    	case 'empty':
175
+        	if (!is_array($blog_id)) {
176
+            	$blog_id = [$blog_id];
177
+        	}
178
+        	foreach ($blog_id as $bid) {
179
+            	$blog_obj = $blogHandler->get($bid);
180
+            	if (!$blogHandler->do_empty($blog_obj)) {
181
+            	}
182
+        	}
183
+        	$message = planet_constant('AM_DBUPDATED');
184
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
185
+
186
+    	/* approve a single blog or a list blogs */
187
+    	// no break
188
+    	case 'approve':
189
+        	if (!is_array($blog_id)) {
190
+            	$blog_id = [$blog_id];
191
+        	}
192
+        	$criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
193
+        	$blogHandler->updateAll('blog_status', 1, $criteria, true);
194
+        	$message = planet_constant('AM_DBUPDATED');
195
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
196
+
197
+    	/* mark a single blog or a list blogs as featured */
198
+    	// no break
199
+    	case 'feature':
200
+        	if (!is_array($blog_id)) {
201
+            	$blog_id = [$blog_id];
202
+        	}
203
+        	$criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
204
+        	$blogHandler->updateAll('blog_status', 2, $criteria, true);
205
+        	$message = planet_constant('AM_DBUPDATED');
206
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
207
+
208
+    	/* edit a single blog */
209
+    	// no break
210
+    	case 'edit':
211
+        	if (!empty(Request::getString('fetch', '', 'POST'))) {
212
+            	$blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST'));
213
+            	$blog_obj->setVar('blog_id', $blog_id);
214
+        	} else {
215
+            	$blog_obj = $blogHandler->get($blog_id);
216
+        	}
217
+        	$categories = Request::getArray('categories', [], 'POST');
218
+        	if (empty($categories) && $blog_id > 0) {
219
+            	$crit       = new Criteria('bc.blog_id', $blog_id);
220
+            	$categories = array_keys($categoryHandler->getByBlog($crit));
221
+        	}
222
+        	if (empty($categories)) {
223
+            	$categories = [0 => _NONE];
224
+        	}
225
+
226
+        	echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
227
+        	echo '<br>';
228
+        	if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
229
+            	$criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
230
+            	$blogs_obj = $blogHandler->getList($criteria);
231
+            	if (count($blogs_obj) > 0) {
232
+                	echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS');
233
+                	foreach (array_keys($blogs_obj) as $bid) {
234
+                    	echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>';
235
+                	}
236
+                	echo '</div>';
237
+            	}
238
+            	unset($blogs_obj, $criteria);
239
+        	}
240
+        	include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
241
+        	echo '</fieldset>';
242
+        	break;
243
+
244
+    	default:
245
+
246
+        	$crit = new Criteria('1', 1);
247
+        	$crit->setSort('cat_order');
248
+        	$crit->setOrder('ASC');
249
+        	$categories = $categoryHandler->getList($crit);
250
+
251
+        	// Display category option form
252
+        	$opform    = new XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get');
253
+        	$op_select = new XoopsFormSelect('', 'category', $category_id);
254
+        	$op_select->setExtra('onchange="document.forms.opform.submit()"');
255
+        	$options = [
256
+            	'0'  => _ALL,
257
+            	'-1' => planet_constant('MD_ACTIVE'),
258
+            	'-2' => planet_constant('MD_FEATURED'),
259
+            	'-3' => planet_constant('MD_PENDING')
260
+        	];
261
+        	foreach (array_keys($categories) as $key) {
262
+            	$options[$key] = $categories[$key];
263
+        	}
264
+        	$op_select->addOptionArray($options);
265
+        	$opform->addElement($op_select);
266
+        	$opform->display();
267
+
268
+        	if ($category_id > 0) {
269
+            	$criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>'));
270
+            	$criteria->add(new Criteria('bc.cat_id', $category_id));
271
+            	$blog_count = $blogHandler->getCountByCategory($criteria);
272
+            	$criteria->setStart($start);
273
+            	$criteria->setLimit($xoopsModuleConfig['list_perpage']);
274
+            	$blog_objs = $blogHandler->getByCategory($criteria);
275
+        	} else {
276
+            	/* All active blogs */
277
+            	if (0 == $category_id) {
278
+                	$criteria = new Criteria('1', 1);
279
+                	$criteria->setStart($start);
280
+                	$criteria->setLimit($xoopsModuleConfig['list_perpage']);
281
+                	/* Active blogs */
282
+            	} elseif ($category_id == -1) {
283
+                	$criteria = new Criteria('blog_status', 1);
284
+                	$criteria->setStart($start);
285
+                	$criteria->setLimit($xoopsModuleConfig['list_perpage']);
286
+                	/* Featured blogs */
287
+            	} elseif ($category_id == -2) {
288
+                	$criteria = new Criteria('blog_status', 2);
289
+                	$criteria->setStart($start);
290
+                	$criteria->setLimit($xoopsModuleConfig['list_perpage']);
291
+                	/* Pending blogs */
292
+            	} else {
293
+                	$criteria = new Criteria('blog_status', 0);
294
+                	$criteria->setStart($start);
295
+                	$criteria->setLimit($xoopsModuleConfig['list_perpage']);
296
+            	}
297
+            	$blog_count = $blogHandler->getCount($criteria);
298
+            	$blog_objs  = $blogHandler->getAll($criteria);
299
+        	}
300
+
301
+        	echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
302
+        	echo "<br style=\"clear:both\">";
303
+
304
+        	echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>";
305
+        	echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
306
+        	echo "<tr align='center'>";
307
+        	echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>";
308
+        	echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>';
309
+        	echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>';
310
+        	echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>';
311
+        	//        echo "<th class='bg3' width='5%'>" . _EDIT . "</td>";
312
+        	//        echo "<th class='bg3' width='5%'>" . _DELETE . "</td>";
313
+        	echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>';
314
+        	echo '</tr>';
315
+
316
+        	$status = [
317
+            	'0' => planet_constant('MD_PENDING'),
318
+            	'1' => planet_constant('MD_ACTIVE'),
319
+            	'2' => planet_constant('MD_FEATURED')
320
+        	];
321
+        	foreach (array_keys($blog_objs) as $bid) {
322
+            	echo "<tr class='odd' align='left'>";
323
+            	echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>";
324
+            	echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>';
325
+            	echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>';
326
+            	echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>';
327
+            	echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a>
328 328
                       <a href='admin.blog.php?op=del&amp;blog=" . $bid . "' title='" . _DELETE . "'><img src='" . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a>&nbsp;
329 329
                       <a href='admin.blog.php?op=empty&amp;blog=" . $bid . "' title='" . planet_constant('MD_EMPTY_BLOG') . "'><img src='" . $pathIcon16 . "/empty.png '" . " alt='" . _EDIT . " title='" . planet_constant('MD_EMPTY_BLOG') . '</a></td>';
330 330
 
331
-            echo '</tr>';
332
-        }
333
-        echo "<tr class='even' align='center'>";
334
-        echo "<td colspan='7'>";
335
-        echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>";
336
-        echo "<option value=''>" . _SELECT . '</option>';
337
-        echo "<option value='del'>" . _DELETE . '</option>';
338
-        echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>';
339
-        echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>';
340
-        if ($category_id > 0) {
341
-            echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>';
342
-        }
343
-        echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>';
344
-        echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>';
345
-        echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>';
346
-
347
-        echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>';
348
-        echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>';
349
-
350
-        echo '</select>';
351
-        echo "<div id='catdiv' style='visibility:hidden;display:inline;'>";
352
-        echo "<select name='category_dest'>";
353
-        echo "<option value=''>" . _SELECT . '</option>';
354
-        foreach ($categories as $cid => $name) {
355
-            echo "<option value='" . $cid . "'>" . $name . '</option>';
356
-        }
357
-        echo '</select>';
358
-        echo '</div>';
359
-        echo "<input name='start' value='" . $start . "' type='hidden'>";
360
-        echo "<input name='category' value='" . $category_id . "' type='hidden'>";
361
-        echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
362
-        echo "<input name='' value='" . _CANCEL . "' type='reset'>";
363
-        echo '</td>';
364
-        echo '</tr>';
365
-        if ($blog_count > $xoopsModuleConfig['list_perpage']) {
366
-            include XOOPS_ROOT_PATH . '/class/pagenav.php';
367
-            $nav     = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category=' . $category_id);
368
-            $pagenav = $nav->renderNav(4);
369
-            echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>';
370
-        }
371
-        echo '</table></form>';
372
-        echo "</fieldset><br style='clear:both;'>";
373
-
374
-        if (empty($start) && empty($category_id)) {
375
-            $form = new XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true);
376
-            $form->addElement(new XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true);
377
-            $form->addElement(new XoopsFormHidden('op', 'edit'));
378
-            $button_tray = new XoopsFormElementTray('', '');
379
-            $butt_save   = new XoopsFormButton('', 'fetch', _SUBMIT, 'submit');
380
-            $button_tray->addElement($butt_save);
381
-            $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
382
-            $button_tray->addElement($butt_cancel);
383
-            $form->addElement($button_tray);
384
-
385
-            $form_add = new XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true);
386
-            $form_add->addElement(new XoopsFormTextArea(planet_constant('AM_FEED'), 'links'));
387
-            $form_add->addElement(new XoopsFormHidden('op', 'add'));
388
-            $button_tray = new XoopsFormElementTray('', '');
389
-            $butt_save   = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
390
-            $button_tray->addElement($butt_save);
391
-            $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
392
-            $button_tray->addElement($butt_cancel);
393
-            $form_add->addElement($button_tray);
394
-
395
-            echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
396
-            echo '<br>';
397
-            $form->display();
398
-            $form_add->display();
399
-            echo '</fieldset>';
400
-        }
401
-        break;
331
+            	echo '</tr>';
332
+        	}
333
+        	echo "<tr class='even' align='center'>";
334
+        	echo "<td colspan='7'>";
335
+        	echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>";
336
+        	echo "<option value=''>" . _SELECT . '</option>';
337
+        	echo "<option value='del'>" . _DELETE . '</option>';
338
+        	echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>';
339
+        	echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>';
340
+        	if ($category_id > 0) {
341
+            	echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>';
342
+        	}
343
+        	echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>';
344
+        	echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>';
345
+        	echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>';
346
+
347
+        	echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>';
348
+        	echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>';
349
+
350
+        	echo '</select>';
351
+        	echo "<div id='catdiv' style='visibility:hidden;display:inline;'>";
352
+        	echo "<select name='category_dest'>";
353
+        	echo "<option value=''>" . _SELECT . '</option>';
354
+        	foreach ($categories as $cid => $name) {
355
+            	echo "<option value='" . $cid . "'>" . $name . '</option>';
356
+        	}
357
+        	echo '</select>';
358
+        	echo '</div>';
359
+        	echo "<input name='start' value='" . $start . "' type='hidden'>";
360
+        	echo "<input name='category' value='" . $category_id . "' type='hidden'>";
361
+        	echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
362
+        	echo "<input name='' value='" . _CANCEL . "' type='reset'>";
363
+        	echo '</td>';
364
+        	echo '</tr>';
365
+        	if ($blog_count > $xoopsModuleConfig['list_perpage']) {
366
+            	include XOOPS_ROOT_PATH . '/class/pagenav.php';
367
+            	$nav     = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category=' . $category_id);
368
+            	$pagenav = $nav->renderNav(4);
369
+            	echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>';
370
+        	}
371
+        	echo '</table></form>';
372
+        	echo "</fieldset><br style='clear:both;'>";
373
+
374
+        	if (empty($start) && empty($category_id)) {
375
+            	$form = new XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true);
376
+            	$form->addElement(new XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true);
377
+            	$form->addElement(new XoopsFormHidden('op', 'edit'));
378
+            	$button_tray = new XoopsFormElementTray('', '');
379
+            	$butt_save   = new XoopsFormButton('', 'fetch', _SUBMIT, 'submit');
380
+            	$button_tray->addElement($butt_save);
381
+            	$butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
382
+            	$button_tray->addElement($butt_cancel);
383
+            	$form->addElement($button_tray);
384
+
385
+            	$form_add = new XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true);
386
+            	$form_add->addElement(new XoopsFormTextArea(planet_constant('AM_FEED'), 'links'));
387
+            	$form_add->addElement(new XoopsFormHidden('op', 'add'));
388
+            	$button_tray = new XoopsFormElementTray('', '');
389
+            	$butt_save   = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
390
+            	$button_tray->addElement($butt_save);
391
+            	$butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
392
+            	$button_tray->addElement($butt_cancel);
393
+            	$form_add->addElement($button_tray);
394
+
395
+            	echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
396
+            	echo '<br>';
397
+            	$form->display();
398
+            	$form_add->display();
399
+            	echo '</fieldset>';
400
+        	}
401
+        	break;
402 402
 }
403 403
 
404 404
 xoops_cp_footer();
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 // ------------------------------------------------------------------------ //
27 27
 use Xmf\Request;
28 28
 
29
-require_once __DIR__ . '/admin_header.php';
30
-require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
29
+require_once __DIR__.'/admin_header.php';
30
+require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
31 31
 
32 32
 xoops_cp_header();
33 33
 $adminObject = \Xmf\Module\Admin::getInstance();
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
  * This is a tricky fix for incomplete solution of module cone
40 40
  * it is expected to have a better solution in article 1.0
41 41
  */
42
-require XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
42
+require XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
43 43
 //planet_adminmenu(2);
44 44
 
45
-$op          = Request::getString('op', Request::getString('op', '', 'POST'), 'GET');//!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : '');
46
-$blog_id     = Request::getArray('blog', Request::getArray('blog', [], 'POST'), 'GET');//!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0);
47
-$blog_id     = is_array($blog_id) ? array_map('intval', $blog_id) : (int)$blog_id;
48
-$category_id = Request::getInt('category', Request::getInt('category', 0, 'POST'), 'GET');//(int)(!empty($_POST['category']) ? $_POST['category'] : (!empty($_GET['category']) ? $_GET['category'] : 0));
49
-$start       = Request::getInt('start', Request::getInt('start', 0, 'POST'), 'GET');//(int)(!empty($_POST['start']) ? $_POST['start'] : (!empty($_GET['start']) ? $_GET['start'] : 0));
45
+$op          = Request::getString('op', Request::getString('op', '', 'POST'), 'GET'); //!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : '');
46
+$blog_id     = Request::getArray('blog', Request::getArray('blog', [], 'POST'), 'GET'); //!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0);
47
+$blog_id     = is_array($blog_id) ? array_map('intval', $blog_id) : (int) $blog_id;
48
+$category_id = Request::getInt('category', Request::getInt('category', 0, 'POST'), 'GET'); //(int)(!empty($_POST['category']) ? $_POST['category'] : (!empty($_GET['category']) ? $_GET['category'] : 0));
49
+$start       = Request::getInt('start', Request::getInt('start', 0, 'POST'), 'GET'); //(int)(!empty($_POST['start']) ? $_POST['start'] : (!empty($_GET['start']) ? $_GET['start'] : 0));
50 50
 
51 51
 $blogHandler     = xoops_getModuleHandler('blog', $GLOBALS['moddirname']);
52 52
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
         if ($blog_id) {
63 63
             $blog_obj = $blogHandler->get($blog_id);
64
-        } else {
64
+        }else {
65 65
             if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) {
66 66
                 redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS'));
67 67
             }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
             unset($blog_obj);
127 127
         }
128 128
         $message = planet_constant('AM_DBUPDATED');
129
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
129
+        redirect_header('admin.blog.php?category='.$category_id.'&amp;start='.$start, 2, $message);
130 130
 
131 131
     /* add a list of blogs to a category */
132 132
     // no break
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
             $categoryHandler->addBlogs(Request::getArray('category_dest', [], 'POST'), $blog_id);
140 140
         }
141 141
         $message = planet_constant('AM_DBUPDATED');
142
-        redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', [], 'POST') . '&amp;start=' . $start, 2, $message);
142
+        redirect_header('admin.blog.php?category='.Request::getArray('category_dest', [], 'POST').'&amp;start='.$start, 2, $message);
143 143
 
144 144
     /* remove a list of blogs from a category */
145 145
     // no break
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             $categoryHandler->removeBlogs($category_id, $blog_id);
153 153
         }
154 154
         $message = planet_constant('AM_DBUPDATED');
155
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
155
+        redirect_header('admin.blog.php?category='.$category_id.'&amp;start='.$start, 2, $message);
156 156
 
157 157
     /* delete a single blog or a list blogs */
158 158
     // no break
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             unset($blog_obj);
168 168
         }
169 169
         $message = planet_constant('AM_DBUPDATED');
170
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
170
+        redirect_header('admin.blog.php?category='.$category_id.'&amp;start='.$start, 2, $message);
171 171
 
172 172
     /* empty a single blog or a list blogs */
173 173
     // no break
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
             }
182 182
         }
183 183
         $message = planet_constant('AM_DBUPDATED');
184
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
184
+        redirect_header('admin.blog.php?category='.$category_id.'&amp;start='.$start, 2, $message);
185 185
 
186 186
     /* approve a single blog or a list blogs */
187 187
     // no break
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
         if (!is_array($blog_id)) {
190 190
             $blog_id = [$blog_id];
191 191
         }
192
-        $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
192
+        $criteria = new Criteria('blog_id', '('.implode(',', $blog_id).')', 'IN');
193 193
         $blogHandler->updateAll('blog_status', 1, $criteria, true);
194 194
         $message = planet_constant('AM_DBUPDATED');
195
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
195
+        redirect_header('admin.blog.php?category='.$category_id.'&amp;start='.$start, 2, $message);
196 196
 
197 197
     /* mark a single blog or a list blogs as featured */
198 198
     // no break
@@ -200,10 +200,10 @@  discard block
 block discarded – undo
200 200
         if (!is_array($blog_id)) {
201 201
             $blog_id = [$blog_id];
202 202
         }
203
-        $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
203
+        $criteria = new Criteria('blog_id', '('.implode(',', $blog_id).')', 'IN');
204 204
         $blogHandler->updateAll('blog_status', 2, $criteria, true);
205 205
         $message = planet_constant('AM_DBUPDATED');
206
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
206
+        redirect_header('admin.blog.php?category='.$category_id.'&amp;start='.$start, 2, $message);
207 207
 
208 208
     /* edit a single blog */
209 209
     // no break
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
         if (!empty(Request::getString('fetch', '', 'POST'))) {
212 212
             $blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST'));
213 213
             $blog_obj->setVar('blog_id', $blog_id);
214
-        } else {
214
+        }else {
215 215
             $blog_obj = $blogHandler->get($blog_id);
216 216
         }
217 217
         $categories = Request::getArray('categories', [], 'POST');
218
-        if (empty($categories) && $blog_id > 0) {
218
+        if (empty($categories) && $blog_id>0) {
219 219
             $crit       = new Criteria('bc.blog_id', $blog_id);
220 220
             $categories = array_keys($categoryHandler->getByBlog($crit));
221 221
         }
@@ -223,21 +223,21 @@  discard block
 block discarded – undo
223 223
             $categories = [0 => _NONE];
224 224
         }
225 225
 
226
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
226
+        echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._EDIT.'</legend>';
227 227
         echo '<br>';
228 228
         if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
229 229
             $criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
230 230
             $blogs_obj = $blogHandler->getList($criteria);
231
-            if (count($blogs_obj) > 0) {
232
-                echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS');
231
+            if (count($blogs_obj)>0) {
232
+                echo "<div class=\"errorMsg\">".planet_constant('AM_BLOGEXISTS');
233 233
                 foreach (array_keys($blogs_obj) as $bid) {
234
-                    echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>';
234
+                    echo "<br><a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$bid."\" target=\"_blank\">".$blogs_obj[$bid].'</a>';
235 235
                 }
236 236
                 echo '</div>';
237 237
             }
238 238
             unset($blogs_obj, $criteria);
239 239
         }
240
-        include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
240
+        include XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/form.blog.php';
241 241
         echo '</fieldset>';
242 242
         break;
243 243
 
@@ -265,14 +265,14 @@  discard block
 block discarded – undo
265 265
         $opform->addElement($op_select);
266 266
         $opform->display();
267 267
 
268
-        if ($category_id > 0) {
268
+        if ($category_id>0) {
269 269
             $criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>'));
270 270
             $criteria->add(new Criteria('bc.cat_id', $category_id));
271 271
             $blog_count = $blogHandler->getCountByCategory($criteria);
272 272
             $criteria->setStart($start);
273 273
             $criteria->setLimit($xoopsModuleConfig['list_perpage']);
274 274
             $blog_objs = $blogHandler->getByCategory($criteria);
275
-        } else {
275
+        }else {
276 276
             /* All active blogs */
277 277
             if (0 == $category_id) {
278 278
                 $criteria = new Criteria('1', 1);
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
                 $criteria->setStart($start);
290 290
                 $criteria->setLimit($xoopsModuleConfig['list_perpage']);
291 291
                 /* Pending blogs */
292
-            } else {
292
+            }else {
293 293
                 $criteria = new Criteria('blog_status', 0);
294 294
                 $criteria->setStart($start);
295 295
                 $criteria->setLimit($xoopsModuleConfig['list_perpage']);
@@ -298,19 +298,19 @@  discard block
 block discarded – undo
298 298
             $blog_objs  = $blogHandler->getAll($criteria);
299 299
         }
300 300
 
301
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
301
+        echo "<fieldset><legend style='font-weight: bold; color: #900;'>".planet_constant('AM_LIST').'</legend>';
302 302
         echo "<br style=\"clear:both\">";
303 303
 
304
-        echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>";
304
+        echo "<form name='list' id='list' method='post' action='".xoops_getenv('PHP_SELF')."'>";
305 305
         echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
306 306
         echo "<tr align='center'>";
307 307
         echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>";
308
-        echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>';
309
-        echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>';
310
-        echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>';
308
+        echo "<th class='bg3'>".planet_constant('AM_TITLE').'</td>';
309
+        echo "<th class='bg3' width='5%'>".planet_constant('AM_STATUS').'</td>';
310
+        echo "<th class='bg3' width='40%'>".planet_constant('AM_FEED').'</td>';
311 311
         //        echo "<th class='bg3' width='5%'>" . _EDIT . "</td>";
312 312
         //        echo "<th class='bg3' width='5%'>" . _DELETE . "</td>";
313
-        echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>';
313
+        echo "<th class='bg3' width='10%'>".planet_constant('AM_ACTIONS').'</td>';
314 314
         echo '</tr>';
315 315
 
316 316
         $status = [
@@ -320,53 +320,53 @@  discard block
 block discarded – undo
320 320
         ];
321 321
         foreach (array_keys($blog_objs) as $bid) {
322 322
             echo "<tr class='odd' align='left'>";
323
-            echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>";
324
-            echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>';
325
-            echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>';
326
-            echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>';
327
-            echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a>
328
-                      <a href='admin.blog.php?op=del&amp;blog=" . $bid . "' title='" . _DELETE . "'><img src='" . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a>&nbsp;
329
-                      <a href='admin.blog.php?op=empty&amp;blog=" . $bid . "' title='" . planet_constant('MD_EMPTY_BLOG') . "'><img src='" . $pathIcon16 . "/empty.png '" . " alt='" . _EDIT . " title='" . planet_constant('MD_EMPTY_BLOG') . '</a></td>';
323
+            echo "<td align='center'><input name='blog[]' value='".$bid."' type='checkbox'></td>";
324
+            echo "<td><a href='".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$bid."'>".$blog_objs[$bid]->getVar('blog_title').'</a></td>';
325
+            echo "<td align='center'>".$status[$blog_objs[$bid]->getVar('blog_status')].'</td>';
326
+            echo '<td>'.$blog_objs[$bid]->getVar('blog_feed').'</td>';
327
+            echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=".$bid."' title='"._EDIT."'><img src='".$pathIcon16."/edit.png '"."alt='"._EDIT." title='"._EDIT." </a>
328
+                      <a href='admin.blog.php?op=del&amp;blog=" . $bid."' title='"._DELETE."'><img src='".$pathIcon16."/delete.png '"." alt='"._EDIT." title='"._DELETE." </a>&nbsp;
329
+                      <a href='admin.blog.php?op=empty&amp;blog=" . $bid."' title='".planet_constant('MD_EMPTY_BLOG')."'><img src='".$pathIcon16."/empty.png '"." alt='"._EDIT." title='".planet_constant('MD_EMPTY_BLOG').'</a></td>';
330 330
 
331 331
             echo '</tr>';
332 332
         }
333 333
         echo "<tr class='even' align='center'>";
334 334
         echo "<td colspan='7'>";
335 335
         echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>";
336
-        echo "<option value=''>" . _SELECT . '</option>';
337
-        echo "<option value='del'>" . _DELETE . '</option>';
338
-        echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>';
339
-        echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>';
340
-        if ($category_id > 0) {
341
-            echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>';
336
+        echo "<option value=''>"._SELECT.'</option>';
337
+        echo "<option value='del'>"._DELETE.'</option>';
338
+        echo "<option value='empty'>".planet_constant('MD_EMPTY_BLOG').'</option>';
339
+        echo "<option value='register'>".planet_constant('AM_REGISTER').'</option>';
340
+        if ($category_id>0) {
341
+            echo "<option value='remove'>".planet_constant('AM_REMOVE').'</option>';
342 342
         }
343
-        echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>';
344
-        echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>';
345
-        echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>';
343
+        echo "<option value='approve'>".planet_constant('AM_APPROVE').'</option>';
344
+        echo "<option value='feature'>".planet_constant('AM_FEATURE').'</option>';
345
+        echo "<option value='update'>".planet_constant('AM_UPDATE').'</option>';
346 346
 
347
-        echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>';
348
-        echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>';
347
+        echo "<option value='pending'>".planet_constant('AM_PENDING').'</option>';
348
+        echo "<option value='active'>".planet_constant('AM_ACTIVE').'</option>';
349 349
 
350 350
         echo '</select>';
351 351
         echo "<div id='catdiv' style='visibility:hidden;display:inline;'>";
352 352
         echo "<select name='category_dest'>";
353
-        echo "<option value=''>" . _SELECT . '</option>';
353
+        echo "<option value=''>"._SELECT.'</option>';
354 354
         foreach ($categories as $cid => $name) {
355
-            echo "<option value='" . $cid . "'>" . $name . '</option>';
355
+            echo "<option value='".$cid."'>".$name.'</option>';
356 356
         }
357 357
         echo '</select>';
358 358
         echo '</div>';
359
-        echo "<input name='start' value='" . $start . "' type='hidden'>";
360
-        echo "<input name='category' value='" . $category_id . "' type='hidden'>";
361
-        echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
362
-        echo "<input name='' value='" . _CANCEL . "' type='reset'>";
359
+        echo "<input name='start' value='".$start."' type='hidden'>";
360
+        echo "<input name='category' value='".$category_id."' type='hidden'>";
361
+        echo "<input name='submit' value='"._SUBMIT."' type='submit'>";
362
+        echo "<input name='' value='"._CANCEL."' type='reset'>";
363 363
         echo '</td>';
364 364
         echo '</tr>';
365
-        if ($blog_count > $xoopsModuleConfig['list_perpage']) {
366
-            include XOOPS_ROOT_PATH . '/class/pagenav.php';
367
-            $nav     = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category=' . $category_id);
365
+        if ($blog_count>$xoopsModuleConfig['list_perpage']) {
366
+            include XOOPS_ROOT_PATH.'/class/pagenav.php';
367
+            $nav     = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category='.$category_id);
368 368
             $pagenav = $nav->renderNav(4);
369
-            echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>';
369
+            echo "<tr align='right'><td colspan='6'>".$pagenav.'</td></tr>';
370 370
         }
371 371
         echo '</table></form>';
372 372
         echo "</fieldset><br style='clear:both;'>";
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
             $button_tray->addElement($butt_cancel);
393 393
             $form_add->addElement($button_tray);
394 394
 
395
-            echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
395
+            echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._ADD.'</legend>';
396 396
             echo '<br>';
397 397
             $form->display();
398 398
             $form_add->display();
Please login to merge, or discard this patch.