Completed
Push — master ( 96da4e...7c5656 )
by Michael
04:52
created
class/class-IXR.php 1 patch
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
     /**
172 172
      * IXR_Message constructor.
173
-     * @param $message
173
+     * @param string|boolean $message
174 174
      */
175 175
     public function __construct($message)
176 176
     {
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 
898 898
     /**
899 899
      * IXR_Base64 constructor.
900
-     * @param $data
900
+     * @param string $data
901 901
      */
902 902
     public function __construct($data)
903 903
     {
@@ -939,10 +939,10 @@  discard block
 block discarded – undo
939 939
     }
940 940
 
941 941
     /**
942
-     * @param $method
943
-     * @param $callback
944
-     * @param $args
945
-     * @param $help
942
+     * @param string $method
943
+     * @param string $callback
944
+     * @param string[] $args
945
+     * @param string $help
946 946
      */
947 947
     public function addCallback($method, $callback, $args, $help)
948 948
     {
Please login to merge, or discard this patch.
class/feedcreator.class.php 1 patch
Doc Comments   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
     public $_feed;
370 370
 
371 371
     /**
372
-     * @param $format
372
+     * @param string $format
373 373
      */
374 374
     public function _setFormat($format)
375 375
     {
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
     /**
567 567
      * Adds an FeedItem to the feed.
568 568
      *
569
-     * @param $item
569
+     * @param FeedItem $item
570 570
      * @internal param FeedItem $object $item The FeedItem to add to the feed.
571 571
      * @access   public
572 572
      */
@@ -585,6 +585,7 @@  discard block
 block discarded – undo
585 585
      * @static
586 586
      * @param string     string A string to be truncated.
587 587
      * @param int        length the maximum length the string should be truncated to
588
+     * @param integer $length
588 589
      * @return string the truncated string
589 590
      */
590 591
     public function iTrunc($string, $length)
@@ -696,7 +697,7 @@  discard block
 block discarded – undo
696 697
     /**
697 698
      * @since  1.4
698 699
      * @access private
699
-     * @param $filename
700
+     * @param string $filename
700 701
      */
701 702
     public function _redirect($filename)
702 703
     {
@@ -853,7 +854,7 @@  discard block
 block discarded – undo
853 854
     /**
854 855
      * Gets the date stored in this FeedDate as an RFC 822 date.
855 856
      *
856
-     * @return a date in RFC 822 format
857
+     * @return string date in RFC 822 format
857 858
      */
858 859
     public function rfc822()
859 860
     {
@@ -869,7 +870,7 @@  discard block
 block discarded – undo
869 870
     /**
870 871
      * Gets the date stored in this FeedDate as an ISO 8601 date.
871 872
      *
872
-     * @return a date in ISO 8601 format
873
+     * @return string date in ISO 8601 format
873 874
      */
874 875
     public function iso8601()
875 876
     {
@@ -999,7 +1000,7 @@  discard block
 block discarded – undo
999 1000
     /**
1000 1001
      * Sets this RSS feed's version number.
1001 1002
      * @access private
1002
-     * @param $version
1003
+     * @param string $version
1003 1004
      */
1004 1005
     public function _setRSSVersion($version)
1005 1006
     {
Please login to merge, or discard this patch.
class/magpie.inc.php 1 patch
Doc Comments   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
     // smart append - field and namespace aware
307 307
 
308 308
     /**
309
-     * @param $el
309
+     * @param string $el
310 310
      * @param $text
311 311
      */
312 312
     public function append($el, $text)
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
     }
391 391
 
392 392
     /**
393
-     * @return bool
393
+     * @return string|false
394 394
      */
395 395
     public function is_rss()
396 396
     {
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
     }
403 403
 
404 404
     /**
405
-     * @return bool
405
+     * @return string|false
406 406
      */
407 407
     public function is_atom()
408 408
     {
@@ -415,10 +415,10 @@  discard block
 block discarded – undo
415 415
 
416 416
     /**
417 417
      * return XML parser, and possibly re-encoded source
418
-     * @param $source
419
-     * @param $out_enc
420
-     * @param $in_enc
421
-     * @param $detect
418
+     * @param string $source
419
+     * @param string $out_enc
420
+     * @param string|null $in_enc
421
+     * @param boolean $detect
422 422
      * @return array
423 423
      */
424 424
     public function create_parser($source, $out_enc, $in_enc, $detect)
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 
529 529
     /**
530 530
      * @param $enc
531
-     * @return bool|string
531
+     * @return string|false
532 532
      */
533 533
     public function known_encoding($enc)
534 534
     {
Please login to merge, or discard this patch.
class/utility.php 1 patch
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
          * @var mixed  $pattern
118 118
          * @var mixed  $replacement
119 119
          *
120
-         * @return bool true on success
120
+         * @return null|boolean true on success
121 121
          */
122 122
         public static function planetParseClass($class_string, $pattern = '', $replacement = '')
123 123
         {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
          * @var mixed  $pattern
154 154
          * @var mixed  $replacement
155 155
          *
156
-         * @return bool true on success
156
+         * @return null|boolean true on success
157 157
          */
158 158
         public static function planetParseFunction($function_string, $pattern = '', $replacement = '')
159 159
         {
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 
521 521
         /**
522 522
          * @param $url
523
-         * @return bool|string
523
+         * @return false|string
524 524
          */
525 525
         public static function planetFetchFopen($url)
526 526
         {
Please login to merge, or discard this patch.
class/xmlparser.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
     }
85 85
 
86 86
     /**
87
-     * @return bool|string
87
+     * @return string|false
88 88
      */
89 89
     public function is_atom()
90 90
     {
Please login to merge, or discard this patch.
include/functions.php 1 patch
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      * @var mixed  $pattern
112 112
      * @var mixed  $replacement
113 113
      *
114
-     * @return bool true on success
114
+     * @return null|boolean true on success
115 115
      */
116 116
     function planetParseClass($class_string, $pattern = '', $replacement = '')
117 117
     {
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      * @var mixed  $pattern
148 148
      * @var mixed  $replacement
149 149
      *
150
-     * @return bool true on success
150
+     * @return null|boolean true on success
151 151
      */
152 152
     function planetParseFunction($function_string, $pattern = '', $replacement = '')
153 153
     {
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
     /**
514 514
      * @param $url
515
-     * @return bool|string
515
+     * @return false|string
516 516
      */
517 517
     function planet_fetch_fopen($url)
518 518
     {
Please login to merge, or discard this patch.
view.archive.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -287,7 +287,7 @@
 block discarded – undo
287 287
 // Used in get_calendar
288 288
 /**
289 289
  * @param $num
290
- * @return mixed
290
+ * @return double
291 291
  */
292 292
 function planet_calendar_week_mod($num)
293 293
 {
Please login to merge, or discard this patch.
admin/admin.blog.php 1 patch
Switch Indentation   +330 added lines, -330 removed lines patch added patch discarded remove patch
@@ -57,339 +57,339 @@
 block discarded – undo
57 57
 
58 58
 switch ($op) {
59 59
     /* save a single blog */
60
-    case 'save':
61
-
62
-        if ($blog_id) {
63
-            $blog_obj = $blogHandler->get($blog_id);
64
-        } else {
65
-            if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) {
66
-                redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS'));
67
-            }
68
-            $blog_obj = $blogHandler->create();
69
-            $blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid'));
70
-        }
71
-
72
-        $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']);
73
-        $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']);
74
-        $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']);
75
-        $blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']);
76
-        $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']);
77
-        $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']);
78
-        $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']);
79
-        $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']);
80
-        $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']);
81
-
82
-        if (!$blogHandler->insert($blog_obj)) {
83
-        } elseif (!empty(Request::getArray('categories', array(), 'POST'))) {
84
-            $blog_id = $blog_obj->getVar('blog_id');
85
-            if (in_array(0, Request::getArray('categories', array(), 'POST'))) {
86
-                $_POST['categories'] = array();
87
-            }
88
-            $blogHandler->setCategories($blog_id, Request::getArray('categories', array(), 'POST'));
89
-        }
90
-        $message = planet_constant('AM_DBUPDATED');
91
-        redirect_header('admin.blog.php', 2, $message);
92
-
93
-    /* fetch and add a list of blogs to a category */
94
-    case 'add':
95
-        $links = PlanetUtility::planetParseLinks(Request::getArray('links', array(), 'POST'));
96
-        $blogs = array();
97
-        foreach ($links as $link) {
98
-            if ($blog_exist = $blogHandler->getCount(new Criteria('blog_feed', $link['url']))) {
99
-                continue;
100
-            }
101
-            $blog_obj = $blogHandler->fetch($link['url']);
102
-            if (!empty($link['title'])) {
103
-                $blog_obj->setVar('blog_title', $link['title']);
104
-            }
105
-            $blogHandler->insert($blog_obj);
106
-            $blogs[] = $blog_obj->getVar('blog_id');
107
-            unset($blog_obj);
108
-        }
109
-        if (!empty(Request::getArray('categories', array(), 'POST'))) {
110
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
111
-            foreach (Request::getArray('categories', array(), 'POST') as $cat_id) {
112
-                $categoryHandler->addBlogs($cat_id, $blogs);
113
-            }
114
-        }
115
-        $message = planet_constant('AM_DBUPDATED');
116
-        redirect_header('admin.blog.php', 2, $message);
117
-
118
-    /* update a list of blogs */
119
-    case 'update':
120
-        foreach ($blog_id as $bid) {
121
-            $blog_obj = $blogHandler->fetch($bid);
122
-            if (!$blogHandler->insert($blog_obj)) {
123
-            }
124
-            unset($blog_obj);
125
-        }
126
-        $message = planet_constant('AM_DBUPDATED');
127
-        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message);
128
-
129
-    /* add a list of blogs to a category */
130
-    case 'register':
131
-        if (!empty(Request::getArray('category_dest', array(), 'POST'))) {
132
-            if (!is_array($blog_id)) {
133
-                $blog_id = array($blog_id);
134
-            }
135
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
136
-            $categoryHandler->addBlogs(Request::getArray('category_dest', array(), 'POST'), $blog_id);
137
-        }
138
-        $message = planet_constant('AM_DBUPDATED');
139
-        redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', array(), 'POST') . '&start=' . $start, 2, $message);
140
-
141
-    /* remove a list of blogs from a category */
142
-    case 'remove':
143
-        if (!is_array($blog_id)) {
144
-            $blog_id = array($blog_id);
145
-        }
146
-        if (!empty($category_id)) {
147
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
148
-            $categoryHandler->removeBlogs($category_id, $blog_id);
149
-        }
150
-        $message = planet_constant('AM_DBUPDATED');
151
-        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message);
152
-
153
-    /* delete a single blog or a list blogs */
154
-    case 'del':
155
-        if (!is_array($blog_id)) {
156
-            $blog_id = array($blog_id);
157
-        }
158
-        foreach ($blog_id as $bid) {
159
-            $blog_obj = $blogHandler->get($bid);
160
-            if (!$blogHandler->delete($blog_obj, true)) {
161
-            }
162
-            unset($blog_obj);
163
-        }
164
-        $message = planet_constant('AM_DBUPDATED');
165
-        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message);
166
-
167
-    /* empty a single blog or a list blogs */
168
-    case 'empty':
169
-        if (!is_array($blog_id)) {
170
-            $blog_id = array($blog_id);
171
-        }
172
-        foreach ($blog_id as $bid) {
173
-            $blog_obj = $blogHandler->get($bid);
174
-            if (!$blogHandler->do_empty($blog_obj)) {
175
-            }
176
-        }
177
-        $message = planet_constant('AM_DBUPDATED');
178
-        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message);
179
-
180
-    /* approve a single blog or a list blogs */
181
-    case 'approve':
182
-        if (!is_array($blog_id)) {
183
-            $blog_id = array($blog_id);
184
-        }
185
-        $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
186
-        $blogHandler->updateAll('blog_status', 1, $criteria, true);
187
-        $message = planet_constant('AM_DBUPDATED');
188
-        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message);
189
-
190
-    /* mark a single blog or a list blogs as featured */
191
-    case 'feature':
192
-        if (!is_array($blog_id)) {
193
-            $blog_id = array($blog_id);
194
-        }
195
-        $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
196
-        $blogHandler->updateAll('blog_status', 2, $criteria, true);
197
-        $message = planet_constant('AM_DBUPDATED');
198
-        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message);
199
-
200
-    /* edit a single blog */
201
-    case 'edit':
202
-        if (!empty(Request::getString('fetch', '', 'POST'))) {
203
-            $blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST'));
204
-            $blog_obj->setVar('blog_id', $blog_id);
205
-        } else {
206
-            $blog_obj = $blogHandler->get($blog_id);
207
-        }
208
-        $categories = Request::getArray('categories', array(), 'POST');
209
-        if (empty($categories) && $blog_id > 0) {
210
-            $crit       = new Criteria('bc.blog_id', $blog_id);
211
-            $categories = array_keys($categoryHandler->getByBlog($crit));
212
-        }
213
-        if (empty($categories)) {
214
-            $categories = array(0 => _NONE);
215
-        }
216
-
217
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
218
-        echo '<br>';
219
-        if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
220
-            $criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
221
-            $blogs_obj = $blogHandler->getList($criteria);
222
-            if (count($blogs_obj) > 0) {
223
-                echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS');
224
-                foreach (array_keys($blogs_obj) as $bid) {
225
-                    echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>';
226
-                }
227
-                echo '</div>';
228
-            }
229
-            unset($blogs_obj, $criteria);
230
-        }
231
-        include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
232
-        echo '</fieldset>';
233
-        break;
234
-
235
-    default:
236
-
237
-        $crit = new Criteria('1', 1);
238
-        $crit->setSort('cat_order');
239
-        $crit->setOrder('ASC');
240
-        $categories = $categoryHandler->getList($crit);
241
-
242
-        // Display category option form
243
-        $opform    = new XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get');
244
-        $op_select = new XoopsFormSelect('', 'category', $category_id);
245
-        $op_select->setExtra('onchange="document.forms.opform.submit()"');
246
-        $options = array(
247
-            '0'  => _ALL,
248
-            '-1' => planet_constant('MD_ACTIVE'),
249
-            '-2' => planet_constant('MD_FEATURED'),
250
-            '-3' => planet_constant('MD_PENDING')
251
-        );
252
-        foreach (array_keys($categories) as $key) {
253
-            $options[$key] = $categories[$key];
254
-        }
255
-        $op_select->addOptionArray($options);
256
-        $opform->addElement($op_select);
257
-        $opform->display();
258
-
259
-        if ($category_id > 0) {
260
-            $criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>'));
261
-            $criteria->add(new Criteria('bc.cat_id', $category_id));
262
-            $blog_count = $blogHandler->getCountByCategory($criteria);
263
-            $criteria->setStart($start);
264
-            $criteria->setLimit($xoopsModuleConfig['list_perpage']);
265
-            $blog_objs = $blogHandler->getByCategory($criteria);
266
-        } else {
267
-            /* All active blogs */
268
-            if ($category_id == 0) {
269
-                $criteria = new Criteria('1', 1);
270
-                $criteria->setStart($start);
271
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
272
-                /* Active blogs */
273
-            } elseif ($category_id == -1) {
274
-                $criteria = new Criteria('blog_status', 1);
275
-                $criteria->setStart($start);
276
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
277
-                /* Featured blogs */
278
-            } elseif ($category_id == -2) {
279
-                $criteria = new Criteria('blog_status', 2);
280
-                $criteria->setStart($start);
281
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
282
-                /* Pending blogs */
283
-            } else {
284
-                $criteria = new Criteria('blog_status', 0);
285
-                $criteria->setStart($start);
286
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
287
-            }
288
-            $blog_count = $blogHandler->getCount($criteria);
289
-            $blog_objs  = $blogHandler->getAll($criteria);
290
-        }
291
-
292
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
293
-        echo "<br style=\"clear:both\">";
294
-
295
-        echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>";
296
-        echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
297
-        echo "<tr align='center'>";
298
-        echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>";
299
-        echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>';
300
-        echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>';
301
-        echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>';
302
-        //        echo "<th class='bg3' width='5%'>" . _EDIT . "</td>";
303
-        //        echo "<th class='bg3' width='5%'>" . _DELETE . "</td>";
304
-        echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>';
305
-        echo '</tr>';
306
-
307
-        $status = array(
308
-            '0' => planet_constant('MD_PENDING'),
309
-            '1' => planet_constant('MD_ACTIVE'),
310
-            '2' => planet_constant('MD_FEATURED')
311
-        );
312
-        foreach (array_keys($blog_objs) as $bid) {
313
-            echo "<tr class='odd' align='left'>";
314
-            echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>";
315
-            echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>';
316
-            echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>';
317
-            echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>';
318
-            echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a>
60
+    	case 'save':
61
+
62
+        	if ($blog_id) {
63
+            	$blog_obj = $blogHandler->get($blog_id);
64
+        	} else {
65
+            	if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) {
66
+                	redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS'));
67
+            	}
68
+            	$blog_obj = $blogHandler->create();
69
+            	$blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid'));
70
+        	}
71
+
72
+        	$blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']);
73
+        	$blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']);
74
+        	$blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']);
75
+        	$blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']);
76
+        	$blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']);
77
+        	$blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']);
78
+        	$blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']);
79
+        	$blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']);
80
+        	$blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']);
81
+
82
+        	if (!$blogHandler->insert($blog_obj)) {
83
+        	} elseif (!empty(Request::getArray('categories', array(), 'POST'))) {
84
+            	$blog_id = $blog_obj->getVar('blog_id');
85
+            	if (in_array(0, Request::getArray('categories', array(), 'POST'))) {
86
+                	$_POST['categories'] = array();
87
+            	}
88
+            	$blogHandler->setCategories($blog_id, Request::getArray('categories', array(), 'POST'));
89
+        	}
90
+        	$message = planet_constant('AM_DBUPDATED');
91
+        	redirect_header('admin.blog.php', 2, $message);
92
+
93
+    	/* fetch and add a list of blogs to a category */
94
+    	case 'add':
95
+        	$links = PlanetUtility::planetParseLinks(Request::getArray('links', array(), 'POST'));
96
+        	$blogs = array();
97
+        	foreach ($links as $link) {
98
+            	if ($blog_exist = $blogHandler->getCount(new Criteria('blog_feed', $link['url']))) {
99
+                	continue;
100
+            	}
101
+            	$blog_obj = $blogHandler->fetch($link['url']);
102
+            	if (!empty($link['title'])) {
103
+                	$blog_obj->setVar('blog_title', $link['title']);
104
+            	}
105
+            	$blogHandler->insert($blog_obj);
106
+            	$blogs[] = $blog_obj->getVar('blog_id');
107
+            	unset($blog_obj);
108
+        	}
109
+        	if (!empty(Request::getArray('categories', array(), 'POST'))) {
110
+            	$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
111
+            	foreach (Request::getArray('categories', array(), 'POST') as $cat_id) {
112
+                	$categoryHandler->addBlogs($cat_id, $blogs);
113
+            	}
114
+        	}
115
+        	$message = planet_constant('AM_DBUPDATED');
116
+        	redirect_header('admin.blog.php', 2, $message);
117
+
118
+    	/* update a list of blogs */
119
+    	case 'update':
120
+        	foreach ($blog_id as $bid) {
121
+            	$blog_obj = $blogHandler->fetch($bid);
122
+            	if (!$blogHandler->insert($blog_obj)) {
123
+            	}
124
+            	unset($blog_obj);
125
+        	}
126
+        	$message = planet_constant('AM_DBUPDATED');
127
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
128
+
129
+    	/* add a list of blogs to a category */
130
+    	case 'register':
131
+        	if (!empty(Request::getArray('category_dest', array(), 'POST'))) {
132
+            	if (!is_array($blog_id)) {
133
+                	$blog_id = array($blog_id);
134
+            	}
135
+            	$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
136
+            	$categoryHandler->addBlogs(Request::getArray('category_dest', array(), 'POST'), $blog_id);
137
+        	}
138
+        	$message = planet_constant('AM_DBUPDATED');
139
+        	redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', array(), 'POST') . '&amp;start=' . $start, 2, $message);
140
+
141
+    	/* remove a list of blogs from a category */
142
+    	case 'remove':
143
+        	if (!is_array($blog_id)) {
144
+            	$blog_id = array($blog_id);
145
+        	}
146
+        	if (!empty($category_id)) {
147
+            	$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
148
+            	$categoryHandler->removeBlogs($category_id, $blog_id);
149
+        	}
150
+        	$message = planet_constant('AM_DBUPDATED');
151
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
152
+
153
+    	/* delete a single blog or a list blogs */
154
+    	case 'del':
155
+        	if (!is_array($blog_id)) {
156
+            	$blog_id = array($blog_id);
157
+        	}
158
+        	foreach ($blog_id as $bid) {
159
+            	$blog_obj = $blogHandler->get($bid);
160
+            	if (!$blogHandler->delete($blog_obj, true)) {
161
+            	}
162
+            	unset($blog_obj);
163
+        	}
164
+        	$message = planet_constant('AM_DBUPDATED');
165
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
166
+
167
+    	/* empty a single blog or a list blogs */
168
+    	case 'empty':
169
+        	if (!is_array($blog_id)) {
170
+            	$blog_id = array($blog_id);
171
+        	}
172
+        	foreach ($blog_id as $bid) {
173
+            	$blog_obj = $blogHandler->get($bid);
174
+            	if (!$blogHandler->do_empty($blog_obj)) {
175
+            	}
176
+        	}
177
+        	$message = planet_constant('AM_DBUPDATED');
178
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
179
+
180
+    	/* approve a single blog or a list blogs */
181
+    	case 'approve':
182
+        	if (!is_array($blog_id)) {
183
+            	$blog_id = array($blog_id);
184
+        	}
185
+        	$criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
186
+        	$blogHandler->updateAll('blog_status', 1, $criteria, true);
187
+        	$message = planet_constant('AM_DBUPDATED');
188
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
189
+
190
+    	/* mark a single blog or a list blogs as featured */
191
+    	case 'feature':
192
+        	if (!is_array($blog_id)) {
193
+            	$blog_id = array($blog_id);
194
+        	}
195
+        	$criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
196
+        	$blogHandler->updateAll('blog_status', 2, $criteria, true);
197
+        	$message = planet_constant('AM_DBUPDATED');
198
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
199
+
200
+    	/* edit a single blog */
201
+    	case 'edit':
202
+        	if (!empty(Request::getString('fetch', '', 'POST'))) {
203
+            	$blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST'));
204
+            	$blog_obj->setVar('blog_id', $blog_id);
205
+        	} else {
206
+            	$blog_obj = $blogHandler->get($blog_id);
207
+        	}
208
+        	$categories = Request::getArray('categories', array(), 'POST');
209
+        	if (empty($categories) && $blog_id > 0) {
210
+            	$crit       = new Criteria('bc.blog_id', $blog_id);
211
+            	$categories = array_keys($categoryHandler->getByBlog($crit));
212
+        	}
213
+        	if (empty($categories)) {
214
+            	$categories = array(0 => _NONE);
215
+        	}
216
+
217
+        	echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
218
+        	echo '<br>';
219
+        	if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
220
+            	$criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
221
+            	$blogs_obj = $blogHandler->getList($criteria);
222
+            	if (count($blogs_obj) > 0) {
223
+                	echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS');
224
+                	foreach (array_keys($blogs_obj) as $bid) {
225
+                    	echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>';
226
+                	}
227
+                	echo '</div>';
228
+            	}
229
+            	unset($blogs_obj, $criteria);
230
+        	}
231
+        	include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
232
+        	echo '</fieldset>';
233
+        	break;
234
+
235
+    	default:
236
+
237
+        	$crit = new Criteria('1', 1);
238
+        	$crit->setSort('cat_order');
239
+        	$crit->setOrder('ASC');
240
+        	$categories = $categoryHandler->getList($crit);
241
+
242
+        	// Display category option form
243
+        	$opform    = new XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get');
244
+        	$op_select = new XoopsFormSelect('', 'category', $category_id);
245
+        	$op_select->setExtra('onchange="document.forms.opform.submit()"');
246
+        	$options = array(
247
+            	'0'  => _ALL,
248
+            	'-1' => planet_constant('MD_ACTIVE'),
249
+            	'-2' => planet_constant('MD_FEATURED'),
250
+            	'-3' => planet_constant('MD_PENDING')
251
+        	);
252
+        	foreach (array_keys($categories) as $key) {
253
+            	$options[$key] = $categories[$key];
254
+        	}
255
+        	$op_select->addOptionArray($options);
256
+        	$opform->addElement($op_select);
257
+        	$opform->display();
258
+
259
+        	if ($category_id > 0) {
260
+            	$criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>'));
261
+            	$criteria->add(new Criteria('bc.cat_id', $category_id));
262
+            	$blog_count = $blogHandler->getCountByCategory($criteria);
263
+            	$criteria->setStart($start);
264
+            	$criteria->setLimit($xoopsModuleConfig['list_perpage']);
265
+            	$blog_objs = $blogHandler->getByCategory($criteria);
266
+        	} else {
267
+            	/* All active blogs */
268
+            	if ($category_id == 0) {
269
+                	$criteria = new Criteria('1', 1);
270
+                	$criteria->setStart($start);
271
+                	$criteria->setLimit($xoopsModuleConfig['list_perpage']);
272
+                	/* Active blogs */
273
+            	} elseif ($category_id == -1) {
274
+                	$criteria = new Criteria('blog_status', 1);
275
+                	$criteria->setStart($start);
276
+                	$criteria->setLimit($xoopsModuleConfig['list_perpage']);
277
+                	/* Featured blogs */
278
+            	} elseif ($category_id == -2) {
279
+                	$criteria = new Criteria('blog_status', 2);
280
+                	$criteria->setStart($start);
281
+                	$criteria->setLimit($xoopsModuleConfig['list_perpage']);
282
+                	/* Pending blogs */
283
+            	} else {
284
+                	$criteria = new Criteria('blog_status', 0);
285
+                	$criteria->setStart($start);
286
+                	$criteria->setLimit($xoopsModuleConfig['list_perpage']);
287
+            	}
288
+            	$blog_count = $blogHandler->getCount($criteria);
289
+            	$blog_objs  = $blogHandler->getAll($criteria);
290
+        	}
291
+
292
+        	echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
293
+        	echo "<br style=\"clear:both\">";
294
+
295
+        	echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>";
296
+        	echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
297
+        	echo "<tr align='center'>";
298
+        	echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>";
299
+        	echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>';
300
+        	echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>';
301
+        	echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>';
302
+        	//        echo "<th class='bg3' width='5%'>" . _EDIT . "</td>";
303
+        	//        echo "<th class='bg3' width='5%'>" . _DELETE . "</td>";
304
+        	echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>';
305
+        	echo '</tr>';
306
+
307
+        	$status = array(
308
+            	'0' => planet_constant('MD_PENDING'),
309
+            	'1' => planet_constant('MD_ACTIVE'),
310
+            	'2' => planet_constant('MD_FEATURED')
311
+        	);
312
+        	foreach (array_keys($blog_objs) as $bid) {
313
+            	echo "<tr class='odd' align='left'>";
314
+            	echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>";
315
+            	echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>';
316
+            	echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>';
317
+            	echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>';
318
+            	echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a>
319 319
                       <a href='admin.blog.php?op=del&amp;blog=" . $bid . "' title='" . _DELETE . "'><img src='" . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a>&nbsp;
320 320
                       <a href='admin.blog.php?op=empty&amp;blog=" . $bid . "' title='" . planet_constant('MD_EMPTY_BLOG') . "'><img src='" . $pathIcon16 . "/empty.png '" . " alt='" . _EDIT . " title='" . planet_constant('MD_EMPTY_BLOG') . '</a></td>';
321 321
 
322
-            echo '</tr>';
323
-        }
324
-        echo "<tr class='even' align='center'>";
325
-        echo "<td colspan='7'>";
326
-        echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>";
327
-        echo "<option value=''>" . _SELECT . '</option>';
328
-        echo "<option value='del'>" . _DELETE . '</option>';
329
-        echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>';
330
-        echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>';
331
-        if ($category_id > 0) {
332
-            echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>';
333
-        }
334
-        echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>';
335
-        echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>';
336
-        echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>';
337
-
338
-        echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>';
339
-        echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>';
340
-
341
-        echo '</select>';
342
-        echo "<div id='catdiv' style='visibility:hidden;display:inline;'>";
343
-        echo "<select name='category_dest'>";
344
-        echo "<option value=''>" . _SELECT . '</option>';
345
-        foreach ($categories as $cid => $name) {
346
-            echo "<option value='" . $cid . "'>" . $name . '</option>';
347
-        }
348
-        echo '</select>';
349
-        echo '</div>';
350
-        echo "<input name='start' value='" . $start . "' type='hidden'>";
351
-        echo "<input name='category' value='" . $category_id . "' type='hidden'>";
352
-        echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
353
-        echo "<input name='' value='" . _CANCEL . "' type='reset'>";
354
-        echo '</td>';
355
-        echo '</tr>';
356
-        if ($blog_count > $xoopsModuleConfig['list_perpage']) {
357
-            include XOOPS_ROOT_PATH . '/class/pagenav.php';
358
-            $nav     = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category=' . $category_id);
359
-            $pagenav = $nav->renderNav(4);
360
-            echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>';
361
-        }
362
-        echo '</table></form>';
363
-        echo "</fieldset><br style='clear:both;'>";
364
-
365
-        if (empty($start) && empty($category_id)) {
366
-            $form = new XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true);
367
-            $form->addElement(new XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true);
368
-            $form->addElement(new XoopsFormHidden('op', 'edit'));
369
-            $button_tray = new XoopsFormElementTray('', '');
370
-            $butt_save   = new XoopsFormButton('', 'fetch', _SUBMIT, 'submit');
371
-            $button_tray->addElement($butt_save);
372
-            $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
373
-            $button_tray->addElement($butt_cancel);
374
-            $form->addElement($button_tray);
375
-
376
-            $form_add = new XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true);
377
-            $form_add->addElement(new XoopsFormTextArea(planet_constant('AM_FEED'), 'links'));
378
-            $form_add->addElement(new XoopsFormHidden('op', 'add'));
379
-            $button_tray = new XoopsFormElementTray('', '');
380
-            $butt_save   = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
381
-            $button_tray->addElement($butt_save);
382
-            $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
383
-            $button_tray->addElement($butt_cancel);
384
-            $form_add->addElement($button_tray);
385
-
386
-            echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
387
-            echo '<br>';
388
-            $form->display();
389
-            $form_add->display();
390
-            echo '</fieldset>';
391
-        }
392
-        break;
322
+            	echo '</tr>';
323
+        	}
324
+        	echo "<tr class='even' align='center'>";
325
+        	echo "<td colspan='7'>";
326
+        	echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>";
327
+        	echo "<option value=''>" . _SELECT . '</option>';
328
+        	echo "<option value='del'>" . _DELETE . '</option>';
329
+        	echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>';
330
+        	echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>';
331
+        	if ($category_id > 0) {
332
+            	echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>';
333
+        	}
334
+        	echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>';
335
+        	echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>';
336
+        	echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>';
337
+
338
+        	echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>';
339
+        	echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>';
340
+
341
+        	echo '</select>';
342
+        	echo "<div id='catdiv' style='visibility:hidden;display:inline;'>";
343
+        	echo "<select name='category_dest'>";
344
+        	echo "<option value=''>" . _SELECT . '</option>';
345
+        	foreach ($categories as $cid => $name) {
346
+            	echo "<option value='" . $cid . "'>" . $name . '</option>';
347
+        	}
348
+        	echo '</select>';
349
+        	echo '</div>';
350
+        	echo "<input name='start' value='" . $start . "' type='hidden'>";
351
+        	echo "<input name='category' value='" . $category_id . "' type='hidden'>";
352
+        	echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
353
+        	echo "<input name='' value='" . _CANCEL . "' type='reset'>";
354
+        	echo '</td>';
355
+        	echo '</tr>';
356
+        	if ($blog_count > $xoopsModuleConfig['list_perpage']) {
357
+            	include XOOPS_ROOT_PATH . '/class/pagenav.php';
358
+            	$nav     = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category=' . $category_id);
359
+            	$pagenav = $nav->renderNav(4);
360
+            	echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>';
361
+        	}
362
+        	echo '</table></form>';
363
+        	echo "</fieldset><br style='clear:both;'>";
364
+
365
+        	if (empty($start) && empty($category_id)) {
366
+            	$form = new XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true);
367
+            	$form->addElement(new XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true);
368
+            	$form->addElement(new XoopsFormHidden('op', 'edit'));
369
+            	$button_tray = new XoopsFormElementTray('', '');
370
+            	$butt_save   = new XoopsFormButton('', 'fetch', _SUBMIT, 'submit');
371
+            	$button_tray->addElement($butt_save);
372
+            	$butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
373
+            	$button_tray->addElement($butt_cancel);
374
+            	$form->addElement($button_tray);
375
+
376
+            	$form_add = new XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true);
377
+            	$form_add->addElement(new XoopsFormTextArea(planet_constant('AM_FEED'), 'links'));
378
+            	$form_add->addElement(new XoopsFormHidden('op', 'add'));
379
+            	$button_tray = new XoopsFormElementTray('', '');
380
+            	$butt_save   = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
381
+            	$button_tray->addElement($butt_save);
382
+            	$butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
383
+            	$button_tray->addElement($butt_cancel);
384
+            	$form_add->addElement($button_tray);
385
+
386
+            	echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
387
+            	echo '<br>';
388
+            	$form->display();
389
+            	$form_add->display();
390
+            	echo '</fieldset>';
391
+        	}
392
+        	break;
393 393
 }
394 394
 
395 395
 xoops_cp_footer();
Please login to merge, or discard this patch.