mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-07 02:11:26 +02:00
bug 1063 fixed: avoid error when adding a tag in chinese or russian characters.
In any language where the str2url would return an empty string. The behavior doesn't change for european characters. rvelices warned me about the many issues we might encounter with copy/paste of the URL and required url_encode/url_decode BUT after many tests (Linux with Firefox 3.0/Google Chrome 5, MacOS 10.6 with Firefox/Safari, WindowsXP with IE6/Firefox) I've found 0 problem, even with the most error prone mode $conf['tag_url_style'] = 'tag' git-svn-id: http://piwigo.org/svn/trunk@6060 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -381,11 +381,18 @@ function remove_accents($string)
|
||||
*/
|
||||
function str2url($str)
|
||||
{
|
||||
$raw = $str;
|
||||
|
||||
$str = remove_accents($str);
|
||||
$str = preg_replace('/[^a-z0-9_\s\'\:\/\[\],-]/','',strtolower($str));
|
||||
$str = preg_replace('/[\s\'\:\/\[\],-]+/',' ',trim($str));
|
||||
$res = str_replace(' ','_',$str);
|
||||
|
||||
if (empty($res))
|
||||
{
|
||||
$res = $raw;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user