]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/common.php
Updated styles for versions page
[quix0rs-gnu-social.git] / lib / common.php
index 063d7d9d99dc97105e16ed3640a0f5e2b4bf77ec..fb5e5919e054037de16f4c499ef2cd83b3f0be96 100644 (file)
@@ -20,9 +20,9 @@
 if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
 
 //exit with 200 response, if this is checking fancy from the installer
-if (isset($_REQUEST['p']) && $_REQUEST['p'] == 'check-fancy') {  exit; } 
+if (isset($_REQUEST['p']) && $_REQUEST['p'] == 'check-fancy') {  exit; }
 
-define('STATUSNET_VERSION', '0.9.0dev');
+define('STATUSNET_VERSION', '0.9.0rc2');
 define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility
 
 define('STATUSNET_CODENAME', 'Stand');
@@ -59,10 +59,6 @@ require_once('PEAR.php');
 require_once('DB/DataObject.php');
 require_once('DB/DataObject/Cast.php'); # for dates
 
-if (!function_exists('gettext')) {
-    require_once("php-gettext/gettext.inc");
-}
-
 require_once(INSTALLDIR.'/lib/language.php');
 
 // This gets included before the config file, so that admin code and plugins
@@ -83,6 +79,9 @@ function _sn_to_path($sn)
     return $p;
 }
 
+// Save our sanity when code gets loaded through subroutines such as PHPUnit tests
+global $default, $config, $_server, $_path;
+
 // try to figure out where we are. $server and $path
 // can be set by including module, else we guess based
 // on HTTP info.
@@ -211,6 +210,18 @@ if ($_db_name != 'statusnet' && !array_key_exists('ini_'.$_db_name, $config['db'
     $config['db']['ini_'.$_db_name] = INSTALLDIR.'/classes/statusnet.ini';
 }
 
+// Backwards compatibility
+
+if (array_key_exists('memcached', $config)) {
+    if ($config['memcached']['enabled']) {
+        addPlugin('Memcache', array('servers' => $config['memcached']['server']));
+    }
+
+    if (!empty($config['memcached']['base'])) {
+        $config['cache']['base'] = $config['memcached']['base'];
+    }
+}
+
 function __autoload($cls)
 {
     if (file_exists(INSTALLDIR.'/classes/' . $cls . '.php')) {
@@ -227,6 +238,27 @@ function __autoload($cls)
     }
 }
 
+// Load default plugins
+
+foreach ($config['plugins']['default'] as $name => $params) {
+    if (is_null($params)) {
+        addPlugin($name);
+    } else if (is_array($params)) {
+        if (count($params) == 0) {
+            addPlugin($name);
+        } else {
+            $keys = array_keys($params);
+            if (is_string($keys[0])) {
+                addPlugin($name, $params);
+            } else {
+                foreach ($params as $paramset) {
+                    addPlugin($name, $paramset);
+                }
+            }
+        }
+    }
+}
+
 // XXX: how many of these could be auto-loaded on use?
 // XXX: note that these files should not use config options
 // at compile time since DB config options are not yet loaded.