392 |
jpm |
1 |
<html>
|
|
|
2 |
<head>
|
|
|
3 |
<title>Test PHP Connector</title>
|
|
|
4 |
</head>
|
|
|
5 |
<body>
|
|
|
6 |
<?php
|
|
|
7 |
error_reporting(E_ALL);
|
|
|
8 |
|
|
|
9 |
include "config.php";
|
|
|
10 |
|
|
|
11 |
$resources=$fckphp_config['ResourceTypes'];
|
|
|
12 |
|
|
|
13 |
$dr=$fckphp_config['basedir'];
|
|
|
14 |
$actual_userfolder=str_replace("//","/",$dr."/".$fckphp_config['UserFilesPath']."/");
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
//Display base directory set in the$fckphp_config
|
|
|
18 |
echo "Base Dir is set to: $dr<br />\n";
|
|
|
19 |
|
|
|
20 |
//Display the path to this script
|
|
|
21 |
echo "PHP_SELF: ".$_SERVER['PHP_SELF']."<br />\n";
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
//Seperator
|
|
|
25 |
echo "\n<br /><hr /><br />\n";
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
//Check if PHP has MIME-Magic Support
|
|
|
29 |
echo "Checking for mime magic support: ".((function_exists("mime_content_type"))?"Yes":"No - you won't get icons by mime type")."<br />";
|
|
|
30 |
|
|
|
31 |
//Check if PHP has GD Support
|
|
|
32 |
echo "Checking for GD support: ".((function_exists("imagecreate"))?"Yes":"No - you won't get thumbnails for images")."<br />";
|
|
|
33 |
echo " JPEG Support: ".((function_exists("imagecreatefromjpeg"))?"Yes":"No - you won't get thumbnails for jpeg images")."<br />";
|
|
|
34 |
echo " PNG Support: ".((function_exists("imagecreatefrompng"))?"Yes":"No - you won't get thumbnails for png images")."<br />";
|
|
|
35 |
echo " GIF Support: ".((function_exists("imagecreatefromgif"))?"Yes":"No - you won't get thumbnails for gif images")."<br />";
|
|
|
36 |
echo " Image Write Support: ".((function_exists("imagegif") || function_exists("imagepng") || function_exists("imagejpeg"))?"Yes":"No - you won't get thumbnails for any images, as i cant write GIFs, PNGs or JPEGs")."<br />";
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
//Seperator
|
|
|
40 |
echo "\n<br /><hr /><br />\n";
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
//Check if the user files folder set in the$fckphp_config exists
|
|
|
44 |
echo "Checking if user files folder exists ($actual_userfolder): ";
|
|
|
45 |
if (is_dir($actual_userfolder)) {
|
|
|
46 |
echo "[ Passed ]<br />\n";
|
|
|
47 |
} else {
|
|
|
48 |
echo "[ Failed ] <br />Task: Create the user files folder in the webroot and point the$fckphp_config.php file to it.<br />\n";
|
|
|
49 |
echo "Skipping all other tests, fix this one first.";
|
|
|
50 |
exit(0);
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
|
|
|
54 |
//Seperator
|
|
|
55 |
echo "\n<br /><hr /><br />\n";
|
|
|
56 |
|
|
|
57 |
|
|
|
58 |
//Check if the File,Image,Flash,Media folders exist in the user files folder and are writeable
|
|
|
59 |
echo "Checking for resource type folders under user file folder: <br />\n";
|
|
|
60 |
foreach ($resources as $value) {
|
|
|
61 |
|
|
|
62 |
//Does the folder exist
|
|
|
63 |
$passed=false;
|
|
|
64 |
echo " $value exists (".($actual_userfolder.$value).": ";
|
|
|
65 |
if (is_dir(($actual_userfolder.$value))) {
|
|
|
66 |
echo "[ Passed ]<br />\n";
|
|
|
67 |
$passed=true;
|
|
|
68 |
} else {
|
|
|
69 |
echo "[ Failed ]<br /> Task: chmod this folder to make it writeable to the php processes user.<br />\n";
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
|
|
|
73 |
//Is the folder writeable by PHP
|
|
|
74 |
echo " $value writeable: ";
|
|
|
75 |
if ($passed) {
|
|
|
76 |
if (is_writeable(($actual_userfolder.$value))) {
|
|
|
77 |
echo "[ Passed ]<br />\n";
|
|
|
78 |
} else {
|
|
|
79 |
echo "[ Failed ]<br /> Task: chmod this folder to make it writeable to the php processes user.<br />\n";
|
|
|
80 |
}
|
|
|
81 |
} else {
|
|
|
82 |
echo "[ Skipped ]<br />\n";
|
|
|
83 |
}
|
|
|
84 |
echo "<br />\n";
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
//Check if PHP is$fckphp_configured to use open_basedir
|
|
|
89 |
echo "Checking if open_basedir restriction in place: (".((($bd=ini_get("open_basedir"))==null)?"Not Set":$bd." - This may cause you some troubles.").")<br />";
|
|
|
90 |
|
|
|
91 |
//Try to open the user files folder
|
|
|
92 |
echo "Trying an opendir on the user files folder: ".((opendir($actual_userfolder))?"[ Passed ]":"[ Failed ]")."<br />";
|
|
|
93 |
|
|
|
94 |
|
|
|
95 |
//Seperator
|
|
|
96 |
echo "\n<br /><hr /><br />\n";
|
|
|
97 |
|
|
|
98 |
|
|
|
99 |
//Compose the url to the connector
|
|
|
100 |
$uri="http".(((isset($_SERVER['HTTPS']))&&(strtolower($_SERVER['HTTPS'])!='off'))?"s":"")."://".$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME'])."/";
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
//--------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
104 |
//Test the GetFolders Command
|
|
|
105 |
echo "Requesting connector.php?Command=GetFolders&Type=Image&CurrentFolder=/ :<br />\n
|
|
|
106 |
<div style=\"border-style:solid;border-width:1px;border-color:#000000\">\n";
|
|
|
107 |
|
|
|
108 |
$test = implode("",file($uri."connector.php?Command=GetFolders&Type=Image&CurrentFolder=/"));
|
|
|
109 |
$test=htmlentities($test);
|
|
|
110 |
echo str_replace("\n","<br />",$test);
|
|
|
111 |
echo "</div> Please do a sanity check on this, it should be something like: \n
|
|
|
112 |
<div style=\"border-style:solid;border-width:1px;border-color:#000000\">\n";
|
|
|
113 |
|
|
|
114 |
$expect="
|
|
|
115 |
<?xml version=\"1.0\" encoding=\"utf-8\" ?>
|
|
|
116 |
<Connector command=\"GetFolders\" resourceType=\"Image\">
|
|
|
117 |
<CurrentFolder path=\"/\" url=\"/data/resources/Image/\" />
|
|
|
118 |
<Folders>
|
|
|
119 |
</Folders>
|
|
|
120 |
</Connector>";
|
|
|
121 |
|
|
|
122 |
|
|
|
123 |
$expect=htmlentities($expect);
|
|
|
124 |
$expect=str_replace(array("\n","\r"),"<br />",$expect);
|
|
|
125 |
echo "<b>EXAMPLE RESPONSE</b>".$expect;
|
|
|
126 |
?>
|
|
|
127 |
</div>
|
|
|
128 |
<br /><br />
|
|
|
129 |
<?php
|
|
|
130 |
//--------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
131 |
|
|
|
132 |
//Seperator
|
|
|
133 |
echo "\n<br /><hr /><br />\n";
|
|
|
134 |
|
|
|
135 |
|
|
|
136 |
//--------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
137 |
//Test GetFoldersAndFiles Command
|
|
|
138 |
echo "Requesting connector.php?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=/ :<br />\n
|
|
|
139 |
<div style=\"border-style:solid;border-width:1px;border-color:#000000\">\n";
|
|
|
140 |
|
|
|
141 |
$test = implode("",file($uri."connector.php?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=/"));
|
|
|
142 |
$test=htmlentities($test);
|
|
|
143 |
echo str_replace("\n","<br />",$test);
|
|
|
144 |
echo "</div> Please do a sanity check on this, it should be something like: \n
|
|
|
145 |
<div style=\"border-style:solid;border-width:1px;border-color:#000000\">\n";
|
|
|
146 |
|
|
|
147 |
$expect="
|
|
|
148 |
<?xml version=\"1.0\" encoding=\"utf-8\" ?>
|
|
|
149 |
<Connector command=\"GetFoldersAndFiles\" resourceType=\"Image\">
|
|
|
150 |
<CurrentFolder path=\"/\" url=\"/data/resources/Image/\" />
|
|
|
151 |
<Folders>
|
|
|
152 |
</Folders>
|
|
|
153 |
<Files>
|
|
|
154 |
</Files>
|
|
|
155 |
</Connector>";
|
|
|
156 |
|
|
|
157 |
|
|
|
158 |
$expect=htmlentities($expect);
|
|
|
159 |
$expect=str_replace(array("\n","\r"),"<br />",$expect);
|
|
|
160 |
echo "<b>EXAMPLE RESPONSE</b>".$expect;
|
|
|
161 |
?>
|
|
|
162 |
</div>
|
|
|
163 |
<br /><br />
|
|
|
164 |
<?php
|
|
|
165 |
//--------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
166 |
|
|
|
167 |
//Seperator
|
|
|
168 |
echo "\n<br /><hr /><br />\n";
|
|
|
169 |
|
|
|
170 |
|
|
|
171 |
//--------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
172 |
//Test the CreateFolder command
|
|
|
173 |
echo "Requesting connector.php?Command=CreateFolder&Type=Image&CurrentFolder=/&NewFolderName=TestFolder99 :<br />\n
|
|
|
174 |
<div style=\"border-style:solid;border-width:1px;border-color:#000000\">\n";
|
|
|
175 |
|
|
|
176 |
$test = implode("",file($uri."connector.php?Command=CreateFolder&Type=Image&CurrentFolder=/&NewFolderName=TestFolder99"));
|
|
|
177 |
$test=htmlentities($test);
|
|
|
178 |
echo str_replace("\n","<br />",$test);
|
|
|
179 |
echo "</div> Please do a sanity check on this, it should be something like: \n
|
|
|
180 |
<div style=\"border-style:solid;border-width:1px;border-color:#000000\">\n";
|
|
|
181 |
|
|
|
182 |
$expect="
|
|
|
183 |
<?xml version=\"1.0\" encoding=\"utf-8\" ?>
|
|
|
184 |
<Connector command=\CreateFolder\" resourceType=\"Image\">
|
|
|
185 |
<CurrentFolder path=\"/\" url=\"/data/resources/Image/\" />
|
|
|
186 |
<Error number=\"0\" />
|
|
|
187 |
</Connector>";
|
|
|
188 |
|
|
|
189 |
|
|
|
190 |
$expect=htmlentities($expect);
|
|
|
191 |
$expect=str_replace(array("\n","\r"),"<br />",$expect);
|
|
|
192 |
echo "<b>EXAMPLE RESPONSE</b>".$expect;
|
|
|
193 |
?>
|
|
|
194 |
</div>
|
|
|
195 |
<br /><br />
|
|
|
196 |
<?php
|
|
|
197 |
//--------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
198 |
|
|
|
199 |
|
|
|
200 |
//Seperator
|
|
|
201 |
echo "\n<br /><hr /><br />\n";
|
|
|
202 |
|
|
|
203 |
|
|
|
204 |
//--------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
205 |
//Test the RenameFolder Command
|
|
|
206 |
echo "Requesting connector.php?Command=RenameFolder&Type=Image&CurrentFolder=/&FolderName=TestFolder99&NewName=TestFolder90 :<br />\n
|
|
|
207 |
<div style=\"border-style:solid;border-width:1px;border-color:#000000\">\n";
|
|
|
208 |
|
|
|
209 |
$test = implode("",file($uri."connector.php?Command=RenameFolder&Type=Image&CurrentFolder=/&FolderName=TestFolder99&NewName=TestFolder90"));
|
|
|
210 |
$test=htmlentities($test);
|
|
|
211 |
echo str_replace("\n","<br />",$test);
|
|
|
212 |
echo "</div> Please do a sanity check on this, it should be something like: \n
|
|
|
213 |
<div style=\"border-style:solid;border-width:1px;border-color:#000000\">\n";
|
|
|
214 |
|
|
|
215 |
$expect="
|
|
|
216 |
<?xml version=\"1.0\" encoding=\"utf-8\" ?>
|
|
|
217 |
<Connector command=\"RenameFolder\" resourceType=\"Image\">
|
|
|
218 |
<CurrentFolder path=\"/\" url=\"/data/resources/Image/\" />
|
|
|
219 |
<Error number=\"0\" />
|
|
|
220 |
</Connector>";
|
|
|
221 |
|
|
|
222 |
|
|
|
223 |
$expect=htmlentities($expect);
|
|
|
224 |
$expect=str_replace(array("\n","\r"),"<br />",$expect);
|
|
|
225 |
echo "<b>EXAMPLE RESPONSE</b>".$expect;
|
|
|
226 |
?>
|
|
|
227 |
</div>
|
|
|
228 |
<br /><br />
|
|
|
229 |
<?php
|
|
|
230 |
//--------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
231 |
|
|
|
232 |
|
|
|
233 |
//Seperator
|
|
|
234 |
echo "\n<br /><hr /><br />\n";
|
|
|
235 |
|
|
|
236 |
|
|
|
237 |
//--------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
238 |
//Test the DeleteFolder Command
|
|
|
239 |
echo "Requesting connector.php?Command=DeleteFolder&Type=Image&CurrentFolder=/&FolderName=TestFolder90 :<br />\n
|
|
|
240 |
<div style=\"border-style:solid;border-width:1px;border-color:#000000\">\n";
|
|
|
241 |
|
|
|
242 |
$test = implode("",file($uri."connector.php?Command=DeleteFolder&Type=Image&CurrentFolder=/&FolderName=TestFolder90"));
|
|
|
243 |
$test=htmlentities($test);
|
|
|
244 |
echo str_replace("\n","<br />",$test);
|
|
|
245 |
echo "</div> Please do a sanity check on this, it should be something like: \n
|
|
|
246 |
<div style=\"border-style:solid;border-width:1px;border-color:#000000\">\n";
|
|
|
247 |
|
|
|
248 |
$expect="
|
|
|
249 |
<?xml version=\"1.0\" encoding=\"utf-8\" ?>
|
|
|
250 |
<Connector command=\"DeleteFolder\" resourceType=\"Image\">
|
|
|
251 |
<CurrentFolder path=\"/\" url=\"/data/resources/Image/\" />
|
|
|
252 |
<Error number=\"0\" />
|
|
|
253 |
</Connector>";
|
|
|
254 |
|
|
|
255 |
|
|
|
256 |
$expect=htmlentities($expect);
|
|
|
257 |
$expect=str_replace(array("\n","\r"),"<br />",$expect);
|
|
|
258 |
echo "<b>EXAMPLE RESPONSE</b>".$expect;
|
|
|
259 |
?>
|
|
|
260 |
</div>
|
|
|
261 |
<br /><br />
|
|
|
262 |
<?php
|
|
|
263 |
//--------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
264 |
|
|
|
265 |
|
|
|
266 |
//Seperator
|
|
|
267 |
echo "\n<br /><hr /><br />\n";
|
|
|
268 |
|
|
|
269 |
|
|
|
270 |
//--------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
271 |
//Test the Progress.cgi Command
|
|
|
272 |
echo "Requesting ".$fckphp_config['uploadProgressHandler']."?iTotal=0&iRead=0&iStatus=1&sessionid=92823&dtnow=".time()."&dtstart=".time()." :<br />\n
|
|
|
273 |
<div style=\"border-style:solid;border-width:1px;border-color:#000000\">\n";
|
|
|
274 |
|
|
|
275 |
$test = implode("",file($fckphp_config['uploadProgressHandler']."?iTotal=0&iRead=0&iStatus=1&sessionid=92823&dtnow=".time()."&dtstart=".time()));
|
|
|
276 |
$test=htmlentities($test);
|
|
|
277 |
echo str_replace("\n","<br />",$test);
|
|
|
278 |
echo "</div> Please do a sanity check on this, it should be something like: \n
|
|
|
279 |
<div style=\"border-style:solid;border-width:1px;border-color:#000000\">\n";
|
|
|
280 |
|
|
|
281 |
$expect="
|
|
|
282 |
<UploadProgress sessionID=\"92823\">
|
|
|
283 |
<RefreshURL><![CDATA[".$fckphp_config['uploadProgressHandler']."?iTotal=0&iRead=0&iStatus=1&sessionid=92823&dtnow=1098477167&dtstart=1098477166]]></RefreshURL>
|
|
|
284 |
<TotalBytes>0</TotalBytes>
|
|
|
285 |
<ReadBytes>0</ReadBytes>
|
|
|
286 |
<Status>1</Status>
|
|
|
287 |
<Speed>0</Speed>
|
|
|
288 |
<TimeRemaining>00:00:00</TimeRemaining>
|
|
|
289 |
<TimeElapsed>00:00:01</TimeElapsed>
|
|
|
290 |
</UploadProgress>";
|
|
|
291 |
|
|
|
292 |
|
|
|
293 |
$expect=htmlentities($expect);
|
|
|
294 |
$expect=str_replace(array("\n","\r"),"<br />",$expect);
|
|
|
295 |
echo "<b>EXAMPLE RESPONSE</b>".$expect;
|
|
|
296 |
?>
|
|
|
297 |
</div>
|
|
|
298 |
<br /><br />
|
|
|
299 |
<?php
|
|
|
300 |
//--------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
301 |
|
|
|
302 |
|
|
|
303 |
//Seperator
|
|
|
304 |
echo "\n<br /><hr /><br />\n";
|
|
|
305 |
|
|
|
306 |
|
|
|
307 |
//--------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
308 |
//Test the GetUploadProgress Command
|
|
|
309 |
echo "Requesting connector.php?Command=GetUploadProgress&Type=File&CurrentFolder=/Docs/&uploadID=19382&refreshURL=".$fckphp_config['uploadProgressHandler']."?uploadID=19382&read=30&total=100 :<br />\n
|
|
|
310 |
<div style=\"border-style:solid;border-width:1px;border-color:#000000\">\n";
|
|
|
311 |
|
|
|
312 |
$test = implode("",file($uri."connector.php?Command=GetUploadProgress&Type=File&CurrentFolder=/Docs/&uploadID=19382&refreshURL=".$fckphp_config['uploadProgressHandler']."?uploadID=19382&read=30&total=100"));
|
|
|
313 |
$test=str_replace("&","&",$test);
|
|
|
314 |
$test=htmlentities($test);
|
|
|
315 |
echo str_replace("\n","<br />",$test);
|
|
|
316 |
echo "</div> Please do a sanity check on this, it should be something like: \n
|
|
|
317 |
<div style=\"border-style:solid;border-width:1px;border-color:#000000\">\n";
|
|
|
318 |
|
|
|
319 |
$expect="
|
|
|
320 |
<?xml version=\"1.0\" encoding=\"utf-8\" ?>
|
|
|
321 |
<Connector command=\"GetUploadProgress\" resourceType=\"File\">
|
|
|
322 |
<CurrentFolder path=\"/Docs/\" url=\"/data/resources/File/Docs/\" />
|
|
|
323 |
<Progress max=\"0\" value=\"0\" />
|
|
|
324 |
<RefreshURL url=\"".$fckphp_config['uploadProgressHandler']."?iTotal=&iRead=&iStatus=&sessionid=&dtnow=1098478692&dtstart=\" />
|
|
|
325 |
</Connector>";
|
|
|
326 |
|
|
|
327 |
|
|
|
328 |
$expect=htmlentities($expect);
|
|
|
329 |
$expect=str_replace(array("\n","\r"),"<br />",$expect);
|
|
|
330 |
echo "<b>EXAMPLE RESPONSE</b>".$expect;
|
|
|
331 |
?>
|
|
|
332 |
</div>
|
|
|
333 |
<br /><br />
|
|
|
334 |
<?php
|
|
|
335 |
//--------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
336 |
|
|
|
337 |
|
|
|
338 |
?>
|
|
|
339 |
</body>
|
|
|
340 |
</html>
|