本文整理汇总了PHP中getDataPrefix函数的典型用法代码示例。如果您正苦于以下问题:PHP getDataPrefix函数的具体用法?PHP getDataPrefix怎么用?PHP getDataPrefix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getDataPrefix函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FormatNotif_PM
function FormatNotif_PM($id, $args)
{
global $loguserid;
$staffpm = '';
if (HasPermission('admin.viewstaffpms')) {
$staffpm = ' OR p.userto=-1';
}
$pm = Fetch(Query("\tSELECT \n\t\t\t\t\t\t\tp.id,\n\t\t\t\t\t\t\tpt.title pmtitle, \n\t\t\t\t\t\t\tu.(_userfields) \n\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\t{pmsgs} p \n\t\t\t\t\t\t\tLEFT JOIN {pmsgs_text} pt ON pt.pid=p.id \n\t\t\t\t\t\t\tLEFT JOIN {users} u ON u.id=p.userfrom \n\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\tp.id={0} AND (p.userto={1}{$staffpm})", $id, $loguserid));
$userdata = getDataPrefix($pm, 'u_');
return __('New private message from ') . UserLink($userdata) . "\n" . actionLinkTag(htmlspecialchars($pm['pmtitle']), 'showprivate', $pm['id']);
}
示例2: doThreadPreview
function doThreadPreview($tid)
{
global $mobileLayout;
if ($mobileLayout) {
return;
}
$rPosts = Query("\n\t\tselect\n\t\t\t{posts}.id, {posts}.date, {posts}.num, {posts}.deleted, {posts}.options, {posts}.mood, {posts}.ip,\n\t\t\t{posts_text}.text, {posts_text}.text, {posts_text}.revision,\n\t\t\tu.(_userfields)\n\t\tfrom {posts}\n\t\tleft join {posts_text} on {posts_text}.pid = {posts}.id and {posts_text}.revision = {posts}.currentrevision\n\t\tleft join {users} u on u.id = {posts}.user\n\t\twhere thread={0} and deleted=0\n\t\torder by date desc limit 0, 20", $tid);
if (NumRows($rPosts)) {
$posts = "";
while ($post = Fetch($rPosts)) {
$cellClass = ($cellClass + 1) % 2;
$poster = getDataPrefix($post, "u_");
$nosm = $post['options'] & 2;
$nobr = $post['options'] & 4;
$posts .= Format("\n\t\t\t<tr>\n\t\t\t\t<td class=\"cell2\" style=\"width: 15%; vertical-align: top;\">\n\t\t\t\t\t{1}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"cell{0}\">\n\t\t\t\t\t<button style=\"float: right;\" onclick=\"insertQuote({2});\">" . __("Quote") . "</button>\n\t\t\t\t\t<button style=\"float: right;\" onclick=\"insertChanLink({2});\">" . __("Link") . "</button>\n\t\t\t\t\t{3}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t", $cellClass, UserLink($poster), $post['id'], CleanUpPost($post['text'], $poster['name'], $nosm));
}
Write("\n\t\t<table class=\"outline margin\">\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"2\">" . __("Thread review") . "</th>\n\t\t\t</tr>\n\t\t\t{0}\n\t\t</table>\n\t", $posts);
}
}
示例3: getBirthdaysText
function getBirthdaysText()
{
$rBirthdays = Query("select u.birthday, u.(_userfields) from {users} u where birthday > 0 and powerlevel >= 0 order by name");
$birthdays = array();
while ($user = Fetch($rBirthdays)) {
$b = $user['birthday'];
if (gmdate("m-d", $b) == gmdate("m-d")) {
$y = gmdate("Y") - gmdate("Y", $b);
$birthdays[] = UserLink(getDataPrefix($user, "u_")) . " (" . $y . ")";
}
}
if (count($birthdays)) {
$birthdaysToday = implode(", ", $birthdays);
}
if ($birthdaysToday) {
return "<br>" . __("Birthdays today:") . " " . $birthdaysToday;
} else {
return "";
}
}
示例4: OnlineUsers
function OnlineUsers($forum = 0, $update = true)
{
global $loguserid;
$forumClause = "";
$browseLocation = __("online");
if ($update) {
if ($loguserid) {
Query("UPDATE {users} SET lastforum={0} WHERE id={1}", $forum, $loguserid);
} else {
Query("UPDATE {guests} SET lastforum={0} WHERE ip={1}", $forum, $_SERVER['REMOTE_ADDR']);
}
}
if ($forum) {
$forumClause = " and lastforum={1}";
$forumName = FetchResult("SELECT title FROM {forums} WHERE id={0}", $forum);
$browseLocation = format(__("browsing {0}"), $forumName);
}
$rOnlineUsers = Query("select u.(_userfields) from {users} u where (lastactivity > {0} or lastposttime > {0}) and loggedin = 1 " . $forumClause . " order by name", time() - 300, $forum);
$onlineUserCt = 0;
$onlineUsers = "";
while ($user = Fetch($rOnlineUsers)) {
$user = getDataPrefix($user, "u_");
$userLink = UserLink($user, true);
$onlineUsers .= ($onlineUserCt ? ", " : "") . $userLink;
$onlineUserCt++;
}
//$onlineUsers = $onlineUserCt." "user".(($onlineUserCt > 1 || $onlineUserCt == 0) ? "s" : "")." ".$browseLocation.($onlineUserCt ? ": " : ".").$onlineUsers;
$onlineUsers = Plural($onlineUserCt, __("user")) . " " . $browseLocation . ($onlineUserCt ? ": " : ".") . $onlineUsers;
$data = Fetch(Query("select \n\t\t(select count(*) from {guests} where bot=0 and date > {0} {$forumClause}) as guests,\n\t\t(select count(*) from {guests} where bot=1 and date > {0} {$forumClause}) as bots\n\t\t", time() - 300, $forum));
$guests = $data["guests"];
$bots = $data["bots"];
if ($guests) {
$onlineUsers .= " | " . Plural($guests, __("guest"));
}
if ($bots) {
$onlineUsers .= " | " . Plural($bots, __("bot"));
}
// $onlineUsers = "<div style=\"display: inline-block; height: 16px; overflow: hidden; padding: 0px; line-height: 16px;\">".$onlineUsers."</div>";
return $onlineUsers;
}
示例5: __
<?php
// AcmlmBoard XD - Frequently Asked Questions page
// Access: all
if (!defined('BLARG')) {
die;
}
$title = __("FAQ");
$links = array();
if (HasPermission('admin.editsettings')) {
$links[] = actionLinkTag(__("Edit the FAQ"), "editsettings", '', 'field=faqText');
}
MakeCrumbs(array(actionLink("faq") => __("FAQ")), $links);
makeThemeArrays();
$admin = Fetch(Query("select u.(_userfields) from {users} u where u.primarygroup={0}", Settings::get('rootGroup')));
$admin = userLink(getDataPrefix($admin, 'u_'));
$sexes = array(0 => __("Male"), 1 => __("Female"), 2 => __("N/A"));
$scolors = array(0 => 'color_male', 1 => 'color_female', 2 => 'color_unspec');
$gcolors = array();
$g = Query("SELECT title, color_male, color_female, color_unspec FROM {usergroups} WHERE type=0 ORDER BY rank");
while ($group = Fetch($g)) {
$gcolors[] = $group;
}
$headers = "";
$colors = "";
foreach ($sexes as $ss) {
$headers .= format("\n\t<th>\n\t\t{0}\n\t</th>\n", $ss);
}
foreach ($gcolors as $g) {
$cellClass = ($cellClass + 1) % 2;
$items = "";
示例6: cdate
$ts = cdate($mydatefmt, $date);
if ($ts == $today) {
$ts = 'Today';
} else {
if ($ts == $yesterday) {
$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>';
示例7: Kill
$rankset = $_GET['id'];
if (!isset($ranksetData[$rankset])) {
Kill(__("Rankset not found."));
}
$ranksets = array();
foreach ($ranksetNames as $name => $title) {
if ($name == $rankset) {
$ranksets[] = $title;
} else {
$ranksets[] = actionLinkTag($title, 'ranks', $name);
}
}
$users = array();
$rUsers = Query("select u.(_userfields), u.(posts,lastposttime) from {users} u order by id asc");
while ($user = Fetch($rUsers)) {
$users[$user['u_id']] = getDataPrefix($user, "u_");
}
$ranks = $ranksetData[$rankset];
$ranklist = array();
for ($i = 0; $i < count($ranks); $i++) {
$rdata = array();
$rank = $ranks[$i];
$nextRank = $ranks[$i + 1];
if ($nextRank['num'] == 0) {
$nextRank['num'] = $ranks[$i]['num'] + 1;
}
$members = array();
$inactive = 0;
$total = 0;
foreach ($users as $user) {
if ($user['posts'] >= $rank['num'] && $user['posts'] < $nextRank['num']) {
示例8: PipeMenu
<?php
// AcmlmBoard XD - Frequently Asked Questions page
// Access: all
$title = "FAQ";
$links = new PipeMenu();
if ($loguser["powerlevel"] >= 3) {
$links->add(new PipeMenuLinkEntry(__("Edit the FAQ"), "editsettings", "faq"));
}
makeLinks($links);
$crumbs = new PipeMenu();
$crumbs->add(new PipeMenuLinkEntry(__("FAQ"), "faq"));
makeBreadcrumbs($crumbs);
makeThemeArrays();
$admin = Fetch(Query("select u.(_userfields) from {users} u where id = 1"));
$admin = UserLink(getDataPrefix($admin, "u_"));
$sexes = array(0 => __("Male"), 1 => __("Female"), 2 => __("N/A"));
$powerlevels = array(0 => __("Normal user"), 1 => __("Local moderator"), 2 => __("Full moderator"), 3 => __("Administrator"), 4 => __("Root"));
$headers = "";
$colors = "";
foreach ($sexes as $ss) {
$headers .= format("\n\t<th>\n\t\t{0}\n\t</th>\n", $ss);
}
foreach ($powerlevels as $pn => $ps) {
$cellClass = ($cellClass + 1) % 2;
$items = "";
foreach ($sexes as $sn => $ss) {
$items .= format("\n\t<td class=\"center\">\n\t\t<a href=\"javascript:void()\"><span class=\"nc{0}{1}\" style=\"font-weight: bold;\">\n\t\t\t{2}\n\t\t</span></a>\n\t</td>\n", $sn, $pn, $ps);
}
$colors .= format("\n<tr class=\"cell{0}\">\n\t{1}\n</tr>\n", $cellClass, $items);
}
示例9: WriteForumEditContents
function WriteForumEditContents($fid)
{
global $loguser;
//Get all categories.
$rCats = Query("SELECT * FROM {categories} ORDER BY corder, id");
$cats = array();
while ($cat = Fetch($rCats)) {
$cats[$cat['id']] = $cat;
}
$rFora = Query("SELECT * FROM {forums} ORDER BY forder, id");
$fora = array();
while ($forum = Fetch($rFora)) {
$fora[$forum['id']] = $forum;
}
if (count($cats) == 0) {
$cats[0] = __("No categories");
}
if ($fid != -1) {
$rForum = Query("SELECT * FROM {forums} WHERE id={0}", $fid);
if (!NumRows($rForum)) {
Kill(__("Forum not found."));
}
$forum = Fetch($rForum);
$title = htmlspecialchars($forum['title']);
$description = htmlspecialchars($forum['description']);
$catselect = MakeCatSelect('cat', $cats, $fora, $forum['catid'], $forum['id']);
$minpower = PowerSelect('minpower', $forum['minpower']);
$minpowerthread = PowerSelect("minpowerthread", $forum['minpowerthread']);
$minpowerreply = PowerSelect('minpowerreply', $forum['minpowerreply']);
$forder = $forum['forder'];
$func = "changeForumInfo";
$button = __("Save");
$boxtitle = __("Edit Forum");
$delbutton = "\n\t\t\t<button onclick='showDeleteForum(); return false;'>\n\t\t\t\t" . __("Delete") . "\n\t\t\t</button>";
$localmods = "";
$rMods = query("SELECT u.(_userfields)\n\t\t\t\t\t\tFROM {forummods} m\n\t\t\t\t\t\tLEFT JOIN {users} u ON u.id = m.user\n\t\t\t\t\t\tWHERE m.forum={0}\n\t\t\t\t\t\tORDER BY m.user", $fid);
$addedMods = array();
if (!numRows($rMods)) {
$localmods .= "(No local moderators assigned to this forum)<br /><br />";
} else {
$localmods .= "<ul>";
while ($mod = fetch($rMods)) {
$mod = getDataPrefix($mod, "u_");
$localmods .= "<li>" . UserLink($mod);
$mid = $mod["id"];
$addedMods[$mid] = 1;
$localmods .= " <sup><a href=\"\" onclick=\"deleteMod({$mid}); return false;\">✘</a></li>";
}
$localmods .= "</ul>";
}
$rMods = query("SELECT u.(_userfields)\n\t\t\t\t\t\tFROM {users} u\n\t\t\t\t\t\tWHERE u.powerlevel = 1\n\t\t\t\t\t\tORDER BY u.id");
$canAddMods = false;
$addmod = "Add a mod: ";
$addmod .= "<select name=\"addmod\" id=\"addmod\">";
while ($mod = fetch($rMods)) {
$mod = getDataPrefix($mod, "u_");
if (isset($addedMods[$mod["id"]])) {
continue;
}
$canAddMods = true;
$mid = $mod["id"];
$mname = $mod["displayname"];
if (!$mname) {
$mname = $mod["name"];
}
$addmod .= "<option value=\"{$mid}\">{$mname} ({$mid})</option>";
}
$addmod .= "</select>";
$addmod .= "<button type=\"button\" onclick=\"addMod(); return false;\">Add</button>";
if (!$canAddMods) {
$addmod = "<br>No moderators available for adding.<br>To add a mod, set his powerlevel to Local Mod first.";
}
$localmods .= $addmod;
} else {
$title = __("New Forum");
$description = __("Description goes here. <strong>HTML allowed.</strong>");
$catselect = MakeCatSelect('cat', $cats, $fora, 1, -1);
$minpower = PowerSelect('minpower', 0);
$minpowerthread = PowerSelect("minpowerthread", 0);
$minpowerreply = PowerSelect('minpowerreply', 0);
$forder = 0;
$func = "addForum";
$button = __("Add");
$boxtitle = __("New Forum");
$delbutton = "";
$localmods = "(Create the forum before managing mods)";
$privusers = '<small>(create the forum before adding users here)</small>';
}
echo "\n\t<form method=\"post\" id=\"forumform\" action=\"" . actionLink("editfora") . "\">\n\t<input type=\"hidden\" name=\"key\" value=\"" . $loguser['token'] . "\">\n\t<input type=\"hidden\" name=\"id\" value=\"{$fid}\">\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header1\">\n\t\t\t<th colspan=\"2\">\n\t\t\t\t{$boxtitle}\n\t\t\t</th>\n\t\t</tr>\n\t\t<tr class=\"cell1\">\n\t\t\t<td style=\"width: 25%;\">\n\t\t\t\t" . __("Title") . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<input type=\"text\" style=\"width: 98%;\" name=\"title\" value=\"{$title}\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell0\">\n\n\t\t\t<td>\n\t\t\t\t" . __("Description") . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<input type=\"text\" style=\"width: 98%;\" name=\"description\" value=\"{$description}\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell1\">\n\t\t\t<td>\n\t\t\t\t" . __("Parent") . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{$catselect}\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell0\">\n\t\t\t<td>\n\t\t\t\t" . __("Listing order") . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<input type=\"text\" size=\"2\" name=\"forder\" value=\"{$forder}\" />\n\t\t\t\t<img src=\"" . resourceLink("img/icons/icon5.png") . "\" title=\"" . __("Everything is sorted by listing order first, then by ID. If everything has its listing order set to 0, they will therefore be sorted by ID only.") . "\" alt=\"[?]\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell1\">\n\t\t\t<td>\n\t\t\t\t" . __("Powerlevel required") . "\n\t\t\t</td>\n\t\t\t<td>\n\n\t\t\t\t{$minpower}\n\t\t\t\t" . __("to view") . "\n\t\t\t\t<br />\n\t\t\t\t{$minpowerthread}\n\t\t\t\t" . __("to post threads") . "\n\t\t\t\t<br />\n\t\t\t\t{$minpowerreply}\n\t\t\t\t" . __("to reply") . "\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell0\">\n\t\t\t<td>\n\t\t\t\t" . __("Local moderators") . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{$localmods}\n\t\t\t</td>\n\t\t</tr>\n\n\t\t<tr class=\"cell2\">\n\t\t\t<td>\n\t\t\t\t \n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<button onclick=\"{$func}(); return false;\">\n\t\t\t\t\t{$button}\n\t\t\t\t</button>\n\t\t\t\t{$delbutton}\n\t\t\t</td>\n\t\t</tr>\n\t</table></form>\n\n\t<form method=\"post\" id=\"deleteform\" action=\"" . actionLink("editfora") . "\">\n\t<input type=\"hidden\" name=\"key\" value=\"" . $loguser['token'] . "\">\n\t<input type=\"hidden\" name=\"id\" value=\"{$fid}\">\n\t<div id=\"deleteforum\" style=\"display:none\">\n\t\t<table class=\"outline margin\">\n\t\t\t<tr class=\"header1\">\n\n\t\t\t\t<th>\n\t\t\t\t\t" . __("Delete forum") . "\n\t\t\t\t</th>\n\t\t\t</tr>\n\t\t\t<tr class=\"cell0\">\n\t\t\t\t<td>\n\t\t\t\t\t" . __("Instead of deleting a forum, you might want to consider archiving it: Change its name or description to say so, and raise the minimum powerlevel to reply and create threads so it's effectively closed.") . "<br><br>\n\t\t\t\t\t" . __("If you still want to delete it, click below:") . "<br>\n\t\t\t\t\t<button onclick=\"deleteForum('delete'); return false;\">\n\t\t\t\t\t\t" . __("Delete forum") . "\n\t\t\t\t\t</button>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>\n\t</form>";
// , $title, $description, $catselect, $minpower, $minpowerthread, $minpowerreply, $fid, $forder, $loguser['token'], $func, $button, $boxtitle, $delbutton);
}
示例10: Fetch
if (NumRows($rPost)) {
$post = Fetch($rPost);
} else {
die(format(__("Unknown post ID #{0}."), $id) . " " . $hideTricks);
}
$qThread = "select forum from {threads} where id={0}";
$rThread = Query($qThread, $post['thread']);
$thread = Fetch($rThread);
$qForum = "select minpower from {forums} where id={0}";
$rForum = Query($qForum, $thread['forum']);
$forum = Fetch($rForum);
if ($forum['minpower'] > $loguser['powerlevel']) {
die(__("No.") . " " . $hideTricks);
}
$qRevs = "SELECT\n\t\t\trevision, date AS revdate,\n\t\t\tru.(_userfields)\n\t\tFROM\n\t\t\t{posts_text}\n\t\t\tLEFT JOIN {users} ru ON ru.id = user\n\t\tWHERE pid={0}\n\t\tORDER BY revision ASC";
$revs = Query($qRevs, $id);
$reply = __("Show revision:") . "<br>";
while ($revision = Fetch($revs)) {
$reply .= " <a href=\"javascript:void(0)\" onclick=\"showRevision(" . $id . "," . $revision["revision"] . ")\">" . format(__("rev. {0}"), $revision["revision"]) . "</a>";
if ($revision['ru_id']) {
$ru_link = UserLink(getDataPrefix($revision, "ru_"));
$revdetail = " " . format(__("by {0} on {1}"), $ru_link, formatdate($revision['revdate']));
} else {
$revdetail = '';
}
$reply .= $revdetail;
$reply .= "<br>";
}
$hideTricks = " <a href=\"javascript:void(0)\" onclick=\"showRevision(" . $id . "," . $post["currentrevision"] . "); hideTricks(" . $id . ")\">" . __("Back") . "</a>";
$reply .= $hideTricks;
echo $reply;
示例11: makePost
function makePost($post, $type, $params = array())
{
global $loguser, $loguserid, $usergroups, $isBot, $blocklayouts;
$poster = getDataPrefix($post, 'u_');
$post['userlink'] = UserLink($poster);
LoadBlockLayouts();
$pltype = Settings::get('postLayoutType');
$isBlocked = $poster['globalblock'] || $loguser['blocklayouts'] || $post['options'] & 1 || isset($blocklayouts[$poster['id']]);
$post['type'] = $type;
$post['formattedDate'] = formatdate($post['date']);
if (!HasPermission('admin.viewips')) {
$post['ip'] = '';
} else {
$post['ip'] = htmlspecialchars($post['ip']);
}
// TODO IP formatting?
if ($post['deleted'] && $type == POST_NORMAL) {
$post['deluserlink'] = UserLink(getDataPrefix($post, 'du_'));
$post['delreason'] = htmlspecialchars($post['reason']);
$links = array();
if (HasPermission('mod.deleteposts', $params['fid'])) {
$links['undelete'] = actionLinkTag(__("Undelete"), "editpost", $post['id'], "delete=2&key=" . $loguser['token']);
$links['view'] = "<a href=\"#\" onclick=\"replacePost(" . $post['id'] . ",true); return false;\">" . __("View") . "</a>";
}
$post['links'] = $links;
RenderTemplate('postbox_deleted', array('post' => $post));
return;
}
$links = array();
if ($type != POST_SAMPLE) {
$forum = $params['fid'];
$thread = $params['tid'];
$notclosed = !$post['closed'] || HasPermission('mod.closethreads', $forum);
$extraLinks = array();
if (!$isBot) {
if ($type == POST_DELETED_SNOOP) {
if ($notclosed && HasPermission('mod.deleteposts', $forum)) {
$links['undelete'] = actionLinkTag(__("Undelete"), "editpost", $post['id'], "delete=2&key=" . $loguser['token']);
}
$links['close'] = "<a href=\"#\" onclick=\"replacePost(" . $post['id'] . ",false); return false;\">" . __("Close") . "</a>";
} else {
if ($type == POST_NORMAL) {
if ($notclosed) {
if ($loguserid && HasPermission('forum.postreplies', $forum) && !$params['noreplylinks']) {
$links['quote'] = actionLinkTag(__("Quote"), "newreply", $thread, "quote=" . $post['id']);
}
$editrights = 0;
if ($poster['id'] == $loguserid && HasPermission('user.editownposts') || HasPermission('mod.editposts', $forum)) {
$links['edit'] = actionLinkTag(__("Edit"), "editpost", $post['id']);
$editrights++;
}
if ($poster['id'] == $loguserid && HasPermission('user.deleteownposts') || HasPermission('mod.deleteposts', $forum)) {
if ($post['id'] != $post['firstpostid']) {
$link = htmlspecialchars(actionLink('editpost', $post['id'], 'delete=1&key=' . $loguser['token']));
$onclick = HasPermission('mod.deleteposts', $forum) ? " onclick=\"deletePost(this);return false;\"" : ' onclick="if(!confirm(\'Really delete this post?\'))return false;"';
$links['delete'] = "<a href=\"{$link}\"{$onclick}>" . __('Delete') . "</a>";
}
$editrights++;
}
if ($editrights < 2 && HasPermission('user.reportposts')) {
$links['report'] = actionLinkTag(__('Report'), 'reportpost', $post['id']);
}
}
// plugins should add to $extraLinks
$bucket = "topbar";
include __DIR__ . "/pluginloader.php";
}
}
$links['extra'] = $extraLinks;
}
//Threadlinks for listpost.php
if ($params['threadlink']) {
$thread = array();
$thread['id'] = $post['thread'];
$thread['title'] = $post['threadname'];
$thread['forum'] = $post['fid'];
$post['threadlink'] = makeThreadLink($thread);
} else {
$post['threadlink'] = '';
}
//Revisions
if ($post['revision']) {
$ru_link = UserLink(getDataPrefix($post, "ru_"));
$revdetail = ' ' . format(__('by {0} on {1}'), $ru_link, formatdate($post['revdate']));
if (HasPermission('mod.editposts', $forum)) {
$post['revdetail'] = "<a href=\"javascript:void(0);\" onclick=\"showRevisions(" . $post['id'] . ")\">" . Format(__('rev. {0}'), $post['revision']) . "</a>" . $revdetail;
} else {
$post['revdetail'] = Format(__('rev. {0}'), $post['revision']) . $revdetail;
}
}
//</revisions>
}
$post['links'] = $links;
// POST SIDEBAR
$sidebar = array();
// quit abusing custom syndromes you unoriginal fuckers
$poster['title'] = preg_replace('@Affected by \'?.*?Syndrome\'?@si', '', $poster['title']);
$sidebar['rank'] = GetRank($poster['rankset'], $poster['posts']);
if ($poster['title']) {
$sidebar['title'] = strip_tags(CleanUpPost($poster['title'], '', true), '<b><strong><i><em><span><s><del><img><a><br/><br><small>');
//.........这里部分代码省略.........
示例12: array
<?php
$c = 1;
$ulcache = array();
foreach ($passmatches as $uid => $match) {
if (!$ulcache[$uid]) {
$userdata = Fetch(Query("SELECT u.(_userfields) FROM {users} u WHERE u.id={0}", $uid));
$userdata = getDataPrefix($userdata, 'u_');
$ulcache[$uid] = $userdata;
}
$ul1 = userLink($ulcache[$uid]);
$date = formatdate($match['m_date']);
$users = explode(',', $match['m_matches']);
$userlist = '';
foreach ($users as $u) {
if (!$ulcache[$u]) {
$userdata = Fetch(Query("SELECT u.(_userfields) FROM {users} u WHERE u.id={0}", $u));
$userdata = getDataPrefix($userdata, 'u_');
$ulcache[$u] = $userdata;
}
$userlist .= userLink($ulcache[$u]) . ', ';
}
$userlist = substr($userlist, 0, -2);
echo '
<tr class="cell' . $c . '">
<td class="center">' . $date . '</td>
<td>' . $ul1 . ', ' . $userlist . '</td>
</tr>';
$c = $c == 1 ? 2 : 1;
}
?>
</table>
示例13: Query
$realLen = $cpp;
if ($realFrom < 0) {
$realLen += $realFrom;
$realFrom = 0;
}
$rComments = Query("SELECT\n\t\tu.(_userfields),\n\t\t{usercomments}.id, {usercomments}.cid, {usercomments}.text\n\t\tFROM {usercomments}\n\t\tLEFT JOIN {users} u ON u.id = {usercomments}.cid\n\t\tWHERE uid={0}\n\t\tORDER BY {usercomments}.date ASC LIMIT {1u},{2u}", $id, $realFrom, $realLen);
$pagelinks = PageLinksInverted(actionLink($mobileLayout ? "usercomments" : "profile", $id, "from="), $cpp, $from, $total);
$commentList = "";
$commentField = "";
if (NumRows($rComments)) {
while ($comment = Fetch($rComments)) {
if ($canDeleteComments) {
$deleteLink = "<small style=\"float: right; margin: 0px 4px;\">" . actionLinkTag("✘", $mobileLayout ? "usercomments" : "profile", $id, "action=delete&cid=" . $comment['id'] . "&token={$loguser['token']}") . "</small>";
}
$cellClass = ($cellClass + 1) % 2;
$thisComment = format("\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"cell2\">\n\t\t\t\t\t\t\t\t{0}\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"cell{1}\">\n\t\t\t\t\t\t\t\t{3}{2}\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n", UserLink(getDataPrefix($comment, "u_")), $cellClass, CleanUpPost($comment['text'], $comment['u_name']), $deleteLink);
$commentList = $commentList . $thisComment;
if (!isset($lastCID)) {
$lastCID = $comment['cid'];
}
}
$pagelinks = "<td colspan=\"2\" class=\"cell1\">{$pagelinks}</td>";
if ($total > $cpp) {
$commentList = "{$pagelinks}{$commentList}{$pagelinks}";
}
} else {
$commentsWasEmpty = true;
$commentList = $thisComment = format("\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"cell0\" colspan=\"2\">\n\t\t\t\t\t\t\t\t" . __("No comments.") . "\n\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n");
}
//print "lastCID: ".$lastCID;
if ($loguserid) {
示例14: Query
$from = (int) $_GET['from'];
} else {
$from = 0;
}
$tpp = 5;
print "<h2 style='text-align:center;'>Latest News</h2>";
$rThreads = Query("\tSELECT\n\t\t\t\t\t\tt.id, t.title, t.closed, t.replies, t.lastpostid,\n\t\t\t\t\t\tp.date, p.options,\n\t\t\t\t\t\tpt.text,\n\t\t\t\t\t\tsu.(_userfields),\n\t\t\t\t\t\tlu.(_userfields)\n\t\t\t\t\tFROM\n\t\t\t\t\t\t{threads} t\n\t\t\t\t\t\tLEFT JOIN {posts} p ON p.id=t.firstpostid\n\t\t\t\t\t\tLEFT JOIN {posts_text} pt ON pt.pid = p.id AND pt.revision = p.currentrevision\n\t\t\t\t\t\tLEFT JOIN {users} su ON su.id=t.user\n\t\t\t\t\t\tLEFT JOIN {users} lu ON lu.id=t.lastposter\n\t\t\t\t\tWHERE forum={0}\n\t\t\t\t\tORDER BY sticky DESC, date DESC LIMIT {1u}, {2u}", $fid, $from, $tpp);
$numonpage = NumRows($rThreads);
$pagelinks = PageLinks(actionLink("blog", "", "from="), $tpp, $from, $total);
if ($pagelinks && $_GET["from"]) {
Write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks);
}
$haveStickies = 0;
while ($thread = Fetch($rThreads)) {
$starter = getDataPrefix($thread, "su_");
$last = getDataPrefix($thread, "lu_");
$tags = ParseThreadTags($thread['title']);
if ($thread['sticky'] && $haveStickies == 0) {
$haveStickies = 1;
}
$lastLink = "";
if ($thread['lastpostid']) {
$lastLink = " " . actionLinkTag("»", "post", $thread['lastpostid']);
}
if ($thread['replies'] == 0) {
$lastLink = "";
}
$subtitle = strip_tags($thread['subtitle']);
if ($subtitle != "") {
$subtitle = '<br>' . $subtitle;
}
示例15: getdate
$now = getdate(time());
$year = $now['year'];
$month = $now['mon'];
$day = $now['mday'];
if ((int) $_GET['month']) {
$month = (int) $_GET['month'];
$day = 0;
}
$d = getdate(mktime(0, 0, 0, $month, 1, $year));
$i = 1 - $d['wday'];
$d = getdate(mktime(0, 0, 0, $month + 1, 0, $year));
$max = $d['mday'];
$users = Query("select u.(_userfields), u.birthday as u_birthday from {users} u where birthday != 0 order by name");
$cells = array();
while ($user = Fetch($users)) {
$user = getDataPrefix($user, "u_");
$d = getdate($user['birthday']);
if ($d['mon'] == $month) {
$dd = $d['mday'];
$age = $year - $d['year'];
$cells[$dd] .= "<br />• " . format(__("{0}'s birthday ({1})"), Userlink($user), $age) . "\n";
}
}
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++) {