forked from projectsend/projectsend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader.php
139 lines (118 loc) · 5.4 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?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.
*
* @package ProjectSend
* @see check_for_session
* @see can_see_content
*/
// Check for an active session
check_for_session();
// Check if the current user has permission to view this page.
can_see_content($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 = array(); }
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">
<title><?php echo html_output( $page_title . ' » ' . htmlspecialchars(get_option('this_install_title'), ENT_QUOTES, CHARSET) ); ?></title>
<?php meta_favicon(); ?>
<?php
require_once INCLUDES_DIR . DS . 'assets.php';
load_js_header_files();
load_css_files();
?>
</head>
<body <?php echo add_body_class( $body_class ); ?> <?php if (!empty($page_id)) { echo add_page_id($page_id); } ?>>
<div class="container-custom">
<header id="header" class="navbar navbar-static-top navbar-fixed-top">
<ul class="nav pull-left nav_toggler">
<li>
<a href="#" class="toggle_main_menu"><i class="fa fa-bars" aria-hidden="true"></i><span><?php _e('Toggle menu', 'cftp_admin'); ?></span></a>
</li>
</ul>
<div class="navbar-header">
<span class="navbar-brand"><a href="<?php echo SYSTEM_URI; ?>" target="_blank"><?php include_once 'assets/img/ps-icon.svg'; ?></a> <?php echo html_output(get_option('this_install_title')); ?></span>
</div>
<ul class="nav pull-right nav_account">
<li id="header_welcome">
<span><?php echo CURRENT_USER_NAME; ?></span>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php _e('Language', 'cftp_admin'); ?> <span class="caret"></span></a>
<ul class="dropdown-menu">
<?php
// scan for language files
$available_langs = get_available_languages();
foreach ($available_langs as $filename => $lang_name) {
?>
<li>
<a href="<?php echo BASE_URI.'process.php?do=change_language&language='.$filename; ?>">
<?php echo $lang_name; ?>
</a>
</li>
<?php
}
?>
</ul>
</li>
<li>
<?php $my_account_link = (CURRENT_USER_LEVEL == 0) ? 'clients-edit.php' : 'users-edit.php'; ?>
<a href="<?php echo BASE_URI.$my_account_link; ?>?id=<?php echo CURRENT_USER_ID; ?>" class="my_account"><i class="fa fa-user-circle" aria-hidden="true"></i> <?php _e('My Account', 'cftp_admin'); ?></a>
</li>
<li>
<a href="<?php echo BASE_URI; ?>process.php?do=logout" ><i class="fa fa-sign-out" aria-hidden="true"></i> <?php _e('Logout', 'cftp_admin'); ?></a>
</li>
</ul>
</header>
<?php include_once 'includes' . DS . 'main-menu.php'; ?>
<div class="main_content">
<div class="container-fluid">
<?php
// 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-xs-12">
<div id="section_title">
<h2><?php echo $page_title; ?></h2>
</div>
</div>
</div>
<?php
// Flash messages
if ($flash->hasMessages()) {
echo $flash;
}