本文整理汇总了PHP中nv_mkdir函数的典型用法代码示例。如果您正苦于以下问题:PHP nv_mkdir函数的具体用法?PHP nv_mkdir怎么用?PHP nv_mkdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nv_mkdir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: nv_set_cache
/**
* nv_set_cache()
*
* @param mixed $module_name
* @param mixed $filename
* @param mixed $content
* @return
*/
function nv_set_cache($module_name, $filename, $content)
{
if (empty($filename) or !preg_match('/([a-z0-9\\_]+)\\.cache/', $filename)) {
return false;
}
nv_mkdir(NV_ROOTDIR . '/' . NV_CACHEDIR, $module_name);
return nv_gz_put_contents(NV_ROOTDIR . '/' . NV_CACHEDIR . '/' . $module_name . '/' . $filename, $content);
}
示例3: die
* @Project NUKEVIET 4.x
* @Author VINADES.,JSC (contact@vinades.vn)
* @Copyright (C) 2015 VINADES.,JSC. All rights reserved
* @License GNU/GPL version 2 or any later version
* @Createdate Tue, 14 Jul 2015 04:17:56 GMT
*/
if (!defined('NV_IS_FILE_ADMIN')) {
die('Stop!!!');
}
if ($nv_Request->isset_request('get_alias_title', 'post')) {
$alias = $nv_Request->get_title('get_alias_title', 'post', '');
$alias = change_alias($alias);
die($alias);
}
if (!file_exists(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module_upload)) {
nv_mkdir(NV_ROOTDIR . '/' . NV_FILES_DIR, $module_upload);
}
if (defined('NV_EDITOR')) {
require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
}
$row = array();
$error = array();
$row['id'] = $nv_Request->get_int('id', 'post,get', 0);
if ($nv_Request->isset_request('submit', 'post')) {
$row['catid'] = $nv_Request->get_int('catid', 'post', 0);
$row['title'] = $nv_Request->get_title('title', 'post', '');
if (empty($row['title'])) {
$row['title'] = $admin_info['username'] . '-' . nv_genpass(6);
}
$row['alias'] = $nv_Request->get_title('alias', 'post', '');
$row['alias'] = empty($row['alias']) ? change_alias($row['title']) : change_alias($row['alias']);
示例4: strtolower
$albdata['imgfolder'] = strtolower($albdata['alias']);
$newalbid = $np->addItem('album', $albdata);
if ((int) $newalbid > 0) {
$np->setAdminRoll($newAdminArray, '', 'admins', 'listalbid', 'userid', $newalbid);
$log_action = "Thêm album";
}
}
if (!empty($log_action)) {
$imgpath = NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_name . '/' . $albdata['image'];
$thumbpath = NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_name . '/thumbs/album/';
if (!is_dir(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/album/' . $albdata['alias'])) {
nv_mkdir(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/album/', $albdata['alias']);
nv_loadUploadDirList(false);
}
if (!is_dir(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/album/' . $albdata['alias'] . '/thumbs')) {
nv_mkdir(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/album/' . $albdata['alias'] . '/', 'thumbs');
nv_loadUploadDirList(false);
}
$albdata['imgfolder'] = strtolower($albdata['alias']);
if ($albdata['image'] != '' and !file_exists($thumbpath . '/' . $albdata['image'])) {
$albdata['thumbpath'] = createthumb($imgpath, $thumbpath, '', 180, 180);
}
$np->updateItem('album', $albdata, 'albid');
nv_insert_logs(NV_LANG_DATA, $module_name, $log_action, $albdata['title'], $admin_info['userid']);
}
nv_del_moduleCache($module_name);
if (empty($np->error) and empty($np->warning)) {
//Header( "Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $op );
//die();
$np->success[] = "Lưu album thành công";
$np->status();
示例5: elseif
//Buoc admin khai bao lai pass neu khong online trong khoang thoi gian nhat dinh
if (empty($admin_info['checkpass'])) {
if ($nv_Request->isset_request(NV_ADMINRELOGIN_VARIABLE, 'get') and $nv_Request->get_int(NV_ADMINRELOGIN_VARIABLE, 'get') == 1) {
require_once NV_ROOTDIR . "/includes/core/admin_relogin.php";
exit;
}
}
} elseif (!in_array(NV_LANG_DATA, $global_config['allow_sitelangs'])) {
$global_config['disable_site'] = 1;
}
//Dinh chi hoat dong cua site
if (!defined('NV_ADMIN') and !defined("NV_IS_ADMIN")) {
if ($global_config['disable_site']) {
$disable_site_content = (isset($global_config['disable_site_content']) and !empty($global_config['disable_site_content'])) ? $global_config['disable_site_content'] : $lang_global['disable_site_content'];
nv_info_die($global_config['site_description'], $global_config['disable_site_title'], $disable_site_content);
} elseif (!in_array(NV_LANG_DATA, $global_config['allow_sitelangs'])) {
Header("Location: " . NV_BASE_SITEURL);
exit;
} elseif (empty($global_config['lang_multi']) and NV_LANG_DATA != $global_config['site_lang']) {
Header("Location: " . NV_BASE_SITEURL);
exit;
}
}
$month_upload_dir = nv_mkdir(NV_UPLOADS_REAL_DIR, date("Y_m"));
//Thu muc uploads theo thang
if (!empty($month_upload_dir[0])) {
define("NV_MONTH_UPLOADS_DIR", date("Y_m"));
define("NV_MONTH_UPLOADS_REAL_DIR", NV_UPLOADS_REAL_DIR . '/' . NV_MONTH_UPLOADS_DIR);
}
define('PCLZIP_TEMPORARY_DIR', NV_ROOTDIR . '/' . NV_TEMP_DIR . '/');
unset($month_upload_dir);
示例6: die
*/
if (!defined('NV_IS_FILE_ADMIN')) {
die('Stop!!!');
}
$page_title = $lang_module['cat_title'];
$table_name = $db_config['prefix'] . '_' . $module_data . '_catalogs';
$error = $admins = '';
$savecat = 0;
$data = array();
$groups_list = nv_groups_list();
if (defined('NV_EDITOR')) {
require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
}
$currentpath = NV_UPLOADS_DIR . '/' . $module_upload . '/' . date('Y_m');
if (!file_exists($currentpath)) {
nv_mkdir(NV_UPLOADS_REAL_DIR . '/' . $module_upload, date('Y_m'), true);
}
list($data['catid'], $data['parentid'], $data['title'], $data['title_custom'], $data['alias'], $data['description'], $data[NV_LANG_DATA . '_descriptionhtml'], $data['keywords'], $data['groups_view'], $data['cat_allow_point'], $data['cat_number_point'], $data['cat_number_product'], $data['image'], $data['form'], $data['group_price'], $data['viewdescriptionhtml'], $data['newday'], $data['typeprice']) = array(0, 0, '', '', '', '', '', '', '6', 0, 0, 0, '', '', $pro_config['group_price'], 0, 7, 1);
$savecat = $nv_Request->get_int('savecat', 'post', 0);
$cat_form_exit = array();
$_form_exit = scandir(NV_ROOTDIR . '/' . NV_ASSETS_DIR . '/' . $module_file . '/files_tpl');
foreach ($_form_exit as $_form) {
if (preg_match('/^cat\\_form\\_([a-zA-Z0-9\\-\\_]+)\\.tpl$/', $_form, $m)) {
$cat_form_exit[] = $m[1];
}
}
if (!empty($savecat)) {
$field_lang = nv_file_table($table_name);
$data['catid'] = $nv_Request->get_int('catid', 'post', 0);
$data['typeprice'] = $nv_Request->get_int('typeprice', 'post', 2);
$data['parentid_old'] = $nv_Request->get_int('parentid_old', 'post', 0);
示例7: str_replace
$xtpl->assign('INCLUDE_LANG', str_replace(NV_ROOTDIR, '', str_replace('\\', '/', $include_lang)));
$xtpl->assign('URL', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=interface');
$xtpl->parse('main.complete');
} else {
$xtpl->assign('CONTENT', $content);
$xtpl->parse('main.error');
}
$xtpl->parse('main');
$contents = $xtpl->text('main');
include NV_ROOTDIR . '/includes/header.php';
echo nv_admin_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
} elseif ($nv_Request->isset_request('checksess', 'get') and $nv_Request->get_string('checksess', 'get') == md5('writeallfile' . NV_CHECK_SESSION)) {
$dirlang = $nv_Request->get_string('dirlang', 'get', '');
if ($dirlang != '' and preg_match("/^([a-z]{2})\$/", $dirlang)) {
nv_mkdir(NV_ROOTDIR . '/includes/language/', $dirlang);
$content = '';
$array_filename = array();
$result = $db->query('SELECT idfile, author_' . $dirlang . ' FROM ' . NV_LANGUAGE_GLOBALTABLE . '_file ORDER BY idfile ASC');
while (list($idfile, $author_lang) = $result->fetch(3)) {
$content = nv_admin_write_lang($dirlang, $idfile);
if (!empty($content)) {
break;
} else {
$array_filename[] = str_replace(NV_ROOTDIR, '', str_replace('\\', '/', $include_lang));
}
}
if (empty($content)) {
$xtpl->assign('URL', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=setting');
$i = 0;
foreach ($array_filename as $name) {
示例8: str_replace
$xtpl->assign('INCLUDE_LANG', str_replace(NV_ROOTDIR, "", str_replace('\\', '/', $include_lang)));
$xtpl->assign('URL', NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=interface");
$xtpl->parse('main.complete');
} else {
$xtpl->assign('CONTENT', $content);
$xtpl->parse('main.error');
}
$xtpl->parse('main');
$contents = $xtpl->text('main');
include NV_ROOTDIR . "/includes/header.php";
echo nv_admin_theme($contents);
include NV_ROOTDIR . "/includes/footer.php";
} elseif ($nv_Request->isset_request('checksess', 'get') and $nv_Request->get_string('checksess', 'get') == md5("writeallfile" . session_id())) {
$dirlang = $nv_Request->get_string('dirlang', 'get', '');
if ($dirlang != "") {
nv_mkdir(NV_ROOTDIR . "/language/", $dirlang);
$sql = "SELECT `idfile`, `author_" . $dirlang . "` FROM `" . NV_LANGUAGE_GLOBALTABLE . "_file` ORDER BY `idfile` ASC";
$result = $db->sql_query($sql);
$content = "";
$array_filename = array();
while (list($idfile, $author_lang) = $db->sql_fetchrow($result)) {
$content = nv_admin_write_lang($dirlang, $idfile);
if (!empty($content)) {
break;
} else {
$array_filename[] = str_replace(NV_ROOTDIR, "", str_replace('\\', '/', $include_lang));
}
}
if (empty($content)) {
// Tam thoi bo qua cai nay
// $array_lang_no_check = array_unique( $array_lang_no_check );
示例9: nv_referer_update
function nv_referer_update()
{
global $nv_Request, $client_info, $global_config, $db, $prefix;
if ($client_info['is_myreferer'] == 0) {
$host = $nv_Request->referer_host;
$host = str_replace('www.', '', $host);
$host = explode('/', $host);
$host = reset($host);
$host = strtolower($host);
$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_current = mktime(0, 0, 0, date("n", NV_CURRENTTIME), date("j", NV_CURRENTTIME), date("Y", NV_CURRENTTIME));
$content = '[' . date("r", NV_CURRENTTIME) . ']';
$content .= ' [' . $client_info['ip'] . ']';
$content .= ' [' . $client_info['referer'] . ']';
$content .= ' [' . $client_info['selfurl'] . ']';
$content .= "\r\n";
$md5 = md5($client_info['referer'] . $client_info['selfurl']);
$is_save = true;
$referer_blocker = array();
if (file_exists(NV_ROOTDIR . '/' . NV_DATADIR . '/referer_blocker.php')) {
include NV_ROOTDIR . '/' . NV_DATADIR . '/referer_blocker.php';
}
if (!empty($referer_blocker)) {
foreach ($referer_blocker as $blocker) {
if (preg_match("/" . preg_quote($blocker) . "/i", $host)) {
$is_save = false;
break;
}
}
}
if ($is_save) {
$tmp = $log_path . '/tmp.' . NV_LOGS_EXT;
if (file_exists($tmp)) {
$ct = file_get_contents($tmp);
if (!empty($ct)) {
$ct = trim($ct);
$ct = explode("|", $ct);
$p = NV_CURRENTTIME - 60;
if ($ct[0] > $p and $ct[1] == $md5) {
$is_save = false;
}
}
}
}
if ($is_save) {
file_put_contents($log_path . '/' . $log_current . '.' . NV_LOGS_EXT, $content, FILE_APPEND);
file_put_contents($tmp, NV_CURRENTTIME . '|' . $md5);
$sql = "UPDATE `" . NV_REFSTAT_TABLE . "` SET \n total=total+1, \n month" . date('m', NV_CURRENTTIME) . "=month" . date('m', NV_CURRENTTIME) . "+1, \n last_update=" . NV_CURRENTTIME . " \n WHERE `host`=" . $db->dbescape($host);
$db->sql_query($sql);
$mysql_info = @mysql_info();
unset($matches);
preg_match("/^\\D+(\\d+)/", $mysql_info, $matches);
if ($matches[1] == 0) {
$sql = "INSERT INTO `" . NV_REFSTAT_TABLE . "` \n (`host`, `total`, `month" . date('m', NV_CURRENTTIME) . "`, `last_update`) \n VALUES (" . $db->dbescape($host) . ",1, 1," . NV_CURRENTTIME . ")";
$db->sql_query($sql);
}
if (!empty($nv_Request->search_engine)) {
if (isset($global_config['engine_allowed'][$nv_Request->search_engine]['query_param']) and !empty($global_config['engine_allowed'][$nv_Request->search_engine]['query_param'])) {
$key = $global_config['engine_allowed'][$nv_Request->search_engine]['query_param'];
$key = $nv_Request->referer_queries[$key];
$key = str_replace("+", " ", $key);
$key = nv_strtolower($key);
$key = nv_substr($key, 0, 100);
$key = trim($key);
$id = md5($key);
if (!empty($key)) {
$sql = "UPDATE `" . NV_SEARCHKEYS_TABLE . "` \n SET total=total+1 WHERE `id`=" . $db->dbescape($id) . " \n AND `search_engine`=" . $db->dbescape($nv_Request->search_engine);
$db->sql_query($sql);
$mysql_info = @mysql_info();
unset($matches);
preg_match("/^\\D+(\\d+)/", $mysql_info, $matches);
if ($matches[1] == 0) {
$sql = "INSERT INTO `" . NV_SEARCHKEYS_TABLE . "` \n VALUES (" . $db->dbescape($id) . "," . $db->dbescape($key) . ",1," . $db->dbescape($nv_Request->search_engine) . ")";
$db->sql_query($sql);
}
}
}
}
}
}
}
示例10: nv_get_viewImage
function nv_get_viewImage($fileName)
{
global $array_thumb_config;
if (preg_match('/^' . nv_preg_quote(NV_UPLOADS_DIR) . '\\/(([a-z0-9\\-\\_\\/]+\\/)*([a-z0-9\\-\\_\\.]+)(\\.(gif|jpg|jpeg|png)))$/i', $fileName, $m)) {
$viewFile = NV_FILES_DIR . '/' . $m[1];
if (file_exists(NV_ROOTDIR . '/' . $viewFile)) {
$size = @getimagesize(NV_ROOTDIR . '/' . $viewFile);
return array($viewFile, $size[0], $size[1]);
} else {
$m[2] = rtrim($m[2], '/');
if (isset($array_thumb_config[NV_UPLOADS_DIR . '/' . $m[2]])) {
$thumb_config = $array_thumb_config[NV_UPLOADS_DIR . '/' . $m[2]];
} else {
$thumb_config = $array_thumb_config[''];
$_arr_path = explode('/', NV_UPLOADS_DIR . '/' . $m[2]);
while (sizeof($_arr_path) > 1) {
array_pop($_arr_path);
$_path = implode('/', $_arr_path);
if (isset($array_thumb_config[$_path])) {
$thumb_config = $array_thumb_config[$_path];
break;
}
}
}
$viewDir = NV_FILES_DIR;
if (!empty($m[2])) {
if (!is_dir(NV_ROOTDIR . '/' . $m[2])) {
$e = explode('/', $m[2]);
$cp = NV_FILES_DIR;
foreach ($e as $p) {
if (is_dir(NV_ROOTDIR . '/' . $cp . '/' . $p)) {
$viewDir .= '/' . $p;
} else {
$mk = nv_mkdir(NV_ROOTDIR . '/' . $cp, $p);
if ($mk[0] > 0) {
$viewDir .= '/' . $p;
}
}
$cp .= '/' . $p;
}
}
}
$image = new image(NV_ROOTDIR . '/' . $fileName, NV_MAX_WIDTH, NV_MAX_HEIGHT);
if ($thumb_config['thumb_type'] == 4) {
$thumb_width = $thumb_config['thumb_width'];
$thumb_height = $thumb_config['thumb_height'];
$maxwh = max($thumb_width, $thumb_height);
if ($image->fileinfo['width'] > $image->fileinfo['height']) {
$thumb_config['thumb_width'] = 0;
$thumb_config['thumb_height'] = $maxwh;
} else {
$thumb_config['thumb_width'] = $maxwh;
$thumb_config['thumb_height'] = 0;
}
}
$image->resizeXY($thumb_config['thumb_width'], $thumb_config['thumb_height']);
if ($thumb_config['thumb_type'] == 4) {
$image->cropFromCenter($thumb_width, $thumb_height);
}
$image->save(NV_ROOTDIR . '/' . $viewDir, $m[3] . $m[4], $thumb_config['thumb_quality']);
$create_Image_info = $image->create_Image_info;
$error = $image->error;
$image->close();
if (empty($error)) {
return array($viewDir . '/' . basename($create_Image_info['src']), $create_Image_info['width'], $create_Image_info['height']);
}
}
} else {
$size = @getimagesize(NV_ROOTDIR . '/' . $fileName);
return array($viewFile, $size[0], $size[1]);
}
return false;
}
示例11: die
* @Copyright (C) 2012 VINADES.,JSC. All rights reserved
* @Createdate 2-2-2010 12:55
*/
if (!defined('NV_IS_FILE_ADMIN')) {
die('Stop!!!');
}
$path = nv_check_path_upload($nv_Request->get_string('path', 'post'));
$newname = nv_string_to_filename(htmlspecialchars(trim($nv_Request->get_string('newname', 'post')), ENT_QUOTES));
$check_allow_upload_dir = nv_check_allow_upload_dir($path);
if (!isset($check_allow_upload_dir['create_dir']) or $check_allow_upload_dir['create_dir'] !== true) {
die("ERROR_" . $lang_module['notlevel']);
}
if (empty($path)) {
die("ERROR_" . $lang_module['notlevel']);
}
if (empty($newname)) {
die("ERROR_" . $lang_module['name_nonamefolder']);
}
$newpath = $path . '/' . $newname;
if (is_dir(NV_ROOTDIR . '/' . $newpath)) {
die("ERROR_" . $lang_module['folder_exists']);
}
$n_dir = nv_mkdir(NV_ROOTDIR . '/' . $path, $newname);
if (!empty($n_dir[0])) {
nv_loadUploadDirList(false);
nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['createfolder'], $newpath, $admin_info['userid']);
echo $path . '/' . $newname;
exit;
} else {
die("ERROR_" . $n_dir[1]);
}
示例12: nv_setup_data_module
//.........这里部分代码省略.........
foreach ($arr_f as $f) {
if (!isset($array_layout_func_default[$module_name][$f])) {
$array_layout_func_default[$module_name][$f] = $layout_name;
}
}
}
}
$arr_func_id_old = array();
$sth = $db->prepare('SELECT func_id, func_name FROM ' . $db_config['prefix'] . '_' . $lang . '_modfuncs WHERE in_module= :in_module');
$sth->bindParam(':in_module', $module_name, PDO::PARAM_STR);
$sth->execute();
while ($row = $sth->fetch()) {
$arr_func_id_old[$row['func_name']] = $row['func_id'];
}
$new_funcs = preg_replace($global_config['check_op_file'], '\\1', $new_funcs);
$new_funcs = array_flip($new_funcs);
$array_keys = array_keys($new_funcs);
$array_submenu = isset($module_version['submenu']) ? explode(',', $module_version['submenu']) : array();
foreach ($array_keys as $func) {
$show_func = 0;
$weight = 0;
$in_submenu = in_array($func, $array_submenu) ? 1 : 0;
if (isset($arr_func_id_old[$func]) and isset($arr_func_id_old[$func]) > 0) {
$arr_func_id[$func] = $arr_func_id_old[$func];
$db->query('UPDATE ' . $db_config['prefix'] . '_' . $lang . '_modfuncs SET show_func= ' . $show_func . ', in_submenu=' . $in_submenu . ', subweight=0 WHERE func_id=' . $arr_func_id[$func]);
} else {
$data = array();
$data['func_name'] = $func;
$data['alias'] = $func;
$data['func_custom_name'] = ucfirst($func);
$data['in_module'] = $module_name;
$arr_func_id[$func] = $db->insert_id("INSERT INTO " . $db_config['prefix'] . "_" . $lang . "_modfuncs\n\t\t\t\t\t\t(func_name, alias, func_custom_name, in_module, show_func, in_submenu, subweight, setting) VALUES\n\t\t\t\t\t \t(:func_name, :alias, :func_custom_name, :in_module, " . $show_func . ", " . $in_submenu . ", " . $weight . ", '')", "func_id", $data);
if ($arr_func_id[$func]) {
-($layout = $layoutdefault);
if (isset($array_layout_func_default[$module_name][$func])) {
if (file_exists(NV_ROOTDIR . '/themes/' . $selectthemes . '/layout/layout.' . $array_layout_func_default[$module_name][$func] . '.tpl')) {
$layout = $array_layout_func_default[$module_name][$func];
}
}
$db->query('INSERT INTO ' . $db_config['prefix'] . '_' . $lang . '_modthemes (`func_id`, `layout`, `theme`) VALUES (' . $arr_func_id[$func] . ', ' . $db->quote($layout) . ', ' . $db->quote($selectthemes) . ')');
}
}
}
$subweight = 0;
foreach ($arr_modfuncs as $func) {
if (isset($arr_func_id[$func])) {
$func_id = $arr_func_id[$func];
$arr_show_func[] = $func_id;
$show_func = 1;
++$subweight;
$db->query('UPDATE ' . $db_config['prefix'] . '_' . $lang . '_modfuncs SET subweight=' . $subweight . ', show_func=' . $show_func . ' WHERE func_id=' . $func_id);
}
}
} else {
// Xoa du lieu tai bang _modfuncs
$sth = $db->prepare('DELETE FROM ' . $db_config['prefix'] . '_' . $lang . '_modfuncs WHERE in_module= :in_module');
$sth->bindParam(':in_module', $module_name, PDO::PARAM_STR);
$sth->execute();
}
if (isset($module_version['uploads_dir']) and !empty($module_version['uploads_dir'])) {
$sth_dir = $db->prepare('INSERT INTO ' . NV_UPLOAD_GLOBALTABLE . '_dir (dirname, time, thumb_type, thumb_width, thumb_height, thumb_quality) VALUES (:dirname, 0, 0, 0, 0, 0)');
foreach ($module_version['uploads_dir'] as $path) {
$cp = '';
$arr_p = explode('/', $path);
foreach ($arr_p as $p) {
if (trim($p) != '') {
if (!is_dir(NV_UPLOADS_REAL_DIR . '/' . $cp . $p)) {
$mk = nv_mkdir(NV_UPLOADS_REAL_DIR . '/' . $cp, $p);
if ($mk[0]) {
try {
$sth_dir->bindValue(':dirname', NV_UPLOADS_DIR . '/' . $cp . $p, PDO::PARAM_STR);
$sth_dir->execute();
} catch (PDOException $e) {
}
}
}
$cp .= $p . '/';
}
}
}
}
if (isset($module_version['files_dir']) and !empty($module_version['files_dir'])) {
foreach ($module_version['files_dir'] as $path) {
$cp = '';
$arr_p = explode('/', $path);
foreach ($arr_p as $p) {
if (trim($p) != '') {
if (!is_dir(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $cp . $p)) {
nv_mkdir(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $cp, $p);
}
$cp .= $p . '/';
}
}
}
}
$return = 'OK_' . $module_name;
nv_delete_all_cache();
}
return $return;
}
示例13: die
<?php
/**
* @Project NUKEVIET 3.0
* @Author VINADES.,JSC (contact@vinades.vn)
* @Copyright (C) 2010 VINADES.,JSC. All rights reserved
* @Createdate 2-2-2010 12:55
*/
if (!defined('NV_IS_FILE_ADMIN')) {
die('Stop!!!');
}
$path = htmlspecialchars(trim($nv_Request->get_string('path', 'post')), ENT_QUOTES);
$newname = htmlspecialchars(trim($nv_Request->get_string('newname', 'post')), ENT_QUOTES);
if (!empty($newname) && !file_exists(NV_ROOTDIR . '/' . $path . '/' . change_alias($newname)) && $admin_info['allow_create_subdirectories'] && nv_check_allow_upload_dir($path)) {
$n_dir = nv_mkdir(NV_ROOTDIR . '/' . $path, change_alias($newname));
if (!empty($n_dir[0])) {
echo $path . '/' . change_alias($newname);
}
}
示例14: nv_create_form_file
//.........这里部分代码省略.........
$type_html = $input_type_i == 'radio' ? 'radio' : 'checkbox';
$content_2 .= "\n\t\t\t\t\t<!-- BEGIN: " . $type_html . "_" . $key . " -->\n";
$content_2 .= "\t\t\t\t\t<label><input class=\"form-control\" type=\"" . $type_html . "\" name=\"custom[" . $key . "]\" value=\"{OPTION.key}\" {OPTION.checked}";
if (isset($array_requireds[$key])) {
$content_2 .= 'required="required" ';
if ($oninvalid) {
$content_2 .= "oninvalid=\"setCustomValidity( nv_required )\" oninput=\"setCustomValidity('')\" ";
}
}
$content_2 .= ">{OPTION.title} </label>\n";
$content_2 .= "\t\t\t\t\t<!-- END: " . $type_html . "_" . $key . " -->\n";
$content_2 .= "\t\t\t\t";
} elseif ($input_type_i == 'multiselect') {
$content_2 .= "\n\t\t\t\t\t<select class=\"form-control\" name=\"custom[" . $key . "][]\" multiple=\"multiple\" >\n";
$content_2 .= "\t\t\t\t\t\t\t<option value=\"\"> --- </option>\n";
$content_2 .= "\n\t\t\t\t\t<!-- BEGIN: " . $key . " -->\n";
$content_2 .= "\t\t\t\t\t\t<option value=\"{OPTION.key}\" {OPTION.selected}>{OPTION.title}</option\n>";
$content_2 .= "\t\t\t\t\t<!-- END: " . $key . " -->\n";
$content_2 .= "\t\t\t\t\t</select>\n";
$content_2 .= "\t\t\t\t";
} else {
switch ($input_type_i) {
case 'email':
$type_html = 'email';
break;
case 'url':
$type_html = 'url';
break;
case 'password':
$type_html = 'password';
break;
default:
$type_html = 'text';
}
$oninvalid = true;
$content_2 .= "<input class=\"form-control\" type=\"" . $type_html . "\" name=\"custom[" . $key . "]\" value=\"{ROW." . $key . "}\" ";
if ($input_type_i == 'date' or $input_type_i == 'time') {
$content_2 .= 'id="' . $key . '" pattern="^[0-9]{2,2}\\/[0-9]{2,2}\\/[0-9]{1,4}$" ';
$array_field_js['date'][] = '#' . $key;
} elseif ($input_type_i == 'textfile') {
$content_2 .= 'id="id_' . $key . '" ';
$array_field_js['file'][] = $key;
} elseif ($input_type_i == 'textalias') {
$content_2 .= 'id="id_' . $key . '" ';
} elseif ($input_type_i == 'email') {
$content_2 .= "oninvalid=\"setCustomValidity( nv_email )\" oninput=\"setCustomValidity('')\" ";
$oninvalid = false;
} elseif ($input_type_i == 'url') {
$content_2 .= "oninvalid=\"setCustomValidity( nv_url )\" oninput=\"setCustomValidity('')\" ";
$oninvalid = false;
} elseif ($input_type_i == 'number_int') {
$content_2 .= "pattern=\"^[0-9]*\$\" oninvalid=\"setCustomValidity( nv_digits )\" oninput=\"setCustomValidity('')\" ";
$oninvalid = false;
} elseif ($input_type_i == 'number_float') {
$content_2 .= "pattern=\"^([0-9]*)(\\.*)([0-9]+)\$\" oninvalid=\"setCustomValidity( nv_number )\" oninput=\"setCustomValidity('')\" ";
$oninvalid = false;
}
if (isset($array_requireds[$key])) {
$content_2 .= 'required="required" ';
if ($oninvalid) {
$content_2 .= "oninvalid=\"setCustomValidity( nv_required )\" oninput=\"setCustomValidity('')\" ";
}
}
$content_2 .= "/>";
if ($input_type_i == 'textfile') {
$content_2 .= ' <button type="button" class="btn btn-info" id="img_' . $key . '"><i class="fa fa-folder-open-o"> </i> Browse server </button>';
}
if ($input_type_i == 'textalias' and $array_field_js['textalias'] == $key) {
$content_2 .= " <i class=\"fa fa-refresh fa-lg icon-pointer\" onclick=\"nv_get_alias('id_" . $key . "');\"> </i>";
}
}
$content_2 .= "</div>\n";
$content_2 .= "\t\t\t</div>\n";
}
$content_2 .= "\t\t</div>\n";
$content_2 .= "\t</div>\n";
if (!empty($array_field_js['date'])) {
$array_field_js['date'] = implode(',', $array_field_js['date']);
$content_2 .= "\n<script type=\"text/javascript\">\n";
$content_2 .= "\$(document).ready(function() {\n";
$content_2 .= "\t\$(\"" . $array_field_js['date'] . "\").datepicker({\n";
$content_2 .= "\t\tshowOn : \"both\",\n";
$content_2 .= "\t\tdateFormat : \"dd/mm/yy\",\n";
$content_2 .= "\t\tchangeMonth : true,\n";
$content_2 .= "\t\tchangeYear : true,\n";
$content_2 .= "\t\tshowOtherMonths : true,\n";
$content_2 .= "\t\tbuttonImage : nv_base_siteurl + \"assets/images/calendar.gif\",\n";
$content_2 .= "\t\tbuttonImageOnly : true\n";
$content_2 .= "\t});\n";
$content_2 .= "});\n";
$content_2 .= "</script>\n";
}
$content_2 .= "<!-- END: main -->";
if (!file_exists(NV_ROOTDIR . '/' . NV_ASSETS_DIR . '/' . $module_name . '/files_tpl')) {
nv_mkdir(NV_ROOTDIR . '/' . NV_ASSETS_DIR . '/' . $module_name, 'files_tpl');
}
$file = NV_ROOTDIR . '/' . NV_ASSETS_DIR . '/' . $module_name . '/files_tpl/cat_form_' . preg_replace('/[\\-]/', '_', $array_template[$templateids_i]['alias']) . '.tpl';
file_put_contents($file, $content_2, LOCK_EX);
}
}
示例15: nv_setup_data_module
//.........这里部分代码省略.........
$arr_modfuncs = (isset($module_version['modfuncs']) and !empty($module_version['modfuncs'])) ? array_map("trim", explode(",", $module_version['modfuncs'])) : array();
//xoa du lieu tai bang _config
$sql = "DELETE FROM `" . NV_CONFIG_GLOBALTABLE . "` WHERE `lang`=" . $db->dbescape($lang) . " AND `module`=" . $db->dbescape($module_name);
$db->sql_query($sql);
nv_save_file_config_global();
if (file_exists(NV_ROOTDIR . '/modules/' . $module_file . '/action.php')) {
$sql_recreate_module = array();
include NV_ROOTDIR . '/modules/' . $module_file . '/action.php';
if (!empty($sql_create_module)) {
foreach ($sql_create_module as $sql) {
if (!$db->sql_query($sql)) {
return $return;
}
}
}
}
$arr_func_id = array();
$arr_show_func = array();
$new_funcs = nv_scandir(NV_ROOTDIR . '/modules/' . $module_file . '/funcs', $global_config['check_op_file']);
if (!empty($new_funcs)) {
// get default layout
$layout_array = nv_scandir(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/layout', $global_config['check_op_layout']);
if (!empty($layout_array)) {
$layout_array = preg_replace($global_config['check_op_layout'], "\\1", $layout_array);
}
$array_layout_func_default = array();
$xml = simplexml_load_file(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/config.ini');
$layoutdefault = (string) $xml->layoutdefault;
$layout = $xml->xpath('setlayout/layout');
for ($i = 0; $i < count($layout); $i++) {
$layout_name = (string) $layout[$i]->name;
if (in_array($layout_name, $layout_array)) {
$layout_funcs = $layout[$i]->xpath('funcs');
for ($j = 0; $j < count($layout_funcs); $j++) {
$mo_funcs = (string) $layout_funcs[$j];
$mo_funcs = explode(":", $mo_funcs);
$m = $mo_funcs[0];
$arr_f = explode(",", $mo_funcs[1]);
foreach ($arr_f as $f) {
$array_layout_func_default[$m][$f] = $layout_name;
}
}
}
}
// end get default layout
$arr_func_id_old = array();
$sql = "SELECT `func_id`, `func_name` FROM `" . $db_config['prefix'] . "_" . $lang . "_modfuncs` WHERE `in_module`=" . $db->dbescape($module_name);
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$arr_func_id_old[$row['func_name']] = $row['func_id'];
}
$new_funcs = preg_replace($global_config['check_op_file'], "\\1", $new_funcs);
$new_funcs = array_flip($new_funcs);
foreach (array_keys($new_funcs) as $func) {
$show_func = 0;
$weight = 0;
$layout = isset($array_layout_func_default[$module_name][$func]) ? $array_layout_func_default[$module_name][$func] : $layoutdefault;
if (isset($arr_func_id_old[$func]) and isset($arr_func_id_old[$func]) > 0) {
$arr_func_id[$func] = $arr_func_id_old[$func];
$db->sql_query("UPDATE `" . $db_config['prefix'] . "_" . $lang . "_modfuncs` SET `layout`=" . $db->dbescape($layout) . ", `show_func`= " . $show_func . ", `subweight`='0' WHERE `func_id`=" . $arr_func_id[$func] . "");
} else {
$sql = "INSERT INTO `" . $db_config['prefix'] . "_" . $lang . "_modfuncs` (`func_id`, `func_name`, `func_custom_name`, `in_module`, `show_func`, `in_submenu`, `subweight`, `layout`, `setting`) VALUES (NULL, " . $db->dbescape($func) . ", " . $db->dbescape(ucfirst($func)) . ", " . $db->dbescape($module_name) . ", " . $show_func . ", 0, " . $weight . ", " . $db->dbescape($layout) . ", '')";
$arr_func_id[$func] = $db->sql_query_insert_id($sql);
}
}
$subweight = 0;
foreach ($arr_modfuncs as $func) {
if (isset($arr_func_id[$func])) {
$func_id = $arr_func_id[$func];
$arr_show_func[] = $func_id;
$show_func = 1;
$subweight++;
$sql = "UPDATE `" . $db_config['prefix'] . "_" . $lang . "_modfuncs` SET `subweight`=" . $subweight . ", show_func=" . $show_func . " WHERE `func_id`=" . $db->dbescape($func_id);
$db->sql_query($sql);
}
}
} else {
//xoa du lieu tai bang _modfuncs
$sql = "DELETE FROM `" . $db_config['prefix'] . "_" . $lang . "_modfuncs` WHERE `in_module`=" . $db->dbescape($module_name);
$db->sql_query($sql);
}
if (isset($module_version['uploads_dir']) and !empty($module_version['uploads_dir'])) {
foreach ($module_version['uploads_dir'] as $path) {
$cp = '';
$arr_p = explode("/", $path);
foreach ($arr_p as $p) {
if (trim($p) != "") {
if (!is_dir(NV_UPLOADS_REAL_DIR . '/' . $cp . $p)) {
nv_mkdir(NV_UPLOADS_REAL_DIR . '/' . $cp, $p);
}
$cp .= $p . '/';
}
}
}
}
$return = 'OK_' . $module_name;
nv_save_file_config_global();
}
return $return;
}