diff --git a/core/users/index.php b/core/users/index.php index 6acfcce31b..f947edff5f 100644 --- a/core/users/index.php +++ b/core/users/index.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2013 the Initial Developer. All Rights Reserved. Contributor(s): @@ -49,7 +49,7 @@ else { echo " "; echo " "; echo " \n"; echo "\n"; -//get the user list from the database - $sql = "select * from v_users "; - $sql .= "where domain_uuid = '$domain_uuid' "; +//get the list of superadmins + $superadmins = superadmin_list($db); + +//get the users from the database + $sql = "select count(*) as num_rows from v_users "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; if (strlen($field_name) > 0 && strlen($field_value) > 0) { $sql .= "and $field_name = '$field_value' "; } if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - $num_rows = count($result); + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + if ($row['num_rows'] > 0) { + $num_rows = $row['num_rows']; + } + else { + $num_rows = '0'; + } + } unset ($prep_statement, $result, $sql); $rows_per_page = 200; $param = ""; @@ -136,26 +146,30 @@ echo " \n"; - echo " \n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n"; + if ($c==0) { $c=1; } else { $c=0; } } - else { - echo $text['option-false']; - } - echo " \n"; - echo " \n"; - echo "\n"; - if ($c==0) { $c=1; } else { $c=0; } } //end foreach unset($sql, $result, $row_count); } //end if results diff --git a/core/users/usersupdate.php b/core/users/usersupdate.php index 6b9df57a31..4324220b8f 100644 --- a/core/users/usersupdate.php +++ b/core/users/usersupdate.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2013 the Initial Developer. All Rights Reserved. Contributor(s): @@ -63,16 +63,15 @@ else { $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { $username = $row["username"]; - break; //limit to 1 row } unset ($prep_statement); //required to be a superadmin to update an account that is a member of the superadmin group - $superadmin_list = superadmin_list($db); - if (if_superadmin($superadmin_list, $_SESSION['user_uuid'])) { + $superadmins = superadmin_list($db); + if (if_superadmin($superadmins, $user_uuid)) { if (!if_group("superadmin")) { echo "access denied"; - return; + exit; } } @@ -116,7 +115,7 @@ else { } } -if (count($_POST)>0 && $_POST["persistform"] != "1") { +if (count($_POST) > 0 && $_POST["persistform"] != "1") { $user_uuid = $_REQUEST["id"]; $password = check_str($_POST["password"]); $confirm_password = check_str($_POST["confirm_password"]);
"; - require_once "userlist.php"; + require_once "users.php"; echo "
"; echo "
"; echo "
"; diff --git a/core/users/userlist.php b/core/users/userlist.php index 40b0983d6a..195f2ad5ec 100644 --- a/core/users/userlist.php +++ b/core/users/userlist.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2013 the Initial Developer. All Rights Reserved. Contributor(s): @@ -78,17 +78,27 @@ echo "
\n"; echo "
\n"; if ($result_count > 0) { foreach($result as $row) { - echo "
".$row['username']." "; - if ($row['user_enabled'] == 'true') { - echo $text['option-true']; + if (if_superadmin($superadmins, $row['user_uuid']) && !if_group("superadmin")) { + //hide + } else { + echo "
".$row['username']." "; + if ($row['user_enabled'] == 'true') { + echo $text['option-true']; + } + else { + echo $text['option-false']; + } + echo " \n"; + if (permission_exists('user_edit')) { + echo " $v_link_label_edit\n"; + } + if (permission_exists('user_delete')) { + echo " $v_link_label_delete\n"; + } + echo "
\n"; - if (permission_exists('user_edit')) { - echo " $v_link_label_edit\n"; - } - if (permission_exists('user_delete')) { - echo " $v_link_label_delete\n"; - } - echo "