XoopsModules25x /
xfguestbook
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | // $Id: admin/index.php,v 2.21 2005/11/09 C. Felix alias the Cat |
||
| 3 | // ------------------------------------------------------------------------ // |
||
| 4 | // XF Guestbook // |
||
| 5 | // ------------------------------------------------------------------------- // |
||
| 6 | // This program is free software; you can redistribute it and/or modify // |
||
| 7 | // it under the terms of the GNU General Public License as published by // |
||
| 8 | // the Free Software Foundation; either version 2 of the License, or // |
||
| 9 | // (at your option) any later version. // |
||
| 10 | // // |
||
| 11 | // You may not change or alter any portion of this comment or credits // |
||
| 12 | // of supporting developers from this source code or any supporting // |
||
| 13 | // source code which is considered copyrighted (c) material of the // |
||
| 14 | // original comment or credit authors. // |
||
| 15 | // // |
||
| 16 | // This program is distributed in the hope that it will be useful, // |
||
| 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
||
| 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
||
| 19 | // GNU General Public License for more details. // |
||
| 20 | // // |
||
| 21 | // You should have received a copy of the GNU General Public License // |
||
| 22 | // along with this program; if not, write to the Free Software // |
||
| 23 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
||
| 24 | // ------------------------------------------------------------------------ // |
||
| 25 | |||
| 26 | include dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; |
||
| 27 | include_once dirname(__DIR__) . '/include/cp_functions.php'; |
||
| 28 | include_once __DIR__ . '/admin_header.php'; |
||
| 29 | |||
| 30 | // Flag |
||
| 31 | $maxsize = 2000; |
||
| 32 | $maxheight = 50; |
||
| 33 | $maxwidth = 80; |
||
| 34 | $format = 'gif'; |
||
| 35 | |||
| 36 | View Code Duplication | if (isset($_GET['op'])) { |
|
| 37 | $op = $_GET['op']; |
||
| 38 | } elseif (isset($_POST['op'])) { |
||
| 39 | $op = $_POST['op']; |
||
| 40 | } else { |
||
| 41 | $op = 'countryShow'; |
||
| 42 | } |
||
| 43 | |||
| 44 | View Code Duplication | if (isset($_GET['country_id'])) { |
|
| 45 | $country_id = (int)$_GET['country_id']; |
||
| 46 | } elseif (isset($_POST['country_id'])) { |
||
| 47 | $country_id = (int)$_POST['country_id']; |
||
| 48 | } else { |
||
| 49 | $country_id = 0; |
||
| 50 | } |
||
| 51 | |||
| 52 | View Code Duplication | if (isset($_GET['country_code'])) { |
|
| 53 | $country_code = $_GET['country_code']; |
||
| 54 | } elseif (isset($_POST['country_code'])) { |
||
| 55 | $country_code = $_POST['country_code']; |
||
| 56 | } else { |
||
| 57 | $country_code = ''; |
||
| 58 | } |
||
| 59 | |||
| 60 | $start = isset($_GET['start']) ? (int)$_GET['start'] : 0; |
||
| 61 | $country_name = isset($_POST['country_name']) ? $_POST['country_name'] : ''; |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @param $country_code |
||
| 65 | */ |
||
| 66 | function flagUpload($country_code) |
||
| 67 | { |
||
| 68 | global $xoopsModule, $xoopsModuleConfig, $maxsize, $maxwidth, $maxheight, $format; |
||
| 69 | $array_allowed_mimetypes = array('image/' . $format); |
||
| 70 | // photos |
||
| 71 | if (!empty($_FILES['photo']['name'])) { |
||
| 72 | $ext = preg_replace("/^.+\.([^.]+)$/sU", "\\1", $_FILES['photo']['name']); |
||
| 73 | include_once(XOOPS_ROOT_PATH . '/class/uploader.php'); |
||
| 74 | $field = $_POST['xoops_upload_file'][0]; |
||
| 75 | if (!empty($field) || $field !== '') { |
||
| 76 | // Check if file uploaded |
||
| 77 | if ($_FILES[$field]['tmp_name'] === '' || !is_readable($_FILES[$field]['tmp_name'])) { |
||
| 78 | redirect_header('country_manager.php', 2, _MD_XFGB_FILEERROR); |
||
| 79 | exit; |
||
| 80 | } |
||
| 81 | $photos_dir = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->dirname() . '/assets/images/flags/' . $xoopsModuleConfig['flagdir']; |
||
| 82 | $uploader = new XoopsMediaUploader($photos_dir, $array_allowed_mimetypes, $maxsize, $maxwidth, $maxheight); |
||
| 83 | $uploader->setPrefix('tmp'); |
||
| 84 | if ($uploader->fetchMedia($field) && $uploader->upload()) { |
||
| 85 | $tmp_name = $uploader->getSavedFileName(); |
||
| 86 | $ext = preg_replace("/^.+\.([^.]+)$/sU", "\\1", $tmp_name); |
||
| 87 | $photo = $country_code . '.' . $ext; |
||
| 88 | if (file_exists($photos_dir . '/' . $photo)) { |
||
| 89 | unlink($photos_dir . '/' . $photo); |
||
| 90 | } |
||
| 91 | rename("$photos_dir/$tmp_name", "$photos_dir/$photo"); |
||
| 92 | } else { |
||
| 93 | redirect_header('country_manager.php', 2, $uploader->getErrors()); |
||
| 94 | exit(); |
||
| 95 | } |
||
| 96 | } |
||
| 97 | redirect_header('country_manager.php', 2, _AM_XFGB_FILEUPLOADED); |
||
| 98 | } else { |
||
| 99 | redirect_header('country_manager.php?op=flagForm&country_code=' . $country_code, 2, _MD_XFGB_NOIMGSELECTED); |
||
| 100 | } |
||
| 101 | exit(); |
||
| 102 | } |
||
| 103 | |||
| 104 | /** |
||
| 105 | * @param $country_code |
||
| 106 | */ |
||
| 107 | function flagForm($country_code) |
||
| 108 | { |
||
| 109 | global $xoopsModule, $xoopsModuleConfig, $maxsize, $maxwidth, $maxheight, $format; |
||
| 110 | include XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
| 111 | |||
| 112 | $flagform = new XoopsThemeForm(_AM_XFGB_SUBMITFLAG, 'op', xoops_getenv('PHP_SELF')); |
||
| 113 | $flagform->setExtra("enctype='multipart/form-data'"); |
||
| 114 | |||
| 115 | $flag = '/modules/' . $xoopsModule->dirname() . '/assets/images/flags/' . $xoopsModuleConfig['flagdir'] . '/' . $country_code . '.gif'; |
||
| 116 | if (file_exists(XOOPS_ROOT_PATH . $flag)) { |
||
| 117 | $flag_img = "<img src='" . XOOPS_URL . $flag . "'>"; |
||
| 118 | $img_flag = new XoopsFormLabel('', '<br>' . $flag_img . '<br>'); |
||
| 119 | $flagform->addElement($img_flag); |
||
| 120 | } |
||
| 121 | $flag_desc = sprintf(_AM_XFGB_FLAGDSC, $maxsize, $maxwidth, $maxheight, $format); |
||
| 122 | $flagform->addElement(new XoopsFormLabel('', $flag_desc)); |
||
| 123 | |||
| 124 | $img_text = new XoopsFormFile(_AM_XFGB_ADDIMG, 'photo', 30000); |
||
| 125 | $img_text->setExtra("size ='60'"); |
||
| 126 | $flagform->addElement($img_text); |
||
| 127 | |||
| 128 | $button_tray = new XoopsFormElementTray('', ''); |
||
| 129 | $button_tray->addElement(new XoopsFormButton('', 'post', _SEND, 'submit')); |
||
| 130 | $button_tray->addElement(new XoopsFormHidden('country_code', $country_code)); |
||
| 131 | $button_tray->addElement(new XoopsFormHidden('op', 'flagUpload')); |
||
| 132 | $flagform->addElement($button_tray); |
||
| 133 | |||
| 134 | $flagform->display(); |
||
| 135 | } |
||
| 136 | |||
| 137 | /** |
||
| 138 | * @param $country_code |
||
| 139 | */ |
||
| 140 | function flagDel($country_code) |
||
| 141 | { |
||
| 142 | global $xoopsModule, $xoopsModuleConfig; |
||
| 143 | $ok = isset($_POST['ok']) ? (int)$_POST['ok'] : 0; |
||
| 144 | if ($ok == 1) { |
||
| 145 | $flag = '/modules/' . $xoopsModule->dirname() . '/assets/images/flags/' . $xoopsModuleConfig['flagdir'] . '/' . $country_code . '.gif'; |
||
| 146 | if (file_exists(XOOPS_ROOT_PATH . $flag)) { |
||
| 147 | unlink(XOOPS_ROOT_PATH . $flag); |
||
| 148 | } |
||
| 149 | redirect_header('country_manager.php', 2, _AM_XFGB_FLAGDELETED); |
||
| 150 | View Code Duplication | } else { |
|
|
0 ignored issues
–
show
|
|||
| 151 | xoops_cp_header(); |
||
| 152 | $index_admin = new ModuleAdmin(); |
||
| 153 | echo $index_admin->addNavigation(basename(__FILE__)); |
||
| 154 | xoops_confirm(array('op' => 'flagDel', 'country_code' => $country_code, 'ok' => 1), 'country_manager.php', _AM_XFGB_CONFDELFLAG); |
||
| 155 | include __DIR__ . '/admin_footer.php'; |
||
| 156 | //xoops_cp_footer(); |
||
| 157 | } |
||
| 158 | } |
||
| 159 | |||
| 160 | /** |
||
| 161 | * @param null $country_id |
||
| 162 | */ |
||
| 163 | function countryForm($country_id = null) |
||
| 164 | { |
||
| 165 | include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
| 166 | |||
| 167 | if ($country_id) { |
||
| 168 | $sform = new XoopsThemeForm(_AM_XFGB_MODCOUNTRY, 'op', xoops_getenv('PHP_SELF')); |
||
| 169 | $arr_country = xfgb_getCountry('country_id=' . $country_id, 0, 0); |
||
| 170 | $country_code = $arr_country[0]['country_code']; |
||
| 171 | $country_name = $arr_country[0]['country_name']; |
||
| 172 | } else { |
||
| 173 | $sform = new XoopsThemeForm(_AM_XFGB_ADDCOUNTRY, 'op', xoops_getenv('PHP_SELF')); |
||
| 174 | $country_code = ''; |
||
| 175 | $country_name = ''; |
||
| 176 | } |
||
| 177 | |||
| 178 | $text_code = new XoopsFormText(_AM_XFGB_FLAGCODE, 'country_code', 5, 5, $country_code); |
||
| 179 | if ($country_id) { |
||
| 180 | $text_code->setExtra("readonly = 'readonly'"); |
||
| 181 | } |
||
| 182 | $sform->addElement($text_code, true); |
||
| 183 | $sform->addElement(new XoopsFormText(_AM_XFGB_FLAGNAME, 'country_name', 50, 50, $country_name), true); |
||
| 184 | |||
| 185 | $button_tray = new XoopsFormElementTray('', ''); |
||
| 186 | $button_tray->addElement(new XoopsFormButton('', 'save', _SUBMIT, 'submit')); |
||
| 187 | if ($country_id) { |
||
| 188 | $button_tray->addElement(new XoopsFormHidden('country_id', $country_id)); |
||
| 189 | } |
||
| 190 | $button_tray->addElement(new XoopsFormHidden('op', 'countrySave')); |
||
| 191 | $sform->addElement($button_tray); |
||
| 192 | $sform->display(); |
||
| 193 | } |
||
| 194 | |||
| 195 | /** |
||
| 196 | * @param null $criteria |
||
| 197 | * @param int $limit |
||
| 198 | * @param int $start |
||
| 199 | * @return array |
||
| 200 | */ |
||
| 201 | View Code Duplication | function xfgb_getCountry($criteria = null, $limit = 0, $start = 0) |
|
| 202 | { |
||
| 203 | global $xoopsDB, $action; |
||
| 204 | $ret = array(); |
||
| 205 | |||
| 206 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('xfguestbook_country'); |
||
| 207 | if (isset($criteria) && $criteria !== '') { |
||
| 208 | $sql .= ' WHERE ' . $criteria; |
||
| 209 | } |
||
| 210 | $sql .= ' ORDER BY country_name ASC'; |
||
| 211 | $result = $xoopsDB->query($sql, $limit, $start); |
||
| 212 | while ($myrow = $xoopsDB->fetchArray($result)) { |
||
| 213 | array_push($ret, $myrow); |
||
| 214 | } |
||
| 215 | |||
| 216 | return $ret; |
||
| 217 | } |
||
| 218 | |||
| 219 | /** |
||
| 220 | * @param $country_id |
||
| 221 | */ |
||
| 222 | function countryDel($country_id) |
||
| 223 | { |
||
| 224 | global $xoopsDB, $xoopsModule, $xoopsModuleConfig; |
||
| 225 | $ok = isset($_POST['ok']) ? (int)$_POST['ok'] : 0; |
||
| 226 | if ($ok == 1) { |
||
| 227 | $arr_country = xfgb_getCountry('country_id=' . $country_id, 0, 0); |
||
| 228 | $flag = '/modules/' . $xoopsModule->dirname() . '/assets/images/flags/' . $xoopsModuleConfig['flagdir'] . '/' . $arr_country[0]['country_code'] . '.gif'; |
||
| 229 | $sql = 'DELETE FROM ' . $xoopsDB->prefix('xfguestbook_country') . " WHERE country_id=$country_id"; |
||
| 230 | $result = $xoopsDB->query($sql); |
||
| 231 | if (file_exists(XOOPS_ROOT_PATH . $flag)) { |
||
| 232 | unlink(XOOPS_ROOT_PATH . $flag); |
||
| 233 | } |
||
| 234 | redirect_header('country_manager.php', 1, _AM_XFGB_COUNTRYDELETED); |
||
| 235 | View Code Duplication | } else { |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 236 | xoops_cp_header(); |
||
| 237 | $index_admin = new ModuleAdmin(); |
||
| 238 | echo $index_admin->addNavigation(basename(__FILE__)); |
||
| 239 | xoops_confirm(array('op' => 'countryDel', 'country_id' => $country_id, 'ok' => 1), 'country_manager.php', _AM_XFGB_CONFDELCOUNTRY); |
||
| 240 | include __DIR__ . '/admin_footer.php'; |
||
| 241 | //xoops_cp_footer(); |
||
| 242 | } |
||
| 243 | } |
||
| 244 | |||
| 245 | /** |
||
| 246 | * @param $country_id |
||
| 247 | * @param $country_code |
||
| 248 | * @param $country_name |
||
| 249 | */ |
||
| 250 | View Code Duplication | function countrySave($country_id, $country_code, $country_name) |
|
| 251 | { |
||
| 252 | global $xoopsDB; |
||
| 253 | |||
| 254 | $myts = MyTextSanitizer::getInstance(); |
||
|
0 ignored issues
–
show
$myts is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the Loading history...
|
|||
| 255 | //$country_code=$myts->makeTboxData4Save::$country_code; |
||
| 256 | //$country_name=$myts->makeTboxData4Save::$country_name; |
||
| 257 | echo $country_code; |
||
| 258 | if (!empty($country_id)) { |
||
| 259 | $sql = 'UPDATE ' . $xoopsDB->prefix('xfguestbook_country') . " SET country_code='$country_code', country_name='$country_name'"; |
||
| 260 | $sql .= " WHERE country_id=$country_id"; |
||
| 261 | $xoopsDB->query($sql); |
||
| 262 | $messagesent = _AM_XFGB_COUNTRY_UPDATED; |
||
| 263 | } else { |
||
| 264 | $sql = sprintf("SELECT COUNT(*) FROM %s WHERE country_code = '%s'", $xoopsDB->prefix('xfguestbook_country'), $country_code); |
||
| 265 | list($count) = $xoopsDB->fetchRow($xoopsDB->query($sql)); |
||
| 266 | if ($count > 0) { |
||
| 267 | $messagesent = '<font color="#FF0000">' . _AM_XFGB_COUNTRY_EXIST . '</font>'; |
||
| 268 | } else { |
||
| 269 | $country_id = $xoopsDB->genId('country_id_seq'); |
||
| 270 | $sql = |
||
| 271 | sprintf("INSERT INTO %s (country_id, country_code, country_name) VALUES (%s, '%s', '%s')", $xoopsDB->prefix('xfguestbook_country'), $country_id, $country_code, $country_name); |
||
| 272 | $xoopsDB->query($sql); |
||
| 273 | $messagesent = _AM_XFGB_COUNTRY_ADDED; |
||
| 274 | } |
||
| 275 | } |
||
| 276 | redirect_header('country_manager.php', 2, $messagesent); |
||
| 277 | exit(); |
||
| 278 | } |
||
| 279 | |||
| 280 | function countryShow() |
||
| 281 | { |
||
| 282 | global $action, $start, $xoopsModule, $xoopsModuleConfig, $pathIcon16; |
||
| 283 | $myts = MyTextSanitizer::getInstance(); |
||
|
0 ignored issues
–
show
$myts is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the Loading history...
|
|||
| 284 | $limit = 15; |
||
| 285 | $arr_country = xfgb_getCountry('', $limit, $start); |
||
| 286 | $scount = count(xfgb_getCountry('', $limit, 0)); |
||
| 287 | $totalcount = count(xfgb_getCountry('', 0, 0)); |
||
| 288 | |||
| 289 | echo " |
||
| 290 | <table width='100%' cellspacing='1' cellpadding='2' border='0' style='border-left: 1px solid silver; border-top: 1px solid silver; border-right: 1px solid silver;'> |
||
| 291 | <tr> |
||
| 292 | <td><span style='font-weight: bold; font-size: 12px; font-variant: small-caps;'>" . _AM_XFGB_DISPCOUNTRY . ' : ' . $totalcount . "</span></td> |
||
| 293 | <td align='right'> |
||
| 294 | </td> |
||
| 295 | </tr> |
||
| 296 | </table>"; |
||
| 297 | |||
| 298 | echo "<table border='1' width='100%' cellpadding ='2' cellspacing='1'>"; |
||
| 299 | echo "<tr class='bg3'>"; |
||
| 300 | echo "<td align='center'><b>" . _AM_XFGB_FLAGIMG . '</td>'; |
||
| 301 | echo "<td align='center'><b>" . _AM_XFGB_FLAGCODE . '</td>'; |
||
| 302 | echo "<td align='center'><b>" . _AM_XFGB_FLAGNAME . '</td>'; |
||
| 303 | echo "<td align='center'><b>" . _AM_XFGB_COUNTRY . '</td></b>'; |
||
| 304 | echo "<td align='center'><b>" . _AM_XFGB_FLAGIMG . '</td></b>'; |
||
| 305 | echo '</tr>'; |
||
| 306 | |||
| 307 | if (count($arr_country) == '0') { |
||
| 308 | echo "<tr ><td align='center' colspan ='10' class = 'head'><b>" . _AM_XFGB_NOFLAG . '</b></td></tr>'; |
||
| 309 | } |
||
| 310 | |||
| 311 | for ($i = 0; $i < count($arr_country); $i++) { |
||
| 312 | $all_country = array(); |
||
| 313 | $flag = '/modules/' . $xoopsModule->dirname() . '/assets/images/flags/' . $xoopsModuleConfig['flagdir'] . '/' . $arr_country[$i]['country_code'] . '.gif'; |
||
| 314 | if (file_exists(XOOPS_ROOT_PATH . $flag)) { |
||
| 315 | $all_country['flag_img'] = "<img src='" . XOOPS_URL . $flag . "'>"; |
||
| 316 | } else { |
||
| 317 | $all_country['flag_img'] = "<img src='" . XOOPS_URL . "/images/blank.gif'>"; |
||
| 318 | } |
||
| 319 | |||
| 320 | $all_country['country_id'] = $arr_country[$i]['country_id']; |
||
| 321 | $all_country['country_code'] = $arr_country[$i]['country_code']; |
||
| 322 | $all_country['country_name'] = $arr_country[$i]['country_name']; |
||
| 323 | $all_country['msg_action'] = "<a href='country_manager.php?op=countryEdit&country_id=" . $arr_country[$i]['country_id'] . "'><img src='" . $pathIcon16 . "/edit.png'></a>"; |
||
| 324 | $all_country['msg_action'] .= " <a href='country_manager.php?op=countryDel&country_id=" . $arr_country[$i]['country_id'] . "'><img src='" . $pathIcon16 . "/delete.png'></a>"; |
||
| 325 | $all_country['flag_action'] = "<a href='country_manager.php?op=flagForm&country_code=" . $arr_country[$i]['country_code'] . "'><img src='" . $pathIcon16 . "/add.png'></a>"; |
||
| 326 | $all_country['flag_action'] .= " <a href='country_manager.php?op=flagDel&country_code=" . $arr_country[$i]['country_code'] . "'><img src='" . $pathIcon16 . "/delete.png'></a>"; |
||
| 327 | echo "<tr><td align='center' class = 'head'><b>" . $all_country['flag_img'] . '</b>'; |
||
| 328 | echo "</td><td class = 'even'>" . $all_country['country_code'] . ''; |
||
| 329 | echo "</td><td class = 'odd'>" . $all_country['country_name'] . ''; |
||
| 330 | echo "</td><td align='center' class='even'>" . $all_country['msg_action'] . ''; |
||
| 331 | echo "</td><td align='center' class='even'>" . $all_country['flag_action'] . ''; |
||
| 332 | echo '</td></tr>'; |
||
| 333 | unset($all_country); |
||
| 334 | } |
||
| 335 | |||
| 336 | echo '</table><br>'; |
||
| 337 | |||
| 338 | View Code Duplication | if ($totalcount > $scount) { |
|
| 339 | include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
| 340 | $pagenav = new XoopsPageNav($totalcount, $limit, $start, 'start', 'action=' . $action); |
||
| 341 | echo "<div style='text-align: center;' class = 'head'>" . $pagenav->renderNav() . '</div><br>'; |
||
| 342 | } else { |
||
| 343 | echo ''; |
||
| 344 | } |
||
| 345 | echo '<br>'; |
||
| 346 | } |
||
| 347 | |||
| 348 | switch ($op) { |
||
| 349 | View Code Duplication | case 'flagForm': |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 350 | xoops_cp_header(); |
||
| 351 | $index_admin = new ModuleAdmin(); |
||
| 352 | echo $index_admin->addNavigation(basename(__FILE__)); |
||
| 353 | //xfguestbook_admin_menu(2); |
||
| 354 | flagForm($country_code); |
||
| 355 | include __DIR__ . '/admin_footer.php'; |
||
| 356 | //xoops_cp_footer(); |
||
| 357 | break; |
||
| 358 | case 'flagUpload': |
||
| 359 | flagUpload($country_code); |
||
| 360 | break; |
||
| 361 | case 'flagDel': |
||
| 362 | flagDel($country_code); |
||
| 363 | break; |
||
| 364 | case 'countryDel': |
||
| 365 | countryDel($country_id); |
||
| 366 | break; |
||
| 367 | View Code Duplication | case 'countryEdit': |
|
| 368 | xoops_cp_header(); |
||
| 369 | $index_admin = new ModuleAdmin(); |
||
| 370 | echo $index_admin->addNavigation(basename(__FILE__)); |
||
| 371 | //xfguestbook_admin_menu(2); |
||
| 372 | countryForm($country_id); |
||
| 373 | include __DIR__ . '/admin_footer.php'; |
||
| 374 | //xoops_cp_footer(); |
||
| 375 | break; |
||
| 376 | case 'countrySave': |
||
| 377 | countrySave($country_id, $country_code, $country_name); |
||
| 378 | break; |
||
| 379 | View Code Duplication | case 'countryAdd': |
|
| 380 | xoops_cp_header(); |
||
| 381 | $index_admin = new ModuleAdmin(); |
||
| 382 | echo $index_admin->addNavigation(basename(__FILE__)); |
||
| 383 | //xfguestbook_admin_menu(2); |
||
| 384 | countryForm(); |
||
| 385 | include __DIR__ . '/admin_footer.php'; |
||
| 386 | //xoops_cp_footer(); |
||
| 387 | break; |
||
| 388 | case 'countryShow': |
||
| 389 | View Code Duplication | default: |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 390 | xoops_cp_header(); |
||
| 391 | $index_admin = new ModuleAdmin(); |
||
| 392 | echo $index_admin->addNavigation(basename(__FILE__)); |
||
| 393 | //xfguestbook_admin_menu(2); |
||
| 394 | countryShow(); |
||
| 395 | countryForm(); |
||
| 396 | include __DIR__ . '/admin_footer.php'; |
||
| 397 | //xoops_cp_footer(); |
||
| 398 | break; |
||
| 399 | } |
||
| 400 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.