[pmwiki-users] Edit Page Problem

Patrick R. Michaud pmichaud at pobox.com
Mon Oct 24 11:26:17 CDT 2005


On Sun, Oct 23, 2005 at 04:43:06PM +0200, Dominique Faure wrote:
> 2005/10/23, Allyen E. Wilson <awilson at allyenwilson.com>:
> > When using the "recurve" skin, when I try to edit a page it always
> > opens the edit page for Main.Homepage. No matter which page I am on
> > it wants to edit Main.Homepage. Where do I start looking for the fix?
> > Is it the .tmpl file? I don't think is is the .css file. Other skins
> > work as expected.
> >
> This skin is quite old now and I apologize for still not having enough
> time/taste/... to synch it to the latest PmWiki features.
> Thanks for the report, I'll take it in account when upgrading skin.

The problem appears to be in the recurve.php file, where it says

    if($action == $match[1])
      if($match[4])
        $text = "<a href='$PageUrl?action=$match[4]' title='$match[5]' class='alt'>$match[2]</a>";
      else $text = "<p>$match[2]</p>";
    else
      $text = "<a href='$PageUrl?action=$match[1]'>$match[2]</a>";

Each of the $PageUrl's needs to be escaped with a backslash, otherwise
they get replaced by an empty string.  For sites with $EnablePathInfo set
things still appear to work, but for other sites it always ends up
at the wiki home page because the ?n=Group.PageName is lost.  

Then $text needs to be passed through FmtPageName so the substitutions 
can take place.

Attached is a corrected version of recurve.php -- just drop it into
the pub/skins/recurve folder until Dominique (or someone else) updates
the zip file.

Pm
-------------- next part --------------
<?php /*>*/ if (!defined('PmWiki')) exit();
#
# recurve/recurve.php v0.3
#
# PmWiki Recurve skin code
# Copyright 2004 Dominique Faure (dominique.faure at laposte.net)
# Based on several PmWiki skins, noticeally Marathon from Steffen Bauch and
# Bronwyn from ...
# This file is part of the PmWiki Recurve skin; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# 2005-10-24  $PageUrl substitution bug fixed by pmichaud at pobox.com.


# Get current query string to construct *real* internal link.
# aka.: <a href='$PageUrl$PageQueryString#TopOfPage'>...</a>
global $PageQueryString;
$PageQueryString = $_SERVER["QUERY_STRING"] ? '?' . $_SERVER["QUERY_STRING"] : '';

# Action-specific behaviors
global $action;
if ($action != 'browse')
	SetTmplDisplay('PagePrintFmt', 0);

if ($action == 'print') {
	# Skin-specific print action.
	# Enabled from config.php with: $ActionSkin['print'] = <skin_name>;
	global $LinkPageExistsFmt, $UrlLinkTextFmt, 
		$GroupPrintHeaderFmt, $GroupPrintFooterFmt,
		$GroupHeaderFmt, $GroupFooterFmt;

	$LinkPageExistsFmt = "<a class='wikilink' href='\$PageUrl?action=print\$Fragment'>\$LinkText</a>";
	$UrlLinkTextFmt = "<cite class='urllink'>\$LinkText</cite> [<a class='urllink' href='\$Url'>\$Url</a>]";
	SDV($GroupPrintHeaderFmt,'(:include $Group.GroupPrintHeader:)(:nl:)');
	SDV($GroupPrintFooterFmt,'(:nl:)(:include $Group.GroupPrintFooter:)');
	$GroupHeaderFmt = $GroupPrintHeaderFmt;
	$GroupFooterFmt = $GroupPrintFooterFmt;

	LoadPageTemplate($pagename,"$SkinDir/print.tmpl");
	return;
}

# Markup extension
# (:noleft:), (:nosidebar:) => remove sidebar
# (:notabs:) => remove tabs above page content
# (:notrailer:) => remove last modification information below page content
#
Markup('noleft', 'directives', '/\\(:noleft:\\)/ei', "NoLeftBar()");
Markup('nosidebar', 'directives', '/\\(:nosidebar:\\)/ei', "NoLeftBar()");
Markup('notabs', 'directives', '/\\(:notabs:\\)/ei', "NoTabs()");
Markup('notrailer', 'directives', '/\\(:notrailer:\\)/ei',
	"SetTmplDisplay('PageTabsTrailerFmt', 0)");

global $NoLeftBarStartComment, $NoLeftBarEndComment, $NoTabsStartComment, $NoTabsEndComment;
$NoLeftBarStartComment = $NoTabsStartComment = '/*';
$NoLeftBarEndComment = $NoTabsEndComment = '*/';

function NoLeftBar() {
	global $NoLeftBarStartComment, $NoLeftBarEndComment;
	$NoLeftBarStartComment = $NoLeftBarEndComment = '';
	SetTmplDisplay('PageLeftFmt', 0);
}

function NoTabs() {
	global $NoTabsStartComment, $NoTabsEndComment;
	$NoTabsStartComment = $NoTabsEndComment = '';
	SetTmplDisplay('PageTabsHeaderFmt', 0);
}

# Contextual Tabs content
function TabsActions($pagename, $params) {
	global $action;
	preg_match('/^(\S+)\s*([^\|]+)(\|(\S+)\s*(.*))?$/s', $params, $match);
	if($action == $match[1])
		if($match[4])
			$text = "<a href='\$PageUrl?action=$match[4]' title='$match[5]' class='alt'>$match[2]</a>";
#			$text = "<a href='\$PageUrl?action=$match[4]' class='alt'>$match[5]</a>";
		else
			$text = "<p>$match[2]</p>";
	else
		$text = "<a href='\$PageUrl?action=$match[1]'>$match[2]</a>";
	print	FmtPageName($text, $pagename);
}

?>


More information about the pmwiki-users mailing list