public function get_content_detail($field, $tablename, $array_field, $id) { $result = array(); $sql = "SELECT " . $field . " FROM " . DB_PREFIX . $tablename . " WHERE id=" . $id; $info = $this->db->query($sql); if ($array_field) { $array_field_arr = explode(',', $array_field); } if ($array_field_arr) { while ($row = $this->db->fetch_array($info)) { foreach ($array_field_arr as $v) { $row[$v] = unserialize($row[$v]) ? unserialize($row[$v]) : $row[$v]; } $result = $row; } } else { while ($row = $this->db->fetch_array($info)) { $result = $row; } } $result = to_htmlspecialchars_decode($result); return $result; }
function to_htmlspecialchars_decode($data) { if (is_array($data)) { foreach ($data as $k => $v) { $data[$k] = to_htmlspecialchars_decode($v); } } else { $data = htmlspecialchars_decode($data); } return $data; }