dimaslanjaka /
universal-framework
| 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
|
|||
| 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 |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.