-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
ajax.php
106 lines (87 loc) · 3.96 KB
/
ajax.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
/***********************************************************************
| Cerb(tm) developed by Webgroup Media, LLC.
|-----------------------------------------------------------------------
| All source code & content (c) Copyright 2002-2019, Webgroup Media LLC
| unless specifically noted otherwise.
|
| This source code is released under the Devblocks Public License.
| The latest version of this license can be found here:
| http://cerb.ai/license
|
| By using this software, you acknowledge having read this license
| and agree to be bound thereby.
| ______________________________________________________________________
| http://cerb.ai http://webgroup.media
***********************************************************************/
/*
* IMPORTANT LICENSING NOTE from your friends at Cerb
*
* Sure, it would be really easy to just cheat and edit this file to use
* Cerb without paying for a license. We trust you anyway.
*
* It takes a significant amount of time and money to develop, maintain,
* and support high-quality enterprise software with a dedicated team.
* For Cerb's entire history we've avoided taking money from outside
* investors, and instead we've relied on actual sales from satisfied
* customers to keep the project running.
*
* We've never believed in hiding our source code out of paranoia over not
* getting paid. We want you to have the full source code and be able to
* make the tweaks your organization requires to get more done -- despite
* having less of everything than you might need (time, people, money,
* energy). We shouldn't be your bottleneck.
*
* As a legitimate license owner, your feedback will help steer the project.
* We'll also prioritize your issues, and work closely with you to make sure
* your teams' needs are being met.
*
* - Jeff Standen and Dan Hildebrandt
* Founders at Webgroup Media LLC; Developers of Cerb
*/
require(getcwd() . '/framework.config.php');
require(DEVBLOCKS_PATH . 'Devblocks.class.php');
require(APP_PATH . '/api/Application.class.php');
DevblocksPlatform::services()->http()->setHeader(
'Content-Type',
sprintf('text/html; charset=%s', LANG_CHARSET_CODE)
);
$request = DevblocksPlatform::readRequest();
$request->is_ajax = true;
DevblocksPlatform::init();
DevblocksPlatform::setHandlerSession('Cerb_DevblocksSessionHandler');
$tpl = DevblocksPlatform::services()->template();
DevblocksPlatform::setStateless(in_array($request->path[0] ?? null, Cerb_DevblocksSessionHandler::getStatelessUris()));
if(DevblocksPlatform::isStateless()) {
$_SESSION = [];
} else {
$session = DevblocksPlatform::services()->session();
$tpl->assign('session', $_SESSION);
$tpl->assign('visit', $session->getVisit());
}
// CSP
DevblocksPlatform::services()->http()->setHeader('Content-Security-Policy', CerberusApplication::getCspPolicy());
$settings = DevblocksPlatform::services()->pluginSettings();
$worker = CerberusApplication::getActiveWorker();
// Localization
DevblocksPlatform::setDateTimeFormat(DevblocksPlatform::getPluginSetting('cerberusweb.core', CerberusSettings::TIME_FORMAT, CerberusSettingsDefaults::TIME_FORMAT));
// Locale
DevblocksPlatform::setLocale((isset($_SESSION['locale']) && !empty($_SESSION['locale'])) ? $_SESSION['locale'] : 'en_US');
// Timezone
DevblocksPlatform::setTimezone();
// Time format
if(isset($_SESSION['time_format']))
DevblocksPlatform::setDateTimeFormat($_SESSION['time_format']);
// Scope
$tpl->assign('translate', DevblocksPlatform::getTranslationService());
$tpl->assign('active_worker', $worker);
$tpl->assign('settings', $settings);
if(!empty($worker)) {
$active_worker_memberships = $worker->getMemberships();
$tpl->assign('active_worker_memberships', $active_worker_memberships);
$keyboard_shortcuts = intval(DAO_WorkerPref::get($worker->id,'keyboard_shortcuts', 1));
$tpl->assign('pref_keyboard_shortcuts', $keyboard_shortcuts);
$tpl->assign('pref_dark_mode', intval(DAO_WorkerPref::get($worker->id, 'dark_mode', 0)));
}
CerberusApplication::processRequest($request);
exit;