/** * nv_set_status_module() * * @return */ function nv_set_status_module() { global $db, $module_name, $module_data, $global_config; $check_run_cronjobs = NV_ROOTDIR . '/' . NV_LOGS_DIR . '/data_logs/cronjobs_' . md5($module_data . 'nv_set_status_module' . $global_config['sitekey']) . '.txt'; $p = NV_CURRENTTIME - 300; if (file_exists($check_run_cronjobs) and @filemtime($check_run_cronjobs) > $p) { return; } file_put_contents($check_run_cronjobs, ''); //status_0 = "Cho duyet"; //status_1 = "Xuat ban"; //status_2 = "Hen gio dang"; //status_3= "Het han"; // Dang cai bai cho kich hoat theo thoi gian $query = $db->query('SELECT id, listcatid FROM ' . NV_PREFIXLANG . '_' . $module_data . '_rows WHERE status=2 AND publtime < ' . NV_CURRENTTIME . ' ORDER BY publtime ASC'); while (list($id, $listcatid) = $query->fetch(3)) { $array_catid = explode(',', $listcatid); foreach ($array_catid as $catid_i) { $catid_i = intval($catid_i); if ($catid_i > 0) { $db->query('UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_' . $catid_i . ' SET status=1 WHERE id=' . $id); } } $db->query('UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_rows SET status=1 WHERE id=' . $id); } // Ngung hieu luc cac bai da het han $query = $db->query('SELECT id, listcatid, archive FROM ' . NV_PREFIXLANG . '_' . $module_data . '_rows WHERE status=1 AND exptime > 0 AND exptime <= ' . NV_CURRENTTIME . ' ORDER BY exptime ASC'); while (list($id, $listcatid, $archive) = $query->fetch(3)) { if (intval($archive) == 0) { nv_del_content_module($id); } else { nv_archive_content_module($id, $listcatid); } } // Tim kiem thoi gian chay lan ke tiep $time_publtime = $db->query('SELECT min(publtime) FROM ' . NV_PREFIXLANG . '_' . $module_data . '_rows WHERE status=2 AND publtime > ' . NV_CURRENTTIME)->fetchColumn(); $time_exptime = $db->query('SELECT min(exptime) FROM ' . NV_PREFIXLANG . '_' . $module_data . '_rows WHERE status=1 AND exptime > ' . NV_CURRENTTIME)->fetchColumn(); $timecheckstatus = min($time_publtime, $time_exptime); if (!$timecheckstatus) { $timecheckstatus = max($time_publtime, $time_exptime); } $sth = $db->prepare("UPDATE " . NV_CONFIG_GLOBALTABLE . " SET config_value = :config_value WHERE lang = '" . NV_LANG_DATA . "' AND module = :module_name AND config_name = 'timecheckstatus'"); $sth->bindValue(':module_name', $module_name, PDO::PARAM_STR); $sth->bindValue(':config_value', intval($timecheckstatus), PDO::PARAM_STR); $sth->execute(); nv_del_moduleCache('settings'); nv_del_moduleCache($module_name); unlink($check_run_cronjobs); clearstatcache(); }
/** * nv_set_status_module() * * @return */ function nv_set_status_module() { global $db, $module_name, $module_data, $global_config; $check_run_cronjobs = NV_ROOTDIR . '/' . NV_LOGS_DIR . '/data_logs/cronjobs_' . md5($module_data . 'nv_set_status_module' . $global_config['sitekey']) . '.txt'; $p = NV_CURRENTTIME - 300; if (file_exists($check_run_cronjobs) and @filemtime($check_run_cronjobs) > $p) { return; } file_put_contents($check_run_cronjobs, ''); //status_0 = "Cho duyet"; //status_1 = "Xuat ban"; //status_2 = "Hen gio dang"; //status_3= "Het han"; // Dang cai bai cho kich hoat theo thoi gian $query = $db->sql_query("SELECT `id`, `listcatid` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `status`=2 AND `publtime` < " . NV_CURRENTTIME . " ORDER BY `publtime` ASC"); while (list($id, $listcatid) = $db->sql_fetchrow($query)) { $array_catid = explode(",", $listcatid); foreach ($array_catid as $catid_i) { $catid_i = intval($catid_i); if ($catid_i > 0) { $db->sql_query("UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_" . $catid_i . "` SET `status`='1' WHERE `id`=" . $id . ""); } } $db->sql_query("UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_rows` SET `status`='1' WHERE `id`=" . $id . ""); } // Ngung hieu luc cac bai da het han $query = $db->sql_query("SELECT `id`, `listcatid`, `archive` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `status`=1 AND `exptime` > 0 AND `exptime` <= " . NV_CURRENTTIME . " ORDER BY `exptime` ASC"); while (list($id, $listcatid, $archive) = $db->sql_fetchrow($query)) { if (intval($archive) == 0) { nv_del_content_module($id); } else { nv_archive_content_module($id, $listcatid); } } // Tim kiem thoi gian chay lan ke tiep list($time_publtime) = $db->sql_fetchrow($db->sql_query("SELECT min(publtime) FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `status`=2 AND `publtime` > " . NV_CURRENTTIME)); list($time_exptime) = $db->sql_fetchrow($db->sql_query("SELECT min(exptime) FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `status`=1 AND `exptime` > " . NV_CURRENTTIME)); $timecheckstatus = min($time_publtime, $time_exptime); if (!$timecheckstatus) { $timecheckstatus = max($time_publtime, $time_exptime); } $db->sql_query("REPLACE INTO `" . NV_CONFIG_GLOBALTABLE . "` (`lang`, `module`, `config_name`, `config_value`) VALUES('" . NV_LANG_DATA . "', " . $db->dbescape($module_name) . ", 'timecheckstatus', '" . intval($timecheckstatus) . "')"); nv_del_moduleCache('settings'); nv_del_moduleCache($module_name); unlink($check_run_cronjobs); clearstatcache(); }
/** * @Project NUKEVIET 4.x * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2014 VINADES.,JSC. All rights reserved * @License GNU/GPL version 2 or any later version * @Createdate 2-10-2010 18:49 */ if (!defined('NV_IS_FILE_ADMIN')) { die('Stop!!!'); } $id = $nv_Request->get_int('id', 'post', 0); $checkss = $nv_Request->get_string('checkss', 'post', ''); $listid = $nv_Request->get_string('listid', 'post', ''); $contents = "NO_" . $id; if ($listid != "" and md5($global_config['sitekey'] . session_id()) == $checkss) { $del_array = array_map("intval", explode(",", $listid)); foreach ($del_array as $id) { if ($id > 0) { $contents = nv_del_content_module($id); } } nv_insert_logs(NV_LANG_DATA, $module_name, 'log_del_product', "id " . $listid, $admin_info['userid']); } elseif (md5($id . session_id()) == $checkss) { $contents = nv_del_content_module($id); nv_insert_logs(NV_LANG_DATA, $module_name, 'log_del_product', "id " . $id, $admin_info['userid']); } nv_set_status_module(); $nv_Cache->delMod($module_name); include NV_ROOTDIR . '/includes/header.php'; echo $contents; include NV_ROOTDIR . '/includes/footer.php';
$xtpl->assign('OP', $op); $xtpl->assign('CATID', $catid); $xtpl->assign('DELALLCHECKSS', $delallcheckss); $xtpl->assign('TITLE', sprintf($lang_module['delcat_msg_rows_select'], $title, $check_rows)); while (list($catid_i, $title_i) = each($array_cat_list)) { $xtpl->assign('CATIDNEWS', array("key" => $catid_i, "title" => $title_i)); $xtpl->parse('main.catidnews'); } $xtpl->parse('main'); $contents = $xtpl->text('main'); } elseif (!empty($delcatandrows)) { nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['delcatandrows'], $title, $admin_info['userid']); $sql = $db->sql_query("SELECT `id`, `catid`, `listcatid` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_" . $catid . "`"); while ($row = $db->sql_fetchrow($sql)) { if ($row['catid'] == $row['listcatid']) { nv_del_content_module($row['id']); } else { $arr_catid_old = explode(",", $row['listcatid']); $arr_catid_i = array($catid); $arr_catid_news = array_diff($arr_catid_old, $arr_catid_i); if ($catid == $row['catid']) { $row['catid'] = $arr_catid_news[0]; } foreach ($arr_catid_news as $catid_i) { $db->sql_query("UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_" . $catid_i . "` SET `catid`=" . $row['catid'] . ", `listcatid` = '" . implode(",", $arr_catid_news) . "' WHERE `id` =" . $row['id']); } $db->sql_query("UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_rows` SET `catid`=" . $row['catid'] . ", `listcatid` = '" . implode(",", $arr_catid_news) . "' WHERE `id` =" . $row['id']); } } $db->sql_query("DROP TABLE `" . NV_PREFIXLANG . "_" . $module_data . "_" . $catid . "`"); $db->sql_query("DELETE FROM `" . NV_PREFIXLANG . "_" . $module_data . "_cat` WHERE `catid`=" . $catid);
echo $alias; include NV_ROOTDIR . '/includes/footer.php'; } $contentid = $nv_Request->get_int('contentid', 'get,post', 0); $fcheckss = $nv_Request->get_title('checkss', 'get,post', ''); $checkss = md5($contentid . $client_info['session_id'] . $global_config['sitekey']); if ($nv_Request->isset_request('contentid', 'get,post') and $fcheckss == $checkss) { if ($contentid > 0) { $rowcontent_old = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_rows where id=' . $contentid . ' and admin_id= ' . $user_info['userid'])->fetch(); $contentid = isset($rowcontent_old['id']) ? intval($rowcontent_old['id']) : 0; if (empty($contentid)) { Header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op, true)); die; } if ($nv_Request->get_int('delcontent', 'get') and (empty($rowcontent_old['status']) or $array_post_user['delcontent'])) { nv_del_content_module($contentid); $user_content = defined('NV_IS_USER') ? ' | ' . $user_info['username'] : ''; nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['del_content'], $contentid . ' | ' . $client_info['ip'] . $user_content, 0); if ($rowcontent_old['status'] == 1) { $nv_Cache->delMod($module_name); } Header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op, true)); die; } elseif (!(empty($rowcontent_old['status']) or $array_post_user['editcontent'])) { Header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op, true)); die; } $page_title = $lang_module['update_content']; } else { $page_title = $lang_module['add_content']; }
$xtpl->assign('OP', $op); $xtpl->assign('GROUPID', $groupid); $xtpl->assign('DELALLCHECKSS', $delallcheckss); $xtpl->assign('INFO', sprintf($lang_module['delgroup_msg_rows_select'], $title, $check_rows)); while (list($groupid_i, $title_i) = each($array_group_list)) { $xtpl->assign('GROUP_ID', $groupid_i); $xtpl->assign('GROUP_TITLE', $title_i); $xtpl->parse('main.grouploop'); } $xtpl->parse('main'); $contents = $xtpl->text('main'); } elseif (!empty($delgroupandrows)) { $result = $db->query("SELECT pro_id FROM " . $db_config['prefix'] . "_" . $module_data . "_group_items WHERE group_id='" . $groupid . "'"); while ($row = $result->fetch()) { // Xoa san pham nv_del_content_module($row['pro_id']); } // Xoa nhom nv_del_group($groupid); // Xoa cua loai san pham $db->query("DELETE FROM " . $db_config['prefix'] . "_" . $module_data . "_group_cateid WHERE groupid=" . $groupid); nv_fix_group_order(); $nv_Cache->delMod($module_name); Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=group&parentid=" . $parentid); die; } elseif (!empty($movegroup) and $groupidnews > 0 and $groupidnews != $groupid) { $groupidnews = $db->query("SELECT groupid FROM " . $db_config['prefix'] . "_" . $module_data . "_group WHERE groupid=" . $groupidnews)->fetchColumn(); if ($groupidnews > 0) { $result = $db->query("SELECT pro_id FROM " . $db_config['prefix'] . "_" . $module_data . "_group_items WHERE group_id='" . $groupid . "'"); while ($row = $result->fetch()) { $count = $db->query('SELECT COUNT(*) FROM ' . $db_config['prefix'] . '_' . $module_data . '_group_items WHERE group_id=' . $groupidnews . ' AND pro_id=' . $row['pro_id'])->fetchColumn();
/** * nv_set_status_module() * * @return */ function nv_set_status_module() { global $db, $module_name, $module_data, $global_config, $db_config; $check_run_cronjobs = NV_ROOTDIR . '/' . NV_LOGS_DIR . '/data_logs/cronjobs_' . md5($module_data . 'nv_set_status_module' . $global_config['sitekey']) . '.txt'; $p = NV_CURRENTTIME - 300; if (file_exists($check_run_cronjobs) and @filemtime($check_run_cronjobs) > $p) { return; } file_put_contents($check_run_cronjobs, ''); // status_0 = "Cho duyet"; // status_1 = "Xuat ban"; // status_2 = "Hen gio dang"; // status_3= "Het han"; // Dang cac san pham cho kich hoat theo thoi gian $result = $db->query('SELECT id FROM ' . $db_config['prefix'] . '_' . $module_data . '_rows WHERE status =2 AND publtime < ' . NV_CURRENTTIME . ' ORDER BY publtime ASC'); while (list($id) = $result->fetch(3)) { $db->query('UPDATE ' . $db_config['prefix'] . '_' . $module_data . '_rows SET status =1 WHERE id=' . $id); } // Ngung hieu luc cac san pham da het han $result = $db->query('SELECT id, archive FROM ' . $db_config['prefix'] . '_' . $module_data . '_rows WHERE status =1 AND exptime > 0 AND exptime <= ' . NV_CURRENTTIME . ' ORDER BY exptime ASC'); while (list($id, $archive) = $result->fetch(3)) { if (intval($archive) == 0) { nv_del_content_module($id); } else { nv_archive_content_module($id); } } // Tim kiem thoi gian chay lan ke tiep $time_publtime = $db->query('SELECT MIN(publtime) FROM ' . $db_config['prefix'] . '_' . $module_data . '_rows WHERE status =2 AND publtime > ' . NV_CURRENTTIME)->fetchColumn(); $time_exptime = $db->query('SELECT MIN(exptime) FROM ' . $db_config['prefix'] . '_' . $module_data . '_rows WHERE status =1 AND exptime > ' . NV_CURRENTTIME)->fetchColumn(); $timecheckstatus = min($time_publtime, $time_exptime); if (!$timecheckstatus) { $timecheckstatus = max($time_publtime, $time_exptime); } $db->query("REPLACE INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES('" . NV_LANG_DATA . "', " . $db->quote($module_name) . ", 'timecheckstatus', '" . intval($timecheckstatus) . "')"); $nv_Cache->delMod('settings'); $nv_Cache->delMod($module_name); unlink($check_run_cronjobs); clearstatcache(); }