Пример #1
0
        if (intval($check_exit) > 0) {
            $error = "error delete cat";
        } else {
            $description = nv_nl2br($description, '<br />');
            //
            $query = "UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_cat` SET `parentid`=" . $db->dbescape($parentid) . ", `title`=" . $db->dbescape($title) . ", `catimage` =  " . $db->dbescape($catimage) . ", `alias` =  " . $db->dbescape($alias) . ", `description`=" . $db->dbescape($description) . ", `keywords`= " . $db->dbescape($keywords) . ", `edit_time`=UNIX_TIMESTAMP( ) WHERE `catid` =" . $catid . "";
            $db->sql_query($query);
            if ($db->sql_affectedrows() > 0) {
                $db->sql_freeresult();
                if ($parentid != $parentid_old) {
                    list($weight) = $db->sql_fetchrow($db->sql_query("SELECT max(`weight`) FROM `" . NV_PREFIXLANG . "_" . $module_data . "_cat` WHERE `parentid`=" . $db->dbescape($parentid) . ""));
                    $weight = intval($weight) + 1;
                    $sql = "UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_cat` SET `weight`=" . $weight . " WHERE `catid`=" . intval($catid);
                    $db->sql_query($sql);
                    nv_fix_cat($parentid);
                    nv_fix_cat($parentid_old);
                    nv_insert_logs(NV_LANG_DATA, $module_name, 'log_edit_cat', "catid " . $catid, $admin_info['userid']);
                }
                nv_del_moduleCache($module_name);
                Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $op . "");
                die;
            } else {
                $error = $lang_module['errorsave'];
            }
            $db->sql_freeresult();
        }
    }
}
global $array_cat, $numcat;
$contents = "<div id=\"module_show_list\">";
$contents .= nv_show_cat_list($array_cat, $numcat);
Пример #2
0
 */
if (!defined('NV_IS_FILE_ADMIN')) {
    die('Stop!!!');
}
$catid = $nv_Request->get_int('catid', 'post', 0);
$contents = "NO_" . $catid;
list($catid, $parentid, $title) = $db->sql_fetchrow($db->sql_query("SELECT `catid`, `parentid`,`title` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_cat` WHERE `catid`=" . intval($catid)));
if ($catid > 0) {
    list($check_parentid) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(*) FROM `" . NV_PREFIXLANG . "_" . $module_data . "_cat` WHERE `parentid` = '" . $catid . "'"));
    if (intval($check_parentid) > 0) {
        $contents = "ERR_" . sprintf($lang_module['delcat_msg_cat'], $check_parentid);
    } else {
        list($check_rows) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(*) FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `catid` = '" . $catid . "'"));
        if (intval($check_rows) > 0) {
            $contents = "ERR_" . sprintf($lang_module['delcat_msg_rows'], $check_rows);
        }
    }
    if ($contents == "NO_" . $catid) {
        $query = "DELETE FROM `" . NV_PREFIXLANG . "_" . $module_data . "_cat` WHERE `catid`=" . $catid;
        if ($db->sql_query($query)) {
            $db->sql_freeresult();
            nv_fix_cat($parentid);
            nv_del_moduleCache($module_name);
            $contents = "OK_" . $catid;
        }
    }
    nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['weblink_del_title'], $title, $admin_info['userid']);
}
include NV_ROOTDIR . "/includes/header.php";
echo $contents;
include NV_ROOTDIR . "/includes/footer.php";