From 832e47e94a4529cfba09dc205a1173c4a9d26b67 Mon Sep 17 00:00:00 2001 From: dignajar Date: Tue, 6 Sep 2016 21:14:57 -0300 Subject: [PATCH] New feature, disable user account --- bl-kernel/admin/controllers/edit-user.php | 22 +++++++ .../admin/themes/default2/css/default.css | 58 +++++++++++++------ bl-kernel/admin/views/edit-page.php | 4 +- bl-kernel/admin/views/edit-post.php | 4 +- bl-kernel/admin/views/edit-user.php | 26 +++++++++ bl-kernel/admin/views/new-page.php | 4 +- bl-kernel/admin/views/new-post.php | 2 +- bl-kernel/dbusers.class.php | 9 +++ bl-kernel/user.class.php | 7 +++ bl-languages/en_US.json | 5 +- 10 files changed, 115 insertions(+), 26 deletions(-) diff --git a/bl-kernel/admin/controllers/edit-user.php b/bl-kernel/admin/controllers/edit-user.php index 8dfaf909..9e884692 100644 --- a/bl-kernel/admin/controllers/edit-user.php +++ b/bl-kernel/admin/controllers/edit-user.php @@ -4,6 +4,25 @@ // Functions // ============================================================================ +function disableUser($username) { + + global $dbUsers; + global $Language; + global $Login; + + // The editors can't disable users + if($Login->role()!=='admin') { + return false; + } + + if( $dbUsers->disableUser($username) ) { + Alert::set($Language->g('The changes have been saved')); + } + else { + Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to edit the user.'); + } +} + function editUser($args) { global $dbUsers; @@ -72,6 +91,9 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' ) elseif(isset($_POST['delete-user-associate'])) { deleteUser($_POST, false); } + elseif(isset($_POST['disable-user'])) { + disableUser($_POST['username']); + } else { editUser($_POST); } diff --git a/bl-kernel/admin/themes/default2/css/default.css b/bl-kernel/admin/themes/default2/css/default.css index 64be24db..74e5d7dc 100644 --- a/bl-kernel/admin/themes/default2/css/default.css +++ b/bl-kernel/admin/themes/default2/css/default.css @@ -59,17 +59,6 @@ } -/* UIKIT HACKs forms ----------------------------------------------------------------- */ - -.uk-form input:not([type]), .uk-form input[type="text"], .uk-form input[type="password"], .uk-form input[type="email"], .uk-form input[type="url"], .uk-form input[type="search"], .uk-form input[type="tel"], .uk-form input[type="number"], .uk-form input[type="datetime"], .uk-form input[type="datetime-local"], .uk-form input[type="date"], .uk-form input[type="month"], .uk-form input[type="time"], .uk-form input[type="week"], .uk-form input[type="color"], .uk-form select, .uk-form textarea { - border-radius: 2px !important; -} - -.uk-form-help-block { - color: #777 !important; - font-size: 0.9em !important; -} /* CSS defaults ---------------------------------------------------------------- */ @@ -167,11 +156,48 @@ div.dashboard-links h4 { margin-bottom: -8px !important; } -/* NEW POST */ -h3.titleOptions { - font-size: 1em; + +/* FORM +---------------------------------------------------------------- */ + +.uk-form input:not([type]), .uk-form input[type="text"], .uk-form input[type="password"], .uk-form input[type="email"], .uk-form input[type="url"], .uk-form input[type="search"], .uk-form input[type="tel"], .uk-form input[type="number"], .uk-form input[type="datetime"], .uk-form input[type="datetime-local"], .uk-form input[type="date"], .uk-form input[type="month"], .uk-form input[type="time"], .uk-form input[type="week"], .uk-form input[type="color"], .uk-form select, .uk-form textarea { + border-radius: 2px !important; } +.uk-form-help-block { + color: #777 !important; + font-size: 0.9em !important; +} + +.sidebar-meta .uk-form-label { + font-size: 0.9em; + text-transform: uppercase; +} + +.uk-form legend { + margin-top: 20px; +} + +.uk-form legend.first-child { + margin-top: 0 !important; +} + +button.aslink { + background: rgba(0, 0, 0, 0) none repeat scroll 0 0; + border: 0 none; + color: #07d; + cursor: pointer; + display: block; + font-size: 1em; + margin: 0 !important; + padding: 0 !important; +} + +button.aslink:hover { + text-decoration: underline; +} + + /* OLD ---------------------------------------------------------------- */ @@ -236,10 +262,6 @@ table.statistics tr:last-child td { /* ----------- FORM ----------- */ -.sidebar .uk-form-label { - font-size: 0.9em; - text-transform: uppercase; -} #bludit-tags { margin-top: 15px; diff --git a/bl-kernel/admin/views/edit-page.php b/bl-kernel/admin/views/edit-page.php index d3b44fec..96849953 100644 --- a/bl-kernel/admin/views/edit-page.php +++ b/bl-kernel/admin/views/edit-page.php @@ -18,7 +18,7 @@ HTML::formOpen(array('class'=>'uk-form-stacked')); // ---- LEFT SIDE ---- echo '
'; -echo '
'; +echo '
'; // Title input HTML::formInputText(array( @@ -52,7 +52,7 @@ if(count($_Page->children())===0) echo '
'; // ---- RIGHT SIDE ---- -echo '