aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/dfrn_confirm.php4
-rw-r--r--mod/item.php116
-rwxr-xr-xmod/like.php2
-rw-r--r--mod/manage.php4
-rwxr-xr-xmod/mood.php2
-rw-r--r--mod/photos.php6
-rwxr-xr-xmod/poke.php2
-rw-r--r--mod/profiles.php2
-rwxr-xr-xmod/subthread.php2
-rw-r--r--mod/tagger.php2
10 files changed, 48 insertions, 94 deletions
diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php
index b0bea7a61..c91b05a48 100644
--- a/mod/dfrn_confirm.php
+++ b/mod/dfrn_confirm.php
@@ -439,7 +439,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
if(count($self)) {
$arr = array();
- $arr['uri'] = $arr['parent_uri'] = item_new_uri($a->get_hostname(), $uid);
+ $arr['uri'] = $arr['parent_uri'] = item_message_id();
$arr['uid'] = $uid;
$arr['contact-id'] = $self[0]['id'];
$arr['wall'] = 1;
@@ -760,7 +760,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
if(count($self)) {
$arr = array();
- $arr['uri'] = $arr['parent_uri'] = item_new_uri($a->get_hostname(), $local_uid);
+ $arr['uri'] = $arr['parent_uri'] = item_message_id();
$arr['uid'] = $local_uid;
$arr['contact-id'] = $self[0]['id'];
$arr['wall'] = 1;
diff --git a/mod/item.php b/mod/item.php
index b135a4b3a..857d7ec63 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -18,6 +18,7 @@
require_once('include/crypto.php');
require_once('include/enotify.php');
require_once('include/email.php');
+require_once('include/items.php');
function item_post(&$a) {
@@ -173,14 +174,28 @@ function item_post(&$a) {
$orig_post = $i[0];
}
- $user = null;
+ $channel = null;
+
+ if(local_user() && local_user() == $profile_uid) {
+ $channel = $a->get_channel();
+ $observer = $a->get_observer();
+ }
+ else {
+ $r = q("SELECT channel.*, account.* FROM channel left join account on channel.channel_account_id = account.account_id
+ where channel.channel_id = %d LIMIT 1",
+ intval($profile_uid)
+ );
+ if(count($r))
+ $channel = $r[0];
+ }
+
+ if(! $channel) {
+ logger("mod_item: no channel.");
+ if(x($_REQUEST,'return'))
+ goaway($a->get_baseurl() . "/" . $return_path );
+ killme();
+ }
- $r = q("SELECT channel.*, account.* FROM channel left join account on channel.channel_account_id = account.account_id
- where channel.channel_id = %d LIMIT 1",
- intval($profile_uid)
- );
- if(count($r))
- $channel = $r[0];
if($orig_post) {
$str_group_allow = $orig_post['allow_gid'];
@@ -538,7 +553,8 @@ function item_post(&$a) {
$notify_type = (($parent) ? 'comment-new' : 'wall-new' );
- $uri = item_new_uri($a->get_hostname(),$profile_uid);
+ $uri = item_message_id();
+
// Fallback so that we alway have a thr_parent
@@ -546,17 +562,19 @@ function item_post(&$a) {
$thr_parent = $uri;
$datarray = array();
+
+ if(! $parent)
+ $datarray['parent_uri'] = $uri;
+
+
+ $datarray['aid'] = get_account_id(); // fixme
+
$datarray['uid'] = $profile_uid;
$datarray['type'] = $post_type;
$datarray['wall'] = $wall;
$datarray['gravity'] = $gravity;
- $datarray['contact-id'] = $contact_id;
- $datarray['owner-name'] = $contact_record['name'];
- $datarray['owner-link'] = $contact_record['url'];
- $datarray['owner-avatar'] = $contact_record['thumb'];
- $datarray['author-name'] = $author['name'];
- $datarray['author-link'] = $author['url'];
- $datarray['author-avatar'] = $author['thumb'];
+ $datarray['owner_xchan'] = $observer['xchan_hash']; // fixme
+ $datarray['author_xchan'] = $observer['xchan_hash'];
$datarray['created'] = datetime_convert();
$datarray['edited'] = datetime_convert();
$datarray['commented'] = datetime_convert();
@@ -582,18 +600,6 @@ function item_post(&$a) {
$datarray['origin'] = $origin;
$datarray['moderated'] = $allow_moderated;
- /**
- * These fields are for the convenience of plugins...
- * 'self' if true indicates the owner is posting on their own wall
- * If parent is 0 it is a top-level post.
- */
-
- $datarray['parent'] = $parent;
- $datarray['self'] = $self;
-
-
- if($orig_post)
- $datarray['edit'] = true;
// preview mode - prepare the body for display and send it via json
@@ -671,54 +677,11 @@ function item_post(&$a) {
$post_id = 0;
- $r = q("INSERT INTO `item` (`uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
- `author-name`, `author-link`, `author-avatar`, `created`, `edited`, `commented`, `received`, `changed`, `uri`, `thr_parent`, `title`, `body`, `app`, `lang`, `location`, `coord`,
- `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `attach`,`origin`, `moderated`)
- VALUES( %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', %d, %d )",
- intval($datarray['uid']),
- dbesc($datarray['type']),
- intval($datarray['wall']),
- intval($datarray['gravity']),
- intval($datarray['contact-id']),
- dbesc($datarray['owner-name']),
- dbesc($datarray['owner-link']),
- dbesc($datarray['owner-avatar']),
- dbesc($datarray['author-name']),
- dbesc($datarray['author-link']),
- dbesc($datarray['author-avatar']),
- dbesc($datarray['created']),
- dbesc($datarray['edited']),
- dbesc($datarray['commented']),
- dbesc($datarray['received']),
- dbesc($datarray['changed']),
- dbesc($datarray['uri']),
- dbesc($datarray['thr_parent']),
- dbesc($datarray['title']),
- dbesc($datarray['body']),
- dbesc($datarray['app']),
- dbesc($datarray['lang']),
- dbesc($datarray['location']),
- dbesc($datarray['coord']),
- dbesc($datarray['inform']),
- dbesc($datarray['verb']),
- dbesc($datarray['postopts']),
- dbesc($datarray['allow_cid']),
- dbesc($datarray['allow_gid']),
- dbesc($datarray['deny_cid']),
- dbesc($datarray['deny_gid']),
- intval($datarray['private']),
- dbesc($datarray['attach']),
- intval($datarray['origin']),
- intval($datarray['moderated'])
- );
+ $post_id = item_store($datarray);
- $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
- dbesc($datarray['uri']));
- if(count($r)) {
- $post_id = $r[0]['id'];
+ if($post_id) {
logger('mod_item: saved item ' . $post_id);
-
if(count($post_tags)) {
foreach($post_tags as $tag) {
if(strlen(trim($tag['term']))) {
@@ -841,15 +804,6 @@ function item_post(&$a) {
call_hooks('post_local_end', $datarray);
- // This is a real juggling act on shared hosting services which kill your processes
- // e.g. dreamhost. We used to start delivery to our native delivery agents in the background
- // and then run our plugin delivery from the foreground. We're now doing plugin delivery first,
- // because as soon as you start loading up a bunch of remote delivey processes, *this* page is
- // likely to get killed off. If you end up looking at an /item URL and a blank page,
- // it's very likely the delivery got killed before all your friends could be notified.
- // Currently the only realistic fixes are to use a reliable server - which precludes shared hosting,
- // or cut back on plugins which do remote deliveries.
-
proc_run('php', "include/notifier.php", $notify_type, "$post_id");
logger('post_complete');
diff --git a/mod/like.php b/mod/like.php
index 7ee9c3cb0..a54493bb4 100755
--- a/mod/like.php
+++ b/mod/like.php
@@ -127,7 +127,7 @@ function like_content(&$a) {
return;
}
- $uri = item_new_uri($a->get_hostname(),$owner_uid);
+ $uri = item_message_id();
$post_type = (($item['resource_id']) ? t('photo') : t('status'));
$objtype = (($item['resource_id']) ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );
diff --git a/mod/manage.php b/mod/manage.php
index 593ba4ae2..557a19375 100644
--- a/mod/manage.php
+++ b/mod/manage.php
@@ -14,8 +14,8 @@ function manage_content(&$a) {
if($change_channel) {
$r = change_channel($change_channel);
- if($r && $r[0]['channel_startpage'])
- goaway(z_root() . '/' . $r[0]['channel_startpage']);
+ if($r && $r['channel_startpage'])
+ goaway(z_root() . '/' . $r['channel_startpage']);
goaway(z_root());
}
diff --git a/mod/mood.php b/mod/mood.php
index 7a793c71e..8992c55e3 100755
--- a/mod/mood.php
+++ b/mod/mood.php
@@ -57,7 +57,7 @@ function mood_init(&$a) {
$poster = $a->contact;
- $uri = item_new_uri($a->get_hostname(),$uid);
+ $uri = item_message_id();
$action = sprintf( t('%1$s is currently %2$s'), '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' , $verbs[$verb]);
diff --git a/mod/photos.php b/mod/photos.php
index 25e04d79c..350b4bcd5 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -405,7 +405,7 @@ function photos_post(&$a) {
// Create item container
$title = '';
- $uri = item_new_uri($a->get_hostname(),$page_owner_uid);
+ $uri = item_message_id();
$arr = array();
@@ -588,7 +588,7 @@ function photos_post(&$a) {
if(count($taginfo)) {
foreach($taginfo as $tagged) {
- $uri = item_new_uri($a->get_hostname(),$page_owner_uid);
+ $uri = item_message_id();
$arr = array();
@@ -805,7 +805,7 @@ function photos_post(&$a) {
}
$basename = basename($filename);
- $uri = item_new_uri($a->get_hostname(), $page_owner_uid);
+ $uri = item_message_id();
// Create item container
diff --git a/mod/poke.php b/mod/poke.php
index a4ccc517a..739690386 100755
--- a/mod/poke.php
+++ b/mod/poke.php
@@ -76,7 +76,7 @@ function poke_init(&$a) {
$poster = $a->contact;
- $uri = item_new_uri($a->get_hostname(),$uid);
+ $uri = item_message_id();
$arr = array();
diff --git a/mod/profiles.php b/mod/profiles.php
index 8679f3026..6c33deb0f 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -338,7 +338,7 @@ function profile_activity($changed, $value) {
return;
$arr = array();
- $arr['uri'] = $arr['parent_uri'] = item_new_uri($a->get_hostname(), local_user());
+ $arr['uri'] = $arr['parent_uri'] = item_message_id();
$arr['uid'] = local_user();
$arr['contact-id'] = $self[0]['id'];
$arr['wall'] = 1;
diff --git a/mod/subthread.php b/mod/subthread.php
index b6e8c476a..7ad7dfd6b 100755
--- a/mod/subthread.php
+++ b/mod/subthread.php
@@ -82,7 +82,7 @@ function subthread_content(&$a) {
return;
}
- $uri = item_new_uri($a->get_hostname(),$owner_uid);
+ $uri = item_message_id();
$post_type = (($item['resource_id']) ? t('photo') : t('status'));
$objtype = (($item['resource_id']) ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );
diff --git a/mod/tagger.php b/mod/tagger.php
index bf05d2e4c..11d1f81d7 100644
--- a/mod/tagger.php
+++ b/mod/tagger.php
@@ -57,7 +57,7 @@ function tagger_content(&$a) {
return;
}
- $uri = item_new_uri($a->get_hostname(),$owner_uid);
+ $uri = item_message_id();
$xterm = xmlify($term);
$post_type = (($item['resource_id']) ? t('photo') : t('status'));
$targettype = (($item['resource_id']) ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );