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('STATUSNET')) {
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 defaultPlugins() {
91 'StrictTransportSecurity' => null,
98 * Settings for a 'public' site
100 class PublicSite extends SiteProfileSettings
103 * Get the settings for this site profile
105 * @return type array an array of settings
107 static function getSettings() {
110 // We only want to change these values, not replace entire 'site' array
111 'site' => array_merge(
112 $config['site'], array(
113 'inviteonly' => false,
119 'default' => array_merge(self::defaultPlugins(), array(
120 'ClientSideShorten' => null,
122 'ExtendedProfile' => null,
128 'discovery' => array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)
134 * Settings for a 'private' site
136 * // XXX Too business oriented?
138 class PrivateSite extends SiteProfileSettings
141 * Get the settings for this site profile
143 * @return type array an array of settings
145 static function getSettings() {
148 // We only want to change these values, not replace entire 'site' array
149 'site' => array_merge(
150 $config['site'], array(
151 'inviteonly' => true,
156 'default' => array_merge(self::defaultPlugins(), array(
157 'ClientSideShorten' => null,
159 'ExtendedProfile' => null,
160 'EmailRegistration' => null,
163 'MobileProfile' => null,
166 'profile' => array('delete' => 'true'),
167 'license' => array('type' => 'private'),
168 'attachments' => array(
169 // Only allow uploads of pictures and MS Office files
170 'supported' => array(
176 'application/msword',
177 'application/vnd.ms-office',
178 'application/vnd.ms-excel',
179 'application/vnd.ms-powerpoint',
183 'discovery' => array('cors' => false) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)
189 * Settings for a 'community' site
191 class CommunitySite extends SiteProfileSettings
194 * Get the settings for this site profile
196 * @return type array an array of settings
198 static function getSettings() {
201 // We only want to change these values, not replace entire 'site' array
202 'site' => array_merge(
203 $config['site'], array(
209 'default' => array_merge(self::defaultPlugins(), array(
210 'ClientSideShorten' => null,
217 'discovery' => array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)
224 * Settings for a 'singleuser' site
226 class SingleuserSite extends SiteProfileSettings
229 * Get the settings for this site profile
231 * @return type array an array of settings
233 static function getSettings() {
236 'singleuser' => array('enabled' => true),
237 // We only want to change these values, not replace entire 'site' array
238 'site' => array_merge(
239 $config['site'], array(
245 'default' => array_merge(self::defaultPlugins(), array(
246 'ClientSideShorten' => null,
249 'MobileProfile' => null,
251 'TwitterBridge' => null,
252 'FacebookBridge' => null,
256 'discovery' => array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)