]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/siteprofile.php
getAcctUri function added with related exception
[quix0rs-gnu-social.git] / lib / siteprofile.php
index 53e6482aae762f616fb30159be4ae8e2654557f0..6ab095d7121cfa573945cb309500800685a55b5c 100644 (file)
@@ -48,7 +48,7 @@ class SiteProfile
         $sprofileClass = ucfirst($name) . "Site";
 
         if (class_exists($sprofileClass)) {
-            return $sprofileClass::getSettings();
+            return call_user_func(array($sprofileClass, 'getSettings'));
         } else {
             common_log(
                 LOG_ERR,
@@ -73,7 +73,17 @@ class SiteProfile
  */
 abstract class SiteProfileSettings
 {
-    abstract static function getSettings();
+    static function getSettings()
+    {
+        throw new MethodNotImplementedException(__METHOD__);
+    }
+
+    static function corePlugins() {
+        return common_config('plugins', 'core');
+    }
+    static function defaultPlugins() {
+        return common_config('plugins', 'default');
+    }
 }
 
 /**
@@ -87,32 +97,26 @@ class PublicSite extends SiteProfileSettings
      * @return type array   an array of settings
      */
     static function getSettings() {
+        global $config;
         return array(
-            'site' => array(
-                'inviteonly' => false,
-                'private'    => false
-                ),
+            // We only want to change these values, not replace entire 'site' array
+            'site' => array_merge(
+                $config['site'], array(
+                    'inviteonly' => false,
+                    'private'    => false,
+                    'closed'     => false
+                )
+            ),
             'plugins' => array(
-                'default' => array(
-                    'Activity'                => null,
-                    'Bookmark'                => null,
-                    'ClientSideShorten'       => null,
+                'core'    => self::corePlugins(),
+                'default' => array_merge(self::defaultPlugins(), array(
                     'Directory'               => null,
-                    'Event'                   => null,
                     'ExtendedProfile'         => null,
-                    'Geonames'                => null,
-                    'Gravatar'                => null,
-                    'OpenID'                  => null,
                     'OStatus'                 => null,
-                    'Poll'                    => null,
-                    'QnA'                     => null,
-                    'SearchSub'               => null,
-                    'StrictTransportSecurity' => null,
-                    'TagSub'                  => null
-                ),
-            'discovery' =>
-                array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)
-            )
+                    'WebFinger'               => null,
+                ))
+            ),
+            'discovery' => array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)
         );
     }
 }
@@ -130,31 +134,24 @@ class PrivateSite extends SiteProfileSettings
      * @return type array  an array of settings
      */
     static function getSettings() {
+        global $config;
         return array(
-            'site' => array(
-                'inviteonly' => true,
-                'private'    => true
-                ),
+            // We only want to change these values, not replace entire 'site' array
+            'site' => array_merge(
+                $config['site'], array(
+                    'inviteonly' => true,
+                    'private'    => true,
+                )
+            ),
             'plugins' => array(
-                'default' => array(
-                    'Activity'                => null,
-                    'Bookmark'                => null,
-                    'ClientSideShorten'       => null,
+                'core'    => self::corePlugins(),
+                'default' => array_merge(self::defaultPlugins(), array(
                     'Directory'               => null,
-                    'Event'                   => null,
                     'ExtendedProfile'         => null,
                     'EmailRegistration'       => null,
-                    'Geonames'                => null,
-                    'Gravatar'                => null,
                     'NewMenu'                 => null,
                     'MobileProfile'           => null,
-                    'OpenID'                  => null,
-                    'Poll'                    => null,
-                    'QnA'                     => null,
-                    'SearchSub'               => null,
-                    'StrictTransportSecurity' => null,
-                    'TagSub'                  => null
-                )
+                ))
              ),
             'profile'       => array('delete' => 'true'),
             'license'       => array('type'   => 'private'),
@@ -189,31 +186,24 @@ class CommunitySite extends SiteProfileSettings
      * @return type array  an array of settings
      */
     static function getSettings() {
+        global $config;
         return array(
-            'site' => array(
-                'inviteonly' => true,
-                'private'    => false
-                ),
+            // We only want to change these values, not replace entire 'site' array
+            'site' => array_merge(
+                $config['site'], array(
+                    'private'    => false,
+                    'closed'     => false
+                )
+            ),
             'plugins' => array(
-                'default' => array(
-                    'Activity'                => null,
-                    'Bookmark'                => null,
-                    'ClientSideShorten'       => null,
+                'core'    => self::corePlugins(),
+                'default' => array_merge(self::defaultPlugins(), array(
                     'Directory'               => null,
-                    'Event'                   => null,
-                    'Geonames'                => null,
-                    'Gravatar'                => null,
-                    'OpenID'                  => null,
                     'OStatus'                 => null,
-                    'Poll'                    => null,
-                    'QnA'                     => null,
-                    'SearchSub'               => null,
-                    'StrictTransportSecurity' => null,
-                    'TagSub'                  => null
-                ),
-            'discovery' =>
-                array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)
-            )
+                    'WebFinger'               => null,
+                ))
+            ),
+            'discovery' => array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)
         );
     }
 
@@ -230,34 +220,28 @@ class SingleuserSite extends SiteProfileSettings
      * @return type array  an array of settings
      */
     static function getSettings() {
+        global $config;
         return array(
             'singleuser' => array('enabled' => true),
-            'site' => array(
-                'private'    => false,
-                'closed'     => true,
-                ),
+            // We only want to change these values, not replace entire 'site' array
+            'site' => array_merge(
+                $config['site'], array(
+                    'private'    => false,
+                    'closed'     => true,
+                )
+            ),
             'plugins' => array(
-                'default' => array(
-                    'Activity'                => null,
-                    'Bookmark'                => null,
-                    'ClientSideShorten'       => null,
-                    'Event'                   => null,
-                    'Geonames'                => null,
+                'core'    => self::corePlugins(),
+                'default' => array_merge(self::defaultPlugins(), array(
                     'NewMenu'                 => null,
                     'MobileProfile'           => null,
-                    'OpenID'                  => null,
                     'OStatus'                 => null,
-                    'Poll'                    => null,
-                    'QnA'                     => null,
-                    'SearchSub'               => null,
-                    'StrictTransportSecurity' => null,
-                    'TagSub'                  => null,
                     'TwitterBridge'           => null,
-                    'FacebookBridge'          => null
-                ),
-            'discovery' =>
-                array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)
-            )
+                    'FacebookBridge'          => null,
+                    'WebFinger'               => null,
+                ))
+            ),
+            'discovery' => array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)
         );
     }