OSDN Git Service

Now this trunk equal 3.62 without documentation. We need to test for install and...
[nucleus-jp/nucleus-jp-ancient.git] / utf8 / nucleus / libs / globalfunctions.php
index 59804a5..6f7ddbb 100755 (executable)
@@ -20,7 +20,7 @@
 // needed if we include globalfunctions from install.php\r
 global $nucleus, $CONF, $DIR_LIBS, $DIR_LANG, $manager, $member;\r
 \r
-$nucleus['version'] = 'v3.61';\r
+$nucleus['version'] = 'v3.62';\r
 $nucleus['codename'] = '';\r
 \r
 // check and die if someone is trying to override internal globals (when register_globals turn on)\r
@@ -268,8 +268,15 @@ if ($action == 'login') {
                ACTIONLOG::add(INFO, "Login successful for $login (sharedpc=$shared)");\r
        } else {\r
                // errormessage for [%errordiv%]\r
-               $errormessage = 'Login failed for ' . $login;\r
-\r
+               $trimlogin = trim($login);\r
+               if (empty($trimlogin))\r
+               {\r
+                       $errormessage = "Please enter a username.";\r
+               }\r
+               else \r
+               {\r
+                       $errormessage = 'Login failed for ' . $login;\r
+               } \r
                $manager->notify('LoginFailed', array('username' => $login) );\r
                ACTIONLOG::add(INFO, $errormessage);\r
        }\r
@@ -557,7 +564,7 @@ function intCookieVar($name) {
   * returns the currently used version (100 = 1.00, 101 = 1.01, etc...)\r
   */\r
 function getNucleusVersion() {\r
-       return 361;\r
+       return 362;\r
 }\r
 \r
 /**\r
@@ -725,21 +732,21 @@ function highlight($text, $expression, $highlight) {
        {\r
                return $text;\r
        }\r
-\r
+       \r
        if (is_array($expression) && (count($expression) == 0) )\r
        {\r
                return $text;\r
        }\r
-\r
+       \r
        // add a tag in front (is needed for preg_match_all to work correct)\r
        $text = '<!--h-->' . $text;\r
-\r
+       \r
        // split the HTML up so we have HTML tags\r
        // $matches[0][i] = HTML + text\r
        // $matches[1][i] = HTML\r
        // $matches[2][i] = text\r
        preg_match_all('/(<[^>]+>)([^<>]*)/', $text, $matches);\r
-\r
+       \r
        // throw it all together again while applying the highlight to the text pieces\r
        $result = '';\r
        $count_matches = count($matches[2]);\r
@@ -748,25 +755,27 @@ function highlight($text, $expression, $highlight) {
                {\r
                        $result .= $matches[1][$i];\r
                }\r
-\r
+               \r
                if (is_array($expression) )\r
                {\r
                        foreach ($expression as $regex)\r
                        {\r
                                if ($regex)\r
                                {\r
-                                       $matches[2][$i] = @eregi_replace($regex, $highlight, $matches[2][$i]);\r
+                                       //$matches[2][$i] = @eregi_replace($regex, $highlight, $matches[2][$i]);\r
+                                       $matches[2][$i] = @preg_replace("#".$regex."#i", $highlight, $matches[2][$i]);\r
                                }\r
                        }\r
-\r
+                       \r
                        $result .= $matches[2][$i];\r
                }\r
                else\r
                {\r
-                       $result .= @eregi_replace($expression, $highlight, $matches[2][$i]);\r
+                       //$result .= @eregi_replace($expression, $highlight, $matches[2][$i]);\r
+                       $result .= @preg_replace("#".$expression."#i", $highlight, $matches[2][$i]);\r
                }\r
        }\r
-\r
+       \r
        return $result;\r
 }\r
 \r
@@ -2006,7 +2015,8 @@ function ticketForPlugin(){
                }\r
                else\r
                {\r
-                       if ( !($uri=serverVar('PHP_SELF')) ) {\r
+                       if ( !($uri=serverVar('PHP_SELF')) )\r
+                       {\r
                                $uri=serverVar('SCRIPT_NAME');\r
                        }\r
                        $qstring=serverVar('QUERY_STRING');\r
@@ -2363,12 +2373,12 @@ function cleanFileName($str) {
        $cleaner[] = array('expression'=>"/[ç]/",'replace'=>"c");\r
        \r
        $str = strtolower($str);\r
-       $ext_point = strripos($str,".");\r
+       $ext_point = strrpos($str,".");\r
        if ($ext_point===false) return false;\r
        $ext = substr($str,$ext_point,strlen($str));\r
        $str = substr($str,0,$ext_point);\r
        \r
-       foreach( $cleaner as $cv ) $str = preg_replace($cv["expression"],$cv["replace"],$str);\r
+       //foreach( $cleaner as $cv ) $str = preg_replace($cv["expression"],$cv["replace"],$str);\r
        \r
        return preg_replace("/[^a-z0-9-]/","_",$str).$ext;\r
 }\r