aliroCore Class Reference

Inheritance diagram for aliroCore:

mamboCore

List of all members.

Public Member Functions

 setRedirectHere ()
 fixLanguage ()
 decodeParams ($rawtext)
 getCfg ($property)
 __get ($property)
 globalizeConfig ()
 getSubLen ()

Static Public Member Functions

static getInstance ()
static getConfigData ($configname)
static get ($property)
static is_set ($property)
static set ($property, $value)

Protected Member Functions

 __construct ()

Private Member Functions

 findLiveSite ($subdirectory)
 propertyError ($property)

Private Attributes

 $config = array()
 $subdirlength = 0

Static Private Attributes

static $instance = __CLASS__


Detailed Description

Definition at line 48 of file aliroCore.php.


Constructor & Destructor Documentation

aliroCore::__construct (  )  [protected]

Definition at line 54 of file aliroCore.php.

References findLiveSite(), getConfigData(), criticalInfo::getInstance(), aliroDatabase::getInstance(), and aliro::getInstance().

00054                                       {
00055         if (aliro::getInstance()->installed) $database = aliroDatabase::getInstance();
00056         $this->config = aliroCore::getConfigData('configuration.php');
00057         error_reporting(E_ALL|E_STRICT);
00058         $subdirectory = dirname($_SERVER['PHP_SELF']);
00059         if (criticalInfo::getInstance()->isAdmin) $subdirectory = dirname($subdirectory);
00060         if ('/' == $subdirectory) $subdirectory = '';
00061         $this->subdirlength = strlen($subdirectory);
00062         $this->findLiveSite($subdirectory);
00063     }


Member Function Documentation

aliroCore::findLiveSite ( subdirectory  )  [private]

Definition at line 65 of file aliroCore.php.

References T_().

Referenced by __construct().

00065                                                   {
00066         $_SERVER['HTTP_HOST'] = str_replace('joomla.', '', $_SERVER['HTTP_HOST']);
00067         $_SERVER['SERVER_NAME'] = str_replace('joomla.', '', $_SERVER['SERVER_NAME']);
00068         $scheme = isset($_SERVER['HTTP_SCHEME']) ? $_SERVER['HTTP_SCHEME'] : ((isset($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS'] != 'off')) ? 'https' : 'http');
00069         if (isset($_SERVER['HTTP_HOST'])) {
00070             $withport = explode(':', $_SERVER['HTTP_HOST']);
00071             $servername = $withport[0];
00072             if (isset($withport[1])) $port = ':'.$withport[1];
00073         }
00074         elseif (isset($_SERVER['SERVER_NAME'])) $servername = $_SERVER['SERVER_NAME'];
00075         else trigger_error(T_('Impossible to determine the name of this server'), E_USER_ERROR);
00076         if (!isset($port) AND !empty($_SERVER['SERVER_PORT'])) $port = ':'.$_SERVER['SERVER_PORT'];
00077         if (isset($port)) {
00078             if (($scheme == 'http' AND $port == ':80') OR ($scheme == 'https' AND $port == ':443')) $port = '';
00079         }
00080         else $port = '';
00081         $afterscheme = '://'.$servername.$port.$subdirectory;
00082         $this->config['live_site'] = $this->config['secure_site'] = $_SESSION['aliro_live_site'] = $scheme.$afterscheme;
00083         $this->config['unsecure_site'] = $_SESSION['aliro_unsecure_site'] = 'http'.$afterscheme;
00084     }

aliroCore::setRedirectHere (  ) 

Definition at line 86 of file aliroCore.php.

00086                                        {
00087         $_SESSION['aliro_redirect_here'] = substr($_SERVER['REQUEST_URI'], $this->subdirlength);
00088     }

static aliroCore::getInstance (  )  [static]

aliroCore::fixLanguage (  ) 

Definition at line 94 of file aliroCore.php.

References criticalInfo::getInstance(), and aliroLanguage::getInstance().

00094                                    {
00095         $language = aliroLanguage::getInstance();
00096         if (empty($this->config['lang'])) $this->set('mosConfig_lang', 'english');
00097         $language_file = _ALIRO_ABSOLUTE_PATH."/language/$this->mosConfig_lang.php";
00098         if (file_exists($language_file)) require_once ($language_file);
00099         else require_once (criticalInfo::getInstance()->absolute_path.'/language/english.php');
00100     }

static aliroCore::getConfigData ( configname  )  [static]

Definition at line 102 of file aliroCore.php.

References criticalInfo::getInstance().

Referenced by aliroDatabase::__construct(), aliroCoreDatabase::__construct(), and __construct().

00102                                                        {
00103         $info = criticalInfo::getInstance();
00104         $filename = md5($info->absolute_path.'/'.$configname).'.php';
00105         if (!file_exists($info->class_base.'/configs/'.$filename)) {
00106             @session_write_close();
00107             $installer = new aliroInstall();
00108             $installer->tellUserNotInstalled();
00109             exit;
00110         }
00111         require ($info->class_base.'/configs/'.$filename);
00112         $results = unserialize ($packed);
00113         foreach ($results as &$item) $item = base64_decode($item);
00114         $results['configfilename'] = $filename; // basename($filepath);
00115         return $results;
00116     }

aliroCore::decodeParams ( rawtext  ) 

Definition at line 118 of file aliroCore.php.

00118                                             {
00119         $info = unserialize ($rawtext);
00120         foreach ($info as &$item) $item = base64_decode($item);
00121         return $info;
00122     }

aliroCore::getCfg ( property  ) 

Definition at line 124 of file aliroCore.php.

References aliroComponentHandler::getInstance(), criticalInfo::getInstance(), aliro::getInstance(), and propertyError().

Referenced by get(), and globalizeConfig().

00124                                        {
00125         if (aliro::getInstance()->installed) $info = criticalInfo::getInstance();
00126         else return null;
00127         if ('admin_site' == $property) return $this->config['live_site'].$info->admin_dir;
00128         // For backwards compatibility
00129         if ('allowUserRegistration' == $property) {
00130             $registration = aliroComponentHandler::getInstance()->getComponentByFormalName('com_registration');
00131             return $registration ? 1 : 0;
00132         }
00133         if ('cachepath' == $property) return $this->getCfg('absolute_path').'/cache';
00134         if ('locale' == $property) return isset($this->config['locale']) ? $this->config['locale'] : 'en';
00135         if (in_array($property, array ('absolute_path', 'admin_absolute_path', 'admin_dir'))) {
00136             if (isset($info->$property)) return $info->$property;
00137         }
00138         elseif (isset($this->config[$property])) return $this->config[$property];
00139         $this->propertyError($property);
00140         return null;
00141     }

aliroCore::__get ( property  ) 

Definition at line 143 of file aliroCore.php.

References get().

00143                                       {
00144         aliroCore::get($property);
00145     }

aliroCore::propertyError ( property  )  [private]

Definition at line 147 of file aliroCore.php.

References T_().

Referenced by getCfg().

00147                                                {
00148         $message = sprintf(T_('Invalid property %s requested from aliroCore'), $property);
00149         trigger_error($message, E_USER_WARNING);
00150     }

static aliroCore::get ( property  )  [static]

Definition at line 152 of file aliroCore.php.

References $config, getCfg(), aliroRequest::getInstance(), getInstance(), and aliro::getInstance().

Referenced by mosSpecialAdminParameters::__construct(), __get(), mosUser::check(), mosCache::cleanCache(), aliroFolder::getIcons(), mosMainFrame::ImageCheck(), mosAdminMenus::ImageCheckAdmin(), aliroFolder::imageURL(), aliroMenuCreator::makeMenuLink(), modules_html::module(), aliroFileManager::mosChmod(), and aliroFileManager::setPermissions().

00152                                            {
00153         if (aliro::getInstance()->installed) $config = aliroCore::getInstance();
00154         else return null;
00155         if ('mosConfig_' == substr($property, 0, 10)) return $config->getCfg(substr($property,10));
00156         elseif ('Itemid' == $property) return aliroRequest::getInstance()->getItemid();
00157         $config->propertyError($property);
00158         return null;
00159     }

static aliroCore::is_set ( property  )  [static]

Definition at line 161 of file aliroCore.php.

References $config, and getInstance().

00161                                               {
00162         $config = aliroCore::getInstance();
00163         return ('mosConfig_' == substr($property, 0, 10) AND isset($config->config[substr($property,10)]));
00164     }

static aliroCore::set ( property,
value 
) [static]

Definition at line 166 of file aliroCore.php.

References $config, and getInstance().

Referenced by aliroLanguage::checkLanguage().

00166                                                    {
00167         $config = aliroCore::getInstance();
00168         $config->config[$property] = $value;
00169         return $value;
00170     }

aliroCore::globalizeConfig (  ) 

Definition at line 172 of file aliroCore.php.

References getCfg().

00172                                        {
00173         foreach ($this->config as $key=>$value) $GLOBALS['mosConfig_'.$key] = $value;
00174         $GLOBALS['mosConfig_absolute_path'] = $this->getCfg('absolute_path');
00175     }

aliroCore::getSubLen (  ) 

Definition at line 177 of file aliroCore.php.

00177                                  {
00178         return $this->subdirlength;
00179     }


Member Data Documentation

aliroCore::$instance = __CLASS__ [static, private]

Definition at line 50 of file aliroCore.php.

aliroCore::$config = array() [private]

Definition at line 51 of file aliroCore.php.

Referenced by get(), is_set(), and set().

aliroCore::$subdirlength = 0 [private]

Definition at line 52 of file aliroCore.php.


The documentation for this class was generated from the following file:

Generated on Wed May 14 13:01:58 2008 for ALIRO by  doxygen 1.5.5