function check() { $metadatarows = select_bhdb("metadata", array("filepath" => $this->filepath), ""); # Grab the array of metadata rows. $sizerows = select_bhdb("metadata", array("filepath" => $filepath, "metaname" => "filesize"), ""); # Get size row for this file. if (empty($sizerows)) { # If there isn't one, then make one. $this->fileinfo['filesize'] = filesize($this->absfilepath); $this->savemetadata(); } if (empty($metadatarows)) { $this->fileinfo['createdate'] = time(); $this->fileinfo['moddate'] = time(); $this->fileinfo['mimetype'] = bh_mimetype($this->filepath); $this->savemetadata(); # Insert ACL entries of parent $parent = bh_fpclean(bh_get_parent($this->filepath)); $acl_u_rows = select_bhdb("aclusers", array("filepath" => $parent), ""); foreach ($acl_u_rows as $acl_u_row) { $acl_u_row['filepath'] = $this->filepath; insert_bhdb("aclusers", $acl_u_row); } $acl_g_rows = select_bhdb("aclgroups", array("filepath" => $parent), ""); foreach ($acl_g_rows as $acl_g_row) { $acl_g_row['filepath'] = $this->filepath; insert_bhdb("aclgroups", $acl_g_row); } $acl_p_rows = select_bhdb("aclpublic", array("filepath" => $parent), ""); foreach ($acl_p_rows as $acl_p_row) { $acl_p_row['filepath'] = $this->filepath; insert_bhdb("aclpublic", $acl_p_row); } } }
*/ #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"; }
function COPY(&$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) { return "403 Forbidden"; } $fileobj = new bhfile($filepath); $fileobj->copyto($destfilepath); return "204 No Content"; }
<?php /* * ByteHoard 2.1 * Copyright (c) Andrew Godwin & contributors 2004 * * Module * $Id: returntofolder.inc.php,v 1.1 2005/07/26 21:55:09 andrewgodwin Exp $ * */ #name Return To Folder #author Andrew Godwin #description Goes to the folder that the passed file is in. #iscore 1 # Test for include status if (IN_BH != 1) { header("Location: ../index.php"); die; } # Get the directory $filepath = bh_fpclean(bh_get_parent($_GET['filepath'])); $_GET['filepath'] = $filepath; # Include the viewdir module require "modules/viewdir.inc.php";