X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fstatusnet.php;h=4c2aacd8f7d229994e41e9be75d2fdafafa25878;hb=1d29ba83150bdd7a23e497ca9a743ac2b6158b6f;hp=7212a4a47d5ebc7db124580ccb110ff7a30ef5f4;hpb=1551fec65a74a4d79c5eb3286015fa839d3a9a41;p=quix0rs-gnu-social.git diff --git a/lib/statusnet.php b/lib/statusnet.php index 7212a4a47d..4c2aacd8f7 100644 --- a/lib/statusnet.php +++ b/lib/statusnet.php @@ -169,7 +169,6 @@ class StatusNet return $sites; } - /** * Fire initialization events for all instantiated plugins. */ @@ -177,6 +176,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,7 +224,7 @@ class StatusNet { return self::$is_api; } - + public function setApi($mode) { self::$is_api = $mode; @@ -241,7 +245,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; @@ -336,8 +340,11 @@ class StatusNet foreach ($config_files as $_config_file) { if (@file_exists($_config_file)) { - include($_config_file); - self::$have_config = true; + // Ignore 0-byte config files + if (filesize($_config_file) > 0) { + include($_config_file); + self::$have_config = true; + } } } @@ -354,7 +361,6 @@ class StatusNet } // Backwards compatibility - if (array_key_exists('memcached', $config)) { if ($config['memcached']['enabled']) { addPlugin('Memcache', array('servers' => $config['memcached']['server'])); @@ -364,6 +370,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'; + } } }