From 0fb1525f299c552ae6a679716f9c3d29b9fe90db Mon Sep 17 00:00:00 2001 From: dignajar Date: Sun, 25 Oct 2015 22:11:46 -0300 Subject: [PATCH] Bug fixes, timezone and user permissions --- admin/controllers/about.php | 26 ++++++++++++++++++++++++++ admin/themes/default/index.php | 9 ++++++++- admin/views/dashboard.php | 11 +++++++++++ install.php | 23 +++++++++++++++++------ languages/en_US.json | 3 ++- 5 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 admin/controllers/about.php diff --git a/admin/controllers/about.php b/admin/controllers/about.php new file mode 100644 index 00000000..20c8e2fb --- /dev/null +++ b/admin/controllers/about.php @@ -0,0 +1,26 @@ +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 +// ============================================================================ \ No newline at end of file diff --git a/admin/themes/default/index.php b/admin/themes/default/index.php index 1acab5a0..4164a56d 100644 --- a/admin/themes/default/index.php +++ b/admin/themes/default/index.php @@ -63,11 +63,14 @@ $(document).ready(function() { + role() == 'admin') { ?>
  • p('Settings') ?> ▾
    @@ -83,12 +86,14 @@ $(document).ready(function() {
  • + +
    diff --git a/admin/views/dashboard.php b/admin/views/dashboard.php index 5527ab59..c602dbbf 100644 --- a/admin/views/dashboard.php +++ b/admin/views/dashboard.php @@ -32,6 +32,8 @@
    + role() == 'admin') { ?> +

    p('Add a new user') ?>

    p('Invite a friend to collaborate on your website') ?>

    @@ -42,6 +44,15 @@

    p('Change your language and region settings') ?>

    + + +
    +

    p('Profile') ?>

    +

    p('View and edit your profile') ?>

    +
    + + +
    diff --git a/install.php b/install.php index 91724f99..44c01f7e 100644 --- a/install.php +++ b/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; diff --git a/languages/en_US.json b/languages/en_US.json index 412bb3a3..df456ee9 100644 --- a/languages/en_US.json +++ b/languages/en_US.json @@ -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." }