| 1 | <?php |
|---|
| 2 | // $Id: index.php,v 1.4 2005/08/03 12:40:01 onokazu Exp $ |
|---|
| 3 | // ------------------------------------------------------------------------ // |
|---|
| 4 | // XOOPS - PHP Content Management System // |
|---|
| 5 | // Copyright (c) 2000 XOOPS.org // |
|---|
| 6 | // <http://www.xoops.org/> // |
|---|
| 7 | // ------------------------------------------------------------------------ // |
|---|
| 8 | // This program is free software; you can redistribute it and/or modify // |
|---|
| 9 | // it under the terms of the GNU General Public License as published by // |
|---|
| 10 | // the Free Software Foundation; either version 2 of the License, or // |
|---|
| 11 | // (at your option) any later version. // |
|---|
| 12 | // // |
|---|
| 13 | // You may not change or alter any portion of this comment or credits // |
|---|
| 14 | // of supporting developers from this source code or any supporting // |
|---|
| 15 | // source code which is considered copyrighted (c) material of the // |
|---|
| 16 | // original comment or credit authors. // |
|---|
| 17 | // // |
|---|
| 18 | // This program is distributed in the hope that it will be useful, // |
|---|
| 19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|---|
| 20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|---|
| 21 | // GNU General Public License for more details. // |
|---|
| 22 | // // |
|---|
| 23 | // You should have received a copy of the GNU General Public License // |
|---|
| 24 | // along with this program; if not, write to the Free Software // |
|---|
| 25 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
|---|
| 26 | // ------------------------------------------------------------------------ // |
|---|
| 27 | |
|---|
| 28 | include '../../../include/cp_header.php'; |
|---|
| 29 | if ( file_exists("../language/".$xoopsConfig['language']."/main.php") ) { |
|---|
| 30 | include "../language/".$xoopsConfig['language']."/main.php"; |
|---|
| 31 | } else { |
|---|
| 32 | include "../language/english/main.php"; |
|---|
| 33 | } |
|---|
| 34 | $op = "listcat"; |
|---|
| 35 | |
|---|
| 36 | if (!empty($_GET['op'])) { |
|---|
| 37 | $cat_id = !empty($_GET['cat_id']) ? intval($_GET['cat_id']) : 0; |
|---|
| 38 | $op = $_GET['op']; |
|---|
| 39 | } elseif (!empty($_POST['op'])) { |
|---|
| 40 | $op = $_POST['op']; |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | if ( !empty($_POST['contents_preview']) ) { |
|---|
| 44 | $myts =& MyTextSanitizer::getInstance(); |
|---|
| 45 | xoops_cp_header(); |
|---|
| 46 | |
|---|
| 47 | $contents_nohtml = !empty($_POST['contents_nohtml']) ? 1 : 0; |
|---|
| 48 | $contents_nosmiley = !empty($_POST['contents_nosmiley']) ? 1 : 0; |
|---|
| 49 | $contents_noxcode = !empty($_POST['contents_noxcode']) ? 1 : 0; |
|---|
| 50 | $html = empty($contents_nohtml) ? 1 : 0; |
|---|
| 51 | $smiley = empty($contents_nosmiley) ? 1 : 0; |
|---|
| 52 | $xcode = empty($contents_noxcode) ? 1 : 0; |
|---|
| 53 | $contents_visible = !empty($_POST['contents_visible']) ? 1 : 0; |
|---|
| 54 | $contents_order = !empty($_POST['contents_order']) ? intval($_POST['contents_order']) : 0; |
|---|
| 55 | $contents_id = !empty($_POST['contents_id']) ? intval($_POST['contents_id']) : 0; |
|---|
| 56 | $category_id = !empty($_POST['category_id']) ? intval($_POST['category_id']) : 0; |
|---|
| 57 | $p_title = $myts->makeTboxData4Preview($_POST['contents_title']); |
|---|
| 58 | $p_contents = $myts->makeTareaData4Preview($_POST['contents_contents'], $contents_nohtml, $contents_nosmiley, $contents_noxcode); |
|---|
| 59 | echo"<table border='0' cellpadding='0' cellspacing='0' width='100%'><tr><td class='bg2'> |
|---|
| 60 | <table width='100%' border='0' cellpadding='4' cellspacing='1'> |
|---|
| 61 | <tr class='bg3' align='center'><td align='left'>$p_title</td></tr><tr class='bg1'><td>$p_contents</td></tr></table></td></tr></table><br />"; |
|---|
| 62 | $contents_title = $myts->makeTboxData4PreviewInForm($_POST['contents_title']); |
|---|
| 63 | $contents_contents = $myts->makeTareaData4PreviewInForm($_POST['contents_contents']); |
|---|
| 64 | include "contentsform.php"; |
|---|
| 65 | |
|---|
| 66 | xoops_cp_footer(); |
|---|
| 67 | exit(); |
|---|
| 68 | } |
|---|
| 69 | |
|---|
| 70 | if ($op == "listcat") { |
|---|
| 71 | $myts =& MyTextSanitizer::getInstance(); |
|---|
| 72 | xoops_cp_header(); |
|---|
| 73 | |
|---|
| 74 | echo " |
|---|
| 75 | <h4 style='text-align:left;'>"._XD_DOCS."</h4> |
|---|
| 76 | <form action='index.php' method='post'> |
|---|
| 77 | <table border='0' cellpadding='0' cellspacing='0' width='100%'><tr><td class='bg2'> |
|---|
| 78 | <table width='100%' border='0' cellpadding='4' cellspacing='1'> |
|---|
| 79 | <tr class='bg3' align='center'><td align='left'>"._XD_CATEGORY."</td><td>"._XD_ORDER."</td><td>"._XD_CONTENTS."</td><td> </td></tr>"; |
|---|
| 80 | $result = $xoopsDB->query("SELECT c.category_id, c.category_title, c.category_order, COUNT(f.category_id) FROM ".$xoopsDB->prefix("xoopsfaq_categories")." c LEFT JOIN ".$xoopsDB->prefix("xoopsfaq_contents")." f ON f.category_id=c.category_id GROUP BY c.category_id ORDER BY c.category_order ASC"); |
|---|
| 81 | $count = 0; |
|---|
| 82 | while ( list($cat_id, $category, $category_order, $faq_count) = $xoopsDB->fetchRow($result) ) { |
|---|
| 83 | $category=$myts->makeTboxData4Edit($category); |
|---|
| 84 | echo "<tr class='bg1'><td align='left'><input type='hidden' value='$cat_id' name='cat_id[]' /><input type='hidden' value='$category' name='oldcategory[]' /><input type='text' value='$category' name='newcategory[]' maxlength='255' size='20' /></td> |
|---|
| 85 | <td align='center'><input type='hidden' value='$category_order' name='oldorder[]' /><input type='text' value='$category_order' name='neworder[]' maxlength='3' size='4' /></td> |
|---|
| 86 | <td align='center'>$faq_count</td> |
|---|
| 87 | <td align='right'><a href='index.php?op=listcontents&cat_id=".$cat_id."'>" ._XD_CONTENTS."</a> | <a href='index.php?op=delcat&cat_id=".$cat_id."&ok=0'>"._DELETE."</a></td></tr>"; |
|---|
| 88 | $count++; |
|---|
| 89 | } |
|---|
| 90 | if ($count > 0) { |
|---|
| 91 | echo "<tr align='center' class='bg3'><td colspan='4'><input type='submit' value='"._SUBMIT."' /><input type='hidden' name='op' value='editcatgo' /></td></tr>"; |
|---|
| 92 | } |
|---|
| 93 | echo "</table></td></tr></table></form> |
|---|
| 94 | <br /><br /> |
|---|
| 95 | <h4 style='text-align:left;'>"._XD_ADDCAT."</h4> |
|---|
| 96 | <form action='index.php' method='post'> |
|---|
| 97 | <table border='0' cellpadding='0' cellspacing='0' width='100%'><tr><td class='bg2'><table width='100%' border='0' cellpadding='4' cellspacing='1'><tr nowrap='nowrap'><td class='bg3'>"._XD_TITLE." </td><td class='bg1'><input type='text' name='category' size='30' maxlength='255' /></td></tr> |
|---|
| 98 | <tr nowrap='nowrap'><td class='bg3'>"._XD_ORDER." </td><td class='bg1'><input type='text' name='order' size='4' maxlength='3' /></td></tr> |
|---|
| 99 | <tr><td class='bg3'> </td><td class='bg1'><input type='hidden' name='op' value='addcatgo' /><input type='submit' value='"._SUBMIT."' /></td></tr> |
|---|
| 100 | </table></td></tr></table></form>"; |
|---|
| 101 | |
|---|
| 102 | xoops_cp_footer(); |
|---|
| 103 | exit(); |
|---|
| 104 | } |
|---|
| 105 | |
|---|
| 106 | if ($op == "addcatgo") { |
|---|
| 107 | $myts =& MyTextSanitizer::getInstance(); |
|---|
| 108 | $category = $myts->stripSlashesGPC($_POST['category']); |
|---|
| 109 | $newid = $xoopsDB->genId($xoopsDB->prefix("xoopsfaq_categories")."_category_id_seq"); |
|---|
| 110 | $sql = "INSERT INTO ".$xoopsDB->prefix("xoopsfaq_categories")." (category_id, category_title, category_order) VALUES ($newid, ".$xoopsDB->quoteString($category).", ".intval($_POST['order']).")"; |
|---|
| 111 | if (!$xoopsDB->query($sql)) { |
|---|
| 112 | xoops_cp_header(); |
|---|
| 113 | echo "Could not add category"; |
|---|
| 114 | xoops_cp_footer(); |
|---|
| 115 | } else { |
|---|
| 116 | redirect_header("index.php?op=listcat",1,_XD_DBSUCCESS); |
|---|
| 117 | } |
|---|
| 118 | exit(); |
|---|
| 119 | } |
|---|
| 120 | |
|---|
| 121 | if ($op == "editcatgo") { |
|---|
| 122 | $myts =& MyTextSanitizer::getInstance(); |
|---|
| 123 | $count = count($_POST['newcategory']); |
|---|
| 124 | for ($i = 0; $i < $count; $i++) { |
|---|
| 125 | if ( $_POST['newcategory'][$i] != $_POST['oldcategory'][$i] || $_POST['neworder'][$i] != $_POST['oldorder'][$i] ) { |
|---|
| 126 | $category = $myts->stripSlashesGPC($_POST['newcategory'][$i]); |
|---|
| 127 | $sql = "UPDATE ".$xoopsDB->prefix("xoopsfaq_categories")." SET category_title=".$xoopsDB->quoteString($category).", category_order=".intval($_POST['neworder'][$i])." WHERE category_id=".intval($_POST['cat_id'][$i]); |
|---|
| 128 | $xoopsDB->query($sql); |
|---|
| 129 | } |
|---|
| 130 | } |
|---|
| 131 | redirect_header("index.php?op=listcat",1,_XD_DBSUCCESS); |
|---|
| 132 | exit(); |
|---|
| 133 | } |
|---|
| 134 | |
|---|
| 135 | if ($op == "listcontents") { |
|---|
| 136 | $myts =& MyTextSanitizer::getInstance(); |
|---|
| 137 | xoops_cp_header(); |
|---|
| 138 | $sql = "SELECT category_title FROM ".$xoopsDB->prefix("xoopsfaq_categories")." WHERE category_id=".$cat_id; |
|---|
| 139 | $result = $xoopsDB->query($sql); |
|---|
| 140 | list($category) = $xoopsDB->fetchRow($result); |
|---|
| 141 | $category = $myts->makeTboxData4Show($category); |
|---|
| 142 | |
|---|
| 143 | echo "<a href='index.php'>" ._XD_MAIN."</a> <span style='font-weight:bold;'>»»</span> ".$category."<br /><br /> |
|---|
| 144 | <h4 style='text-align:left;'>"._XD_CONTENTS."</h4> |
|---|
| 145 | <form action='index.php' method='post'> |
|---|
| 146 | <table border='0' cellpadding='0' cellspacing='0' width='100%'><tr><td class='bg2'> |
|---|
| 147 | <table width='100%' border='0' cellpadding='4' cellspacing='1'> |
|---|
| 148 | <tr class='bg3'><td>"._XD_TITLE."</td><td align='center'>"._XD_ORDER."</td><td align='center'>"._XD_DISPLAY."</td><td> </td></tr>"; |
|---|
| 149 | $result = $xoopsDB->query("SELECT contents_id, contents_title, contents_time, contents_order, contents_visible FROM ".$xoopsDB->prefix("xoopsfaq_contents")." WHERE category_id=".$cat_id." ORDER BY contents_order"); |
|---|
| 150 | $count = 0; |
|---|
| 151 | while(list($id, $title, $time, $order, $visible) = $xoopsDB->fetchRow($result)) { |
|---|
| 152 | $title = $myts->makeTboxData4Show($title); |
|---|
| 153 | echo "<tr class='bg1'><td><input type='hidden' value='$id' name='id[]' />".$title."</td> |
|---|
| 154 | <td align='center'><input type='hidden' value='$order' name='oldorder[$id]' /><input type='text' value='$order' name='neworder[$id]' maxlength='3' size='4' /></td>"; |
|---|
| 155 | $checked = ($visible == 1) ? " checked='checked'" : ""; |
|---|
| 156 | echo "<td align='center'><input type='hidden' value='$visible' name='oldvisible[$id]' /><input type='checkbox' value='1' name='newvisible[$id]'".$checked." /></td> |
|---|
| 157 | <td align='right'><a href='index.php?op=editcontents&id=".$id."&cat_id=".$cat_id."'>"._EDIT."</a> | <a href='index.php?op=delcontents&id=".$id."&ok=0&cat_id=".$cat_id."'>"._DELETE."</a></td></tr>"; |
|---|
| 158 | $count++; |
|---|
| 159 | } |
|---|
| 160 | if ($count > 0) { |
|---|
| 161 | echo "<tr align='center' class='bg3'><td colspan='4'><input type='submit' value='"._SUBMIT."' /><input type='hidden' name='op' value='quickeditcontents' /><input type='hidden' name='cat_id' value='".$cat_id."' /></td></tr>"; |
|---|
| 162 | } |
|---|
| 163 | echo "</table></td></tr></table></form> |
|---|
| 164 | <br /><br /> |
|---|
| 165 | <h4 style='text-align:left;'>"._XD_ADDCONTENTS."</h4>"; |
|---|
| 166 | $contents_title = ""; |
|---|
| 167 | $contents_contents = ""; |
|---|
| 168 | $contents_order = 0; |
|---|
| 169 | $contents_visible = 1; |
|---|
| 170 | $contents_nohtml = 0; |
|---|
| 171 | $contents_nosmiley = 0; |
|---|
| 172 | $contents_noxcode = 0; |
|---|
| 173 | $contents_id = 0; |
|---|
| 174 | $category_id = $cat_id; |
|---|
| 175 | $op = "addcontentsgo"; |
|---|
| 176 | include "contentsform.php"; |
|---|
| 177 | |
|---|
| 178 | xoops_cp_footer(); |
|---|
| 179 | exit(); |
|---|
| 180 | } |
|---|
| 181 | |
|---|
| 182 | if ($op == "quickeditcontents") { |
|---|
| 183 | $myts =& MyTextSanitizer::getInstance(); |
|---|
| 184 | $cat_id = !empty($_POST['cat_id']) ? intval($_POST['cat_id']) : 0; |
|---|
| 185 | $count = count($_POST['id']); |
|---|
| 186 | for ($i = 0; $i < $count; $i++) { |
|---|
| 187 | $index = intval($_POST['id'][$i]); |
|---|
| 188 | if ( $_POST['neworder'][$index] != $_POST['oldorder'][$index] || $_POST['newvisible'][$index] != $_POST['oldvisible'][$index] ) { |
|---|
| 189 | $xoopsDB->query("UPDATE ".$xoopsDB->prefix("xoopsfaq_contents")." SET contents_order=".intval($_POST['neworder'][$index]).", contents_visible=".intval($_POST['newvisible'][$index])." WHERE contents_id=".$index); |
|---|
| 190 | } |
|---|
| 191 | } |
|---|
| 192 | redirect_header("index.php?op=listcontents&cat_id=$cat_id",1,_XD_DBSUCCESS); |
|---|
| 193 | exit(); |
|---|
| 194 | } |
|---|
| 195 | |
|---|
| 196 | if ($op == "addcontentsgo") { |
|---|
| 197 | $category_id = !empty($_POST['category_id']) ? intval($_POST['category_id']) : 0; |
|---|
| 198 | if ($category_id > 0) { |
|---|
| 199 | $contents_nohtml = !empty($_POST['contents_nohtml']) ? 1 : 0; |
|---|
| 200 | $contents_nosmiley = !empty($_POST['contents_nosmiley']) ? 1 : 0; |
|---|
| 201 | $contents_noxcode = !empty($_POST['contents_noxcode']) ? 1 : 0; |
|---|
| 202 | $contents_visible = !empty($_POST['contents_visible']) ? 1 : 0; |
|---|
| 203 | $contents_order = !empty($_POST['contents_order']) ? intval($_POST['contents_order']) : 0; |
|---|
| 204 | $myts =& MyTextSanitizer::getInstance(); |
|---|
| 205 | $title = $myts->stripSlashesGPC($_POST['contents_title']); |
|---|
| 206 | $contents = $myts->makeTareaData4Save($_POST['contents_contents']); |
|---|
| 207 | $newid = $xoopsDB->genId($xoopsDB->prefix("xoopsfaq_contents")."_contents_id_seq"); |
|---|
| 208 | $sql = "INSERT INTO ".$xoopsDB->prefix("xoopsfaq_contents")." (contents_id, category_id, contents_title, contents_contents, contents_time, contents_order, contents_visible, contents_nohtml, contents_nosmiley, contents_noxcode) VALUES ($newid, $category_id, ".$xoopsDB->quoteString($title).", ".$xoopsDB->quoteString($contents).", ".time().", ".$contents_order.", ".$contents_visible.", ".$contents_nohtml.", ".$contents_nosmiley.", ".$contents_noxcode.")"; |
|---|
| 209 | if (!$xoopsDB->query($sql)) { |
|---|
| 210 | xoops_cp_header(); |
|---|
| 211 | echo "Could not add contents"; |
|---|
| 212 | xoops_cp_footer(); |
|---|
| 213 | } else { |
|---|
| 214 | redirect_header("index.php?op=listcontents&cat_id=$category_id",1,_XD_DBSUCCESS); |
|---|
| 215 | } |
|---|
| 216 | } |
|---|
| 217 | exit(); |
|---|
| 218 | } |
|---|
| 219 | |
|---|
| 220 | if ($op == "editcontents") { |
|---|
| 221 | $id = !empty($_GET['id']) ? intval($_GET['id']) : 0; |
|---|
| 222 | if ($id <= 0 || $cat_id <= 0) { |
|---|
| 223 | exit(); |
|---|
| 224 | } |
|---|
| 225 | $myts =& MyTextSanitizer::getInstance(); |
|---|
| 226 | xoops_cp_header(); |
|---|
| 227 | $sql = "SELECT category_title FROM ".$xoopsDB->prefix("xoopsfaq_categories")." WHERE category_id=".$cat_id; |
|---|
| 228 | $result = $xoopsDB->query($sql); |
|---|
| 229 | list($category) = $xoopsDB->fetchRow($result); |
|---|
| 230 | $category = $myts->makeTboxData4Show($category); |
|---|
| 231 | $result = $xoopsDB->query("SELECT * FROM ".$xoopsDB->prefix("xoopsfaq_contents")." WHERE contents_id=$id"); |
|---|
| 232 | $myrow = $xoopsDB->fetchArray($result); |
|---|
| 233 | $contents_title = $myts->makeTboxData4Edit($myrow['contents_title']); |
|---|
| 234 | $contents_contents = $myts->makeTareaData4Edit($myrow['contents_contents']); |
|---|
| 235 | $contents_order = $myrow['contents_order']; |
|---|
| 236 | $contents_visible = $myrow['contents_visible']; |
|---|
| 237 | $contents_nohtml = $myrow['contents_nohtml']; |
|---|
| 238 | $contents_nosmiley = $myrow['contents_nosmiley']; |
|---|
| 239 | $contents_noxcode = $myrow['contents_noxcode']; |
|---|
| 240 | $contents_id = $myrow['contents_id']; |
|---|
| 241 | $category_id = $myrow['category_id']; |
|---|
| 242 | $op = "editcontentsgo"; |
|---|
| 243 | |
|---|
| 244 | echo "<a href='index.php'>" ._XD_MAIN."</a> <span style='font-weight:bold;'>»»</span> <a href='index.php?op=listcontents&cat_id=$cat_id'>".$category."</a> <span style='font-weight:bold;'>»»</span> "._XD_EDITCONTENTS."<br /><br /> |
|---|
| 245 | <h4 style='text-align:left;'>"._XD_EDITCONTENTS."</h4>"; |
|---|
| 246 | include "contentsform.php"; |
|---|
| 247 | |
|---|
| 248 | xoops_cp_footer(); |
|---|
| 249 | exit(); |
|---|
| 250 | } |
|---|
| 251 | |
|---|
| 252 | if ($op == "editcontentsgo") { |
|---|
| 253 | $contents_id = !empty($_POST['contents_id']) ? intval($_POST['contents_id']) : 0; |
|---|
| 254 | $myts =& MyTextSanitizer::getInstance(); |
|---|
| 255 | $title = !empty($_POST['contents_title']) ? $myts->stripSlashesGPC($_POST['contents_title']) : ''; |
|---|
| 256 | $contents = !empty($_POST['contents_contents']) ? $myts->stripSlashesGPC($_POST['contents_contents']) : ''; |
|---|
| 257 | $contents_nohtml = empty($_POST['contents_nohtml']) ? 0 : 1; |
|---|
| 258 | $contents_nosmiley = empty($_POST['contents_nosmiley']) ? 0 : 1; |
|---|
| 259 | $contents_noxcode = empty($_POST['contents_noxcode']) ? 0 : 1; |
|---|
| 260 | $contents_visible = !empty($_POST['contents_visible']) ? 1 : 0; |
|---|
| 261 | $contents_order = !empty($_POST['contents_order']) ? intval($_POST['contents_order']) : 0; |
|---|
| 262 | $sql = "UPDATE ".$xoopsDB->prefix("xoopsfaq_contents")." set contents_title=".$xoopsDB->quoteSTring($title).", contents_contents=".$xoopsDB->quoteSTring($contents).", contents_time=".time().", contents_order=".$contents_order.", contents_visible=".$contents_visible.", contents_nohtml=".$contents_nohtml.", contents_nosmiley=".$contents_nosmiley.", contents_noxcode=".$contents_noxcode." WHERE contents_id=".$contents_id; |
|---|
| 263 | if (!$xoopsDB->query($sql)) { |
|---|
| 264 | xoops_cp_header(); |
|---|
| 265 | echo "Could not update contents"; |
|---|
| 266 | xoops_cp_footer(); |
|---|
| 267 | } else { |
|---|
| 268 | redirect_header("index.php?op=listcontents&cat_id=".intval($_POST['category_id']),1,_XD_DBSUCCESS); |
|---|
| 269 | } |
|---|
| 270 | exit(); |
|---|
| 271 | } |
|---|
| 272 | |
|---|
| 273 | if ($op == "delcatgo") { |
|---|
| 274 | $cat_id = !empty($_POST['cat_id']) ? intval($_POST['cat_id']) : 0; |
|---|
| 275 | if ($cat_id <= 0) { |
|---|
| 276 | exit(); |
|---|
| 277 | } |
|---|
| 278 | $sql = sprintf("DELETE FROM %s WHERE category_id = %u", $xoopsDB->prefix("xoopsfaq_categories"), $cat_id); |
|---|
| 279 | if (!$xoopsDB->query($sql)) { |
|---|
| 280 | xoops_cp_header(); |
|---|
| 281 | echo "Could not delete category"; |
|---|
| 282 | xoops_cp_footer(); |
|---|
| 283 | } else { |
|---|
| 284 | $sql = sprintf("DELETE FROM %s WHERE category_id = %u", $xoopsDB->prefix("xoopsfaq_contents"), $cat_id); |
|---|
| 285 | $xoopsDB->query($sql); |
|---|
| 286 | // delete comments |
|---|
| 287 | xoops_comment_delete($xoopsModule->getVar('mid'), $cat_id); |
|---|
| 288 | redirect_header("index.php?op=listcat",1,_XD_DBSUCCESS); |
|---|
| 289 | } |
|---|
| 290 | exit(); |
|---|
| 291 | } |
|---|
| 292 | |
|---|
| 293 | if ($op == 'delcat') { |
|---|
| 294 | xoops_cp_header(); |
|---|
| 295 | xoops_confirm(array('op' => 'delcatgo', 'cat_id' => $cat_id), 'index.php', _XD_RUSURECAT); |
|---|
| 296 | xoops_cp_footer(); |
|---|
| 297 | exit(); |
|---|
| 298 | } |
|---|
| 299 | |
|---|
| 300 | if ($op == "delcontentsgo") { |
|---|
| 301 | $id = !empty($_POST['id']) ? intval($_POST['id']) : 0; |
|---|
| 302 | if ($id <= 0) { |
|---|
| 303 | exit(); |
|---|
| 304 | } |
|---|
| 305 | $sql = sprintf("DELETE FROM %s WHERE contents_id = %u", $xoopsDB->prefix("xoopsfaq_contents"), $id); |
|---|
| 306 | if (!$xoopsDB->query($sql)) { |
|---|
| 307 | xoops_cp_header(); |
|---|
| 308 | echo "Could not delete contents"; |
|---|
| 309 | xoops_cp_footer(); |
|---|
| 310 | } else { |
|---|
| 311 | redirect_header("index.php?op=listcontents&cat_id=".intval($_POST['cat_id']),1,_XD_DBSUCCESS); |
|---|
| 312 | } |
|---|
| 313 | exit(); |
|---|
| 314 | } |
|---|
| 315 | |
|---|
| 316 | if ($op == "delcontents") { |
|---|
| 317 | $id = !empty($_GET['id']) ? intval($_GET['id']) : 0; |
|---|
| 318 | xoops_cp_header(); |
|---|
| 319 | xoops_confirm(array('op' => 'delcontentsgo', 'id' => $id, 'cat_id' => $cat_id), 'index.php', _XD_RUSURECAT); |
|---|
| 320 | xoops_cp_footer(); |
|---|
| 321 | exit(); |
|---|
| 322 | } |
|---|
| 323 | ?> |
|---|