From 1c7ba213343f6002bc6c8802f779fd6628fa43ee Mon Sep 17 00:00:00 2001 From: dairiki Date: Wed, 26 Feb 2003 00:39:30 +0000 Subject: [PATCH] Bug fix: for magic PhpWiki URLs, "lock page to enable link" message was being displayed at incorrect times. git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@2668 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/CachedMarkup.php | 20 +++++++++++++++++++- lib/InlineParser.php | 4 ++-- lib/stdlib.php | 10 +++++++--- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/lib/CachedMarkup.php b/lib/CachedMarkup.php index 7fcbcfc7c..91018705c 100644 --- a/lib/CachedMarkup.php +++ b/lib/CachedMarkup.php @@ -1,4 +1,4 @@ - * * This file is part of PhpWiki. @@ -266,6 +266,24 @@ class Cached_WikiLinkIfKnown extends Cached_WikiLink } } +class Cached_PhpwikiURL extends Cached_DynamicContent +{ + function Cached_PhpwikiURL ($url, $label) { + $this->_url = $url; + if ($label) + $this->_label = $label; + } + + function isInlineElement() { + return true; + } + + function expand($basepage) { + $label = isset($this->_label) ? $this->_label : false; + return LinkPhpwikiURL($this->_url, $label, $basepage); + } +} + class Cached_ExternalLink extends Cached_Link { function Cached_ExternalLink($url, $label=false) { diff --git a/lib/InlineParser.php b/lib/InlineParser.php index dff350325..71435d274 100644 --- a/lib/InlineParser.php +++ b/lib/InlineParser.php @@ -1,4 +1,4 @@ - * * This file is part of PhpWiki. @@ -298,7 +298,7 @@ function LinkBracketLink($bracketlink) { return new Cached_ExternalLink($link, $label); } elseif (preg_match("/^phpwiki:/", $link)) - return LinkPhpwikiURL($link, $label); + return new Cached_PhpwikiURL($link, $label); elseif (preg_match("/^" . $intermap->getRegexp() . ":/", $link)) return new Cached_InterwikiLink($link, $label); else { diff --git a/lib/stdlib.php b/lib/stdlib.php index 22be0b777..a0b2f9d42 100644 --- a/lib/stdlib.php +++ b/lib/stdlib.php @@ -1,4 +1,4 @@ -getPage(); + $dbi = $GLOBALS['request']->getDbh(); + $page = $dbi->getPage($basepage); if (!$page->get('locked')) return HTML::span(array('class' => 'wikiunsafe'), HTML::u(_("Lock page to enable link"))); @@ -1237,6 +1238,9 @@ class Alert { // $Log: not supported by cvs2svn $ +// Revision 1.143 2003/02/26 00:10:26 dairiki +// More/better/different checks for bad page names. +// // Revision 1.142 2003/02/25 22:19:46 dairiki // Add some sanity checking for pagenames. // -- 2.45.0