Example #1
0
/**
 * nv_set_authorization()
 *
 * @return
 */
function nv_set_authorization()
{
    $auth_user = $auth_pw = '';
    if (nv_getenv('PHP_AUTH_USER')) {
        $auth_user = nv_getenv('PHP_AUTH_USER');
    } elseif (nv_getenv('REMOTE_USER')) {
        $auth_user = nv_getenv('REMOTE_USER');
    } elseif (nv_getenv('AUTH_USER')) {
        $auth_user = nv_getenv('AUTH_USER');
    } elseif (nv_getenv('HTTP_AUTHORIZATION')) {
        $auth_user = nv_getenv('HTTP_AUTHORIZATION');
    } elseif (nv_getenv('Authorization')) {
        $auth_user = nv_getenv('Authorization');
    }
    if (nv_getenv('PHP_AUTH_PW')) {
        $auth_pw = nv_getenv('PHP_AUTH_PW');
    } elseif (nv_getenv('REMOTE_PASSWORD')) {
        $auth_pw = nv_getenv('REMOTE_PASSWORD');
    } elseif (nv_getenv('AUTH_PASSWORD')) {
        $auth_pw = nv_getenv('AUTH_PASSWORD');
    }
    if (strcmp(substr($auth_user, 0, 6), 'Basic ') == 0) {
        $usr_pass = base64_decode(substr($auth_user, 6));
        if (!empty($usr_pass) && strpos($usr_pass, ':') !== false) {
            list($auth_user, $auth_pw) = explode(':', $usr_pass);
        }
        unset($usr_pass);
    }
    return array('auth_user' => $auth_user, 'auth_pw' => $auth_pw);
}
Example #2
0
/**
 * 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;
}
Example #3
0
 * @Project NUKEVIET 4.x
 * @Author VINADES.,JSC (contact@vinades.vn)
 * @Copyright (C) 2014 VINADES.,JSC. All rights reserved
 * @License GNU/GPL version 2 or any later version
 * @Createdate 2-1-2010 22:5
 */
if (!defined('NV_IS_FILE_SITEINFO')) {
    die('Stop!!!');
}
$page_title = $lang_module['site_configs_info'];
$info = array();
$info['website'] = array('caption' => $lang_module['site_configs_info'], 'field' => array(array('key' => $lang_module['site_domain'], 'value' => NV_MY_DOMAIN), array('key' => $lang_module['site_url'], 'value' => $global_config['site_url']), array('key' => $lang_module['site_root'], 'value' => NV_ROOTDIR), array('key' => $lang_module['site_script_path'], 'value' => $nv_Request->base_siteurl), array('key' => $lang_module['site_cookie_domain'], 'value' => $global_config['cookie_domain']), array('key' => $lang_module['site_cookie_path'], 'value' => $global_config['cookie_path']), array('key' => $lang_module['site_session_path'], 'value' => $sys_info['sessionpath']), array('key' => $lang_module['site_timezone'], 'value' => NV_SITE_TIMEZONE_NAME . (NV_SITE_TIMEZONE_GMT_NAME != NV_SITE_TIMEZONE_NAME ? ' (' . NV_SITE_TIMEZONE_GMT_NAME . ')' : ''))));
if (defined('NV_IS_GODADMIN')) {
    $global_config['version'] .= '<a href="' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=webtools&amp;' . NV_OP_VARIABLE . '=checkupdate">' . $lang_module['checkversion'] . '</a>';
}
$info['server'] = array('caption' => $lang_module['server_configs_info'], 'field' => array(array('key' => $lang_module['version'], 'value' => $global_config['version']), array('key' => $lang_module['server_phpversion'], 'value' => PHP_VERSION != '' ? PHP_VERSION : phpversion()), array('key' => $lang_module['server_api'], 'value' => (nv_function_exists('apache_get_version') ? apache_get_version() . ', ' : (nv_getenv('SERVER_SOFTWARE') != '' ? nv_getenv('SERVER_SOFTWARE') . ', ' : '')) . (PHP_SAPI != '' ? PHP_SAPI : php_sapi_name())), array('key' => $lang_module['server_phpos'], 'value' => $sys_info['os']), array('key' => $lang_module['server_databaseversion'], 'value' => $db->getAttribute(PDO::ATTR_DRIVER_NAME) . ' ' . $db->getAttribute(PDO::ATTR_SERVER_VERSION))));
if (defined('NV_IS_GODADMIN') and substr($sys_info['os'], 0, 3) != 'WIN') {
    $info['chmod'] = array('caption' => $lang_module['chmod'], 'field' => array(array('key' => NV_DATADIR, 'value' => is_writable(NV_ROOTDIR . '/' . NV_DATADIR) ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_CACHEDIR, 'value' => is_writable(NV_ROOTDIR . '/' . NV_CACHEDIR) ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_UPLOADS_DIR, 'value' => is_writable(NV_ROOTDIR . '/' . NV_UPLOADS_DIR) ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_TEMP_DIR, 'value' => is_writable(NV_ROOTDIR . '/' . NV_TEMP_DIR) ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . '/data_logs', 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/data_logs') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . '/dump_backup', 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/error_logs') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . '/error_logs', 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/error_logs') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . '/error_logs/errors256', 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/error_logs/errors256') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . '/error_logs/old', 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/error_logs/old') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . '/error_logs/tmp', 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/error_logs/tmp') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . '/ip_logs', 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/ip_logs') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . '/ref_logs', 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/ref_logs') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . '/voting_logs', 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/voting_logs') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need'])));
    if ($dh = opendir(NV_ROOTDIR . '/' . NV_CACHEDIR)) {
        while (($modname = readdir($dh)) !== false) {
            if (preg_match('/^([a-z0-9\\_]+)$/', $modname)) {
                $info['chmod']['field'][] = array('key' => NV_CACHEDIR . '/' . $modname, 'value' => is_writable(NV_CACHEDIR . '/' . $modname) ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']);
            }
        }
        closedir($dh);
    }
}
$xtpl = new XTemplate('system_info.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
$xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
$xtpl->assign('LANG', $lang_module);
foreach ($info as $key => $if) {
 /**
  * download::download_file()
  * 
  * @return
  */
 public function download_file()
 {
     if (!$this->properties['path']) {
         die("Nothing to download!");
     }
     $seek_start = 0;
     $seek_end = -1;
     $data_section = false;
     if (($http_range = nv_getenv('HTTP_RANGE')) != "") {
         $seek_range = substr($http_range, strlen('bytes='));
         $range = explode('-', $seek_range);
         if (!empty($range[0])) {
             $seek_start = intval($range[0]);
         }
         if (isset($range[1]) and !empty($range[1])) {
             $seek_end = intval($range[1]);
         }
         if (!$this->properties['resume']) {
             $seek_start = 0;
         } else {
             $data_section = true;
         }
     }
     @ob_end_clean();
     $old_status = ignore_user_abort(true);
     if (defined('ALLOWED_SET_TIME_LIMIT')) {
         set_time_limit(0);
     }
     if ($seek_start > $this->properties['size'] - 1) {
         $seek_start = 0;
     }
     $res = fopen($this->properties['path'], 'rb');
     if (!$res) {
         die('File error');
     }
     if ($seek_start) {
         fseek($res, $seek_start);
     }
     if ($seek_end < $seek_start) {
         $seek_end = $this->properties['size'] - 1;
     }
     header("Pragma: public");
     header("Expires: 0");
     header("Cache-Control:");
     header("Cache-Control: public");
     header("Content-Description: File Transfer");
     header("Content-Type: " . $this->properties['type']);
     if (strstr($this->nv_getenv('HTTP_USER_AGENT'), "MSIE") != false) {
         header('Content-Disposition: attachment; filename="' . urlencode($this->properties['name']) . '";');
     } else {
         header('Content-Disposition: attachment; filename="' . $this->properties['name'] . '";');
     }
     header('Last-Modified: ' . date('D, d M Y H:i:s \\G\\M\\T', $this->properties['mtime']));
     if ($data_section and $this->properties['resume']) {
         header("HTTP/1.1 206 Partial Content");
         header("Status: 206 Partial Content");
         header('Accept-Ranges: bytes');
         header("Content-Range: bytes " . $seek_start . "-" . $seek_end . "/" . $this->properties['size']);
         header("Content-Length: " . ($seek_end - $seek_start + 1));
     } else {
         header("Content-Length: " . $this->properties['size']);
     }
     while (!(connection_aborted() or connection_status() == 1) and !feof($res)) {
         if (($speed = $this->properties['max_speed']) > 0) {
             $sleep_time = 8 / $speed * 1000000.0;
         } else {
             $sleep_time = 0;
         }
         print fread($res, 1024 * 8);
         flush();
         usleep($sleep_time);
     }
     fclose($res);
     ignore_user_abort($old_status);
     if (defined('ALLOWED_SET_TIME_LIMIT')) {
         set_time_limit(ini_get("max_execution_time"));
     }
     exit;
 }
             $nv_Request->unset_request('admin_login_redirect', 'session');
             if (!empty($redirect) and nv_is_myreferer($redirect) == 1 and strpos($redirect, NV_NAME_VARIABLE . '=siteinfo&' . NV_OP_VARIABLE . '=notification_load') == 0) {
                 Header('Location: ' . nv_url_rewrite($redirect, true));
                 exit;
             } else {
                 Header('Location: ' . NV_BASE_ADMINURL);
                 exit;
             }
         }
     }
 }
 if ($check_hits > $global_config['adminrelogin_max']) {
     $nv_Request->unset_request('admin,online', 'session');
     $nv_Request->unset_request('admin_relogin_redirect', 'session');
     if (!empty($redirect) and nv_is_myreferer($redirect) == 1 and strpos($redirect, NV_NAME_VARIABLE . '=siteinfo&' . NV_OP_VARIABLE . '=notification_load') == 0) {
         $server_name = preg_replace('/^www\\./', '', nv_getenv('HTTP_HOST'));
         $nohttp_redirect = preg_replace(array('/^[a-zA-Z]+\\:\\/\\//', '/www\\./'), array('', ''), $redirect);
         if (!preg_match('/^' . preg_quote($server_name) . '\\/' . preg_quote(NV_ADMINDIR) . '/', $nohttp_redirect)) {
             Header('Location: ' . $redirect);
             exit;
         }
     }
     Header('Location: ' . NV_BASE_SITEURL);
     die;
 }
 $info = !empty($error) ? '<div class="error">' . sprintf($lang_global['relogin_error_info'], $error, $global_config['adminrelogin_max'] - $check_hits + 1) . '</div>' : '<div class="normal">' . sprintf($lang_global['relogin_info'], $global_config['adminrelogin_max'] - $check_hits + 1) . '</div>';
 $size = @getimagesize(NV_ROOTDIR . '/' . $global_config['site_logo']);
 if ($size[0] > 490) {
     $size[1] = ceil(490 * $size[1] / $size[0]);
     $size[0] = 490;
 }
Example #6
0
 /**
  * download::download_file()
  *
  * @return
  */
 public function download_file()
 {
     if (!$this->properties['path']) {
         die('Nothing to download!');
     }
     $seek_start = 0;
     $seek_end = -1;
     $data_section = false;
     if (($http_range = nv_getenv('HTTP_RANGE')) != '') {
         $seek_range = substr($http_range, 6);
         $range = explode('-', $seek_range);
         if (!empty($range[0])) {
             $seek_start = intval($range[0]);
         }
         if (isset($range[1]) and !empty($range[1])) {
             $seek_end = intval($range[1]);
         }
         if (!$this->properties['resume']) {
             $seek_start = 0;
         } else {
             $data_section = true;
         }
     }
     if (@ob_get_length()) {
         @ob_end_clean();
     }
     $old_status = ignore_user_abort(true);
     if (!$this->safe_mode and function_exists('set_time_limit') and !in_array('set_time_limit', $this->disable_functions)) {
         set_time_limit(0);
     }
     if ($seek_start > $this->properties['size'] - 1) {
         $seek_start = 0;
     }
     $res = fopen($this->properties['path'], 'rb');
     if (!$res) {
         die('File error');
     }
     if ($seek_start) {
         fseek($res, $seek_start);
     }
     if ($seek_end < $seek_start) {
         $seek_end = $this->properties['size'] - 1;
     }
     header('Pragma: public');
     header('Expires: 0');
     header('Cache-Control:');
     header('Cache-Control: public');
     header('Content-Description: File Transfer');
     header('Content-Type: ' . $this->properties['type']);
     if (strstr($this->nv_getenv('HTTP_USER_AGENT'), 'MSIE') != false) {
         header('Content-Disposition: attachment; filename="' . urlencode($this->properties['name']) . '";');
     } else {
         header('Content-Disposition: attachment; filename="' . $this->properties['name'] . '";');
     }
     header('Last-Modified: ' . date('D, d M Y H:i:s \\G\\M\\T', $this->properties['mtime']));
     if ($data_section and $this->properties['resume']) {
         header('HTTP/1.1 206 Partial Content');
         header('Status: 206 Partial Content');
         header('Accept-Ranges: bytes');
         header('Content-Range: bytes ' . $seek_start . '-' . $seek_end . '/' . $this->properties['size']);
         header('Content-Length: ' . ($seek_end - $seek_start + 1));
     } else {
         header('Content-Length: ' . $this->properties['size']);
     }
     if (function_exists('usleep') and !in_array('usleep', $this->disable_functions) and ($speed = $this->properties['max_speed']) > 0) {
         $sleep_time = 8 / $speed * 1000000.0;
     } else {
         $sleep_time = 0;
     }
     while (!(connection_aborted() or connection_status() == 1) and !feof($res)) {
         print fread($res, 1024 * 8);
         flush();
         if ($sleep_time > 0) {
             usleep($sleep_time);
         }
     }
     fclose($res);
     ignore_user_abort($old_status);
     if (!$this->safe_mode and function_exists('set_time_limit') and !in_array('set_time_limit', $this->disable_functions)) {
         set_time_limit(ini_get('max_execution_time'));
     }
     exit;
 }
Example #7
0
/**
 * @Project NUKEVIET 3.x
 * @Author VINADES.,JSC (contact@vinades.vn)
 * @Copyright (C) 2012 VINADES.,JSC. All rights reserved
 * @Createdate 2-1-2010 22:5
 */
if (!defined('NV_IS_FILE_SITEINFO')) {
    die('Stop!!!');
}
$page_title = $lang_module['site_configs_info'];
$info = array();
$info['website'] = array('caption' => $lang_module['site_configs_info'], 'field' => array(array('key' => $lang_module['site_domain'], 'value' => NV_MY_DOMAIN), array('key' => $lang_module['site_url'], 'value' => $global_config['site_url']), array('key' => $lang_module['site_root'], 'value' => NV_ROOTDIR), array('key' => $lang_module['site_script_path'], 'value' => $nv_Request->base_siteurl), array('key' => $lang_module['site_cookie_domain'], 'value' => $global_config['cookie_domain']), array('key' => $lang_module['site_cookie_path'], 'value' => $global_config['cookie_path']), array('key' => $lang_module['site_session_path'], 'value' => $sys_info['sessionpath']), array('key' => $lang_module['site_timezone'], 'value' => NV_SITE_TIMEZONE_NAME . (NV_SITE_TIMEZONE_GMT_NAME != NV_SITE_TIMEZONE_NAME ? " (" . NV_SITE_TIMEZONE_GMT_NAME . ")" : ""))));
if (defined('NV_IS_GODADMIN')) {
    $global_config['version'] .= "<a href=\"" . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=webtools&amp;" . NV_OP_VARIABLE . "=checkupdate\">" . $lang_module['checkversion'] . "</a>";
}
$info['server'] = array('caption' => $lang_module['server_configs_info'], 'field' => array(array('key' => $lang_module['version'], 'value' => $global_config['version']), array('key' => $lang_module['server_phpversion'], 'value' => PHP_VERSION != '' ? PHP_VERSION : phpversion()), array('key' => $lang_module['server_api'], 'value' => (nv_function_exists('apache_get_version') ? apache_get_version() . ', ' : (nv_getenv('SERVER_SOFTWARE') != '' ? nv_getenv('SERVER_SOFTWARE') . ', ' : '')) . (PHP_SAPI != '' ? PHP_SAPI : php_sapi_name())), array('key' => $lang_module['server_phpos'], 'value' => $sys_info['os']), array('key' => $lang_module['server_mysqlversion'], 'value' => $db->sql_version)));
$js = false;
if (defined('NV_IS_GODADMIN') and substr($sys_info['os'], 0, 3) != 'WIN') {
    $js = true;
    $info['chmod'] = array('caption' => $lang_module['chmod'], 'field' => array(array('key' => NV_DATADIR, 'value' => is_writable(NV_ROOTDIR . '/' . NV_DATADIR) ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_SESSION_SAVE_PATH, 'value' => is_writable(NV_ROOTDIR . '/' . NV_SESSION_SAVE_PATH) ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR, 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR) ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_CACHEDIR, 'value' => is_writable(NV_ROOTDIR . '/' . NV_CACHEDIR) ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_UPLOADS_DIR, 'value' => is_writable(NV_ROOTDIR . '/' . NV_UPLOADS_DIR) ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_TEMP_DIR, 'value' => is_writable(NV_ROOTDIR . '/' . NV_TEMP_DIR) ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . "/data_logs", 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . "/data_logs") ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . "/dump_backup", 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . "/error_logs") ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . "/error_logs", 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . "/error_logs") ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . "/error_logs/errors256", 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . "/error_logs/errors256") ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . "/error_logs/old", 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . "/error_logs/old") ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . "/error_logs/tmp", 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . "/error_logs/tmp") ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . "/ip_logs", 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . "/ip_logs") ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . "/ref_logs", 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . "/ref_logs") ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_LOGS_DIR . "/voting_logs", 'value' => is_writable(NV_ROOTDIR . '/' . NV_LOGS_DIR . "/voting_logs") ? $lang_module['chmod_noneed'] : $lang_module['chmod_need']), array('key' => NV_FILES_DIR . "/css", 'value' => is_writable(NV_ROOTDIR . '/' . NV_FILES_DIR . '/css') ? $lang_module['chmod_noneed'] : $lang_module['chmod_need'])));
}
$xtpl = new XTemplate("system_info.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file);
$xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
$xtpl->assign('LANG', $lang_module);
foreach ($info as $key => $if) {
    $xtpl->assign('CAPTION', $if['caption']);
    if ($key == 'chmod') {
        $xtpl->assign('URL', NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=siteinfo&amp;" . NV_OP_VARIABLE . "=checkchmod");
        $xtpl->parse('main.urlcap');
    } else {
        $xtpl->parse('main.textcap');
             $nv_Request->unset_request('admin_login_redirect', 'session');
             if (!empty($redirect) and nv_is_myreferer($redirect) == 1) {
                 Header("Location: " . $redirect);
                 exit;
             } else {
                 Header("Location: " . NV_BASE_ADMINURL);
                 exit;
             }
         }
     }
 }
 if ($check_hits > NV_ADMINRELOGIN_MAX) {
     $nv_Request->unset_request('admin,online', 'session');
     $nv_Request->unset_request('admin_relogin_redirect', 'session');
     if (!empty($redirect) and nv_is_myreferer($redirect) == 1) {
         $server_name = preg_replace('/^www\\./e', '', nv_getenv("HTTP_HOST"));
         $nohttp_redirect = preg_replace(array('/^[a-zA-Z]+\\:\\/\\//e', '/www\\./e'), array('', ''), $redirect);
         if (!preg_match("/^" . preg_quote($server_name) . '\\/' . preg_quote(NV_ADMINDIR) . "/", $nohttp_redirect)) {
             Header("Location: " . $redirect);
             exit;
         }
     }
     Header("Location: " . NV_BASE_SITEURL);
     die;
 }
 $info = !empty($error) ? '<div class="error">' . sprintf($lang_global['relogin_error_info'], $error, NV_ADMINRELOGIN_MAX - $check_hits + 1) . '</div>' : '<div class="normal">' . sprintf($lang_global['relogin_info'], NV_ADMINRELOGIN_MAX - $check_hits + 1) . '</div>';
 $size = @getimagesize(NV_ROOTDIR . '/images/' . $global_config['site_logo']);
 $dir_template = "";
 if (file_exists(NV_ROOTDIR . "/themes/" . $global_config['admin_theme'] . "/system/relogin.tpl")) {
     $dir_template = NV_ROOTDIR . "/themes/" . $global_config['admin_theme'] . "/system";
 } else {
/**
 * 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('/^www\\./e', '', nv_getenv("HTTP_HOST"));
    $referer_nohttp = preg_replace(array('/^[a-zA-Z]+\\:\\/\\//e', '/www\\./e'), array('', ''), $referer);
    if (preg_match("/^" . preg_quote($server_name) . "/", $referer_nohttp)) {
        return 1;
    }
    return 0;
}