aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/item.php8
-rw-r--r--mod/network.php6
-rw-r--r--mod/profile.php36
-rw-r--r--mod/update_profile.php1
4 files changed, 44 insertions, 7 deletions
diff --git a/mod/item.php b/mod/item.php
index e0497af7a..c8758726f 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -91,10 +91,16 @@ function item_post(&$a) {
if(count($r))
$contact_record = $r[0];
+ $post_type == notags(trim($_POST['type']));
+
+ if($post_type == 'net-comment') {
+ if($parent_item !== null && $parent_item['type'] != 'remote')
+ $post_type = 'wall-comment';
+ }
$notify_type = (($parent) ? 'comment-new' : 'wall-new' );
- if(($_POST['type'] == 'wall') || ($_POST['type'] == 'wall-comment')) {
+ if(($_POST['type'] == 'wall') || ($_POST['type'] == 'wall-comment') || ($_POST['type'] == 'net-comment')) {
do {
$dups = false;
diff --git a/mod/network.php b/mod/network.php
index 262ecc20b..a91760f7f 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -166,6 +166,7 @@ function network_content(&$a, $update = false) {
if($item['last-child']) {
$comment = replace_macros($cmnt_tpl,array(
'$return_path' => $_SESSION['return_url'],
+ '$type' => 'net-comment',
'$id' => $item['item_id'],
'$parent' => $item['parent'],
'$profile_uid' => $_SESSION['uid'],
@@ -173,6 +174,10 @@ function network_content(&$a, $update = false) {
));
}
+
+ $drop = replace_macros(file_get_contents('view/wall_item_drop.tpl'), array('$id' => $item['id']));
+
+
if(($item['contact-uid'] == $_SESSION['uid']) && (strlen($item['dfrn-id'])) && (! $item['self'] ))
$profile_url = $redirect_url;
@@ -209,6 +214,7 @@ function network_content(&$a, $update = false) {
'$owner_url' => $owner_url,
'$owner_photo' => $owner_photo,
'$owner_name' => $owner_name,
+ '$drop' => $drop,
'$comment' => $comment
));
}
diff --git a/mod/profile.php b/mod/profile.php
index 0cfe22807..b0ff85a44 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -79,6 +79,7 @@ function profile_content(&$a, $update = false) {
+
if(remote_user()) {
$contact_id = $_SESSION['visitor_id'];
$groups = init_groups_visitor($contact_id);
@@ -88,9 +89,23 @@ function profile_content(&$a, $update = false) {
}
if($update) {
- if(! local_user())
- return '';
- $a->profile['uid'] = $_SESSION['uid'];
+ // Ensure we've got a profile owner if updating.
+ if(remote_user()) {
+ $r = q("SELECT `uid` FROM `contact` WHERE `id` = %d LIMIT 1",
+ intval($_SESSION['visitor_id'])
+ );
+ if(count($r))
+ $a->profile['uid'] = $r[0]['uid'];
+ else
+ killme();
+ }
+ elseif(local_user()) {
+ $a->profile['uid'] = $_SESSION['uid'];
+ }
+ else {
+ killme();
+ return; // NOTREACHED
+ }
}
else {
@@ -174,7 +189,7 @@ function profile_content(&$a, $update = false) {
$r = q("SELECT COUNT(*) AS `total`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
- AND `item`.`type` != 'remote' AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
+ AND NOT `item`.`type` IN ( 'remote', 'net-comment') AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$sql_extra ",
intval($a->profile['uid'])
@@ -190,7 +205,7 @@ function profile_content(&$a, $update = false) {
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
- AND `item`.`type` != 'remote' AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
+ AND NOT `item`.`type` IN ( 'remote', 'net-comment') AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$sql_extra
ORDER BY `parent` DESC, `id` ASC LIMIT %d ,%d ",
intval($a->profile['uid']),
@@ -217,10 +232,12 @@ function profile_content(&$a, $update = false) {
else
$return_url = $_SESSION['return_url'] = $a->cmd;
+
if(can_write_wall($a,$a->profile['uid'])) {
if($item['last-child']) {
$comment = replace_macros($cmnt_tpl,array(
'$return_path' => $_SESSION['return_url'],
+ '$type' => 'wall-comment',
'$id' => $item['item_id'],
'$parent' => $item['parent'],
'$profile_uid' => $a->profile['uid'],
@@ -252,6 +269,14 @@ function profile_content(&$a, $update = false) {
$profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']);
$profile_link = $profile_url;
+ $drop = '';
+
+ if(($item['contact-id'] == $_SESSION['visitor_id']) || ($item['uid'] == $_SESSION['uid']))
+ $drop = replace_macros(file_get_contents('view/wall_item_drop.tpl'), array('$id' => $item['id']));
+
+
+
+
$o .= replace_macros($template,array(
'$id' => $item['item_id'],
'$profile_url' => $profile_link,
@@ -260,6 +285,7 @@ function profile_content(&$a, $update = false) {
'$body' => bbcode($item['body']),
'$ago' => relative_date($item['created']),
'$indent' => (($item['parent'] != $item['item_id']) ? ' comment' : ''),
+ '$drop' => $drop,
'$comment' => $comment
));
}
diff --git a/mod/update_profile.php b/mod/update_profile.php
index 367a5568d..8ea86eb91 100644
--- a/mod/update_profile.php
+++ b/mod/update_profile.php
@@ -3,7 +3,6 @@
require_once('mod/profile.php');
-
function update_profile_content(&$a) {
header("Content-type: text/html");