diff --git a/code_igniter/application/controllers/db_upgrades/db_1.12.08.01.php b/code_igniter/application/controllers/db_upgrades/db_1.12.08.01.php index 1be84e6f0..29e59a588 100644 --- a/code_igniter/application/controllers/db_upgrades/db_1.12.08.01.php +++ b/code_igniter/application/controllers/db_upgrades/db_1.12.08.01.php @@ -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); diff --git a/code_igniter/application/models/m_summaries.php b/code_igniter/application/models/m_summaries.php index 01b1c1452..a6e892f38 100644 --- a/code_igniter/application/models/m_summaries.php +++ b/code_igniter/application/models/m_summaries.php @@ -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') { @@ -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); }