aliroAbstractRequest Class Reference

Inheritance diagram for aliroAbstractRequest:

aliroAdminRequest aliroUserRequest

List of all members.

Public Member Functions

 __call ($method, $args)
 __get ($property)
 getComponentName ()
 showHead ()
 getFavIcon ()
 getItemid ()
 getOption ()
 redirect ($url='', $message='', $severity=_ALIRO_ERROR_INFORM)
 redirectSame ($message='', $severity=_ALIRO_ERROR_INFORM)
 stripFromURL ($url, $property)
 setErrorMessage ($message, $severity=_ALIRO_ERROR_FATAL)
 isErrorLevelSet ($severity)
 pullErrorMessages ()
 getUserState ($var_name)
 setUserState ($var_name, $var_value)
 getUserStateFromRequest ($var_name, $req_name, $var_default=null)
 makeFormStamp ()
 getFormCheckError ()
 getParam (&$arr, $name, $def=null, $mask=0)
 doPurify ($string)
 getStickyParam (&$arr, $name, $def=null, $mask=0)
 getStickyAliroParam (&$arr, $name, $def=null, $mask=0)
 unstick ($name)
 getTemplate ()
 setPageTitle ($title=null)
 getPageTitle ()
 addMetaTag ($name, $content, $prepend='', $append='')
 appendMetaTag ($name, $content)
 prependMetaTag ($name, $content)
 addCustomHeadTag ($html)
 addScript ($relativeFile)
 addCSS ($relativeFile, $media='screen')
 setMetadataInCache (&$cache_object)
 setMetadataFromCache ($cache_object)
 requestOverlib ()
 divOverlib ()
 getDebug ()
 getCustomTags ()
 getComponentObject ()
 invokeRetroCode ($path, $function=null, $menu=null)

Protected Member Functions

 __construct ()
 fixPostItems ()
 __clone ()
 isUserStateSet ($var_name)
 fix_metatag ($operation, $name, $content, $prepend='', $append='')
 invokeComponent ($menu=null)
 standardCall ($component, $class, $menu)
 retroCall ($menu)

Protected Attributes

 $option = ''
 $isHome = false
 $formcheck = 0
 $component_name = ''
 $bestmatch = null
 $aliroVersion = ''
 $urlerror = false
 $title = ''
 $metatags = array()
 $customtags = array()
 $templateName = ''
 $templateObject = null
 $do_gzip = false
 $error_message = array()
 $overlib = false
 $user = null
 $critical = null
 $configuration = null
 $pathway = null
 $version = null
 $mhandler = null
 $chandler = null
 $xhandler = null
 $purifier = null

Static Protected Attributes

static $instance = null

Private Member Functions

 setHandlers ()
 setUsefulObjects ()
 handleGlobals ()
 checkFormStamp ()
 getSticky ($var, &$arr, $name, $def, $mask)


Detailed Description

Definition at line 3 of file aliroAbstractRequest.php.


Constructor & Destructor Documentation

aliroAbstractRequest::__construct (  )  [protected]

Reimplemented in aliroAdminRequest, and aliroUserRequest.

Definition at line 38 of file aliroAbstractRequest.php.

References $_REQUEST, fixPostItems(), aliroUser::getInstance(), getParam(), aliroSessionFactory::getSession(), handleGlobals(), setErrorMessage(), setHandlers(), and setUsefulObjects().

00038                                       {
00039         // This is not necessarily right - but should avoid getting a notice
00040         if (function_exists('date_default_timezone_set')) date_default_timezone_set('UTC');
00041         @set_magic_quotes_runtime( 0 );
00042         //require_once(criticalInfo::getInstance()->absolute_path.'/includes/phpgettext/phpgettext.class.php');
00043         // Note that none of the things called here can use aliroAbstractRequest!
00044         // Otherwise, a loop will be created and Aliro will fail!
00045         // Ensure session started straight away
00046 
00047         aliroSessionFactory::getSession();
00048         // Check for problems with globals - do after session has started to be able to handle session variables
00049         $this->handleGlobals();
00050         $this->setUsefulObjects();
00051         if (extension_loaded('zlib') AND $this->configuration->getCfg('gzip')) $this->do_gzip = true;
00052         $this->setHandlers();
00053         if (count($_POST)) $this->fixPostItems();
00054         $this->option = $this->component_name = strtolower($this->getParam($_REQUEST, 'option'));
00055         if ($this->option != 'login' AND $this->option != 'logout') $this->user = aliroUser::getInstance();
00056         if ($message = $this->getParam($_REQUEST, 'mosmsg')) {
00057             $severity = $this->getParam($_REQUEST, 'severity', _ALIRO_ERROR_INFORM);
00058             $this->setErrorMessage ($message, intval($severity));
00059         }
00060     }


Member Function Documentation

aliroAbstractRequest::setHandlers (  )  [private]

Definition at line 62 of file aliroAbstractRequest.php.

References aliroExtensionHandler::getInstance(), aliroComponentHandler::getInstance(), and aliroMenuHandler::getInstance().

Referenced by __construct().

00062                                     {
00063         $this->mhandler = aliroMenuHandler::getInstance();
00064         $this->chandler = aliroComponentHandler::getInstance();
00065         $this->xhandler = aliroExtensionHandler::getInstance();
00066     }

aliroAbstractRequest::setUsefulObjects (  )  [private]

Definition at line 68 of file aliroAbstractRequest.php.

References aliroCore::getInstance(), version::getInstance(), and criticalInfo::getInstance().

Referenced by __construct().

00068                                          {
00069         $this->critical = criticalInfo::getInstance();
00070         // Initiate HTML Purifier autoloading
00071         if (function_exists('spl_autoload_register') AND function_exists('spl_autoload_unregister')) {
00072             // HTML Purifier needs unregister for our pre-registering functionality
00073             HTMLPurifier_Bootstrap::registerAutoload();
00074             // Be polite and ensure that userland autoload gets retained
00075             spl_autoload_register('__autoload');
00076         }
00077         // End of HTML Purifier related code       
00078         $this->version = version::getInstance();
00079         $this->aliroVersion = $this->version->RELEASE.'/'.$this->version->DEV_STATUS.'/'.$this->version->DEV_LEVEL;
00080         $this->configuration = aliroCore::getInstance();
00081         $this->configuration->fixLanguage();
00082     }

aliroAbstractRequest::fixPostItems (  )  [protected]

Definition at line 84 of file aliroAbstractRequest.php.

References $_REQUEST, checkFormStamp(), getParam(), setErrorMessage(), and T_().

Referenced by __construct(), and aliroAdminRequest::doControl().

00084                                        {
00085         $this->formcheck = $this->checkFormStamp();
00086         if (_ALIRO_FORM_CHECK_EXPIRED == $this->formcheck OR _ALIRO_FORM_CHECK_FAIL == $this->formcheck) {
00087             $this->setErrorMessage(T_('Sorry, your request used an invalid or expired form, please try again'));
00088             $_POST = array();
00089         }
00090         if (_ALIRO_FORM_CHECK_REPEAT == $this->formcheck) {
00091             $this->setErrorMessage(T_('This form submission has already been processed'));
00092             $_POST = array();
00093         }
00094         if ($params = $this->getParam($_POST, 'params', null, _MOS_ALLOWHTML)) {
00095             $pobject = new aliroParameters();
00096             $pobject->processInput($params);
00097             $_POST['params'] = $pobject->asString();
00098         }
00099         if (isset($_POST['alironstask']) AND (!isset($_REQUEST['task']) OR !$_REQUEST['task'])) $_POST['task'] = $_REQUEST['task'] = $_POST['alironstask'];
00100     }

aliroAbstractRequest::__clone (  )  [protected]

Definition at line 102 of file aliroAbstractRequest.php.

00102                                   {
00103         // Declared to enforce singleton
00104     }

aliroAbstractRequest::__call ( method,
args 
)

Definition at line 106 of file aliroAbstractRequest.php.

References T_(), and aliroRequest::trace().

00106                                             {
00107         // May want to add language
00108         foreach (array($this->configuration, $this->pathway) as $object) {
00109             if (method_exists($object, $method)) return call_user_func_array(array($object, $method), $args);
00110         }
00111         trigger_error (sprintf(T_('Invalid method call on aliroRequest - %s'), $method));
00112         echo aliroRequest::trace();
00113         return null;
00114     }

aliroAbstractRequest::__get ( property  ) 

Definition at line 116 of file aliroAbstractRequest.php.

References T_().

00116                                       {
00117         if (isset($this->critical->$property)) return $this->critical->$property;
00118         trigger_error (sprintf(T_('Invalid property request on aliroAbstractRequest - %s'), $property));
00119         return null;
00120     }

aliroAbstractRequest::handleGlobals (  )  [private]

Definition at line 122 of file aliroAbstractRequest.php.

References aliroCore::getInstance().

Referenced by __construct().

00122                                       {
00123         $superglobals = array($_SERVER, $_ENV, $_FILES, $_COOKIE, $_POST, $_GET, $_SESSION);
00124 
00125         // Emulate register_globals on
00126         if (!ini_get('register_globals') AND aliroCore::getInstance()->getCfg('register_globals')) {
00127             foreach ($_GET as $key=>$value) {
00128                 if (!isset($GLOBALS[$key])) $GLOBALS[$key]=$value;
00129             }
00130             foreach ($_POST as $key=>$value) {
00131                 if (!isset($GLOBALS[$key])) $GLOBALS[$key]=$value;
00132             }
00133         }
00134         // Emulate register_globals off
00135         elseif (ini_get('register_globals') AND !$this->getCfg('register_globals')) {
00136             foreach ($superglobals as $superglobal) {
00137                 foreach ($superglobal as $key=>$value) {
00138                     unset( $GLOBALS[$key]);
00139                 }
00140             }
00141         }
00142     }

aliroAbstractRequest::getComponentName (  ) 

Definition at line 144 of file aliroAbstractRequest.php.

00144                                         {
00145         return $this->component_name;
00146     }

aliroAbstractRequest::showHead (  ) 

Definition at line 148 of file aliroAbstractRequest.php.

References aliroSEF::getInstance().

00148                                 {
00149         $html = aliroSEF::getInstance()->getHead($this->title, $this->metatags, $this->customtags);
00150         if ($this->getCfg('sef')) $html .= "<base href=\"{$this->getCfg('live_site')}/\" />\r\n";
00151         if ( $this->user->id ) $html .= "<script src='{$this->getCfg('live_site')}/includes/js/alirojavascript.js' type='text/javascript'></script>";
00152         return $html;
00153     }

aliroAbstractRequest::getFavIcon (  ) 

Definition at line 155 of file aliroAbstractRequest.php.

00155                                   {
00156         // Default favourites icon
00157         return $this->getCfg('live_site').'/images/favicon.ico';
00158     }

aliroAbstractRequest::getItemid (  ) 

Definition at line 160 of file aliroAbstractRequest.php.

Referenced by invokeRetroCode().

00160                                  {
00161         return isset($this->bestmatch) ? $this->bestmatch->id : 0;
00162     }

aliroAbstractRequest::getOption (  ) 

Definition at line 164 of file aliroAbstractRequest.php.

00164                                  {
00165         return $this->option;
00166     }

aliroAbstractRequest::redirect ( url = '',
message = '',
severity = _ALIRO_ERROR_INFORM 
)

Definition at line 168 of file aliroAbstractRequest.php.

References stripFromURL(), and T_().

Referenced by aliroUserRequest::doControl(), invokeComponent(), and redirectSame().

00168                                                                                    {
00169         if (is_null($url) OR !$url) $url = '';
00170         else {
00171             $url = $this->stripFromURL($url, 'mosmsg');
00172             $url = $this->stripFromURL($url, 'severity');
00173         }
00174         if ($message AND !$url) $url = 'index.php';
00175         if (strpos($url, 'http') !== 0) {
00176             if ($url AND $url[0] != '/') $url = '/'.$url;
00177             $url = $this->siteBaseURL.$url;
00178         }
00179         if ($message) {
00180             $url .= (strpos($url, '?') ? '&' : '?').'mosmsg='.urlencode($message);
00181             if ($severity) $url .= '&severity='.intval($severity);
00182         }
00183         @session_write_close();
00184         if (headers_sent()) printf (T_('Please click on %s this link %s to continue'), "<a href='$url'>", '</a>');
00185         else {
00186             @ob_end_clean(); // clear output buffer
00187             header( "Location: $url" );
00188         }
00189         exit();
00190     }

aliroAbstractRequest::redirectSame ( message = '',
severity = _ALIRO_ERROR_INFORM 
)

Definition at line 192 of file aliroAbstractRequest.php.

References redirect().

00192                                                                               {
00193         $url = 'index.php?'.$_SERVER['QUERY_STRING'];
00194         $this->redirect ($url, $message, $severity);
00195     }

aliroAbstractRequest::stripFromURL ( url,
property 
)

Definition at line 197 of file aliroAbstractRequest.php.

Referenced by redirect().

00197                                                    {
00198         if ($position = strpos($url, $property)) {
00199             if ($endpos = strpos($url, '&', $position)) $url = substr($url, 0, $position).substr($url, $endpos+1);
00200             else $url = substr($url, 0, $position-1);
00201         }
00202         return $url;
00203     }

aliroAbstractRequest::setErrorMessage ( message,
severity = _ALIRO_ERROR_FATAL 
)

Definition at line 205 of file aliroAbstractRequest.php.

Referenced by __construct(), checkFormStamp(), and fixPostItems().

00205                                                                              {
00206         $this->error_message[$severity][] = $message;
00207     }

aliroAbstractRequest::isErrorLevelSet ( severity  ) 

Definition at line 209 of file aliroAbstractRequest.php.

00209                                                 {
00210         return isset($this->error_message[$severity]);
00211     }

aliroAbstractRequest::pullErrorMessages (  ) 

Definition at line 213 of file aliroAbstractRequest.php.

00213                                          {
00214         $messages = $this->error_message;
00215         $this->error_message = array();
00216         return $messages;
00217     }

aliroAbstractRequest::getUserState ( var_name  ) 

Definition at line 219 of file aliroAbstractRequest.php.

References getParam().

Referenced by getUserStateFromRequest().

00219                                               {
00220         return is_array($_SESSION["aliro_{$this->prefix}state"]) ? $this->getParam($_SESSION["aliro_{$this->prefix}state"], $var_name) : null;
00221     }

aliroAbstractRequest::setUserState ( var_name,
var_value 
)

Definition at line 223 of file aliroAbstractRequest.php.

Referenced by getUserStateFromRequest().

00223                                                           {
00224         $_SESSION["aliro_{$this->prefix}state"][$var_name] = $var_value;
00225     }

aliroAbstractRequest::isUserStateSet ( var_name  )  [protected]

Definition at line 227 of file aliroAbstractRequest.php.

Referenced by getUserStateFromRequest().

00227                                                   {
00228         return isset($_SESSION["aliro_{$this->prefix}state"][$var_name]);
00229     }

aliroAbstractRequest::getUserStateFromRequest ( var_name,
req_name,
var_default = null 
)

Definition at line 231 of file aliroAbstractRequest.php.

References $_REQUEST, getUserState(), isUserStateSet(), and setUserState().

00231                                                                                      {
00232         if (isset($_REQUEST[$req_name])) {
00233             if ((string) $var_default == (string) (int) $var_default) $_REQUEST[$req_name] = intval($_REQUEST[$req_name]);
00234             $this->setUserState($var_name, $_REQUEST[$req_name]);
00235         }
00236         elseif (isset($var_default) AND !$this->isUserStateSet($var_name)) $this->setUserState($var_name, $var_default);
00237         return $this->getUserState($var_name);
00238     }

aliroAbstractRequest::makeFormStamp (  ) 

Definition at line 240 of file aliroAbstractRequest.php.

References name.

00240                                      {
00241         $formid = md5(uniqid(mt_rand(), true));
00242         $checker = md5(uniqid(mt_rand(), true));
00243         $_SESSION['aliro_formid_'.$formid] = $checker;
00244         $_SESSION['aliro_formdone_'.$formid] = 0;
00245         $html = <<<FORM_STAMP
00246         <input type="hidden" name="aliroformid" value="$formid" />
00247         <input type="hidden" name="alirochecker" value="$checker" />
00248 FORM_STAMP;
00249         return $html;
00250     }

aliroAbstractRequest::getFormCheckError (  ) 

Definition at line 252 of file aliroAbstractRequest.php.

References T_().

Referenced by aliroUserRequest::doControl().

00252                                          {
00253         $messages = array (
00254         _ALIRO_FORM_CHECK_EXPIRED => T_('Sorry, the form you used has expired, please try again'),
00255         _ALIRO_FORM_CHECK_FAIL => T_('Sorry, the form you used is invalid'),
00256         _ALIRO_FORM_CHECK_NULL => T_('Sorry, the form you used did not have a required authentication'),
00257         _ALIRO_FORM_CHECK_REPEAT => T_('The form you used has already been processed')
00258         );
00259         if ($this->formcheck) {
00260             if (isset($messages[$this->formcheck])) return $messages[$this->formcheck];
00261             else return T_('Internal error - invalid form check value');
00262         }
00263         else return '';
00264     }

aliroAbstractRequest::checkFormStamp (  )  [private]

Definition at line 266 of file aliroAbstractRequest.php.

References getParam(), setErrorMessage(), and T_().

Referenced by fixPostItems().

00266                                        {
00267         $formid = $this->getParam($_POST, 'aliroformid');
00268         $checker = $this->getParam($_POST, 'alirochecker');
00269         if ($formid) {
00270             if (!isset($_SESSION['aliro_formid_'.$formid])) return _ALIRO_FORM_CHECK_EXPIRED;
00271             if ($_SESSION['aliro_formid_'.$formid] == $checker) {
00272                 if ($_SESSION['aliro_formdone_'.$formid]) return _ALIRO_FORM_CHECK_REPEAT;
00273                 else {
00274                     $_SESSION['aliro_formdone_'.$formid] = 1;
00275                     return _ALIRO_FORM_CHECK_OK;
00276                 }
00277             }
00278             else {
00279                 $this->setErrorMessage(T_('Form failed consistency check'), _ALIRO_ERROR_FATAL);
00280                 return _ALIRO_FORM_CHECK_FAIL;
00281             }
00282         }
00283         else return _ALIRO_FORM_CHECK_NULL;
00284     }

aliroAbstractRequest::getParam ( &$  arr,
name,
def = null,
mask = 0 
)

Definition at line 286 of file aliroAbstractRequest.php.

References doPurify().

Referenced by aliroAdminRequest::__construct(), __construct(), aliroAdminRequest::adminActiveUser(), checkFormStamp(), aliroUserRequest::doControl(), aliroAdminRequest::doControl(), fixPostItems(), getSticky(), getUserState(), invokeRetroCode(), and aliroUserRequest::runNonTemplate().

00286                                                                  {
00287         if (isset( $arr[$name] )) {
00288             if (is_array($arr[$name])) foreach ($arr[$name] as $key=>$element) {
00289                 $result[$key] = $this->getParam ($arr[$name], $key, $def, $mask);
00290             }
00291             else {
00292                 $result = $arr[$name];
00293                 if (!($mask&_MOS_NOTRIM)) $result = trim($result);
00294                 if (!is_numeric($result)) {
00295                     if (get_magic_quotes_gpc() AND !($mask & _MOS_NOSTRIP)) $result = stripslashes($result);
00296                     if (!($mask&_MOS_ALLOWRAW) AND is_numeric($def)) $result = $def;
00297                     elseif ($result) {
00298                         if ($mask & _MOS_ALLOWHTML) $result = $this->doPurify($result);
00299                         else {
00300                             $result = strip_tags($result);
00301                             // $result = htmlspecialchars($result, ENT_QUOTES, 'UTF-8');
00302                         }
00303                     }
00304                 }
00305             }
00306             return $result;
00307         }
00308         return $def;
00309     }

aliroAbstractRequest::doPurify ( string  ) 

Definition at line 311 of file aliroAbstractRequest.php.

References criticalInfo::getInstance().

Referenced by getParam().

00311                                        {
00312         if (null == $this->purifier) {
00313             $config = HTMLPurifier_Config::createDefault();
00314             if (criticalInfo::getInstance()->isAdmin) $config->set('HTML', 'Trusted', true);
00315             $this->purifier = new HTMLPurifier($config);
00316         }
00317         return $this->purifier->purify($string);
00318     }

aliroAbstractRequest::getStickyParam ( &$  arr,
name,
def = null,
mask = 0 
)

Definition at line 321 of file aliroAbstractRequest.php.

References getSticky().

00321                                                                       {
00322         $var = 'aliro_sticky_'.$this->getComponentName().'_'.$name;
00323         return $this->getSticky ($var, $arr, $name, $def=null, $mask=0);
00324     }

aliroAbstractRequest::getStickyAliroParam ( &$  arr,
name,
def = null,
mask = 0 
)

Definition at line 326 of file aliroAbstractRequest.php.

References getSticky().

Referenced by aliroAdminRequest::doControl().

00326                                                                            {
00327         $var = 'aliro_sticky_aliro_'.$name;
00328         return $this->getSticky ($var, $arr, $name, $def=null, $mask=0);
00329     }

aliroAbstractRequest::getSticky ( var,
&$  arr,
name,
def,
mask 
) [private]

Definition at line 331 of file aliroAbstractRequest.php.

References getParam().

Referenced by getStickyAliroParam(), and getStickyParam().

00331                                                                  {
00332         if ((!isset($arr[$name]) OR !$arr[$name]) AND isset($_SESSION[$var])) return $_SESSION[$var];
00333         $provided = $this->getParam($arr, $name, $def, $mask);
00334         if ($provided) $_SESSION[$var] = $provided;
00335         return $provided;
00336     }

aliroAbstractRequest::unstick ( name  ) 

Definition at line 338 of file aliroAbstractRequest.php.

00338                                     {
00339         $var = 'aliro_sticky_'.$this->getComponentName().'_'.$name;
00340         if (isset($_SESSION[$var])) unset ($_SESSION[$var]);
00341     }

aliroAbstractRequest::getTemplate (  ) 

Definition at line 343 of file aliroAbstractRequest.php.

References aliroTemplateHandler::getInstance().

00343                                   {
00344         if (!$this->templateName) $this->templateName = aliroTemplateHandler::getInstance()->getDefaultTemplateName();
00345         return $this->templateName;
00346     }

aliroAbstractRequest::setPageTitle ( title = null  ) 

Definition at line 348 of file aliroAbstractRequest.php.

References $title.

00348                                                {
00349         if ($this->getCfg('pagetitles')) {
00350             $title = trim($title);
00351             $base = $this->getCfg('sitename');
00352             $this->title = $title ?  $title.' - '.$base : $base;
00353         }
00354     }

aliroAbstractRequest::getPageTitle (  ) 

Definition at line 356 of file aliroAbstractRequest.php.

00356                                     {
00357         return $this->title;
00358     }

aliroAbstractRequest::fix_metatag ( operation,
name,
content,
prepend = '',
append = '' 
) [protected]

Definition at line 360 of file aliroAbstractRequest.php.

Referenced by addMetaTag(), appendMetaTag(), and prependMetaTag().

00360                                                                                           {
00361         $content = trim(htmlspecialchars($content));
00362         if (!$content) return;
00363         $name = trim(htmlspecialchars($name));
00364         $prepend = trim($prepend);
00365         $append = trim($append);
00366         if ('new' == $operation) $this->metatags[$name] = array($content, $prepend, $append);
00367         else {
00368             $tag = isset($this->metatags[$name]) ?  $this->metatags[$name] : array('', '', '');
00369             if ('pre' == $operation) $tag[0] = $content.$tag[0];
00370             else $tag[0] = $content.(($tag[0] AND $content) ? ',' : '').$tag[0];
00371             $this->metatags[$name] = $tag;
00372         }
00373     }

aliroAbstractRequest::addMetaTag ( name,
content,
prepend = '',
append = '' 
)

Definition at line 375 of file aliroAbstractRequest.php.

References fix_metatag().

00375                                                                          {
00376         $this->fix_metatag ('new', $name, $content, $prepend, $append);
00377     }

aliroAbstractRequest::appendMetaTag ( name,
content 
)

Definition at line 379 of file aliroAbstractRequest.php.

References fix_metatag().

00379                                                     {
00380         $this->fix_metatag ('post', $name, $content);
00381     }

aliroAbstractRequest::prependMetaTag ( name,
content 
)

Definition at line 383 of file aliroAbstractRequest.php.

References fix_metatag().

00383                                                      {
00384         $this->fix_metatag ('pre', $name, $content);
00385     }

aliroAbstractRequest::addCustomHeadTag ( html  ) 

Definition at line 387 of file aliroAbstractRequest.php.

Referenced by addCSS(), addScript(), and requestOverlib().

00387                                              {
00388         $this->customtags[] = trim ($html);
00389     }

aliroAbstractRequest::addScript ( relativeFile  ) 

Definition at line 391 of file aliroAbstractRequest.php.

References addCustomHeadTag().

00391                                               {
00392         $link = <<<SCRIPT_LINK
00393 
00394     <script type="text/javascript" src="{$this->getCfg('live_site')}$relativeFile"></script>
00395 
00396 SCRIPT_LINK;
00397 
00398         $this->addCustomHeadTag($link);
00399     }

aliroAbstractRequest::addCSS ( relativeFile,
media = 'screen' 
)

Definition at line 401 of file aliroAbstractRequest.php.

References addCustomHeadTag().

00401                                                             {
00402         $link = <<<CSS_LINK
00403 
00404     <link href="{$this->getCfg('live_site')}$relativeFile" rel="stylesheet" type="text/css" media="$media" />
00405 
00406 CSS_LINK;
00407 
00408         $this->addCustomHeadTag($link);
00409     }

aliroAbstractRequest::setMetadataInCache ( &$  cache_object  ) 

Definition at line 411 of file aliroAbstractRequest.php.

00411                                                         {
00412         $cache_object->title = $this->title;
00413         $cache_object->metatags = $this->metatags;
00414         $cache_object->customtags = $this->customtags;
00415     }

aliroAbstractRequest::setMetadataFromCache ( cache_object  ) 

Definition at line 417 of file aliroAbstractRequest.php.

00417                                                          {
00418         $this->title = $cache_object->title;
00419         $this->metatags = $cache_object->metatags;
00420         $this->customtags = $cache_object->customtags;
00421     }

aliroAbstractRequest::requestOverlib (  ) 

Definition at line 423 of file aliroAbstractRequest.php.

References addCustomHeadTag().

00423                                       {
00424         if ($this->overlib) return;
00425         $html = <<<OVERLIB
00426         <script type="text/javascript" src="{$this->getCfg('live_site')}/includes/js/overlib_mini.js"></script>
00427 OVERLIB;
00428         $this->addCustomHeadTag ($html);
00429         $this->overlib = true;
00430     }

aliroAbstractRequest::divOverlib (  ) 

Definition at line 432 of file aliroAbstractRequest.php.

00432                                   {
00433         if ($this->overlib) return '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>';
00434         return '';
00435     }

aliroAbstractRequest::getDebug (  ) 

Definition at line 437 of file aliroAbstractRequest.php.

References aliroDebug::getInstance(), aliroCoreDatabase::getInstance(), and aliroDatabase::getInstance().

00437                                 {
00438         if ($this->getCfg('debug')) {
00439             $database = aliroDatabase::getInstance();
00440             $log = $database->getLogged();
00441             $database = aliroCoreDatabase::getInstance();
00442             $log .= $database->getLogged();
00443             $loader = aliroDebug::getInstance();
00444             $log .= $loader->getLogged();
00445             return $log;
00446         }
00447         else return '';
00448     }

aliroAbstractRequest::getCustomTags (  ) 

Definition at line 450 of file aliroAbstractRequest.php.

00450                                      {
00451         if (count($this->customtags)) return implode("\n", $this->customtags);
00452         return '';
00453     }

aliroAbstractRequest::getComponentObject (  ) 

Definition at line 455 of file aliroAbstractRequest.php.

References aliroComponent.

Referenced by invokeComponent().

00455                                           {
00456         if ($this->core_item) {
00457             $component = new aliroComponent();
00458             $component->option = $component->extformalname = $this->core_item;
00459             $component->name = $this->core_item;
00460             $component->adminclass = 'aliroComponentAdminManager';
00461         }
00462         else $component = $this->chandler->getComponentByFormalName($this->option);
00463         return $component;
00464     }

aliroAbstractRequest::invokeComponent ( menu = null  )  [protected]

Definition at line 466 of file aliroAbstractRequest.php.

References getComponentObject(), aliroErrorRecorder::getInstance(), aliroSEF::getInstance(), redirect(), retroCall(), standardCall(), and T_().

Referenced by aliroAdminRequest::adminActiveUser(), and aliroUserRequest::doControl().

00466                                                     {
00467         try {
00468             $this->chandler->startBuffer();
00469             if (!$this->option AND $menu AND $menu->component) $this->option = $menu->component;
00470             $component = $this->getComponentObject();
00471             $message = T_('At entry of aliroRequest::invokeComponent');
00472             if (!$this->urlerror AND ($this->option OR $this->core_item)) {
00473                 $componentname = $this->option? $this->option : $this->core_item;
00474                 define ('_ALIRO_COMPONENT_NAME', $componentname);
00475                 if ($component) {
00476                     if ($this->pathway) {
00477                         $cname = aliroSEF::getInstance()->sefComponentName($component->option);
00478                         $this->pathway->addItem($cname, 'index.php?option='.$component->option);
00479                     }
00480                     $class = $this->getComponentClass($component);
00481                     if ($class) $this->standardCall ($component, $class, $menu);
00482                     else $this->urlerror = $this->retroCall ($menu);
00483                     if ($this->urlerror) trigger_error(T_('Retro call was unable to find component: ').$this->option);
00484                 }
00485                 else {
00486                     $this->urlerror = true;
00487                     $message = T_('Unable to find component object for ').$this->option;
00488                 }
00489             }
00490             else {
00491                 $this->urlerror = true;
00492                 if ($this->chandler->componentCount() AND $this->mhandler->getMenuCount('mainmenu')) {
00493                     $message = sprintf(T_('Failed on urlerror from SEF or no option (%s)'), $this->option);
00494                 }
00495             }
00496             if ($this->urlerror) new aliroPage404($message);
00497             $this->chandler->endBuffer();
00498         } catch (databaseException $exception) {
00499             $target = $this->core_item ? $this->core_item : $this->option;
00500             $message = sprintf(T_('A database error occurred on %s at %s while processing %s'), date('Y-M-d'), date('H:i:s'), $target);
00501             $errorkey = "SQL/{$exception->getCode()}/$target/$exception->dbname/{$exception->getMessage()}/$exception->sql";
00502             aliroErrorRecorder::getInstance()->recordError($message, $errorkey, $message, $exception);
00503             $this->redirect('', $message, _ALIRO_ERROR_FATAL);
00504         }
00505     }

aliroAbstractRequest::standardCall ( component,
class,
menu 
) [protected]

Definition at line 507 of file aliroAbstractRequest.php.

Referenced by invokeComponent().

00507                                                                 {
00508         $worker = new $class ($component, 'Aliro', $this->aliroVersion, $menu);
00509         $worker->activate();
00510     }

aliroAbstractRequest::retroCall ( menu  )  [protected]

Definition at line 512 of file aliroAbstractRequest.php.

References $mainframe, mosMainFrame::getInstance(), and invokeRetroCode().

Referenced by invokeComponent().

00512                                          {
00513         $mainframe = mosMainFrame::getInstance();
00514         $path = $mainframe->getPath($this->path_side);
00515         if (!$path) return true;
00516         $this->invokeRetroCode($path, null, $menu);
00517         return false;
00518     }

aliroAbstractRequest::invokeRetroCode ( path,
function = null,
menu = null 
)

Definition at line 520 of file aliroAbstractRequest.php.

References $_REQUEST, $mainframe, $option, aliroDatabase::getInstance(), mosMainFrame::getInstance(), aliroUser::getInstance(), aliroAuthoriser::getInstance(), getItemid(), and getParam().

Referenced by retroCall().

00520                                                                         {
00521         $GLOBALS['task'] = $task = $this->getParam($_REQUEST, 'task');
00522         $GLOBALS['act'] = $act = $this->getParam($_REQUEST, 'act');
00523         $GLOBALS['id'] = $id = $this->getParam($_REQUEST, 'id', 0);
00524         $GLOBALS['section'] = $section = $this->getParam($_REQUEST, 'section');
00525         require_once ($this->critical->absolute_path.'/includes/mambofunc.php');
00526         $GLOBALS['acl'] = $acl = aliroAuthoriser::getInstance();
00527         $GLOBALS['my'] = $my = aliroUser::getInstance();
00528         $GLOBALS['gid'] = $gid = $my->gid;
00529         $GLOBALS['mainframe'] = $mainframe = mosMainFrame::getInstance();
00530         $GLOBALS['database'] = $database = aliroDatabase::getInstance();
00531         $GLOBALS['Itemid'] = $Itemid = $this->getItemid();
00532         $GLOBALS['option'] = $option = $this->option;
00533         $GLOBALS['_VERSION'] = $this->version;
00534 
00535         // This will not do - what should happen??
00536         $GLOBALS['mosConfig_lang'] = 'english';
00537 
00538         error_reporting(E_ALL);
00539         $this->globalizeConfig();
00540         foreach ($GLOBALS as $key=>$value) if ('mosConfig_' == substr($key,0,10)) $$key = $value;
00541         require($path);
00542         if ($function) $function();
00543         error_reporting(E_ALL|E_STRICT);
00544     }


Member Data Documentation

aliroAbstractRequest::$instance = null [static, protected]

Definition at line 5 of file aliroAbstractRequest.php.

aliroAbstractRequest::$option = '' [protected]

Definition at line 8 of file aliroAbstractRequest.php.

Referenced by invokeRetroCode().

aliroAbstractRequest::$isHome = false [protected]

Definition at line 9 of file aliroAbstractRequest.php.

aliroAbstractRequest::$formcheck = 0 [protected]

Definition at line 10 of file aliroAbstractRequest.php.

aliroAbstractRequest::$component_name = '' [protected]

Definition at line 11 of file aliroAbstractRequest.php.

aliroAbstractRequest::$bestmatch = null [protected]

Definition at line 12 of file aliroAbstractRequest.php.

aliroAbstractRequest::$aliroVersion = '' [protected]

Definition at line 13 of file aliroAbstractRequest.php.

aliroAbstractRequest::$urlerror = false [protected]

Definition at line 14 of file aliroAbstractRequest.php.

aliroAbstractRequest::$title = '' [protected]

Definition at line 15 of file aliroAbstractRequest.php.

Referenced by setPageTitle().

aliroAbstractRequest::$metatags = array() [protected]

Definition at line 16 of file aliroAbstractRequest.php.

aliroAbstractRequest::$customtags = array() [protected]

Definition at line 17 of file aliroAbstractRequest.php.

aliroAbstractRequest::$templateName = '' [protected]

Definition at line 18 of file aliroAbstractRequest.php.

aliroAbstractRequest::$templateObject = null [protected]

Definition at line 19 of file aliroAbstractRequest.php.

aliroAbstractRequest::$do_gzip = false [protected]

Definition at line 20 of file aliroAbstractRequest.php.

aliroAbstractRequest::$error_message = array() [protected]

Definition at line 21 of file aliroAbstractRequest.php.

aliroAbstractRequest::$overlib = false [protected]

Definition at line 22 of file aliroAbstractRequest.php.

aliroAbstractRequest::$user = null [protected]

Definition at line 25 of file aliroAbstractRequest.php.

aliroAbstractRequest::$critical = null [protected]

Definition at line 26 of file aliroAbstractRequest.php.

aliroAbstractRequest::$configuration = null [protected]

Definition at line 27 of file aliroAbstractRequest.php.

aliroAbstractRequest::$pathway = null [protected]

Definition at line 28 of file aliroAbstractRequest.php.

aliroAbstractRequest::$version = null [protected]

Definition at line 29 of file aliroAbstractRequest.php.

aliroAbstractRequest::$mhandler = null [protected]

Definition at line 32 of file aliroAbstractRequest.php.

aliroAbstractRequest::$chandler = null [protected]

Definition at line 33 of file aliroAbstractRequest.php.

aliroAbstractRequest::$xhandler = null [protected]

Definition at line 34 of file aliroAbstractRequest.php.

aliroAbstractRequest::$purifier = null [protected]

Definition at line 35 of file aliroAbstractRequest.php.


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

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