$filepath = bh_fpclean($_GET['filepath']); $filename = bh_get_filename($filepath); if (bh_file_exists($filepath) == true) { if ($_POST['iscontent']) { $fileobj = new bhfile($filepath); $sizediff = strlen($_POST['file_content']) - $fileobj->fileinfo['filesize']; if ($bhcurrent['userobj']->spaceremaining() < $sizediff) { bh_add_logvars(array("quota" => $bhcurrent['userobj']->quota)); bh_add_error($bhlang['error:quota_exceeded']); require "modules/error.inc.php"; } else { $fileobj->filecontents = $_POST['file_content']; $fileobj->savefile(); bh_log($bhlang['notice:file_saved'], "BH_NOTICE"); bh_log(str_replace("#FILE#", $filepath, str_replace("#USER#", $bhsession['username'], $bhlang['log:#USER#_modified_#FILE#'])), "BH_FILE_MODIFIED"); require "modules/viewfile.inc.php"; } } else { $fileobj = new bhfile($filepath); $fileobj->loadfile(); $layoutobj = new bhlayout("editform"); $layoutobj->content1 = $fileobj->filecontents; $layoutobj->filepath = $filepath; $layoutobj->subtitle1 = str_replace("#FILE#", $filename, $bhlang['title:editing_#FILE#']); $layoutobj->title = str_replace("#FILE#", $filename, $bhlang['title:editing_#FILE#']); $layoutobj->display(); } } else { bh_log($bhlang['error:file_not_exist'], "BH_NOPAGE"); require "modules/error.inc.php"; }
$layoutobj->title = $bhlang['title:main']; $layoutobj->content1 = $bhtexts['main_loggedout']; $layoutobj->display(); } else { # Send the file listing to the layout, along with directory name # Open layout object $layoutobj = new bhlayout("filelist"); # Grab the directory we're looking in $filepath = bh_fpclean($bhcurrent['userobj']->homedir); # Open the file object for the directory if (empty($filepath)) { $filepath = "/"; } $directoryobj = new bhfile($filepath); if ($directoryobj->is_dir() == FALSE) { bh_error($bhlang['error:not_a_dir'], "BH_INVALID_PATH"); } $modulestouse = bh_listmodulesdirectory($filepath); # Get listing mode for this directory $view = bh_view($bhcurrent['userobj']->username, $filepath); # Grab a listing of the files $files = $directoryobj->loadfile(); # Send the file listing to the layout, along with directory name $layoutobj->title = $bhlang['title:viewing_directory'] . " " . $filepath; $layoutobj->subtitle1 = $filepath; $layoutobj->content1 = $files; $layoutobj->content2 = $modulestouse; $layoutobj->filepath = $filepath; $layoutobj->view = $view; $layoutobj->display(); }
function PROPFIND(&$options, &$files) { global $bhsession; $filepath = bh_fpclean($options['path']); $fileobj = new bhfile($filepath); $files['files'][] = $this->fileinfo($options['path']); if ($fileobj->is_dir() == 1) { $filelist = $fileobj->loadfile(); foreach ($filelist as $afile) { $files['files'][] = $this->fileinfo($afile['filepath']); } } return "200 OK"; }