/** * Add recent changed pages to the feed object * * @author Andreas Gohr <*****@*****.**> */ function rssRecentChanges($opt) { global $conf; global $auth; $flags = RECENTS_SKIP_DELETED; if (!$opt['show_minor']) { $flags += RECENTS_SKIP_MINORS; } $recents = getRecents(0, $opt['items'], $opt['namespace'], $flags); return $recents; }
/** * display recent changes * * @author Andreas Gohr <*****@*****.**> * @author Matthias Grimm <*****@*****.**> * @author Ben Coburn <*****@*****.**> * @author Kate Arzamastseva <*****@*****.**> */ function html_recent($first = 0, $show_changes = 'both') { global $conf; global $lang; global $ID; /* we need to get one additionally log entry to be able to * decide if this is the last page or is there another one. * This is the cheapest solution to get this information. */ $flags = 0; if ($show_changes == 'mediafiles' && $conf['mediarevisions']) { $flags = RECENTS_MEDIA_CHANGES; } elseif ($show_changes == 'pages') { $flags = 0; } elseif ($conf['mediarevisions']) { $show_changes = 'both'; $flags = RECENTS_MEDIA_PAGES_MIXED; } $recents = getRecents($first, $conf['recent'] + 1, getNS($ID), $flags); if (count($recents) == 0 && $first != 0) { $first = 0; $recents = getRecents($first, $conf['recent'] + 1, getNS($ID), $flags); } $hasNext = false; if (count($recents) > $conf['recent']) { $hasNext = true; array_pop($recents); // remove extra log entry } print p_locale_xhtml('recent'); if (getNS($ID) != '') { print '<div class="level1"><p>' . sprintf($lang['recent_global'], getNS($ID), wl('', 'do=recent')) . '</p></div>'; } $form = new Doku_Form(array('id' => 'dw__recent', 'method' => 'GET')); $form->addHidden('sectok', null); $form->addHidden('do', 'recent'); $form->addHidden('id', $ID); if ($conf['mediarevisions']) { $form->addElement(form_makeListboxField('show_changes', array('pages' => $lang['pages_changes'], 'mediafiles' => $lang['media_changes'], 'both' => $lang['both_changes']), $show_changes, $lang['changes_type'], '', '', array('class' => 'quickselect'))); $form->addElement(form_makeButton('submit', 'recent', $lang['btn_apply'])); } $form->addElement(form_makeOpenTag('ul')); foreach ($recents as $recent) { $date = dformat($recent['date']); if ($recent['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) { $form->addElement(form_makeOpenTag('li', array('class' => 'minor'))); } else { $form->addElement(form_makeOpenTag('li')); } $form->addElement(form_makeOpenTag('div', array('class' => 'li'))); if ($recent['media']) { $form->addElement(media_printicon($recent['id'])); } else { $icon = DOKU_BASE . 'lib/images/fileicons/file.png'; $form->addElement('<img src="' . $icon . '" alt="' . $filename . '" class="icon" />'); } $form->addElement(form_makeOpenTag('span', array('class' => 'date'))); $form->addElement($date); $form->addElement(form_makeCloseTag('span')); if ($recent['media']) { $diff = count(getRevisions($recent['id'], 0, 1, 8192, true)) && @file_exists(mediaFN($recent['id'])); if ($diff) { $href = media_managerURL(array('tab_details' => 'history', 'mediado' => 'diff', 'image' => $recent['id'], 'ns' => getNS($recent['id'])), '&'); } } else { $href = wl($recent['id'], "do=diff", false, '&'); } if ($recent['media'] && !$diff) { $form->addElement('<img src="' . DOKU_BASE . 'lib/images/blank.gif" width="15" height="11" alt="" />'); } else { $form->addElement(form_makeOpenTag('a', array('class' => 'diff_link', 'href' => $href))); $form->addElement(form_makeTag('img', array('src' => DOKU_BASE . 'lib/images/diff.png', 'width' => 15, 'height' => 11, 'title' => $lang['diff'], 'alt' => $lang['diff']))); $form->addElement(form_makeCloseTag('a')); } if ($recent['media']) { $href = media_managerURL(array('tab_details' => 'history', 'image' => $recent['id'], 'ns' => getNS($recent['id'])), '&'); } else { $href = wl($recent['id'], "do=revisions", false, '&'); } $form->addElement(form_makeOpenTag('a', array('class' => 'revisions_link', 'href' => $href))); $form->addElement(form_makeTag('img', array('src' => DOKU_BASE . 'lib/images/history.png', 'width' => 12, 'height' => 14, 'title' => $lang['btn_revs'], 'alt' => $lang['btn_revs']))); $form->addElement(form_makeCloseTag('a')); if ($recent['media']) { $href = media_managerURL(array('tab_details' => 'view', 'image' => $recent['id'], 'ns' => getNS($recent['id'])), '&'); $class = file_exists(mediaFN($recent['id'])) ? 'wikilink1' : ($class = 'wikilink2'); $form->addElement(form_makeOpenTag('a', array('class' => $class, 'href' => $href))); $form->addElement($recent['id']); $form->addElement(form_makeCloseTag('a')); } else { $form->addElement(html_wikilink(':' . $recent['id'], useHeading('navigation') ? null : $recent['id'])); } $form->addElement(form_makeOpenTag('span', array('class' => 'sum'))); $form->addElement(' – ' . htmlspecialchars($recent['sum'])); $form->addElement(form_makeCloseTag('span')); $form->addElement(form_makeOpenTag('span', array('class' => 'user'))); if ($recent['user']) { $form->addElement(editorinfo($recent['user'])); if (auth_ismanager()) { $form->addElement(' (' . $recent['ip'] . ')'); } } else { $form->addElement($recent['ip']); } $form->addElement(form_makeCloseTag('span')); $form->addElement(form_makeCloseTag('div')); $form->addElement(form_makeCloseTag('li')); } $form->addElement(form_makeCloseTag('ul')); $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav'))); $last = $first + $conf['recent']; if ($first > 0) { $first -= $conf['recent']; if ($first < 0) { $first = 0; } $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-prev'))); $form->addElement(form_makeTag('input', array('type' => 'submit', 'name' => 'first[' . $first . ']', 'value' => $lang['btn_newer'], 'accesskey' => 'n', 'title' => $lang['btn_newer'] . ' [N]', 'class' => 'button show'))); $form->addElement(form_makeCloseTag('div')); } if ($hasNext) { $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-next'))); $form->addElement(form_makeTag('input', array('type' => 'submit', 'name' => 'first[' . $last . ']', 'value' => $lang['btn_older'], 'accesskey' => 'p', 'title' => $lang['btn_older'] . ' [P]', 'class' => 'button show'))); $form->addElement(form_makeCloseTag('div')); } $form->addElement(form_makeCloseTag('div')); html_form('recent', $form); }
/** * List recent edits matching the given filter */ function _list($filter) { global $conf; global $lang; echo '<hr /><br />'; echo '<form action="" method="post"><div class="no">'; echo '<input type="hidden" name="filter" value="' . hsc($filter) . '" />'; formSecurityToken(); $recents = getRecents(0, $this->max_lines); echo '<ul>'; $cnt = 0; foreach ($recents as $recent) { if ($filter) { if (strpos(rawWiki($recent['id']), $filter) === false) { continue; } } $cnt++; $date = strftime($conf['dformat'], $recent['date']); echo $recent['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT ? '<li class="minor">' : '<li>'; echo '<div class="li">'; echo '<input type="checkbox" name="revert[]" value="' . hsc($recent['id']) . '" checked="checked" id="revert__' . $cnt . '" />'; echo '<label for="revert__' . $cnt . '">' . $date . '</label> '; echo '<a href="' . wl($recent['id'], "do=diff") . '">'; $p = array(); $p['src'] = DOKU_BASE . 'lib/images/diff.png'; $p['width'] = 15; $p['height'] = 11; $p['title'] = $lang['diff']; $p['alt'] = $lang['diff']; $att = buildAttributes($p); echo "<img {$att} />"; echo '</a> '; echo '<a href="' . wl($recent['id'], "do=revisions") . '">'; $p = array(); $p['src'] = DOKU_BASE . 'lib/images/history.png'; $p['width'] = 12; $p['height'] = 14; $p['title'] = $lang['btn_revs']; $p['alt'] = $lang['btn_revs']; $att = buildAttributes($p); echo "<img {$att} />"; echo '</a> '; echo html_wikilink(':' . $recent['id'], useHeading('navigation') ? NULL : $recent['id']); echo ' – ' . htmlspecialchars($recent['sum']); echo ' <span class="user">'; echo $recent['user'] . ' ' . $recent['ip']; echo '</span>'; echo '</div>'; echo '</li>'; @set_time_limit(10); flush(); } echo '</ul>'; echo '<p>'; echo '<input type="submit" class="button" value="' . $this->getLang('revert') . '" /> '; printf($this->getLang('note2'), hsc($filter)); echo '</p>'; echo '</div></form>'; }
/** * display recent changes * * @author Andreas Gohr <*****@*****.**> * @author Matthias Grimm <*****@*****.**> * @author Ben Coburn <*****@*****.**> */ function html_recent($first = 0) { global $conf; global $lang; global $ID; /* we need to get one additionally log entry to be able to * decide if this is the last page or is there another one. * This is the cheapest solution to get this information. */ $recents = getRecents($first, $conf['recent'] + 1, getNS($ID)); if (count($recents) == 0 && $first != 0) { $first = 0; $recents = getRecents($first, $conf['recent'] + 1, getNS($ID)); } $hasNext = false; if (count($recents) > $conf['recent']) { $hasNext = true; array_pop($recents); // remove extra log entry } print p_locale_xhtml('recent'); if (getNS($ID) != '') { print '<div class="level1"><p>' . sprintf($lang['recent_global'], getNS($ID), wl('', 'do=recent')) . '</p></div>'; } $form = new Doku_Form('dw__recent', script(), 'get'); $form->addHidden('sectok', null); $form->addHidden('do', 'recent'); $form->addHidden('id', $ID); $form->addElement(form_makeOpenTag('ul')); foreach ($recents as $recent) { $date = strftime($conf['dformat'], $recent['date']); if ($recent['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) { $form->addElement(form_makeOpenTag('li', array('class' => 'minor'))); } else { $form->addElement(form_makeOpenTag('li')); } $form->addElement(form_makeOpenTag('div', array('class' => 'li'))); $form->addElement(form_makeOpenTag('span', array('class' => 'date'))); $form->addElement($date); $form->addElement(form_makeCloseTag('span')); $form->addElement(form_makeOpenTag('a', array('class' => 'diff_link', 'href' => wl($recent['id'], "do=diff", false, '&')))); $form->addElement(form_makeTag('img', array('src' => DOKU_BASE . 'lib/images/diff.png', 'width' => 15, 'height' => 11, 'title' => $lang['diff'], 'alt' => $lang['diff']))); $form->addElement(form_makeCloseTag('a')); $form->addElement(form_makeOpenTag('a', array('class' => 'revisions_link', 'href' => wl($recent['id'], "do=revisions", false, '&')))); $form->addElement(form_makeTag('img', array('src' => DOKU_BASE . 'lib/images/history.png', 'width' => 12, 'height' => 14, 'title' => $lang['btn_revs'], 'alt' => $lang['btn_revs']))); $form->addElement(form_makeCloseTag('a')); $form->addElement(html_wikilink(':' . $recent['id'], useHeading('navigation') ? NULL : $recent['id'])); $form->addElement(form_makeOpenTag('span', array('class' => 'sum'))); $form->addElement(' – ' . htmlspecialchars($recent['sum'])); $form->addElement(form_makeCloseTag('span')); $form->addElement(form_makeOpenTag('span', array('class' => 'user'))); if ($recent['user']) { $form->addElement(editorinfo($recent['user'])); if (auth_ismanager()) { $form->addElement(' (' . $recent['ip'] . ')'); } } else { $form->addElement($recent['ip']); } $form->addElement(form_makeCloseTag('span')); $form->addElement(form_makeCloseTag('div')); $form->addElement(form_makeCloseTag('li')); } $form->addElement(form_makeCloseTag('ul')); $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav'))); $last = $first + $conf['recent']; if ($first > 0) { $first -= $conf['recent']; if ($first < 0) { $first = 0; } $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-prev'))); $form->addElement(form_makeTag('input', array('type' => 'submit', 'name' => 'first[' . $first . ']', 'value' => $lang['btn_newer'], 'accesskey' => 'n', 'title' => $lang['btn_newer'] . ' [N]', 'class' => 'button'))); $form->addElement(form_makeCloseTag('div')); } if ($hasNext) { $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-next'))); $form->addElement(form_makeTag('input', array('type' => 'submit', 'name' => 'first[' . $last . ']', 'value' => $lang['btn_older'], 'accesskey' => 'p', 'title' => $lang['btn_older'] . ' [P]', 'class' => 'button'))); $form->addElement(form_makeCloseTag('div')); } $form->addElement(form_makeCloseTag('div')); html_form('recent', $form); }
/** * PRINT LAST CHANGES LIST * * Print an <ul> loaded with @param last changes. * * @param integer $n number of last changes to show in the list */ function _mixture_last_changes($n, $context = null) { global $conf, $lang; $flags = ''; if (strpos(tpl_getConf('lastchanges'), 'skip_deleted') !== false) { $flags = RECENTS_SKIP_DELETED; } if (strpos(tpl_getConf('lastchanges'), 'skip_minors') !== false) { $flags += RECENTS_SKIP_MINORS; } $recents = getRecents(0, $n, getNS($ID), $flags); $i = 0; foreach ($recents as $key => $value) { $details = null; if ($value['sum'] != null) { $details = ucfirst(trim($value['sum'], ".")); } else { $details = ucfirst(trim(str_replace(":", "", $lang['mail_changed']), chr(0xc2) . chr(0xa0))); } if ($value['user'] != null and $context == "landing") { $details .= $lang['by'] . ucwords($value['user']); } if ($context == "landing") { $details .= "."; } print '<li'; if ($context == "landing") { print ' data-infos="' . $details . '"'; $logo = _mixture_namespacedFile('logo', 'inherit', 1, null, $value['id']); if ($logo != null) { print ' data-logo="' . $logo['fileID'] . '"'; } } print '>'; if ($context == "landing") { //print '<i class="fa fa-fw fa-play state"></i>'; print '<span class="timestamp display-none">' . _mixture_date("long", $value['date'], true) . '</span>'; } if (page_exists($value['id'])) { $exist = "wikilink1"; } else { $exist = "wikilink2"; } if ($context == null or $conf['useheading'] == 0 or p_get_first_heading($value['id']) == null) { $pageName = $value['id']; } else { $pageName = p_get_first_heading($value['id']); } if ($context == "landing") { tpl_link(wl($value['id']), $pageName, 'class="' . $exist . '"'); } else { tpl_link(wl($value['id']), $pageName, 'title="' . $details . ' (' . _mixture_date("long", $value['date']) . ')" class="' . $exist . '"'); } $by = null; if ($value['user'] != null) { $by = " " . $lang['by'] . " "; } if ($context == null) { print '<span class="display-none wd-display-initial">' . $by . '<span class="text-capitalize"><bdi>' . $value['user'] . '</bdi></span></span>'; } $i++; print '</li>'; } }
/** * Add recent changed pages to the feed object * * @author Andreas Gohr <*****@*****.**> */ function rssRecentChanges($opt) { global $conf; $flags = RECENTS_SKIP_DELETED; if (!$opt['show_minor']) { $flags += RECENTS_SKIP_MINORS; } if ($opt['content_type'] == 'media' && $conf['mediarevisions']) { $flags += RECENTS_MEDIA_CHANGES; } if ($opt['content_type'] == 'both' && $conf['mediarevisions']) { $flags += RECENTS_MEDIA_PAGES_MIXED; } $recents = getRecents(0, $opt['items'], $opt['namespace'], $flags); return $recents; }
/** * display recent changes * * @author Andreas Gohr <*****@*****.**> * @author Matthias Grimm <*****@*****.**> * @author Ben Coburn <*****@*****.**> */ function html_recent($first = 0) { global $conf; global $lang; global $ID; /* we need to get one additionally log entry to be able to * decide if this is the last page or is there another one. * This is the cheapest solution to get this information. */ $recents = getRecents($first, $conf['recent'] + 1, getNS($ID)); if (count($recents) == 0 && $first != 0) { $first = 0; $recents = getRecents($first, $conf['recent'] + 1, getNS($ID)); } $hasNext = false; if (count($recents) > $conf['recent']) { $hasNext = true; array_pop($recents); // remove extra log entry } print p_locale_xhtml('recent'); print '<ul>'; foreach ($recents as $recent) { $date = date($conf['dformat'], $recent['date']); print $recent['type'] === 'e' ? '<li class="minor">' : '<li>'; print '<div class="li">'; print $date . ' '; print '<a href="' . wl($recent['id'], "do=diff") . '">'; $p = array(); $p['src'] = DOKU_BASE . 'lib/images/diff.png'; $p['width'] = 15; $p['height'] = 11; $p['title'] = $lang['diff']; $p['alt'] = $lang['diff']; $att = buildAttributes($p); print "<img {$att} />"; print '</a> '; print '<a href="' . wl($recent['id'], "do=revisions") . '">'; $p = array(); $p['src'] = DOKU_BASE . 'lib/images/history.png'; $p['width'] = 12; $p['height'] = 14; $p['title'] = $lang['btn_revs']; $p['alt'] = $lang['btn_revs']; $att = buildAttributes($p); print "<img {$att} />"; print '</a> '; print html_wikilink(':' . $recent['id'], $conf['useheading'] ? NULL : $recent['id']); print ' – ' . htmlspecialchars($recent['sum']); print ' <span class="user">'; if ($recent['user']) { print $recent['user']; } else { print $recent['ip']; } print '</span>'; print '</div>'; print '</li>'; } print '</ul>'; print '<div class="pagenav">'; $last = $first + $conf['recent']; if ($first > 0) { $first -= $conf['recent']; if ($first < 0) { $first = 0; } print '<div class="pagenav-prev">'; print html_btn('newer', '', "p", array('do' => 'recent', 'first' => $first)); print '</div>'; } if ($hasNext) { print '<div class="pagenav-next">'; print html_btn('older', '', "n", array('do' => 'recent', 'first' => $last)); print '</div>'; } print '</div>'; }