aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/contacts.php11
-rw-r--r--mod/dfrn_notify.php125
-rw-r--r--mod/dfrn_poll.php2
-rw-r--r--mod/photos.php8
4 files changed, 83 insertions, 63 deletions
diff --git a/mod/contacts.php b/mod/contacts.php
index 61d9ce398..36f42f8e5 100644
--- a/mod/contacts.php
+++ b/mod/contacts.php
@@ -245,6 +245,13 @@ function contacts_content(&$a) {
$sparkle = '';
}
+ $last_update = (($r[0]['last-update'] == '0000-00-00 00:00:00')
+ ? t('Never')
+ : datetime_convert('UTC',date_default_timezone_get(),$r[0]['last-update'],'D, j M Y, g:i A'));
+
+ if($r[0]['last-update'] !== '0000-00-00 00:00:00')
+ $last_update .= ' ' . (($r[0]['last-update'] == $r[0]['success_update']) ? t("\x28Update was successful\x29") : t("\x28Update was not successful\x29"));
+
$o .= replace_macros($tpl,array(
'$header' => t('Contact Editor'),
'$visit' => t('Visit $name\'s profile'),
@@ -254,9 +261,7 @@ function contacts_content(&$a) {
'$poll_interval' => contact_poll_interval($r[0]['priority']),
'$lastupdtext' => t('Last updated: '),
'$updpub' => t('Update public posts: '),
- '$last_update' => (($r[0]['last-update'] == '0000-00-00 00:00:00')
- ? t('Never')
- : datetime_convert('UTC',date_default_timezone_get(),$r[0]['last-update'],'D, j M Y, g:i A')),
+ '$last_update' => $last_update,
'$udnow' => t('Update now'),
'$profile_select' => contact_profile_assign($r[0]['profile-id'],(($r[0]['network'] !== 'dfrn') ? true : false)),
'$contact_id' => $r[0]['id'],
diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php
index 142d13284..dffbb5974 100644
--- a/mod/dfrn_notify.php
+++ b/mod/dfrn_notify.php
@@ -200,68 +200,77 @@ function dfrn_notify_post(&$a) {
logger('dfrn_notify: feed item count = ' . $feed->get_item_quantity());
- foreach($feed->get_items() as $item) {
+ // process any deleted entries
+
+ $del_entries = $feed->get_feed_tags(NAMESPACE_TOMB, 'deleted-entry');
+ if(is_array($del_entries) && count($del_entries)) {
+ foreach($del_entries as $dentry) {
+ $deleted = false;
+ if(isset($dentry['attribs']['']['ref'])) {
+ $uri = $dentry['attribs']['']['ref'];
+ $deleted = true;
+ if(isset($dentry['attribs']['']['when'])) {
+ $when = $dentry['attribs']['']['when'];
+ $when = datetime_convert('UTC','UTC', $when, 'Y-m-d H:i:s');
+ }
+ else
+ $when = datetime_convert('UTC','UTC','now','Y-m-d H:i:s');
+ }
+ if($deleted) {
+ $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+ dbesc($uri),
+ intval($importer['importer_uid'])
+ );
+ if(count($r)) {
+ $item = $r[0];
- $deleted = false;
+ if(! $item['deleted'])
+ logger('dfrn_notify: deleting item ' . $item['id'] . ' uri=' . $item['uri'], LOGGER_DEBUG);
- $rawdelete = $item->get_item_tags( NAMESPACE_TOMB , 'deleted-entry');
- if(isset($rawdelete[0]['attribs']['']['ref'])) {
- $uri = $rawthread[0]['attribs']['']['ref'];
- $deleted = true;
- if(isset($rawdelete[0]['attribs']['']['when'])) {
- $when = $rawthread[0]['attribs']['']['when'];
- $when = datetime_convert('UTC','UTC', $when, 'Y-m-d H:i:s');
- }
- else
- $when = datetime_convert('UTC','UTC','now','Y-m-d H:i:s');
- }
- if($deleted) {
- $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
- dbesc($uri),
- intval($importer['importer_uid'])
- );
- if(count($r)) {
- $item = $r[0];
- if($item['uri'] == $item['parent-uri']) {
- $r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s'
- WHERE `parent-uri` = '%s' AND `uid` = %d",
- dbesc($when),
- dbesc(datetime_convert()),
- dbesc($item['uri']),
- intval($importer['importer_uid'])
- );
- }
- else {
- $r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s'
- WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
- dbesc($when),
- dbesc(datetime_convert()),
- dbesc($uri),
- intval($importer['importer_uid'])
- );
- if($item['last-child']) {
- // ensure that last-child is set in case the comment that had it just got wiped.
- $q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d ",
+ if($item['uri'] == $item['parent-uri']) {
+ $r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s'
+ WHERE `parent-uri` = '%s' AND `uid` = %d",
+ dbesc($when),
dbesc(datetime_convert()),
- dbesc($item['parent-uri']),
- intval($item['uid'])
+ dbesc($item['uri']),
+ intval($importer['importer_uid'])
);
- // who is the last child now?
- $r = q("SELECT `id` FROM `item` WHERE `parent-uri` = '%s' AND `type` != 'activity' AND `deleted` = 0 AND `uid` = %d
- ORDER BY `created` DESC LIMIT 1",
- dbesc($item['parent-uri']),
- intval($importer['importer_uid'])
+ }
+ else {
+ $r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s'
+ WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+ dbesc($when),
+ dbesc(datetime_convert()),
+ dbesc($uri),
+ intval($importer['importer_uid'])
);
- if(count($r)) {
- q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d LIMIT 1",
- intval($r[0]['id'])
+ if($item['last-child']) {
+ // ensure that last-child is set in case the comment that had it just got wiped.
+ q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d ",
+ dbesc(datetime_convert()),
+ dbesc($item['parent-uri']),
+ intval($item['uid'])
);
- }
- }
+ // who is the last child now?
+ $r = q("SELECT `id` FROM `item` WHERE `parent-uri` = '%s' AND `type` != 'activity' AND `deleted` = 0 AND `uid` = %d
+ ORDER BY `created` DESC LIMIT 1",
+ dbesc($item['parent-uri']),
+ intval($importer['importer_uid'])
+ );
+ if(count($r)) {
+ q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d LIMIT 1",
+ intval($r[0]['id'])
+ );
+ }
+ }
+ }
}
- }
- continue;
+ }
}
+ }
+
+
+ foreach($feed->get_items() as $item) {
$is_reply = false;
$item_id = $item->get_id();
@@ -298,7 +307,7 @@ function dfrn_notify_post(&$a) {
);
if(count($r))
$parent = $r[0]['parent'];
-
+
if(! $is_like) {
$r1 = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `uid` = %d AND `parent` = %d",
dbesc(datetime_convert()),
@@ -332,12 +341,11 @@ function dfrn_notify_post(&$a) {
'$from' => $from,
'$body' => strip_tags(bbcode(stripslashes($datarray['body'])))
));
-
+
$res = mail($importer['email'], $from . t(' commented on an item at ') . $a->config['sitename'],
$email_tpl, "From: " . t('Administrator') . '@' . $a->get_hostname() );
}
}
-
xml_status(0);
// NOTREACHED
}
@@ -372,7 +380,6 @@ function dfrn_notify_post(&$a) {
$datarray['type'] = 'activity';
$datarray['gravity'] = GRAVITY_LIKE;
}
-
$r = item_store($datarray);
// find out if our user is involved in this conversation and wants to be notified.
@@ -389,7 +396,7 @@ function dfrn_notify_post(&$a) {
continue;
require_once('bbcode.php');
$from = stripslashes($datarray['author-name']);
- $tpl = load_view_file('view/cmnt_received_eml.tpl');
+ $tpl = load_view_file('view/cmnt_received_eml.tpl');
$email_tpl = replace_macros($tpl, array(
'$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(),
diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php
index 85e7fc0af..334e10307 100644
--- a/mod/dfrn_poll.php
+++ b/mod/dfrn_poll.php
@@ -28,7 +28,7 @@ function dfrn_poll_init(&$a) {
if(($dfrn_id === '') && (! x($_POST,'dfrn_id')) && ($a->argc > 1)) {
logger('dfrn_poll: public feed request from ' . $_SERVER['REMOTE_ADDR'] );
header("Content-type: application/atom+xml");
- $o = get_feed_for($a, '*', $a->argv[1],$last_update);
+ $o = get_feed_for($a, '', $a->argv[1],$last_update);
echo $o;
killme();
}
diff --git a/mod/photos.php b/mod/photos.php
index 1a1ebaac1..9acde458d 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -268,6 +268,13 @@ foreach($_FILES AS $key => $val) {
intval($page_owner_uid)
);
}
+
+ /* Don't make the item visible if the only change was the album name */
+
+ $visibility = 0;
+ if($p[0]['desc'] !== $desc || strlen($rawtags))
+ $visibility = 1;
+
if(! $item_id) {
// Create item container
@@ -297,6 +304,7 @@ foreach($_FILES AS $key => $val) {
$arr['deny_cid'] = $p[0]['deny_cid'];
$arr['deny_gid'] = $p[0]['deny_gid'];
$arr['last-child'] = 1;
+ $arr['visible'] = $visibility;
$arr['body'] = '[url=' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $p[0]['resource-id'] . ']'
. '[img]' . $a->get_baseurl() . '/photo/' . $p[0]['resource-id'] . '-' . $p[0]['scale'] . '.jpg' . '[/img]'
. '[/url]';