/** * notify a launched event * @param CopixEvent $event the launched event */ function notify($event) { require_once COPIX_EVENTS_PATH . 'CopixEventResponse.class.php'; $me =& CopixEventNotifier::instance(); $response =& new CopixEventResponse(); $me->_dispatch($event, $response); return $response; }
/** * Logout */ public function processOut() { Logs::set(array('type' => 'LOG', 'message' => 'Logout: ' . _currentUser()->getLogin())); CopixAuth::getCurrentUser()->logout(array()); CopixEventNotifier::notify('logout', array('login' => CopixAuth::getCurrentUser()->getLogin())); CopixAuth::destroyCurrentUser(); CopixSession::destroyNamespace('default'); return _arRedirect(CopixRequest::get('auth_url_return', _url('||'))); }
public function beforeProcess(&$action) { if (CopixConfig::get('conf_Saml_actif') != 1) { return; } require_once COPIX_UTILS_PATH . '../../simplesamlphp/lib/_autoload.php'; $asId = 'iconito-sql'; if (CopixConfig::exists('default|conf_Saml_authSource') && CopixConfig::get('default|conf_Saml_authSource')) { $asId = CopixConfig::get('default|conf_Saml_authSource'); } $as = new SimpleSAML_Auth_Simple($asId); $ppo->user = _currentUser(); if ($as->isAuthenticated() && !$ppo->user->isConnected()) { $attributes = $as->getAttributes(); $uidAttribute = 'login_dbuser'; if (CopixConfig::exists('default|conf_Saml_uidAttribute') && CopixConfig::get('default|conf_Saml_uidAttribute')) { $uidAttribute = CopixConfig::get('default|conf_Saml_uidAttribute'); } $ppo->saml_user = null; if (isset($attributes[$uidAttribute]) && isset($attributes[$uidAttribute][0])) { $ppo->saml_user = $attributes[$uidAttribute][0]; } if ($ppo->saml_user) { $ppo->iconito_user = Kernel::getUserInfo("LOGIN", $ppo->saml_user); if ($ppo->iconito_user['login']) { _currentUser()->login(array('login' => $ppo->iconito_user['login'], 'assistance' => true)); $url_return = CopixUrl::get('kernel||doSelectHome'); // $url_return = CopixUrl::get ('assistance||users'); return new CopixActionReturn(COPIX_AR_REDIRECT, $url_return); } else { $ppo->cas_error = 'no-iconito-user'; return _arPpo($ppo, 'cas.tpl'); } } } if (!$as->isAuthenticated() && $ppo->user->isConnected()) { $ppo->user = _currentUser(); if ($ppo->user->isConnected()) { CopixAuth::getCurrentUser()->logout(array()); CopixEventNotifier::notify('logout', array('login' => CopixAuth::getCurrentUser()->getLogin())); CopixAuth::destroyCurrentUser(); CopixSession::destroyNamespace('default'); } } }
public function processLogout() { include_once COPIX_UTILS_PATH . '../../CAS-1.2.2/CAS.php'; $ppo = new CopixPPO(); $ppo->user = _currentUser(); if ($ppo->user->isConnected()) { CopixAuth::getCurrentUser()->logout(array()); CopixEventNotifier::notify('logout', array('login' => CopixAuth::getCurrentUser()->getLogin())); CopixAuth::destroyCurrentUser(); CopixSession::destroyNamespace('default'); } phpCAS::setDebug(); $conf_Cas_host = CopixConfig::get('default|conf_Cas_host'); $conf_Cas_port = CopixConfig::get('default|conf_Cas_port'); $conf_Cas_path = CopixConfig::get('default|conf_Cas_path'); phpCAS::client(CAS_VERSION_2_0, $conf_Cas_host, (int) $conf_Cas_port, $conf_Cas_path, false); phpCAS::setNoCasServerValidation(); phpCAS::forceAuthentication(); phpCAS::logout(); return _arRedirect(CopixRequest::get('auth_url_return', _url('||'))); }
/** * apply updates on the edited comment. * save to datebase if ok and save file. */ function doValid() { $plugAuth =& $GLOBALS['COPIX']['COORD']->getPlugin('auth|auth'); $user =& $plugAuth->getUser(); if ($user->isConnected()) { if (!($toValid = $this->_getSessionComment())) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('comment.error.unableToGetSession'))); } $services =& CopixClassesFactory::create('comment|commentservices'); if (!$services->canComment($toValid->id_cmt, $toValid->type_cmt)) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('comment.error.unableToComment'))); } $dao =& CopixDAOFactory::create('Comment'); $this->_validFromForm($toValid); //inserting or updating. if ($toValid->INTERNAL_COPIX_IsNew !== true) { if ($toValid->check() !== true) { $this->_setSessionComment($toValid); return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('comment||edit', array('e' => '1'))); } $dao->update($toValid); } else { $toValid->date_cmt = date('Ymd'); $toValid->author_cmt = $user->login; $toValid->position_cmt = $dao->getNextPosition($toValid->type_cmt, $toValid->id_cmt); if ($toValid->check() !== true) { $this->_setSessionComment($toValid); return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('comment||edit', array('e' => '1'))); } $dao->insert($toValid); } // Gestion du notifier pour les projets koyo // CopixEventNotifier::notify(new CopixEvent('AddComment', array('id' => $toValid->id_cmt, 'type' => $toValid->type_cmt))); $this->_setSessionComment(null); if ($toValid->backToComment) { return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('comment||', array('back' => urlencode($toValid->back), 'id' => $toValid->id_cmt, 'type' => $toValid->type_cmt))); } else { return new CopixActionReturn(COPIX_AR_REDIRECT, $toValid->back); } } else { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('comment|comment.messages.needLogin'))); } }
/** * Désinstallation d'un module (sans prendre en compte les dépendances) * * @param string $pModuleName Nom du module * @return true si success et message de l'exception sinon */ public static function deleteModule($pModuleName) { try { // evenement avant la désinstallation du module. si un listener retourne false, on annule la désinstallation $response = CopixEventNotifier::notify(new CopixEvent('beforeUninstallModule', array('moduleName' => $pModuleName))); foreach ($response->getResponse() as $listener) { if (isset($listener['uninstall']) && $listener['uninstall'] === false) { $message = isset($listener['message']) ? $listener['message'] : _i18n('copix:copixmodule.error.listenerNoMessage'); throw new CopixException(_i18n('copix:copixmodule.error.listenerCancelUninstall', array($pModuleName, $message))); } } $moduleInstaller = self::_getModuleInstaller($pModuleName); if ($moduleInstaller !== null) { $moduleInstaller->processPreDelete(); } $scriptFile = self::_getDeleteFile($pModuleName); if ($scriptFile) { $ct = CopixDB::getConnection(); $ct->doSQLScript($scriptFile); } self::$_arModuleList = false; self::_deleteModuleInDatabase($pModuleName); self::_loadModuleList(true); //on demande de rafrachir le cache PHP une fois termin. self::_clearRegistryCache(); CopixListenerFactory::clearCompiledFile(); if ($moduleInstaller !== null) { $moduleInstaller->processPostDelete(); } // evenement après la désinstallation du module $response = CopixEventNotifier::notify(new CopixEvent('afterUninstallModule', array('moduleName' => $pModuleName))); } catch (Exception $e) { return $e->getMessage(); } return true; }
public function processLogout() { require_once COPIX_UTILS_PATH . '../../simplesamlphp/lib/_autoload.php'; $asId = 'iconito-sql'; if (CopixConfig::exists('default|conf_Saml_authSource') && CopixConfig::get('default|conf_Saml_authSource')) { $asId = CopixConfig::get('default|conf_Saml_authSource'); } $as = new SimpleSAML_Auth_Simple($asId); $ppo = new CopixPPO(); $ppo->user = _currentUser(); if ($ppo->user->isConnected()) { CopixAuth::getCurrentUser()->logout(array()); CopixEventNotifier::notify('logout', array('login' => CopixAuth::getCurrentUser()->getLogin())); CopixAuth::destroyCurrentUser(); CopixSession::destroyNamespace('default'); } $as->logout(_url() . 'simplesaml/saml2/idp/initSLO.php?RelayState=' . urlencode(_url('auth|saml|logout_cas'))); // $as->logout(_url ().'simplesaml/saml2/idp/initSLO.php?RelayState='.urlencode(_url() . 'logout.php')); }
/** * Singleton * @return CopixEventNotifier */ public static function instance() { if (self::$_instance === false) { self::$_instance = new CopixEventNotifier(); } return self::$_instance; }
/** * Alias de CopixEventNotifier::notify () * @param mixed $pEvent CopixEvent ou string qui représente l'événement levé * @param array $pParams Tableau de paramètres relatifs à l'événement (si $pEvent est une chaine) * @see CopixEventNotifier::notify () */ function _notify($pEvent, $pParams = array()) { return CopixEventNotifier::notify($pEvent, $pParams); }