Skip to content
This repository was archived by the owner on Mar 8, 2021. It is now read-only.

Commit d457979

Browse files
committed
Merge pull request #126 from yama/temp
PR for 1.0.11
2 parents 14125f9 + 71edebe commit d457979

File tree

2 files changed

+42
-36
lines changed

2 files changed

+42
-36
lines changed

Diff for: install/action.language.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
sort( $langs );
1010
?>
1111
<form name="install" id="install_form" action="index.php?action=mode" method="post">
12-
<h2>Choose language:&nbsp;&nbsp;
12+
<h2 style="display:inline;">Choose language:&nbsp;&nbsp;</h2>
1313
<select name="language">
1414
<?php
1515
foreach ($langs as $language) {
1616
$abrv_language = explode('-',$language);
1717
echo '<option value="' . $language . '"'. ( ($abrv_language[0] == 'english') ? ' selected="selected"' : null ) .'>' . ucwords( $abrv_language[0] ). '</option>'."\n";
1818
}
1919
?>
20-
</select></h2>
20+
</select>
2121
<p class="buttonlinks">
2222
<a style="display:inline;" href="javascript:document.getElementById('install_form').submit();" title="<?php echo $_lang['begin']?>"><span><?php echo $_lang['btnnext_value']?></span></a>
2323
</p>

Diff for: manager/includes/document.parser.class.inc.php

+40-34
Original file line numberDiff line numberDiff line change
@@ -1275,43 +1275,49 @@ function rewriteUrls($documentSource) {
12751275
$documentSource= preg_replace($in, $out, $documentSource);
12761276
}
12771277

1278-
$this->_fixURI();
12791278
return $documentSource;
12801279
}
12811280

1282-
function _fixURI(){
1281+
function sendStrictURI(){
12831282
// FIX URLs
1284-
if ((int)$this->documentIdentifier != 0 && $this->config['seostrict']=='1' && $this->config['friendly_urls']=='1'){
1285-
if ($this->config['site_status'] == 1) {
1286-
$myProtocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
1287-
$parts = explode("?", $_SERVER['REQUEST_URI'],2);
1288-
$parts[0] = '/'.$_GET['q'];
1289-
$strictURL = $this->toAlias($this->makeUrl($this->documentIdentifier));
1290-
$myDomain = $myProtocol . "://" . $_SERVER['HTTP_HOST'];
1291-
$newURL = $myDomain . $strictURL;
1292-
$requestedURL = $myDomain . $parts[0];
1293-
1294-
if ($this->documentIdentifier == $this->config['site_start']){
1295-
if ($requestedURL != $this->config['site_url']){
1296-
// Force redirect of site start
1297-
// $this->sendErrorPage();
1298-
header("HTTP/1.1 301 Moved Permanently");
1299-
$qstring = isset($parts[1]) ? preg_replace("#(^|&)(q|id)=[^&]+#", '', $parts[1]) : ''; // Strip conflicting id/q from query string
1300-
if ($qstring) header('Location: ' . $this->config['site_url'] . '?' . $qstring);
1301-
else header('Location: ' . $this->config['site_url']);
1302-
exit(0);
1303-
}
1304-
}elseif ($parts[0] != $strictURL && $this->documentIdentifier != $this->config['error_page']){
1305-
// Force page redirect
1306-
header("HTTP/1.1 301 Moved Permanently");
1307-
$qstring = preg_replace("#(^|&)(q|id)=[^&]+#", '', $parts[1]); // Strip conflicting id/q from query string
1308-
if ($qstring) header('Location: ' . $strictURL . '?' . $qstring);
1309-
else header('Location: ' . $strictURL);
1310-
exit(0);
1311-
1312-
}
1313-
}
1314-
}
1283+
if (empty($this->documentIdentifier) || $this->config['seostrict']=='0' || $this->config['friendly_urls']=='0')
1284+
return;
1285+
if ($this->config['site_status'] == 0) return;
1286+
1287+
$scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
1288+
$len_base_url = strlen($this->config['base_url']);
1289+
if(strpos($_SERVER['REQUEST_URI'],'?'))
1290+
list($url_path,$url_query_string) = explode('?', $_SERVER['REQUEST_URI'],2);
1291+
else $url_path = $_SERVER['REQUEST_URI'];
1292+
if(substr($url_path,0,$len_base_url)===$this->config['base_url'])
1293+
$url_path = substr($url_path,$len_base_url);
1294+
$strictURL = $this->toAlias($this->makeUrl($this->documentIdentifier));
1295+
if(substr($strictURL,0,$len_base_url)===$this->config['base_url'])
1296+
$strictURL = substr($strictURL,$len_base_url);
1297+
$http_host = $_SERVER['HTTP_HOST'];
1298+
$requestedURL = "{$scheme}://{$http_host}" . $_SERVER['REQUEST_URI'];
1299+
$site_url = $this->config['site_url'];
1300+
if ($this->documentIdentifier == $this->config['site_start']){
1301+
if ($requestedURL != $this->config['site_url']){
1302+
// Force redirect of site start
1303+
// $this->sendErrorPage();
1304+
$qstring = isset($url_query_string) ? preg_replace("#(^|&)(q|id)=[^&]+#", '', $url_query_string) : ''; // Strip conflicting id/q from query string
1305+
if ($qstring) $url = "{$site_url}?{$qstring}";
1306+
else $url = $site_url;
1307+
$this->sendRedirect($url,0,'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently');
1308+
exit(0);
1309+
}
1310+
}elseif ($url_path != $strictURL && $this->documentIdentifier != $this->config['error_page']){
1311+
// Force page redirect
1312+
//$strictURL = ltrim($strictURL,'/');
1313+
if(!empty($url_query_string))
1314+
$qstring = preg_replace("#(^|&)(q|id)=[^&]+#", '', $url_query_string); // Strip conflicting id/q from query string
1315+
if ($qstring) $url = "{$site_url}{$strictURL}?{$qstring}";
1316+
else $url = "{$site_url}{$strictURL}";
1317+
$this->sendRedirect($url,0,'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently');
1318+
exit(0);
1319+
}
1320+
return;
13151321
}
13161322

13171323
/**
@@ -1558,7 +1564,7 @@ function executeParser() {
15581564
if ($this->config['track_visitors'] == 1) {
15591565
$this->invokeEvent("OnLogPageHit");
15601566
}
1561-
1567+
if($this->config['seostrict']==='1') $this->sendStrictURI();
15621568
$this->prepareResponse();
15631569
}
15641570

0 commit comments

Comments
 (0)