From: Geoffrey T. D. <da...@us...> - 2001-02-10 22:14:39
|
Update of /cvsroot/phpwiki/phpwiki In directory usw-pr-cvs1:/tmp/cvs-serv20420 Modified Files: HISTORY index.php Removed Files: admin.php Log Message: Jeff hacks again: LOT's of changes. Highlights: * Pagename in PATH_INFO support added. * Redid the user (admin) authentication stuff. All access now through index.php. See HISTORY for (a few) more details. Index: HISTORY =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/HISTORY,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** HISTORY 2001/02/08 18:19:16 1.13 --- HISTORY 2001/02/10 22:15:07 1.14 *************** *** 1,2 **** --- 1,34 ---- + 02/09/01 Jeff hack's again: + + * Pagename in PATH_INFO support added. This is configurable, + cause, near as I can figure, if the php interpreter is run stand-alone + in /cgi-bin there's no way to pass any useful PATH_INFO to it. + (If a stand-alone php, in say /usr/local/bin, is used as a CGI interpreter, + PATH_INFO will work, as long as php was configured with --enable-discard-path .) + + Along with this I refactored the semantics of all the query arguments to + make them (IMHO) more consistent. + + * Redid the administrator authentication stuff. Eliminated admin.php --- + all access is now through index.php. (New file lib/userauth.php.) + Still a little rough, but a big improvement, I think. Hopefully this + can be developed into a more general user identification scheme... + + Along with eliminating admin.php and the new auth scheme, completely + refactored index.php. It should be easy now to swap config.php and index.php. + (I'll do that soon.) + + * Continued cleaning out page reference stuff. + + * Force archive of old page if author changes. (Unless new author + is admin.) + + * More warning fixes in diff.php + + * Refactored the semantics of the phpwiki: URL's. + See pgsrc/PhpWikiAdministration and pgsrc/MagicPhpWikiURLs + for more information. + + Bug fixes: * Don't show signature image if $SignatureImg (in config.php) is left unset * Bug fix: hang on full zip dump Index: index.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/index.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** index.php 2000/11/08 15:34:06 1.5 --- index.php 2001/02/10 22:15:07 1.6 *************** *** 1,45 **** - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> - <!-- $Id$ --> <?php ! /* ! The main page, i.e. the main loop. ! This file is always called first. ! */ ! ! if (!defined('WIKI_ADMIN')) { // index.php not included by admin.php? ! include "lib/config.php"; ! include "lib/stdlib.php"; ! // All requests require the database ! $dbi = OpenDataBase($WikiPageStore); } ! // Allow choice of submit buttons to determine type of search: ! if (isset($searchtype) && ($searchtype == 'full')) ! $full = $searchstring; ! elseif (isset($searchstring)) // default to title search ! $search = $searchstring; ! if (isset($edit)) { ! include "lib/editpage.php"; ! } elseif (isset($links)) { ! include "lib/editlinks.php"; ! } elseif (isset($copy)) { include "lib/editpage.php"; ! } elseif (isset($search)) { ! include "lib/search.php"; ! } elseif (isset($full)) { ! include "lib/fullsearch.php"; ! } elseif (isset($post)) { include "lib/savepage.php"; ! } elseif (isset($info)) { include "lib/pageinfo.php"; ! } elseif (isset($diff)) { include "lib/diff.php"; ! } else { include "lib/display.php"; // defaults to FrontPage ! } ! ! CloseDataBase($dbi); ?> --- 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); ?> --- admin.php DELETED --- |