poke doco and cleanup

This commit is contained in:
friendica 2013-04-17 22:44:53 -07:00
parent c2fe3fd8fe
commit e99b9376a0
2 changed files with 22 additions and 41 deletions

2
done
View File

@ -128,7 +128,7 @@ mod/
photos.php
+ ping.php (needs more work)
+ poco.php
poke.php
+ poke.php
? post.php
+ pretheme.php
+ probe.php

View File

@ -1,10 +1,21 @@
<?php
<?php /** @file */
/**
*
* Poke, prod, finger, or otherwise do unspeakable things to somebody - who must be a connection in your address book
* This function can be invoked with the required arguments (verb and cid and private and possibly parent) silently via ajax or
* other web request. You must be logged in and connected to a channel.
* If the required arguments aren't present, we'll display a simple form to choose a recipient and a verb.
* parent is a special argument which let's you attach this activity as a comment to an existing conversation, which
* may have started with somebody else poking (etc.) somebody, but this isn't necessary. This can be used in the adult
* plugin version to have entire conversations where Alice poked Bob, Bob fingered Alice, Alice hugged Bob, etc.
*
* private creates a private conversation with the recipient. Otherwise your channel's default post privacy is used.
*
*/
require_once('include/security.php');
require_once('include/bbcode.php');
require_once('include/items.php');
function poke_init(&$a) {
if(! local_user())
@ -13,8 +24,7 @@ function poke_init(&$a) {
$uid = local_user();
$channel = $a->get_channel();
$verb = notags(trim($_GET['verb']));
$verb = notags(trim($_REQUEST['verb']));
if(! $verb)
return;
@ -26,12 +36,11 @@ function poke_init(&$a) {
$activity = ACTIVITY_POKE . '#' . urlencode($verbs[$verb][0]);
$contact_id = intval($_GET['cid']);
$contact_id = intval($_REQUEST['cid']);
if(! $contact_id)
return;
$parent = ((x($_GET,'parent')) ? intval($_GET['parent']) : 0);
$parent = ((x($_REQUEST,'parent')) ? intval($_REQUEST['parent']) : 0);
logger('poke: verb ' . $verb . ' contact ' . $contact_id, LOGGER_DEBUG);
@ -77,9 +86,6 @@ function poke_init(&$a) {
}
$arr = array();
$arr['item_flags'] = ITEM_WALL | ITEM_ORIGIN;
if($parent_item)
@ -126,10 +132,10 @@ function poke_content(&$a) {
$name = '';
$id = '';
if(intval($_GET['c'])) {
if(intval($_REQUEST['c'])) {
$r = q("select abook_id, xchan_name from abook left join xchan on abook_xchan = xchan_hash
where abook_id = %d and abook_channel = %d limit 1",
intval($_GET['c']),
intval($_REQUEST['c']),
intval(local_user())
);
if($r) {
@ -138,32 +144,7 @@ function poke_content(&$a) {
}
}
$base = $a->get_baseurl();
$a->page['htmlhead'] .= <<< EOT
<script>$(document).ready(function() {
var a;
a = $("#poke-recip").autocomplete({
serviceUrl: '$base/acl',
minChars: 2,
width: 350,
onSelect: function(value,data) {
$("#poke-recip-complete").val(data);
}
});
a.setOptions({ params: { type: 'a' }});
});
</script>
EOT;
$parent = ((x($_GET,'parent')) ? intval($_GET['parent']) : '0');
$parent = ((x($_REQUEST,'parent')) ? intval($_REQUEST['parent']) : '0');
$verbs = get_poke_verbs();