streams/mod/share.php

32 lines
747 B
PHP
Raw Normal View History

2011-03-17 02:36:59 +00:00
<?php
require_once('bbcode.php');
function share_init(&$a) {
$post_id = ((argc() > 1) ? intval(argv(1)) : 0);
2011-03-17 02:36:59 +00:00
if((! $post_id) || (! local_user()))
killme();
$r = q("SELECT * from item WHERE id = %d AND uid = %d and item_restrict = 0 LIMIT 1",
2012-06-23 10:25:11 +00:00
intval($post_id),
intval(local_user())
2011-03-17 02:36:59 +00:00
);
if((! $r) || $r[0]['item_private'])
2011-03-17 02:36:59 +00:00
killme();
xchan_query($r);
$o = '[share]' . "\n";
2011-03-17 02:36:59 +00:00
$o .= "\xE2\x99\xb2" . ' [url=' . $r[0]['author']['xchan_url'] . ']' . $r[0]['author']['xchan_name'] . '[/url]' . "\n";
2012-06-23 10:25:11 +00:00
if($r[0]['title'])
$o .= '[b]' . $r[0]['title'] . '[/b]' . "\n";
2012-07-03 23:26:14 +00:00
$o .= $r[0]['body'] . "\n" ;
2012-10-08 07:04:12 +00:00
$o .= (($r[0]['plink']) ? '[url=' . $r[0]['plink'] . ']' . t('link') . '[/url]' . "\n" : '') . '[/share]';
2012-06-23 10:25:11 +00:00
echo $o;
2011-03-17 02:36:59 +00:00
killme();
}