]> git.mxchange.org Git - friendica.git/commitdiff
admin: Don't allow to block or delete site admin in users admin page. fix bug 471
authorFabrixxm <fabrix.xm@gmail.com>
Mon, 17 Sep 2012 12:48:43 +0000 (08:48 -0400)
committerFabrixxm <fabrix.xm@gmail.com>
Mon, 17 Sep 2012 12:48:43 +0000 (08:48 -0400)
mod/admin.php
view/admin_users.tpl

index 5edb927559c87e220f4795aa0e5e27f2c30c2da1..ee048305483ab0ae98d60b9cabcf3cb7f3233c91 100644 (file)
@@ -664,6 +664,7 @@ function admin_page_users(&$a){
                                );
                                        
        function _setup_users($e){
+        $a = get_app();
                $accounts = Array(
                        t('Normal Account'), 
                        t('Soapbox Account'),
@@ -674,6 +675,7 @@ function admin_page_users(&$a){
                $e['register_date'] = relative_date($e['register_date']);
                $e['login_date'] = relative_date($e['login_date']);
                $e['lastitem_date'] = relative_date($e['lastitem_date']);
+        $e['is_admin'] = ($e['email'] === $a->config['admin_email']);
                return $e;
        }
        $users = array_map("_setup_users", $users);
@@ -694,6 +696,7 @@ function admin_page_users(&$a){
                '$delete' => t('Delete'),
                '$block' => t('Block'),
                '$unblock' => t('Unblock'),
+        '$siteadmin' => t('Site admin'),
                
                '$h_users' => t('Users'),
                '$th_users' => array( t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'),  t('Account') ),
index f67e4a0f74244fffdb599484575aca6c449b13d5..c9ab0e3f73d19f4fbd55d71431c1569cd8710649 100644 (file)
                                                <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[]" value="$u.uid"/></td>
+                                               <td class='login_date'>$u.page-flags {{ if $u.is_admin }}($siteadmin){{ endif }}</td>
+                                               <td class="checkbox"> 
+                                    {{ if $u.is_admin }}
+                                        &nbsp;
+                                    {{ else }}
+                                        <input type="checkbox" class="users_ckbx" id="id_user_$u.uid" name="user[]" value="$u.uid"/></td>
+                                    {{ endif }}
                                                <td class="tools">
-                                                       <a href="$baseurl/admin/users/block/$u.uid?t=$form_security_token" 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?t=$form_security_token" title='$delete' onclick="return confirm_delete('$u.name')"><span class='icon drop'></span></a>
+                                    {{ if $u.is_admin }}
+                                        &nbsp;
+                                    {{ else }}
+                                        <a href="$baseurl/admin/users/block/$u.uid?t=$form_security_token" 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?t=$form_security_token" title='$delete' onclick="return confirm_delete('$u.name')"><span class='icon drop'></span></a>
+                                    {{ endif }}
                                                </td>
                                        </tr>
                                {{ endfor }}