コード例 #1
0
ファイル: pl_PL.php プロジェクト: knytrune/ABXD
function Plural($i, $s)
{
    $wordto2 = array('użytkownik' => 'użytkowników', 'godziny' => 'godzin', 'użytkownika' => 'użytkowników', 'prywatną wiadomość' => 'prywatne wiadomości', 'post' => 'posty', 'temat' => 'tematy', 'plik' => 'pliki', 'MySQL query' => 'MySQL queries', 'nową <a href="' . actionLink("private") . '">prywatną wiadomość' => 'nowe <a href="' . actionLink("private") . '">prywatne wiadomości', 'gość' => 'gości', 'bot' => 'boty', 'nowy post' => 'nowe posty', 'year' => 'years', 'zapytanie MySQL' => 'zapytania MySQL');
    $wordto5 = array('użytkownik' => 'użytkowników', 'godziny' => 'godzin', 'użytkownika' => 'użytkowników', 'post' => 'postów', 'temat' => 'tematów', 'prywatną wiadomość' => 'prywatnych wiadomości', 'plik' => 'plików', 'MySQL query' => 'MySQL queries', 'nową <a href="private.php">prywatną wiadomość' => 'nowych <a href="private.php">prywatnych wiadomości', 'gość' => 'gości', 'bot' => 'botów', 'nowy post' => 'nowe postów', 'year' => 'years', 'zapytanie MySQL' => 'zapytań MySQL');
    if ($i > 1 && $i < 5) {
        // from two to four
        if (isset($wordto2[$s])) {
            $s = $wordto2[$s];
        }
    } elseif ($i > 4 || $i < 1) {
        // 0 and 5+ makes other form
        if (isset($wordto5[$s])) {
            $s = $wordto5[$s];
        }
    }
    return $i . " " . $s;
}
コード例 #2
0
ファイル: lib.php プロジェクト: Servault/Blargboard
function uploadFile($file, $cattype, $cat)
{
    global $loguserid, $uploaddirs, $goodfiles, $badfiles, $userquota, $maxSize;
    $targetdir = $uploaddirs[$cattype];
    $totalsize = foldersize($targetdir);
    $filedata = $_FILES[$file];
    $c = FetchResult("SELECT COUNT(*) FROM {uploader} WHERE filename={0} AND cattype={1} AND user={2} AND deldate=0", $filedata['name'], $cattype, $loguserid);
    if ($c > 0) {
        return "You already have a file with this name. Please delete the old copy before uploading a new one.";
    }
    if ($filedata['size'] == 0) {
        if ($filedata['tmp_name'] == '') {
            return 'No file given.';
        } else {
            return 'File is empty.';
        }
    }
    if ($filedata['size'] > $maxSize) {
        return 'File is too large. Maximum size allowed is ' . BytesToSize($maxSize) . '.';
    }
    $randomid = Shake();
    $pname = $randomid . '_' . Shake();
    $fname = $_FILES['newfile']['name'];
    $temp = $_FILES['newfile']['tmp_name'];
    $size = $_FILES['size']['size'];
    $parts = explode(".", $fname);
    $extension = end($parts);
    if ($totalsize + $size > $quot) {
        Alert(format(__("Uploading \"{0}\" would break the quota."), $fname));
    } else {
        if (in_array(strtolower($extension), $badfiles) || is_array($goodfiles) && !in_array(strtolower($extension), $goodfiles)) {
            return 'Forbidden file type.';
        } else {
            $description = $_POST['description'];
            $big_descr = $cat['showindownloads'] ? $_POST['big_description'] : '';
            Query("insert into {uploader} (id, filename, description, big_description, date, user, private, category, deldate, physicalname) values ({7}, {0}, {1}, {6}, {2}, {3}, {4}, {5}, 0, {8})", $fname, $description, time(), $loguserid, $privateFlag, $_POST['cat'], $big_descr, $randomid, $pname);
            copy($temp, $targetdir . "/" . $pname);
            Report("[b]" . $loguser['name'] . "[/] uploaded file \"[b]" . $fname . "[/]\"" . ($privateFlag ? " (privately)" : ""), $privateFlag);
            die(header("Location: " . actionLink("uploaderlist", "", "cat=" . $_POST["cat"])));
        }
    }
}
コード例 #3
0
ファイル: userpanel.php プロジェクト: Servault/Blargboard
<?php

if (!defined('BLARG')) {
    die;
}
$userMenu = array();
if ($loguserid) {
    if (HasPermission('user.editprofile')) {
        $userMenu[actionLink('editprofile')] = __('Edit profile');
        if (HasPermission('user.editavatars')) {
            $userMenu[actionLink('editavatars')] = __('Mood avatars');
        }
    }
    $userMenu[actionLink('private')] = __('Private messages');
    $userMenu[actionLink('favorites')] = __('Favorites');
    $bucket = 'userMenu';
    include __DIR__ . "/../lib/pluginloader.php";
}
$layout_userpanel = $userMenu;
コード例 #4
0
ファイル: newreply.php プロジェクト: Servault/Blargboard
if ($_POST['mood']) {
    $moodSelects[(int) $_POST['mood']] = "selected=\"selected\" ";
}
$moodOptions = "<option " . $moodSelects[0] . "value=\"0\">" . __("[Default avatar]") . "</option>\n";
$rMoods = Query("select mid, name from {moodavatars} where uid={0} order by mid asc", $loguserid);
while ($mood = Fetch($rMoods)) {
    $moodOptions .= format("\n\t<option {0} value=\"{1}\">{2}</option>\n", $moodSelects[$mood['mid']], $mood['mid'], htmlspecialchars($mood['name']));
}
$ninja = FetchResult("select id from {posts} where thread={0} order by date desc limit 0, 1", $tid);
$mod_lock = '';
if (HasPermission('mod.closethreads', $fid)) {
    if (!$thread['closed']) {
        $mod_lock = "<label><input type=\"checkbox\" " . getCheck("lock") . " name=\"lock\">&nbsp;" . __("Close thread", 1) . "</label>\n";
    } else {
        $mod_lock = "<label><input type=\"checkbox\" " . getCheck("unlock") . "  name=\"unlock\">&nbsp;" . __("Open thread", 1) . "</label>\n";
    }
}
$mod_stick = '';
if (HasPermission('mod.stickthreads', $fid)) {
    if (!$thread['sticky']) {
        $mod_stick = "<label><input type=\"checkbox\" " . getCheck("stick") . "  name=\"stick\">&nbsp;" . __("Sticky", 1) . "</label>\n";
    } else {
        $mod_stick = "<label><input type=\"checkbox\" " . getCheck("unstick") . "  name=\"unstick\">&nbsp;" . __("Unstick", 1) . "</label>\n";
    }
}
$fields = array('text' => "<textarea id=\"text\" name=\"text\" rows=\"16\">\n{$prefill}</textarea>", 'mood' => "<select size=1 name=\"mood\">" . $moodOptions . "</select>", 'nopl' => "<label><input type=\"checkbox\" " . getCheck('nopl') . " name=\"nopl\">&nbsp;" . __("Disable post layout", 1) . "</label>", 'nosm' => "<label><input type=\"checkbox\" " . getCheck('nosm') . " name=\"nosm\">&nbsp;" . __("Disable smilies", 1) . "</label>", 'lock' => $mod_lock, 'stick' => $mod_stick, 'btnPost' => "<input type=\"submit\" name=\"actionpost\" value=\"" . __("Post") . "\">", 'btnPreview' => "<input type=\"submit\" name=\"actionpreview\" value=\"" . __("Preview") . "\">");
echo "\n\t<form name=\"postform\" action=\"" . htmlentities(actionLink("newreply", $tid)) . "\" method=\"post\" enctype=\"multipart/form-data\">\n\t\t<input type=\"hidden\" name=\"ninja\" value=\"{$ninja}\">";
RenderTemplate('form_newreply', array('fields' => $fields));
PostAttachForm($attachs);
echo "\n\t\t</form>\n\t<script type=\"text/javascript\">\n\t\tdocument.postform.text.focus();\n\t</script>\n";
doThreadPreview($tid);
コード例 #5
0
		<input type="text" name="pollOption[' . $i . ']" value="' . $opttext . '" size=48 maxlength=40>
		&nbsp;Color: <input type="text" name="pollColor[' . $i . ']" value="' . $color . '" size=10 maxlength=7 class="color {hash:true,required:false,pickerFaceColor:\'black\',pickerFace:3,pickerBorder:0,pickerInsetColor:\'black\',pickerPosition:\'left\',pickerMode:\'HVS\'}">
		&nbsp; <input type="submit" name="pollRemove[' . $i . ']" value="&#xD7;" onclick="removeOption(this.parentNode);return false;">
	</div>';
    }
}
$pollSettings .= '</div>';
$pollSettings .= '<input type="submit" name="pollAdd" value="' . __('Add option') . '" onclick="addOption();return false;">';
$moodSelects = array();
if ($_POST['mood']) {
    $moodSelects[(int) $_POST['mood']] = "selected=\"selected\" ";
}
$moodOptions = "<option " . $moodSelects[0] . "value=\"0\">" . __("[Default avatar]") . "</option>\n";
$rMoods = Query("select mid, name from {moodavatars} where uid={0} order by mid asc", $loguserid);
while ($mood = Fetch($rMoods)) {
    $moodOptions .= format("\n\t<option {0} value=\"{1}\">{2}</option>\n", $moodSelects[$mood['mid']], $mood['mid'], htmlspecialchars($mood['name']));
}
$mod_lock = '';
$mod_stick = '';
if (HasPermission('mod.closethreads', $forum['id'])) {
    $mod_lock = "<label><input type=\"checkbox\" " . getCheck("lock") . " name=\"lock\">&nbsp;" . __("Close thread", 1) . "</label>\n";
}
if (HasPermission('mod.stickthreads', $forum['id'])) {
    $mod_stick = "<label><input type=\"checkbox\" " . getCheck("stick") . "  name=\"stick\">&nbsp;" . __("Sticky", 1) . "</label>\n";
}
$fields = array('title' => "<input type=\"text\" name=\"title\" size=80 maxlength=\"60\" value=\"{$trefill}\">", 'icon' => $iconSettings, 'pollQuestion' => "<input type=\"text\" name=\"pollQuestion\" value=\"" . htmlspecialchars($_POST['pollQuestion']) . "\" size=80 maxlength=\"100\">", 'pollOptions' => $pollSettings, 'pollMultivote' => "<label><input type=\"checkbox\" " . ($_POST['multivote'] ? "checked=\"checked\"" : "") . " name=\"multivote\">&nbsp;" . __("Multivote", 1) . "</label>", 'text' => "<textarea id=\"text\" name=\"text\" rows=\"16\">\n{$prefill}</textarea>", 'mood' => "<select size=1 name=\"mood\">" . $moodOptions . "</select>", 'nopl' => "<label><input type=\"checkbox\" " . getCheck('nopl') . " name=\"nopl\">&nbsp;" . __("Disable post layout", 1) . "</label>", 'nosm' => "<label><input type=\"checkbox\" " . getCheck('nosm') . " name=\"nosm\">&nbsp;" . __("Disable smilies", 1) . "</label>", 'lock' => $mod_lock, 'stick' => $mod_stick, 'btnPost' => "<input type=\"submit\" name=\"actionpost\" value=\"" . __("Post") . "\">", 'btnPreview' => "<input type=\"submit\" name=\"actionpreview\" value=\"" . __("Preview") . "\">", 'btnAddPoll' => "<input type=\"submit\" name=\"addpoll\" value=\"" . __("Add poll") . "\" onclick=\"addPoll();return false;\">", 'btnRemovePoll' => "<input type=\"submit\" name=\"deletepoll\" value=\"" . __("Remove poll") . "\" onclick=\"removePoll();return false;\">");
echo "\n\t<script src=\"" . resourceLink("js/threadtagging.js") . "\"></script>\n\t<script src=\"" . resourceLink('js/polleditor.js') . "\"></script>\n\t<form name=\"postform\" action=\"" . htmlentities(actionLink("newthread", $fid)) . "\" method=\"post\" enctype=\"multipart/form-data\">";
RenderTemplate('form_newthread', array('fields' => $fields, 'pollMode' => (int) $_POST['poll']));
PostAttachForm($attachs);
echo "\n\t\t<input type=\"hidden\" name=\"poll\" id=\"pollModeVal\" value=\"" . (int) $_POST['poll'] . "\">\n\t</form>\n\t<script type=\"text/javascript\">\n\t\tdocument.postform.text.focus();\n\t</script>\n";
LoadPostToolbar();
コード例 #6
0
<?php

$viewableforums = ForumsWithPermission('forum.viewforum');
$tag = $_GET['tag'];
$tagcode = '"[' . $tag . ']"';
$forum = $_GET['fid'];
$cond = "WHERE MATCH (t.title) AGAINST ({0} IN BOOLEAN MODE)";
if ($forum) {
    $cond .= " AND t.forum = {1}";
}
$total = Fetch(Query("SELECT count(*) from threads t {$cond} AND t.forum IN ({2c})", $tag, $forum, $viewableforums));
$total = $total[0];
$tpp = $loguser['threadsperpage'];
if (isset($_GET['from'])) {
    $from = (int) $_GET['from'];
} else {
    $from = 0;
}
if (!$tpp) {
    $tpp = 50;
}
$rThreads = Query("\tSELECT\n\t\t\t\t\t\tt.*,\n\t\t\t\t\t\tf.(title, id),\n\t\t\t\t\t\t" . ($loguserid ? "tr.date readdate," : '') . "\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\tthreads t\n\t\t\t\t\t\t" . ($loguserid ? "LEFT JOIN threadsread tr ON tr.thread=t.id AND tr.id={2}" : '') . "\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\t\tLEFT JOIN forums f ON f.id=t.forum\n\t\t\t\t\t{$cond} AND f.id IN ({5c})\n\t\t\t\t\tORDER BY sticky DESC, lastpostdate DESC LIMIT {3u}, {4u}", $tagcode, $forum, $loguserid, $from, $tpp, $viewableforums);
$pagelinks = PageLinks(actionLink("tagsearch", "", "tag={$tag}&fid={$forum}&from="), $tpp, $from, $total);
if (NumRows($rThreads)) {
    makeThreadListing($rThreads, $pagelinks, false, !$forum);
} else {
    Alert(format(__("Tag {0} was not found in any thread."), htmlspecialchars($tag)), __("No threads found."));
}
コード例 #7
0
ファイル: editavatars.php プロジェクト: knytrune/ABXD
                            } elseif ($type <= 3) {
                                $r = imagesx($img1) / imagesy($img1);
                                if ($r > 1) {
                                    $img2 = imagecreatetruecolor($dimx, floor($dimy / $r));
                                    imagecopyresampled($img2, $img1, 0, 0, 0, 0, $dimx, $dimy / $r, imagesx($img1), imagesy($img1));
                                } else {
                                    $img2 = imagecreatetruecolor(floor($dimx * $r), $dimy);
                                    imagecopyresampled($img2, $img1, 0, 0, 0, 0, $dimx * $r, $dimy, imagesx($img1), imagesy($img1));
                                }
                                imagepng($img2, $file);
                            } else {
                                $error .= "<li>Invalid format.</li>";
                            }
                        }
                        $usepic = $file;
                    } else {
                        Kill(__("Could not update your avatar for the following reason(s):") . "<ul>" . $error . "</ul>");
                    }
                }
            }
        }
    }
}
$moodRows = "";
$rMoods = Query("select mid, name from {moodavatars} where uid={0} order by mid asc", $loguserid);
while ($mood = Fetch($rMoods)) {
    $cellClass = ($cellClass + 1) % 2;
    $moodRows .= format("\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td style=\"width: 100px;\">\n\t\t\t\t<img src=\"img/avatars/{1}_{2}\" alt=\"\">\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<form method=\"post\" action=\"" . actionLink("editavatars") . "\">\n\t\t\t\t\t<input type=\"hidden\" name=\"mid\" value=\"{2}\" />\n\t\t\t\t\t<input type=\"text\" id=\"name{2}\" name=\"name\" style=\"width: 60%;\" value=\"{3}\" />\n\t\t\t\t\t<input type=\"submit\" name=\"action\" value=\"" . __("Rename") . "\" />\n\t\t\t\t\t<input type=\"submit\" name=\"action\" value=\"" . __("Delete") . "\" />\n\t\t\t\t</form>\n\t\t\t</td>\n\t\t</tr>\n", $cellClass, $loguserid, $mood['mid'], htmlspecialchars($mood['name']));
}
write("\n\t<table class=\"margin outline width50\">\n\t\t<tr class=\"header1\">\n\t\t\t<th colspan=\"2\">\n\t\t\t\t" . __("Mood avatars") . "\n\t\t\t</th>\n\t\t</tr>\n\t\t{0}\n\t\t<tr class=\"header1\">\n\t\t\t<th colspan=\"2\">\n\t\t\t\t" . __("Add new") . "\n\t\t\t</th>\n\t\t</tr>\n\t\t<tr class=\"cell2\">\n\t\t\t<td>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<form method=\"post\" action=\"" . actionLink("editavatars") . "\" enctype=\"multipart/form-data\">\n\t\t\t\t\t<label for=\"newName\">" . __("Name:") . "</label>\n\t\t\t\t\t<input type=\"text\" id=\"newName\" name=\"name\" style=\"width: 60%;\" /><br />\n\n\t\t\t\t\t<label for=\"pic\">" . __("Image:") . "</label>\n\t\t\t\t\t<input type=\"file\" id=\"pic\" name=\"picture\"  style=\"width: 75%;\" />\n\n\t\t\t\t\t<input type=\"submit\" name=\"action\" value=\"" . __("Add") . "\" />\n\t\t\t\t</form>\n\t\t\t</td>\n\t</table>\n", $moodRows);
コード例 #8
0
ファイル: newreply.php プロジェクト: Servault/Blargboard
<?php

if ($isHidden) {
    return;
}
$c1 = ircColor(Settings::pluginGet("color1"));
$c2 = ircColor(Settings::pluginGet("color2"));
$thename = $loguser["name"];
if ($loguser["displayname"]) {
    $thename = $loguser["displayname"];
}
$fpage = ircForumPrefix($forum);
$link = getServerDomainNoSlash() . actionLink("post", $pid);
ircReport("" . $c2 . "New reply by{$c1} " . ircUserColor($thename, $loguser['sex'], 0) . "{$c2}: {$c1}" . $thread["title"] . "{$c2} (" . $fpage . $forum["title"] . ")" . " -- " . $link);
コード例 #9
0
ファイル: editpost.php プロジェクト: knytrune/ABXD
    }
}
if (isset($_POST['actionpreview']) || isset($_POST['actionpost'])) {
    $prefill = $_POST['text'];
    if ($_POST['nopl']) {
        $nopl = "checked=\"checked\"";
    }
    if ($_POST['nosm']) {
        $nosm = "checked=\"checked\"";
    }
} else {
    $prefill = $post['text'];
    if ($post['options'] & 1) {
        $nopl = "checked=\"checked\"";
    }
    if ($post['options'] & 2) {
        $nosm = "checked=\"checked\"";
    }
    $_POST['mood'] = $post['mood'];
}
if ($_POST['mood']) {
    $moodSelects[(int) $_POST['mood']] = "selected=\"selected\" ";
}
$moodOptions = Format("<option {0}value=\"0\">" . __("[Default avatar]") . "</option>\n", $moodSelects[0]);
$rMoods = Query("select mid, name from {moodavatars} where uid={0} order by mid asc", $post['user']);
while ($mood = Fetch($rMoods)) {
    $moodOptions .= Format("<option {0}value=\"{1}\">{2}</option>\n", $moodSelects[$mood['mid']], $mood['mid'], htmlspecialchars($mood['name']));
}
$form = "\n\t<form name=\"postform\" action=\"" . actionLink("editpost") . "\" method=\"post\">\n\t\t<table class=\"outline margin width100\">\n\t\t\t<tr class=\"header1\">\n\t\t\t\t<th colspan=\"2\">\n\t\t\t\t\t" . __("Edit Post") . "\n\t\t\t\t</th>\n\t\t\t</tr>\n\t\t\t<tr class=\"cell0\">\n\t\t\t\t<td colspan=\"2\">\n\t\t\t\t\t<textarea id=\"text\" name=\"text\" rows=\"16\" style=\"width: 98%;\">" . htmlspecialchars($prefill) . "</textarea>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr class=\"cell2\">\n\t\t\t\t<td></td>\n\t\t\t\t<td>\n\t\t\t\t\t<input type=\"submit\" name=\"actionpost\" value=\"" . __("Edit") . "\" />\n\t\t\t\t\t<input type=\"submit\" name=\"actionpreview\" value=\"" . __("Preview") . "\" />\n\t\t\t\t\t<select size=\"1\" name=\"mood\">\n\t\t\t\t\t\t{$moodOptions}\n\t\t\t\t\t</select>\n\t\t\t\t\t<label>\n\t\t\t\t\t\t<input type=\"checkbox\" name=\"nopl\" {$pid} />&nbsp;" . __("Disable post layout", 1) . "\n\t\t\t\t\t</label>\n\t\t\t\t\t<label>\n\t\t\t\t\t\t<input type=\"checkbox\" name=\"nosm\" {$nosm} />&nbsp;" . __("Disable smilies", 1) . "\n\t\t\t\t\t</label>\n\t\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"{$pid}\" />\n\t\t\t\t\t<input type=\"hidden\" name=\"key\" value=\"" . $loguser['token'] . "\" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t</form>";
doPostForm($form);
doThreadPreview($tid);
コード例 #10
0
function forumRedirectURL($redir)
{
    if ($redir[0] == ':') {
        $redir = explode(':', $redir);
        return actionLink($redir[1], $redir[2], $redir[3], $redir[4]);
    } else {
        return $redir;
    }
}
コード例 #11
0
ファイル: listposts.php プロジェクト: knytrune/ABXD
    $from = 0;
}
if (!$ppp) {
    $ppp = 25;
}
$rPosts = Query("\n\tSELECT\n\t\tp.*,\n\t\tpt.text, pt.revision, pt.user AS revuser, pt.date AS revdate,\n\t\tu.(_userfields), u.(rankset,title,picture,posts,postheader,signature,signsep,lastposttime,lastactivity,regdate,globalblock),\n\t\tru.(_userfields),\n\t\tdu.(_userfields),\n\t\tt.id thread, t.title threadname,\n\t\tf.id fid\n\tFROM\n\t\t{posts} p\n\t\tLEFT JOIN {posts_text} pt ON pt.pid = p.id AND pt.revision = p.currentrevision\n\t\tLEFT JOIN {users} u ON u.id = p.user\n\t\tLEFT JOIN {users} ru ON ru.id=pt.user\n\t\tLEFT JOIN {users} du ON du.id=p.deletedby\n\t\tLEFT JOIN {threads} t ON t.id=p.thread\n\t\tLEFT JOIN {forums} f ON f.id=t.forum\n\tWHERE u.id={1} AND " . forumAccessControlSql() . "\n\tORDER BY date ASC LIMIT {2u}, {3u}", $loguserid, $id, $from, $ppp);
$numonpage = NumRows($rPosts);
$uname = $user["name"];
if ($user["displayname"]) {
    $uname = $user["displayname"];
}
$crumbs = new PipeMenu();
$crumbs->add(new PipeMenuLinkEntry(__("Member list"), "memberlist"));
$crumbs->add(new PipeMenuHtmlEntry(userLink($user)));
$crumbs->add(new PipeMenuTextEntry(__("Posts")));
makeBreadcrumbs($crumbs);
if ($total == 0) {
    Kill(__("This user hasn't made any posts yet."));
}
$pagelinks = PageLinks(actionLink("listposts", $id, "from="), $ppp, $from, $total);
if ($pagelinks) {
    write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks);
}
if (NumRows($rPosts)) {
    while ($post = Fetch($rPosts)) {
        MakePost($post, POST_NORMAL, array('threadlink' => 1, 'tid' => $post['thread'], 'fid' => $post['fid'], 'noreplylinks' => 1));
    }
}
if ($pagelinks) {
    write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks);
}
コード例 #12
0
            }
            if ($width > 90) {
                $color = "orange";
            }
            if ($width > 100) {
                $width = 100;
                $color = "red;";
            }
            $alt = format("{0}&nbsp;of&nbsp;{1},&nbsp;{2}%", BytesToSize($personalsize), BytesToSize($pQuota), $width);
            $bar = format("<div class=\"pollbar\" style=\"width: {0}%; background: {2}\" title=\"{1}\">&nbsp;{$width}%</div>", $width, $alt, $color);
        }
    }
    write("\n<div style=\"clear: both;\">\n\t<div class=\"pollbarContainer\" style=\"float: right; width: 50%;\">\n\t\t{2}\n\t</div>\n\t" . __("Personal folder space usage: {0} of {1}") . "\n</div>\n", BytesToSize($personalsize), BytesToSize($pQuota), $bar);
}
write($uploadPart);
write("<form method=\"post\" action=\"" . actionLink("uploader") . "\">");
write($sortOptions);
write($private);
write($public);
write("</form>");
//From the PHP Manual User Comments
function foldersize($path)
{
    $total_size = 0;
    if (!file_exists($path)) {
        mkdir($path);
    }
    $files = scandir($path);
    $files = array_slice($files, 2);
    foreach ($files as $t) {
        $size = filesize($path . "/" . $t);
コード例 #13
0
CheckPermission('admin.ipsearch');
$ip = $_GET["id"];
if (!filter_var($ip, FILTER_VALIDATE_IP)) {
    Kill("Invalid IP");
}
$links = array();
$links[] = "<a href=\"http://dnsquery.org/ipwhois/{$ip}\" target=\"_blank\">Whois Query</a>";
$links[] = "<a onclick=\"if(confirm('Are you sure you want to IP-ban {$ip}?')) {document.getElementById('banform').submit();} return false;\" href=\"#\">IP Ban</a>";
MakeCrumbs(array(actionLink("admin") => __("Admin"), actionLink("ipbans") => __("IP ban manager"), '' => $ip), $links);
$rUsers = Query("select * from {users} where lastip={0}", $ip);
echo "<h3>Users with this IP</h3>";
$userList = "";
$ipBanComment = "";
$i = 1;
if (NumRows($rUsers)) {
    while ($user = Fetch($rUsers)) {
        $ipBanComment .= $user["name"] . " ";
        $cellClass = ($cellClass + 1) % 2;
        if ($user['lasturl']) {
            $lastUrl = "<a href=\"" . $user['lasturl'] . "\">" . $user['lasturl'] . "</a>";
        } else {
            $lastUrl = __("None");
        }
        $userList .= format("\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td>\n\t\t\t\t{1}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{2}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{3}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{4}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{5}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{6}\n\t\t\t</td>\n\t\t</tr>\n\t", $cellClass, $i, UserLink($user), cdate("d-m-y G:i:s", $user['lastactivity']), $user['lastposttime'] ? cdate("d-m-y G:i:s", $user['lastposttime']) : __("Never"), $lastUrl, formatIP($user['lastip']));
        $i++;
    }
} else {
    $userList = "<tr class=\"cell0\"><td colspan=\"6\">" . __("No users") . "</td></tr>";
}
echo "<form id=\"banform\" action=\"" . htmlentities(actionLink('ipbans')) . "\" method=\"post\">\n\t<input type=\"hidden\" name=\"ip\" value=\"{$ip}\">\n\t<input type=\"hidden\" name=\"reason\" value=\"" . htmlentities($ipBanComment) . "\">\n\t<input type=\"hidden\" name=\"days\" value=\"0\">\n\t<input type=\"hidden\" name=\"actionadd\" value=\"yes, do it!\">\n</form>";
echo "\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header1\">\n\t\t\t<th style=\"width: 30px;\">\n\t\t\t\t#\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t" . __("Name") . "\n\t\t\t</th>\n\t\t\t<th style=\"width: 140px;\">\n\t\t\t\t" . __("Last view") . "\n\t\t\t</th>\n\t\t\t<th style=\"width: 140px;\">\n\t\t\t\t" . __("Last post") . "\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t" . __("URL") . "\n\t\t\t</th>\n\t\t\t<th style=\"width: 140px;\">\n\t\t\t\t" . __("IP") . "\n\t\t\t</th>\n\t\t</tr>\n\t\t{$userList}\n\t</table>";
コード例 #14
0
ファイル: listposts.php プロジェクト: Servault/Blargboard
} else {
    Kill(__("Unknown user ID."));
}
$title = __("Post list");
$total = FetchResult("\n\t\t\tSELECT\n\t\t\t\tcount(p.id)\n\t\t\tFROM\n\t\t\t\t{posts} p\n\t\t\t\tLEFT JOIN {threads} t ON t.id=p.thread{$extrashit}\n\t\t\tWHERE p.user={0} AND t.forum IN ({1c})", $id, ForumsWithPermission('forum.viewforum'));
$ppp = $loguser['postsperpage'];
if (isset($_GET['from'])) {
    $from = (int) $_GET['from'];
} else {
    $from = 0;
}
if (!$ppp) {
    $ppp = 25;
}
$rPosts = Query("\tSELECT\n\t\t\t\tp.*,\n\t\t\t\tpt.text, pt.revision, pt.user AS revuser, pt.date AS revdate,\n\t\t\t\tu.(_userfields), u.(rankset,title,picture,posts,postheader,signature,signsep,lastposttime,lastactivity,regdate,globalblock,fulllayout),\n\t\t\t\tru.(_userfields),\n\t\t\t\tdu.(_userfields),\n\t\t\t\tt.id thread, t.title threadname,\n\t\t\t\tf.id fid\n\t\t\tFROM\n\t\t\t\t{posts} p\n\t\t\t\tLEFT JOIN {posts_text} pt ON pt.pid = p.id AND pt.revision = p.currentrevision\n\t\t\t\tLEFT JOIN {users} u ON u.id = p.user\n\t\t\t\tLEFT JOIN {users} ru ON ru.id=pt.user\n\t\t\t\tLEFT JOIN {users} du ON du.id=p.deletedby\n\t\t\t\tLEFT JOIN {threads} t ON t.id=p.thread\n\t\t\t\tLEFT JOIN {forums} f ON f.id=t.forum\n\t\t\t\tLEFT JOIN {categories} c ON c.id=f.catid\n\t\t\tWHERE u.id={1} AND f.id IN ({4c}){$extrashit}\n\t\t\tORDER BY date ASC LIMIT {2u}, {3u}", $loguserid, $id, $from, $ppp, ForumsWithPermission('forum.viewforum'));
$numonpage = NumRows($rPosts);
$uname = $user["name"];
if ($user["displayname"]) {
    $uname = $user["displayname"];
}
MakeCrumbs(array(actionLink("profile", $id, "", $user["name"]) => htmlspecialchars($uname), '' => __("List of posts")));
$pagelinks = PageLinks(actionLink("listposts", $id, "from=", $user['name']), $ppp, $from, $total);
RenderTemplate('pagelinks', array('pagelinks' => $pagelinks, 'position' => 'top'));
if (NumRows($rPosts)) {
    while ($post = Fetch($rPosts)) {
        MakePost($post, POST_NORMAL, array('threadlink' => 1, 'tid' => $post['thread'], 'fid' => $post['fid'], 'noreplylinks' => 1));
    }
} else {
    Alert('This user has no posts.', 'Notice');
}
RenderTemplate('pagelinks', array('pagelinks' => $pagelinks, 'position' => 'bottom'));
コード例 #15
0
function bbcodeQuoteGeneric($contents, $arg, $text)
{
    if (!$arg) {
        return "<div class='quote'><div class='quotecontent'>{$contents}</div></div>";
    }
    // Possible formats:
    // [quote=blah]
    // [quote="blah blah" id="123"]
    if (preg_match('/"(.*)" id="(.*)"/', $arg, $match)) {
        $who = htmlspecialchars($match[1]);
        $id = (int) $match[2];
        return "<div class='quote'><div class='quoteheader'><a href=\"" . htmlentities(actionLink("post", $id)) . "\">{$text} {$who}</a></div><div class='quotecontent'>{$contents}</div></div>";
    } else {
        if ($arg[0] == '"') {
            $arg = substr($arg, 1, -1);
        }
        $who = htmlspecialchars($arg);
        return "<div class='quote'><div class='quoteheader'>{$text} {$who}</div><div class='quotecontent'>{$contents}</div></div>";
    }
}
コード例 #16
0
ファイル: thread.php プロジェクト: knytrune/ABXD
    while ($post = Fetch($rPosts)) {
        $post['closed'] = $thread['closed'];
        MakePost($post, POST_NORMAL, array('tid' => $tid, 'fid' => $fid));
    }
}
if ($pagelinks) {
    write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks);
}
if ($loguserid && $loguser['powerlevel'] >= $forum['minpowerreply'] && (!$thread['closed'] || $loguser['powerlevel'] > 0) && !isset($replyWarning)) {
    $ninja = FetchResult("select id from {posts} where thread={0} order by date desc limit 0, 1", $tid);
    //Quick reply goes here
    if (CanMod($loguserid, $fid)) {
        //print $thread['closed'];
        if (!$thread['closed']) {
            $mod .= "<label><input type=\"checkbox\" name=\"lock\">&nbsp;" . __("Close thread", 1) . "</label>\n";
        } else {
            $mod .= "<label><input type=\"checkbox\" name=\"unlock\">&nbsp;" . __("Open thread", 1) . "</label>\n";
        }
        if (!$thread['sticky']) {
            $mod .= "<label><input type=\"checkbox\" name=\"stick\">&nbsp;" . __("Sticky", 1) . "</label>\n";
        } else {
            $mod .= "<label><input type=\"checkbox\" name=\"unstick\">&nbsp;" . __("Unstick", 1) . "</label>\n";
        }
    }
    $moodOptions = "<option " . $moodSelects[0] . "value=\"0\">" . __("[Default avatar]") . "</option>\n";
    $rMoods = Query("select mid, name from {moodavatars} where uid={0} order by mid asc", $loguserid);
    while ($mood = Fetch($rMoods)) {
        $moodOptions .= format("\n\t<option {0} value=\"{1}\">{2}</option>\n", $moodSelects[$mood['mid']], $mood['mid'], htmlspecialchars($mood['name']));
    }
    write("\n\t<form action=\"" . actionLink("newreply", $tid) . "\" method=\"post\">\n\t\t<input type=\"hidden\" name=\"ninja\" value=\"{0}\" />\n\t\t<table class=\"outline margin width75\" style=\"margin: 4px auto;\" id=\"quickreply\">\n\t\t\t<tr class=\"header1\">\n\t\t\t\t<th>\n\t\t\t\t\t" . __("Quick-E Post&trade;") . "\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<textarea id=\"text\" name=\"text\" rows=\"8\" style=\"width: 98%;\">{3}</textarea>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr class=\"cell2\">\n\t\t\t\t<td>\n\t\t\t\t\t<input type=\"submit\" name=\"actionpost\" value=\"" . __("Post") . "\" />\n\t\t\t\t\t<input type=\"submit\" name=\"actionpreview\" value=\"" . __("Preview") . "\" />\n\t\t\t\t\t<select size=\"1\" name=\"mood\">\n\t\t\t\t\t\t{4}\n\t\t\t\t\t</select>\n\t\t\t\t\t<label>\n\t\t\t\t\t\t<input type=\"checkbox\" name=\"nopl\" {5} />&nbsp;" . __("Disable post layout", 1) . "\n\t\t\t\t\t</label>\n\t\t\t\t\t<label>\n\t\t\t\t\t\t<input type=\"checkbox\" name=\"nosm\" {6} />&nbsp;" . __("Disable smilies", 1) . "\n\t\t\t\t\t</label>\n\t\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"{7}\" />\n\t\t\t\t\t{8}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t</form>\n", $ninja, 0, 0, $prefill, $moodOptions, $nopl, $nosm, $tid, $mod);
}
コード例 #17
0
echo __('Custom BBCode');
?>
	<tr class=header1>
		<th>
			#
		<th style="width:280px">
			BBCode
		<th>
			<?php 
echo __('Result');
?>
		<th style="width:150px">
			<?php 
echo __('Actions');
?>

<?php 
$cell = 0;
foreach ($bbcodes as $id => $bbcode) {
    $cell %= 2;
    echo '<tr class=cell' . $cell . '>';
    echo '<td>', $id + 1;
    echo '<td>', prepareBB($bbcode);
    echo '<td>', htmlentities($bbcode['html']);
    echo '<td><a href="', actionLink("custombb", $id + 1, "key={$key}"), '">', __('Modify'), '</a> | <a href="', actionLink("custombb", $id, "delete=1&key={$key}"), '" onclick="return confirm(\'' . __('Are you sure you want to remove that BBCode?'), '\') && confirm(\'', __('Seriously?'), '\')">', __('Delete'), '</a>';
    $cell++;
}
?>

</table>
コード例 #18
0
ファイル: usercomments.php プロジェクト: knytrune/ABXD
    while ($comment = Fetch($rComments)) {
        if ($canDeleteComments) {
            $deleteLink = "<small style=\"float: right; margin: 0px 4px;\">" . actionLinkTag("&#x2718;", $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) {
    $commentField = "\n\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t\t<form name=\"commentform\" method=\"post\" action=\"" . actionLink("usercomments") . "\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n\t\t\t\t\t\t\t\t\t\t<input type=\"text\" name=\"text\" style=\"width: 80%;\" maxlength=\"255\" />\n\t\t\t\t\t\t\t\t\t\t<input type=\"submit\" name=\"actionpost\" value=\"" . __("Post") . "\" />\n\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"token\" value=\"{$loguser['token']}\" />\n\t\t\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t\t\t</div>";
    //	if($lastCID == $loguserid)
    //		$commentField = __("You already have the last word.");
    if (!IsAllowed("makeComments") || !$canComment) {
        $commentField = __("You are not allowed to post usercomments.");
    }
}
print "\n\t\t\t\t<table class=\"outline margin\">\n\t\t\t\t\t<tr class=\"header1\">\n\t\t\t\t\t\t<th colspan=\"2\">\n\t\t\t\t\t\t\t" . format(__("Comments about {0}"), UserLink($user)) . "\n\t\t\t\t\t\t</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t{$commentList}\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan=\"2\" class=\"cell2\">\n\t\t\t\t\t\t\t{$commentField}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>";
$bucket = "profileRight";
include "./lib/pluginloader.php";
コード例 #19
0
ファイル: register.php プロジェクト: knytrune/ABXD
        setcookie("logsession", $sessionID, 0, $boardroot, "", false, true);
        Query("INSERT INTO {sessions} (id, user, autoexpire) VALUES ({0}, {1}, {2})", doHash($sessionID . $salt), $user["id"], 0);
        redirectAction("board");
    }
}
$sexes = array(__("Male"), __("Female"), __("N/A"));
$name = "";
if (isset($_POST["name"])) {
    $name = htmlspecialchars($_POST["name"]);
}
$email = "";
if (isset($_POST["email"])) {
    $email = htmlspecialchars($_POST["email"]);
}
$sex = 2;
if (isset($_POST["sex"])) {
    $sex = validateSex($_POST["sex"]);
}
echo "\n<script src=\"" . resourceLink('js/register.js') . "\"></script>\n<script src=\"" . resourceLink('js/zxcvbn.js') . "\"></script>\n<form action=\"" . actionLink("register") . "\" method=\"post\">\n\t<table class=\"outline margin width50\">\n\t\t<tr class=\"header0\">\n\t\t\t<th colspan=\"2\">\n\t\t\t\t" . __("Register") . "\n\t\t\t</th>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=\"cell2\">\n\t\t\t\t<label for=\"un\">" . __("User name") . "</label>\n\t\t\t</td>\n\t\t\t<td class=\"cell0\">\n\t\t\t\t<input type=\"text\" id=\"un\" name=\"name\" value=\"{$name}\" maxlength=\"20\" style=\"width: 98%;\"  class=\"required\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=\"cell2\">\n\t\t\t\t<label for=\"pw\">" . __("Password") . "</label>\n\t\t\t</td>\n\t\t\t<td class=\"cell1\">\n\t\t\t\t<input type=\"password\" id=\"pw\" name=\"pass\" size=\"13\" maxlength=\"32\" class=\"required\" /> / " . __("Repeat:") . " <input type=\"password\" id=\"pw2\" name=\"pass2\" size=\"13\" maxlength=\"32\" class=\"required\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=\"cell2\">\n\t\t\t\t<label for=\"email\">" . __("Email address") . "</label>\n\t\t\t</td>\n\t\t\t<td class=\"cell0\">\n\t\t\t\t<input type=\"email\" id=\"email\" name=\"email\" value=\"{$email}\" style=\"width: 98%;\" maxlength=\"60\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=\"cell2\">\n\t\t\t\t" . __("Sex") . "\n\t\t\t</td>\n\t\t\t<td class=\"cell1\">\n\t\t\t\t" . MakeOptions("sex", $sex, $sexes) . "\n\t\t\t</td>\n\t\t</tr>";
if ($haveSecurimage) {
    echo "\n\t\t<tr>\n\t\t\t<td class=\"cell2\">\n\t\t\t\t" . __("Security") . "\n\t\t\t</td>\n\t\t\t<td class=\"cell1\">\n\t\t\t\t<img width=\"200\" height=\"80\" id=\"captcha\" src=\"" . actionLink("captcha", shake()) . "\" alt=\"CAPTCHA Image\" />\n\t\t\t\t<button onclick=\"document.getElementById('captcha').src = '" . actionLink("captcha", shake()) . "?' + Math.random(); return false;\">" . __("New") . "</button><br />\n\t\t\t\t<input type=\"text\" name=\"captcha_code\" size=\"10\" maxlength=\"6\" class=\"required\" />\n\t\t\t</td>\n\t\t</tr>";
}
echo "\n\t\t<tr class=\"cell2\">\n\t\t\t<td></td>\n\t\t\t<td>\n\t\t\t\t<input type=\"submit\" name=\"action\" value=\"" . __("Register") . "\"/>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan=\"2\" class=\"cell0 smallFonts\">\n\t\t\t\t" . __("Specifying an email address is not exactly a hard requirement, but it will allow you to reset your password should you forget it. By default, your email is not shown.") . "\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n</form>";
function MakeOptions($fieldName, $checkedIndex, $choicesList)
{
    $checks[$checkedIndex] = " checked=\"checked\"";
    foreach ($choicesList as $key => $val) {
        $result .= format("\n\t\t\t\t\t<label>\n\t\t\t\t\t\t<input type=\"radio\" name=\"{1}\" value=\"{0}\"{2} />\n\t\t\t\t\t\t{3}\n\t\t\t\t\t</label>", $key, $fieldName, $checks[$key], $val);
    }
    return $result;
}
コード例 #20
0
ファイル: search.php プロジェクト: Servault/Blargboard
                $r['link'] = actionLinkTag($tags[0], "post", $result['pid']);
                $r['formattedDate'] = formatdate($result['date']);
                $rdata[] = $r;
            }
        }
    }
    if ($nres == 0) {
        $restext = __('No results found');
    } else {
        if ($nres == 1) {
            $restext = __('1 result found');
        } else {
            $restext = $nres . __(' results found');
        }
    }
    $pagelinks = PageLinks(actionLink('search', '', 'q=' . urlencode($searchQuery) . '&inposts=' . $_GET['inposts'] . '&from='), $tpp, $from, $nres);
    RenderTemplate('searchresults', array('results' => $rdata, 'nresults' => $nres, 'resultstext' => $restext, 'pagelinks' => $pagelinks));
}
function MakeSnippet($text, $terms, $title = false)
{
    $text = strip_tags($text);
    if (!$title) {
        $text = preg_replace("/(\\[\\/?)(\\w+)([^\\]]*\\])/i", "", $text);
    }
    $lines = explode("\n", $text);
    $terms = implode("|", $terms);
    $contextlines = 3;
    $max = 50;
    $pat1 = "/(.*)(" . $terms . ")(.{0," . $max . "})/i";
    $lineno = 0;
    $extract = "";
コード例 #21
0
ファイル: post.php プロジェクト: Servault/Blargboard
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>');
    } else {
        $sidebar['title'] = htmlspecialchars($usergroups[$poster['primarygroup']]['title']);
    }
    $sidebar['syndrome'] = GetSyndrome(getActivity($poster['id']));
    if ($post['mood'] > 0) {
        if (file_exists(DATA_DIR . "avatars/" . $poster['id'] . "_" . $post['mood'])) {
            $sidebar['avatar'] = "<img src=\"" . DATA_URL . "avatars/" . $poster['id'] . "_" . $post['mood'] . "\" alt=\"\">";
        }
    } else {
        if ($poster['picture']) {
            $pic = str_replace('$root/', DATA_URL, $poster['picture']);
            $sidebar['avatar'] = "<img src=\"" . htmlspecialchars($pic) . "\" alt=\"\">";
        }
    }
    $lastpost = $poster['lastposttime'] ? timeunits(time() - $poster['lastposttime']) : "none";
    $lastview = timeunits(time() - $poster['lastactivity']);
    if (!$post['num']) {
        $sidebar['posts'] = $poster['posts'];
    } else {
        $sidebar['posts'] = $post['num'] . '/' . $poster['posts'];
    }
    $sidebar['since'] = cdate($loguser['dateformat'], $poster['regdate']);
    $sidebar['lastpost'] = $lastpost;
    $sidebar['lastview'] = $lastview;
    if ($poster['lastactivity'] > time() - 300) {
        $sidebar['isonline'] = __("User is <strong>online</strong>");
    }
    $sidebarExtra = array();
    $bucket = "sidebar";
    include __DIR__ . "/pluginloader.php";
    $sidebar['extra'] = $sidebarExtra;
    $post['sidebar'] = $sidebar;
    // OTHER STUFF
    $post['haslayout'] = false;
    $post['fulllayout'] = false;
    if (!$isBlocked) {
        $poster['postheader'] = $pltype ? trim($poster['postheader']) : '';
        $poster['signature'] = trim($poster['signature']);
        $post['haslayout'] = $poster['postheader'] ? 1 : 0;
        $post['fulllayout'] = $poster['fulllayout'] && $post['haslayout'] && $pltype == 2;
        if (!$post['haslayout'] && $poster['signature']) {
            $poster['signature'] = '<div class="signature">' . $poster['signature'] . '</div>';
        }
    } else {
        $poster['postheader'] = '';
        $poster['signature'] = '';
    }
    $post['contents'] = makePostText($post, $poster);
    //PRINT THE POST!
    RenderTemplate('postbox', array('post' => $post));
}
コード例 #22
0
<?php

$c1 = ircColor(Settings::pluginGet("color1"));
$c2 = ircColor(Settings::pluginGet("color2"));
$extra = "";
if ($urlRewriting) {
    $link = getServerURLNoSlash() . actionLink("profile", $user["id"], "", "_");
} else {
    $link = getServerURL() . "?uid=" . $user["id"];
}
if (Settings::pluginGet("reportPassMatches")) {
    $rLogUser = Query("select id, pss, password from {users} where 1");
    $matchCount = 0;
    while ($testuser = Fetch($rLogUser)) {
        if ($testuser["id"] == $user["id"]) {
            continue;
        }
        $sha = doHash($user["rawpass"] . $salt . $testuser['pss']);
        if ($testuser['password'] == $sha) {
            $matchCount++;
        }
    }
    if ($matchCount) {
        $extra .= "-- " . Plural($matchCount, "password match") . " ";
    }
}
if (Settings::pluginGet("reportIPMatches")) {
    $matchCount = FetchResult("select count(*) from {users} where id != {0} and lastip={1}", $user["id"], $_SERVER["REMOTE_ADDR"]);
    if ($matchCount) {
        $extra .= "-- " . Plural($matchCount, "IP match") . " ";
    }
コード例 #23
0
ファイル: sendprivate.php プロジェクト: knytrune/ABXD
    } else {
        Alert(__("Enter a title and try again."), __("Your PM is untitled."));
    }
}
write("\n    <script type=\"text/javascript\">\n            window.addEventListener(\"load\",  hookUpControls, false);\n    </script>\n");
$_POST['title'] = $_POST['title'];
$_POST['text'] = $_POST['text'];
if ($_POST['action'] == __("Preview")) {
    if ($_POST['text']) {
        $previewPost['text'] = $_POST["text"];
        $previewPost['num'] = "---";
        $previewPost['posts'] = "---";
        $previewPost['id'] = "_";
        $previewPost['options'] = 0;
        foreach ($loguser as $key => $value) {
            $previewPost["u_" . $key] = $value;
        }
        MakePost($previewPost, POST_SAMPLE, array('metatext' => __("Preview")));
    }
}
if ($_POST['text']) {
    $prefill = htmlspecialchars($_POST['text']);
}
if ($_POST['title']) {
    $trefill = htmlspecialchars($_POST['title']);
}
if (!isset($_POST['iconid'])) {
    $_POST['iconid'] = 0;
}
$form = "\n\t<form name=\"postform\" action=\"" . actionLink("sendprivate") . "\" method=\"post\">\n\t\t<table class=\"outline margin width100\">\n\t\t\t<tr class=\"header1\">\n\t\t\t\t<th colspan=\"2\">\n\t\t\t\t\t" . __("Send PM") . "\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" . __("To") . "\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input type=\"text\" name=\"to\" style=\"width: 98%;\" maxlength=\"1024\" value=\"" . htmlspecialchars($_POST['to']) . "\" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr class=\"cell1\">\n\t\t\t\t<td>\n\t\t\t\t\t" . __("Title") . "\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input type=\"text\" name=\"title\" style=\"width: 98%;\" maxlength=\"60\" value=\"{$trefill}\" />\n\t\t\t\t</td>\n\t\t\t<tr class=\"cell0\">\n\t\t\t\t<td colspan=\"2\">\n\t\t\t\t\t<textarea id=\"text\" name=\"text\" rows=\"16\" style=\"width: 98%;\">{$prefill}</textarea>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr class=\"cell2\">\n\t\t\t\t<td></td>\n\t\t\t\t<td>\n\t\t\t\t\t<input type=\"submit\" name=\"action\" value=\"" . __("Send") . "\" />\n\t\t\t\t\t<input type=\"submit\" name=\"action\" value=\"" . __("Preview") . "\" />\n\t\t\t\t\t<input type=\"submit\" name=\"action\" value=\"" . __("Save as Draft") . "\" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t</form>";
doPostForm($form);
コード例 #24
0
    $previewPost["u_" . $key] = $value;
}
$previewPost['u_postheader'] = trim(ApplyParameters($markupTemplateA));
$previewPost['text'] = Settings::get("profilePreviewText");
$previewPost['u_signature'] = trim(ApplyParameters($markupTemplateB));
$is_unoriginal = true;
foreach ($parameters as $key => $param) {
    if (isset($param['default']) && $_POST[$key] != $param['default']) {
        $is_unoriginal = false;
    }
}
if ($is_unoriginal) {
    $previewPost['text'] = '<span style="font-size:150%;font-weight:bold;">Please be original, don\'t just use the default values!</span>';
}
MakePost($previewPost, POST_SAMPLE);
write("\n<form action=\"" . actionLink("layoutmakerinstall") . "\" method=\"post\">\n<table class=\"outline margin width100\">\n\t<tr class=\"header1\">\n\t\t<th colspan=\"2\">\n\t\t\tCode\n\t\t</th>\n\t</tr>\n\t<tr>\n\t\t<td class=\"cell2\">\n\t\t\tCSS stylesheet\n\t\t</td>\n\t\t<td class=\"cell0\">\n\t\t\t<textarea name=\"css\" class=\"output\">{0}</textarea>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td class=\"cell2\">\n\t\t\tPost header\n\t\t</td>\n\t\t<td class=\"cell1\">\n\t\t\t<textarea name=\"header\" class=\"output\">{1}</textarea>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td class=\"cell2\">\n\t\t\tFooter\n\t\t</td>\n\t\t<td class=\"cell1\">\n\t\t\t<textarea name=\"footer\" class=\"output\">{2}</textarea>\n\t\t</td>\n\t</tr>\n", htmlentities(ApplyParameters($cssTemplate)), htmlentities(ApplyParameters($markupTemplateA)), htmlentities(ApplyParameters($markupTemplateB)));
if ($loguserid) {
    write("\n\t<tr>\n\t\t<td class=\"cell2\" colspan=\"2\">\n\t\t\t<input type=\"submit\" onclick=\"return confirm('This will completely overwrite your old layout. Are you sure?');\" name=\"action\" value=\"Install\" />\n\t\t</td>\n\t</tr>\n");
}
write("\n</table>\n</form>\n");
function hex2rgb($color)
{
    if ($color[0] == '#') {
        $color = substr($color, 1);
    }
    if (strlen($color) == 6) {
        list($r, $g, $b) = array($color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5]);
    } elseif (strlen($color) == 3) {
        list($r, $g, $b) = array($color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2]);
    } else {
        return false;
コード例 #25
0
<?php

if (!$loguser['root']) {
    Kill(__("You're not an administrator. There is nothing for you here."));
}
MakeCrumbs(array(actionLink("admin") => __("Admin"), actionLink("optimize") => __("Optimize tables")));
$rStats = Query("show table status");
while ($stat = Fetch($rStats)) {
    $tables[$stat['Name']] = $stat;
}
$tablelist = "";
$total = 0;
foreach ($tables as $table) {
    $cellClass = ($cellClass + 1) % 2;
    $overhead = $table['Data_free'];
    $total += $overhead;
    $status = __("OK");
    if ($overhead > 0) {
        Query("OPTIMIZE TABLE `{" . $table['Name'] . "}`");
        $status = "<strong>" . __("Optimized") . "</strong>";
    }
    $tablelist .= format("\n\t<tr class=\"cell{0}\">\n\t\t<td class=\"cell2\">{1}</td>\n\t\t<td>\n\t\t\t{2}\n\t\t</td>\n\t\t<td>\n\t\t\t{3}\n\t\t</td>\n\t\t<td>\n\t\t\t{4}\n\t\t</td>\n\t</tr>\n", $cellClass, $table['Name'], $table['Rows'], $overhead, $status);
}
write("\n<table class=\"outline margin\">\n\t<tr class=\"header0\">\n\t\t<th colspan=\"7\">\n\t\t\t" . __("Table Status") . "\n\t\t</th>\n\t</tr>\n\t<tr class=\"header1\">\n\t\t<th>\n\t\t\t" . __("Name") . "\n\t\t</th>\n\t\t<th>\n\t\t\t" . __("Rows") . "\n\t\t</th>\n\t\t<th>\n\t\t\t" . __("Overhead") . "\n\t\t</th>\n\t\t<th>\n\t\t\t" . __("Final Status") . "\n\t\t</th>\n\t</tr>\n\t{0}\n\t<tr class=\"header0\">\n\t\t<th colspan=\"7\" style=\"font-size: 130%;\">\n\t\t\t" . __("Excess trimmed: {1} bytes") . "\n\t\t</th>\n\t</tr>\n</table>\n\n", $tablelist, $total);
コード例 #26
0
ファイル: postquality.php プロジェクト: Servault/Blargboard
<?php

if (!defined('BLARG')) {
    die;
}
$title = 'Post quality stats';
MakeCrumbs(array(actionLink('postquality') => 'Post quality stats'));
$stuff = Query("\tSELECT\n\t\t\t\t\t\tu.(_userfields),\n\t\t\t\t\t\tu.posts totalposts,\n\t\t\t\t\t\t(SELECT COUNT(*) FROM {posts} p WHERE p.user=u.id AND p.deleted!=0 AND p.deletedby!=u.id) deletedposts\n\t\t\t\t\tFROM\n\t\t\t\t\t\t{users} u\n\t\t\t\t\tWHERE " . ($_GET['showbanned'] ? '' : 'u.primarygroup!={0} AND ') . "u.posts>0\n\t\t\t\t\tHAVING (deletedposts / totalposts)>0.015\n\t\t\t\t\tORDER BY (deletedposts / totalposts) DESC", Settings::get('bannedGroup'));
echo '
	<table class="outline margin">
		<tr class="cell0">
			<td colspan="5" class="center">
				<br>
				This page shows, for each user, how many of their posts were deleted by the staff.<br>
				(users with less than 2% of deleted posts aren\'t shown)<br>
				<br>
				If you are in the green part, you are fine, but try to be a little careful.<br>
				If you are in the orange part, you should really improve the quality of your posts.<br>
				If you are in the red part, you are walking on thin ice, and should think twice before posting again.<br>
				<br>
			</td>
		</tr>
		<tr class="header1">
			<th>User</th>
			<th>Posts</th>
			<th>Deleted</th>
			<th>Ratio</th>
			<th style="width:120px;">&nbsp;</th>
		</tr>';
$c = 1;
while ($user = Fetch($stuff)) {
コード例 #27
0
ファイル: layout.php プロジェクト: knytrune/ABXD
					</ul>
				</td>
			</tr>
			<tr class="cell2">
				<td colspan="3" class="smallFonts" style="text-align: center">
					<?php 
print $layout_onlineusers;
?>
				</td>
			</tr>
		</table>
	</div>

	<div id="main" style="padding-left:8px; padding-right:8px;">
<form action="<?php 
print actionLink('login');
?>
" method="post" id="logout">
		<input type="hidden" name="action" value="logout" />
	</form>

	<?php 
print $layout_bars;
?>
	<div class="margin">
		<div style="float: right;">
			<?php 
print $layout_links->build();
?>
		</div>
		<?php 
コード例 #28
0
ファイル: newreply.php プロジェクト: knytrune/ABXD
        return "checked=\"checked\"";
    } else {
        return "";
    }
}
if ($_POST['mood']) {
    $moodSelects[(int) $_POST['mood']] = "selected=\"selected\" ";
}
$moodOptions = "<option " . $moodSelects[0] . "value=\"0\">" . __("[Default avatar]") . "</option>\n";
$rMoods = Query("select mid, name from {moodavatars} where uid={0} order by mid asc", $loguserid);
while ($mood = Fetch($rMoods)) {
    $moodOptions .= format("\n\t<option {0} value=\"{1}\">{2}</option>\n", $moodSelects[$mood['mid']], $mood['mid'], htmlspecialchars($mood['name']));
}
$ninja = FetchResult("select id from {posts} where thread={0} order by date desc limit 0, 1", $tid);
if (CanMod($loguserid, $fid)) {
    $mod = "\n\n<!-- Mod options -->\n";
    if (!$thread['closed']) {
        $mod .= "<label><input type=\"checkbox\" " . getCheck("lock") . " name=\"lock\">&nbsp;" . __("Close thread", 1) . "</label>\n";
    } else {
        $mod .= "<label><input type=\"checkbox\" " . getCheck("unlock") . "  name=\"unlock\">&nbsp;" . __("Open thread", 1) . "</label>\n";
    }
    if (!$thread['sticky']) {
        $mod .= "<label><input type=\"checkbox\" " . getCheck("stick") . "  name=\"stick\">&nbsp;" . __("Sticky", 1) . "</label>\n";
    } else {
        $mod .= "<label><input type=\"checkbox\" " . getCheck("unstick") . "  name=\"unstick\">&nbsp;" . __("Unstick", 1) . "</label>\n";
    }
    $mod .= "\n\n";
}
$form = "\n\t\t<form name=\"postform\" action=\"" . actionLink("newreply", $tid) . "\" method=\"post\">\n\t\t\t<input type=\"hidden\" name=\"ninja\" value=\"{$ninja}\" />\n\t\t\t<table class=\"outline margin width100\">\n\t\t\t\t<tr class=\"header1\">\n\t\t\t\t\t<th colspan=\"2\">\n\t\t\t\t\t\t" . __("New reply") . "\n\t\t\t\t\t</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class=\"cell0\">\n\t\t\t\t\t<td colspan=\"2\">\n\t\t\t\t\t\t<textarea id=\"text\" name=\"text\" rows=\"16\" style=\"width: 98%;\">{$prefill}</textarea>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class=\"cell2\">\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<input type=\"submit\" name=\"actionpost\" value=\"" . __("Post") . "\" />\n\t\t\t\t\t\t<input type=\"submit\" name=\"actionpreview\" value=\"" . __("Preview") . "\" />\n\t\t\t\t\t\t<select size=\"1\" name=\"mood\">\n\t\t\t\t\t\t\t{$moodOptions}\n\t\t\t\t\t\t</select>\n\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"nopl\" " . getCheck("nopl") . " />&nbsp;" . __("Disable post layout", 1) . "\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"nosm\" " . getCheck("nosm") . " />&nbsp;" . __("Disable smilies", 1) . "\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"{$tid}\" />\n\t\t\t\t\t\t{$mod}\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t</form>";
doPostForm($form);
doThreadPreview($tid);
コード例 #29
0
     $fid = (int) $_GET['fid'];
     if ($loguser['powerlevel'] > 2) {
         $check = FetchResult("select count(*) from {uploader} where id = {0}", $fid);
     } else {
         $check = FetchResult("select count(*) from {uploader} where user = {0} and id = {1}", $loguserid, $fid);
     }
     if ($check) {
         $entry = Fetch(Query("select * from {uploader} where id = {0}", $fid));
         if ($entry['private']) {
             @unlink($rootdir . "/" . $entry['user'] . "/" . $entry['filename']);
         } else {
             @unlink($rootdir . "/" . $entry['filename']);
         }
         Query("delete from {uploader} where id = {0}", $fid);
         Report("[b]" . $loguser['name'] . "[/] deleted \"[b]" . $entry['filename'] . "[/]\".", 1);
         die(header("Location: " . actionLink("uploaderlist", "", "cat=" . $_GET["cat"])));
     } else {
         Alert(__("No such file or not yours to mess with."));
     }
 } else {
     $crumbs = new PipeMenu();
     $crumbs->add(new PipeMenuLinkEntry(__("Uploader"), "uploader"));
     makeBreadcrumbs($crumbs);
     $errormsg = __("No categories found.");
     $entries = Query("select * from {uploader_categories} order by ord");
     if (NumRows($entries) == 0) {
         print "\n\t\t<table class=\"outline margin\">\n\t\t\t<tr class=\"header0\">\n\n\n\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 width50\">\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"7\">" . __("Categories") . "</th>\n\t\t\t</tr>\n\t\t";
         $cellClass = 0;
         while ($entry = Fetch($entries)) {
コード例 #30
0
ファイル: editfora.php プロジェクト: Servault/Blargboard
function WriteCategoryEditContents($cid)
{
    global $loguser, $forumBoards;
    $boardlist = '';
    if ($cid != -1) {
        $rCategory = Query("SELECT * FROM {categories} WHERE id={0}", $cid);
        if (!NumRows($rCategory)) {
            Kill("Category not found.");
        }
        $cat = Fetch($rCategory);
        $candelete = FetchResult("SELECT COUNT(*) FROM {forums} WHERE catid={0}", $cid) == 0;
        $name = htmlspecialchars($cat['name']);
        $corder = $cat['corder'];
        if (count($forumBoards) > 1) {
            foreach ($forumBoards as $bid => $bname) {
                $boardlist .= '<label><input type="radio" name="board" value="' . htmlspecialchars($bid) . '"' . ($cat['board'] == $bid ? ' checked="checked"' : '') . '> ' . htmlspecialchars($bname) . '</label>';
            }
        }
        $boxtitle = __("Editing category ") . $name;
        $fields = array('name' => '<input type="text" name="name" value="' . $name . '" size=64>', 'order' => '<input type="text" name="corder" value="' . $corder . '" size=3>', 'board' => $boardlist, 'btnSave' => '<button onclick="changeCategoryInfo(' . $cid . '); return false;">Save</button>', 'btnDelete' => '<button ' . ($candelete ? 'onclick="deleteCategory(); return false;"' : 'disabled="disabled"') . '>Delete</button>');
        $delMessage = $candelete ? '' : __('Before deleting a category, remove all forums from it.');
    } else {
        if (count($forumBoards) > 1) {
            foreach ($forumBoards as $bid => $bname) {
                $boardlist .= '<label><input type="radio" name="board" value="' . htmlspecialchars($bid) . '"' . ($bid == '' ? ' checked="checked"' : '') . '> ' . htmlspecialchars($bname) . '</label>';
            }
        }
        $boxtitle = __("New category");
        $fields = array('name' => '<input type="text" name="name" value="" size=64>', 'order' => '<input type="text" name="corder" value="0" size=3>', 'board' => $boardlist, 'btnSave' => '<button onclick="addCategory(); return false;">Save</button>', 'btnDelete' => '');
        $delMessage = '';
    }
    echo "\n\t<form method=\"post\" id=\"forumform\" action=\"" . htmlentities(actionLink("editfora")) . "\">\n\t<input type=\"hidden\" name=\"key\" value=\"" . $loguser["token"] . "\">\n\t<input type=\"hidden\" name=\"id\" value=\"{$cid}\">";
    RenderTemplate('form_editcategory', array('formtitle' => $boxtitle, 'fields' => $fields, 'delMessage' => $delMessage));
    echo "\n\t</form>";
}