]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - g
Define DATABASE_TYPE so that upgrade works for Gforge when checking db version.
[SourceForge/phpwiki.git] / g
1 <?php // -*-php-*- $Id$
2
3 /*
4  * Copyright (C) 2008-2009 Alcatel-Lucent
5  *
6  * This file is part of PhpWiki.
7  *
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.
12  *
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.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with PhpWiki; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21 */
22
23 /*
24  * Standard Alcatel-Lucent disclaimer for contributing to open source
25  *
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
31  * Contribution.
32  *
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
42  * ALONE BASIS."
43  */
44
45 ini_set("memory_limit", "64M");
46
47 // Disable compression, seems needed to get all the messages.
48 $no_gz_buffer=true;
49
50 require_once('pre.php');
51
52 if (!$group_id || !$project) {
53     exit_error("Invalid Project", "Invalid Project");
54 } else if (!($project->usesPlugin("wiki"))) {
55     exit_error("Wiki plugin not activated in project", $project->getPublicName());
56 } else {
57
58     $group_name = $project->getUnixName();
59     $group_public_name = $project->getPublicName();
60     $is_external = $project->getIsExternal();
61
62     define('VIRTUAL_PATH', '/wiki/g/'.$group_name);
63     define('PAGE_PREFIX', '_g'.$group_id.'_');
64
65     define('THEME', 'gforge');
66
67     // For Gforge, we create some specific pages, located in the theme
68     // except for project "help"
69     if ($group_name == "help") {
70         define('WIKI_PGSRC', 'pgsrc/');
71     } else {
72         define('WIKI_PGSRC', 'themes/gforge/pgsrc/');
73     }
74
75     define('GFORGE', true);
76
77     define('PATH_INFO_PREFIX', '/'.$group_name . '/');
78     define('USE_PATH_INFO', true);
79
80     define('WIKI_NAME', $group_name);
81
82     define('UPLOAD_FILE_PATH', '/opt/groups/'.WIKI_NAME.'/www/uploads/');
83     // define('UPLOAD_DATA_PATH', SERVER_URL . '/www/'.WIKI_NAME.'/uploads/');
84     define('UPLOAD_DATA_PATH', '/www/'.WIKI_NAME.'/uploads/');
85
86     // Do not use a directory per user but only one (per project)
87     define('UPLOAD_USERDIR', false);
88
89     // Use black list of extensions instead of white list
90     define('DISABLE_UPLOAD_ONLY_ALLOWED_EXTENSIONS', true);
91
92     // Get the maximum upload filesize from PHP config
93     define('MAX_UPLOAD_SIZE', octets(ini_get('upload_max_filesize')));
94
95     // GForge is UTF-8, so use the same.
96     define('CHARSET', 'UTF-8');
97
98     // Disable access log (already in apache & gforge).
99     define('ACCESS_LOG_SQL', 0);
100
101     define('DEBUG', ($sys_install_type != 'production'));
102     // define('_DEBUG_LOGIN', true);
103
104     // Postgesql
105     define('DATABASE_TYPE', 'SQL');
106
107     // Disable VACUUM (they are performed every night)
108     define('DATABASE_OPTIMISE_FREQUENCY', 0);
109
110     define('ADMIN_USER', 'ACOS Forge Administrator');
111     define('ADMIN_PASSWD', 'xxx');
112
113     // Allow ".jpeg" as extension
114     define('INLINE_IMAGES', 'png|jpg|jpeg|gif');
115
116     // Allow parsing of headers for CreateToc
117     define('TOC_FULL_SYNTAX', true);
118
119     // Allow <div> and <span> in wiki code
120     define('ENABLE_MARKUP_DIVSPAN', true);
121
122     // Disable ENABLE_ACDROPDOWN, it creates a <style> in the <body> (illegal)
123     define('ENABLE_ACDROPDOWN', false);
124     define('ENABLE_AJAX', false);
125
126     define('TOOLBAR_PAGELINK_PULLDOWN', false);
127     define('TOOLBAR_TEMPLATE_PULLDOWN', false);
128     define('TOOLBAR_IMAGE_PULLDOWN', true);
129
130     // Disable WYSIWYG
131     define('ENABLE_WYSIWYG', false);
132     define('WYSIWYG_BACKEND', 'tinymce');
133     define('WYSIWYG_DEFAULT_PAGETYPE_HTML', false);
134
135     // Disable public pages
136     define('ENABLE_PAGE_PUBLIC', false);
137     
138     // Enable external pages
139     define('ENABLE_EXTERNAL_PAGES', $is_external);
140
141     // Let all revisions be stored. Default since 1.3.11
142     define('MAJOR_MIN_KEEP', 2147483647);
143     define('MINOR_MIN_KEEP', 2147483647);
144     define('MAJOR_MAX_AGE', 2147483647);
145     define('MAJOR_KEEP', 2147483647);
146     define('MINOR_MAX_AGE', 2147483647);
147     define('MINOR_KEEP', 2147483647);
148     define('AUTHOR_MAX_AGE', 2147483647);
149     define('AUTHOR_KEEP', 2147483647);
150     define('AUTHOR_MIN_AGE', 2147483647);
151     define('AUTHOR_MAX_KEEP', 2147483647);
152
153     //
154     // Define access rights for the wiki.
155     //
156
157     // Allow anonymous user to view the pages.
158     define('ALLOW_ANON_USER', true);
159
160     // Do not allow anon users to edit pages
161     define('ALLOW_ANON_EDIT', false);
162
163     // Do not allow fake user
164     define('ALLOW_BOGO_LOGIN', false);
165     define('ALLOW_USER_PASSWORDS', true);
166
167     // A dedicated auth has been created to get auth from GForge
168     $USER_AUTH_ORDER = array("GForge");
169     define('USER_AUTH_ORDER', 'GForge');
170     define('USER_AUTH_POLICY', 'strict');
171
172     define('EXTERNAL_LINK_TARGET', '_top');
173
174     // Override the default configuration for CONSTANTS before index.php
175     $LANG='en'; $LC_ALL='en_US';
176
177     // We use a local interwiki map file
178     define('INTERWIKI_MAP_FILE', 'themes/gforge/interwiki.map');
179
180     define('DEFAULT_WIKI_PAGES', "");
181
182     define('DBAUTH_AUTH_CHECK', "SELECT IF(passwd='\$password',1,0) as ok FROM plugin_wiki_pref WHERE userid='\$userid'");
183     define('DBAUTH_AUTH_USER_EXISTS', "SELECT userid FROM plugin_wiki_pref WHERE userid='\$userid'");
184     define('DBAUTH_AUTH_CREATE', "INSERT INTO plugin_wiki_pref (passwd,userid) VALUES ('\$password','\$userid')");
185     define('DBAUTH_PREF_SELECT', "SELECT prefs FROM plugin_wiki_pref WHERE userid='\$userid'");
186     define('DBAUTH_PREF_UPDATE', "UPDATE plugin_wiki_pref SET prefs='\$pref_blob' WHERE userid='\$userid'");
187     define('DBAUTH_PREF_INSERT', "INSERT INTO plugin_wiki_pref (prefs,userid) VALUES ('\$pref_blob','\$userid')");
188     define('DBAUTH_IS_MEMBER', "SELECT userid FROM plugin_wiki_pref WHERE userid='\$userid' AND groupname='\$groupname'");
189     define('DBAUTH_GROUP_MEMBERS', "SELECT userid FROM plugin_wiki_pref WHERE groupname='\$groupname'");
190     define('DBAUTH_USER_GROUPS', "SELECT groupname FROM plugin_wiki_pref WHERE userid='\$userid'");
191
192     define('USE_DB_SESSION', true);
193
194     define('USE_BYTEA', true);
195
196     define('ENABLE_SPAMBLOCKLIST', false);
197     
198     define('ENCRYPTED_PASSWD', true);
199
200     define('ENABLE_REVERSE_DNS', true);
201
202     define('ZIPDUMP_AUTH', false);
203
204     define('ENABLE_RAW_HTML', true);
205
206     define('ENABLE_RAW_HTML_LOCKEDONLY', true);
207
208     define('ENABLE_RAW_HTML_SAFE', true);
209
210     define('STRICT_MAILABLE_PAGEDUMPS', false);
211
212     // Perhaps propose Web DAV location ?
213     define('DEFAULT_DUMP_DIR', "");
214     define('HTML_DUMP_DIR', "");
215     define('HTML_DUMP_SUFFIX', ".html");
216
217     define('MINOR_EDIT_TIMEOUT', 604800);
218
219     define('COMPRESS_OUTPUT', false);
220
221     define('CACHE_CONTROL', "NO_CACHE");
222
223     define('CACHE_CONTROL_MAX_AGE', 600);
224
225     define('COOKIE_EXPIRATION_DAYS', 365);
226
227     define('GROUP_METHOD', "WIKIPAGE");
228
229     define('DBAUTH_AUTH_CRYPT_METHOD', "plain");
230
231     define('DEFAULT_LANGUAGE', "en");
232
233     define('DISABLE_GETIMAGESIZE', true);
234
235     if (isset($sys_use_selenium) && $sys_use_selenium) {
236         // Temporary disabled for selenium based tests.
237         define('ENABLE_EDIT_TOOLBAR', false);
238     }
239
240     // If the user is logged in, let the Wiki know
241     if (session_loggedin()){
242         // let php do it's session stuff too!
243         //ini_set('session.save_handler', 'files');
244         // session_start();
245         $user = session_get_user();
246
247         if ($user && is_object($user) && !$user->isError() && $user->isActive()) {
248             $user_name = $user->getRealName();
249             $_SESSION['user_id'] = $user_name;
250             $_SERVER['PHP_AUTH_USER'] = $user_name;
251             $HTTP_SERVER_VARS['PHP_AUTH_USER'] = $user_name;
252         }
253     } else {
254         // clear out the globals, just in case...
255     }
256
257     // Load the default configuration.
258     include "index.php";
259
260     // Override the default configuration for VARIABLES after index.php:
261     // E.g. Use another DB:
262     $DBParams['dbtype'] = 'SQL';
263     $DBParams['dsn']    = 'pgsql://' . $sys_dbuser . ':' .
264         $sys_dbpasswd . '@' . $sys_dbhost .'/' . $sys_dbname;
265
266     $DBParams['prefix'] = "plugin_wiki_";
267
268     // Start the wiki
269     include "lib/main.php";
270 }
271
272 /**
273  * Return a number of octets from a string like "300M"
274  */
275 function octets($val) {
276     $val = trim($val);
277     $last = strtolower($val[strlen($val)-1]);
278     switch($last) {
279         // The 'G' modifier is available since PHP 5.1.0
280         case 'g':
281             $val *= 1024;
282         case 'm':
283             $val *= 1024;
284         case 'k':
285             $val *= 1024;
286     }
287     return $val;
288 }
289 ?>