本文整理汇总了PHP中phpbb\request\request_interface::server方法的典型用法代码示例。如果您正苦于以下问题:PHP request_interface::server方法的具体用法?PHP request_interface::server怎么用?PHP request_interface::server使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb\request\request_interface
的用法示例。
在下文中一共展示了request_interface::server方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_ssl
/**
* Check if the current session is secure.
*
* @return bool
*/
private function is_ssl()
{
$secure = $this->request->server('HTTPS');
if (!empty($secure)) {
return 'on' === strtolower($secure) || '1' == $secure;
} else {
if ('443' == $this->request->server('SERVER_PORT')) {
return true;
}
}
return false;
}
示例2: browser
private function browser()
{
if (!($user_agent = $this->request->header('User-Agent'))) {
$user_agent = $this->request->server('HTTP_USER_AGENT');
}
preg_match("/(MSIE|Firefox|iPhone|Android|BlackBerry|WindowsPhone|Symbian|Chrome|Netscape|Konqueror|SeaMonkey|K-Meleon|iPod|Opera Mini|Camino|Minefield|Iceweasel|Maxthon|Version)(?:\\/| )([0-9.]+)/", $user_agent, $browser_info);
list(, $browser, $version) = $browser_info;
if ($browser == 'Opera Mini') {
return 'Opera Mini ' . $version;
}
if (preg_match("/(Opera|OPR)(?:\\/| )([0-9.]+)/i", $user_agent, $opera)) {
return 'Opera ' . ($opera[2] != '9.80' ? $opera[2] : substr($user_agent, -5));
}
if (preg_match("/Nokia([0-9.]+)/i", $user_agent, $nokia)) {
return 'Nokia ' . $nokia[1];
}
if ($browser == 'MSIE') {
preg_match("/(Maxthon|Avant Browser|MyIE2)/i", $user_agent, $ie);
if ($ie) {
return $ie[1] . ' based on IE ' . $version;
}
return 'IE ' . $version;
}
if ($browser == 'Firefox') {
preg_match("/(Flock|Navigator|Epiphany)\\/([0-9.]+)/", $user_agent, $ff);
if ($ff) {
return $ff[1] . ' ' . $ff[2];
}
}
if ($browser == 'Version') {
return 'Safari ' . $version;
}
if (!$browser && strpos($user_agent, 'Gecko')) {
return 'Browser based on Gecko';
}
if (!$browser) {
$mobile_browser = '';
$browser_ary = array('Alcatel, Sony Ericsson, Motorola, Panasonic, Philips, Samsung, Sanyo, Sharp, Sony, Ericsson,
j2me, midp, wap, pda, series60, vodafone, mobile, phone, up.browser, up.link, xiino/i');
foreach ($browser_ary as $mobile_browser) {
if (stripos($user_agent, $mobile_browser) !== false) {
$version = $mobile_browser;
break;
}
}
$browser = 'Browser';
}
return $browser . ' ' . $version;
}
示例3: is_multipart
/**
* Returns whether the current HTTP request is a multipart request.
*
* @return bool
*/
public function is_multipart()
{
$content_type = $this->request->server('CONTENT_TYPE');
return strpos($content_type, 'multipart') === 0;
}
示例4: get_server_variable
/**
* {@inheritdoc}
*/
public function get_server_variable($name, $default = '')
{
return $this->request->server($name, $default);
}
示例5: recent
public function recent()
{
$http_ajax = $this->request->server('HTTP_X_REQUESTED_WITH') == "XMLHttpRequest" ? true : false;
$crawl = $this->request->variable('mode', '');
$this->template->assign_vars(array('L_RECENT_TITLE' => $this->config['recent_title'], 'L_RECENT_POSTS_NAME' => $this->config['recent_posts_name'], 'S_RECENT_MARQUE' => $this->config['recent_show_marque'] && $crawl ? true : false));
$http_headers = array('Content-type' => 'text/html; charset=UTF-8', 'Cache-Control' => 'private, no-cache="set-cookie", pre-check=0, post-check=0, max-age=0', 'Expires' => gmdate('D, d M Y H:i:s', time()) . ' GMT', 'Pragma' => 'no-cache');
foreach ($http_headers as $hname => $hval) {
header((string) $hname . ': ' . (string) $hval);
}
//
// Building URL
//
$board_path = generate_board_url();
$viewtopic_url = $board_path . '/viewtopic.' . $this->php_ext;
$forum = $this->request->variable('forum', 0);
if ($forum || !$this->config['recent_ignore_forums'] && $this->config['recent_only_forums']) {
if ($forum) {
$sql_forums = ' AND t.forum_id = "' . $this->db->sql_escape($forum) . '" ';
} else {
$sql_forums = ' AND t.forum_id IN(' . $this->config['recent_only_forums'] . ') ';
}
} else {
// Fetching forums that should not be displayed
$forums = implode(',', array_keys($this->auth->acl_getf('!f_read', true)));
if ($this->config['recent_only_forums'] && !empty($forums)) {
$cfg_ignore_forums = $this->config['recent_only_forums'] . ',' . $forums;
} else {
if (!empty($forums)) {
$cfg_ignore_forums = $forums;
} else {
$cfg_ignore_forums = $this->config['recent_only_forums'] ? $this->config['recent_only_forums'] : '';
}
}
// Building sql for forums that should not be displayed
$sql_forums = $cfg_ignore_forums ? ' AND t.forum_id NOT IN(' . $cfg_ignore_forums . ') ' : '';
}
// Fetching topics of public forums
$sql = 'SELECT t.*, p.post_id, p.post_text, p.bbcode_uid, p.bbcode_bitfield, p.post_attachment
FROM ' . TOPICS_TABLE . ' AS t, ' . POSTS_TABLE . ' AS p, ' . FORUMS_TABLE . " AS f\n\t\t\tWHERE t.forum_id = f.forum_id\n\t\t\t\t{$sql_forums}\n\t\t\t\tAND p.post_id = t.topic_first_post_id\n\t\t\t\tAND t.topic_moved_id = 0\n\t\t\tORDER BY t.topic_last_post_id DESC";
$result = $this->db->sql_query_limit($sql, $this->config['recent_nm_topics']);
if (!($recent_topics = $this->db->sql_fetchrowset($result))) {
trigger_error('NO_FORUM');
}
//
// BEGIN ATTACHMENT DATA
//
if ($this->config['recent_show_first_post'] && $this->config['recent_show_attachments'] && !$crawl) {
$attach_list = $update_count = array();
foreach ($recent_topics as $post_attachment) {
if ($post_attachment['post_attachment'] && $this->config['allow_attachments']) {
$attach_list[] = $post_attachment['post_id'];
if ($post_attachment['topic_posts_approved']) {
$has_attachments = true;
}
}
}
// Pull attachment data
if (sizeof($attach_list)) {
if ($this->auth->acl_get('u_download')) {
$sql_attach = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
WHERE ' . $this->db->sql_in_set('post_msg_id', $attach_list) . '
AND in_message = 0
ORDER BY filetime DESC, post_msg_id ASC';
$result_attach = $this->db->sql_query($sql_attach);
while ($row_attach = $this->db->sql_fetchrow($result_attach)) {
$attachments[$row_attach['post_msg_id']][] = $row_attach;
}
$this->db->sql_freeresult($result_attach);
} else {
$display_notice = true;
}
}
}
//
// END ATTACHMENT DATA
//
foreach ($recent_topics as $row) {
$topic_title = censor_text($row['topic_title']);
if (!$this->config['recent_show_first_post'] && utf8_strlen($topic_title) > $this->config['recent_max_topic_length']) {
$topic_title = utf8_substr($topic_title, 0, $this->config['recent_max_topic_length']) . '…';
}
// Replies
if ($this->config['recent_show_replies']) {
global $phpbb_container;
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
$replies = $phpbb_content_visibility->get_count('topic_posts', $row, $row['forum_id']) - 1;
}
$this->template->assign_block_vars('topicrow', array('U_TOPIC' => $viewtopic_url . '?t=' . $row['topic_id'], 'U_LAST_POST' => $viewtopic_url . '?p=' . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'], 'TOPIC_TITLE' => $topic_title, 'TOPIC_REPLIES' => isset($replies) ? $replies : '', 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'FIRST_POST_TIME' => $this->user->format_date($row['topic_time']), 'LAST_POST_TIME' => $this->user->format_date($row['topic_last_post_time']), 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour'])));
if ($this->config['recent_show_first_post'] && !$crawl) {
$message = $row['post_text'];
if (utf8_strlen($message) > $this->config['recent_max_topic_length']) {
//strip_bbcode($message);
//$message = utf8_substr($message, 0, $this->config['recent_max_topic_length']) . '…';
$message = $this->text_substr($message, $this->config['recent_max_topic_length']) . '…';
}
// Parse the message and subject
$parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
$message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, true);
if (!$http_ajax) {
//.........这里部分代码省略.........