Completed
Push — master ( 062d56...6eea48 )
by Dimas
08:52
created

is_admin()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 3
nc 3
nop 0
dl 0
loc 5
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * Shutdown here
5
 *
6
 * @return void
7
 */
8
function maintenance()
9
{
10
	include __DIR__ . '/maintenance.php';
11
	exit;
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
12
}
13
/**
14
 * Debug Error
15
 *
16
 * @return void
17
 */
18
function show_error()
19
{
20
	error_reporting(E_ALL);
21
	ini_set('display_errors', 'On');
22
}
23
24
/**
25
 * Check is admin granted
26
 */
27
function is_admin()
28
{
29
	if (isset($_SESSION['login'])) {
30
		if (isset($_SESSION['login']['role'])) {
31
			return preg_match('/^superadmin$/s', $_SESSION['login']['role']);
32
		}
33
	}
34
}
35