]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/config.php
ZERO/SINGLE_DEPTH renamed into ZERO/NESTED_LEVEL
[SourceForge/phpwiki.git] / lib / config.php
1 <?php
2    // essential internal stuff -- skip it
3    set_magic_quotes_runtime(0);
4    error_reporting(E_ALL ^ E_NOTICE);
5
6    if (!function_exists('rcs_id')) {
7       function rcs_id($id) { echo "<!-- $id -->\n"; };
8    }
9    rcs_id('$Id: config.php,v 1.19 2001-01-04 18:32:43 ahollosi Exp $');
10    // end essential internal stuff
11
12
13    /////////////////////////////////////////////////////////////////////
14    // Constants and settings. Edit the values below for your site.
15    /////////////////////////////////////////////////////////////////////
16
17
18    // URL of index.php e.g. http://yoursite.com/phpwiki/index.php
19    // you can leave this empty - it will be calculated automatically
20    $ScriptUrl = "";
21    // URL of admin.php e.g. http://yoursite.com/phpwiki/admin.php
22    // you can leave this empty - it will be calculated automatically
23    // if you fill in $ScriptUrl you *MUST* fill in $AdminUrl as well!
24    $AdminUrl = "";
25
26    //  Select your language - default language "C": English
27    // other languages available: Dutch "nl", Spanish "es", German "de"
28    $LANG="C";
29
30    /////////////////////////////////////////////////////////////////////
31    // Database section
32    // set your database here and edit the according section below
33    $WhichDatabase = 'dbm'; // use one of "dbm", "mysql", "pgsql", "msql",
34                            // or "file"
35    
36    // DBM settings (default)
37    if ($WhichDatabase == 'dbm') {
38       $DBMdir = "/tmp";
39       $WikiPageStore = "wiki";
40       $ArchivePageStore = "archive";
41       $WikiDB['wiki']      = "$DBMdir/wikipagesdb";
42       $WikiDB['archive']   = "$DBMdir/wikiarchivedb";
43       $WikiDB['wikilinks'] = "$DBMdir/wikilinksdb";
44       $WikiDB['hottopics'] = "$DBMdir/wikihottopicsdb";
45       $WikiDB['hitcount']  = "$DBMdir/wikihitcountdb";
46       // try this many times if the dbm is unavailable
47       define("MAX_DBM_ATTEMPTS", 20);
48       include "lib/dbmlib.php";
49
50    // MySQL settings -- see INSTALL.mysql for details on using MySQL
51    } elseif ($WhichDatabase == 'mysql') {
52       $WikiPageStore = "wiki";
53       $ArchivePageStore = "archive";
54       $WikiLinksStore = "wikilinks";
55       $WikiScoreStore = "wikiscore";
56       $HitCountStore = "hitcount";
57       $mysql_server = 'localhost';
58       $mysql_user = 'root';
59       $mysql_pwd = '';
60       $mysql_db = 'wiki';
61       include "lib/mysql.php";
62
63    // PostgreSQL settings -- see INSTALL.pgsql for more details
64    } elseif ($WhichDatabase == 'pgsql') {
65       $pg_dbhost    = "localhost";
66       $pg_dbport    = "5432";
67       $WikiDataBase  = "wiki"; // name of the database in Postgresql
68       $WikiPageStore = "wiki";
69       $ArchivePageStore = "archive";
70       $WikiLinksPageStore = "wikilinks";
71       $HotTopicsPageStore = "hottopics";
72       $HitCountPageStore = "hitcount";
73       include "lib/pgsql.php";
74
75    // MiniSQL (mSQL) settings -- see INSTALL.msql for details on using mSQL
76    } elseif ($WhichDatabase == 'msql') {
77       $msql_db = "wiki";
78       $WikiPageStore = array();
79       $ArchivePageStore = array();
80       $WikiPageStore['table']         = "wiki";
81       $WikiPageStore['page_table']    = "wikipages";
82       $ArchivePageStore['table']      = "archive";
83       $ArchivePageStore['page_table'] = "archivepages";
84       // should be the same as wikipages.line
85       define("MSQL_MAX_LINE_LENGTH", 128);
86       include "lib/msql.php";
87
88    // Filesystem DB settings
89    } elseif ($WhichDatabase == 'file') {
90       $DBdir = "/tmp/wiki";
91       $WikiPageStore = "wiki";
92       $ArchivePageStore = "archive";
93       $WikiDB['wiki']      = "$DBdir/pages";
94       $WikiDB['archive']   = "$DBdir/archive";
95       $WikiDB['wikilinks'] = "$DBdir/links";
96       $WikiDB['hottopics'] = "$DBdir/hottopics";
97       $WikiDB['hitcount']  = "$DBdir/hitcount";
98       include "lib/db_filesystem.php";
99
100     } else die("Invalid '\$WhichDatabase' in lib/config.php"); 
101
102
103    /////////////////////////////////////////////////////////////////////
104    // Miscellanious
105
106    // logo image (path relative to index.php)
107    $logo = "images/wikibase.png";
108    // signature image which is shown after saving an edited page
109    $SignatureImg = "images/signature.png";
110
111    // date & time formats used to display modification times, etc.
112    // formats are given as format strings to PHP date() function
113    $datetimeformat = "F j, Y";  // may contain time of day
114    $dateformat = "F j, Y";      // must not contain time
115
116    // this defines how many page names to list when displaying
117    // the MostPopular pages; the default is to show the 20 most popular pages
118    define("MOST_POPULAR_LIST_LENGTH", 20);
119
120    // this defines how many page names to list when displaying related pages
121    define("NUM_RELATED_PAGES", 5);
122
123    // number of user-defined external references, i.e. "[1]"
124    define("NUM_LINKS", 12);
125
126    // allowed protocols for links - be careful not to allow "javascript:"
127    // within a named link [name|uri] one more protocol is defined: phpwiki
128    $AllowedProtocols = "http|https|mailto|ftp|news|gopher";
129
130    // URLs ending with the following extension should be inlined as images
131    $InlineImages = "png|jpg|gif";
132
133    // Perl regexp for WikiNames
134    // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well
135    $WikiNameRegexp = "(?<![A-Za-z0-9])([A-Z][a-z]+){2,}(?![A-Za-z0-9])";
136
137
138
139    /////////////////////////////////////////////////////////////////////
140    // Original pages and layout
141
142    // need to define localization function first -- skip this
143    if (!function_exists ('gettext')) {
144       $lcfile = "locale/$LANG/LC_MESSAGES/phpwiki.php";
145       if (file_exists($lcfile)) { include($lcfile); }
146       else { $locale = array(); }
147
148       function gettext ($text) { 
149          global $locale;
150          if (!empty ($locale[$text]))
151            return $locale[$text];
152          return $text;
153       }
154    } else {
155       putenv ("LANG=$LANG");
156       bindtextdomain ("phpwiki", "./locale");
157       textdomain ("phpwiki");
158    }
159    // end of localization function
160
161    // Template files (filenames are relative to script position)
162    $templates = array(
163         "BROWSE" =>    gettext("templates/browse.html"),
164         "EDITPAGE" =>  gettext("templates/editpage.html"),
165         "EDITLINKS" => gettext("templates/editlinks.html"),
166         "MESSAGE" =>   gettext("templates/message.html")
167         );
168
169    /* WIKI_PGSRC -- specifies the source for the initial page contents
170     * of the Wiki.  The setting of WIKI_PGSRC only has effect when
171     * the wiki is accessed for the first time (or after clearing the
172     * database.) WIKI_PGSRC can either name a directory or a zip file.
173     * In either case WIKI_PGSRC is scanned for files --- one file per page.
174     *
175     * If the files appear to be MIME formatted messages, they are
176     * scanned for application/x-phpwiki content-types.  Any suitable
177     * content is added to the wiki.
178     * The files can also be plain text files, in which case the page name
179     * is taken from the file name.
180     */
181
182    define('WIKI_PGSRC', gettext("./pgsrc")); // Default (old) behavior.
183    //define('WIKI_PGSRC', './wiki.zip'); // New style.
184
185    // DEFAULT_WIKI_PGSRC is only used when the language is *not*
186    // the default (English) and when reading from a directory:
187    // in that case some English pages are inserted into the wiki as well
188    // DEFAULT_WIKI_PGSRC defines where the English pages reside 
189    define('DEFAULT_WIKI_PGSRC', "./pgsrc");
190
191
192
193    //////////////////////////////////////////////////////////////////////
194    // you shouldn't have to edit anyting below this line
195
196    if (empty($ScriptUrl)) {
197       $port = ($SERVER_PORT == 80) ? '' : ":$SERVER_PORT";
198       $ScriptUrl = "http://$SERVER_NAME$port$SCRIPT_NAME";
199    }
200    if (defined('WIKI_ADMIN') && !empty($AdminUrl))
201       $ScriptUrl = $AdminUrl;
202
203    $LogoImage = "<img src=\"$logo\" border=0 ALT=\"[PhpWiki!]\">";
204    $LogoImage = "<a href=\"$ScriptUrl\">$LogoImage</a>";
205
206    $FieldSeparator = "\263";
207
208    if (isset($PHP_AUTH_USER)) {
209         $remoteuser = $PHP_AUTH_USER;
210    } else {
211
212       // Apache won't show REMOTE_HOST unless the admin configured it
213       // properly. We'll be nice and see if it's there.
214
215       getenv('REMOTE_HOST') ? ($remoteuser = getenv('REMOTE_HOST'))
216                             : ($remoteuser = getenv('REMOTE_ADDR'));
217    }
218
219    // constants used for HTML output. HTML tags may allow nesting
220    // other tags always start at level 0
221    define("ZERO_LEVEL", 0);
222    define("NESTED_LEVEL", 1);
223
224    // constants for flags in $pagehash
225    define("FLAG_PAGE_LOCKED", 1);
226 ?>