| 1 |
liveuser |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
|
|
|
5 |
QBPWCF, Quick Build PHP website Component base on Fedora Linux.
|
| 226 |
liveuser |
6 |
Copyright (C) 2014~2025 MIN ZHI, CHEN
|
| 1 |
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 |
|
|
|
25 |
#使用 qbpwcf 命名空間
|
|
|
26 |
namespace qbpwcf;
|
|
|
27 |
|
|
|
28 |
#初始化輸出
|
|
|
29 |
$output=array();
|
|
|
30 |
|
|
|
31 |
#取得 lib path
|
| 98 |
liveuser |
32 |
exec("php -f ".escapeshellarg(pathinfo(__FILE__)["dirname"]."/../../../../usr/bin/libexec/folderOfUsrLib.php"),$output,$status);
|
| 1 |
liveuser |
33 |
|
|
|
34 |
#如果執行失敗
|
|
|
35 |
if($status!==0){
|
|
|
36 |
|
|
|
37 |
#debug
|
|
|
38 |
var_dump(__LINE__,$output);
|
|
|
39 |
|
|
|
40 |
#結束執行,回傳shell 1.
|
|
|
41 |
exit(1);
|
|
|
42 |
|
|
|
43 |
}#if end
|
|
|
44 |
|
|
|
45 |
#儲存lib path
|
|
|
46 |
$folderOfUsrLib=$output[0];
|
|
|
47 |
|
|
|
48 |
#初始化輸出
|
|
|
49 |
$output=array();
|
|
|
50 |
|
|
|
51 |
#以該檔案的實際位置的 lib path 為 include path 首位
|
| 98 |
liveuser |
52 |
exec("cd ".pathinfo(__FILE__)["dirname"]."/../../../../usr/".$folderOfUsrLib."/qbpwcf;pwd;",$output,$status);
|
| 1 |
liveuser |
53 |
set_include_path($output[0].PATH_SEPARATOR.get_include_path());
|
|
|
54 |
|
|
|
55 |
#匯入套件
|
|
|
56 |
require_once("allInOne.php");
|
|
|
57 |
|
|
|
58 |
#qbpwcf用的javascript
|
|
|
59 |
$qbpwcfJavaScript=javaScript::qbpwcfJavaScript();
|
|
|
60 |
|
|
|
61 |
#如果建立 qbpwcf 用的 js 語法失敗
|
|
|
62 |
if($qbpwcfJavaScript["status"]==="false"){
|
|
|
63 |
|
|
|
64 |
#debug
|
|
|
65 |
var_dump($qbpwcfJavaScript);
|
|
|
66 |
exit;
|
|
|
67 |
|
|
|
68 |
}#if end
|
|
|
69 |
|
|
|
70 |
#印出js語法
|
|
|
71 |
echo $qbpwcfJavaScript["content"];
|
|
|
72 |
|
|
|
73 |
#建議的log位置
|
|
|
74 |
$logFile=$_SERVER["DOCUMENT_ROOT"].$_SERVER["PHP_SELF"].".log";
|
|
|
75 |
|
|
|
76 |
#函式說明:
|
|
|
77 |
#開新視窗,可以隱藏瀏覽器的元件。
|
|
|
78 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
79 |
#$result["error"],錯誤訊息.
|
|
|
80 |
#$result["function"],當前執行的函數名稱.
|
|
|
81 |
#$result["argu"],所使用的參數.
|
|
|
82 |
#$result["content"],js語法.
|
|
|
83 |
#$result["jsFuncName"],使用的js函數名稱.
|
|
|
84 |
#必填參數:
|
|
|
85 |
#$conf["url"],字串,要開新視窗的網址.
|
|
|
86 |
$conf["url"]="https://www.qbpwcf.org";
|
|
|
87 |
#$conf["function"],字串,js開新視窗函式的名稱.
|
|
|
88 |
$conf["function"]="openWindowFunc";
|
|
|
89 |
#可省略參數:
|
|
|
90 |
#$conf["name"],字串 ,視窗的名稱,指定後可以直接存取其內容.
|
|
|
91 |
#$conf["name"]="";
|
|
|
92 |
#$conf["width"],字串,新視窗的寬度.
|
|
|
93 |
#$conf["width"]="";
|
|
|
94 |
#$conf["height"],字串,新視窗的高度.
|
|
|
95 |
#$conf["height"]="";
|
|
|
96 |
#$conf["toolbar"],字串,是否要工具列,"true"代表要,"false"代表不要,預設為"false".
|
|
|
97 |
#$conf["toolbar"]="";
|
|
|
98 |
#$cpnf["menubar"],字串,是否要選單列,"true"代表要,"false"代表不要,預設為"false".
|
|
|
99 |
#$conf["menubar"]="";
|
|
|
100 |
#$conf["scrollbars"],字串,是否要滾軸,"true"代表要,"false"代表不要,預設為"true".
|
|
|
101 |
#$conf["scrollbars"]="";
|
|
|
102 |
#$conf["resizable"],字串,是否可以改變視窗大小,"true"代表可以,"false"代表不可以,預設為"true".
|
|
|
103 |
#$conf["resizable"]="";
|
|
|
104 |
#$conf["location"],字串,是否要顯示地址列,"true"代表要,"false"代表不要,預設為"false".
|
|
|
105 |
#$conf["location"]="";
|
|
|
106 |
#$conf["status"],字串,是否要顯示狀態列,"true"代表要,"false"代表不要,預設為"false".
|
|
|
107 |
#$conf["status"]="";
|
|
|
108 |
#$conf["titlebar"],字串,是否要顯示視窗標題,"true"代表要,"false"代表不要,預設為"true".
|
|
|
109 |
#$conf["titlebar"]="";
|
|
|
110 |
#$conf["returnWindowVarName"],字串,開啟的視窗要儲存到哪個全域變數,請提供window.後面的名稱即可,預設不使用,直接return.
|
|
|
111 |
$conf["returnWindowVarName"]="abc";
|
|
|
112 |
#參考資料:
|
|
|
113 |
#http://www.w3schools.com/jsref/met_win_open.asp
|
|
|
114 |
#http://www.blueshop.com.tw/board/FUM20041006152641OLG/BRD20080107111600L3T.html
|
|
|
115 |
#備註:
|
|
|
116 |
#無.
|
|
|
117 |
$openWindow=javaScript::openWindow($conf);
|
|
|
118 |
unset($conf);
|
|
|
119 |
|
|
|
120 |
#如果執行失敗
|
|
|
121 |
if($openWindow["status"]==="false"){
|
|
|
122 |
|
|
|
123 |
#函式說明:
|
|
|
124 |
#撰寫log
|
|
|
125 |
#回傳結果:
|
|
|
126 |
#$result["status"],狀態,"true"或"false".
|
|
|
127 |
#$result["error"],錯誤訊息陣列.
|
|
|
128 |
#$result["function"],當前函式的名稱.
|
|
|
129 |
#$result["argu"],使用的參數.
|
|
|
130 |
#必填參數:
|
|
|
131 |
#$conf["path"],字串,log檔案的路徑與名稱.
|
|
|
132 |
$conf["path"]=$logFile;
|
|
|
133 |
#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
|
|
|
134 |
$conf["content"]=$openWindow;
|
|
|
135 |
#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
|
|
|
136 |
$conf["fileArgu"]=__FILE__;
|
|
|
137 |
#可省略參數:
|
|
|
138 |
#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
|
|
|
139 |
#$conf["rewrite"]="false";
|
|
|
140 |
#參考資料:
|
|
|
141 |
#無.
|
|
|
142 |
#備註:
|
|
|
143 |
#無.
|
|
|
144 |
$record=logs::record($conf);
|
|
|
145 |
unset($conf);
|
| 226 |
liveuser |
146 |
|
| 1 |
liveuser |
147 |
#結束執行
|
|
|
148 |
exit;
|
|
|
149 |
|
|
|
150 |
}#if end
|
| 226 |
liveuser |
151 |
|
| 1 |
liveuser |
152 |
#印出語法
|
| 226 |
liveuser |
153 |
echo $openWindow["content"];
|