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 $Language;
// The user admin cannot be deleted.
if($args['username']=='admin') {
return false;
}
if($deleteContent) {
$dbPosts->deletePostsByUser($args['username']);
}

View File

@ -15,12 +15,14 @@
<script src="./js/kube.min.js"></script>
<!-- Plugins -->
<?php
Theme::plugins('onAdminHead');
?>
<?php Theme::plugins('onAdminHead') ?>
</head>
<body>
<!-- Plugins -->
<?php Theme::plugins('onAdminBodyBegin') ?>
<!-- ALERT -->
<script>
$(document).ready(function() {
@ -91,9 +93,7 @@ $(document).ready(function() {
?>
<!-- Plugins -->
<?php
Theme::plugins('onAdminBody');
?>
<?php Theme::plugins('onAdminBodyEnd') ?>
<?php
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="#email"><?php $Language->p('Email') ?></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>
<?php } ?>
</ul>
</nav>
@ -99,6 +102,7 @@
<!-- ===================================== -->
<!-- Delete -->
<!-- ===================================== -->
<?php if($_user['username']!=='admin') { ?>
<div id="delete">
@ -117,3 +121,5 @@
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>" class="btn"><?php $Language->p('Cancel') ?></a>
</div>
<?php } ?>

View File

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

View File

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

View File

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