richdocuments/ajax/session.php

26 lines
522 B
PHP
Raw Normal View History

2013-08-07 02:22:21 +03:00
<?php
namespace OCA\Office;
// Check if we are a user
\OCP\User::checkLoggedIn();
$genesis = @$_POST['genesis'];
2013-08-07 21:14:36 +03:00
$uid = \OCP\User::getUser();
$officeView = View::initOfficeView($uid);
if (!$officeView->file_exists($genesis)){
$genesisPath = View::storeDocument($uid, $genesis);
} else {
$genesisPath = $genesis;
}
if ($genesisPath){
$session = Session::getSessionByPath($genesisPath);
2013-08-07 02:22:21 +03:00
if (!$session){
2013-08-07 21:14:36 +03:00
$session = Session::addSession($genesisPath);
2013-08-07 02:22:21 +03:00
}
\OCP\JSON::success($session);
exit();
}
\OCP\JSON::error();