| 7 |
* Mambo is Free Software |
* Mambo is Free Software |
| 8 |
*/ |
*/ |
| 9 |
|
|
| 10 |
/** ensure this file is being included by a parent file */ |
class mosSEF { |
|
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); |
|
| 11 |
|
|
| 12 |
if ($mosConfig_sef) sefParseUrl(config_register_globals()); |
var $custom_code = array(); |
| 13 |
|
var $custom_name = array(); |
| 14 |
|
var $custom_PHP = array(); |
| 15 |
|
var $custom_short = array(); |
| 16 |
|
var $sef_content_task = array(); |
| 17 |
|
var $sef_name_chars = array(); |
| 18 |
|
var $sef_translate_chars = array(); |
| 19 |
|
var $content_data = null; |
| 20 |
|
var $content_items = array(); |
| 21 |
|
var $content_sections = array(); |
| 22 |
|
var $content_categories = array(); |
| 23 |
|
var $SEF_SPACE; |
| 24 |
|
|
| 25 |
|
function mosSEF () { |
| 26 |
|
/******************************************************************************* |
| 27 |
|
** The following are parameters for the ReMOSef Search Engine |
| 28 |
|
** Optimisation component. $this->SEF_SPACE should be set to the |
| 29 |
|
** character that is to replace blanks in names that form the URL. |
| 30 |
|
** You can vary this, although the only sensible choices seem to be |
| 31 |
|
** underscore or hyphen (_ or -). |
| 32 |
|
** |
| 33 |
|
** The arrays $this->custom_code and $this->custom_name must be kept exactly |
| 34 |
|
** in step with each other. $this->custom_code is a list of the components |
| 35 |
|
** that are to be handled by ReMOSef. |
| 36 |
|
** |
| 37 |
|
** The array $this->custom_name is the alternative name that will be used |
| 38 |
|
** in the optimised URL to identify the component and can be whatever |
| 39 |
|
** you please so long as it is unique and legal for a URL. Apart from |
| 40 |
|
** using the custom name for the component, ReMOSef will do no further |
| 41 |
|
** translation of the URL than is done by the standard Mambo SEF - UNLESS |
| 42 |
|
** there is a sef_ext.php file installed for that component. The |
| 43 |
|
** exception to this is ReMOSitory - the optimisation code for Remository |
| 44 |
|
** is integrated in ReMOSef. For other components, if a sef_ext.php is |
| 45 |
|
** present, it will be invoked by ReMOSef. |
| 46 |
|
** |
| 47 |
|
|
| 48 |
|
** The array $remosef_content_task is capable of translating the tasks |
| 49 |
|
** understood by the Mambo content component. Please DO NOT CHANGE what |
| 50 |
|
** is to the left of the equals sign. When putting different values on |
| 51 |
|
** the right hand side, remember that they must all be different, and must |
| 52 |
|
** also be different from any of the custom names used for components. |
| 53 |
|
** Without that, Remosef cannot figure out what a SEF URL means and will |
| 54 |
|
** give unpredictable results. |
| 55 |
|
*******************************************************************************/ |
| 56 |
|
$this->SEF_SPACE = "_"; // divide words with underscores |
| 57 |
|
// can be changed to a hyphen "-" |
| 58 |
|
$this->custom_code = array('com_remository','com_simpleboard','com_frontpage','com_contact','com_mrecommend','com_graphitory'); |
| 59 |
|
$this->custom_name = array('Remository','Forum','Frontpage','Contact_Us','Recommend_Us','Graphitory'); |
| 60 |
|
/******************************************************************************* |
| 61 |
|
** The following are the parameters for the optional content specific |
| 62 |
|
** URL optimisation. |
| 63 |
|
** |
| 64 |
|
** The following two lines define the translations that SEF will perform on |
| 65 |
|
** names of sections and categories when translating them for inclusion in a URL. |
| 66 |
|
** Each item in $this->sef_name_chars is translated into the corresponding |
| 67 |
|
** element of $this->sef_translate_chars. |
| 68 |
|
** |
| 69 |
|
** NOTE it is important that space be the last translate character, since the |
| 70 |
|
** characters are processed in the order in which they appear. Since earlier |
| 71 |
|
** translates may create new spaces, it is vital that the space translation is |
| 72 |
|
** done last. |
| 73 |
|
** |
| 74 |
|
** You can extend these arrays as you wish, although it is obviously important |
| 75 |
|
** to make sure that the items of one match the items of the other exactly. |
| 76 |
|
*******************************************************************************/ |
| 77 |
|
$this->sef_name_chars = array('&', '/', ' '); |
| 78 |
|
$this->sef_translate_chars = array('and', ' or ', $this->SEF_SPACE); |
| 79 |
|
|
| 80 |
|
/************** DO NOT MAKE CHANGES PAST HERE EXCEPT AT YOUR OWN RISK! ********************/ |
| 81 |
|
|
| 82 |
|
foreach ($this->custom_code as $code) { |
| 83 |
|
$codefile = "components/$code/sef_ext.php"; |
| 84 |
|
if (file_exists($codefile)) { |
| 85 |
|
include ($codefile); |
| 86 |
|
$this->custom_PHP[] = true; |
| 87 |
|
} |
| 88 |
|
else $this->custom_PHP[] = false; |
| 89 |
|
$split = explode('_',$code); |
| 90 |
|
$this->custom_short[] = $split[1]; |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
$this->sef_content_task['findkey'] = 'findkey'; |
| 94 |
|
$this->sef_content_task['view'] = 'view'; |
| 95 |
|
$this->sef_content_task['section'] = 'section'; |
| 96 |
|
$this->sef_content_task['category'] = 'category'; |
| 97 |
|
$this->sef_content_task['blogsection'] = 'blogsection'; |
| 98 |
|
$this->sef_content_task['blogcategorymulti'] = 'blogcategorymulti'; |
| 99 |
|
$this->sef_content_task['blogcategory'] = 'blogcategory'; |
| 100 |
|
$this->sef_content_task['archivesection'] = 'archivesection'; |
| 101 |
|
$this->sef_content_task['archivecategory'] = 'archivecategory'; |
| 102 |
|
$this->sef_content_task['save'] = 'save'; |
| 103 |
|
$this->sef_content_task['cancel'] = 'cancel'; |
| 104 |
|
$this->sef_content_task['emailform'] = 'emailform'; |
| 105 |
|
$this->sef_content_task['emailsend'] = 'emailsend'; |
| 106 |
|
$this->sef_content_task['vote'] = 'vote'; |
| 107 |
|
$this->sef_content_task['showblogsection'] = 'showblogsection'; |
| 108 |
|
|
| 109 |
|
} |
| 110 |
|
|
| 111 |
|
function &getInstance () { |
| 112 |
|
static $instance; |
| 113 |
|
if (!is_object($instance)) $instance = new mosSEF(); |
| 114 |
|
return $instance; |
| 115 |
|
} |
| 116 |
|
|
| 117 |
|
function sefRetrieval($register_globals){ |
| 118 |
|
|
|
function sefParseUrl($register_globals){ |
|
|
// prevent globals overwrite via REQUEST_URI |
|
| 119 |
if (preg_match('/(\b)GLOBALS|_REQUEST|_SERVER|_ENV|_COOKIE|_GET|_POST|_FILES|_SESSION(\b)/i', $_SERVER['REQUEST_URI']) > 0) { |
if (preg_match('/(\b)GLOBALS|_REQUEST|_SERVER|_ENV|_COOKIE|_GET|_POST|_FILES|_SESSION(\b)/i', $_SERVER['REQUEST_URI']) > 0) { |
| 120 |
die('Invalid Request'); |
die('Invalid Request'); |
| 121 |
} |
} |
| 122 |
$url_array = explode("/", $_SERVER['REQUEST_URI']); |
if (mamboCore::get('mosConfig_sef')) { |
| 123 |
|
$url_array = explode('/', $_SERVER['REQUEST_URI']); |
| 124 |
/** |
/** |
| 125 |
* Content |
* Content |
| 126 |
* http://www.domain.com/$option/$task/$sectionid/$id/$Itemid/$limit/$limitstart |
* /$option/$task/$sectionid/$id/$Itemid/$limit/$limitstart |
| 127 |
*/ |
*/ |
|
if (in_array("content", $url_array)) { |
|
| 128 |
|
|
| 129 |
$uri = explode("content/", $_SERVER['REQUEST_URI']); |
$foundit = false; |
| 130 |
$option = "com_content"; |
if ($url_array[1] == 'content') { |
| 131 |
$_GET['option'] = $option; |
$foundit = true; |
| 132 |
$_REQUEST['option'] = $option; |
$_REQUEST['option'] = $_GET['option'] = $option = 'com_content'; |
|
$pos = array_search ("content", $url_array); |
|
| 133 |
|
|
| 134 |
// language hook for content |
// language hook for content |
| 135 |
$lang = ""; |
$lang = ""; |
| 136 |
|
$parms = array(); |
| 137 |
foreach($url_array as $key=>$value) { |
foreach($url_array as $key=>$value) { |
| 138 |
if ( !strcasecmp(substr($value,0,5),"lang,") ) { |
if ( strcasecmp(substr($value,0,5),'lang,') == 0 ) { |
| 139 |
$temp = explode(",", $value); |
$parts = explode(",", $value); |
| 140 |
if (isset($temp[0]) && $temp[0]!="" && isset($temp[1]) && $temp[1]!="") { |
if (count($parts) > 1) { |
| 141 |
$_GET['lang'] = $temp[1]; |
$lang = $_REQUEST['lang'] = $_GET['lang'] = $parts[1]; |
|
$_REQUEST['lang'] = $temp[1]; |
|
|
$lang = $temp[1]; |
|
| 142 |
} |
} |
|
unset($url_array[$key]); |
|
| 143 |
} |
} |
| 144 |
|
elseif ( $value != '' AND $key > 1 ) $parms[] = $value; |
| 145 |
} |
} |
| 146 |
|
|
| 147 |
// $option/$task/$sectionid/$id/$Itemid/$limit/$limitstart |
// $option/$task/$sectionid/$id/$Itemid/$limit/$limitstart |
| 148 |
if (isset($url_array[$pos+6]) && $url_array[$pos+6]!="") { |
$task = array_search($parms[0], $this->sef_content_task); |
| 149 |
$task = $url_array[$pos+1]; |
if ($task === false OR $task === null) return 1; |
| 150 |
$sectionid = $url_array[$pos+2]; |
$_REQUEST['task'] = $_GET['task'] = $task; |
|
$id = $url_array[$pos+3]; |
|
|
$Itemid = $url_array[$pos+4]; |
|
|
$limit = $url_array[$pos+5]; |
|
|
$limitstart = $url_array[$pos+6]; |
|
|
$_GET['task'] = $task; |
|
|
$_REQUEST['task'] = $task; |
|
|
$_GET['sectionid'] = $sectionid; |
|
|
$_REQUEST['sectionid'] = $sectionid; |
|
|
$_GET['id'] = $id; |
|
|
$_REQUEST['id'] = $id; |
|
|
$_GET['Itemid'] = $Itemid; |
|
|
$_REQUEST['Itemid'] = $Itemid; |
|
|
$_GET['limit'] = $limit; |
|
|
$_REQUEST['limit'] = $limit; |
|
|
$_GET['limitstart'] = $limitstart; |
|
|
$_REQUEST['limitstart'] = $limitstart; |
|
|
$QUERY_STRING = "option=com_content&task=$task§ionid=$sectionid&id=$id&Itemid=$Itemid&limit=$limit&limitstart=$limitstart"; |
|
|
// $option/$task/$id/$Itemid/$limit/$limitstart |
|
|
} else if (isset($url_array[$pos+5]) && $url_array[$pos+5]!="") { |
|
|
$task = $url_array[$pos+1]; |
|
|
$id = $url_array[$pos+2]; |
|
|
$Itemid = $url_array[$pos+3]; |
|
|
$limit = $url_array[$pos+4]; |
|
|
$limitstart = $url_array[$pos+5]; |
|
|
$_GET['task'] = $task; |
|
|
$_REQUEST['task'] = $task; |
|
|
$_GET['id'] = $id; |
|
|
$_REQUEST['id'] = $id; |
|
|
$_GET['Itemid'] = $Itemid; |
|
|
$_REQUEST['Itemid'] = $Itemid; |
|
|
$_GET['limit'] = $limit; |
|
|
$_REQUEST['limit'] = $limit; |
|
|
$_GET['limitstart'] = $limitstart; |
|
|
$_REQUEST['limitstart'] = $limitstart; |
|
|
$QUERY_STRING = "option=com_content&task=$task&id=$id&Itemid=$Itemid&limit=$limit&limitstart=$limitstart"; |
|
|
// $option/$task/$sectionid/$id/$Itemid |
|
|
} else if (!(isset($url_array[$pos+5]) && $url_array[$pos+5]!="") && isset($url_array[$pos+4]) && $url_array[$pos+4]!="") { |
|
|
$task = $url_array[$pos+1]; |
|
|
$sectionid = $url_array[$pos+2]; |
|
|
$id = $url_array[$pos+3]; |
|
|
$Itemid = $url_array[$pos+4]; |
|
|
$_GET['task'] = $task; |
|
|
$_REQUEST['task'] = $task; |
|
|
$_GET['sectionid'] = $sectionid; |
|
|
$_REQUEST['sectionid'] = $sectionid; |
|
|
$_GET['id'] = $id; |
|
|
$_REQUEST['id'] = $id; |
|
|
$_GET['Itemid'] = $Itemid; |
|
|
$_REQUEST['Itemid'] = $Itemid; |
|
|
$QUERY_STRING = "option=com_content&task=$task§ionid=$sectionid&id=$id&Itemid=$Itemid"; |
|
|
// $option/$task/$id/$Itemid |
|
|
} else if (!(isset($url_array[$pos+4]) && $url_array[$pos+4]!="") && (isset($url_array[$pos+3]) && $url_array[$pos+3]!="")) { |
|
|
$task = $url_array[$pos+1]; |
|
|
$id = $url_array[$pos+2]; |
|
|
$Itemid = $url_array[$pos+3]; |
|
|
$_GET['task'] = $task; |
|
|
$_REQUEST['task'] = $task; |
|
|
$_GET['id'] = $id; |
|
|
$_REQUEST['id'] = $id; |
|
|
$_GET['Itemid'] = $Itemid; |
|
|
$_REQUEST['Itemid'] = $Itemid; |
|
|
$QUERY_STRING = "option=com_content&task=$task&id=$id&Itemid=$Itemid"; |
|
|
// $option/$task/$id |
|
|
} else if (!(isset($url_array[$pos+3]) && $url_array[$pos+3]!="") && (isset($url_array[$pos+2]) && $url_array[$pos+2]!="")) { |
|
|
$task = $url_array[$pos+1]; |
|
|
$id = $url_array[$pos+2]; |
|
|
$_GET['task'] = $task; |
|
|
$_REQUEST['task'] = $task; |
|
|
$_GET['id'] = $id; |
|
|
$_REQUEST['id'] = $id; |
|
|
$QUERY_STRING = "option=com_content&task=$task&id=$id"; |
|
|
// $option/$task |
|
|
} else if (!(isset($url_array[$pos+2]) && $url_array[$pos+2]!="") && (isset($url_array[$pos+1]) && $url_array[$pos+1]!="")) { |
|
|
$task = $url_array[$pos+1]; |
|
|
$_GET['task'] = $task; |
|
|
$_REQUEST['task'] = $task; |
|
| 151 |
$QUERY_STRING = "option=com_content&task=$task"; |
$QUERY_STRING = "option=com_content&task=$task"; |
| 152 |
|
$num = count($parms); |
| 153 |
|
for ($i = 1; $i <= $num-1; $i++) { |
| 154 |
|
if (strcmp($parms[$i], (int)$parms[$i]) !== 0) return 1; |
| 155 |
|
} |
| 156 |
|
$i = 1; |
| 157 |
|
if ($num == 6 OR $num == 4) { |
| 158 |
|
$_REQUEST['sectionid'] = $_GET['sectionid'] = $sectionid = $parms[$i]; |
| 159 |
|
$QUERY_STRING .= "§ionid=$sectionid"; |
| 160 |
|
$i++; |
| 161 |
|
} |
| 162 |
|
if ($num > 1) { |
| 163 |
|
$_REQUEST['id'] = $_GET['id'] = $id = $parms[$i]; |
| 164 |
|
$QUERY_STRING .= "&id=$id"; |
| 165 |
|
} |
| 166 |
|
if ($num > 2) { |
| 167 |
|
$_REQUEST['Itemid'] = $_GET['Itemid'] = $Itemid = $parms[$i+1]; |
| 168 |
|
mamboCore::set('Itemid',$Itemid); |
| 169 |
|
$QUERY_STRING .= "&Itemid=$Itemid"; |
| 170 |
|
} |
| 171 |
|
if ($num > 4) { |
| 172 |
|
$_REQUEST['limit'] = $_GET['limit'] = $limit = $parms[$i+2]; |
| 173 |
|
$_REQUEST['limitstart'] = $_GET['limitstart'] = $limitstart = $parms[$i+3]; |
| 174 |
|
$QUERY_STRING .= "&limit=$limit&limitstart=$limitstart"; |
| 175 |
} |
} |
| 176 |
|
|
| 177 |
if ($lang!="") { |
if ($lang!="") { |
| 178 |
$QUERY_STRING .= "&lang=$lang"; |
$QUERY_STRING .= "&lang=$lang"; |
| 179 |
} |
} |
|
|
|
|
$_SERVER['QUERY_STRING'] = $QUERY_STRING; |
|
|
$REQUEST_URI = $uri[0]."index.php?".$QUERY_STRING; |
|
|
$_SERVER['REQUEST_URI'] = $REQUEST_URI; |
|
| 180 |
} |
} |
| 181 |
|
|
| 182 |
/* |
/* |
| 183 |
Components |
Components |
| 184 |
http://www.domain.com/component/$name,$value |
http://www.domain.com/component/$name,$value |
| 185 |
*/ |
*/ |
| 186 |
if (in_array("component", $url_array)) { |
elseif ($url_array[1] == 'component') { |
| 187 |
|
$foundit = true; |
| 188 |
$uri = explode("component/", $_SERVER['REQUEST_URI']); |
$QUERY_STRING = $this->default_revert('component'); |
| 189 |
$uri_array = explode("/", $uri[1]); |
} |
| 190 |
$QUERY_STRING = ""; |
else { |
| 191 |
|
$menuhandler = mosMenuHandler::getInstance(); |
| 192 |
foreach($uri_array as $value) { |
foreach ($this->custom_name as $i=>$compname) { |
| 193 |
$temp = explode(",", $value); |
if ($url_array[1] == $compname) { |
| 194 |
if (isset($temp[0]) && $temp[0]!="" && isset($temp[1]) && $temp[1]!="") { |
$foundit = true; |
| 195 |
$_GET[$temp[0]] = $temp[1]; |
$origname = $this->custom_code[$i]; |
| 196 |
$_REQUEST[$temp[0]] = $temp[1]; |
$_REQUEST['Itemid'] = $_GET['Itemid'] = $Itemid = $menuhandler->getIDLikeLink("index.php?option=$origname"); |
| 197 |
$QUERY_STRING .= $temp[0]=="option" ? "$temp[0]=$temp[1]" : "&$temp[0]=$temp[1]"; |
mamboCore::set('Itemid', $Itemid); |
| 198 |
|
if ($this->custom_PHP[$i]) { |
| 199 |
|
$fixup = '$QUERY_STRING = "option='.$origname.'&Itemid=".$Itemid.sef_'.$this->custom_short[$i].'::revert($url_array,0);'; |
| 200 |
|
eval($fixup); |
| 201 |
|
} |
| 202 |
|
else $QUERY_STRING = "option=$origname&Itemid=$Itemid".$this->default_revert($compname); |
| 203 |
|
$_REQUEST['option'] = $this->custom_code[$i]; |
| 204 |
|
break; |
| 205 |
|
} |
| 206 |
|
} |
| 207 |
|
if (!$foundit) { |
| 208 |
|
$content_sef = mamboCore::get('mosConfig_absolute_path').'/components/com_content/sef_ext.php'; |
| 209 |
|
if (file_exists($content_sef)) { |
| 210 |
|
require_once($content_sef); |
| 211 |
|
$QUERY_STRING = sef_content::revert($url_array,0); |
| 212 |
|
if ($QUERY_STRING) $foundit = true; |
| 213 |
|
} |
| 214 |
} |
} |
| 215 |
} |
} |
| 216 |
|
|
| 217 |
|
if ($foundit) { |
| 218 |
$_SERVER['QUERY_STRING'] = $QUERY_STRING; |
$_SERVER['QUERY_STRING'] = $QUERY_STRING; |
| 219 |
$REQUEST_URI = $uri[0]."index.php?".$QUERY_STRING; |
$REQUEST_URI = '/index.php?'.$QUERY_STRING; |
| 220 |
$_SERVER['REQUEST_URI'] = $REQUEST_URI; |
$_SERVER['REQUEST_URI'] = $REQUEST_URI; |
| 221 |
|
return 0; |
| 222 |
|
} |
| 223 |
|
else return 1; |
| 224 |
|
} |
| 225 |
} |
} |
| 226 |
|
|
| 227 |
if ($register_globals) { |
function default_revert ($specialname) { |
| 228 |
// Extract to globals |
$request = explode($specialname.'/', $_SERVER['REQUEST_URI']); |
| 229 |
while(list($key,$value)=each($_GET)) { |
if (isset($request[1])) $parmset = explode("/", $request[1]); |
| 230 |
if (!isset($GLOBALS[$key])) $GLOBALS[$key]=$value; |
else $parmset = array(); |
| 231 |
|
$QUERY_STRING = ''; |
| 232 |
|
$menuhandler = mosMenuHandler::getInstance(); |
| 233 |
|
foreach($parmset as $values) { |
| 234 |
|
$parts = explode(",", $values); |
| 235 |
|
if (count($parts) > 1) { |
| 236 |
|
$_REQUEST[$parts[0]] = $_GET[$parts[0]] = $parts[1]; |
| 237 |
|
if ($parts[0] == 'option') { |
| 238 |
|
$_REQUEST['Itemid'] = $_GET['Itemid'] = $Itemid = $menuhandler->getIDLikeLink("index.php?option=$parts[1]"); |
| 239 |
|
mamboCore::set('Itemid', $Itemid); |
| 240 |
|
$QUERY_STRING .= "$parts[0]=$parts[1]&Itemid=$Itemid"; |
| 241 |
} |
} |
| 242 |
|
$QUERY_STRING .= "&$parts[0]=$parts[1]"; |
| 243 |
} |
} |
| 244 |
} |
} |
| 245 |
|
return $QUERY_STRING; |
| 246 |
|
} |
| 247 |
|
|
| 248 |
function sefRelToAbs( $string ) { |
function sefRelToAbs( $string ) { |
|
GLOBAL $mosConfig_live_site, $mosConfig_sef, $mosConfig_mbf_content; |
|
|
|
|
| 249 |
global $iso_client_lang; |
global $iso_client_lang; |
|
if( $mosConfig_mbf_content && $string!="index.php" && |
|
|
!eregi("^(([^:/?#]+):)",$string) && !strcasecmp(substr($string,0,9),"index.php") && |
|
|
!eregi("lang=", $string) ) { |
|
|
$string .= "&lang=$iso_client_lang"; |
|
|
} |
|
| 250 |
|
|
| 251 |
if ($mosConfig_sef && !eregi("^(([^:/?#]+):)",$string) && !strcasecmp(substr($string,0,9),"index.php")) { |
$server = 'http://'.$_SERVER['HTTP_HOST']; |
| 252 |
|
if ($string == 'index.php') return $server; |
| 253 |
|
|
| 254 |
// Replace all & with & |
if (!mamboCore::get('mosConfig_sef') OR strtolower(substr($string,0,9)) != 'index.php' OR eregi('^(([^:/?#]+):)',$string)) return $string; |
|
$string = str_replace( '&', '&', $string ); |
|
| 255 |
|
|
| 256 |
/* |
$passed_string = str_replace('&', '&', $string); |
| 257 |
Home |
$string = substr($passed_string,10); |
| 258 |
index.php |
if(mamboCore::get('mosConfig_mbf_content') AND strpos("lang=", strtolower($string)) === false) { |
| 259 |
*/ |
$string .= "&lang=$iso_client_lang"; |
|
if ($string=="index.php") { |
|
|
$string=""; |
|
| 260 |
} |
} |
| 261 |
|
$option = $task = ''; |
| 262 |
$sefstring = ""; |
$oktasks = true; |
| 263 |
if ( (eregi("option=com_content",$string) || eregi("option=content",$string) ) && !eregi("task=new",$string) && !eregi("task=edit",$string) ) { |
parse_str($string, $params); |
| 264 |
|
foreach ($params as $key=>$value) { |
| 265 |
|
$lowkey = strtolower($key); |
| 266 |
|
$lowvalue = strtolower($value); |
| 267 |
|
$unset = true; |
| 268 |
|
switch ($lowkey) { |
| 269 |
|
case 'option': |
| 270 |
|
$option = $lowvalue; |
| 271 |
|
break; |
| 272 |
|
case 'task': |
| 273 |
|
$task = $value; |
| 274 |
|
if ($lowvalue == 'new' OR $lowvalue == 'edit') $oktasks = false; |
| 275 |
|
break; |
| 276 |
|
default: |
| 277 |
|
$check_params[$lowkey] = $key; |
| 278 |
|
$unset = false; |
| 279 |
|
} |
| 280 |
|
if ($unset) unset($params[$key]); |
| 281 |
|
} |
| 282 |
|
// Process content items |
| 283 |
|
if (($option == 'com_content' OR $option == 'content') AND $oktasks) { |
| 284 |
/* |
/* |
| 285 |
Content |
Content |
| 286 |
index.php?option=com_content&task=$task§ionid=$sectionid&id=$id&Itemid=$Itemid&limit=$limit&limitstart=$limitstart |
index.php?option=com_content&task=$task§ionid=$sectionid&id=$id&Itemid=$Itemid&limit=$limit&limitstart=$limitstart |
| 287 |
*/ |
*/ |
| 288 |
$sefstring .= "content/"; |
$task = $this->sef_content_task[$task]; |
| 289 |
if (eregi("&task=",$string)) { |
$content_sef = mamboCore::get('mosConfig_absolute_path').'/components/com_content/sef_ext.php'; |
| 290 |
$temp = split("&task=", $string); |
if (file_exists($content_sef)) { |
| 291 |
$temp = split("&", $temp[1]); |
require_once($content_sef); |
| 292 |
$sefstring .= $temp[0]."/"; |
return $server.sef_content::create($task, $params); |
| 293 |
} |
} |
| 294 |
if (eregi("§ionid=",$string)) { |
$keys = array('sectionid', 'id', 'itemid', 'limit', 'limitstart', 'lang'); |
| 295 |
$temp = split("§ionid=", $string); |
$string = "/content/$task/"; |
| 296 |
$temp = split("&", $temp[1]); |
foreach ($keys as $key) { |
| 297 |
$sefstring .= $temp[0]."/"; |
if (isset($check_params[$key])) { |
| 298 |
} |
$pkey = $check_params[$key]; |
| 299 |
if (eregi("&id=",$string)) { |
$string .= $params[$pkey].'/'; |
| 300 |
$temp = split("&id=", $string); |
} |
| 301 |
$temp = split("&", $temp[1]); |
} |
| 302 |
$sefstring .= $temp[0]."/"; |
return $server.$string; |
| 303 |
} |
} |
| 304 |
if (eregi("&Itemid=",$string)) { |
// Other types of URL than content do not use Itemid in the SEO version |
| 305 |
$temp = split("&Itemid=", $string); |
if (isset($check_params['itemid'])) { |
| 306 |
$temp = split("&", $temp[1]); |
$pkey = $check_params['itemid']; |
| 307 |
$sefstring .= $temp[0]."/"; |
unset($params[$pkey]); |
| 308 |
} |
unset($check_params['itemid']); |
| 309 |
if (eregi("&limit=",$string)) { |
} |
| 310 |
$temp = split("&limit=", $string); |
// Process customised components |
| 311 |
$temp = split("&", $temp[1]); |
$i = array_search($option,$this->custom_code); |
| 312 |
$sefstring .= $temp[0]."/"; |
if ($i !== false AND $i !== null) { |
| 313 |
} |
if ($this->custom_PHP[$i]) eval('$string = sef_'.$this->custom_short[$i].'::create($passed_string);'); |
| 314 |
if (eregi("&limitstart=",$string)) { |
else $string = $this->componentDetails($params,$task); |
| 315 |
$temp = split("&limitstart=", $string); |
return $server.'/'.$this->custom_name[$i].'/'.$string; |
| 316 |
$temp = split("&", $temp[1]); |
} |
| 317 |
$sefstring .= $temp[0]."/"; |
// Process ordinary components |
| 318 |
} |
if (strpos($option,'com_')===0 AND $option != 'com_registration' AND $oktasks) { |
| 319 |
if (eregi("&lang=",$string)) { |
return "$server/component/option,$option/".$this->componentDetails($params,$task); |
| 320 |
$temp = split("&lang=", $string); |
} |
| 321 |
$temp = split("&", $temp[1]); |
// Anything else is returned as received, except it is guaranteed that & will be & |
| 322 |
$sefstring .= "lang,".$temp[0]."/"; |
return $server.'/'.str_replace( '&', '&', $passed_string ); |
| 323 |
} |
} |
| 324 |
$string = $sefstring; |
|
| 325 |
} else if (eregi("option=com_",$string) && !eregi("option=com_registration",$string) && !eregi("task=new",$string) && !eregi("task=edit",$string)) { |
function componentDetails (&$params, $task) { |
| 326 |
/* |
$string = ($task ? "task,$task/" : ''); |
| 327 |
Components |
foreach ($params as $key=>$param) $string .= "$key,$param/"; |
|
index.php?option=com_xxxx&... |
|
|
*/ |
|
|
$sefstring = "component/"; |
|
|
$temp = split("\?", $string); |
|
|
$temp = split("&", $temp[1]); |
|
|
foreach($temp as $key => $value) { |
|
|
$sefstring .= $value."/"; |
|
|
} |
|
|
$string = str_replace( '=', ',', $sefstring ); |
|
|
} |
|
|
//echo $mosConfig_live_site."/".$string; |
|
|
return $mosConfig_live_site."/".$string; |
|
|
} else { |
|
| 328 |
return $string; |
return $string; |
| 329 |
} |
} |
| 330 |
|
|