<?php if (!defined('PmWiki')) exit();
/*
	LastChangeSummary 0.1b
	adds the $LastChangeSummary page variable for PmWiki
	copyright (c) 2006 Yuri Giuntoli (www.giuntoli.com)

	This PHP script is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation.

	This PHP script is not part of the standard PmWiki distribution.

	0.1 - 02.02.2006
		First implementation.
	0.1b - 03.02.2006
		Changed page attribute from 'lastcsum' to 'csum'.
*/

	define(LASTCHANGESUMMARY, '0.1b');

	array_unshift($EditFunctions,'SaveLastChangeSummary');

	$ChangeSummary = substr(stripmagic(@$_REQUEST['csum']), 0, 100);

	if (!isset($PCache[$pagename])) {
		PCache($pagename, ReadPage($pagename, READPAGE_CURRENT));
	}

	$LastChangeSummary = $PCache[$pagename]['csum'];
	$FmtPV['$LastChangeSummary'] = '@$page["csum"]';

	//------------------------------------------------------------------------------------

	function SaveLastChangeSummary($pagename, &$page, &$new) {
		global $ChangeSummary;
		if ($ChangeSummary) {
			$new['csum'] = $ChangeSummary;
		} else {
			unset($new['csum']);
		}
	}


?>