]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/common.php
Added configuration options to enable/disable SMS and Twitter integration.
[quix0rs-gnu-social.git] / lib / common.php
index e2936f0751d245a1179b5028d9b2ef25c84c56f8..12a7ac4499a290dea552e4f7e542e6106563959d 100644 (file)
@@ -19,7 +19,7 @@
 
 if (!defined('LACONICA')) { exit(1); }
 
-define('LACONICA_VERSION', '0.8.0dev');
+define('LACONICA_VERSION', '0.8.1dev');
 
 define('AVATAR_PROFILE_SIZE', 96);
 define('AVATAR_STREAM_SIZE', 48);
@@ -94,14 +94,6 @@ $config =
         array('name' => 'Just another Laconica microblog',
               'server' => $_server,
               'theme' => 'default',
-              'design' =>
-              array('backgroundcolor' => '#CEE1E9',
-                    'contentcolor' => '#FFFFFF',
-                    'sidebarcolor' => '#C8D1D5',
-                    'textcolor' => '#000000',
-                    'linkcolor' => '#002E6E',
-                    'backgroundimage' => null,
-                    'disposition' => 1),
               'path' => $_path,
               'logfile' => null,
               'logo' => null,
@@ -120,10 +112,12 @@ $config =
               'private' => false,
               'ssl' => 'never',
               'sslserver' => null,
+              'shorturllength' => 30,
               'dupelimit' => 60), # default for same person saying the same thing
         'syslog' =>
         array('appname' => 'laconica', # for syslog
-              'priority' => 'debug'), # XXX: currently ignored
+              'priority' => 'debug', # XXX: currently ignored
+              'facility' => LOG_USER),
         'queue' =>
         array('enabled' => false,
               'subsystem' => 'db', # default to database, or 'stomp'
@@ -175,6 +169,8 @@ $config =
               'host' => null, # only set if != server
               'debug' => false, # print extra debug info
               'public' => array()), # JIDs of users who want to receive the public stream
+        'invite' =>
+        array('enabled' => true),
         'sphinx' =>
         array('enabled' => false,
               'server' => 'localhost',
@@ -187,6 +183,10 @@ $config =
         array('piddir' => '/var/run',
               'user' => false,
               'group' => false),
+        'sms' =>
+        array('enabled' => false),
+        'twitter' =>
+        array('enabled' => false),
         'twitterbridge' =>
         array('enabled' => false),
         'integration' =>
@@ -202,7 +202,7 @@ $config =
         'inboxes' =>
         array('enabled' => true), # on by default for new sites
         'newuser' =>
-        array('subscribe' => null,
+        array('default' => null,
               'welcome' => null),
         'snapshot' =>
         array('run' => 'web',
@@ -257,6 +257,14 @@ $config =
         'sessions' =>
         array('handle' => false, // whether to handle sessions ourselves
               'debug' => false), // debugging output for sessions
+        'design' =>
+        array('backgroundcolor' => null, // null -> 'use theme default'
+              'contentcolor' => null,
+              'sidebarcolor' => null,
+              'textcolor' => null,
+              'linkcolor' => null,
+              'backgroundimage' => null,
+              'disposition' => null),
         );
 
 $config['db'] = &PEAR::getStaticProperty('DB_DataObject','options');
@@ -273,11 +281,48 @@ $config['db'] =
         'quote_identifiers' => false,
         'type' => 'mysql' );
 
+// Backward compatibility
+
+$config['site']['design'] =& $config['design'];
+
 if (function_exists('date_default_timezone_set')) {
     /* Work internally in UTC */
     date_default_timezone_set('UTC');
 }
 
+function addPlugin($name, $attrs = null)
+{
+    $name = ucfirst($name);
+    $pluginclass = "{$name}Plugin";
+
+    if (!class_exists($pluginclass)) {
+
+        $files = array("local/plugins/{$pluginclass}.php",
+                       "local/plugins/{$name}/{$pluginclass}.php",
+                       "local/{$pluginclass}.php",
+                       "local/{$name}/{$pluginclass}.php",
+                       "plugins/{$pluginclass}.php",
+                       "plugins/{$name}/{$pluginclass}.php");
+
+        foreach ($files as $file) {
+            $fullpath = INSTALLDIR.'/'.$file;
+            if (@file_exists($fullpath)) {
+                include_once($fullpath);
+                break;
+            }
+        }
+    }
+
+    $inst = new $pluginclass();
+
+    if (!empty($attrs)) {
+        foreach ($attrs as $aname => $avalue) {
+            $inst->$aname = $avalue;
+        }
+    }
+    return $inst;
+}
+
 // From most general to most specific:
 // server-wide, then vhost-wide, then for a path,
 // finally for a dir (usually only need one of the last two).