aliroSEF.php

Go to the documentation of this file.
00001 <?php
00002 
00003 /*******************************************************************************
00004  * Aliro - the modern, accessible content management system
00005  *
00006  * Aliro is open source software, free to use, and licensed under GPL.
00007  * You can find the full licence at http://www.gnu.org/copyleft/gpl.html GNU/GPL
00008  *
00009  * The author freely draws attention to the fact that Aliro derives from Mambo,
00010  * software that is controlled by the Mambo Foundation.  However, this section
00011  * of code is totally new.  If it should contain any fragments that are similar
00012  * to Mambo, please bear in mind (1) there are only so many ways to do things
00013  * and (2) the author of Aliro is also the author and copyright owner for large
00014  * parts of Mambo 4.6.
00015  *
00016  * Tribute should be paid to all the developers who took Mambo to the stage
00017  * it had reached at the time Aliro was created.  It is a feature rich system
00018  * that contains a good deal of innovation.
00019  *
00020  * Your attention is also drawn to the fact that Aliro relies on other items of
00021  * open source software, which is very much in the spirit of open source.  Aliro
00022  * wishes to give credit to those items of code.  Please refer to
00023  * http://aliro.org/credits for details.  The credits are not included within
00024  * the Aliro package simply to avoid providing a marker that allows hackers to
00025  * identify the system.
00026  *
00027  * Copyright in this code is strictly reserved by its author, Martin Brampton.
00028  * If it seems appropriate, the copyright will be vested in the Aliro Organisation
00029  * at a suitable time.
00030  *
00031  * Copyright (c) 2007 Martin Brampton
00032  *
00033  * http://aliro.org
00034  *
00035  * counterpoint@aliro.org
00036  *
00037  * aliroSEF provides advanced SEF functions where sef_ext.php files are installed.
00038  * When SEF is turned off, aliroSEF still operates to achieve two things.  It will
00039  * redirect any SEF URLs that it recognises back to the non-SEF equivalents, with
00040  * a 301 redirect.  It also ensures that all URLs have ampersands correctly encoded.
00041  *
00042  * When SEF is turned on, but no sef_ext.php files are present, aliroSEF behaves
00043  * pretty much like the standard SEF functionality of Mambo 4.x or Joomla! 1.0.x.
00044  *
00045  * If components are activated through the admin interface and sef_ext.php files
00046  * are present, more advanced SEF processing takes place.  There are Aliro standard
00047  * sef_ext.php files for some common components, including the retro-content
00048  * component.
00049  *
00050  */
00051 
00052 class aliroUnAccent {
00053 
00054     // private vars
00055     // private static $instance = null;
00056     var $tranmap = array();
00057 
00058     // private function
00059     function aliroUnaccent () {
00060 
00061     $this->tranmap = array(
00062       "\xC3\x80" => "A",   "\xC3\x81" => "A",   "\xC3\x82" => "A",   "\xC3\x83" => "A",
00063       "\xC3\x84" => "A",   "\xC3\x85" => "A",   "\xC3\x86" => "AE",  "\xC3\x87" => "C",
00064       "\xC3\x88" => "E",   "\xC3\x89" => "E",   "\xC3\x8A" => "E",   "\xC3\x8B" => "E",
00065       "\xC3\x8C" => "I",   "\xC3\x8D" => "I",   "\xC3\x8E" => "I",   "\xC3\x8F" => "I",
00066       "\xC3\x90" => "D",   "\xC3\x91" => "N",   "\xC3\x92" => "O",   "\xC3\x93" => "O",
00067       "\xC3\x94" => "O",   "\xC3\x95" => "O",   "\xC3\x96" => "O",   "\xC3\x98" => "O",
00068       "\xC3\x99" => "U",   "\xC3\x9A" => "U",   "\xC3\x9B" => "U",   "\xC3\x9C" => "U",
00069       "\xC3\x9D" => "Y",   "\xC3\x9E" => "P",   "\xC3\x9F" => "ss",
00070       "\xC3\xA0" => "a",   "\xC3\xA1" => "a",   "\xC3\xA2" => "a",   "\xC3\xA3" => "a",
00071       "\xC3\xA4" => "a",   "\xC3\xA5" => "a",   "\xC3\xA6" => "ae",  "\xC3\xA7" => "c",
00072       "\xC3\xA8" => "e",   "\xC3\xA9" => "e",   "\xC3\xAA" => "e",   "\xC3\xAB" => "e",
00073       "\xC3\xAC" => "i",   "\xC3\xAD" => "i",   "\xC3\xAE" => "i",   "\xC3\xAF" => "i",
00074       "\xC3\xB0" => "o",   "\xC3\xB1" => "n",   "\xC3\xB2" => "o",   "\xC3\xB3" => "o",
00075       "\xC3\xB4" => "o",   "\xC3\xB5" => "o",   "\xC3\xB6" => "o",   "\xC3\xB8" => "o",
00076       "\xC3\xB9" => "u",   "\xC3\xBA" => "u",   "\xC3\xBB" => "u",   "\xC3\xBC" => "u",
00077       "\xC3\xBD" => "y",   "\xC3\xBE" => "p",   "\xC3\xBF" => "y",
00078       "\xC4\x80" => "A",   "\xC4\x81" => "a",   "\xC4\x82" => "A",   "\xC4\x83" => "a",
00079       "\xC4\x84" => "A",   "\xC4\x85" => "a",   "\xC4\x86" => "C",   "\xC4\x87" => "c",
00080       "\xC4\x88" => "C",   "\xC4\x89" => "c",   "\xC4\x8A" => "C",   "\xC4\x8B" => "c",
00081       "\xC4\x8C" => "C",   "\xC4\x8D" => "c",   "\xC4\x8E" => "D",   "\xC4\x8F" => "d",
00082       "\xC4\x90" => "D",   "\xC4\x91" => "d",   "\xC4\x92" => "E",   "\xC4\x93" => "e",
00083       "\xC4\x94" => "E",   "\xC4\x95" => "e",   "\xC4\x96" => "E",   "\xC4\x97" => "e",
00084       "\xC4\x98" => "E",   "\xC4\x99" => "e",   "\xC4\x9A" => "E",   "\xC4\x9B" => "e",
00085       "\xC4\x9C" => "G",   "\xC4\x9D" => "g",   "\xC4\x9E" => "G",   "\xC4\x9F" => "g",
00086       "\xC4\xA0" => "G",   "\xC4\xA1" => "g",   "\xC4\xA2" => "G",   "\xC4\xA3" => "g",
00087       "\xC4\xA4" => "H",   "\xC4\xA5" => "h",   "\xC4\xA6" => "H",   "\xC4\xA7" => "h",
00088       "\xC4\xA8" => "I",   "\xC4\xA9" => "i",   "\xC4\xAA" => "I",   "\xC4\xAB" => "i",
00089       "\xC4\xAC" => "I",   "\xC4\xAD" => "i",   "\xC4\xAE" => "I",   "\xC4\xAF" => "i",
00090       "\xC4\xB0" => "I",   "\xC4\xB1" => "i",   "\xC4\xB2" => "IJ",  "\xC4\xB3" => "ij",
00091       "\xC4\xB4" => "J",   "\xC4\xB5" => "j",   "\xC4\xB6" => "K",   "\xC4\xB7" => "k",
00092       "\xC4\xB8" => "k",   "\xC4\xB9" => "L",   "\xC4\xBA" => "l",   "\xC4\xBB" => "L",
00093       "\xC4\xBC" => "l",   "\xC4\xBD" => "L",   "\xC4\xBE" => "l",   "\xC4\xBF" => "L",
00094       "\xC5\x80" => "l",   "\xC5\x81" => "L",   "\xC5\x82" => "l",   "\xC5\x83" => "N",
00095       "\xC5\x84" => "n",   "\xC5\x85" => "N",   "\xC5\x86" => "n",   "\xC5\x87" => "N",
00096       "\xC5\x88" => "n",   "\xC5\x89" => "n",   "\xC5\x8A" => "N",   "\xC5\x8B" => "n",
00097       "\xC5\x8C" => "O",   "\xC5\x8D" => "o",   "\xC5\x8E" => "O",   "\xC5\x8F" => "o",
00098       "\xC5\x90" => "O",   "\xC5\x91" => "o",   "\xC5\x92" => "CE",  "\xC5\x93" => "ce",
00099       "\xC5\x94" => "R",   "\xC5\x95" => "r",   "\xC5\x96" => "R",   "\xC5\x97" => "r",
00100       "\xC5\x98" => "R",   "\xC5\x99" => "r",   "\xC5\x9A" => "S",   "\xC5\x9B" => "s",
00101       "\xC5\x9C" => "S",   "\xC5\x9D" => "s",   "\xC5\x9E" => "S",   "\xC5\x9F" => "s",
00102       "\xC5\xA0" => "S",   "\xC5\xA1" => "s",   "\xC5\xA2" => "T",   "\xC5\xA3" => "t",
00103       "\xC5\xA4" => "T",   "\xC5\xA5" => "t",   "\xC5\xA6" => "T",   "\xC5\xA7" => "t",
00104       "\xC5\xA8" => "U",   "\xC5\xA9" => "u",   "\xC5\xAA" => "U",   "\xC5\xAB" => "u",
00105       "\xC5\xAC" => "U",   "\xC5\xAD" => "u",   "\xC5\xAE" => "U",   "\xC5\xAF" => "u",
00106       "\xC5\xB0" => "U",   "\xC5\xB1" => "u",   "\xC5\xB2" => "U",   "\xC5\xB3" => "u",
00107       "\xC5\xB4" => "W",   "\xC5\xB5" => "w",   "\xC5\xB6" => "Y",   "\xC5\xB7" => "y",
00108       "\xC5\xB8" => "Y",   "\xC5\xB9" => "Z",   "\xC5\xBA" => "z",   "\xC5\xBB" => "Z",
00109       "\xC5\xBC" => "z",   "\xC5\xBD" => "Z",   "\xC5\xBE" => "z",   "\xC6\x8F" => "E",
00110       "\xC6\xA0" => "O",   "\xC6\xA1" => "o",   "\xC6\xAF" => "U",   "\xC6\xB0" => "u",
00111       "\xC7\x8D" => "A",   "\xC7\x8E" => "a",   "\xC7\x8F" => "I",
00112       "\xC7\x90" => "i",   "\xC7\x91" => "O",   "\xC7\x92" => "o",   "\xC7\x93" => "U",
00113       "\xC7\x94" => "u",   "\xC7\x95" => "U",   "\xC7\x96" => "u",   "\xC7\x97" => "U",
00114       "\xC7\x98" => "u",   "\xC7\x99" => "U",   "\xC7\x9A" => "u",   "\xC7\x9B" => "U",
00115       "\xC7\x9C" => "u",
00116       "\xC7\xBA" => "A",   "\xC7\xBB" => "a",   "\xC7\xBC" => "AE",  "\xC7\xBD" => "ae",
00117       "\xC7\xBE" => "O",   "\xC7\xBF" => "o",
00118       "\xC9\x99" => "e",
00119 
00120       "\xC2\x82" => ",",        // High code comma
00121       "\xC2\x84" => ",,",       // High code double comma
00122       "\xC2\x85" => "...",      // Tripple dot
00123       "\xC2\x88" => "^",        // High carat
00124       "\xC2\x91" => "\x27",     // Forward single quote
00125       "\xC2\x92" => "\x27",     // Reverse single quote
00126       "\xC2\x93" => "\x22",     // Forward double quote
00127       "\xC2\x94" => "\x22",     // Reverse double quote
00128       "\xC2\x96" => "-",        // High hyphen
00129       "\xC2\x97" => "--",       // Double hyphen
00130       "\xC2\xA6" => "|",        // Split vertical bar
00131       "\xC2\xAB" => "<<",       // Double less than
00132       "\xC2\xBB" => ">>",       // Double greater than
00133       "\xC2\xBC" => "1/4",      // one quarter
00134       "\xC2\xBD" => "1/2",      // one half
00135       "\xC2\xBE" => "3/4",      // three quarters
00136 
00137       "\xCA\xBF" => "\x27",     // c-single quote
00138       "\xCC\xA8" => "",         // modifier - under curve
00139       "\xCC\xB1" => ""          // modifier - under line
00140     );
00141 
00142     }
00143 
00144     function &getInstance () {
00145         static $instance;
00146         if (!is_object($instance)) $instance = new aliroUnaccent();
00147         return $instance;
00148     }
00149 
00150     function unaccent ($utf8string) {
00151         return strtr($utf8string, $this->tranmap);
00152     }
00153 
00154 }
00155 
00156 class aliroSEF extends aliroFriendlyBase {
00157     protected static $instance = __CLASS__;
00158 
00159     // The following are private
00160     private $live_site = '';
00161     private $home_page = false;
00162     private $mainmenu = array();
00163     private $config = null;
00164     
00165 /* These should have been incorporate into $this->config    
00166     private $underscore = 0;
00167     private $enabled = 1;
00168     private $strip_chars = '';
00169     private $lower_case = '0';
00170     private $unique_id = '0';
00171     private $cache_time = '600';
00172     private $buffer_size = '500';
00173     private $home_title = 'Home';
00174     private $title_separator = '|';
00175     private $default_robots = 'index, follow';
00176     private $custom_code = array();
00177     private $custom_name = array();
00178     private $custom_PHP = array();
00179     private $custom_short = array();
00180     private $sef_content_task = array();
00181     private $sef_name_chars = array();
00182     private $sef_translate_chars = array();
00183     private $component_details = array();
00184     private $sef_substitutions_exact = array();
00185     private $sef_substitutions_in = array();
00186     private $sef_substitutions_out = array();
00187     private $legal_content_tasks = array();
00188 */
00189     
00190     private $sef_name_string = '';
00191     private $sef_translate_string = '';
00192     private $content_tasks = array();
00193     private $content_menus = array();
00194     private $metadata = null;
00195 
00196     // The following are public
00197     public $content_data = null;
00198     public $content_items = array();
00199     public $content_sections = array();
00200     public $content_categories = array();
00201 
00202     // The following are private
00203     private $SEF_SPACE;
00204     private $cachedSEF = array();
00205     private $cachedTime = array();
00206     private $cacheWritten = array();
00207     private $cacheObject = null;
00208     
00209     private $database = null;
00210 
00211     private function __construct () {
00212         $this->database = aliroDatabase::getInstance();
00213         $this->live_site = $this->getCfg('live_site');
00214 
00215         /*******************************************************************************
00216         **  The following are parameters for the ReMOSef Search Engine
00217         **  Optimisation component.  $this->SEF_SPACE should be set to the
00218         **  character that is to replace blanks in names that form the URL.
00219         **  You can privatey this, although the only sensible choices seem to be
00220         **  underscore or hyphen (_ or -).
00221         **
00222         **  The arrays $this->config->custom_code and $this->config->custom_name must be kept exactly
00223         **  in step with each other.  $this->custom_code is a list of the components
00224         **  that are to be handled by ReMOSef.
00225         **
00226         **  The array $this->config->custom_name is the alternative name that will be used
00227         **  in the optimised URL to identify the component and can be whatever
00228         **  you please so long as it is unique and legal for a URL.  Apart from
00229         **  using the custom name for the component, ReMOSef will do no further
00230         **  translation of the URL than is done by the standard Mambo SEF - UNLESS
00231         **  there is a sef_ext.php file installed for that component.  The
00232         **  exception to this is ReMOSitory - the optimisation code for Remository
00233         **  is integrated in ReMOSef.  For other components, if a sef_ext.php is
00234         **  present, it will be invoked by ReMOSef.
00235         **
00236         **  The array $remosef_content_task is capable of translating the tasks
00237         **  understood by the Mambo content component.  Please DO NOT CHANGE what
00238         **  is to the left of the equals sign.  When putting different values on
00239         **  the right hand side, remember that they must all be different, and must
00240         **  also be different from any of the custom names used for components.
00241         **  Without that, Remosef cannot figure out what a SEF URL means and will
00242         **  give unpredictable results.
00243         **
00244         **  Note that the names in custom_name must not be allowed to clash with
00245         **  the names used as tasks by the content component, in their
00246         **  translated form - see below.
00247         *******************************************************************************/
00248         // Use of underscore is NOT recommended, as search engines then do not see the words
00249         global $_SEF_SPACE;                                 // divide words with hyphens
00250         $this->SEF_SPACE = $_SEF_SPACE = "-";               // divide words with hyphens
00251         /*******************************************************************************
00252         **  The following are the parameters for the optional content specific
00253         **  URL optimisation.  They are not used within the standard SEF processing
00254         **  unless you add in a sef_ext.php that is integrated with the Mambo SEF.
00255         **
00256         **  The following two lines define the translations that SEF will perform on
00257         **  names of sections and categories when translating them for inclusion in a URL.
00258         **  Each item in $this->config->sef_name_chars is translated into the corresponding
00259         **  element of $this->config->sef_translate_chars.
00260         **
00261         **  NOTE it is important that space be the last translate character, since the
00262         **  characters are processed in the order in which they appear.  Since earlier
00263         **  translates may create new spaces, it is vital that the space translation is
00264         **  done last.
00265         **
00266         **  You can extend these arrays as you wish, although it is obviously important
00267         **  to make sure that the items of one match the items of the other exactly.
00268         *******************************************************************************/
00269         $this->sef_name_string = '"\'';
00270         $this->sef_translate_string = '--';
00271         $this->content_tasks = array ('findkey',
00272         'view',
00273         'section',
00274         'category',
00275         'blogsection',
00276         'blogcategorymulti',
00277         'blogcategory',
00278         'archivesection',
00279         'archivecategory',
00280         'save',
00281         'cancel',
00282         'emailform',
00283         'emailsend',
00284         'vote',
00285         'showblogsection'
00286         );
00287 
00288         $this->cache =new aliroCache('aliroSEF');
00289         $this->config = $this->cache->get('sefConfig');
00290         if (!$this->config) {
00291             $this->config = new stdClass();
00292             $this->config->underscore = 0;
00293             $this->config->enabled = 1;
00294             $this->config->strip_chars = '';
00295             $this->config->lower_case = '0';
00296             $this->config->unique_id = '0';
00297             $this->config->cache_time = '600';
00298             $this->config->buffer_size = '500';
00299             $this->config->home_title = 'Home';
00300             $this->config->title_separator = '|';
00301             $this->config->default_robots = 'index, follow';
00302             $this->config->custom_code = array();
00303             $this->config->custom_name = array();
00304             $this->config->custom_PHP = array();
00305             $this->config->custom_short = array();
00306             $this->config->sef_content_task = array();
00307             $this->config->sef_name_chars = array();
00308             $this->config->sef_translate_chars = array();
00309             $this->config->component_details = array();
00310             $this->config->sef_substitutions_exact = array();
00311             $this->config->sef_substitutions_in = array();
00312             $this->config->sef_substitutions_out = array();
00313             $this->config->legal_content_tasks = array();
00314             $this->config->sef_name_chars = array('!', '?', '&', '/', ' ');
00315             $this->config->sef_translate_chars = array('', '', 'and', ' or ', $this->SEF_SPACE);
00316 
00317             $configdata = $this->database->doSQLget ("SELECT * FROM #__remosef_config");
00318             foreach ($configdata as $item) {
00319                 if ('options' == $item->type) {
00320                     $name = $item->name;
00321                     $this->config->$name = $item->modified;
00322                 }
00323                 elseif ('components' == $item->type) {
00324                     $this->config->custom_code[] = $item->name;
00325                     $this->config->custom_name[] = $item->modified;
00326                 }
00327                 elseif ('characters' == $item->type) {
00328                     $this->config->sef_name_chars[] = $item->name;
00329                     $this->config->sef_translate_chars[] = $item->modified;
00330                 }
00331                 elseif ('substitutions' == $item->type) {
00332                     $this->config->sef_substitutions_exact[$item->name] = $item->modified;
00333                 }
00334                 elseif ('substitutions_in' == $item->type) {
00335                     $this->config->sef_substitutions_in["#$item->name#i"] = $item->modified;
00336                 }
00337                 elseif ('substitutions_out' == $item->type) {
00338                     $this->config->sef_substitutions_out["#$item->name#i"] = $item->modified;
00339                 }
00340                 elseif ('content' == $item->type) $this->config->sef_content_task[$item->name] = $item->modified;
00341                 else $this->config->component_details[$item->type][$item->name] = $item->modified;
00342             }
00343             unset($configdata);
00344             foreach ($this->content_tasks as $task) {
00345                 $this->config->legal_content_tasks[] = isset($this->config->sef_content_task[$task]) ? $this->config->sef_content_task[$task] : $task;
00346             }
00347             foreach ($this->config->custom_code as $code) {
00348                 $codefile = _ALIRO_CLASS_BASE."/components/$code/sef_ext.php";
00349                 $seffile = dirname(__FILE__)."/sef_ext/$code/sef_ext.php";
00350                 if (file_exists($codefile)) $this->config->custom_PHP[] = $codefile;
00351                 elseif (file_exists($seffile)) $this->config->custom_PHP[] = $seffile;
00352                 else $this->config->custom_PHP[] = false;
00353                 $split = explode('_',$code);
00354                 $this->config->custom_short[] = $split[1];
00355             }
00356             $this->cache->save($this->config);
00357         }
00358 
00359         $this->mainmenu = aliroMenuHandler::getInstance()->getByParentOrder('mainmenu');
00360         if ($this->mainmenu) foreach ($this->mainmenu as $menu) {
00361             $stage2 = parse_url($menu->link);
00362             if (isset($stage2['query'])) {
00363                 parse_str($stage2['query'], $parms);
00364                 if (isset($parms['option']) AND 'com_content' == $parms['option']) {
00365                     if (isset($parms['task'])) $this->content_menus[$parms['task']][$menu->id] = $parms;
00366                 }
00367             }
00368         }
00369 
00370         $results = $this->cache->get('sefDataURI');
00371         if (!$results) {
00372             $results = $this->database->doSQLget("SELECT * FROM #__remosef_uri ORDER BY refreshed DESC LIMIT {$this->config->buffer_size}");
00373             $this->cache->save($results);
00374         }
00375         foreach ($results as $result) {
00376             $uri = $result->uri;
00377             $this->cachedSEF[$uri] = $result->sef;
00378             $this->cachedTime[$uri] = $result->refreshed;
00379         }
00380         unset($results);
00381     }
00382 
00383     public static function getInstance () {
00384         return is_object(self::$instance) ? self::$instance : (self::$instance = new self::$instance());
00385     }
00386     
00387     public function clearCache () {
00388         $this->cache->clean();
00389     }
00390 
00391     public function getContentMenuInfo () {
00392         return $this->content_menus;
00393     }
00394 
00395     public function nameForURL ($string) {
00396         $strips = explode ('|', $this->config->strip_chars);
00397         $string = str_replace($strips, '', $string);
00398         $string = aliroUnaccent::getInstance()->unaccent($string);
00399         $string = str_replace($this->config->sef_name_chars, $this->config->sef_translate_chars, $string);
00400         // This may be problematic - must not urldecode the incoming URL as components may duplicate
00401         $string = urlencode($string);
00402         return $string;
00403     }
00404 
00405     function translateContentTask ($task) {
00406         if (isset($this->config->sef_content_task[$task])) return $this->config->sef_content_task[$task];
00407         else return $task;
00408     }
00409 
00410     function untranslateContentTask ($tr_task) {
00411         $task = array_search ($tr_task, $this->config->sef_content_task);
00412         if (!$task) $task = $tr_task;
00413         if (in_array($task, $this->content_tasks)) return $task;
00414         else return null;
00415     }
00416 
00417     private function analyseStandardURI ($uri) {
00418         $_SERVER['REQUEST_URI'] = $uri;
00419         $this->database->setQuery("SELECT * FROM #__remosef_metadata WHERE uri = '$uri'");
00420         $this->database->loadObject($this->metadata);
00421         $mainparts = explode('?', $uri);
00422         if (empty($mainparts[1])) return;
00423         $vars = explode('&', $mainparts[1]);
00424         foreach ($vars as $var) {
00425             $parts = explode('=', $var);
00426             if (!empty($parts[1])) {
00427                 $_REQUEST[$parts[0]] = $_GET[$parts[0]] = $parts[1];
00428             }
00429         }
00430     }
00431 
00432     public function sefRetrieval() {
00433         $uri = $_SERVER['REQUEST_URI'];
00434         $sublength = strlen(dirname($_SERVER['PHP_SELF']));
00435         if (1 < $sublength) $uri = substr($uri,$sublength);
00436         if (!$uri OR $uri == '/' or $uri == '/index.php') {
00437             $this->home_page = true;
00438             return 0;
00439         }
00440         if (preg_match('/(\b)GLOBALS|_REQUEST|_SERVER|_ENV|_COOKIE|_GET|_POST|_FILES|_SESSION(\b)/i', $uri) > 0) {
00441             die('Invalid Request');
00442         }
00443         $regex = '#[<>\(\)@"\']+|/\?#';
00444         if (preg_match($regex, $uri)) return 1;
00445         // if ($this->config->underscore AND $this->SEF_SPACE == '-' AND strpos($uri,'_') !== false) $uri = str_replace('_', '-', $uri);
00446         $exactback = isset($this->config->sef_substitutions_exact) ? array_search($uri, $this->config->sef_substitutions_exact) : false;
00447         if (false === $exactback AND '/' != substr($uri,-1)) {
00448             $exactback = array_search($uri.'/', $this->config->sef_substitutions_exact);
00449             if (false !== $exactback) {
00450                 header ('HTTP/1.1 301 Moved Permanently');
00451                 header ('Location:'.$this->live_site.$uri.'/');
00452                 exit;
00453             }
00454         }
00455         if (false !== $exactback) {
00456             $this->analyseStandardURI($exactback);
00457             return 0;
00458         }
00459         $uri = str_replace(array('!', '%21'), array('',''), $uri);
00460         $saveuri = $uri;
00461         if (isset($this->config->sef_substitutions_in)) $uri = @preg_replace(array_keys($this->config->sef_substitutions_in), array_values($this->config->sef_substitutions_in), $uri);
00462         if ($indexloc = strpos($uri, 'index.php?')) {
00463             if ($_SERVER['REQUEST_METHOD'] == 'GET') {
00464                 $sefagain = substr($this->sefRelToAbs(substr($uri,$indexloc), false),strlen($this->live_site));
00465                 if ($saveuri != $sefagain) {
00466                     header ('HTTP/1.1 301 Moved Permanently');
00467                     header ('Location:'.$sefagain);
00468                     exit;
00469                 }
00470             }
00471             return 0;
00472         }
00473         elseif (false !== strpos($uri,'index2.php')) return 0;
00474         elseif (false !== strpos($uri,'index3.php')) return 0;
00475         $retrieved = $this->retrieveURI ($uri);
00476         if (!$retrieved AND '/' != substr($uri,-1)) {
00477             $retrieved = $this->retrieveURI($uri.'/');
00478             if ($retrieved) {
00479                     header ('HTTP/1.1 301 Moved Permanently');
00480                     header ('Location:'.$this->live_site.$uri.'/');
00481                     exit;
00482             }
00483         }
00484         if (!$retrieved) {
00485             $retrieved = $this->basicJoomlaRetrieve($uri);
00486             trigger_error('Had to invoke basicJoomlaRetrieve: '.$uri.' : '.$retrieved);
00487         }
00488 
00489         if ($retrieved) {
00490             $retrieved = 'index.php?'.$retrieved;
00491             $sefagain = substr($this->sefRelToAbs($retrieved),strlen($this->live_site));
00492             if ($saveuri != $sefagain AND $_SERVER['REQUEST_METHOD'] == 'GET') {
00493                 header ('HTTP/1.1 301 Moved Permanently');
00494                 header ('Location:'.$sefagain);
00495                 exit;
00496             }
00497                 $this->analyseStandardURI($retrieved);
00498             $returncode = 0;
00499         }
00500         else $returncode = 1;
00501 
00502         return $returncode;
00503     }
00504     
00505     private function retrieveURI ($sef) {
00506         $retrieved = array_search($sef, $this->cachedSEF);
00507         if ($retrieved) return $retrieved;
00508         $coded_sef = $this->database->getEscaped($sef);
00509         $this->database->setQuery("SELECT uri FROM #__remosef_uri WHERE sef='$coded_sef'");
00510         $this->database->loadObject($sefdata);
00511         if ($sefdata) return $sefdata->uri;
00512         else return false;
00513     }
00514 
00515     private function invoke_plugin ($i, $method, $parm1, $parm2=0) {
00516         error_reporting(E_ALL);
00517         require_once($this->config->custom_PHP[$i]);
00518         $classname = 'sef_'.$this->config->custom_short[$i];
00519         $compname = 'com_'.$this->config->custom_short[$i];
00520         $maptags = isset($this->config->component_details[$compname]) ? $this->config->component_details[$compname] : array();
00521         $callplugin = array($classname, 'getInstance');
00522         if (is_callable($callplugin)) {
00523             $plugin = call_user_func($callplugin);
00524             if ('create' == $method) return $plugin->$method($parm1, $this->config->lower_case, $this->config->unique_id, $maptags);
00525             else return $plugin->revert($parm1, $parm2, $maptags);
00526         }
00527         else {
00528             $callplugin = array($classname, $method);
00529             if ('create' == $method) return call_user_func ($callplugin, $parm1, $this->config->lower_case, $this->config->unique_id, $maptags);
00530             else return call_user_func ($callplugin, $parm1, $parm2, $maptags);
00531         }
00532     }
00533 
00534     private function default_revert ($specialname) {
00535         $request = explode($specialname.'/', $_SERVER['REQUEST_URI']);
00536         if (isset($request[1])) $parmset = explode("/", $request[1]);
00537         else $parmset = array();
00538         $QUERY_STRING = '';
00539         foreach($parmset as $values) {
00540             $parts = explode(",", $values);
00541             if (count($parts) > 1) {
00542                 $_REQUEST[$parts[0]] = $_GET[$parts[0]] = $parts[1];
00543                 if ($parts[0] == 'option') $QUERY_STRING .= "option=$parts[1]";
00544                 else $QUERY_STRING .= "&$parts[0]=$parts[1]";
00545             }
00546         }
00547         return $QUERY_STRING;
00548     }
00549 
00550     private function parse ($string, &$parms) {
00551         $parms = array();
00552         $parts = explode('&', $string);
00553         foreach ($parts as $part) {
00554             $assigns = explode('=', $part);
00555             if (count($assigns) == 2) $parms[$assigns[0]] = $assigns[1];
00556         }
00557     }
00558 
00559 
00560     public function getHead () {
00561         global $mainframe;
00562         $head = $found = array();
00563         $block['title'] = 1;
00564         $sitename = $this->getCfg('sitename');
00565         if ($this->home_page) $extratitle = $this->config->home_title;
00566         elseif (empty($this->metadata->htmltitle)) {
00567             if (strlen($mainframe->_head['title']) > strlen($sitename)) $extratitle = substr($mainframe->_head['title'], strlen($sitename)+3);
00568             else $extratitle = '';
00569         }
00570         else $extratitle = htmlspecialchars($this->metadata->htmltitle, ENT_QUOTES, 'UTF-8');
00571         if ($extratitle) {
00572             if (strlen($extratitle) + strlen($sitename) < 60) $extratitle .= ' '.$this->config->title_separator.' '.$sitename;
00573         }
00574         else $extratitle = $sitename;
00575         $head[] = '<title>' . $extratitle . '</title>';
00576         if (!empty($this->metadata->description)) {
00577             $head[] = $this->makeMeta('description', htmlspecialchars($this->metadata->description, ENT_QUOTES, 'UTF-8'));
00578             $block['description'] = 1;
00579         }
00580 
00581         if (!empty($this->metadata->keywords)) {
00582             $head[] = $this->makeMeta('keywords', htmlspecialchars($this->metadata->keywords, ENT_QUOTES, 'UTF-8'));
00583             $block['keywords'] = 1;
00584         }
00585 
00586         if (!empty($this->metadata->robots)) {
00587             $head[] = $this->makeMeta('robots', htmlspecialchars($this->metadata->robots, ENT_QUOTES, 'UTF-8'));
00588             $block['robots'] = 1;
00589         }
00590 
00591         foreach ($mainframe->_head['meta'] as $meta) {
00592             if (isset($block[$meta[0]]) OR empty($meta[1])) continue;
00593             $found[$meta[0]] = 1;
00594             if ($meta[2]) {
00595                 $head[] = $meta[2];
00596             }
00597             $head[] = $this->makeMeta ($meta[0], $meta[1]);
00598             if ($meta[3]) {
00599                 $head[] = $meta[3];
00600             }
00601         }
00602 
00603         if (empty($block['description']) AND empty($found['description'])) $head[] = $this->makeMeta('description', htmlspecialchars($this->getCfg('MetaDesc'), ENT_QUOTES, 'UTF-8'));
00604         if (empty($block['keywords']) AND empty($found['keywords'])) $head[] = $this->makeMeta('keywords', htmlspecialchars($this->getCfg('MetaKeys'), ENT_QUOTES, 'UTF-8'));
00605         if (empty($block['robots']) AND empty($found['robots'])) $head[] = $this->makeMeta('robots', $this->config->default_robots);
00606 
00607         foreach ($mainframe->_head['custom'] as $html) {
00608             $head[] = $html;
00609         }
00610         return implode( "\n", $head ) . "\n";
00611     }
00612 
00613     function makeMeta ($name, $value) {
00614         return <<<META_DATA
00615 <meta name="$name" content="$value" />
00616 META_DATA;
00617 
00618     }
00619 
00623 function metaData () {
00624     global $database, $option, $my, $mainframe, $_VERSION, $task, $id;
00625     global $mosConfig_MetaDesc, $mosConfig_MetaKeys, $mosConfig_live_site, $mosConfig_sef, $mosConfig_absolute_path, $mosConfig_sitename, $mosConfig_favicon;
00626 
00627     // All this now handled conditionally in getHead
00628     // $mainframe->appendMetaTag( 'description', $mosConfig_MetaDesc );
00629     // $mainframe->appendMetaTag( 'keywords', $mosConfig_MetaKeys );
00630     // $mainframe->addMetaTag( 'robots', 'index, follow' );
00631 
00632     // cache activation
00633     // Original Joomla line next:
00634     // if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
00635     // Martin's modified 2 lines to prevent content cache destroying remository.css
00636     global $option;
00637     if ('com_content' == $option AND !empty($_SERVER['QUERY_STRING'])) {
00638         $cache =& mosCache::getCache('com_content');
00639         $GLOBALS['aliroSEFinstance'] =& $this;
00640         echo $cache->call('aliroSEFinstance->getHead', @$_SERVER['QUERY_STRING'], $id);
00641     } else {
00642         echo $this->getHead();
00643     }
00644 
00645     if ( isset($mosConfig_sef) && $mosConfig_sef ) {
00646         echo "<base href=\"$mosConfig_live_site/\" />\r\n";
00647     }
00648 
00649     if ($my->id OR $mainframe->get( 'joomlaJavascript' )) {
00650         ?>
00651         <script src="<?php echo $mosConfig_live_site;?>/includes/js/joomla.javascript.js" type="text/javascript"></script>
00652         <?php
00653     }
00654 
00655     $row = new aliroComponent();
00656     $query = "SELECT a.*"
00657     . "\n FROM #__components AS a"
00658     . "\n WHERE ( a.admin_menu_link = 'option=com_syndicate' OR a.admin_menu_link = 'option=com_syndicate&hidemainmenu=1' )"
00659     . "\n AND a.option = 'com_syndicate'"
00660     ;
00661     $this->database->setQuery( $query );
00662     $this->database->loadObject( $row );
00663 
00664     // get params definitions
00665     $syndicateParams = new mosParameters( $row->params, $mainframe->getPath( 'com_xml', $row->option ), 'component' );
00666 
00667     // needed to reduce query
00668     $GLOBALS['syndicateParams'] = $syndicateParams;
00669 
00670     $live_bookmark = $syndicateParams->get( 'live_bookmark', 0 );
00671 
00672     // and to allow disabling/enabling of selected feed types
00673     switch ( $live_bookmark ) {
00674         case 'RSS0.91':
00675             if ( !$syndicateParams->get( 'rss091', 1 ) ) {
00676                 $live_bookmark = 0;
00677             }
00678             break;
00679 
00680         case 'RSS1.0':
00681             if ( !$syndicateParams->get( 'rss10', 1 ) ) {
00682                 $live_bookmark = 0;
00683             }
00684             break;
00685 
00686         case 'RSS2.0':
00687             if ( !$syndicateParams->get( 'rss20', 1 ) ) {
00688                 $live_bookmark = 0;
00689             }
00690             break;
00691 
00692         case 'ATOM0.3':
00693             if ( !$syndicateParams->get( 'atom03', 1 ) ) {
00694                 $live_bookmark = 0;
00695             }
00696             break;
00697     }
00698 
00699     // support for Live Bookmarks ability for site syndication
00700     if ($live_bookmark) {
00701         $show = 1;
00702 
00703         $link_file  = $mosConfig_live_site . '/index2.php?option=com_rss&feed='. $live_bookmark .'&no_html=1';
00704 
00705         // xhtml check
00706         $link_file = ampReplace( $link_file );
00707 
00708         // security chcek
00709         $check = $syndicateParams->def( 'check', 1 );
00710         if($check) {
00711             // test if rssfeed module is published
00712             // if not disable access
00713             $query = "SELECT m.id"
00714             . "\n FROM #__modules AS m"
00715             . "\n WHERE m.module = 'mod_rssfeed'"
00716             . "\n AND m.published = 1"
00717             ;
00718             $this->database->setQuery( $query );
00719             $check = $this->database->loadResultArray();
00720             if(empty($check)) {
00721                 $show = 0;
00722             }
00723         }
00724         // outputs link tag for page
00725         if ($show) {
00726             // test if security check is enbled
00727             ?>
00728             <link rel="alternate" type="application/rss+xml" title="<?php echo $mosConfig_sitename; ?>" href="<?php echo $link_file; ?>" />
00729             <?php
00730         }
00731     }
00732 
00733     // favourites icon
00734     if ( !$mosConfig_favicon ) {
00735         $mosConfig_favicon = 'favicon.ico';
00736     }
00737     $icon = $mosConfig_absolute_path .'/images/'. $mosConfig_favicon;
00738     // checks to see if file exists
00739     if ( !file_exists( $icon ) ) {
00740         $icon = $mosConfig_live_site .'/images/favicon.ico';
00741     } else {
00742         $icon = $mosConfig_live_site .'/images/' .$mosConfig_favicon;
00743     }
00744 
00745     // outputs link tag for page
00746     ?>
00747     <link rel="shortcut icon" href="<?php echo $icon;?>" />
00748     <?php
00749 }
00750 
00751     public function sefRelToAbs ($string, $specialamp=true) {
00752         global $iso_client_lang;
00753         if ($string == 'index.php') return $this->live_site.'/';
00754         if (strtolower(substr($string,0,9)) != 'index.php' OR eregi('^(([^:/?#]+):)',$string)) return $string;
00755         $clean_string = str_replace('&amp;', '&', $string);
00756         $noitemid_string = preg_replace('/\&Itemid=[0-9]*/', '', $clean_string);
00757             $homelink = $this->mainmenu[0]->link;
00758         if ($noitemid_string == $homelink) return $this->live_site.'/';
00759         if (!($this->getCfg('sef')) OR !$this->config->enabled) return $this->live_site.'/'.($specialamp ? str_replace( '&', '&amp;', $clean_string ) : $clean_string);
00760         $string = substr($clean_string,10);
00761         // Do we need something like this?
00762         if (false AND strpos("lang=", strtolower($string)) === false) {
00763             $string .= "&lang=$iso_client_lang";
00764         }
00765         if (isset($this->config->sef_substitutions_exact['/'.$clean_string])) return $this->live_site.$this->config->sef_substitutions_exact['/'.$clean_string];
00766         if (isset($this->cachedSEF[$clean_string]) AND (time() - $this->config->cachedTime[$clean_string]) < $this->config->cache_time) return $this->live_site.$this->cachedSEF[$clean_string];
00767         $option = $task = '';
00768         $oktasks = true;
00769         $this->parse($string, $params);
00770         foreach ($params as $key=>$value) {
00771             $lowkey = strtolower($key);
00772             $lowvalue = strtolower($value);
00773             $unset = true;
00774             switch ($lowkey) {
00775                 case 'option':
00776                     $option = $lowvalue;
00777                     break;
00778                 case 'task':
00779                     $task = $value;
00780                     if ($lowvalue == 'new' OR $lowvalue == 'edit') $oktasks = false;
00781                     break;
00782                 default:
00783                     $check_params[$lowkey] = $key;
00784                     $unset = false;
00785             }
00786             if ($unset) unset($params[$key]);
00787         }
00788         // Process content items
00789         if (($option == 'com_content' OR $option == 'content') AND $oktasks) {
00790             /*
00791             Content
00792             index.php?option=com_content&task=$task&sectionid=$sectionid&id=$id&Itemid=$Itemid&limit=$limit&limitstart=$limitstart
00793             */
00794             $content_sef = _ALIRO_CLASS_BASE.'/components/com_content/sef_ext.php';
00795             if (file_exists($content_sef)) {
00796                 require_once($content_sef);
00797                 $result = sef_content::create($task, $params, $this->config->lower_case, $this->config->unique_id);
00798                 return $this->live_site.$this->outSubstitution($string, $result);
00799             }
00800             $keys = array('sectionid', 'id', 'itemid', 'limit', 'limitstart', 'year', 'month', 'module', 'lang');
00801             $result = '/content/'.$task.'/';
00802             foreach ($keys as $key) {
00803                 if (isset($check_params[$key])) {
00804                     $pkey = $check_params[$key];
00805                     $result .= $params[$pkey].'/';
00806                 }
00807             }
00808             return $this->live_site.$this->outSubstitution($string, $result);
00809         }
00810         // Process customised components
00811         $i = array_search($option,$this->config->custom_code);
00812         if ($i !== false AND $i !== null) {
00813             if ($this->config->custom_PHP[$i] AND file_exists($this->config->custom_PHP[$i])) {
00814 /*
00815                 if (isset($check_params['itemid'])) {
00816                     $pkey = $check_params['itemid'];
00817                     unset($params[$pkey]);
00818                     unset($check_params['itemid']);
00819                 }
00820 */
00821                 $result = $this->invoke_plugin ($i, 'create', $noitemid_string);
00822             }
00823             else $result = $this->componentDetails($params,$task);
00824             $result = '/'.$this->config->custom_name[$i].'/'.$result;
00825             return $this->live_site.$this->outSubstitution($string, $result);
00826         }
00827         // Process ordinary components
00828         if (strpos($option,'com_')===0 AND $option != 'com_registration' AND $oktasks) {
00829             $result = "/component/option,$option/".$this->componentDetails($params,$task);
00830             return $this->live_site.$this->outSubstitution($string, $result);
00831         }
00832         // Anything else is returned as received, except it is guaranteed that & will be &amp;
00833         return $this->live_site.'/'.($specialamp ? str_replace( '&', '&amp;', $clean_string ) : $clean_string);
00834     }
00835 
00836     private function outSubstitution ($inuri, $outuri) {
00837         $now = time();
00838         // if ($this->config->underscore AND $this->SEF_SPACE == '-' AND strpos($outuri,'_') !== false) $outuri = str_replace('_', '-', $outuri);
00839         $finishedurl = isset($this->config->sef_substitutions_out) ? @preg_replace(array_keys($this->config->sef_substitutions_out), array_values($this->config->sef_substitutions_out), $outuri) : $outuri;
00840         if (isset($this->cachedSEF[$inuri]) AND $finishedurl == $this->cachedSEF[$inuri] AND ($now - $this->cachedTime[$inuri] < $this->config->cache_time)) return $finishedurl;
00841         $this->cachedSEF[$inuri] = $finishedurl;
00842         $this->cachedTime[$inuri] = $now;
00843         $sef = $this->database->getEscaped($finishedurl);
00844         $uri = $this->database->getEscaped($inuri);
00845         $this->database->doSQL("UPDATE #__remosef_uri SET sef = '$sef', refreshed = $now WHERE uri = '$uri'");
00846         if (0 == $this->database->getAffectedRows()) {
00847             $this->database->doSQL("INSERT INTO #__remosef_uri (uri, sef, refreshed) VALUES ('$uri', '$sef', $now)");
00848         }
00849         if (50 == mt_rand(0,99)) {
00850             $weekago = $now - 7*24*60*60;
00851             $chkcode = 'option=com_remository&Itemid=65&func=download&id';
00852             $this->database->doSQL("DELETE FROM #__remosef_uri WHERE uri LIKE '$chkcode%' AND refreshed < $weekago");
00853         }
00854         $this->cache->clean();
00855         return $finishedurl;
00856     }
00857 
00858     private function componentDetails (&$params, $task) {
00859         $string = ($task ? "task,$task/" : '');
00860         foreach ($params as $key=>$param) {
00861                     $param = urlencode($param);
00862                     $string .= "$key,$param/";
00863                 }
00864         return $string;
00865     }
00866 
00867     private function basicJoomlaRetrieve ($uri) {
00868         $url_array = explode('/', $uri);
00869         if (0 == strlen($url_array[0])) array_shift($url_array);
00870         if ($l = count($url_array) AND 0 == strlen($url_array[$l-1])) array_pop($url_array);
00871         $prefix = $subdir = '';
00872         $legal = array_merge(array ('content', 'component'), $this->config->custom_name, $this->config->legal_content_tasks);
00873         while (count($url_array)) {
00874             $element = array_shift($url_array);
00875             if ($element) {
00876                 if (in_array($element,$legal)) {
00877                     $prefix = $element;
00878                     break;
00879                 }
00880                 elseif (strpos($this->live_site,$element) === false) break;
00881                 else $subdir .= '/'.$element;
00882             }
00883         }
00884         $QUERY_STRING = '';
00885         $foundit = false;
00890         if ($prefix == 'content') {
00891             $foundit = true;
00892             $_REQUEST['option'] = $_GET['option'] = $option = 'com_content';
00893             // language hook for content
00894             $lang = "";
00895             $parms = array();
00896             foreach($url_array as $key=>$value) {
00897                 if ( strcasecmp(substr($value,0,5),'lang,') == 0 ) {
00898                     $parts = explode(",", $value);
00899                     if (count($parts) > 1) {
00900                         $lang = $_REQUEST['lang'] = $_GET['lang'] = $parts[1];
00901                     }
00902                 }
00903                 elseif (strlen($value)) $parms[] = $value;
00904             }
00905             // $option/$task/$sectionid/$id/$limit/$limitstart
00906             $task = $this->untranslateContentTask($parms[0]);
00907             $_REQUEST['task'] = $_GET['task'] = $task;
00908             $QUERY_STRING .= "option=com_content&task=$task";
00909             if ($task == 'archivecategory') {
00910                 $_REQUEST['year'] = $_GET['year'] = $year = intval(@$parms[1]);
00911                 $_REQUEST['month'] = $_GET['month'] = $month = intval(@$parms[2]);
00912                 $_REQUEST['module'] = $_GET['module'] = $module = intval(@$parms[3]);
00913                 $QUERY_STRING .= "&year=$year&month=$month&module=$module";
00914             }
00915             else {
00916                 $num = count($parms);
00917                 for ($i = 1; $i <= $num-1; $i++) {
00918                     if (strcmp($parms[$i], (int)$parms[$i]) !== 0) return false;
00919                 }
00920                 $i = 1;
00921                 if (5 == $num OR 3 == $num) {
00922                     $_REQUEST['sectionid'] = $_GET['sectionid'] = $sectionid = $parms[$i];
00923                     $QUERY_STRING .= "&sectionid=$sectionid";
00924                     $i++;
00925                 }
00926                 if ($num > 1) {
00927                     $_REQUEST['id'] = $_GET['id'] = $id = $parms[$i];
00928                     $QUERY_STRING .= "&id=$id";
00929                 }
00930                 if ($num > 3) {
00931                     $_REQUEST['limit'] = $_GET['limit'] = $limit = $parms[$i+1];
00932                     $_REQUEST['limitstart'] = $_GET['limitstart'] = $limitstart = $parms[$i+2];
00933                     $QUERY_STRING .= "&limit=$limit&limitstart=$limitstart";
00934                 }
00935             }
00936             if ($lang!="") {
00937                 $QUERY_STRING .= "&lang=$lang";
00938             }
00939         }
00940 
00941         /*
00942         Components
00943         http://www.domain.com/component/$name,$value
00944         */
00945         elseif ($prefix == 'component') {
00946             $QUERY_STRING .= $this->default_revert('component');
00947             if ($QUERY_STRING) $foundit = true;
00948         }
00949         else {
00950             // Wouldn't be necessary, but wanted to avoid negative parameter to sef_ext.php
00951             array_unshift ($url_array, $prefix);
00952             array_unshift ($url_array, 'dummy');
00953             foreach ($this->config->custom_name as $i=>$compname) {
00954                 if (isset($url_array[1]) AND $url_array[1] == $compname) {
00955                     $origname = $this->config->custom_code[$i];
00956                     if ($this->config->custom_PHP[$i] AND file_exists($this->config->custom_PHP[$i])) {
00957                         if (isset($url_array[2]) AND $url_array[2]) {
00958                             $customsef = $this->invoke_plugin($i, 'revert', $url_array, 0);
00959                             if ($customsef) $QUERY_STRING .= 'option='.$origname.$customsef;
00960                             else return false;
00961                         }
00962                         else $QUERY_STRING .= 'option='.$origname;
00963                     }
00964                     else $QUERY_STRING .= 'option='.$origname.$this->default_revert($compname);
00965                     $_REQUEST['option'] = $_GET['option'] = $option = $origname;
00966                     $foundit = true;
00967                     break;
00968                 }
00969             }
00970             if (!$foundit AND isset($url_array[1])) {
00971                 $content_sef = _ALIRO_CLASS_BASE.'/components/com_content/sef_ext.php';
00972                 if (file_exists($content_sef)) {
00973                     require_once($content_sef);
00974                     $crevert = sef_content::revert($url_array,0);
00975                     if ($crevert) {
00976                         $foundit = true;
00977                         $QUERY_STRING .= $crevert;
00978                     }
00979                 }
00980             }
00981         }
00982         if ($foundit) return $QUERY_STRING;
00983         else return false;
00984     }
00985 
00986 }

Generated on Thu Apr 17 13:03:27 2008 for ALIRO by  doxygen 1.5.5