forked from emoncms/app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp_menu.php
62 lines (52 loc) · 1.64 KB
/
app_menu.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
global $mysqli,$path,$session,$route,$user,$app_settings;
if ($session["write"]) {
require_once "Modules/app/app_model.php";
$appconfig = new AppConfig($mysqli, $app_settings);
// enable apikey read access
$userid = false;
if (isset($session['write']) && $session['write']) {
$userid = $session['userid'];
$apikey = $user->get_apikey_write($session['userid']);
} else if (isset($_GET['readkey'])) {
$apikey = $_GET['readkey'];
$userid = $user->get_id_from_apikey($apikey);
} else if (isset($_GET['apikey'])) {
$apikey = $_GET['apikey'];
$userid = $user->get_id_from_apikey($apikey);
}
if ($userid)
{
$applist = $appconfig->get_list($userid);
$_i = 0;
foreach ($applist as $name=>$appitem) {
$menu['sidebar']['apps'][] = array(
'title' => $name,
'text' => $name,
'order'=> $_i,
'path' => "app/view?name=".$name.'&apikey='.$apikey
);
$_i++;
}
}
$menu['tabs'][] = array(
'icon'=>'apps',
'text'=> _("Apps"),
'path'=> 'app/view',
'order'=> 2,
'data'=> array('sidebar' => '#sidebar_apps')
);
$menu['sidebar']['apps'][] = array(
'text' => _('New'),
'icon' => 'plus',
'path' => 'app/new',
'order'=> 99
);
// allow default app to show at `/app/view` - hidden menu item using css li_class
$menu['sidebar']['apps'][] = array(
'text' => _('View'),
'path' => 'app/view',
'li_class'=>'d-none',
'order'=> 99
);
}