RenameFolder.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: RenameFolder.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 RenameFolder {
  20. var $fckphp_config;
  21. var $type;
  22. var $cwd;
  23. var $actual_cwd;
  24. var $newfolder;
  25. function RenameFolder($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("//","/",($fckphp_config['UserFilesPath']."/$type/".$this->raw_cwd));
  30. $this->real_cwd=str_replace("//","/",($this->fckphp_config['basedir']."/".$this->actual_cwd));
  31. $this->foldername=str_replace(array("..","/"),"",$_GET['FolderName']);
  32. $this->newname=str_replace(array("..","/"),"",$this->checkName($_GET['NewName']));
  33. }
  34. function checkName($name) {
  35. $newName="";
  36. for ($i=0;$i<strlen($name);$i++) {
  37. if (in_array($name[$i],$this->fckphp_config['DirNameAllowedChars'])) $newName.=$name[$i];
  38. }
  39. return $newName;
  40. }
  41. function run() {
  42. $result1=false;
  43. if ($this->newname!='') {
  44. $result1=rename($this->real_cwd.'/'.$this->foldername,$this->real_cwd.'/'.$this->newname);
  45. }
  46. header ("content-type: text/xml");
  47. echo "<?xml version="1.0" encoding="utf-8" ?>n";
  48. ?>
  49. <Connector command="RenameFolder" resourceType="<?php echo $this->type; ?>">
  50. <CurrentFolder path="<?php echo $this->raw_cwd; ?>" url="<?php echo $this->actual_cwd; ?>" />
  51. <?php
  52. if ($result1) {
  53. $err_no=0;
  54. } else {
  55. $err_no=602;
  56. }
  57. ?>
  58. <Error number="<?php echo "".$err_no; ?>" />
  59. </Connector>
  60. <?php
  61. }
  62. }
  63. ?>