users.php
changeset 105 df46fd74c2ee
parent 99 a4b469dac161
child 110 455405c757e1
equal deleted inserted replaced
104:7fef233c99df 105:df46fd74c2ee
    25 verify_permission(user_edit_own) ? $perm_edit_own = "1" : $perm_edit_own = "0" ;
    25 verify_permission(user_edit_own) ? $perm_edit_own = "1" : $perm_edit_own = "0" ;
    26 verify_permission(user_edit_others) ? $perm_edit_others = "1" : $perm_edit_others = "0" ;
    26 verify_permission(user_edit_others) ? $perm_edit_others = "1" : $perm_edit_others = "0" ;
    27 verify_permission(templ_perm_edit) ? $perm_templ_perm_edit = "1" : $perm_templ_perm_edit = "0" ;
    27 verify_permission(templ_perm_edit) ? $perm_templ_perm_edit = "1" : $perm_templ_perm_edit = "0" ;
    28 verify_permission(is_ueberuser) ? $perm_is_godlike = "1" : $perm_is_godlike = "0" ; 
    28 verify_permission(is_ueberuser) ? $perm_is_godlike = "1" : $perm_is_godlike = "0" ; 
    29 
    29 
       
    30 unset($commit_button);
       
    31 
    30 if (isset($_POST['commit'])) {
    32 if (isset($_POST['commit'])) {
    31 	foreach ($_POST['user'] as $user) {
    33 	foreach ($_POST['user'] as $user) {
    32 		update_user_details($user);
    34 		update_user_details($user);
    33 	}
    35 	}
    34 }
    36 }
    51 	if ($user['active'] == "1" ) {
    53 	if ($user['active'] == "1" ) {
    52 		$active = " checked";
    54 		$active = " checked";
    53 	} else {
    55 	} else {
    54 		$active = "";
    56 		$active = "";
    55 	}
    57 	}
    56 	echo "      <input type=\"hidden\" name=\"user[" . $user['uid'] . "][uid]\" value=\"" . $user['uid'] . "\">\n";
       
    57 	echo "      <tr>\n";
       
    58 	echo "       <td>\n";
       
    59 	if (($user['uid'] == $_SESSION["userid"] && $perm_edit_own == "1") || ($user['uid'] != $_SESSION["userid"] && $perm_edit_others == "1" )) {
    58 	if (($user['uid'] == $_SESSION["userid"] && $perm_edit_own == "1") || ($user['uid'] != $_SESSION["userid"] && $perm_edit_others == "1" )) {
       
    59 		$commit_button = "1";
       
    60 
       
    61 		echo "      <input type=\"hidden\" name=\"user[" . $user['uid'] . "][uid]\" value=\"" . $user['uid'] . "\">\n";
       
    62 		echo "      <tr>\n";
       
    63 		echo "       <td>\n";
    60 		echo "        <a href=\"edit_user.php?id=" . $user['uid'] . "\"><img src=\"images/edit.gif\" alt=\"[ " . _('Edit user') . "\" ]></a>\n";
    64 		echo "        <a href=\"edit_user.php?id=" . $user['uid'] . "\"><img src=\"images/edit.gif\" alt=\"[ " . _('Edit user') . "\" ]></a>\n";
    61 		echo "        <a href=\"delete_user.php?id=" . $user['uid'] . "\"><img src=\"images/delete.gif\" alt=\"[ " . _('Delete user') . "\" ]></a>\n";
    65 		echo "        <a href=\"delete_user.php?id=" . $user['uid'] . "\"><img src=\"images/delete.gif\" alt=\"[ " . _('Delete user') . "\" ]></a>\n";
       
    66 		echo "       </td>\n";
       
    67 		echo "       <td><input type=\"text\" name=\"user[" . $user['uid'] . "][username]\" value=\"" . $user['username'] . "\"></td>\n";
       
    68 		echo "       <td><input type=\"text\" name=\"user[" . $user['uid'] . "][fullname]\" value=\"" . $user['fullname'] . "\"></td>\n";
       
    69 		echo "       <td><input type=\"text\" name=\"user[" . $user['uid'] . "][descr]\" value=\"" . $user['descr'] . "\"></td>\n";
       
    70 		echo "       <td><input type=\"text\" name=\"user[" . $user['uid'] . "][email]\" value=\"" . $user['email'] . "\"></td>\n";
       
    71 		echo "       <td>\n";
       
    72 		if ($perm_templ_perm_edit == "1") {
       
    73 			echo "        <select name=\"user[" . $user['uid'] . "][templ_id]\">\n";
       
    74 			foreach (list_permission_templates() as $template) {
       
    75 				($template['id'] == $user['tpl_id']) ? $select = " SELECTED" : $select = "" ;
       
    76 				echo "          <option value=\"" . $template['id'] . "\"" . $select . ">" . $template['name'] . "</option>\n";
       
    77 			}
       
    78 			echo "         </select>\n";
       
    79 		} else {
       
    80 			echo $user['tpl_name'];
       
    81 		}
       
    82 		echo "       </td>\n";
       
    83 		echo "       <td><input type=\"checkbox\" name=\"user[" . $user['uid'] . "][active]\"" . $active . "></td>\n";
       
    84 		echo "      </tr>\n";
    62 	} else {
    85 	} else {
    63 		echo "        &nbsp;\n";
    86 		echo "      <tr>\n";
       
    87 		echo "       <td>&nbsp;</td>\n";
       
    88 		echo "       <td>" . $user['username'] . "</td>\n";
       
    89 		echo "       <td>" . $user['fullname'] . "</td>\n";
       
    90 		echo "       <td>" . $user['descr'] . "</td>\n";
       
    91 		echo "       <td>" . $user['email'] . "</td>\n";
       
    92 		echo "       <td>" . $user['tpl_name'] . "</td>\n";
       
    93 		if ($active == " checked") {
       
    94 			echo "       <td>Yes</td>\n";
       
    95 		} else {
       
    96 			echo "       <td>No</td>\n";
       
    97 		}
       
    98 		echo "      </tr>\n";
    64 	}
    99 	}
    65 	echo "       </td>\n";
       
    66 	echo "       <td><input type=\"text\" name=\"user[" . $user['uid'] . "][username]\" value=\"" . $user['username'] . "\"></td>\n";
       
    67 	echo "       <td><input type=\"text\" name=\"user[" . $user['uid'] . "][fullname]\" value=\"" . $user['fullname'] . "\"></td>\n";
       
    68 	echo "       <td><input type=\"text\" name=\"user[" . $user['uid'] . "][descr]\" value=\"" . $user['descr'] . "\"></td>\n";
       
    69 	echo "       <td><input type=\"text\" name=\"user[" . $user['uid'] . "][email]\" value=\"" . $user['email'] . "\"></td>\n";
       
    70 	echo "       <td>\n";
       
    71 	echo "        <select name=\"user[" . $user['uid'] . "][templ_id]\">\n";
       
    72 
       
    73 	foreach (list_permission_templates() as $template) {
       
    74 		($template['id'] == $user['tpl_id']) ? $select = " SELECTED" : $select = "" ;
       
    75 		echo "          <option value=\"" . $template['id'] . "\"" . $select . ">" . $template['name'] . "</option>\n";
       
    76 	}
       
    77 	echo "         </select>\n";
       
    78 	echo "       </td>\n";
       
    79 	echo "       <td><input type=\"checkbox\" name=\"user[" . $user['uid'] . "][active]\"" . $active . "></td>\n";
       
    80 	echo "      </tr>\n";
       
    81 }
   100 }
    82 
   101 
    83 echo "     </table>\n";
   102 echo "     </table>\n";
    84 echo "     <input type=\"submit\" class=\"button\" name=\"commit\" value=\"" . _('Commit changes') . "\">\n";
   103 if ($commit_button) {
       
   104 	echo "     <input type=\"submit\" class=\"button\" name=\"commit\" value=\"" . _('Commit changes') . "\">\n";
       
   105 }
    85 echo "    </form>\n";
   106 echo "    </form>\n";
    86 
   107 
    87 echo "    <ul>\n";
   108 echo "    <ul>\n";
    88 if ($perm_templ_perm_edit == "1") {
   109 if ($perm_templ_perm_edit == "1") {
    89 	echo "<li><a href=\"list_perm_templ.php\">" . _('Edit permission templates') . "</a>.</li>\n";
   110 	echo "<li><a href=\"list_perm_templ.php\">" . _('Edit permission templates') . "</a>.</li>\n";