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 eac38fe..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
@@ -898,7 +907,7 @@ function selector() {
                // itemid given -> only show that item\r
                $type = 'item';\r
 \r
-               if (!$manager->existsItem($itemid,intval($CONF['allowFuture']),intval($CONF['allowDrafts']) ) {\r
+               if (!$manager->existsItem($itemid,intval($CONF['allowFuture']),intval($CONF['allowDrafts']))) {\r
                        doError(_ERROR_NOSUCHITEM);\r
                }\r
 \r
@@ -1937,19 +1946,22 @@ function ticketForPlugin(){
        }\r
        \r
        /* Return if not index.php */\r
-       if ( $phppath!=strtolower($plugin_name).'/' && $phppath!=strtolower($plugin_name).'/index.php' ) {\r
+       if ( ($phppath != strtolower($plugin_name) . '/') && ($phppath != strtolower($plugin_name) . '/index.php') )\r
+       {\r
                return;\r
        }\r
 \r
        /* Exit if not logged in. */\r
-       if ( !$member->isLoggedIn() ) {\r
+       if ( !$member->isLoggedIn() )\r
+       {\r
                exit(_GFUNCTIONS_YOU_AERNT_LOGGEDIN);\r
        }\r
 \r
        global $manager,$DIR_LIBS,$DIR_LANG,$HTTP_GET_VARS,$HTTP_POST_VARS;\r
 \r
        /* Check if this feature is needed (ie, if "$manager->checkTicket()" is not included in the script). */\r
-       if (!($p_translated=serverVar('PATH_TRANSLATED'))) {\r
+       if (!($p_translated=serverVar('PATH_TRANSLATED')))\r
+       {\r
                $p_translated=serverVar('SCRIPT_FILENAME');\r
        }\r
        if ($file=@file($p_translated))\r
@@ -1957,7 +1969,8 @@ function ticketForPlugin(){
                $prevline='';\r
                foreach($file as $line)\r
                {\r
-                       if (preg_match('/[\$]manager([\s]*)[\-]>([\s]*)checkTicket([\s]*)[\(]/i',$prevline.$line)) {\r
+                       if (preg_match('/[\$]manager([\s]*)[\-]>([\s]*)checkTicket([\s]*)[\(]/i',$prevline.$line))\r
+                       {\r
                                return;\r
                        }\r
                        $prevline=$line;\r
@@ -1999,13 +2012,17 @@ function ticketForPlugin(){
                if ($uri=serverVar('REQUEST_URI'))\r
                {\r
                        list($uri,$qstring)=explode('?',$uri);\r
-               } else {\r
-                       if ( !($uri=serverVar('PHP_SELF')) ) {\r
+               }\r
+               else\r
+               {\r
+                       if ( !($uri=serverVar('PHP_SELF')) )\r
+                       {\r
                                $uri=serverVar('SCRIPT_NAME');\r
                        }\r
                        $qstring=serverVar('QUERY_STRING');\r
                }\r
-               if ($qstring) {\r
+               if ($qstring)\r
+               {\r
                        $qstring='?'.$qstring;\r
                }\r
                echo '<p>'._SETTINGS_UPDATE.' : '._QMENU_PLUGINS.' <span style="color:red;">'.htmlspecialchars($plugin_name)."</span> ?</p>\n";\r
@@ -2356,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