当前位置: 首页>>代码示例>>PHP>>正文


PHP nv_preg_quote函数代码示例

本文整理汇总了PHP中nv_preg_quote函数的典型用法代码示例。如果您正苦于以下问题:PHP nv_preg_quote函数的具体用法?PHP nv_preg_quote怎么用?PHP nv_preg_quote使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了nv_preg_quote函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cron_dump_autobackup

function cron_dump_autobackup()
{
    global $db, $db_config, $global_config, $client_info;
    $result = true;
    $current_day = mktime(0, 0, 0, date("n", NV_CURRENTTIME), date("j", NV_CURRENTTIME), date("Y", NV_CURRENTTIME));
    $w_day = $current_day - $global_config['dump_backup_day'] * 86400;
    $contents = array();
    $contents['savetype'] = $global_config['dump_backup_ext'] == "sql" ? "sql" : "gz";
    $file_ext = $contents['savetype'] == "sql" ? "sql" : "sql.gz";
    $log_dir = NV_ROOTDIR . "/" . NV_LOGS_DIR . "/dump_backup";
    $contents['filename'] = $log_dir . "/" . md5(nv_genpass(10) . $client_info['session_id']) . "_" . $current_day . "." . $file_ext;
    if (!file_exists($contents['filename'])) {
        $files = scandir($log_dir);
        foreach ($files as $file) {
            unset($mc);
            if (preg_match("/^([a-zA-Z0-9]+)\\_([0-9]+)\\.(" . nv_preg_quote($file_ext) . ")/", $file, $mc)) {
                if (intval($mc[2]) > 0 and intval($mc[2]) < $w_day) {
                    @unlink($log_dir . "/" . $file);
                }
            }
        }
        $contents['tables'] = array();
        $res = $db->sql_query("SHOW TABLES LIKE '" . $db_config['prefix'] . "_%'");
        while ($item = $db->sql_fetchrow($res)) {
            $contents['tables'][] = $item[0];
        }
        $db->sql_freeresult($res);
        $contents['type'] = "all";
        include NV_ROOTDIR . "/includes/core/dump.php";
        if (!nv_dump_save($contents)) {
            $result = false;
        }
    }
    return $result;
}
开发者ID:syphuonglam,项目名称:creative-portal,代码行数:35,代码来源:dump_autobackup.php

示例2: viewdirtree

/**
 * viewdirtree()
 *
 * @param mixed $dir
 * @param mixed $currentpath
 * @return
 */
function viewdirtree($dir, $currentpath)
{
    global $array_dirname, $global_config, $module_file;
    $pattern = !empty($dir) ? '/^(' . nv_preg_quote($dir) . ')\\/([^\\/]+)$/' : '/^([^\\/]+)$/';
    $_dirlist = preg_grep($pattern, array_keys($array_dirname));
    $content = '';
    foreach ($_dirlist as $_dir) {
        $check_allow_upload_dir = nv_check_allow_upload_dir($_dir);
        if (!empty($check_allow_upload_dir)) {
            $class_li = ($_dir == $currentpath or strpos($currentpath, $_dir . '/') !== false) ? 'open collapsable' : 'expandable';
            $style_color = $_dir == $currentpath ? ' style="color:red"' : '';
            $tree = array();
            $tree['class1'] = $class_li;
            $tree['class2'] = nv_set_dir_class($check_allow_upload_dir) . ' pos' . nv_string_to_filename($dir);
            $tree['style'] = $style_color;
            $tree['title'] = $_dir;
            $tree['titlepath'] = basename($_dir);
            $content2 = viewdirtree($_dir, $currentpath);
            $xtpl = new XTemplate('foldlist.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
            $xtpl->assign('DIRTREE', $tree);
            if (empty($content2)) {
                $content2 = '<li class="hide">&nbsp;</li>';
            }
            if (!empty($content2)) {
                $xtpl->assign('TREE_CONTENT', $content2);
                $xtpl->parse('tree.tree_content');
            }
            $xtpl->parse('tree');
            $content .= $xtpl->text('tree');
        }
    }
    return $content;
}
开发者ID:lzhao18,项目名称:nukeviet,代码行数:40,代码来源:folderlist.php

示例3: cron_auto_del_temp_download

function cron_auto_del_temp_download()
{
    $dir = NV_ROOTDIR . '/' . NV_TEMP_DIR;
    $result = true;
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            if (preg_match('/^(' . nv_preg_quote(NV_TEMPNAM_PREFIX) . ')[a-zA-Z0-9\\_\\.]+$/', $file)) {
                if (filemtime($dir . '/' . $file) + 600 < NV_CURRENTTIME) {
                    if (is_file($dir . '/' . $file)) {
                        if (!@unlink($dir . '/' . $file)) {
                            $result = false;
                        }
                    } else {
                        $rt = nv_deletefile($dir . '/' . $file, true);
                        if ($rt[0] == 0) {
                            $result = false;
                        }
                    }
                }
            }
        }
        closedir($dh);
        clearstatcache();
    }
    return $result;
}
开发者ID:nukeplus,项目名称:nuke,代码行数:26,代码来源:temp_download_destroy.php

示例4: viewdirtree

/**
 * viewdirtree()
 * 
 * @param mixed $dir
 * @param mixed $currentpath
 * @return
 */
function viewdirtree($dir, $currentpath)
{
    global $dirlist, $global_config, $module_file;
    $pattern = !empty($dir) ? "/^(" . nv_preg_quote($dir) . ")\\/([^\\/]+)\$/" : "/^([^\\/]+)\$/";
    $_dirlist = preg_grep($pattern, $dirlist);
    $content = "";
    foreach ($_dirlist as $_dir) {
        $check_allow_upload_dir = nv_check_allow_upload_dir($_dir);
        if (!empty($check_allow_upload_dir)) {
            $class_li = ($_dir == $currentpath or strpos($currentpath, $_dir . '/') !== false) ? "open collapsable" : "expandable";
            $style_color = $_dir == $currentpath ? ' style="color:red"' : '';
            $tree = array();
            $tree['class1'] = $class_li;
            $tree['class2'] = nv_set_dir_class($check_allow_upload_dir) . " pos" . nv_string_to_filename($dir);
            $tree['style'] = $style_color;
            $tree['title'] = $_dir;
            $tree['titlepath'] = basename($_dir);
            $content2 = viewdirtree($_dir, $currentpath);
            $xtpl = new XTemplate("foldlist.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file);
            $xtpl->assign("DIRTREE", $tree);
            if (!empty($content2)) {
                $xtpl->assign("TREE_CONTENT", $content2);
                $xtpl->parse('tree.tree_content');
            }
            $xtpl->parse('tree');
            $content .= $xtpl->text('tree');
        }
    }
    return $content;
}
开发者ID:atarubi,项目名称:nuke-viet,代码行数:37,代码来源:folderlist.php

示例5: nv_is_myreferer

/**
 * nv_is_myreferer()
 *
 * @param string $referer
 * @return
 */
function nv_is_myreferer($referer = '')
{
    if (empty($referer)) {
        $referer = urldecode(nv_getenv('HTTP_REFERER'));
    }
    if (empty($referer)) {
        return 2;
    }
    $server_name = preg_replace('/^[w]+\\./', '', nv_getenv('HTTP_HOST'));
    $referer = preg_replace(array('/^[a-zA-Z]+\\:\\/\\/([w]+\\.)?/', '/^[w]+\\./'), '', $referer);
    if (preg_match('/^' . nv_preg_quote($server_name) . '/', $referer)) {
        return 1;
    }
    return 0;
}
开发者ID:anhtunguyen,项目名称:vietnamguide,代码行数:21,代码来源:functions.php

示例6: 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;
}
开发者ID:syphuonglam,项目名称:creative-portal,代码行数:17,代码来源:temp_download_destroy.php

示例7: cron_dump_autobackup

/**
 * cron_dump_autobackup()
 *
 * @return
 */
function cron_dump_autobackup()
{
    global $db, $db_config, $global_config, $client_info;
    $result = true;
    $current_day = mktime(0, 0, 0, date('n', NV_CURRENTTIME), date('j', NV_CURRENTTIME), date('Y', NV_CURRENTTIME));
    $w_day = $current_day - $global_config['dump_backup_day'] * 86400;
    $contents = array();
    $contents['savetype'] = $global_config['dump_backup_ext'] == 'sql' ? 'sql' : 'gz';
    $file_ext = $contents['savetype'] == 'sql' ? 'sql' : 'sql.gz';
    $log_dir = NV_ROOTDIR . '/' . NV_LOGS_DIR . '/dump_backup';
    $contents['filename'] = $log_dir . '/' . md5(nv_genpass(10) . $client_info['session_id']) . '_' . $current_day . '.' . $file_ext;
    if (!file_exists($contents['filename'])) {
        if ($dh = opendir($log_dir)) {
            while (($file = readdir($dh)) !== false) {
                if (preg_match('/^([a-zA-Z0-9]+)\\_([0-9]+)\\.(' . nv_preg_quote($file_ext) . ')/', $file, $m)) {
                    if (intval($m[2]) > 0 and intval($m[2]) < $w_day) {
                        @unlink($log_dir . '/' . $file);
                    }
                }
            }
            closedir($dh);
            clearstatcache();
        }
        if ($global_config['dump_autobackup']) {
            $contents['tables'] = array();
            $res = $db->query("SHOW TABLES LIKE '" . $db_config['prefix'] . "_%'");
            while ($item = $res->fetch(3)) {
                $contents['tables'][] = $item[0];
            }
            $res->closeCursor();
            $contents['type'] = 'all';
            include NV_ROOTDIR . '/includes/core/dump.php';
            if (!nv_dump_save($contents)) {
                $result = false;
            }
        }
    }
    return $result;
}
开发者ID:nukeplus,项目名称:nuke,代码行数:44,代码来源:dump_autobackup.php

示例8: strlen

        if (isset($request_uri_array[1][0])) {
            $lop = strlen($request_uri_array[0]) + 1;
            $_GET[NV_OP_VARIABLE] = substr($matches[1], $lop);
        }
    }
} elseif (preg_match('/<(.*)s(.*)c(.*)r(.*)i(.*)p(.*)t(.*)>/i', urldecode($request_uri))) {
    header('HTTP/1.1 301 Moved Permanently');
    Header('Location: ' . $base_siteurl);
    die;
} elseif (isset($_GET[NV_OP_VARIABLE])) {
    if (preg_match('/([a-z0-9\\-\\_\\.\\/]+)' . nv_preg_quote($global_config['rewrite_exturl']) . '$/i', $_GET[NV_OP_VARIABLE], $matches)) {
        $_GET[NV_OP_VARIABLE] = $matches[1];
        define('NV_REWRITE_EXTURL', true);
    }
} else {
    if (preg_match('/^(' . $base_siteurl_quote . '([a-z0-9\\-\\_\\.\\/]+)(' . nv_preg_quote($global_config['rewrite_endurl']) . '|' . nv_preg_quote($global_config['rewrite_exturl']) . '))\\?(.*)$/i', $request_uri, $matches)) {
        header('HTTP/1.1 301 Moved Permanently');
        Header('Location: ' . $matches[1]);
        die;
    } elseif (!empty($global_config['rewrite_op_mod']) and preg_match('/^' . $base_siteurl_quote . 'tag\\/([^\'\\?\\&]+)$/i', $request_uri, $matches)) {
        $_GET[NV_NAME_VARIABLE] = $global_config['rewrite_op_mod'];
        $_GET[NV_OP_VARIABLE] = 'tag';
        $_GET['alias'] = urldecode($matches[1]);
    } elseif ($global_config['rewrite_optional'] and preg_match('/^' . $base_siteurl_quote . '([a-z0-9\\-]+)\\/tag\\/([^\'\\?\\&]+)$/i', $request_uri, $matches)) {
        $_GET[NV_NAME_VARIABLE] = $matches[1];
        $_GET[NV_OP_VARIABLE] = 'tag';
        $_GET['alias'] = urldecode($matches[2]);
    } elseif (preg_match('/^' . $base_siteurl_quote . '([a-z]{2}+)\\/([a-z0-9\\-]+)\\/tag\\/([^\'\\?\\&]+)$/i', $request_uri, $matches)) {
        $_GET[NV_LANG_VARIABLE] = $matches[1];
        $_GET[NV_NAME_VARIABLE] = $matches[2];
        $_GET[NV_OP_VARIABLE] = 'tag';
开发者ID:nukeplus,项目名称:nuke,代码行数:31,代码来源:request_uri.php

示例9: die

 * @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-2-2010 12:55
 */
if (!defined('NV_IS_FILE_ADMIN')) {
    die('Stop!!!');
}
$path = nv_check_path_upload($nv_Request->get_string('path', 'post'));
$check_allow_upload_dir = nv_check_allow_upload_dir($path);
if (!isset($check_allow_upload_dir['delete_dir']) or $check_allow_upload_dir['delete_dir'] !== true) {
    die('ERROR_' . $lang_module['notlevel']);
}
if (empty($path) or $path == NV_UPLOADS_DIR) {
    die('ERROR_' . $lang_module['notlevel']);
}
$d = nv_deletefile(NV_ROOTDIR . '/' . $path, true);
if ($d[0]) {
    if (preg_match('/^' . nv_preg_quote(NV_UPLOADS_DIR) . '\\/([a-z0-9\\-\\_\\/]+)$/i', $path, $m)) {
        @nv_deletefile(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $m[1], true);
    }
    $result = $db->query("SELECT did FROM " . NV_UPLOAD_GLOBALTABLE . "_dir WHERE dirname='" . $path . "' OR dirname LIKE '" . $path . "/%'");
    while (list($did) = $result->fetch(3)) {
        $db->query('DELETE FROM ' . NV_UPLOAD_GLOBALTABLE . '_file WHERE did = ' . $did);
        $db->query('DELETE FROM ' . NV_UPLOAD_GLOBALTABLE . '_dir WHERE did = ' . $did);
    }
    nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['deletefolder'], $path, $admin_info['userid']);
    echo 'OK';
} else {
    die('ERROR_' . $d[1]);
}
开发者ID:nukeplus,项目名称:nuke,代码行数:31,代码来源:delfolder.php

示例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;
}
开发者ID:hongoctrien,项目名称:module_c34to40,代码行数:73,代码来源:news.php

示例11: nv_check_path_upload

/**
 * nv_check_path_upload()
 *
 * @param mixed $path
 * @return
 */
function nv_check_path_upload($path)
{
    global $allow_upload_dir;
    $path = htmlspecialchars(trim($path), ENT_QUOTES);
    $path = rtrim($path, "/");
    if (empty($path)) {
        return "";
    }
    $path = NV_ROOTDIR . "/" . $path;
    if (($path = realpath($path)) === false) {
        return "";
    }
    $path = str_replace("\\", "/", $path);
    $path = str_replace(NV_ROOTDIR . "/", "", $path);
    $result = false;
    foreach ($allow_upload_dir as $dir) {
        $dir = nv_preg_quote($dir);
        if (preg_match("/^" . $dir . "/", $path)) {
            $result = true;
            break;
        }
    }
    if ($result === false) {
        return "";
    }
    return $path;
}
开发者ID:atarubi,项目名称:nuke-viet,代码行数:33,代码来源:functions.php

示例12: nv_rewrite_change

/**
 * nv_rewrite_change()
 *
 * @param mixed $rewrite_optional
 * @return
 */
function nv_rewrite_change($array_config_global)
{
    global $sys_info, $lang_module;
    $rewrite_rule = $filename = '';
    $endurl = $array_config_global['rewrite_endurl'] == $array_config_global['rewrite_exturl'] ? nv_preg_quote($array_config_global['rewrite_endurl']) : nv_preg_quote($array_config_global['rewrite_endurl']) . "|" . nv_preg_quote($array_config_global['rewrite_exturl']);
    if ($sys_info['supports_rewrite'] == "rewrite_mode_iis") {
        $filename = NV_ROOTDIR . "/web.config";
        $rulename = 0;
        $rewrite_rule .= "\n";
        $rewrite_rule .= "                <rule name=\"nv_rule_" . ++$rulename . "\">\n";
        $rewrite_rule .= "                    <match url=\"^\" ignoreCase=\"false\" />\n";
        $rewrite_rule .= "                    <conditions>\n";
        $rewrite_rule .= "                    \t\t<add input=\"{REQUEST_FILENAME}\" pattern=\"/robots.txt\$\" />\n";
        $rewrite_rule .= "                    </conditions>\n";
        $rewrite_rule .= "                    <action type=\"Rewrite\" url=\"robots.php?action={HTTP_HOST}\" appendQueryString=\"false\" />\n";
        $rewrite_rule .= "                </rule>\n";
        $rewrite_rule .= "                <rule name=\"nv_rule_" . ++$rulename . "\">\n";
        $rewrite_rule .= "                    <match url=\"^(.*?)Sitemap\\.xml\$\" ignoreCase=\"false\" />\n";
        $rewrite_rule .= "                    <action type=\"Rewrite\" url=\"index.php?" . NV_NAME_VARIABLE . "=SitemapIndex\" appendQueryString=\"false\" />\n";
        $rewrite_rule .= "                </rule>\n";
        $rewrite_rule .= "                <rule name=\"nv_rule_" . ++$rulename . "\">\n";
        $rewrite_rule .= "                    <match url=\"^(.*?)Sitemap\\-([a-z]{2})\\.xml\$\" ignoreCase=\"false\" />\n";
        $rewrite_rule .= "                    <action type=\"Rewrite\" url=\"index.php?" . NV_LANG_VARIABLE . "={R:2}&amp;" . NV_NAME_VARIABLE . "=SitemapIndex\" appendQueryString=\"false\" />\n";
        $rewrite_rule .= "                </rule>\n";
        $rewrite_rule .= "                <rule name=\"nv_rule_" . ++$rulename . "\">\n";
        $rewrite_rule .= "                    <match url=\"^(.*?)Sitemap\\-([a-z]{2})\\.([a-zA-Z0-9-]+)\\.xml\$\" ignoreCase=\"false\" />\n";
        $rewrite_rule .= "                    <action type=\"Rewrite\" url=\"index.php?" . NV_LANG_VARIABLE . "={R:2}&amp;" . NV_NAME_VARIABLE . "={R:3}&amp;" . NV_OP_VARIABLE . "=Sitemap\" appendQueryString=\"false\" />\n";
        $rewrite_rule .= "                </rule>\n";
        if ($sys_info['zlib_support']) {
            $rewrite_rule .= "                <rule name=\"nv_rule_" . ++$rulename . "\">\n";
            $rewrite_rule .= "                    <match url=\"^((?!http(s?)|ftp\\:\\/\\/).*)\\.(css|js)\$\" ignoreCase=\"false\" />\n";
            $rewrite_rule .= "                    <action type=\"Rewrite\" url=\"CJzip.php?file={R:1}.{R:3}\" appendQueryString=\"false\" />\n";
            $rewrite_rule .= "                </rule>\n";
        }
        $rewrite_rule .= "                <rule name=\"nv_rule_rewrite\">\n";
        $rewrite_rule .= "                \t<match url=\"(.*)(" . $endurl . ")\$\" ignoreCase=\"false\" />\n";
        $rewrite_rule .= "                \t<conditions logicalGrouping=\"MatchAll\">\n";
        $rewrite_rule .= "                \t\t<add input=\"{REQUEST_FILENAME}\" matchType=\"IsFile\" ignoreCase=\"false\" negate=\"true\" />\n";
        $rewrite_rule .= "                 \t\t<add input=\"{REQUEST_FILENAME}\" matchType=\"IsDirectory\" ignoreCase=\"false\" negate=\"true\" />\n";
        $rewrite_rule .= "                \t</conditions>\n";
        $rewrite_rule .= "                \t<action type=\"Rewrite\" url=\"index.php\" />\n";
        $rewrite_rule .= "                </rule>\n";
        $rewrite_rule = nv_rewrite_rule_iis7($rewrite_rule);
    } elseif ($sys_info['supports_rewrite'] == "rewrite_mode_apache") {
        $filename = NV_ROOTDIR . "/.htaccess";
        $htaccess = "";
        $rewrite_rule = "##################################################################################\n";
        $rewrite_rule .= "#nukeviet_rewrite_start //Please do not change the contents of the following lines\n";
        $rewrite_rule .= "##################################################################################\n\n";
        $rewrite_rule .= "#Options +FollowSymLinks\n\n";
        $rewrite_rule .= "<IfModule mod_rewrite.c>\n";
        $rewrite_rule .= "RewriteEngine On\n";
        $rewrite_rule .= "#RewriteBase " . NV_BASE_SITEURL . "\n";
        $rewrite_rule .= "RewriteCond %{REQUEST_FILENAME} /robots.txt\$ [NC]\n";
        $rewrite_rule .= "RewriteRule ^ robots.php?action=%{HTTP_HOST} [L]\n";
        $rewrite_rule .= "RewriteRule ^(.*?)Sitemap\\.xml\$ index.php?" . NV_NAME_VARIABLE . "=SitemapIndex [L]\n";
        $rewrite_rule .= "RewriteRule ^(.*?)Sitemap\\-([a-z]{2})\\.xml\$ index.php?" . NV_LANG_VARIABLE . "=\$2&" . NV_NAME_VARIABLE . "=SitemapIndex [L]\n";
        $rewrite_rule .= "RewriteRule ^(.*?)Sitemap\\-([a-z]{2})\\.([a-zA-Z0-9-]+)\\.xml\$ index.php?" . NV_LANG_VARIABLE . "=\$2&" . NV_NAME_VARIABLE . "=\$3&" . NV_OP_VARIABLE . "=Sitemap [L]\n";
        if ($sys_info['zlib_support']) {
            $rewrite_rule .= "RewriteRule ^((?!http(s?)|ftp\\:\\/\\/).*)\\.(css|js)\$ CJzip.php?file=\$1.\$3 [L]\n";
        }
        $rewrite_rule .= "RewriteCond %{REQUEST_FILENAME} !-f\n";
        $rewrite_rule .= "RewriteCond %{REQUEST_FILENAME} !-d\n";
        $rewrite_rule .= "RewriteRule (.*)(" . $endurl . ")\$ index.php\n";
        $rewrite_rule .= "</IfModule>\n\n";
        $rewrite_rule .= "#nukeviet_rewrite_end\n";
        $rewrite_rule .= "##################################################################################\n\n";
        if (file_exists($filename)) {
            $htaccess = @file_get_contents($filename);
            if (!empty($htaccess)) {
                $htaccess = preg_replace("/[\n]*[\\#]+[\n]+\\#nukeviet\\_rewrite\\_start(.*)\\#nukeviet\\_rewrite\\_end[\n]+[\\#]+[\n]*/s", "\n", $htaccess);
                $htaccess = trim($htaccess);
            }
        }
        $htaccess .= "\n\n" . $rewrite_rule;
        $rewrite_rule = $htaccess;
    }
    $errormess = false;
    if (!empty($filename) and !empty($rewrite_rule)) {
        $savefile = true;
        try {
            file_put_contents($filename, $rewrite_rule, LOCK_EX);
            if (!file_exists($filename) or filesize($filename) == 0) {
                $errormess .= sprintf($lang_module['err_writable'], NV_BASE_SITEURL . $filename);
                $savefile = false;
            }
        } catch (exception $e) {
            $savefile = false;
        }
        if (!$savefile) {
            $errormess .= sprintf($lang_module['err_writable'], NV_BASE_SITEURL . basename($filename));
        }
    }
    return $errormess;
//.........这里部分代码省略.........
开发者ID:atarubi,项目名称:nuke-viet,代码行数:101,代码来源:admin_functions.php

示例13: nv_getFileInfo

/**
 * nv_getFileInfo()
 *
 * @param mixed $pathimg
 * @param mixed $file
 * @return
 */
function nv_getFileInfo($pathimg, $file)
{
    global $array_images, $array_flash, $array_archives, $array_documents;
    clearstatcache();
    unset($matches);
    preg_match("/([a-zA-Z0-9\\.\\-\\_\\s\\(\\)]+)\\.([a-zA-Z0-9]+)\$/", $file, $matches);
    $info = array();
    $info['name'] = $file;
    if (isset($file[17])) {
        $info['name'] = substr($matches[1], 0, 13 - strlen($matches[2])) . '...' . $matches[2];
    }
    $info['ext'] = $matches[2];
    $info['type'] = 'file';
    $stat = @stat(NV_ROOTDIR . '/' . $pathimg . '/' . $file);
    $info['filesize'] = $stat['size'];
    $info['src'] = NV_ASSETS_DIR . '/images/file.gif';
    $info['srcwidth'] = 32;
    $info['srcheight'] = 32;
    $info['size'] = '|';
    $ext = strtolower($matches[2]);
    if (in_array($ext, $array_images)) {
        $size = @getimagesize(NV_ROOTDIR . '/' . $pathimg . '/' . $file);
        $info['type'] = 'image';
        $info['src'] = $pathimg . '/' . $file;
        $info['srcwidth'] = intval($size[0]);
        $info['srcheight'] = intval($size[1]);
        $info['size'] = intval($size[0]) . '|' . intval($size[1]);
        if (preg_match('/^' . nv_preg_quote(NV_UPLOADS_DIR) . '\\/([a-z0-9\\-\\_\\.\\/]+)$/i', $pathimg . '/' . $file, $m)) {
            if (($thub_src = nv_get_viewImage($pathimg . '/' . $file)) !== false) {
                $info['src'] = $thub_src[0];
                $info['srcwidth'] = $thub_src[1];
                $info['srcheight'] = $thub_src[2];
            }
        }
        if ($info['srcwidth'] > 80) {
            $info['srcheight'] = round(80 / $info['srcwidth'] * $info['srcheight']);
            $info['srcwidth'] = 80;
        }
        if ($info['srcheight'] > 80) {
            $info['srcwidth'] = round(80 / $info['srcheight'] * $info['srcwidth']);
            $info['srcheight'] = 80;
        }
    } elseif (in_array($ext, $array_flash)) {
        $info['type'] = 'flash';
        $info['src'] = NV_ASSETS_DIR . '/images/flash.gif';
        if ($matches[2] == 'swf') {
            $size = @getimagesize(NV_ROOTDIR . '/' . $pathimg . '/' . $file);
            if (isset($size, $size[0], $size[1])) {
                $info['size'] = $size[0] . '|' . $size[1];
            }
        }
    } elseif (in_array($ext, $array_archives)) {
        $info['src'] = NV_ASSETS_DIR . '/images/zip.gif';
    } elseif (in_array($ext, $array_documents)) {
        if ($ext == 'doc' or $ext == 'docx') {
            $info['src'] = NV_ASSETS_DIR . '/images/msword.png';
        } elseif ($ext == 'xls' or $ext == 'xlsx') {
            $info['src'] = NV_ASSETS_DIR . '/images/excel.png';
        } elseif ($ext == 'pdf') {
            $info['src'] = NV_ASSETS_DIR . '/images/pdf.png';
        } else {
            $info['src'] = NV_ASSETS_DIR . '/images/doc.gif';
        }
    }
    $info['userid'] = 0;
    $info['mtime'] = $stat['mtime'];
    return $info;
}
开发者ID:nukeviet,项目名称:nukeviet,代码行数:75,代码来源:functions.php

示例14: nv_is_file

/**
 * nv_is_file()
 *
 * @param mixed $filepath
 * @param mixed $folders
 * @return
 */
function nv_is_file($filepath, $folders = array())
{
    if (empty($folders)) {
        $folders = array(NV_UPLOADS_DIR, NV_ASSETS_DIR . '/images');
    } elseif (!is_array($folders)) {
        $folders = array($folders);
    }
    $filepath = htmlspecialchars(trim(NV_DOCUMENT_ROOT . $filepath), ENT_QUOTES);
    $filepath = rtrim($filepath, '/');
    if (empty($filepath)) {
        return false;
    }
    if (($filepath = realpath($filepath)) === false) {
        return false;
    }
    $filepath = str_replace("\\", '/', $filepath);
    $file_exists = 0;
    foreach ($folders as $folder) {
        if (preg_match('/^' . nv_preg_quote(NV_ROOTDIR . '/' . $folder) . '/', $filepath) and is_file($filepath)) {
            $file_exists++;
        }
    }
    return $file_exists > 0 ? true : false;
}
开发者ID:nukeviet,项目名称:nukeviet,代码行数:31,代码来源:filesystem_functions.php

示例15: nv_getextension

}
$newalt = $nv_Request->get_title('newalt', 'post', $newname, 1);
$ext = nv_getextension($file);
$newname = $newname . '.' . $ext;
if ($file != $newname) {
    $newname2 = $newname;
    $i = 1;
    while (file_exists(NV_ROOTDIR . '/' . $path . '/' . $newname2)) {
        $newname2 = preg_replace('/(.*)(\\.[a-zA-Z0-9]+)$/', '\\1_' . $i . '\\2', $newname);
        ++$i;
    }
    $newname = $newname2;
    if (!@rename(NV_ROOTDIR . '/' . $path . '/' . $file, NV_ROOTDIR . '/' . $path . '/' . $newname)) {
        die('ERROR_' . $lang_module['errorNotRenameFile']);
    }
    if (preg_match('/^' . nv_preg_quote(NV_UPLOADS_DIR) . '\\/(([a-z0-9\\-\\_\\/]+\\/)*([a-z0-9\\-\\_\\.]+)(\\.(gif|jpg|jpeg|png|bmp)))$/i', $path . '/' . $file, $m)) {
        @nv_deletefile(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $m[1]);
    }
    if (isset($array_dirname[$path])) {
        $info = nv_getFileInfo($path, $newname);
        $sth = $db->prepare("UPDATE " . NV_UPLOAD_GLOBALTABLE . "_file SET name = '" . $info['name'] . "', src = '" . $info['src'] . "', title = '" . $newname . "', alt = :newalt WHERE did = " . $array_dirname[$path] . " AND title = '" . $file . "'");
        $sth->bindParam(':newalt', $newalt, PDO::PARAM_STR);
        $sth->execute();
    }
    nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['rename'], $path . '/' . $file . ' -> ' . $path . '/' . $newname, $admin_info['userid']);
} else {
    $sth = $db->prepare("UPDATE " . NV_UPLOAD_GLOBALTABLE . "_file SET alt = :newalt WHERE did = " . $array_dirname[$path] . " AND title = '" . $file . "'");
    $sth->bindParam(':newalt', $newalt, PDO::PARAM_STR);
    $sth->execute();
    nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['rename'], $path . '/' . $file . ' -> ' . $path . '/' . $newname, $admin_info['userid']);
}
开发者ID:nukeplus,项目名称:nuke,代码行数:31,代码来源:renameimg.php


注:本文中的nv_preg_quote函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。