| 3 |
liveuser |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
|
|
|
5 |
QBPWCF, Quick Build PHP website Component base on Fedora Linux.
|
|
|
6 |
Copyright (C) 2015~2025 Min-Jhin,Chen
|
|
|
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 |
|
|
|
25 |
#頁面說明:
|
|
|
26 |
#負責將其它類別匯入到該檔案裏面,這樣撰寫網頁的時候就只需要將此檔案匯入即可使用所有的類別函式
|
|
|
27 |
#該檔案,不適用於撰寫SOAP服務。
|
|
|
28 |
|
|
|
29 |
#使用方法:
|
|
|
30 |
/*
|
|
|
31 |
|
|
|
32 |
#只要匯入當前目錄底下的 allInOne.php 即可使用各式類別方法。
|
|
|
33 |
#匯入的範例:
|
|
|
34 |
|
|
|
35 |
<?php
|
|
|
36 |
|
|
|
37 |
#使用命名空間,請務必指派爲 qbpwcf
|
|
|
38 |
namespace qbpwcf;
|
|
|
39 |
|
|
|
40 |
#匯入外部套件,檔案位置請依照需求去修改
|
|
|
41 |
require_once("allInOne.php");
|
|
|
42 |
|
|
|
43 |
#以下爲你的程式...
|
|
|
44 |
|
|
|
45 |
?>
|
|
|
46 |
|
|
|
47 |
*/
|
|
|
48 |
|
|
|
49 |
#指派命名空間
|
|
|
50 |
namespace qbpwcf;
|
|
|
51 |
|
|
|
52 |
#參考資料
|
|
|
53 |
#http://php.net/manual/en/function.set-exception-handler.php
|
|
|
54 |
#http://php.net/manual/en/function.set-error-handler.php
|
|
|
55 |
#https://stackoverflow.com/questions/4514568/how-to-catch-all-php-error
|
|
|
56 |
|
|
|
57 |
#如果是在命令列環境
|
|
|
58 |
if(!(isset($_SERVER['HTTP_USER_AGENT']))){
|
|
|
59 |
|
|
|
60 |
#改匯入 "allInOneForCmd.php"
|
|
|
61 |
require_once("allInOneForCmd.php");
|
|
|
62 |
|
|
|
63 |
#結束程式
|
|
|
64 |
return 0;
|
|
|
65 |
|
|
|
66 |
}#if end
|
|
|
67 |
|
|
|
68 |
#如果 session 不存在
|
|
|
69 |
if(!isset($_SESSION)){
|
|
|
70 |
|
|
|
71 |
#啟動 session
|
|
|
72 |
session_start();
|
|
|
73 |
|
|
|
74 |
}#if end
|
|
|
75 |
|
|
|
76 |
#如果尚未取得 lib path
|
|
|
77 |
if(!isset($folderOfUsrLib)){
|
|
|
78 |
|
|
|
79 |
#儲存要執行的指令
|
|
|
80 |
$cmd="php -f ".escapeshellarg(pathinfo(__FILE__)["dirname"]."/../../bin/libexec/folderOfUsrLib.php");
|
|
|
81 |
|
|
|
82 |
#取得 lib path
|
|
|
83 |
exec($cmd,$output,$status);
|
|
|
84 |
|
|
|
85 |
#如果執行失敗
|
|
|
86 |
if($status!==0){
|
|
|
87 |
|
|
|
88 |
#debug
|
|
|
89 |
var_dump($cmd,$ouput,$status);
|
|
|
90 |
|
|
|
91 |
#結束執行,回傳shell 1.
|
|
|
92 |
exit(1);
|
|
|
93 |
|
|
|
94 |
}#if end
|
|
|
95 |
|
|
|
96 |
#儲存lib path
|
|
|
97 |
$folderOfUsrLib=$output[0];
|
|
|
98 |
|
|
|
99 |
}#if end
|
|
|
100 |
|
|
|
101 |
#匯入自建的php類別檔
|
|
|
102 |
require_once("amazon.php"); #跟 amazon 互動的類別
|
|
|
103 |
require_once("analyse.php"); #跟問卷整理分析有關的類別
|
|
|
104 |
require_once("app.php"); #讓網頁變得更行動與app化
|
|
|
105 |
require_once("autoService.php"); #讓網頁可以管理系統的自動化服務
|
|
|
106 |
require_once("arrays.php"); #跟陣列有關的方法
|
|
|
107 |
require_once("authenticate.php"); #裏面包含跟驗證有關的功能
|
|
|
108 |
require_once("bigbluebutton.php"); #big blue button的應用
|
|
|
109 |
require_once("canvas.php"); #canvas 的應用
|
|
|
110 |
require_once("catchWebContent.php"); #包含可以抓取網頁內容的功能
|
|
|
111 |
require_once("chartJS.php"); #繪製圖表的js
|
|
|
112 |
require_once("cmd.php"); #跟命令列有關的功能
|
|
|
113 |
require_once("config.php"); #用於改變php執行環境的類別
|
|
|
114 |
require_once("css.php"); #裏面包含設定css樣式的功能,網頁美觀就靠它了。
|
|
|
115 |
require_once("csv.php"); #跟csv檔案有關的功能
|
|
|
116 |
require_once("csInformation.php"); #裏面包含取得用戶、伺服端資訊的功能。
|
|
|
117 |
#require_once("communication.php"); #網路通訊相關功能,開發中...
|
| 169 |
liveuser |
118 |
require_once("controlStructures.php"); #control structures 的應用.
|
| 3 |
liveuser |
119 |
require_once("ckEditor.php"); #ckeditor的相關應用
|
|
|
120 |
require_once("dataTable.php"); #將資料表的資料呈現出來並附上操作選項的設置
|
|
|
121 |
require_once("db.php"); #裏面包含跟資料庫操作有關的功能
|
|
|
122 |
require_once("external.php"); #執行外部程式
|
|
|
123 |
require_once("exam.php"); #包含跟測驗有關的功能
|
|
|
124 |
require_once("fb.php"); #裏面包含facebook提供的api服務
|
|
|
125 |
require_once("fileAccess.php"); #裏面包含檔案讀、寫的功能
|
|
|
126 |
require_once("flash.php"); #裏面包含嵌入flash到網頁會用到的功能
|
|
|
127 |
require_once("form.php"); #裏面包含表單的設計、傳送、接收與跟處理上傳檔案有關的功能
|
|
|
128 |
require_once("fuse.php"); #包含fuse的使用(ftp,sftp,glusterfs...)
|
|
|
129 |
require_once("frame.php"); #裏面包含 iframe 的設置功能
|
|
|
130 |
require_once("googleMap.php"); #裡面包含 googleMap 的應用
|
|
|
131 |
require_once("header.php"); #裏面包含轉址、網頁編碼、檔案下載、網頁資訊等設定功能
|
|
|
132 |
require_once("hive.php"); #連線到hiveServer進行操作
|
|
|
133 |
require_once("html.php"); #管理網頁內容的功能
|
|
|
134 |
require_once("img.php"); #裏面關於在網頁嵌入圖片、與繪圖的功能
|
|
|
135 |
require_once("javaScript.php"); #一些javaScript函式、語法可以參考
|
|
|
136 |
require_once("jquery.php"); #javascript的函式庫,提供較易使用的方式
|
|
|
137 |
require_once("jwt.php"); #提供 jwt token 的應用
|
|
|
138 |
require_once("libreoffice.php"); #提供 libreoffice 相關的應用
|
|
|
139 |
require_once("line.php"); # 提供 line 的相關應用
|
|
|
140 |
require_once("link.php"); #裏面包含跟超連結有關的功能
|
|
|
141 |
require_once("logs.php"); #跟log相關的功能
|
|
|
142 |
require_once("mail.php"); #跟寄信有關的功能
|
|
|
143 |
require_once("maintain.php"); #跟維護有關的類別
|
|
|
144 |
require_once("math.php"); #裏面包含跟數學運算有關的功能
|
|
|
145 |
require_once("od.php"); #跟open document有關的功能
|
|
|
146 |
require_once("parser.php"); #跟解析內容相關的功能.
|
|
|
147 |
require_once("phpLib.php"); #跟php函式庫管理有關的類別
|
|
|
148 |
require_once("qemu.php"); #跟qemu有關的功能
|
|
|
149 |
require_once("qrCode.php"); #裏面包含qrCode的功能
|
|
|
150 |
require_once("R.php"); #用於統計與報表產生的套件
|
|
|
151 |
require_once("record.php"); #用於記錄資訊的套件功能
|
|
|
152 |
require_once("session.php"); #用於管理session的功能
|
|
|
153 |
require_once("search.php"); #裏面包含跟搜尋有關的功能
|
|
|
154 |
require_once("security.php"); #裏面包含跟保護製作權有關的功能
|
|
|
155 |
require_once("soap.php"); #webService建構、存取的相關功能
|
|
|
156 |
require_once("sock.php"); #unix domain socket
|
|
|
157 |
require_once("sound.php"); #裏面包含嵌入音樂、聲音、語音到網頁的功能
|
|
|
158 |
require_once("stop.php"); #跟程式中止有關的功能
|
|
|
159 |
require_once("stringProcess.php"); #裏面包含字串處理的功能
|
|
|
160 |
require_once("tab.php"); #提供建立tab的功能
|
|
|
161 |
require_once("text.php"); #提供文字顯示的功能
|
|
|
162 |
require_once("table.php"); #裏面包含建立表格的功能
|
|
|
163 |
require_once("threads.php"); #提供多執行序功能
|
|
|
164 |
require_once("time.php"); #裏面包含關於跟時鐘、期間限定有關的功能
|
|
|
165 |
require_once("variableCheck.php"); #變數檢查
|
|
|
166 |
require_once("video.php"); #裏面包含跟嵌入影片到網頁有關的功能
|
|
|
167 |
require_once("webSock.php"); #裡面包含web socket的應用
|
|
|
168 |
require_once("xml.php"); #裏面包含xml資料的截取功能
|
|
|
169 |
require_once("zerossl.php"); #裡面包含應用zerossl提供的服務
|
|
|
170 |
|
|
|
171 |
#匯入別人的php類別檔
|
|
|
172 |
|
|
|
173 |
#套件說明:
|
|
|
174 |
#tcpdf,用於編輯pdf檔案的套件。
|
|
|
175 |
#參考資料:
|
|
|
176 |
#http://www.tcpdf.org/index.php
|
|
|
177 |
require_once("tcpdf/tcpdf.php");
|
|
|
178 |
|
|
|
179 |
#匯入全域的設定檔
|
|
|
180 |
require_once(pathinfo(__FILE__)["dirname"]."/../../../etc/qbpwcf/allInOneConfig.php");
|
|
|
181 |
|
|
|
182 |
#覆蓋資料庫連結用的資訊
|
|
|
183 |
#$dbAddress="localhost";#資料庫的位置
|
|
|
184 |
#$dbPort="3306";#資料庫的 tcp port
|
|
|
185 |
#$dbAccount="root";#資料庫帳號
|
|
|
186 |
#$dbPassword="";#資料庫密碼
|
|
|
187 |
#$dbName="test";#資料庫名稱
|
|
|
188 |
|
|
|
189 |
#定義常數變數,bbb service url
|
|
|
190 |
define("bbbUrl",$bbbUrl);
|
|
|
191 |
|
|
|
192 |
#定義常數變數,bbb service secret
|
|
|
193 |
define("bbbSecret",$bbbSecret);
|
|
|
194 |
|
| 182 |
liveuser |
195 |
#定義資料庫系統加解密用的GnuPG ID
|
| 3 |
liveuser |
196 |
define("dbSecret",$dbSecret);
|
|
|
197 |
|
|
|
198 |
#定義 qbpwcf unix domain socket path
|
|
|
199 |
define("qbpwcf_usock_path",$qbpwcf_usock_path);
|
|
|
200 |
|
|
|
201 |
#定義 Zero SSL API access key
|
|
|
202 |
define("zeroSSLapiKey",$zeroSSLapiKey);
|
|
|
203 |
|
| 77 |
liveuser |
204 |
#定義運行web服務的賬戶
|
|
|
205 |
define("webUser",$webUser);
|
|
|
206 |
|
|
|
207 |
#定義系統的domain
|
|
|
208 |
define("domain",$domain);
|
|
|
209 |
|
| 63 |
liveuser |
210 |
#定義用於gpg加解密的預設id
|
|
|
211 |
define("gnupgId",$gnupgId);
|
|
|
212 |
|
| 30 |
liveuser |
213 |
#定義供系統寄送信件的email帳號
|
|
|
214 |
define("systemMailAcct",$systemMailAcct);
|
|
|
215 |
|
|
|
216 |
#定義供系統寄送信件的email密碼
|
|
|
217 |
define("systemMailPass",$systemMailPass);
|
|
|
218 |
|
| 47 |
liveuser |
219 |
#定義環境模式
|
|
|
220 |
define("mode",$mode);
|
| 30 |
liveuser |
221 |
|
| 53 |
liveuser |
222 |
#定義 web socket server 預設的 listen address
|
|
|
223 |
define("webSocketServerDefaultListenAddr",$webSocketServerDefaultListenAddr);
|
|
|
224 |
|
|
|
225 |
#定義 web soscket server 預設的 listen port
|
|
|
226 |
define("webSocketServerDefaultListenPort",$webSocketServerDefaultListenPort);
|
|
|
227 |
|
| 3 |
liveuser |
228 |
/*
|
|
|
229 |
|
|
|
230 |
#取得使用者拜訪的頁面
|
|
|
231 |
#涵式說明:
|
|
|
232 |
#取得用戶端的資訊
|
|
|
233 |
#回傳的結果:
|
|
|
234 |
#$result["status"],執行是否正常,"true"代表執行成功,"false"代表執行失敗.
|
|
|
235 |
#$result["error"],錯誤訊息.
|
|
|
236 |
#$result["function"],檔前執行的函數名稱.
|
|
|
237 |
#$result["mode"],當前的模式是"cmd"還是"web".
|
|
|
238 |
#$result["userBrowserType"],爲使用者的瀏覽器資訊
|
|
|
239 |
#$result["userIp"],爲使用者的IP
|
|
|
240 |
#$result["serverIp"],為伺服器的IP
|
|
|
241 |
#$result["scheme"],通訊協定
|
|
|
242 |
#$result["serverPort"],伺服器給對外下載網頁的port
|
|
|
243 |
#$result["requestUri"],爲使用者要求的網址
|
|
|
244 |
#$result["username"],爲使用者目前的帳戶,若爲""則表示尚未登入成功
|
|
|
245 |
#$result["phpUser"],運行該php的使用者帳戶.
|
|
|
246 |
#必填的參數:
|
|
|
247 |
$conf["getAccount"]="true";#是否要取得帳號
|
|
|
248 |
#可省略的參數:
|
|
|
249 |
#$conf["accountVar"]=$_SESSION["username"];#帳號儲存在哪個變數裏面,預設爲$_SESSION["username"]
|
|
|
250 |
$conf["saveToDb"]="true";#是否要除儲存到資料庫,"true"為要儲存",預設為不儲存
|
|
|
251 |
$conf["dbAddress"]=$dbAddress;;#爲mysql-Server的位置,若#$conf["saveToDb"]設為"true",則該參數為必填。
|
|
|
252 |
$conf["dbAccount"]=$dbAccount;#爲用於連入mysql-Server時要使用的帳號,若#$conf["saveToDb"]設為"true",則該參數為必填。
|
|
|
253 |
$conf["dbName"]=$dbName;#要選取的資料庫名稱,若#$conf["saveToDb"]設為"true",則該參數為必填。
|
|
|
254 |
$conf["tableName"]="visitorInfo";#爲要插入資料的資料表名稱,若#$conf["saveToDb"]設為"true",則該參數為必填。
|
|
|
255 |
$conf["columnName"]=array("username","userWebBrowser","userIp","requestUri","systemDateAndTime");#爲資料表的項目名稱,
|
|
|
256 |
#例如:$conf["columnName"]=array("columnName1","columnName2","columnName3",...);
|
|
|
257 |
#寫入的資料依序為,使用者帳戶、瀏覽器資訊、使用者IP、觀看的網址、當時的時間
|
|
|
258 |
#$conf["saveToDb"]設為"true",則該參數為必填。
|
|
|
259 |
$conf["dbPassword"]=$dbPassword;#爲連線到mysql-Server時要使用的密碼,可省略,若省略則代表不使用密碼
|
|
|
260 |
#$conf["displayQueryError"]="true";#爲是否呈現Query的錯誤訊息,預設不呈現,若要呈現則請將此值設爲"true"
|
|
|
261 |
#$conf["displayQueryString"]="true";#爲是否呈現Query的命令,預設不呈現,若要呈現則請將此值設爲"true"
|
|
|
262 |
$recordResult=csInformation::getConnectionInfo($conf);
|
|
|
263 |
unset($conf);
|
|
|
264 |
|
|
|
265 |
#如果記錄拜訪資訊失敗
|
|
|
266 |
if($recordResult["status"]=="false"){
|
|
|
267 |
|
|
|
268 |
#debug
|
|
|
269 |
var_dump($recordResult);
|
|
|
270 |
exit;
|
|
|
271 |
|
|
|
272 |
}#if end
|
|
|
273 |
|
|
|
274 |
#如果要求的通訊協定不為https
|
|
|
275 |
if($recordResult["scheme"]!=="https"){
|
|
|
276 |
|
|
|
277 |
#函式說明:
|
|
|
278 |
#設定session變數後,立即轉址.
|
|
|
279 |
#回傳的結果:
|
|
|
280 |
#$result["status"],執行是否成功,"true"代表成功,"false"代表不成功.
|
|
|
281 |
#$result["function"],當前執行的函數名稱.
|
|
|
282 |
#$result["error"],錯誤訊息陣列.
|
|
|
283 |
#必填的參數:
|
|
|
284 |
#$conf["headerLocation"],為要轉址到的地方,若爲 $_SERVER["PHP_SELF"],則爲回到目前頁面,全民資安素養網爲 https://isafe.moe.edu.tw/.
|
|
|
285 |
$conf["header::redirectionNow"]["headerLocation"]=$recordResult["scheme"]."s://".$recordResult["serverIp"].$recordResult["requestUri"];
|
|
|
286 |
#可省略的參數:
|
|
|
287 |
#$conf["sessionName"],字串陣列,可以指派session變數的名稱.
|
|
|
288 |
#$conf["sessionName"]=array("");
|
|
|
289 |
#$conf["sessionValue"]字串陣列,可以指派session變數的內容.
|
|
|
290 |
#$conf["sessionValue"]=array("");
|
|
|
291 |
#參靠資料來源:
|
|
|
292 |
#http://php.net/manual/en/reserved.variables.server.php
|
|
|
293 |
$redirectionNow=header::redirectionNow($conf["header::redirectionNow"]);
|
|
|
294 |
unset($conf["header::redirectionNow"]);
|
|
|
295 |
|
|
|
296 |
#如果轉址失敗
|
|
|
297 |
if($redirectionNow["status"]==="false"){
|
|
|
298 |
|
|
|
299 |
#停止執行
|
|
|
300 |
exit;
|
|
|
301 |
|
|
|
302 |
}#if end
|
|
|
303 |
|
|
|
304 |
}#if end
|
|
|
305 |
|
|
|
306 |
#驗證權限,檢查會員所屬群組是否能拜訪該子細統
|
|
|
307 |
#函式說明:
|
|
|
308 |
#檢查session裏面的使用者資訊是否在會員清單裏面,
|
|
|
309 |
#該會員所屬的羣組是否具有權限瀏覽該子功能頁面
|
|
|
310 |
#目標資料庫裏面必須有名爲member作爲儲存會員資料的資料表。
|
|
|
311 |
#目標資料庫裏面必須有名爲userGroupAuthorities作爲儲存羣組資料的資料表
|
|
|
312 |
#回傳的參數:
|
|
|
313 |
#$result["status"],執行是否正常的識別,"true"代表一切正常,"false"代表不正常
|
|
|
314 |
#$result["error"],錯誤訊息
|
|
|
315 |
#$result["function"],當前執行的函數名稱
|
|
|
316 |
#$result["passed"],是否通過檢查,"true"代表通過檢查,"false"代表沒有通過檢查.
|
|
|
317 |
#$result["warning"],記錄不會影響程式執行,但是需要注意的事情。
|
|
|
318 |
#必填寫的參數:
|
|
|
319 |
$conf["thisSubSystemName"]="phplib";#爲該子系統的名稱,若該羣組所能瀏覽的子系統裏面有該名稱,則通過驗證。
|
|
|
320 |
$conf["dbName"]=$dbName;#爲指定的資料庫名稱,欲選擇的資料庫名稱
|
|
|
321 |
$conf["dbPassword"]=$dbPassword;#爲連線到mysql-Server時要使用的密碼,可省略,若省略則代表不使用密碼
|
|
|
322 |
#可省略的參數:
|
|
|
323 |
#$conf["dbAddress"]="localhost";#爲資料庫的位置,預設爲 "localhost"
|
|
|
324 |
#$conf["dbAccount"]="root";#爲用於連入資料庫時要使用的帳號,預設爲 "root"
|
|
|
325 |
#$conf["dtName.member"]="member";#儲存會員資料的資料表,預設爲 "member"
|
|
|
326 |
#$conf["dtName.userGroup"]="userGroupAuthorities";#儲存羣組資料的資,預設爲 "userGroupAuthorities"
|
|
|
327 |
$authenticate=authenticate::checkUserGroupAuthorities($conf);
|
|
|
328 |
unset($conf);
|
|
|
329 |
|
|
|
330 |
#debug
|
|
|
331 |
#var_dump($conf);
|
|
|
332 |
#var_dump($authenticate);
|
|
|
333 |
#exit;
|
|
|
334 |
|
|
|
335 |
#如果驗證權權限失敗
|
|
|
336 |
if($authenticate["status"]==="false"){
|
|
|
337 |
|
|
|
338 |
#debug
|
|
|
339 |
#var_dump($authenticate);
|
|
|
340 |
#exit;
|
|
|
341 |
|
|
|
342 |
#函式說明:
|
|
|
343 |
#用彈出式視窗顯示訊息,接著設置seesion變數,最後進行轉址.
|
|
|
344 |
#回傳的結果:
|
|
|
345 |
#$result["status"],執行是否成功,"true"代表成功,"false"代表不成功.
|
|
|
346 |
#$result["error"],錯誤訊息陣列.
|
|
|
347 |
#必填的參數:
|
|
|
348 |
#$conf["headerLocation"],為要轉址到的地方,若爲 $_SERVER["PHP_SELF"],則爲回到目前頁面,全民資安素養網爲 https://isafe.moe.edu.tw/.
|
|
|
349 |
$conf["headerLocation"]="/~qbpwcf/";
|
|
|
350 |
#$conf["alertMessage"],字串陣列,要顯示的彈出式視窗內容,第n個元素代表第n行的內容.
|
|
|
351 |
$conf["alertMessage"]=$authenticate["warning"];
|
|
|
352 |
#可省略的參數:
|
|
|
353 |
#$conf["sessionName"],字串陣,可以指派要建立的session變數名稱.
|
|
|
354 |
#$conf["sessionName"]=array("");
|
|
|
355 |
#$conf["sessionValue"]字串陣列,可以指派要建立的session變數的內容.
|
|
|
356 |
#$conf["sessionValue"]=array("");
|
|
|
357 |
#參靠資料來源:
|
|
|
358 |
#http://php.net/manual/en/reserved.variables.server.php
|
|
|
359 |
header::redirectionAfterAlertWindows($conf);
|
|
|
360 |
unset($conf);
|
|
|
361 |
|
|
|
362 |
}#if end
|
|
|
363 |
|
|
|
364 |
#如果驗證權限不通過
|
|
|
365 |
if($authenticate["passed"]==="false"){
|
|
|
366 |
|
|
|
367 |
#函式說明:
|
|
|
368 |
#用彈出式視窗顯示訊息,接著設置seesion變數,最後進行轉址.
|
|
|
369 |
#回傳的結果:
|
|
|
370 |
#$result["status"],執行是否成功,"true"代表成功,"false"代表不成功.
|
|
|
371 |
#$result["error"],錯誤訊息陣列.
|
|
|
372 |
#必填的參數:
|
|
|
373 |
#$conf["headerLocation"],為要轉址到的地方,若爲 $_SERVER["PHP_SELF"],則爲回到目前頁面,全民資安素養網爲 https://isafe.moe.edu.tw/.
|
|
|
374 |
$conf["headerLocation"]="/~qbpwcf/";
|
|
|
375 |
#$conf["alertMessage"],字串陣列,要顯示的彈出式視窗內容,第n個元素代表第n行的內容.
|
|
|
376 |
$conf["alertMessage"]=$authenticate["warning"];
|
|
|
377 |
#可省略的參數:
|
|
|
378 |
#$conf["sessionName"],字串陣,可以指派要建立的session變數名稱.
|
|
|
379 |
#$conf["sessionName"]=array("");
|
|
|
380 |
#$conf["sessionValue"]字串陣列,可以指派要建立的session變數的內容.
|
|
|
381 |
#$conf["sessionValue"]=array("");
|
|
|
382 |
#參靠資料來源:
|
|
|
383 |
#http://php.net/manual/en/reserved.variables.server.php
|
|
|
384 |
header::redirectionAfterAlertWindows($conf);
|
|
|
385 |
unset($conf);
|
|
|
386 |
|
|
|
387 |
}#if end
|
|
|
388 |
|
|
|
389 |
*/
|
|
|
390 |
|
|
|
391 |
#函式說明:
|
|
|
392 |
#將php設定檔常用的設定進行調整使之變成適用於開發模式、釋出模式、或自訂要調整哪些設定值
|
|
|
393 |
#回傳結果:
|
|
|
394 |
#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
|
|
|
395 |
#$result["error"],錯誤訊息陣列.
|
|
|
396 |
#$result["function"],當前執行的函數名稱.
|
|
|
397 |
#必填參數:
|
|
|
398 |
#$conf["mode"],參數設定的模式,"release"代表是指共一般使用所需;"develop"代表是在開發狀態下所需;"custom"代表自訂參數設定內容
|
| 47 |
liveuser |
399 |
$conf["mode"]=mode;
|
| 3 |
liveuser |
400 |
#可省略參數:
|
|
|
401 |
#$conf["customSettings"],要自訂的參數與其數值,例如array("display_errors=On").
|
|
|
402 |
$conf["customSettings"]=array();
|
|
|
403 |
#參考資料:
|
|
|
404 |
#ini_set=>http://www.php.net/manual/en/function.ini-set.php
|
|
|
405 |
#各個參數適用的修改方式=>http://www.php.net/manual/en/ini.list.php
|
|
|
406 |
#各個參數適用的修改方式的解說=>http://hi.baidu.com/richardali/item/d28104083c70c638a2332a60
|
|
|
407 |
#備註:
|
|
|
408 |
#使用該函式後,網頁會無法顯示。
|
|
|
409 |
$changeSettings=config::changeSettings($conf);
|
|
|
410 |
unset($conf);
|
|
|
411 |
|
|
|
412 |
#如果變更設定失敗
|
|
|
413 |
if($changeSettings["status"]==="false"){
|
|
|
414 |
|
|
|
415 |
#debug
|
| 47 |
liveuser |
416 |
var_dump($changeSettings);exit;
|
| 3 |
liveuser |
417 |
|
|
|
418 |
}#if end
|
|
|
419 |
|
|
|
420 |
?>
|