Subversion Repositories qbpwcf-lib(archive)

Rev

Rev 753 | Rev 926 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
349 liveuser 1
<?php
2
 
615 liveuser 3
/*
4
 
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
846 liveuser 6
    Copyright (C) 2015~2025 Min-Jhin,Chen
615 liveuser 7
 
8
    This file is part of QBPWCF.
9
 
10
    QBPWCF is free software: you can redistribute it and/or modify
11
    it under the terms of the GNU General Public License as published by
12
    the Free Software Foundation, either version 3 of the License, or
13
    (at your option) any later version.
14
 
15
    QBPWCF is distributed in the hope that it will be useful,
16
    but WITHOUT ANY WARRANTY; without even the implied warranty of
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
    GNU General Public License for more details.
19
 
20
    You should have received a copy of the GNU General Public License
21
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.
22
 
23
*/
24
 
658 liveuser 25
#使用 qbpwcf 命名空間
26
namespace qbpwcf;
349 liveuser 27
 
753 liveuser 28
#以該檔案的實際位置的 lib path 為 include path 首位
29
exec("cd ".pathinfo(__FILE__)["dirname"]."/qbpwcf;pwd;",$output,$status);
30
set_include_path($output[0].PATH_SEPARATOR.get_include_path());
31
 
658 liveuser 32
#匯入套件
753 liveuser 33
require_once("allInOne.php");
349 liveuser 34
 
658 liveuser 35
#建議的log位置
36
$logFile=$_SERVER["DOCUMENT_ROOT"].$_SERVER["PHP_SELF"].".log";
349 liveuser 37
 
658 liveuser 38
#函式說明:
39
#依據行號分隔抓取檔案的內容,結果會回傳一個陣列
40
#回傳的變數說明:
41
#$result["status"],執行是否成功,"true"代表成功;"fasle"代表失敗.
42
#$result["error"],錯誤訊息提示.
43
#$result["warning"],警告訊息.
44
#$result["function"],當前執行的函數名稱.
45
#$result["fileContent"],爲檔案的內容陣列.
46
#$result["lineCount"],爲檔案內容總共的行數.
47
#$result["fullContent"],為檔案的完整內容.
48
#$result["base64data"],為檔案的base64內容.
49
#$result["mimeType"],為檔案的mime type.
50
#必填參數:
51
#$conf["filePositionAndName"],字串,爲檔案的位置以及名稱.
753 liveuser 52
$conf["filePositionAndName"]="Release Note";
658 liveuser 53
#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
54
$conf["fileArgu"]=__FILE__;
55
#可省略參數:
56
#$conf["web"],是要取得網路上的檔案則為"true";反之預設為"false".
57
#$conf["web"]="true";
58
#$conf["createIfnotExist"],字串,預設為"false"代表檔案不存在也不需要建立;反之為"true".
59
#$conf["createIfnotExist"]="false";
60
#參考資料:
61
#file(),取得檔案內容的行數.
62
#file=>http:#php.net/manual/en/function.file.php
63
#rtrim(),剔除透過file()取得每行內容結尾的換行符號.
64
#filesize=>http://php.net/manual/en/function.filesize.php
65
#參考資料:
66
#無.
67
#備註:
68
#無.
69
$getFileContent=fileAccess::getFileContent($conf);
70
unset($conf);
349 liveuser 71
 
658 liveuser 72
#如果執行失敗
73
if($getFileContent["status"]==="false"){
74
 
75
	#函式說明:
76
	#設定session變數後,立即轉址.
77
	#回傳的結果:
78
	#$result["status"],執行是否成功,"true"代表成功,"false"代表不成功.
79
	#$result["function"],當前執行的函數名稱.
80
	#$result["error"],錯誤訊息陣列.
81
	#必填參數:
82
	#$conf["headerLocation"],為要轉址到的地方,若爲 $_SERVER["PHP_SELF"],則爲回到目前頁面,全民資安素養網爲 https://isafe.moe.edu.tw/.
83
	$conf["headerLocation"]="https://sourceforge.net/projects/qbpwc/";
84
	#可省略參數:
85
	#$conf["sessionName"],字串陣列,可以指派session變數的名稱.
86
	#$conf["sessionName"]=array("");
87
	#$conf["sessionValue"]字串陣列,可以指派session變數的內容.
88
	#$conf["sessionValue"]=array("");
89
	#參考資料:
90
	#http://php.net/manual/en/reserved.variables.server.php
91
	#備註:
92
	#無.
93
	$redirectionNow=header::redirectionNow($conf);
94
	unset($conf);
95
 
96
	#如果執行失敗
97
	if($redirectionNow["status"]==="false"){
98
 
99
		#函式說明:
100
		#撰寫log
101
		#回傳結果:
102
		#$result["status"],狀態,"true"或"false".
103
		#$result["error"],錯誤訊息陣列.
104
		#$result["function"],當前函式的名稱.
105
		#$result["argu"],使用的參數.
106
		#$result["content"],要寫入log的內容字串.
107
		#必填參數:
108
		#$conf["path"],字串,log檔案的路徑與名稱.
109
		$conf["path"]=$logFile;
110
		#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
111
		$conf["content"]=$redirectionNow;
112
		#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
113
		$conf["fileArgu"]=__FILE__;
114
		#可省略參數:
115
		#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
116
		#$conf["rewrite"]="false";
117
		#$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
118
		#$conf["returnOnly"]="true";
119
		#參考資料:
120
		#無.
121
		#備註:
122
		#無.
123
		$record=logs::record($conf);
124
		unset($conf);
125
 
126
		#如果執行失敗
127
		if($record["status"]==="false"){
128
 
129
			#印出結果
130
			var_dump($record);
131
 
132
			#結束執行
133
			exit;
134
 
135
			}#if end
136
 
137
		#結束執行
138
		exit;
139
 
140
		}#if end
141
 
142
	}#if end
143
 
144
#var_dump($getFileContent["fileContent"]);exit;
145
 
146
#函式說明:
147
#顯示多行文字.
148
#回傳的結果:
149
#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
150
#$result["error"],錯誤訊息陣列.
151
#$result["function"],當前執行的函數名稱.
152
#$result["content"],語法.
153
#必填參數:
154
#$conf["string"],字串陣列,要放置的內容.
155
$conf["string"]=$getFileContent["fileContent"];
156
#可省略參數:
157
#$conf["class"],字串,要使用的css樣式名稱,預設為"__defaultTextStyle"
158
#$conf["class"]="";
159
#$conf["type"],字串,要用"div"或"span"或"br"或"p"或"EOL"來段行,預設為"EOL".
160
$conf["type"]="textarea";
161
#參考資料:
162
#無.
163
#備註:
164
#無.
165
$multiLine=text::multiLine($conf);
166
unset($conf);
167
 
168
#如果執行失敗
169
if($multiLine["status"]==="false"){
170
 
171
	#函式說明:
172
	#撰寫log
173
	#回傳結果:
174
	#$result["status"],狀態,"true"或"false".
175
	#$result["error"],錯誤訊息陣列.
176
	#$result["function"],當前函式的名稱.
177
	#$result["argu"],使用的參數.
178
	#$result["content"],要寫入log的內容字串.
179
	#必填參數:
180
	#$conf["path"],字串,log檔案的路徑與名稱.
181
	$conf["path"]=$logFile;
182
	#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
183
	$conf["content"]=$multiLine;
184
	#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
185
	$conf["fileArgu"]=__FILE__;
186
	#可省略參數:
187
	#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
188
	#$conf["rewrite"]="false";
189
	#$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
190
	#$conf["returnOnly"]="true";
191
	#參考資料:
192
	#無.
193
	#備註:
194
	#無.
195
	$record=logs::record($conf);
196
	unset($conf);
197
 
198
	#如果執行失敗
199
	if($record["status"]==="false"){
200
 
201
		#印出結果
202
		var_dump($record);
203
 
204
		#結束執行
205
		exit;
206
 
207
		}#if end
208
 
349 liveuser 209
	#結束執行
210
	exit;
211
 
212
	}#if end
213
 
658 liveuser 214
#印出結果
215
echo $multiLine["content"];
349 liveuser 216
 
217
?>