[ Index ]
 

Code source de Joomla 1.0.13

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/includes/ -> sef.php (source)

   1  <?php
   2  /**
   3  * @version $Id: sef.php 6024 2006-12-18 22:30:07Z friesengeist $
   4  * @package Joomla
   5  * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
   6  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
   7  * Joomla! is free software. This version may have been modified pursuant
   8  * to the GNU General Public License, and as distributed it includes or
   9  * is derivative of works licensed under the GNU General Public License or
  10  * other free or open source software licenses.
  11  * See COPYRIGHT.php for copyright notices and details.
  12  */
  13  
  14  // no direct access
  15  defined( '_VALID_MOS' ) or die( 'Restricted access' );
  16  
  17  if ($mosConfig_sef) {
  18      $url_array = explode('/', $_SERVER['REQUEST_URI']);
  19  
  20      if (in_array('content', $url_array)) {
  21  
  22          /**
  23          * Content
  24          * http://www.domain.com/$option/$task/$sectionid/$id/$Itemid/$limit/$limitstart
  25          */
  26  
  27          $uri                 = explode('content/', $_SERVER['REQUEST_URI']);
  28          $option             = 'com_content';
  29          $_GET['option']     = $option;
  30          $_REQUEST['option'] = $option;
  31          $pos                 = array_search ('content', $url_array);
  32  
  33          // language hook for content
  34          $lang = '';
  35          foreach($url_array as $key=>$value) {
  36              if ( !strcasecmp(substr($value,0,5),'lang,') ) {
  37                  $temp = explode(',', $value);
  38                  if (isset($temp[0]) && $temp[0] != '' && isset($temp[1]) && $temp[1] != '') {
  39                      $_GET['lang']         = $temp[1];
  40                      $_REQUEST['lang']     = $temp[1];
  41                      $lang                 = $temp[1];
  42                  }
  43                  unset($url_array[$key]);
  44              }
  45          }
  46  
  47          if (isset($url_array[$pos+8]) && $url_array[$pos+8] != '' && in_array('category', $url_array) && ( strpos( $url_array[$pos+5], 'order,' ) !== false ) && ( strpos( $url_array[$pos+6], 'filter,' ) !== false ) ) {
  48              // $option/$task/$sectionid/$id/$Itemid/$order/$filter/$limit/$limitstart
  49              $task                     = $url_array[$pos+1];
  50              $sectionid                = $url_array[$pos+2];
  51              $id                     = $url_array[$pos+3];
  52              $Itemid                 = $url_array[$pos+4];
  53              $order                     = str_replace( 'order,', '', $url_array[$pos+5] );
  54              $filter                    = str_replace( 'filter,', '', $url_array[$pos+6] );
  55              $limit                     = $url_array[$pos+7];
  56              $limitstart             = $url_array[$pos+8];
  57  
  58              // pass data onto global variables
  59              $_GET['task']             = $task;
  60              $_REQUEST['task']         = $task;
  61              $_GET['sectionid']         = $sectionid;
  62              $_REQUEST['sectionid']     = $sectionid;
  63              $_GET['id']             = $id;
  64              $_REQUEST['id']         = $id;
  65              $_GET['Itemid']         = $Itemid;
  66              $_REQUEST['Itemid']     = $Itemid;
  67              $_GET['order']             = $order;
  68              $_REQUEST['order']         = $order;
  69              $_GET['filter']         = $filter;
  70              $_REQUEST['filter']     = $filter;
  71              $_GET['limit']             = $limit;
  72              $_REQUEST['limit']         = $limit;
  73              $_GET['limitstart']     = $limitstart;
  74              $_REQUEST['limitstart'] = $limitstart;
  75  
  76              $QUERY_STRING = "option=com_content&task=$task&sectionid=$sectionid&id=$id&Itemid=$Itemid&order=$order&filter=$filter&limit=$limit&limitstart=$limitstart";
  77          } else if (isset($url_array[$pos+7]) && $url_array[$pos+7] != '' && $url_array[$pos+5] > 1000 && ( in_array('archivecategory', $url_array) || in_array('archivesection', $url_array) ) ) {
  78              // $option/$task/$id/$limit/$limitstart/year/month/module
  79              $task                     = $url_array[$pos+1];
  80              $id                        = $url_array[$pos+2];
  81              $limit                     = $url_array[$pos+3];
  82              $limitstart             = $url_array[$pos+4];
  83              $year                     = $url_array[$pos+5];
  84              $month                     = $url_array[$pos+6];
  85              $module                    = $url_array[$pos+7];
  86  
  87              // pass data onto global variables
  88              $_GET['task']             = $task;
  89              $_REQUEST['task']         = $task;
  90              $_GET['id']             = $id;
  91              $_REQUEST['id']         = $id;
  92              $_GET['limit']             = $limit;
  93              $_REQUEST['limit']         = $limit;
  94              $_GET['limitstart']     = $limitstart;
  95              $_REQUEST['limitstart'] = $limitstart;
  96              $_GET['year']             = $year;
  97              $_REQUEST['year']         = $year;
  98              $_GET['month']             = $month;
  99              $_REQUEST['month']         = $month;
 100              $_GET['module']            = $module;
 101              $_REQUEST['module']        = $module;
 102  
 103              $QUERY_STRING = "option=com_content&task=$task&id=$id&limit=$limit&limitstart=$limitstart&year=$year&month=$month&module=$module";
 104          } else if (isset($url_array[$pos+7]) && $url_array[$pos+7] != '' && $url_array[$pos+6] > 1000 && ( in_array('archivecategory', $url_array) || in_array('archivesection', $url_array) ) ) {
 105              // $option/$task/$id/$Itemid/$limit/$limitstart/year/month
 106              $task                     = $url_array[$pos+1];
 107              $id                        = $url_array[$pos+2];
 108              $Itemid                 = $url_array[$pos+3];
 109              $limit                     = $url_array[$pos+4];
 110              $limitstart             = $url_array[$pos+5];
 111              $year                     = $url_array[$pos+6];
 112              $month                     = $url_array[$pos+7];
 113  
 114              // pass data onto global variables
 115              $_GET['task']             = $task;
 116              $_REQUEST['task']         = $task;
 117              $_GET['id']             = $id;
 118              $_REQUEST['id']         = $id;
 119              $_GET['Itemid']         = $Itemid;
 120              $_REQUEST['Itemid']     = $Itemid;
 121              $_GET['limit']             = $limit;
 122              $_REQUEST['limit']         = $limit;
 123              $_GET['limitstart']     = $limitstart;
 124              $_REQUEST['limitstart'] = $limitstart;
 125              $_GET['year']             = $year;
 126              $_REQUEST['year']         = $year;
 127              $_GET['month']             = $month;
 128              $_REQUEST['month']         = $month;
 129  
 130              $QUERY_STRING = "option=com_content&task=$task&id=$id&Itemid=$Itemid&limit=$limit&limitstart=$limitstart&year=$year&month=$month";
 131          } else if (isset($url_array[$pos+7]) && $url_array[$pos+7] != '' && in_array('category', $url_array) && ( strpos( $url_array[$pos+5], 'order,' ) !== false )) {
 132              // $option/$task/$sectionid/$id/$Itemid/$order/$limit/$limitstart
 133              $task                     = $url_array[$pos+1];
 134              $sectionid                = $url_array[$pos+2];
 135              $id                     = $url_array[$pos+3];
 136              $Itemid                 = $url_array[$pos+4];
 137              $order                     = str_replace( 'order,', '', $url_array[$pos+5] );
 138              $limit                     = $url_array[$pos+6];
 139              $limitstart             = $url_array[$pos+7];
 140  
 141              // pass data onto global variables
 142              $_GET['task']             = $task;
 143              $_REQUEST['task']         = $task;
 144              $_GET['sectionid']         = $sectionid;
 145              $_REQUEST['sectionid']     = $sectionid;
 146              $_GET['id']             = $id;
 147              $_REQUEST['id']         = $id;
 148              $_GET['Itemid']         = $Itemid;
 149              $_REQUEST['Itemid']     = $Itemid;
 150              $_GET['order']             = $order;
 151              $_REQUEST['order']         = $order;
 152              $_GET['limit']             = $limit;
 153              $_REQUEST['limit']         = $limit;
 154              $_GET['limitstart']     = $limitstart;
 155              $_REQUEST['limitstart'] = $limitstart;
 156  
 157              $QUERY_STRING = "option=com_content&task=$task&sectionid=$sectionid&id=$id&Itemid=$Itemid&order=$order&limit=$limit&limitstart=$limitstart";
 158          } else if (isset($url_array[$pos+6]) && $url_array[$pos+6] != '') {
 159          // $option/$task/$sectionid/$id/$Itemid/$limit/$limitstart
 160              $task                     = $url_array[$pos+1];
 161              $sectionid                = $url_array[$pos+2];
 162              $id                     = $url_array[$pos+3];
 163              $Itemid                 = $url_array[$pos+4];
 164              $limit                     = $url_array[$pos+5];
 165              $limitstart             = $url_array[$pos+6];
 166  
 167              // pass data onto global variables
 168              $_GET['task']             = $task;
 169              $_REQUEST['task']         = $task;
 170              $_GET['sectionid']         = $sectionid;
 171              $_REQUEST['sectionid']     = $sectionid;
 172              $_GET['id']             = $id;
 173              $_REQUEST['id']         = $id;
 174              $_GET['Itemid']         = $Itemid;
 175              $_REQUEST['Itemid']     = $Itemid;
 176              $_GET['limit']             = $limit;
 177              $_REQUEST['limit']         = $limit;
 178              $_GET['limitstart']     = $limitstart;
 179              $_REQUEST['limitstart'] = $limitstart;
 180  
 181              $QUERY_STRING = "option=com_content&task=$task&sectionid=$sectionid&id=$id&Itemid=$Itemid&limit=$limit&limitstart=$limitstart";
 182          } else if (isset($url_array[$pos+5]) && $url_array[$pos+5] != '') {
 183          // $option/$task/$id/$Itemid/$limit/$limitstart
 184              $task                     = $url_array[$pos+1];
 185              $id                     = $url_array[$pos+2];
 186              $Itemid                 = $url_array[$pos+3];
 187              $limit                     = $url_array[$pos+4];
 188              $limitstart             = $url_array[$pos+5];
 189  
 190              // pass data onto global variables
 191              $_GET['task']             = $task;
 192              $_REQUEST['task']         = $task;
 193              $_GET['id']             = $id;
 194              $_REQUEST['id']         = $id;
 195              $_GET['Itemid']         = $Itemid;
 196              $_REQUEST['Itemid']     = $Itemid;
 197              $_GET['limit']             = $limit;
 198              $_REQUEST['limit']         = $limit;
 199              $_GET['limitstart']     = $limitstart;
 200              $_REQUEST['limitstart'] = $limitstart;
 201  
 202              $QUERY_STRING = "option=com_content&task=$task&id=$id&Itemid=$Itemid&limit=$limit&limitstart=$limitstart";
 203          } else if (isset($url_array[$pos+4]) && $url_array[$pos+4] != '' && ( in_array('archivecategory', $url_array) || in_array('archivesection', $url_array) )) {
 204          // $option/$task/$year/$month/$module
 205              $task                     = $url_array[$pos+1];
 206              $year                     = $url_array[$pos+2];
 207              $month                     = $url_array[$pos+3];
 208              $module                 = $url_array[$pos+4];
 209  
 210              // pass data onto global variables
 211              $_GET['task']             = $task;
 212              $_REQUEST['task']         = $task;
 213              $_GET['year']             = $year;
 214              $_REQUEST['year']         = $year;
 215              $_GET['month']             = $month;
 216              $_REQUEST['month']         = $month;
 217              $_GET['module']         = $module;
 218              $_REQUEST['module']        = $module;
 219  
 220              $QUERY_STRING = "option=com_content&task=$task&year=$year&month=$month&module=$module";
 221          } else if (!(isset($url_array[$pos+5]) && $url_array[$pos+5] != '') && isset($url_array[$pos+4]) && $url_array[$pos+4] != '') {
 222          // $option/$task/$sectionid/$id/$Itemid
 223              $task                     = $url_array[$pos+1];
 224              $sectionid                 = $url_array[$pos+2];
 225              $id                     = $url_array[$pos+3];
 226              $Itemid                 = $url_array[$pos+4];
 227  
 228              // pass data onto global variables
 229              $_GET['task']             = $task;
 230              $_REQUEST['task']         = $task;
 231              $_GET['sectionid']         = $sectionid;
 232              $_REQUEST['sectionid']     = $sectionid;
 233              $_GET['id']             = $id;
 234              $_REQUEST['id']         = $id;
 235              $_GET['Itemid']         = $Itemid;
 236              $_REQUEST['Itemid']     = $Itemid;
 237  
 238              $QUERY_STRING = "option=com_content&task=$task&sectionid=$sectionid&id=$id&Itemid=$Itemid";
 239          } else if (!(isset($url_array[$pos+4]) && $url_array[$pos+4] != '') && (isset($url_array[$pos+3]) && $url_array[$pos+3] != '')) {
 240          // $option/$task/$id/$Itemid
 241              $task                     = $url_array[$pos+1];
 242              $id                     = $url_array[$pos+2];
 243              $Itemid                 = $url_array[$pos+3];
 244  
 245              // pass data onto global variables
 246              $_GET['task']             = $task;
 247              $_REQUEST['task']         = $task;
 248              $_GET['id']             = $id;
 249              $_REQUEST['id']         = $id;
 250              $_GET['Itemid']         = $Itemid;
 251              $_REQUEST['Itemid']     = $Itemid;
 252  
 253              $QUERY_STRING = "option=com_content&task=$task&id=$id&Itemid=$Itemid";
 254          } else if (!(isset($url_array[$pos+3]) && $url_array[$pos+3] != '') && (isset($url_array[$pos+2]) && $url_array[$pos+2] != '')) {
 255          // $option/$task/$id
 256              $task                     = $url_array[$pos+1];
 257              $id                     = $url_array[$pos+2];
 258  
 259              // pass data onto global variables
 260              $_GET['task']             = $task;
 261              $_REQUEST['task']         = $task;
 262              $_GET['id']             = $id;
 263              $_REQUEST['id']         = $id;
 264  
 265              $QUERY_STRING = "option=com_content&task=$task&id=$id";
 266          } else if (!(isset($url_array[$pos+2]) && $url_array[$pos+2] != '') && (isset($url_array[$pos+1]) && $url_array[$pos+1] != '')) {
 267          // $option/$task
 268              $task = $url_array[$pos+1];
 269  
 270              $_GET['task']             = $task;
 271              $_REQUEST['task']         = $task;
 272  
 273              $QUERY_STRING = 'option=com_content&task='. $task;
 274          }
 275  
 276          if ($lang!='') {
 277              $QUERY_STRING .= '&amp;lang='. $lang;
 278          }
 279  
 280          $_SERVER['QUERY_STRING']     = $QUERY_STRING;
 281          $REQUEST_URI                 = $uri[0].'index.php?'.$QUERY_STRING;
 282          $_SERVER['REQUEST_URI']     = $REQUEST_URI;
 283  
 284      } else if (in_array('component', $url_array)) {
 285  
 286          /*
 287          Components
 288          http://www.domain.com/component/$name,$value
 289          */
 290          $uri = explode('component/', $_SERVER['REQUEST_URI']);
 291          $uri_array = explode('/', $uri[1]);
 292          $QUERY_STRING = '';
 293  
 294          // needed for check if component exists
 295          $path         = $mosConfig_absolute_path .'/components';
 296          $dirlist     = array();
 297          if ( is_dir( $path ) ) {
 298              $base = opendir( $path );
 299              while (false !== ( $dir = readdir($base) ) ) {
 300                  if ($dir !== '.' && $dir !== '..' && is_dir($path .'/'. $dir) && strtolower($dir) !== 'cvs' && strtolower($dir) !== '.svn') {
 301                      $dirlist[] = $dir;
 302                  }
 303              }
 304              closedir($base);
 305          }
 306  
 307          foreach($uri_array as $value) {
 308              $temp = explode(',', $value);
 309              if (isset($temp[0]) && $temp[0]!='' && isset($temp[1]) && $temp[1]!='') {
 310                  $_GET[$temp[0]]     = $temp[1];
 311                  $_REQUEST[$temp[0]] = $temp[1];
 312  
 313                  // check to ensure component actually exists
 314                  if ( $temp[0] == 'option' ) {
 315                      $check = '';
 316                      if (count( $dirlist )) {
 317                          foreach ( $dirlist as $dir ) {
 318                              if ( $temp[1] == $dir ) {
 319                                  $check = 1;
 320                                  break;
 321                              }
 322                          }
 323                      }
 324                      // redirect to 404 page if no component found to match url
 325                      if ( !$check ) {
 326                          header( 'HTTP/1.0 404 Not Found' );
 327                          require_once ( $mosConfig_absolute_path . '/templates/404.php' );
 328                          exit( 404 );
 329                      }
 330                  }
 331  
 332                  if ( $QUERY_STRING == '' ) {
 333                      $QUERY_STRING .= "$temp[0]=$temp[1]";
 334                  } else {
 335                      $QUERY_STRING .= "&$temp[0]=$temp[1]";
 336                  }
 337              }
 338          }
 339  
 340          $_SERVER['QUERY_STRING']     = $QUERY_STRING;
 341          $REQUEST_URI                 = $uri[0].'index.php?'.$QUERY_STRING;
 342          $_SERVER['REQUEST_URI']     = $REQUEST_URI;
 343  
 344          if (defined('RG_EMULATION') && RG_EMULATION == 1) {
 345              // Extract to globals
 346              while(list($key,$value)=each($_GET)) {
 347                  if ($key!="GLOBALS") {
 348                      $GLOBALS[$key]=$value;
 349                  }
 350              }
 351              // Don't allow config vars to be passed as global
 352              include( 'configuration.php' );
 353  
 354              // SSL check - $http_host returns <live site url>:<port number if it is 443>
 355              $http_host = explode(':', $_SERVER['HTTP_HOST'] );
 356              if( (!empty( $_SERVER['HTTPS'] ) && strtolower( $_SERVER['HTTPS'] ) != 'off' || isset( $http_host[1] ) && $http_host[1] == 443) && substr( $mosConfig_live_site, 0, 8 ) != 'https://' ) {
 357                  $mosConfig_live_site = 'https://'.substr( $mosConfig_live_site, 7 );
 358              }
 359          }
 360  
 361      } else {
 362  
 363          /*
 364          Unknown content
 365          http://www.domain.com/unknown
 366          */
 367          $jdir = str_replace( 'index.php', '', $_SERVER['PHP_SELF'] );
 368          $juri = str_replace( $jdir, '', $_SERVER['REQUEST_URI'] );
 369  
 370          if ($juri != '' && $juri != '/' && !eregi( "index\.php", $_SERVER['REQUEST_URI'] ) && !eregi( "index2\.php", $_SERVER['REQUEST_URI'] ) && !eregi( "/\?", $_SERVER['REQUEST_URI'] ) && $_SERVER['QUERY_STRING'] == '' ) {
 371              header( 'HTTP/1.0 404 Not Found' );
 372              require_once ( $mosConfig_absolute_path . '/templates/404.php' );
 373              exit( 404 );
 374          }
 375      }
 376  }
 377  
 378  /**
 379   * Converts an absolute URL to SEF format
 380   * @param string The URL
 381   * @return string
 382   */
 383  function sefRelToAbs( $string ) {
 384      global $mosConfig_live_site, $mosConfig_sef, $mosConfig_multilingual_support;
 385      global $iso_client_lang;
 386  
 387      //multilingual code url support
 388      if( $mosConfig_sef && $mosConfig_multilingual_support && $string!='index.php' && !eregi("^(([^:/?#]+):)",$string) && !strcasecmp(substr($string,0,9),'index.php') && !eregi('lang=', $string) ) {
 389          $string .= '&amp;lang='. $iso_client_lang;
 390      }
 391  
 392      // SEF URL Handling
 393      if ($mosConfig_sef && !eregi("^(([^:/?#]+):)",$string) && !strcasecmp(substr($string,0,9),'index.php')) {
 394          // Replace all &amp; with &
 395          $string = str_replace( '&amp;', '&', $string );
 396  
 397          // Home index.php
 398          if ($string == 'index.php') {
 399              $string = '';
 400          }
 401  
 402          // break link into url component parts
 403          $url = parse_url( $string );
 404  
 405          // check if link contained fragment identifiers (ex. #foo)
 406          $fragment = '';
 407          if ( isset($url['fragment']) ) {
 408              // ensure fragment identifiers are compatible with HTML4
 409              if (preg_match('@^[A-Za-z][A-Za-z0-9:_.-]*$@', $url['fragment'])) {
 410                  $fragment = '#'. $url['fragment'];
 411              }
 412          }
 413  
 414          // check if link contained a query component
 415          if ( isset($url['query']) ) {
 416              // special handling for javascript
 417              $url['query'] = stripslashes( str_replace( '+', '%2b', $url['query'] ) );
 418              // clean possible xss attacks
 419              $url['query'] = preg_replace( "'%3Cscript[^%3E]*%3E.*?%3C/script%3E'si", '', $url['query'] );
 420  
 421              // break url into component parts
 422              parse_str( $url['query'], $parts );
 423  
 424              // special handling for javascript
 425              foreach( $parts as $key => $value) {
 426                  if ( strpos( $value, '+' ) !== false ) {
 427                      $parts[$key] = stripslashes( str_replace( '%2b', '+', $value ) );
 428                  }
 429              }
 430              //var_dump($parts);
 431              $sefstring = '';
 432  
 433              // Component com_content urls
 434              if ( ( ( isset($parts['option']) && ( $parts['option'] == 'com_content' || $parts['option'] == 'content' ) ) ) && ( $parts['task'] != 'new' ) && ( $parts['task'] != 'edit' ) ) {
 435              // index.php?option=com_content [&task=$task] [&sectionid=$sectionid] [&id=$id] [&Itemid=$Itemid] [&limit=$limit] [&limitstart=$limitstart] [&year=$year] [&month=$month] [&module=$module]
 436                  $sefstring .= 'content/';
 437  
 438                  // task
 439                  if ( isset( $parts['task'] ) ) {
 440                      $sefstring .= $parts['task'].'/';
 441                  }
 442                  // sectionid
 443                  if ( isset( $parts['sectionid'] ) ) {
 444                      $sefstring .= $parts['sectionid'].'/';
 445                  }
 446                  // id
 447                  if ( isset( $parts['id'] ) ) {
 448                      $sefstring .= $parts['id'].'/';
 449                  }
 450                  // Itemid
 451                  if ( isset( $parts['Itemid'] ) ) {
 452                      //only add Itemid value if it does not correspond with the 'unassigned' Itemid value
 453                      if ( $parts['Itemid'] != 99999999 && $parts['Itemid'] != 0 ) {
 454                          $sefstring .= $parts['Itemid'].'/';
 455                      }
 456                  }
 457                  // order
 458                  if ( isset( $parts['order'] ) ) {
 459                      $sefstring .= 'order,'. $parts['order'].'/';
 460                  }
 461                  // filter
 462                  if ( isset( $parts['filter'] ) ) {
 463                      $sefstring .= 'filter,'. $parts['filter'].'/';
 464                  }
 465                  // limit
 466                  if ( isset( $parts['limit'] ) ) {
 467                      $sefstring .= $parts['limit'].'/';
 468                  }
 469                  // limitstart
 470                  if ( isset( $parts['limitstart'] ) ) {
 471                      $sefstring .= $parts['limitstart'].'/';
 472                  }
 473                  // year
 474                  if ( isset( $parts['year'] ) ) {
 475                      $sefstring .= $parts['year'].'/';
 476                  }
 477                  // month
 478                  if ( isset( $parts['month'] ) ) {
 479                      $sefstring .= $parts['month'].'/';
 480                  }
 481                  // module
 482                  if ( isset( $parts['module'] ) ) {
 483                      $sefstring .= $parts['module'].'/';
 484                  }
 485                  // lang
 486                  if ( isset( $parts['lang'] ) ) {
 487                      $sefstring .= 'lang,'. $parts['lang'].'/';
 488                  }
 489  
 490                  $string = $sefstring;
 491  
 492              // all other components
 493              // index.php?option=com_xxxx &...
 494              } else if ( isset($parts['option']) && ( strpos($parts['option'], 'com_' ) !== false ) ) {
 495                  // do not SEF where com_content - `edit` or `new` task link
 496                  if ( !( ( $parts['option'] == 'com_content' ) && ( ( isset($parts['task']) == 'new' ) || ( isset($parts['task']) == 'edit' ) ) ) ) {
 497                      $sefstring     = 'component/';
 498  
 499                      foreach($parts as $key => $value) {
 500                          // remove slashes automatically added by parse_str
 501                          $value        = stripslashes($value);
 502                          $sefstring .= $key .','. $value.'/';
 503                      }
 504  
 505                      $string = str_replace( '=', ',', $sefstring );
 506                  }
 507              }
 508          // no query given. Empty $string to get only the fragment
 509          // index.php#anchor or index.php?#anchor
 510          } else {
 511              $string = '';
 512          }
 513  
 514          // allows SEF without mod_rewrite
 515          // comment line below if you dont have mod_rewrite
 516          return $mosConfig_live_site .'/'. $string . $fragment;
 517  
 518          // allows SEF without mod_rewrite
 519          // uncomment Line 512 and comment out Line 514
 520  
 521          // uncomment line below if you dont have mod_rewrite
 522          // return $mosConfig_live_site .'/index.php/'. $string . $fragment;
 523          // If the above doesnt work - try uncommenting this line instead
 524          // return $mosConfig_live_site .'/index.php?/'. $string . $fragment;
 525      } else {
 526      // Handling for when SEF is not activated
 527          // Relative link handling
 528          if ( (strpos( $string, $mosConfig_live_site ) !== 0) ) {
 529              // if URI starts with a "/", means URL is at the root of the host...
 530              if (strncmp($string, '/', 1) == 0) {
 531                  // splits http(s)://xx.xx/yy/zz..." into [1]="http(s)://xx.xx" and [2]="/yy/zz...":
 532                  $live_site_parts = array();
 533                  eregi("^(https?:[\/]+[^\/]+)(.*$)", $mosConfig_live_site, $live_site_parts);
 534  
 535                  $string = $live_site_parts[1] . $string;
 536              } else {
 537                  $check = 1;
 538  
 539                  // array list of non http/https    URL schemes
 540                  $url_schemes     = explode( ', ', _URL_SCHEMES );
 541                  $url_schemes[]     = 'http:';
 542                  $url_schemes[]     = 'https:';
 543  
 544                  foreach ( $url_schemes as $url ) {
 545                      if ( strpos( $string, $url ) === 0 ) {
 546                          $check = 0;
 547                      }
 548                  }
 549  
 550                  if ( $check ) {
 551                      $string = $mosConfig_live_site .'/'. $string;
 552                  }
 553              }
 554          }
 555  
 556          return $string;
 557      }
 558  }
 559  ?>


Généré le : Wed Nov 21 14:43:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics