/** * This function displays the difference between two page versions. * * @author Johannes Klose <*****@*****.**> * @return void **/ function opDiff() { $tpl =& singleton('template'); if (isset($this->get['orig'], $this->get['final'])) { $orig = $this->get['orig']; $final = $this->get['final']; if (!preg_match('/^\\d+\\.\\d+\\.\\d+$/', $orig) || !preg_match('/^\\d+\\.\\d+\\.\\d+$/', $final)) { if (preg_match('/^\\d+\\.\\d+\\.\\d+$/', $final)) { $orig = diff::findPrevVersion($final, $this->pageVersions); if ($orig === false) { $this->opList(); return; } } else { $this->opList(); return; } } if (!isset($this->pageVersions[$orig]) || !isset($this->pageVersions[$final])) { $this->opList(); return; } $origText = diff::createVersion($this->page['page_text'], $this->pageVersions, $orig); $finalText = diff::createVersion($this->page['page_text'], $this->pageVersions, $final); $diff = diff::makeDiff($origText, $finalText, $this->pageVersions); $tpl->assign('diff_orig', $diff['orig']); $tpl->assign('diff_final', $diff['final']); $this->historyTemplate = 'action_history_diff.tpl'; $this->lang['history_original'] = sprintf($this->lang['history_original'], $orig, $final, $this->pageVersions[$final]['log_time']); $this->lang['history_final'] = sprintf($this->lang['history_final'], $orig, $final, $this->pageVersions[$final]['log_time']); return; } else { $this->opList(); } }