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