Esempio n. 1
0
/**
 * nv_del_cat()
 *
 * @param mixed $catid
 * @return
 */
function nv_del_cat($catid)
{
    global $db, $module_name, $module_data, $admin_info, $nv_Cache;
    $sql = 'SELECT parentid, title FROM ' . NV_PREFIXLANG . '_' . $module_data . '_categories WHERE id=' . $catid;
    list($p, $title) = $db->query($sql)->fetch(3);
    $sql = 'SELECT id, fileupload, fileimage FROM ' . NV_PREFIXLANG . '_' . $module_data . ' WHERE catid=' . $catid;
    $result = $db->query($sql);
    $ids = array();
    while (list($id, $fileupload, $fileimage) = $result->fetch(3)) {
        $ids[] = $id;
    }
    if (!empty($ids)) {
        $ids = implode(',', $ids);
        $sql = 'DELETE FROM ' . NV_PREFIXLANG . '_comment WHERE module=' . $db->quote($module_name) . ' AND id IN (' . $ids . ')';
        $db->query($sql);
        $sql = 'DELETE FROM ' . NV_PREFIXLANG . '_' . $module_data . '_report WHERE fid IN (' . $ids . ')';
        $db->query($sql);
    }
    $sql = 'DELETE FROM ' . NV_PREFIXLANG . '_' . $module_data . ' WHERE catid=' . $catid;
    $db->query($sql);
    $sql = 'SELECT id FROM ' . NV_PREFIXLANG . '_' . $module_data . '_categories WHERE parentid=' . $catid;
    $result = $db->query($sql);
    while (list($id) = $result->fetch(3)) {
        nv_del_cat($id);
    }
    $sql = 'DELETE FROM ' . NV_PREFIXLANG . '_' . $module_data . '_categories WHERE id=' . $catid;
    $db->query($sql);
    $nv_Cache->delMod($module_name);
    nv_insert_logs(NV_LANG_DATA, $module_data, 'Delete Category', $title, $admin_info['userid']);
}
Esempio n. 2
0
/**
 * nv_del_cat()
 * 
 * @param mixed $catid
 * @return
 */
function nv_del_cat($catid)
{
    global $db, $module_data;
    $sql = "DELETE FROM `" . NV_PREFIXLANG . "_" . $module_data . "` WHERE `catid`=" . $catid;
    $db->sql_query($sql);
    $sql = "SELECT `id` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_categories` WHERE `parentid`=" . $catid;
    $result = $db->sql_query($sql);
    while (list($id) = $db->sql_fetchrow($result)) {
        nv_del_cat($id);
    }
    $sql = "DELETE FROM `" . NV_PREFIXLANG . "_" . $module_data . "_categories` WHERE `id`=" . $catid;
    $db->sql_query($sql);
}
Esempio n. 3
0
/**
 * nv_del_cat()
 * 
 * @param mixed $catid
 * @return
 */
function nv_del_cat($catid)
{
    global $db, $module_data;
    $sql = 'DELETE FROM ' . NV_PREFIXLANG . '_' . $module_data . ' WHERE catid=' . $catid;
    $db->query($sql);
    $sql = 'SELECT id FROM ' . NV_PREFIXLANG . '_' . $module_data . '_categories WHERE parentid=' . $catid;
    $result = $db->query($sql);
    while (list($id) = $result->fetch(3)) {
        nv_del_cat($id);
    }
    $sql = 'DELETE FROM ' . NV_PREFIXLANG . '_' . $module_data . '_categories WHERE id=' . $catid;
    $db->query($sql);
}
Esempio n. 4
0
/**
 * nv_del_cat()
 * 
 * @param mixed $catid
 * @return
 */
function nv_del_cat($catid)
{
    global $db, $module_data, $admin_info;
    $sql = "SELECT `parentid`, `title` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_categories` WHERE `id`=" . $catid;
    $result = $db->sql_query($sql);
    list($p, $title) = $db->sql_fetchrow($result);
    $sql = "SELECT `id`, `fileupload`, `fileimage` FROM `" . NV_PREFIXLANG . "_" . $module_data . "` WHERE `catid`=" . $catid;
    $result = $db->sql_query($sql);
    $ids = array();
    while (list($id, $fileupload, $fileimage) = $db->sql_fetchrow($result)) {
        $ids[] = $id;
        //Khong xao file vi co the co truong hop file dung chung
        /*
                if(!empty($fileupload))
                {
                $fileupload = explode("[NV]",$fileupload);
                
                foreach($fileupload as $file)
                {
                $file = substr($file,strlen(NV_BASE_SITEURL));
                if ( ! empty( $file ) and file_exists( NV_ROOTDIR . '/' . $file ) )
                {
                @nv_deletefile( NV_ROOTDIR . '/' . $file );
                }
                }
                }
        
                $fileimage = substr($array['fileimage'],strlen(NV_BASE_SITEURL));
                if ( ! empty( $fileimage ) and file_exists( NV_ROOTDIR . '/' . $fileimage ) )
                {
                @nv_deletefile( NV_ROOTDIR . '/' . $fileimage );
                }*/
    }
    if (!empty($ids)) {
        $ids = implode(",", $ids);
        $sql = "DELETE FROM `" . NV_PREFIXLANG . "_" . $module_data . "_comments` WHERE `fid` IN (" . $ids . ")";
        $db->sql_query($sql);
        $sql = "DELETE FROM `" . NV_PREFIXLANG . "_" . $module_data . "_report` WHERE `fid` IN (" . $ids . ")";
        $db->sql_query($sql);
    }
    $sql = "DELETE FROM `" . NV_PREFIXLANG . "_" . $module_data . "` WHERE `catid`=" . $catid;
    $db->sql_query($sql);
    $sql = "SELECT `id` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_categories` WHERE `parentid`=" . $catid;
    $result = $db->sql_query($sql);
    while (list($id) = $db->sql_fetchrow($result)) {
        nv_del_cat($id);
    }
    $sql = "DELETE FROM `" . NV_PREFIXLANG . "_" . $module_data . "_categories` WHERE `id`=" . $catid;
    $db->sql_query($sql);
    nv_insert_logs(NV_LANG_DATA, $module_data, "Delete Category", $title, $admin_info['userid']);
}
Esempio n. 5
0
function nv_del_cat($catid, $db, $module_data, $BL)
{
    global $admin_info;
    $sql = "SELECT parentid, title FROM " . $BL->table_prefix . "_categories WHERE id=" . $catid;
    list($parentid, $catTitle) = $db->query($sql)->fetch(3);
    $sql = "SELECT id FROM " . $BL->table_prefix . "_categories WHERE parentid=" . $catid;
    $result = $db->query($sql);
    while (list($id) = $result->fetch(3)) {
        nv_del_cat($id, $db, $module_data, $BL);
    }
    // Xoa bang danh muc
    $sql = "DELETE FROM " . $BL->table_prefix . "_categories WHERE id=" . $catid;
    $db->query($sql);
    // Cap nhat thong ke danh muc
    $BL->fixCat($parentid);
    // Ghi nhat ky
    nv_insert_logs(NV_LANG_DATA, $module_data, $BL->lang('categoriesDelete'), $catTitle, $admin_info['userid']);
}
Esempio n. 6
0
/**
 * nv_del_cat()
 *
 * @param mixed $catid
 * @return
 */
function nv_del_cat($catid)
{
    global $db, $module_name, $module_data, $admin_info, $nv_Cache;
    $sql = 'SELECT parentid, title FROM ' . NV_MOD_TABLE . '_categories WHERE id=' . $catid;
    list($p, $title) = $db->query($sql)->fetch(3);
    $sql = 'SELECT id, fileimage FROM ' . NV_MOD_TABLE . ' WHERE catid=' . $catid;
    $result = $db->query($sql);
    $ids = array();
    while (list($id, $fileimage) = $result->fetch(3)) {
        $ids[] = $id;
        nv_delete_notification(NV_LANG_DATA, $module_name, 'report', $id);
    }
    if (!empty($ids)) {
        $ids = implode(',', $ids);
        $sql = 'DELETE FROM ' . NV_PREFIXLANG . '_comment WHERE module=' . $db->quote($module_name) . ' AND id IN (' . $ids . ')';
        $db->query($sql);
        $sql = 'DELETE FROM ' . NV_MOD_TABLE . '_report WHERE fid IN (' . $ids . ')';
        $db->query($sql);
        $sql = 'DELETE FROM ' . NV_MOD_TABLE . '_detail WHERE id IN (' . $ids . ')';
        $db->query($sql);
        $sql = 'DELETE FROM ' . NV_MOD_TABLE . '_files WHERE download_id IN (' . $ids . ')';
        $db->query($sql);
        $sql = 'SELECT * FROM ' . NV_MOD_TABLE . '_tags_id WHERE id IN (' . $ids . ')';
        $result = $db->query($sql);
        while ($row = $result->fetch()) {
            $sql = 'UPDATE ' . NV_MOD_TABLE . '_tags SET numdownload=numdownload-1 WHERE did=' . $row['did'];
            $db->query($sql);
        }
        $sql = 'DELETE FROM ' . NV_MOD_TABLE . '_tags_id WHERE id IN (' . $ids . ')';
        $db->query($sql);
    }
    $sql = 'DELETE FROM ' . NV_MOD_TABLE . ' WHERE catid=' . $catid;
    $db->query($sql);
    $sql = 'SELECT id FROM ' . NV_MOD_TABLE . '_categories WHERE parentid=' . $catid;
    $result = $db->query($sql);
    while (list($id) = $result->fetch(3)) {
        nv_del_cat($id);
    }
    $sql = 'DELETE FROM ' . NV_MOD_TABLE . '_categories WHERE id=' . $catid;
    $db->query($sql);
    $nv_Cache->delMod($module_name);
    nv_insert_logs(NV_LANG_DATA, $module_data, 'Delete Category', $title, $admin_info['userid']);
}