本文整理汇总了PHP中RenderTemplate函数的典型用法代码示例。如果您正苦于以下问题:PHP RenderTemplate函数的具体用法?PHP RenderTemplate怎么用?PHP RenderTemplate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RenderTemplate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Alert
function Alert($s, $t = "")
{
if ($t == "") {
$t = __("Notice");
}
RenderTemplate('messagebox', array('msgtitle' => $t, 'message' => $s));
}
示例2: Shake
$sessionID = Shake();
setcookie("logsession", $sessionID, 2147483647, URL_ROOT, "", false, true);
Query("INSERT INTO {sessions} (id, user, autoexpire) VALUES ({0}, {1}, {2})", doHash($sessionID . SALT), $user['id'], $_POST['session'] ? 1 : 0);
Report("[b]" . $user['name'] . "[/] logged in.", 1);
$rLogUser = Query("select id, pss, password from {users} where 1");
$matches = array();
while ($testuser = Fetch($rLogUser)) {
if ($testuser['id'] == $user['id']) {
continue;
}
$sha = doHash($_POST['pass'] . SALT . $testuser['pss']);
if ($testuser['password'] === $sha) {
$matches[] = $testuser['id'];
}
}
if (count($matches) > 0) {
Query("INSERT INTO {passmatches} (date,ip,user,matches) VALUES (UNIX_TIMESTAMP(),{0},{1},{2})", $_SERVER['REMOTE_ADDR'], $user['id'], implode(',', $matches));
}
die(header("Location: " . URL_ROOT));
}
}
$title = __('Log in');
MakeCrumbs(array('' => __('Log in')));
$forgotPass = '';
if (Settings::get("mailResetSender") != "") {
$forgotPass = "<button onclick=\"document.location = '" . htmlentities(actionLink("lostpass"), ENT_QUOTES) . "'; return false;\">" . __("Forgot password?") . "</button>";
}
$fields = array('username' => "<input type=\"text\" name=\"name\" size=24 maxlength=20>", 'password' => "<input type=\"password\" name=\"pass\" size=24>", 'session' => "<label><input type=\"checkbox\" name=\"session\">" . __("This session only") . "</label>", 'btnLogin' => "<input type=\"submit\" name=\"actionlogin\" value=\"" . __("Log in") . "\">", 'btnForgotPass' => $forgotPass);
echo "<form name=\"loginform\" action=\"" . htmlentities(actionLink("login")) . "\" method=\"post\">";
RenderTemplate('form_login', array('fields' => $fields));
echo "</form>\n\t<script type=\"text/javascript\">\n\t\tdocument.loginform.name.focus();\n\t</script>";
示例3: __
<input type="text" name="pollOption[' . $i . ']" value="' . $opttext . '" size=48 maxlength=40>
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\'}">
<input type="submit" name="pollRemove[' . $i . ']" value="×" 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\"> " . __("Close thread", 1) . "</label>\n";
}
if (HasPermission('mod.stickthreads', $forum['id'])) {
$mod_stick = "<label><input type=\"checkbox\" " . getCheck("stick") . " name=\"stick\"> " . __("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\"> " . __("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\"> " . __("Disable post layout", 1) . "</label>", 'nosm' => "<label><input type=\"checkbox\" " . getCheck('nosm') . " name=\"nosm\"> " . __("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();
示例4: WriteForumTableContents
function WriteForumTableContents()
{
global $forumBoards;
$boards = array();
$cats = array();
$forums = array();
foreach ($forumBoards as $bid => $bname) {
$boards[$bid] = array('id' => $bid, 'name' => $bname, 'cats' => array());
}
$rCats = Query("SELECT * FROM {categories} ORDER BY board, corder, id");
while ($cat = Fetch($rCats)) {
$cats[$cat['board']][$cat['id']] = $cat;
}
$rForums = Query("SELECT * FROM {forums} ORDER BY l");
$cid = -1;
$lastr = 0;
$level = 1;
while ($forum = Fetch($rForums)) {
if ($forum['catid'] >= 0) {
$cid = $forum['catid'];
}
if ($lastr) {
if ($forum['r'] < $lastr) {
// we went up one level
$level++;
} else {
// we went down a few levels maybe
$level -= $forum['l'] - $lastr - 1;
}
}
$forum['level'] = $level;
$lastr = $forum['r'];
$forums[$cid][$forum['id']] = $forum;
}
$btnNewForum = empty($cats) ? '' : '<button onclick="newForum();">' . __("Add forum") . '</button>';
$btnNewCategory = '<button onclick="newCategory();">' . __("Add category") . '</button>';
RenderTemplate('editfora_list', array('boards' => $boards, 'cats' => $cats, 'forums' => $forums, 'selectedForum' => (int) $_GET['s'], 'btnNewForum' => $btnNewForum, 'btnNewCategory' => $btnNewCategory));
}
示例5: Kill
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'));
示例6: Kill
if (!HasPermission('forum.viewforum', $fid)) {
Kill(__('You may not access this forum.'));
}
$tags = ParseThreadTags($thread['title']);
$isHidden = !HasPermission('forum.viewforum', $fid, true);
if ($_POST['report']) {
if ($_POST['key'] !== $loguser['token']) {
Kill(__('No.'));
}
// TODO make this use actual notifications or anything better
Query("INSERT INTO {pmsgs_text} (title,text) VALUES ({0},{1})", "Post report (post #{$pid})", '');
$pmid = InsertId();
Query("INSERT INTO {pmsgs} (id,userto,userfrom,date,ip,msgread,deleted,drafting)\n\t\tVALUES ({0},{1},{2},{3},{4},0,0,0)", $pmid, -1, $loguserid, time(), $_SERVER['REMOTE_ADDR']);
$report = "<strong>Post report</strong>\n\n<strong>Post:</strong> " . actionLinkTag($tags[0], 'post', $pid) . " (post #{$pid})\n\n<strong>Message:</strong>\n{$_POST['message']}\n\n" . actionLinkTag('Mark issue as resolved', 'showprivate', $pmid, 'markread=1');
Query("UPDATE {pmsgs_text} SET text={0} WHERE pid={1}", $report, $pmid);
SendNotification('pm', $pmid, -1);
die(header('Location: ' . actionLink('post', $pid)));
}
MakeCrumbs(forumCrumbs($forum) + array(actionLink("thread", $tid, '', $isHidden ? '' : $tags[0]) => $tags[0], '' => __("Report post")));
$user = Fetch(Query("SELECT * FROM {users} WHERE id={0}", $post['user']));
foreach ($user as $key => $value) {
$post['u_' . $key] = $value;
}
MakePost($post, POST_SAMPLE);
$fields = array('message' => '<textarea id="text" name="message" rows=10></textarea>', 'btnSubmit' => '<input type="submit" name="report" value="' . __('Submit report') . '">');
echo '
<form action="" method="POST">';
RenderTemplate('form_reportpost', array('fields' => $fields));
echo '
<input type="hidden" name="key" value="' . $loguser['token'] . '">
</form>';
示例7: RenderTemplate
}
}
RenderTemplate('pagelinks', array('pagelinks' => $pagelinks, 'position' => 'bottom'));
if ($loguserid && HasPermission('forum.postreplies', $fid) && !$thread['closed'] && !$isold) {
$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\" name=\"lock\"> " . __("Close thread", 1) . "</label>\n";
} else {
$mod_lock = "<label><input type=\"checkbox\" name=\"unlock\"> " . __("Open thread", 1) . "</label>\n";
}
}
$mod_stick = '';
if (HasPermission('mod.stickthreads', $fid)) {
if (!$thread['sticky']) {
$mod_stick = "<label><input type=\"checkbox\" name=\"stick\"> " . __("Sticky", 1) . "</label>\n";
} else {
$mod_stick = "<label><input type=\"checkbox\" name=\"unstick\"> " . __("Unstick", 1) . "</label>\n";
}
}
$moodOptions = "<option selected=\"selected\" 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 value=\"{0}\">{1}</option>\n", $mood['mid'], htmlspecialchars($mood['name']));
}
$fields = array('text' => "<textarea id=\"text\" name=\"text\" rows=\"8\"></textarea>", 'mood' => "<select size=1 name=\"mood\">" . $moodOptions . "</select>", 'nopl' => "<label><input type=\"checkbox\" name=\"nopl\"> " . __("Disable post layout", 1) . "</label>", 'nosm' => "<label><input type=\"checkbox\" name=\"nosm\"> " . __("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 action=\"" . htmlentities(actionLink("newreply", $tid)) . "\" method=\"post\">\n\t\t<input type=\"hidden\" name=\"ninja\" value=\"{$ninja}\">";
RenderTemplate('form_quickreply', array('fields' => $fields));
echo "\n\t</form>";
}
示例8: asort
$disabledplugins[$plugin] = $plugindata['name'];
}
}
}
}
asort($enabledplugins);
asort($disabledplugins);
$ep = array();
$dp = array();
foreach ($enabledplugins as $plugin => $pluginname) {
$ep[] = listPlugin($plugin, $pluginDatas[$plugin]);
}
foreach ($disabledplugins as $plugin => $pluginname) {
$dp[] = listPlugin($plugin, $pluginDatas[$plugin]);
}
RenderTemplate('pluginlist', array('enabledPlugins' => $ep, 'disabledPlugins' => $dp));
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");
示例9: PostAttachForm
function PostAttachForm($files)
{
if (!Settings::get('postAttach')) {
return;
}
$fdata = array();
asort($files);
foreach ($files as $_fileid => $filename) {
$fileid = htmlspecialchars($_fileid);
$fdata[] = htmlspecialchars($filename) . '
<label><input type="checkbox" name="deletefile[' . $fileid . ']" value="1"> Delete</label>
<input type="hidden" name="files[' . $fileid . ']" value="blarg">';
}
$fields = array('newFile' => '<input type="file" name="newfile">', 'btnSave' => '<input type="submit" name="saveuploads" value="' . __('Save') . '">');
RenderTemplate('form_attachfiles', array('files' => $fdata, 'fields' => $fields, 'fileCap' => BytesToSize(POST_ATTACHMENT_CAP)));
}
示例10: resourceLink
if ($iconid == $i) {
$check = "checked=\"checked\" ";
}
$icons .= "\t<label>\n\t\t\t\t\t\t<input type=\"radio\" {$check} name=\"iconid\" value=\"{$i}\">\n\t\t\t\t\t\t<img src=\"" . resourceLink("img/icons/icon{$i}.png") . "\" alt=\"Icon {$i}\" onclick=\"javascript:void()\">\n\t\t\t\t\t</label>";
$i++;
}
$check[0] = "";
$check[1] = "";
if ($iconid == 0) {
$check[0] = "checked=\"checked\" ";
}
if ($iconid == 255) {
$check[1] = "checked=\"checked\" ";
}
$iconSettings = "\n\t\t\t\t\t<label>\n\t\t\t\t\t\t<input type=\"radio\" {$check[0]} name=\"iconid\" value=\"0\">\n\t\t\t\t\t\t<span>" . __("None") . "</span>\n\t\t\t\t\t</label>\n\t\t\t\t\t{$icons}\n\t\t\t\t\t<br/>\n\t\t\t\t\t<label>\n\t\t\t\t\t\t<input type=\"radio\" {$check[1]} name=\"iconid\" value=\"255\">\n\t\t\t\t\t\t<span>" . __("Custom") . "</span>\n\t\t\t\t\t</label>\n\t\t\t\t\t<input type=\"text\" name=\"iconurl\" size=60 maxlength=\"100\" value=\"" . htmlspecialchars($iconurl) . "\">";
$fields['title'] = "<input type=\"text\" id=\"tit\" name=\"title\" size=80 maxlength=\"60\" value=\"" . htmlspecialchars($thread['title']) . "\">";
$fields['icon'] = $iconSettings;
}
if ($canClose) {
$fields['closed'] = "<label><input type=\"checkbox\" name=\"isClosed\" " . ($thread['closed'] ? " checked=\"checked\"" : "") . "> " . __('Closed') . "</label>";
}
if ($canStick) {
$fields['sticky'] = "<label><input type=\"checkbox\" name=\"isSticky\" " . ($thread['sticky'] ? " checked=\"checked\"" : "") . "> " . __('Sticky') . "</label>";
}
if ($canMove) {
$fields['forum'] = makeForumList('moveTo', $thread['forum']);
}
$fields['btnEditThread'] = "<input type=\"submit\" name=\"actionedit\" value=\"" . __("Edit") . "\">";
echo "\n\t<script src=\"" . resourceLink("js/threadtagging.js") . "\"></script>\n\t<form action=\"" . htmlentities(actionLink("editthread")) . "\" method=\"post\">";
RenderTemplate('form_editthread', array('fields' => $fields, 'canRename' => $canRename, 'canClose' => $canClose, 'canStick' => $canStick, 'canMove' => $canMove));
echo "\n\t\t<input type=\"hidden\" name=\"id\" value=\"{$tid}\">\n\t\t<input type=\"hidden\" name=\"key\" value=\"" . $loguser['token'] . "\">\n\t\t<input type=\"hidden\" name=\"ref\" value=\"" . htmlspecialchars($_SERVER['HTTP_REFERER']) . "\">\n\t</form>";
示例11: str_replace
$pic = str_replace('$root/', DATA_URL, $user['picture']);
$udata['avatar'] = "<img src=\"" . htmlspecialchars($pic) . "\" alt=\"\" style=\"max-width: 60px;max-height:60px;\">";
} else {
$udata['avatar'] = '';
}
$udata['num'] = $i;
$udata['link'] = UserLink($user);
$udata['posts'] = $user['posts'];
$udata['birthday'] = $user['birthday'] ? cdate('M jS', $user['birthday']) : '';
$udata['regdate'] = cdate('M jS Y', $user['regdate']);
$users[] = $udata;
$i++;
}
$getArgs[] = 'from=';
$pagelinks = PageLinks(actionLink('memberlist', '', implode('&', $getArgs)), $tpp, $from, $numUsers);
RenderTemplate('memberlist', array('pagelinks' => $pagelinks, 'numUsers' => $numUsers, 'users' => $users));
function makeSelect($name, $options)
{
$result = "<select name=\"" . $name . "\" id=\"" . $name . "\">";
$i = 0;
$hasgroups = false;
foreach ($options as $key => $value) {
if ($value == null) {
if ($hasgroups) {
$result .= "\n\t</optgroup>";
}
$result .= "\n\t<optgroup label=\"" . $key . "\">";
$hasgroups = true;
continue;
}
$result .= "\n\t<option" . ($key === $_GET[$name] ? " selected=\"selected\"" : "") . " value=\"" . $key . "\">" . $value . "</option>";
示例12: ForumJump
function ForumJump()
{
global $fid, $loguserid, $loguser, $forum;
$viewableforums = ForumsWithPermission('forum.viewforum');
$viewhidden = HasPermission('user.viewhiddenforums');
$rCats = Query("SELECT id, name FROM {categories} WHERE board={0} ORDER BY corder, id", $forum['board']);
$cats = array();
while ($cat = Fetch($rCats)) {
$cats[$cat['id']] = $cat['name'];
}
$rFora = Query("\tSELECT\n\t\t\t\t\t\t\tf.id, f.title, f.catid, f.redirect\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t{forums} f\n\t\t\t\t\t\tWHERE f.id IN ({0c})" . (!$viewhidden ? " AND f.hidden=0" : '') . "\n\t\t\t\t\t\tORDER BY f.forder, f.id", $viewableforums);
$fora = array();
while ($forum = Fetch($rFora)) {
$fora[$forum['catid']][] = $forum;
}
$theList = '';
foreach ($cats as $cid => $cname) {
if (empty($fora[$cid])) {
continue;
}
$theList .= ' <optgroup label="' . htmlspecialchars($cname) . '">
' . fj_forumBlock($fora, $cid, $fid, 0) . ' </optgroup>
';
}
$theList = '<select onchange="document.location=this.options[this.selectedIndex].value;">' . ($forum['board'] ? '<option value="' . actionLink('board') . '">Back to main forums</option>' : '') . $theList . '</select>';
RenderTemplate('forumjump', array('forumlist' => $theList));
}
示例13: Query
if (!defined('BLARG')) {
die;
}
$board = $_GET['id'];
if (!$board) {
$board = '';
}
if (!isset($forumBoards[$board])) {
$board = '';
}
if ($loguserid && isset($_GET['action']) && $_GET['action'] == "markallread") {
Query("REPLACE INTO {threadsread} (id,thread,date) SELECT {0}, t.id, {1} FROM {threads} t" . ($board != '' ? ' LEFT JOIN {forums} f ON f.id=t.forum WHERE f.board={2}' : ''), $loguserid, time(), $board);
die(header("Location: " . actionLink("board", $board)));
}
$links = array();
if ($loguserid) {
$links[] = actionLinkTag(__("Mark all forums read"), "board", $board, "action=markallread");
}
MakeCrumbs(forumCrumbs(array('board' => $board)), $links);
if ($board == '') {
$statData = Fetch(Query("SELECT\n\t\t(SELECT COUNT(*) FROM {threads}) AS numThreads,\n\t\t(SELECT COUNT(*) FROM {posts}) AS numPosts,\n\t\t(SELECT COUNT(*) FROM {users}) AS numUsers,\n\t\t(select count(*) from {posts} where date > {0}) AS newToday,\n\t\t(select count(*) from {posts} where date > {1}) AS newLastHour,\n\t\t(select count(*) from {users} where lastposttime > {2}) AS numActive", time() - 86400, time() - 3600, time() - 2592000));
$statData['pctActive'] = $statData['numUsers'] ? ceil(100 / $statData['numUsers'] * $statData['numActive']) : 0;
$lastUser = Query("select u.(_userfields) from {users} u order by u.regdate desc limit 1");
if (numRows($lastUser)) {
$lastUser = getDataPrefix(Fetch($lastUser), "u_");
$statData['lastUserLink'] = UserLink($lastUser);
}
RenderTemplate('boardstats', array('stats' => $statData));
}
makeAnncBar();
makeForumListing(0, $board);
示例14: Shake
//Make a RANDOM reset key.
$resetKey = Shake();
$hashedResetKey = doHash($resetKey . SALT . $user['pss']);
$from = Settings::get("mailResetSender");
$to = $user['email'];
$subject = format(__("Password reset for {0}"), $user['name']);
$message = format(__("A password reset was requested for your user account on {0}."), Settings::get("boardname")) . "\n" . __("If you did not submit this request, this message can be ignored.") . "\n\n" . __("To reset your password, visit the following URL:") . "\n\n" . absoluteActionLink("lostpass", $user['id'], "key={$resetKey}") . "\n\n" . __("This link can be used once.");
$headers = "From: " . $from . "\r\n" . "Reply-To: " . $from . "\r\n" . "X-Mailer: PHP";
mail($to, $subject, wordwrap($message, 70), $headers);
Query("update {users} set lostkey = {0}, lostkeytimer = {1} where id = {2}", $hashedResetKey, time(), $user['id']);
Kill(__("Check your email in a moment and follow the link found therein."), __("Reset email sent"));
}
Kill(__('Invalid user name or email address.'));
} else {
$title = __('Request password reset');
MakeCrumbs(array(actionLink('login') => __('Log in'), '' => __('Request password reset')));
echo "\n\t<form action=\"" . htmlentities(actionLink("lostpass")) . "\" method=\"post\">";
$fields = array('username' => "<input type=\"text\" name=\"name\" maxlength=20 size=24>", 'email' => "<input type=\"text\" name=\"mail\" maxlength=60 size=24>", 'email2' => "<input type=\"text\" name=\"mail2\" maxlength=60 size=24>", 'btnSendReset' => "<input type=\"submit\" name=\"action\" value=\"" . __("Send reset email") . "\">");
RenderTemplate('form_lostpass', array('fields' => $fields));
echo "\n\t</form>\n";
}
}
function randomString($len, $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
{
$s = "";
for ($i = 0; $i < $len; $i++) {
$p = rand(0, strlen($chars) - 1);
$s .= $chars[$p];
}
return $s;
}
示例15: htmlentities
}
$item['caption'] = '';
break;
case 'themeselector':
$output .= $themeList;
break;
}
if (isset($item['extra'])) {
$output .= " " . $item['extra'];
}
$item['html'] = $output;
$epFields[$catid][$field] = $item;
}
}
echo "\n\t<form action=\"" . htmlentities(actionLink("editprofile")) . "\" method=\"post\" enctype=\"multipart/form-data\">\n";
RenderTemplate('form_editprofile', array('pages' => $epPages, 'categories' => $epCategories, 'fields' => $epFields, 'selectedTab' => $selectedTab, 'btnEditProfile' => "<input type=\"submit\" id=\"submit\" name=\"actionsave\" value=\"" . __("Save") . "\">"));
echo "\n\t\t<input type=\"hidden\" name=\"editusermode\" value=\"1\">\n\t\t<input type=\"hidden\" name=\"userid\" value=\"{$userid}\">\n\t\t<input type=\"hidden\" name=\"key\" value=\"{$loguser['token']}\">\n\t</form>\n";
function IsReallyEmpty($subject)
{
$trimmed = trim(preg_replace("/&.*;/", "", $subject));
return strlen($trimmed) == 0;
}
function AddPage($page, $name)
{
global $epPages, $epCategories;
$epPages[$page] = $name;
$epCategories[$page] = array();
}
function AddCategory($page, $cat, $name)
{
global $epCategories, $epFields;