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