forked from Nekosyndrome/Yonkoma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.php
56 lines (47 loc) · 1.1 KB
/
default.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
define('PHP_SELF', 'default.php');
require './config.php';
require ROOTPATH . 'lib/pmclibrary.php';
require ROOTPATH . 'lib/lib_errorhandler.php';
require ROOTPATH . 'lib/lib_compatible.php';
require ROOTPATH . 'lib/lib_common.php';
/**
* 程式首次執行之初始化
* @return boolean 是否無錯誤完成
*/
function init() {
$PIO = PMCLibrary::getPIOInstance();
$FileIO = PMCLibrary::getFileIOInstance();
if (file_exists(PHP_SELF2)) {
return true;
}
if (!is_writable(STORAGE_PATH)) {
error(_T('init_permerror'));
return false;
}
createDirectories();
$PIO->dbInit();
$FileIO->init();
return true;
}
function createDirectories() {
$chkfolder = array(
IMG_DIR,
THUMB_DIR,
STORAGE_PATH . 'cache/'
);
foreach ($chkfolder as $value) {
if (!is_dir($value)) {
mkdir($value);
chmod($value, 0777);
}
}
}
function redirect() {
header("HTTP/1.1 301 Moved Permanently");
header("Location: pixmicat.php");
}
$result = init();
if ($result) {
redirect();
}