From 45a9933524f9a31e0a104cccfd082217501017ba Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Tue, 9 Mar 2010 11:42:34 +0100 Subject: Move data preprocessing out of html_edit --- inc/actions.php | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'inc/actions.php') diff --git a/inc/actions.php b/inc/actions.php index b7567bc20..5802bd6f5 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -111,7 +111,7 @@ function act_dispatch(){ $ACT = act_draftsave($ACT); //edit - if(($ACT == 'edit' || $ACT == 'preview') && $INFO['editable']){ + if(($ACT == 'edit' || $ACT == 'preview' || $ACT == 'recover') && $INFO['editable']){ $ACT = act_edit($ACT); }else{ unlock($ID); //try to unlock @@ -442,7 +442,7 @@ function act_auth($act){ } /** - * Handle 'edit', 'preview' + * Handle 'edit', 'preview', 'recover' * * @author Andreas Gohr */ @@ -450,6 +450,39 @@ function act_edit($act){ global $ID; global $INFO; + global $TEXT; + global $RANGE; + global $PRE; + global $SUF; + global $REV; + global $SUM; + global $lang; + global $DATE; + + if (!isset($TEXT)) { + if ($INFO['exists']) { + if ($RANGE) { + list($PRE,$TEXT,$SUF) = rawWikiSlices($RANGE,$ID,$REV); + } else { + $TEXT = rawWiki($ID,$REV); + } + } else { + $data = array($ID); + $TEXT = trigger_event('HTML_PAGE_FROMTEMPLATE',$data,'pageTemplate',true); + } + } + + //set summary default + if(!$SUM){ + if($REV){ + $SUM = $lang['restored']; + }elseif(!$INFO['exists']){ + $SUM = $lang['created']; + } + } + + if(!$DATE) $DATE = $INFO['lastmod']; + //check if locked by anyone - if not lock for my self $lockedby = checklock($ID); if($lockedby) return 'locked'; -- cgit v1.2.3