Beispiel #1
0
 /**
  * @access public
  * @return bool retourne true/false selon qu'on est autorise ou non a faire $action sur $ressource
  * @param string $action action qu'on autorise sur $ressource
  * @param string $ressource ressource l'action est autorise sur $ressource	
  */
 public function can($action, $ressource)
 {
     $ok = true;
     if (!isset($this->tabAllowDeny[$ressource])) {
         $ok = false;
     }
     if (!isset($this->tabAllowDeny[$ressource][$action])) {
         $ok = false;
     }
     if (_root::getConfigVar('site.mode') == 'dev') {
         $tAskCan = _root::getConfigVar('tAskCan');
         $tAskCan[] = array($action, $ressource, $ok);
         _root::setConfigVar('tAskCan', $tAskCan);
     }
     if ($ok) {
         $sOk = 'oui';
     } else {
         $sOk = 'non';
     }
     _root::getLog()->info('ACL can "' . $action . '" on "' . $ressource . '" ? : ' . $sOk);
     return $ok;
 }
Beispiel #2
0
 /** 
  * supprime un enregistrement
  * @access public
  * @param object $oRow
  */
 public function delete($oRow)
 {
     $this->getSgbd()->delete($this->sTable, $oRow->getWhere());
     /*LOG*/
     _root::getLog()->info('sql delete:' . $this->getSgbd()->getRequete());
 }
Beispiel #3
0
    /** 
     * parse l'url rewrite pour en extraire les parametres (nav, parametres...) 
     * @access public
     * @param string $sUrl url
     */
    public function parseUrl($sUrl)
    {
        $sRootScript = $_SERVER['SCRIPT_NAME'];
        $sRootScript = str_replace(_root::getConfigVar('navigation.scriptname'), '', $sRootScript);
        $sUrl = str_replace($sRootScript, '', $sUrl);
        /*LOG*/
        _root::getLog()->info('plugin_routing parseUrl(' . $sUrl . ')');
        if (is_array($this->tRoute)) {
            foreach ($this->tRoute as $sPattern => $tUrl) {
                $sPattern = preg_replace('/:([^:])*:/', '([^/]*)', $sPattern);
                $sPattern = preg_replace('/\\//', '\\/', $sPattern);
                if (preg_match_all('/^' . $sPattern . '$/', $sUrl, $tTrouve)) {
                    _root::getRequest()->loadModuleAndAction($tUrl['nav']);
                    if (isset($tUrl['tParam']) and is_array($tTrouve[1])) {
                        $j = 0;
                        foreach ($tTrouve as $i => $found) {
                            if ($i == 0) {
                                continue;
                            }
                            $j = $i - 1;
                            _root::setParam($tUrl['tParam'][$j], $found[0]);
                        }
                    }
                    if (isset($tUrl['tParamHidden'])) {
                        foreach ($tUrl['tParamHidden'] as $key => $val) {
                            _root::setParam($key, $val);
                        }
                    }
                    return;
                }
            }
            /*LOG*/
            _root::getLog()->info('plugin_routing regle non trouve, 
				utilisation de 404 loadModuleAndAction(' . $this->tRoute['404']['nav'] . ')');
            if (_root::getConfigVar('urlrewriting.use4O4') == 1) {
                _root::getRequest()->loadModuleAndAction($this->tRoute['404']['nav']);
            }
        }
    }
Beispiel #4
0
 /** 
  * retourne le contenu d'un objet _tpl a l'emplacement $sPlace
  * @access public
  * @return string
  * @param string $sPlace
  */
 public function load($sPlace)
 {
     /*LOG*/
     _root::getLog()->info('-layout: chargement/affichage place [' . $sPlace . ']');
     if (!isset($this->_tContent[$sPlace])) {
         return null;
     }
     $sLoad = '';
     foreach ($this->_tContent[$sPlace] as $oTpl) {
         $sLoad .= $oTpl->show();
     }
     return $sLoad;
 }
Beispiel #5
0
 protected function choose($sPath)
 {
     if (!file_exists($sPath) and !file_exists($sPath . _root::getConfigVar('template.extension'))) {
         /*LOG*/
         _root::getLog()->error('vue ' . $sPath . ' et  inexistant');
         throw new Exception('vue ' . $sPath . ' et ' . $sPath . _root::getConfigVar('template.extension') . ' inexistant');
     }
     $this->_sPath = $sPath;
 }