Dan F - 2004-09-27

Logged In: YES
user_id=417594

Patches I applied to make mine work properly:

diff -b -u -r1.4 -r1.5
--- CachedMarkup.php 16 Jun 2004 19:26:06 -0000 1.4
+++ CachedMarkup.php 20 Jul 2004 13:16:21 -0000 1.5
@@ -412,7 +412,7 @@

 function expand($basepage, &$markup) {
     //include_once('lib/interwiki.php');
  • $intermap =
    PageType_interwikimap::GetMap($GLOBALS['request']);
  • $intermap = PageType_interwikimap::GetMap();
    $label = isset($this->_label) ? $this->_label : false;
    return $intermap->link($this->_link, $label);
    }

=======================================

diff -b -u -r1.5 -r1.6
--- InlineParser.php 3 Jun 2004 18:23:48 -0000 1.5
+++ InlineParser.php 20 Jul 2004 13:16:35 -0000 1.6
@@ -286,7 +286,7 @@
global $request, $AllowedProtocols, $InlineImages;

 //include_once("lib/interwiki.php");
  • $intermap = PageType_interwikimap::GetMap($request);
  • $intermap = PageType_interwikimap::GetMap();

    // $bracketlink will start and end with brackets; in
    between will
    // be either a page name, a URL or both separated by a
    pipe.
    @@ -423,13 +423,13 @@
    {
    function getMatchRegexp () {
    global $request;
    - $map = PageType_interwikimap::GetMap($request);
    + $map = PageType_interwikimap::GetMap();
    return "(?<! [[:alnum:]])" . $map->getRegexp(). ":
    \S+ (?<![ ,.?;! ] ) \" \' ])";
    }

    function markup ($match) {
    global $request;
    - $map = PageType_interwikimap::GetMap($request);
    + $map = PageType_interwikimap::GetMap();
    return new Cached_InterwikiLink(UnWikiEscape($match));
    }
    }

==================================

diff -b -u -r1.3 -r1.4
--- PageType.php 19 Jul 2004 20:59:16 -0000 1.3
+++ PageType.php 20 Jul 2004 13:17:19 -0000 1.4
@@ -128,10 +128,21 @@

class PageType_interwikimap extends PageType
{
- function PageType_interwikimap() {
+ function PageType_interwikimap($pagetext = false) {
global $request;
$dbi = $request->getDbh();
- $intermap =
$this->getMapFromWikiPage($dbi->getPage(("InterWikiMap")));
+
+ if (!$pagetext) {
+ $page = $dbi->getPage(("InterWikiMap"));
+ if ($page->get('locked')) {
+ $current = $page->getCurrentRevision();
+ $pagetext = $current->getPackedContent();
+ }
+ else {
+ trigger_error(
("WARNING: InterWikiMap page
is unlocked, so not using those links."));
+ }
+ }
+ $intermap = $this->_getMapFromWikiPageText($pagetext);
if (!$intermap && defined('INTERWIKI_MAP_FILE'))
$intermap =
$this->_getMapFromFile(INTERWIKI_MAP_FILE);

@@ -139,13 +150,8 @@
$this->_regexp = $this->_getRegexp();
}

  • function GetMap ($request = false) {
  • if (empty($this->_map)) {
  • $map = new PageType_interwikimap();
  • return $map;
  • } else {
  • return $this;
  • }
  • function GetMap ($pagetext = false) {
  • return new PageType_interwikimap($pagetext);
    }

    function getRegexp() {
    @@ -153,7 +159,6 @@
    }

     list ($moniker, $page) = split (":", $link, 2);
    
     if (!isset($this->_map[$moniker])) {
    

    @@ -201,14 +206,9 @@
    return $map;
    }

  • function _getMapFromWikiPage ($page) {

  • if (! $page->get('locked'))
  • return false;

  • $current = $page->getCurrentRevision();

  • function _getMapFromWikiPageText ($pagetext) {
    if (preg_match('|^<verbatim>\n(.*)^</verbatim>|ms',
  • $current->getPackedContent(), $m)) {
  • $pagetext, $m)) {
    return $m[1];
    }
    return false;
    @@ -287,7 +287,7 @@
    function format($text) {
    return HTML::div(array('class' => 'wikitext'),

$this->_transform($this->_getHeader($text)),
- $this->_formatMap(),
+ $this->_formatMap($text),

$this->_transform($this->_getFooter($text)));
}

@@ -299,13 +299,13 @@
return preg_replace('@.*?(</verbatim>|\Z)@s', '',
$text, 1);
}

  • function _getMap() {
  • $map = PageType_interwikimap::getMap();
  • function _getMap($pagetext) {
  • $map = PageType_interwikimap::getMap($pagetext);
    return $map->_map;
    }

  • function _formatMap() {

  • $map = $this->_getMap();
  • function _formatMap($pagetext) {
  • $map = $this->_getMap($pagetext);
    if (!$map)
    return HTML::p("<No map="" found="">"); // Shouldn't
    happen.

=======================================

diff -b -u -r1.1 -r1.2
--- ExternalSearch.php 29 Jan 2004 14:30:28 -0000 1.1
+++ ExternalSearch.php 20 Jul 2004 13:17:54 -0000 1.2
@@ -20,7 +20,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
*/

-require_once("lib/interwiki.php");
+//require_once("lib/interwiki.php");

/*

/
@@ -38,11 +38,11 @@
function _getInterWikiUrl(&$request) {
- $intermap = InterWikiMap::GetMap($request);
+ $intermap = PageType_interwikimap::GetMap();
$map = $intermap->_map;

     if (in_array($this->_url, array_keys($map))) {

@@ -118,8 +118,21 @@
};

===============================

diff -b -u -r1.1 -r1.2
--- stdlib.php 29 Jan 2004 14:30:27 -0000 1.1
+++ stdlib.php 20 Jul 2004 13:29:38 -0000 1.2
@@ -559,8 +558,8 @@

     // change ! escapes to ~'s.
     global $AllowedProtocols, $WikiNameRegexp, $request;
  • include_once('lib/interwiki.php');
  • $map = InterWikiMap::GetMap($request);
  • //include_once('lib/interwiki.php');
  • $map = PageType_interwikimap::GetMap();
    $bang_esc[] =
    "(?:$AllowedProtocols):[^\s<>[]\"'()]*[^\s<>[]\"'(),.
    ?]
    ";
    $bang_esc[] = $map->getRegexp() . ":[^\s.,;?()]+";
    // FIXME: is this r
    eally needed?
    $bang_esc[] = $WikiNameRegexp;