/** * 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(); } }
/** * Checks if the changes conflict to a version submited * while editing. * * @author Johannes Klose <*****@*****.**> * @return bool True if there is a conflict, false otherwise **/ function editConflicts($editText, $editUsername, $editSummary, $editStart) { $tpl =& singleton('template'); if ($this->page['page_version'] != $editStart) { $pageVersions = diff::getVersions(); $orig = $editStart; $final = $this->page['page_version']; $finalText = $this->page['page_text']; $origText = diff::createVersion($this->page['page_text'], $pageVersions, $orig); $diff = diff::makeDiff($origText, $finalText, $pageVersions); $tpl->assign('diffOrig', $diff['orig']); $tpl->assign('diffFinal', $diff['final']); $tpl->assign('isConflict', true); $tpl->assign('editStart', $this->time); $tpl->assign('editText', htmlentities($editText)); $tpl->assign('valAuthor', htmlentities($editUsername)); $tpl->assign('valSummary', htmlentities($editSummary)); $tpl->assign('isMessage', true); $tpl->assign('message', $this->lang['edit_conflicts']); $this->lang['history_original'] = sprintf($this->lang['history_original'], $orig, $final, $pageVersions[$final]['log_time']); $this->lang['history_final'] = sprintf($this->lang['history_final'], $orig, $final, $pageVersions[$final]['log_time']); return true; } else { return false; } }