Changeset 902 in svn for trunk/admin/common.php


Ignore:
Timestamp:
2012-05-29T04:25:41+02:00 (3 years ago)
Author:
Xuefer
Message:

improve config handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/common.php

    r783 r902  
    4141function get_language_file($name)
    4242{
    43     global $charset, $lang;
    44     $s = strtolower($charset);
    45     if (isset($lang)) {
    46         $l = strtolower($lang);
     43    global $config;
     44    $s = strtolower($config['charset']);
     45    if (!empty($config['lang'])) {
     46        $l = strtolower($config['lang']);
    4747        $file = get_language_file_ex($name, $l, $s);
    4848        if (!isset($file)) {
     
    5656            $file = get_language_file_ex($name, $l, $s);
    5757            if (isset($file)) {
    58                 $lang = $l;
     58                $config['lang'] = $l;
    5959                break;
    6060            }
     
    6363                $file = get_language_file_ex($name, $ll, $s);
    6464                if (isset($file)) {
    65                     $lang = $l;
     65                    $config['lang'] = $l;
    6666                    break;
    6767                }
     
    7777        return $GLOBALS['strings'][$str];
    7878    }
    79     if (!empty($GLOBALS['show_todo_strings'])) {
     79    if (!empty($GLOBALS['config']['show_todo_strings'])) {
    8080        return '<span style="color:red">' . htmlspecialchars($str) . '</span>';
    8181    }
     
    9696}
    9797
     98function ob_filter_path_nicer_default($list_html)
     99{
     100    $sep = DIRECTORY_SEPARATOR;
     101    $docRoot = $_SERVER['DOCUMENT_ROOT'];
     102    $list_html = str_replace($docRoot,  "{DOCROOT}" . (substr($docRoot, -1) == $sep ? $sep : ""), $list_html);
     103    $xcachedir = realpath(dirname(__FILE__) . "$sep..$sep");
     104    $list_html = str_replace($xcachedir . $sep, "{XCache}$sep", $list_html);
     105    if ($sep == '/') {
     106        $list_html = str_replace("/home/", "{H}/", $list_html);
     107    }
     108    return $list_html;
     109}
     110
     111
    98112error_reporting(E_ALL);
    99113ini_set('display_errors', 'On');
     
    105119    $_POST = stripaddslashes_array($_POST, $mqs);
    106120    $_REQUEST = stripaddslashes_array($_REQUEST, $mqs);
     121    unset($mqs);
    107122}
    108123ini_set('magic_quotes_runtime', '0');
    109124
    110 $charset = "UTF-8";
     125$config = array();
     126include("./config.default.php");
    111127if (file_exists("./config.php")) {
    112128    include("./config.php");
     
    114130
    115131include(get_language_file("common"));
    116 if (!isset($lang)) {
    117     $lang = 'en-us';
     132if (empty($config['lang'])) {
     133    $config['lang'] = 'en-us';
    118134}
    119 if (!isset($usage_graph_width) && !isset($free_graph_width)) {
    120     $usage_graph_width = 120;
    121 }
    122 $graph_width = isset($free_graph_width) ? $free_graph_width : $usage_graph_width;
    123135
    124136?>
Note: See TracChangeset for help on using the changeset viewer.