[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/mambots/editors/mostlyce/jscripts/tiny_mce/filemanager/connectors/php/Commands/ -> GetFolders.php (source)

   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  
  20  class GetFolders {
  21      var $fckphp_config;
  22      var $type;
  23      var $cwd;
  24      var $actual_cwd;
  25      
  26  	function GetFolders($fckphp_config,$type,$cwd) {
  27          $this->fckphp_config=$fckphp_config;
  28          $this->type=$type;
  29          $this->raw_cwd=$cwd;
  30          $this->actual_cwd=str_replace("//","/",($fckphp_config['UserFilesPath']."/$type/".$this->raw_cwd));
  31          $this->real_cwd=str_replace("//","/",($this->fckphp_config['basedir']."/".$this->actual_cwd));
  32      }
  33      
  34  	function run() {
  35          header ("content-type: text/xml");
  36          echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
  37          ?>
  38  <Connector command="GetFolders" resourceType="<?php echo $this->type; ?>">
  39      <CurrentFolder path="<?php echo $this->raw_cwd; ?>" url="<?php echo $this->actual_cwd; ?>" />
  40      <Folders>
  41          <?php
  42              if (is_dir($this->real_cwd)) {
  43                  if ($dh=opendir($this->real_cwd)) {
  44                      while (($filename=readdir($dh))!==false) {
  45                          if (($filename!=".")&&($filename!="..")) {
  46                              if (is_dir($this->real_cwd."/$filename")) {
  47  
  48                                  //check if$fckphp_configured not to show this folder
  49                                  $hide=false;
  50                                  for($i=0;$i<sizeof($this->fckphp_config['ResourceAreas'][$this->type]['HideFolders']);$i++) 
  51                                      $hide=(ereg($this->fckphp_config['ResourceAreas'][$this->type]['HideFolders'][$i],$filename)?true:$hide);
  52  
  53                                  if (!$hide) echo "<Folder name=\"$filename\" />\n";
  54                              }
  55                          }
  56                      }
  57                      closedir($dh);
  58                  }
  59              }
  60          ?>
  61      </Folders>
  62  </Connector>
  63          <?php
  64      }
  65  }
  66  
  67  ?>