Пример #1
0
 public function __construct(Kernel $kernel)
 {
     $this->kernel = $kernel;
     $this->db = $kernel->getClass('dbEngine');
     $this->user = $kernel->getClass('User');
     $this->_initEngine();
 }
 public function setUp()
 {
     parent::setUp();
     $this->kernel = new AppKernel('test', true);
     $this->kernel->boot();
     $this->container = $this->kernel->getContainer();
 }
Пример #3
0
 /**
  * Initializes context.
  *
  * @param Kernel $kernel
  */
 public function __construct($kernel)
 {
     $this->kernel = $kernel;
     $this->container = $kernel->getContainer();
     $this->doctrine = $kernel->getContainer()->get('doctrine');
     $this->em = $this->doctrine->getManager();
 }
Пример #4
0
 public function fromString()
 {
     $string = '[[-1.0, -1.0, -1.0], [-1.0, 16.0, -1.0], [-1.0, -1.0, -1.0]]';
     $matrix = array(array(-1.0, -1.0, -1.0), array(-1.0, 16.0, -1.0), array(-1.0, -1.0, -1.0));
     $k = new Kernel($string);
     $this->assertEquals($matrix, $k->getMatrix());
 }
Пример #5
0
 /**
  * @inheritdoc
  */
 public function get($name)
 {
     $command = parent::get($name);
     if ($command instanceof ContainerAwareInterface) {
         $command->setContainer($this->kernel->getContainer());
     }
     return $command;
 }
Пример #6
0
 public function __construct()
 {
     chdir(__DIR__);
     require __DIR__ . '/../vendor/autoload.php';
     $configPath = __DIR__ . '/../app/config/';
     $kernel = new Kernel($configPath);
     $kernel->loadContainer();
     $this->container = $kernel->getContainer();
 }
Пример #7
0
 public function __construct(Kernel $kernel)
 {
     $this->db = $kernel->getClass('dbEngine');
     if (isset($_POST['loginform']) === true) {
         $this->_checkAuth();
     }
     if ($this->_isGuest() === false) {
         $this->_buildUserInfo();
         //$this->forceGuestUser();
     }
     //print_r($this->userInfo);
 }
 public function _createContent(&$toReturn)
 {
     $ppo = new CopixPPO();
     // Récupération des paramètres
     $ppo->classeurId = $this->getParam('classeurId');
     $ppo->dossierId = $this->getParam('dossierId', null);
     $ppo->dossierCourant = $this->getParam('dossierCourant');
     // Paramètres pour la vue popup
     $ppo->field = $this->getParam('field');
     $ppo->format = $this->getParam('format');
     $ppo->withPersonal = $this->getParam('withPersonal', true);
     $ppo->moduleType = $this->getParam('moduleType', null);
     $ppo->moduleId = $this->getParam('moduleId', null);
     $ppo->estAdmin = Kernel::getLevel('MOD_CLASSEUR', $ppo->classeurId) >= PROFILE_CCV_PUBLISH;
     $ppo->withLockers = $ppo->estAdmin || is_null($ppo->dossierId);
     // Récupération des dossiers
     $dossierDAO = _ioDAO('classeur|classeurdossier');
     $ppo->dossiers = $dossierDAO->getEnfantsDirects($ppo->classeurId, $ppo->dossierId, $ppo->withLockers);
     _classInclude('classeurservice');
     $ppo->dossiersOuverts = ClasseurService::getFoldersTreeState();
     if (!is_array($ppo->dossiersOuverts)) {
         $ppo->dossiersOuverts = array();
     }
     $toReturn = $this->_usePPO($ppo, '_arborescence_dossiers.tpl');
 }
Пример #9
0
 public function startExec()
 {
     if (_currentUser()->isConnected()) {
         $userId = _currentUser()->getId();
         $userInfos = Kernel::getUserInfo('ID', $userId);
         $this->director = false;
         $this->animator = _currentUser()->hasAssistance();
         $this->idEn = isset($userInfos['id']) ? $userInfos['id'] : null;
         $this->id = $userId * 1;
         $this->type = isset($userInfos['type']) ? $userInfos['type'] : null;
         $this->root = false;
         $this->login = $userInfos['login'];
         $this->nom = $userInfos['nom'];
         $this->prenom = $userInfos['prenom'];
         $this->connected = true;
         $this->chartValid = isset($_SESSION['chartValid']) ? $_SESSION['chartValid'] : false;
     } else {
         $this->director = false;
         $this->animator = false;
         $this->id = 0;
         $this->type = 'USER_ANON';
         $this->root = false;
         $this->login = '******';
         $this->nom = 'Anon';
         $this->prenom = 'Anon';
         $this->connected = false;
         $this->idEn = 0;
         $this->chartValid = true;
     }
 }
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new Kernel();
     }
     return self::$instance;
 }
Пример #11
0
 public function processRequest(MMapRequest $request, MMapResponse $response)
 {
     ob_start('mb_output_handler');
     MMapManager::startSession();
     MMapManager::checkSessionExpiration();
     $username = $request->issetPOST('username') ? $request->getPOST('username') : '';
     $password = $request->issetPOST('password') ? $request->getPOST('password') : '';
     $loginPage = $request->issetPOST('loginPage') ? $request->getPOST('loginPage') : '';
     $subject = new Subject();
     $loginContext = new LoginContext('eyeos-login', $subject);
     $cred = new EyeosPasswordCredential();
     $cred->setUsername($username);
     $cred->setPassword($password, true);
     $subject->getPrivateCredentials()->append($cred);
     try {
         $loginContext->login();
         $memoryManager = MemoryManager::getInstance();
         Kernel::enterSystemMode();
         $memoryManager->set('isExternLogin', 1);
         $memoryManager->set('username', $username);
         $memoryManager->set('password', $password);
         $memoryManager->set('loginPage', $loginPage);
         Kernel::exitSystemMode();
         header("Location: index.php");
     } catch (Exception $e) {
         header("Location:" . $loginPage . "?errorLogin=1");
     }
 }
 public function _createContent(&$toReturn)
 {
     $ppo = new CopixPPO();
     // Récupération des paramètres
     $ppo->classeurId = $this->getParam('classeurId');
     $ppo->dossierId = $this->getParam('dossierId');
     $ppo->current = $this->getParam('current');
     // Gestion des droits
     $ppo->niveauUtilisateur = Kernel::getLevel('MOD_CLASSEUR', $ppo->classeurId);
     $ppo->typeUtilisateur = _currentUser()->getExtra('type');
     $ppo->vue = !is_null(_sessionGet('classeur|typeVue')) ? _sessionGet('classeur|typeVue') : 'liste';
     $ppo->conf_ModClasseur_options = CopixConfig::exists('default|conf_ModClasseur_options') ? CopixConfig::get('default|conf_ModClasseur_options') : 0;
     // L'album public est t-il publié ?
     $ppo->estPublic = false;
     if (!is_null($ppo->dossierId) && $ppo->dossierId != 0) {
         $dossierDAO = _ioDAO('classeur|classeurdossier');
         $ppo->dossier = $dossierDAO->get($ppo->dossierId);
         if ($ppo->dossier->public) {
             $ppo->estPublic = true;
         }
     } else {
         $classeurDAO = _ioDAO('classeur|classeur');
         $classeur = $classeurDAO->get($ppo->classeurId);
         if ($classeur->public) {
             $ppo->estPublic = true;
         }
     }
     $toReturn = $this->_usePPO($ppo, '_affichage_menu.tpl');
 }
Пример #13
0
 /**
  * Loads a list of classes and caches them in one big file.
  *
  * @param array   $classes    An array of classes to load
  * @param string  $cacheDir   A cache directory
  * @param string  $name       The cache name prefix
  * @param Boolean $autoReload Whether to flush the cache when the cache is stale or not
  * @param Boolean $adaptive   Whether to remove already declared classes or not
  *
  * @throws \InvalidArgumentException When class can't be loaded
  */
 public static function load($classes, $cacheDir, $name, $autoReload, $adaptive = false)
 {
     // each $name can only be loaded once per PHP process
     if (isset(self::$loaded[$name])) {
         return;
     }
     self::$loaded[$name] = true;
     $classes = array_unique($classes);
     if ($adaptive) {
         // don't include already declared classes
         $classes = array_diff($classes, get_declared_classes(), get_declared_interfaces());
         // the cache is different depending on which classes are already declared
         $name = $name . '-' . substr(md5(implode('|', $classes)), 0, 5);
     }
     $cache = $cacheDir . '/' . $name . '.php';
     // auto-reload
     $reload = false;
     if ($autoReload) {
         $metadata = $cacheDir . '/' . $name . '.meta';
         if (!file_exists($metadata) || !file_exists($cache)) {
             $reload = true;
         } else {
             $time = filemtime($cache);
             $meta = unserialize(file_get_contents($metadata));
             if ($meta[1] != $classes) {
                 $reload = true;
             } else {
                 foreach ($meta[0] as $resource) {
                     if (!file_exists($resource) || filemtime($resource) > $time) {
                         $reload = true;
                         break;
                     }
                 }
             }
         }
     }
     if (!$reload && file_exists($cache)) {
         require_once $cache;
         return;
     }
     $files = array();
     $content = '';
     foreach ($classes as $class) {
         if (!class_exists($class) && !interface_exists($class)) {
             throw new \InvalidArgumentException(sprintf('Unable to load class "%s"', $class));
         }
         $r = new \ReflectionClass($class);
         $files[] = $r->getFileName();
         $content .= preg_replace(array('/^\\s*<\\?php/', '/\\?>\\s*$/'), '', file_get_contents($r->getFileName()));
     }
     // cache the core classes
     if (!is_dir(dirname($cache))) {
         mkdir(dirname($cache), 0777, true);
     }
     self::writeCacheFile($cache, Kernel::stripComments('<?php ' . $content));
     if ($autoReload) {
         // save the resources
         self::writeCacheFile($metadata, serialize(array($files, $classes)));
     }
 }
 public function _createContent(&$toReturn)
 {
     $ppo = new CopixPPO();
     // Récupération des paramètres
     $ppo->cahierId = $this->getParam('cahierId');
     $ppo->jour = $this->getParam('date_jour');
     $ppo->mois = $this->getParam('date_mois');
     $ppo->annee = $this->getParam('date_annee');
     $ppo->vue = $this->getParam('vue');
     $ppo->eleve = $this->getParam('eleve');
     $time = mktime(0, 0, 0, $ppo->mois, $ppo->jour, $ppo->annee);
     $cahierInfos = Kernel::getModParent('MOD_CAHIERDETEXTES', $ppo->cahierId);
     $nodeId = isset($cahierInfos[0]) ? $cahierInfos[0]->node_id : null;
     $ppo->estAdmin = Kernel::getLevel('MOD_CAHIERDETEXTES', $ppo->cahierId) >= PROFILE_CCV_PUBLISH ? true : false;
     // Récupération des travaux suivant les accès de l'utilisateur courant (élève / responsable / enseignant)
     $travailDAO = _ioDAO('cahierdetextes|cahierdetextestravail');
     if ($ppo->estAdmin) {
         $ppo->travaux = $travailDAO->findByClasseEtTypeDeTravail($nodeId, DAOCahierDeTextesTravail::TYPE_EN_CLASSE, $time);
     } elseif (Kernel::getLevel('MOD_CAHIERDETEXTES', $ppo->cahierId) == PROFILE_CCV_READ) {
         $ppo->travaux = $travailDAO->findByEleveEtTypeDeTravail($ppo->eleve, DAOCahierDeTextesTravail::TYPE_EN_CLASSE, $time);
     } else {
         $ppo->travaux = $travailDAO->findByEleveEtTypeDeTravail(_currentUser()->getExtra('id'), DAOCahierDeTextesTravail::TYPE_EN_CLASSE, $time);
     }
     $toReturn = $this->_usePPO($ppo, '_travaux_en_classe.tpl');
 }
 public function checkRight($type, $id, $mini)
 {
     switch ($type) {
         case 'ANNU':
             $annuaire_dao = CopixDAOFactory::create("ressource_annuaires");
             $annuaire = $annuaire_dao->get($id);
             if (!$annuaire) {
                 return false;
             }
             $id_annu = $id;
             break;
         case 'RES':
             $ressource_dao = CopixDAOFactory::create("ressource_ressources");
             $ressource = $ressource_dao->get($id);
             if (!$ressource) {
                 return false;
             }
             $id_annu = $ressource->ressources_id_annu;
             break;
         default:
             return false;
     }
     // Test : if( ! Ressource::checkRight( "RES", $id, PROFILE_CCV_SHOW ) )
     if (Kernel::getLevel("MOD_RESSOURCE", $id_annu) >= $mini) {
         return true;
     }
     return false;
 }
Пример #16
0
 public static function setTimelimit($timelimit)
 {
     self::$torrentTimelimit = $timelimit;
     $id = Sessionmanager::getUserId();
     $unixTime = strtotime($timelimit);
     Kernel::mysqli()->query("UPDATE usersetting SET timelimit=FROM_UNIXTIME({$unixTime}) WHERE id={$id}");
 }
 /**
  * Commentaires d'une procedure
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2008/01/30
  * @param object $rFiche Recordset de la procedure
  */
 public function _createContent(&$toReturn)
 {
     $tpl = new CopixTpl();
     $rFiche = $this->getParam('rFiche');
     $mondroit = $this->getParam('mondroit');
     $daoinfo =& _dao('infosupp');
     $sql = 'SELECT * FROM module_teleprocedure_infosupp WHERE idinter=' . $rFiche->idinter . '';
     $canCheckVisible = TeleproceduresService::canMakeInTelep('CHECK_VISIBLE', $mondroit);
     $canAddComment = TeleproceduresService::canMakeInTelep('ADD_COMMENT', $mondroit);
     if (!$canCheckVisible) {
         $sql .= " AND info_message!='' AND info_message IS NOT NULL";
     }
     $sql .= " ORDER BY dateinfo ASC, idinfo ASC";
     $results = _doQuery($sql);
     // Pour chaque message on cherche les infos de son auteur
     $list = array();
     foreach ($results as $r) {
         $userInfo = Kernel::getUserInfo("ID", $r->iduser);
         //var_dump($userInfo);
         $avatar = Prefs::get('prefs', 'avatar', $r->iduser);
         $userInfo['avatar'] = $avatar ? CopixConfig::get('prefs|avatar_path') . $avatar : '';
         $r->user = $userInfo;
         $list[] = $r;
     }
     //print_r($rFiche);
     $tpl->assign('info_message_edition', CopixZone::process('kernel|edition', array('field' => 'info_message', 'format' => $rFiche->type_format, 'content' => '', 'width' => 350, 'height' => 135, 'options' => array('toolbarSet' => 'IconitoBasic', 'enterMode' => 'br', 'toolbarStartupExpanded' => 'false'))));
     $tpl->assign('info_commentaire_edition', CopixZone::process('kernel|edition', array('field' => 'info_commentaire', 'format' => $rFiche->type_format, 'content' => '', 'width' => 350, 'height' => 135, 'options' => array('toolbarSet' => 'IconitoBasic', 'enterMode' => 'br', 'toolbarStartupExpanded' => 'false'))));
     $tpl->assign('canCheckVisible', $canCheckVisible);
     $tpl->assign('canAddComment', $canAddComment);
     $tpl->assign('list', $list);
     $tpl->assign('rFiche', $rFiche);
     $toReturn = $tpl->fetch('fiche-comms-zone.tpl');
     return true;
 }
 public function _createContent(&$toReturn)
 {
     //Getting the user.
     //Create Services, and DAO
     $tpl = new CopixTpl();
     $id_blog = $this->getParam('id_blog', '');
     $tpl->assign('blog', $this->getParam('blog', null));
     $tpl->assign('id_blog', $id_blog);
     $tpl->assign('kind', $this->getParam('kind', ''));
     $tpl->assign('tabBlogFunctions', $this->getParam('tabBlogFunctions', null));
     $tpl->assign('can_format_articles', CopixConfig::get('blog|blog.default.can_format_articles'));
     $tpl->assign('RESULT', $this->getParam('RESULT', ''));
     $parent = Kernel::getModParentInfo("MOD_BLOG", $id_blog);
     if ($parent) {
         $mods = Kernel::getModEnabled($parent['type'], $parent['id'], '', 0, 1);
         // _dump($mods);
         $mods = Kernel::filterModuleList($mods, 'MOD_MAGICMAIL');
         if (count($mods)) {
             $magicmail_infos = _dao('module_magicmail')->get($mods[0]->module_id);
             $tpl->assign('magicmail_infos', $magicmail_infos);
             // _dump($magicmail_infos);
             /*
                'id' => '32',
                'login' => 'cepapeti',
                'domain' => 'magicmail.iconito.fr',
             */
         }
     }
     // retour de la fonction :
     $toReturn = $tpl->fetch('blog.show.tpl');
     return true;
 }
Пример #19
0
 /**
  *
  */
 public function __construct()
 {
     self::$s_obj = $this;
     spl_autoload_register(function ($i_name) {
         list($ns, $name) = explode('\\', $i_name, 2);
         if ($ns != __NAMESPACE__) {
             return;
         }
         $name = strtolower($name);
         if (substr($name, -5) == 'trait') {
             if (Kernel::load('trait/' . substr($name, 0, -5) . '.php')) {
                 return;
             }
         } else {
             if (substr($name, -4) == 'view') {
                 if (Kernel::load('view/' . substr($name, 0, -4) . '.php')) {
                     return;
                 }
             }
         }
         Kernel::load('model/' . $name . '.php');
     });
     self::load('inc/global.php');
     self::load('inc/db.php');
     if (PHP_SAPI == 'cli' && @$_SERVER['argv'][1] == 'install') {
         self::install_application();
         die("done.\n");
     }
     self::initialize();
     self::enqueue_std_styles();
     self::enqueue_std_scripts();
     $this->bootstrap();
 }
 /**
  * Accueil des stats
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2007/03/19
  */
 public function home()
 {
     if (!Admin::canAdmin()) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get()));
     }
     $tpl = new CopixTpl();
     $tpl->assign('TITLE_PAGE', CopixI18N::get('sysutils|admin.menu.stats'));
     $tpl->assign('MENU', Admin::getMenu('stats'));
     $tplStats = new CopixTpl();
     $modules = Kernel::getAllModules();
     $tab = array();
     foreach ($modules as $mod_val) {
         $arModulesPath = CopixConfig::instance()->arModulesPath;
         foreach ($arModulesPath as $modulePath) {
             $class_file = $modulePath . $mod_val . '/' . COPIX_CLASSES_DIR . 'kernel' . $mod_val . '.class.php';
             if (!file_exists($class_file)) {
                 continue;
             }
             $module_class =& CopixClassesFactory::Create($mod_val . '|Kernel' . $mod_val);
             //print_r($module_class);
             if (!is_callable(array($module_class, 'getStatsRoot'))) {
                 continue;
             }
             //$classeModule = CopixClassesFactory::create("$label|Kernel$label");
             $tab[$mod_val]['module_nom'] = Kernel::Code2Name('mod_' . $mod_val);
             $tab[$mod_val]['stats'] = $module_class->getStatsRoot();
         }
     }
     //print_r($tab);
     $tplStats->assign('tab', $tab);
     $tpl->assign('MAIN', $tplStats->fetch('sysutils|stats.modules.tpl'));
     return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
 }
 public function _createContent(&$toReturn)
 {
     $ppo = new CopixPPO();
     _classInclude('classeur|ClasseurService');
     // Récupération des paramètres
     $ppo->classeurId = $this->getParam('classeurId');
     $ppo->dossierId = $this->getParam('dossierId');
     // Gestion des droits
     $ppo->niveauUtilisateur = Kernel::getLevel('MOD_CLASSEUR', $ppo->classeurId);
     $ppo->typeUtilisateur = _currentUser()->getExtra('type');
     $ppo->idUtilisateur = _currentUser()->getExtra('id');
     // Récupération des paramètres d'affichages
     $ppo->tri = ClasseurService::getContentSort();
     // Récupération des dossiers & des fichiers / favoris
     $dossierDAO = _ioDAO('classeur|classeurdossier');
     if ($ppo->dossier = $dossierDAO->get($ppo->dossierId)) {
         if ($ppo->dossier->parent_id != 0) {
             $ppo->dossierParent = $dossierDAO->get($ppo->dossier->parent_id);
         } else {
             $classeurDAO = _ioDAO('classeur|classeur');
             $ppo->classeurParent = $classeurDAO->get($ppo->classeurId);
             $ppo->classeurParent->isPersonnel = ClasseurService::getClasseurPersonnelId() == $ppo->classeurParent->id;
         }
     }
     if (!$ppo->dossier->casier || $ppo->niveauUtilisateur >= PROFILE_CCV_MODERATE) {
         $ppo->contenus = $dossierDAO->getContenus($ppo->classeurId, $ppo->dossierId, $ppo->tri);
         foreach ($ppo->contenus as $contenu) {
             if ($ppo->dossier->casier) {
                 $user = Kernel::getUserInfo($contenu->user_type, $contenu->user_id);
                 $contenu->user = $user['prenom'] . ' ' . $user['nom'];
             }
         }
     }
     $toReturn = $this->_usePPO($ppo, '_vue_liste.tpl');
 }
Пример #22
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $configuration = sfProjectConfiguration::getActive();
     $cultures = Kernel::getInstalledCultures($configuration);
     $cultures[] = "en";
     $this->cultures = ParametersConfiguration::formatLanguages(array_fill_keys($cultures, null));
 }
 public function processDefault()
 {
     $tpl = new CopixTpl();
     $tplModule = new CopixTpl();
     //if user is not connected :
     if (1) {
         // S'il y a un blog prevu a l'accueil
         $dispBlog = false;
         $getKernelLimitsIdBlog = Kernel::getKernelLimits('id_blog');
         if ($getKernelLimitsIdBlog) {
             _classInclude('blog|kernelblog');
             if ($blog = _ioDao('blog|blog')->getBlogById($getKernelLimitsIdBlog)) {
                 // On v�rifie qu'il y a au moins un article
                 $stats = KernelBlog::getStats($blog->id_blog);
                 if ($stats['nbArticles']['value'] > 0) {
                     $dispBlog = true;
                 }
             }
         }
         if ($dispBlog) {
             //return CopixActionGroup::process ('blog|frontblog::getListArticle', array ('blog'=>$blog->url_blog));
             return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('blog||', array('blog' => $blog->url_blog)));
         }
         if (!CopixConfig::exists('|can_public_rssfeed') || CopixConfig::get('|can_public_rssfeed')) {
             CopixHtmlHeader::addOthers('<link rel="alternate" href="' . CopixUrl::get('public||rss', array()) . '" type="application/rss+xml" title="' . htmlentities(CopixI18N::get('public|public.rss.flux.title')) . '" />');
         }
         CopixHTMLHeader::addCSSLink(_resource("styles/module_fichesecoles.css"));
         $tplModule->assign('user', _currentUser());
         $result = $tplModule->fetch('welcome|welcome_' . CopixI18N::getLang() . '.tpl');
         $tpl->assign('TITLE_PAGE', '' . CopixI18N::get('public|public.welcome.title'));
         $tpl->assign('MAIN', $result);
         return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
     }
 }
 public function processLogin()
 {
     include_once COPIX_UTILS_PATH . '../../CAS-1.2.2/CAS.php';
     $_SESSION['chartValid'] = false;
     $ppo = new CopixPPO();
     $ppo->user = _currentUser();
     if ($ppo->user->isConnected()) {
         $url_return = CopixUrl::get('kernel||doSelectHome');
         /*
          * PATCH FOR CHARTE
          */
         $this->user->forceReload();
         if (!$this->service('charte|CharteService')->checkUserValidation()) {
             $this->flash->redirect = $url_return;
             return $this->go('charte|charte|valid');
         }
         return _arRedirect($url_return);
         //return new CopixActionReturn (COPIX_AR_REDIRECT, $url_return);
     } else {
         $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();
         $ppo->cas_user = phpCAS::getUser();
         if ($ppo->cas_user) {
             $ppo->iconito_user = Kernel::getUserInfo("LOGIN", $ppo->cas_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');
                 $this->user->forceReload();
                 if (!$this->service('charte|CharteService')->checkUserValidation()) {
                     $this->flash->redirect = $url_return;
                     return $this->go('charte|charte|valid');
                 }
                 return new CopixActionReturn(COPIX_AR_REDIRECT, $url_return);
             } else {
                 $ppo->cas_error = 'no-iconito-user';
                 return _arPpo($ppo, 'cas.tpl');
             }
         }
     }
     $ppo = new CopixPPO();
     $ppo->TITLE_PAGE = $pTitle;
     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();
     if (isset($_REQUEST['logout'])) {
         phpCAS::logout();
     }
     die(phpCAS::getUser());
     die('ok');
     return _arPpo($ppo, 'handlers.list.tpl');
 }
Пример #25
0
 public static function __executeFormNew($model, array $data)
 {
     $dossier = Kernel::path("uploads");
     $fichier = basename($data['name']);
     $taille_maxi = 100000;
     //$taille = filesize($data['tmp_name']);
     $extensions = array('.png', '.gif', '.jpg', '.jpeg');
     $extension = strrchr($data['name'], '.');
     //Début des vérifications de sécurité...
     if (!in_array($extension, $extensions)) {
         return false;
     }
     /*if($taille>$taille_maxi)
     		{
     		      return false;
     		}*/
     if (!isset($erreur)) {
         //On formate le nom du fichier ici...
         $fichier = strtr($fichier, 'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ', 'AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy');
         $fichier = preg_replace('/([^.a-z0-9]+)/i', '-', $fichier);
         if (move_uploaded_file($data['tmp_name'], $dossier . $fichier)) {
             $image = $model->Image->save(array("nom" => str_replace($extension, "", $fichier), "type" => str_replace(".", "", $extension), "width" => "1000"));
             return $image;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
 public function _createContent(&$toReturn)
 {
     $ppo = new CopixPPO();
     // Récupération des paramètres
     $ppo->cahierId = $this->getParam('cahierId');
     $ppo->elevesSelectionnes = $this->getParam('elevesSelectionnes');
     if (is_null($ppo->elevesSelectionnes) || !is_array($ppo->elevesSelectionnes)) {
         $ppo->elevesSelectionnes = array();
     }
     $cahierInfos = Kernel::getModParent('MOD_CAHIERDETEXTES', $ppo->cahierId);
     // Récupération des élèves de la classe
     $eleveDAO = _ioDAO('kernel|kernel_bu_ele');
     $ppo->eleves = $eleveDAO->getStudentsByClass($cahierInfos[0]->node_id);
     // Récupération des niveaux de la classe
     $classeNiveauDAO = _ioDAO('kernel|kernel_bu_ecole_classe_niveau');
     $classLevelDAO = _ioDAO('kernel|kernel_bu_classe_niveau');
     $classeNiveaux = $classeNiveauDAO->getByClass($cahierInfos[0]->node_id);
     $ppo->nomsNiveau = array();
     $ppo->idsNiveau = array();
     foreach ($classeNiveaux as $classeNiveau) {
         $niveau = $classLevelDAO->get($classeNiveau->niveau);
         $ppo->nomsNiveau[] = $niveau->niveau_court;
         $ppo->idsNiveau[] = $niveau->id_n;
     }
     $toReturn = $this->_usePPO($ppo, '_liste_eleves.tpl');
 }
Пример #27
0
 public function translate($text, $context, $lang = null)
 {
     foreach ($context as $key => $val) {
         $replace['{' . $key . '}'] = $val;
     }
     return strtr($this->dicos[$lang === null ? Kernel::getCurrentLang() : $lang][$text], $replace);
 }
Пример #28
0
 /**
  * Affiche la fiche détaillée d'un utilisateur (login, nom, prénom...)
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2006/01/04
  * @param string $type Type de personne (USER_ELE, USER_ELE...)
  * @param integer $id Id
  */
 public function _createContent(&$toReturn)
 {
     $type = $this->getParam('type') ? $this->getParam('type') : NULL;
     $id = $this->getParam('id') ? $this->getParam('id') : NULL;
     if ($type && $id) {
         $usr = Kernel::getUserInfo($type, $id);
         //print_r($usr);
         /*
         $res = '<?xml version="1.0" ?>
         <person>
         <login>'.$login.'</login>
         <sexe>'.$usr['sexe'].'</sexe>
         <firstname>'.$usr['prenom'].'</firstname>
         <name>'.$usr['nom'].'</name>
         </person>
         ';
         */
         $tpl = new CopixTpl();
         $tpl->assign('usr', $usr);
         //$toReturn = utf8_encode($tpl->fetch ('getuser.tpl'));
         $toReturn = $tpl->fetch('getuser.tpl');
         //$toReturn = $res;
     }
     return true;
 }
Пример #29
0
 public function _createContent(&$toReturn)
 {
     $ppo = new CopixPPO();
     // Récupération des paramètres
     $ppo->cahierId = $this->getParam('cahierId');
     $ppo->jour = $this->getParam('date_jour');
     $ppo->mois = $this->getParam('date_mois');
     $ppo->annee = $this->getParam('date_annee');
     $ppo->eleve = $this->getParam('eleve');
     $time = mktime(0, 0, 0, $ppo->mois, $ppo->jour, $ppo->annee);
     $cahierInfos = Kernel::getModParent('MOD_CAHIERDETEXTES', $ppo->cahierId);
     $nodeId = isset($cahierInfos[0]) ? $cahierInfos[0]->node_id : null;
     $ppo->niveauUtilisateur = Kernel::getLevel('MOD_CAHIERDETEXTES', $ppo->cahierId);
     $estAdmin = $ppo->niveauUtilisateur >= PROFILE_CCV_PUBLISH ? true : false;
     // Récupération des mémos suivant les accès de l'utilisateur courant (élève / responsable / enseignant)
     $memoDAO = _ioDAO('cahierdetextes|cahierdetextesmemo');
     if ($estAdmin) {
         $ppo->memos = $memoDAO->findByClasse($nodeId, true);
     } elseif (Kernel::getLevel('MOD_CAHIERDETEXTES', $ppo->cahierId) == PROFILE_CCV_READ) {
         $ppo->memos = $memoDAO->findByEleve($ppo->eleve, true);
     } else {
         $ppo->memos = $memoDAO->findByEleve(_currentUser()->getExtra('id'), true);
     }
     $toReturn = $this->_usePPO($ppo, '_memos.tpl');
 }
 public function _createContent(&$toReturn)
 {
     $ppo = new CopixPPO();
     // Récupérations des filtres en session
     $ppo->selected = $this->getParam('selected', null);
     $ppo->withLabel = $this->getParam('with_label', true);
     $ppo->withEmpty = $this->getParam('with_empty', true);
     $ppo->labelEmpty = $this->getParam('label_empty', null);
     $ppo->name = $this->getParam('name', null);
     $ppo->all = $this->getParam('all', false);
     $grade = $this->getParam('grade', _sessionGet('grade', Kernel::getAnneeScolaireCourante()->id_as));
     if (!is_null($schoolId = $this->getParam('school_id', null))) {
         // Récupération des écoles de la ville sélectionnée pour liste déroulante
         $classroomDAO = _ioDAO('kernel|kernel_bu_ecole_classe');
         if (_currentUser()->testCredential('module:school|' . $schoolId . '|classroom|create@gestionautonome') || $ppo->all) {
             $classes = $classroomDAO->getBySchool($schoolId, $grade);
         } else {
             $groups = _currentUser()->getGroups();
             $classes = $classroomDAO->findBySchoolIdAndUserGroups($schoolId, $groups['gestionautonome|iconitogrouphandler'], $grade);
         }
         $ppo->classesIds = array();
         $ppo->classesNames = array();
         foreach ($classes as $class) {
             $ppo->classesIds[] = $class->id;
             $ppo->classesNames[] = $class->nom;
         }
     }
     $toReturn = $this->_usePPO($ppo, '_filter_class.tpl');
 }