From 36f44273037b0f056386f5df7d89800d4d7bd352 Mon Sep 17 00:00:00 2001 From: ozhozh Date: Mon, 2 Aug 2010 13:36:14 +0000 Subject: [PATCH] Change in generating rnd strings (now comply to charset as defined in config.php) git-svn-id: http://yourls.googlecode.com/svn/trunk@458 12232710-3e20-11de-b438-597f59cd7555 --- includes/functions.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 16315fd..81a2388 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -1330,20 +1330,19 @@ function yourls_is_installed() { } // Generate random string of (int)$length length and type $type (see function for details) -function yourls_rnd_string ( $length = 5, $type = 1, $charlist = '' ) { +function yourls_rnd_string ( $length = 5, $type = 0, $charlist = '' ) { $str = ''; $length = intval( $length ); // define possible characters switch ( $type ) { - // custom char list + + // custom char list, or comply to charset as defined in config case '0': - if( $charlist ) { - $possible = $charlist; - break; - } + $possible = $charlist ? $charlist : yourls_get_shorturl_charset() ; + break; - // no vowels to make no offending word, no 0 or 1 to avoid confusion betwee letters & digits. Perfect for passwords. + // no vowels to make no offending word, no 0/1/o/l to avoid confusion between letters & digits. Perfect for passwords. case '1': $possible = "23456789bcdfghjkmnpqrstvwxyz"; break; -- 2.45.0