本文整理汇总了PHP中nv_del_moduleCache函数的典型用法代码示例。如果您正苦于以下问题:PHP nv_del_moduleCache函数的具体用法?PHP nv_del_moduleCache怎么用?PHP nv_del_moduleCache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nv_del_moduleCache函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: nv_set_layout_site
function nv_set_layout_site()
{
global $db, $global_config;
$array_layout_func_data = array();
$fnsql = "SELECT `func_id`, `layout`, `theme` FROM `" . NV_PREFIXLANG . "_modthemes`";
$fnresult = $db->sql_query($fnsql);
while (list($func_id, $layout, $theme) = $db->sql_fetchrow($fnresult)) {
$array_layout_func_data[$theme][$func_id] = $layout;
}
$func_id_mods = array();
$sql = "SELECT `func_id`, `in_module` FROM `" . NV_MODFUNCS_TABLE . "` WHERE `show_func`='1' ORDER BY `in_module` ASC, `subweight` ASC";
$result = $db->sql_query($sql);
while (list($func_id, $in_module) = $db->sql_fetchrow($result)) {
$func_id_mods[$in_module][] = $func_id;
}
$sql = "SELECT title, theme FROM `" . NV_MODULES_TABLE . "` ORDER BY `weight` ASC";
$result = $db->sql_query($sql);
$is_delCache = false;
while (list($title, $theme) = $db->sql_fetchrow($result)) {
if (isset($func_id_mods[$title])) {
if (empty($theme)) {
$theme = $global_config['site_theme'];
}
foreach ($func_id_mods[$title] as $func_id) {
$layout = isset($array_layout_func_data[$theme][$func_id]) ? $array_layout_func_data[$theme][$func_id] : $array_layout_func_data[$theme][0];
$db->sql_query("UPDATE `" . NV_MODFUNCS_TABLE . "` SET `layout`=" . $db->dbescape($layout) . " WHERE `func_id`=" . $func_id . "");
$is_delCache = true;
}
}
}
if ($is_delCache) {
nv_del_moduleCache('modules');
}
}
开发者ID:syphuonglam,项目名称:creative-portal,代码行数:34,代码来源:admin_functions.php
示例2: nv_del_cat
/**
* nv_del_cat()
*
* @param mixed $catid
* @return
*/
function nv_del_cat($catid)
{
global $db, $module_name, $module_data, $admin_info;
$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_del_moduleCache($module_name);
nv_insert_logs(NV_LANG_DATA, $module_data, 'Delete Category', $title, $admin_info['userid']);
}
开发者ID:ThinhNguyenVB,项目名称:module-download,代码行数:36,代码来源:cat.php
示例3: nv_fix_subweight
function nv_fix_subweight($mod)
{
global $db;
$sql = "SELECT `func_id` FROM `" . NV_MODFUNCS_TABLE . "` WHERE `in_module`=" . $db->dbescape($mod) . " AND `show_func`='1' ORDER BY `subweight` ASC";
$result = $db->sql_query($sql);
$subweight = 0;
while ($row = $db->sql_fetchrow($result)) {
$subweight++;
$sql = "UPDATE `" . NV_MODFUNCS_TABLE . "` SET `subweight`=" . $subweight . " WHERE `func_id`=" . $row['func_id'];
$db->sql_query($sql);
nv_del_moduleCache('modules');
}
}
开发者ID:syphuonglam,项目名称:creative-portal,代码行数:13,代码来源:functions.php
示例4: nv_set_status_module
/**
* 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();
}
开发者ID:anhtunguyen,项目名称:vietnamguide,代码行数:55,代码来源:global.functions.php
示例5: nv_set_status_module
/**
* 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();
}
开发者ID:atarubi,项目名称:nuke-viet,代码行数:52,代码来源:global.functions.php
示例6: die
* @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!!!');
}
$payment = $nv_Request->get_string('oid', 'post', '');
$new_weight = $nv_Request->get_int('w', 'post', 0);
$content = "NO_" . $payment;
$table = $db_config['prefix'] . "_" . $module_data . "_payment";
$stmt = $db->prepare("SELECT payment, weight FROM " . $table . " WHERE payment= :payment");
$stmt->bindParam(':payment', $payment, PDO::PARAM_STR);
$stmt->execute();
list($payment, $weight_old) = $stmt->fetch(3);
if (!empty($payment)) {
$sql = "SELECT payment FROM " . $table . " WHERE weight = " . intval($new_weight);
$result = $db->query($sql);
$payment_swap = $result->fetchColumn();
$stmt = $db->prepare("UPDATE " . $table . " SET weight=" . $new_weight . " WHERE payment= :payment");
$stmt->bindParam(':payment', $payment, PDO::PARAM_STR);
$stmt->execute();
$stmt = $db->prepare("UPDATE " . $table . " SET weight=" . $weight_old . " WHERE payment= :payment");
$stmt->bindParam(':payment', $payment, PDO::PARAM_STR);
$stmt->execute();
$content = "OK_" . $payment;
nv_del_moduleCache($payment);
}
include NV_ROOTDIR . '/includes/header.php';
echo $content;
include NV_ROOTDIR . '/includes/footer.php';
开发者ID:hoangvtien,项目名称:module-shops,代码行数:31,代码来源:changepay.php
示例7: nv_groups_list_pub
/**
* nv_groups_list_pub()
*
* @return
*/
function nv_groups_list_pub()
{
global $db;
$query = "SELECT `group_id`, `title`, `exp_time`, `public` FROM `" . NV_GROUPS_GLOBALTABLE . "` WHERE `act`=1 ORDER BY `weight`";
$list = nv_db_cache($query, '', 'users');
if (empty($list)) {
return array();
}
$groups = array();
$reload = array();
for ($i = 0, $count = sizeof($list); $i < $count; ++$i) {
if ($list[$i]['exp_time'] != 0 and $list[$i]['exp_time'] <= NV_CURRENTTIME) {
$reload[] = $list[$i]['group_id'];
} elseif ($list[$i]['public']) {
$groups[$list[$i]['group_id']] = $list[$i]['title'];
}
}
if ($reload) {
$sql = "UPDATE `" . NV_GROUPS_GLOBALTABLE . "` SET `act`='0' WHERE `group_id` IN (" . implode(",", $reload) . ")";
$db->sql_query($sql);
nv_del_moduleCache('users');
}
return $groups;
}
开发者ID:atarubi,项目名称:nuke-viet,代码行数:29,代码来源:user_functions.php
示例8: die
<?php
/**
* @Project NUKEVIET 3.x
* @Author VINADES.,JSC ([email protected])
* @Copyright (C) 2012 VINADES.,JSC. All rights reserved
* @Createdate 2-10-2010 17:30
*/
if (!defined('NV_IS_FILE_MODULES')) {
die('Stop!!!');
}
$mod = filter_text_input('mod', 'post');
if (empty($mod) or !preg_match($global_config['check_module'], $mod)) {
die("NO_" . $mod);
}
$sql = "SELECT `submenu` FROM `" . NV_MODULES_TABLE . "` WHERE `title`=" . $db->dbescape($mod);
$result = $db->sql_query($sql);
$numrows = $db->sql_numrows($result);
if ($numrows != 1) {
die('NO_' . $mod);
}
$row = $db->sql_fetchrow($result);
$submenu = $row['submenu'] ? 0 : 1;
$sql = "UPDATE `" . NV_MODULES_TABLE . "` SET `submenu`=" . $submenu . " WHERE `title`=" . $db->dbescape($mod);
$db->sql_query($sql);
nv_del_moduleCache('modules');
include NV_ROOTDIR . "/includes/header.php";
echo 'OK_' . $mod;
include NV_ROOTDIR . "/includes/footer.php";
开发者ID:atarubi,项目名称:nuke-viet,代码行数:29,代码来源:change_submenu.php
示例9: die
if (!$db->sql_query($sql)) {
die('NO_' . $modname);
}
}
}
}
// Xoa du lieu tai bang nv3_vi_blocks
$sql = "DELETE FROM `" . NV_BLOCKS_TABLE . "_weight` WHERE `bid` in (SELECT `bid` FROM `" . NV_BLOCKS_TABLE . "_groups` WHERE `module`=" . $db->dbescape($modname) . ")";
if (!$db->sql_query($sql)) {
die('NO_' . $modname);
}
$sql = "DELETE FROM `" . NV_BLOCKS_TABLE . "_groups` WHERE `module`=" . $db->dbescape($modname);
if (!$db->sql_query($sql)) {
die('NO_' . $modname);
}
nv_del_moduleCache("themes");
$sql = "DELETE FROM `" . NV_PREFIXLANG . "_modthemes` WHERE `func_id` IN (SELECT `func_id` FROM `" . NV_MODFUNCS_TABLE . "` WHERE `in_module`=" . $db->dbescape($modname) . ")";
if (!$db->sql_query($sql)) {
die('NO_' . $modname);
}
// Xoa du lieu tai bang nv3_vi_modfuncs
$sql = "DELETE FROM `" . NV_MODFUNCS_TABLE . "` WHERE `in_module`=" . $db->dbescape($modname);
if (!$db->sql_query($sql)) {
die('NO_' . $modname);
}
// Xoa du lieu tai bang nv3_vi_modules
$sql = "DELETE FROM `" . NV_MODULES_TABLE . "` WHERE `title`=" . $db->dbescape($modname);
if (!$db->sql_query($sql)) {
die('NO_' . $modname);
}
// Xoa du lieu tai bang nv3_config
开发者ID:atarubi,项目名称:nuke-viet,代码行数:31,代码来源:del.php
示例10: while
$sth->bindParam(':theme', $theme, PDO::PARAM_STR);
$sth->bindParam(':position', $pos_new, PDO::PARAM_STR);
$sth->execute();
$weight = 0;
while (list($bid_i) = $sth->fetch(3)) {
++$weight;
$db->query('UPDATE ' . NV_BLOCKS_TABLE . '_groups SET weight=' . $weight . ' WHERE bid=' . $bid_i);
}
if ($weight) {
$func_id_old = $weight = 0;
$sth = $db->prepare('SELECT t1.bid, t1.func_id FROM ' . NV_BLOCKS_TABLE . '_weight t1 INNER JOIN ' . NV_BLOCKS_TABLE . '_groups t2 ON t1.bid = t2.bid WHERE t2.theme=:theme AND t2.position=:position ORDER BY t1.func_id ASC, t1.weight ASC');
$sth->bindParam(':theme', $theme, PDO::PARAM_STR);
$sth->bindParam(':position', $pos_new, PDO::PARAM_STR);
$sth->execute();
while (list($bid_i, $func_id_i) = $sth->fetch(3)) {
if ($func_id_i == $func_id_old) {
++$weight;
} else {
$weight = 1;
$func_id_old = $func_id_i;
}
$db->query('UPDATE ' . NV_BLOCKS_TABLE . '_weight SET weight=' . $weight . ' WHERE bid=' . $bid_i . ' AND func_id=' . $func_id_i);
}
}
nv_del_moduleCache('themes');
$db->query('OPTIMIZE TABLE ' . NV_BLOCKS_TABLE . '_groups');
$db->query('OPTIMIZE TABLE ' . NV_BLOCKS_TABLE . '_weight');
echo $lang_module['block_update_success'];
} else {
echo 'ERROR';
}
开发者ID:lzhao18,项目名称:nukeviet,代码行数:31,代码来源:blocks_change_pos.php
示例11: unset
$property['background_repeat'] = $nv_Request->get_title('block_heading_background_repeat', 'post', '');
$property['background_position'] = $nv_Request->get_title('block_heading_background_position', 'post', '');
$config_theme['block_heading'] = $property;
unset($property);
// General css
$config_theme['generalcss'] = nv_unhtmlspecialchars($nv_Request->get_textarea('generalcss', 'post', ''));
$config_value = serialize($config_theme);
if (isset($module_config['themes'][$selectthemes])) {
$sth = $db->prepare("UPDATE " . NV_CONFIG_GLOBALTABLE . " SET config_value= :config_value WHERE config_name = :config_name AND lang = '" . NV_LANG_DATA . "' AND module='themes'");
} else {
$sth = $db->prepare("INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('" . NV_LANG_DATA . "', 'themes', :config_name, :config_value)");
}
$sth->bindParam(':config_name', $selectthemes, PDO::PARAM_STR);
$sth->bindParam(':config_value', $config_value, PDO::PARAM_STR, strlen($config_value));
$sth->execute();
nv_del_moduleCache('settings');
if (file_exists(NV_ROOTDIR . "/" . SYSTEM_FILES_DIR . "/css/theme_" . $selectthemes . "_" . $global_config['idsite'] . ".css")) {
nv_deletefile(NV_ROOTDIR . "/" . SYSTEM_FILES_DIR . "/css/theme_" . $selectthemes . "_" . $global_config['idsite'] . ".css");
}
Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&selectthemes=' . $selectthemes . '&rand=' . nv_genpass());
die;
} elseif (isset($module_config['themes'][$selectthemes])) {
$config_theme = unserialize($module_config['themes'][$selectthemes]);
} else {
require NV_ROOTDIR . '/themes/' . $selectthemes . '/config_default.php';
}
$xtpl = new XTemplate('config.tpl', NV_ROOTDIR . '/themes/' . $selectthemes . '/system/');
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('NV_LANG_VARIABLE', NV_LANG_VARIABLE);
$xtpl->assign('NV_LANG_DATA', NV_LANG_DATA);
$xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL);
开发者ID:hongoctrien,项目名称:themes-newszine,代码行数:31,代码来源:config.php
示例12: nv_setup_block_module
/**
* nv_setup_block_module()
*
* @param mixed $mod
* @param integer $func_id
* @return
*/
function nv_setup_block_module($mod, $func_id = 0)
{
global $db;
if (empty($func_id)) {
//xoa du lieu tai bang blocks
$sth = $db->prepare('DELETE FROM ' . NV_BLOCKS_TABLE . '_weight WHERE bid in (SELECT bid FROM ' . NV_BLOCKS_TABLE . '_groups WHERE module= :module)');
$sth->bindParam(':module', $mod, PDO::PARAM_STR);
$sth->execute();
$sth = $db->prepare('DELETE FROM ' . NV_BLOCKS_TABLE . '_groups WHERE module= :module');
$sth->bindParam(':module', $mod, PDO::PARAM_STR);
$sth->execute();
$sth = $db->prepare('DELETE FROM ' . NV_BLOCKS_TABLE . '_weight WHERE func_id in (SELECT func_id FROM ' . NV_MODFUNCS_TABLE . ' WHERE in_module= :module)');
$sth->bindParam(':module', $mod, PDO::PARAM_STR);
$sth->execute();
}
$array_funcid = array();
$sth = $db->prepare('SELECT func_id FROM ' . NV_MODFUNCS_TABLE . ' WHERE show_func = 1 AND in_module= :module ORDER BY subweight ASC');
$sth->bindParam(':module', $mod, PDO::PARAM_STR);
$sth->execute();
while (list($func_id_i) = $sth->fetch(3)) {
if ($func_id == 0 or $func_id == $func_id_i) {
$array_funcid[] = $func_id_i;
}
}
$weight = 0;
$old_theme = $old_position = '';
$sql = 'SELECT bid, theme, position FROM ' . NV_BLOCKS_TABLE . '_groups WHERE all_func= 1 ORDER BY theme ASC, position ASC, weight ASC';
$result = $db->query($sql);
while ($row = $result->fetch()) {
if ($old_theme == $row['theme'] and $old_position == $row['position']) {
++$weight;
} else {
$weight = 1;
$old_theme = $row['theme'];
$old_position = $row['position'];
}
foreach ($array_funcid as $func_id) {
$db->query('INSERT INTO ' . NV_BLOCKS_TABLE . '_weight (bid, func_id, weight) VALUES (' . $row['bid'] . ', ' . $func_id . ', ' . $weight . ')');
}
}
nv_del_moduleCache('themes');
}
开发者ID:lzhao18,项目名称:nukeviet,代码行数:49,代码来源:functions.php
示例13: nv_block_voting
/**
* nv_block_voting()
*
* @return
*/
function nv_block_voting()
{
global $db, $my_footer, $site_mods, $global_config, $client_info;
$content = '';
if (!isset($site_mods['voting'])) {
return '';
}
$sql = 'SELECT vid, question, link, acceptcm, groups_view, publ_time, exp_time FROM ' . NV_PREFIXLANG . '_' . $site_mods['voting']['module_data'] . ' WHERE act=1';
$list = nv_db_cache($sql, 'vid', 'voting');
if (empty($list)) {
return '';
}
$allowed = array();
$is_update = array();
$a = 0;
foreach ($list as $row) {
if ($row['exp_time'] > 0 and $row['exp_time'] < NV_CURRENTTIME) {
$is_update[] = $row['vid'];
} elseif ($row['publ_time'] <= NV_CURRENTTIME and nv_user_in_groups($row['groups_view'])) {
$allowed[$a] = $row;
++$a;
}
}
if (!empty($is_update)) {
$is_update = implode(',', $is_update);
$sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $site_mods['voting']['module_data'] . ' SET act=0 WHERE vid IN (' . $is_update . ')';
$db->query($sql);
nv_del_moduleCache('voting');
}
if ($allowed) {
--$a;
$rand = rand(0, $a);
$current_voting = $allowed[$rand];
$sql = 'SELECT id, vid, title, url FROM ' . NV_PREFIXLANG . '_' . $site_mods['voting']['module_data'] . '_rows WHERE vid = ' . $current_voting['vid'] . ' ORDER BY id ASC';
$list = nv_db_cache($sql, '', 'voting');
if (empty($list)) {
return '';
}
include NV_ROOTDIR . '/modules/' . $site_mods['voting']['module_file'] . '/language/' . NV_LANG_INTERFACE . '.php';
if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $site_mods['voting']['module_file'] . '/global.voting.tpl')) {
$block_theme = $global_config['module_theme'];
} elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/' . $site_mods['voting']['module_file'] . '/global.voting.tpl')) {
$block_theme = $global_config['site_theme'];
} else {
$block_theme = 'default';
}
if (file_exists(NV_ROOTDIR . '/themes/' . $block_theme . '/js/voting.js')) {
$my_footer .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "themes/" . $block_theme . "/js/voting.js\"></script>\n";
}
$action = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=voting';
$voting_array = array('checkss' => md5($current_voting['vid'] . $client_info['session_id'] . $global_config['sitekey']), 'accept' => (int) $current_voting['acceptcm'], 'errsm' => (int) $current_voting['acceptcm'] > 1 ? sprintf($lang_module['voting_warning_all'], (int) $current_voting['acceptcm']) : $lang_module['voting_warning_accept1'], 'vid' => $current_voting['vid'], 'question' => empty($current_voting['link']) ? $current_voting['question'] : '<a target="_blank" href="' . $current_voting['link'] . '">' . $current_voting['question'] . '</a>', 'action' => $action, 'langresult' => $lang_module['voting_result'], 'langsubmit' => $lang_module['voting_hits']);
$xtpl = new XTemplate('global.voting.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $site_mods['voting']['module_file']);
$xtpl->assign('VOTING', $voting_array);
foreach ($list as $row) {
if (!empty($row['url'])) {
$row['title'] = '<a target="_blank" href="' . $row['url'] . '">' . $row['title'] . '</a>';
}
$xtpl->assign('RESULT', $row);
if ((int) $current_voting['acceptcm'] > 1) {
$xtpl->parse('main.resultn');
} else {
$xtpl->parse('main.result1');
}
}
$xtpl->parse('main');
$content = $xtpl->text('main');
}
return $content;
}
开发者ID:anhtunguyen,项目名称:vietnamguide,代码行数:74,代码来源:global.voting_random.php
示例14: nv_setup_block_module
/**
* nv_setup_block_module()
*
* @param mixed $mod
* @param integer $func_id
* @return
*/
function nv_setup_block_module($mod, $func_id = 0)
{
global $db;
if (empty($func_id)) {
//xoa du lieu tai bang blocks
$db->sql_query("DELETE FROM `" . NV_BLOCKS_TABLE . "_weight` WHERE `bid` in (SELECT `bid` FROM `" . NV_BLOCKS_TABLE . "_groups` WHERE `module`=" . $db->dbescape($mod) . ")");
$db->sql_query("DELETE FROM `" . NV_BLOCKS_TABLE . "_groups` WHERE `module`=" . $db->dbescape($mod));
$db->sql_query("DELETE FROM `" . NV_BLOCKS_TABLE . "_weight` WHERE `func_id` in (SELECT `func_id` FROM `" . NV_MODFUNCS_TABLE . "` WHERE `in_module`=" . $db->dbescape($mod) . ")");
}
$array_funcid = array();
$func_result = $db->sql_query("SELECT `func_id` FROM `" . NV_MODFUNCS_TABLE . "` WHERE `show_func` = '1' AND `in_module`=" . $db->dbescape($mod) . " ORDER BY `subweight` ASC");
while (list($func_id_i) = $db->sql_fetchrow($func_result)) {
if ($func_id == 0 or $func_id == $func_id_i) {
$array_funcid[] = $func_id_i;
}
}
$weight = 0;
$old_theme = $old_position = "";
$sql = "SELECT `bid`, `theme`, `position` FROM `" . NV_BLOCKS_TABLE . "_groups` WHERE `all_func`='1' ORDER BY `theme` ASC, `position` ASC, `weight` ASC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
if ($old_theme == $row['theme'] and $old_position == $row['position']) {
++$weight;
} else {
$weight = 1;
$old_theme = $row['theme'];
$old_position = $row['position'];
}
foreach ($array_funcid as $func_id) {
$db->sql_query("INSERT INTO `" . NV_BLOCKS_TABLE . "_weight` (`bid`, `func_id`, `weight`) VALUES ('" . $row['bid'] . "', '" . $func_id . "', '" . $weight . "')");
}
}
nv_del_moduleCache("themes");
}
开发者ID:atarubi,项目名称:nuke-viet,代码行数:41,代码来源:functions.php
示例15: del_cache
/**
* nv_mod_blog::del_cache()
*
* @param mixed $module_name
* @return
*/
private function del_cache($module_name)
{
return nv_del_moduleCache($module_name);
}
开发者ID:hoangvtien,项目名称:blog,代码行数:10,代码来源:blog.class.php
示例16: nv_show_funcs
//.........这里部分代码省略.........
while ($row = $db->sql_fetchrow($result)) {
$func = $db->unfixdb($row['func_name']);
$show_func = in_array($func, $modfuncs) ? 1 : 0;
if ($row['show_func'] != $show_func) {
$row['show_func'] = $show_func;
$sql = "UPDATE `" . NV_MODFUNCS_TABLE . "` SET `show_func`=" . $show_func . " WHERE `func_id`=" . $row['func_id'];
$db->sql_query($sql);
$is_delCache = true;
}
$data_funcs[$func]['func_id'] = $row['func_id'];
$data_funcs[$func]['layout'] = empty($row['layout']) ? '' : $row['layout'];
$data_funcs[$func]['show_func'] = $row['show_func'];
$data_funcs[$func]['func_custom_name'] = $row['func_custom_name'];
$data_funcs[$func]['in_submenu'] = $row['in_submenu'];
$data_funcs[$func]['subweight'] = $row['subweight'];
if ($show_func) {
$weight_list[] = $row['subweight'];
}
}
$act_funcs = array_intersect_key($data_funcs, $local_funcs);
$old_funcs = array_diff_key($data_funcs, $local_funcs);
$new_funcs = array_diff_key($local_funcs, $data_funcs);
$is_refresh = false;
if (!empty($old_funcs)) {
foreach ($old_funcs as $func => $values) {
$sql = "DELETE FROM `" . NV_BLOCKS_TABLE . "_weight` WHERE `func_id` = " . $values['func_id'];
$db->sql_query($sql);
$sql = "DELETE FROM `" . NV_MODFUNCS_TABLE . "` WHERE `func_id` = " . $values['func_id'];
$db->sql_query($sql);
$sql = "DELETE FROM `" . NV_PREFIXLANG . "_modthemes` WHERE `func_id` = " . $values['func_id'];
$db->sql_query($sql);
$is_delCache = true;
}
$db->sql_query("OPTIMIZE TABLE `" . NV_BLOCKS_TABLE . "_weight`");
$db->sql_query("OPTIMIZE TABLE `" . NV_MODFUNCS_TABLE . "`");
$db->sql_query("OPTIMIZE TABLE `" . NV_PREFIXLANG . "_modthemes`");
$is_refresh = true;
}
if (!empty($new_funcs)) {
$mod_theme = "default";
if (!empty($site_mods[$mod]['theme']) and file_exists(NV_ROOTDIR . '/themes/' . $site_mods[$mod]['theme'] . '/config.ini')) {
$mod_theme = $site_mods[$mod]['theme'];
}
if (!empty($global_config['site_theme']) and file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/config.ini')) {
$mod_theme = $global_config['site_theme'];
}
$xml = simplexml_load_file(NV_ROOTDIR . '/themes/' . $mod_theme . '/config.ini');
$layoutdefault = (string) $xml->layoutdefault;
$array_keys = array_keys($new_funcs);
foreach ($array_keys as $func) {
$show_func = in_array($func, $modfuncs) ? 1 : 0;
$sql = "INSERT INTO `" . NV_MODFUNCS_TABLE . "` (`func_id`, `func_name`, `func_custom_name`, `in_module`, `show_func`, `in_submenu`, `subweight`, `setting`) VALUES (NULL, " . $db->dbescape($func) . ", " . $db->dbescape(ucfirst($func)) . ", " . $db->dbescape($mod) . ", " . $show_func . ", 0, 0, '')";
$func_id = $db->sql_query_insert_id($sql);
if ($show_func) {
$db->sql_query("INSERT INTO `" . NV_PREFIXLANG . "_modthemes` (`func_id`, `layout`, `theme`) VALUES ('" . $func_id . "'," . $db->dbescape($layoutdefault) . ", " . $db->dbescape($mod_theme) . ")");
nv_setup_block_module($mod, $func_id);
}
}
$is_refresh = true;
$is_delCache = true;
}
if ($is_refresh) {
nv_fix_subweight($mod);
$act_funcs = array();
$weight_list = array();
$sql = "SELECT * FROM `" . NV_MODFUNCS_TABLE . "` WHERE `in_module`=" . $db->dbescape($mod) . " AND `show_func`='1' ORDER BY `subweight` ASC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$func = $db->unfixdb($row['func_name']);
$act_funcs[$func]['func_id'] = $row['func_id'];
$act_funcs[$func]['layout'] = empty($row['layout']) ? "" : $row['layout'];
$act_funcs[$func]['show_func'] = $row['show_func'];
$act_funcs[$func]['func_custom_name'] = $row['func_custom_name'];
$act_funcs[$func]['in_submenu'] = $row['in_submenu'];
$act_funcs[$func]['subweight'] = $row['subweight'];
$weight_list[] = $row['subweight'];
}
}
if ($is_delCache) {
nv_del_moduleCache('modules');
nv_del_moduleCache('themes');
}
$contents = array();
$contents['caption'] = sprintf($lang_module['funcs_list'], $custom_title);
$contents['thead'] = array($lang_module['funcs_subweight'], $lang_module['funcs_in_submenu'], $lang_module['funcs_title'], $lang_module['custom_title'], $lang_module['funcs_layout']);
$contents['weight_list'] = $weight_list;
foreach ($act_funcs as $funcs => $values) {
if ($values['show_func']) {
$func_id = $values['func_id'];
$contents['rows'][$func_id]['weight'] = array($values['subweight'], "nv_chang_func_weight(" . $func_id . ");");
$contents['rows'][$func_id]['name'] = array($funcs, $values['func_custom_name'], "nv_change_custom_name(" . $values['func_id'] . ",'action');");
$contents['rows'][$func_id]['layout'] = array($values['layout'], "nv_chang_func_layout(" . $func_id . ");");
$contents['rows'][$func_id]['in_submenu'] = array($values['in_submenu'], "nv_chang_func_in_submenu(" . $func_id . ");");
$contents['rows'][$func_id]['disabled'] = in_array($funcs, $arr_in_submenu) ? "" : " disabled";
}
}
include NV_ROOTDIR . "/includes/header.php";
echo aj_show_funcs_theme($contents);
include NV_ROOTDIR . "/includes/footer.php";
}
开发者ID:atarubi,项目名称:nuke-viet,代码行数:101,代码来源:show.php
示例17: nv_block_freecontent
/**
* nv_block_freecontent()
*
* @return
*/
function nv_block_freecontent($block_config)
{
global $global_config, $site_mods, $module_config, $db;
$module = $block_config['module'];
// Set content status
if (!empty($module_config[$module]['next_execute']) and $module_config[$module]['next_execute'] <= NV_CURRENTTIME) {
$sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_rows SET status = 2 WHERE end_time > 0 AND end_time < ' . NV_CURRENTTIME;
$db->query($sql);
// Get next execute
$sql = 'SELECT MIN(end_time) next_execute FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_rows WHERE end_time > 0 AND status = 1';
$result = $db->query($sql);
$next_execute = intval($result->fetchColumn());
$sth = $db->prepare("UPDATE " . NV_CONFIG_GLOBALTABLE . " SET config_value = :config_value WHERE lang = '" . NV_LANG_DATA . "' AND module = :module_name AND config_name = 'next_execute'");
$sth->bindParam(':module_name', $module, PDO::PARAM_STR);
$sth->bindParam(':config_value', $next_execute, PDO::PARAM_STR);
$sth->execute();
nv_del_moduleCache('settings');
nv_del_moduleCache($module);
unset($next_execute);
}
if (!isset($site_mods[$module]) or empty($block_config['blockid'])) {
return '';
}
$sql = 'SELECT id, title, description, image, link, target FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_rows WHERE status = 1 AND bid = ' . $block_config['blockid'];
$list = nv_db_cache($sql, 'id', $module);
if (!empty($list)) {
if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $site_mods[$module]['module_file'] . '/block.free_content.tpl')) {
$block_theme = $global_config['module_theme'];
} elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/' . $site_mods[$module]['module_file'] . '/block.free_content.tpl')) {
$block_theme = $global_config['site_theme'];
} else {
$block_theme = 'default';
}
$xtpl = new XTemplate('block.free_content.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $site_mods[$module]['module_file']);
shuffle($list);
if ($block_config['numrows'] <= sizeof($list)) {
$list = array_slice($list, 0, $block_config['numrows']);
}
foreach ($list as $row) {
if (!empty($row['image'])) {
$row['image'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $row['image'];
}
$xtpl->assign('ROW', $row);
if (!empty($row['link'])) {
if (!empty($row['target'])) {
$xtpl->parse('main.loop.title_link.target');
}
$xtpl->parse('main.loop.title_link');
} else {
$xtpl->parse('main.loop.title_text');
}
if (!empty($row['image'])) {
if (!empty($row['link'])) {
if (!empty($row['target'])) {
$xtpl->parse('main.loop.image_link.target');
}
$xtpl->parse('main.loop.image_link');
} else {
$xtpl->parse('main.loop.image_only');
}
}
$xtpl->parse('main.loop');
}
$xtpl->parse('main');
return $xtpl->text('main');
}
return '';
}
开发者ID:anhtunguyen,项目名称:vietnamguide,代码行数:73,代码来源:global.free_content.php
示例18: nv_set_status_module
/**
* 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'] . '_' .
|
请发表评论