@@ -22,7 +22,7 @@ |
||
22 | 22 | ." <div style='text-align: center;'>\n" |
23 | 23 | ." <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" |
24 | 24 | ." </div>\n" |
25 | - ." " . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" |
|
25 | + ." "._AM_MODULEADMIN_ADMIN_FOOTER."\n" |
|
26 | 26 | ."</div>"; |
27 | 27 | |
28 | 28 | xoops_cp_footer(); |
29 | 29 | \ No newline at end of file |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | // URL: http://xoops.org // |
25 | 25 | // Project: Article Project // |
26 | 26 | // ------------------------------------------------------------------------ // |
27 | -include( "admin_header.php" ); |
|
28 | -require_once(XOOPS_ROOT_PATH . "/class/xoopsformloader.php"); |
|
27 | +include("admin_header.php"); |
|
28 | +require_once(XOOPS_ROOT_PATH."/class/xoopsformloader.php"); |
|
29 | 29 | |
30 | 30 | xoops_cp_header(); |
31 | 31 | $indexAdmin = new ModuleAdmin(); |
@@ -40,31 +40,31 @@ discard block |
||
40 | 40 | require XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/include/vars.php"; |
41 | 41 | //planet_adminmenu(2); |
42 | 42 | |
43 | -$op = !empty($_POST["op"])?$_POST["op"]:(!empty($_GET["op"])?$_GET["op"]:""); |
|
44 | -$blog_id = !empty($_POST["blog"])?$_POST["blog"]:(!empty($_GET["blog"])?$_GET["blog"]:0); |
|
45 | -$blog_id = is_array($blog_id)?array_map("intval", $blog_id):intval($blog_id); |
|
46 | -$category_id = intval( !empty($_POST["category"])?$_POST["category"]:(!empty($_GET["category"])?$_GET["category"]:0) ); |
|
47 | -$start = intval( !empty($_POST["start"])?$_POST["start"]:(!empty($_GET["start"])?$_GET["start"]:0) ); |
|
43 | +$op = !empty($_POST["op"]) ? $_POST["op"] : (!empty($_GET["op"]) ? $_GET["op"] : ""); |
|
44 | +$blog_id = !empty($_POST["blog"]) ? $_POST["blog"] : (!empty($_GET["blog"]) ? $_GET["blog"] : 0); |
|
45 | +$blog_id = is_array($blog_id) ? array_map("intval", $blog_id) : intval($blog_id); |
|
46 | +$category_id = intval(!empty($_POST["category"]) ? $_POST["category"] : (!empty($_GET["category"]) ? $_GET["category"] : 0)); |
|
47 | +$start = intval(!empty($_POST["start"]) ? $_POST["start"] : (!empty($_GET["start"]) ? $_GET["start"] : 0)); |
|
48 | 48 | |
49 | -$blog_handler =& xoops_getmodulehandler("blog", $GLOBALS["moddirname"]); |
|
50 | -$category_handler =& xoops_getmodulehandler("category", $GLOBALS["moddirname"]); |
|
49 | +$blog_handler = & xoops_getmodulehandler("blog", $GLOBALS["moddirname"]); |
|
50 | +$category_handler = & xoops_getmodulehandler("category", $GLOBALS["moddirname"]); |
|
51 | 51 | |
52 | -if($op=="save" && !empty($_POST["fetch"])){ |
|
53 | - $op="edit"; |
|
52 | +if ($op == "save" && !empty($_POST["fetch"])) { |
|
53 | + $op = "edit"; |
|
54 | 54 | } |
55 | 55 | |
56 | -switch($op){ |
|
56 | +switch ($op) { |
|
57 | 57 | /* save a single blog */ |
58 | 58 | case "save": |
59 | 59 | |
60 | 60 | if ($blog_id) { |
61 | - $blog_obj =& $blog_handler->get($blog_id); |
|
62 | - } else { |
|
63 | - if($blog_exists = $blog_handler->getCount(new Criteria("blog_feed", $_POST['blog_feed']))){ |
|
61 | + $blog_obj = & $blog_handler->get($blog_id); |
|
62 | + }else { |
|
63 | + if ($blog_exists = $blog_handler->getCount(new Criteria("blog_feed", $_POST['blog_feed']))) { |
|
64 | 64 | redirect_header("admin.blog.php", 2, planet_constant("AM_BLOGEXISTS")); |
65 | 65 | exit(); |
66 | 66 | } |
67 | - $blog_obj =& $blog_handler->create(); |
|
67 | + $blog_obj = & $blog_handler->create(); |
|
68 | 68 | $blog_obj->setVar('blog_submitter', $xoopsUser->getVar("uid")); |
69 | 69 | } |
70 | 70 | |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | $blog_obj->setVar('blog_status', $_POST['blog_status']); |
80 | 80 | |
81 | 81 | if (!$blog_handler->insert($blog_obj)) { |
82 | - }elseif(!empty($_POST["categories"])){ |
|
82 | + }elseif (!empty($_POST["categories"])) { |
|
83 | 83 | $blog_id = $blog_obj->getVar("blog_id"); |
84 | - if(in_array(0, $_POST["categories"])) $_POST["categories"] = array(); |
|
84 | + if (in_array(0, $_POST["categories"])) $_POST["categories"] = array(); |
|
85 | 85 | $blog_handler->setCategories($blog_id, $_POST["categories"]); |
86 | 86 | } |
87 | 87 | $message = planet_constant("AM_DBUPDATED"); |
@@ -92,17 +92,17 @@ discard block |
||
92 | 92 | case "add": |
93 | 93 | $links = planet_parseLinks($_POST["links"]); |
94 | 94 | $blogs = array(); |
95 | - foreach($links as $link){ |
|
96 | - if($blog_exist = $blog_handler->getCount(new Criteria("blog_feed", $link["url"]))) continue; |
|
97 | - $blog_obj =& $blog_handler->fetch($link["url"]); |
|
98 | - if(!empty($link["title"])) $blog_obj->setVar("blog_title", $link["title"]); |
|
95 | + foreach ($links as $link) { |
|
96 | + if ($blog_exist = $blog_handler->getCount(new Criteria("blog_feed", $link["url"]))) continue; |
|
97 | + $blog_obj = & $blog_handler->fetch($link["url"]); |
|
98 | + if (!empty($link["title"])) $blog_obj->setVar("blog_title", $link["title"]); |
|
99 | 99 | $blog_handler->insert($blog_obj); |
100 | 100 | $blogs[] = $blog_obj->getVar("blog_id"); |
101 | 101 | unset($blog_obj); |
102 | 102 | } |
103 | - if(!empty($_POST["categories"])){ |
|
104 | - $category_handler =& xoops_getmodulehandler("category", $GLOBALS["moddirname"]); |
|
105 | - foreach($_POST["categories"] as $cat_id){ |
|
103 | + if (!empty($_POST["categories"])) { |
|
104 | + $category_handler = & xoops_getmodulehandler("category", $GLOBALS["moddirname"]); |
|
105 | + foreach ($_POST["categories"] as $cat_id) { |
|
106 | 106 | $category_handler->addBlogs($cat_id, $blogs); |
107 | 107 | } |
108 | 108 | } |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | |
113 | 113 | /* update a list of blogs */ |
114 | 114 | case "update": |
115 | - foreach($blog_id as $bid){ |
|
116 | - $blog_obj =& $blog_handler->fetch($bid); |
|
115 | + foreach ($blog_id as $bid) { |
|
116 | + $blog_obj = & $blog_handler->fetch($bid); |
|
117 | 117 | if (!$blog_handler->insert($blog_obj)) { |
118 | 118 | } |
119 | 119 | unset($blog_obj); |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | |
125 | 125 | /* add a list of blogs to a category */ |
126 | 126 | case "register": |
127 | - if(!empty($_POST["category_dest"])){ |
|
128 | - if(!is_array($blog_id)) $blog_id = array($blog_id); |
|
129 | - $category_handler =& xoops_getmodulehandler("category", $GLOBALS["moddirname"]); |
|
127 | + if (!empty($_POST["category_dest"])) { |
|
128 | + if (!is_array($blog_id)) $blog_id = array($blog_id); |
|
129 | + $category_handler = & xoops_getmodulehandler("category", $GLOBALS["moddirname"]); |
|
130 | 130 | $category_handler->addBlogs($_POST["category_dest"], $blog_id); |
131 | 131 | } |
132 | 132 | $message = planet_constant("AM_DBUPDATED"); |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | |
136 | 136 | /* remove a list of blogs from a category */ |
137 | 137 | case "remove": |
138 | - if(!is_array($blog_id)) $blog_id = array($blog_id); |
|
139 | - if(!empty($category_id)){ |
|
140 | - $category_handler =& xoops_getmodulehandler("category", $GLOBALS["moddirname"]); |
|
138 | + if (!is_array($blog_id)) $blog_id = array($blog_id); |
|
139 | + if (!empty($category_id)) { |
|
140 | + $category_handler = & xoops_getmodulehandler("category", $GLOBALS["moddirname"]); |
|
141 | 141 | $category_handler->removeBlogs($category_id, $blog_id); |
142 | 142 | } |
143 | 143 | $message = planet_constant("AM_DBUPDATED"); |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | |
147 | 147 | /* delete a single blog or a list blogs */ |
148 | 148 | case "del": |
149 | - if(!is_array($blog_id)) $blog_id = array($blog_id); |
|
150 | - foreach($blog_id as $bid){ |
|
151 | - $blog_obj =& $blog_handler->get($bid); |
|
149 | + if (!is_array($blog_id)) $blog_id = array($blog_id); |
|
150 | + foreach ($blog_id as $bid) { |
|
151 | + $blog_obj = & $blog_handler->get($bid); |
|
152 | 152 | if (!$blog_handler->delete($blog_obj, true)) { |
153 | 153 | } |
154 | 154 | unset($blog_obj); |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | |
160 | 160 | /* empty a single blog or a list blogs */ |
161 | 161 | case "empty": |
162 | - if(!is_array($blog_id)) $blog_id = array($blog_id); |
|
163 | - foreach($blog_id as $bid){ |
|
164 | - $blog_obj =& $blog_handler->get($bid); |
|
162 | + if (!is_array($blog_id)) $blog_id = array($blog_id); |
|
163 | + foreach ($blog_id as $bid) { |
|
164 | + $blog_obj = & $blog_handler->get($bid); |
|
165 | 165 | if (!$blog_handler->do_empty($blog_obj)) { |
166 | 166 | } |
167 | 167 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | /* approve a single blog or a list blogs */ |
173 | 173 | case "approve": |
174 | - if(!is_array($blog_id)) $blog_id = array($blog_id); |
|
174 | + if (!is_array($blog_id)) $blog_id = array($blog_id); |
|
175 | 175 | $criteria = new Criteria("blog_id", "(".implode(",", $blog_id).")", "IN"); |
176 | 176 | $blog_handler->updateAll("blog_status", 1, $criteria, true); |
177 | 177 | $message = planet_constant("AM_DBUPDATED"); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | /* mark a single blog or a list blogs as featured */ |
182 | 182 | case "feature": |
183 | - if(!is_array($blog_id)) $blog_id = array($blog_id); |
|
183 | + if (!is_array($blog_id)) $blog_id = array($blog_id); |
|
184 | 184 | $criteria = new Criteria("blog_id", "(".implode(",", $blog_id).")", "IN"); |
185 | 185 | $blog_handler->updateAll("blog_status", 2, $criteria, true); |
186 | 186 | $message = planet_constant("AM_DBUPDATED"); |
@@ -189,27 +189,27 @@ discard block |
||
189 | 189 | |
190 | 190 | /* edit a single blog */ |
191 | 191 | case "edit": |
192 | - if(!empty($_POST["fetch"])){ |
|
193 | - $blog_obj =& $blog_handler->fetch($_POST["blog_feed"]); |
|
192 | + if (!empty($_POST["fetch"])) { |
|
193 | + $blog_obj = & $blog_handler->fetch($_POST["blog_feed"]); |
|
194 | 194 | $blog_obj->setVar("blog_id", $blog_id); |
195 | - }else{ |
|
196 | - $blog_obj =& $blog_handler->get($blog_id); |
|
195 | + }else { |
|
196 | + $blog_obj = & $blog_handler->get($blog_id); |
|
197 | 197 | } |
198 | 198 | $categories = @$_POST["categories"]; |
199 | - if(empty($categories) && $blog_id>0){ |
|
199 | + if (empty($categories) && $blog_id>0) { |
|
200 | 200 | $crit = new Criteria("bc.blog_id", $blog_id); |
201 | 201 | $categories = array_keys($category_handler->getByBlog($crit)); |
202 | 202 | } |
203 | - if(empty($categories)) $categories = array(0=>_NONE); |
|
203 | + if (empty($categories)) $categories = array(0=>_NONE); |
|
204 | 204 | |
205 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . "</legend>"; |
|
205 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._EDIT."</legend>"; |
|
206 | 206 | echo"<br />"; |
207 | - if(empty($blog_id) && $blog_obj->getVar("blog_feed")){ |
|
207 | + if (empty($blog_id) && $blog_obj->getVar("blog_feed")) { |
|
208 | 208 | $criteria = new Criteria("blog_feed", $blog_obj->getVar("blog_feed")); |
209 | - $blogs_obj =& $blog_handler->getList($criteria); |
|
210 | - if(count($blogs_obj)>0){ |
|
209 | + $blogs_obj = & $blog_handler->getList($criteria); |
|
210 | + if (count($blogs_obj)>0) { |
|
211 | 211 | echo "<div class=\"errorMsg\">".planet_constant("AM_BLOGEXISTS"); |
212 | - foreach(array_keys($blogs_obj) as $bid){ |
|
212 | + foreach (array_keys($blogs_obj) as $bid) { |
|
213 | 213 | echo "<br /><a href=\"".XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/index.php".URL_DELIMITER."b".$bid."\" target=\"_blank\">".$blogs_obj[$bid]."</a>"; |
214 | 214 | } |
215 | 215 | echo "</div>"; |
@@ -232,71 +232,71 @@ discard block |
||
232 | 232 | $op_select = new XoopsFormSelect("", 'category', $category_id); |
233 | 233 | $op_select->setExtra('onchange="document.forms.opform.submit()"'); |
234 | 234 | $options = array("0"=>_ALL, "-1"=>planet_constant("MD_ACTIVE"), "-2"=>planet_constant("MD_FEATURED"), "-3"=>planet_constant("MD_PENDING")); |
235 | - foreach(array_keys($categories) as $key){ |
|
235 | + foreach (array_keys($categories) as $key) { |
|
236 | 236 | $options[$key] = $categories[$key]; |
237 | 237 | } |
238 | 238 | $op_select->addOptionArray($options); |
239 | 239 | $opform->addElement($op_select); |
240 | 240 | $opform->display(); |
241 | 241 | |
242 | - if($category_id>0){ |
|
242 | + if ($category_id>0) { |
|
243 | 243 | $criteria = new CriteriaCompo(new Criteria("b.blog_status", 0, ">")); |
244 | - $criteria->add(new Criteria("bc.cat_id", $category_id)) ; |
|
244 | + $criteria->add(new Criteria("bc.cat_id", $category_id)); |
|
245 | 245 | $blog_count = $blog_handler->getCountByCategory($criteria); |
246 | 246 | $criteria->setStart($start); |
247 | 247 | $criteria->setLimit($xoopsModuleConfig["list_perpage"]); |
248 | - $blog_objs =& $blog_handler->getByCategory($criteria); |
|
249 | - }else{ |
|
248 | + $blog_objs = & $blog_handler->getByCategory($criteria); |
|
249 | + }else { |
|
250 | 250 | /* All active blogs */ |
251 | - if($category_id==0){ |
|
252 | - $criteria = new Criteria("1", 1) ; |
|
251 | + if ($category_id == 0) { |
|
252 | + $criteria = new Criteria("1", 1); |
|
253 | 253 | $criteria->setStart($start); |
254 | 254 | $criteria->setLimit($xoopsModuleConfig["list_perpage"]); |
255 | 255 | /* Active blogs */ |
256 | - }elseif($category_id == -1){ |
|
256 | + }elseif ($category_id == -1) { |
|
257 | 257 | $criteria = new Criteria("blog_status", 1); |
258 | 258 | $criteria->setStart($start); |
259 | 259 | $criteria->setLimit($xoopsModuleConfig["list_perpage"]); |
260 | 260 | /* Featured blogs */ |
261 | - }elseif($category_id == -2){ |
|
261 | + }elseif ($category_id == -2) { |
|
262 | 262 | $criteria = new Criteria("blog_status", 2); |
263 | 263 | $criteria->setStart($start); |
264 | 264 | $criteria->setLimit($xoopsModuleConfig["list_perpage"]); |
265 | 265 | /* Pending blogs */ |
266 | - }else{ |
|
266 | + }else { |
|
267 | 267 | $criteria = new Criteria("blog_status", 0); |
268 | 268 | $criteria->setStart($start); |
269 | 269 | $criteria->setLimit($xoopsModuleConfig["list_perpage"]); |
270 | 270 | } |
271 | 271 | $blog_count = $blog_handler->getCount($criteria); |
272 | - $blog_objs =& $blog_handler->getAll($criteria); |
|
272 | + $blog_objs = & $blog_handler->getAll($criteria); |
|
273 | 273 | } |
274 | 274 | |
275 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant("AM_LIST") . "</legend>"; |
|
275 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>".planet_constant("AM_LIST")."</legend>"; |
|
276 | 276 | echo "<br style=\"clear:both\" />"; |
277 | 277 | |
278 | 278 | echo "<form name='list' id='list' method='post' action='".xoops_getenv("PHP_SELF")."'>"; |
279 | 279 | echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
280 | 280 | echo "<tr align='center'>"; |
281 | 281 | echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox' onclick=\"xoopsCheckAll('list', 'blog_check');\" /></td>"; |
282 | - echo "<th class='bg3'>" . planet_constant("AM_TITLE") . "</td>"; |
|
283 | - echo "<th class='bg3' width='5%'>" . planet_constant("AM_STATUS") . "</td>"; |
|
284 | - echo "<th class='bg3' width='40%'>" . planet_constant("AM_FEED") . "</td>"; |
|
282 | + echo "<th class='bg3'>".planet_constant("AM_TITLE")."</td>"; |
|
283 | + echo "<th class='bg3' width='5%'>".planet_constant("AM_STATUS")."</td>"; |
|
284 | + echo "<th class='bg3' width='40%'>".planet_constant("AM_FEED")."</td>"; |
|
285 | 285 | // echo "<th class='bg3' width='5%'>" . _EDIT . "</td>"; |
286 | 286 | // echo "<th class='bg3' width='5%'>" . _DELETE . "</td>"; |
287 | - echo "<th class='bg3' width='10%'>" . planet_constant("AM_ACTIONS") . "</td>"; |
|
287 | + echo "<th class='bg3' width='10%'>".planet_constant("AM_ACTIONS")."</td>"; |
|
288 | 288 | echo "</tr>"; |
289 | 289 | |
290 | 290 | $status = array("0"=>planet_constant("MD_PENDING"), "1"=>planet_constant("MD_ACTIVE"), "2"=>planet_constant("MD_FEATURED")); |
291 | - foreach(array_keys($blog_objs) as $bid){ |
|
291 | + foreach (array_keys($blog_objs) as $bid) { |
|
292 | 292 | echo "<tr class='odd' align='left'>"; |
293 | 293 | echo "<td align='center'><input name='blog[]' value='".$bid."' type='checkbox' /></td>"; |
294 | 294 | echo "<td><a href='".XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/index.php".URL_DELIMITER."b".$bid."'>".$blog_objs[$bid]->getVar("blog_title")."</a></td>"; |
295 | 295 | echo "<td align='center'>".$status[$blog_objs[$bid]->getVar("blog_status")]."</td>"; |
296 | 296 | echo "<td>".$blog_objs[$bid]->getVar("blog_feed")."</td>"; |
297 | - echo "<td align='center'><a href='admin.blog.php?op=edit&blog=".$bid. "' title='"._EDIT."'><img src='". $pathIcon16 ."/edit.png '". "alt='" . _EDIT . " title='" ._EDIT." </a> |
|
298 | - <a href='admin.blog.php?op=del&blog=".$bid. "' title='"._DELETE."'><img src='". $pathIcon16 ."/delete.png '"." alt='" . _EDIT . " title='"._DELETE." </a> |
|
299 | - <a href='admin.blog.php?op=empty&blog=".$bid."' title='".planet_constant("MD_EMPTY_BLOG")."'><img src='". $pathIcon16 ."/empty.png '"." alt='" . _EDIT . " title='".planet_constant("MD_EMPTY_BLOG")."</a></td>"; |
|
297 | + echo "<td align='center'><a href='admin.blog.php?op=edit&blog=".$bid."' title='"._EDIT."'><img src='".$pathIcon16."/edit.png '"."alt='"._EDIT." title='"._EDIT." </a> |
|
298 | + <a href='admin.blog.php?op=del&blog=".$bid."' title='"._DELETE."'><img src='".$pathIcon16."/delete.png '"." alt='"._EDIT." title='"._DELETE." </a> |
|
299 | + <a href='admin.blog.php?op=empty&blog=".$bid."' title='".planet_constant("MD_EMPTY_BLOG")."'><img src='".$pathIcon16."/empty.png '"." alt='"._EDIT." title='".planet_constant("MD_EMPTY_BLOG")."</a></td>"; |
|
300 | 300 | |
301 | 301 | echo "</tr>"; |
302 | 302 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | echo "<option value='del'>"._DELETE."</option>"; |
308 | 308 | echo "<option value='empty'>".planet_constant("MD_EMPTY_BLOG")."</option>"; |
309 | 309 | echo "<option value='register'>".planet_constant("AM_REGISTER")."</option>"; |
310 | - if($category_id > 0){ |
|
310 | + if ($category_id>0) { |
|
311 | 311 | echo "<option value='remove'>".planet_constant("AM_REMOVE")."</option>"; |
312 | 312 | } |
313 | 313 | echo "<option value='approve'>".planet_constant("AM_APPROVE")."</option>"; |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | echo "<div id='catdiv' style='visibility:hidden;display:inline;'>"; |
318 | 318 | echo "<select name='category_dest'>"; |
319 | 319 | echo "<option value=''>"._SELECT."</option>"; |
320 | - foreach($categories as $cid=>$name){ |
|
320 | + foreach ($categories as $cid=>$name) { |
|
321 | 321 | echo "<option value='".$cid."'>".$name."</option>"; |
322 | 322 | } |
323 | 323 | echo "</select>"; |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | echo "<input name='' value='"._CANCEL."' type='reset' />"; |
329 | 329 | echo "</td>"; |
330 | 330 | echo "</tr>"; |
331 | - if($blog_count>$xoopsModuleConfig["list_perpage"]){ |
|
331 | + if ($blog_count>$xoopsModuleConfig["list_perpage"]) { |
|
332 | 332 | include(XOOPS_ROOT_PATH."/class/pagenav.php"); |
333 | 333 | $nav = new XoopsPageNav($blog_count, $xoopsModuleConfig["list_perpage"], $start, "start", "category=".$category_id); |
334 | 334 | $pagenav = $nav->renderNav(4); |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | echo "</table></form>"; |
338 | 338 | echo "</fieldset><br style='clear:both;'>"; |
339 | 339 | |
340 | - if(empty($start) && empty($category_id)){ |
|
340 | + if (empty($start) && empty($category_id)) { |
|
341 | 341 | $form = new XoopsThemeForm(_ADD, "edit", xoops_getenv('PHP_SELF')); |
342 | 342 | $form->addElement(new XoopsFormText(planet_constant("AM_FEED"), 'blog_feed', 50, 255), true); |
343 | 343 | $form->addElement(new XoopsFormHidden('op', 'edit')); |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $button_tray->addElement($butt_cancel); |
359 | 359 | $form_add->addElement($button_tray); |
360 | 360 | |
361 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . "</legend>"; |
|
361 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._ADD."</legend>"; |
|
362 | 362 | echo"<br />"; |
363 | 363 | $form->display(); |
364 | 364 | $form_add->display(); |
@@ -18,7 +18,7 @@ |
||
18 | 18 | * @version $Id $ |
19 | 19 | */ |
20 | 20 | |
21 | -include_once dirname(__FILE__) . '/admin_header.php'; |
|
21 | +include_once dirname(__FILE__).'/admin_header.php'; |
|
22 | 22 | |
23 | 23 | xoops_cp_header(); |
24 | 24 |
@@ -31,10 +31,10 @@ |
||
31 | 31 | include_once(XOOPS_ROOT_PATH."/Frameworks/art/functions.admin.php"); |
32 | 32 | |
33 | 33 | // include the default language file for the admin interface |
34 | -if(!@include_once(XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/language/" . $xoopsConfig['language'] . "/main.php")){ |
|
34 | +if (!@include_once(XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/language/".$xoopsConfig['language']."/main.php")) { |
|
35 | 35 | include_once(XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/language/english/main.php"); |
36 | 36 | } |
37 | 37 | |
38 | 38 | planet_define_url_delimiter(); |
39 | -$myts =& MyTextSanitizer::getInstance(); |
|
39 | +$myts = & MyTextSanitizer::getInstance(); |
|
40 | 40 | ?> |
41 | 41 | \ No newline at end of file |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | // URL: http://xoops.org // |
25 | 25 | // Project: Article Project // |
26 | 26 | // ------------------------------------------------------------------------ // |
27 | -include( "admin_header.php" ); |
|
28 | -require_once(XOOPS_ROOT_PATH . "/class/xoopsformloader.php"); |
|
27 | +include("admin_header.php"); |
|
28 | +require_once(XOOPS_ROOT_PATH."/class/xoopsformloader.php"); |
|
29 | 29 | |
30 | 30 | xoops_cp_header(); |
31 | 31 | $indexAdmin = new ModuleAdmin(); |
@@ -33,19 +33,19 @@ discard block |
||
33 | 33 | require XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/include/vars.php"; |
34 | 34 | //planet_adminmenu(1); |
35 | 35 | |
36 | -$op = !empty($_POST["op"])?$_POST["op"]:(!empty($_GET["op"])?$_GET["op"]:""); |
|
37 | -$cat_id = !empty($_POST["category"])?$_POST["category"]:(!empty($_GET["category"])?$_GET["category"]:0); |
|
38 | -$cat_id = is_array($cat_id)?array_map("intval", $cat_id):intval($cat_id); |
|
36 | +$op = !empty($_POST["op"]) ? $_POST["op"] : (!empty($_GET["op"]) ? $_GET["op"] : ""); |
|
37 | +$cat_id = !empty($_POST["category"]) ? $_POST["category"] : (!empty($_GET["category"]) ? $_GET["category"] : 0); |
|
38 | +$cat_id = is_array($cat_id) ? array_map("intval", $cat_id) : intval($cat_id); |
|
39 | 39 | |
40 | -$category_handler =& xoops_getmodulehandler("category", $GLOBALS["moddirname"]); |
|
41 | -$blog_handler =& xoops_getmodulehandler("blog", $GLOBALS["moddirname"]); |
|
40 | +$category_handler = & xoops_getmodulehandler("category", $GLOBALS["moddirname"]); |
|
41 | +$blog_handler = & xoops_getmodulehandler("blog", $GLOBALS["moddirname"]); |
|
42 | 42 | |
43 | -switch($op){ |
|
43 | +switch ($op) { |
|
44 | 44 | case "save": |
45 | 45 | if ($cat_id) { |
46 | - $category_obj =& $category_handler->get($cat_id); |
|
47 | - } else { |
|
48 | - $category_obj =& $category_handler->create(); |
|
46 | + $category_obj = & $category_handler->get($cat_id); |
|
47 | + }else { |
|
48 | + $category_obj = & $category_handler->create(); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | $category_obj->setVar('cat_title', $_POST['cat_title']); |
@@ -53,16 +53,16 @@ discard block |
||
53 | 53 | |
54 | 54 | if (!$category_handler->insert($category_obj)) { |
55 | 55 | $message = planet_constant("AM_ERROR"); |
56 | - }else{ |
|
56 | + }else { |
|
57 | 57 | $message = planet_constant("AM_DBUPDATED"); |
58 | 58 | } |
59 | 59 | redirect_header("admin.category.php", 2, $message); |
60 | 60 | exit(); |
61 | 61 | |
62 | 62 | case "del": |
63 | - if(!is_array($cat_id)) $cat_id = array($cat_id); |
|
64 | - foreach($cat_id as $cid){ |
|
65 | - $category_obj =& $category_handler->get($cid); |
|
63 | + if (!is_array($cat_id)) $cat_id = array($cat_id); |
|
64 | + foreach ($cat_id as $cid) { |
|
65 | + $category_obj = & $category_handler->get($cid); |
|
66 | 66 | if (!$category_handler->delete($category_obj)) { |
67 | 67 | } |
68 | 68 | } |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | |
73 | 73 | case "order": |
74 | 74 | $count = count($_POST['cat_order']); |
75 | - for($i=0; $i < $count; $i++){ |
|
76 | - $category_obj =& $category_handler->get($_POST['cat'][$i]); |
|
75 | + for ($i = 0; $i<$count; $i++) { |
|
76 | + $category_obj = & $category_handler->get($_POST['cat'][$i]); |
|
77 | 77 | $category_obj->setVar("cat_order", $_POST['cat_order'][$i]); |
78 | 78 | $category_handler->insert($category_obj, true); |
79 | 79 | unset($category_obj); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | exit(); |
84 | 84 | |
85 | 85 | case "edit": |
86 | - $category_obj =& $category_handler->get($cat_id); |
|
86 | + $category_obj = & $category_handler->get($cat_id); |
|
87 | 87 | $form = new XoopsThemeForm(_EDIT, "edit", xoops_getenv('PHP_SELF')); |
88 | 88 | $form->addElement(new XoopsFormText(planet_constant("AM_TITLE"), 'cat_title', 50, 80, $category_obj->getVar('cat_title', 'E')), true); |
89 | 89 | $form->addElement(new XoopsFormText(planet_constant("AM_ORDER"), 'cat_order', 5, 10, $category_obj->getVar('cat_order')), false); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $button_tray->addElement($butt_cancel); |
98 | 98 | $form->addElement($button_tray); |
99 | 99 | |
100 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . "</legend>"; |
|
100 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._EDIT."</legend>"; |
|
101 | 101 | echo"<br />"; |
102 | 102 | $form->display(); |
103 | 103 | echo "</fieldset>"; |
@@ -109,36 +109,36 @@ discard block |
||
109 | 109 | $crit->setOrder("ASC"); |
110 | 110 | $categories = $category_handler->getList($crit); |
111 | 111 | $blog_counts = $blog_handler->getCountsByCategory(); |
112 | - foreach(array_keys($categories) as $cid){ |
|
113 | - if(!empty($blog_counts[$cid])){ |
|
112 | + foreach (array_keys($categories) as $cid) { |
|
113 | + if (!empty($blog_counts[$cid])) { |
|
114 | 114 | $categories[$cid] .= " (".intval($blog_counts[$cid]).")"; |
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant("AM_LIST") . "</legend>"; |
|
118 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>".planet_constant("AM_LIST")."</legend>"; |
|
119 | 119 | echo "<br style=\"clear:both\" />"; |
120 | 120 | |
121 | 121 | echo "<form name='list' method='post'>"; |
122 | 122 | echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
123 | 123 | echo "<tr align='center'>"; |
124 | - echo "<th class='bg3' width='5%'>" . planet_constant("AM_ORDER") . "</td>"; |
|
125 | - echo "<th align='left' class='bg3' width='80%'>" . planet_constant("AM_TITLE") . "</td>"; |
|
126 | - echo "<th class='bg3' width='5%'>" . planet_constant("AM_BLOGCOUNT") . "</td>"; |
|
127 | - echo "<th class='bg3' width='5%'>" . planet_constant("AM_ACTIONS") . "</td>"; |
|
124 | + echo "<th class='bg3' width='5%'>".planet_constant("AM_ORDER")."</td>"; |
|
125 | + echo "<th align='left' class='bg3' width='80%'>".planet_constant("AM_TITLE")."</td>"; |
|
126 | + echo "<th class='bg3' width='5%'>".planet_constant("AM_BLOGCOUNT")."</td>"; |
|
127 | + echo "<th class='bg3' width='5%'>".planet_constant("AM_ACTIONS")."</td>"; |
|
128 | 128 | // echo "<td class='bg3' width='5%'>" . _DELETE . "</td>"; |
129 | 129 | |
130 | 130 | echo "</tr>"; |
131 | 131 | |
132 | 132 | $ii = 0; |
133 | - foreach(array_keys($categories) as $cid){ |
|
133 | + foreach (array_keys($categories) as $cid) { |
|
134 | 134 | echo "<tr class='odd' align='left'>"; |
135 | 135 | echo "<td><input type='hidden' name='cat[]' value='".$cid."' />"; |
136 | 136 | echo "<input type='text' name='cat_order[]' value='".($ii*10)."' /></td>"; |
137 | 137 | echo "<td>".$categories[$cid]."</td>"; |
138 | 138 | echo "<td align='center'>".@$blog_counts[$cid]."</td>"; |
139 | 139 | |
140 | - echo "<td align='center'><a href='admin.category.php?op=edit &category='".$cid."' title='"._EDIT."'><img src='". $pathIcon16 ."/edit.png '". "alt='" . _EDIT . "' title='" ._EDIT."' </a> |
|
141 | - <a href='admin.category.php?op=del &category='".$cid."' title='"._DELETE."'><img src='". $pathIcon16 ."/delete.png '"." alt='" . _EDIT . "' title='"._DELETE."' </a></td>"; |
|
140 | + echo "<td align='center'><a href='admin.category.php?op=edit &category='".$cid."' title='"._EDIT."'><img src='".$pathIcon16."/edit.png '"."alt='"._EDIT."' title='"._EDIT."' </a> |
|
141 | + <a href='admin.category.php?op=del &category='".$cid."' title='"._DELETE."'><img src='".$pathIcon16."/delete.png '"." alt='"._EDIT."' title='"._DELETE."' </a></td>"; |
|
142 | 142 | echo "</tr>"; |
143 | 143 | $ii++; |
144 | 144 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $button_tray->addElement($butt_cancel); |
165 | 165 | $form->addElement($button_tray); |
166 | 166 | |
167 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . "</legend>"; |
|
167 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._ADD."</legend>"; |
|
168 | 168 | echo"<br />"; |
169 | 169 | $form->display(); |
170 | 170 | echo "</fieldset>"; |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | */ |
20 | 20 | |
21 | 21 | $path = dirname(dirname(dirname(dirname(__FILE__)))); |
22 | -include_once $path . '/mainfile.php'; |
|
23 | -include_once $path . '/include/cp_functions.php'; |
|
24 | -require_once $path . '/include/cp_header.php'; |
|
22 | +include_once $path.'/mainfile.php'; |
|
23 | +include_once $path.'/include/cp_functions.php'; |
|
24 | +require_once $path.'/include/cp_header.php'; |
|
25 | 25 | |
26 | 26 | global $xoopsModule; |
27 | 27 | |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | include_once(XOOPS_ROOT_PATH."/Frameworks/art/functions.admin.php"); |
48 | 48 | |
49 | 49 | // include the default language file for the admin interface |
50 | -if(!@include_once(XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/language/" . $xoopsConfig['language'] . "/main.php")){ |
|
50 | +if (!@include_once(XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/language/".$xoopsConfig['language']."/main.php")) { |
|
51 | 51 | include_once(XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/language/english/main.php"); |
52 | 52 | } |
53 | 53 | |
54 | 54 | planet_define_url_delimiter(); |
55 | -$myts =& MyTextSanitizer::getInstance(); |
|
55 | +$myts = & MyTextSanitizer::getInstance(); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | // URL: http://xoops.org // |
25 | 25 | // Project: Article Project // |
26 | 26 | // ------------------------------------------------------------------------ // |
27 | -include( "admin_header.php" ); |
|
27 | +include("admin_header.php"); |
|
28 | 28 | |
29 | 29 | xoops_cp_header(); |
30 | 30 | $indexAdmin = new ModuleAdmin(); |
@@ -39,29 +39,29 @@ discard block |
||
39 | 39 | require XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/include/vars.php"; |
40 | 40 | //planet_adminmenu(3); |
41 | 41 | |
42 | -$article_handler =& xoops_getmodulehandler("article", $GLOBALS["moddirname"]); |
|
43 | -if(!empty($xoopsModuleConfig["article_expire"])){ |
|
42 | +$article_handler = & xoops_getmodulehandler("article", $GLOBALS["moddirname"]); |
|
43 | +if (!empty($xoopsModuleConfig["article_expire"])) { |
|
44 | 44 | $criteria = new Criteria("art_time", time()-$xoopsModuleConfig["article_expire"]*60*60*24, "<"); |
45 | - if(!empty($_GET["purge"])){ |
|
45 | + if (!empty($_GET["purge"])) { |
|
46 | 46 | $crit = new CriteriaCompo($criteria); |
47 | 47 | $crit->add(new Criteria("art_comments", 0)); |
48 | - $article_expires =& $article_handler->getObjects($criteria); |
|
49 | - foreach($article_expires as $id=>$article_obj){ |
|
48 | + $article_expires = & $article_handler->getObjects($criteria); |
|
49 | + foreach ($article_expires as $id=>$article_obj) { |
|
50 | 50 | $article_handler->delete($article_obj); |
51 | 51 | } |
52 | 52 | } |
53 | 53 | $article_count_expire = $article_handler->getCount($criteria); |
54 | -}else{ |
|
54 | +}else { |
|
55 | 55 | $article_count_expire = 0; |
56 | 56 | } |
57 | 57 | $article_count = $article_handler->getCount(); |
58 | 58 | |
59 | -echo "<fieldset><legend style=\"font-weight: bold; color: #900;\">" . planet_constant("AM_ARTICLES") . "</legend>"; |
|
59 | +echo "<fieldset><legend style=\"font-weight: bold; color: #900;\">".planet_constant("AM_ARTICLES")."</legend>"; |
|
60 | 60 | echo "<div style=\"padding: 8px;\">"; |
61 | -echo "<br clear=\"all\" />" . planet_constant("AM_COUNT").": ". $article_count; |
|
61 | +echo "<br clear=\"all\" />".planet_constant("AM_COUNT").": ".$article_count; |
|
62 | 62 | echo "<br clear=\"all\" />"; |
63 | -if($article_count_expire>0){ |
|
64 | - echo "<br clear=\"all\" /><a href=\"".XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/admin/admin.article.php?purge=1\" >" . planet_constant("AM_EXPIRED").": ".$article_count_expire."</a>"; |
|
63 | +if ($article_count_expire>0) { |
|
64 | + echo "<br clear=\"all\" /><a href=\"".XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/admin/admin.article.php?purge=1\" >".planet_constant("AM_EXPIRED").": ".$article_count_expire."</a>"; |
|
65 | 65 | echo "<br clear=\"all\" />"; |
66 | 66 | } |
67 | 67 | echo "</div>"; |
@@ -27,58 +27,58 @@ discard block |
||
27 | 27 | |
28 | 28 | include 'header.php'; |
29 | 29 | |
30 | -$rate = intval( !empty($_POST["rate"])?$_POST["rate"]:(!empty($_GET["rate"])?$_GET["rate"]:0) ); |
|
31 | -$article_id = intval( !empty($_POST["article"])?$_POST["article"]:(!empty($_GET["article"])?$_GET["article"]:0) ); |
|
32 | -$blog_id = intval( !empty($_POST["blog"])?$_POST["blog"]:(!empty($_GET["blog"])?$_GET["blog"]:0) ); |
|
30 | +$rate = intval(!empty($_POST["rate"]) ? $_POST["rate"] : (!empty($_GET["rate"]) ? $_GET["rate"] : 0)); |
|
31 | +$article_id = intval(!empty($_POST["article"]) ? $_POST["article"] : (!empty($_GET["article"]) ? $_GET["article"] : 0)); |
|
32 | +$blog_id = intval(!empty($_POST["blog"]) ? $_POST["blog"] : (!empty($_GET["blog"]) ? $_GET["blog"] : 0)); |
|
33 | 33 | |
34 | -if(empty($article_id) && empty($blog_id)){ |
|
34 | +if (empty($article_id) && empty($blog_id)) { |
|
35 | 35 | redirect_header("javascript:history.go(-1);", 1, planet_constant("MD_INVALID")); |
36 | 36 | exit(); |
37 | 37 | } |
38 | 38 | |
39 | -$article_handler =& xoops_getmodulehandler("article", $GLOBALS["moddirname"]); |
|
40 | -$blog_handler =& xoops_getmodulehandler("blog", $GLOBALS["moddirname"]); |
|
41 | -if(empty($xoopsModuleConfig["anonymous_rate"]) && !is_object($xoopsUser)){ |
|
39 | +$article_handler = & xoops_getmodulehandler("article", $GLOBALS["moddirname"]); |
|
40 | +$blog_handler = & xoops_getmodulehandler("blog", $GLOBALS["moddirname"]); |
|
41 | +if (empty($xoopsModuleConfig["anonymous_rate"]) && !is_object($xoopsUser)) { |
|
42 | 42 | $message = planet_constant("MD_NOACCESS"); |
43 | -}else{ |
|
44 | - $uid = (is_object($xoopsUser))?$xoopsUser->getVar("uid"):0; |
|
43 | +}else { |
|
44 | + $uid = (is_object($xoopsUser)) ? $xoopsUser->getVar("uid") : 0; |
|
45 | 45 | $ip = planet_getIP(); |
46 | - if($article_id>0){ |
|
46 | + if ($article_id>0) { |
|
47 | 47 | $criteria = new CriteriaCompo(new Criteria("art_id", $article_id)); |
48 | - }else{ |
|
48 | + }else { |
|
49 | 49 | $criteria = new CriteriaCompo(new Criteria("blog_id", $blog_id)); |
50 | 50 | } |
51 | - if($uid>0){ |
|
51 | + if ($uid>0) { |
|
52 | 52 | $criteria->add(new Criteria("rate_uid", $uid)); |
53 | - }else{ |
|
53 | + }else { |
|
54 | 54 | $criteria->add(new Criteria("rate_ip", $ip)); |
55 | 55 | $criteria->add(new Criteria("rate_time", time()-24*3600, ">")); |
56 | 56 | } |
57 | - $rate_handler =& xoops_getmodulehandler("rate", $GLOBALS["moddirname"]); |
|
58 | - if($count=$rate_handler->getCount($criteria)){ |
|
57 | + $rate_handler = & xoops_getmodulehandler("rate", $GLOBALS["moddirname"]); |
|
58 | + if ($count = $rate_handler->getCount($criteria)) { |
|
59 | 59 | $message = planet_constant("MD_ALREADYRATED"); |
60 | - }else{ |
|
61 | - $rate_obj =& $rate_handler->create(); |
|
62 | - if($article_id>0){ |
|
60 | + }else { |
|
61 | + $rate_obj = & $rate_handler->create(); |
|
62 | + if ($article_id>0) { |
|
63 | 63 | $rate_obj->setVar("art_id", $article_id); |
64 | - }else{ |
|
64 | + }else { |
|
65 | 65 | $rate_obj->setVar("blog_id", $blog_id); |
66 | 66 | } |
67 | 67 | $rate_obj->setVar("rate_uid", $uid); |
68 | 68 | $rate_obj->setVar("rate_ip", $ip); |
69 | 69 | $rate_obj->setVar("rate_rating", $rate); |
70 | 70 | $rate_obj->setVar("rate_time", time()); |
71 | - if(!$rate_id = $rate_handler->insert($rate_obj, true)){ |
|
71 | + if (!$rate_id = $rate_handler->insert($rate_obj, true)) { |
|
72 | 72 | redirect_header("javascript:history.go(-1);", 1, planet_constant("MD_NOTSAVED")); |
73 | 73 | exit(); |
74 | 74 | } |
75 | - if($article_id>0){ |
|
76 | - $article_obj =& $article_handler->get($article_id); |
|
75 | + if ($article_id>0) { |
|
76 | + $article_obj = & $article_handler->get($article_id); |
|
77 | 77 | $article_obj->setVar("art_rating", $article_obj->getVar("art_rating")+$rate); |
78 | 78 | $article_obj->setVar("art_rates", $article_obj->getVar("art_rates")+1); |
79 | 79 | $article_handler->insert($article_obj, true); |
80 | - }else{ |
|
81 | - $blog_obj =& $blog_handler->get($blog_id); |
|
80 | + }else { |
|
81 | + $blog_obj = & $blog_handler->get($blog_id); |
|
82 | 82 | $blog_obj->setVar("blog_rating", $blog_obj->getVar("blog_rating")+$rate); |
83 | 83 | $blog_obj->setVar("blog_rates", $blog_obj->getVar("blog_rates")+1); |
84 | 84 | $blog_handler->insert($blog_obj, true); |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | $message = planet_constant("MD_ACTIONDONE"); |
87 | 87 | } |
88 | 88 | } |
89 | -if($article_id>0){ |
|
89 | +if ($article_id>0) { |
|
90 | 90 | redirect_header(XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/view.article.php".URL_DELIMITER."".$article_id, 2, $message); |
91 | -}else{ |
|
91 | +}else { |
|
92 | 92 | redirect_header(XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/index.php".URL_DELIMITER."b".$blog_id, 2, $message); |
93 | 93 | } |
94 | 94 | include 'footer.php'; |
@@ -27,56 +27,56 @@ |
||
27 | 27 | |
28 | 28 | include "header.php"; |
29 | 29 | |
30 | -$art_id = intval( isset($_GET["article"]) ? $_GET["article"] : (isset($_POST["article"]) ? $_POST["article"]: 0) ); |
|
31 | -if(empty($art_id)){ |
|
30 | +$art_id = intval(isset($_GET["article"]) ? $_GET["article"] : (isset($_POST["article"]) ? $_POST["article"] : 0)); |
|
31 | +if (empty($art_id)) { |
|
32 | 32 | redirect_header("javascript:history.go(-1);", 1, planet_constant("MD_INVALID")); |
33 | 33 | exit(); |
34 | 34 | } |
35 | -if (!$xoopsUser->isAdmin()){ |
|
35 | +if (!$xoopsUser->isAdmin()) { |
|
36 | 36 | redirect_header("javascript:history.go(-1);", 2, _NOPERM); |
37 | 37 | exit(); |
38 | 38 | } |
39 | 39 | include XOOPS_ROOT_PATH."/header.php"; |
40 | 40 | include XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/include/vars.php"; |
41 | 41 | |
42 | -$article_handler =& xoops_getmodulehandler("article", $GLOBALS["moddirname"]); |
|
42 | +$article_handler = & xoops_getmodulehandler("article", $GLOBALS["moddirname"]); |
|
43 | 43 | $article_obj = $article_handler->get($art_id); |
44 | 44 | |
45 | 45 | $op = isset($_POST["op"]) ? $_POST["op"] : ""; |
46 | 46 | |
47 | -if ( $op == "del" || !empty($_POST["del"])) { |
|
47 | +if ($op == "del" || !empty($_POST["del"])) { |
|
48 | 48 | $article_handler->delete($article_obj); |
49 | 49 | $redirect = XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/index.php"; |
50 | 50 | $message = planet_constant("MD_SAVED"); |
51 | - redirect_header($redirect,2,$message); |
|
52 | -}elseif ( $op == "save" ) { |
|
51 | + redirect_header($redirect, 2, $message); |
|
52 | +}elseif ($op == "save") { |
|
53 | 53 | |
54 | - if(empty($_POST["art_content"])){ |
|
54 | + if (empty($_POST["art_content"])) { |
|
55 | 55 | redirect_header("javascript:history.go(-1);", 1, planet_constant("MD_TEXTEMPTY")); |
56 | 56 | exit(); |
57 | 57 | } |
58 | 58 | |
59 | - foreach(array( |
|
59 | + foreach (array( |
|
60 | 60 | "art_title", |
61 | 61 | "art_link", |
62 | 62 | "art_author", |
63 | 63 | "art_content" |
64 | - ) as $tag){ |
|
65 | - if(@$_POST[$tag] != $article_obj->getVar($tag)) |
|
64 | + ) as $tag) { |
|
65 | + if (@$_POST[$tag] != $article_obj->getVar($tag)) |
|
66 | 66 | $article_obj->setVar($tag, @$_POST[$tag]); |
67 | 67 | } |
68 | 68 | |
69 | 69 | $art_id_new = $article_handler->insert($article_obj); |
70 | - if(!$article_obj->getVar("art_id")){ |
|
70 | + if (!$article_obj->getVar("art_id")) { |
|
71 | 71 | $redirect = XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/index.php"; |
72 | 72 | $message = planet_constant("MD_INSERTERROR"); |
73 | - }else{ |
|
73 | + }else { |
|
74 | 74 | $redirect = XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/view.article.php".URL_DELIMITER."".$article_obj->getVar("art_id"); |
75 | 75 | $message = planet_constant("MD_SAVED"); |
76 | 76 | } |
77 | - redirect_header($redirect,2,$message); |
|
78 | -}else{ |
|
79 | - require_once(XOOPS_ROOT_PATH . "/class/xoopsformloader.php"); |
|
77 | + redirect_header($redirect, 2, $message); |
|
78 | +}else { |
|
79 | + require_once(XOOPS_ROOT_PATH."/class/xoopsformloader.php"); |
|
80 | 80 | |
81 | 81 | $form = new XoopsThemeForm(_EDIT, "formarticle", xoops_getenv('PHP_SELF')); |
82 | 82 |