Example #1
0
function poke_content(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $name = '';
    $id = '';
    if (intval($_GET['c'])) {
        $r = q("select id,name from contact where id = %d and uid = %d limit 1", intval($_GET['c']), intval(local_user()));
        if (count($r)) {
            $name = $r[0]['name'];
            $id = $r[0]['id'];
        }
    }
    $base = $a->get_baseurl();
    $a->page['htmlhead'] .= '<script src="' . $a->get_baseurl(true) . '/library/jquery_ac/friendica.complete.js" ></script>';
    $a->page['htmlhead'] .= <<<EOT

<script>\$(document).ready(function() { 
\tvar a; 
\ta = \$("#poke-recip").autocomplete({ 
\t\tserviceUrl: '{$base}/acl',
\t\tminChars: 2,
\t\twidth: 350,
\t\tonSelect: function(value,data) {
\t\t\t\$("#poke-recip-complete").val(data);
\t\t}\t\t\t
\t});
\ta.setOptions({ params: { type: 'a' }});


}); 

</script>
EOT;
    $parent = x($_GET, 'parent') ? intval($_GET['parent']) : '0';
    $verbs = get_poke_verbs();
    $shortlist = array();
    foreach ($verbs as $k => $v) {
        if ($v[1] !== 'NOTRANSLATION') {
            $shortlist[] = array($k, $v[1]);
        }
    }
    $tpl = get_markup_template('poke_content.tpl');
    $o = replace_macros($tpl, array('$title' => t('Poke/Prod'), '$desc' => t('poke, prod or do other things to somebody'), '$clabel' => t('Recipient'), '$choice' => t('Choose what you wish to do to recipient'), '$verbs' => $shortlist, '$parent' => $parent, '$prv_desc' => t('Make this post private'), '$submit' => t('Submit'), '$name' => $name, '$id' => $id));
    return $o;
}
Example #2
0
function poke_content(&$a)
{
    if (!local_channel()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $name = '';
    $id = '';
    if (intval($_REQUEST['c'])) {
        $r = q("select abook_id, xchan_name from abook left join xchan on abook_xchan = xchan_hash \n\t\t\twhere abook_id = %d and abook_channel = %d limit 1", intval($_REQUEST['c']), intval(local_channel()));
        if ($r) {
            $name = $r[0]['xchan_name'];
            $id = $r[0]['abook_id'];
        }
    }
    $parent = x($_REQUEST, 'parent') ? intval($_REQUEST['parent']) : '0';
    $verbs = get_poke_verbs();
    $shortlist = array();
    foreach ($verbs as $k => $v) {
        if ($v[1] !== 'NOTRANSLATION') {
            $shortlist[] = array($k, $v[1]);
        }
    }
    $tpl = get_markup_template('poke_content.tpl');
    $o = replace_macros($tpl, array('$title' => t('Poke/Prod'), '$desc' => t('poke, prod or do other things to somebody'), '$clabel' => t('Recipient'), '$choice' => t('Choose what you wish to do to recipient'), '$verbs' => $shortlist, '$parent' => $parent, '$prv_desc' => t('Make this post private'), '$submit' => t('Submit'), '$name' => $name, '$id' => $id));
    return $o;
}
Example #3
0
function poke_content(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $name = '';
    $id = '';
    if (intval($_GET['c'])) {
        $r = q("SELECT `id`,`name` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($_GET['c']), intval(local_user()));
        if (count($r)) {
            $name = $r[0]['name'];
            $id = $r[0]['id'];
        }
    }
    $base = $a->get_baseurl();
    $head_tpl = get_markup_template('poke_head.tpl');
    $a->page['htmlhead'] .= replace_macros($head_tpl, array('$baseurl' => $a->get_baseurl(true), '$base' => $base));
    $parent = x($_GET, 'parent') ? intval($_GET['parent']) : '0';
    $verbs = get_poke_verbs();
    $shortlist = array();
    foreach ($verbs as $k => $v) {
        if ($v[1] !== 'NOTRANSLATION') {
            $shortlist[] = array($k, $v[1]);
        }
    }
    $tpl = get_markup_template('poke_content.tpl');
    $o = replace_macros($tpl, array('$title' => t('Poke/Prod'), '$desc' => t('poke, prod or do other things to somebody'), '$clabel' => t('Recipient'), '$choice' => t('Choose what you wish to do to recipient'), '$verbs' => $shortlist, '$parent' => $parent, '$prv_desc' => t('Make this post private'), '$submit' => t('Submit'), '$name' => $name, '$id' => $id));
    return $o;
}