public function init() { $response = Sahara_Soap::getSchedServerSessionClient()->getSessionInformation(array('userQName' => Zend_Auth::getInstance()->getIdentity())); $home = new Sahara_Home(Sahara_Home::getHomeDirectoryLocation(), time() - $response->time); $home->loadContents(); $this->_view->files = $home->getFlattenedContents(); $this->view->refreshTime = $this->_config->home->sessionrefresh; if (!$this->view->refreshTime) { $this->view->refreshTime = self::DEFAULT_REFRESH_SEC; } }
/** * Action to delete a file. */ public function deletesessionAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->layout()->disableLayout(); $path = $homePath = Sahara_Home::getHomeDirectoryLocation(); $reqPath = $this->_getParam('path'); if ($reqPath) { $reqPath = implode('/', explode(':', $reqPath)); } $reqFile = $this->_getParam('file'); list($junk, $user) = explode(':', $this->_auth->getIdentity(), 2); if ($reqPath && !($path = realpath($path . '/' . $reqPath))) { $this->_logger->warn("Unable to delete {$reqFile} because path {$path} does not exist in home directory " . "{$homeDir}."); echo "FAILED: Path {$reqPath} does not exist."; return; } if (strpos($path, $user) === false) { $this->_logger->warn("Unable to delete {$reqFile} because path {$path} does not contain user name {$user}."); echo "FAILED: Path does not include name {$user}."; return; } $file = $path . '/' . $reqFile; if (!is_file($file)) { $this->_logger->warn("Unable to delete {$reqFile} because it does not exist."); echo "FAILED: File {$reqFile} does not exist."; return; } if (!unlink($file)) { echo 'FAILED: Permission denied.'; return; } $response = Sahara_Soap::getSchedServerSessionClient()->getSessionInformation(array('userQName' => $this->_auth->getIdentity())); $home = new Sahara_Home($homePath, time() - $response->time); $home->loadContents(); echo $this->view->json($home->getFlattenedContents()); }