From: Geoffrey T. D. <da...@us...> - 2001-02-12 01:42:38
|
Update of /cvsroot/phpwiki/phpwiki In directory usw-pr-cvs1:/tmp/cvs-serv13525 Modified Files: HISTORY index.php Log Message: log Index: HISTORY =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/HISTORY,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** HISTORY 2001/02/10 22:15:07 1.14 --- HISTORY 2001/02/12 01:43:09 1.15 *************** *** 1,2 **** --- 1,23 ---- + 02/11/01 Jeff's hacks continue: + + * Moved user configuration stuff into index.php. What was index.php is + now in lib/main.php. + + * Refactored the DB configuration variables. There's one define() constant + which specifies type database type, and one hash (used by all the + databases) which holds database, file, and server selection. + The actual file/table names are now "hard-coded" into the individual + database modules --- I have added the hook for setting a prefix + to be applied to all file/table names. + I think it's much cleaner, but let me know if you think otherwise. + (I've only tested the dba and mysql backends.) + + * Refactored the dump/load zip/directory stuff. You can now upload zip-dumps + or individual files from your local (client) machine. + See PhpWikiAdministration. + + * Fixed a bunch of bugs --- mostly the one's I introduced in my last big + commit. + 02/09/01 Jeff hack's again: Index: index.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/index.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** index.php 2001/02/10 22:15:07 1.6 --- index.php 2001/02/12 01:43:09 1.7 *************** *** 1,127 **** <?php ! $RCS_IDS = array('$Id$'); ! function rcs_id($id) ! { ! global $RCS_IDS; ! $RCS_IDS[] = $id; ! } ! ! include "lib/config.php"; ! include "lib/stdlib.php"; ! include "lib/userauth.php"; ! ! ! if (isset($pagename)) ! $pagename = fix_magic_quotes_gpc($pagename); ! else if (USE_PATH_INFO && !empty($PATH_INFO)) ! $pagename = substr($PATH_INFO, 1); ! else ! $pagename = gettext("FrontPage"); ! ! if (empty($action)) ! $action = 'browse'; ! else ! fix_magic_quotes_gpc($action); ! ! // Fix for compatibility with very old diff links in RecentChanges. ! // (The [phpwiki:?diff=PageName] style links are fixed elsewhere.) ! if (isset($diff)) ! { ! $action = 'diff'; ! $pagename = fix_magic_quotes_gpc($diff); ! unset($diff); ! } ! ! function get_auth_mode ($action) ! { ! switch ($action) { ! ! case 'logout': ! return 'LOGOUT'; ! ! case 'login': ! return 'REQUIRE_AUTH'; ! ! case 'lock': ! case 'unlock': ! case 'remove': ! case 'dumpserial': ! case 'loadserial': ! // Auto-login if user attempts one of these ! return 'REQUIRE_AUTH'; ! ! case 'zip': ! // Auto-loing if necessary ! return ZIPDUMP_AUTH ? 'REQUIRE_AUTH' : 'NORMAL'; ! ! default: ! return 'NORMAL'; ! } ! } ! ! $user = new WikiUser(get_auth_mode($action)); ! ! // All requests require the database ! $dbi = OpenDataBase($WikiPageStore); ! ! // if there is no FrontPage, create a basic set of Wiki pages ! if ( ! IsWikiPage($dbi, gettext("FrontPage")) ) ! { ! include "lib/setupwiki.php"; ! } ! ! switch ($action) { ! case 'edit': ! include "lib/editpage.php"; ! break; ! case 'search': ! if (isset($searchtype) && ($searchtype == 'full')) { ! include "lib/fullsearch.php"; ! } ! else { ! include "lib/search.php"; ! } ! break; ! ! case 'save': ! include "lib/savepage.php"; ! break; ! case 'info': ! include "lib/pageinfo.php"; ! break; ! case 'diff': ! include "lib/diff.php"; ! break; ! ! case 'zip': ! include "admin/zip.php"; ! break; ! ! case 'dumpserial': ! include "admin/dumpserial.php"; ! break; ! ! case 'loadserial': ! include "admin/loadserial.php"; ! break; ! ! case 'remove': ! include 'admin/removepage.php'; ! break; ! ! case 'lock': ! case 'unlock': ! include "admin/lockpage.php"; ! include "lib/display.php"; ! break; ! ! case 'browse': ! case 'login': ! case 'logout': ! default: ! include "lib/display.php"; // defaults to FrontPage ! break; ! } ! CloseDataBase($dbi); ?> --- 1,231 ---- <?php ! define ('PHPWIKI_VERSION', '1.3.0pre'); ! error_reporting(E_ALL /* ^ E_NOTICE */); ! $RCS_IDS = array("SCRIPT_NAME='$SCRIPT_NAME'", ! '$Id$'); ! ! ///////////////////////////////////////////////////////////////////// ! // ! // Part One: ! // Authentication and security settings: ! // ! ///////////////////////////////////////////////////////////////////// ! ! // If set, we will perform reverse dns lookups to try to convert the users ! // IP number to a host name, even if the http server didn't do it for us. ! define('ENABLE_REVERSE_DNS', true); ! ! // Username and password of administrator. ! // Set these to your preferences. For heaven's sake ! // pick a good password! ! define('ADMIN_USER', ""); ! define('ADMIN_PASSWD', ""); ! ! // If true, only the admin user can make zip dumps, else ! // zip dumps require no authentication. ! define('ZIPDUMP_AUTH', false); ! ! // The maximum file upload size. ! define('MAX_UPLOAD_SIZE', 16 * 1024 * 1024); ! ! // If the last edit is older than MINOR_EDIT_TIMEOUT seconds, the default ! // state for the "minor edit" checkbox on the edit page form will be off. ! define("MINOR_EDIT_TIMEOUT", 7 * 24 * 3600); ! ! ///////////////////////////////////////////////////////////////////// ! // ! // Part Two: ! // Database Selection ! // ! ///////////////////////////////////////////////////////////////////// ! ! // Pick one of 'dbm', 'dba', 'mysql', 'pgsql', 'msql', or 'file'. ! // (Or leaven DBTYPE undefined for default behavior (which is 'dba' ! // if supported, else 'dbm'). ! ! //define("DBTYPE", 'mysql'); ! ! // 'dbm' and 'dba create files named "$directory/${database}{$prefix}*". ! // 'file' creates files named "$directory/${database}/{$prefix}*/*". ! // The sql types use tables named "{$prefix}*" ! ! // ! // This array holds the parameters which select the database to use. ! // ! // Not all of these parameters are used by any particular DB backend. ! // ! $DBParams = array( ! // Used by all DB types: ! 'database' => 'wiki', ! 'prefix' => '', // prefix for filenames or table names ! ! // Used by 'dbm', 'dba', 'file' ! 'directory' => "/tmp", ! ! // Used by 'dbm', 'dba' ! 'timeout' => 20, ! ! // Used by *sql as neccesary to log in to server: ! 'server' => 'localhost', ! 'port' => '', ! 'socket' => '', ! 'user' => 'guest', ! 'password' => '' ! ); ! ! ! ///////////////////////////////////////////////////////////////////// ! // ! // Part Three: ! // Page appearance and layout ! // ! ///////////////////////////////////////////////////////////////////// ! ! // Select your language - default language "C": English ! // other languages available: Dutch "nl", Spanish "es", German "de", ! // and Swedish "sv" ! $LANG = "C"; ! ! // logo image (path relative to index.php) ! $logo = "images/wikibase.png"; ! ! // Signature image which is shown after saving an edited page ! // If this is left blank (or unset), the signature will be omitted. ! //$SignatureImg = "images/signature.png"; ! ! // date & time formats used to display modification times, etc. ! // formats are given as format strings to PHP date() function ! // FIXME: these should have different defaults depending on locale. ! $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); ! ! // This path is searched when trying to read WIKI_PGSRC ! // or template files. ! $DataPath = array(".", "locale/$LANG"); ! ! // Template files (filenames are relative to script position) ! // (These filenames will be passed through gettext() before use.) ! $templates = array("BROWSE" => "templates/browse.html", ! "EDITPAGE" => "templates/editpage.html", ! "MESSAGE" => "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. ! */ ! define('WIKI_PGSRC', "pgsrc"); // Default (old) behavior. ! //define('WIKI_PGSRC', 'wiki.zip'); // New style. ! ! // DEFAULT_WIKI_PGSRC is only used when the language is *not* ! // the default (English) and when reading from a directory: ! // in that case some English pages are inserted into the wiki as well ! // DEFAULT_WIKI_PGSRC defines where the English pages reside ! // FIXME: is this really needed? Can't we just copy ! // these pages into the localized pgsrc? ! define('DEFAULT_WIKI_PGSRC', "pgsrc"); ! // These are the pages which will get loaded from DEFAULT_WIKI_PGSRC. ! $GenericPages = array("ReleaseNotes", "SteveWainstead", "TestPage"); ! ! ///////////////////////////////////////////////////////////////////// ! // ! // Part four: ! // Mark-up options. ! // ! ///////////////////////////////////////////////////////////////////// ! ! // allowed protocols for links - be careful not to allow "javascript:" ! // URL of these types will be automatically linked. ! // 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 ("bumpy words") ! // (?<!..) & (?!...) used instead of '\b' because \b matches '_' as well ! $WikiNameRegexp = "(?<![A-Za-z0-9])([A-Z][a-z]+){2,}(?![A-Za-z0-9])"; ! ! // InterWiki linking -- wiki-style links to other wikis on the web ! // ! // Intermap file for InterWikiLinks -- define other wikis there ! // Leave this undefined to disable InterWiki linking. ! define('INTERWIKI_MAP_FILE', "lib/interwiki.map"); ! ! ///////////////////////////////////////////////////////////////////// ! // ! // Part five: ! // URL options -- you can probably skip this section. ! // ! ///////////////////////////////////////////////////////////////////// ! /****************************************************************** ! * ! * The following section contains settings which you can use to tailor ! * the URLs which PhpWiki generates. ! * ! * Any of these parameters which are left undefined will be ! * deduced automatically. You need only set them explicitly ! * if the auto-detected values prove to be incorrect. ! * ! * In most cases the auto-detected values should work fine, ! * so hopefully you don't need to mess with this section. ! * ! ******************************************************************/ ! ! /* ! * Canonical name and httpd port of the server on which this ! * PhpWiki resides. ! */ ! //define('PHPWIKI_SERVER_NAME', 'some.host.com'); ! //define('PHPWIKI_SERVER_PORT', 80); ! ! /* ! * Absolute URL (from the server root) of the PhpWiki ! * script. ! */ ! //define('PHPWIKI_SCRIPT_NAME', '/some/where/index.php'); ! ! /* ! * Absolute URL (from the server root) of the directory ! * in which relative URL's for images and other support files ! * are interpreted. ! */ ! //define('PHPWIKI_DATA_PATH', '/some/where'); ! ! /* ! * Define to 'true' to use PATH_INFO to pass the pagename's. ! * e.g. http://www.some.where/index.php/FrontPage instead ! * of http://www.some.where/index.php?pagename=FrontPage ! * FIXME: more docs (maybe in README). ! */ ! //define('USE_PATH_INFO', false); ! ! /* ! * FIXME: add docs ! * (Only used if USE_PATH_INFO is true.) ! */ ! //define('PHPWIKI_VIRTUAL_PATH', '/SomeWiki'); ! ! ! //////////////////////////////////////////////////////////////// ! // Okay... fire up the code: ! //////////////////////////////////////////////////////////////// ! ! include "lib/main.php"; ! ! // For emacs users ! // Local Variables: ! // mode: php ! // c-file-style: "ellemtel" ! // End: ?> |