summaryrefslogtreecommitdiff
path: root/page_history.php
diff options
context:
space:
mode:
authorChristian Fowler <spider@viovio.com>2005-06-28 07:46:29 +0000
committerChristian Fowler <spider@viovio.com>2005-06-28 07:46:29 +0000
commit1ac5efd4760ea31cef14335c3ccb64ca256e75b5 (patch)
treec24ae459842c48b00389a0e23057ddace5837faf /page_history.php
parent96a6e127788097951511b99264aa153b19b12f76 (diff)
downloadwiki-1ac5efd4760ea31cef14335c3ccb64ca256e75b5.tar.gz
wiki-1ac5efd4760ea31cef14335c3ccb64ca256e75b5.tar.bz2
wiki-1ac5efd4760ea31cef14335c3ccb64ca256e75b5.zip
Merge recent changes from R1 into HEAD
Diffstat (limited to 'page_history.php')
-rw-r--r--page_history.php54
1 files changed, 38 insertions, 16 deletions
diff --git a/page_history.php b/page_history.php
index 385cc1a..3db5ac8 100644
--- a/page_history.php
+++ b/page_history.php
@@ -1,9 +1,21 @@
<?php
-// $Header: /cvsroot/bitweaver/_bit_wiki/page_history.php,v 1.2 2005/06/19 09:35:44 jht001 Exp $
-// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
-// All Rights Reserved. See copyright.txt for details and a complete list of authors.
-// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
-// Initialization
+/**
+ * $Header: /cvsroot/bitweaver/_bit_wiki/page_history.php,v 1.3 2005/06/28 07:46:27 spiderr Exp $
+ *
+ * Copyright (c) 2004 bitweaver.org
+ * Copyright (c) 2003 tikwiki.org
+ * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+ * All Rights Reserved. See copyright.txt for details and a complete list of authors.
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
+ *
+ * $Id: page_history.php,v 1.3 2005/06/28 07:46:27 spiderr Exp $
+ * @package wiki
+ * @subpackage functions
+ */
+
+/**
+ * required setup
+ */
require_once( '../bit_setup_inc.php' );
include_once( WIKI_PKG_PATH.'BitPage.php');
@@ -32,7 +44,7 @@ if (!$gBitUser->hasPermission( 'bit_p_view' )) {
$smarty->assign('source', 0);
// If we have to include a preview please show it
$smarty->assign('preview', false);
-$smarty->assign('diff', false);
+$smarty->assign('compare', 'n');
$smarty->assign('diff2', 'n');
if (isset($_REQUEST["delete"]) && isset($_REQUEST["hist"])) {
foreach (array_keys($_REQUEST["hist"])as $version) {
@@ -52,18 +64,28 @@ if (isset($_REQUEST["delete"]) && isset($_REQUEST["hist"])) {
$smarty->assign_by_ref('version', $_REQUEST["preview"]);
}
} elseif( isset( $_REQUEST["diff2"] ) ) {
- $diff = $gContent->getHistory( $_REQUEST["diff2"] );
- $html = $gBitSystem->diff2($diff[0]["data"], $gContent->mInfo["data"]);
+ $from_version = $_REQUEST["diff2"];
+ $from_page = $gContent->getHistory( $from_version );
+ $from_lines = explode("\n",$from_page[0]["data"]);
+ $to_version = $gContent->mInfo["version"];
+ $to_lines = explode("\n",$gContent->mInfo["data"]);
+
+ include_once( WIKI_PKG_PATH.'diff.php');
+ $diffx = new WikiDiff($from_lines,$to_lines);
+ $fmt = new WikiUnifiedDiffFormatter;
+ $html = $fmt->format($diffx, $from_lines);
$smarty->assign('diffdata', $html);
$smarty->assign('diff2', 'y');
- $smarty->assign_by_ref('version', $_REQUEST["diff2"]);
- $smarty->assign_by_ref('parsed', $gContent->parseData( $diff[0]["data"], $diff[0]["format_guid"] ) );
-} elseif( isset( $_REQUEST["diff"] ) ) {
- // We are going to change this to "compare" instead of diff
- $diff = $gContent->getHistory( $_REQUEST["diff"]);
- $smarty->assign_by_ref('diff', $gContent->parseData( $diff[0]["data"], $diff[0]["format_guid"] ) );
- $smarty->assign_by_ref('parsed', $gContent->parseData() );
- $smarty->assign_by_ref('version', $_REQUEST["diff"]);
+ $smarty->assign('version_from', $from_version);
+ $smarty->assign('version_to', $to_version);
+
+} elseif( isset( $_REQUEST["compare"] ) ) {
+ $from_version = $_REQUEST["compare"];
+ $from_page = $gContent->getHistory($from_version);
+ $smarty->assign('compare', 'y');
+ $smarty->assign_by_ref('diff_from', $gContent->parseData( $from_page[0]["data"], $from_page[0]["format_guid"] ) );
+ $smarty->assign_by_ref('diff_to', $gContent->parseData() );
+ $smarty->assign_by_ref('version_from', $from_version);
} elseif (isset($_REQUEST["rollback"])) {
if( $version = $gContent->getHistory( $_REQUEST["preview"] ) ) {
$smarty->assign_by_ref('parsed', $gContent->parseData( $version[0]["data"], $version[0]["format_guid"] ) );