示例#1
0
 /**
  * Create output
  */
 function render($format, Doku_Renderer $R, $data)
 {
     if ($format != 'xhtml') {
         return false;
     }
     $user = strip_tags(editorinfo($data['user']));
     if ($data['valid']) {
         $msg = sprintf($this->getLang('valid'), $user);
         $R->doc .= '<span class="sig_valid" title="' . $msg . '">';
     } else {
         $msg = sprintf($this->getLang('invalid'), $user);
         $R->doc .= '<span class="sig_invalid" title="' . $msg . '">';
     }
     $R->cdata($data['text']);
     $R->doc .= '</span>';
     return true;
 }
示例#2
0
function html_diff_head($l_rev, $r_rev, $id = null, $media = false)
{
    global $lang;
    if ($id === null) {
        global $ID;
        $id = $ID;
    }
    $media_or_wikiFN = $media ? 'mediaFN' : 'wikiFN';
    $ml_or_wl = $media ? 'ml' : 'wl';
    $l_minor = $r_minor = '';
    if (!$l_rev) {
        $l_head = '&mdash;';
    } else {
        $l_info = getRevisionInfo($id, $l_rev, true, $media);
        if ($l_info['user']) {
            $l_user = editorinfo($l_info['user']);
            if (auth_ismanager()) {
                $l_user .= ' (' . $l_info['ip'] . ')';
            }
        } else {
            $l_user = $l_info['ip'];
        }
        $l_user = '******' . $l_user . '</span>';
        $l_sum = $l_info['sum'] ? '<span class="sum">' . hsc($l_info['sum']) . '</span>' : '';
        if ($l_info['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) {
            $l_minor = 'class="minor"';
        }
        $l_head_title = $media ? dformat($l_rev) : $id . ' [' . dformat($l_rev) . ']';
        $l_head = '<a class="wikilink1" href="' . $ml_or_wl($id, "rev={$l_rev}") . '">' . $l_head_title . '</a>' . '<br />' . $l_user . ' ' . $l_sum;
    }
    if ($r_rev) {
        $r_info = getRevisionInfo($id, $r_rev, true, $media);
        if ($r_info['user']) {
            $r_user = editorinfo($r_info['user']);
            if (auth_ismanager()) {
                $r_user .= ' (' . $r_info['ip'] . ')';
            }
        } else {
            $r_user = $r_info['ip'];
        }
        $r_user = '******' . $r_user . '</span>';
        $r_sum = $r_info['sum'] ? '<span class="sum">' . hsc($r_info['sum']) . '</span>' : '';
        if ($r_info['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) {
            $r_minor = 'class="minor"';
        }
        $r_head_title = $media ? dformat($r_rev) : $id . ' [' . dformat($r_rev) . ']';
        $r_head = '<a class="wikilink1" href="' . $ml_or_wl($id, "rev={$r_rev}") . '">' . $r_head_title . '</a>' . '<br />' . $r_user . ' ' . $r_sum;
    } elseif ($_rev = @filemtime($media_or_wikiFN($id))) {
        $_info = getRevisionInfo($id, $_rev, true, $media);
        if ($_info['user']) {
            $_user = editorinfo($_info['user']);
            if (auth_ismanager()) {
                $_user .= ' (' . $_info['ip'] . ')';
            }
        } else {
            $_user = $_info['ip'];
        }
        $_user = '******' . $_user . '</span>';
        $_sum = $_info['sum'] ? '<span class="sum">' . hsc($_info['sum']) . '</span>' : '';
        if ($_info['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) {
            $r_minor = 'class="minor"';
        }
        $r_head_title = $media ? dformat($_rev) : $id . ' [' . dformat($_rev) . ']';
        $r_head = '<a class="wikilink1" href="' . $ml_or_wl($id) . '">' . $r_head_title . '</a> ' . '(' . $lang['current'] . ')' . '<br />' . $_user . ' ' . $_sum;
    } else {
        $r_head = '&mdash; (' . $lang['current'] . ')';
    }
    return array($l_head, $r_head, $l_minor, $r_minor);
}
示例#3
0
/**
 * Print some info about the current page
 *
 * @author Andreas Gohr <*****@*****.**>
 * @param bool $ret return content instead of printing it
 * @return bool|string
 */
function tpl_pageinfo($ret = false)
{
    global $conf;
    global $lang;
    global $INFO;
    global $ID;
    // return if we are not allowed to view the page
    if (!auth_quickaclcheck($ID)) {
        return false;
    }
    // prepare date and path
    $fn = $INFO['filepath'];
    if (!$conf['fullpath']) {
        if ($INFO['rev']) {
            $fn = str_replace(fullpath($conf['olddir']) . '/', '', $fn);
        } else {
            $fn = str_replace(fullpath($conf['datadir']) . '/', '', $fn);
        }
    }
    $fn = utf8_decodeFN($fn);
    $date = dformat($INFO['lastmod']);
    // print it
    if ($INFO['exists']) {
        $out = '';
        $out .= $fn;
        $out .= ' · ';
        $out .= $lang['lastmod'];
        $out .= ': ';
        $out .= $date;
        if ($INFO['editor']) {
            $out .= ' ' . $lang['by'] . ' ';
            $out .= editorinfo($INFO['editor']);
        } else {
            $out .= ' (' . $lang['external_edit'] . ')';
        }
        if ($INFO['locked']) {
            $out .= ' · ';
            $out .= $lang['lockedby'];
            $out .= ': ';
            $out .= editorinfo($INFO['locked']);
        }
        if ($ret) {
            return $out;
        } else {
            echo $out;
            return true;
        }
    }
    return false;
}
示例#4
0
/**
 * Create html for revision navigation
 *
 * @param PageChangeLog $pagelog changelog object of current page
 * @param string        $type    inline vs sidebyside
 * @param int           $l_rev   left revision timestamp
 * @param int           $r_rev   right revision timestamp
 * @return string[] html of left and right navigation elements
 */
function html_diff_navigation($pagelog, $type, $l_rev, $r_rev)
{
    global $INFO, $ID;
    // last timestamp is not in changelog, retrieve timestamp from metadata
    // note: when page is removed, the metadata timestamp is zero
    if (!$r_rev) {
        if (isset($INFO['meta']['last_change']['date'])) {
            $r_rev = $INFO['meta']['last_change']['date'];
        } else {
            $r_rev = 0;
        }
    }
    //retrieve revisions with additional info
    list($l_revs, $r_revs) = $pagelog->getRevisionsAround($l_rev, $r_rev);
    $l_revisions = array();
    if (!$l_rev) {
        $l_revisions[0] = array(0, "", false);
        //no left revision given, add dummy
    }
    foreach ($l_revs as $rev) {
        $info = $pagelog->getRevisionInfo($rev);
        $l_revisions[$rev] = array($rev, dformat($info['date']) . ' ' . editorinfo($info['user'], true) . ' ' . $info['sum'], $r_rev ? $rev >= $r_rev : false);
    }
    $r_revisions = array();
    if (!$r_rev) {
        $r_revisions[0] = array(0, "", false);
        //no right revision given, add dummy
    }
    foreach ($r_revs as $rev) {
        $info = $pagelog->getRevisionInfo($rev);
        $r_revisions[$rev] = array($rev, dformat($info['date']) . ' ' . editorinfo($info['user'], true) . ' ' . $info['sum'], $rev <= $l_rev);
    }
    //determine previous/next revisions
    $l_index = array_search($l_rev, $l_revs);
    $l_prev = $l_revs[$l_index + 1];
    $l_next = $l_revs[$l_index - 1];
    if ($r_rev) {
        $r_index = array_search($r_rev, $r_revs);
        $r_prev = $r_revs[$r_index + 1];
        $r_next = $r_revs[$r_index - 1];
    } else {
        //removed page
        if ($l_next) {
            $r_prev = $r_revs[0];
        } else {
            $r_prev = null;
        }
        $r_next = null;
    }
    /*
     * Left side:
     */
    $l_nav = '';
    //move back
    if ($l_prev) {
        $l_nav .= html_diff_navigationlink($type, 'diffbothprevrev', $l_prev, $r_prev);
        $l_nav .= html_diff_navigationlink($type, 'diffprevrev', $l_prev, $r_rev);
    }
    //dropdown
    $form = new Doku_Form(array('action' => wl()));
    $form->addHidden('id', $ID);
    $form->addHidden('difftype', $type);
    $form->addHidden('rev2[1]', $r_rev);
    $form->addHidden('do', 'diff');
    $form->addElement(form_makeListboxField('rev2[0]', $l_revisions, $l_rev, '', '', '', array('class' => 'quickselect')));
    $form->addElement(form_makeButton('submit', 'diff', 'Go'));
    $l_nav .= $form->getForm();
    //move forward
    if ($l_next && ($l_next < $r_rev || !$r_rev)) {
        $l_nav .= html_diff_navigationlink($type, 'diffnextrev', $l_next, $r_rev);
    }
    /*
     * Right side:
     */
    $r_nav = '';
    //move back
    if ($l_rev < $r_prev) {
        $r_nav .= html_diff_navigationlink($type, 'diffprevrev', $l_rev, $r_prev);
    }
    //dropdown
    $form = new Doku_Form(array('action' => wl()));
    $form->addHidden('id', $ID);
    $form->addHidden('rev2[0]', $l_rev);
    $form->addHidden('difftype', $type);
    $form->addHidden('do', 'diff');
    $form->addElement(form_makeListboxField('rev2[1]', $r_revisions, $r_rev, '', '', '', array('class' => 'quickselect')));
    $form->addElement(form_makeButton('submit', 'diff', 'Go'));
    $r_nav .= $form->getForm();
    //move forward
    if ($r_next) {
        if ($pagelog->isCurrentRevision($r_next)) {
            $r_nav .= html_diff_navigationlink($type, 'difflastrev', $l_rev);
            //last revision is diff with current page
        } else {
            $r_nav .= html_diff_navigationlink($type, 'diffnextrev', $l_rev, $r_next);
        }
        $r_nav .= html_diff_navigationlink($type, 'diffbothnextrev', $l_next, $r_next);
    }
    return array($l_nav, $r_nav);
}
示例#5
0
/**
 * show diff
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function html_diff($text = '', $intro = true)
{
    require_once DOKU_INC . 'inc/DifferenceEngine.php';
    global $ID;
    global $REV;
    global $lang;
    global $conf;
    // we're trying to be clever here, revisions to compare can be either
    // given as rev and rev2 parameters, with rev2 being optional. Or in an
    // array in rev2.
    $rev1 = $REV;
    if (is_array($_REQUEST['rev2'])) {
        $rev1 = (int) $_REQUEST['rev2'][0];
        $rev2 = (int) $_REQUEST['rev2'][1];
        if (!$rev1) {
            $rev1 = $rev2;
            unset($rev2);
        }
    } else {
        $rev2 = (int) $_REQUEST['rev2'];
    }
    if ($text) {
        // compare text to the most current revision
        $l_rev = '';
        $l_text = rawWiki($ID, '');
        $l_head = '<a class="wikilink1" href="' . wl($ID) . '">' . $ID . ' ' . strftime($conf['dformat'], @filemtime(wikiFN($ID))) . '</a> ' . $lang['current'];
        $r_rev = '';
        $r_text = cleanText($text);
        $r_head = $lang['yours'];
    } else {
        if ($rev1 && $rev2) {
            // two specific revisions wanted
            // make sure order is correct (older on the left)
            if ($rev1 < $rev2) {
                $l_rev = $rev1;
                $r_rev = $rev2;
            } else {
                $l_rev = $rev2;
                $r_rev = $rev1;
            }
        } elseif ($rev1) {
            // single revision given, compare to current
            $r_rev = '';
            $l_rev = $rev1;
        } else {
            // no revision was given, compare previous to current
            $r_rev = '';
            $revs = getRevisions($ID, 0, 1);
            $l_rev = $revs[0];
        }
        // when both revisions are empty then the page was created just now
        if (!$l_rev && !$r_rev) {
            $l_text = '';
        } else {
            $l_text = rawWiki($ID, $l_rev);
        }
        $r_text = rawWiki($ID, $r_rev);
        if (!$l_rev) {
            $l_head = '&mdash;';
        } else {
            $l_info = getRevisionInfo($ID, $l_rev, true);
            if ($l_info['user']) {
                $l_user = editorinfo($l_info['user']);
                if (auth_ismanager()) {
                    $l_user .= ' (' . $l_info['ip'] . ')';
                }
            } else {
                $l_user = $l_info['ip'];
            }
            $l_user = '******' . $l_user . '</span>';
            $l_sum = $l_info['sum'] ? '<span class="sum">' . hsc($l_info['sum']) . '</span>' : '';
            if ($l_info['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) {
                $l_minor = 'class="minor"';
            }
            $l_head = '<a class="wikilink1" href="' . wl($ID, "rev={$l_rev}") . '">' . $ID . ' [' . strftime($conf['dformat'], $l_rev) . ']</a>' . '<br />' . $l_user . ' ' . $l_sum;
        }
        if ($r_rev) {
            $r_info = getRevisionInfo($ID, $r_rev, true);
            if ($r_info['user']) {
                $r_user = editorinfo($r_info['user']);
                if (auth_ismanager()) {
                    $r_user .= ' (' . $r_info['ip'] . ')';
                }
            } else {
                $r_user = $r_info['ip'];
            }
            $r_user = '******' . $r_user . '</span>';
            $r_sum = $r_info['sum'] ? '<span class="sum">' . hsc($r_info['sum']) . '</span>' : '';
            if ($r_info['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) {
                $r_minor = 'class="minor"';
            }
            $r_head = '<a class="wikilink1" href="' . wl($ID, "rev={$r_rev}") . '">' . $ID . ' [' . strftime($conf['dformat'], $r_rev) . ']</a>' . '<br />' . $r_user . ' ' . $r_sum;
        } elseif ($_rev = @filemtime(wikiFN($ID))) {
            $_info = getRevisionInfo($ID, $_rev, true);
            if ($_info['user']) {
                $_user = editorinfo($_info['user']);
                if (auth_ismanager()) {
                    $_user .= ' (' . $_info['ip'] . ')';
                }
            } else {
                $_user = $_info['ip'];
            }
            $_user = '******' . $_user . '</span>';
            $_sum = $_info['sum'] ? '<span class="sum">' . hsc($_info['sum']) . '</span>' : '';
            if ($_info['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) {
                $r_minor = 'class="minor"';
            }
            $r_head = '<a class="wikilink1" href="' . wl($ID) . '">' . $ID . ' [' . strftime($conf['dformat'], $_rev) . ']</a> ' . '(' . $lang['current'] . ')' . '<br />' . $_user . ' ' . $_sum;
        } else {
            $r_head = '&mdash; (' . $lang['current'] . ')';
        }
    }
    $df = new Diff(explode("\n", htmlspecialchars($l_text)), explode("\n", htmlspecialchars($r_text)));
    $tdf = new TableDiffFormatter();
    if ($intro) {
        print p_locale_xhtml('diff');
    }
    ?>
    <table class="diff">
      <tr>
        <th colspan="2" <?php 
    echo $l_minor;
    ?>
>
          <?php 
    echo $l_head;
    ?>
        </th>
        <th colspan="2" <?php 
    echo $r_minor;
    ?>
>
          <?php 
    echo $r_head;
    ?>
        </th>
      </tr>
      <?php 
    echo $tdf->format($df);
    ?>
    </table>
  <?php 
}
/**
 * Print some info about the current page
 *
 * @author  Andreas Gohr <*****@*****.**>
 * @author  Giuseppe Di Terlizzi <*****@*****.**>
 *
 * @param   bool $ret return content instead of printing it
 * @return  bool|string
 */
function bootstrap3_pageinfo($ret = false)
{
    global $conf;
    global $lang;
    global $INFO;
    global $ID;
    // return if we are not allowed to view the page
    if (!auth_quickaclcheck($ID)) {
        return false;
    }
    // prepare date and path
    $fn = $INFO['filepath'];
    if (!$conf['fullpath']) {
        if ($INFO['rev']) {
            $fn = str_replace(fullpath($conf['olddir']) . '/', '', $fn);
        } else {
            $fn = str_replace(fullpath($conf['datadir']) . '/', '', $fn);
        }
    }
    $date_format = bootstrap3_conf('pageInfoDateFormat');
    $page_info = bootstrap3_conf('pageInfo');
    $fn = utf8_decodeFN($fn);
    $date = $date_format == 'dformat' ? dformat($INFO['lastmod']) : datetime_h($INFO['lastmod']);
    // print it
    if ($INFO['exists']) {
        $fn_full = $fn;
        if (!in_array('extension', $page_info)) {
            $fn = str_replace(array('.txt.gz', '.txt'), '', $fn);
        }
        $out = '<ul class="list-inline">';
        if (in_array('filename', $page_info)) {
            $out .= sprintf('<li><i class="fa fa-fw fa-file-text-o text-muted"></i> <span title="%s">%s</span></li>', $fn_full, $fn);
        }
        if (in_array('date', $page_info)) {
            $out .= sprintf('<li><i class="fa fa-fw fa-calendar text-muted"></i> %s <span title="%s">%s</span></li>', $lang['lastmod'], dformat($INFO['lastmod']), $date);
        }
        if (in_array('editor', $page_info)) {
            if (isset($INFO['editor'])) {
                $user = editorinfo($INFO['editor']);
                if (bootstrap3_conf('useGravatar')) {
                    global $auth;
                    $user_data = $auth->getUserData($INFO['editor']);
                    $HTTP = new DokuHTTPClient();
                    $gravatar_img = get_gravatar($user_data['mail'], 16);
                    $gravatar_check = $HTTP->get($gravatar_img . '&d=404');
                    if ($gravatar_check) {
                        $user_img = sprintf('<img src="%s" alt="" width="16" class="img-rounded" /> ', $gravatar_img);
                        $user = str_replace(array('iw_user', 'interwiki'), '', $user);
                        $user = $user_img . $user;
                    }
                }
                $out .= sprintf('<li class="text-muted">%s %s</li>', $lang['by'], $user);
            } else {
                $out .= sprintf('<li>(%s)</li>', $lang['external_edit']);
            }
        }
        if ($INFO['locked'] && in_array('locked', $page_info)) {
            $out .= sprintf('<li><i class="fa fa-fw fa-lock text-muted"></i> %s %s</li>', $lang['lockedby'], editorinfo($INFO['locked']));
        }
        $out .= '</ul>';
        if ($ret) {
            return $out;
        } else {
            echo $out;
            return true;
        }
    }
    return false;
}
                <!-- About -->
                <li><?php 
tpl_link(wl('about'), hsc("About"), 'title="About"');
?>
</li>

            </ul>
            <ul class="nav navbar-nav navbar-right">

                <!-- User tool -->
                <!-- Logged As -->
                <?php 
if (!empty($_SERVER['REMOTE_USER'])) {
    echo '<li class="dropdown">';
    echo '<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" title="' . $lang['loggedinas'] . $_SERVER['REMOTE_USER'] . '">';
    print 'User ' . ucfirst(editorinfo($_SERVER['REMOTE_USER'], true));
    print '<span class="caret"></span>';
    echo '</a>';
    echo '<ul class="dropdown-menu">';
    tpl_action('admin', 1, 'li');
    tpl_action('profile', 1, 'li');
    tpl_action('login', 1, 'li');
    echo '</ul>';
    echo '</li>';
} else {
    tpl_action('login', $link = true, $wrapper = 'li');
    tpl_action('register', 1, 'li');
}
?>

示例#8
0
 /**
  * Returns the meta line below the included page
  * @param $renderer Doku_Renderer_xhtml The (xhtml) renderer
  * @return string The HTML code of the footer
  */
 function html_footer($page, $sect, $sect_title, $flags, $footer_lvl, &$renderer)
 {
     global $conf, $ID;
     if (!$flags['footer']) {
         return '';
     }
     $meta = p_get_metadata($page);
     $exists = page_exists($page);
     $xhtml = array();
     // permalink
     if ($flags['permalink']) {
         $class = $exists ? 'wikilink1' : 'wikilink2';
         $url = $sect ? wl($page) . '#' . $sect : wl($page);
         $name = $sect ? $sect_title : $page;
         $title = $sect ? $page . '#' . $sect : $page;
         if (!$title) {
             $title = str_replace('_', ' ', noNS($page));
         }
         $link = array('url' => $url, 'title' => $title, 'name' => $name, 'target' => $conf['target']['wiki'], 'class' => $class . ' permalink', 'more' => 'rel="bookmark"');
         $xhtml[] = $renderer->_formatLink($link);
     }
     // date
     if ($flags['date'] && $exists) {
         $date = $meta['date']['created'];
         if ($date) {
             $xhtml[] = '<abbr class="published" title="' . strftime('%Y-%m-%dT%H:%M:%SZ', $date) . '">' . strftime($conf['dformat'], $date) . '</abbr>';
         }
     }
     // modified date
     if ($flags['mdate'] && $exists) {
         $mdate = $meta['date']['modified'];
         if ($mdate) {
             $xhtml[] = '<abbr class="published" title="' . strftime('%Y-%m-%dT%H:%M:%SZ', $mdate) . '">' . strftime($conf['dformat'], $mdate) . '</abbr>';
         }
     }
     // author
     if ($flags['user'] && $exists) {
         $author = $meta['user'];
         if ($author) {
             if (function_exists('userlink')) {
                 $xhtml[] = '<span class="vcard author">' . userlink($author) . '</span>';
             } else {
                 // DokuWiki versions < 2014-05-05 doesn't have userlink support, fall back to not providing a link
                 $xhtml[] = '<span class="vcard author">' . editorinfo($author) . '</span>';
             }
         }
     }
     // comments - let Discussion Plugin do the work for us
     if (empty($sect) && $flags['comments'] && !plugin_isdisabled('discussion') && ($discussion =& plugin_load('helper', 'discussion'))) {
         $disc = $discussion->td($page);
         if ($disc) {
             $xhtml[] = '<span class="comment">' . $disc . '</span>';
         }
     }
     // linkbacks - let Linkback Plugin do the work for us
     if (empty($sect) && $flags['linkbacks'] && !plugin_isdisabled('linkback') && ($linkback =& plugin_load('helper', 'linkback'))) {
         $link = $linkback->td($page);
         if ($link) {
             $xhtml[] = '<span class="linkback">' . $link . '</span>';
         }
     }
     $xhtml = implode(DOKU_LF . DOKU_TAB . '&middot; ', $xhtml);
     // tags - let Tag Plugin do the work for us
     if (empty($sect) && $flags['tags'] && !plugin_isdisabled('tag') && ($tag =& plugin_load('helper', 'tag'))) {
         $tags = $tag->td($page);
         if ($tags) {
             $xhtml .= '<div class="tags"><span>' . DOKU_LF . DOKU_TAB . $tags . DOKU_LF . DOKU_TAB . '</span></div>' . DOKU_LF;
         }
     }
     if (!$xhtml) {
         $xhtml = '&nbsp;';
     }
     $class = 'inclmeta';
     $class .= ' level' . $footer_lvl;
     return '<div class="' . $class . '">' . DOKU_LF . DOKU_TAB . $xhtml . DOKU_LF . '</div>' . DOKU_LF;
 }
 function getApprovers()
 {
     $approvers = $this->getApprovalsOnRevision($this->getRevision());
     if (count($approvers) === 0) {
         return;
     }
     $result = array();
     foreach ($approvers as $approver) {
         $result[] = editorinfo($this->getApproverName($approver));
     }
     return $result;
 }
示例#10
0
/**
 * show diff
 *
 * @author Andreas Gohr <*****@*****.**>
 * @param  string $text - compare with this text with most current version
 * @param  bool   $intr - display the intro text
 */
function html_diff($text = '', $intro = true, $type = null)
{
    global $ID;
    global $REV;
    global $lang;
    global $conf;
    if (!$type) {
        $type = $_REQUEST['difftype'];
    }
    if ($type != 'inline') {
        $type = 'sidebyside';
    }
    // we're trying to be clever here, revisions to compare can be either
    // given as rev and rev2 parameters, with rev2 being optional. Or in an
    // array in rev2.
    $rev1 = $REV;
    if (is_array($_REQUEST['rev2'])) {
        $rev1 = (int) $_REQUEST['rev2'][0];
        $rev2 = (int) $_REQUEST['rev2'][1];
        if (!$rev1) {
            $rev1 = $rev2;
            unset($rev2);
        }
    } else {
        $rev2 = (int) $_REQUEST['rev2'];
    }
    $r_minor = '';
    $l_minor = '';
    if ($text) {
        // compare text to the most current revision
        $l_rev = '';
        $l_text = rawWiki($ID, '');
        $l_head = '<a class="wikilink1" href="' . wl($ID) . '">' . $ID . ' ' . dformat((int) @filemtime(wikiFN($ID))) . '</a> ' . $lang['current'];
        $r_rev = '';
        $r_text = cleanText($text);
        $r_head = $lang['yours'];
    } else {
        if ($rev1 && $rev2) {
            // two specific revisions wanted
            // make sure order is correct (older on the left)
            if ($rev1 < $rev2) {
                $l_rev = $rev1;
                $r_rev = $rev2;
            } else {
                $l_rev = $rev2;
                $r_rev = $rev1;
            }
        } elseif ($rev1) {
            // single revision given, compare to current
            $r_rev = '';
            $l_rev = $rev1;
        } else {
            // no revision was given, compare previous to current
            $r_rev = '';
            $revs = getRevisions($ID, 0, 1);
            $l_rev = $revs[0];
            $REV = $l_rev;
            // store revision back in $REV
        }
        // when both revisions are empty then the page was created just now
        if (!$l_rev && !$r_rev) {
            $l_text = '';
        } else {
            $l_text = rawWiki($ID, $l_rev);
        }
        $r_text = rawWiki($ID, $r_rev);
        if (!$l_rev) {
            $l_head = '&mdash;';
        } else {
            $l_info = getRevisionInfo($ID, $l_rev, true);
            if ($l_info['user']) {
                $l_user = editorinfo($l_info['user']);
                if (auth_ismanager()) {
                    $l_user .= ' (' . $l_info['ip'] . ')';
                }
            } else {
                $l_user = $l_info['ip'];
            }
            $l_user = '******' . $l_user . '</span>';
            $l_sum = $l_info['sum'] ? '<span class="sum">' . hsc($l_info['sum']) . '</span>' : '';
            if ($l_info['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) {
                $l_minor = 'class="minor"';
            }
            $l_head = '<a class="wikilink1" href="' . wl($ID, "rev={$l_rev}") . '">' . $ID . ' [' . dformat($l_rev) . ']</a>' . '<br />' . $l_user . ' ' . $l_sum;
        }
        if ($r_rev) {
            $r_info = getRevisionInfo($ID, $r_rev, true);
            if ($r_info['user']) {
                $r_user = editorinfo($r_info['user']);
                if (auth_ismanager()) {
                    $r_user .= ' (' . $r_info['ip'] . ')';
                }
            } else {
                $r_user = $r_info['ip'];
            }
            $r_user = '******' . $r_user . '</span>';
            $r_sum = $r_info['sum'] ? '<span class="sum">' . hsc($r_info['sum']) . '</span>' : '';
            if ($r_info['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) {
                $r_minor = 'class="minor"';
            }
            $r_head = '<a class="wikilink1" href="' . wl($ID, "rev={$r_rev}") . '">' . $ID . ' [' . dformat($r_rev) . ']</a>' . '<br />' . $r_user . ' ' . $r_sum;
        } elseif ($_rev = @filemtime(wikiFN($ID))) {
            $_info = getRevisionInfo($ID, $_rev, true);
            if ($_info['user']) {
                $_user = editorinfo($_info['user']);
                if (auth_ismanager()) {
                    $_user .= ' (' . $_info['ip'] . ')';
                }
            } else {
                $_user = $_info['ip'];
            }
            $_user = '******' . $_user . '</span>';
            $_sum = $_info['sum'] ? '<span class="sum">' . hsc($_info['sum']) . '</span>' : '';
            if ($_info['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) {
                $r_minor = 'class="minor"';
            }
            $r_head = '<a class="wikilink1" href="' . wl($ID) . '">' . $ID . ' [' . dformat($_rev) . ']</a> ' . '(' . $lang['current'] . ')' . '<br />' . $_user . ' ' . $_sum;
        } else {
            $r_head = '&mdash; (' . $lang['current'] . ')';
        }
    }
    $df = new Diff(explode("\n", htmlspecialchars($l_text)), explode("\n", htmlspecialchars($r_text)));
    if ($type == 'inline') {
        $tdf = new InlineDiffFormatter();
    } else {
        $tdf = new TableDiffFormatter();
    }
    if ($intro) {
        print p_locale_xhtml('diff');
    }
    if (!$text) {
        ptln('<p class="difflink">');
        $form = new Doku_Form(array('action' => wl()));
        $form->addHidden('id', $ID);
        $form->addHidden('rev2[0]', $l_rev);
        $form->addHidden('rev2[1]', $r_rev);
        $form->addHidden('do', 'diff');
        $form->addElement(form_makeListboxField('difftype', array('sidebyside' => $lang['diff_side'], 'inline' => $lang['diff_inline']), $type, $lang['diff_type'], '', '', array('class' => 'quickselect')));
        $form->addElement(form_makeButton('submit', 'diff', 'Go'));
        $form->printForm();
        $diffurl = wl($ID, array('do' => 'diff', 'rev2[0]' => $l_rev, 'rev2[1]' => $r_rev, 'difftype' => $type));
        ptln('<br /><a class="wikilink1" href="' . $diffurl . '">' . $lang['difflink'] . '</a>');
        ptln('</p>');
    }
    ?>
    <table class="diff diff_<?php 
    echo $type;
    ?>
">
    <tr>
    <th colspan="2" <?php 
    echo $l_minor;
    ?>
>
    <?php 
    echo $l_head;
    ?>
    </th>
    <th colspan="2" <?php 
    echo $r_minor;
    ?>
>
    <?php 
    echo $r_head;
    ?>
    </th>
    </tr>
    <?php 
    echo $tdf->format($df);
    ?>
    </table>
    <?php 
}
		    <div class="sitesuffix">
			    <div class="pageinfo">
				    <h2><dfn><?php 
    echo "SiteInformation";
    //TODO: translation
    ?>
</dfn></h2>
				    <p><?php 
    if (isset($INFO['exists']) && auth_quickaclcheck($ID)) {
        echo $lang['lastmod'] . ': ';
        if (actionOK('revisions')) {
            tpl_actionlink('history', '<span id="page_diff" title="' . $lang['btn_revs'] . '"><span class="backendbutton"></span>', '</span>', strftime($conf['dformat'], $INFO['lastmod']));
        } else {
            strftime($conf['dformat'], $INFO['lastmod']);
        }
        echo (isset($INFO['editor']) ? ' ' . $lang['by'] . ' ' . editorinfo($INFO['editor']) : ' (' . $lang['external_edit'] . ')') . '. ';
        tpl_actionlink('backlink', '<span id="page_link" title="' . $lang['btn_backlink'] . '"><span class="backendbutton"></span>', '</span>');
    }
    // TODO: License
    ?>
</p>
				    
				    <!-- there are no file upload features in DokuWiki (?)
				    <?php 
    if (isset($_SERVER['REMOTE_USER'])) {
        ?>
				    <ul>
					    <?php 
        /* Referer link -- moved to info paragraph above */
        ?>
					    <?php