diff options
author | plegall <plg@piwigo.org> | 2010-05-03 23:31:42 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2010-05-03 23:31:42 +0000 |
commit | 0ce0f28a2306d442b8fd3781ef20524c995d7027 (patch) | |
tree | 898b51e6b6c0af4e74bc93dacd52a59bc6055ad7 /include | |
parent | 1f01b7f91200350c3ca2ecd05f8511f1ef943e03 (diff) |
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
Diffstat (limited to '')
-rw-r--r-- | include/functions.inc.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php index e44421fdb..dc87f508c 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -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; } |