Page 18 of 21

Re: Clean URLs

Posted: Sun Sep 22, 2019 11:53 am
by lck
Korwin wrote:
Sun Sep 22, 2019 8:14 am
Wie schade! Vielleicht gibt es eine Art Plugin, mit dem Sie einen alternativen Namen im Menü eingeben und die URL in lateinischen Zeichen schreiben können?
Per urichar/org new, siehe Wiki und Beispiel dazu hier.
Oder ein Addon (Siehe auch viewtopic.php?t=5719&start=90#p41996).

Re: Clean URLs

Posted: Sun Sep 22, 2019 12:53 pm
by cmb
Korwin wrote:
Sat Sep 21, 2019 4:39 pm
English:
I write sites on CMSimple_XH in Russian. Several times I came across the fact that the system does not allow saving a page in the page manager and reporting too long URLs.
This error message is caused by the configuration setting "uri length". You can increase the value to 400, for example.

However, 200 is already quite long, so for a page at level 4, you are supposed to have roughly 50 characters (not bytes) for each page heading. There might be a bug, though – I'll check that later.

Re: Clean URLs

Posted: Sun Sep 22, 2019 2:06 pm
by Korwin
cmb wrote:
Sun Sep 22, 2019 12:53 pm
Korwin wrote:
Sat Sep 21, 2019 4:39 pm
English:
I write sites on CMSimple_XH in Russian. Several times I came across the fact that the system does not allow saving a page in the page manager and reporting too long URLs.
This error message is caused by the configuration setting "uri length". You can increase the value to 400, for example.

However, 200 is already quite long, so for a page at level 4, you are supposed to have roughly 50 characters (not bytes) for each page heading. There might be a bug, though – I'll check that later.
Thanks!
It works! But I will continue to study other solutions. I noticed a strange variable name.

Code: Select all

$cf['uri']['sepErator']="/"; - is it right?
$cf['uri']['word_separator']="-";

Re: Clean URLs

Posted: Wed Sep 25, 2019 11:18 pm
by cmb
Korwin wrote:
Sun Sep 22, 2019 2:06 pm
I noticed a strange variable name.

Code: Select all

$cf['uri']['sepErator']="/"; - is it right?
No, this is wrong. It should be 'seperator' (neither 'sepErator', nor the correctly spelled 'separator'). I don't know how that happened, but I suggest to change it, and to check whether the site still works.
cmb wrote:
Sun Sep 22, 2019 12:53 pm
There might be a bug, though – I'll check that later.
Indeed, there is a bug. $su is taken from the QUERY_STRING, and this is not urldecoded (at least not on IIS where I'm checking, but I think it is not urldecoded on other servers as well). So if someone is requesting http://example.com/?Content/Inhalt-%5Bde%5D, $su is "Content/Inhalt-%5Bde%5D", so the $cf['uri']['length'] cut would shorten the URL more than desired, and could even split in the middle of a urlencoded character, resulting in an invalid URL. A quick-fix might be to replace this line with:

Code: Select all

$su = utf8_substr($su, 0, $cf['uri']['length'] + 2 * substr_count($su, '%'));
And to adjust this line accordingly. Not sure if that's correct for all (edge-)cases. And it doesn't look clean, anyway.

Re: Clean URLs

Posted: Fri Sep 27, 2019 4:45 am
by Korwin
cmb wrote:
Wed Sep 25, 2019 11:18 pm
Korwin wrote:
Sun Sep 22, 2019 2:06 pm
I noticed a strange variable name.

Code: Select all

$cf['uri']['sepErator']="/"; - is it right?
No, this is wrong. It should be 'seperator' (neither 'sepErator', nor the correctly spelled 'separator'). I don't know how that happened, but I suggest to change it, and to check whether the site still works.
Sorry, it was written "seperator", I highlighted the letter "E" to make it clear what surprised me. The mistake is not in this place, at least functional, not spelling. :oops:
cmb wrote:
Wed Sep 25, 2019 11:18 pm
cmb wrote:
Sun Sep 22, 2019 12:53 pm
There might be a bug, though – I'll check that later.
Indeed, there is a bug. $su is taken from the QUERY_STRING, and this is not urldecoded (at least not on IIS where I'm checking, but I think it is not urldecoded on other servers as well). So if someone is requesting http://example.com/?Content/Inhalt-%5Bde%5D, $su is "Content/Inhalt-%5Bde%5D", so the $cf['uri']['length'] cut would shorten the URL more than desired, and could even split in the middle of a urlencoded character, resulting in an invalid URL. A quick-fix might be to replace this line with:

Code: Select all

$su = utf8_substr($su, 0, $cf['uri']['length'] + 2 * substr_count($su, '%'));
And to adjust this line accordingly. Not sure if that's correct for all (edge-)cases. And it doesn't look clean, anyway.
And there is. After adjusting the specified lines on a clean CMSimple_XH 1.72, everything works, after installing new files "cms.php" and "functions.php" on the site, I learned a message:
Twocents_XH detected an unsupported CMSimple_XH version.
Uninstall Twocents_XH or upgrade to a supported CMSimple_XH version!

Re: Clean URLs

Posted: Sat Sep 28, 2019 10:24 am
by lck
Korwin wrote:
Sun Sep 22, 2019 2:06 pm
And there is. After adjusting the specified lines on a clean CMSimple_XH 1.72, everything works, after installing new files "cms.php" and "functions.php" on the site, I learned a message:
Twocents_XH detected an unsupported CMSimple_XH version.
Uninstall Twocents_XH or upgrade to a supported CMSimple_XH version!
:? anscheinend hast du eine Masterversion von XH 1.7.2 installiert und nicht das Release.
Schau mal im Backend unter Einstellungen > Info was da angezeigt wird, sollte sein:
CMSimple_XH 1.7.2 Released: 2017-12-21
Bei der Masterversion wird folgendes angezeigt:
"@CMSIMPLE_XH_VERSION@ Released: @CMSIMPLE_XH_DATE@"

Re: Clean URLs

Posted: Wed Oct 02, 2019 9:13 pm
by cmb
Yes, like lck said. Or in other words: if you download from github/cmsimple-xh or github/cmb69, don't use "Source code (zip)" or "Source code (tar.gz)", but rather a .zip which contains "XH" in the filename.

Re: Clean URLs

Posted: Wed Oct 16, 2019 3:09 pm
by Korwin
English:
Hello friends! Unfortunately, the same problem remains, or I'm doing something wrong. In the cms.php file, line 805 is as follows:

Code: Select all

$su = utf8_substr($su, 0, $cf['uri']['length'] + 2 * substr_count($su, '%'));
In functions.php, line 823 is like this:

Code: Select all

$u[] = utf8_substr($url, 0, $cf['uri']['length']) + 2 * substr_count($u, '%'));
The result you see is the Cyrillic url is too long.

Please help me figure it out.

Deutsch:
Hallo Freunde! Leider bleibt das gleiche Problem, oder ich mache etwas falsch. In der cms.php-Datei lautet die Zeile 805 wie folgt:

Code: Select all

$su = utf8_substr($su, 0, $cf['uri']['length'] + 2 * substr_count($su, '%'));
In functions.php sieht Zeile 823 folgendermaßen aus:

Code: Select all

$u[] = utf8_substr($url, 0, $cf['uri']['length']) + 2 * substr_count($u, '%'));
Das Ergebnis ist, dass die kyrillische URL zu lang ist.

Bitte helfen Sie mir, es herauszufinden.
[ external image ]

Re: Clean URLs

Posted: Wed Oct 16, 2019 7:02 pm
by lck
Korwin wrote:
Wed Oct 16, 2019 3:09 pm
Das Ergebnis ist, dass die kyrillische URL zu lang ist.
Ich habe das mal mit folgendem Seitennamen und einer Unterseite lokal mit Xampp mit frisch installiertem XH 1.7.2 getestet

Code: Select all

Не хлебом единым сыт человек - Не хлебом единым сыт человек
Unterseite

Code: Select all

а б в г д е ё ж з и й к л м н о п р с т у ф х ц ч ш щ ъ ы ь э ю я
Einstellung in der config.php

Code: Select all

$cf['uri']['seperator']="/";
$cf['uri']['word_separator']="-";
$cf['uri']['length']="600";
Speichert ohne Probleme und die URI ist auch aufrufbar.

Magst du mal die problematischen Seitennamen hier als Text posten, damit wir das mal testen können.

Re: Clean URLs

Posted: Tue Oct 22, 2019 4:50 am
by Korwin
Vielen Dank, lck, das Problem ist behoben!