]> git.mxchange.org Git - friendica.git/blob - mod/notes.php
Remove unused BBCode::scaleExternalImage parameters
[friendica.git] / mod / notes.php
1 <?php
2 /**
3  * @file mod/notes.php
4  */
5
6 use Friendica\App;
7 use Friendica\Content\Nav;
8 use Friendica\Content\Pager;
9 use Friendica\Core\L10n;
10 use Friendica\Database\DBA;
11 use Friendica\DI;
12 use Friendica\Model\Item;
13 use Friendica\Model\Profile;
14
15 function notes_init(App $a)
16 {
17         if (! local_user()) {
18                 return;
19         }
20
21         Nav::setSelected('home');
22 }
23
24
25 function notes_content(App $a, $update = false)
26 {
27         if (!local_user()) {
28                 notice(L10n::t('Permission denied.') . EOL);
29                 return;
30         }
31
32         $o = Profile::getTabs($a, 'notes', true);
33
34         if (!$update) {
35                 $o .= '<h3>' . L10n::t('Personal Notes') . '</h3>';
36
37                 $x = [
38                         'is_owner' => true,
39                         'allow_location' => (($a->user['allow_location']) ? true : false),
40                         'default_location' => $a->user['default-location'],
41                         'nickname' => $a->user['nickname'],
42                         'lockstate' => 'lock',
43                         'acl' => '',
44                         'bang' => '',
45                         'visitor' => 'block',
46                         'profile_uid' => local_user(),
47                         'button' => L10n::t('Save'),
48                         'acl_data' => '',
49                 ];
50
51                 $o .= status_editor($a, $x, $a->contact['id']);
52         }
53
54         $condition = ['uid' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => GRAVITY_PARENT,
55                 'contact-id'=> $a->contact['id']];
56
57         $pager = new Pager(DI::args()->getQueryString(), 40);
58
59         $params = ['order' => ['created' => true],
60                 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
61         $r = Item::selectThreadForUser(local_user(), ['uri'], $condition, $params);
62
63         $count = 0;
64
65         if (DBA::isResult($r)) {
66                 $notes = Item::inArray($r);
67
68                 $count = count($notes);
69
70                 $o .= conversation($a, $notes, $pager, 'notes', $update);
71         }
72
73         $o .= $pager->renderMinimal($count);
74
75         return $o;
76 }