robbiblubber.org |
/********************************************************************************
WeakWiki (WeakWiki history viewer include file: history.include.php)
Copyright (C) 2011 Alexander Lang
Project Home: http://weakwiki.robnet.wmweb.at/
Contact: robbiblubber@robnet.wmweb.at
********************************************************************************/
require_once(Lang::load('history'));
// GET variables
$title = (isset($_GET['title']) ? $_GET['title'] : '');
$action = (isset($_GET['action']) ? $_GET['action'] : '');
$d = new Document($title);
if($action == "history")
{
$pm = new PageMenu();
$pm->add(WIKI_PATH . $title, LANG_HI_0000 . "");
$pm->add(WIKI_PATH . $title . "&action=source", LANG_HI_0001);
if($d->request(OP_WRITE))
{
$pm->add(WIKI_PATH . $title . "&action=edit", LANG_HI_0002);
$pm->add(WIKI_PATH . $title . "&action=delete", LANG_HI_0003);
}
$pm->add(WIKI_PATH . $title . "&action=history", LANG_HI_0004);
$pm->write();
if($d->request(OP_HISTORY))
{
echo(Parser::current()->parse(History::current()->getHistory($title)));
}
else
{
$m = new MessageBox(LANG_HI_0020, LANG_HI_0021, MSG_ERROR);
$m->write();
}
}
else if($action == "showhistory")
{
$fileid = (isset($_GET['fileid']) ? $_GET['fileid'] : '0');
$pm = new PageMenu();
$pm->add(WIKI_PATH . $title . "&fileid=" . $fileid . "&action=showhistory&mode=wiki", LANG_HI_0010);
$pm->add(WIKI_PATH . $title . "&fileid=" . $fileid . "&action=showhistory&mode=source", LANG_HI_0011);
$pm->add(WIKI_PATH . $title . "&fileid=" . $fileid . "&action=showhistory&mode=diffcurr", LANG_HI_0012);
$pm->add(WIKI_PATH . $title . "&fileid=" . $fileid . "&action=showhistory&mode=diffprev", LANG_HI_0013);
$pm->add(WIKI_PATH . $title, LANG_HI_0000);
$pm->add(WIKI_PATH . $title . "&action=history", LANG_HI_0004);
$pm->write();
$mode = (isset($_GET['mode']) ? $_GET['mode'] : '');
switch($mode)
{
case "source":
echo(" \n"); echo(Engine::current()->formatSource(History::current()->getText($title, $fileid))); echo("\n \n"); break; case "diffcurr": require_once('./lib/Diff.class.php'); $diff = new Diff(); echo("\n"); echo($diff->getText(History::current()->getText($title, $fileid), Engine::current()->getText($title))); break; case "diffprev": require_once('./lib/Diff.class.php'); $diff = new Diff(); echo(" \n"); echo($diff->getText(History::current()->getPrevious($title, $fileid), History::current()->getText($title, $fileid))); break; default: echo(Parser::current()->parse(History::current()->getText($title, $fileid))); break; } } ?> |