本文整理汇总了PHP中http_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP http_cache函数的具体用法?PHP http_cache怎么用?PHP http_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了http_cache函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_header
function do_header($title, $id = 'home')
{
global $current_user, $dblang, $globals;
check_auth_page();
header('Content-type: text/html; charset=utf-8');
header('X-Frame-Options: SAMEORIGIN');
http_cache();
$globals['security_key'] = get_security_key();
setcookie('k', $globals['security_key'], 0, $globals['base_url']);
$vars = compact('title', 'id');
return Haanga::Load("mobile/header.html", $vars);
}
示例2: do_header
function do_header($title, $id = 'home', $options = false)
{
global $current_user, $dblang, $globals, $db;
check_auth_page();
header('Content-Type: text/html; charset=utf-8');
header('X-Frame-Options: SAMEORIGIN');
header('X-UA-Compatible: IE=edge,chrome=1');
http_cache();
$globals['security_key'] = get_security_key();
setcookie('k', $globals['security_key'], 0, $globals['base_url']);
if (!empty($_REQUEST['q'])) {
$globals['q'] = $_REQUEST['q'];
}
$sites = $db->get_results("select * from subs where visible order by id asc");
$this_site = SitesMgr::get_info();
if ($this_site->nsfw) {
$globals['ads'] = false;
}
/*
echo "<pre>";
print_r($this_site);
exit;
*/
if (!is_array($options)) {
$left_options = array();
//$left_options[] = new MenuOption(_('portada'), $globals['base_url'], $id, _('página principal'));
// $left_options[] = new MenuOption(_('Nuevas'), $globals['base_url'].'queue', $id, _('menear noticias pendientes'), array(), 'nuevas');
$left_options[] = new MenuOption(_('Populares'), $globals['base_url'] . 'popular', $id, _('historias más votadas'), array(), 'populares');
$left_options[] = new MenuOption(_('Más visitadas'), $globals['base_url'] . 'top_visited', $id, _('historias más visitadas/leídas'), array(), 'más visitadas');
//$left_options[] = new MenuOption(_('destacadas'), $globals['base_url'].'top_active', $id, _('historias más activas'));
if ($this_site->enabled) {
$left_options[] = new MenuOption(_('Enviar noticia'), $globals['base_url'] . 'submit', $id, _('enviar nueva historia'), array('class' => 'link-send-story'), 'enviar historia');
}
$right_options = array();
$right_options[] = new MenuOption(_('m/'), $globals['base_url_general'] . 'subs', $id, _('sub menéames'), array(), 'm/');
$right_options[] = new MenuOption(_('Actividad'), $globals['base_url'] . 'sneak', $id, _('visualizador en tiempo real'), array(), 'fisgona');
$right_options[] = new MenuOption(_('Notas y mensajes privados'), post_get_base_url(), $id, _('leer o escribir notas y mensajes privados'), array(), 'nótame');
$right_options[] = new MenuOption(_('Galería'), 'javascript:fancybox_gallery(\'all\');', false, _('las imágenes subidas por los usuarios'));
} else {
$left_options = $options;
$right_options = array();
//$right_options[] = new MenuOption(_('portada'), $globals['base_url'], '', _('página principal'));
// $right_options[] = new MenuOption(_('Nuevas'), $globals['base_url'].'queue', '', _('menear noticias pendientes'));
$right_options[] = new MenuOption(_('m/'), $globals['base_url_general'] . 'subs', $id, _('sub menéames'), array(), 'm/');
$right_options[] = new MenuOption(_('Actividad'), $globals['base_url'] . 'sneak', $id, _('visualizador en tiempo real'), array(), 'fisgona');
$right_options[] = new MenuOption(_('Notas y mensajes privados'), post_get_base_url(), $id, _('leer o escribir notas y mensajes privados'), array(), 'nótame');
$right_options[] = new MenuOption(_('Galería'), 'javascript:fancybox_gallery(\'all\');', false, _('las imágenes subidas por los usuarios'));
}
$vars = compact('title', 'greeting', 'id', 'left_options', 'right_options', 'sites', 'this_site', 'themes');
return Haanga::Load('header.html', $vars);
}
示例3: do_header
function do_header($title, $id = 'home', $options = false)
{
global $current_user, $dblang, $globals, $db;
check_auth_page();
header('Content-Type: text/html; charset=utf-8');
header('X-Frame-Options: SAMEORIGIN');
header('X-UA-Compatible: IE=edge,chrome=1');
http_cache();
if (!empty($globals['link_id'])) {
// Pingback autodiscovery
// http://www.hixie.ch/specs/pingback/pingback
header('X-Pingback: http://' . get_server_name() . $globals['base_url'] . 'xmlrpc.php');
}
$globals['security_key'] = get_security_key();
setcookie('k', $globals['security_key'], 0, $globals['base_url']);
if (!empty($_REQUEST['q'])) {
$globals['q'] = $_REQUEST['q'];
}
/*
if ($globals['greetings']) $greeting = array_rand($globals['greetings'], 1);
else $greeting = _('hola');
*/
if (!is_array($options)) {
$left_options = array();
$left_options[] = new MenuOption(_('enviar historia'), $globals['base_url'] . 'submit.php', $id, _('enviar nueva historia'));
$left_options[] = new MenuOption(_('portada'), $globals['base_url'], $id, _('página principal'));
$left_options[] = new MenuOption(_('pendientes'), $globals['base_url'] . 'shakeit.php', $id, _('menear noticias pendientes'));
$left_options[] = new MenuOption(_('populares'), $globals['base_url'] . 'topstories.php', $id, _('historias más votadas'));
$left_options[] = new MenuOption(_('más visitadas'), $globals['base_url'] . 'topclicked.php', $id, _('historias más visitadas/leídas'));
$left_options[] = new MenuOption(_('destacadas'), $globals['base_url'] . 'topactive.php', $id, _('historias más activas'));
$right_options = array();
$right_options[] = new MenuOption(_('fisgona'), $globals['base_url'] . 'sneak.php', $id, _('visualizador en tiempo real'));
$right_options[] = new MenuOption(_('nótame'), post_get_base_url(), $id, _('leer o escribir notas y mensajes privados'));
$right_options[] = new MenuOption(_('galería'), 'javascript:fancybox_gallery(\'all\');', false, _('las imágenes subidas por los usuarios'));
} else {
$left_options = $options;
$right_options = array();
//$right_options[] = new MenuOption(_('portada'), $globals['base_url'], '', _('página principal'));
$right_options[] = new MenuOption(_('pendientes'), $globals['base_url'] . 'shakeit.php', '', _('menear noticias pendientes'));
$right_options[] = new MenuOption(_('fisgona'), $globals['base_url'] . 'sneak.php', $id, _('visualizador en tiempo real'));
$right_options[] = new MenuOption(_('nótame'), post_get_base_url(), $id, _('leer o escribir notas y mensajes privados'));
$right_options[] = new MenuOption(_('galería'), 'javascript:fancybox_gallery(\'all\');', false, _('las imágenes subidas por los usuarios'));
}
$sites = $db->get_results("select * from subs where visible order by id asc");
$this_site = SitesMgr::get_info();
$vars = compact('title', 'greeting', 'id', 'left_options', 'right_options', 'sites', 'this_site');
return Haanga::Load('header.html', $vars);
}
示例4: do_header
function do_header($title, $id = 'home')
{
global $current_user, $dblang, $globals;
check_auth_page();
header('Content-type: text/html; charset=utf-8');
http_cache();
//echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">' . "\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $dblang . '">' . "\n";
echo '<head>' . "\n";
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n";
echo '<meta name="ROBOTS" content="NOARCHIVE" />' . "\n";
echo '<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;"/>' . "\n";
echo "<title>{$title}</title>\n";
do_css_includes();
echo '<meta name="generator" content="meneame mobile" />' . "\n";
if (!empty($globals['noindex'])) {
echo '<meta name="robots" content="noindex,follow"/>' . "\n";
}
if (!empty($globals['tags'])) {
echo '<meta name="keywords" content="' . $globals['tags'] . '" />' . "\n";
}
if (empty($globals['favicon'])) {
$globals['favicon'] = 'img/favicons/favicon4.ico';
}
echo '<link rel="icon" href="' . $globals['base_static'] . $globals['favicon'] . '" type="image/x-icon"/>' . "\n";
echo '<link rel="apple-touch-icon" href="' . $globals['base_static'] . 'img/favicons/apple-touch-icon.png"/>' . "\n";
echo '<link rel="alternate" type="application/rss+xml" title="' . _('publicadas') . '" href="http://' . get_server_name() . $globals['base_url'] . 'rss2.php" />' . "\n";
if ($globals['extra_head']) {
echo $globals['extra_head'];
}
echo '</head>' . "\n";
echo "<body id=\"{$id}\" " . $globals['body_args'] . ">\n";
echo '<div id="header">' . "\n";
echo '<a href="' . $globals['base_url'] . '" title="' . _('inicio') . '" id="logo">' . _("menéame") . '</a>' . "\n";
echo '<ul id="headtools">';
echo '<li><a href="' . $globals['base_url'] . 'search.php">' . _('buscar') . '</a></li>';
if ($current_user->authenticated) {
echo '<li><a href="' . $globals['base_url'] . 'login.php?op=logout&return=' . urlencode($_SERVER['REQUEST_URI']) . '">' . _('logout') . '</a></li>';
echo '<li class="noborder"><a href="' . get_user_uri($current_user->user_login) . '" title="' . $current_user->user_login . '"><img src="' . get_avatar_url($current_user->user_id, $current_user->user_avatar, 20) . '" width="20" height="20" alt="' . $current_user->user_login . '"/></a></li>';
} else {
echo '<li class="noborder"><a href="' . $globals['base_url'] . 'login.php?return=' . urlencode($_SERVER['REQUEST_URI']) . '">' . _('login') . '</a></li>';
}
echo '</ul>' . "\n";
echo '</div>' . "\n";
do_banner_top_mobile();
echo '<div id="container">' . "\n";
}
示例5: array_push
<?php
// The source code packaged with this file is Free Software, Copyright (C) 2005 by
// Ricardo Galli <gallir at uib dot es>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
if (!defined('mnmpath')) {
include '../config.php';
include mnminclude . 'html1.php';
}
array_push($globals['cache-control'], 'no-cache');
http_cache();
$message = new PrivateMessage();
if (!empty($_POST['author'])) {
$message_id = intval($_REQUEST['id']);
if ($message_id > 0) {
save_post($message_id);
} else {
save_post(0);
}
} else {
if (!empty($_REQUEST['id'])) {
if ($message = PrivateMessage::from_db(intval($_REQUEST['id']))) {
$message->print_edit_form();
}
} else {
// A new post
$message = new PrivateMessage();
if (!empty($_REQUEST['user_id'])) {
示例6: do_header
function do_header($title, $id = 'home')
{
global $current_user, $dblang, $globals, $greetings;
check_auth_page();
header('Content-Type: text/html; charset=utf-8');
http_cache();
if (!empty($globals['link_id'])) {
// Pingback autodiscovery
// http://www.hixie.ch/specs/pingback/pingback
header('X-Pingback: http://' . get_server_name() . $globals['base_url'] . 'xmlrpc.php');
}
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
//echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $dblang . '" lang="' . $dblang . '">' . "\n";
echo '<head>' . "\n";
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n";
echo '<meta name="ROBOTS" content="NOARCHIVE" />' . "\n";
echo "<title>{$title}</title>\n";
do_css_includes();
echo '<meta name="generator" content="meneame" />' . "\n";
if ($globals['noindex']) {
echo '<meta name="robots" content="noindex,follow"/>' . "\n";
}
if ($globals['tags']) {
echo '<meta name="keywords" content="' . $globals['tags'] . '" />' . "\n";
}
if ($globals['description']) {
echo '<meta name="description" content="' . $globals['description'] . '" />' . "\n";
}
if ($globals['link']) {
echo '<link rel="pingback" href="http://' . get_server_name() . $globals['base_url'] . 'xmlrpc.php"/>' . "\n";
}
echo '<link rel="microsummary" type="application/x.microsummary+xml" href="' . $globals['base_url'] . 'microsummary.xml" />' . "\n";
echo '<link rel="search" type="application/opensearchdescription+xml" title="' . _("menéame search") . '" href="http://' . get_server_name() . $globals['base_url'] . 'opensearch_plugin.php"/>' . "\n";
echo '<link rel="alternate" type="application/rss+xml" title="' . _('publicadas') . '" href="http://' . get_server_name() . $globals['base_url'] . 'rss2.php" />' . "\n";
echo '<link rel="alternate" type="application/rss+xml" title="' . _('pendientes') . '" href="http://' . get_server_name() . $globals['base_url'] . 'rss2.php?status=queued" />' . "\n";
echo '<link rel="alternate" type="application/rss+xml" title="' . _('comentarios') . '" href="http://' . get_server_name() . $globals['base_url'] . 'comments_rss2.php" />' . "\n";
if (!$globals['favicon']) {
$globals['favicon'] = 'img/favicons/favicon4.ico';
}
echo '<link rel="shortcut icon" href="' . $globals['base_static'] . $globals['favicon'] . '" type="image/x-icon"/>' . "\n";
do_js_includes();
if ($globals['thumbnail']) {
// WARN: It's assumed a thumbanil comes with base_url included
$thumb = $globals['thumbnail'];
} else {
$thumb = 'http://' . get_static_server_name() . $globals['base_url'] . $globals['thumbnail_logo'];
}
echo '<meta name="thumbnail_url" content="' . $thumb . "\"/>\n";
echo '<link rel="image_src" href="' . $thumb . "\"/>\n";
if ($globals['extra_head']) {
echo $globals['extra_head'];
}
echo '</head>' . "\n";
echo "<body id=\"{$id}\" " . $globals['body_args'] . ">\n";
echo '<div id="wrap">' . "\n";
echo '<div id="header">' . "\n";
echo '<a href="' . $globals['base_url'] . '" title="' . _('inicio') . '" id="logo">' . _("menéame") . '</a>' . "\n";
echo '<ul id="headtools">' . "\n";
// Main search form
echo '<li class="searchbox">' . "\n";
echo '<form action="' . $globals['base_url'] . 'search.php" method="get" name="top_search">' . "\n";
echo '<img src="' . $globals['base_static'] . 'img/common/search-left-04.png" width="6" height="22" alt=""/>';
if (!empty($_REQUEST['q'])) {
echo '<input type="text" name="q" value="' . htmlspecialchars($_REQUEST['q']) . '" />';
} else {
echo '<input name="q" value="' . _('buscar') . '..." type="text" onblur="if(this.value==\'\') this.value=\'' . _('buscar') . '...\';" onfocus="if(this.value==\'' . _('buscar') . '...\') this.value=\'\';"/>';
}
echo '<a href="javascript:document.top_search.submit()"><img class="searchIcon" alt="' . _('buscar') . '" src="' . $globals['base_static'] . 'img/common/search-04.png" id="submit_image" width="28" height="22"/></a>' . "\n";
if ($globals['search_options']) {
foreach ($globals['search_options'] as $name => $value) {
echo '<input type="hidden" name="' . $name . '" value="' . $value . '"/>' . "\n";
}
}
echo '</form>';
echo '</li>' . "\n";
// form
echo '<li><a href="http://meneame.wikispaces.com/Comenzando">' . _('ayuda') . ' <img src="' . $globals['base_static'] . 'img/common/help-bt-02.png" alt="help button" title="' . _('ayuda') . '" width="13" height="16" /></a></li>';
if ($current_user->admin) {
echo '<li><a href="' . $globals['base_url'] . 'admin/bans.php">admin <img src="' . $globals['base_static'] . 'img/common/tools-bt-02.png" alt="tools button" title="herramientas" width="16" height="16" /> </a></li>' . "\n";
}
if ($current_user->authenticated) {
$randhello = array_rand($greetings, 1);
echo '<li><a href="' . get_user_uri($current_user->user_login) . '" title="' . _('menéame te saluda en ') . $greetings[$randhello] . '">' . $randhello . ' ' . $current_user->user_login . ' <img src="' . get_avatar_url($current_user->user_id, $current_user->user_avatar, 20) . '" width="20" height="20" alt="' . $current_user->user_login . '"/></a></li>' . "\n";
echo '<li><a href="' . $globals['base_url'] . 'login.php?op=logout&return=' . urlencode($_SERVER['REQUEST_URI']) . '">' . _('cerrar sesión') . ' <img src="' . $globals['base_static'] . 'img/common/logout-bt-02.png" alt="" title="logout" width="22" height="16" /></a></li>' . "\n";
} else {
echo '<li><a href="' . $globals['base_url'] . 'register.php">' . _('registrarse') . ' <img src="' . $globals['base_static'] . 'img/common/register-bt-02.png" alt="" title="register" width="16" height="18" /></a></li>' . "\n";
echo '<li><a href="' . $globals['base_url'] . 'login.php?return=' . urlencode($_SERVER['REQUEST_URI']) . '">' . _('login') . ' <img src="' . $globals['base_static'] . 'img/common/login-bt-02.png" alt="" title="login" width="22" height="16" /></a></li>' . "\n";
}
//echo '<li><a href="'.$globals['base_url'].'faq-'.$dblang.'.php">' . _('acerca de menéame').'</a></li>' . "\n";
echo '</ul>' . "\n";
echo '</div>' . "\n";
echo '<div id="naviwrap">' . "\n";
echo '<ul>' . "\n";
echo '<li><a href="' . $globals['base_url'] . 'submit.php">' . _('enviar noticia') . '</a></li>' . "\n";
echo '<li><a href="' . $globals['base_url'] . 'shakeit.php">' . _('pendientes') . '</a></li>' . "\n";
echo '<li><a href="' . $globals['base_url'] . 'sneak.php">' . _('fisgona') . '</a></li>' . "\n";
echo '<li><a href="' . $globals['base_url'] . 'notame/">' . _('nótame') . '</a></li>' . "\n";
echo '</ul></div>' . "\n";
do_banner_top();
//.........这里部分代码省略.........
示例7: do_header
function do_header($title, $id = 'home', $options = false)
{
global $current_user, $dblang, $globals, $db;
header('Content-Type: text/html; charset=utf-8');
// Security headers
header('X-Frame-Options: SAMEORIGIN');
header('X-UA-Compatible: IE=edge,chrome=1');
if ($globals['force_ssl'] && $globals['https']) {
header('Strict-Transport-Security: max-age=15638400');
// 181 days, ssllabs doesn't like less than 180
}
http_cache();
$globals['security_key'] = get_security_key();
setcookie('k', $globals['security_key'], 0, $globals['base_url_general']);
if (!empty($_REQUEST['q'])) {
$globals['q'] = $_REQUEST['q'];
}
if ($current_user->user_id > 0) {
$globals['extra_js'][] = 'jquery.form.min.js';
}
$sites = $db->get_results("select * from subs where visible order by id asc");
$this_site = SitesMgr::get_info();
$this_site_properties = SitesMgr::get_extended_properties();
if ($this_site->sub) {
$this_site->url = $this_site->base_url . 'm/' . $this_site->name;
} else {
$this_site->url = $this_site->base_url;
}
// Check if the sub has a logo and calculate the width
if ($this_site->media_id > 0 && $this_site->media_dim1 > 0 && $this_site->media_dim2 > 0) {
$r = $this_site->media_dim1 / $this_site->media_dim2;
if ($globals['mobile']) {
$this_site->logo_height = $globals['media_sublogo_height_mobile'];
} else {
$this_site->logo_height = $globals['media_sublogo_height'];
}
$this_site->logo_width = round($r * $this_site->logo_height);
$this_site->logo_url = Upload::get_cache_relative_dir($this_site->id) . '/media_thumb-sub_logo-' . $this_site->id . '.' . $this_site->media_extension . '?' . $this_site->media_date;
}
if ($this_site->nsfw) {
$globals['ads'] = false;
}
if (!empty($this_site_properties['post_html'])) {
$globals['post_html'] = $this_site_properties['post_html'];
}
if (!is_array($options)) {
$left_options = array();
if ($this_site->enabled && empty($this_site_properties['new_disabled'])) {
$left_options[] = new MenuOption(_('enviar historia'), $globals['base_url'] . 'submit', $id, _('enviar nueva historia'));
}
$left_options[] = new MenuOption(_('portada'), $globals['base_url'], $id, _('página principal'));
$left_options[] = new MenuOption(_('nuevas'), $globals['base_url'] . 'queue', $id, _('menear noticias pendientes'));
$left_options[] = new MenuOption(_('populares'), $globals['base_url'] . 'popular', $id, _('historias más votadas'));
$left_options[] = new MenuOption(_('más visitadas'), $globals['base_url'] . 'top_visited', $id, _('historias más visitadas/leídas'));
$left_options[] = new MenuOption(_('destacadas'), $globals['base_url'] . 'top_active', $id, _('historias más activas'));
$right_options = array();
$right_options[] = new MenuOption(_('m/'), $globals['base_url_general'] . 'subs', $id, _('sub menéames'));
$right_options[] = new MenuOption(_('fisgona'), $globals['base_url'] . 'sneak', $id, _('visualizador en tiempo real'));
$right_options[] = new MenuOption(_('nótame'), post_get_base_url(), $id, _('leer o escribir notas y mensajes privados'));
$right_options[] = new MenuOption(_('galería'), 'javascript:fancybox_gallery(\'all\');', false, _('las imágenes subidas por los usuarios'));
} else {
$left_options = $options;
$right_options = array();
//$right_options[] = new MenuOption(_('portada'), $globals['base_url'], '', _('página principal'));
$right_options[] = new MenuOption(_('nuevas'), $globals['base_url'] . 'queue', '', _('menear noticias pendientes'));
$right_options[] = new MenuOption(_('m/'), $globals['base_url_general'] . 'subs', $id, _('sub menéames'));
$right_options[] = new MenuOption(_('fisgona'), $globals['base_url'] . 'sneak', $id, _('visualizador en tiempo real'));
$right_options[] = new MenuOption(_('nótame'), post_get_base_url(), $id, _('leer o escribir notas y mensajes privados'));
$right_options[] = new MenuOption(_('galería'), 'javascript:fancybox_gallery(\'all\');', false, _('las imágenes subidas por los usuarios'));
}
$vars = compact('title', 'greeting', 'id', 'left_options', 'right_options', 'sites', 'this_site', 'this_site_properties');
return Haanga::Load('header.html', $vars);
}
示例8: do_redirect
// You can get copies of the licenses here:
// http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
// Use the alternate server for api, if it exists
//$globals['alternate_db_server'] = 'backend';
include '../config.php';
$db->connect_timeout = 3;
if (!$current_user->user_id) {
die;
}
if (!empty($_GET['redirect'])) {
do_redirect($_GET['redirect']);
exit(0);
}
header('Content-Type: application/json; charset=utf-8');
http_cache(5);
$notifications = new stdClass();
$notifications->posts = (int) Post::get_unread_conversations($current_user->user_id);
$notifications->comments = (int) Comment::get_unread_conversations($current_user->user_id);
$notifications->privates = (int) PrivateMessage::get_unread($current_user->user_id);
$notifications->friends = count(User::get_new_friends($current_user->user_id));
$notifications->total = $notifications->posts + $notifications->privates + $notifications->friends + $notifications->comments;
echo json_encode($notifications);
function do_redirect($type)
{
global $globals, $current_user;
$url = '/';
// If everything fails, it will be redirected to the home
switch ($type) {
case 'privates':
$url = post_get_base_url('_priv');
示例9: do_header
function do_header($title, $id = 'home')
{
global $current_user, $dblang, $globals, $greetings, $db;
// escolhe norma
$stdRow = false;
// if change by request
if ($_REQUEST['standard']) {
$stdRow = $globals['standards'][$_REQUEST['standard']];
if ($current_user->authenticated) {
// authenticated users store that in their profile
$user = new User($current_user->user_id);
$user->standard = (int) $_REQUEST['standard'];
$user->store();
} else {
// if not authenticated, store on cookie
setcookie("chuza_current_standard", (int) $_REQUEST['standard'], time() + 3600 * 24 * 365 * 3);
// 3 anos de cookie
}
} elseif ($current_user->authenticated) {
// user authenticated but NOT request change
$stdRow = $globals['standards'][(int) $current_user->standard];
} else {
// set default standard for non authenticated users
// search in redis
$check_ip = $globals['user_ip_int'];
$redis = new Predis_Client();
$r = $redis->zrevrangebyscore($globals['enviroment'] . 'ips', $check_ip, '0', 'WITHSCORES', 'LIMIT', '0', '1');
preg_match('/(^[^-]*)/', $r[0], $matches);
if (in_array($matches[0], $globals['lusophonia'])) {
$stdRow = 1;
} else {
if (!$_COOKIE['chuza_current_standard']) {
$_COOKIE['chuza_current_standard'] = 1;
}
$stdRow = $globals['standards'][$_COOKIE['chuza_current_standard']];
}
}
if ($stdRow) {
putenv('LANGUAGE=' . $stdRow['short_name']);
setlocale(LC_MESSAGES, $stdRow['short_name']);
$current_user->standard = $stdRow['id'];
} else {
// default standard
putenv('LANGUAGE=gl_ES.utf8');
setlocale(LC_MESSAGES, 'gl_ES.utf8');
$current_user->standard = 1;
}
bindtextdomain('meneame', mnminclude . '/languages');
textdomain('meneame');
// fim de escolher norma
check_auth_page();
header('Content-Type: text/html; charset=utf-8');
http_cache();
if (!empty($globals['link_id'])) {
// Pingback autodiscovery
// http://www.hixie.ch/specs/pingback/pingback
header('X-Pingback: http://' . get_server_name() . $globals['base_url'] . 'xmlrpc.php');
}
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
//echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $dblang . '" lang="' . $dblang . '">' . "\n";
echo '<head>' . "\n";
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n";
echo '<meta name="ROBOTS" content="NOARCHIVE" />' . "\n";
echo "<title>{$title}</title>\n";
do_css_includes();
echo '<meta name="generator" content="meneame" />' . "\n";
if ($globals['noindex']) {
echo '<meta name="robots" content="noindex,follow"/>' . "\n";
}
if ($globals['tags']) {
echo '<meta name="keywords" content="' . $globals['tags'] . '" />' . "\n";
}
if ($globals['description']) {
echo '<meta name="description" content="' . $globals['description'] . '" />' . "\n";
}
if ($globals['link']) {
echo '<link rel="pingback" href="http://' . get_server_name() . $globals['base_url'] . 'xmlrpc.php"/>' . "\n";
}
echo '<link rel="microsummary" type="application/x.microsummary+xml" href="' . $globals['base_url'] . 'microsummary.xml" />' . "\n";
echo '<link rel="search" type="application/opensearchdescription+xml" title="' . _("menéame search") . '" href="http://' . get_server_name() . $globals['base_url'] . 'opensearch_plugin.php"/>' . "\n";
echo '<link rel="alternate" type="application/rss+xml" title="' . _('publicadas') . '" href="http://' . get_server_name() . $globals['base_url'] . 'rss2.php" />' . "\n";
echo '<link rel="alternate" type="application/rss+xml" title="' . _('pendientes') . '" href="http://' . get_server_name() . $globals['base_url'] . 'rss2.php?status=queued" />' . "\n";
echo '<link rel="alternate" type="application/rss+xml" title="' . _('comentarios') . '" href="http://' . get_server_name() . $globals['base_url'] . 'comments_rss2.php" />' . "\n";
if (!$globals['favicon']) {
$globals['favicon'] = 'favicon.ico';
}
echo '<link rel="shortcut icon" href="' . $globals['base_static'] . $globals['favicon'] . '" type="image/x-icon"/>' . "\n";
do_js_includes();
if ($globals['thumbnail']) {
// WARN: It's assumed a thumbanil comes with base_url included
$thumb = $globals['thumbnail'];
} else {
$thumb = 'http://' . get_static_server_name() . $globals['base_url'] . $globals['thumbnail_logo'];
}
echo '<meta name="thumbnail_url" content="' . $thumb . "\"/>\n";
echo '<link rel="image_src" href="' . $thumb . "\"/>\n";
if ($globals['extra_head']) {
echo $globals['extra_head'];
}
//.........这里部分代码省略.........
示例10: dirname
<?php
if (!defined('mnmpath')) {
include dirname(__FILE__) . '/../config.php';
include mnminclude . 'html1.php';
}
header('Content-Type: text/html; charset=utf-8');
http_cache(86400 * 10);
// 10 days cache
$menemojis = array('angry' => 'angry.png', 'blank' => 'blank.png', 'cheesy' => 'cheesy.png', 'confused' => 'confused.png', 'cool' => 'cool.png', 'cry' => 'cry.gif', 'ffu' => 'ffu.png', 'goatse' => 'goatse.png', 'grin' => 'grin.png', 'hug' => 'hug.png', 'huh' => 'huh.png', 'kiss' => 'kiss.gif', 'lipssealed' => 'lipssealed.png', 'lol' => 'lol.gif', 'oops' => 'oops.png', 'palm' => 'palm.png', 'roll' => 'roll.gif', 'sad' => 'sad.png', 'shame' => 'shame.png', 'shit' => 'shit.png', 'shocked' => 'shocked.gif', 'smiley' => 'smiley.png', 'tongue' => 'tongue.png', 'troll' => 'troll.png', 'undecided' => 'undecided.png', 'wall' => 'wall.gif', 'wink' => 'wink.png', 'wow' => 'wow.png', 'coletas' => 'coletas.png', 'eli' => 'eli.png', 'foreveralone' => 'foreveralone.png', 'pagafantas' => 'pagafantas.png', 'popcorn' => 'popcorn.gif', 'take' => 'takemymoney.png', 'professor' => 'professor.png', 'peineta' => 'peineta.png', 'ferrari' => 'ferrari.png', 'calzador' => 'calzador.png', 'clap' => 'clap.gif', 'tinfoil' => 'tinfoil.gif');
$twemojis[_('gente')] = array("1f600", "1f601", "1f602", "1f603", "1f604", "1f605", "1f606", "1f607", "1f608", "1f609", "1f60a", "1f60b", "1f60c", "1f60d", "1f60e", "1f60f", "1f610", "1f611", "1f612", "1f613", "1f614", "1f615", "1f616", "1f617", "1f618", "1f619", "1f61a", "1f61b", "1f61c", "1f61d", "1f61e", "1f61f", "1f620", "1f621", "1f622", "1f623", "1f624", "1f625", "1f626", "1f627", "1f628", "1f629", "1f62a", "1f62b", "1f62c", "1f62d", "1f62e", "1f62f", "1f630", "1f631", "1f632", "1f633", "1f634", "1f635", "1f636", "1f637", "1f638", "1f639", "1f63a", "1f63b", "1f63c", "1f63d", "1f63e", "1f63f", "1f640", "1f645", "1f646", "1f647", "1f648", "1f649", "1f64a", "1f64b", "1f64c", "1f64d", "1f64e", "1f64f", "1f440", "1f442", "1f443", "1f444", "1f445", "1f446", "1f447", "1f448", "1f449", "1f44a", "1f44b", "1f44c", "1f44d", "1f44e", "1f44f", "1f450", "1f451", "1f452", "1f453", "1f454", "1f455", "1f456", "1f457", "1f458", "1f459", "1f45a", "1f45b", "1f45c", "1f45d", "1f45e", "1f45f", "1f460", "1f461", "1f462", "1f463", "1f464", "1f465", "1f466", "1f467", "1f468", "1f469", "1f46a", "1f46b", "1f46c", "1f46d", "1f46e", "1f46f", "1f470", "1f471", "1f472", "1f473", "1f474", "1f475", "1f476", "1f477", "1f478", "1f479", "1f47a", "1f47b", "1f47c", "1f47d", "1f47e", "1f47f", "1f480", "1f481", "1f482", "1f483", "1f484", "1f485", "1f486", "1f487", "1f488", "1f489", "1f48a", "1f48b", "1f48c", "1f48d", "1f48e", "1f48f", "1f490", "1f491", "1f492", "1f493", "1f494", "1f495", "1f496", "1f497", "1f498", "1f499", "261d");
// gente
$twemojis[_('naturaleza')] = array("1f300", "1f301", "1f302", "1f303", "1f304", "1f305", "1f306", "1f307", "1f308", "1f309", "1f30a", "1f30b", "1f30c", "1f30d", "1f30e", "1f30f", "1f310", "1f311", "1f312", "1f313", "1f314", "1f315", "1f316", "1f317", "1f318", "1f319", "1f31a", "1f31b", "1f31c", "1f31d", "1f31e", "1f31f", "1f320", "1f330", "1f331", "1f332", "1f333", "1f334", "1f335", "1f337", "1f338", "1f339", "1f33a", "1f33b", "1f33c", "1f33d", "1f33e", "1f33f", "1f340", "1f341", "1f342", "1f343", "1f344", "1f345", "1f346", "1f347", "1f348", "1f349", "1f34a", "1f34b", "1f34c", "1f34d", "1f34e", "1f34f", "1f350", "1f351", "1f352", "1f353");
// nature
$twemojis[_('comida')] = array("1f354", "1f355", "1f356", "1f357", "1f358", "1f359", "1f35a", "1f35b", "1f35c", "1f35d", "1f35e", "1f35f", "1f360", "1f361", "1f362", "1f363", "1f364", "1f365", "1f366", "1f367", "1f368", "1f369", "1f36a", "1f36b", "1f36c", "1f36d", "1f36e", "1f36f", "1f370", "1f371", "1f372", "1f373", "1f374", "1f375", "1f376", "1f377", "1f378", "1f379", "1f37a", "1f37b", "1f37c", "1f380", "1f381", "1f382");
// food
$twemojis[_('cosas')] = array("1f383", "1f384", "1f385", "1f386", "1f387", "1f388", "1f389", "1f38a", "1f38b", "1f38c", "1f38d", "1f38e", "1f38f", "1f390", "1f391", "1f392", "1f393", "1f3a0", "1f3a1", "1f3a2", "1f3a3", "1f3a4", "1f3a5", "1f3a6", "1f3a7", "1f3a8", "1f3a9", "1f3aa", "1f3ab", "1f3ac", "1f3ad", "1f3ae", "1f3af", "1f3b0", "1f3b1", "1f3b2", "1f3b3", "1f3b4", "1f3b5", "1f3b6", "1f3b7", "1f3b8", "1f3b9", "1f3ba", "1f3bb", "1f3bc", "1f3bd", "1f3be", "1f3bf", "1f3c0", "1f3c1", "1f3c2", "1f3c3", "1f3c4", "1f3c6", "1f3c7", "1f3c8", "1f3c9", "1f3ca", "1f3e0", "1f3e1", "1f3e2", "1f3e3", "1f3e4", "1f3e5", "1f3e6", "1f3e7", "1f3e8", "1f3e9", "1f3ea", "1f3eb", "1f3ec", "1f3ed", "1f3ee", "1f3ef", "1f3f0", "1f49a", "1f49b", "1f49c", "1f49d", "1f49e", "1f49f", "1f4a0", "1f4a1", "1f4a2", "1f4a3", "1f4a4", "1f4a5", "1f4a6", "1f4a7", "1f4a8", "1f4a9", "1f4aa", "1f4ab", "1f4ac", "1f4ad", "1f4ae", "1f4af", "1f4b0", "1f4b1", "1f4b2", "1f4b3", "1f4b4", "1f4b5", "1f4b6", "1f4b7", "1f4b8", "1f4b9", "1f4ba", "1f4bb", "1f4bc", "1f4bd", "1f4be", "1f4bf", "1f4c0", "1f4c1", "1f4c2", "1f4c3", "1f4c4", "1f4c5", "1f4c6", "1f4c7", "1f4c8", "1f4c9", "1f4ca", "1f4cb", "1f4cc", "1f4cd", "1f4ce", "1f4cf", "1f4d0", "1f4d1", "1f4d2", "1f4d3", "1f4d4", "1f4d5", "1f4d6", "1f4d7", "1f4d8", "1f4d9", "1f4da", "1f4db", "1f4dc", "1f4dd", "1f4de", "1f4df", "1f4e0", "1f4e1", "1f4e2", "1f4e3", "1f4e4", "1f4e5", "1f4e6", "1f4e7", "1f4e8", "1f4e9", "1f4ea", "1f4eb", "1f4ec", "1f4ed", "1f4ee", "1f4ef", "1f4f0", "1f4f1", "1f4f2", "1f4f3", "1f4f4", "1f4f5", "1f4f6", "1f4f7", "1f4f9", "1f4fa", "1f4fb", "1f4fc", "1f500", "1f501", "1f502", "1f503", "1f504", "1f505", "1f506", "1f507", "1f508", "1f509", "1f50a", "1f50b", "1f50c", "1f50d", "1f50e", "1f50f", "1f510", "1f511", "1f512", "1f513", "1f514", "1f515", "1f516", "1f517", "1f518", "1f519", "1f51a", "1f51b", "1f51c", "1f51d", "1f51e", "1f51f", "1f520", "1f521", "1f522", "1f523", "1f524", "1f525", "1f526", "1f527", "1f528", "1f529", "1f52a", "1f52b", "1f52c", "1f52d", "1f52e", "1f52f", "1f530", "1f531", "1f532", "1f533", "1f534", "1f535", "1f536", "1f537", "1f538", "1f539", "1f53a", "1f53b", "1f53c", "1f53d", "1f550", "1f551", "1f552", "1f553", "1f554", "1f555", "1f556", "1f557", "1f558", "1f559", "1f55a", "1f55b", "1f55c", "1f55d", "1f55e", "1f55f", "1f560", "1f561", "1f562", "1f563", "1f564", "1f565", "1f566", "1f567", "1f5fb", "1f5fc", "1f5fd", "1f5fe", "1f5ff");
// things
$twemojis[_('animales')] = array("1f400", "1f401", "1f402", "1f403", "1f404", "1f405", "1f406", "1f407", "1f408", "1f409", "1f40a", "1f40b", "1f40c", "1f40d", "1f40e", "1f40f", "1f410", "1f411", "1f412", "1f413", "1f414", "1f415", "1f416", "1f417", "1f418", "1f419", "1f41a", "1f41b", "1f41c", "1f41d", "1f41e", "1f41f", "1f420", "1f421", "1f422", "1f423", "1f424", "1f425", "1f426", "1f427", "1f428", "1f429", "1f42a", "1f42b", "1f42c", "1f42d", "1f42e", "1f42f", "1f430", "1f431", "1f432", "1f433", "1f434", "1f435", "1f436", "1f437", "1f438", "1f439", "1f43a", "1f43b", "1f43c", "1f43d", "1f43e");
// animals
$twemojis[_('transporte')] = array("1f680", "1f681", "1f682", "1f683", "1f684", "1f685", "1f686", "1f687", "1f688", "1f689", "1f68a", "1f68b", "1f68c", "1f68d", "1f68e", "1f68f", "1f690", "1f691", "1f692", "1f693", "1f694", "1f695", "1f696", "1f697", "1f698", "1f699", "1f69a", "1f69b", "1f69c", "1f69d", "1f69e", "1f69f", "1f6a0", "1f6a1", "1f6a2", "1f6a3", "1f6a4", "1f6a5", "1f6a6", "1f6a7", "1f6a8");
// traffic
echo '<div class="emoji-kbd">';
echo '<ul class="emojiCat">';
echo '<li><a href="#" data-target="cat-meneame" class="emoji-tab active">menéame</a></li>';
if (!$globals['mobile']) {
foreach ($twemojis as $cat => $v) {
echo '<li><a href="#" data-target="cat-' . $cat . '" class="emoji-tab">' . $cat . '</a></li>';
}
}
echo '</ul>';
示例11: _render_file_with_http_cache
function _render_file_with_http_cache($path)
{
if (file_exists($path)) {
if (option('http_cache')) {
$modified_timestamp = filemtime($path);
if ($modified_timestamp) {
http_cache($modified_timestamp);
}
}
render_file($path);
} else {
halt(NOT_FOUND);
}
}