本文整理汇总了PHP中AttachmentFile::generateDownloadUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP AttachmentFile::generateDownloadUrl方法的具体用法?PHP AttachmentFile::generateDownloadUrl怎么用?PHP AttachmentFile::generateDownloadUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttachmentFile
的用法示例。
在下文中一共展示了AttachmentFile::generateDownloadUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAttachments
function getAttachments()
{
if ($this->attachments) {
return $this->attachments;
}
//XXX: inner join the file table instead?
$sql = 'SELECT a.attach_id, f.id as file_id, f.size, lower(f.`key`) as file_hash, f.`signature` as file_sig, f.name, a.inline ' . ' FROM ' . FILE_TABLE . ' f ' . ' INNER JOIN ' . TICKET_ATTACHMENT_TABLE . ' a ON(f.id=a.file_id) ' . ' WHERE a.ticket_id=' . db_input($this->getTicketId()) . ' AND a.ref_id=' . db_input($this->getId());
$this->attachments = array();
if (($res = db_query($sql)) && db_num_rows($res)) {
while ($rec = db_fetch_array($res)) {
$rec['download_url'] = AttachmentFile::generateDownloadUrl($rec['file_id'], $rec['file_hash'], $rec['file_sig']);
$this->attachments[] = $rec;
}
}
return $this->attachments;
}
示例2: _getList
function _getList($separate = false, $inlines = false)
{
if (!isset($this->attachments)) {
$this->attachments = array();
$sql = 'SELECT f.id, f.size, f.`key`, f.signature, 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_url'] = AttachmentFile::generateDownloadUrl($rec['id'], $rec['key'], $rec['signature']);
$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;
}