phpPoA2
[ class tree: phpPoA2 ] [ index: phpPoA2 ] [ all elements ]

Source for file PoAConfigurator.php

Documentation is available at PoAConfigurator.php

  1. <?php
  2. /**
  3.  * @copyright Copyright 2005-2010 RedIRIS, http://www.rediris.es/
  4.  *
  5.  *  This file is part of phpPoA2.
  6.  *
  7.  *  phpPoA2 is free software: you can redistribute it and/or modify
  8.  *  it under the terms of the GNU General Public License as published by
  9.  *  the Free Software Foundation, either version 3 of the License, or
  10.  *  (at your option) any later version.
  11.  *
  12.  *  phpPoA2 is distributed in the hope that it will be useful,
  13.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  *  GNU General Public License for more details.
  16.  *
  17.  *  You should have received a copy of the GNU General Public License
  18.  *  along with phpPoA2. If not, see <http://www.gnu.org/licenses/>.
  19.  *
  20.  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
  21.  * @version 2.0
  22.  * @author Jaime Perez <jaime.perez@rediris.es>
  23.  * @filesource
  24.  */
  25.  
  26. /**
  27.  * Main configurator for the phpPoA.
  28.  * @package phpPoA2
  29.  */
  30.  
  31.     protected $mandatory_options = array('LogFile',
  32.                                          'LogLevel');
  33.  
  34.     public function __construct($site$file null{
  35.         global $poa_messages;
  36.  
  37.         // defaults
  38.         $this->cfg["ROOT_DIR"dirname(__FILE__);
  39.         $this->cfg['Language'"en_EN";
  40.         include_once $this->cfg["ROOT_DIR"]."/messages/messages-".$this->cfg['Language'].".php";
  41.         $file_path "PoA.conf";
  42.  
  43.         // configure
  44.         $v get_cfg_var('poa_conf_file');
  45.         if ($file{
  46.             $file_path $file;
  47.         else if (!empty($v)) {
  48.             $file_path $v;
  49.         }
  50.         parent::__construct($file_path$site);
  51.  
  52.         // load internationalized messages
  53.         foreach (glob($this->cfg["ROOT_DIR"]."/messages/messages-*.php"as $filename{
  54.             //include_once $this->cfg["ROOT_DIR"]."/messages/messages-en_EN.php";
  55.             if (PoAUtils::lang_code($filename=== $this->cfg['Language']{
  56.                 include_once $filename;
  57.             }
  58.         }
  59.  
  60.         // check configuration
  61.         $this->validate();
  62.     }
  63.  
  64.     public function getLogFile({
  65.         return $this->cfg['LogFile'];
  66.     }
  67.  
  68.     public function isDebug({
  69.         return @($this->cfg['Debug'=== true);
  70.     }
  71.  
  72.     public function getLanguage({
  73.         return @$this->cfg['Language'];
  74.     }
  75.  
  76.     public function getLogLevel({
  77.         return $this->cfg['LogLevel'];
  78.     }
  79.  
  80.     public function getNoAuthErrorURL({
  81.         return @$this->cfg['NoAuthErrorURL'];
  82.     }
  83.  
  84.     public function getSystemErrorURL({
  85.         return @$this->cfg['SystemErrorURL'];
  86.     }
  87.  
  88.     public function getInviteErrorURL({
  89.         return @$this->cfg['InviteErrorURL'];
  90.     }
  91.  
  92.     public function getAuthnEngine({
  93.         return @$this->cfg['AuthnEngine'];
  94.     }
  95.  
  96.     public function getAuthzEngines({
  97.         if (!@is_array($this->cfg['AuthzEngines'])) {
  98.             return (isset($this->cfg['AuthzEngines'])) array($this->cfg['AuthzEngines']array();
  99.         }
  100.  
  101.         return @$this->cfg['AuthzEngines'];
  102.     }
  103.  
  104.     public function getAuthnEngineConfFile({
  105.         return @$this->cfg['AuthnEngineConfFile'];
  106.     }
  107.  
  108.     public function getAuthzEngineConfFile($engine{
  109.         return @$this->cfg['AuthzEnginesConfFiles'][$engine];
  110.     }
  111.  
  112.     public function getAuthzLevels({
  113.         if (!@is_array($this->cfg['AuthzLevels'])) {
  114.             return (isset($this->cfg['AuthzLevels'])) array($this->cfg['AuthzLevels']array();
  115.         }
  116.  
  117.         return @$this->cfg['AuthzLevels'];
  118.     }
  119.  
  120. }
  121.  
  122. ?>

Documentation generated on Fri, 11 Feb 2011 10:58:04 +0100 by phpDocumentor 1.4.3