User delete functionality

This commit is contained in:
dignajar 2015-07-22 22:45:54 -03:00
parent cc7738ff9e
commit 42ec373c5f
6 changed files with 40 additions and 14 deletions

View File

@ -43,6 +43,11 @@ function deleteUser($args, $deleteContent=false)
global $dbPosts; global $dbPosts;
global $Language; global $Language;
// The user admin cannot be deleted.
if($args['username']=='admin') {
return false;
}
if($deleteContent) { if($deleteContent) {
$dbPosts->deletePostsByUser($args['username']); $dbPosts->deletePostsByUser($args['username']);
} }

View File

@ -15,12 +15,14 @@
<script src="./js/kube.min.js"></script> <script src="./js/kube.min.js"></script>
<!-- Plugins --> <!-- Plugins -->
<?php <?php Theme::plugins('onAdminHead') ?>
Theme::plugins('onAdminHead');
?>
</head> </head>
<body> <body>
<!-- Plugins -->
<?php Theme::plugins('onAdminBodyBegin') ?>
<!-- ALERT --> <!-- ALERT -->
<script> <script>
$(document).ready(function() { $(document).ready(function() {
@ -91,9 +93,7 @@ $(document).ready(function() {
?> ?>
<!-- Plugins --> <!-- Plugins -->
<?php <?php Theme::plugins('onAdminBodyEnd') ?>
Theme::plugins('onAdminBody');
?>
<?php <?php
echo "DEBUG: Load time: ".(microtime(true) - $loadTime).'<br>'; echo "DEBUG: Load time: ".(microtime(true) - $loadTime).'<br>';

View File

@ -5,7 +5,10 @@
<li><a href="#profile"><?php $Language->p('Profile') ?></a></li> <li><a href="#profile"><?php $Language->p('Profile') ?></a></li>
<li><a href="#email"><?php $Language->p('Email') ?></a></li> <li><a href="#email"><?php $Language->p('Email') ?></a></li>
<li><a href="#password"><?php $Language->p('Password') ?></a></li> <li><a href="#password"><?php $Language->p('Password') ?></a></li>
<?php if($_user['username']!=='admin') { ?>
<li><a href="#delete"><?php $Language->p('Delete') ?></a></li> <li><a href="#delete"><?php $Language->p('Delete') ?></a></li>
<?php } ?>
</ul> </ul>
</nav> </nav>
@ -99,6 +102,7 @@
<!-- ===================================== --> <!-- ===================================== -->
<!-- Delete --> <!-- Delete -->
<!-- ===================================== --> <!-- ===================================== -->
<?php if($_user['username']!=='admin') { ?>
<div id="delete"> <div id="delete">
@ -116,4 +120,6 @@
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>" class="btn"><?php $Language->p('Cancel') ?></a> <a href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>" class="btn"><?php $Language->p('Cancel') ?></a>
</div> </div>
<?php } ?>

View File

@ -204,7 +204,12 @@ class Plugin {
return false; return false;
} }
public function onSiteBody() public function onSiteBodyBegin()
{
return false;
}
public function onSiteBodyEnd()
{ {
return false; return false;
} }
@ -214,7 +219,12 @@ class Plugin {
return false; return false;
} }
public function onAdminBody() public function onAdminBodyBegin()
{
return false;
}
public function onAdminBodyEnd()
{ {
return false; return false;
} }

View File

@ -5,11 +5,13 @@
// ============================================================================ // ============================================================================
$plugins = array( $plugins = array(
'onSiteHead'=>array(), 'onSiteHead'=>array(), // <html><head>HERE</head><body>...</body></html>
'onSiteBody'=>array(), 'onSiteBodyBegin'=>array(), // <html><head>...</head><body>HERE...</body></html>
'onSiteSidebar'=>array(), 'onSiteBodyEnd'=>array(), // <html><head>...</head><body>...HERE</body></html>
'onSiteSidebar'=>array(), // <html><head>...</head><body>...<sidebar>HERE</sidebar>...</body></html>
'onAdminHead'=>array(), 'onAdminHead'=>array(),
'onAdminBody'=>array(), 'onAdminBodyBegin'=>array(),
'onAdminBodyEnd'=>array(),
'onAdminSidebar'=>array(), 'onAdminSidebar'=>array(),
'beforeSiteLoad'=>array(), 'beforeSiteLoad'=>array(),
'afterSiteLoad'=>array(), 'afterSiteLoad'=>array(),

View File

@ -9,7 +9,7 @@
<body> <body>
<!-- Plugins --> <!-- Plugins -->
<?php Theme::plugins('onSiteBody') ?> <?php Theme::plugins('onSiteBodyBegin') ?>
<!-- Layout --> <!-- Layout -->
<div id="layout" class="pure-g"> <div id="layout" class="pure-g">
@ -47,5 +47,8 @@
</div> </div>
<!-- Plugins -->
<?php Theme::plugins('onSiteBodyEnd') ?>
</body> </body>
</html> </html>