From: Arno H. <aho...@us...> - 2000-10-31 20:24:34
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory slayer.i.sourceforge.net:/tmp/cvs-serv24035 Modified Files: config.php Log Message: restructured config.php completely -- hope this is more readable / useable Index: config.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/config.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** config.php 2000/10/31 17:07:08 1.12 --- config.php 2000/10/31 20:24:30 1.13 *************** *** 5,50 **** rcs_id('$Id$'); ! /* ! Constants and settings. Edit the values below for ! your site. You need two image files, a banner and ! a signature. The dbm file MUST be writable by the ! web server or this won't work. If you configure your ! server to allow index.php as an index file, you ! can just give the URL without the script name. ! */ ! ! // If you need to access your Wiki from assorted locations and ! // you use DHCP, this setting might work for you: ! ! //$ServerAddress = "http:"; ! ! // It works quite well thanks to relative URIs. (Yes, that's just ! // 'http:'). If find that you want an explicit address (recommended), ! // you can set one yourself by changing and uncommenting: ! //$ServerAddress = "http://your.hostname.org/phpwiki/"; ! // Or you could use the if/else statement below to deduce ! // the $ServerAddress dynamically. (Default) ! if (preg_match("#(.*?)([^/]*$)#", $REQUEST_URI, $matches)) { ! $ServerAddress = "http://$SERVER_NAME:$SERVER_PORT" . $matches[1]; ! } else { ! $ServerAddress = "http://$SERVER_NAME:$SERVER_PORT$REQUEST_URI"; ! } ! // Select your language here ! ! $LANG="C"; // (What should be the) Default: English ! // $LANG="nl"; // We all speak dutch, no? ! // $LANG="es"; // We all speak spanish, no? if (!function_exists ('gettext')) { $lcfile = "locale/$LANG/LC_MESSAGES/phpwiki.php"; ! if(file_exists($lcfile)) { ! include($lcfile); ! } else { ! $locale = array(); ! } function gettext ($text) { --- 5,133 ---- rcs_id('$Id$'); ! ///////////////////////////////////////////////////////////////////// ! // Constants and settings. Edit the values below for your site. ! // URL of index.php e.g. http://yoursite.com/phpwiki/index.php ! // you can leave this empty - it will be calculated automatically ! $ScriptUrl = ""; ! ! // Select your language - default language "C": English ! // other languages available: Dutch "nl", Spanish "es" ! $LANG="C"; ! ! ///////////////////////////////////////////////////////////////////// ! // Database section ! // set your database here and edit the according section below ! $WhichDatabase = 'dbm'; // use one of "dbm", "mysql", "pgsql", "msql", ! // or "file" ! ! // DBM settings (default) ! if ($WhichDatabase == 'dbm') { ! $DBMdir = "/tmp"; ! $WikiPageStore = "wiki"; ! $ArchivePageStore = "archive"; ! $WikiDB['wiki'] = "$DBMdir/wikipagesdb"; ! $WikiDB['archive'] = "$DBMdir/wikiarchivedb"; ! $WikiDB['wikilinks'] = "$DBMdir/wikilinksdb"; ! $WikiDB['hottopics'] = "$DBMdir/wikihottopicsdb"; ! $WikiDB['hitcount'] = "$DBMdir/wikihitcountdb"; ! // try this many times if the dbm is unavailable ! define("MAX_DBM_ATTEMPTS", 20); ! include "lib/dbmlib.php"; ! ! // MySQL settings -- see INSTALL.mysql for details on using MySQL ! } elseif ($WhichDatabase == 'mysql') { ! $WikiPageStore = "wiki"; ! $ArchivePageStore = "archive"; ! $mysql_server = 'localhost'; ! $mysql_user = 'root'; ! $mysql_pwd = ''; ! $mysql_db = 'wiki'; ! include "lib/mysql.php"; ! ! // PostgreSQL settings -- see INSTALL.pgsql for more details ! } elseif ($WhichDatabase == 'pgsql') { ! $pg_dbhost = "localhost"; ! $pg_dbport = "5432"; ! $WikiDataBase = "wiki"; // name of the database in Postgresql ! $WikiPageStore = "wiki"; ! $ArchivePageStore = "archive"; ! $WikiLinksPageStore = "wikilinks"; ! $HotTopicsPageStore = "hottopics"; ! $HitCountPageStore = "hitcount"; ! include "lib/pgsql.php"; ! ! // MiniSQL (mSQL) settings -- see INSTALL.msql for details on using mSQL ! } elseif ($WhichDatabase == 'msql') { ! $msql_db = "wiki"; ! $WikiPageStore = array(); ! $ArchivePageStore = array(); ! $WikiPageStore['table'] = "wiki"; ! $WikiPageStore['page_table'] = "wikipages"; ! $ArchivePageStore['table'] = "archive"; ! $ArchivePageStore['page_table'] = "archivepages"; ! // should be the same as wikipages.line ! define("MSQL_MAX_LINE_LENGTH", 128); ! include "lib/msql.php"; ! // Filesystem DB settings ! } elseif ($WhichDatabase == 'file') { ! $DBdir = "/tmp/wiki"; ! $WikiPageStore = "wiki"; ! $ArchivePageStore = "archive"; ! $WikiDB['wiki'] = "$DBdir/pages"; ! $WikiDB['archive'] = "$DBdir/archive"; ! $WikiDB['wikilinks'] = "$DBdir/links"; ! $WikiDB['hottopics'] = "$DBdir/hottopics"; ! $WikiDB['hitcount'] = "$DBdir/hitcount"; ! include "lib/db_filesystem.php"; ! } else die("Invalid '\$WhichDatabase' in lib/config.php"); ! ! ! ///////////////////////////////////////////////////////////////////// ! // Miscellanious ! ! // logo image ! $logo = "images/wikibase.png"; ! // signature image which is shown after saving an edited page ! $SignatureImg = "images/signature.png"; ! ! // date & time formats used to display modification times, etc. ! // formats are given as format strings to PHP date() function ! $datetimeformat = "F j, Y"; // may contain time of day ! $dateformat = "F j, Y"; // must not contain time ! ! // this defines how many page names to list when displaying ! // the MostPopular pages; the default is to show the 20 most popular pages ! define("MOST_POPULAR_LIST_LENGTH", 20); ! ! // this defines how many page names to list when displaying related pages ! define("NUM_RELATED_PAGES", 5); ! ! // number of user-defined external references, i.e. "[1]" ! define("NUM_LINKS", 12); ! // allowed protocols for links - be careful not to allow "javascript:" ! // within a named link [name|uri] one more protocol is defined: phpwiki ! $AllowedProtocols = "http|https|mailto|ftp|news|gopher"; + // URLs ending with the following extension should be inlined as images + $InlineImages = "png|jpg|gif"; + + // Perl regexp for WikiNames + // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well + $WikiNameRegexp = "(?<![A-Za-z0-9])([A-Z][a-z]+){2,}(?![A-Za-z0-9])"; + + + + ///////////////////////////////////////////////////////////////////// + // Original pages and layout + + // need to define localization function first -- skip this if (!function_exists ('gettext')) { $lcfile = "locale/$LANG/LC_MESSAGES/phpwiki.php"; ! if (file_exists($lcfile)) { include($lcfile); } ! else { $locale = array(); } function gettext ($text) { *************** *** 59,163 **** textdomain ("phpwiki"); } ! // if you are using MySQL instead of a DBM to store your ! // Wiki pages, use mysql.php instead of dbmlib.php ! // See INSTALL.mysql for details on using MySQL ! ! // if you are using Postgressl instead of a DBM to store your ! // Wiki pages, use pgsql.php instead of dbmlib.php ! // See INSTALL.pgsql for details on using Postgresql ! ! // if you are using mSQL instead of a DBM to store your ! // Wiki pages, use msql.php instead of dbmlib.php ! // See INSTALL.mysql for details on using mSQL ! ! ! // DBM settings (default) ! include "lib/dbmlib.php"; ! $DBMdir = "/tmp"; ! $WikiPageStore = "wiki"; ! $ArchivePageStore = "archive"; ! $WikiDB['wiki'] = "$DBMdir/wikipagesdb"; ! $WikiDB['archive'] = "$DBMdir/wikiarchivedb"; ! $WikiDB['wikilinks'] = "$DBMdir/wikilinksdb"; ! $WikiDB['hottopics'] = "$DBMdir/wikihottopicsdb"; ! $WikiDB['hitcount'] = "$DBMdir/wikihitcountdb"; ! ! /* ! // MySQL settings (thanks Arno Hollosi! <aho...@in...>) ! // Comment out the lines above (for the DBM) if you use these ! include "lib/mysql.php"; ! $WikiPageStore = "wiki"; ! $ArchivePageStore = "archive"; ! $mysql_server = 'localhost'; ! $mysql_user = 'root'; ! $mysql_pwd = ''; ! $mysql_db = 'wiki'; ! */ ! ! /* ! // PostgreSQL settings. ! include "lib/pgsql.php"; ! $WikiDataBase = "wiki"; // name of the database in Postgresql ! $WikiPageStore = "wiki"; // name of the table where pages are stored ! $ArchivePageStore = "archive"; // name of the table where pages are archived ! $WikiLinksPageStore = "wikilinks"; ! $HotTopicsPageStore = "hottopics"; ! $HitCountPageStore = "hitcount"; ! $pg_dbhost = "localhost"; ! $pg_dbport = "5432"; ! */ ! ! ! /* ! // MiniSQL (mSQL) settings. ! include "lib/msql.php"; ! $msql_db = "wiki"; ! // should be the same as wikipages.line ! define("MSQL_MAX_LINE_LENGTH", 128); ! $WikiPageStore = array(); ! $ArchivePageStore = array(); ! ! $WikiPageStore['table'] = "wiki"; ! $WikiPageStore['page_table'] = "wikipages"; ! $ArchivePageStore['table'] = "archive"; ! $ArchivePageStore['page_table'] = "archivepages"; ! // end mSQL settings ! */ ! ! /* ! // Filesystem DB settings ! include "lib/db_filesystem.php"; ! $DBdir = "/tmp/wiki"; ! $WikiPageStore = "wiki"; ! $ArchivePageStore = "archive"; ! $WikiDB['wiki'] = "$DBdir/pages"; ! $WikiDB['archive'] = "$DBdir/archive"; ! $WikiDB['wikilinks'] = "$DBdir/links"; ! $WikiDB['hottopics'] = "$DBdir/hottopics"; ! $WikiDB['hitcount'] = "$DBdir/hitcount"; ! // End Filsystem Settings ! */ ! ! /* WIKI_PGSRC ! * ! * This constant specifies the source for the initial page contents * of the Wiki. The setting of WIKI_PGSRC only has effect when * the wiki is accessed for the first time (or after clearing the ! * database.) ! * ! * The WIKI_PGSRC can either name a directory or a zip file. * In either case WIKI_PGSRC is scanned for files --- one file per page. * - * FIXME: this documentation needs to be clarified. - * * If the files appear to be MIME formatted messages, they are * scanned for application/x-phpwiki content-types. Any suitable * content is added to the wiki. - * * The files can also be plain text files, in which case the page name * is taken from the file name. */ define('WIKI_PGSRC', gettext("./pgsrc")); // Default (old) behavior. //define('WIKI_PGSRC', './wiki.zip'); // New style. --- 142,168 ---- textdomain ("phpwiki"); } + // end of localization function ! // Template files (filenames are relative to script position) ! $templates = array( ! "BROWSE" => gettext("templates/browse.html"), ! "EDITPAGE" => gettext("templates/editpage.html"), ! "EDITLINKS" => gettext("templates/editlinks.html"), ! "MESSAGE" => gettext("templates/message.html") ! ); ! /* WIKI_PGSRC -- specifies the source for the initial page contents * of the Wiki. The setting of WIKI_PGSRC only has effect when * the wiki is accessed for the first time (or after clearing the ! * database.) WIKI_PGSRC can either name a directory or a zip file. * In either case WIKI_PGSRC is scanned for files --- one file per page. * * If the files appear to be MIME formatted messages, they are * scanned for application/x-phpwiki content-types. Any suitable * content is added to the wiki. * The files can also be plain text files, in which case the page name * is taken from the file name. */ + define('WIKI_PGSRC', gettext("./pgsrc")); // Default (old) behavior. //define('WIKI_PGSRC', './wiki.zip'); // New style. *************** *** 168,223 **** // DEFAULT_WIKI_PGSRC defines where the English pages reside define('DEFAULT_WIKI_PGSRC', "./pgsrc"); - - $ScriptName = "index.php"; - - $SignatureImg = "images/signature.png"; - $logo = "images/wikibase.png"; - // Template files (filenames are relative to script position) - $templates = array( - "BROWSE" => gettext("templates/browse.html"), - "EDITPAGE" => gettext("templates/editpage.html"), - "EDITLINKS" => gettext("templates/editlinks.html"), - "MESSAGE" => gettext("templates/message.html") - ); - // date & time formats used to display modification times, etc. - // formats are given as format strings to PHP date() function - $datetimeformat = "F j, Y"; // may contain time of day - $dateformat = "F j, Y"; // must not contain time - // allowed protocols for links - be careful not to allow "javascript:" - // within a named link [name|uri] one more protocol is defined: phpwiki - // that phpwiki protocol must not be used below - $AllowedProtocols = "http|https|mailto|ftp|news|gopher"; - - // URLs ending with the following extension should be inlined as images - $InlineImages = "png|jpg|gif"; - - // Perl regexp for WikiNames - // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well - $WikiNameRegexp = "(?<![A-Za-z0-9])([A-Z][a-z]+){2,}(?![A-Za-z0-9])"; - - // this defines how many page names to list when displaying - // the MostPopular pages; i.e. setting this to 20 will show - // the 20 most popular pages - define("MOST_POPULAR_LIST_LENGTH", 20); - - // this defines how many page names to list when displaying - // scored related pages - define("NUM_RELATED_PAGES", 5); - - // number of user-defined external links, i.e. "[1]" - define("NUM_LINKS", 12); - - // try this many times if the dbm is unavailable - define("MAX_DBM_ATTEMPTS", 20); - - ////////////////////////////////////////////////////////////////////// - // you shouldn't have to edit anyting below this line - $ScriptUrl = $ServerAddress . $ScriptName; $LogoImage = "<img src='${ServerAddress}$logo' border='0'>"; $LogoImage = "<a href='$ScriptUrl'>$LogoImage</a>"; --- 173,192 ---- // DEFAULT_WIKI_PGSRC defines where the English pages reside define('DEFAULT_WIKI_PGSRC', "./pgsrc"); ////////////////////////////////////////////////////////////////////// // you shouldn't have to edit anyting below this line + + if (empty($ScriptUrl)) { + if (preg_match("#(.*?)([^/]*$)#", $REQUEST_URI, $matches)) { + $ServerAddress = "http://$SERVER_NAME:$SERVER_PORT" . $matches[1]; + } else { + $ServerAddress = "http://$SERVER_NAME:$SERVER_PORT$REQUEST_URI"; + } + $ScriptName = basename($HTTP_SERVER_VARS["PHP_SELF"]); + $ScriptUrl = $ServerAddress . $ScriptName; + } $LogoImage = "<img src='${ServerAddress}$logo' border='0'>"; $LogoImage = "<a href='$ScriptUrl'>$LogoImage</a>"; |