3 * StatusNet, the distributed open-source microblogging tool
5 * A site profile is a set of default settings for a particular style of
6 * StatusNet site: public, private, community, etc.
10 * LICENCE: This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Affero General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Affero General Public License for more details.
20 * You should have received a copy of the GNU Affero General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 * @category Installation
25 * @author Zach Copley <zach@status.net>
26 * @copyright 2011 StatusNet, Inc.
27 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
28 * @link http://status.net/
31 if (!defined('GNUSOCIAL')) {
36 * Helper class for getting the settings for a particular site profile
41 * Returns the config settings for a site profile by name
43 * @param string $name name of a site profile
44 * @return array config settings
46 static public function getSettings($name)
48 $sprofileClass = ucfirst($name) . "Site";
50 if (class_exists($sprofileClass)) {
51 return call_user_func(array($sprofileClass, 'getSettings'));
55 "Unknown site profile '{$name}' specified in config file.",
64 * Site profile settings contain the list of the default settings (and
65 * possibly other information for a particular flavor of StatusNet
66 * installation). These will overwrite base defaults in $config global.
68 * @category Installation
70 * @author Zach Copley <zach@status.net>
71 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
72 * @link http://status.net/
74 abstract class SiteProfileSettings
76 static function getSettings()
78 throw new MethodNotImplementedException(__METHOD__);
81 static function corePlugins() {
82 return common_config('plugins', 'core');
84 static function defaultPlugins() {
85 return common_config('plugins', 'default');
90 * Settings for a 'public' site
92 class PublicSite extends SiteProfileSettings
95 * Get the settings for this site profile
97 * @return type array an array of settings
99 static function getSettings() {
102 // We only want to change these values, not replace entire 'site' array
103 'site' => array_merge(
104 $config['site'], array(
105 'inviteonly' => false,
111 'core' => self::corePlugins(),
112 'default' => array_merge(self::defaultPlugins(), array(
113 'Directory' => array(),
114 'ExtendedProfile' => array(),
115 'OStatus' => array(),
116 'WebFinger' => array(),
119 'discovery' => array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)
125 * Settings for a 'private' site
127 * // XXX Too business oriented?
129 class PrivateSite extends SiteProfileSettings
132 * Get the settings for this site profile
134 * @return type array an array of settings
136 static function getSettings() {
139 // We only want to change these values, not replace entire 'site' array
140 'site' => array_merge(
141 $config['site'], array(
142 'inviteonly' => true,
147 'core' => self::corePlugins(),
148 'default' => array_merge(self::defaultPlugins(), array(
149 'Directory' => array(),
150 'ExtendedProfile' => array(),
151 'EmailRegistration' => array(),
152 'MobileProfile' => array(),
155 'profile' => array('delete' => 'true'),
156 'license' => array('type' => 'private'),
157 'attachments' => array(
158 // Only allow uploads of pictures and MS Office files
159 'supported' => array(
165 'application/msword',
166 'application/vnd.ms-office',
167 'application/vnd.ms-excel',
168 'application/vnd.ms-powerpoint',
172 'discovery' => array('cors' => false) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)
178 * Settings for a 'community' site
180 class CommunitySite extends SiteProfileSettings
183 * Get the settings for this site profile
185 * @return type array an array of settings
187 static function getSettings() {
190 // We only want to change these values, not replace entire 'site' array
191 'site' => array_merge(
192 $config['site'], array(
198 'core' => self::corePlugins(),
199 'default' => array_merge(self::defaultPlugins(), array(
200 'Directory' => array(),
201 'OStatus' => array(),
202 'WebFinger' => array(),
205 'discovery' => array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)
212 * Settings for a 'singleuser' site
214 class SingleuserSite extends SiteProfileSettings
217 * Get the settings for this site profile
219 * @return type array an array of settings
221 static function getSettings() {
224 'singleuser' => array('enabled' => true),
225 // We only want to change these values, not replace entire 'site' array
226 'site' => array_merge(
227 $config['site'], array(
233 'core' => self::corePlugins(),
234 'default' => array_merge(self::defaultPlugins(), array(
235 'MobileProfile' => array(),
236 'OStatus' => array(),
237 'TwitterBridge' => array(),
238 'FacebookBridge' => array(),
239 'WebFinger' => array(),
242 'discovery' => array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)