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