]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/config.php
internationalization patch (based on Jan Nieuwenhuizen's original patch)
[SourceForge/phpwiki.git] / lib / config.php
1 <?php
2    if (!function_exists('rcs_id')) {
3       function rcs_id($id) { echo "<!-- $id -->\n"; };
4    }
5    rcs_id('$Id: config.php,v 1.6 2000-10-19 21:36:50 ahollosi Exp $');
6
7    /*
8       Constants and settings. Edit the values below for
9       your site. You need two image files, a banner and 
10       a signature. The dbm file MUST be writable by the
11       web server or this won't work. If you configure your
12       server to allow index.php as an index file, you 
13       can just give the URL without the script name.
14    */
15
16    // If you need to access your Wiki from assorted locations and
17    // you use DHCP, this setting might work for you:
18
19    //$ServerAddress = "http:";
20
21    // It works quite well thanks to relative URIs. (Yes, that's just
22    // 'http:'). If find that you want an explicit address (recommended), 
23    // you can set one yourself by changing and uncommenting:
24
25    //$ServerAddress = "http://your.hostname.org/phpwiki/";
26
27    // Or you could use the if/else statement below to deduce
28    // the $ServerAddress dynamically. (Default)
29
30    if (preg_match("#(.*?)([^/]*$)#", $REQUEST_URI, $matches)) {
31       $ServerAddress = "http://$SERVER_NAME:$SERVER_PORT" . $matches[1];
32    } else {
33       $ServerAddress = "http://$SERVER_NAME:$SERVER_PORT$REQUEST_URI";
34    }
35
36    //  Select your language here
37  
38    $LANG="C"; // (What should be the) Default: English
39    // $LANG="nl";  // We all speak dutch, no?
40
41    if (!function_exists ('gettext')) {
42       $lcfile = "locale/$LANG/LC_MESSAGES/phpwiki.php";
43       if(file_exists($lcfile)) {
44          include($lcfile);
45       } else {
46          $locale = array();
47       }
48
49       function gettext ($text) { 
50          global $locale;
51          if (!empty ($locale[$text]))
52            return $locale[$text];
53          return $text;
54       }
55    } else {
56       putenv ("LANG=$LANG");
57       bindtextdomain ("phpwiki", "./locale");
58       textdomain ("phpwiki");
59    }
60
61    // if you are using MySQL instead of a DBM to store your
62    // Wiki pages, use mysql.php instead of dbmlib.php
63    // See INSTALL.mysql for details on using MySQL
64
65    // if you are using Postgressl instead of a DBM to store your
66    // Wiki pages, use pgsql.php instead of dbmlib.php
67    // See INSTALL.pgsql for details on using Postgresql
68
69    // if you are using mSQL instead of a DBM to store your
70    // Wiki pages, use msql.php instead of dbmlib.php
71    // See INSTALL.mysql for details on using mSQL
72
73
74    // DBM settings (default)
75    include "lib/dbmlib.php";
76    $DBMdir = "/tmp";
77    $WikiPageStore = "wiki";
78    $ArchivePageStore = "archive";
79    $WikiDB['wiki']      = "$DBMdir/wikipagesdb";
80    $WikiDB['archive']   = "$DBMdir/wikiarchivedb";
81    $WikiDB['wikilinks'] = "$DBMdir/wikilinksdb";
82    $WikiDB['hottopics'] = "$DBMdir/wikihottopicsdb";
83    $WikiDB['hitcount']  = "$DBMdir/wikihitcountdb";
84
85 /*
86    // MySQL settings (thanks Arno Hollosi! <ahollosi@iname.com>)
87    // Comment out the lines above (for the DBM) if you use these
88    include "lib/mysql.php";
89    $WikiPageStore = "wiki";
90    $ArchivePageStore = "archive";
91    $mysql_server = 'localhost';
92    $mysql_user = 'root';
93    $mysql_pwd = '';
94    $mysql_db = 'wiki';
95 */
96
97 /*
98    // PostgreSQL settings. 
99    include "lib/pgsql.php";
100    $WikiDataBase  = "wiki"; // name of the database in Postgresql
101    $WikiPageStore = "wiki"; // name of the table where pages are stored
102    $ArchivePageStore = "archive"; // name of the table where pages are archived
103    $pg_dbhost    = "localhost";
104    $pg_dbport    = "5432";
105 */
106
107
108 /*
109    // MiniSQL (mSQL) settings.
110    include "lib/msql.php";
111    $msql_db = "wiki";
112    // should be the same as wikipages.line
113    define("MSQL_MAX_LINE_LENGTH", 128);
114    $WikiPageStore = array();
115    $ArchivePageStore = array();
116
117    $WikiPageStore['table']         = "wiki";
118    $WikiPageStore['page_table']    = "wikipages";
119    $ArchivePageStore['table']      = "archive";
120    $ArchivePageStore['page_table'] = "archivepages";
121    // end mSQL settings
122 */
123
124 /*
125    // Filesystem DB settings
126    include "lib/db_filesystem.php";
127    $DBdir = "/tmp/wiki";
128    $WikiPageStore = "wiki";
129    $ArchivePageStore = "archive";
130    $WikiDB['wiki']      = "$DBdir/pages";
131    $WikiDB['archive']   = "$DBdir/archive";
132    $WikiDB['wikilinks'] = "$DBdir/links";
133    $WikiDB['hottopics'] = "$DBdir/hottopics";
134    $WikiDB['hitcount']  = "$DBdir/hitcount";
135    // End Filsystem Settings
136 */
137
138
139    /* WIKI_PGSRC
140     *
141     * This constant specifies the source for the initial page contents
142     * of the Wiki.  The setting of WIKI_PGSRC only has effect when
143     * the wiki is accessed for the first time (or after clearing the
144     * database.)
145     *
146     * The WIKI_PGSRC can either name a directory or a zip file.
147     * In either case WIKI_PGSRC is scanned for files --- one file per page.
148     *
149     * FIXME: this documentation needs to be clarified.
150     *
151     * If the files appear to be MIME formatted messages, they are
152     * scanned for application/x-phpwiki content-types.  Any suitable
153     * content is added to the wiki.
154     *
155     * The files can also be plain text files, in which case the page name
156     * is taken from the file name.
157     */
158    define('WIKI_PGSRC', gettext("./pgsrc")); // Default (old) behavior.
159    //define('WIKI_PGSRC', './wiki.zip'); // New style.
160   
161    $ScriptName = "index.php";
162
163    $SignatureImg = "images/signature.png";
164    $logo = "images/wikibase.png";
165
166    // Template files (filenames are relative to script position)
167    $templates = array(
168         "BROWSE" =>    gettext("templates/browse.html"),
169         "EDITPAGE" =>  gettext("templates/editpage.html"),
170         "EDITLINKS" => gettext("templates/editlinks.html"),
171         "MESSAGE" =>   gettext("templates/message.html")
172         );
173
174    // date & time formats used to display modification times, etc.
175    // formats are given as format strings to PHP date() function
176    $datetimeformat = "F j, Y";  // may contain time of day
177    $dateformat = "F j, Y";      // must not contain time
178
179    // allowed protocols for links - be careful not to allow "javascript:"
180    $AllowedProtocols = "http|https|mailto|ftp|news|gopher";
181
182    // this defines how many page names to list when displaying
183    // the MostPopular pages; i.e. setting this to 20 will show
184    // the 20 most popular pages
185    define("MOST_POPULAR_LIST_LENGTH", 20);
186
187    // this defines how many page names to list when displaying
188    // scored related pages
189    define("NUM_RELATED_PAGES", 5);
190
191    // number of user-defined external links, i.e. "[1]"
192    define("NUM_LINKS", 12);
193
194    // try this many times if the dbm is unavailable
195    define("MAX_DBM_ATTEMPTS", 20);
196
197
198    //////////////////////////////////////////////////////////////////////
199
200    // you shouldn't have to edit anyting below this line
201
202    $ScriptUrl = $ServerAddress . $ScriptName;
203    $LogoImage = "<img src='${ServerAddress}$logo' border='0'>";
204    $LogoImage = "<a href='$ScriptUrl'>$LogoImage</a>";
205
206    $FieldSeparator = "\263";
207
208    // Apache won't show REMOTE_HOST unless the admin configured it
209    // properly. We'll be nice and see if it's there.
210    empty($REMOTE_HOST) ?
211       ($remoteuser = $REMOTE_ADDR) : ($remoteuser = $REMOTE_HOST);
212
213    // constants used for HTML output. List tags like UL and 
214    // OL have a depth of one, PRE has a depth of 0.
215    define("ZERO_DEPTH", 0);
216    define("SINGLE_DEPTH", 1);
217
218    // constants for flags in $pagehash
219    define("FLAG_PAGE_LOCKED", 1);
220 ?>