DeleteFile.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: 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. class DeleteFile {
  20. var $fckphp_config;
  21. var $type;
  22. var $cwd;
  23. var $actual_cwd;
  24. var $newfolder;
  25. function DeleteFile($fckphp_config,$type,$cwd) {
  26. $this->fckphp_config=$fckphp_config;
  27. $this->type=$type;
  28. $this->raw_cwd=$cwd;
  29. $this->actual_cwd=str_replace("//","/",($this->fckphp_config['UserFilesPath']."/$type/".$this->raw_cwd));
  30. $this->real_cwd=str_replace("//","/",($this->fckphp_config['basedir']."/".$this->actual_cwd));
  31. $this->filename=str_replace(array("..","/"),"",$_GET['FileName']);
  32. }
  33. function run() {
  34. $result1=false;
  35. $result2=true;
  36. $thumb=$this->real_cwd.'/.thumb_'.$this->filename;
  37. $result1=unlink($this->real_cwd.'/'.$this->filename);
  38. if (file_exists($thumb)) $result2=unlink($thumb);
  39. header ("content-type: text/xml");
  40. echo "<?xml version="1.0" encoding="utf-8" ?>n";
  41. ?>
  42. <Connector command="DeleteFile" resourceType="<?php echo $this->type; ?>">
  43. <CurrentFolder path="<?php echo $this->raw_cwd; ?>" url="<?php echo $this->actual_cwd; ?>" />
  44. <?php
  45. if ($result1&&$result2) {
  46. $err_no=0;
  47. } else {
  48. $err_no=302;
  49. }
  50. ?>
  51. <Error number="<?php echo "".$err_no; ?>" />
  52. </Connector>
  53. <?php
  54. }
  55. }
  56. ?>