1 <?php // -*-php-*- $Id$
4 * Copyright (C) 2008-2010 Alcatel-Lucent
6 * This file is part of PhpWiki.
8 * PhpWiki is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * PhpWiki is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with PhpWiki; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * Standard Alcatel-Lucent disclaimer for contributing to open source
26 * "The Configuration File ("Contribution") has not been tested and/or
27 * validated for release as or in products, combinations with products or
28 * other commercial use. Any use of the Contribution is entirely made at
29 * the user's own responsibility and the user can not rely on any features,
30 * functionalities or performances Alcatel-Lucent has attributed to the
33 * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
34 * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
35 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
36 * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
37 * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
38 * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
39 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
40 * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
41 * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
45 ini_set("memory_limit", "64M");
47 // Disable compression, seems needed to get all the messages.
50 require_once('../../env.inc.php');
51 require_once $gfcommon.'include/pre.php';
52 require_once $gfplugins.'wiki/common/wikiconfig.class.php';
54 if (!$group_id || !$project) {
56 } else if (!($project->usesPlugin("wiki"))) {
57 exit_disabled('home');
62 $robots = "noindex,nofollow";
64 $group_name = $project->getUnixName();
65 $group_public_name = $project->getPublicName();
67 $is_external = method_exists($project, 'getIsExternal') && $project->getIsExternal();
69 $wc = new WikiConfig($group_id);
71 define('VIRTUAL_PATH', '/wiki/g/'.$group_name);
72 define('PAGE_PREFIX', '_g'.$group_id.'_');
74 define('THEME', 'fusionforge');
76 // For FusionForge, we create some specific pages, located in the theme
77 // except for project "help"
78 if ($group_name == "help") {
79 define('WIKI_PGSRC', 'pgsrc');
81 define('WIKI_PGSRC', 'themes/fusionforge/pgsrc');
84 define('FUSIONFORGE', true);
86 define('PATH_INFO_PREFIX', '/'.$group_name . '/');
87 define('USE_PATH_INFO', true);
89 define('WIKI_NAME', $group_name);
91 define('DISABLE_MARKUP_WIKIWORD', $wc->getWikiConfig('DISABLE_MARKUP_WIKIWORD'));
93 define('NUM_SPAM_LINKS', 20 * ($wc->getWikiConfig('NUM_SPAM_LINKS')));
95 define('ENABLE_RATEIT', $wc->getWikiConfig('ENABLE_RATEIT'));
97 define('UPLOAD_FILE_PATH', '/opt/groups/'.WIKI_NAME.'/www/uploads/');
98 // define('UPLOAD_DATA_PATH', SERVER_URL . '/www/'.WIKI_NAME.'/uploads/');
99 define('UPLOAD_DATA_PATH', '/www/'.WIKI_NAME.'/uploads/');
101 // Do not use a directory per user but only one (per project)
102 define('UPLOAD_USERDIR', false);
104 // Use black list of extensions instead of white list
105 define('DISABLE_UPLOAD_ONLY_ALLOWED_EXTENSIONS', true);
107 // Get the maximum upload filesize from PHP config
108 define('MAX_UPLOAD_SIZE', octets(ini_get('upload_max_filesize')));
110 // Disable access log (already in Apache & FusionForge).
111 define('ACCESS_LOG_SQL', 0);
113 define('DEBUG', ($sys_install_type != 'production'));
116 define('DATABASE_TYPE', 'SQL');
117 // Dummy value (to avoid warning in SystemInfo plugin)
118 define('DATABASE_DSN', 'pgsql://localhost/user_phpwiki');
120 // Disable VACUUM (they are performed every night)
121 define('DATABASE_OPTIMISE_FREQUENCY', 0);
123 // TBD: the name should be taken from FusionForge
124 // define('ADMIN_USER', 'ACOS Forge Administrator');
125 define('ADMIN_USER', 'The PhpWiki programming team');
127 define('ADMIN_PASSWD', 'xxx');
129 // Allow ".svg" and ".swf" as extensions
130 define('INLINE_IMAGES', 'png|jpg|jpeg|gif|svg|swf');
132 // Allow <div> and <span> in wiki code
133 define('ENABLE_MARKUP_DIVSPAN', true);
135 // Disable ENABLE_ACDROPDOWN, it creates a <style> in the <body> (illegal)
136 define('ENABLE_ACDROPDOWN', false);
137 define('ENABLE_AJAX', false);
139 define('TOOLBAR_PAGELINK_PULLDOWN', false);
140 define('TOOLBAR_TEMPLATE_PULLDOWN', false);
141 define('TOOLBAR_IMAGE_PULLDOWN', true);
143 // Enable external pages
144 define('ENABLE_EXTERNAL_PAGES', $is_external);
146 // Let all revisions be stored. Default since 1.3.11
147 define('MAJOR_MIN_KEEP', 2147483647);
148 define('MINOR_MIN_KEEP', 2147483647);
149 define('MAJOR_MAX_AGE', 2147483647);
150 define('MAJOR_KEEP', 2147483647);
151 define('MINOR_MAX_AGE', 2147483647);
152 define('MINOR_KEEP', 2147483647);
153 define('AUTHOR_MAX_AGE', 2147483647);
154 define('AUTHOR_KEEP', 2147483647);
155 define('AUTHOR_MIN_AGE', 2147483647);
156 define('AUTHOR_MAX_KEEP', 2147483647);
159 // Define access rights for the wiki.
162 // Do not allow anon users to edit pages
163 define('ALLOW_ANON_EDIT', false);
165 // Do not allow fake user
166 define('ALLOW_BOGO_LOGIN', false);
168 // A dedicated auth has been created to get auth from FusionForge
169 $USER_AUTH_ORDER = array("FusionForge");
170 define('USER_AUTH_ORDER', 'FusionForge');
171 define('USER_AUTH_POLICY', 'strict');
173 define('EXTERNAL_LINK_TARGET', '_top');
175 // Override the default configuration for CONSTANTS before index.php
176 $LC_ALL = language_name_to_locale_code(choose_language_from_context());
177 $LANG = preg_replace('/_.*/', '', $LC_ALL);
179 // We use a local interwiki map file
180 define('INTERWIKI_MAP_FILE', 'themes/fusionforge/interwiki.map');
182 define('DEFAULT_WIKI_PAGES', "");
184 define('DBAUTH_AUTH_CHECK', "SELECT IF(passwd='\$password',1,0) as ok FROM plugin_wiki_pref WHERE userid='\$userid'");
185 define('DBAUTH_AUTH_USER_EXISTS', "SELECT userid FROM plugin_wiki_pref WHERE userid='\$userid'");
186 define('DBAUTH_AUTH_CREATE', "INSERT INTO plugin_wiki_pref (passwd,userid) VALUES ('\$password','\$userid')");
187 define('DBAUTH_PREF_SELECT', "SELECT prefs FROM plugin_wiki_pref WHERE userid='\$userid'");
188 define('DBAUTH_PREF_UPDATE', "UPDATE plugin_wiki_pref SET prefs='\$pref_blob' WHERE userid='\$userid'");
189 define('DBAUTH_PREF_INSERT', "INSERT INTO plugin_wiki_pref (prefs,userid) VALUES ('\$pref_blob','\$userid')");
190 define('DBAUTH_IS_MEMBER', "SELECT userid FROM plugin_wiki_pref WHERE userid='\$userid' AND groupname='\$groupname'");
191 define('DBAUTH_GROUP_MEMBERS', "SELECT userid FROM plugin_wiki_pref WHERE groupname='\$groupname'");
192 define('DBAUTH_USER_GROUPS', "SELECT groupname FROM plugin_wiki_pref WHERE userid='\$userid'");
194 define('USE_DB_SESSION', true);
196 define('USE_BYTEA', true);
198 define('ENABLE_REVERSE_DNS', false);
201 define('DEFAULT_DUMP_DIR', "/opt/groups/".$group_name."/wikidump/");
202 define('HTML_DUMP_DIR', "/opt/groups/".$group_name."/wikidumphtml/");
204 define('COMPRESS_OUTPUT', false);
206 define('CACHE_CONTROL', "NO_CACHE");
208 $lg = language_name_to_locale_code(forge_get_config('default_language'));
209 $lg = preg_replace('/_.*/', '', $lg);
210 define('DEFAULT_LANGUAGE', $lg);
212 define('DISABLE_GETIMAGESIZE', true);
214 // If the user is logged in, let the Wiki know
215 if (session_loggedin()) {
216 $user = session_get_user();
217 if ($user && is_object($user) && !$user->isError() && $user->isActive()) {
218 $user_name = $user->getRealName();
219 $_SESSION['user_id'] = $user_name;
220 $_SERVER['PHP_AUTH_USER'] = $user_name;
221 $HTTP_SERVER_VARS['PHP_AUTH_USER'] = $user_name;
224 // clear out the globals, just in case...
227 // Load the default configuration.
228 require_once(dirname(__FILE__).'/lib/prepend.php');
229 require_once(dirname(__FILE__).'/lib/IniConfig.php');
230 IniConfig(dirname(__FILE__)."/config/config-default.ini");
232 // Override the default configuration for VARIABLES after index.php:
233 // E.g. Use another DB:
234 $DBParams['dbtype'] = 'SQL';
235 $DBParams['dsn'] = 'ffpgsql://' . $sys_dbuser . ':' .
236 $sys_dbpasswd . '@' . $sys_dbhost .'/' . $sys_dbname;
238 $DBParams['prefix'] = "plugin_wiki_";
241 include dirname(__FILE__).'/lib/main.php';
245 * Return a number of octets from a string like "300M"
247 function octets($val) {
249 $last = strtolower($val[strlen($val)-1]);
251 // The 'G' modifier is available since PHP 5.1.0