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 abstract static function getSettings();
78 static function defaultPlugins() {
86 'StrictTransportSecurity' => null,
93 * Settings for a 'public' site
95 class PublicSite extends SiteProfileSettings
98 * Get the settings for this site profile
100 * @return type array an array of settings
102 static function getSettings() {
105 // We only want to change these values, not replace entire 'site' array
106 'site' => array_merge(
107 $config['site'], array(
108 'inviteonly' => false,
114 'default' => array_merge(self::defaultPlugins(), array(
115 'ClientSideShorten' => null,
117 'ExtendedProfile' => null,
122 'discovery' => array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)
128 * Settings for a 'private' site
130 * // XXX Too business oriented?
132 class PrivateSite extends SiteProfileSettings
135 * Get the settings for this site profile
137 * @return type array an array of settings
139 static function getSettings() {
142 // We only want to change these values, not replace entire 'site' array
143 'site' => array_merge(
144 $config['site'], array(
145 'inviteonly' => true,
150 'default' => array_merge(self::defaultPlugins(), array(
151 'ClientSideShorten' => null,
153 'ExtendedProfile' => null,
154 'EmailRegistration' => null,
157 'MobileProfile' => null,
160 'profile' => array('delete' => 'true'),
161 'license' => array('type' => 'private'),
162 'attachments' => array(
163 // Only allow uploads of pictures and MS Office files
164 'supported' => array(
170 'application/msword',
171 'application/vnd.ms-office',
172 'application/vnd.ms-excel',
173 'application/vnd.ms-powerpoint',
177 'discovery' => array('cors' => false) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)
183 * Settings for a 'community' site
185 class CommunitySite extends SiteProfileSettings
188 * Get the settings for this site profile
190 * @return type array an array of settings
192 static function getSettings() {
195 // We only want to change these values, not replace entire 'site' array
196 'site' => array_merge(
197 $config['site'], array(
203 'default' => array_merge(self::defaultPlugins(), array(
204 'ClientSideShorten' => null,
210 'discovery' => array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)
217 * Settings for a 'singleuser' site
219 class SingleuserSite extends SiteProfileSettings
222 * Get the settings for this site profile
224 * @return type array an array of settings
226 static function getSettings() {
229 'singleuser' => array('enabled' => true),
230 // We only want to change these values, not replace entire 'site' array
231 'site' => array_merge(
232 $config['site'], array(
238 'default' => array_merge(self::defaultPlugins(), array(
239 'ClientSideShorten' => null,
242 'MobileProfile' => null,
244 'TwitterBridge' => null,
245 'FacebookBridge' => null,
248 'discovery' => array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)