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