Example #1
0
        if (!mysql_num_rows($result)) {
            cpg_die(ERROR, $lang_catmgr_php['unknown_cat'], __FILE__, __LINE__);
        }
        $del_category = mysql_fetch_array($result);
        $parent = $del_category['parent'];
        $result = cpg_db_query("UPDATE {$CONFIG['TABLE_CATEGORIES']} SET parent='{$parent}' WHERE parent = '{$cid}'");
        $result = cpg_db_query("UPDATE {$CONFIG['TABLE_ALBUMS']} SET category='{$parent}' WHERE category = '{$cid}'");
        $result = cpg_db_query("DELETE FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid='{$cid}' LIMIT 1");
        //delete from categorymap
        cpg_db_query("DELETE FROM {$CONFIG['TABLE_CATMAP']} WHERE cid='{$cid}'");
        break;
}
fix_cat_table();
get_subcat_data(0);
if ($CONFIG['categories_alpha_sort'] != 1) {
    update_cat_order();
}
pageheader($lang_catmgr_php['manage_cat']);
echo <<<EOT

<script language="javascript" type="text/javascript">
function confirmDel(catName)
{
    return confirm("{$lang_catmgr_php['confirm_delete']} (" + catName + ") ?");
}

function build(target, category){

        if (target.length > 1) return;

        pos = target.options[0];
Example #2
0
    if ($cat_name == "") {
        $error['cat_name'] = 1;
    }
    if (empty($error)) {
        if (!$cat_order) {
            $sql = "SELECT cat_order\n              FROM " . CATEGORIES_TABLE . "\n              WHERE cat_parent_id = {$cat_parent_id}\n              ORDER BY cat_order DESC\n              LIMIT 1";
            $catorder = $site_db->query_firstrow($sql);
            $cat_order = $catorder['cat_order'] + 10;
            $do_update_cat_order = 0;
        } else {
            $do_update_cat_order = 1;
        }
        $sql = "UPDATE " . CATEGORIES_TABLE . "\n            SET cat_name = '{$cat_name}', cat_description = '{$cat_description}', cat_parent_id = {$cat_parent_id}, cat_order = {$cat_order}, cat_hits = {$cat_hits}, auth_viewcat = {$auth_viewcat}, auth_viewimage = {$auth_viewimage}, auth_download = {$auth_download}, auth_upload = {$auth_upload}, auth_directupload = {$auth_directupload}, auth_vote = {$auth_vote}, auth_sendpostcard = {$auth_sendpostcard}, auth_readcomment = {$auth_readcomment}, auth_postcomment = {$auth_postcomment}\n            WHERE cat_id = {$cat_id}";
        $result = $site_db->query($sql);
        if ($result && $do_update_cat_order) {
            update_cat_order($cat_parent_id);
        }
        $msg = $result ? $lang['cat_edit_success'] : $lang['cat_edit_error'];
        //$action = "modifycats";
        forward_to_modify($msg);
    } else {
        $msg .= sprintf("<span class=\"marktext\">%s</span>", $lang['lostfield_error']);
        $action = "editcat";
    }
}
if ($action == "editcat") {
    if ($msg != "") {
        printf("<b>%s</b>\n", $msg);
    }
    $cat_id = isset($HTTP_POST_VARS['cat_id']) ? intval($HTTP_POST_VARS['cat_id']) : intval($HTTP_GET_VARS['cat_id']);
    $sql = "SELECT cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment\n          FROM " . CATEGORIES_TABLE . "\n          WHERE cat_id = {$cat_id}";