forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication.php
More file actions
86 lines (75 loc) · 2.69 KB
/
Application.php
File metadata and controls
86 lines (75 loc) · 2.69 KB
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
<?php
namespace ProcessMaker;
use Igaster\LaravelTheme\Facades\Theme;
use Illuminate\Foundation\Application as IlluminateApplication;
use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables;
use Illuminate\Support\Facades\Auth;
use ProcessMaker\Models\Setting;
use ProcessMaker\Providers\SettingServiceProvider;
/**
* Class Application.
*/
class Application extends IlluminateApplication
{
// ProcessMaker Version
public const VERSION = '4.0.0';
/**
* Sets the timezone for the application and for php with the specified timezone.
*
* @param $timezone string
*/
public function setTimezone(string $timezone): void
{
if (!$this->configurationIsCached()) {
config(['app.timezone' => $timezone]);
}
date_default_timezone_set(config('app.timezone'));
}
/**
* Retrieves the currently set timezone.
*/
public function getTimezone(): string
{
return config('app.timezone');
}
/**
* TODO Is this method, getSystemConstants() still necessary?
*
* Return the System defined constants and Application variables
* Constants: SYS_*
* Sessions : USER_* , URS_*
*
* @note: This is ported from Gulliver System. This will most likely need to be refactored/removed
*
* @return array contents of system contents
*/
public function getSystemConstants()
{
$sysCon = [];
$sysCon['SYS_LANG'] = $this->getLocale();
// Get the current theme
$sysCon['SYS_SKIN'] = Theme::get();
// The following items should be refactored to no longer use $_SESSION
// Since these items should be request scope specific and not session specific
$sysCon['APPLICATION'] = (isset($_SESSION['APPLICATION'])) ? $_SESSION['APPLICATION'] : '';
$sysCon['PROCESS'] = (isset($_SESSION['PROCESS'])) ? $_SESSION['PROCESS'] : '';
$sysCon['TASK'] = (isset($_SESSION['TASK'])) ? $_SESSION['TASK'] : '';
$sysCon['INDEX'] = (isset($_SESSION['INDEX'])) ? $_SESSION['INDEX'] : '';
$sysCon['USER_LOGGED'] = Auth::user() ? Auth::user()->USR_UID : '';
$sysCon['USER_USERNAME'] = Auth::user() ? Auth::user()->USR_USERNAME : '';
return $sysCon;
}
/**
* Get the path to the application "app" directory.
*
* @note This extends the base Application to specify ProcessMaker instead of app as the main directory
*
* @param string $path Optionally, a path to append to the app path
*
* @return string
*/
public function path($path = '')
{
return $this->basePath . DIRECTORY_SEPARATOR . 'ProcessMaker' . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
}