|
From: Geoffrey T. D. <da...@us...> - 2001-02-12 01:42:38
|
Update of /cvsroot/phpwiki/phpwiki/lib
In directory usw-pr-cvs1:/tmp/cvs-serv13525/lib
Modified Files:
config.php db_filesystem.php dbalib.php dbmlib.php diff.php
display.php editpage.php fullsearch.php interwiki.php msql.php
mysql.php pageinfo.php pgsql.php savepage.php search.php
stdlib.php transform.php userauth.php ziplib.php
Added Files:
loadsave.php main.php
Removed Files:
setupwiki.php
Log Message:
log
***** Error reading new file: [Errno 2] No such file or directory: 'loadsave.php'
***** Error reading new file: [Errno 2] No such file or directory: 'main.php'
Index: config.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/config.php,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** config.php 2001/02/10 22:15:08 1.29
--- config.php 2001/02/12 01:43:10 1.30
***************
*** 1,269 ****
<?php
! rcs_id('$Id$');
!
! // essential internal stuff -- skip it. Go down to Part One. There
! // are four parts to this file that interest you, all labeled Part
! // One, Two, Three and Four.
!
! set_magic_quotes_runtime(0);
! error_reporting(E_ALL ^ E_NOTICE);
!
! /////////////////////////////////////////////////////////////////////
! // Part One:
! // 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", German "de",
! // and Swedish "sv"
! $LANG="C";
!
! // 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
! define('USE_PATH_INFO', 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);
!
! // 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);
!
! /////////////////////////////////////////////////////////////////////
! // Part Two:
! // Database section
! // set your database here and edit the according section below.
! // For PHP 4.0.4 and later you must use "dba" if you are using
! // DBM files for storage. "dbm" uses the older deprecated interface.
! // The option 'default' will choose either dbm or dba, depending on
! // the version of PHP you are running.
! /////////////////////////////////////////////////////////////////////
!
! $WhichDatabase = 'default'; // use one of "dbm", "dba", "mysql",
! // "pgsql", "msql", or "file"
!
! // DBM and DBA settings (default)
! if ($WhichDatabase == 'dbm' or $WhichDatabase == 'dba' or
! $WhichDatabase == 'default') {
! $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);
!
! // for PHP3 use dbmlib, else use dbalib for PHP4
! if ($WhichDatabase == 'default') {
! if ( floor(phpversion()) == 3) {
! $WhichDatabase = 'dbm';
! } else {
! $WhichDatabase = 'dba';
! }
! }
!
! if ($WhichDatabase == 'dbm') {
! include "lib/dbmlib.php";
! } else {
! include "lib/dbalib.php";
! }
!
! // MySQL settings -- see INSTALL.mysql for details on using MySQL
! } elseif ($WhichDatabase == 'mysql') {
! $WikiPageStore = "wiki";
! $ArchivePageStore = "archive";
! $WikiLinksStore = "wikilinks";
! $WikiScoreStore = "wikiscore";
! $HitCountStore = "hitcount";
! $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");
!
!
! /////////////////////////////////////////////////////////////////////
! // Part Three:
! // Miscellaneous
! /////////////////////////////////////////////////////////////////////
!
! // 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
! $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);
!
! // 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";
!
! // 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
! // (even if the page author hasn't changed.)
! define("MINOR_EDIT_TIMEOUT", 7 * 24 * 3600);
!
! // 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])";
!
!
! // InterWiki linking -- wiki-style links to other wikis on the web
! // Set InterWikiLinking to 1 if you would like to enable this feature
! $InterWikiLinking = 0;
!
! if ($InterWikiLinking) {
! // Intermap file for InterWikiLinks -- define other wikis there
! $interwikimap_file = "lib/interwiki.map";
!
! include ('lib/interwiki.php');
! // sets also $InterWikiLinkRegexp
}
!
! /////////////////////////////////////////////////////////////////////
! // Part Four:
! // 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) {
! global $locale;
! if (!empty ($locale[$text]))
! return $locale[$text];
! return $text;
! }
! } else {
! putenv ("LANG=$LANG");
! bindtextdomain ("phpwiki", "./locale");
! 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"),
! "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.
!
! // 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
! define('DEFAULT_WIKI_PGSRC', "./pgsrc");
!
!
! //////////////////////////////////////////////////////////////////////
! // you shouldn't have to edit anyting below this line
!
! if (empty($ScriptUrl)) {
! $port = ($SERVER_PORT == 80) ? '' : ":$SERVER_PORT";
! $ScriptUrl = "http://$SERVER_NAME$port$SCRIPT_NAME";
}
! $ScriptName = preg_replace('@^.*/@', '', $ScriptUrl);
!
! // "\x80"-"\x9f" (and "\x00" - "\x1f") are non-printing control
! // chars in iso-8859-*
! // $FieldSeparator = "\263"; //this is a superscript 3 in ISO-8859-1.
! $FieldSeparator = "\x81";
!
! // constants used for HTML output. HTML tags may allow nesting
! // other tags always start at level 0
! define("ZERO_LEVEL", 0);
! define("NESTED_LEVEL", 1);
! // constants for flags in $pagehash
! define("FLAG_PAGE_LOCKED", 1);
?>
--- 1,149 ----
<?php
! rcs_id('$Id$');
! /*
! * NOTE: the settings here should probably not need to be changed.
! *
! *
! * (The user-configurable settings have been moved to index.php.)
! */
!
! // essential internal stuff
!
! set_magic_quotes_runtime(0);
!
! // Some constants.
!
! // "\x80"-"\x9f" (and "\x00" - "\x1f") are non-printing control
! // chars in iso-8859-*
! // $FieldSeparator = "\263"; //this is a superscript 3 in ISO-8859-1.
! $FieldSeparator = "\x81";
!
!
! // constants for flags in $pagehash
! define("FLAG_PAGE_LOCKED", 1);
!
! //////////////////////////////////////////////////////////////////
! //
! // Set up localization
! //
! if (!function_exists ('gettext'))
! {
! $locale = array();
!
! function gettext ($text) {
! global $locale;
! if (!empty ($locale[$text]))
! return $locale[$text];
! return $text;
}
! if ( ($lcfile = SearchPath("LC_MESSAGES/phpwiki.php", 'missing_ok')) )
! {
! include($lcfile);
}
! }
! else
! {
! putenv ("LANG=$LANG");
! bindtextdomain ("phpwiki", "./locale");
! textdomain ("phpwiki");
! }
!
! //////////////////////////////////////////////////////////////////
! // Autodetect URL settings:
! //
! if (!defined('SERVER_NAME')) define('SERVER_NAME', $SERVER_NAME);
! if (!defined('SERVER_PORT')) define('SERVER_PORT', $SERVER_PORT);
! if (!defined('SCRIPT_NAME')) define('SCRIPT_NAME', $SCRIPT_NAME);
! if (!defined('DATA_PATH'))
! define('DATA_PATH', dirname(SCRIPT_NAME));
! if (!defined('USE_PATH_INFO'))
! {
! /*
! * If SCRIPT_NAME does not look like php source file,
! * or user cgi we assume that php is getting run by an
! * action handler in /cgi-bin. In this case,
! * I think there is no way to get Apache to pass
! * useful PATH_INFO to the php script (PATH_INFO
! * is used to the the php interpreter where the
! * php script is...)
*/
! define('USE_PATH_INFO', ereg('\.(php3?|cgi)$', $SCRIPT_NAME));
! }
! if (!defined('VIRTUAL_PATH'))
! {
! if (USE_PATH_INFO and isset($REDIRECT_URL))
! {
! // FIXME: This is a hack, and won't work if the requested
! // pagename has a slash in it.
! define('VIRTUAL_PATH', dirname($REDIRECT_URL . 'x'));
}
! else
! define('VIRTUAL_PATH', SCRIPT_NAME);
! }
!
! if (SERVER_PORT && SERVER_PORT != 80)
! define('SERVER_URL',
! "http://" . SERVER_NAME . ':' . SERVER_PORT);
! else
! define('SERVER_URL',
! "http://" . SERVER_NAME);
!
! if (VIRTUAL_PATH != SCRIPT_NAME)
! {
! // Apache action handlers are used.
! define('PATH_INFO_PREFIX', VIRTUAL_PATH . "/");
! }
! else
! define("PATH_INFO_PREFIX", '/');
!
!
! //////////////////////////////////////////////////////////////////
! // Select database
! //
! if (!defined('DBTYPE'))
! {
! if ( floor(phpversion()) == 3) {
! define('DBTYPE', 'dbm');
! } else {
! define('DBTYPE', 'dba');
! }
! }
! switch (DBTYPE)
! {
! case 'dbm':
! include 'lib/dbmlib.php';
! break;
! case 'dba':
! include 'lib/dbalib.php';
! break;
! case 'mysql':
! include 'lib/mysql.php';
! break;
! case 'pgsql':
! include 'lib/pgsql.php';
! break;
! case 'msql':
! include 'lib/msql.php';
! break;
! case 'file':
! include "lib/db_filesystem.php";
! break;
! default:
! die(DBTYPE . ": unknown DBTYPE");
! }
!
! // InterWiki linking -- wiki-style links to other wikis on the web
! //
! if (defined('INTERWIKI_MAP_FILE'))
! {
! include ('lib/interwiki.php');
! }
!
! // For emacs users
! // Local Variables:
! // mode: php
! // c-file-style: "ellemtel"
! // End:
?>
Index: db_filesystem.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/db_filesystem.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** db_filesystem.php 2001/01/01 23:18:46 1.4
--- db_filesystem.php 2001/02/12 01:43:10 1.5
***************
*** 19,23 ****
--- 19,41 ----
*/
+ $WikiPageStore = "wiki";
+ $ArchivePageStore = "archive";
+ // Initialize our globals:
+ function _dbname($base)
+ {
+ extract($GLOBALS['DBParams']);
+ return "$directory/$database/${prefix}${base}";
+ }
+
+ $WikiDB['wiki'] = _dbname('pages');
+ $WikiDB['archive'] = _dbname('archive');
+ $WikiDB['wikilinks'] = _dbname('links');
+ $WikiDB['hottopics'] = _dbname('hottopics');
+ $WikiDB['hitcount'] = _dbname('hitcount');
+
+ if (preg_match('@%/tmp\b@', $DBParams['directory']))
+ $DBWarning = "Filesystem DB directory is in the /tmp directory.";
+
// open a database and return the handle
// loop until we get a handle; php has its own
***************
*** 25,28 ****
--- 43,47 ----
// Suppress ugly error message with @.
+
function OpenDataBase($dbname) {
global $WikiDB;
***************
*** 234,236 ****
--- 253,260 ----
return $namelist;
}
+ // For emacs users
+ // Local Variables:
+ // mode: php
+ // c-file-style: "ellemtel"
+ // End:
?>
Index: dbalib.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/dbalib.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** dbalib.php 2001/01/31 02:01:27 1.2
--- dbalib.php 2001/02/12 01:43:10 1.3
***************
*** 27,30 ****
--- 27,50 ----
+ // Initialize our globals:
+ function _dbname($base)
+ {
+ extract($GLOBALS['DBParams']);
+ return "$directory/${database}${prefix}${base}";
+ }
+
+ $WikiPageStore = "wiki";
+ $ArchivePageStore = "archive";
+ $WikiDB = array('wiki' => _dbname('pagesdb'),
+ 'archive' => _dbname('archivedb'),
+ 'wikilinks' => _dbname('linksdb'),
+ 'hottopics' => _dbname('hottopicsdb'),
+ 'hitcount' => _dbname('hitcountdb'));
+
+ if (preg_match('@%/tmp\b@', $DBParams['directory']))
+ $DBWarning = "DBA files are in the /tmp directory.";
+
+ define('MAX_DBM_ATTEMPTS', $DBParams['timeout']);
+
// open a database and return the handle
// loop until we get a handle; php has its own
***************
*** 76,81 ****
}
-
-
// Return hash of page + attributes or default
function RetrievePage($dbi, $pagename, $pagestore) {
--- 96,99 ----
***************
*** 89,93 ****
}
-
// Either insert or replace a key/value (a page)
function InsertPage($dbi, $pagename, $pagehash) {
--- 107,110 ----
***************
*** 255,257 ****
}
! ?>
\ No newline at end of file
--- 272,279 ----
}
! // For emacs users
! // Local Variables:
! // mode: php
! // c-file-style: "ellemtel"
! // End:
! ?>
Index: dbmlib.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/dbmlib.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** dbmlib.php 2001/01/31 03:11:25 1.7
--- dbmlib.php 2001/02/12 01:43:10 1.8
***************
*** 22,26 ****
--- 22,46 ----
*/
+ // Initialize our globals:
+ function _dbname($base)
+ {
+ extract($GLOBALS['DBParams']);
+ return "$directory/${database}${prefix}${base}";
+ }
+
+ $WikiPageStore = "wiki";
+ $ArchivePageStore = "archive";
+ $WikiDB = array('wiki' => _dbname('pagesdb'),
+ 'archive' => _dbname('archivedb'),
+ 'wikilinks' => _dbname('linksdb'),
+ 'hottopics' => _dbname('hottopicsdb'),
+ 'hitcount' => _dbname('hitcountdb'));
+ if (preg_match('@%/tmp\b@', $DBParams['directory']))
+ $DBWarning = "DBM files are in the /tmp directory.";
+
+ define('MAX_DBM_ATTEMPTS', $DBParams['timeout']);
+
+
// open a database and return the handle
// loop until we get a handle; php has its own
***************
*** 481,483 ****
--- 501,508 ----
}
+ // For emacs users
+ // Local Variables:
+ // mode: php
+ // c-file-style: "ellemtel"
+ // End:
?>
Index: diff.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/diff.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** diff.php 2001/02/10 22:15:08 1.6
--- diff.php 2001/02/12 01:43:10 1.7
***************
*** 1067,1072 ****
}
! GeneratePage('MESSAGE', $html, sprintf(gettext ("Diff of %s."),
! htmlspecialchars($pagename)), 0);
}
?>
--- 1067,1073 ----
}
! echo GeneratePage('MESSAGE', $html,
! sprintf(gettext ("Diff of %s."),
! htmlspecialchars($pagename)), 0);
}
?>
Index: display.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/display.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** display.php 2001/02/10 22:15:08 1.7
--- display.php 2001/02/12 01:43:10 1.8
***************
*** 17,23 ****
}
! GeneratePage('BROWSE', $html, $pagename, $pagehash);
flush();
IncreaseHitCount($dbi, $pagename);
?>
--- 17,28 ----
}
! echo GeneratePage('BROWSE', $html, $pagename, $pagehash);
flush();
IncreaseHitCount($dbi, $pagename);
+ // For emacs users
+ // Local Variables:
+ // mode: php
+ // c-file-style: "ellemtel"
+ // End:
?>
Index: editpage.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/editpage.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** editpage.php 2001/02/10 22:15:08 1.10
--- editpage.php 2001/02/12 01:43:10 1.11
***************
*** 2,6 ****
<?php
! // editpage relies on $pagename and $ScriptUrl
$currentpage = RetrievePage($dbi, $pagename, $WikiPageStore);
--- 2,6 ----
<?php
! // editpage relies on $pagename, $version
$currentpage = RetrievePage($dbi, $pagename, $WikiPageStore);
***************
*** 17,21 ****
if (is_array($pagehash)) {
! if (($pagehash['flags'] & FLAG_PAGE_LOCKED) && $user->is_admin()) {
$html = "<p>";
$html .= gettext ("This page has been locked by the administrator and cannot be edited.");
--- 17,21 ----
if (is_array($pagehash)) {
! if (($pagehash['flags'] & FLAG_PAGE_LOCKED) && !$user->is_admin()) {
$html = "<p>";
$html .= gettext ("This page has been locked by the administrator and cannot be edited.");
***************
*** 23,27 ****
$html .= gettext ("Sorry for the inconvenience.");
$html .= "\n";
! GeneratePage('MESSAGE', $html, sprintf (gettext ("Problem while editing %s"), $pagename), 0);
ExitWiki ("");
}
--- 23,28 ----
$html .= gettext ("Sorry for the inconvenience.");
$html .= "\n";
! echo GeneratePage('MESSAGE', $html,
! sprintf (gettext ("Problem while editing %s"), $pagename), 0);
ExitWiki ("");
}
***************
*** 46,60 ****
}
!
! if ($user->id() == $currentpage['author'] || $user->is_admin()) {
! $ckbox = element('input', array('type' => 'checkbox',
! 'name' => 'minor_edit',
! 'value' => 'yes'));
$page_age = time() - $currentpage['lastmodified'];
! if ($user->id() == $currentpage['author'] && $page_age < MINOR_EDIT_TIMEOUT)
! $ckbox .= " checked";
! $pagehash['minor_edit_checkbox'] = $ckbox . '>';
}
! GeneratePage('EDITPAGE', $textarea, $pagename, $pagehash);
?>
--- 47,80 ----
}
! if (empty($pagehash['copy']))
! $do_archive = false;
! else if ( $user->is_admin() )
! $do_archive = 'probably';
! else if ( $user->id() == $currentpage['author'] )
! {
$page_age = time() - $currentpage['lastmodified'];
! if ($page_age < MINOR_EDIT_TIMEOUT)
! $do_archive = 'maybe';
! else
! $do_archive = 'probably';
! }
! else
! $do_archive = 'force';
!
! if ($do_archive == 'probably' || $do_archive == 'maybe')
! {
! $pagehash['minor_edit_checkbox']
! = Element('input', array('type' => 'checkbox',
! 'name' => 'minor_edit',
! 'value' => 'yes',
! 'checked' => ($do_archive == 'probably')));
}
+
+ echo GeneratePage('EDITPAGE', $textarea, $pagename, $pagehash);
! // For emacs users
! // Local Variables:
! // mode: php
! // c-file-style: "ellemtel"
! // End:
?>
Index: fullsearch.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/fullsearch.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** fullsearch.php 2001/02/10 22:15:08 1.5
--- fullsearch.php 2001/02/12 01:43:10 1.6
***************
*** 45,48 ****
. "\n";
! GeneratePage('MESSAGE', $html, gettext ("Full Text Search Results"), 0);
?>
--- 45,48 ----
. "\n";
! echo GeneratePage('MESSAGE', $html, gettext ("Full Text Search Results"), 0);
?>
Index: interwiki.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/interwiki.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** interwiki.php 2001/02/08 10:39:41 1.1
--- interwiki.php 2001/02/12 01:43:10 1.2
***************
*** 1,22 ****
! <?php rcs_id("$Id$");
! function generate_interwikimap_and_regexp()
{
! global $interwikimap_file, $InterWikiLinkRegexp, $interwikimap;
! $intermap_data = file($interwikimap_file);
! $wikiname_regexp = "";
! for ($i=0; $i<count($intermap_data); $i++)
! {
! list( $wiki, $inter_url ) = split(' ', chop($intermap_data[$i]));
! $interwikimap[$wiki] = $inter_url;
! if ($wikiname_regexp)
! $wikiname_regexp .= "|";
! $wikiname_regexp .= $wiki;
! }
! $InterWikiLinkRegexp = "($wikiname_regexp)";
}
! generate_interwikimap_and_regexp();
?>
--- 1,63 ----
! <?php rcs_id('$Id$');
! function generate_interwikimap_and_regexp()
! {
! global $interwikimap_file, $InterWikiLinkRegexp, $interwikimap;
!
! $intermap_data = file(INTERWIKI_MAP_FILE);
! $wikiname_regexp = "";
! for ($i=0; $i<count($intermap_data); $i++)
{
! list( $wiki, $inter_url ) = split(' ', chop($intermap_data[$i]));
! $interwikimap[$wiki] = $inter_url;
! if ($wikiname_regexp)
! $wikiname_regexp .= "|";
! $wikiname_regexp .= $wiki;
! }
! $InterWikiLinkRegexp = "($wikiname_regexp)";
! }
!
! generate_interwikimap_and_regexp();
!
! function LinkInterWikiLink($link, $linktext='')
! {
! global $interwikimap;
! list( $wiki, $page ) = split( ":", $link );
!
! $url = $interwikimap[$wiki] . urlencode($page);
! return LinkURL($url, $linktext ? $linktext : $link);
! }
!
! // Link InterWiki links
! // These can be protected by a '!' like Wiki words.
! function wtt_interwikilinks($line, &$trfrm)
! {
! global $InterWikiLinkRegexp, $WikiNameRegexp;
!
! $n = $ntok = $trfrm->tokencounter;
!
! // FIXME: perhaps WikiNameRegexp is a bit too restrictive?
! $line = wt_tokenize($line, "!?(?<![A-Za-z0-9])$InterWikiLinkRegexp:$WikiNameRegexp",
! $trfrm->replacements, $ntok);
! while ($n < $ntok) {
! $old = $trfrm->replacements[$n];
! if ($old[0] == '!') {
! $trfrm->replacements[$n] = substr($old,1);
! } else {
! $trfrm->replacements[$n] = LinkInterWikiLink($old);
! }
! $n++;
}
+
+ $trfrm->tokencounter = $ntok;
+ return $line;
+ }
! // For emacs users
! // Local Variables:
! // mode: php
! // c-file-style: "ellemtel"
! // End:
?>
Index: msql.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/msql.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** msql.php 2001/02/01 04:24:26 1.6
--- msql.php 2001/02/12 01:43:10 1.7
***************
*** 20,29 ****
// open a database and return the handle
// ignores MAX_DBM_ATTEMPTS
function OpenDataBase($dbinfo) {
! global $msql_db;
!
if (! ($dbc = msql_connect())) {
$msg = gettext ("Cannot establish connection to database, giving up.");
--- 20,38 ----
+ // Get rid of these globals!
+ $WikiPageStore['table'] = $DBParams['prefix'] . "wiki";
+ $WikiPageStore['page_table'] = $DBParams['prefix'] . "wikipages";
+ $ArchivePageStore['table'] = $DBParams['prefix'] . "archive";
+ $ArchivePageStore['page_table'] = $DBParams['prefix'] . "archivepages";
+
+ // should be the same as wikipages.line
+ define("MSQL_MAX_LINE_LENGTH", 128);
+
// open a database and return the handle
// ignores MAX_DBM_ATTEMPTS
function OpenDataBase($dbinfo) {
! extract($GLOBALS['DBParams']);
! // FIXME: use $host, $port, $user, $password
if (! ($dbc = msql_connect())) {
$msg = gettext ("Cannot establish connection to database, giving up.");
***************
*** 32,37 ****
ExitWiki($msg);
}
! if (!msql_select_db($msql_db, $dbc)) {
! $msg = gettext ("Cannot open database %s, giving up.");
$msg .= "<BR>";
$msg .= sprintf(gettext ("Error message: %s"), msql_error());
--- 41,47 ----
ExitWiki($msg);
}
! if (!msql_select_db($database, $dbc)) {
! $msg = sprintf(gettext ("Cannot open database %s, giving up."),
! $database);
$msg .= "<BR>";
$msg .= sprintf(gettext ("Error message: %s"), msql_error());
***************
*** 514,516 ****
--- 524,531 ----
*/
+ // For emacs users
+ // Local Variables:
+ // mode: php
+ // c-file-style: "ellemtel"
+ // End:
?>
Index: mysql.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/mysql.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** mysql.php 2001/02/10 22:15:08 1.11
--- mysql.php 2001/02/12 01:43:10 1.12
***************
*** 27,37 ****
*/
// open a database and return the handle
// ignores MAX_DBM_ATTEMPTS
function OpenDataBase($dbname) {
! global $mysql_server, $mysql_user, $mysql_pwd, $mysql_db;
! if (!($dbc = mysql_pconnect($mysql_server, $mysql_user, $mysql_pwd))) {
$msg = gettext ("Cannot establish connection to database, giving up.");
$msg .= "<BR>";
--- 27,48 ----
*/
+ $WikiPageStore = $DBParams['prefix'] . "wiki";
+ $ArchivePageStore = $DBParams['prefix'] . "archive";
+ $WikiLinksStore = $DBParams['prefix'] . "wikilinks";
+ $WikiScoreStore = $DBParams['prefix'] . "wikiscore";
+ $HitCountStore = $DBParams['prefix'] . "hitcount";
+
// open a database and return the handle
// ignores MAX_DBM_ATTEMPTS
function OpenDataBase($dbname) {
! extract($GLOBALS['DBParams']);
! if (empty($server))
! $server = $socket;
! else if (!empty($port))
! $server .= ":$port";
!
! if (!($dbc = mysql_pconnect($server, $user, $password))) {
$msg = gettext ("Cannot establish connection to database, giving up.");
$msg .= "<BR>";
***************
*** 39,44 ****
ExitWiki($msg);
}
! if (!mysql_select_db($mysql_db, $dbc)) {
! $msg = sprintf(gettext ("Cannot open database %s, giving up."), $mysql_db);
$msg .= "<BR>";
$msg .= sprintf(gettext ("MySQL error: %s"), mysql_error());
--- 50,55 ----
ExitWiki($msg);
}
! if (!mysql_select_db($database, $dbc)) {
! $msg = sprintf(gettext ("Cannot open database %s, giving up."), $database);
$msg .= "<BR>";
$msg .= sprintf(gettext ("MySQL error: %s"), mysql_error());
***************
*** 355,357 ****
--- 366,374 ----
select pagename from wiki left join wikilinks on pagename=topage where topage is NULL;
*/
+
+ // For emacs users
+ // Local Variables:
+ // mode: php
+ // c-file-style: "ellemtel"
+ // End:
?>
Index: pageinfo.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/pageinfo.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** pageinfo.php 2001/02/10 22:15:08 1.6
--- pageinfo.php 2001/02/12 01:43:10 1.7
***************
*** 58,61 ****
$html .= ViewPageProps($pagename, $ArchivePageStore);
! GeneratePage('MESSAGE', $html, gettext("PageInfo").": '$pagename'", 0);
?>
--- 58,62 ----
$html .= ViewPageProps($pagename, $ArchivePageStore);
! echo GeneratePage('MESSAGE', $html,
! gettext("PageInfo").": '$pagename'", 0);
?>
Index: pgsql.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/pgsql.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** pgsql.php 2000/11/02 04:23:59 1.4
--- pgsql.php 2001/02/12 01:43:10 1.5
***************
*** 25,39 ****
*/
// open a database and return a hash
function OpenDataBase($table) {
! global $WikiDataBase, $pg_dbhost, $pg_dbport;
! $connectstring = $pg_dbhost?"host=$pg_dbhost ":"";
! $connectstring .= $pg_dbport?"port=$pg_dbport ":"";
! $connectstring .= $WikiDataBase?"dbname=$WikiDataBase":"";
!
! if (!($dbc = pg_pconnect($connectstring))) {
echo "Cannot establish connection to database, giving up.";
exit();
--- 25,52 ----
*/
+ $WikiPageStore = $DBParams['prefix'] . "wiki";
+ $ArchivePageStore = $DBParams['prefix'] . "archive";
+ $WikiLinksPageStore = $DBParams['prefix'] . "wikilinks";
+ $HotTopicsPageStore = $DBParams['prefix'] . "hottopics";
+ $HitCountPageStore = $DBParams['prefix'] . "hitcount";
// open a database and return a hash
function OpenDataBase($table) {
! extract($GLOBALS['DBParams']);
!
! $args = array();
! if (!empty($server))
! $args[] = "host=$server";
! if (!empty($port))
! $args[] = "port=$port";
! if (!empty($database))
! $args[] = "dbname=$database";
! if (!empty($user))
! $args[] = "user=$user";
! if (!empty($password))
! $args[] = "password=$password";
! if (!($dbc = pg_pconnect(join(' ', $args)))) {
echo "Cannot establish connection to database, giving up.";
exit();
***************
*** 418,422 ****
}
-
?>
--- 431,439 ----
}
+ // For emacs users
+ // Local Variables:
+ // mode: php
+ // c-file-style: "ellemtel"
+ // End:
?>
Index: savepage.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/savepage.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** savepage.php 2001/02/10 22:15:08 1.10
--- savepage.php 2001/02/12 01:43:10 1.11
***************
*** 102,107 ****
$html .= "</P>";
! GeneratePage('MESSAGE', $html,
! sprintf (gettext ("Problem while updating %s"), $pagename), 0);
exit;
}
--- 102,107 ----
$html .= "</P>";
! echo GeneratePage('MESSAGE', $html,
! sprintf (gettext ("Problem while updating %s"), $pagename), 0);
exit;
}
***************
*** 121,125 ****
$html = "<p>" . gettext ("This page has been locked by the administrator and cannot be edited.");
$html .= "\n<p>" . gettext ("Sorry for the inconvenience.");
! GeneratePage('MESSAGE', $html, sprintf (gettext ("Problem while editing %s"), $pagename), 0);
ExitWiki ("");
}
--- 121,126 ----
$html = "<p>" . gettext ("This page has been locked by the administrator and cannot be edited.");
$html .= "\n<p>" . gettext ("Sorry for the inconvenience.");
! echo GeneratePage('MESSAGE', $html,
! sprintf (gettext ("Problem while editing %s"), $pagename), 0);
ExitWiki ("");
}
***************
*** 167,183 ****
// fixme: no test for flat file db system
! if (isset($DBMdir) && preg_match('@^/tmp\b@', $DBMdir)) {
! $html .= "<P><B>Warning: the Wiki DB files still live in the " .
! "/tmp directory. Please read the INSTALL file and move " .
! "the DBM file to a permanent location or risk losing " .
"all the pages!</B>\n";
}
if (!empty($SignatureImg))
! $html .= sprintf("<P><img src=\"%s\"></P>\n", MakeURLAbsolute($SignatureImg));
$html .= "<hr noshade><P>";
include('lib/transform.php');
! GeneratePage('BROWSE', $html, $pagename, $pagehash);
?>
--- 168,184 ----
// fixme: no test for flat file db system
! if (!empty($DBWarning)) {
! $html .= "<P><B>Warning: $DBWarning" .
! "Please read the INSTALL file and move " .
! "the DB file to a permanent location or risk losing " .
"all the pages!</B>\n";
}
if (!empty($SignatureImg))
! $html .= sprintf("<P><img src=\"%s\"></P>\n", DataURL($SignatureImg));
$html .= "<hr noshade><P>";
include('lib/transform.php');
! echo GeneratePage('BROWSE', $html, $pagename, $pagehash);
?>
Index: search.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/search.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** search.php 2001/02/10 22:15:08 1.4
--- search.php 2001/02/12 01:43:10 1.5
***************
*** 28,31 ****
. "\n";
! GeneratePage('MESSAGE', $html, gettext ("Title Search Results"), 0);
?>
--- 28,31 ----
. "\n";
! echo GeneratePage('MESSAGE', $html, gettext ("Title Search Results"), 0);
?>
Index: stdlib.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/stdlib.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** stdlib.php 2001/02/10 22:15:08 1.27
--- stdlib.php 2001/02/12 01:43:10 1.28
***************
*** 5,9 ****
Standard functions for Wiki functionality
ExitWiki($errormsg)
- MakeURLAbsolute($url, $base = false)
WikiURL($pagename, $args, $abs)
--- 5,8 ----
***************
*** 43,47 ****
--- 42,76 ----
}
+ function SearchPath ($file, $missing_ok = false, $path = false)
+ {
+ if (ereg('^/', $file))
+ return $file; // absolute path.
+
+ if (!$path)
+ $path = $GLOBALS['DataPath'];
+
+ while (list($i, $dir) = each($path))
+ {
+ if (file_exists("$dir/$file"))
+ return "$dir/$file";
+ }
+ if ($missing_ok)
+ return false;
+ die("$file: file not found");
+ }
+
+ function arrays_equal ($a, $b)
+ {
+ if (sizeof($a) != sizeof($b))
+ return false;
+ for ($i = 0; $i < sizeof($a); $i++)
+ if ($a[$i] != $b[$i])
+ return false;
+ return true;
+ }
+
+
+
function ExitWiki($errormsg)
{
***************
*** 63,79 ****
}
! function MakeURLAbsolute($url, $base = false) {
! global $ScriptUrl;
!
if (preg_match('@^(\w+:|/)@', $url))
return $url;
!
! return preg_replace('@[^/]*$@', '', empty($base) ? $ScriptUrl : $base) . $url;
}
!
! function WikiURL($pagename, $args = '', $make_abs_url = false) {
! global $ScriptName, $ScriptUrl;
!
if (is_array($args))
{
--- 92,102 ----
}
! function DataURL($url) {
if (preg_match('@^(\w+:|/)@', $url))
return $url;
! return SERVER_URL . DATA_PATH . "/$url";
}
! function WikiURL($pagename, $args = '') {
if (is_array($args))
{
***************
*** 87,101 ****
if (USE_PATH_INFO) {
! $url = $make_abs_url ? "$ScriptUrl/" : '';
! $url .= rawurlencode($pagename);
if ($args)
$url .= "?$args";
}
else {
! $url = $make_abs_url ? $ScriptUrl : $ScriptName;
! $url .= "?pagename=" . rawurlencode($pagename);
if ($args)
$url .= "&$args";
}
return $url;
}
--- 110,124 ----
if (USE_PATH_INFO) {
! $url = rawurlencode($pagename);
if ($args)
$url .= "?$args";
}
else {
! $url = basename(SCRIPT_NAME) .
! "?pagename=" . rawurlencode($pagename);
if ($args)
$url .= "&$args";
}
+
return $url;
}
***************
*** 113,118 ****
if (is_array($args))
{
! while (list($key, $val) = each($args))
! $html .= sprintf(' %s="%s"', $key, htmlspecialchars($val));
}
else
--- 136,146 ----
if (is_array($args))
{
! while (list($key, $val) = each($args))
! {
! if (is_string($val) || is_numeric($val))
! $html .= sprintf(' %s="%s"', $key, htmlspecialchars($val));
! else if ($val)
! $html .= " $key";
! }
}
else
***************
*** 123,127 ****
{
$html .= $content;
! $html .= "</$tag>";
}
return $html;
--- 151,155 ----
{
$html .= $content;
! $html .= "</$tag>\n";//FIXME: newline might not always be desired.
}
return $html;
***************
*** 171,183 ****
}
- function LinkInterWikiLink($link, $linktext='') {
- global $interwikimap;
-
- list( $wiki, $page ) = split( ":", $link );
-
- $url = $interwikimap[$wiki] . urlencode($page);
- return LinkURL($url, $linktext ? $linktext : $link);
- }
-
// converts spaces to tabs
--- 199,202 ----
***************
*** 220,227 ****
! function MakeWikiForm ($pagename, $args, $button_text = '') {
! global $ScriptUrl;
!
! $formargs['action'] = USE_PATH_INFO ? WikiURL($pagename) : $ScriptUrl;
$formargs['method'] = 'post';
$contents = '';
--- 239,245 ----
! function MakeWikiForm ($pagename, $args, $button_text = '')
! {
! $formargs['action'] = USE_PATH_INFO ? WikiURL($pagename) : SCRIPT_NAME;
$formargs['method'] = 'post';
$contents = '';
***************
*** 232,236 ****
$a = array('name' => $key, 'value' => $val, 'type' => 'hidden');
! if (preg_match('/^ (\d*) \( (.*) \) $/x', $val, $m))
{
$input_seen++;
--- 250,254 ----
$a = array('name' => $key, 'value' => $val, 'type' => 'hidden');
! if (preg_match('/^ (\d*) \( (.*) \) ((upload)?) $/xi', $val, $m))
{
$input_seen++;
***************
*** 238,241 ****
--- 256,268 ----
$a['size'] = $m[1] ? $m[1] : 30;
$a['value'] = $m[2];
+ if ($m[3])
+ {
+ $a['type'] = 'file';
+ $formargs['enctype'] = 'multipart/form-data';
+ $contents .= Element('input',
+ array('name' => 'MAX_FILE_SIZE',
+ 'value' => MAX_UPLOAD_SIZE,
+ 'type' => 'hidden'));
+ }
}
***************
*** 243,254 ****
}
if (!empty($button_text)) {
! if ($input_seen)
! $contents .= ' ';
! $contents .= Element('input', array('type' => 'submit',
! 'value' => $button_text));
}
! return Element('form', $formargs, $contents);
}
--- 270,283 ----
}
+ $row = Element('td', $contents);
+
if (!empty($button_text)) {
! $row .= Element('td', Element('input', array('type' => 'submit',
! 'value' => $button_text)));
}
! return Element('form', $formargs,
! Element('table',
! Element('tr', $row)));
}
***************
*** 286,289 ****
--- 315,329 ----
}
+
+ // FIXME: ug, don't like this
+
+ if (!empty($args['action']) && !IsSafeAction($args['action']))
+ {
+ // Don't allow administrative links on unlocked pages.
+ global $pagehash;
+ if (($pagehash['flags'] & FLAG_PAGE_LOCKED) == 0)
+ return QElement('u', gettext('Lock page to enable link'));
+ }
+
// FIXME: ug, don't like this
if (preg_match('/=\d*\(/', $qargs))
***************
*** 294,299 ****
function ParseAndLink($bracketlink) {
! global $dbi, $ScriptUrl, $AllowedProtocols, $InlineImages;
! global $InterWikiLinking, $InterWikiLinkRegexp;
// $bracketlink will start and end with brackets; in between
--- 334,339 ----
function ParseAndLink($bracketlink) {
! global $dbi, $AllowedProtocols, $InlineImages;
! global $InterWikiLinkRegexp;
// $bracketlink will start and end with brackets; in between
***************
*** 335,339 ****
$link['type'] = "footnote-$linktype";
$link['link'] = $URL;
! } elseif ($InterWikiLinking &&
preg_match("#^$InterWikiLinkRegexp:#", $URL)) {
$link['type'] = "interwiki-$linktype";
--- 375,379 ----
$link['type'] = "footnote-$linktype";
$link['link'] = $URL;
! } elseif (function_exists('LinkInterWikiLink') &&
preg_match("#^$InterWikiLinkRegexp:#", $URL)) {
$link['type'] = "interwiki-$linktype";
***************
*** 381,385 ****
}
-
function LinkRelatedPages($dbi, $pagename)
{
--- 421,424 ----
***************
*** 436,442 ****
function GeneratePage($template, $content, $name, $hash)
{
! global $ScriptUrl, $AllowedProtocols, $templates;
global $datetimeformat, $dbi, $logo, $FieldSeparator;
! global $user;
if (!is_array($hash))
--- 475,481 ----
function GeneratePage($template, $content, $name, $hash)
{
! global $templates;
global $datetimeformat, $dbi, $logo, $FieldSeparator;
! global $user, $pagename;
if (!is_array($hash))
***************
*** 476,480 ****
}
! $page = join('', file($templates[$template]));
$page = str_replace('###', "$FieldSeparator#", $page);
--- 515,519 ----
}
! $page = join('', file(SearchPath($templates[$template])));
$page = str_replace('###', "$FieldSeparator#", $page);
***************
*** 493,499 ****
_dotoken('USERID', htmlspecialchars($user->id()), $page);
- _dotoken('SCRIPTURL', htmlspecialchars($ScriptUrl), $page);
_dotoken('PAGE', htmlspecialchars($name), $page);
! _dotoken('LOGO', htmlspecialchars(MakeURLAbsolute($logo)), $page);
global $RCS_IDS;
_dotoken('RCS_IDS', join("\n", $RCS_IDS), $page);
--- 532,537 ----
_dotoken('USERID', htmlspecialchars($user->id()), $page);
_dotoken('PAGE', htmlspecialchars($name), $page);
! _dotoken('LOGO', htmlspecialchars(DataURL($logo)), $page);
global $RCS_IDS;
_dotoken('RCS_IDS', join("\n", $RCS_IDS), $page);
***************
*** 506,511 ****
_dotoken('BROWSE', WikiURL(''), $page);
! // FIXME: this is possibly broken.
! _dotoken('BASE_URL', WikiURL($name, '', 'absolute_url'), $page);
// invalid for messages (search results, error messages)
--- 544,552 ----
_dotoken('BROWSE', WikiURL(''), $page);
! if (USE_PATH_INFO)
! _dotoken('BASE_URL',
! SERVER_URL . VIRTUAL_PATH . "/" . WikiURL($pagename), $page);
! else
! _dotoken('BASE_URL', SERVER_URL . SCRIPT_NAME, $page);
// invalid for messages (search results, error messages)
***************
*** 528,532 ****
_dotoken('CONTENT', $content, $page);
! print $page;
}
?>
--- 569,578 ----
_dotoken('CONTENT', $content, $page);
! return $page;
}
+ // For emacs users
+ // Local Variables:
+ // mode: php
+ // c-file-style: "ellemtel"
+ // End:
?>
Index: transform.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/transform.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** transform.php 2001/02/10 22:15:08 1.14
--- transform.php 2001/02/12 01:43:10 1.15
***************
*** 5,8 ****
--- 5,11 ----
define('WT_MODE_MARKUP', 3);
+ define("ZERO_LEVEL", 0);
+ define("NESTED_LEVEL", 1);
+
class WikiTransform
{
***************
*** 199,203 ****
$transform->register(WT_TOKENIZER, 'wtt_bracketlinks');
$transform->register(WT_TOKENIZER, 'wtt_urls');
! if ($InterWikiLinking) {
$transform->register(WT_TOKENIZER, 'wtt_interwikilinks');
}
--- 202,206 ----
$transform->register(WT_TOKENIZER, 'wtt_bracketlinks');
$transform->register(WT_TOKENIZER, 'wtt_urls');
! if (function_exists('wtt_interwikilinks')) {
$transform->register(WT_TOKENIZER, 'wtt_interwikilinks');
}
***************
*** 324,350 ****
- // Link InterWiki links
- // These can be protected by a '!' like Wiki words.
- function wtt_interwikilinks($line, &$trfrm)
- {
- global $InterWikiLinkRegexp, $WikiNameRegexp;
-
- $n = $ntok = $trfrm->tokencounter;
- $line = wt_tokenize($line, "!?(?<![A-Za-z0-9])$InterWikiLinkRegexp:$WikiNameRegexp", $trfrm->replacements, $ntok);
- while ($n < $ntok) {
- $old = $trfrm->replacements[$n];
- if ($old[0] == '!') {
- $trfrm->replacements[$n] = substr($old,1);
- } else {
- $trfrm->replacements[$n] = LinkInterWikiLink($old);
- }
- $n++;
- }
- $trfrm->tokencounter = $ntok;
- return $line;
- }
-
-
// Link Wiki words (BumpyText)
// Wikiwords preceeded by a '!' are not linked
--- 327,331 ----
***************
*** 528,530 ****
--- 509,517 ----
return $line;
}
+
+ // For emacs users
+ // Local Variables:
+ // mode: php
+ // c-file-style: "ellemtel"
+ // End:
?>
Index: userauth.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/userauth.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** userauth.php 2001/02/10 22:15:08 1.1
--- userauth.php 2001/02/12 01:43:10 1.2
***************
*** 13,18 ****
// Arg $login_mode:
// default: Anonymous users okay.
// 'LOGOUT': Force logout.
! // 'REQUIRE_AUTH': Force authenticated login.
function WikiUser ($auth_mode = '') {
// Restore from cookie.
--- 13,20 ----
// Arg $login_mode:
// default: Anonymous users okay.
+ // 'ANON_OK': Anonymous access is fine.
+ // 'REQUIRE_AUTH': User must be authenticated.
// 'LOGOUT': Force logout.
! // 'LOGIN': Force authenticated login.
function WikiUser ($auth_mode = '') {
// Restore from cookie.
***************
*** 27,36 ****
$this = unserialize(fix_magic_quotes_gpc($WIKI_AUTH));
!
if ($auth_mode != 'LOGOUT')
{
$user = $this->_get_authenticated_userid();
! if (!$user && $auth_mode == 'REQUIRE_AUTH')
$warning = $this->_demand_http_authentication(); //NORETURN
}
--- 29,44 ----
$this = unserialize(fix_magic_quotes_gpc($WIKI_AUTH));
! if ($this->state == 'authorized' && $auth_mode == 'LOGIN')
! {
! // ...logout
! $this->realm++;
! $this->state = 'loggedout';
! }
!
if ($auth_mode != 'LOGOUT')
{
$user = $this->_get_authenticated_userid();
! if (!$user && $auth_mode != 'ANON_OK')
$warning = $this->_demand_http_authentication(); //NORETURN
}
***************
*** 125,127 ****
--- 133,140 ----
}
+ // For emacs users
+ // Local Variables:
+ // mode: php
+ // c-file-style: "ellemtel"
+ // End:
?>
Index: ziplib.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/ziplib.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** ziplib.php 2001/02/10 22:15:08 1.5
--- ziplib.php 2001/02/12 01:43:10 1.6
***************
*** 358,362 ****
{
function ZipReader ($zipfile) {
! if (!($this->fp = fopen($zipfile, "rb")))
die("Can't open zip file '$zipfile' for reading");
}
--- 358,364 ----
{
function ZipReader ($zipfile) {
! if (!is_string($zipfile))
! $this->fp = $zipfile; // File already open
! else if (!($this->fp = fopen($zipfile, "rb")))
die("Can't open zip file '$zipfile' for reading");
}
***************
*** 524,528 ****
$params['flags'] = 'PAGE_LOCKED';
! if (is_array($refs))
{
// phpwiki's with versions > 1.2.x shouldn't have references.
--- 526,530 ----
$params['flags'] = 'PAGE_LOCKED';
! if (isset($refs) && is_array($refs))
{
// phpwiki's with versions > 1.2.x shouldn't have references.
***************
*** 696,707 ****
// FIXME: more sanity checking?
! $pagehash = array('pagename' => rawurldecode($params['pagename']),
! 'author' => rawurldecode($params['author']),
! 'version' => $params['version'],
! 'lastmodified' => $params['lastmodified'],
! 'created' => $params['created']);
$pagehash['flags'] = 0;
! if (preg_match('/PAGE_LOCKED/', $params['flags']))
! $pagehash['flags'] |= FLAG_PAGE_LOCKED;
$encoding = strtolower($headers['content-transfer-encoding']);
--- 698,716 ----
// FIXME: more sanity checking?
! $pagehash = array('pagename' => '',
! 'author' => '',
! 'version' => 0,
! 'lastmodified' => '',
! 'created' => '');
! while(list($key, $val) = each ($pagehash))
! if (!empty($params[$key]))
! $pagehash[$key] = rawurldecode($params[$key]);
!
$pagehash['flags'] = 0;
! if (!empty($params['flags']))
! {
! if (preg_match('/PAGE_LOCKED/', $params['flags']))
! $pagehash['flags'] |= FLAG_PAGE_LOCKED;
! }
$encoding = strtolower($headers['content-transfer-encoding']);
--- setupwiki.php DELETED ---
|