function listPlugin($plugin, $plugindata) { global $plugins, $loguser; $pdata = $plugindata; $hasperms = false; if (!isset($plugins[$plugin]) && file_exists('plugins/' . $plugin . '/permStrings.php')) { $hasperms = true; } if ($hasperms) { $pdata['description'] .= '<br><strong>This plugin has permissions. After enabling it, make sure to configure them properly.</strong>'; } $text = __("Enable"); $act = "enable"; if (isset($plugins[$plugin])) { $text = __("Disable"); $act = "disable"; } $pdata['actions'] = '<ul class="pipemenu">' . actionLinkTagItem($text, "pluginmanager", $plugin, "action=" . $act . "&key=" . $loguser['token']); if (in_array("settingsfile", $plugindata['buckets'])) { if (isset($plugins[$plugin])) { $pdata['actions'] .= actionLinkTagItem(__("Settings…"), "editsettings", $plugin); } } $pdata['actions'] .= '</ul>'; return $pdata; }
$text = preg_replace_callback('@\\[\\[([^\\]]+?)\\]\\]@s', 'makeLink', $text); //$text = preg_replace_callback('@^\s*\*\s*.+?$@m', 'makeList', $text); //$text = preg_replace_callback("@(\[li\](.+?)\[/li\]\n)+@", 'finalizeList', $text); $text = preg_replace('@^[ ]*\\*[ ]*(.+?)$@m', '• $1', $text); // run the post parser on it and call it good $text = CleanUpPost($text, '', false, false); $hlevels = array('cur' => 0, 'curtag' => -1); $contentsbox = ''; $text = preg_replace_callback('@^<(h[1-6]).*?>(.+?)</\\1.*?>$@mi', 'headingHandler', $text); if ($contentsbox && !$nocontbox) { $text = ' <table class="outline margin" style="display:inline-block;width:auto;"> <tr class="header1"><th>Contents</th></tr> <tr class="cell0"> <td style="padding:1em;"> ' . $contentsbox . ' </td> </tr> </table> <br> ' . $text; } return $text; } // TODO: implement wiki banning/localmod system $canedit = $loguserid && HasPermission('wiki.editpages'); $token = hash('sha256', "{$loguserid},{$loguser['pss']}," . SALT . ",wikiXD,sfg657gsfh685gh7s4sg6f5hgf"); $links = actionLinkTagItem('Recent changes', 'wikichanges'); if ($canedit) { $links .= actionLinkTagItem('Create page', 'wikiedit', '', 'createnew'); }
$crumbs->add(new PipeMenuLinkEntry(__("Online users"), "online")); makeBreadcrumbs($crumbs); AssertForbidden("viewOnline"); // This can (and will) be turned into a permission. $showIPs = $loguser['powerlevel'] > 0; $time = (int) $_GET['time']; if (!$time) { $time = 300; } $rUsers = Query("select * from {users} where lastactivity > {0} order by lastactivity desc", time() - $time); $rGuests = Query("select * from {guests} where date > {0} and bot = 0 order by date desc", time() - $time); $rBots = Query("select * from {guests} where date > {0} and bot = 1 order by date desc", time() - $time); $spans = array(60, 300, 900, 3600, 86400); $spanList = ""; foreach ($spans as $span) { $spanList .= actionLinkTagItem(timeunits($span), "online", "", "time={$span}"); } write("\n\t<div class=\"smallFonts margin\">\n\t\t" . __("Show visitors from this far back:") . "\n\t\t<ul class=\"pipemenu\">\n\t\t\t{0}\n\t\t</ul>\n\t</div>\n", $spanList); $userList = ""; $i = 1; if (NumRows($rUsers)) { while ($user = Fetch($rUsers)) { $cellClass = ($cellClass + 1) % 2; if ($user['lasturl']) { $lastUrl = "<a href=\"" . FilterURL($user['lasturl']) . "\">" . FilterURL($user['lasturl']) . "</a>"; } else { $lastUrl = __("None"); } $userList .= "\n\t\t<tr class=\"cell{$cellClass}\">\n\t\t\t<td>{$i}</td>\n\t\t\t<td>" . UserLink($user) . "</td>\n\t\t\t<td>" . ($user['lastposttime'] ? cdate("d-m-y G:i:s", $user['lastposttime']) : __("Never")) . "</td>\n\t\t\t<td>" . cdate("d-m-y G:i:s", $user['lastactivity']) . "</td>\n\t\t\t<td>{$lastUrl}</td>"; if ($showIPs) { $userList .= "<td>" . formatIP($user['lastip']) . "</td>";
require 'wikilib.php'; $rev = isset($_GET['rev']) ? (int) $_GET['rev'] : 0; $page = getWikiPage($_GET['id'], $rev); $rev = min($rev, $page['revision']); $urltitle = $page['id']; //urlencode($page['id']); $nicetitle = htmlspecialchars(url2title($page['id'])); $title = 'Wiki » ' . $nicetitle; if ($page['istalk']) { $links .= actionLinkTagItem('Page', 'wiki', substr($urltitle, 5)) . '<li>Discuss</li>'; } else { $links .= '<li>Page</li>' . actionLinkTagItem('Discuss', 'wiki', 'Talk:' . $urltitle); } if ($page['canedit']) { $links .= actionLinkTagItem('Edit', 'wikiedit', $urltitle); } if ($page['ismain']) { MakeCrumbs(array(actionLink('wiki') => 'Wiki'), $links); } else { MakeCrumbs(array(actionLink('wiki') => 'Wiki', actionLink('wiki', $urltitle) => $nicetitle), $links); } echo ' <table class="outline margin"> <tr class="cell1"> <td style="padding:0px 1em 1em;">'; if ($page['flags'] & WIKI_PFLAG_DELETED) { echo '<h1>' . $nicetitle . '</h1>This page has been deleted.'; } else { if ($page['new']) { echo '<h1>' . $nicetitle . '</h1>This page does not exist.';
$ts = 'Yesterday'; } } if ($ts != $lastts) { $lastts = $ts; echo ' <tr class="header0"> <th colspan="2">' . $ts . '</th> </tr>'; } $user = getDataPrefix($change, 'u_'); $userlink = userLink($user); $date = formatdate($date); $links = actionLinkTagItem('View page', 'wiki', $change['id'], 'rev=' . $change['revision']); $changetext = 'Page ' . actionLinkTag(htmlspecialchars(url2title($change['id'])), 'wiki', $change['id']); if ($change['revision'] > 1) { $changetext .= ' edited by ' . $userlink . ' on ' . $date . ' (revision ' . $change['revision'] . ')'; $links .= actionLinkTagItem('Diff', 'wikidiff', $change['id'], 'rev=' . $change['revision']); } else { $changetext .= ' created by ' . $userlink . ' on ' . $date; } echo ' <tr class="cell' . $c . '"> <td>' . $changetext . '</td> <td><ul class="pipemenu">' . $links . '</ul></td> </tr>'; $c = $c == 1 ? 2 : 1; } } echo ' </table>';
function listCategory($cat) { global $loguser, $loguserid, $rootdir, $userSelectUsers, $boardroot; if (isset($_GET['sort']) && $_GET['sort'] == "filename" || $_GET['sort'] == "date") { $skey = $_GET['sort']; } else { $skey = "date"; } $sortOptions = "<div class=\"margin smallFonts\">" . __("Sort order") . ": <ul class=\"pipemenu\">"; $sortOptions .= $skey == "filename" ? "<li>" . __("Name") . "</li>" : actionLinkTagItem(__("Name"), "uploaderlist", "", "cat={$_GET["cat"]}&sort=filename"); $sortOptions .= $skey == "date" ? "<li>" . __("Date") . "</li>" : actionLinkTagItem(__("Date"), "uploaderlist", "", "cat={$_GET["cat"]}&sort=date"); $sortOptions .= "</ul></div>"; $sdir = $skey == "date" ? " desc" : " asc"; print $sortOptions; if ($cat == -1) { $condition = "up.user = "******" and up.private = 1"; } else { if ($cat == -2 && $loguser['powerlevel'] > 2) { $condition = "up.private = 1"; } else { $condition = "up.private = 0 and up.category = {0}"; } } $errormsg = __("The category is empty."); if ($cat < 0) { $errormsg = __("You have no private files."); } $entries = Query("SELECT\n\t\t\tup.*,\n\t\t\tu.(_userfields)\n\t\t\tFROM {uploader} up\n\t\t\tLEFT JOIN {users} u on up.user = u.id\n\t\t\tWHERE {$condition}\n\t\t\tORDER BY " . $skey . $sdir, $cat); $checkbox = ""; if ($loguserid) { $checkbox = "<input type=\"checkbox\" id=\"ca\" onchange=\"checkAll();\" />"; $checkbox = "<th style=\"width: 22px;\">{$checkbox}</th>"; } if (NumRows($entries) == 0) { print "\n\t\t<table class=\"outline margin\">\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"7\">" . __("Files") . "</th>\n\t\t\t</tr>\n\t\t\t<tr class=\"cell1\">\n\t\t\t\t<td colspan=\"4\">\n\t\t\t\t\t" . $errormsg . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t"; } else { print "\n\t\t<table class=\"outline margin\">\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"7\">" . __("Files") . "</th>\n\t\t\t</tr>\n\n\t\t"; print "\n\t\t\t<tr class=\"header1\">\n\t\t\t\t{$checkbox}\n\t\t\t\t<th>\n\t\t\t\t\t" . __("File") . "\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t" . __("Description") . "\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t" . __("Size") . "\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t" . __("Uploader") . "\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t" . __("Downloads") . "\n\t\t\t\t</th>\n\t\t\t</tr>\n\t\t"; while ($entry = Fetch($entries)) { $delete = ""; $multidel = ""; if ($loguserid) { $multidel = "<td><input type=\"checkbox\" name=\"delete[" . $entry['id'] . "]\" disabled=\"disabled\" /></td>"; } if ($loguserid == $entry['user'] || $loguser['powerlevel'] > 2) { $delete = " <sup>" . actionLinkTag("✘", "uploader", "", "action=delete&fid=" . $entry['id'] . "&cat=" . $_GET["cat"]) . "</sup>"; $multidel = "<td><input type=\"checkbox\" name=\"del[" . $entry['id'] . "]\" /></td>"; } $cellClass = ($cellClass + 1) % 2; $filepath = $rootdir . "/" . $entry['filename']; if ($entry['private']) { $filepath = $rootdir . "/" . $entry['user'] . "/" . $entry['filename']; } print format("\n\t\t\t<tr class=\"cell{0}\">\n\t\t\t\t{7}\n\t\t\t\t<td>\n\t\t\t\t\t<a href=\"{$boardroot}get.php?id={1}\">{2}</a>{3}\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t{4}\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t{5}\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t{6}\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t{8}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t", $cellClass, $entry['id'], $entry['filename'], $delete, $entry['description'], BytesToSize(@filesize($filepath)), UserLink(getDataPrefix($entry, "u_")), $multidel, $entry["downloads"]); } if ($loguserid) { $entries = Query("select * from {uploader_categories} order by ord"); $movelist = ""; while ($entry = Fetch($entries)) { $movelist .= "<option value='{$entry["id"]}'>{$entry["name"]}</option>"; } $movelist = "<select name='destcat' size='1'>{$movelist}</select>"; print format("\n\t\t\t\t<tr class=\"header1\">\n\t\t\t\t\t<th style=\"text-align: right;\" colspan=\"6\">\n\t\t\t\t\t\t<input type=\"hidden\" id='actionfield' name=\"action\" value=\"multidel\" />\n\t\t\t\t\t\t<a href=\"javascript:void();\" onclick=\"document.getElementById('actionfield').value = 'multidel'; document.forms[1].submit();\">" . __("delete checked") . "</a>\n\t\t\t\t\t\t<a href=\"javascript:void();\" onclick=\"document.getElementById('actionfield').value = 'multimove'; document.forms[1].submit();\">" . __("Move checked to") . "</a>{$movelist}\n\t\t\t\t\t</th>\n\t\t\t\t</tr>"); } print "</table>"; } }
<?php if (Settings::pluginGet('showlink')) { print actionLinkTagItem(__("Minecraft stats"), "minestats"); }
function listPlugin($plugin, $plugindata) { global $cell, $plugins, $loguser, $pluginsDb; print '<tr class="cell' . $cell . '"><td>'; print "<b>" . $plugindata["name"] . "</b><br>"; if ($plugindata["author"]) { $author = '<br />' . __("Made by:") . " " . $plugindata["author"]; } print '<span style="display:block;margin-left:30px;">' . $plugindata["description"] . $author . '</span>'; print '</td><td>'; print '<ul class="pipemenu">'; $text = __("Enable"); $act = "enable"; if (isset($pluginsDb[$plugin])) { $text = __("Disable"); $act = "disable"; } print actionLinkTagItem($text, "pluginmanager", $plugin, "action=" . $act . "&key=" . $loguser['token']); if (in_array("settingsfile", $plugindata["buckets"])) { if (isset($plugins[$plugin])) { print actionLinkTagItem(__("Settings…"), "editsettings", $plugin); } } print '</ul>'; print '</td></tr>'; $cell++; $cell %= 2; }
} } if ($year == 2012 && $month == 12) { $cells[21] .= '<br>• <span style="color:red;font-weight:bold;text-decoration:blink;">THE END OF THE WORLD</span>'; $cells[22] .= '<br>• Laugh at those who actually believed it'; } $cellClass = 0; while ($i <= $max) { $grid .= format("\n\t<tr>\n"); for ($dn = 0; $dn <= 6; $dn++) { $dd = $i + $dn; if ($dd < 1 || $dd > $max) { $label = ""; } else { $label = format("\n\t\t\t{0}\n\t\t\t{1}", $dd, $cells[$dd]); } $grid .= format("\n\t\t<td class=\"cell{2} smallFonts\" style=\"height: 80px; vertical-align: top;\">\n\t\t\t{1}\n\t\t</td>\n", $cellClass, $label, $label == "" ? 1 : 0); $cellClass = ($cellClass + 1) % 2; } $grid .= format("\n\t</tr>\n"); $i += 7; } $monthChoice = ""; for ($i = 1; $i <= 12; $i++) { if ($i == $month) { $monthChoice .= format("<li>{0}</li>", $months[$i]); } else { $monthChoice .= actionLinkTagItem($months[$i], "calendar", 0, "month={$i}"); } } write("\n<table class=\"outline margin\">\n\t<tr class=\"header0\">\n\t\t<th colspan=\"7\">\n\t\t\t{0} {1}\n\t\t</th>\n\t</tr>\n\t<tr class=\"header1\">\n\t\t<th {3}>" . $days[1] . "</th>\n\t\t<th {3}>" . $days[2] . "</th>\n\t\t<th {3}>" . $days[3] . "</th>\n\t\t<th {3}>" . $days[4] . "</th>\n\t\t<th {3}>" . $days[5] . "</th>\n\t\t<th {3}>" . $days[6] . "</th>\n\t\t<th {3}>" . $days[7] . "</th>\n\t</tr>\n\t{2}\n\t<tr>\n\t\t<td class=\"cell2 smallFonts center\" colspan=\"7\">\n\t\t\t<ul class=\"pipemenu\">\n\t\t\t\t{4}\n\t\t\t</ul>\n\t\t</td>\n\t</tr>\n</table>\n", $months[$month], $year, $grid, "style=\"width: 14.3%;\"", $monthChoice);
Kill('You may not ' . ($page['new'] == 2 ? 'create pages.' : 'edit this page.')); } if ($page['flags'] & WIKI_PFLAG_DELETED && !HasPermission('wiki.deletepages')) { Kill('This page has been deleted.'); } $urltitle = $ptitle; //urlencode($ptitle); $nicetitle = htmlspecialchars(url2title($ptitle)); $title = 'Wiki » ' . ($page['new'] == 2 ? 'New page' : 'Editing: ' . $nicetitle); if ($page['new'] != 2) { if ($page['istalk']) { $links .= actionLinkTagItem('Page', 'wiki', substr($urltitle, 5)) . '<li>Discuss</li>'; } else { $links .= '<li>Page</li>' . actionLinkTagItem('Discuss', 'wiki', 'Talk:' . $urltitle); } $links .= actionLinkTagItem('View', 'wiki', $urltitle); } if (isset($_POST['saveaction'])) { if ($_POST['token'] !== $token) { die('No.'); } if ($page['new'] == 2 && !$ptitle) { Kill('Enter a title and try again.'); } $rev = $page['revision']; $flags = $page['flags']; setflag($flags, WIKI_PFLAG_NOCONTBOX, $_POST['nocontbox']); if (HasPermission('wiki.makepagesspecial')) { setflag($flags, WIKI_PFLAG_SPECIAL, $_POST['special']); } if (HasPermission('wiki.deletepages')) {