function _getList($separate = false, $inlines = false) { if (!isset($this->attachments)) { $this->attachments = array(); $sql = 'SELECT f.id, f.size, f.`key`, f.name, a.inline ' . ' FROM ' . FILE_TABLE . ' f ' . ' INNER JOIN ' . ATTACHMENT_TABLE . ' a ON(f.id=a.file_id) ' . ' WHERE a.`type`=' . db_input($this->getType()) . ' AND a.object_id=' . db_input($this->getId()); if (($res = db_query($sql)) && db_num_rows($res)) { while ($rec = db_fetch_array($res)) { $rec['download'] = AttachmentFile::getDownloadForIdAndKey($rec['id'], $rec['key']); $this->attachments[] = $rec; } } } $attachments = array(); foreach ($this->attachments as $a) { if ($a['inline'] != $separate || $a['inline'] == $inlines) { $a['file_id'] = $a['id']; $a['hash'] = md5($a['file_id'] . session_id() . strtolower($a['key'])); $attachments[] = $a; } } return $attachments; }