e = get_extension((int)safe_get("id")); if ($this->e == null) { header("Location: index.html"); break; } $this->page = safe_get("page"); $this->rev = safe_get("rev"); $this->diff = safe_get("diff"); $this->undo_rev = safe_get("undo"); } public function is_submitted() { return false;//($this->undo_rev != ""); } public function output() { if ($this->rev != "") $this->output_rev(); else if ($this->diff != "") $this->output_diff(); else if ($this->undo_rev != "") $this->output_undo(); else $this->output_history(); } public function go() { if ($this->undo_rev != "") return $this->undo(); return true; } private function output_rev() { $a = html::a( make_ext_link($this->e->id(), $this->page), $this->page); echo html::wrap_div("bt_ext_old_rev", sprintf(loc("ext_old_rev"), $a)); echo wiki::page($this->page, $this->rev); } private function output_diff() { echo wiki::diff($this->page, $this->diff); } private function output_undo() { echo wiki::diff($this->page, $this->undo_rev, "cur"); } private function output_history() { $title = sprintf( loc("ext_history"), html::a("ext.html?id=" . $this->e->id(), $this->page)); echo " " . html::wrap_div("ext_history_title", $title) . " "; $entries = wiki::history($this->page); $i = 0; foreach ($entries as $e) { $tr_class = ""; if (count($entries) > 2) $tr_class = odd_even_class($i); $url = make_history_link( $this->e->id(), $this->page, $e["revid"]); $diff = ""; if ($i < (count($entries) - 1)) { $diff = html::a( make_diff_link( $this->e->id(), $this->page, $e["revid"]), loc("ext_history_diff")); } $undo = html::a( make_undo_link( $this->e->id(), $this->page, $e["revid"]), loc("ext_history_undo")); $c = $e["comment"] . " ($undo)"; echo " "; ++$i; } echo"
" . loc("ext_history_time") . " " . loc("ext_history_user") . " " . loc("ext_history_comment") . "
" . $diff . " " . html::a($url, make_simple_date($e["time"])) . " " . $e["user"] . " " . $c . "
"; } private function undo() { wiki::undo($this->page, $this->undo_rev); return true; } } $h = new history; if ($h->is_submitted()) { if ($h->go()) { //header("Location: index.html"); exit; } } output_head("extensions", "baretorrent - extensions"); ?>
output(); ?>