3 require_once('include/bbcode.php');
5 function share_init(&$a) {
7 $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
8 if((! $post_id) || (! local_user()))
11 $r = q("SELECT item.*, contact.network FROM `item`
12 left join contact on `item`.`contact-id` = `contact`.`id`
13 WHERE `item`.`id` = %d AND `item`.`uid` = %d LIMIT 1",
18 if(! count($r) || ($r[0]['private'] == 1))
21 if (intval(get_config('system','new_share'))) {
22 if (strpos($r[0]['body'], "[/share]") !== false) {
23 $pos = strpos($r[0]['body'], "[share");
24 $o = substr($r[0]['body'], $pos);
26 $o = "[share author='".str_replace("'", "'",$r[0]['author-name']).
27 "' profile='".$r[0]['author-link'].
28 "' avatar='".$r[0]['author-avatar'].
29 "' link='".$r[0]['plink'].
30 "' posted='".$r[0]['created']."']\n";
32 $o .= '[b]'.$r[0]['title'].'[/b]'."\n";
39 $o .= "\xE2\x99\xb2" . ' [url=' . $r[0]['author-link'] . ']' . $r[0]['author-name'] . '[/url]' . "\n";
41 $o .= '[b]' . $r[0]['title'] . '[/b]' . "\n";
42 $o .= $r[0]['body'] . "\n" ;
44 $o .= (($r[0]['plink']) ? '[url=' . $r[0]['plink'] . ']' . t('link') . '[/url]' . "\n" : '');