]> git.mxchange.org Git - friendica.git/blob - mod/bookmarklet.php
Merge develop into 3011_hcard_vcard
[friendica.git] / mod / bookmarklet.php
1 <?php
2
3 require_once('include/conversation.php');
4 require_once('include/items.php');
5
6 function bookmarklet_init(&$a) {
7         $_GET["mode"] = "minimal";
8 }
9
10 function bookmarklet_content(&$a) {
11         if(!local_user()) {
12                 $o = '<h2>'.t('Login').'</h2>';
13                 $o .= login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
14                 return $o;
15         }
16
17         $referer = normalise_link($_SERVER["HTTP_REFERER"]);
18         $page = normalise_link($a->get_baseurl()."/bookmarklet");
19
20         if (!strstr($referer, $page)) {
21                 $content = add_page_info($_REQUEST["url"]);
22
23                 $x = array(
24                         'is_owner' => true,
25                         'allow_location' => $a->user['allow_location'],
26                         'default_location' => $a->user['default-location'],
27                         'nickname' => $a->user['nickname'],
28                         'lockstate' => ((is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid'])))) ? 'lock' : 'unlock'),
29                         'default_perms' => get_acl_permissions($a->user),
30                         'acl' => populate_acl($a->user,true),
31                         'bang' => '',
32                         'visitor' => 'block',
33                         'profile_uid' => local_user(),
34                         'acl_data' => construct_acl_data($a, $a->user), // For non-Javascript ACL selector
35                         'title' => trim($_REQUEST["title"], "*"),
36                         'content' => $content
37                 );
38                 $o = status_editor($a,$x, 0, false);
39                 $o .= "<script>window.resizeTo(800,550);</script>";
40         } else {
41                 $o = '<h2>'.t('The post was created').'</h2>';
42                 $o .= "<script>window.close()</script>";
43         }
44
45         return $o;
46 }