-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathheader.php
113 lines (92 loc) · 3.94 KB
/
header.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
107
108
109
110
111
112
113
<?php
/**
* This file generates the header for the back-end and also for the default
* template.
*
* Other checks for user level are performed later to generate the different
* menu items, and the content of the page that called this file.
*/
if (!defined('VIEW_TYPE')) define('VIEW_TYPE', 'private');
// Check for an active session
redirect_if_not_logged_in();
// Check if the current user has permission to view this page.
redirect_if_role_not_allowed($allowed_levels);
global $flash;
/** If no page title is defined, revert to a default one */
if (!isset($page_title)) { $page_title = __('System Administration','cftp_admin'); }
if (!isset($body_class)) { $body_class = []; }
if ( !empty( $_COOKIE['menu_contracted'] ) && $_COOKIE['menu_contracted'] == 'true' ) {
$body_class[] = 'menu_contracted';
}
$body_class[] = 'menu_hidden';
/**
* Silent updates that are needed even if no user is logged in.
*/
require_once INCLUDES_DIR . DS .'core.update.silent.php';
// Run required database upgrades
$db_upgrade = new \ProjectSend\Classes\DatabaseUpgrade;
$db_upgrade->upgradeDatabase(false);
/**
* Call the database update file to see if any change is needed,
* but only if logged in as a system user.
*/
$core_update_allowed = array(9,8,7);
if (current_role_in($core_update_allowed)) {
require_once INCLUDES_DIR . DS . 'core.update.php';
}
// Redirect if password needs to be changed
password_change_required();
?>
<!doctype html>
<html lang="<?php echo SITE_LANG; ?>">
<head>
<meta charset="<?php echo(CHARSET); ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php meta_noindex(); ?>
<title><?php echo html_output( $page_title . ' » ' . htmlspecialchars(get_option('this_install_title'), ENT_QUOTES, CHARSET) ); ?></title>
<?php meta_favicon(); ?>
<?php
render_assets('js', 'head');
render_assets('css', 'head');
render_custom_assets('head');
?>
</head>
<body <?php echo add_body_class( $body_class ); ?> <?php if (!empty($page_id)) { echo add_page_id($page_id); } ?>>
<?php include_once LAYOUT_DIR . DS . 'header-top.php'; ?>
<?php include_once LAYOUT_DIR . DS . 'main-menu.php'; ?>
<main>
<div class="container-fluid">
<div class="main_content">
<?php
render_custom_assets('body_top');
// Gets the mark up and values for the System Updated and errors messages.
include_once INCLUDES_DIR . DS . 'updates.messages.php';
include_once INCLUDES_DIR . DS . 'header-messages.php';
?>
<div class="row">
<div class="col-6">
<div id="section_title">
<h2><?php echo $page_title; ?></h2>
</div>
</div>
<div class="col-6 text-end">
<?php
if (!empty($header_action_buttons)) {
foreach ($header_action_buttons as $header_button) {
$icon = (!empty($header_button['icon'])) ? $header_button['icon'] : 'fa fa-plus';
?>
<a href="<?php echo $header_button['url']; ?>" class="btn btn-sm btn-primary" <?php if (!empty($header_button['id'])) { echo 'id="'.$header_button['id'].'"'; } ?>>
<i class="<?php echo $icon; ?> fa-small"></i> <?php echo $header_button['label']; ?>
</a>
<?php
}
}
?>
</div>
</div>
<?php
// Flash messages
if ($flash->hasMessages()) {
echo $flash;
}