[Fusionforge-commits] r10559 - in trunk/src/plugins/wiki/www: lib lib/plugin pgsrc

Marc-Etienne VARGENAU vargenau at libremir.placard.fr.eu.org
Mon Sep 20 20:06:02 CEST 2010


Author: vargenau
Date: 2010-09-20 20:06:01 +0200 (Mon, 20 Sep 2010)
New Revision: 10559

Modified:
   trunk/src/plugins/wiki/www/lib/BlockParser.php
   trunk/src/plugins/wiki/www/lib/EditToolbar.php
   trunk/src/plugins/wiki/www/lib/plugin/CreateToc.php
   trunk/src/plugins/wiki/www/lib/plugin/IncludePage.php
   trunk/src/plugins/wiki/www/lib/plugin/PageGroup.php
   trunk/src/plugins/wiki/www/lib/plugin/Template.php
   trunk/src/plugins/wiki/www/pgsrc/Help%2FCreateTocPlugin
   trunk/src/plugins/wiki/www/pgsrc/Help%2FIncludePagePlugin
   trunk/src/plugins/wiki/www/pgsrc/Help%2FTemplatePlugin
Log:
Phpwiki update

Modified: trunk/src/plugins/wiki/www/lib/BlockParser.php
===================================================================
--- trunk/src/plugins/wiki/www/lib/BlockParser.php	2010-09-20 16:23:49 UTC (rev 10558)
+++ trunk/src/plugins/wiki/www/lib/BlockParser.php	2010-09-20 18:06:01 UTC (rev 10559)
@@ -1,4 +1,4 @@
-<?php // rcs_id('$Id: BlockParser.php 7638 2010-08-11 11:58:40Z vargenau $');
+<?php // rcs_id('$Id: BlockParser.php 7697 2010-09-20 13:04:55Z vargenau $');
 /* Copyright (C) 2002 Geoffrey T. Dairiki <dairiki at dairiki.org>
  * Copyright (C) 2004,2005 Reini Urban
  * Copyright (C) 2008-2009 Marc-Etienne Vargenau, Alcatel-Lucent
@@ -1182,7 +1182,7 @@
         // {{foo?version=5}}
         // in that case, output is "page=foo rev=5"
         if (strstr($pi, "?")) {
-            $pi = str_replace("?version=", "\" rev=\"", $page);
+            $pi = str_replace("?version=", "\" rev=\"", $pi);
         }
 
         if ($vars)

Modified: trunk/src/plugins/wiki/www/lib/EditToolbar.php
===================================================================
--- trunk/src/plugins/wiki/www/lib/EditToolbar.php	2010-09-20 16:23:49 UTC (rev 10558)
+++ trunk/src/plugins/wiki/www/lib/EditToolbar.php	2010-09-20 18:06:01 UTC (rev 10559)
@@ -1,5 +1,5 @@
 <?php
-// rcs_id('$Id: EditToolbar.php 7659 2010-08-31 14:55:29Z vargenau $');
+// rcs_id('$Id: EditToolbar.php 7696 2010-09-20 10:20:25Z rurban $');
 /* Copyright 2004-2010 $ThePhpWikiProgrammingTeam
  * Copyright 2008-2009 Marc-Etienne Vargenau, Alcatel-Lucent
  *
@@ -216,7 +216,6 @@
 	    }
     
             foreach ($toolarray as $tool) {
-            	global $WikiTheme;
                 $image = $WikiTheme->getImageURL($tool["image"]);
                 $open  = $tool["open"];
                 $close = $tool["close"];

Modified: trunk/src/plugins/wiki/www/lib/plugin/CreateToc.php
===================================================================
--- trunk/src/plugins/wiki/www/lib/plugin/CreateToc.php	2010-09-20 16:23:49 UTC (rev 10558)
+++ trunk/src/plugins/wiki/www/lib/plugin/CreateToc.php	2010-09-20 18:06:01 UTC (rev 10559)
@@ -1,5 +1,5 @@
 <?php // -*-php-*-
-// rcs_id('$Id: CreateToc.php 7689 2010-09-17 08:41:10Z vargenau $');
+// rcs_id('$Id: CreateToc.php 7701 2010-09-20 16:09:07Z vargenau $');
 /*
  * Copyright 2004,2005 $ThePhpWikiProgrammingTeam
  * Copyright 2008-2010 Marc-Etienne Vargenau, Alcatel-Lucent
@@ -67,6 +67,7 @@
                      'width'     => '200px',
                      'with_counter' => 0,
                      'with_toclink' => 0,             // link back to TOC
+                     'version'   => false,
                     );
     }
     // Initialisation of toc counter
@@ -168,13 +169,13 @@
                            $level, &$hstart, &$hend, $basepage=false) {
         $hstart = 0;
         $hend = 0;
-            $h = $this->_getHeader($level);
+        $h = $this->_getHeader($level);
         $qheading = $this->_quote($heading);
-            for ($j=$start_index; $j < count($content); $j++) {
+        for ($j=$start_index; $j < count($content); $j++) {
             if (is_string($content[$j])) {
-                    if (preg_match("/<$h>$qheading<\/$h>/",
+                if (preg_match("/<$h>$qheading<\/$h>/",
                                    $content[$j]))
-                        return $j;
+                    return $j;
             }
             elseif (isa($content[$j], 'cached_link'))
             {
@@ -213,10 +214,10 @@
                         }
                     }
                 }
-                }
             }
-            trigger_error("Heading <$h> $heading </$h> not found\n", E_USER_NOTICE);
-            return 0;
+        }
+        trigger_error("Heading <$h> $heading </$h> not found\n", E_USER_NOTICE);
+        return 0;
     }
 
     /** prevent from duplicate anchors,
@@ -371,7 +372,7 @@
             $pagename = $page->name;
         }
         if (!$pagename) {
-            return $this->error(_("no page specified"));
+            return $this->error(_("No page specified."));
         }
         if (isBrowserIE() and browserDetect("Mac")) {
             $jshide = 0;
@@ -380,22 +381,39 @@
             $with_counter = 1;
         }
 
-        // Check if user is allowed to get the Page.
+        // Check if page exists.
+        if (!($dbi->isWikiPage($pagename))) {
+            return $this->error(sprintf(_("Page '%s' does not exist."), $pagename));
+        }
+
+        // Check if user is allowed to get the page.
         if (!mayAccessPage ('view', $pagename)) {
             return $this->error(sprintf(_("Illegal access to page %s: no read access"),
             $pagename));
         }
 
         $page = $dbi->getPage($pagename);
+
+        if ($version) {
+            $r = $page->getRevision($version);
+            if ((!$r) || ($r->hasDefaultContents())) {
+                return $this->error(sprintf(_("%s: no such revision %d."),
+                                            $pagename, $version));
+            }
+        } else {
+            $r = $page->getCurrentRevision();
+        }
+
         $current = $page->getCurrentRevision();
         //FIXME: I suspect this only to crash with Apache2
         if (!$current->get('markup') or $current->get('markup') < 2) {
             if (in_array(php_sapi_name(),array('apache2handler','apache2filter'))) {
-                trigger_error(_("CreateToc disabled for old markup"), E_USER_WARNING);
-                return '';
+                return $this->error(_("CreateToc disabled for old markup."));
             }
         }
-        $content = $current->getContent();
+
+        $content = $r->getContent();
+
         $html = HTML::div(array('class' => 'toc', 'id'=> GenerateId("toc")));
         if ($notoc) {
             $html->setAttr('style','display:none;');

Modified: trunk/src/plugins/wiki/www/lib/plugin/IncludePage.php
===================================================================
--- trunk/src/plugins/wiki/www/lib/plugin/IncludePage.php	2010-09-20 16:23:49 UTC (rev 10558)
+++ trunk/src/plugins/wiki/www/lib/plugin/IncludePage.php	2010-09-20 18:06:01 UTC (rev 10559)
@@ -1,5 +1,5 @@
 <?php // -*-php-*-
-// rcs_id('$Id: IncludePage.php 7638 2010-08-11 11:58:40Z vargenau $');
+// rcs_id('$Id: IncludePage.php 7700 2010-09-20 16:03:26Z vargenau $');
 /*
  * Copyright 1999, 2000, 2001, 2002 $ThePhpWikiProgrammingTeam
  * Copyright 2008-2009 Marc-Etienne Vargenau, Alcatel-Lucent
@@ -41,6 +41,7 @@
     function getDefaultArguments() {
         return array( 'page'    => false, // the page to include
                       'rev'     => false, // the revision (defaults to most recent)
+                      'version' => false, // same as "rev"
                       'quiet'   => false, // if set, inclusion appears as normal content
                       'bytes'   => false, // maximum number of bytes to include
                       'words'   => false, // maximum number of words to include
@@ -68,6 +69,13 @@
     function run($dbi, $argstr, &$request, $basepage) {
         $args = $this->getArgs($argstr, $request);
         extract($args);
+
+        if ($version && $rev) {
+            return $this->error(_("Choose only one of 'version' or 'rev' parameters."));
+        } elseif ($version) {
+            $rev = $version;
+        }
+
         if ($page) {
             // Expand relative page names.
             $page = new WikiPageName($page, $basepage);
@@ -99,8 +107,8 @@
         $p = $dbi->getPage($page);
         if ($rev) {
             $r = $p->getRevision($rev);
-            if (!$r) {
-                return $this->error(sprintf(_("%s(%d): no such revision"),
+            if ((!$r) || ($r->hasDefaultContents())) {
+                return $this->error(sprintf(_("%s: no such revision %d."),
                                             $page, $rev));
             }
         } else {

Modified: trunk/src/plugins/wiki/www/lib/plugin/PageGroup.php
===================================================================
--- trunk/src/plugins/wiki/www/lib/plugin/PageGroup.php	2010-09-20 16:23:49 UTC (rev 10558)
+++ trunk/src/plugins/wiki/www/lib/plugin/PageGroup.php	2010-09-20 18:06:01 UTC (rev 10559)
@@ -1,5 +1,5 @@
 <?php // -*-php-*-
-// rcs_id('$Id: PageGroup.php 7447 2010-05-31 11:29:39Z vargenau $');
+// rcs_id('$Id: PageGroup.php 7700 2010-09-20 16:03:26Z vargenau $');
 /**
  * Copyright 1999,2000,2001,2002,2004 $ThePhpWikiProgrammingTeam
  * Copyright 2009 Marc-Etienne Vargenau, Alcatel-Lucent
@@ -120,10 +120,9 @@
         $p = $dbi->getPage($parent);
         if ($rev) {
             $r = $p->getRevision($rev);
-            if (!$r) {
-                $this->error(sprintf(_("%s(%d): no such revision"), $parent,
-                                     $rev));
-                return '';
+            if ((!$r) || ($r->hasDefaultContents())) {
+                return $this->error(sprintf(_("%s: no such revision %d."),
+                                            $parent, $rev));
             }
         } else {
             $r = $p->getCurrentRevision();

Modified: trunk/src/plugins/wiki/www/lib/plugin/Template.php
===================================================================
--- trunk/src/plugins/wiki/www/lib/plugin/Template.php	2010-09-20 16:23:49 UTC (rev 10558)
+++ trunk/src/plugins/wiki/www/lib/plugin/Template.php	2010-09-20 18:06:01 UTC (rev 10559)
@@ -1,5 +1,5 @@
 <?php // -*-php-*-
-// rcs_id('$Id: Template.php 7638 2010-08-11 11:58:40Z vargenau $');
+// rcs_id('$Id: Template.php 7700 2010-09-20 16:03:26Z vargenau $');
 /*
  * Copyright 2005,2007 $ThePhpWikiProgrammingTeam
  * Copyright 2008-2009 Marc-Etienne Vargenau, Alcatel-Lucent
@@ -70,6 +70,7 @@
                      'page'    => false, // the page to include
                      'vars'    => false, // TODO: get rid of this, all remaining args should be vars
                      'rev'     => false, // the revision (defaults to most recent)
+                     'version' => false, // same as "rev"
                      'section' => false, // just include a named section
                      'sectionhead' => false // when including a named section show the heading
                      );
@@ -94,17 +95,24 @@
     }
 
     function run($dbi, $argstr, &$request, $basepage) {
-            $this->vars = array();
+        $this->vars = array();
         $args = $this->getArgs($argstr, $request);
         $vars = $args['vars'] ? $args['vars'] : $this->vars;
         $page = $args['page'];
+
+        if ($args['version'] && $args['rev']) {
+            return $this->error(_("Choose only one of 'version' or 'rev' parameters."));
+        } elseif ($args['version']) {
+            $args['rev'] = $args['version'];
+        }
+
         if ($page) {
             // Expand relative page names.
             $page = new WikiPageName($page, $basepage);
             $page = $page->name;
         }
         if (!$page) {
-            return $this->error(_("no page specified"));
+            return $this->error(_("No page specified."));
         }
 
         // If "Template:$page" exists, use it
@@ -125,20 +133,20 @@
 
         // Check if page exists
         if (!($dbi->isWikiPage($page))) {
-            return $this->error(sprintf(_("Page '%s' does not exist"), $page));
+            return $this->error(sprintf(_("Page '%s' does not exist."), $page));
         }
 
         // Check if user is allowed to get the Page.
         if (!mayAccessPage ('view', $page)) {
-                return $this->error(sprintf(_("Illegal inclusion of page %s: no read access"),
+                return $this->error(sprintf(_("Illegal inclusion of page %s: no read access."),
                                         $page));
         }
 
         $p = $dbi->getPage($page);
         if ($args['rev']) {
             $r = $p->getRevision($args['rev']);
-            if (!$r) {
-                return $this->error(sprintf(_("%s(%d): no such revision"),
+            if ((!$r) || ($r->hasDefaultContents())) {
+                return $this->error(sprintf(_("%s: no such revision %d."),
                                             $page, $args['rev']));
             }
         } else {

Modified: trunk/src/plugins/wiki/www/pgsrc/Help%FCreateTocPlugin
===================================================================
--- trunk/src/plugins/wiki/www/pgsrc/Help%2FCreateTocPlugin	2010-09-20 16:23:49 UTC (rev 10558)
+++ trunk/src/plugins/wiki/www/pgsrc/Help%2FCreateTocPlugin	2010-09-20 18:06:01 UTC (rev 10559)
@@ -1,6 +1,6 @@
-Date: Fri, 10 Sep 2010 13:46:13 +0000
+Date: Mon, 20 Sep 2010 18:07:40 +0000
 Mime-Version: 1.0 (Produced by PhpWiki 1.4.0RC1)
-X-Rcs-Id: $Id: Help%2FCreateTocPlugin 7682 2010-09-10 12:03:36Z vargenau $
+X-Rcs-Id: $Id: Help%2FCreateTocPlugin 7701 2010-09-20 16:09:07Z vargenau $
 Content-Type: application/x-phpwiki;
   pagename=Help%2FCreateTocPlugin;
   flags=PAGE_LOCKED%2CEXTERNAL_PAGE;
@@ -63,6 +63,10 @@
 | Table of Contents of which page?
 | current pagename
 |-
+| **version**
+| page version
+| most recent version
+|-
 | **position**
 | Where to display the Table of Contents: full, left or right.
 | full

Modified: trunk/src/plugins/wiki/www/pgsrc/Help%FIncludePagePlugin
===================================================================
--- trunk/src/plugins/wiki/www/pgsrc/Help%2FIncludePagePlugin	2010-09-20 16:23:49 UTC (rev 10558)
+++ trunk/src/plugins/wiki/www/pgsrc/Help%2FIncludePagePlugin	2010-09-20 18:06:01 UTC (rev 10559)
@@ -1,6 +1,6 @@
-Date: Fri, 10 Sep 2010 13:46:13 +0000
+Date: Mon, 20 Sep 2010 16:44:13 +0000
 Mime-Version: 1.0 (Produced by PhpWiki 1.4.0RC1)
-X-Rcs-Id: $Id: Help%2FIncludePagePlugin 7682 2010-09-10 12:03:36Z vargenau $
+X-Rcs-Id: $Id: Help%2FIncludePagePlugin 7699 2010-09-20 14:45:28Z vargenau $
 Content-Type: application/x-phpwiki;
   pagename=Help%2FIncludePagePlugin;
   flags=PAGE_LOCKED%2CEXTERNAL_PAGE;
@@ -31,8 +31,12 @@
 |-
 | **rev**
 | the revision
-| defaults to most recent
+| most recent revision
 |-
+| **version**
+| page revision (same as ##rev##)
+| most recent revision
+|-
 | **quiet**
 | if set, inclusion appears as normal content
 | false

Modified: trunk/src/plugins/wiki/www/pgsrc/Help%FTemplatePlugin
===================================================================
--- trunk/src/plugins/wiki/www/pgsrc/Help%2FTemplatePlugin	2010-09-20 16:23:49 UTC (rev 10558)
+++ trunk/src/plugins/wiki/www/pgsrc/Help%2FTemplatePlugin	2010-09-20 18:06:01 UTC (rev 10559)
@@ -1,6 +1,6 @@
-Date: Fri, 10 Sep 2010 13:46:13 +0000
+Date: Fri, 20 Sep 2010 13:46:13 +0000
 Mime-Version: 1.0 (Produced by PhpWiki 1.4.0RC1)
-X-Rcs-Id: $Id: Help%2FTemplatePlugin 7682 2010-09-10 12:03:36Z vargenau $
+X-Rcs-Id: $Id: Help%2FTemplatePlugin 7698 2010-09-20 13:28:46Z vargenau $
 Content-Type: application/x-phpwiki;
   pagename=Help%2FTemplatePlugin;
   flags=PAGE_LOCKED%2CEXTERNAL_PAGE;
@@ -73,6 +73,10 @@
 | page revision
 | most recent revision
 |-
+| **version**
+| page revision (same as ##rev##)
+| most recent revision
+|-
 | **section**
 | just include a named section
 | (empty)




More information about the Fusionforge-commits mailing list