Пример #1
0
function displayWikiPage($pid)
{
    echo '<div>';
    $page = getWikiPage($pid);
    if ($page == NULL) {
        echo "<span class='testempty'>No Testsolve Wiki Page</span>";
    } else {
        echo "<span class='testdesc'>Testsolve wiki page: <a href='{$page}'>{$page}</a></span>";
    }
    echo '</div>';
}
Пример #2
0
 if ($view == "search") {
     searchWiki(Request::get('searchfor'), Request::get('searchcurrentversions'), Request::get('keyword'), Request::get('localsearch'));
 } else {
     if ($view == "edit") {
         //
         // show page for editing
         //
         if (!$perm->have_studip_perm("autor", $SessSemName[1])) {
             throw new AccessDeniedException(_('Sie haben keine Berechtigung, Seiten zu editieren!'));
         }
         // prevent malformed urls: keword must be set
         if (!$keyword) {
             throw new InvalidArgumentException(_('Es wurde keine zu editierende Seite übergeben!'));
         }
         SkipLinks::addIndex(_("Seite bearbeiten"), 'main_content', 100);
         $wikiData = getWikiPage($keyword, 0);
         // always get newest page
         // set lock
         setWikiLock(null, $user->id, $SessSemName[1], $keyword);
         //show form
         wikiEdit($keyword, $wikiData, $user->id);
     } else {
         if ($view == 'editnew') {
             // edit a new page
             if (!$perm->have_studip_perm("autor", $SessSemName[1])) {
                 throw new AccessDeniedException(_('Sie haben keine Berechtigung, Seiten zu editieren!'));
             }
             // set lock
             setWikiLock(null, $user->id, $SessSemName[1], $keyword);
             wikiEdit($keyword, NULL, $user->id, Request::quoted('lastpage'));
         } else {
Пример #3
0
function changeWikiPage($uid, $pid, $wikiPage)
{
    if (!canViewPuzzle($uid, $pid)) {
        utilsError("You do not have permission to modify this puzzle.");
    }
    $purifier = new HTMLPurifier();
    mysql_query('START TRANSACTION');
    $oldWikiPage = getWikiPage($pid);
    $cleanWikiPage = $purifier->purify($wikiPage);
    $cleanWikiPage = htmlspecialchars($cleanWikiPage);
    updateWikiPage($uid, $pid, $oldWikiPage, $cleanWikiPage);
    mysql_query('COMMIT');
}
Пример #4
0
<?php

require 'wikilib.php';
require 'Diff.php';
require 'Diff/Renderer/inline.php';
?>
<style type="text/css">
#wikidiff ins, #wikidiff del { text-decoration: none; }
#wikidiff ins { background: #060; color: #cfc; }
#wikidiff del { background: #600; color: #fcc; }
</style>
<?php 
$rev = (int) $_GET['rev'];
$page = getWikiPage($_GET['id'], $rev);
$rev = min($page['revision'], $rev);
$urltitle = $page['id'];
//urlencode($page['id']);
$nicetitle = htmlspecialchars(url2title($page['id']));
$title = 'Wiki &raquo; Diff: ' . $nicetitle;
$links = new PipeMenu();
//I think this is broken.
$links->add(new PipeMenuLinkEntry('Page', 'wiki', substr($urltitle, 5)));
$links->add(new PipeMenuLinkEntry('Discuss', 'wiki', 'Talk:' . $urltitle));
if ($page['canedit']) {
    $links->add(new PipeMenuLinkEntry('Edit', 'wikiedit', $urltitle));
}
makeLinks($links);
$crumbs = new PipeMenu();
$crumbs->add(new PipeMenuLinkEntry(__("Wiki"), "wiki"));
if ($page['ismain']) {
    $crumbs->add(new PipeMenuLinkEntry('Main page: Diff', 'wikidiff', $urltitle, 'rev=' . $rev));
Пример #5
0
<?php

require 'wikilib.php';
if (isset($_GET['createnew'])) {
    $ptitle = title2url($_POST['title']);
    $page = array('id' => $ptitle, 'revision' => 0, 'flags' => 0, 'text' => '', 'new' => 2, 'canedit' => $canedit);
} else {
    $page = getWikiPage($_GET['id']);
    $ptitle = $page['id'];
}
if (!preg_match('@[^_]@', $ptitle)) {
    Kill('You must enter a page title.');
}
if (!$page['canedit']) {
    Kill('You may not ' . ($page['new'] == 2 ? 'create pages.' : 'edit this page.'));
}
if ($page['flags'] & WIKI_PFLAG_DELETED && !$canmod) {
    Kill('This page has been deleted.');
}
$urltitle = $ptitle;
//urlencode($ptitle);
$nicetitle = htmlspecialchars(url2title($ptitle));
$title = 'Wiki &raquo; ' . ($page['new'] == 2 ? 'New page' : 'Editing: ' . $nicetitle);
$links = new PipeMenu();
if ($page['new'] != 2) {
    if ($page['istalk']) {
        $links->add(new PipeMenuLinkEntry('Page', 'wiki', substr($urltitle, 5)));
        $links->add(new PipeMenuTextEntry('Discuss'));
    } else {
        $links->add(new PipeMenuTextEntry('Page'));
        $links->add(new PipeMenuLinkEntry('Discuss', 'wiki', 'Talk:' . $urltitle));
Пример #6
0
        }
    }
    $q = "https://{$l}.wikipedia.org/w/api.php?action=query&prop=extracts&exchars={$chars}&titles={$pageLabel}&explaintext=true&format=json";
    $j = file_get_contents($q);
    $result = json_decode($j);
    if ($result !== NULL) {
        $pid = key($result->query->pages);
        $d = $result->query->pages->{"{$pid}"}->extract;
        $description = array('source' => "https://{$l}.wikipedia.org/wiki/{$pageLabel}", 'text' => $d);
        return $description;
    }
}
/*process*/
$wikidataId = getWikidataId($gnd);
$img = getWikidataImg($gnd, "100");
$wikiPageLabel = getWikiPage($wikidataId, $lang);
$wiki = getDescription($wikiPageLabel, $lang, 500);
$wikipage = $wiki["source"];
$description = $wiki["text"];
$r = array();
if (isset($img)) {
    $r['img'] = $img;
}
if (isset($wikidataId)) {
    $r['wikidataId'] = $wikidataId;
}
if (isset($wikipage)) {
    $r['wikipage'] = $wikipage;
}
if (isset($description)) {
    $r['description'] = $description;
Пример #7
0
function displayWikiPage($uid, $pid)
{
    $page = getWikiPage($pid);
    ?>
    <table class="wikiInfo">
        <tr>
            <td class='wikiInfo'>
                <strong>Testsolve Work Page: </strong> <a href="<?php 
    echo $page;
    ?>
"><?php 
    echo $page;
    ?>
</a>
            </td>
            <td class='wikiInfo'>
                <a href="#" class="changeLink">[Change]</a>
            </td>
        </tr>
        <tr>
            <td colspan='2'>
            <form method="post" action="form-submit.php">
                <input type="hidden" name="uid" value="<?php 
    echo $uid;
    ?>
" />
                <input type="hidden" name="pid" value="<?php 
    echo $pid;
    ?>
" />
                <input type="text" name="wikiPage" maxlength="255" class="longin" value="<?php 
    echo $page;
    ?>
"/>
                <input type="submit" name="changeWikiPage" value="Change" />
            </form>
            </td>
        </tr>
    </table>
<?php 
}
Пример #8
0
function showComboDiff($keyword, $db=NULL) {

    global $SessSemName;

    $version2=getLatestVersion($keyword, $SessSemName[1]);
    $version1=getFirstVersion($keyword, $SessSemName[1]);
    $version2=$version2["version"];
    $version1=$version1["version"];

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

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

    // create combodiff

    $wd1 = getWikiPage($keyword, $version1);
    $diffarray1 = toDiffLineArray($wd1['body'], $wd1['user_id']);
    $current_version = $version1 + 1;
    $differ = new line_diff();
    while ($current_version <= $version2) {
        $wd2 = getWikiPage($keyword, $current_version);
        if ($wd2) {
            $diffarray2 = toDiffLineArray($wd2['body'], $wd2['user_id']);
            $newarray = $differ->arr_compare("diff", $diffarray1, $diffarray2);
            $diffarray1=array();
            foreach ($newarray as $i) {
                if ($i->status["diff"] != "-") {
                    $diffarray1[]=$i;
                }
            }
        }
        $current_version++;
    }
    $content="<table>";
    $count=0;
    $authors=array();
    foreach ($diffarray1 as $i) {
        if ($i && !in_array($i->who, $authors)) {
            $authors[]=$i->who;
            if ($count % 4 == 0) {
                $content.= "<tr width=\"100%\">";
            }
            $content.= "<td bgcolor=".create_color($count)." width=14>&nbsp;</td><td><font size=-1>".get_fullname($i->who,'full',1)."</font></td><td>&nbsp;</td>";
            if ($count % 4 == 3) {
                $content .= "</tr>";
            }
            $count++;
        }
    }
    echo "<tr><td class=\"table_row_even\" colspan=2>";
    echo "<p><font size=-1>&nbsp;<br>";
    echo _("Legende der Autor/-innenfarben:");
    echo "<table cellpadding=6 cellspacing=6>$content</table>\n";
    echo "</p>";
    echo "<table cellpadding=0 cellspacing=0 width=\"100%\">";
    $last_author=None;
    $collect="";
    $diffarray1[]=NULL;
    foreach ($diffarray1 as $i) {
        if (!$i || $last_author != $i->who) {
            if (trim($collect)!="") {
                $idx=array_search($last_author, $authors);
                $col=create_color($idx);
                echo "<tr bgcolor=$col>";
                echo "<td width=30 align=center valign=top>";
                echo Icon::create('info-circle', 'inactive', ['title' => _("Änderung von").' ' . get_fullname($last_author)])->asImg();
                echo "</td>";
                echo "<td><font size=-1>";
                echo wikiReady($collect);
                echo "</font></td>";
                echo "</tr>";
            }
            $collect="";
        }
        if ($i) {
            $last_author = $i->who;
            $collect .= $i->text;
        }
    }
    echo "</table></td></tr>";
    echo "</table>     ";
    getDiffPageInfobox($keyword);
    showPageFrameEnd();
}