require_once('library/Mobile_Detect/Mobile_Detect.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
-define ( 'FRIENDICA_VERSION', '3.0.1478' );
+define ( 'FRIENDICA_VERSION', '3.0.1479' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1156 );
--- /dev/null
+<?php
+
+require_once('include/security.php');
+require_once('include/bbcode.php');
+require_once('include/items.php');
+
+
+function subthread_content(&$a) {
+
+ if(! local_user() && ! remote_user()) {
+ return;
+ }
+
+ $activity = ACTIVITY_FOLLOW;
+
+ $item_id = (($a->argc > 1) ? notags(trim($a->argv[1])) : 0);
+
+ $r = q("SELECT * FROM `item` WHERE `parent` = '%s' OR `parent-uri` = '%s' and parent = id LIMIT 1",
+ dbesc($item_id),
+ dbesc($item_id)
+ );
+
+ if(! $item_id || (! count($r))) {
+ logger('subthread: no item ' . $item_id);
+ return;
+ }
+
+ $item = $r[0];
+
+ $owner_uid = $item['uid'];
+
+ if(! can_write_wall($a,$owner_uid)) {
+ return;
+ }
+
+ $remote_owner = null;
+
+ if(! $item['wall']) {
+ // The top level post may have been written by somebody on another system
+ $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($item['contact-id']),
+ intval($item['uid'])
+ );
+ if(! count($r))
+ return;
+ if(! $r[0]['self'])
+ $remote_owner = $r[0];
+ }
+
+ // this represents the post owner on this system.
+
+ $r = q("SELECT `contact`.*, `user`.`nickname` FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
+ WHERE `contact`.`self` = 1 AND `contact`.`uid` = %d LIMIT 1",
+ intval($owner_uid)
+ );
+ if(count($r))
+ $owner = $r[0];
+
+ if(! $owner) {
+ logger('like: no owner');
+ return;
+ }
+
+ if(! $remote_owner)
+ $remote_owner = $owner;
+
+
+ // This represents the person posting
+
+ if((local_user()) && (local_user() == $owner_uid)) {
+ $contact = $owner;
+ }
+ else {
+ $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($_SESSION['visitor_id']),
+ intval($owner_uid)
+ );
+ if(count($r))
+ $contact = $r[0];
+ }
+ if(! $contact) {
+ return;
+ }
+
+ $uri = item_new_uri($a->get_hostname(),$owner_uid);
+
+ $post_type = (($item['resource-id']) ? t('photo') : t('status'));
+ $objtype = (($item['resource-id']) ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );
+ $link = xmlify('<link rel="alternate" type="text/html" href="' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;
+ $body = $item['body'];
+
+ $obj = <<< EOT
+
+ <object>
+ <type>$objtype</type>
+ <local>1</local>
+ <id>{$item['uri']}</id>
+ <link>$link</link>
+ <title></title>
+ <content>$body</content>
+ </object>
+EOT;
+ $bodyverb = t('%1$s is following %2$s\'s %3$s');
+
+ if(! isset($bodyverb))
+ return;
+
+ $arr = array();
+
+ $arr['uri'] = $uri;
+ $arr['uid'] = $owner_uid;
+ $arr['contact-id'] = $contact['id'];
+ $arr['type'] = 'activity';
+ $arr['wall'] = $item['wall'];
+ $arr['origin'] = 1;
+ $arr['gravity'] = GRAVITY_LIKE;
+ $arr['parent'] = $item['id'];
+ $arr['parent-uri'] = $item['uri'];
+ $arr['thr-parent'] = $item['uri'];
+ $arr['owner-name'] = $remote_owner['name'];
+ $arr['owner-link'] = $remote_owner['url'];
+ $arr['owner-avatar'] = $remote_owner['thumb'];
+ $arr['author-name'] = $contact['name'];
+ $arr['author-link'] = $contact['url'];
+ $arr['author-avatar'] = $contact['thumb'];
+
+ $ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
+ $alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
+ $plink = '[url=' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . ']' . $post_type . '[/url]';
+ $arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink );
+
+ $arr['verb'] = $activity;
+ $arr['object-type'] = $objtype;
+ $arr['object'] = $obj;
+ $arr['allow_cid'] = $item['allow_cid'];
+ $arr['allow_gid'] = $item['allow_gid'];
+ $arr['deny_cid'] = $item['deny_cid'];
+ $arr['deny_gid'] = $item['deny_gid'];
+ $arr['visible'] = 1;
+ $arr['unseen'] = 1;
+ $arr['last-child'] = 0;
+
+ $post_id = item_store($arr);
+
+ if(! $item['visible']) {
+ $r = q("UPDATE `item` SET `visible` = 1 WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($item['id']),
+ intval($owner_uid)
+ );
+ }
+
+ $arr['id'] = $post_id;
+
+ call_hooks('post_local_end', $arr);
+
+ killme();
+
+}
+
+
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: 3.0.1478\n"
+"Project-Id-Version: 3.0.1479\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-09-26 10:00-0700\n"
+"POT-Creation-Date: 2012-09-27 10:00-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
#: ../../mod/dfrn_confirm.php:53 ../../addon/facebook/facebook.php:510
#: ../../addon/facebook/facebook.php:516 ../../addon/fbpost/fbpost.php:159
#: ../../addon/fbpost/fbpost.php:165
-#: ../../addon/dav/friendica/layout.fnk.php:354 ../../include/items.php:3908
+#: ../../addon/dav/friendica/layout.fnk.php:354 ../../include/items.php:3913
#: ../../index.php:317
msgid "Permission denied."
msgstr ""
#: ../../addon/randplace/randplace.php:177 ../../addon/dwpost/dwpost.php:93
#: ../../addon/drpost/drpost.php:110 ../../addon/startpage/startpage.php:92
#: ../../addon/geonames/geonames.php:187 ../../addon/oembed.old/oembed.php:41
-#: ../../addon/forumlist/forumlist.php:169
+#: ../../addon/forumlist/forumlist.php:163
#: ../../addon/impressum/impressum.php:83
#: ../../addon/notimeline/notimeline.php:64 ../../addon/blockem/blockem.php:57
#: ../../addon/qcomment/qcomment.php:61
msgid "Confirm"
msgstr ""
-#: ../../mod/dfrn_request.php:715 ../../include/items.php:3287
+#: ../../mod/dfrn_request.php:715 ../../include/items.php:3292
msgid "[Name Withheld]"
msgstr ""
#: ../../addon/facebook/facebook.php:702
#: ../../addon/facebook/facebook.php:1200 ../../addon/fbpost/fbpost.php:661
#: ../../addon/public_server/public_server.php:62
-#: ../../addon/testdrive/testdrive.php:67 ../../include/items.php:3296
+#: ../../addon/testdrive/testdrive.php:67 ../../include/items.php:3301
#: ../../boot.php:788
msgid "Administrator"
msgstr ""
#: ../../mod/notice.php:15 ../../mod/viewsrc.php:15 ../../mod/admin.php:159
#: ../../mod/admin.php:734 ../../mod/admin.php:933 ../../mod/display.php:29
-#: ../../mod/display.php:145 ../../include/items.php:3774
+#: ../../mod/display.php:145 ../../include/items.php:3779
msgid "Item not found."
msgstr ""
msgstr ""
#: ../../addon/page/page.php:61 ../../addon/page/page.php:91
-#: ../../addon/forumlist/forumlist.php:54
+#: ../../addon/forumlist/forumlist.php:55
msgid "Forums"
msgstr ""
-#: ../../addon/page/page.php:129 ../../addon/forumlist/forumlist.php:88
+#: ../../addon/page/page.php:129 ../../addon/forumlist/forumlist.php:89
msgid "Forums:"
msgstr ""
msgid "Page Settings"
msgstr ""
-#: ../../addon/page/page.php:196 ../../addon/forumlist/forumlist.php:155
+#: ../../addon/page/page.php:196
msgid "How many forums to display on sidebar without paging"
msgstr ""
msgid "URL to embed:"
msgstr ""
-#: ../../addon/forumlist/forumlist.php:57
+#: ../../addon/forumlist/forumlist.php:58
msgid "show/hide"
msgstr ""
msgid "No forum subscriptions"
msgstr ""
-#: ../../addon/forumlist/forumlist.php:124
+#: ../../addon/forumlist/forumlist.php:125
msgid "Forumlist settings updated."
msgstr ""
-#: ../../addon/forumlist/forumlist.php:153
+#: ../../addon/forumlist/forumlist.php:150
msgid "Forumlist Settings"
msgstr ""
-#: ../../addon/forumlist/forumlist.php:158
-msgid "Randomise Forumlist/Forum list"
+#: ../../addon/forumlist/forumlist.php:152
+msgid "Randomise forum list"
msgstr ""
-#: ../../addon/forumlist/forumlist.php:161
-msgid "Show forumlists/forums on profile forumlist"
+#: ../../addon/forumlist/forumlist.php:155
+msgid "Show forums on profile page"
msgstr ""
#: ../../addon/impressum/impressum.php:37
msgid "%1$d %2$s ago"
msgstr ""
-#: ../../include/datetime.php:472 ../../include/items.php:1683
+#: ../../include/datetime.php:472 ../../include/items.php:1688
#, php-format
msgid "%s's birthday"
msgstr ""
-#: ../../include/datetime.php:473 ../../include/items.php:1684
+#: ../../include/datetime.php:473 ../../include/items.php:1689
#, php-format
msgid "Happy Birthday %s"
msgstr ""
msgid "following"
msgstr ""
-#: ../../include/items.php:3294
+#: ../../include/items.php:3299
msgid "A new person is sharing with you at "
msgstr ""
-#: ../../include/items.php:3294
+#: ../../include/items.php:3299
msgid "You have a new follower at "
msgstr ""
-#: ../../include/items.php:3975
+#: ../../include/items.php:3980
msgid "Archives"
msgstr ""