That's a nice service for the community; thank you.Maxim wrote:Created collection "CMSimple_XH_157_CleanURLs" and update "Update_CMSimple_XH_157_CleanURLs"
http://maxim.zp.ua/users/2/files.html
I tried the full version; after switching to "ru", I was not able to call the site. The problem is in cmsimple/languages/ru.php line 182:
Code: Select all
$tx['urichar']['org']="А,Б,В,Г,Д,Е,Ё,Ж,З,И,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ы,Э,Ю,Я,а,б,в,г,д,е,ё,ж,з,и,й,к,л,м,н,о,п,р,с,т,у,ф,х,ц,ч,ш,щ,ы,э,ю,я, &, –,Ъ,Ь,ъ,ь,",(,)";
Code: Select all
$tx['urichar']['org']="А,Б,В,Г,Д,Е,Ё,Ж,З,И,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ы,Э,Ю,Я,а,б,в,г,д,е,ё,ж,з,и,й,к,л,м,н,о,п,р,с,т,у,ф,х,ц,ч,ш,щ,ы,э,ю,я, &, –,Ъ,Ь,ъ,ь,\",(,)";
I have totally overlooked this issue in my clean URL solution. Having clean links for sitemap and mailform is easy. In cmsimple/cms.php around line 733 there is function ml(). This has to be changed:Maxim wrote:Please tell me how to create CleanURLs to "Sitemap", "Print view", "Mailform", "Login".
Failed to Russify.
Code: Select all
function ml($i) {
global $f, $sn, $tx;
$t = '';
if ($f != $i)
$t .= '<a href="' . $sn . '?' . $i . '">';
$t .= $tx['menu'][$i];
if ($f != $i)
$t .= '</a>';
return $t;
}
- Function ml() has to be modified further:
This produces the desired links for sitemap and mailform.
Code: Select all
function ml($i) { global $f, $sn, $tx; $t = ''; if ($f != $i) $t .= '<a href="' . $sn . '?' . uenc($tx['menu'][$i]) . '">'; $t .= $tx['menu'][$i]; if ($f != $i) $t .= '</a>'; return $t; }
- To produce a localized login link, in cmsimple/login.php function lilink() has to be modified:
Code: Select all
function lilink() { global $cf, $adm, $sn, $u, $s, $tx; if (!$adm) { if ($cf['security']['type'] == 'javascript') return '<form id="login" action="' . $sn . '" method="post"><div id="loginlink">' . tag('input type="hidden" name="login" value="true"') . tag('input type="hidden" name="selected" value="' . $u[$s] . '"') . tag('input type="hidden" name="passwd" id="passwd" value=""') . '</div></form><a href="#" onclick="login(); return false">' . $tx['menu']['login'] . '</a>'; else return a($s > -1 ? $s : 0, uenc($tx['menu']['login'])) . $tx['menu']['login'] . '</a>'; } }
- To produce a localized print link, function printlink() in cmsimple/cms.php has to be modified:
Code: Select all
function printlink() { global $f, $search, $file, $sn, $tx; $t = '&' . uenc($tx['menu']['print']); if ($f == 'search') $t .= '&function=search&search=' . htmlspecialchars(stsl($search), ENT_COMPAT, 'UTF-8'); else if ($f == 'file') $t .= '&file=' . $file; else if ($f != '' && $f != 'save') $t .= '&' . $f; else if (sv('QUERY_STRING') != '') $t = htmlspecialchars(sv('QUERY_STRING'), ENT_COMPAT, "UTF-8") . $t; return '<a href="' . $sn . '?' . $t . '">' . $tx['menu']['print'] . '</a>'; }
- To recognize the incoming URLs, one has to add in cmsimple/cms.php after line 221:
Code: Select all
$su = substr($su, 0, $cf['uri']['length']); // this line is line 221, which is already there foreach (array('login', 'mailform', 'print', 'sitemap') as $i) { if (!empty($GLOBALS[uenc($tx['menu'][$i])])) { $$i = 'true'; } }
Maxim wrote:How to add ".html"?
- Function a() in cmsimple/cms.php around line 720 has to be further modified:
Code: Select all
function a($i, $x) { global $sn, $u, $cf, $adm; if ($i == 0 && !$adm) { if ($x == '' && $cf['locator']['show_homepage'] == 'true') { return '<a href="' . $sn . $u[0] . '">'; } } return isset($u[$i]) ? '<a href="' . $sn . $u[$i] . '.html' . (!empty($x) ? '?' . $x : '') . '">' : '<a href="' . $sn . '.html' . (!empty($x) ? '?' . $x : '') . '">'; }
- Function ml() in cmsimple/cms.php has to be further modified to cater for sitemap and mailform links:
Code: Select all
function ml($i) { global $f, $sn, $tx; $t = ''; if ($f != $i) $t .= '<a href="' . $sn . '?' . uenc($tx['menu'][$i]) . '.html">'; $t .= $tx['menu'][$i]; if ($f != $i) $t .= '</a>'; return $t; }
- .htaccess has to be modified to accept these incoming URLs:
Code: Select all
RewriteEngine on # Do not rewrite requests to existing directories and files: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Everything else is a CMSimple_XH page request, # so shift the subfolders to the beginning of the query string RewriteRule ^([A-z]{2}/)?([^.]*)(.html)?$ $1?$2 [QSA]
Christoph