Changeset 902
- Timestamp:
- 2012-05-29T04:25:41+02:00 (12 months ago)
- Location:
- trunk
- Files:
-
- 9 edited
- 1 moved
-
ChangeLog (modified) (1 diff)
-
NEWS (modified) (1 diff)
-
admin/common-en.lang.php (modified) (1 diff)
-
admin/common.php (modified) (7 diffs)
-
admin/config.default.php (moved) (moved from trunk/admin/config.php.example) (3 diffs)
-
admin/edit.php (modified) (2 diffs)
-
admin/header.tpl.php (modified) (1 diff)
-
admin/help.php (modified) (1 diff)
-
admin/xcache.php (modified) (2 diffs)
-
admin/xcache.tpl.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r901 r902 3 3 ======== 4 4 * fixed #279: segv when cache is full (since 2.0) 5 * admin/ config changed. please update accordingly 5 6 6 7 2.0.0 2012-04-20 -
trunk/NEWS
r901 r902 2 2 ======== 3 3 * improve stability 4 * admin/ config changed. please update accordingly 4 5 5 6 2.0.0 2012-04-20 -
trunk/admin/common-en.lang.php
r605 r902 1 1 <?php 2 2 3 $GLOBALS[' show_todo_strings'] = false;3 $GLOBALS['config']['show_todo_strings'] = false; 4 4 5 5 ?> -
trunk/admin/common.php
r783 r902 41 41 function get_language_file($name) 42 42 { 43 global $c harset, $lang;44 $s = strtolower($c harset);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']); 47 47 $file = get_language_file_ex($name, $l, $s); 48 48 if (!isset($file)) { … … 56 56 $file = get_language_file_ex($name, $l, $s); 57 57 if (isset($file)) { 58 $ lang= $l;58 $config['lang'] = $l; 59 59 break; 60 60 } … … 63 63 $file = get_language_file_ex($name, $ll, $s); 64 64 if (isset($file)) { 65 $ lang= $l;65 $config['lang'] = $l; 66 66 break; 67 67 } … … 77 77 return $GLOBALS['strings'][$str]; 78 78 } 79 if (!empty($GLOBALS[' show_todo_strings'])) {79 if (!empty($GLOBALS['config']['show_todo_strings'])) { 80 80 return '<span style="color:red">' . htmlspecialchars($str) . '</span>'; 81 81 } … … 96 96 } 97 97 98 function 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 98 112 error_reporting(E_ALL); 99 113 ini_set('display_errors', 'On'); … … 105 119 $_POST = stripaddslashes_array($_POST, $mqs); 106 120 $_REQUEST = stripaddslashes_array($_REQUEST, $mqs); 121 unset($mqs); 107 122 } 108 123 ini_set('magic_quotes_runtime', '0'); 109 124 110 $charset = "UTF-8"; 125 $config = array(); 126 include("./config.default.php"); 111 127 if (file_exists("./config.php")) { 112 128 include("./config.php"); … … 114 130 115 131 include(get_language_file("common")); 116 if ( !isset($lang)) {117 $ lang= 'en-us';132 if (empty($config['lang'])) { 133 $config['lang'] = 'en-us'; 118 134 } 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;123 135 124 136 ?> -
trunk/admin/config.default.php
r900 r902 1 1 <?php 2 2 3 // this is an example only4 // write your own config and name it as config.php3 // this is default config, DO NOT modify this file 4 // copy this file and write your own config and name it as config.php 5 5 6 6 // detected by browser 7 // $ lang= 'en-us';7 // $config['lang'] = 'en-us'; 8 8 9 $c harset= "UTF-8";9 $config['charset'] = "UTF-8"; 10 10 11 // developers only12 $ show_todo_strings= false;11 // translators only 12 $config['show_todo_strings'] = false; 13 13 14 14 // width of graph for free or usage blocks 15 $usage_graph_width = 120; 16 // do not define both with 17 // $free_graph_width = 120; 15 $config['percent_graph_width'] = 120; 16 $config['percent_graph_type'] = 'used'; // either 'used' or 'free' 18 17 19 18 // only enable if you have password protection for admin page 20 19 // enabling this option will cause user to eval() whatever code they want 21 $ enable_eval= false;20 $config['enable_eval'] = false; 22 21 23 // this function is detected by xcache.tpl.php, and enabled if function_exists24 22 // this ob filter is applied for the cache list, not the whole page 25 function ob_filter_path_nicer($o) 23 $config['path_nicer'] = 'ob_filter_path_nicer_default'; 24 25 /* 26 function custom_ob_filter_path_nicer($list_html) 26 27 { 27 $sep = DIRECTORY_SEPARATOR; 28 $d = $_SERVER['DOCUMENT_ROOT']; 29 $o = str_replace($d, "{DOCROOT}" . (substr($d, -1) == $sep ? $sep : ""), $o); 30 $xcachedir = realpath(dirname(__FILE__) . "$sep..$sep"); 31 $o = str_replace($xcachedir . $sep, "{XCache}$sep", $o); 32 if ($sep == '/') { 33 $o = str_replace("/home/", "{H}/", $o); 34 } 35 return $o; 28 $list_html = ob_filter_path_nicer_default($list_html); // this function is from common.php 29 return $list_html; 36 30 } 31 $config['path_nicer'] = 'custom_ob_filter_path_nicer'; 32 */ 37 33 38 34 // you can simply let xcache to do the http auth … … 40 36 // {{{ home made login example 41 37 // this is an example only, it's won't work for you without your implemention. 38 /* 42 39 function check_admin_and_by_pass_xcache_http_auth() 43 40 { … … 63 60 } 64 61 65 // uncomment: 66 // check_admin_and_by_pass_xcache_http_auth(); 62 check_admin_and_by_pass_xcache_http_auth(); 63 */ 67 64 // }}} 68 65 66 /* by pass XCache http auth 67 $_SERVER["PHP_AUTH_USER"] = "moo"; 68 $_SERVER["PHP_AUTH_PW"] = "your-xcache-password"; 69 */ 70 69 71 ?> -
trunk/admin/edit.php
r605 r902 12 12 13 13 if ($_SERVER['REQUEST_METHOD'] == 'POST') { 14 if ( $enable_eval) {14 if (!empty($config['enable_eval'])) { 15 15 eval('$value = ' . $_POST['value']); 16 16 } … … 23 23 } 24 24 $value = xcache_get($name); 25 if ( $enable_eval) {25 if (!empty($enable['enable_eval'])) { 26 26 $value = var_export($value, true); 27 27 $editable = true; -
trunk/admin/header.tpl.php
r605 r902 4 4 <?php 5 5 echo <<<HEAD 6 <meta http-equiv="Content-Type" content="text/html; charset=$c harset" />7 <meta http-equiv="Content-Language" content="$ lang" />8 <script type="text/javascript" src="tablesort.js" charset="$c harset"></script>6 <meta http-equiv="Content-Type" content="text/html; charset=$config[charset]" /> 7 <meta http-equiv="Content-Language" content="$config[lang]" /> 8 <script type="text/javascript" src="tablesort.js" charset="$config[charset]"></script> 9 9 HEAD; 10 10 ?> -
trunk/admin/help.php
r605 r902 7 7 <?php 8 8 echo <<<HEAD 9 <meta http-equiv="Content-Type" content="text/html; charset=$c harset" />10 <meta http-equiv="Content-Language" content="$ lang" />11 <script type="text/javascript" src="tablesort.js" charset="$c harset"></script>9 <meta http-equiv="Content-Type" content="text/html; charset=$config[charset]" /> 10 <meta http-equiv="Content-Language" content="$config[lang]" /> 11 <script type="text/javascript" src="tablesort.js" charset="$config[charset]"></script> 12 12 HEAD; 13 13 ?> -
trunk/admin/xcache.php
r868 r902 77 77 function freeblock_to_graph($freeblocks, $size) 78 78 { 79 global $ graph_width, $usage_graph_width, $free_graph_width;79 global $config; 80 80 81 81 // cached in static variable 82 82 static $graph_initial; 83 83 if (!isset($graph_initial)) { 84 $graph_initial = array_fill(0, $ graph_width, 0);84 $graph_initial = array_fill(0, $config['percent_graph_width'], 0); 85 85 } 86 86 $graph = $graph_initial; 87 87 foreach ($freeblocks as $b) { 88 $begin = $b['offset'] / $size * $ graph_width;89 $end = ($b['offset'] + $b['size']) / $size * $ graph_width;88 $begin = $b['offset'] / $size * $config['percent_graph_width']; 89 $end = ($b['offset'] + $b['size']) / $size * $config['percent_graph_width']; 90 90 91 91 if ((int) $begin == (int) $end) { … … 104 104 $c = 255; 105 105 foreach ($graph as $k => $v) { 106 if ( !isset($free_graph_width)) {106 if ($config['percent_graph_type'] != 'free') { 107 107 $v = 1 - $v; 108 108 } -
trunk/admin/xcache.tpl.php
r868 r902 33 33 <th><?php echo _T('Size'); ?></th> 34 34 <th><?php echo _T('Avail'); ?></th> 35 <th><?php echo _T( isset($free_graph_width)? '% Free' : '% Used'); ?></th>35 <th><?php echo _T($config['percent_graph_type'] == 'free' ? '% Free' : '% Used'); ?></th> 36 36 <th><?php echo _T('Clear'); ?></th> 37 37 <th><?php echo _T('Compiling'); ?></th> … … 58 58 $pvalue = (int) ($ci['avail'] / $ci['size'] * 100); 59 59 $pempty = 100 - $pvalue; 60 if ( !isset($free_graph_width)) {60 if ($config['percent_graph_type'] == 'used') { 61 61 // swap 62 62 $tmp = $pvalue; … … 65 65 } 66 66 67 $w = $ graph_width;67 $w = $config['percent_graph_width']; 68 68 if (empty($ci['istotal'])) { 69 69 $graph = freeblock_to_graph($ci['free_blocks'], $ci['size']); … … 135 135 <div class="legendtitle"><?php echo _T('Legends:'); ?></div> 136 136 <div class="legend pvalue"> </div> 137 <div class="legendtitle"><?php echo _T( isset($free_graph_width)? '% Free' : '% Used'); ?></div>137 <div class="legendtitle"><?php echo _T($config['percent_graph_type'] == 'free' ? '% Free' : '% Used'); ?></div> 138 138 <div class="legend" style="background: rgb(0,0,255)"> </div> 139 <div class="legendtitle"><?php echo _T( isset($free_graph_width)? 'Free Blocks' : 'Used Blocks'); ?></div>139 <div class="legendtitle"><?php echo _T($config['percent_graph_type'] == 'free' ? 'Free Blocks' : 'Used Blocks'); ?></div> 140 140 <div class="legend" style="background: rgb(255,0,0)"> </div> 141 141 <div class="legendtitle"><?php echo _T('Hits'); ?></div> … … 145 145 if ($cachelist) { 146 146 $isphp = $cachelist['type'] == $type_php; 147 if (function_exists("ob_filter_path_nicer")) { 148 ob_start("ob_filter_path_nicer"); 149 } 147 ob_start($config['path_nicer']); 150 148 foreach (array('Cached' => $cachelist['cache_list'], 'Deleted' => $cachelist['deleted_list']) as $listname => $entries) { 151 149 $a->reset(); … … 261 259 <?php 262 260 } 263 if (function_exists("ob_filter_path_nicer")) { 264 ob_end_flush(); 265 } 261 ob_end_flush(); 266 262 } 267 263 if ($moduleinfo) {
Note: See TracChangeset
for help on using the changeset viewer.

