$id = 0 + $_POST['id']; if (!$id) { header("Location: log.php?action=chronicle"); die; } else { sql_query("UPDATE chronicle SET txt=" . sqlesc($txt) . " WHERE id=" . $id) or sqlerr(__FILE__, __LINE__); } } else { $id = 0 + $_GET['id']; if (!$id) { header("Location: log.php?action=chronicle"); die; } elseif ($_GET['do'] == "del") { sql_query("DELETE FROM chronicle where id = '" . $id . "'") or sqlerr(__FILE__, __LINE__); } elseif ($_GET['do'] == "edit") { edititem($lang_log['text_edit_chronicle'], 'chronicle', $id); } } } $res = sql_query("SELECT COUNT(*) FROM chronicle" . $wherea); $row = mysql_fetch_array($res); $count = $row[0]; $perpage = 50; list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "log.php?action=chronicle&" . $addparam); $res = sql_query("SELECT id, added, txt FROM chronicle {$wherea} ORDER BY added DESC {$limit}") or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($res) == 0) { print $lang_log['text_chronicle_empty']; } else { //echo $pagertop; print "<table width=940 border=1 cellspacing=0 cellpadding=5>\n"; print "<tr><td class=colhead align=center>" . $lang_log['col_date'] . "</td><td class=colhead align=left>" . $lang_log['col_event'] . "</td>" . (get_user_class() >= $chrmanage_class ? "<td class=colhead align=center>" . $lang_log['col_modify'] . "</td>" : "") . "</tr>\n";
} /* -- Available operations -- */ switch ($op) { case "mod": global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModuleConfig, $xoopsModule, $modify, $myts; $itemid = isset($_GET['itemid']) ? $_GET['itemid'] : 0; if ($itemid == 0) { $totalcategories = $smartsection_category_handler->getCategoriesCount(-1); if ($totalcategories == 0) { redirect_header("category.php?op=mod", 3, _AM_SS_NEED_CATEGORY_ITEM); exit; } } ss_xoops_cp_header(); include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; edititem(true, $itemid); break; case "additem": global $xoopsUser; if (!$xoopsUser) { if ($xoopsModuleConfig['anonpost'] == 1) { $uid = 0; } else { redirect_header("index.php", 3, _NOPERM); exit; } } else { $uid = $xoopsUser->uid(); } $itemid = isset($_POST['itemid']) ? intval($_POST['itemid']) : -1; // Creating the ITEM object
$userrow = checkcookies(); if ($userrow == false) { die("Please log in to the <a href=\"../login.php?do=login\">game</a> before using the control panel."); } if ($userrow["authlevel"] != 1) { die("You must have administrator privileges to use the control panel."); } $controlrow = getcontrol(); if (isset($_GET["do"])) { $do = explode(":", $_GET["do"]); if ($do[0] == "main") { main(); } elseif ($do[0] == "items") { items(); } elseif ($do[0] == "edititem") { edititem($do[1]); } elseif ($do[0] == "drops") { drops(); } elseif ($do[0] == "editdrop") { editdrop($do[1]); } elseif ($do[0] == "towns") { towns(); } elseif ($do[0] == "edittown") { edittown($do[1]); } elseif ($do[0] == "monsters") { monsters(); } elseif ($do[0] == "editmonster") { editmonster($do[1]); } elseif ($do[0] == "levels") { levels(); } elseif ($do[0] == "editlevel") {
if ($totalitems > 0) { for ($i = 0; $i < $totalItemsOnPage; $i++) { $categoryObj =& $itemsObj[$i]->category(); $modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/edit.gif' title='" . _AM_SSECTION_EDITITEM . "' alt='" . _AM_SSECTION_EDITITEM . "' /></a>"; $delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/delete.gif' title='" . _AM_SSECTION_EDITITEM . "' alt='" . _AM_SSECTION_DELETEITEM . "'/></a>"; echo "<tr>"; echo "<td class='head' align='center'>" . $itemsObj[$i]->itemid() . "</td>"; echo "<td class='even' align='left'>" . $categoryObj->name() . "</td>"; echo "<td class='even' align='left'><a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/item.php?itemid=" . $itemsObj[$i]->itemid() . "'>" . $itemsObj[$i]->title() . "</a></td>"; echo "<td class='even' align='center'>" . $itemsObj[$i]->datesub() . "</td>"; echo "<td class='even' align='center'> {$modify} {$delete} </td>"; echo "</tr>"; } } else { $itemid = -1; echo "<tr>"; echo "<td class='head' align='center' colspan= '7'>" . _AM_SSECTION_NOITEMS . "</td>"; echo "</tr>"; } echo "</table>\n"; echo "<br />\n"; $pagenav = new XoopsPageNav($totalitems, $xoopsModuleConfig['perpage'], $startitem, 'startitem'); echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; echo "</div>"; $totalcategories = $smartsection_category_handler->getCategoriesCount(-1); if ($totalcategories > 0) { edititem(); } break; } smart_xoops_cp_footer();