Skip to content
Snippets Groups Projects
Select Git revision
  • cff48047b00b890600356fad29064b6a28532c2b
  • main default protected
  • pdf-annotieren
  • pdf-annotieren-2.0
  • issue-4244
  • issues-4244-b
  • pdf-annotieren-old
  • biest-4274
  • issue-2982
  • issue-660
  • issue-3326
  • issue-3270
  • issue-3616
  • 5.1
  • 5.2
  • 5.3
  • 5.4
  • 5.5
  • issue-4255
  • issue-4261
  • issue-4262
  • v5.4.2
  • v5.3.5
  • v5.2.7
  • v5.1.8
  • v5.4.1
  • v5.3.4
  • v5.2.6
  • v5.1.7
  • v5.0.9
  • v5.4
  • v5.3.3
  • v5.2.5
  • v5.1.6
  • v5.0.8
  • v5.3.2
  • v5.2.4
  • v5.1.5
  • v5.0.7
  • v5.3.1
  • v5.2.3
41 results

wiki.inc.php

Blame
  • Forked from Stud.IP / Stud.IP
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    wiki.inc.php 69.61 KiB
    <?php
    # Lifter002: TODO
    # Lifter007: TODO
    use Studip\Button, Studip\LinkButton;
    
    /**
    * Retrieve a WikiPage version from current seminar's WikiWikiWeb.
    *
    * Returns raw text data from database if requested version is
    * available. If not, an
    *
    * @param string WikiWiki keyword to be retrieved
    * @param int    Version number. If empty, latest version is returned.
    *
    **/
    function getWikiPage($keyword, $version = null)
    {
        $page = null;
        if ($version) {
            $page = WikiPage::find([Context::getId(), $keyword, $version]);
        }
        if ($page === null) {
            $page = WikiPage::findLatestPage(Context::getId(), $keyword);
        }
    
        if ($page) {
            return $page;
        }
    
        if ($keyword === 'WikiWikiWeb') {
            return WikiPage::getStartPage(Context::getId());
        }
    
        $page = new WikiPage();
        $page->range_id = Context::getId();
        $page->keyword  = $keyword;
        return $page;
    }
    
    /**
    * Write a new/edited wiki page to database
    *
    * @param    string  keyword WikiPage name
    * @param    string  version WikiPage version
    * @param    string  body    WikiPage text
    * @param    string  user_id Internal user id of editor
    * @param    string  range_id    Internal id of seminar/einrichtung
    *
    **/
    function submitWikiPage($keyword, $version, $body, $user_id, $range_id, $ancestor) {
    
        global $perm;
        releasePageLocks($keyword, $user_id); // kill lock that was set when starting to edit
        // write changes to db, show new page
        $latestVersion = getWikiPage($keyword, false);
        if ($latestVersion) {
            $date = time();
            $lastchange = $date - $latestVersion['chdate'];
        }
    
        StudipTransformFormat::addStudipMarkup('wiki-comments', '(\[comment\])', null, function(){return sprintf('[comment=%s]', get_fullname());});
    
        //TODO: Die $message Texte klingen fürchterlich. Halbsätze, Denglisch usw...
        if ($latestVersion && ($latestVersion['body'] == $body)) {
            $message = MessageBox::info(_('Keine Änderung vorgenommen.'));
            PageLayout::postMessage($message);
        } else if ($latestVersion && ($version !== null) && ($lastchange < 30*60) && ($user_id == $latestVersion['user_id'])) {
            // if same author changes again within 30 minutes, no new verison is created
            $wp = WikiPage::find([$range_id, $keyword, $version]);
            if ($wp) {