Last active
December 13, 2017 08:32
-
-
Save raschid/8bb056f6a4bf8cd97175bf95e788a518 to your computer and use it in GitHub Desktop.
In kirby 2.5.7 the panel does not work on shared servers of german provider strato. This fix makes it work
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open file kirby/vendor/getkirby/toolkit/lib/url.php | |
change this (around line 397): | |
----------------------------------------------------------------------------- | |
public static function unIdn($url) { | |
if(!function_exists('idn_to_ascii')) return $url; | |
// disassemble the URL, convert the domain name and reassemble | |
$variant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : INTL_IDNA_VARIANT_2003; | |
$host = idn_to_ascii(static::host($url), 0, $variant); | |
if($host === false) return $url; | |
$url = static::build(['host' => $host], $url); | |
return $url; | |
} | |
----------------------------------------------------------------------------- | |
to that: | |
----------------------------------------------------------------------------- | |
public static function unIdn($url) { | |
if(!function_exists('idn_to_ascii')) return $url; | |
// disassemble the URL, convert the domain name and reassemble | |
$host = idn_to_ascii(static::host($url)); | |
$url = static::build(['host' => $host], $url); | |
return $url; | |
} | |
----------------------------------------------------------------------------- | |
Now you will be able to access the panel. But you'll see a message there (at least with debugging switched on): | |
idn_to_utf8() expects at most 2 parameters, 3 given | |
To get rid of the message change this (around line 378) | |
----------------------------------------------------------------------------- | |
public static function idn($url) { | |
if(!function_exists('idn_to_utf8')) return $url; | |
// disassemble the URL, convert the domain name and reassemble | |
$variant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : INTL_IDNA_VARIANT_2003; | |
$host = idn_to_utf8(static::host($url), 0, $variant); | |
if($host === false) return $url; | |
$url = static::build(['host' => $host], $url); | |
return $url; | |
} | |
----------------------------------------------------------------------------- | |
to that: | |
----------------------------------------------------------------------------- | |
public static function idn($url) { | |
if(!function_exists('idn_to_utf8')) return $url; | |
// disassemble the URL, convert the domain name and reassemble | |
$host = idn_to_utf8(static::host($url)); | |
$url = static::build(['host' => $host], $url); | |
return $url; | |
} | |
----------------------------------------------------------------------------- | |
The code you put in derives from kirby 2.5.5 and kirby 2.5.7 will work as expected afterwards. | |
This solution was brought to me from texnixe (https://github.com/texnixe). | |
Thank you texnixe! | |
I posted it as a gist, because up to now you don't find anything when you search github for "kirby panel strato" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment