From 7b86f75955cc6aa0e62636b68ac1c1abd9b6adb5 Mon Sep 17 00:00:00 2001 From: Victor Dubiniuk Date: Wed, 7 Aug 2013 21:41:11 +0300 Subject: [PATCH] Cross user access --- ajax/genesis.php | 20 -------------------- lib/download.php | 9 +++++---- lib/download/range.php | 3 ++- lib/download/simple.php | 3 ++- lib/genesis.php | 5 ++++- 5 files changed, 13 insertions(+), 27 deletions(-) delete mode 100644 ajax/genesis.php diff --git a/ajax/genesis.php b/ajax/genesis.php deleted file mode 100644 index 4795aef5..00000000 --- a/ajax/genesis.php +++ /dev/null @@ -1,20 +0,0 @@ -sendResponse(); \ No newline at end of file diff --git a/lib/download.php b/lib/download.php index 13758057..dfcd2c98 100644 --- a/lib/download.php +++ b/lib/download.php @@ -9,19 +9,20 @@ class Download { protected $instance; - public function __construct($filepath){ + public function __construct($view, $filepath){ $this->filepath = $filepath; + $this->view = $view; if (isset($_SERVER['HTTP_RANGE'])) { - $this->instance = new Download\Range($filepath); + $this->instance = new Download\Range($view, $filepath); } else { - $this->instance = new Download\Simple($filepath); + $this->instance = new Download\Simple($view, $filepath); } } public function sendResponse(){ \OCP\Response::disableCaching(); - $this->view = View::initOfficeView(\OCP\User::getUser()); + if (!$this->fileExists()){ $this->sendNotFound(); diff --git a/lib/download/range.php b/lib/download/range.php index 198f7ca4..a9b21b73 100644 --- a/lib/download/range.php +++ b/lib/download/range.php @@ -9,7 +9,8 @@ class Range extends \OCA\Office\Download { // End of the range protected $end; - public function __construct($filepath){ + public function __construct($view, $filepath){ + $this->view = $view; $this->filepath = $filepath; } diff --git a/lib/download/simple.php b/lib/download/simple.php index de81aec8..56332017 100644 --- a/lib/download/simple.php +++ b/lib/download/simple.php @@ -5,7 +5,8 @@ use OCA\Office\View; class Simple extends \OCA\Office\Download { - public function __construct($filepath){ + public function __construct($view, $filepath){ + $this->view = $view; $this->filepath = $filepath; } diff --git a/lib/genesis.php b/lib/genesis.php index 06d6af80..721acd88 100644 --- a/lib/genesis.php +++ b/lib/genesis.php @@ -10,7 +10,10 @@ class Genesis { $session = Session::getSession(@$args['es_id']); $filename = isset($session['genesis_url']) ? $session['genesis_url'] : ''; - $download = new Download($filename); + + $officeView = View::initOfficeView($session['owner']); + + $download = new Download($officeView, $filename); $download->sendResponse(); }