3 PHP Connector for the FCKEditor v2 File Manager
4 Written By Grant French, UK, Sept 2004
7 FCKEditor - By Frederico Caldeira Knabben
8 http://www.fckeditor.net
11 Implements the DeleteFile command to delete a file
12 in the current directory. Output is in XML
14 2009.2.10 mbstringなしでも実行できるように修正 by naoki hirata
17 class RenameFolder extends command {
22 $this->foldername = $_GET['FolderName'];
23 $this->newname = $_GET['NewName'];
27 $err_no = $this->_run();
29 header ("content-type: text/xml");
30 echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
32 <Connector command="RenameFolder" resourceType="<?php echo $this->XMLEncode($this->type); ?>">
33 <CurrentFolder path="<?php echo $this->XMLEncode($this->raw_cwd); ?>" url="<?php echo $this->XMLEncode($this->url($this->actual_cwd)); ?>" />
34 <Error number="<?php echo $err_no; ?>" />
40 if ($this->newname == '') {
44 if (function_exists('mb_ereg')){
45 if (mb_ereg($this->fckphp_config['DisableName'], $this->newname)) {
49 if (ereg($this->fckphp_config['DisableName'], $this->newname)) {
53 if (function_exists('mb_ereg')){
54 if (mb_ereg($this->fckphp_config['DisableChars'], $this->newname)) {
58 if (ereg($this->fckphp_config['DisableChars'], $this->newname)) {
63 //Check if we can create the directory here
64 if (! is_writeable($this->path($this->actual_cwd))) {
65 return 103; //No permissions to rename
68 //Check if it already exists
69 if (file_exists($this->path("{$this->actual_cwd}{$this->newname}"))) {
70 return 104; //Folder or file already exists
73 if (! @rename($this->path("{$this->actual_cwd}{$this->foldername}"), $this->path("{$this->actual_cwd}/{$this->newname}"))) {