$data_insert['title'] = $title; $data_insert['titlesite'] = $titlesite; $data_insert['alias'] = $alias; $data_insert['description'] = $description; $data_insert['descriptionhtml'] = $descriptionhtml; $data_insert['weight'] = $weight; $data_insert['viewcat'] = $viewcat; $data_insert['subcatid'] = $subcatid; $data_insert['keywords'] = $keywords; $data_insert['admins'] = $admins; $data_insert['groups_view'] = $groups_view; $data_insert['featured'] = $featured; $newcatid = $db->insert_id($sql, 'catid', $data_insert); if ($newcatid > 0) { require_once NV_ROOTDIR . '/includes/action_' . $db->dbtype . '.php'; nv_copy_structure_table(NV_PREFIXLANG . '_' . $module_data . '_' . $newcatid, NV_PREFIXLANG . '_' . $module_data . '_rows'); nv_fix_cat_order(); if (!defined('NV_IS_ADMIN_MODULE')) { $db->query('INSERT INTO ' . NV_PREFIXLANG . '_' . $module_data . '_admins (userid, catid, admin, add_content, pub_content, edit_content, del_content) VALUES (' . $admin_id . ', ' . $newcatid . ', 1, 1, 1, 1, 1)'); } nv_del_moduleCache($module_name); nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['add_cat'], $title, $admin_info['userid']); Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&parentid=' . $parentid); die; } else { $error = $lang_module['errorsave']; } } elseif ($catid > 0 and $title != '') { $stmt = $db->prepare('UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_cat SET parentid= :parentid, title= :title, titlesite=:titlesite, alias = :alias, description = :description, descriptionhtml = :descriptionhtml, image= :image, viewdescription= :viewdescription,featured=:featured, keywords= :keywords, groups_view= :groups_view, edit_time=' . NV_CURRENTTIME . ' WHERE catid =' . $catid); $stmt->bindParam(':parentid', $parentid, PDO::PARAM_INT); $stmt->bindParam(':title', $title, PDO::PARAM_STR);
$db->query("INSERT " . NV_PREFIXLANG . "_" . $mod_data . "_cat (`catid`, `parentid`, `title`, `titlesite`, `alias`, `description`, `image`, `weight`, `sort`, `lev`, `viewcat`, `numsubcat`, `subcatid`, `inhome`, `numlinks`, `keywords`, `admins`, `add_time`, `edit_time`, `groups_view`) SELECT `catid`, `parentid`, `title`, `titlesite`, `alias`, `description`, `image`, `weight`, `order`, `lev`, `viewcat`, `numsubcat`, `subcatid`, `inhome`, `numlinks`, `keywords`, `admins`, `add_time`, `edit_time`, `groups_view` FROM " . NV_PREFIXLANG3 . "_" . $mod_data3 . "_cat"); $db->query("INSERT " . NV_PREFIXLANG . "_" . $mod_data . "_admins ( `userid`, `catid`, `admin`, `add_content`, `pub_content`, `edit_content`, `del_content`) SELECT `userid`, `catid`, `admin`, `add_content`, `pub_content`, `edit_content`, `del_content` FROM " . NV_PREFIXLANG3 . "_" . $mod_data3 . "_admins"); // Fetch Assoc $_sql = 'SELECT * FROM ' . NV_PREFIXLANG3 . '_' . $mod_data3 . '_cat'; $_query = $db->query($_sql); while ($row = $_query->fetch()) { if ($row['who_view'] == 1) { $groups_view = '2'; } if ($row['who_view'] == 2) { $groups_view = '3'; } else { $groups_view = '6'; } $db->query("UPDATE " . NV_PREFIXLANG . "_" . $mod_data . "_cat SET `viewdescription` = 0, `newday` = 3, `groups_view` = " . $groups_view . " WHERE catid=" . $row['catid']); nv_copy_structure_table(NV_PREFIXLANG . '_' . $mod_data . '_' . $row['catid'], NV_PREFIXLANG . '_' . $mod_data . '_rows'); } } catch (PDOException $e) { die($e->getMessage()); } try { $array_thumb_config = array(); $array_thumb_config[''] = array('did' => 0, 'dirname' => '', 'time' => 0, 'thumb_type' => 3, 'thumb_width' => 100, 'thumb_height' => 150, 'thumb_quality' => 90); $aray_table_bodyhtml = array(); $_query = $db->query('SELECT * FROM ' . NV_PREFIXLANG3 . '_' . $mod_data3 . '_rows'); while ($item = $_query->fetch()) { $array_img = !empty($item['homeimgthumb']) ? explode("|", $item['homeimgthumb']) : ($array_img = array("", "")); $homeimgthumb = 0; if ($item['homeimgfile'] != "" and file_exists(NV_UPLOADS_REAL_DIR . '/' . $mod_name . '/' . $item['homeimgfile']) and $array_img[0] != "" and file_exists(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $mod_name . '/' . $array_img[0])) { $path = dirname($item['homeimgfile']); if (!empty($path)) {
$db->query("DELETE FROM " . $db_config['prefix'] . "_setup_extensions WHERE basename NOT IN ('" . implode("', '", $modules_exit) . "') AND type='module'"); //xoa du lieu tai bang nvx_vi_blocks_groups $db->query('DELETE FROM ' . $db_config['prefix'] . '_' . $lang_data . '_blocks_groups WHERE module!=\'theme\' AND module NOT IN (SELECT title FROM ' . $db_config['prefix'] . '_' . $lang_data . '_modules)'); //xoa du lieu tai bang nvx_vi_blocks $db->query('DELETE FROM ' . $db_config['prefix'] . '_' . $lang_data . '_blocks_weight WHERE bid NOT IN (SELECT bid FROM ' . $db_config['prefix'] . '_' . $lang_data . '_blocks_groups)'); //xoa du lieu tai bang nvx_vi_modthemes $db->query('DELETE FROM ' . $db_config['prefix'] . '_' . $lang_data . '_modthemes WHERE func_id in (SELECT func_id FROM ' . $db_config['prefix'] . '_' . $lang_data . '_modfuncs WHERE in_module NOT IN (SELECT title FROM ' . $db_config['prefix'] . '_' . $lang_data . '_modules))'); //xoa du lieu tai bang nvx_vi_modfuncs $db->query('DELETE FROM ' . $db_config['prefix'] . '_' . $lang_data . '_modfuncs WHERE in_module NOT IN (SELECT title FROM ' . $db_config['prefix'] . '_' . $lang_data . '_modules)'); //xoa du lieu tai bang nvx_config $db->query("DELETE FROM " . $db_config['prefix'] . "_config WHERE lang= '" . $lang_data . "' AND module!='global' AND module NOT IN (SELECT title FROM " . $db_config['prefix'] . "_" . $lang_data . "_modules)"); $result = $db->query("SELECT COUNT(*) FROM " . $db_config['prefix'] . "_" . $lang_data . "_modules WHERE title='news'"); if ($result->fetchColumn()) { $result = $db->query('SELECT catid FROM ' . $db_config['prefix'] . '_' . $lang_data . '_news_cat ORDER BY sort ASC'); while (list($catid_i) = $result->fetch(3)) { nv_copy_structure_table($db_config['prefix'] . '_' . $lang_data . '_news_' . $catid_i, $db_config['prefix'] . '_' . $lang_data . '_news_rows'); } $result->closeCursor(); $result = $db->query('SELECT id, listcatid FROM ' . $db_config['prefix'] . '_' . $lang_data . '_news_rows ORDER BY id ASC'); while (list($id, $listcatid) = $result->fetch(3)) { $arr_catid = explode(',', $listcatid); foreach ($arr_catid as $catid) { $db->query('INSERT INTO ' . $db_config['prefix'] . '_' . $lang_data . '_news_' . $catid . ' SELECT * FROM ' . $db_config['prefix'] . '_' . $lang_data . '_news_rows WHERE id=' . $id); } } $result->closeCursor(); } } catch (PDOException $e) { include NV_ROOTDIR . '/includes/header.php'; echo nv_admin_theme('ERROR SETUP: <br />' . $e->getMessage()); include NV_ROOTDIR . '/includes/footer.php';
$data_insert['title'] = $title; $data_insert['titlesite'] = $titlesite; $data_insert['alias'] = $alias; $data_insert['description'] = $description; $data_insert['descriptionhtml'] = $descriptionhtml; $data_insert['weight'] = $weight; $data_insert['viewfam'] = $viewfam; $data_insert['subfid'] = $subfid; $data_insert['keywords'] = $keywords; $data_insert['admins'] = $admins; $data_insert['groups_view'] = $groups_view; $data_insert['featured'] = $featured; $newfid = $db->insert_id($sql, 'fid', $data_insert); if ($newfid > 0) { require_once NV_ROOTDIR . '/includes/action_' . $db->dbtype . '.php'; nv_copy_structure_table(NV_PREFIXLANG . '_' . $module_data . '_' . $newfid, NV_PREFIXLANG . '_' . $module_data . '_genealogy '); nv_fix_fam_order(); if (!defined('NV_IS_ADMIN_MODULE')) { $db->query('INSERT INTO ' . NV_PREFIXLANG . '_' . $module_data . '_admins (userid, fid, admin, add_content, pub_content, edit_content, del_content) VALUES (' . $admin_id . ', ' . $newfid . ', 1, 1, 1, 1, 1)'); } nv_del_moduleCache($module_name); nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['add_fam'], $title, $admin_info['userid']); Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&parentid=' . $parentid); die; } else { $error = $lang_module['errorsave']; } } elseif ($fid > 0 and $title != '') { $stmt = $db->prepare('UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_family SET parentid= :parentid, title= :title, titlesite=:titlesite, alias = :alias, description = :description, descriptionhtml = :descriptionhtml, image= :image, viewdescription= :viewdescription,featured=:featured, keywords= :keywords, groups_view= :groups_view, edit_time=' . NV_CURRENTTIME . ' WHERE fid =' . $fid); $stmt->bindParam(':parentid', $parentid, PDO::PARAM_INT); $stmt->bindParam(':title', $title, PDO::PARAM_STR);