/** * Méthode d'instanciation de l'objet en singleton * * design pattern singleton * * @author Frédéric Laguitton * @since 2014-05-01 * @version v1 */ public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new ConfigApp(); } return self::$instance; }
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * License as published by the Free Software Foundation; either * version 3 of the License, or any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. * * You should have received a copy of the GNU Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ namespace OCA\User_Servervars2\AppInfo; $app = new ConfigApp(); $c = $app->getContainer(); $appName = 'user_servervars2'; if (!\OCP\App::isEnabled($appName)) { return; } //To put a template into admin menu \OCP\App::registerAdmin('user_servervars2', 'settings/admin'); \OCP\App::registerPersonal('user_servervars2', 'settings/user'); $login = array('href' => $app->getAppConfig()->getValue('user_servervars2', 'sso_url'), 'name' => $app->getAppConfig()->getValue('user_servervars2', 'button_name', 'Use Your ID Provider')); \OC_App::registerLogIn($login); $app->getUserManager()->registerBackend($c->query('UserBackend')); //$app->getGroupManager()->addBackend( new \OC_Group_Database() ); $c->query('ServerVarsHooks')->register($app->getUserSession()); $authStatus = $c->isLoggedIn(); // - trigger authentication -
define('RelativePathConf', ReducPath(RelativePathTop . '../../config/')); include_once RelativePathLibs . 'class_erreur.php'; include_once RelativePathLibs . 'class_config.php'; include_once RelativePathLibs . 'class_tpl.php'; include_once RelativePathLibs . 'commun.php'; function ReducPath($in) { $tab_out = array(); $idx = 0; $tab_in = explode('/', $in); foreach ($tab_in as $item) { switch ($item) { case '..': if (isset($tab_out[$idx]) && $tab_out[$idx] != '..') { unset($tab_out[$idx--]); } else { $tab_out[++$idx] = $item; } break; case '.': break; default: $tab_out[++$idx] = $item; } } $out = implode('/', $tab_out); return $out; } $LogErreur = LogErreur::getInstance(); $ConfigApp = ConfigApp::getInstance(); $Tpl = Tpl::getInstance();
<?php namespace OCA\User_Servervars2\AppInfo; $app = new ConfigApp(); $app->registerRoutes($this, array('routes' => array(array('name' => 'settings#class_exists', 'url' => '/api/settings/class/{class}', 'verb' => 'GET'), array('name' => 'settings#conf', 'url' => '/api/settings/conf/', 'verb' => 'POST'), array('name' => 'settings#set_config', 'url' => '/api/settings/', 'verb' => 'POST'))));