if ($view !== 'files') { $hash .= '&view=' . urlencode($view); } header('Location: ' . OCP\Util::linkTo('files', 'index.php') . $hash); exit; } $user = OC_User::getUser(); $config = \OC::$server->getConfig(); // mostly for the home storage's free space $dirInfo = \OC\Files\Filesystem::getFileInfo('/', false); $storageInfo = OC_Helper::getStorageInfo('/', $dirInfo); // if the encryption app is disabled, than everything is fine (INIT_SUCCESSFUL status code) $encryptionInitStatus = 2; if (OC_App::isEnabled('files_encryption')) { $session = new \OCA\Files_Encryption\Session(new \OC\Files\View('/')); $encryptionInitStatus = $session->getInitialized(); } $nav = new OCP\Template('files', 'appnavigation', ''); function sortNavigationItems($item1, $item2) { return $item1['order'] - $item2['order']; } \OCA\Files\App::getNavigationManager()->add(array('id' => 'favorites', 'appname' => 'files', 'script' => 'simplelist.php', 'order' => 5, 'name' => $l->t('Favorites'))); $navItems = \OCA\Files\App::getNavigationManager()->getAll(); usort($navItems, 'sortNavigationItems'); $nav->assign('navigationItems', $navItems); $contentItems = array(); function renderScript($appName, $scriptName) { $content = ''; $appPath = OC_App::getAppPath($appName);
<?php /** * Copyright (c) 2013 Sam Tuke <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ // Add CSS stylesheet \OC_Util::addStyle('files_encryption', 'settings-personal'); $tmpl = new OCP\Template('files_encryption', 'settings-personal'); $user = \OCP\USER::getUser(); $view = new \OC\Files\View('/'); $util = new \OCA\Files_Encryption\Util($view, $user); $session = new \OCA\Files_Encryption\Session($view); $privateKeySet = $session->getPrivateKey() !== false; // did we tried to initialize the keys for this session? $initialized = $session->getInitialized(); $recoveryAdminEnabled = \OC::$server->getAppConfig()->getValue('files_encryption', 'recoveryAdminEnabled'); $recoveryEnabledForUser = $util->recoveryEnabledForUser(); $result = false; if ($recoveryAdminEnabled || !$privateKeySet) { \OCP\Util::addscript('files_encryption', 'settings-personal'); $tmpl->assign('recoveryEnabled', $recoveryAdminEnabled); $tmpl->assign('recoveryEnabledForUser', $recoveryEnabledForUser); $tmpl->assign('privateKeySet', $privateKeySet); $tmpl->assign('initialized', $initialized); $result = $tmpl->fetchPage(); } return $result;
<?php /** * Copyright (c) 2011 Robin Appelman <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ \OC_Util::checkAdminUser(); $tmpl = new OCP\Template('files_encryption', 'settings-admin'); // Check if an adminRecovery account is enabled for recovering files after lost pwd $recoveryAdminEnabled = \OC::$server->getAppConfig()->getValue('files_encryption', 'recoveryAdminEnabled', '0'); $session = new \OCA\Files_Encryption\Session(new \OC\Files\View('/')); $initStatus = $session->getInitialized(); $tmpl->assign('recoveryEnabled', $recoveryAdminEnabled); $tmpl->assign('initStatus', $initStatus); \OCP\Util::addscript('files_encryption', 'settings-admin'); \OCP\Util::addscript('core', 'multiselect'); return $tmpl->fetchPage();