Bug fixes, timezone and user permissions
This commit is contained in:
parent
c08a6303f9
commit
0fb1525f29
|
@ -0,0 +1,26 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
if($Login->role()!=='admin') {
|
||||
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
|
||||
Redirect::page('admin', 'dashboard');
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
|
@ -63,11 +63,14 @@ $(document).ready(function() {
|
|||
<ul class="uk-nav uk-nav-navbar">
|
||||
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'manage-posts' ?>"><i class="uk-icon-folder-o"></i> <?php $L->p('Posts') ?></a></li>
|
||||
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'manage-pages' ?>"><i class="uk-icon-folder-o"></i> <?php $L->p('Pages') ?></a></li>
|
||||
<?php if($Login->role() == 'admin') { ?>
|
||||
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>"><i class="uk-icon-users"></i> <?php $L->p('Users') ?></a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php if($Login->role() == 'admin') { ?>
|
||||
<li class="uk-parent" data-uk-dropdown>
|
||||
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'settings-general' ?>"><i class="uk-icon-cog"></i> <?php $L->p('Settings') ?> ▾</a>
|
||||
<div class="uk-dropdown uk-dropdown-navbar">
|
||||
|
@ -83,12 +86,14 @@ $(document).ready(function() {
|
|||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="uk-navbar-flip uk-hidden-small">
|
||||
<ul class="uk-navbar-nav">
|
||||
<li class="uk-parent" data-uk-dropdown>
|
||||
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'edit-user/'.$Login->username() ?>"><i class="uk-icon-user"></i> Admin ▾</a>
|
||||
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'edit-user/'.$Login->username() ?>"><i class="uk-icon-user"></i> <?php echo $Login->username() ?> ▾</a>
|
||||
<div class="uk-dropdown uk-dropdown-navbar">
|
||||
<ul class="uk-nav uk-nav-navbar">
|
||||
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'edit-user/'.$Login->username() ?>"><?php $L->p('Profile') ?></a></li>
|
||||
|
@ -115,6 +120,7 @@ $(document).ready(function() {
|
|||
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'new-page' ?>"><?php $L->p('New page') ?></a></li>
|
||||
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'manage-posts' ?>"><?php $L->p('Manage posts') ?></a></li>
|
||||
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'manage-pages' ?>"><?php $L->p('Manage pages') ?></a></li>
|
||||
<?php if($Login->role() == 'admin') { ?>
|
||||
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>"><?php $L->p('Manage users') ?></a></li>
|
||||
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'settings-general' ?>"><?php $L->p('General settings') ?></a></li>
|
||||
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'settings-advanced' ?>"><?php $L->p('Advanced settings') ?></a></li>
|
||||
|
@ -122,6 +128,7 @@ $(document).ready(function() {
|
|||
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'plugins' ?>"><?php $L->p('Plugins') ?></a></li>
|
||||
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'themes' ?>"><?php $L->p('Themes') ?></a></li>
|
||||
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'about' ?>"><?php $L->p('About') ?></a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
|
||||
<div class="uk-width-medium-1-3">
|
||||
|
||||
<?php if($Login->role() == 'admin') { ?>
|
||||
|
||||
<div class="uk-panel">
|
||||
<h4><a href="<?php echo HTML_PATH_ADMIN_ROOT.'add-user' ?>"><i class="uk-icon-user-plus"></i> <?php $L->p('Add a new user') ?></a></h4>
|
||||
<p><?php $L->p('Invite a friend to collaborate on your website') ?></p>
|
||||
|
@ -42,6 +44,15 @@
|
|||
<p><?php $L->p('Change your language and region settings') ?></p>
|
||||
</div>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<div class="uk-panel">
|
||||
<h4><a href="<?php echo HTML_PATH_ADMIN_ROOT.'edit-user/'.$Login->username() ?>"><i class="uk-icon-user"></i> <?php $L->p('Profile') ?></a></h4>
|
||||
<p><?php $L->p('View and edit your profile') ?></p>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
23
install.php
23
install.php
|
@ -60,7 +60,7 @@ if(MB_STRING)
|
|||
mb_http_output(CHARSET);
|
||||
}
|
||||
|
||||
// PHP Classes
|
||||
// --- PHP Classes ---
|
||||
include(PATH_HELPERS.'sanitize.class.php');
|
||||
include(PATH_HELPERS.'valid.class.php');
|
||||
include(PATH_HELPERS.'text.class.php');
|
||||
|
@ -69,6 +69,8 @@ include(PATH_KERNEL.'dblanguage.class.php');
|
|||
include(PATH_HELPERS.'log.class.php');
|
||||
include(PATH_HELPERS.'date.class.php');
|
||||
|
||||
// --- LANGUAGE ---
|
||||
|
||||
// Try to detect language from HTTP
|
||||
$explode = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
||||
$localeFromHTTP = empty($explode[0])?'en_US':str_replace('-', '_', $explode[0]);
|
||||
|
@ -79,19 +81,24 @@ if(isset($_GET['language'])) {
|
|||
|
||||
$Language = new dbLanguage($localeFromHTTP);
|
||||
|
||||
// Timezone
|
||||
// --- LOCALE ---
|
||||
|
||||
setlocale(LC_ALL, $localeFromHTTP);
|
||||
|
||||
// --- TIMEZONE ---
|
||||
|
||||
// Check if timezone is defined in php.ini
|
||||
$iniDate = ini_get('date.timezone');
|
||||
if(empty($iniDate)) {
|
||||
// Timezone not defined in php.ini, then UTC as default.
|
||||
date_default_timezone_set('UTC');
|
||||
}
|
||||
|
||||
// Locales
|
||||
setlocale(LC_ALL, $localeFromHTTP);
|
||||
|
||||
// ============================================================================
|
||||
// FUNCTIONS
|
||||
// ============================================================================
|
||||
|
||||
// Returns an array with all languages
|
||||
function getLanguageList()
|
||||
{
|
||||
$files = glob(PATH_LANGUAGES.'*.json');
|
||||
|
@ -132,6 +139,7 @@ function checkSystem()
|
|||
$phpModules = get_loaded_extensions();
|
||||
}
|
||||
|
||||
// If the php version is less than 5.3, then don't check others requirements.
|
||||
if(!version_compare(phpversion(), '5.3', '>='))
|
||||
{
|
||||
$errorText = 'Current PHP version '.phpversion().', you need > 5.3. (ERR_202)';
|
||||
|
@ -187,13 +195,15 @@ function checkSystem()
|
|||
return $stdOut;
|
||||
}
|
||||
|
||||
// Finish with the installation.
|
||||
function install($adminPassword, $email, $timezoneOffset)
|
||||
{
|
||||
global $Language;
|
||||
|
||||
$stdOut = array();
|
||||
|
||||
$timezone = timezone_name_from_abbr("", $timezoneOffset, 0);
|
||||
$timezone = timezone_name_from_abbr('', $timezoneOffset, 1);
|
||||
if($timezone === false) { $timezone = timezone_name_from_abbr('', $timezoneOffset, 0); } // Workaround bug #44780
|
||||
|
||||
date_default_timezone_set($timezone);
|
||||
|
||||
|
@ -408,6 +418,7 @@ Content:
|
|||
return true;
|
||||
}
|
||||
|
||||
// Check form's parameters and finish Bludit installation.
|
||||
function checkPOST($args)
|
||||
{
|
||||
global $Language;
|
||||
|
|
|
@ -195,5 +195,6 @@
|
|||
"edit-or-remove-your-blogs-posts": "Edit or remove your blog's posts.",
|
||||
"general-settings": "General settings",
|
||||
"advanced-settings": "Advanced settings",
|
||||
"manage-users": "Manage users"
|
||||
"manage-users": "Manage users",
|
||||
"view-and-edit-your-profile": "View and edit your profile."
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue