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 ()
 getHead ()
 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         // The include path is needed for HTMLpurifier (will possibly serve for other extensions too):
00071         set_include_path($this->critical->class_base.'/extclasses/');
00072         $this->version = version::getInstance();
00073         $this->aliroVersion = $this->version->RELEASE.'/'.$this->version->DEV_STATUS.'/'.$this->version->DEV_LEVEL;
00074         $this->configuration = aliroCore::getInstance();
00075         $this->configuration->fixLanguage();
00076     }

aliroAbstractRequest::fixPostItems (  )  [protected]

Definition at line 78 of file aliroAbstractRequest.php.

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

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

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

aliroAbstractRequest::__clone (  )  [protected]

Definition at line 96 of file aliroAbstractRequest.php.

00096                                   {
00097         // Declared to enforce singleton
00098     }

aliroAbstractRequest::__call ( method,
args 
)

Definition at line 100 of file aliroAbstractRequest.php.

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

00100                                             {
00101         // May want to add language
00102         foreach (array($this->configuration, $this->pathway) as $object) {
00103             if (method_exists($object, $method)) return call_user_func_array(array($object, $method), $args);
00104         }
00105         trigger_error (sprintf(T_('Invalid method call on aliroRequest - %s'), $method));
00106         echo aliroRequest::trace();
00107         return null;
00108     }

aliroAbstractRequest::__get ( property  ) 

Definition at line 110 of file aliroAbstractRequest.php.

References T_().

00110                                       {
00111         if (isset($this->critical->$property)) return $this->critical->$property;
00112         trigger_error (sprintf(T_('Invalid property request on aliroAbstractRequest - %s'), $property));
00113         return null;
00114     }

aliroAbstractRequest::handleGlobals (  )  [private]

Definition at line 116 of file aliroAbstractRequest.php.

References aliroCore::getInstance().

Referenced by __construct().

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

aliroAbstractRequest::getComponentName (  ) 

Definition at line 138 of file aliroAbstractRequest.php.

00138                                         {
00139         return $this->component_name;
00140     }

aliroAbstractRequest::showHead (  ) 

Definition at line 142 of file aliroAbstractRequest.php.

References addMetaTag(), appendMetaTag(), and getHead().

00142                                 {
00143         if (!isset($this->metatags['description'])) $this->appendMetaTag( 'description', $this->getCfg('MetaDesc') );
00144         if (!isset($this->metatags['keywords']))$this->appendMetaTag( 'keywords', $this->getCfg('MetaKeys') );
00145         $this->addMetaTag( 'robots', 'index, follow' );
00146         $html = $this->getHead();
00147         if ($this->getCfg('sef')) $html .= "<base href=\"{$this->getCfg('live_site')}/\" />\r\n";
00148         if ( $this->user->id ) $html .= "<script src='{$this->getCfg('live_site')}/includes/js/alirojavascript.js' type='text/javascript'></script>";
00149         return $html;
00150     }

aliroAbstractRequest::getFavIcon (  ) 

Definition at line 152 of file aliroAbstractRequest.php.

00152                                   {
00153         // Default favourites icon
00154         return $this->getCfg('live_site').'/images/favicon.ico';
00155     }

aliroAbstractRequest::getItemid (  ) 

Definition at line 157 of file aliroAbstractRequest.php.

Referenced by invokeRetroCode().

00157                                  {
00158         return isset($this->bestmatch) ? $this->bestmatch->id : 0;
00159     }

aliroAbstractRequest::getOption (  ) 

Definition at line 161 of file aliroAbstractRequest.php.

00161                                  {
00162         return $this->option;
00163     }

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

Definition at line 165 of file aliroAbstractRequest.php.

References stripFromURL(), and T_().

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

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

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

Definition at line 189 of file aliroAbstractRequest.php.

References redirect().

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

aliroAbstractRequest::stripFromURL ( url,
property 
)

Definition at line 194 of file aliroAbstractRequest.php.

Referenced by redirect().

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

aliroAbstractRequest::setErrorMessage ( message,
severity = _ALIRO_ERROR_FATAL 
)

Definition at line 202 of file aliroAbstractRequest.php.

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

00202                                                                              {
00203         $this->error_message[$severity][] = $message;
00204     }

aliroAbstractRequest::isErrorLevelSet ( severity  ) 

Definition at line 206 of file aliroAbstractRequest.php.

00206                                                 {
00207         return isset($this->error_message[$severity]);
00208     }

aliroAbstractRequest::pullErrorMessages (  ) 

Definition at line 210 of file aliroAbstractRequest.php.

00210                                          {
00211         $messages = $this->error_message;
00212         $this->error_message = array();
00213         return $messages;
00214     }

aliroAbstractRequest::getUserState ( var_name  ) 

Definition at line 216 of file aliroAbstractRequest.php.

References getParam().

Referenced by getUserStateFromRequest().

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

aliroAbstractRequest::setUserState ( var_name,
var_value 
)

Definition at line 220 of file aliroAbstractRequest.php.

Referenced by getUserStateFromRequest().

00220                                                           {
00221         $_SESSION["aliro_{$this->prefix}state"][$var_name] = $var_value;
00222     }

aliroAbstractRequest::isUserStateSet ( var_name  )  [protected]

Definition at line 224 of file aliroAbstractRequest.php.

Referenced by getUserStateFromRequest().

00224                                                   {
00225         return isset($_SESSION["aliro_{$this->prefix}state"][$var_name]);
00226     }

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

Definition at line 228 of file aliroAbstractRequest.php.

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

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

aliroAbstractRequest::makeFormStamp (  ) 

Definition at line 237 of file aliroAbstractRequest.php.

References name.

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

aliroAbstractRequest::getFormCheckError (  ) 

Definition at line 249 of file aliroAbstractRequest.php.

References T_().

Referenced by aliroUserRequest::doControl().

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

aliroAbstractRequest::checkFormStamp (  )  [private]

Definition at line 263 of file aliroAbstractRequest.php.

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

Referenced by fixPostItems().

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

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

Definition at line 283 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().

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

aliroAbstractRequest::doPurify ( string  ) 

Definition at line 308 of file aliroAbstractRequest.php.

References criticalInfo::getInstance().

Referenced by getParam().

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

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

Definition at line 318 of file aliroAbstractRequest.php.

References getSticky().

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

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

Definition at line 323 of file aliroAbstractRequest.php.

References getSticky().

Referenced by aliroAdminRequest::doControl().

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

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

Definition at line 328 of file aliroAbstractRequest.php.

References getParam().

Referenced by getStickyAliroParam(), and getStickyParam().

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

aliroAbstractRequest::unstick ( name  ) 

Definition at line 335 of file aliroAbstractRequest.php.

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

aliroAbstractRequest::getTemplate (  ) 

Definition at line 340 of file aliroAbstractRequest.php.

References aliroTemplateHandler::getInstance().

00340                                   {
00341         if (!$this->templateName) $this->templateName = aliroTemplateHandler::getInstance()->getDefaultTemplateName();
00342         return $this->templateName;
00343     }

aliroAbstractRequest::setPageTitle ( title = null  ) 

Definition at line 345 of file aliroAbstractRequest.php.

References $title.

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

aliroAbstractRequest::getPageTitle (  ) 

Definition at line 353 of file aliroAbstractRequest.php.

00353                                     {
00354         return $this->title;
00355     }

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

Definition at line 357 of file aliroAbstractRequest.php.

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

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

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

Definition at line 372 of file aliroAbstractRequest.php.

References fix_metatag().

Referenced by showHead().

00372                                                                          {
00373         $this->fix_metatag ('new', $name, $content, $prepend, $append);
00374     }

aliroAbstractRequest::appendMetaTag ( name,
content 
)

Definition at line 376 of file aliroAbstractRequest.php.

References fix_metatag().

Referenced by showHead().

00376                                                     {
00377         $this->fix_metatag ('post', $name, $content);
00378     }

aliroAbstractRequest::prependMetaTag ( name,
content 
)

Definition at line 380 of file aliroAbstractRequest.php.

References fix_metatag().

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

aliroAbstractRequest::addCustomHeadTag ( html  ) 

Definition at line 384 of file aliroAbstractRequest.php.

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

00384                                              {
00385         $this->customtags[] = trim ($html);
00386     }

aliroAbstractRequest::addScript ( relativeFile  ) 

Definition at line 388 of file aliroAbstractRequest.php.

References addCustomHeadTag().

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

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

Definition at line 398 of file aliroAbstractRequest.php.

References addCustomHeadTag().

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

aliroAbstractRequest::setMetadataInCache ( &$  cache_object  ) 

Definition at line 408 of file aliroAbstractRequest.php.

00408                                                         {
00409         $cache_object->title = $this->title;
00410         $cache_object->metatags = $this->metatags;
00411         $cache_object->customtags = $this->customtags;
00412     }

aliroAbstractRequest::setMetadataFromCache ( cache_object  ) 

Definition at line 414 of file aliroAbstractRequest.php.

00414                                                          {
00415         $this->title = $cache_object->title;
00416         $this->metatags = $cache_object->metatags;
00417         $this->customtags = $cache_object->customtags;
00418     }

aliroAbstractRequest::requestOverlib (  ) 

Definition at line 420 of file aliroAbstractRequest.php.

References addCustomHeadTag().

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

aliroAbstractRequest::divOverlib (  ) 

Definition at line 429 of file aliroAbstractRequest.php.

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

aliroAbstractRequest::getDebug (  ) 

Definition at line 434 of file aliroAbstractRequest.php.

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

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

aliroAbstractRequest::getHead (  ) 

Definition at line 447 of file aliroAbstractRequest.php.

Referenced by showHead().

00447                               {
00448         $head[] = '<title>'.$this->title.'</title>';
00449         foreach ($this->metatags as $name=>$meta) {
00450             if ($meta[1]) $head[] = $meta[1];
00451             $head[] = '<meta name="' . $name . '" content="' . $meta[0] . '" />';
00452             if ($meta[2]) $head[] = $meta[2];
00453         }
00454         foreach ($this->customtags as $html) $head[] = $html;
00455         return implode( "\n", $head )."\n";
00456     }

aliroAbstractRequest::getCustomTags (  ) 

Definition at line 458 of file aliroAbstractRequest.php.

00458                                      {
00459         if (count($this->customtags)) return implode("\n", $this->customtags);
00460         return '';
00461     }

aliroAbstractRequest::getComponentObject (  ) 

Definition at line 463 of file aliroAbstractRequest.php.

References aliroComponent.

Referenced by invokeComponent().

00463                                           {
00464         if ($this->core_item) {
00465             $component = new aliroComponent();
00466             $component->option = $component->extformalname = $this->core_item;
00467             $component->name = $this->core_item;
00468             $component->adminclass = 'aliroComponentAdminManager';
00469         }
00470         else $component = $this->chandler->getComponentByFormalName($this->option);
00471         return $component;
00472     }

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

Definition at line 474 of file aliroAbstractRequest.php.

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

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

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

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

Definition at line 512 of file aliroAbstractRequest.php.

Referenced by invokeComponent().

00512                                                                 {
00513         $worker = new $class ($component, 'Aliro', $this->aliroVersion, $menu);
00514         $worker->activate();
00515     }

aliroAbstractRequest::retroCall ( menu  )  [protected]

Definition at line 517 of file aliroAbstractRequest.php.

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

Referenced by invokeComponent().

00517                                          {
00518         $mainframe = mosMainFrame::getInstance();
00519         $path = $mainframe->getPath($this->path_side);
00520         if (!$path) return true;
00521         $this->invokeRetroCode($path, null, $menu);
00522         return false;
00523     }

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

Definition at line 525 of file aliroAbstractRequest.php.

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

Referenced by retroCall().

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


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 Thu Apr 17 13:03:28 2008 for ALIRO by  doxygen 1.5.5