]> git.mxchange.org Git - friendica.git/blob - mod/share.php
Oops, re-kill the dead snake.
[friendica.git] / mod / share.php
1 <?php
2
3 require_once('bbcode.php');
4
5 function share_init(&$a) {
6
7         $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
8         if((! $post_id) || (! local_user()))
9                 killme();
10
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",
14
15                 intval($post_id),
16                 intval(local_user())
17         );
18         if(! count($r) || ($r[0]['private'] == 1))
19                 killme();
20
21         $o = '';
22
23         $o .= "\xE2\x99\xb2" . ' [url=' . $r[0]['author-link'] . ']' . $r[0]['author-name'] . '[/url]' . "\n";
24         if($r[0]['title'])
25                 $o .= '[b]' . $r[0]['title'] . '[/b]' . "\n";
26         $o .= $r[0]['body'] . "\n" ;
27
28         $o .= (($r[0]['plink']) ? '[url=' . $r[0]['plink'] . ']' . t('link') . '[/url]' . "\n" : '');
29
30         echo $o;
31         killme();  
32 }