testme.php.suspended
上传用户:wlfwy2004
上传日期:2016-12-12
资源大小:33978k
文件大小:14k
源码类别:

Jsp/Servlet

开发平台:

Java

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