]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Ticket #2329: fix for use of _m() translation functions from outside of plugin direct...
authorBrion Vibber <brion@pobox.com>
Thu, 27 May 2010 21:18:08 +0000 (14:18 -0700)
committerBrion Vibber <brion@pobox.com>
Thu, 27 May 2010 21:18:08 +0000 (14:18 -0700)
lib/language.php

index 64b59e73966e61b9894e85efbd57eadd4e6a2f9b..3846b8f358bdb9581d3e54286c93a1fd14ddbe3f 100644 (file)
@@ -205,12 +205,20 @@ function _mdomain($backtrace)
         if (DIRECTORY_SEPARATOR !== '/') {
             $path = strtr($path, DIRECTORY_SEPARATOR, '/');
         }
-        $cut = strpos($path, '/plugins/') + 9;
-        $cut2 = strpos($path, '/', $cut);
-        if ($cut && $cut2) {
-            $cached[$path] = substr($path, $cut, $cut2 - $cut);
-        } else {
+        $plug = strpos($path, '/plugins/');
+        if ($plug === false) {
+            // We're not in a plugin; return null for the default domain.
             return null;
+        } else {
+            $cut = $plug + 9;
+            $cut2 = strpos($path, '/', $cut);
+            if ($cut2) {
+                $cached[$path] = substr($path, $cut, $cut2 - $cut);
+            } else {
+                // We might be running directly from the plugins dir?
+                // If so, there's no place to store locale info.
+                return null;
+            }
         }
     }
     return $cached[$path];