diff options
author | Mike Macgirvin <mike@macgirvin.com> | 2010-09-20 19:34:44 -0700 |
---|---|---|
committer | Mike Macgirvin <mike@macgirvin.com> | 2010-09-20 19:34:44 -0700 |
commit | 3ad52463f633b060bee519e8aa4d6e9453fdc2aa (patch) | |
tree | 5235655b2dd2e9a2af5f1179ebbff20dfdbd05b6 /mod | |
parent | 177a6d7f79f5e237eb6d0811e8e28732a4c90d03 (diff) | |
download | volse-hubzilla-3ad52463f633b060bee519e8aa4d6e9453fdc2aa.tar.gz volse-hubzilla-3ad52463f633b060bee519e8aa4d6e9453fdc2aa.tar.bz2 volse-hubzilla-3ad52463f633b060bee519e8aa4d6e9453fdc2aa.zip |
more robust feed error handling, at the expense of performance.
Pass profile owner through HTML (yuk) to the ajax updater - as
browser pre-fetch totally buggers passing it via the server session.
Diffstat (limited to 'mod')
-rw-r--r-- | mod/network.php | 4 | ||||
-rw-r--r-- | mod/profile.php | 17 | ||||
-rw-r--r-- | mod/update_network.php | 4 | ||||
-rw-r--r-- | mod/update_profile.php | 4 |
4 files changed, 19 insertions, 10 deletions
diff --git a/mod/network.php b/mod/network.php index c5845f63c..e9e730340 100644 --- a/mod/network.php +++ b/mod/network.php @@ -7,7 +7,7 @@ function network_init(&$a) { } -function network_content(&$a, $update = false) { +function network_content(&$a, $update = 0) { if(! local_user()) return; @@ -59,7 +59,7 @@ function network_content(&$a, $update = false) { // criteria is discovered in javascript). if($a->pager['start'] == 0 && $a->argc == 1) - $o .= '<div id="live-network"></div>' . "\r\n"; + $o .= '<div id="live-network" profile="' . $_SESSION['uid'] . '"></div>' . "\r\n"; } // We aren't going to try and figure out at the item, group, and page level diff --git a/mod/profile.php b/mod/profile.php index 31b634013..0d9c94eed 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -74,7 +74,11 @@ function profile_init(&$a) { } -function profile_content(&$a, $update = false) { +function profile_content(&$a, $update = 0) { + + + file_put_contents('uid.log',"{$_SERVER['QUERY_STRING']} ". session_id() . "\n", FILE_APPEND); + require_once("include/bbcode.php"); require_once('include/security.php'); @@ -86,13 +90,11 @@ function profile_content(&$a, $update = false) { if($update) { // Ensure we've got a profile owner if updating. - $a->profile['profile_uid'] = $_SESSION['profile_uid']; + $a->profile['profile_uid'] = $update; } else { - if($a->profile['uid'] == get_uid()) + if($a->profile['profile_uid'] == get_uid()) $o .= '<script> $(document).ready(function() { $(\'#nav-home-link\').addClass(\'nav-selected\'); });</script>'; - // set the uid so we can pick it up during update - $_SESSION['profile_uid'] = $a->profile['uid']; } $contact = null; @@ -158,8 +160,11 @@ function profile_content(&$a, $update = false) { )); } + // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, + // because browser prefetching might change it on us. We have to deliver it with the page. + if($tab == 'posts' && (! $a->pager['start'])) - $o .= '<div id="live-profile"></div>' . "\r\n"; + $o .= '<div id="live-profile" profile="' . $a->profile['profile_uid'] . '"></div>' . "\r\n"; } // TODO alter registration and settings and profile to update contact table when names and photos change. diff --git a/mod/update_network.php b/mod/update_network.php index 1c790ead1..35e968dba 100644 --- a/mod/update_network.php +++ b/mod/update_network.php @@ -7,12 +7,14 @@ require_once('mod/network.php'); function update_network_content(&$a) { + $profile_uid = intval($_GET['p']); + header("Content-type: text/html"); echo "<!DOCTYPE html><html><body>\r\n"; echo (($_GET['msie'] == 1) ? '<div>' : '<section>'); - $text = network_content($a,true); + $text = network_content($a,$profile_uid); $pattern = "/<img([^>]*) src=\"([^\"]*)\"/"; $replace = "<img\${1} dst=\"\${2}\""; $text = preg_replace($pattern, $replace, $text); diff --git a/mod/update_profile.php b/mod/update_profile.php index e5085f6ec..9a6729396 100644 --- a/mod/update_profile.php +++ b/mod/update_profile.php @@ -7,6 +7,8 @@ require_once('mod/profile.php'); function update_profile_content(&$a) { + $profile_uid = intval($_GET['p']); + header("Content-type: text/html"); echo "<!DOCTYPE html><html><body>\r\n"; echo (($_GET['msie'] == 1) ? '<div>' : '<section>'); @@ -16,7 +18,7 @@ function update_profile_content(&$a) { // The only ones we need to fetch are those for new page additions, which we'll discover // on the client side and then swap the image back. - $text = profile_content($a,true); + $text = profile_content($a,$profile_uid); $pattern = "/<img([^>]*) src=\"([^\"]*)\"/"; $replace = "<img\${1} dst=\"\${2}\""; $text = preg_replace($pattern, $replace, $text); |