Пример #1
0
include_once APP_PATH . "includes/smarty/Smarty.class.php";
include_once APP_PATH . "includes/phpmailer/class.phpmailer.php";
include_once APP_PATH . "includes/function/seback_func.php";
include_once APP_PATH . "includes/function/func.php";
include_once APP_PATH . "includes/config/conn.php";
include_once APP_PATH . "includes/config/config.php";
//---Jones 函數
include_once APP_PATH . "includes/project/function.php";
//---qrcode
include_once APP_PATH . "includes/phpqrcode/qrlib.php";
//--ini設定檔案讀取
if (!$_SESSION["web_ini_data"] || $_POST || $_SESSION["web_ini_time"] * 1 + 600 < strtotime(date("Y-m-d H:i:s"))) {
    $ini_webset = $_SESSION["web_ini_data"] = parse_ini_file(APP_PATH . "includes/config/web_set.ini", true);
    $_SESSION["web_ini_time"] = strtotime(date("Y-m-d H:i:s"));
    if (count($ini_webset) > 0 && $ini_webset["web_set"]["upload_check_status"] == '1') {
        $ini_webset["web_set"]["now_file"] = CalcDirectorySize('../upload/');
        //-bytes  取得客戶已上傳的所有檔案資料大小
        if ($ini_webset["web_set"]["iniloadcheck"] != NULL && trim($ini_webset["web_set"]["upload_max_size"]) !== '') {
            write_php_ini($ini_webset, APP_PATH . "includes/config/web_set.ini");
        }
        //寫入大小現值
    }
} else {
    $ini_webset = $_SESSION["web_ini_data"];
}
$tpl = new Smarty();
$tpl->left_delimiter = '({';
$tpl->right_delimiter = '})';
$tpl->template_dir = APP_PATH . "templates/";
$tpl->compile_dir = APP_PATH . "templates_c/";
$tpl->config_dir = APP_PATH . "configs/";
Пример #2
0
function CalcDirectorySize($DirectoryPath)
{
    // I reccomend using a normalize_path function here
    // to make sure $DirectoryPath contains an ending slash
    // (-> http://www.jonasjohn.de/snippets/php/normalize-path.htm)
    // To display a good looking size you can use a readable_filesize
    // function.
    // (-> http://www.jonasjohn.de/snippets/php/readable-filesize.htm)
    $Size = 0;
    $Dir = opendir($DirectoryPath);
    if (!$Dir) {
        return -1;
    }
    while (($File = readdir($Dir)) !== false) {
        // Skip file pointers
        if ($File[0] == '.') {
            continue;
        }
        // Go recursive down, or add the file size
        if (is_dir($DirectoryPath . $File)) {
            $Size += CalcDirectorySize($DirectoryPath . $File . DIRECTORY_SEPARATOR);
        } else {
            $Size += filesize($DirectoryPath . $File);
        }
    }
    closedir($Dir);
    return $Size;
}