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

Jsp/Servlet

开发平台:

Java

  1. <?php 
  2. /*
  3.  * FCKeditor - The text editor for internet
  4.  * Copyright (C) 2003-2005 Frederico Caldeira Knabben
  5.  * 
  6.  * Licensed under the terms of the GNU Lesser General Public License:
  7.  *  http://www.opensource.org/licenses/lgpl-license.php
  8.  * 
  9.  * For further information visit:
  10.  *  http://www.fckeditor.net/
  11.  * 
  12.  * File Name: GetFolders.php
  13.  *  Implements the GetFolders command, to list the folders 
  14.  *  in the current directory. Output is in XML
  15.  * 
  16.  * File Authors:
  17.  *  Grant French (grant@mcpuk.net)
  18.  */
  19. class GetFolders {
  20. var $fckphp_config;
  21. var $type;
  22. var $cwd;
  23. var $actual_cwd;
  24. function GetFolders($fckphp_config,$type,$cwd) {
  25. $this->fckphp_config=$fckphp_config;
  26. $this->type=$type;
  27. $this->raw_cwd=$cwd;
  28. $this->actual_cwd=str_replace("//","/",($fckphp_config['UserFilesPath']."/$type/".$this->raw_cwd));
  29. $this->real_cwd=str_replace("//","/",($this->fckphp_config['basedir']."/".$this->actual_cwd));
  30. }
  31. function run() {
  32. header ("content-type: text/xml");
  33. echo "<?xml version="1.0" encoding="utf-8" ?>n";
  34. ?>
  35. <Connector command="GetFolders" resourceType="<?php echo $this->type; ?>">
  36. <CurrentFolder path="<?php echo $this->raw_cwd; ?>" url="<?php echo $this->actual_cwd; ?>" />
  37. <Folders>
  38. <?php
  39. if ($dh=opendir($this->real_cwd)) {
  40. while (($filename=readdir($dh))!==false) {
  41. if (($filename!=".")&&($filename!="..")) {
  42. if (is_dir($this->real_cwd."/$filename")) {
  43. //check if$fckphp_configured not to show this folder
  44. $hide=false;
  45. for($i=0;$i<sizeof($this->fckphp_config['ResourceAreas'][$this->type]['HideFolders']);$i++) 
  46. $hide=(ereg($this->fckphp_config['ResourceAreas'][$this->type]['HideFolders'][$i],$filename)?true:$hide);
  47. if (!$hide) echo "<Folder name="$filename" />n";
  48. }
  49. }
  50. }
  51. closedir($dh);
  52. }
  53. ?>
  54. </Folders>
  55. </Connector>
  56. <?php
  57. }
  58. }
  59. ?>