aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/datetime.php4
-rw-r--r--mod/admin.php25
-rw-r--r--view/admin_users.tpl7
3 files changed, 14 insertions, 22 deletions
diff --git a/include/datetime.php b/include/datetime.php
index a5b388e76..ade202cad 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -178,6 +178,10 @@ function relative_date($posted_date) {
$abs = strtotime($localtime);
$etime = time() - $abs;
+ if ($abs==False) {
+ return t('never');
+ }
+
if ($etime < 1) {
return t('less than a second ago');
}
diff --git a/mod/admin.php b/mod/admin.php
index 920adf05d..9a92f4e15 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -327,11 +327,8 @@ function admin_page_site(&$a) {
* Users admin page
*/
function admin_page_users_post(&$a){
- $users=array(); $pending=array();
- foreach($_POST as $k=>$v){
- if (substr($k,0,5)=="user_") $users[] = substr($k,5,strlen($k)-5);
- if (substr($k,0,8)=="pending_") $users[] = substr($k,8,strlen($k)-8);
- }
+ $pending = ( x(£_POST, 'pending') ? $_POST['pending'] : Array() );
+ $users = ( x($_POST, 'user') ? $_POST['user'] : Array() );
if (x($_POST,'page_users_block')){
foreach($users as $uid){
@@ -350,13 +347,13 @@ function admin_page_users_post(&$a){
}
if (x($_POST,'page_users_approve')){
- require_once("include/regmod.php");
+ require_once("mod/regmod.php");
foreach($pending as $hash){
user_allow($hash);
}
}
if (x($_POST,'page_users_deny')){
- require_once("include/regmod.php");
+ require_once("mod/regmod.php");
foreach($pending as $hash){
user_deny($hash);
}
@@ -409,22 +406,15 @@ function admin_page_users(&$a){
$a->set_pager_itemspage(100);
}
- $users = q("SELECT `user` . * , `contact`.`name` , `contact`.`url` , `contact`.`micro` , `lastitem`.`lastitem_date`
- FROM (
- SELECT MAX(`item`.`changed`) as `lastitem_date`, `item`.`uid`
- FROM `item`
- WHERE `item`.`type` = 'wall'
- GROUP BY `item`.`uid`
- ) AS `lastitem` , `user`
+ $users = q("SELECT `user` . * , `contact`.`name` , `contact`.`url` , `contact`.`micro`
+ FROM `user`
LEFT JOIN `contact` ON `user`.`uid` = `contact`.`uid`
WHERE `user`.`verified` =1
AND `contact`.`self` =1
- AND `lastitem`.`uid` = `user`.`uid`
ORDER BY `contact`.`name` LIMIT %d, %d
",
intval($a->pager['start']),
intval($a->pager['itemspage'])
-
);
function _setup_users($e){
@@ -437,7 +427,6 @@ function admin_page_users(&$a){
$e['page-flags'] = $accounts[$e['page-flags']];
$e['register_date'] = relative_date($e['register_date']);
$e['login_date'] = relative_date($e['login_date']);
- $e['lastitem_date'] = relative_date($e['lastitem_date']);
return $e;
}
$users = array_map("_setup_users", $users);
@@ -459,7 +448,7 @@ function admin_page_users(&$a){
'$unblock' => t('Unblock'),
'$h_users' => t('Users'),
- '$th_users' => array( t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Account') ),
+ '$th_users' => array( t('Name'), t('Email'), t('Register date'), t('Last login'), t('Account') ),
'$confirm_delete_multi' => t('Selected users will be deleted!\n\nEverything these users had posted on this site will be permanently deleted!\n\nAre you sure?'),
'$confirm_delete' => t('The user {0} will be deleted!\n\nEverything this user has posted on this site will be permanently deleted!\n\nAre you sure?'),
diff --git a/view/admin_users.tpl b/view/admin_users.tpl
index 952a8992b..6e677f7dc 100644
--- a/view/admin_users.tpl
+++ b/view/admin_users.tpl
@@ -31,7 +31,7 @@
<td class="created">$u.created</td>
<td class="name">$u.name</td>
<td class="email">$u.email</td>
- <td class="checkbox"><input type="checkbox" class="pending_ckbx" id="id_pending_$u.hash" name="pending_$u.hash"/></td>
+ <td class="checkbox"><input type="checkbox" class="pending_ckbx" id="id_pending_$u.hash" name="pending[]" value="$u.hash" /></td>
<td class="tools">
<a href="$baseurl/regmod/allow/$u.hash" title='$approve'><span class='icon like'></span></a>
<a href="$baseurl/regmod/deny/$u.hash" title='$deny'><span class='icon dislike'></span></a>
@@ -68,12 +68,11 @@
<td class='email'>$u.email</td>
<td class='register_date'>$u.register_date</td>
<td class='login_date'>$u.login_date</td>
- <td class='lastitem_date'>$u.lastitem_date</td>
<td class='login_date'>$u.page-flags</td>
- <td class="checkbox"><input type="checkbox" class="users_ckbx" id="id_user_$u.uid" name="user_$u.uid"/></td>
+ <td class="checkbox"><input type="checkbox" class="users_ckbx" id="id_user_$u.uid" name="user[]" value="$u.uid"/></td>
<td class="tools">
<a href="$baseurl/admin/users/block/$u.uid" title='{{ if $u.blocked }}$unblock{{ else }}$block{{ endif }}'><span class='icon block {{ if $u.blocked==0 }}dim{{ endif }}'></span></a>
- <a href="$baseurl/admin/users/delete/$u.uid" title='$discard' onclick="return confirm_delete('$u.name')"><span class='icon drop'></span></a>
+ <a href="$baseurl/admin/users/delete/$u.uid" title='$delete' onclick="return confirm_delete('$u.name')"><span class='icon drop'></span></a>
</td>
</tr>
{{ endfor }}