if identity (uid) changes - reload any other open browser windows on next ping.

This commit is contained in:
friendica 2012-05-22 16:01:07 -07:00
parent 3ce06caeed
commit e70573f34c
5 changed files with 267 additions and 249 deletions

View File

@ -9,7 +9,7 @@ require_once('include/nav.php');
require_once('include/cache.php'); require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '3.0.1349' ); define ( 'FRIENDICA_VERSION', '3.0.1350' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1144 ); define ( 'DB_UPDATE_VERSION', 1144 );
@ -511,6 +511,7 @@ if(! class_exists('App')) {
$tpl = file_get_contents('view/head.tpl'); $tpl = file_get_contents('view/head.tpl');
$this->page['htmlhead'] = replace_macros($tpl,array( $this->page['htmlhead'] = replace_macros($tpl,array(
'$baseurl' => $this->get_baseurl(), // FIXME for z_path!!!! '$baseurl' => $this->get_baseurl(), // FIXME for z_path!!!!
'$local_user' => local_user(),
'$generator' => 'Friendica' . ' ' . FRIENDICA_VERSION, '$generator' => 'Friendica' . ' ' . FRIENDICA_VERSION,
'$delitem' => t('Delete this item?'), '$delitem' => t('Delete this item?'),
'$comment' => t('Comment'), '$comment' => t('Comment'),

View File

@ -117,6 +117,9 @@
/* nav update event */ /* nav update event */
$('nav').bind('nav-update', function(e,data){; $('nav').bind('nav-update', function(e,data){;
var invalid = $(data).find('invalid').text();
if(invalid == 1) { window.location.href=window.location.href }
var net = $(data).find('net').text(); var net = $(data).find('net').text();
if(net == 0) { net = ''; $('#net-update').removeClass('show') } else { $('#net-update').addClass('show') } if(net == 0) { net = ''; $('#net-update').removeClass('show') } else { $('#net-update').addClass('show') }
$('#net-update').html(net); $('#net-update').html(net);
@ -211,7 +214,8 @@
function NavUpdate() { function NavUpdate() {
if(! stopped) { if(! stopped) {
$.get("ping",function(data) { var pingCmd = 'ping' + ((localUser != 0) ? '?f=&uid=' + localUser : '');
$.get(pingCmd,function(data) {
$(data).find('result').each(function() { $(data).find('result').each(function() {
// send nav-update event // send nav-update event
$('nav').trigger('nav-update', this); $('nav').trigger('nav-update', this);

View File

@ -10,8 +10,16 @@ function ping_init(&$a) {
<result>"; <result>";
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">"; $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
if(local_user()){ if(local_user()){
// Different login session than the page that is calling us.
if(intval($_GET['uid']) && intval($_GET['uid']) != local_user()) {
echo '<invalid>1</invalid></result>';
killme();
}
$firehose = intval(get_pconfig(local_user(),'system','notify_full')); $firehose = intval(get_pconfig(local_user(),'system','notify_full'));
$t = q("select count(*) as total from notify where uid = %d and seen = 0", $t = q("select count(*) as total from notify where uid = %d and seen = 0",

File diff suppressed because it is too large Load Diff

View File

@ -29,6 +29,7 @@
<script> <script>
var updateInterval = $update_interval; var updateInterval = $update_interval;
var localUser = $local_user;
function confirmDelete() { return confirm("$delitem"); } function confirmDelete() { return confirm("$delitem"); }
function commentOpen(obj,id) { function commentOpen(obj,id) {