]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/statusnet.php
mail paths for docfile
[quix0rs-gnu-social.git] / lib / statusnet.php
index 7cb831696bc02ac512a69f6190469242227371c4..648369ec4482ebf9f1f347aa382d12b13c9d2eee 100644 (file)
@@ -31,6 +31,7 @@ class StatusNet
 {
     protected static $have_config;
     protected static $is_api;
+    protected static $is_ajax;
     protected static $plugins = array();
 
     /**
@@ -169,7 +170,6 @@ class StatusNet
         return $sites;
     }
 
-
     /**
      * Fire initialization events for all instantiated plugins.
      */
@@ -177,6 +177,11 @@ class StatusNet
     {
         // Load default plugins
         foreach (common_config('plugins', 'default') as $name => $params) {
+            $key = 'disable-' . $name;
+            if (common_config('plugins', $key)) {
+                continue;
+            }
+
             if (is_null($params)) {
                 addPlugin($name);
             } else if (is_array($params)) {
@@ -220,12 +225,22 @@ class StatusNet
     {
         return self::$is_api;
     }
-    
+
     public function setApi($mode)
     {
         self::$is_api = $mode;
     }
 
+    public function isAjax()
+    {
+        return self::$is_ajax;
+    }
+
+    public function setAjax($mode)
+    {
+        self::$is_ajax = $mode;
+    }
+
     /**
      * Build default configuration array
      * @return array
@@ -241,7 +256,7 @@ class StatusNet
      * Establish default configuration based on given or default server and path
      * Sets global $_server, $_path, and $config
      */
-    protected static function initDefaults($server, $path)
+    public static function initDefaults($server, $path)
     {
         global $_server, $_path, $config;
 
@@ -357,7 +372,6 @@ class StatusNet
         }
 
         // Backwards compatibility
-
         if (array_key_exists('memcached', $config)) {
             if ($config['memcached']['enabled']) {
                 addPlugin('Memcache', array('servers' => $config['memcached']['server']));
@@ -367,6 +381,37 @@ class StatusNet
                 $config['cache']['base'] = $config['memcached']['base'];
             }
         }
+        if (array_key_exists('xmpp', $config)) {
+            if ($config['xmpp']['enabled']) {
+                addPlugin('xmpp', array(
+                    'server' => $config['xmpp']['server'],
+                    'port' => $config['xmpp']['port'],
+                    'user' => $config['xmpp']['user'],
+                    'resource' => $config['xmpp']['resource'],
+                    'encryption' => $config['xmpp']['encryption'],
+                    'password' => $config['xmpp']['password'],
+                    'host' => $config['xmpp']['host'],
+                    'debug' => $config['xmpp']['debug'],
+                    'public' => $config['xmpp']['public']
+                ));
+            }
+        }
+    }
+
+    /**
+     * Are we running from the web with HTTPS?
+     *
+     * @return boolean true if we're running with HTTPS; else false
+     */
+
+    static function isHTTPS()
+    {
+        // There are some exceptions to this; add them here!
+        if(empty($_SERVER['HTTPS'])) {
+            return false;
+        } else {
+            return $_SERVER['HTTPS'] !== 'off';
+        }
     }
 }