From 4bff52990e5f340cf879abf7c1cdaea7ee928d74 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 16 Feb 2011 21:17:49 -0800 Subject: ajax reload fixes --- mod/display.php | 3 ++- mod/item.php | 11 +++++++++-- mod/network.php | 3 ++- mod/photos.php | 9 ++++++--- mod/profile.php | 3 ++- 5 files changed, 21 insertions(+), 8 deletions(-) (limited to 'mod') diff --git a/mod/display.php b/mod/display.php index 03003f3c0..bdf6a6f97 100644 --- a/mod/display.php +++ b/mod/display.php @@ -153,7 +153,8 @@ function display_content(&$a) { } if($item['last-child']) { $comment = replace_macros($cmnt_tpl,array( - '$return_path' => '', // $_SESSION['return_url'], + '$return_path' => '', + '$jsreload' => $_SESSION['return_url'], '$type' => 'wall-comment', '$id' => $item['item_id'], '$parent' => $item['parent'], diff --git a/mod/item.php b/mod/item.php index cbdd11eb9..8c6b181c0 100644 --- a/mod/item.php +++ b/mod/item.php @@ -496,10 +496,17 @@ function item_post(&$a) { } } - if((x($_POST,'return')) && strlen($_POST['return'])) + logger('post_complete'); + if((x($_POST,'return')) && strlen($_POST['return'])) { + logger('return: ' . $_POST['return']); goaway($a->get_baseurl() . "/" . $_POST['return'] ); - + } $json = array('success' => 1); + if(x($_POST,'jsreload') && strlen($_POST['jsreload'])) + $json['reload'] = $a->get_baseurl() . '/' . $_POST['jsreload']; + + logger('post_json: ' . print_r($json,true), LOGGER_DEBUG); + echo json_encode($json); killme(); // NOTREACHED diff --git a/mod/network.php b/mod/network.php index 3658c601e..bb0850d68 100644 --- a/mod/network.php +++ b/mod/network.php @@ -340,7 +340,8 @@ function network_content(&$a, $update = 0) { if($item['last-child']) { $comment = replace_macros($cmnt_tpl,array( - '$return_path' => '', // $_SESSION['return_url'], + '$return_path' => '', + '$jsreload => '', // $_SESSION['return_url'], '$type' => 'net-comment', '$id' => $item['item_id'], '$parent' => $item['parent'], diff --git a/mod/photos.php b/mod/photos.php index a44eb5a5f..27cb1beb1 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1048,7 +1048,8 @@ function photos_content(&$a) { if($can_post || can_write_wall($a,$owner_uid)) { if($link_item['last-child']) { $o .= replace_macros($cmnt_tpl,array( - '$return_path' => '', // $return_url, + '$return_path' => '', + '$jsreload' => $return_url, '$type' => 'wall-comment', '$id' => $link_item['id'], '$parent' => $link_item['id'], @@ -1087,7 +1088,8 @@ function photos_content(&$a) { if($can_post || can_write_wall($a,$owner_uid)) { if($link_item['last-child']) { $o .= replace_macros($cmnt_tpl,array( - '$return_path' => $return_url, + '$return_path' => '', + '$jsreload' => $return_url, '$type' => 'wall-comment', '$id' => $link_item['id'], '$parent' => $link_item['id'], @@ -1115,7 +1117,8 @@ function photos_content(&$a) { if($item['last-child']) { $comment = replace_macros($cmnt_tpl,array( - '$return_path' => $return_url, + '$return_path' => '', + '$jsreload' => $return_url, '$type' => 'wall-comment', '$id' => $item['item_id'], '$parent' => $item['parent'], diff --git a/mod/profile.php b/mod/profile.php index 0723d64fb..3a393eea0 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -293,7 +293,8 @@ function profile_content(&$a, $update = 0) { } if($item['last-child']) { $comment = replace_macros($cmnt_tpl,array( - '$return_path' => '', // $_SESSION['return_url'], + '$return_path' => '', + '$jsreload' => '', // $_SESSION['return_url'], '$type' => 'wall-comment', '$id' => $item['item_id'], '$parent' => $item['parent'], -- cgit v1.2.3