From 2b440eadcccc876a180bcf62f10e6de281ff6175 Mon Sep 17 00:00:00 2001 From: Victor Dubiniuk Date: Fri, 9 Aug 2013 17:29:18 +0300 Subject: [PATCH] Store original path --- ajax/controller.php | 4 ++-- lib/session.php | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ajax/controller.php b/ajax/controller.php index f5b47d8a..2e4b6310 100644 --- a/ajax/controller.php +++ b/ajax/controller.php @@ -36,10 +36,10 @@ class Controller { } if ($genesisPath){ - $session = Session::getSessionByPath($uid, $genesisPath); + $session = Session::getSessionByOwnerAndGenesis($uid, $genesisPath); if (!$session){ $hash = View::getHashByGenesis($uid, $genesisPath); - $session = Session::addSession($genesisPath, $hash); + $session = Session::addSession($genesisPath, $hash, $path); } \OCP\JSON::success($session); exit(); diff --git a/lib/session.php b/lib/session.php index cba88f0b..0cde911d 100644 --- a/lib/session.php +++ b/lib/session.php @@ -25,20 +25,21 @@ class Session { return $result->fetchRow(); } - public static function getSessionByPath($uid, $url){ + public static function getSessionByOwnerAndGenesis($uid, $url){ $query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*office_session` WHERE `genesis_url`= ? AND `owner`= ? '); $result = $query->execute(array($url, $uid)); return $result->fetchRow(); } - public static function addSession($genesis, $hash){ - $query = \OCP\DB::prepare('INSERT INTO `*PREFIX*office_session` (`es_id`, `genesis_url`, `genesis_hash`, `owner`) VALUES (?, ?, ?, ?) '); + public static function addSession($genesis, $hash, $documentPath){ + $query = \OCP\DB::prepare('INSERT INTO `*PREFIX*office_session` (`es_id`, `genesis_url`, `genesis_hash`, `owner`, `document_path`) VALUES (?, ?, ?, ?, ?) '); $data = array( 'es_id' => self::getUniqueSessionId(), 'genesis_url' => $genesis, 'genesis_hash' => $hash, - 'owner' => \OCP\User::getUser() + 'owner' => \OCP\User::getUser(), + 'document_path' => $documentPath ); $result = $query->execute(array_values($data));