function action_history() { global $pagestore, $page, $full, $HistMax; $history = $pagestore->history($page); gen_headers($history[0][0]); $text = ''; $latest_auth = ''; $previous_ver = 0; $is_latest = 1; for ($i = 0; $i < count($history); $i++) { if ($latest_auth == '') { $latest_auth = $history[$i][3] == '' ? $history[$i][1] : $history[$i][3]; $latest_ver = $history[$i][2]; } if ($previous_ver == 0 && $latest_auth != ($history[$i][3] == '' ? $history[$i][1] : $history[$i][3])) { $previous_ver = $history[$i][2]; } if ($i < $HistMax || $full) { $text = $text . html_history_entry($page, $history[$i][2], $history[$i][0], $history[$i][1], $history[$i][3], $previous_ver == $history[$i][2] || !$full && $i == count($history) - 1, $is_latest, $history[$i][4]); } $is_latest = 0; } if ($i >= $HistMax && !$full) { $text = $text . html_fullhistory($page, count($history)); } $p1 = $pagestore->page($page); $p1->version = $previous_ver; $p2 = $pagestore->page($page); $p2->version = $latest_ver; $diff = diff_compute($p1->read(), $p2->read()); template_history(array('page' => $p2->as_array(), 'history' => $text, 'diff' => diff_parse($diff))); }
function action_history() { global $diff_mode, $full, $HistMax, $page, $pagestore, $UserName, $ver1; global $ver2; $history = $pagestore->history($page); gen_headers($history[0][0]); $versions = diff_get_history_versions($history, $ver1, $ver2); $latest_ver = $versions['latest_ver']; $previous_ver = $versions['previous_ver']; $text = ''; for ($i = 0; $i < count($history); $i++) { if ($i < $HistMax || $full) { $text = $text . html_history_entry($page, $history[$i][2], $history[$i][0], $history[$i][1], $history[$i][3], $previous_ver == $history[$i][2], $latest_ver == $history[$i][2], $history[$i][4]); } } if ($i >= $HistMax && !$full) { $text = $text . html_fullhistory($page, count($history)); } $p1 = $pagestore->page($page); $p1->version = $previous_ver; $p2 = $pagestore->page($page); $p2->version = $latest_ver; $diff = do_diff($p1->read(), $p2->read()); template_history(array('page' => $page, 'history' => $text, 'diff' => $diff, 'editver' => $UserName && $p2->mutable ? 0 : -1, 'timestamp' => $p2->time, 'edituser' => $p2->username, 'diff_mode' => $diff_mode)); }
function action_view() { global $page, $pagestore, $ParseEngine, $version, $UserName; global $document, $redirect_from, $view_source; $pg = $pagestore->page($page); if (file_exists("modules/" . $page . ".php")) { require_once "modules/" . $page . ".php"; if (function_exists($page . "_content")) { eval("\$pg->text=" . $page . "_content();"); } $pg->mutable = 0; } else { if ($version != '') { $pg->version = $version; } $pg->read(); } $document = $pg->text; gen_headers($pg->time); if ($view_source) { $html = wordwrap($pg->text, 80, "\n", true); $html = '<pre>' . htmlspecialchars($html) . '</pre>'; } else { $html = parseText($pg->text, $ParseEngine, $page); } template_view(array('page' => $page, 'page_length' => strlen($pg->text), 'html' => $html, 'view_source' => $view_source, 'editable' => $UserName && $pg->mutable, 'timestamp' => $pg->time, 'archive' => $version != '', 'version' => $pg->version, 'edituser' => $pg->username, 'redirect_from' => $redirect_from, 'editver' => $UserName && $pg->mutable ? $version == '' ? 0 : $version : -1)); }
function action_children() { global $page, $pagestore, $UserName; $pg = $pagestore->page($page); $pg->read(); gen_headers($pg->time); template_children(array('page' => $page, 'children' => $pagestore->getChildren($page), 'timestamp' => $pg->time, 'edituser' => $pg->username, 'editver' => $UserName && $pg->mutable ? 0 : -1)); }
function action_backlinks() { global $page, $pagestore, $UserName; $pg = $pagestore->page($page); $pg->read(); gen_headers($pg->time); template_backlinks(array('page' => $page, 'backlinks' => $pagestore->getBacklinks($page), 'haschildren' => $pagestore->getChildren($page) ? 1 : 0, 'parents' => $pagestore->getParents($page), 'timestamp' => $pg->time, 'edituser' => $pg->username, 'editver' => $UserName && $pg->mutable ? 0 : -1)); }
function action_view() { global $page, $pagestore, $ParseEngine, $version; $pg = $pagestore->page($page); if ($version != '') { $pg->version = $version; } $pg->read(); gen_headers($pg->time); template_view(array('page' => $pg->as_array(), 'title' => $pg->title, 'html' => parseText($pg->text, $ParseEngine, $page), 'editable' => $pg->acl_check(), 'timestamp' => $pg->time, 'archive' => $version != '', 'version' => $pg->version)); }