From 9b7994a9b785bac7ae8314ae398352d336b26aef Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 27 Oct 2013 20:01:28 -0700 Subject: remote post module so that from anywhere on the web or at least within the matrix you'll be able to share content or we can have apps on other sites that post status updates on your wall. All with your permission of course as you'll have to click "share" to actually post it. --- include/conversation.php | 4 +-- mod/editpost.php | 6 ++-- mod/rpost.php | 90 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 mod/rpost.php diff --git a/include/conversation.php b/include/conversation.php index a8b3150b4..497c2fda7 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1096,7 +1096,7 @@ function status_editor($a,$x,$popup=false) { '$shortsetloc' => t('set location'), '$noloc' => t('Clear browser location'), '$shortnoloc' => t('clear location'), - '$title' => "", + '$title' => ((x($x,'title')) ? htmlspecialchars($x['title']) : ''), '$placeholdertitle' => t('Set title'), '$catsenabled' => ((feature_enabled($x['profile_uid'],'categories') && (! $webpage)) ? 'categories' : ''), '$category' => "", @@ -1105,7 +1105,7 @@ function status_editor($a,$x,$popup=false) { '$permset' => t('Permission settings'), '$shortpermset' => t('permissions'), '$ptyp' => (($notes_cid) ? 'note' : 'wall'), - '$content' => '', + '$content' => ((x($x,'body')) ? htmlspecialchars($x['body']) : ''), '$post_id' => '', '$baseurl' => $a->get_baseurl(true), '$defloc' => $x['default_location'], diff --git a/mod/editpost.php b/mod/editpost.php index 8d510ce05..161e8f301 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -1,4 +1,4 @@ -get_channel(); + $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( '$title' => t('Edit post') )); @@ -46,7 +48,7 @@ function editpost_content(&$a) { '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$ispublic' => ' ', // t('Visible to everybody'), '$geotag' => $geotag, - '$nickname' => $a->user['nickname'] + '$nickname' => $channel['channel_address'] )); diff --git a/mod/rpost.php b/mod/rpost.php new file mode 100644 index 000000000..78adb5e34 --- /dev/null +++ b/mod/rpost.php @@ -0,0 +1,90 @@ + 1 && argv(1) === 'return' && $_SESSION['remote_return']) { + goaway($_SESSION['remote_return']); + } + + $plaintext = true; + if(feature_enabled(local_user(),'richtext')) + $plaintext = false; + + + $channel = $a->get_channel(); + + $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( + '$title' => t('Edit post') + )); + + + $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( + '$baseurl' => $a->get_baseurl(), + '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), + '$ispublic' => ' ', // t('Visible to everybody'), + '$geotag' => $geotag, + '$nickname' => $channel['channel_address'] + )); + + + + $x = array( + 'is_owner' => true, + 'allow_location' => ((intval(get_pconfig($channel['channel_id'],'system','use_browser_location'))) ? '1' : ''), + 'default_location' => $channel['channel_location'], + 'nickname' => $channel['channel_address'], + 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] + || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), + 'acl' => populate_acl($channel, $false), + 'bang' => '', + 'visitor' => 'block', + 'profile_uid' => local_user(), + 'title' => $_REQUEST['title'], + 'body' => $_REQUEST['body'], + 'return_path' => 'rpost/return' + ); + + + $o .= status_editor($a,$x); + + return $o; + +} + + -- cgit v1.2.3