Skip to content

Commit

Permalink
2.1.25.2
Browse files Browse the repository at this point in the history
Fix for case where an array could contain an empty value
  • Loading branch information
nilsteampassnet committed Jan 30, 2016
1 parent ebe6233 commit aa4fb01
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sources/main.functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ function identifyUserRights($groupesVisiblesUser, $groupesInterditsUser, $isAdmi
"SELECT * FROM ".prefix_table("roles_title")."
ORDER BY title ASC");
foreach ($rows as $record) {
if (!in_array($record['id'], $tmp)) {
if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
array_push($tmp, $record['id']);
}
}
Expand Down
6 changes: 3 additions & 3 deletions sources/roles.queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@
$previous = 1;

//count nb of roles
if (empty($_SESSION['fonction_id'])) $where = "";
else $where = " WHERE id IN (".str_replace(";", ",", $_SESSION['fonction_id']).")";
if (empty($_SESSION['fonction_id'])) $where = "";
else $where = " WHERE id IN (".array_filter(str_replace(";", ",", $_SESSION['fonction_id'])).")";
DB::query("SELECT * FROM ".prefix_table("roles_title").$where);
$roles_count = DB::count();
if ($roles_count > $display_nb) {
Expand All @@ -252,7 +252,7 @@
//Display table header
$rows = DB::query(
"SELECT * FROM ".prefix_table("roles_title").
$where."
$where."
ORDER BY title ASC".$sql_limit);
foreach ($rows as $record) {
if ($_SESSION['is_admin'] == 1 || ($_SESSION['user_manager'] == 1 && (in_array($record['id'], $my_functions) || $record['creator_id'] == $_SESSION['user_id']))) {
Expand Down

0 comments on commit aa4fb01

Please sign in to comment.