~ubuntu-branches/ubuntu/intrepid/moin/intrepid-updates

« back to all changes in this revision

Viewing changes to wiki/htdocs/applets/FCKeditor/editor/filemanager/browser/mcpuk/connectors/php/Commands/DeleteFolder.php

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-02-14 16:09:24 UTC
  • mfrom: (0.2.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20060214160924-fyrx3gvknzqvt4vj
Tags: 1.5.2-1ubuntu1
Drop python2.3 package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 * "Support Open Source software. What about a donation today?"
13
 
 * 
14
 
 * File Name: DeleteFolder.php
15
 
 *      Implements the DeleteFolder command to delete a folder
16
 
 *      in the current directory. Output is in XML.
17
 
 * 
18
 
 * File Authors:
19
 
 *              Grant French (grant@mcpuk.net)
20
 
 */
21
 
class DeleteFolder {
22
 
        var $fckphp_config;
23
 
        var $type;
24
 
        var $cwd;
25
 
        var $actual_cwd;
26
 
        var $newfolder;
27
 
        
28
 
        function DeleteFolder($fckphp_config,$type,$cwd) {
29
 
                $this->fckphp_config=$fckphp_config;
30
 
                $this->type=$type;
31
 
                $this->raw_cwd=$cwd;
32
 
                $this->actual_cwd=str_replace("//","/",($this->fckphp_config['UserFilesPath']."/$type/".$this->raw_cwd));
33
 
                $this->real_cwd=str_replace("//","/",($this->fckphp_config['basedir']."/".$this->actual_cwd));
34
 
                $this->foldername=str_replace(array("..","/"),"",$_GET['FolderName']);
35
 
        }
36
 
        
37
 
        function run() {
38
 
                
39
 
                if ($this->delDir($this->real_cwd.'/'.$this->foldername)) {
40
 
                        $err_no=0;
41
 
                } else {
42
 
                        $err_no=402;
43
 
                }
44
 
                
45
 
                header ("content-type: text/xml");
46
 
                echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
47
 
                ?>
48
 
<Connector command="DeleteFolder" resourceType="<?php echo $this->type; ?>">
49
 
        <CurrentFolder path="<?php echo $this->raw_cwd; ?>" url="<?php echo $this->actual_cwd; ?>" />
50
 
        <Error number="<?php echo "".$err_no; ?>" />
51
 
</Connector>
52
 
                <?php
53
 
        }
54
 
        
55
 
        
56
 
        function delDir($dir) {
57
 
                $dh=opendir($dir);
58
 
                if ($dh) {
59
 
                        while ($entry=readdir($dh)) {
60
 
                                if (($entry!=".")&&($entry!="..")) {
61
 
                                        if (is_dir($dir.'/'.$entry)) {
62
 
                                                $this->delDir($dir.'/'.$entry); 
63
 
                                        } else {
64
 
                                                $thumb=$dir.'/.thumb_'.$entry;
65
 
                                                if (file_exists($thumb)) if (!unlink($thumb)) return false;
66
 
                                                if (!unlink($dir.'/'.$entry)) return false;
67
 
                                        }
68
 
                                }
69
 
                        }       
70
 
                        closedir($dh);
71
 
                        return rmdir($dir);
72
 
                } else {
73
 
                        return false;
74
 
                }
75
 
        }
76
 
}
77
 
 
78
 
?>
 
 
b'\\ No newline at end of file'