public function getFiles() { // var_dump(Storage::load()); $out = array(); foreach (Storage::load()->getData() as $token => $value) { $value['file'] = str_replace($this->userdir, '/', $value['file']); $value['id'] = $token; $out[] = $value; } return $out; }
public function fileDownload() { if (!isset($_GET['uh']) || !isset($_GET['s']) || !($user = base64_decode($_GET['uh']))) { die('Invalid link'); } $share_token = $_GET['s']; $_SERVER['REMOTE_USER'] = $user; // maybe encryption, maybe a user hash scan if users less than 100 require_once dirname(__FILE__) . "/../../../php/cache.php"; require_once dirname(__FILE__) . "/Storage.php"; // require_once( dirname(__FILE__)."/src/Storage.php" ); $share = Storage::load(); if (!($filedata = $share->getData($share_token)) || $filedata['expire'] < time()) { die('Invalid link'); } if (!empty($filedata['password']) && $_SERVER['PHP_AUTH_PW'] != $filedata['password']) { self::_doAuth(); } else { if (!sendFile($filedata['file'])) { echo "temp fail"; } } }