本文整理汇总了PHP中isBrowser函数的典型用法代码示例。如果您正苦于以下问题:PHP isBrowser函数的具体用法?PHP isBrowser怎么用?PHP isBrowser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isBrowser函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: template_select_boards
/**
* Dropdown usable to select a board
*
* @param string $name
* @param string $label
* @param string $extra
* @param boolean $all
*/
function template_select_boards($name, $label = '', $extra = '', $all = false)
{
global $context, $txt;
if (!empty($label)) {
echo '
<label for="', $name, '">', $label, ' </label>';
}
echo '
<select name="', $name, '" id="', $name, '" ', $extra, ' >';
if ($all) {
echo '
<option value="">', $txt['icons_edit_icons_all_boards'], '</option>';
}
foreach ($context['categories'] as $category) {
echo '
<optgroup label="', $category['name'], '">';
foreach ($category['boards'] as $board) {
echo '
<option value="', $board['id'], '"', !empty($board['selected']) ? ' selected="selected"' : '', !empty($context['current_board']) && $board['id'] == $context['current_board'] && $context['boards_current_disabled'] ? ' disabled="disabled"' : '', '>', $board['child_level'] > 0 ? str_repeat(' ', $board['child_level'] - 1) . ' ' . (isBrowser('ie8') ? '»' : '➤') : '', $board['name'], '</option>';
}
echo '
</optgroup>';
}
echo '
</select>';
}
示例2: iCalDownload
/**
* This function offers up a download of an event in iCal 2.0 format.
*
* follows the conventions in RFC5546 http://tools.ietf.org/html/rfc5546
* sets events as all day events since we don't have hourly events
* will honor and set multi day events
* sets a sequence number if the event has been modified
*
* @todo .... allow for week or month export files as well?
*/
function iCalDownload()
{
global $smcFunc, $sourcedir, $forum_version, $context, $modSettings, $webmaster_email, $mbname;
// You can't export if the calendar export feature is off.
if (empty($modSettings['cal_export'])) {
fatal_lang_error('calendar_export_off', false);
}
// Goes without saying that this is required.
if (!isset($_REQUEST['eventid'])) {
fatal_lang_error('no_access', false);
}
// This is kinda wanted.
require_once $sourcedir . '/Subs-Calendar.php';
// Load up the event in question and check it exists.
$event = getEventProperties($_REQUEST['eventid']);
if ($event === false) {
fatal_lang_error('no_access', false);
}
// Check the title isn't too long - iCal requires some formatting if so.
$title = str_split($event['title'], 30);
foreach ($title as $id => $line) {
if ($id != 0) {
$title[$id] = ' ' . $title[$id];
}
$title[$id] .= "\n";
}
// Format the dates.
$datestamp = date('Ymd\\THis\\Z', time());
$datestart = $event['year'] . ($event['month'] < 10 ? '0' . $event['month'] : $event['month']) . ($event['day'] < 10 ? '0' . $event['day'] : $event['day']);
// Do we have a event that spans several days?
if ($event['span'] > 1) {
$dateend = strtotime($event['year'] . '-' . ($event['month'] < 10 ? '0' . $event['month'] : $event['month']) . '-' . ($event['day'] < 10 ? '0' . $event['day'] : $event['day']));
$dateend += ($event['span'] - 1) * 86400;
$dateend = date('Ymd', $dateend);
}
// This is what we will be sending later
$filecontents = '';
$filecontents .= 'BEGIN:VCALENDAR' . "\n";
$filecontents .= 'METHOD:PUBLISH' . "\n";
$filecontents .= 'PRODID:-//SimpleMachines//SMF ' . (empty($forum_version) ? 2.0 : strtr($forum_version, array('SMF ' => ''))) . '//EN' . "\n";
$filecontents .= 'VERSION:2.0' . "\n";
$filecontents .= 'BEGIN:VEVENT' . "\n";
$filecontents .= 'ORGANIZER;CN="' . $event['realname'] . '":MAILTO:' . $webmaster_email . "\n";
$filecontents .= 'DTSTAMP:' . $datestamp . "\n";
$filecontents .= 'DTSTART;VALUE=DATE:' . $datestart . "\n";
// more than one day
if ($event['span'] > 1) {
$filecontents .= 'DTEND;VALUE=DATE:' . $dateend . "\n";
}
// event has changed? advance the sequence for this UID
if ($event['sequence'] > 0) {
$filecontents .= 'SEQUENCE:' . $event['sequence'] . "\n";
}
$filecontents .= 'SUMMARY:' . implode('', $title);
$filecontents .= 'UID:' . $event['eventid'] . '@' . str_replace(' ', '-', $mbname) . "\n";
$filecontents .= 'END:VEVENT' . "\n";
$filecontents .= 'END:VCALENDAR';
// Send some standard headers.
ob_end_clean();
if (!empty($modSettings['enableCompressedOutput'])) {
@ob_start('ob_gzhandler');
} else {
ob_start();
}
// Send the file headers
header('Pragma: ');
header('Cache-Control: no-cache');
if (!isBrowser('gecko')) {
header('Content-Transfer-Encoding: binary');
}
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 525600 * 60) . ' GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . 'GMT');
header('Accept-Ranges: bytes');
header('Connection: close');
header('Content-Disposition: attachment; filename="' . $event['title'] . '.ics"');
if (empty($modSettings['enableCompressedOutput'])) {
header('Content-Length: ' . $smcFunc['strlen']($filecontents));
}
// This is a calendar item!
header('Content-Type: text/calendar');
// Chuck out the card.
echo $filecontents;
// Off we pop - lovely!
obExit(false);
}
示例3: template_results
//.........这里部分代码省略.........
echo '
<input type="checkbox" name="topics[]" value="', $topic['id'], '" class="input_check" />';
} else {
if ($topic['quick_mod']['remove']) {
echo '
<a href="', $scripturl, '?action=quickmod;actions%5B', $topic['id'], '%5D=remove;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['quickmod_confirm'], '\');"><img src="', $settings['images_url'], '/icons/quick_remove.png" style="width: 16px;" alt="', $txt['remove_topic'], '" title="', $txt['remove_topic'], '" /></a>';
}
if ($topic['quick_mod']['lock']) {
echo '
<a href="', $scripturl, '?action=quickmod;actions%5B', $topic['id'], '%5D=lock;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['quickmod_confirm'], '\');"><img src="', $settings['images_url'], '/icons/quick_lock.png" style="width: 16px;" alt="', $txt[$topic['is_locked'] ? 'set_unlock' : 'set_lock'], '" title="', $txt[$topic['is_locked'] ? 'set_unlock' : 'set_lock'], '" /></a>';
}
if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) {
echo '
<br />';
}
if ($topic['quick_mod']['sticky']) {
echo '
<a href="', $scripturl, '?action=quickmod;actions%5B', $topic['id'], '%5D=sticky;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['quickmod_confirm'], '\');"><img src="', $settings['images_url'], '/icons/quick_sticky.png" style="width: 16px;" alt="', $txt[$topic['is_sticky'] ? 'set_nonsticky' : 'set_sticky'], '" title="', $txt[$topic['is_sticky'] ? 'set_nonsticky' : 'set_sticky'], '" /></a>';
}
if ($topic['quick_mod']['move']) {
echo '
<a href="', $scripturl, '?action=movetopic;topic=', $topic['id'], '.0"><img src="', $settings['images_url'], '/icons/quick_move.png" style="width: 16px;" alt="', $txt['move_topic'], '" title="', $txt['move_topic'], '" /></a>';
}
}
echo '
</p>';
}
echo '
</li>';
}
}
echo '
</ul>';
// If we have results show a page index
if (!empty($context['topics'])) {
template_pagesection();
}
// Quick moderation enabled, then show an action area
if (!empty($context['topics']) && !empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) {
echo '
<div class="search_controls floatright">
<div class="additional_row">
<select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.move_to.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '>
<option value=""> </option>';
foreach ($context['qmod_actions'] as $qmod_action) {
if ($context['can_' . $qmod_action]) {
echo '
<option value="' . $qmod_action . '">' . (isBrowser('ie8') ? '»' : '➤') . ' ', $txt['quick_mod_' . $qmod_action] . '</option>';
}
}
echo '
</select>';
// Show a list of boards they can move the topic to.
if ($context['can_move']) {
echo '
<span id="quick_mod_jump_to"> </span>';
}
echo '
<input type="hidden" name="redirect_url" value="', $scripturl . '?action=search;sa=results;params=' . $context['params'], '" />
<input class="button_submit" type="submit" value="', $txt['quick_mod_go'], '" onclick="return document.forms.topicForm.qaction.value != \'\' && confirm(\'', $txt['quickmod_confirm'], '\');" />
</div>
</div>';
echo '
<input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" />
</form>';
}
// Show a jump to box for easy navigation.
echo '
<div class="floatright" id="search_jump_to"> </div>';
if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) {
addInlineJavascript('
aJumpTo[aJumpTo.length] = new JumpTo({
sContainerId: "quick_mod_jump_to",
sClassName: "qaction",
sJumpToTemplate: "%dropdown_list%",
sCurBoardName: "' . $context['jump_to']['board_name'] . '",
sBoardChildLevelIndicator: " ",
sBoardPrefix: "' . (isBrowser('ie8') ? '»' : '➤') . ' ",
sCatClass: "jump_to_header",
sCatPrefix: "",
bNoRedirect: true,
bDisabled: true,
sCustomName: "move_to"
});', true);
}
addInlineJavascript('
aJumpTo[aJumpTo.length] = new JumpTo({
sContainerId: "search_jump_to",
sJumpToTemplate: "<label class=\\"smalltext\\" for=\\"%select_id%\\">' . $context['jump_to']['label'] . ':<" + "/label> %dropdown_list%",
iCurBoardId: 0,
iCurBoardChildLevel: 0,
sCurBoardName: "' . $context['jump_to']['board_name'] . '",
sBoardChildLevelIndicator: " ",
sBoardPrefix: "' . (isBrowser('ie8') ? '»' : '➤') . ' ",
sCatClass: "jump_to_header",
sCatPrefix: "",
sGoButtonLabel: "' . $txt['quick_mod_go'] . '"
});', true);
}
示例4: html_to_bbc
/**
* !!!Compatibility!!!
*
* This is not directly required any longer, but left for mod usage
*
* The harder one - wysiwyg to BBC!
*
* @param string $text
* @return string
*/
function html_to_bbc($text)
{
global $modSettings, $scripturl, $context;
$db = database();
// Replace newlines with spaces, as that's how browsers usually interpret them.
$text = preg_replace("~\\s*[\r\n]+\\s*~", ' ', $text);
// Though some of us love paragraphs, the parser will do better with breaks.
$text = preg_replace('~</p>\\s*?<p~i', '</p><br /><p', $text);
$text = preg_replace('~</p>\\s*(?!<)~i', '</p><br />', $text);
// Safari/webkit wraps lines in Wysiwyg in <div>'s.
if (isBrowser('webkit')) {
$text = preg_replace(array('~<div(?:\\s(?:[^<>]*?))?' . '>~i', '</div>'), array('<br />', ''), $text);
}
// If there's a trailing break get rid of it - Firefox tends to add one.
$text = preg_replace('~<br\\s?/?' . '>$~i', '', $text);
// Remove any formatting within code tags.
if (strpos($text, '[code') !== false) {
$text = preg_replace('~<br\\s?/?' . '>~i', '#elk_br_spec_grudge_cool!#', $text);
$parts = preg_split('~(\\[/code\\]|\\[code(?:=[^\\]]+)?\\])~i', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
// Only mess with stuff outside [code] tags.
for ($i = 0, $n = count($parts); $i < $n; $i++) {
// Value of 2 means we're inside the tag.
if ($i % 4 == 2) {
$parts[$i] = strip_tags($parts[$i]);
}
}
$text = strtr(implode('', $parts), array('#elk_br_spec_grudge_cool!#' => '<br />'));
}
// Remove scripts, style and comment blocks.
$text = preg_replace('~<script[^>]*[^/]?' . '>.*?</script>~i', '', $text);
$text = preg_replace('~<style[^>]*[^/]?' . '>.*?</style>~i', '', $text);
$text = preg_replace('~\\<\\!--.*?-->~i', '', $text);
$text = preg_replace('~\\<\\!\\[CDATA\\[.*?\\]\\]\\>~i', '', $text);
// Do the smileys ultra first!
preg_match_all('~<img\\s+[^<>]*?id="*smiley_\\d+_([^<>]+?)[\\s"/>]\\s*[^<>]*?/*>(?:\\s)?~i', $text, $matches);
if (!empty($matches[0])) {
// Easy if it's not custom.
if (empty($modSettings['smiley_enable'])) {
$smileysfrom = array('>:D', ':D', '::)', '>:(', ':)', ';)', ';D', ':(', ':o', '8)', ':P', '???', ':-[', ':-X', ':-*', ':\'(', ':-\\', '^-^', 'O0', 'C:-)', '0:)');
$smileysto = array('evil.gif', 'cheesy.gif', 'rolleyes.gif', 'angry.gif', 'smiley.gif', 'wink.gif', 'grin.gif', 'sad.gif', 'shocked.gif', 'cool.gif', 'tongue.gif', 'huh.gif', 'embarrassed.gif', 'lipsrsealed.gif', 'kiss.gif', 'cry.gif', 'undecided.gif', 'azn.gif', 'afro.gif', 'police.gif', 'angel.gif');
foreach ($matches[1] as $k => $file) {
$found = array_search($file, $smileysto);
// Note the weirdness here is to stop double spaces between smileys.
if ($found) {
$matches[1][$k] = '-[]-elk_smily_start#|#' . htmlspecialchars($smileysfrom[$found]) . '-[]-elk_smily_end#|#';
} else {
$matches[1][$k] = '';
}
}
} else {
// Load all the smileys.
$names = array();
foreach ($matches[1] as $file) {
$names[] = $file;
}
$names = array_unique($names);
if (!empty($names)) {
$request = $db->query('', '
SELECT code, filename
FROM {db_prefix}smileys
WHERE filename IN ({array_string:smiley_filenames})', array('smiley_filenames' => $names));
$mappings = array();
while ($row = $db->fetch_assoc($request)) {
$mappings[$row['filename']] = htmlspecialchars($row['code']);
}
$db->free_result($request);
foreach ($matches[1] as $k => $file) {
if (isset($mappings[$file])) {
$matches[1][$k] = '-[]-elk_smily_start#|#' . $mappings[$file] . '-[]-elk_smily_end#|#';
}
}
}
}
// Replace the tags!
$text = str_replace($matches[0], $matches[1], $text);
// Now sort out spaces
$text = str_replace(array('-[]-elk_smily_end#|#-[]-elk_smily_start#|#', '-[]-elk_smily_end#|#', '-[]-elk_smily_start#|#'), ' ', $text);
}
// Only try to buy more time if the client didn't quit.
if (connection_aborted() && $context['server']['is_apache']) {
@apache_reset_timeout();
}
$parts = preg_split('~(<[A-Za-z]+\\s*[^<>]*?style="?[^<>"]+"?[^<>]*?(?:/?)>|</[A-Za-z]+>)~', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
$replacement = '';
$stack = array();
foreach ($parts as $part) {
if (preg_match('~(<([A-Za-z]+)\\s*[^<>]*?)style="?([^<>"]+)"?([^<>]*?(/?)>)~', $part, $matches) === 1) {
// If it's being closed instantly, we can't deal with it...yet.
if ($matches[5] === '/') {
continue;
//.........这里部分代码省略.........
示例5: template_viewmodreport
/**
* View the details of a moderation report
*/
function template_viewmodreport()
{
global $context, $scripturl, $txt;
echo '
<div id="modcenter">
<form action="', $scripturl, '?action=moderate;area=reports;report=', $context['report']['id'], '" method="post" accept-charset="UTF-8">
<h3 class="category_header">
', sprintf($txt['mc_viewmodreport'], $context['report']['message_link'], $context['report']['author']['link']), '
</h3>
<div class="windowbg2">
<p class="warningbox">', sprintf($txt['mc_modreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '</p>
<div class="content">
', $context['report']['body'], '
</div>
<ul class="quickbuttons">
<li class="listlevel1">
<a class="linklevel1 close_button" href="', $scripturl, '?action=moderate;area=reports;close=', (int) (!$context['report']['closed']), ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $context['report']['closed'] ? $txt['mc_reportedp_open'] : $txt['mc_reportedp_close'], '</a>
</li>
<li class="listlevel1">
<a class="linklevel1 ignore_button" href="', $scripturl, '?action=moderate;area=reports;ignore=', (int) (!$context['report']['ignore']), ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], '" ', !$context['report']['ignore'] ? 'onclick="return confirm(' . JavaScriptEscape($txt['mc_reportedp_ignore_confirm']) . ');"' : '', '>', $context['report']['ignore'] ? $txt['mc_reportedp_unignore'] : $txt['mc_reportedp_ignore'], '</a>
</li>
</ul>
</div>
<h3 class="category_header">', $txt['mc_modreport_whoreported_title'], '</h3>';
foreach ($context['report']['comments'] as $comment) {
echo '
<div class="windowbg">
<div class="content">
<p class="smalltext">', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '</p>
<p>', $comment['message'], '</p>
</div>
</div>';
}
echo '
<h3 class="category_header">', $txt['mc_modreport_mod_comments'], '</h3>
<div class="windowbg2">
<div class="content">';
if (empty($context['report']['mod_comments'])) {
echo '
<p class="successbox">', $txt['mc_modreport_no_mod_comment'], '</p>';
}
foreach ($context['report']['mod_comments'] as $comment) {
echo '<p>', $comment['member']['link'], ': ', $comment['message'], ' <em class="smalltext">(', $comment['time'], ')</em></p>';
}
echo '
<textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 100%') . ';" name="mod_comment"></textarea>
<div class="submitbutton">
<input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button_submit" />
</div>
</div>
</div>';
template_show_list('moderation_actions_list');
echo '
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</form>
</div>';
}
示例6: template_html_above
/**
* The main sub template above the content.
*/
function template_html_above()
{
global $context, $settings, $scripturl, $txt, $modSettings;
// Show right to left and the character set for ease of translating.
echo '<!DOCTYPE html>
<html ', $context['right_to_left'] ? ' dir="rtl"' : '', '>
<head>
<title>', $context['page_title_html_safe'], '</title>';
// Tell IE to render the page in standards not compatibility mode. really for ie >= 8
// Note if this is not in the first 4k, its ignored, thats why its here
if (isBrowser('ie')) {
echo '
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />';
}
// load in any css from mods or themes so they can overwrite if wanted
template_css();
// Save some database hits, if a width for multiple wrappers is set in admin.
if (!empty($settings['forum_width'])) {
echo '
<style>
#wrapper, .frame {
width: ', $settings['forum_width'], ';
}
</style>';
}
// Quick and dirty testing of RTL horrors. Remove before production build.
//echo '
//<link rel="stylesheet" href="', $settings['theme_url'], '/css/rtl.css?alp21" />';
// RTL languages require an additional stylesheet.
if ($context['right_to_left']) {
echo '
<link rel="stylesheet" href="', $settings['theme_url'], '/css/rtl.css?alp21" />';
if (!empty($context['theme_variant'])) {
echo '
<link rel="stylesheet" href="', $settings['theme_url'], '/css/rtl', $context['theme_variant'], '.css?alp21" />';
}
}
echo '
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width" />
<meta name="description" content="', $context['page_title_html_safe'], '" />', !empty($context['meta_keywords']) ? '
<meta name="keywords" content="' . $context['meta_keywords'] . '" />' : '';
// Please don't index these Mr Robot.
if (!empty($context['robot_no_index'])) {
echo '
<meta name="robots" content="noindex" />';
}
// Present a canonical url for search engines to prevent duplicate content in their indices.
if (!empty($context['canonical_url'])) {
echo '
<link rel="canonical" href="', $context['canonical_url'], '" />';
}
// Show all the relative links, such as help, search, contents, and the like.
echo '
<link rel="help" href="', $scripturl, '?action=help" />
<link rel="contents" href="', $scripturl, '" />', $context['allow_search'] ? '
<link rel="search" href="' . $scripturl . '?action=search" />' : '';
// If RSS feeds are enabled, advertise the presence of one.
if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged'])) {
echo '
<link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $scripturl, '?type=rss2;action=.xml" />
<link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['atom'], '" href="', $scripturl, '?type=atom;action=.xml" />';
}
// If we're viewing a topic, these should be the previous and next topics, respectively.
if (!empty($context['links']['next'])) {
echo '<link rel="next" href="', $context['links']['next'], '" />';
} else {
if (!empty($context['current_topic'])) {
echo '<link rel="next" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=next" />';
}
}
if (!empty($context['links']['prev'])) {
echo '<link rel="prev" href="', $context['links']['prev'], '" />';
} else {
if (!empty($context['current_topic'])) {
echo '<link rel="prev" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=prev" />';
}
}
// If we're in a board, or a topic for that matter, the index will be the board's index.
if (!empty($context['current_board'])) {
echo '
<link rel="index" href="', $scripturl, '?board=', $context['current_board'], '.0" />';
}
// load in any javascript files from mods and themes
template_javascript();
// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'];
// A little help for our friends
echo '
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->';
echo '
</head>
<body id="', $context['browser_body_id'], '" class="action_', !empty($context['current_action']) ? htmlspecialchars($context['current_action']) : (!empty($context['current_board']) ? 'messageindex' : (!empty($context['current_topic']) ? 'display' : 'home')), !empty($context['current_board']) ? ' board_' . htmlspecialchars($context['current_board']) : '', '">';
}
示例7: action_coppa
/**
* This function will display the contact information for the forum, as well a form to fill in.
* Accessed by action=coppa
*/
public function action_coppa()
{
global $context, $modSettings, $txt;
loadLanguage('Login');
loadTemplate('Register');
// No User ID??
if (!isset($_GET['member'])) {
fatal_lang_error('no_access', false);
}
// Get the user details...
require_once SUBSDIR . '/Members.subs.php';
$member = getBasicMemberData((int) $_GET['member'], array('authentication' => true));
// If doesn't exist or not pending coppa
if (empty($member) || $member['is_activated'] != 5) {
fatal_lang_error('no_access', false);
}
if (isset($_GET['form'])) {
// Some simple contact stuff for the forum.
$context['forum_contacts'] = (!empty($modSettings['coppaPost']) ? $modSettings['coppaPost'] . '<br /><br />' : '') . (!empty($modSettings['coppaFax']) ? $modSettings['coppaFax'] . '<br />' : '');
$context['forum_contacts'] = !empty($context['forum_contacts']) ? $context['forum_name_html_safe'] . '<br />' . $context['forum_contacts'] : '';
// Showing template?
if (!isset($_GET['dl'])) {
// Shortcut for producing underlines.
$context['ul'] = '<u> </u>';
Template_Layers::getInstance()->removeAll();
$context['sub_template'] = 'coppa_form';
$context['page_title'] = replaceBasicActionUrl($txt['coppa_form_title']);
$context['coppa_body'] = str_replace(array('{PARENT_NAME}', '{CHILD_NAME}', '{USER_NAME}'), array($context['ul'], $context['ul'], $member['member_name']), replaceBasicActionUrl($txt['coppa_form_body']));
} else {
// The data.
$ul = ' ';
$crlf = "\r\n";
$data = $context['forum_contacts'] . $crlf . $txt['coppa_form_address'] . ':' . $crlf . $txt['coppa_form_date'] . ':' . $crlf . $crlf . $crlf . replaceBasicActionUrl($txt['coppa_form_body']);
$data = str_replace(array('{PARENT_NAME}', '{CHILD_NAME}', '{USER_NAME}', '<br>', '<br />'), array($ul, $ul, $member['member_name'], $crlf, $crlf), $data);
// Send the headers.
header('Connection: close');
header('Content-Disposition: attachment; filename="approval.txt"');
header('Content-Type: ' . (isBrowser('ie') || isBrowser('opera') ? 'application/octetstream' : 'application/octet-stream'));
header('Content-Length: ' . count($data));
echo $data;
obExit(false);
}
} else {
$context += array('page_title' => $txt['coppa_title'], 'sub_template' => 'coppa');
$context['coppa'] = array('body' => str_replace('{MINIMUM_AGE}', $modSettings['coppaAge'], replaceBasicActionUrl($txt['coppa_after_registration'])), 'many_options' => !empty($modSettings['coppaPost']) && !empty($modSettings['coppaFax']), 'post' => empty($modSettings['coppaPost']) ? '' : $modSettings['coppaPost'], 'fax' => empty($modSettings['coppaFax']) ? '' : $modSettings['coppaFax'], 'phone' => empty($modSettings['coppaPhone']) ? '' : str_replace('{PHONE_NUMBER}', $modSettings['coppaPhone'], $txt['coppa_send_by_phone']), 'id' => $_GET['member']);
}
}
示例8: template_groupMembership
function template_groupMembership()
{
global $context, $settings, $options, $scripturl, $modSettings, $txt;
// The main containing header.
echo '
<form action="', $scripturl, '?action=profile;area=groupmembership;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator">
<div class="cat_bar">
<h3 class="catbg">
<img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />', $txt['profile'], '
</h3>
</div>
<p class="description">', $txt['groupMembership_info'], '</p>';
// Do we have an update message?
if (!empty($context['update_message'])) {
echo '
<div class="infobox">
', $context['update_message'], '.
</div>';
}
// Requesting membership to a group?
if (!empty($context['group_request'])) {
echo '
<div class="groupmembership">
<div class="cat_bar">
<h3 class="catbg">', $txt['request_group_membership'], '</h3>
</div>
<div class="roundframe">
', $txt['request_group_membership_desc'], ':
<textarea name="reason" rows="4" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 99%; min-width: 99%' : 'width: 99%') . ';"></textarea>
<div class="righttext" style="margin: 0.5em 0.5% 0 0.5%;">
<input type="hidden" name="gid" value="', $context['group_request']['id'], '" />
<input type="submit" name="req" value="', $txt['submit_request'], '" class="button_submit" />
</div>
</div>
</div>';
} else {
echo '
<table border="0" width="100%" cellspacing="0" cellpadding="4" class="table_grid">
<thead>
<tr class="catbg">
<th class="first_th" scope="col" ', $context['can_edit_primary'] ? ' colspan="2"' : '', '>', $txt['current_membergroups'], '</th>
<th class="last_th" scope="col"></th>
</tr>
</thead>
<tbody>';
$alternate = true;
foreach ($context['groups']['member'] as $group) {
echo '
<tr class="', $alternate ? 'windowbg' : 'windowbg2', '" id="primdiv_', $group['id'], '">';
if ($context['can_edit_primary']) {
echo '
<td width="4%">
<input type="radio" name="primary" id="primary_', $group['id'], '" value="', $group['id'], '" ', $group['is_primary'] ? 'checked="checked"' : '', ' onclick="highlightSelected(\'primdiv_' . $group['id'] . '\');" ', $group['can_be_primary'] ? '' : 'disabled="disabled"', ' class="input_radio" />
</td>';
}
echo '
<td>
<label for="primary_', $group['id'], '"><strong>', empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>', '</strong>', !empty($group['desc']) ? '<br /><span class="smalltext">' . $group['desc'] . '</span>' : '', '</label>
</td>
<td width="15%" class="righttext">';
// Can they leave their group?
if ($group['can_leave']) {
echo '
<a href="' . $scripturl . '?action=profile;save;u=' . $context['id_member'] . ';area=groupmembership;' . $context['session_var'] . '=' . $context['session_id'] . ';gid=' . $group['id'] . ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">' . $txt['leave_group'] . '</a>';
}
echo '
</td>
</tr>';
$alternate = !$alternate;
}
echo '
</tbody>
</table>';
if ($context['can_edit_primary']) {
echo '
<div class="padding righttext">
<input type="submit" value="', $txt['make_primary'], '" class="button_submit" />
</div>';
}
// Any groups they can join?
if (!empty($context['groups']['available'])) {
echo '
<br />
<table border="0" width="100%" cellspacing="0" cellpadding="4" class="table_grid">
<thead>
<tr class="catbg">
<th class="first_th" scope="col">
', $txt['available_groups'], '
</th>
<th class="last_th" scope="col"></th>
</tr>
</thead>
<tbody>';
$alternate = true;
foreach ($context['groups']['available'] as $group) {
echo '
<tr class="', $alternate ? 'windowbg' : 'windowbg2', '">
<td>
<strong>', empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>', '</strong>', !empty($group['desc']) ? '<br /><span class="smalltext">' . $group['desc'] . '</span>' : '', '
</td>
//.........这里部分代码省略.........
示例9: BookOfUnknown
function BookOfUnknown()
{
global $context;
if (strpos($_GET['action'], 'mozilla') !== false && !isBrowser('gecko')) {
redirectexit('http://www.getfirefox.com/');
} elseif (strpos($_GET['action'], 'mozilla') !== false) {
redirectexit('about:mozilla');
}
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
<head>
<title>The Book of Unknown, ', @$_GET['verse'] == '2:18' ? '2:18' : '4:16', '</title>
<style type="text/css">
em
{
font-size: 1.3em;
line-height: 0;
}
</style>
</head>
<body style="background-color: #444455; color: white; font-style: italic; font-family: serif;">
<div style="margin-top: 12%; font-size: 1.1em; line-height: 1.4; text-align: center;">';
if (@$_GET['verse'] == '2:18') {
echo '
Woe, it was that his name wasn\'t <em>known</em>, that he came in mystery, and was recognized by none. And it became to be in those days <em>something</em>. Something not yet <em id="unknown" name="[Unknown]">unknown</em> to mankind. And thus what was to be known the <em>secret project</em> began into its existence. Henceforth the opposition was only <em>weary</em> and <em>fearful</em>, for now their match was at arms against them.';
} else {
echo '
And it came to pass that the <em>unbelievers</em> dwindled in number and saw rise of many <em>proselytizers</em>, and the opposition found fear in the face of the <em>x</em> and the <em>j</em> while those who stood with the <em>something</em> grew stronger and came together. Still, this was only the <em>beginning</em>, and what lay in the future was <em id="unknown" name="[Unknown]">unknown</em> to all, even those on the right side.';
}
echo '
</div>
<div style="margin-top: 2ex; font-size: 2em; text-align: right;">';
if (@$_GET['verse'] == '2:18') {
echo '
from <span style="font-family: Georgia, serif;"><strong><a href="http://www.unknownbrackets.com/about:unknown" style="color: white; text-decoration: none; cursor: text;">The Book of Unknown</a></strong>, 2:18</span>';
} else {
echo '
from <span style="font-family: Georgia, serif;"><strong><a href="http://www.unknownbrackets.com/about:unknown" style="color: white; text-decoration: none; cursor: text;">The Book of Unknown</a></strong>, 4:16</span>';
}
echo '
</div>
</body>
</html>';
obExit(false);
}
示例10: action_browse
/**
* List all members who are awaiting approval / activation, sortable on different columns.
*
* What it does:
* - It allows instant approval or activation of (a selection of) members.
* - Called by ?action=admin;area=viewmembers;sa=browse;type=approve
* or ?action=admin;area=viewmembers;sa=browse;type=activate.
* - The form submits to ?action=admin;area=viewmembers;sa=approve.
* - Requires the moderate_forum permission.
*
* @uses the admin_browse sub template of the ManageMembers template.
*/
public function action_browse()
{
global $txt, $context, $scripturl, $modSettings;
// Not a lot here!
$context['page_title'] = $txt['admin_members'];
$context['sub_template'] = 'admin_browse';
$context['browse_type'] = isset($_REQUEST['type']) ? $_REQUEST['type'] : (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 1 ? 'activate' : 'approve');
if (isset($context['tabs'][$context['browse_type']])) {
$context['tabs'][$context['browse_type']]['is_selected'] = true;
}
// Allowed filters are those we can have, in theory.
$context['allowed_filters'] = $context['browse_type'] == 'approve' ? array(3, 4, 5) : array(0, 2);
$context['current_filter'] = isset($_REQUEST['filter']) && in_array($_REQUEST['filter'], $context['allowed_filters']) && !empty($context['activation_numbers'][$_REQUEST['filter']]) ? (int) $_REQUEST['filter'] : -1;
// Sort out the different sub areas that we can actually filter by.
$context['available_filters'] = array();
foreach ($context['activation_numbers'] as $type => $amount) {
// We have some of these...
if (in_array($type, $context['allowed_filters']) && $amount > 0) {
$context['available_filters'][] = array('type' => $type, 'amount' => $amount, 'desc' => isset($txt['admin_browse_filter_type_' . $type]) ? $txt['admin_browse_filter_type_' . $type] : '?', 'selected' => $type == $context['current_filter']);
}
}
// If the filter was not sent, set it to whatever has people in it!
if ($context['current_filter'] == -1 && !empty($context['available_filters'][0]['amount'])) {
$context['current_filter'] = $context['available_filters'][0]['type'];
$context['available_filters'][0]['selected'] = true;
}
// This little variable is used to determine if we should flag where we are looking.
$context['show_filter'] = $context['current_filter'] != 0 && $context['current_filter'] != 3 || count($context['available_filters']) > 1;
// The columns that can be sorted.
$context['columns'] = array('id_member' => array('label' => $txt['admin_browse_id']), 'member_name' => array('label' => $txt['admin_browse_username']), 'email_address' => array('label' => $txt['admin_browse_email']), 'member_ip' => array('label' => $txt['admin_browse_ip']), 'date_registered' => array('label' => $txt['admin_browse_registered']));
// Are we showing duplicate information?
if (isset($_GET['showdupes'])) {
$_SESSION['showdupes'] = (int) $_GET['showdupes'];
}
$context['show_duplicates'] = !empty($_SESSION['showdupes']);
// Determine which actions we should allow on this page.
if ($context['browse_type'] == 'approve') {
// If we are approving deleted accounts we have a slightly different list... actually a mirror ;)
if ($context['current_filter'] == 4) {
$context['allowed_actions'] = array('reject' => $txt['admin_browse_w_approve_deletion'], 'ok' => $txt['admin_browse_w_reject']);
} else {
$context['allowed_actions'] = array('ok' => $txt['admin_browse_w_approve'], 'okemail' => $txt['admin_browse_w_approve'] . ' ' . $txt['admin_browse_w_email'], 'require_activation' => $txt['admin_browse_w_approve_require_activate'], 'reject' => $txt['admin_browse_w_reject'], 'rejectemail' => $txt['admin_browse_w_reject'] . ' ' . $txt['admin_browse_w_email']);
}
} elseif ($context['browse_type'] == 'activate') {
$context['allowed_actions'] = array('ok' => $txt['admin_browse_w_activate'], 'okemail' => $txt['admin_browse_w_activate'] . ' ' . $txt['admin_browse_w_email'], 'delete' => $txt['admin_browse_w_delete'], 'deleteemail' => $txt['admin_browse_w_delete'] . ' ' . $txt['admin_browse_w_email'], 'remind' => $txt['admin_browse_w_remind'] . ' ' . $txt['admin_browse_w_email']);
}
// Create an option list for actions allowed to be done with selected members.
$allowed_actions = '
<option selected="selected" value="">' . $txt['admin_browse_with_selected'] . ':</option>
<option value="" disabled="disabled">' . str_repeat('—', strlen($txt['admin_browse_with_selected'])) . '</option>';
// ie8 fonts don't have the glyph coverage we desire
$arrow = isBrowser('ie8') ? '» ' : '➤ ';
foreach ($context['allowed_actions'] as $key => $desc) {
$allowed_actions .= '
<option value="' . $key . '">' . $arrow . $desc . '</option>';
}
// Setup the Javascript function for selecting an action for the list.
$javascript = '
function onSelectChange()
{
if (document.forms.postForm.todo.value == "")
return;
var message = "";';
// We have special messages for approving deletion of accounts - it's surprisingly logical - honest.
if ($context['current_filter'] == 4) {
$javascript .= '
if (document.forms.postForm.todo.value.indexOf("reject") != -1)
message = "' . $txt['admin_browse_w_delete'] . '";
else
message = "' . $txt['admin_browse_w_reject'] . '";';
} else {
$javascript .= '
if (document.forms.postForm.todo.value.indexOf("delete") != -1)
message = "' . $txt['admin_browse_w_delete'] . '";
else if (document.forms.postForm.todo.value.indexOf("reject") != -1)
message = "' . $txt['admin_browse_w_reject'] . '";
else if (document.forms.postForm.todo.value == "remind")
message = "' . $txt['admin_browse_w_remind'] . '";
else
message = "' . ($context['browse_type'] == 'approve' ? $txt['admin_browse_w_approve'] : $txt['admin_browse_w_activate']) . '";';
}
$javascript .= '
if (confirm(message + " ' . $txt['admin_browse_warn'] . '"))
document.forms.postForm.submit();
}';
$listOptions = array('id' => 'approve_list', 'items_per_page' => $modSettings['defaultMaxMembers'], 'base_href' => $scripturl . '?action=admin;area=viewmembers;sa=browse;type=' . $context['browse_type'] . (!empty($context['show_filter']) ? ';filter=' . $context['current_filter'] : ''), 'default_sort_col' => 'date_registered', 'get_items' => array('file' => SUBSDIR . '/Members.subs.php', 'function' => 'list_getMembers', 'params' => array('is_activated = {int:activated_status}', array('activated_status' => $context['current_filter']), $context['show_duplicates'])), 'get_count' => array('file' => SUBSDIR . '/Members.subs.php', 'function' => 'list_getNumMembers', 'params' => array('is_activated = {int:activated_status}', array('activated_status' => $context['current_filter']))), 'columns' => array('id_member' => array('header' => array('value' => $txt['member_id']), 'data' => array('db' => 'id_member'), 'sort' => array('default' => 'id_member', 'reverse' => 'id_member DESC')), 'user_name' => array('header' => array('value' => $txt['username']), 'data' => array('sprintf' => array('format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=profile;u=%1$d">%2$s</a>', 'params' => array('id_member' => false, 'member_name' => false))), 'sort' => array('default' => 'member_name', 'reverse' => 'member_name DESC')), 'email' => array('header' => array('value' => $txt['email_address']), 'data' => array('sprintf' => array('format' => '<a href="mailto:%1$s">%1$s</a>', 'params' => array('email_address' => true))), 'sort' => array('default' => 'email_address', 'reverse' => 'email_address DESC')), 'ip' => array('header' => array('value' => $txt['ip_address']), 'data' => array('sprintf' => array('format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=trackip;searchip=%1$s">%1$s</a>', 'params' => array('member_ip' => false))), 'sort' => array('default' => 'INET_ATON(member_ip)', 'reverse' => 'INET_ATON(member_ip) DESC')), 'hostname' => array('header' => array('value' => $txt['hostname']), 'data' => array('function' => create_function('$rowData', '
return host_from_ip($rowData[\'member_ip\']);
//.........这里部分代码省略.........
示例11: template_groupMembership
/**
* Template for choosing group membership.
*/
function template_groupMembership()
{
global $context, $scripturl, $txt;
// The main containing header.
echo '
<form action="', $scripturl, '?action=profile;area=groupmembership;save" method="post" accept-charset="UTF-8" name="creator" id="creator">
<h2 class="category_header hdicon cat_img_profile">
', $txt['profile'], '
</h2>
<p class="description">', $txt['groupMembership_info'], '</p>';
// Do we have an update message?
if (!empty($context['update_message'])) {
echo '
<div class="successbox">
', $context['update_message'], '.
</div>';
}
// Requesting membership to a group?
if (!empty($context['group_request'])) {
echo '
<div class="groupmembership">
<h3 class="category_header">', $txt['request_group_membership'], '</h3>
<div class="roundframe">
', $txt['request_group_membership_desc'], ':
<textarea name="reason" rows="4" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 100%; min-width: 100%' : 'width: 99%') . ';"></textarea>
<div class="submitbutton">
<input type="hidden" name="gid" value="', $context['group_request']['id'], '" />
<input type="submit" name="req" value="', $txt['submit_request'], '" class="button_submit" />
</div>
</div>
</div>';
} else {
echo '
<table class="table_grid">
<thead>
<tr class="table_head">
<th scope="col" ', $context['can_edit_primary'] ? ' colspan="2"' : '', '>', $txt['current_membergroups'], '</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>';
foreach ($context['groups']['member'] as $group) {
echo '
<tr id="primdiv_', $group['id'], ' "class="windowbg">';
if ($context['can_edit_primary']) {
echo '
<td>
<input type="radio" name="primary" id="primary_', $group['id'], '" value="', $group['id'], '" ', $group['is_primary'] ? 'checked="checked" ' : '', $group['can_be_primary'] ? '' : 'disabled="disabled" ', ' class="input_radio" />
</td>';
}
echo '
<td>
<label for="primary_', $group['id'], '"><strong>', empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>', '</strong>', !empty($group['desc']) ? '<br /><span class="smalltext">' . $group['desc'] . '</span>' : '', '</label>
</td>
<td class="grid17 righttext">';
// Can they leave their group?
if ($group['can_leave']) {
echo '
<a href="' . $scripturl . '?action=profile;save;u=' . $context['id_member'] . ';area=groupmembership;' . $context['session_var'] . '=' . $context['session_id'] . ';gid=' . $group['id'] . ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">' . $txt['leave_group'] . '</a>';
}
echo '
</td>
</tr>';
}
echo '
</tbody>
</table>';
if ($context['can_edit_primary']) {
echo '
<div class="submitbutton">
<input type="submit" value="', $txt['make_primary'], '" class="button_submit" />
</div>';
}
// Any groups they can join?
if (!empty($context['groups']['available'])) {
echo '
<br />
<table class="table_grid">
<thead>
<tr class="table_head">
<th scope="col">
', $txt['available_groups'], '
</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>';
foreach ($context['groups']['available'] as $group) {
echo '
<tr class="windowbg">
<td>
<strong>', empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>', '</strong>', !empty($group['desc']) ? '<br /><span class="smalltext">' . $group['desc'] . '</span>' : '', '
</td>
<td class="lefttext">';
if ($group['type'] == 3) {
echo '
<a class="linkbutton_right" href="', $scripturl, '?action=profile;save;u=', $context['id_member'], ';area=groupmembership;', $context['session_var'], '=', $context['session_id'], ';gid=', $group['id'], ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">', $txt['join_group'], '</a>';
//.........这里部分代码省略.........
示例12: template_main
//.........这里部分代码省略.........
sImageExpanded: "expand.png",
sJumpAnchor: "quickreply",
bIsFull: ', !empty($options['display_quick_reply']) && $options['display_quick_reply'] > 2 ? 'true' : 'false', '
});';
}
if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $context['can_remove_post']) {
echo '
var oInTopicModeration = new InTopicModeration({
sSelf: \'oInTopicModeration\',
sCheckboxContainerMask: \'in_topic_mod_check_\',
aMessageIds: [\'', implode('\', \'', $removableMessageIDs), '\'],
sSessionId: smf_session_id,
sSessionVar: smf_session_var,
sButtonStrip: \'moderationbuttons\',
sButtonStripDisplay: \'moderationbuttons_strip\',
bUseImageButton: false,
bCanRemove: ', $context['can_remove_post'] ? 'true' : 'false', ',
sRemoveButtonLabel: \'', $txt['quickmod_delete_selected'], '\',
sRemoveButtonImage: \'delete_selected.png\',
sRemoveButtonConfirm: \'', $txt['quickmod_confirm'], '\',
bCanRestore: ', $context['can_restore_msg'] ? 'true' : 'false', ',
sRestoreButtonLabel: \'', $txt['quick_mod_restore'], '\',
sRestoreButtonImage: \'restore_selected.png\',
sRestoreButtonConfirm: \'', $txt['quickmod_confirm'], '\',
bCanSplit: ', $context['can_split'] ? 'true' : 'false', ',
sSplitButtonLabel: \'', $txt['quickmod_split_selected'], '\',
sSplitButtonImage: \'split_selected.png\',
sSplitButtonConfirm: \'', $txt['quickmod_confirm'], '\',
sFormId: \'quickModForm\'
});';
}
echo '
$(".quick_edit").css("display", "inline");
if (\'XMLHttpRequest\' in window)
{
var oQuickModify = new QuickModify({
sScriptUrl: smf_scripturl,
bShowModify: ', $settings['show_modify'] ? 'true' : 'false', ',
iTopicId: ', $context['current_topic'], ',
sTemplateBodyEdit: ', JavaScriptEscape('
<div id="quick_edit_body_container" style="width: 90%">
<div id="error_box" style="padding: 4px;" class="error"></div>
<textarea class="editor" name="message" rows="12" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 100%; min-width: 100%' : 'width: 100%') . '; margin-bottom: 10px;" tabindex="' . $context['tabindex']++ . '">%body%</textarea><br />
<input type="hidden" name="\' + smf_session_var + \'" value="\' + smf_session_id + \'" />
<input type="hidden" name="topic" value="' . $context['current_topic'] . '" />
<input type="hidden" name="msg" value="%msg_id%" />
<div class="righttext">
<input type="submit" name="post" value="' . $txt['save'] . '" tabindex="' . $context['tabindex']++ . '" onclick="return oQuickModify.modifySave(\'' . $context['session_id'] . '\', \'' . $context['session_var'] . '\');" accesskey="s" class="button_submit" /> ' . ($context['show_spellchecking'] ? '<input type="button" value="' . $txt['spell_check'] . '" tabindex="' . $context['tabindex']++ . '" onclick="spellCheck(\'quickModForm\', \'message\');" class="button_submit" /> ' : '') . '<input type="submit" name="cancel" value="' . $txt['modify_cancel'] . '" tabindex="' . $context['tabindex']++ . '" onclick="return oQuickModify.modifyCancel();" class="button_submit" />
</div>
</div>'), ',
sTemplateSubjectEdit: ', JavaScriptEscape('<input type="text" style="width: 90%;" name="subject" value="%subject%" size="80" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text" />'), ',
sTemplateBodyNormal: ', JavaScriptEscape('%body%'), ',
sTemplateSubjectNormal: ', JavaScriptEscape('<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.msg%msg_id%#msg%msg_id%" rel="nofollow">%subject%</a>'), ',
sTemplateTopSubject: ', JavaScriptEscape($txt['topic'] . ': %subject% (' . $txt['read'] . ' ' . $context['num_views'] . ' ' . $txt['times'] . ')'), ',
sErrorBorderStyle: ', JavaScriptEscape('1px solid red'), $context['can_reply'] && !empty($options['display_quick_reply']) ? ',
sFormRemoveAccessKeys: \'postmodify\'' : '', '
});
aJumpTo[aJumpTo.length] = new JumpTo({
sContainerId: "display_jump_to",
sJumpToTemplate: "<label class=\\"smalltext\\" for=\\"%select_id%\\">', $context['jump_to']['label'], ':<" + "/label> %dropdown_list%",
iCurBoardId: ', $context['current_board'], ',
iCurBoardChildLevel: ', $context['jump_to']['child_level'], ',
sCurBoardName: "', $context['jump_to']['board_name'], '",
sBoardChildLevelIndicator: "==",
sBoardPrefix: "=> ",
sCatSeparator: "-----------------------------",
sCatPrefix: "",
sGoButtonLabel: "', $txt['go'], '"
});
aIconLists[aIconLists.length] = new IconList({
sBackReference: "aIconLists[" + aIconLists.length + "]",
sIconIdPrefix: "msg_icon_",
sScriptUrl: smf_scripturl,
bShowModify: ', $settings['show_modify'] ? 'true' : 'false', ',
iBoardId: ', $context['current_board'], ',
iTopicId: ', $context['current_topic'], ',
sSessionId: smf_session_id,
sSessionVar: smf_session_var,
sLabelIconList: "', $txt['message_icon'], '",
sBoxBackground: "transparent",
sBoxBackgroundHover: "#ffffff",
iBoxBorderWidthHover: 1,
sBoxBorderColorHover: "#adadad" ,
sContainerBackground: "#ffffff",
sContainerBorder: "1px solid #adadad",
sItemBorder: "1px solid #ffffff",
sItemBorderHover: "1px dotted gray",
sItemBackground: "transparent",
sItemBackgroundHover: "#e0e0f0"
});
}';
if (!empty($ignoredMsgs)) {
echo '
ignore_toggles([', implode(', ', $ignoredMsgs), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');';
}
echo '
// ]]></script>';
}
示例13: Download
/**
* Downloads an attachment or avatar, and increments the download count.
* It requires the view_attachments permission. (not for avatars!)
* It disables the session parser, and clears any previous output.
* It depends on the attachmentUploadDir setting being correct.
* It is accessed via the query string ?action=dlattach.
* Views to attachments and avatars do not increase hits and are not logged in the "Who's Online" log.
*/
function Download()
{
global $txt, $modSettings, $user_info, $scripturl, $context, $sourcedir, $topic, $smcFunc;
// Some defaults that we need.
$context['character_set'] = empty($modSettings['global_character_set']) ? empty($txt['lang_character_set']) ? 'ISO-8859-1' : $txt['lang_character_set'] : $modSettings['global_character_set'];
$context['utf8'] = $context['character_set'] === 'UTF-8';
$context['no_last_modified'] = true;
// Make sure some attachment was requested!
if (!isset($_REQUEST['attach']) && !isset($_REQUEST['id'])) {
fatal_lang_error('no_access', false);
}
$_REQUEST['attach'] = isset($_REQUEST['attach']) ? (int) $_REQUEST['attach'] : (int) $_REQUEST['id'];
if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'avatar') {
$request = $smcFunc['db_query']('', '
SELECT id_folder, filename, file_hash, fileext, id_attach, attachment_type, mime_type, approved, id_member
FROM {db_prefix}attachments
WHERE id_attach = {int:id_attach}
AND id_member > {int:blank_id_member}
LIMIT 1', array('id_attach' => $_REQUEST['attach'], 'blank_id_member' => 0));
$_REQUEST['image'] = true;
} else {
// This checks only the current board for $board/$topic's permissions.
isAllowedTo('view_attachments');
// Make sure this attachment is on this board.
// @todo: We must verify that $topic is the attachment's topic, or else the permission check above is broken.
$request = $smcFunc['db_query']('', '
SELECT a.id_folder, a.filename, a.file_hash, a.fileext, a.id_attach, a.attachment_type, a.mime_type, a.approved, m.id_member
FROM {db_prefix}attachments AS a
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_msg AND m.id_topic = {int:current_topic})
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board AND {query_see_board})
WHERE a.id_attach = {int:attach}
LIMIT 1', array('attach' => $_REQUEST['attach'], 'current_topic' => $topic));
}
if ($smcFunc['db_num_rows']($request) == 0) {
fatal_lang_error('no_access', false);
}
list($id_folder, $real_filename, $file_hash, $file_ext, $id_attach, $attachment_type, $mime_type, $is_approved, $id_member) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
// If it isn't yet approved, do they have permission to view it?
if (!$is_approved && ($id_member == 0 || $user_info['id'] != $id_member) && ($attachment_type == 0 || $attachment_type == 3)) {
isAllowedTo('approve_posts');
}
// Update the download counter (unless it's a thumbnail).
if ($attachment_type != 3) {
$smcFunc['db_query']('attach_download_increase', '
UPDATE LOW_PRIORITY {db_prefix}attachments
SET downloads = downloads + 1
WHERE id_attach = {int:id_attach}', array('id_attach' => $id_attach));
}
$filename = getAttachmentFilename($real_filename, $_REQUEST['attach'], $id_folder, false, $file_hash);
// This is done to clear any output that was made before now.
ob_end_clean();
if (!empty($modSettings['enableCompressedOutput']) && @filesize($filename) <= 4194304 && in_array($file_ext, array('txt', 'html', 'htm', 'js', 'doc', 'docx', 'rtf', 'css', 'php', 'log', 'xml', 'sql', 'c', 'java'))) {
@ob_start('ob_gzhandler');
} else {
ob_start();
header('Content-Encoding: none');
}
// No point in a nicer message, because this is supposed to be an attachment anyway...
if (!file_exists($filename)) {
loadLanguage('Errors');
header((preg_match('~HTTP/1\\.[01]~i', $_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0') . ' 404 Not Found');
header('Content-Type: text/plain; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set']));
// We need to die like this *before* we send any anti-caching headers as below.
die('404 - ' . $txt['attachment_not_found']);
}
// If it hasn't been modified since the last time this attachement was retrieved, there's no need to display it again.
if (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
list($modified_since) = explode(';', $_SERVER['HTTP_IF_MODIFIED_SINCE']);
if (strtotime($modified_since) >= filemtime($filename)) {
ob_end_clean();
// Answer the question - no, it hasn't been modified ;).
header('HTTP/1.1 304 Not Modified');
exit;
}
}
// Check whether the ETag was sent back, and cache based on that...
$eTag = '"' . substr($_REQUEST['attach'] . $real_filename . filemtime($filename), 0, 64) . '"';
if (!empty($_SERVER['HTTP_IF_NONE_MATCH']) && strpos($_SERVER['HTTP_IF_NONE_MATCH'], $eTag) !== false) {
ob_end_clean();
header('HTTP/1.1 304 Not Modified');
exit;
}
// Send the attachment headers.
header('Pragma: ');
if (!isBrowser('gecko')) {
header('Content-Transfer-Encoding: binary');
}
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 525600 * 60) . ' GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($filename)) . ' GMT');
header('Accept-Ranges: bytes');
header('Connection: close');
//.........这里部分代码省略.........
示例14: template_email_members_compose
function template_email_members_compose()
{
global $context, $settings, $options, $txt, $scripturl;
echo '
<div id="preview_section"', isset($context['preview_message']) ? '' : ' style="display: none;"', '>
<div class="cat_bar">
<h3 class="catbg">
<span id="preview_subject">', empty($context['preview_subject']) ? '' : $context['preview_subject'], '</span>
</h3>
</div>
<div class="windowbg">
<div class="content">
<div class="post" id="preview_body">
', empty($context['preview_message']) ? '<br />' : $context['preview_message'], '
</div>
</div>
</div>
</div><br />';
echo '
<div id="admincenter">
<form name="newsmodify" action="', $scripturl, '?action=admin;area=news;sa=mailingsend" method="post" accept-charset="', $context['character_set'], '">
<div class="cat_bar">
<h3 class="catbg">
<a href="', $scripturl, '?action=helpadmin;help=email_members" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.png" alt="', $txt['help'], '" class="icon" /></a> ', $txt['admin_newsletters'], '
</h3>
</div>
<div class="information">
', $txt['email_variables'], '
</div>
<div class="windowbg">
<div class="content">
<div class="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'noticebox' : 'errorbox', '"', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors">
<dl>
<dt>
<strong id="error_serious">', $txt['error_while_submitting'], '</strong>
</dt>
<dd class="error" id="error_list">
', empty($context['post_error']['messages']) ? '' : implode('<br />', $context['post_error']['messages']), '
</dd>
</dl>
</div>
<dl id="post_header">
<dt class="clear_left">
<span', isset($context['post_error']['no_subject']) ? ' class="error"' : '', ' id="caption_subject">', $txt['subject'], ':</span>
</dt>
<dd id="pm_subject">
<input type="text" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="60" maxlength="60"', isset($context['post_error']['no_subject']) ? ' class="error"' : ' class="input_text"', '/>
</dd>
</dl><hr class="clear" />
<div id="bbcBox_message"></div>';
// What about smileys?
if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) {
echo '
<div id="smileyBox_message"></div>';
}
// Show BBC buttons, smileys and textbox.
echo '
', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
echo '
<ul class="reset">
<li><label for="send_pm"><input type="checkbox" name="send_pm" id="send_pm" ', !empty($context['send_pm']) ? 'checked="checked"' : '', 'class="input_check" onclick="checkboxes_status(this);" /> ', $txt['email_as_pms'], '</label></li>
<li><label for="send_html"><input type="checkbox" name="send_html" id="send_html" ', !empty($context['send_html']) ? 'checked="checked"' : '', 'class="input_check" onclick="checkboxes_status(this);" /> ', $txt['email_as_html'], '</label></li>
<li><label for="parse_html"><input type="checkbox" name="parse_html" id="parse_html" checked="checked" disabled="disabled" class="input_check" /> ', $txt['email_parsed_html'], '</label></li>
</ul>
<p id="shortcuts" class="smalltext">
', isBrowser('is_firefox') ? $txt['shortcuts_firefox'] : $txt['shortcuts'], '
</p>
<p id="post_confirm_strip" class="righttext">
', template_control_richedit_buttons($context['post_box_name']), '
</p>
</div>
</div>
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
<input type="hidden" name="email_force" value="', $context['email_force'], '" />
<input type="hidden" name="total_emails" value="', $context['total_emails'], '" />
<input type="hidden" name="max_id_member" value="', $context['max_id_member'], '" />';
foreach ($context['recipients'] as $key => $values) {
echo '
<input type="hidden" name="', $key, '" value="', implode($key == 'emails' ? ';' : ',', $values), '" />';
}
echo '
<script type="text/javascript"><!-- // --><![CDATA[';
// The functions used to preview a posts without loading a new page.
echo '
var txt_preview_title = "', $txt['preview_title'], '";
var txt_preview_fetch = "', $txt['preview_fetch'], '";
function previewPost()
{';
if (isBrowser('is_firefox')) {
echo '
// Firefox doesn\'t render <marquee> that have been put it using javascript
if (document.forms.newsmodify.elements[', JavaScriptEscape($context['post_box_name']), '].value.indexOf(\'[move]\') != -1)
{
return submitThisOnce(document.forms.newsmodify);
}';
}
echo '
if (window.XMLHttpRequest)
{
// Opera didn\'t support setRequestHeader() before 8.01.
//.........这里部分代码省略.........
示例15: header
if (!isBrowser('gecko')) {
header('Content-Transfer-Encoding: binary');
}
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 525600 * 60) . ' GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($filename)) . ' GMT');
header('Accept-Ranges: bytes');
header('Connection: close');
header('ETag: ' . $eTag);
header('Content-Type: image/png');
$disposition = 'inline';
// Different browsers like different standards...
if (isBrowser('firefox')) {
header('Content-Disposition: ' . $disposition . '; filename*=UTF-8\'\'' . rawurlencode(preg_replace_callback('~&#(\\d{3,8});~', 'fixchar__callback', $real_filename)));
} elseif (isBrowser('opera')) {
header('Content-Disposition: ' . $disposition . '; filename="' . preg_replace_callback('~&#(\\d{3,8});~', 'fixchar__callback', $real_filename) . '"');
} elseif (isBrowser('ie')) {
header('Content-Disposition: ' . $disposition . '; filename="' . urlencode(preg_replace_callback('~&#(\\d{3,8});~', 'fixchar__callback', $real_filename)) . '"');
} else {
header('Content-Disposition: ' . $disposition . '; filename="' . $real_filename . '"');
}
header('Cache-Control: max-age=' . 525600 * 60 . ', private');
if (empty($modSettings['enableCompressedOutput']) || $filesize > 4194304) {
header('Content-Length: ' . $filesize);
}
// Try to buy some time...
@set_time_limit(600);
// Since we don't do output compression for files this large...
if ($filesize > 4194304) {
// Forcibly end any output buffering going on.
while (ob_get_level() > 0) {
@ob_end_clean();