function loadcfg($d) { $arr = array(); if (ufile_exists(pathjoin($d, 'config.ini'))) { $s = ufile_get_contents(pathjoin($d, 'config.ini')); $s = preg_replace("/[\r\n]+/s", "\n", $s); $a = explode("\n", $s); foreach ($a as $l) { $n = strpos($l, '='); if ($n !== false) { $key = trim(substr($l, 0, $n)); $val = trim(substr($l, $n + 1)); $arr[$key] = $val; } else { $arr[$l] = true; } } } return $arr; }
if (!ufile_exists($rootdir . $file)) { header('HTTP/1.0 404 Not Found'); die; } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link href="common.css" rel="stylesheet" type="text/css" /> <link href="<?php echo $CFG['gcpurl']; ?> prettify.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="<?php echo $CFG['gcpurl']; ?> prettify.js"></script> </head> <body onload="prettyPrint()"> <div style="font-size:10pt;"><?php echo mklink($_GET['base'], $_GET['file']); ?> </div> <pre class="prettyprint"><?php $s = ufile_get_contents($rootdir . $file); echo dehtml(mb_convert_encoding($s, 'UTF-8', mb_detect_encoding($s))); ?> </pre> </body> </html>