예제 #1
0
파일: wiki.php 프로젝트: ratbird/hope
 public function store_action($version)
 {
     $body = Request::get('body');
     if (Request::isXhr()) {
         $body = studip_utf8decode($body);
     }
     submitWikiPage($this->keyword, $version, $body, $GLOBALS['user']->id, $this->range_id);
     $latest_version = getLatestVersion($this->keyword, $this->range_id);
     if (Request::isXhr()) {
         $this->render_json(array('version' => $latest_version['version'], 'body' => $latest_version['body'], 'messages' => implode(PageLayout::getMessages()) ?: false, 'zusatz' => getZusatz($latest_version)));
     } else {
         // Yeah, wait for the whole trailification of the wiki...
     }
 }
예제 #2
0
파일: wiki.inc.php 프로젝트: ratbird/hope
/**
* Display Page diffs, restrictable to recent versions
*
* @param    string  WikiPage name
* @param    string  Only show versions newer than this timestamp
*
**/
function showDiffs($keyword, $versions_since) {
    global $SessSemName;

    $query = "SELECT *
              FROM wiki
              WHERE keyword = ? AND range_id = ?
              ORDER BY version DESC";
    $statement = DBManager::get()->prepare($query);
    $statement->execute(array($keyword, $SessSemName[1]));
    $versions = $statement->fetchAll(PDO::FETCH_ASSOC);

    if (count($versions) === 0) {
        throw new InvalidArgumentException(_('Es gibt keine zu vergleichenden Versionen.'));
    }

    showPageFrameStart();
    wikiSinglePageHeader($wikiData, $keyword);

    echo "\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";

    $version     = array_shift($versions);
    $last        = $version['body'];
    $lastversion = $version['version'];
    $zusatz      = getZusatz($version);

    foreach ($versions as $version) {
        echo '<tr>';
        $current        = $version['body'];
        $currentversion = $version['version'];

        $diffarray = '<b><font size=-1>'. _("Änderungen zu") . " </font> $zusatz</b><p>";
        $diffarray .= "<table cellpadding=0 cellspacing=0 border=0 width=\"100%\">\n";
        $diffarray .= do_diff($current, $last);
        $diffarray .= "</table>\n";
        printcontent(0, 0, $diffarray, '');
        echo '</tr>';

        $last        = $current;
        $lastversion = $currentversion;
        $zusatz      = getZusatz($version);
        if ($versions_since && $version['chdate'] < $versions_since) {
            break;
        }
    }
    echo '</table>';

    getDiffPageInfobox($keyword);
    showPageFrameEnd();
}