|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @package Cadmium\System\Modules\Informer |
|
5
|
|
|
* @author Anton Romanov |
|
6
|
|
|
* @copyright Copyright (c) 2015-2017, Anton Romanov |
|
7
|
|
|
* @link http://cadmium-cms.com |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
namespace Modules\Informer\Handler { |
|
11
|
|
|
|
|
12
|
|
|
use Frames, Modules\Install, Utils\Validate, Utils\View, DB, Language, Template; |
|
13
|
|
|
|
|
14
|
|
|
class Information extends Frames\Admin\Area\Panel { |
|
15
|
|
|
|
|
16
|
|
|
protected $_title = 'TITLE_SYSTEM_INFORMATION'; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Set common entries |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
private function setCommonEntries(Template\Block $contents) { |
|
23
|
|
|
|
|
24
|
|
|
# Set server entries |
|
25
|
|
|
|
|
26
|
|
|
$contents->os_version = (php_uname('s') . ', ' . php_uname('v')); |
|
|
|
|
|
|
27
|
|
|
|
|
28
|
|
|
$contents->php_version = phpversion(); |
|
|
|
|
|
|
29
|
|
|
|
|
30
|
|
|
$contents->mysql_version = DB::getVersion(); |
|
|
|
|
|
|
31
|
|
|
|
|
32
|
|
|
# Set system entries |
|
33
|
|
|
|
|
34
|
|
|
$contents->system_version = CADMIUM_VERSION; |
|
|
|
|
|
|
35
|
|
|
|
|
36
|
|
|
$contents->debug_mode_class = (DEBUG_MODE ? 'red' : 'grey'); |
|
|
|
|
|
|
37
|
|
|
|
|
38
|
|
|
$contents->debug_mode_value = Language::get('INFORMATION_VALUE_DEBUG_MODE_' . (DEBUG_MODE ? 'ON' : 'OFF')); |
|
|
|
|
|
|
39
|
|
|
|
|
40
|
|
|
# Set third-party entries |
|
41
|
|
|
|
|
42
|
|
|
$contents->jquery_version = JQUERY_VERSION; |
|
|
|
|
|
|
43
|
|
|
|
|
44
|
|
|
$contents->semantic_ui_version = SEMANTIC_UI_VERSION; |
|
|
|
|
|
|
45
|
|
|
|
|
46
|
|
|
$contents->ckeditor_version = CKEDITOR_VERSION; |
|
|
|
|
|
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Set PHP entries |
|
51
|
|
|
*/ |
|
52
|
|
|
|
|
53
|
|
|
private function setPhpEntries(Template\Block $contents) { |
|
54
|
|
|
|
|
55
|
|
|
$status_value = function (string $value) { return (Validate::boolean($value) ? 'On' : 'Off'); }; |
|
56
|
|
|
|
|
57
|
|
|
# Set errors entries |
|
58
|
|
|
|
|
59
|
|
|
$contents->display_errors_class = (ini_get('display_errors') ? 'orange' : 'green'); |
|
|
|
|
|
|
60
|
|
|
|
|
61
|
|
|
$contents->display_errors_value = $status_value(ini_get('display_errors')); |
|
|
|
|
|
|
62
|
|
|
|
|
63
|
|
|
$contents->display_startup_errors_class = (ini_get('display_startup_errors') ? 'orange' : 'green'); |
|
|
|
|
|
|
64
|
|
|
|
|
65
|
|
|
$contents->display_startup_errors_value = $status_value(ini_get('display_startup_errors')); |
|
|
|
|
|
|
66
|
|
|
|
|
67
|
|
|
# Set file uploads entries |
|
68
|
|
|
|
|
69
|
|
|
$contents->file_uploads_class = (ini_get('file_uploads') ? 'green' : 'red'); |
|
|
|
|
|
|
70
|
|
|
|
|
71
|
|
|
$contents->file_uploads_value = $status_value(ini_get('file_uploads')); |
|
|
|
|
|
|
72
|
|
|
|
|
73
|
|
|
$contents->upload_max_filesize = ini_get('upload_max_filesize'); |
|
|
|
|
|
|
74
|
|
|
|
|
75
|
|
|
$contents->post_max_size = ini_get('post_max_size'); |
|
|
|
|
|
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Set diagnostics entries |
|
80
|
|
|
*/ |
|
81
|
|
|
|
|
82
|
|
|
private function setDiagnosticsEntries(Template\Block $contents) { |
|
83
|
|
|
|
|
84
|
|
|
$extension_value = function (bool $value) { |
|
85
|
|
|
|
|
86
|
|
|
return Language::get('INFORMATION_VALUE_EXTENSION_' . (!$value ? 'NOT_' : '') . 'LOADED' ); |
|
87
|
|
|
}; |
|
88
|
|
|
|
|
89
|
|
|
$dir_value = function (bool $value) { |
|
90
|
|
|
|
|
91
|
|
|
return Language::get('INFORMATION_VALUE_DIR_' . (!$value ? 'NOT_' : '') . 'WRITABLE' ); |
|
92
|
|
|
}; |
|
93
|
|
|
|
|
94
|
|
|
# Get loops |
|
95
|
|
|
|
|
96
|
|
|
$extensions = $contents->getLoop('extensions'); $dirs = $contents->getLoop('dirs'); |
|
97
|
|
|
|
|
98
|
|
|
# Set extensions |
|
99
|
|
|
|
|
100
|
|
View Code Duplication |
foreach (Install::getExtensions() as $name => $status) { |
|
|
|
|
|
|
101
|
|
|
|
|
102
|
|
|
$name = Language::get('INFORMATION_ROW_EXTENSION_' . strtoupper($name)); |
|
103
|
|
|
|
|
104
|
|
|
$class = ($status ? 'green' : 'red'); $value = $extension_value($status); |
|
105
|
|
|
|
|
106
|
|
|
$extensions->addItem(['name' => $name, 'class' => $class, 'value' => $value]); |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
# Set directories |
|
110
|
|
|
|
|
111
|
|
View Code Duplication |
foreach (Install::getDirs() as $name => $status) { |
|
|
|
|
|
|
112
|
|
|
|
|
113
|
|
|
$name = Language::get('INFORMATION_ROW_DIR_' . strtoupper($name)); |
|
114
|
|
|
|
|
115
|
|
|
$class = ($status ? 'green' : 'red'); $value = $dir_value($status); |
|
116
|
|
|
|
|
117
|
|
|
$dirs->addItem(['name' => $name, 'class' => $class, 'value' => $value]); |
|
118
|
|
|
} |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* Get the contents block |
|
123
|
|
|
*/ |
|
124
|
|
|
|
|
125
|
|
|
private function getContents() : Template\Block { |
|
126
|
|
|
|
|
127
|
|
|
$contents = View::get('Blocks/Informer/Information'); |
|
128
|
|
|
|
|
129
|
|
|
# Set entries |
|
130
|
|
|
|
|
131
|
|
|
$this->setCommonEntries($contents); |
|
132
|
|
|
|
|
133
|
|
|
$this->setPhpEntries($contents); |
|
134
|
|
|
|
|
135
|
|
|
$this->setDiagnosticsEntries($contents); |
|
136
|
|
|
|
|
137
|
|
|
# ------------------------ |
|
138
|
|
|
|
|
139
|
|
|
return $contents; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
/** |
|
143
|
|
|
* Handle the request |
|
144
|
|
|
*/ |
|
145
|
|
|
|
|
146
|
|
|
protected function handle() : Template\Block { |
|
147
|
|
|
|
|
148
|
|
|
return $this->getContents(); |
|
149
|
|
|
} |
|
150
|
|
|
} |
|
151
|
|
|
} |
|
152
|
|
|
|
Since your code implements the magic setter
_set, this function will be called for any write access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.