Completed
Push — master ( 7c5656...a50592 )
by Michael
01:55
created
print.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -31,44 +31,44 @@  discard block
 block discarded – undo
31 31
 error_reporting(0);
32 32
 
33 33
 if (empty(Request::getString('print_data', '', 'POST'))) {
34
-    //$_POST['print_data']))
34
+	//$_POST['print_data']))
35 35
 
36
-    if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) {
37
-        $args['article'] = @$args_num[0];
38
-    }
36
+	if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) {
37
+		$args['article'] = @$args_num[0];
38
+	}
39 39
 
40
-    $article_id = Request::getInt('article', @$args['article'], 'POST');//(int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']);
40
+	$article_id = Request::getInt('article', @$args['article'], 'POST');//(int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']);
41 41
 
42
-    $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']);
43
-    $article_obj    = $articleHandler->get($article_id);
42
+	$articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']);
43
+	$article_obj    = $articleHandler->get($article_id);
44 44
 
45
-    $article_data = [];
45
+	$article_data = [];
46 46
 
47
-    // title
48
-    $article_data['title'] = $article_obj->getVar('art_title');
47
+	// title
48
+	$article_data['title'] = $article_obj->getVar('art_title');
49 49
 
50
-    $article_data['author'] = $article_obj->getVar('art_author');
50
+	$article_data['author'] = $article_obj->getVar('art_author');
51 51
 
52
-    // source
53
-    $article_data['source'] = $article_obj->getVar('art_link');
52
+	// source
53
+	$article_data['source'] = $article_obj->getVar('art_link');
54 54
 
55
-    // publish time
56
-    $article_data['time'] = $article_obj->getTime('l');
55
+	// publish time
56
+	$article_data['time'] = $article_obj->getTime('l');
57 57
 
58
-    // summary
59
-    $article_data['summary'] =& $article_obj->getSummary();
58
+	// summary
59
+	$article_data['summary'] =& $article_obj->getSummary();
60 60
 
61
-    // text of page
62
-    $article_data['text'] = $article_obj->getVar('art_content');
61
+	// text of page
62
+	$article_data['text'] = $article_obj->getVar('art_content');
63 63
 
64
-    $print_data['title']   = $article_data['title'];
65
-    $print_data['author']  = $article_data['author'];
66
-    $print_data['date']    = $article_data['time'];
67
-    $print_data['summary'] = empty($article_data['summary']) ? '' : planet_constant('MD_SUMMARY') . ': ' . $article_data['summary'];
68
-    $print_data['content'] = $article_data['text'];
69
-    $print_data['url']     = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/view.article.php' . URL_DELIMITER . 'c' . $category_id . '/' . $article_id . '/p' . $page;
64
+	$print_data['title']   = $article_data['title'];
65
+	$print_data['author']  = $article_data['author'];
66
+	$print_data['date']    = $article_data['time'];
67
+	$print_data['summary'] = empty($article_data['summary']) ? '' : planet_constant('MD_SUMMARY') . ': ' . $article_data['summary'];
68
+	$print_data['content'] = $article_data['text'];
69
+	$print_data['url']     = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/view.article.php' . URL_DELIMITER . 'c' . $category_id . '/' . $article_id . '/p' . $page;
70 70
 } else {
71
-    $print_data = unserialize(base64_decode(Request::getString('print_data', '', 'POST')));//$_POST['print_data']));
71
+	$print_data = unserialize(base64_decode(Request::getString('print_data', '', 'POST')));//$_POST['print_data']));
72 72
 }
73 73
 
74 74
 $print_data['image']  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/' . $xoopsModule->getInfo('image');
@@ -99,36 +99,36 @@  discard block
 block discarded – undo
99 99
             </style>\n";
100 100
 echo "</head>\n";
101 101
 echo "<body style='background-color:#ffffff; color:#000000; font-family: Arial' onload='window.print()'>\n"
102
-     . "<div style='float:center; width: 750px; border: 1px solid #000; padding: 20px;'>\n"
103
-     . "<div style='text-align: center; display: block; margin: 0 0 6px 0; padding: 5px;'>\n"
104
-     . "<img src='"
105
-     . $print_data['image']
106
-     . "' border='0' alt='"
107
-     . $print_data['module']
108
-     . "'>\n"
109
-     . '<h2>'
110
-     . $print_data['title']
111
-     . "</h2>\n"
112
-     . "</div>\n"
113
-     . "<div style='margin-top: 12px; margin-bottom: 12px; border-top: 2px solid #ccc;'></div>\n";
102
+	 . "<div style='float:center; width: 750px; border: 1px solid #000; padding: 20px;'>\n"
103
+	 . "<div style='text-align: center; display: block; margin: 0 0 6px 0; padding: 5px;'>\n"
104
+	 . "<img src='"
105
+	 . $print_data['image']
106
+	 . "' border='0' alt='"
107
+	 . $print_data['module']
108
+	 . "'>\n"
109
+	 . '<h2>'
110
+	 . $print_data['title']
111
+	 . "</h2>\n"
112
+	 . "</div>\n"
113
+	 . "<div style='margin-top: 12px; margin-bottom: 12px; border-top: 2px solid #ccc;'></div>\n";
114 114
 echo(empty($print_data['author']) ? '' : '<div>' . planet_constant('MD_AUTHOR') . ': ' . $print_data['author'] . "</div>\n")
115
-     . '<div>'
116
-     . planet_constant('MD_DATE')
117
-     . ': '
118
-     . $print_data['date']
119
-     . "</div>\n"
120
-     . (empty($article_data['summary']) ? '' : "<div style='margin-top: 12px; margin-bottom: 12px; border-top: 1px solid #ccc;'></div>\n" . '<div>' . $print_data['summary'] . "</div>\n")
121
-     . "<div style='margin-top: 12px; margin-bottom: 12px; border-top: 1px solid #ccc;'></div>\n"
122
-     . '<div>'
123
-     . $print_data['content']
124
-     . "</div>\n"
125
-     . "<div style='margin-top: 12px; margin-bottom: 12px; border-top: 2px solid #ccc;'></div>\n"
126
-     . '<div>'
127
-     . $print_data['module']
128
-     . "</div>\n"
129
-     . '<div>URL: '
130
-     . $print_data['url']
131
-     . "</div>\n"
132
-     . "</div>\n"
133
-     . "</body>\n</html>\n";
115
+	 . '<div>'
116
+	 . planet_constant('MD_DATE')
117
+	 . ': '
118
+	 . $print_data['date']
119
+	 . "</div>\n"
120
+	 . (empty($article_data['summary']) ? '' : "<div style='margin-top: 12px; margin-bottom: 12px; border-top: 1px solid #ccc;'></div>\n" . '<div>' . $print_data['summary'] . "</div>\n")
121
+	 . "<div style='margin-top: 12px; margin-bottom: 12px; border-top: 1px solid #ccc;'></div>\n"
122
+	 . '<div>'
123
+	 . $print_data['content']
124
+	 . "</div>\n"
125
+	 . "<div style='margin-top: 12px; margin-bottom: 12px; border-top: 2px solid #ccc;'></div>\n"
126
+	 . '<div>'
127
+	 . $print_data['module']
128
+	 . "</div>\n"
129
+	 . '<div>URL: '
130
+	 . $print_data['url']
131
+	 . "</div>\n"
132
+	 . "</div>\n"
133
+	 . "</body>\n</html>\n";
134 134
 exit();
Please login to merge, or discard this patch.
xml.php 1 patch
Indentation   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 include __DIR__ . '/header.php';
31 31
 
32 32
 if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) {
33
-    $args['article'] = @$args_num[0];
34
-    $args['type']    = @$args_str[0];
33
+	$args['article'] = @$args_num[0];
34
+	$args['type']    = @$args_str[0];
35 35
 }
36 36
 
37 37
 /* Specified Article */
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
 
49 49
 $valid_format = ['RSS0.91', 'RSS1.0', 'RSS2.0', 'PIE0.1', 'MBOX', 'OPML', 'ATOM', 'ATOM0.3', 'HTML', 'JS'];
50 50
 if ($type === 'RDF') {
51
-    $type = 'RSS1.0';
51
+	$type = 'RSS1.0';
52 52
 }
53 53
 if ($type === 'RSS') {
54
-    $type = 'RSS0.91';
54
+	$type = 'RSS0.91';
55 55
 }
56 56
 if (empty($type) || !in_array($type, $valid_format)) {
57
-    PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
58
-    exit();
57
+	PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
58
+	exit();
59 59
 }
60 60
 
61 61
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
@@ -64,30 +64,30 @@  discard block
 block discarded – undo
64 64
 $bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']);
65 65
 
66 66
 if (!empty($article_id)) {
67
-    $article_obj = $articleHandler->get($article_id);
68
-    if (!$article_obj->getVar('art_id')) {
69
-        PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_EXPIRED'));
70
-        exit();
71
-    }
72
-    $source = 'article';
67
+	$article_obj = $articleHandler->get($article_id);
68
+	if (!$article_obj->getVar('art_id')) {
69
+		PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_EXPIRED'));
70
+		exit();
71
+	}
72
+	$source = 'article';
73 73
 } elseif (!empty($blog_id)) {
74
-    $blog_obj = $blogHandler->get($blog_id);
75
-    if (!$blog_obj->getVar('blog_id')) {
76
-        PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
77
-        exit();
78
-    }
79
-    $source = 'blog';
74
+	$blog_obj = $blogHandler->get($blog_id);
75
+	if (!$blog_obj->getVar('blog_id')) {
76
+		PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
77
+		exit();
78
+	}
79
+	$source = 'blog';
80 80
 } elseif (!empty($category_id)) {
81
-    $source       = 'category';
82
-    $category_obj = $categoryHandler->get($category_id);
83
-    if (!$category_obj->getVar('cat_id')) {
84
-        PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
85
-        exit();
86
-    }
81
+	$source       = 'category';
82
+	$category_obj = $categoryHandler->get($category_id);
83
+	if (!$category_obj->getVar('cat_id')) {
84
+		PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
85
+		exit();
86
+	}
87 87
 } elseif (!empty($uid)) {
88
-    $source = 'bookmark';
88
+	$source = 'bookmark';
89 89
 } else {
90
-    $source = '';
90
+	$source = '';
91 91
 }
92 92
 
93 93
 $xml_charset = 'UTF-8';
@@ -97,102 +97,102 @@  discard block
 block discarded – undo
97 97
 $tpl->xoops_setCacheTime(3600);
98 98
 $xoopsCachedTemplateId = md5($xoopsModule->getVar('mid') . ',' . $article_id . ',' . $category_id . ',' . $blog_id . ',' . $uid . ',' . $type);
99 99
 if (!$tpl->is_cached('db:system_dummy.tpl', $xoopsCachedTemplateId)) {
100
-    $criteria = new CriteriaCompo();
101
-    $criteria->setLimit($xoopsModuleConfig['articles_perpage']);
102
-    $articles_obj = [];
103
-    switch ($source) {
104
-        case 'article':
105
-            $pagetitle = planet_constant('MD_ARTICLE');
106
-            $rssdesc   = planet_constant('MD_XMLDESC_ARTICLE');
107
-
108
-            $articles_obj[$article_id] = $article_obj;
109
-
110
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id');
111
-            break;
112
-
113
-        case 'category':
114
-            $pagetitle = planet_constant('MD_CATEGORY');
115
-            $rssdesc   = sprintf(planet_constant('MD_XMLDESC_CATEGORY'), $category_obj->getVar('cat_title'));
116
-
117
-            $criteria->add(new Criteria('bc.cat_id', $category_id));
118
-            $articles_obj = $articleHandler->getByCategory($criteria);
119
-
120
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'c' . $category_id;
121
-            break;
122
-
123
-        case 'blog':
124
-            $pagetitle = planet_constant('MD_BLOG');
125
-            $rssdesc   = sprintf(planet_constant('MD_XMLDESC_BLOG'), $blog_obj->getVar('blog_title'));
126
-
127
-            $criteria->add(new Criteria('blog_id', $blog_id));
128
-            $articles_obj = $articleHandler->getAll($criteria);
129
-
130
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id;
131
-            break;
132
-
133
-        case 'bookmark':
134
-            $author_name = XoopsUser::getUnameFromId($uid);
135
-            $pagetitle   = planet_constant('MD_BOOKMARKS');
136
-            $rssdesc     = sprintf(planet_constant('MD_XMLDESC_BOOKMARK'), $author_name);
137
-
138
-            $criteria->add(new Criteria('bm.bm_uid', $uid));
139
-            $articles_obj = $articleHandler->getByBookmark($criteria);
140
-
141
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid;
142
-
143
-            break;
144
-
145
-        default:
146
-            $pagetitle = planet_constant('MD_INDEX');
147
-            $rssdesc   = planet_constant('MD_XMLDESC_INDEX');
148
-
149
-            $articles_obj = $articleHandler->getAll($criteria);
150
-
151
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php';
152
-            break;
153
-    }
154
-    $items = [];
155
-    foreach (array_keys($articles_obj) as $id) {
156
-        $content = $articles_obj[$id]->getVar('art_content');
157
-        $content .= '<br>' . planet_constant('MD_SOURCE') . ': ' . $articles_obj[$id]->getVar('art_link') . ' ' . $articles_obj[$id]->getVar('art_author');
158
-        $items[] = [
159
-            'title'                     => $articles_obj[$id]->getVar('art_title'),
160
-            'link'                      => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_obj[$id]->getVar('art_id'),
161
-            'description'               => $content,
162
-            'descriptionHtmlSyndicated' => true,
163
-            'date'                      => $articles_obj[$id]->getTime('rss'),
164
-            'source'                    => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/',
165
-            'author'                    => $articles_obj[$id]->getVar('art_author')
166
-        ];
167
-    }
168
-    unset($articles_obj, $criteria);
169
-
170
-    $xmlHandler = xoops_getModuleHandler('xml', $GLOBALS['moddirname']);
171
-    $xml        = $xmlHandler->create($type);
172
-    $xml->setVar('encoding', $xml_charset);
173
-    $xml->setVar('title', $xoopsConfig['sitename'] . ' :: ' . $pagetitle, 'UTF-8', $xml_charset, true);
174
-    $xml->setVar('description', $rssdesc, true);
175
-    $xml->setVar('descriptionHtmlSyndicated', true);
176
-    $xml->setVar('link', $xml_link);
177
-    $xml->setVar('syndicationURL', XOOPS_URL . '/' . xoops_getenv('PHP_SELF'), 'post', true);
178
-    $xml->setVar('webmaster', checkEmail($xoopsConfig['adminmail'], true));
179
-    $xml->setVar('editor', checkEmail($xoopsConfig['adminmail'], true));
180
-    $xml->setVar('category', $xoopsModule->getVar('name'), true);
181
-    $xml->setVar('generator', $xoopsModule->getInfo('version'));
182
-    $xml->setVar('language', _LANGCODE);
183
-
184
-    $dimention = @getimagesize(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'));
185
-    $image     = [
186
-        'width'       => $dimention[0],
187
-        'height'      => $dimention[1],
188
-        'title'       => $xoopsConfig['sitename'] . ' :: ' . $pagetitle,
189
-        'url'         => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'),
190
-        'link'        => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/',
191
-        'description' => $rssdesc
192
-    ];
193
-    $xml->setImage($image);
194
-
195
-    /*
100
+	$criteria = new CriteriaCompo();
101
+	$criteria->setLimit($xoopsModuleConfig['articles_perpage']);
102
+	$articles_obj = [];
103
+	switch ($source) {
104
+		case 'article':
105
+			$pagetitle = planet_constant('MD_ARTICLE');
106
+			$rssdesc   = planet_constant('MD_XMLDESC_ARTICLE');
107
+
108
+			$articles_obj[$article_id] = $article_obj;
109
+
110
+			$xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id');
111
+			break;
112
+
113
+		case 'category':
114
+			$pagetitle = planet_constant('MD_CATEGORY');
115
+			$rssdesc   = sprintf(planet_constant('MD_XMLDESC_CATEGORY'), $category_obj->getVar('cat_title'));
116
+
117
+			$criteria->add(new Criteria('bc.cat_id', $category_id));
118
+			$articles_obj = $articleHandler->getByCategory($criteria);
119
+
120
+			$xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'c' . $category_id;
121
+			break;
122
+
123
+		case 'blog':
124
+			$pagetitle = planet_constant('MD_BLOG');
125
+			$rssdesc   = sprintf(planet_constant('MD_XMLDESC_BLOG'), $blog_obj->getVar('blog_title'));
126
+
127
+			$criteria->add(new Criteria('blog_id', $blog_id));
128
+			$articles_obj = $articleHandler->getAll($criteria);
129
+
130
+			$xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id;
131
+			break;
132
+
133
+		case 'bookmark':
134
+			$author_name = XoopsUser::getUnameFromId($uid);
135
+			$pagetitle   = planet_constant('MD_BOOKMARKS');
136
+			$rssdesc     = sprintf(planet_constant('MD_XMLDESC_BOOKMARK'), $author_name);
137
+
138
+			$criteria->add(new Criteria('bm.bm_uid', $uid));
139
+			$articles_obj = $articleHandler->getByBookmark($criteria);
140
+
141
+			$xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid;
142
+
143
+			break;
144
+
145
+		default:
146
+			$pagetitle = planet_constant('MD_INDEX');
147
+			$rssdesc   = planet_constant('MD_XMLDESC_INDEX');
148
+
149
+			$articles_obj = $articleHandler->getAll($criteria);
150
+
151
+			$xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php';
152
+			break;
153
+	}
154
+	$items = [];
155
+	foreach (array_keys($articles_obj) as $id) {
156
+		$content = $articles_obj[$id]->getVar('art_content');
157
+		$content .= '<br>' . planet_constant('MD_SOURCE') . ': ' . $articles_obj[$id]->getVar('art_link') . ' ' . $articles_obj[$id]->getVar('art_author');
158
+		$items[] = [
159
+			'title'                     => $articles_obj[$id]->getVar('art_title'),
160
+			'link'                      => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_obj[$id]->getVar('art_id'),
161
+			'description'               => $content,
162
+			'descriptionHtmlSyndicated' => true,
163
+			'date'                      => $articles_obj[$id]->getTime('rss'),
164
+			'source'                    => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/',
165
+			'author'                    => $articles_obj[$id]->getVar('art_author')
166
+		];
167
+	}
168
+	unset($articles_obj, $criteria);
169
+
170
+	$xmlHandler = xoops_getModuleHandler('xml', $GLOBALS['moddirname']);
171
+	$xml        = $xmlHandler->create($type);
172
+	$xml->setVar('encoding', $xml_charset);
173
+	$xml->setVar('title', $xoopsConfig['sitename'] . ' :: ' . $pagetitle, 'UTF-8', $xml_charset, true);
174
+	$xml->setVar('description', $rssdesc, true);
175
+	$xml->setVar('descriptionHtmlSyndicated', true);
176
+	$xml->setVar('link', $xml_link);
177
+	$xml->setVar('syndicationURL', XOOPS_URL . '/' . xoops_getenv('PHP_SELF'), 'post', true);
178
+	$xml->setVar('webmaster', checkEmail($xoopsConfig['adminmail'], true));
179
+	$xml->setVar('editor', checkEmail($xoopsConfig['adminmail'], true));
180
+	$xml->setVar('category', $xoopsModule->getVar('name'), true);
181
+	$xml->setVar('generator', $xoopsModule->getInfo('version'));
182
+	$xml->setVar('language', _LANGCODE);
183
+
184
+	$dimention = @getimagesize(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'));
185
+	$image     = [
186
+		'width'       => $dimention[0],
187
+		'height'      => $dimention[1],
188
+		'title'       => $xoopsConfig['sitename'] . ' :: ' . $pagetitle,
189
+		'url'         => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'),
190
+		'link'        => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/',
191
+		'description' => $rssdesc
192
+	];
193
+	$xml->setImage($image);
194
+
195
+	/*
196 196
     $item = array(
197 197
         "title" => $datatitle,
198 198
         "link" => $dataurl,
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
         "author" => $dataauthor
204 204
         );
205 205
     */
206
-    $xml->addItems($items);
206
+	$xml->addItems($items);
207 207
 
208
-    $dummy_content = $xmlHandler->display($xml, XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '.xml.tmp');
208
+	$dummy_content = $xmlHandler->display($xml, XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '.xml.tmp');
209 209
 
210
-    $tpl->assign_by_ref('dummy_content', $dummy_content);
210
+	$tpl->assign_by_ref('dummy_content', $dummy_content);
211 211
 }
212 212
 //$content = ob_get_contents();
213 213
 ob_end_clean();
Please login to merge, or discard this patch.
action.article.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 
31 31
 $art_id = Request::getInt('article', Request::getInt('article', 0, 'POST'), 'GET');//(int)(isset($_GET['article']) ? $_GET['article'] : (isset($_POST['article']) ? $_POST['article'] : 0));
32 32
 if (empty($art_id)) {
33
-    redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID'));
33
+	redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID'));
34 34
 }
35 35
 if (!$xoopsUser->isAdmin()) {
36
-    redirect_header('javascript:history.go(-1);', 2, _NOPERM);
36
+	redirect_header('javascript:history.go(-1);', 2, _NOPERM);
37 37
 }
38 38
 include XOOPS_ROOT_PATH . '/header.php';
39 39
 include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
@@ -44,58 +44,58 @@  discard block
 block discarded – undo
44 44
 $op = Request::getCmd('op', 'check', 'POST');//isset($_POST['op']) ? $_POST['op'] : '';
45 45
 
46 46
 if ($op === 'del' || !empty(Request::getString('del', '', 'POST'))) {
47
-    $articleHandler->delete($article_obj);
48
-    $redirect = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php';
49
-    $message  = planet_constant('MD_SAVED');
50
-    redirect_header($redirect, 2, $message);
47
+	$articleHandler->delete($article_obj);
48
+	$redirect = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php';
49
+	$message  = planet_constant('MD_SAVED');
50
+	redirect_header($redirect, 2, $message);
51 51
 } elseif ($op === 'save') {
52
-    if (empty($_POST['art_content'])) {
53
-        redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_TEXTEMPTY'));
54
-    }
52
+	if (empty($_POST['art_content'])) {
53
+		redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_TEXTEMPTY'));
54
+	}
55 55
 
56
-    foreach ([
57
-                 'art_title',
58
-                 'art_link',
59
-                 'art_author',
60
-                 'art_content'
61
-             ] as $tag) {
62
-        if (@Request::getString('tag', '', 'POST') != $article_obj->getVar($tag)) {
63
-            $article_obj->setVar($tag, @Request::getString('tag', '', 'POST'));
64
-        }
65
-    }
56
+	foreach ([
57
+				 'art_title',
58
+				 'art_link',
59
+				 'art_author',
60
+				 'art_content'
61
+			 ] as $tag) {
62
+		if (@Request::getString('tag', '', 'POST') != $article_obj->getVar($tag)) {
63
+			$article_obj->setVar($tag, @Request::getString('tag', '', 'POST'));
64
+		}
65
+	}
66 66
 
67
-    $art_id_new = $articleHandler->insert($article_obj);
68
-    if (!$article_obj->getVar('art_id')) {
69
-        $redirect = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php';
70
-        $message  = planet_constant('MD_INSERTERROR');
71
-    } else {
72
-        $redirect = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id');
73
-        $message  = planet_constant('MD_SAVED');
74
-    }
75
-    redirect_header($redirect, 2, $message);
67
+	$art_id_new = $articleHandler->insert($article_obj);
68
+	if (!$article_obj->getVar('art_id')) {
69
+		$redirect = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php';
70
+		$message  = planet_constant('MD_INSERTERROR');
71
+	} else {
72
+		$redirect = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id');
73
+		$message  = planet_constant('MD_SAVED');
74
+	}
75
+	redirect_header($redirect, 2, $message);
76 76
 } else {
77
-    require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
77
+	require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
78 78
 
79
-    $form = new XoopsThemeForm(_EDIT, 'formarticle', xoops_getenv('PHP_SELF'), 'post', true);
79
+	$form = new XoopsThemeForm(_EDIT, 'formarticle', xoops_getenv('PHP_SELF'), 'post', true);
80 80
 
81
-    $form->addElement(new XoopsFormText(planet_constant('MD_TITLE'), 'art_title', 50, 255, $article_obj->getVar('art_title', 'E')), true);
82
-    $form->addElement(new XoopsFormText(planet_constant('MD_LINK'), 'art_link', 50, 255, $article_obj->getVar('art_link', 'E')), true);
83
-    $form->addElement(new XoopsFormText(planet_constant('MD_AUTHOR'), 'art_author', 80, 255, $article_obj->getVar('art_author', 'E')));
84
-    $form->addElement(new XoopsFormTextArea(planet_constant('MD_CONTENT'), 'art_content', $article_obj->getVar('art_content', 'E')), true);
81
+	$form->addElement(new XoopsFormText(planet_constant('MD_TITLE'), 'art_title', 50, 255, $article_obj->getVar('art_title', 'E')), true);
82
+	$form->addElement(new XoopsFormText(planet_constant('MD_LINK'), 'art_link', 50, 255, $article_obj->getVar('art_link', 'E')), true);
83
+	$form->addElement(new XoopsFormText(planet_constant('MD_AUTHOR'), 'art_author', 80, 255, $article_obj->getVar('art_author', 'E')));
84
+	$form->addElement(new XoopsFormTextArea(planet_constant('MD_CONTENT'), 'art_content', $article_obj->getVar('art_content', 'E')), true);
85 85
 
86
-    $form->addElement(new XoopsFormHidden('article', $art_id));
87
-    $form->addElement(new XoopsFormHidden('op', 'save'));
86
+	$form->addElement(new XoopsFormHidden('article', $art_id));
87
+	$form->addElement(new XoopsFormHidden('op', 'save'));
88 88
 
89
-    $button_tray = new XoopsFormElementTray('', '');
90
-    $butt_save   = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
91
-    $button_tray->addElement($butt_save);
92
-    $butt_del = new XoopsFormButton('', 'del', _DELETE, 'submit');
93
-    $butt_del->setExtra("onClick='document.forms.formarticle.op.value=del'");
94
-    $button_tray->addElement($butt_del);
95
-    $butt_cancel = new XoopsFormButton('', 'cancel', _CANCEL, 'button');
96
-    $butt_cancel->setExtra("onclick='window.document.location=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . (int)$art_id . "\"'");
97
-    $button_tray->addElement($butt_cancel);
98
-    $form->addElement($button_tray);
99
-    $form->display();
89
+	$button_tray = new XoopsFormElementTray('', '');
90
+	$butt_save   = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
91
+	$button_tray->addElement($butt_save);
92
+	$butt_del = new XoopsFormButton('', 'del', _DELETE, 'submit');
93
+	$butt_del->setExtra("onClick='document.forms.formarticle.op.value=del'");
94
+	$button_tray->addElement($butt_del);
95
+	$butt_cancel = new XoopsFormButton('', 'cancel', _CANCEL, 'button');
96
+	$butt_cancel->setExtra("onclick='window.document.location=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . (int)$art_id . "\"'");
97
+	$button_tray->addElement($butt_cancel);
98
+	$form->addElement($button_tray);
99
+	$form->display();
100 100
 }
101 101
 include XOOPS_ROOT_PATH . '/footer.php';
Please login to merge, or discard this patch.
view.archive.php 1 patch
Indentation   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 include __DIR__ . '/header.php';
30 30
 
31 31
 if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) {
32
-    $args['year']  = @$args_num[0];
33
-    $args['month'] = @$args_num[1];
34
-    $args['day']   = @$args_num[2];
32
+	$args['year']  = @$args_num[0];
33
+	$args['month'] = @$args_num[1];
34
+	$args['day']   = @$args_num[2];
35 35
 }
36 36
 
37 37
 $day     = Request::getInt('day', @$args['day'], 'GET'); //(int)(empty($_GET['day']) ? @$args['day'] : $_GET['day']);
@@ -52,31 +52,31 @@  discard block
 block discarded – undo
52 52
 
53 53
 $year = empty($year) ? date('Y') : $year;
54 54
 if ($month < 1) {
55
-    $month        = $day = 0;
56
-    $page['time'] = sprintf(planet_constant('MD_TIME_Y'), $year);
55
+	$month        = $day = 0;
56
+	$page['time'] = sprintf(planet_constant('MD_TIME_Y'), $year);
57 57
 } elseif ($day < 1) {
58
-    $day          = 0;
59
-    $page['time'] = sprintf(planet_constant('MD_TIME_YM'), $year, $month);
58
+	$day          = 0;
59
+	$page['time'] = sprintf(planet_constant('MD_TIME_YM'), $year, $month);
60 60
 } else {
61
-    $page['time'] = sprintf(planet_constant('MD_TIME_YMD'), $year, $month, $day);
61
+	$page['time'] = sprintf(planet_constant('MD_TIME_YMD'), $year, $month, $day);
62 62
 }
63 63
 $time = ['year' => $year, 'month' => $month, 'day' => $day];
64 64
 if ($xoopsUser) {
65
-    $timeoffset = ($xoopsUser->getVar('timezone_offset') - $xoopsConfig['server_TZ']) * 3600;
65
+	$timeoffset = ($xoopsUser->getVar('timezone_offset') - $xoopsConfig['server_TZ']) * 3600;
66 66
 } else {
67
-    $timeoffset = ($xoopsConfig['default_TZ'] - $xoopsConfig['server_TZ']) * 3600;
67
+	$timeoffset = ($xoopsConfig['default_TZ'] - $xoopsConfig['server_TZ']) * 3600;
68 68
 }
69 69
 
70 70
 $criteria = new CriteriaCompo();
71 71
 if ($blog_id) {
72
-    $criteria->add(new Criteria('blog_id', $blog_id));
72
+	$criteria->add(new Criteria('blog_id', $blog_id));
73 73
 }
74 74
 $criteria->add(new Criteria("YEAR(FROM_UNIXTIME(art_time_publish - $timeoffset))", $year));
75 75
 if ($month) {
76
-    $criteria->add(new Criteria("MONTH(FROM_UNIXTIME(art_time_publish - $timeoffset))", $month));
77
-    if ($day) {
78
-        $criteria->add(new Criteria("DAY(FROM_UNIXTIME(art_time_publish - $timeoffset))", $day));
79
-    }
76
+	$criteria->add(new Criteria("MONTH(FROM_UNIXTIME(art_time_publish - $timeoffset))", $month));
77
+	if ($day) {
78
+		$criteria->add(new Criteria("DAY(FROM_UNIXTIME(art_time_publish - $timeoffset))", $day));
79
+	}
80 80
 }
81 81
 $criteria->setStart($start);
82 82
 $criteria->setLimit($xoopsModuleConfig['articles_perpage']);
@@ -87,115 +87,115 @@  discard block
 block discarded – undo
87 87
 $articles = [];
88 88
 $blogs_id = [];
89 89
 foreach ($articles_obj as $id => $article) {
90
-    $articles[]                            = [
91
-        'id'      => $id,
92
-        'blog'    => ['id' => $article->getVar('blog_id'), 'title' => ''],
93
-        'title'   => $article->getVar('art_title'),
94
-        'time'    => $article->getTime(),
95
-        'content' => $article->getVar('art_content')
96
-    ];
97
-    $articles[]                            = $_article;
98
-    $blogs_id[$article->getVar('blog_id')] = 1;
99
-    unset($_article);
90
+	$articles[]                            = [
91
+		'id'      => $id,
92
+		'blog'    => ['id' => $article->getVar('blog_id'), 'title' => ''],
93
+		'title'   => $article->getVar('art_title'),
94
+		'time'    => $article->getTime(),
95
+		'content' => $article->getVar('art_content')
96
+	];
97
+	$articles[]                            = $_article;
98
+	$blogs_id[$article->getVar('blog_id')] = 1;
99
+	unset($_article);
100 100
 }
101 101
 $criteria_blog = new Criteria('blog_id', '(' . implode(',', array_keys($blog_array)) . ')', 'IN');
102 102
 $blogs         = $blogHandler->getList($criteria_blog);
103 103
 foreach (array_keys($articles) as $key) {
104
-    $articles[$key]['blog']['title'] = $blogs[$articles[$key]['blog']['id']];
104
+	$articles[$key]['blog']['title'] = $blogs[$articles[$key]['blog']['id']];
105 105
 }
106 106
 if ($blog_id > 0) {
107
-    $page['blog'] = $blogs[$blog_id];
107
+	$page['blog'] = $blogs[$blog_id];
108 108
 }
109 109
 
110 110
 if ($articles_count > $xoopsModuleConfig['articles_perpage']) {
111
-    include XOOPS_ROOT_PATH . '/class/pagenav.php';
112
-    $nav     = new XoopsPageNav($articles_count, $xoopsModuleConfig['articles_perpage'], $start, 'start', 'month=' . $month . '&amp;day=' . $day . '&amp;year=' . $year . '&amp;blog=' . (int)$blog_id);
113
-    $pagenav = $nav->renderNav(4);
111
+	include XOOPS_ROOT_PATH . '/class/pagenav.php';
112
+	$nav     = new XoopsPageNav($articles_count, $xoopsModuleConfig['articles_perpage'], $start, 'start', 'month=' . $month . '&amp;day=' . $day . '&amp;year=' . $year . '&amp;blog=' . (int)$blog_id);
113
+	$pagenav = $nav->renderNav(4);
114 114
 } else {
115
-    $pagenav = '';
115
+	$pagenav = '';
116 116
 }
117 117
 
118 118
 $timenav  = null;
119 119
 $calendar = null;
120 120
 $months   = null;
121 121
 if (empty($start)) {
122
-    if ($blog_id) {
123
-        $blog_criteria = ' AND blog_id=' . $blog_id;
124
-    } else {
125
-        $blog_criteria = '';
126
-    }
127
-    // Get monthly list
128
-    if (empty($month)) {
129
-        $sql    = "SELECT MONTH(FROM_UNIXTIME(art_time - $timeoffset)) AS mon, COUNT(DISTINCT art_id) AS count
122
+	if ($blog_id) {
123
+		$blog_criteria = ' AND blog_id=' . $blog_id;
124
+	} else {
125
+		$blog_criteria = '';
126
+	}
127
+	// Get monthly list
128
+	if (empty($month)) {
129
+		$sql    = "SELECT MONTH(FROM_UNIXTIME(art_time - $timeoffset)) AS mon, COUNT(DISTINCT art_id) AS count
130 130
             FROM " . planet_DB_prefix('article') . "
131 131
             WHERE YEAR(FROM_UNIXTIME(art_time - $timeoffset)) = $year
132 132
             " . $blog_criteria . '
133 133
             GROUP BY mon
134 134
             ';
135
-        $result = $xoopsDB->query($sql);
136
-        $months = [];
137
-        while ($myrow = $xoopsDB->fetchArray($result)) {
138
-            $months[] = [
139
-                'title' => planet_constant('MD_MONTH_' . (int)$myrow['mon']) . ' (' . (int)$myrow['count'] . ')',
140
-                'url'   => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $year . '/' . $myrow['mon'] . '/b' . $blog_id
141
-            ];
142
-        }
143
-        $timenav['prev'] = [
144
-            'url'   => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . ($year - 1) . '/b' . $blog_id,
145
-            'title' => sprintf(planet_constant('MD_TIME_Y'), $year - 1)
146
-        ];
147
-        if ($year < date('Y')) {
148
-            $timenav['next'] = [
149
-                'url'   => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . ($year + 1) . '/b' . $blog_id,
150
-                'title' => sprintf(planet_constant('MD_TIME_Y'), $year + 1)
151
-            ];
152
-        }
153
-    } // Get daily list
154
-    elseif (empty($day)) {
155
-        $sql    = "SELECT DAY(FROM_UNIXTIME(art_time - $timeoffset)) AS day, COUNT(DISTINCT a.art_id) AS count
135
+		$result = $xoopsDB->query($sql);
136
+		$months = [];
137
+		while ($myrow = $xoopsDB->fetchArray($result)) {
138
+			$months[] = [
139
+				'title' => planet_constant('MD_MONTH_' . (int)$myrow['mon']) . ' (' . (int)$myrow['count'] . ')',
140
+				'url'   => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $year . '/' . $myrow['mon'] . '/b' . $blog_id
141
+			];
142
+		}
143
+		$timenav['prev'] = [
144
+			'url'   => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . ($year - 1) . '/b' . $blog_id,
145
+			'title' => sprintf(planet_constant('MD_TIME_Y'), $year - 1)
146
+		];
147
+		if ($year < date('Y')) {
148
+			$timenav['next'] = [
149
+				'url'   => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . ($year + 1) . '/b' . $blog_id,
150
+				'title' => sprintf(planet_constant('MD_TIME_Y'), $year + 1)
151
+			];
152
+		}
153
+	} // Get daily list
154
+	elseif (empty($day)) {
155
+		$sql    = "SELECT DAY(FROM_UNIXTIME(art_time - $timeoffset)) AS day, COUNT(DISTINCT a.art_id) AS count
156 156
             FROM " . planet_DB_prefix('article') . "
157 157
             WHERE YEAR(FROM_UNIXTIME(art_time - $timeoffset)) = $year
158 158
             AND MONTH(FROM_UNIXTIME(art_time - $timeoffset)) = $month
159 159
             " . $blog_criteria . '
160 160
             GROUP BY day
161 161
             ';
162
-        $result = $xoopsDB->query($sql);
163
-        $days   = [];
164
-        while ($myrow = $xoopsDB->fetchArray($result)) {
165
-            $days[$myrow['day']]['count'] = $myrow['count'];
166
-        }
167
-        for ($i = 1; $i <= 31; ++$i) {
168
-            if (!isset($days[$i])) {
169
-                continue;
170
-            }
171
-            $days[$i] = [
172
-                'title' => $days[$i]['count'],
173
-                'url'   => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $year . '/' . $month . '/' . $i . '/b' . $blog_id
174
-            ];
175
-        }
176
-        $calendar   = planet_getCalendar($year, $month, $days);
177
-        $month_next = $month + 1;
178
-        $month_prev = $month - 1;
179
-        $_year      = $year;
180
-        if ($month == 12) {
181
-            $month_next = 1;
182
-            $_year      = $year + 1;
183
-        }
184
-        if ($month == 1) {
185
-            $month_pre = 12;
186
-            $_year     = $year - 1;
187
-        }
188
-        $timenav['prev'] = [
189
-            'url'   => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $_year . '/' . $month_prev . '/b' . $blog_id,
190
-            'title' => planet_constant('MD_MONTH_' . $month_prev)
191
-        ];
192
-        if ($year < date('Y') || $month < date('n')) {
193
-            $timenav['next'] = [
194
-                'url'   => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $_year . '/' . $month_next . '/b' . $blog_id,
195
-                'title' => planet_constant('MD_MONTH_' . $month_next)
196
-            ];
197
-        }
198
-    }
162
+		$result = $xoopsDB->query($sql);
163
+		$days   = [];
164
+		while ($myrow = $xoopsDB->fetchArray($result)) {
165
+			$days[$myrow['day']]['count'] = $myrow['count'];
166
+		}
167
+		for ($i = 1; $i <= 31; ++$i) {
168
+			if (!isset($days[$i])) {
169
+				continue;
170
+			}
171
+			$days[$i] = [
172
+				'title' => $days[$i]['count'],
173
+				'url'   => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $year . '/' . $month . '/' . $i . '/b' . $blog_id
174
+			];
175
+		}
176
+		$calendar   = planet_getCalendar($year, $month, $days);
177
+		$month_next = $month + 1;
178
+		$month_prev = $month - 1;
179
+		$_year      = $year;
180
+		if ($month == 12) {
181
+			$month_next = 1;
182
+			$_year      = $year + 1;
183
+		}
184
+		if ($month == 1) {
185
+			$month_pre = 12;
186
+			$_year     = $year - 1;
187
+		}
188
+		$timenav['prev'] = [
189
+			'url'   => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $_year . '/' . $month_prev . '/b' . $blog_id,
190
+			'title' => planet_constant('MD_MONTH_' . $month_prev)
191
+		];
192
+		if ($year < date('Y') || $month < date('n')) {
193
+			$timenav['next'] = [
194
+				'url'   => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $_year . '/' . $month_next . '/b' . $blog_id,
195
+				'title' => planet_constant('MD_MONTH_' . $month_next)
196
+			];
197
+		}
198
+	}
199 199
 }
200 200
 
201 201
 $xoopsTpl->assign('dirname', $GLOBALS['moddirname']);
@@ -222,66 +222,66 @@  discard block
 block discarded – undo
222 222
  */
223 223
 function planet_getCalendar($year = null, $month = null, $days = null)
224 224
 {
225
-    $year      = empty($year) ? date('Y') : $year;
226
-    $month     = empty($month) ? date('n') : $month;
227
-    $unixmonth = mktime(0, 0, 0, $month, 1, $year);
225
+	$year      = empty($year) ? date('Y') : $year;
226
+	$month     = empty($month) ? date('n') : $month;
227
+	$unixmonth = mktime(0, 0, 0, $month, 1, $year);
228 228
 
229
-    ob_start();
230
-    echo '<table id="calendar">';
231
-    echo '<caption>';
232
-    printf(planet_constant('MD_TIME_YM'), $year, planet_constant('MD_MONTH_' . $month));
233
-    echo '</caption>';
229
+	ob_start();
230
+	echo '<table id="calendar">';
231
+	echo '<caption>';
232
+	printf(planet_constant('MD_TIME_YM'), $year, planet_constant('MD_MONTH_' . $month));
233
+	echo '</caption>';
234 234
 
235
-    for ($i = 1; $i <= 7; ++$i) {
236
-        echo "\n\t\t<th abbr=\"" . planet_constant('MD_WEEK_' . $i) . "\" scope=\"col\" title=\"" . planet_constant('MD_WEEK_' . $i) . "\">" . planet_constant('MD_WEEK_' . $i) . '</th>';
237
-    }
235
+	for ($i = 1; $i <= 7; ++$i) {
236
+		echo "\n\t\t<th abbr=\"" . planet_constant('MD_WEEK_' . $i) . "\" scope=\"col\" title=\"" . planet_constant('MD_WEEK_' . $i) . "\">" . planet_constant('MD_WEEK_' . $i) . '</th>';
237
+	}
238 238
 
239
-    echo '<tr>';
239
+	echo '<tr>';
240 240
 
241
-    // See how much we should pad in the beginning
242
-    $week_begins = 1;
243
-    $pad         = planet_calendar_week_mod(date('w', $unixmonth) - $week_begins);
244
-    if (0 != $pad) {
245
-        echo "\n\t\t" . '<td colspan="' . $pad . '">&nbsp;</td>';
246
-    }
241
+	// See how much we should pad in the beginning
242
+	$week_begins = 1;
243
+	$pad         = planet_calendar_week_mod(date('w', $unixmonth) - $week_begins);
244
+	if (0 != $pad) {
245
+		echo "\n\t\t" . '<td colspan="' . $pad . '">&nbsp;</td>';
246
+	}
247 247
 
248
-    $daysinmonth = (int)date('t', $unixmonth);
249
-    for ($day = 1; $day <= $daysinmonth; ++$day) {
250
-        if (isset($newrow) && $newrow) {
251
-            echo "\n\t</tr>\n\t<tr>\n\t\t";
252
-        }
253
-        $newrow = false;
248
+	$daysinmonth = (int)date('t', $unixmonth);
249
+	for ($day = 1; $day <= $daysinmonth; ++$day) {
250
+		if (isset($newrow) && $newrow) {
251
+			echo "\n\t</tr>\n\t<tr>\n\t\t";
252
+		}
253
+		$newrow = false;
254 254
 
255
-        echo '<td>';
255
+		echo '<td>';
256 256
 
257
-        if (!empty($days[$day]['url'])) {
258
-            echo '<a href="' . $days[$day]['url'] . "\"";
259
-            if (!empty($days[$day]['title'])) {
260
-                echo "title=\"" . $days[$day]['title'] . "\"";
261
-            }
262
-            echo ">$day</a>";
263
-        } elseif (!empty($days[$day]['title'])) {
264
-            echo "<acronym title=\"" . $days[$day]['title'] . "\">$day</acronym>";
265
-        } else {
266
-            echo $day;
267
-        }
268
-        echo '</td>';
257
+		if (!empty($days[$day]['url'])) {
258
+			echo '<a href="' . $days[$day]['url'] . "\"";
259
+			if (!empty($days[$day]['title'])) {
260
+				echo "title=\"" . $days[$day]['title'] . "\"";
261
+			}
262
+			echo ">$day</a>";
263
+		} elseif (!empty($days[$day]['title'])) {
264
+			echo "<acronym title=\"" . $days[$day]['title'] . "\">$day</acronym>";
265
+		} else {
266
+			echo $day;
267
+		}
268
+		echo '</td>';
269 269
 
270
-        if (6 == planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins)) {
271
-            $newrow = true;
272
-        }
273
-    }
270
+		if (6 == planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins)) {
271
+			$newrow = true;
272
+		}
273
+	}
274 274
 
275
-    $pad = 7 - planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins);
276
-    if ($pad != 0 && $pad != 7) {
277
-        echo "\n\t\t" . '<td class="pad" colspan="' . $pad . '">&nbsp;</td>';
278
-    }
275
+	$pad = 7 - planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins);
276
+	if ($pad != 0 && $pad != 7) {
277
+		echo "\n\t\t" . '<td class="pad" colspan="' . $pad . '">&nbsp;</td>';
278
+	}
279 279
 
280
-    echo "\n\t</tr>\n\t</tbody>\n\t</table>";
281
-    $calendar = ob_get_contents();
282
-    ob_end_clean();
280
+	echo "\n\t</tr>\n\t</tbody>\n\t</table>";
281
+	$calendar = ob_get_contents();
282
+	ob_end_clean();
283 283
 
284
-    return $calendar;
284
+	return $calendar;
285 285
 }
286 286
 
287 287
 // Used in get_calendar
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
  */
292 292
 function planet_calendar_week_mod($num)
293 293
 {
294
-    $base = 7;
294
+	$base = 7;
295 295
 
296
-    return ($num - $base * floor($num / $base));
296
+	return ($num - $base * floor($num / $base));
297 297
 }
Please login to merge, or discard this patch.
transfer.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 include __DIR__ . '/header.php';
18 18
 
19 19
 if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) {
20
-    $args['article'] = @$args_num[0];
21
-    $args['op']      = @$args_str[0];
20
+	$args['article'] = @$args_num[0];
21
+	$args['op']      = @$args_str[0];
22 22
 }
23 23
 
24 24
 $article_id = Request::getInt('article', Request::getInt('article', @$args['article'], 'POST'), 'GET');//(int)(empty($_GET['article']) ? (empty($_POST['article']) ? @$args['article'] : $_POST['article']) : $_GET['article']);
@@ -27,33 +27,33 @@  discard block
 block discarded – undo
27 27
 $op = strtolower(trim($op));
28 28
 
29 29
 if (empty($article_id)) {
30
-    if (empty(Request::getUrl('HTTP_REFERER', '', 'SERVER'))) {
31
-        //$_SERVER['HTTP_REFERER']))
30
+	if (empty(Request::getUrl('HTTP_REFERER', '', 'SERVER'))) {
31
+		//$_SERVER['HTTP_REFERER']))
32 32
 
33
-        include XOOPS_ROOT_PATH . '/header.php';
34
-        xoops_error(_NOPERM);
35
-        $xoopsOption['output_type'] = 'plain';
36
-        include XOOPS_ROOT_PATH . '/footer.php';
37
-        exit();
38
-    } else {
39
-        $ref_parser = parse_url(Request::getUrl('HTTP_REFERER', '', 'SERVER')); //$_SERVER['HTTP_REFERER']);
40
-        $uri_parser = parse_url(Request::getUrl('REQUEST_URI', '', 'SERVER'));// $_SERVER['REQUEST_URI']);
41
-        if ((!empty($ref_parser['host']) && !empty($uri_parser['host']) && $uri_parser['host'] != $ref_parser['host'])
42
-            || ($ref_parser['path'] != $uri_parser['path'])) {
43
-            include XOOPS_ROOT_PATH . '/header.php';
44
-            include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
45
-            xoops_confirm([], 'javascript: window.close();', sprintf(planet_constant('MD_TRANSFER_DONE'), ''), _CLOSE, Request::getUrl('HTTP_REFERER', '', 'SERVER'));
46
-            $xoopsOption['output_type'] = 'plain';
47
-            include XOOPS_ROOT_PATH . '/footer.php';
48
-            exit();
49
-        } else {
50
-            include XOOPS_ROOT_PATH . '/header.php';
51
-            xoops_error(_NOPERM);
52
-            $xoopsOption['output_type'] = 'plain';
53
-            include XOOPS_ROOT_PATH . '/footer.php';
54
-            exit();
55
-        }
56
-    }
33
+		include XOOPS_ROOT_PATH . '/header.php';
34
+		xoops_error(_NOPERM);
35
+		$xoopsOption['output_type'] = 'plain';
36
+		include XOOPS_ROOT_PATH . '/footer.php';
37
+		exit();
38
+	} else {
39
+		$ref_parser = parse_url(Request::getUrl('HTTP_REFERER', '', 'SERVER')); //$_SERVER['HTTP_REFERER']);
40
+		$uri_parser = parse_url(Request::getUrl('REQUEST_URI', '', 'SERVER'));// $_SERVER['REQUEST_URI']);
41
+		if ((!empty($ref_parser['host']) && !empty($uri_parser['host']) && $uri_parser['host'] != $ref_parser['host'])
42
+			|| ($ref_parser['path'] != $uri_parser['path'])) {
43
+			include XOOPS_ROOT_PATH . '/header.php';
44
+			include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
45
+			xoops_confirm([], 'javascript: window.close();', sprintf(planet_constant('MD_TRANSFER_DONE'), ''), _CLOSE, Request::getUrl('HTTP_REFERER', '', 'SERVER'));
46
+			$xoopsOption['output_type'] = 'plain';
47
+			include XOOPS_ROOT_PATH . '/footer.php';
48
+			exit();
49
+		} else {
50
+			include XOOPS_ROOT_PATH . '/header.php';
51
+			xoops_error(_NOPERM);
52
+			$xoopsOption['output_type'] = 'plain';
53
+			include XOOPS_ROOT_PATH . '/footer.php';
54
+			exit();
55
+		}
56
+	}
57 57
 }
58 58
 
59 59
 $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']);
@@ -61,37 +61,37 @@  discard block
 block discarded – undo
61 61
 
62 62
 // Display option form
63 63
 if (empty($op)) {
64
-    $module_variables .= "<input type=\"hidden\" name=\"article\" id=\"article\" value=\"{$article_id}\">";
65
-    include XOOPS_ROOT_PATH . '/Frameworks/transfer/option.transfer.php';
66
-    exit();
64
+	$module_variables .= "<input type=\"hidden\" name=\"article\" id=\"article\" value=\"{$article_id}\">";
65
+	include XOOPS_ROOT_PATH . '/Frameworks/transfer/option.transfer.php';
66
+	exit();
67 67
 } else {
68
-    $data           = [];
69
-    $data['id']     = $article_id;
70
-    $data['title']  = $article_obj->getVar('art_title');
71
-    $data['time']   = $article_obj->getTime('l');
72
-    $data['image']  = '';
73
-    $data['source'] = $article_obj->getVar('art_link');
74
-    $data['url']    = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id');
75
-    $data['author'] = $article_obj->getVar('art_author');
68
+	$data           = [];
69
+	$data['id']     = $article_id;
70
+	$data['title']  = $article_obj->getVar('art_title');
71
+	$data['time']   = $article_obj->getTime('l');
72
+	$data['image']  = '';
73
+	$data['source'] = $article_obj->getVar('art_link');
74
+	$data['url']    = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id');
75
+	$data['author'] = $article_obj->getVar('art_author');
76 76
 
77
-    switch ($op) {
77
+	switch ($op) {
78 78
 
79
-        // Use title
80
-        case 'bookmark':
81
-            break;
79
+		// Use title
80
+		case 'bookmark':
81
+			break;
82 82
 
83
-        case 'print':
84
-        case 'pdf':
85
-            ${"{$op}_data"}            =& $data;
86
-            ${"{$op}_data"}['date']    = $pdf_data['time'];
87
-            ${"{$op}_data"}['content'] = $article_obj->getVar('art_content');
88
-            break;
83
+		case 'print':
84
+		case 'pdf':
85
+			${"{$op}_data"}            =& $data;
86
+			${"{$op}_data"}['date']    = $pdf_data['time'];
87
+			${"{$op}_data"}['content'] = $article_obj->getVar('art_content');
88
+			break;
89 89
 
90
-        case 'newbb':
91
-        default:
92
-            $data['content'] = $article_obj->getSummary();
93
-            break;
94
-    }
95
-    include XOOPS_ROOT_PATH . '/Frameworks/transfer/action.transfer.php';
96
-    exit();
90
+		case 'newbb':
91
+		default:
92
+			$data['content'] = $article_obj->getSummary();
93
+			break;
94
+	}
95
+	include XOOPS_ROOT_PATH . '/Frameworks/transfer/action.transfer.php';
96
+	exit();
97 97
 }
Please login to merge, or discard this patch.
action.blog.php 1 patch
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 ($op === 'save' && !empty(Request::getString('fetch', '', 'POST'))) {//!empty($_POST['fetch'])) {
40
-    $op = 'edit';
40
+	$op = 'edit';
41 41
 }
42 42
 
43 43
 if ($op === 'save' && !$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.
xoops_version.php 1 patch
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 include __DIR__ . '/include/vars.php';
31 31
 
32 32
 $modversion                 = [
33
-    'name'          => planet_constant('MI_NAME'),
34
-    'version'       => 2.10,
35
-    'module_status' => 'Final',
36
-    'release_date'  => '2016/08/01',
37
-    'description'   => planet_constant('MI_DESC'),
38
-    'author'        => 'D.J. (phppp)',
39
-    'credits'       => 'XOOPS Project',
40
-    'image'         => 'assets/images/logoModule.png',
41
-    'dirname'       => $GLOBALS['moddirname'],
42
-    'help'          => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/readme.html'
33
+	'name'          => planet_constant('MI_NAME'),
34
+	'version'       => 2.10,
35
+	'module_status' => 'Final',
36
+	'release_date'  => '2016/08/01',
37
+	'description'   => planet_constant('MI_DESC'),
38
+	'author'        => 'D.J. (phppp)',
39
+	'credits'       => 'XOOPS Project',
40
+	'image'         => 'assets/images/logoModule.png',
41
+	'dirname'       => $GLOBALS['moddirname'],
42
+	'help'          => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/readme.html'
43 43
 ];
44 44
 $modversion['help']         = 'page=help';
45 45
 $modversion['license']      = 'GNU see LICENSE';
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
 // database tables
63 63
 $modversion['sqlfile']['mysql'] = 'sql/mysql.sql';
64 64
 $modversion['tables']           = [
65
-    $GLOBALS['MOD_DB_PREFIX'] . '_category',
66
-    $GLOBALS['MOD_DB_PREFIX'] . '_article',
67
-    $GLOBALS['MOD_DB_PREFIX'] . '_blog',
68
-    $GLOBALS['MOD_DB_PREFIX'] . '_blogcat',
69
-    $GLOBALS['MOD_DB_PREFIX'] . '_bookmark',
70
-    $GLOBALS['MOD_DB_PREFIX'] . '_rate'
65
+	$GLOBALS['MOD_DB_PREFIX'] . '_category',
66
+	$GLOBALS['MOD_DB_PREFIX'] . '_article',
67
+	$GLOBALS['MOD_DB_PREFIX'] . '_blog',
68
+	$GLOBALS['MOD_DB_PREFIX'] . '_blogcat',
69
+	$GLOBALS['MOD_DB_PREFIX'] . '_bookmark',
70
+	$GLOBALS['MOD_DB_PREFIX'] . '_rate'
71 71
 ];
72 72
 
73 73
 // Admin things
@@ -149,162 +149,162 @@  discard block
 block discarded – undo
149 149
 // Configs
150 150
 // Config items
151 151
 $modversion['config'][] = [
152
-    'name'        => 'do_debug',
153
-    'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_DODEBUG',
154
-    'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DODEBUG_DESC',
155
-    'formtype'    => 'yesno',
156
-    'valuetype'   => 'int',
157
-    'default'     => 1
152
+	'name'        => 'do_debug',
153
+	'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_DODEBUG',
154
+	'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DODEBUG_DESC',
155
+	'formtype'    => 'yesno',
156
+	'valuetype'   => 'int',
157
+	'default'     => 1
158 158
 ];
159 159
 
160 160
 $modversion['config'][] = [
161
-    'name'        => 'do_urw',
162
-    'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_DOURLREWRITE',
163
-    'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOURLREWRITE_DESC',
164
-    'formtype'    => 'yesno',
165
-    'valuetype'   => 'int',
166
-    'default'     => in_array(php_sapi_name(), ['apache', 'apache2handler'])
161
+	'name'        => 'do_urw',
162
+	'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_DOURLREWRITE',
163
+	'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOURLREWRITE_DESC',
164
+	'formtype'    => 'yesno',
165
+	'valuetype'   => 'int',
166
+	'default'     => in_array(php_sapi_name(), ['apache', 'apache2handler'])
167 167
 ];
168 168
 
169 169
 $modversion['config'][] = [
170
-    'name'        => 'theme_set',
171
-    'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_THEMESET',
172
-    'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_THEMESET_DESC',
173
-    'formtype'    => 'select',
174
-    'valuetype'   => 'text',
175
-    'options'     => [_NONE => '0'],
176
-    'default'     => ''
170
+	'name'        => 'theme_set',
171
+	'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_THEMESET',
172
+	'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_THEMESET_DESC',
173
+	'formtype'    => 'select',
174
+	'valuetype'   => 'text',
175
+	'options'     => [_NONE => '0'],
176
+	'default'     => ''
177 177
 ];
178 178
 
179 179
 $modversion['config'][] = [
180
-    'name'        => 'timeformat',
181
-    'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT',
182
-    'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT_DESC',
183
-    'formtype'    => 'select',
184
-    'valuetype'   => 'text',
185
-    'options'     => [
186
-        _DATESTRING                                       => 'l',
187
-        _MEDIUMDATESTRING                                 => 'm',
188
-        _SHORTDATESTRING                                  => 's',
189
-        $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT_CUSTOM' => 'c'
190
-    ],
191
-    'default'     => 'c'
180
+	'name'        => 'timeformat',
181
+	'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT',
182
+	'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT_DESC',
183
+	'formtype'    => 'select',
184
+	'valuetype'   => 'text',
185
+	'options'     => [
186
+		_DATESTRING                                       => 'l',
187
+		_MEDIUMDATESTRING                                 => 'm',
188
+		_SHORTDATESTRING                                  => 's',
189
+		$GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT_CUSTOM' => 'c'
190
+	],
191
+	'default'     => 'c'
192 192
 ];
193 193
 
194 194
 $modversion['config'][] = [
195
-    'name'        => 'articles_perpage',
196
-    'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLESPERPAGE',
197
-    'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLESPERPAGE_DESC',
198
-    'formtype'    => 'textbox',
199
-    'valuetype'   => 'int',
200
-    'default'     => 10
195
+	'name'        => 'articles_perpage',
196
+	'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLESPERPAGE',
197
+	'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLESPERPAGE_DESC',
198
+	'formtype'    => 'textbox',
199
+	'valuetype'   => 'int',
200
+	'default'     => 10
201 201
 ];
202 202
 
203 203
 $modversion['config'][] = [
204
-    'name'        => 'list_perpage',
205
-    'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_LISTPERPAGE',
206
-    'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_LISTPERPAGE_DESC',
207
-    'formtype'    => 'textbox',
208
-    'valuetype'   => 'int',
209
-    'default'     => 20
204
+	'name'        => 'list_perpage',
205
+	'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_LISTPERPAGE',
206
+	'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_LISTPERPAGE_DESC',
207
+	'formtype'    => 'textbox',
208
+	'valuetype'   => 'int',
209
+	'default'     => 20
210 210
 ];
211 211
 
212 212
 $modversion['config'][] = [
213
-    'name'        => 'blogs_perupdate',
214
-    'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_BLOGSPERUPDATE',
215
-    'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_BLOGSPERUPDATE_DESC',
216
-    'formtype'    => 'textbox',
217
-    'valuetype'   => 'int',
218
-    'default'     => 10
213
+	'name'        => 'blogs_perupdate',
214
+	'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_BLOGSPERUPDATE',
215
+	'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_BLOGSPERUPDATE_DESC',
216
+	'formtype'    => 'textbox',
217
+	'valuetype'   => 'int',
218
+	'default'     => 10
219 219
 ];
220 220
 
221 221
 $modversion['config'][] = [
222
-    'name'        => 'article_expire',
223
-    'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLE_EXPIRE',
224
-    'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLE_EXPIRE_DESC',
225
-    'formtype'    => 'textbox',
226
-    'valuetype'   => 'int',
227
-    'default'     => 30
222
+	'name'        => 'article_expire',
223
+	'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLE_EXPIRE',
224
+	'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLE_EXPIRE_DESC',
225
+	'formtype'    => 'textbox',
226
+	'valuetype'   => 'int',
227
+	'default'     => 30
228 228
 ];
229 229
 
230 230
 $modversion['config'][] = [
231
-    'name'        => 'display_summary',
232
-    'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_DISPLAY_SUMMARY',
233
-    'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DISPLAY_SUMMARY_DESC',
234
-    'formtype'    => 'textbox',
235
-    'valuetype'   => 'int',
236
-    'default'     => 0
231
+	'name'        => 'display_summary',
232
+	'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_DISPLAY_SUMMARY',
233
+	'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DISPLAY_SUMMARY_DESC',
234
+	'formtype'    => 'textbox',
235
+	'valuetype'   => 'int',
236
+	'default'     => 0
237 237
 ];
238 238
 
239 239
 $modversion['config'][] = [
240
-    'name'        => 'do_sibling',
241
-    'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_DOSIBLING',
242
-    'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOSIBLING_DESC',
243
-    'formtype'    => 'yesno',
244
-    'valuetype'   => 'int',
245
-    'default'     => 1
240
+	'name'        => 'do_sibling',
241
+	'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_DOSIBLING',
242
+	'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOSIBLING_DESC',
243
+	'formtype'    => 'yesno',
244
+	'valuetype'   => 'int',
245
+	'default'     => 1
246 246
 ];
247 247
 
248 248
 $modversion['config'][] = [
249
-    'name'        => 'pings',
250
-    'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_PING',
251
-    'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_PING_DESC',
252
-    'formtype'    => 'textarea',
253
-    'valuetype'   => 'text',
254
-    'default'     => ''
249
+	'name'        => 'pings',
250
+	'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_PING',
251
+	'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_PING_DESC',
252
+	'formtype'    => 'textarea',
253
+	'valuetype'   => 'text',
254
+	'default'     => ''
255 255
 ];
256 256
 
257 257
 $modversion['config'][] = [
258
-    'name'        => 'trackback_option',
259
-    'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_TRACKBACK_OPTION',
260
-    'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_TRACKBACK_OPTION_DESC',
261
-    'formtype'    => 'select',
262
-    'valuetype'   => 'int',
263
-    'default'     => 0,
264
-    'options'     => [planet_constant('MI_MODERATION') => 0, _ALL => 1, _NONE => 2]
258
+	'name'        => 'trackback_option',
259
+	'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_TRACKBACK_OPTION',
260
+	'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_TRACKBACK_OPTION_DESC',
261
+	'formtype'    => 'select',
262
+	'valuetype'   => 'int',
263
+	'default'     => 0,
264
+	'options'     => [planet_constant('MI_MODERATION') => 0, _ALL => 1, _NONE => 2]
265 265
 ];
266 266
 
267 267
 $modversion['config'][] = [
268
-    'name'        => 'copyright',
269
-    'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_COPYRIGHT',
270
-    'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_COPYRIGHT_DESC',
271
-    'formtype'    => 'textbox',
272
-    'valuetype'   => 'text',
273
-    'default'     => 'Copyright&copy; %s & ' . $xoopsConfig['sitename']
268
+	'name'        => 'copyright',
269
+	'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_COPYRIGHT',
270
+	'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_COPYRIGHT_DESC',
271
+	'formtype'    => 'textbox',
272
+	'valuetype'   => 'text',
273
+	'default'     => 'Copyright&copy; %s & ' . $xoopsConfig['sitename']
274 274
 ];
275 275
 
276 276
 $modversion['config'][] = [
277
-    'name'        => 'newblog_submit',
278
-    'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_NEWBLOG_SUBMIT',
279
-    'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_NEWBLOG_SUBMIT_DESC',
280
-    'formtype'    => 'select',
281
-    'valuetype'   => 'int',
282
-    'default'     => 2,
283
-    'options'     => [
284
-        _NONE                            => 0,
285
-        planet_constant('MI_MODERATION') => 1,
286
-        planet_constant('MI_MEMBER')     => 2,
287
-        _ALL                             => 3
288
-    ]
289
-    // 0 - Only admin; 1 - all but need approval; 2 - members auto approved; 3 - all
277
+	'name'        => 'newblog_submit',
278
+	'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_NEWBLOG_SUBMIT',
279
+	'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_NEWBLOG_SUBMIT_DESC',
280
+	'formtype'    => 'select',
281
+	'valuetype'   => 'int',
282
+	'default'     => 2,
283
+	'options'     => [
284
+		_NONE                            => 0,
285
+		planet_constant('MI_MODERATION') => 1,
286
+		planet_constant('MI_MEMBER')     => 2,
287
+		_ALL                             => 3
288
+	]
289
+	// 0 - Only admin; 1 - all but need approval; 2 - members auto approved; 3 - all
290 290
 ];
291 291
 
292 292
 $modversion['config'][] = [
293
-    'name'        => 'anonymous_rate',
294
-    'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_ANONYMOUSRATE',
295
-    'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ANONYMOUSRATE_DESC',
296
-    'formtype'    => 'yesno',
297
-    'valuetype'   => 'int',
298
-    'default'     => 0
293
+	'name'        => 'anonymous_rate',
294
+	'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_ANONYMOUSRATE',
295
+	'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ANONYMOUSRATE_DESC',
296
+	'formtype'    => 'yesno',
297
+	'valuetype'   => 'int',
298
+	'default'     => 0
299 299
 ];
300 300
 
301 301
 $modversion['config'][] = [
302
-    'name'        => 'do_pseudocron',
303
-    'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_PSEUDOCRON',
304
-    'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_PSEUDOCRON_DESC',
305
-    'formtype'    => 'yesno',
306
-    'valuetype'   => 'int',
307
-    'default'     => 1
302
+	'name'        => 'do_pseudocron',
303
+	'title'       => $GLOBALS['VAR_PREFIXU'] . '_MI_PSEUDOCRON',
304
+	'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_PSEUDOCRON_DESC',
305
+	'formtype'    => 'yesno',
306
+	'valuetype'   => 'int',
307
+	'default'     => 1
308 308
 ];
309 309
 
310 310
 // Notification
Please login to merge, or discard this patch.
trackback.php 1 patch
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.
pdf.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -32,51 +32,51 @@
 block discarded – undo
32 32
 include __DIR__ . '/header.php';
33 33
 global $pdf_data;
34 34
 if (!empty($_POST['pdf_data'])) {
35
-    $pdf_data = unserialize(base64_decode(Request::getText('pdf_data', '', 'POST')));
35
+	$pdf_data = unserialize(base64_decode(Request::getText('pdf_data', '', 'POST')));
36 36
 } elseif (!empty($pdf_data)) {
37 37
 } else {
38
-    error_reporting(0);
39
-    include __DIR__ . '/header.php';
40
-    error_reporting(0);
38
+	error_reporting(0);
39
+	include __DIR__ . '/header.php';
40
+	error_reporting(0);
41 41
 
42
-    if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) {
43
-        $args['article'] = @$args_num[0];
44
-    }
42
+	if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) {
43
+		$args['article'] = @$args_num[0];
44
+	}
45 45
 
46
-    $article_id = (int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']);
46
+	$article_id = (int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']);
47 47
 
48
-    $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']);
49
-    $article_obj    = $articleHandler->get($article_id);
48
+	$articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']);
49
+	$article_obj    = $articleHandler->get($article_id);
50 50
 
51
-    $article_data = [];
51
+	$article_data = [];
52 52
 
53
-    // title
54
-    $article_data['title'] = $article_obj->getVar('art_title');
53
+	// title
54
+	$article_data['title'] = $article_obj->getVar('art_title');
55 55
 
56
-    $article_data['author'] = $article_obj->getVar('art_author');
56
+	$article_data['author'] = $article_obj->getVar('art_author');
57 57
 
58
-    // source
59
-    $article_data['source'] = $article_obj->getVar('art_link');
58
+	// source
59
+	$article_data['source'] = $article_obj->getVar('art_link');
60 60
 
61
-    // publish time
62
-    $article_data['time'] = $article_obj->getTime();
61
+	// publish time
62
+	$article_data['time'] = $article_obj->getTime();
63 63
 
64
-    // summary
65
-    $article_data['summary'] = $article_obj->getSummary();
64
+	// summary
65
+	$article_data['summary'] = $article_obj->getSummary();
66 66
 
67
-    // text of page
68
-    $article_data['text'] = $article_obj->getVar('art_content');
67
+	// text of page
68
+	$article_data['text'] = $article_obj->getVar('art_content');
69 69
 
70
-    // Build the pdf_data array
71
-    $pdf_data['title']   = $article_data['title'];
72
-    $pdf_data['author']  = $article_data['author'];
73
-    $pdf_data['date']    = $article_data['time'];
74
-    $pdf_data['content'] = '';
75
-    if ($article_data['summary']) {
76
-        $pdf_data['content'] .= planet_constant('MD_SUMMARY') . ': ' . $article_data['summary'] . '<br><br>';
77
-    }
78
-    $pdf_data['content'] .= $article_data['text'] . '<br>';
79
-    $pdf_data['url']     = XOOPS_URL . '/modules/' . $GLOBALS['artdirname'] . '/view.article.php' . URL_DELIMITER . $article_obj->getVar('art_id');
70
+	// Build the pdf_data array
71
+	$pdf_data['title']   = $article_data['title'];
72
+	$pdf_data['author']  = $article_data['author'];
73
+	$pdf_data['date']    = $article_data['time'];
74
+	$pdf_data['content'] = '';
75
+	if ($article_data['summary']) {
76
+		$pdf_data['content'] .= planet_constant('MD_SUMMARY') . ': ' . $article_data['summary'] . '<br><br>';
77
+	}
78
+	$pdf_data['content'] .= $article_data['text'] . '<br>';
79
+	$pdf_data['url']     = XOOPS_URL . '/modules/' . $GLOBALS['artdirname'] . '/view.article.php' . URL_DELIMITER . $article_obj->getVar('art_id');
80 80
 }
81 81
 $pdf_data['filename'] = preg_replace("/[^0-9a-z\-_\.]/i", '', $pdf_data['title']);
82 82
 
Please login to merge, or discard this patch.