X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Futil.php;fp=lib%2Futil.php;h=1231f4c8d1cd3dd9ef39973c2f4c65e28575a189;hb=8dfc8f1635940b096e7f4025e3aef0ca4f909eb2;hp=094cd8772de33fe2a4f2f89866c2569afca1d387;hpb=8914b69d5055c1bc7d0604ee338ffdaf6b0a8606;p=quix0rs-gnu-social.git diff --git a/lib/util.php b/lib/util.php index 094cd8772d..1231f4c8d1 100644 --- a/lib/util.php +++ b/lib/util.php @@ -134,7 +134,7 @@ function common_check_user($nickname, $password) $authenticatedUser = false; if (Event::handle('StartCheckPassword', array($nickname, $password, &$authenticatedUser))) { - $user = User::staticGet('nickname', $nickname); + $user = User::staticGet('nickname', common_canonical_nickname($nickname)); if (!empty($user)) { if (!empty($password)) { // never allow login with blank password if (0 == strcmp(common_munge_password($password, $user->id), @@ -1599,6 +1599,7 @@ function common_database_tablename($tablename) */ function common_shorten_url($long_url) { + $long_url = trim($long_url); $user = common_current_user(); if (empty($user)) { // common current user does not find a user when called from the XMPP daemon @@ -1613,7 +1614,7 @@ function common_shorten_url($long_url) return $long_url; }else{ //URL was shortened, so return the result - return $shortenedUrl; + return trim($shortenedUrl); } } @@ -1690,7 +1691,8 @@ function common_url_to_nickname($url) # Strip starting, ending slashes $path = preg_replace('@/$@', '', $parts['path']); $path = preg_replace('@^/@', '', $path); - if (strpos($path, '/') === false) { + $path = basename($path); + if ($path) { return common_nicknamize($path); } }