本文整理汇总了PHP中nv_scandir函数的典型用法代码示例。如果您正苦于以下问题:PHP nv_scandir函数的具体用法?PHP nv_scandir怎么用?PHP nv_scandir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nv_scandir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nv_genealogy_anniversary
/**
* nv_message_page()
*
* @return
*/
function nv_genealogy_anniversary($block_config)
{
global $global_config, $site_mods, $db, $module_name, $lang_block;
$module = $block_config['module'];
if (!isset($site_mods[$module])) {
return '';
}
$is_show = false;
$pattern = '/^' . NV_LANG_DATA . '\\_([a-zA-z0-9\\_\\-]+)\\_([0-9]+)\\_' . NV_CACHE_PREFIX . '\\.cache$/i';
$cache_files = nv_scandir(NV_ROOTDIR . '/' . NV_CACHEDIR . '/' . $module, $pattern);
$anniversary = array();
if (($count = sizeof($cache_files)) >= 1) {
$num = rand(1, $count);
--$num;
$cache_file = $cache_files[$num];
if (($cache = nv_get_cache($module, $cache_file)) != false) {
$cache = unserialize($cache);
$link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $cache['alias'] . $global_config['rewrite_exturl'];
$anniversary = $cache;
$is_show = true;
}
}
if (!$is_show) {
$date_array = getdate();
$dd = 0;
$mm = 0;
$yy = 0;
if ($dd == 0) {
$dd = $date_array['mday'];
}
if ($mm == 0) {
$mm = $date_array['mon'];
}
if ($yy == 0) {
$yy = $date_array['year'];
}
$al = convertSolar2Lunar($dd, $mm, $yy, 7.0);
$sql = 'SELECT * FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . ' WHERE status=2 AND anniversary_mont = ' . $al[1] . ' ORDER BY rand() DESC';
if (($query = $db->query($sql)) !== false) {
while ($row = $query->fetch()) {
$link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $row['alias'] . $global_config['rewrite_exturl'];
$anniversary[] = $row;
$is_show = true;
}
}
}
if ($is_show) {
if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/genealogy/block.anniversary.tpl')) {
$block_theme = $global_config['module_theme'];
} elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/genealogy/block.anniversary.tpl')) {
$block_theme = $global_config['site_theme'];
} else {
$block_theme = 'default';
}
$xtpl = new XTemplate('block.anniversary.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/genealogy');
$xtpl->assign('LINK', $link);
$xtpl->assign('LANG', $lang_block);
$xtpl->assign('MONT', $al[1]);
$i = 0;
$n = count($anniversary);
foreach ($anniversary as $anniversary_i) {
$i++;
$xtpl->assign('ANNIVERSARY', $anniversary_i);
if ($i < $n) {
$xtpl->parse('main.anniversary.comma');
}
$xtpl->parse('main.anniversary');
$xtpl->parse('main.anniversary_list');
}
$xtpl->parse('main');
return $xtpl->text('main');
}
return '';
}
示例2: nv_delete_cache
/**
* nv_delete_cache()
*
* @param mixed $pattern
* @return
*/
function nv_delete_cache($pattern)
{
$files = nv_scandir(NV_ROOTDIR . "/" . NV_CACHEDIR, $pattern);
if (!empty($files)) {
foreach ($files as $f) {
nv_deletefile(NV_ROOTDIR . "/" . NV_CACHEDIR . "/" . $f, true);
}
}
}
示例3: nv_message_about
/**
* nv_message_about()
*
* @return
*/
function nv_message_about()
{
global $global_config, $site_mods, $db, $module_name;
if (!isset($site_mods['about'])) {
return "";
}
if ($module_name == 'about') {
return "";
}
$is_show = false;
$pattern = "/^" . NV_LANG_DATA . "\\_about\\_([0-9]+)\\_" . NV_CACHE_PREFIX . "\\.cache\$/i";
$cache_files = nv_scandir(NV_ROOTDIR . "/" . NV_CACHEDIR, $pattern);
if (($count = count($cache_files)) >= 1) {
$num = rand(1, $count);
$num--;
$cache_file = $cache_files[$num];
if (($cache = nv_get_cache($cache_file)) != false) {
$cache = unserialize($cache);
$link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=about&" . NV_OP_VARIABLE . "=" . $cache['alias'];
$title = $cache['page_title'];
$bodytext = strip_tags($cache['contents']);
$bodytext = nv_clean60($bodytext, 300);
$is_show = true;
}
}
if (!$is_show) {
$sql = "SELECT `id`,`title`,`alias`,`bodytext`,`keywords`,`add_time`,`edit_time` FROM `" . NV_PREFIXLANG . "_" . $site_mods['about']['module_data'] . "` ORDER BY rand() DESC LIMIT 1";
if (($query = $db->sql_query($sql)) !== false) {
if (($row = $db->sql_fetchrow($query)) !== false) {
$link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=about&" . NV_OP_VARIABLE . "=" . $row['alias'];
$title = $row['title'];
$bodytext = $row['bodytext'];
//$bodytext = strip_tags( $row['bodytext'] );
$bodytext = nv_clean60($bodytext, 300);
$is_show = true;
}
}
}
if ($is_show) {
if (file_exists(NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/blocks/global.about.tpl")) {
$block_theme = $global_config['module_theme'];
} elseif (file_exists(NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/blocks/global.about.tpl")) {
$block_theme = $global_config['site_theme'];
} else {
$block_theme = "default";
}
$xtpl = new XTemplate("global.about.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/blocks");
$xtpl->assign('LINK', $link);
$xtpl->assign('TITLE', $title);
$xtpl->assign('BODYTEXT', $bodytext);
$xtpl->parse('main');
return $xtpl->text('main');
}
return "";
}
示例4: nv_message_page
/**
* nv_message_page()
*
* @return
*/
function nv_message_page($block_config)
{
global $global_config, $site_mods, $db, $module_name;
$module = $block_config['module'];
if (!isset($site_mods[$module])) {
return '';
}
if ($module_name == $module) {
return '';
}
$is_show = false;
$pattern = '/^' . NV_LANG_DATA . '\\_([a-zA-z0-9\\_\\-]+)\\_([0-9]+)\\_' . NV_CACHE_PREFIX . '\\.cache$/i';
$cache_files = nv_scandir(NV_ROOTDIR . '/' . NV_CACHEDIR . '/' . $module, $pattern);
if (($count = sizeof($cache_files)) >= 1) {
$num = rand(1, $count);
--$num;
$cache_file = $cache_files[$num];
if (($cache = nv_get_cache($module, $cache_file)) != false) {
$cache = unserialize($cache);
$link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $cache['alias'] . $global_config['rewrite_exturl'];
$title = $cache['page_title'];
$bodytext = strip_tags($cache['bodytext']);
$is_show = true;
}
}
if (!$is_show) {
$sql = 'SELECT id,title,alias,bodytext,keywords,add_time,edit_time FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . ' WHERE status=1 ORDER BY rand() DESC';
if (($query = $db->query($sql)) !== false) {
if (($row = $query->fetch()) !== false) {
$link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $row['alias'] . $global_config['rewrite_exturl'];
$title = $row['title'];
$bodytext = strip_tags($row['bodytext']);
$bodytext = nv_clean60($bodytext, 300);
$is_show = true;
}
}
}
if ($is_show) {
if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/page/block.about.tpl')) {
$block_theme = $global_config['module_theme'];
} elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/page/block.about.tpl')) {
$block_theme = $global_config['site_theme'];
} else {
$block_theme = 'default';
}
$xtpl = new XTemplate('block.about.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/page');
$xtpl->assign('LINK', $link);
$xtpl->assign('TITLE', $title);
$xtpl->assign('BODYTEXT', $bodytext);
$xtpl->parse('main');
return $xtpl->text('main');
}
return '';
}
示例5: LoadModulesSearch
/**
* LoadModulesSearch()
*
* @return
*/
function LoadModulesSearch()
{
global $site_mods, $global_config;
$pathmodule = NV_ROOTDIR . "/modules";
$folder = nv_scandir($pathmodule, $global_config['check_module']);
$arrayfolder = array();
foreach ($site_mods as $mod => $arr_mod) {
$pathserch = $pathmodule . "/" . $arr_mod['module_file'] . "/search.php";
if (file_exists($pathserch)) {
$arrayfolder[$mod] = array("module_name" => $mod, "module_file" => $arr_mod['module_file'], "module_data" => $arr_mod['module_data'], "custom_title" => $arr_mod['custom_title']);
}
}
return $arrayfolder;
}
示例6: cron_del_ip_logs
function cron_del_ip_logs()
{
$dir = NV_ROOTDIR . '/' . NV_LOGS_DIR . '/ip_logs';
$files = nv_scandir($dir, "/^([0-9]+)\\." . NV_LOGS_EXT . "\$/");
$result = true;
if (!empty($files)) {
foreach ($files as $file) {
if (filemtime($dir . '/' . $file) + 7200 < NV_CURRENTTIME) {
if (!@unlink($dir . '/' . $file)) {
$result = false;
}
}
clearstatcache();
}
}
return $result;
}
示例7: cron_auto_del_temp_download
function cron_auto_del_temp_download()
{
$dir = NV_ROOTDIR . "/" . NV_TEMP_DIR;
$files = nv_scandir($dir, "/^(" . nv_preg_quote(NV_TEMPNAM_PREFIX) . ")[a-zA-Z0-9\\_\\.]+\$/");
$result = true;
if (!empty($files)) {
foreach ($files as $file) {
if (filemtime($dir . '/' . $file) + 600 < NV_CURRENTTIME) {
if (!@unlink($dir . '/' . $file)) {
$result = false;
}
}
clearstatcache();
}
}
return $result;
}
示例8: nv_CreateXML_bannerPlan
/**
* nv_CreateXML_bannerPlan()
*
* @return
*/
function nv_CreateXML_bannerPlan()
{
global $db, $global_config;
$pattern = $global_config['idsite'] ? '/^site\\_' . $global_config['idsite'] . '\\_bpl\\_([0-9]+)\\.xml$/' : '/^bpl\\_([0-9]+)\\.xml$/';
$files = nv_scandir(NV_ROOTDIR . '/' . NV_DATADIR, $pattern);
if (!empty($files)) {
foreach ($files as $file) {
nv_deletefile(NV_ROOTDIR . '/' . NV_DATADIR . '/' . $file);
}
}
include NV_ROOTDIR . '/includes/class/array2xml.class.php';
$sql = 'SELECT * FROM ' . NV_BANNERS_GLOBALTABLE . '_plans WHERE act = 1';
$result = $db->query($sql);
while ($row = $result->fetch()) {
$id = intval($row['id']);
if ($global_config['idsite']) {
$xmlfile = NV_ROOTDIR . '/' . NV_DATADIR . '/site_' . $global_config['idsite'] . '_bpl_' . $id . '.xml';
} else {
$xmlfile = NV_ROOTDIR . '/' . NV_DATADIR . '/bpl_' . $id . '.xml';
}
$plan = array();
$plan['id'] = $id;
$plan['lang'] = $row['blang'];
$plan['title'] = $row['title'];
if (!empty($row['description'])) {
$plan['description'] = $row['description'];
}
$plan['form'] = $row['form'];
$plan['width'] = $row['width'];
$plan['height'] = $row['height'];
$query2 = 'SELECT * FROM ' . NV_BANNERS_GLOBALTABLE . '_rows WHERE pid = ' . $id . ' AND (exp_time > ' . NV_CURRENTTIME . ' OR exp_time = 0 ) AND act = 1';
if ($row['form'] == 'sequential') {
$query2 .= ' ORDER BY weight ASC';
}
$plan['banners'] = array();
$result2 = $db->query($query2);
while ($row2 = $result2->fetch()) {
$plan['banners'][] = array('id' => $row2['id'], 'title' => $row2['title'], 'clid' => $row2['clid'], 'file_name' => $row2['file_name'], 'imageforswf' => $row2['imageforswf'], 'file_ext' => $row2['file_ext'], 'file_mime' => $row2['file_mime'], 'file_width' => $row2['width'], 'file_height' => $row2['height'], 'file_alt' => $row2['file_alt'], 'file_click' => $row2['click_url'], 'target' => $row2['target'], 'publ_time' => $row2['publ_time'], 'exp_time' => $row2['exp_time']);
}
if (sizeof($plan['banners'])) {
$array2XML = new Array2XML();
$array2XML->saveXML($plan, 'plan', $xmlfile, $encoding = $global_config['site_charset']);
}
}
}
示例9: nv_CreateXML_bannerPlan
/**
* nv_CreateXML_bannerPlan()
*
* @return
*/
function nv_CreateXML_bannerPlan()
{
global $db, $global_config;
$files = nv_scandir(NV_ROOTDIR . '/' . NV_DATADIR, "/^bpl\\_([0-9]+)\\.xml\$/");
if (!empty($files)) {
foreach ($files as $file) {
nv_deletefile(NV_ROOTDIR . '/' . NV_DATADIR . '/' . $file);
}
}
include NV_ROOTDIR . '/includes/class/array2xml.class.php';
$sql = "SELECT * FROM `" . NV_BANNERS_PLANS_GLOBALTABLE . "` WHERE `act` = 1";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$id = intval($row['id']);
$xmlfile = NV_ROOTDIR . '/' . NV_DATADIR . '/bpl_' . $id . '.xml';
$plan = array();
$plan['id'] = $id;
$plan['lang'] = $row['blang'];
$plan['title'] = $row['title'];
if (!empty($row['description'])) {
$plan['description'] = $row['description'];
}
$plan['form'] = $row['form'];
$plan['width'] = $row['width'];
$plan['height'] = $row['height'];
$query2 = "SELECT * FROM `" . NV_BANNERS_ROWS_GLOBALTABLE . "` WHERE `pid` = " . $id . " AND (`exp_time` > " . NV_CURRENTTIME . " OR `exp_time` = 0 ) AND `act` = 1";
if ($row['form'] == "sequential") {
$query2 .= " ORDER BY `weight` ASC";
}
$result2 = $db->sql_query($query2);
$numrows2 = $db->sql_numrows($result2);
if (empty($numrows2)) {
continue;
}
$plan['banners'] = array();
while ($row2 = $db->sql_fetchrow($result2)) {
$plan['banners'][] = array('id' => $row2['id'], 'title' => $row2['title'], 'clid' => $row2['clid'], 'file_name' => $row2['file_name'], 'file_ext' => $row2['file_ext'], 'file_mime' => $row2['file_mime'], 'file_width' => $row2['width'], 'file_height' => $row2['height'], 'file_alt' => $row2['file_alt'], 'file_click' => $row2['click_url']);
}
$array2XML = new Array2XML();
$array2XML->saveXML($plan, 'plan', $xmlfile, $encoding = $global_config['site_charset']);
}
}
示例10: cron_ref_expired_del
function cron_ref_expired_del()
{
$log_path = NV_ROOTDIR . '/' . NV_LOGS_DIR . '/ref_logs';
if (!is_dir($log_path)) {
@nv_mkdir(NV_ROOTDIR . '/' . NV_LOGS_DIR, 'ref_logs', true);
}
$log_start = mktime(0, 0, 0, date("n", NV_CURRENTTIME), 1, date("Y", NV_CURRENTTIME));
$logfiles = nv_scandir($log_path, "/^[0-9]{10,12}\\." . preg_quote(NV_LOGS_EXT) . "\$/");
$result = true;
if (!empty($logfiles)) {
foreach ($logfiles as $logfile) {
unset($matches);
preg_match("/^([0-9]{10,12})\\." . preg_quote(NV_LOGS_EXT) . "\$/", $logfile, $matches);
$d = (int) $matches[1];
if ($d < $log_start) {
if (!@unlink($log_path . '/' . $logfile)) {
$result = false;
}
}
}
}
return $result;
}
示例11: date
}
}
} else {
$min = date('i', NV_CURRENTTIME);
$hour = date('G', NV_CURRENTTIME);
$start_time = NV_CURRENTTIME;
$interval = 60;
$cron_name = $run_file = $run_func = $params = '';
$del = 0;
}
$contents = array();
$contents['is_error'] = !empty($error) ? 1 : 0;
$contents['title'] = !empty($error) ? $error : $lang_module['nv_admin_add_title'];
$contents['action'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=cronjobs_add';
$contents['cron_name'] = array($lang_module['cron_name'], $cron_name, 100);
$filelist = nv_scandir(NV_ROOTDIR . '/includes/cronjobs', '/^([a-zA-Z0-9\\_\\.]+)\\.php$/');
$contents['run_file'] = array($lang_module['run_file'], $lang_module['file_none'], $filelist, $run_file, $lang_module['run_file_info']);
$contents['run_func'] = array($lang_module['run_func'], $run_func, 255, $lang_module['run_func_info']);
$contents['params'] = array($lang_module['params'], $params, 255, $lang_module['params_info']);
$contents['start_time'] = array($lang_module['start_time'], $lang_module['day'], date('d/m/Y', $start_time));
$contents['min'] = array($lang_module['min'], $min);
$contents['hour'] = array($lang_module['hour'], $hour);
$contents['interval'] = array($lang_module['interval'], $interval, 11, $lang_module['min'], $lang_module['interval_info']);
$contents['del'] = array($lang_module['is_del'], $del);
$contents['submit'] = $lang_global['submit'];
$contents = nv_admin_add_theme($contents);
$page_title = $lang_global['mod_cronjobs'] . ' -> ' . $lang_module['nv_admin_add'];
$set_active_op = 'cronjobs';
include NV_ROOTDIR . '/includes/header.php';
echo nv_admin_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
示例12: elseif
} elseif (isset($language_array[$typelang])) {
nv_copyfile(NV_ROOTDIR . "/js/language/" . $typelang . ".js", NV_ROOTDIR . "/js/language/" . $newslang . ".js");
$db->sql_query("UPDATE `" . NV_LANGUAGE_GLOBALTABLE . "_file` SET `author_" . $newslang . "`=`author_" . $typelang . "`");
$db->sql_query("UPDATE `" . NV_LANGUAGE_GLOBALTABLE . "` SET `lang_" . $newslang . "`=`lang_" . $typelang . "`");
}
$nv_Request->set_Cookie('dirlang', $newslang, NV_LIVE_COOKIE_TIME);
$xtpl->assign('URL', NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=interface");
$xtpl->parse('copyok');
$contents = $xtpl->text('copyok');
include NV_ROOTDIR . "/includes/header.php";
echo nv_admin_theme($contents);
include NV_ROOTDIR . "/includes/footer.php";
}
}
$lang_array_file = array();
$lang_array_file_temp = nv_scandir(NV_ROOTDIR . "/language", "/^[a-z]{2}+\$/");
foreach ($lang_array_file_temp as $value) {
if (file_exists(NV_ROOTDIR . "/language/" . $value . "/global.php")) {
$lang_array_file[] = $value;
}
}
$xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL);
$xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE);
$xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE);
$xtpl->assign('MODULE_NAME', $module_name);
$xtpl->assign('OP', $op);
$xtpl->assign('CHECKSESS', md5(session_id()));
foreach ($language_array as $key => $value) {
if (!in_array($key, $array_lang_exit) and !in_array($key, $lang_array_file)) {
$xtpl->assign('NEWSLANG', array('key' => $key, 'title' => $value['name']));
$xtpl->parse('main.newslang');
示例13: foreach
$contents .= "<select name=\"parentid\" site=\"3\">\n";
if ($parentid == 0) {
$sl = " selected=\"selected\"";
}
$sl = "";
$contents .= "<option value=\"0\" " . $sl . ">" . $lang_module['cat_sub_sl'] . "</option>\n";
foreach ($array_cat as $catid_i => $array_cat_i) {
if ($catid_i == $parentid) {
$sl = " selected=\"selected\"";
}
$contents .= "<option value=\"" . $catid_i . "\" " . $sl . ">" . $array_cat_i['title'] . "</option>\n";
}
$contents .= "</select>\n";
$contents .= "</td>";
$contents .= "</tr>";
$filelist = nv_scandir(NV_ROOTDIR . "/uploads/{$module_name}/cat", "/^([a-zA-Z0-9\\-\\_]+)\\.(jpg|gif)\$/");
$contents .= "<tr>";
$contents .= "<td align=\"right\"><strong>" . $lang_module['weblink_fileimage'] . ": </strong></td>\n";
$contents .= "<td>";
$contents .= "<div style='float:left'>";
$contents .= "<select name=\"catimage\" id='catimage'>\n";
foreach ($filelist as $image) {
$selected = $catimage == $image ? ' selected' : '';
$contents .= "<option value=\"" . $image . "\" " . $selected . ">" . $image . "</option>\n";
}
$contents .= "</select>\n";
$contents .= "</div>\n";
$contents .= "<div style='float:left;padding-left:30px' id='preview'></div>";
//show preview
$contents .= '
<script>
示例14: array
}
$array_site_cat_module = array();
if ($global_config['idsite']) {
$_module = $db->query('SELECT module FROM ' . $db_config['dbsystem'] . '.' . $db_config['prefix'] . '_site_cat t1 INNER JOIN ' . $db_config['dbsystem'] . '.' . $db_config['prefix'] . '_site t2 ON t1.cid=t2.cid WHERE t2.idsite=' . $global_config['idsite'])->fetchColumn();
if (!empty($_module)) {
$array_site_cat_module = explode(',', $_module);
}
}
$title = $note = $modfile = $error = '';
$modules_site = nv_scandir(NV_ROOTDIR . '/modules', $global_config['check_module']);
if ($nv_Request->get_title('checkss', 'post') == NV_CHECK_SESSION) {
$title = $nv_Request->get_title('title', 'post', '', 1);
$modfile = $nv_Request->get_title('module_file', 'post', '', 1);
$note = $nv_Request->get_title('note', 'post', '', 1);
$title = strtolower(change_alias($title));
$modules_admin = nv_scandir(NV_ROOTDIR . '/' . NV_ADMINDIR, $global_config['check_module']);
$error = $lang_module['vmodule_exit'];
if (!empty($title) and !empty($modfile) and !in_array($title, $modules_site) and !in_array($title, $modules_admin) and preg_match($global_config['check_module'], $title) and preg_match($global_config['check_module'], $modfile)) {
$version = '';
$author = '';
$note = nv_nl2br($note, '<br />');
$module_data = preg_replace('/(\\W+)/i', '_', $title);
if (empty($array_site_cat_module) or in_array($modfile, $array_site_cat_module)) {
try {
$sth = $db->prepare('INSERT INTO ' . $db_config['prefix'] . '_setup_extensions (type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES ( \'module\', :title, 0, 0, :basename, :table_prefix, :version, ' . NV_CURRENTTIME . ', :author, :note)');
$sth->bindParam(':title', $title, PDO::PARAM_STR);
$sth->bindParam(':basename', $modfile, PDO::PARAM_STR);
$sth->bindParam(':table_prefix', $module_data, PDO::PARAM_STR);
$sth->bindParam(':version', $version, PDO::PARAM_STR);
$sth->bindParam(':author', $author, PDO::PARAM_STR);
$sth->bindParam(':note', $note, PDO::PARAM_STR);
示例15: nv_save_file_config_global
//.........这里部分代码省略.........
$my_domains[] = NV_SERVER_NAME;
$config_variable['my_domains'] = implode(',', array_unique($my_domains));
$config_variable['check_rewrite_file'] = nv_check_rewrite_file();
$config_variable['allow_request_mods'] = NV_ALLOW_REQUEST_MODS != '' ? NV_ALLOW_REQUEST_MODS : "request";
$config_variable['request_default_mode'] = NV_REQUEST_DEFAULT_MODE != '' ? trim(NV_REQUEST_DEFAULT_MODE) : 'request';
$config_variable['session_save_path'] = NV_SESSION_SAVE_PATH;
$config_variable['log_errors_list'] = NV_LOG_ERRORS_LIST;
$config_variable['display_errors_list'] = NV_DISPLAY_ERRORS_LIST;
$config_variable['send_errors_list'] = NV_SEND_ERRORS_LIST;
$config_variable['error_log_path'] = NV_LOGS_DIR . '/error_logs';
$config_variable['error_log_filename'] = NV_ERRORLOGS_FILENAME;
$config_variable['error_log_fileext'] = NV_LOGS_EXT;
$config_variable['error_send_email'] = $config_variable['error_send_email'];
$config_name_array = array('file_allowed_ext', 'forbid_extensions', 'forbid_mimes', 'allow_sitelangs', 'openid_servers', 'allow_request_mods', 'config_sso');
if (empty($config_variable['openid_servers'])) {
$config_variable['openid_mode'] = 0;
}
if ($config_variable['is_user_forum']) {
$forum_files = @scandir(NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet');
if (!empty($forum_files) and in_array('is_user.php', $forum_files) and in_array('changepass.php', $forum_files) and in_array('editinfo.php', $forum_files) and in_array('login.php', $forum_files) and in_array('logout.php', $forum_files) and in_array('lostpass.php', $forum_files) and in_array('register.php', $forum_files)) {
$content_config .= "define( 'NV_IS_USER_FORUM', true );\n\n";
} else {
$config_variable['is_user_forum'] = 0;
}
}
foreach ($config_variable as $c_config_name => $c_config_value) {
if ($c_config_name == 'config_sso') {
$config_sso = empty($c_config_value) ? '' : nv_var_export(unserialize($c_config_value));
$content_config .= "\$global_config['" . $c_config_name . "']=" . $config_sso . ";\n";
} elseif (in_array($c_config_name, $config_name_array)) {
if (!empty($c_config_value)) {
$c_config_value = "'" . implode("','", array_map("trim", explode(',', $c_config_value))) . "'";
} else {
$c_config_value = '';
}
$content_config .= "\$global_config['" . $c_config_name . "']=array(" . $c_config_value . ");\n";
} else {
if (preg_match('/^\\d+$/', $c_config_value) and $c_config_name != 'facebook_client_id') {
$content_config .= "\$global_config['" . $c_config_name . "']=" . $c_config_value . ";\n";
} else {
$c_config_value = nv_unhtmlspecialchars($c_config_value);
if (!preg_match("/^[a-z0-9\\-\\_\\.\\,\\;\\:\\@\\/\\s]+\$/i", $c_config_value) and $c_config_name != 'my_domains') {
$c_config_value = nv_htmlspecialchars($c_config_value);
}
$content_config .= "\$global_config['" . $c_config_name . "']='" . $c_config_value . "';\n";
}
}
}
$content_config .= "\$global_config['array_theme_type']=" . nv_var_export(array_filter(array_map('trim', explode(',', NV_THEME_TYPE)))) . ";\n";
//allowed_html_tags
if (!empty($allowed_html_tags)) {
$allowed_html_tags = "'" . implode("','", array_map('trim', explode(',', $allowed_html_tags))) . "'";
} else {
$allowed_html_tags = '';
}
$content_config .= "\$global_config['allowed_html_tags']=array(" . $allowed_html_tags . ");\n";
//Xac dinh cac search_engine
$engine_allowed = file_exists(NV_ROOTDIR . '/' . NV_DATADIR . '/search_engine.xml') ? nv_object2array(simplexml_load_file(NV_ROOTDIR . '/' . NV_DATADIR . '/search_engine.xml')) : array();
$content_config .= "\$global_config['engine_allowed']=" . nv_var_export($engine_allowed) . ";\n";
$content_config .= "\n";
$language_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/langs.ini', true);
$tmp_array = array();
$lang_array_exit = nv_scandir(NV_ROOTDIR . "/language", "/^[a-z]{2}+\$/");
foreach ($lang_array_exit as $lang) {
$tmp_array[$lang] = $language_array[$lang];
}
unset($language_array);
$content_config .= "\$language_array=" . nv_var_export($tmp_array) . ";\n";
$tmp_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/br.ini', true);
$content_config .= "\$nv_parse_ini_browsers=" . nv_var_export($tmp_array) . ";\n";
$tmp_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/mobile.ini', true);
$content_config .= "\$nv_parse_ini_mobile=" . nv_var_export($tmp_array) . ";\n";
$tmp_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/os.ini', true);
$content_config .= "\$nv_parse_ini_os=" . nv_var_export($tmp_array) . ";\n";
$tmp_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/timezone.ini', true);
$content_config .= "\$nv_parse_ini_timezone=" . nv_var_export($tmp_array) . ";\n";
$rewrite = array();
$global_config['rewrite_optional'] = $config_variable['rewrite_optional'];
$global_config['rewrite_op_mod'] = $config_variable['rewrite_op_mod'];
$global_config['rewrite_endurl'] = $config_variable['rewrite_endurl'];
$global_config['rewrite_exturl'] = $config_variable['rewrite_exturl'];
if ($config_variable['check_rewrite_file']) {
require NV_ROOTDIR . '/includes/rewrite.php';
} else {
require NV_ROOTDIR . '/includes/rewrite_index.php';
}
$content_config .= "\n";
$nv_plugin_area = array();
$_sql = 'SELECT * FROM ' . $db_config['prefix'] . '_plugin ORDER BY plugin_area ASC, weight ASC';
$_query = $db->query($_sql);
while ($row = $_query->fetch()) {
$nv_plugin_area[$row['plugin_area']][] = $row['plugin_file'];
}
$content_config .= "\$nv_plugin_area=" . nv_var_export($nv_plugin_area) . ";\n\n";
$content_config .= "\$rewrite_keys=" . nv_var_export(array_keys($rewrite)) . ";\n";
$content_config .= "\$rewrite_values=" . nv_var_export(array_values($rewrite)) . ";\n";
$return = file_put_contents(NV_ROOTDIR . "/" . NV_DATADIR . "/config_global.php", trim($content_config), LOCK_EX);
nv_delete_all_cache();
return $return;
}