<?php
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2006                                            */
/* http://www.php-maximus.fr                                            */
/* dev@php-maximus.org                                                  */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
if (!defined('ADMIN_ALLOW') && !defined('ADMIN_MAX')) {
    Header("Location: index.php");
}

    $catid = $db->XMFnum($catid);
    $result = $db->sql_query("select title from ".TABLE_STORIES_CAT." where catid='$catid'");
    list($title) = $db->sql_fetchrow($result);
    incoh();
    GraphicAdmin();
    Max_OpenTable();
    echo "<center><font class='title'><b>"._CATEGORIESADMIN."</b></font></center>";
    Max_CloseTable();
    echo "<br />";
    Max_OpenTable();
    echo "<center><font class=\"option\"><b>"._EDITCATEGORY."</b></font><br />";
    if (!$catid) {
        $selcat = $db->sql_query("select catid, title from ".TABLE_STORIES_CAT."");
        echo "<form action=\"".$admin_file.".php\" method=\"post\">";
        echo "<b>"._ASELECTCATEGORY."</b>";
        echo "<select name=\"catid\">";
        echo "<option name=\"catid\" value=\"0\" $sel>Articles</option>";
        while(list($catid, $title) = $db->sql_fetchrow($selcat)) {
            $catid = $db->XMFnum($catid);
            echo "<option name=\"catid\" value=\"$catid\" $sel>$title</option>";
        }
        echo "</select>";
        echo "<input type=\"hidden\" name=\"op\" value=\"EditCategory\">";
        echo "<input type=\"submit\" value=\""._EDIT."\"><br /><br />";
        echo ""._NOARTCATEDIT."";
    } else {
        echo "<form action=\"".$admin_file.".php\" method=\"post\">";
        echo "<b>"._CATEGORYNAME.":</b> ";
        echo "<input type=\"text\" name=\"title\" size=\"22\" maxlength=\"20\" value=\"$title\"> ";
        echo "<input type=\"hidden\" name=\"catid\" value=\"$catid\">";
        echo "<input type=\"hidden\" name=\"op\" value=\"SaveEditCategory\">";
        echo "<input type=\"submit\" value=\""._SAVECHANGES."\"><br /><br />";
        echo ""._NOARTCATEDIT."";
        echo "</form>";
    }
    echo "</center>";
    Max_CloseTable();
    incof();