Skip to content

Commit

Permalink
Fix incorrect use of implode in a few places.
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-unwin committed May 16, 2022
1 parent 1c37a68 commit 4d0805b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

if ($this->db->table_exists('additional_field')) {
$fields = $this->db->list_fields('system');
$fields = implode($fields, "','");
$fields = implode("','", $fields);
$fields = "'" . $fields . "'";
$sql = "UPDATE additional_field SET name = CONCAT(`name`, '_1') WHERE name in (" . $fields . ")";
$this->db->query($sql);
Expand Down
6 changes: 3 additions & 3 deletions code_igniter/application/models/m_summaries.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public function read_sub_resource()
$count = intval($count[0]->count);
} else if ($collection === 'orgs') {
$org_list = array_unique(array_merge($CI->user->orgs, $CI->m_orgs->get_user_descendants($CI->user->id)));
$sql = "SELECT COUNT(*) AS `count` FROM `" . $collection . "` WHERE id IN (" . implode($org_list, ',') . ")";
$sql = "SELECT COUNT(*) AS `count` FROM `" . $collection . "` WHERE id IN (" . implode(',', $org_list) . ")";
$count = $this->run_sql($sql);
$count = intval($count[0]->count);
} else if ($value->orgs === 'u') {
Expand All @@ -309,14 +309,14 @@ public function read_sub_resource()
$count = intval($count[0]->count);
} else if ($value->orgs === 'd') {
$org_list = array_unique(array_merge($CI->user->orgs, $CI->m_orgs->get_user_descendants($CI->user->id)));
$sql = "SELECT COUNT(*) AS `count` FROM `" . $collection . "` WHERE org_id IN (" . implode($org_list, ',') . ")";
$sql = "SELECT COUNT(*) AS `count` FROM `" . $collection . "` WHERE org_id IN (" . implode(',', $org_list) . ")";
$count = $this->run_sql($sql);
$count = intval($count[0]->count);
} else if ($value->orgs === 'b') {
$org_list = array_unique(array_merge($CI->user->orgs, $CI->m_orgs->get_user_descendants($CI->user->id)));
$org_list = array_unique(array_merge($org_list, $CI->m_orgs->get_user_ascendants($CI->user->id)));
$org_list[] = 1;
$sql = "SELECT COUNT(*) AS `count` FROM `" . $collection . "` WHERE org_id IN (" . implode($org_list, ',') . ")";
$sql = "SELECT COUNT(*) AS `count` FROM `" . $collection . "` WHERE org_id IN (" . implode(',', $org_list) . ")";
$count = $this->run_sql($sql);
$count = intval($count[0]->count);
}
Expand Down

0 comments on commit 4d0805b

Please sign in to comment.