[ 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/ -> DeleteFile.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: DeleteFile.php
  13   *     Implements the DeleteFile command to delete a file
  14   *     in the current directory. Output is in XML.
  15   * 
  16   * File Authors:
  17   *         Grant French (grant@mcpuk.net)
  18   */
  19  
  20  class DeleteFile {
  21      var $fckphp_config;
  22      var $type;
  23      var $cwd;
  24      var $actual_cwd;
  25      var $newfolder;
  26      
  27  	function DeleteFile($fckphp_config,$type,$cwd) {
  28          $this->fckphp_config=$fckphp_config;
  29          $this->type=$type;
  30          $this->raw_cwd=$cwd;
  31          $this->actual_cwd=str_replace("//","/",($this->fckphp_config['UserFilesPath']."/$type/".$this->raw_cwd));
  32          $this->real_cwd=str_replace("//","/",($this->fckphp_config['basedir']."/".$this->actual_cwd));
  33          $this->filename=str_replace(array("..","/"),"",$_GET['FileName']);
  34      }
  35      
  36  	function run() {
  37          $result1=false;
  38          $result2=true;
  39          
  40          $thumb=$this->real_cwd.'/.thumb_'.$this->filename;
  41          $result1=unlink($this->real_cwd.'/'.$this->filename);
  42          if (file_exists($thumb)) $result2=unlink($thumb);
  43          
  44          header ("content-type: text/xml");
  45          echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
  46          ?>
  47  <Connector command="DeleteFile" resourceType="<?php echo $this->type; ?>">
  48      <CurrentFolder path="<?php echo $this->raw_cwd; ?>" url="<?php echo $this->actual_cwd; ?>" />
  49      <?php
  50          if ($result1&&$result2) {
  51              $err_no=0;
  52          } else {
  53              $err_no=302;
  54          }
  55          
  56      ?>
  57      <Error number="<?php echo "".$err_no; ?>" />
  58  </Connector>
  59          <?php
  60      }
  61  }
  62  
  63  ?>