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