Skip to content

Commit

Permalink
Fix install sql
Browse files Browse the repository at this point in the history
Update design
  • Loading branch information
Alex committed Oct 10, 2019
1 parent abf626f commit 39a38ba
Show file tree
Hide file tree
Showing 9 changed files with 531 additions and 590 deletions.
103 changes: 58 additions & 45 deletions Module/Administrators/Admin/Act.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,64 @@
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/Utils/functions.php');

class Act extends AdminAct {
public function __construct($id) {
$this->permission = 'Edit administrators';
$this->entity = new Model('admins');
public function __construct($id) {
$this->permission = 'Edit administrators';
$this->entity = new Model('admins');
$act = false;
if ($this->hasAccess()) {
if ($id) $this->fields['id'] = $id;
if (strtolower($_SERVER['REQUEST_METHOD']) == 'delete') {
$this->delete();
}
else {
$method = 'patch';
if (strtolower($_SERVER['REQUEST_METHOD']) == 'patch') {
if ($id) parse_str(file_get_contents('php://input'), $_PATCH);
else $this->sendStatus(false, __('No ID set'));
}
else $method = 'create';
$permissions = new Model('admins_permissions');
try {
$bcrypt = new Bcrypt(10);
}
catch (\Exception $e) {
}
foreach ($method == 'patch'?$_PATCH:$_POST AS $key => $value) {
if (!in_array($key, array('password', 'permission'))) $this->fields[$key] = $value;
elseif ($key == 'password' && strlen($value) > 5) $this->fields['password'] = $bcrypt->hash($_REQUEST['password']);
}
if($method == 'patch') {
$permissions->admin = $id;
$permissions->delete();
}
$act = call_user_func_array(array($this, $method), array());
foreach ($method == 'patch'?$_PATCH:$_POST AS $key => $value) {
if($key == 'permission') {
foreach ($value AS $permissionId => $hasAccess) {
if ($hasAccess) {
$permissions->admin = $act->id;
$permissions->permission = $permissionId;
$permissions->create();
}
}
break;
}
}
}
}
if ($this->hasAccess()) {
if ($id) $this->fields['id'] = $id;
if (strtolower($_SERVER['REQUEST_METHOD']) == 'delete') {
$this->delete();
}
else {
$method = 'patch';
if (strtolower($_SERVER['REQUEST_METHOD']) == 'patch') {
if ($id) parse_str(file_get_contents('php://input'), $_PATCH);
else $this->sendStatus(false, __('No ID set'));
}
else $method = 'create';
$permissions = new Model('admins_permissions');
try {
$bcrypt = new Bcrypt(10);
}
catch (\Exception $e) {
}
foreach ($method == 'patch'?$_PATCH:$_POST AS $key => $value) {
if (!in_array($key, array('password', 'permission'))) $this->fields[$key] = $value;
elseif ($key == 'password' && strlen($value) > 5) $this->fields['password'] = $bcrypt->hash($_REQUEST['password']);
}
if($method == 'patch') {
$permissions->admin = $id;
$permissions->delete();
}
$act = call_user_func_array(array($this, $method), array());
foreach ($method == 'patch'?$_PATCH:$_POST AS $key => $value) {
if($key == 'permission') {
foreach ($value AS $permissionId => $hasAccess) {
if ($hasAccess) {
$permissions->admin = $act->id;
$permissions->permission = $permissionId;
$permissions->create();
}
}
break;
}
}
}
}
$this->sendStatus($act);
}
}

public function create() {
foreach ($this->fields AS $key => $value) $this->entity->$key = $value;
$entity = $this->entity->create();
return $entity;
}

public function patch() {
foreach ($this->fields AS $key => $value) $this->entity->$key = $value;
$entity = $this->entity->update();
return $entity;
}

}
2 changes: 1 addition & 1 deletion Module/Users/LoginPage.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class LoginPage
public $css = array();
public $visible = true;
public $disableAmp = true;
public $gradient = ' d-gradient';

public function __construct()
{
Expand Down Expand Up @@ -187,7 +188,6 @@ public function __construct()
<a href="#" id="register-form-link">' . __('Register') . '</a>
</div>
</div>
<hr>
</div>
<div class="panel-body container">
<div class="row">
Expand Down
3 changes: 2 additions & 1 deletion Module/Users/PasswordResetPage.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class PasswordResetPage {
public $js = array();
public $css = array();
public $visible = true;
public $gradient = ' d-gradient';

public function __construct() {
$this->content = '';
Expand Down Expand Up @@ -131,7 +132,7 @@ public function __construct() {
<div class="col-12 col-lg-6 col-lg-offset-3 col-md-6 col-md-offset-3">
' . $errors . '
<div class="panel panel-login">
<div class="panel-heading"><div class="row"><div class="col-12 text-center"><h2><b>' . __('Password reset') . '</b></h2></div></div><hr /></div>
<div class="panel-heading"><div class="row"><div class="col-12 text-center"><h5><b>' . __('Password reset') . '</b></h5></div></div><hr /></div>
<div class="panel-body">
<div class="row">
<div class="col-12">
Expand Down
4 changes: 4 additions & 0 deletions Utils/Template.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class Template
* @var string
*/
private $sidebar = '';
/**
* @var string
*/
private $gradient = '';
/**
* @var bool
*/
Expand Down
31 changes: 19 additions & 12 deletions admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,14 @@
}
.login-box {
z-index: 1;
-webkit-box-shadow: 0 4px 70px -18px #707070;
box-shadow: 0 4px 70px -18px #707070;
border: 1px solid rgba(255, 255, 255, .4);
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
transition: all 0.5s;
-webkit-transition: all 0.5s;
}
.login-box:hover {
-webkit-box-shadow: 0 4px 70px -18px #000;
box-shadow: 0 4px 70px -18px #000;
.login-box-body {
background: transparent;
color: #f8f8f8;
}
.login-logo {
margin-bottom: 0;
Expand All @@ -141,6 +138,18 @@
-moz-border-radius: 0 0 10px 10px;
border-radius: 0 0 10px 10px;
}
.login-box-body input:hover,
.login-box-body input:focus {
outline: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
border-color: #ccc;
}
.d-gradient .login-box-body input:hover,
.d-gradient .login-box-body input:focus {
border-color: rgba(255, 255, 255, .6);
}
</style>
</head>
<body>
Expand Down Expand Up @@ -168,12 +177,10 @@
<i class="bar"></i>
</div>
</div>
<div class="row">
<!-- /.col -->
<div class="col-lg-6 col-6">
<button type="submit" class="btn btn-outline-primary btn-sm"><?php echo __('Login'); ?></button>
<div class="d-flex justify-content-sm-center">
<div class="col-sm-6">
<input type="submit" class="form-control btn btn-outline-primary" value="<?php echo __('Login'); ?>" />
</div>
<!-- /.col -->
</div>
</form>
</div>
Expand Down
Loading

0 comments on commit 39a38ba

Please sign in to comment.