Exemple #1
0
 */
#name Delete
#author Andrew Godwin
#description Deletes a file.
#iscore 1
# Note: no layouts here, of course. Unless we get an error.
# Test for include status
if (IN_BH != 1) {
    header("Location: ../index.php");
    die;
}
$filepath = bh_fpclean($_GET['filepath']);
$filename = bh_get_filename($filepath);
if (bh_file_exists($filepath) == true) {
    if ($_POST['dodelete'] == 1) {
        $delfileobj = new bhfile($filepath);
        $delfileobj->smartdeletefile();
        unset($delfileobj);
        bh_log($bhlang['notice:file_deleted'], "BH_FILE_DELETED");
        $_GET['filepath'] = bh_get_parent($filepath);
        require "modules/viewdir.inc.php";
    } else {
        $layoutobj = new bhlayout('deleteform');
        $layoutobj->filepath = $filepath;
        $layoutobj->title = $bhlang['title:deleting_'] . bh_get_filename($filepath);
        $layoutobj->display();
    }
} else {
    bh_log($bhlang['error:file_not_exist'], "BH_NOPAGE");
    require "modules/error.inc.php";
}
Exemple #2
0
 function MOVE(&$options)
 {
     global $bhsession;
     $destfilepath = bh_fpclean($options['dest']);
     $filepath = bh_fpclean($options['path']);
     $infolder = bh_get_parent($destfilepath);
     $fileexist = bh_user_file_exists($filepath);
     if (!$fileexist) {
         return "404 Not Found";
     }
     if (bh_checkrights(bh_fpclean($infolder), $bhsession['username']) <= 1) {
         a($infolder);
         return "403 Forbidden";
     }
     $fileobj = new bhfile($filepath);
     $fileobj->copyto($destfilepath);
     $fileobj->smartdeletefile();
     return "201 Created";
 }