本文整理汇总了PHP中FSS_Helper::getEncKey方法的典型用法代码示例。如果您正苦于以下问题:PHP FSS_Helper::getEncKey方法的具体用法?PHP FSS_Helper::getEncKey怎么用?PHP FSS_Helper::getEncKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSS_Helper
的用法示例。
在下文中一共展示了FSS_Helper::getEncKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
$fileid = FSS_Input::getInt('fileid');
$key = FSS_Input::getCmd('key');
$decoded = FSS_Helper::decrypt(FSS_Helper::base64url_decode($key), FSS_Helper::getEncKey("file"));
if ($fileid != $decoded) {
exit;
}
$db = JFactory::getDBO();
$sql = "SELECT * FROM #__fss_ticket_attach WHERE id = " . $fileid;
$db->setQuery($sql);
$attach = $db->loadObject();
$image = in_array(strtolower(pathinfo($attach->filename, PATHINFO_EXTENSION)), array('jpg', 'jpeg', 'png', 'gif'));
$image_file = JPATH_SITE . DS . FSS_Settings::get('attach_location') . DS . "support" . DS . $attach->diskfile;
require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'files.php';
FSS_File_Helper::OutputImage($image_file, pathinfo($attach->filename, PATHINFO_EXTENSION));
}
示例2: stripImagesFromMessage
function stripImagesFromMessage($message_id)
{
$db = JFactory::getDBO();
$qry = "SELECT * FROM #__fss_ticket_messages WHERE id = " . $db->escape($message_id);
$db->setQuery($qry);
$message = $db->loadObject();
$body = $message->body;
$count = 0;
while (strpos($body, "[img]data:") !== false) {
$start = strpos($body, "[img]data:");
$end = strpos($body, "[/img]", $start);
if ($end < 1) {
break;
}
$count++;
$content = substr($body, $start + 5, $end - $start - 5);
list($type, $rest) = explode(";", $content, 2);
list($encoding, $data) = explode(",", $rest, 2);
$image_data = base64_decode($data);
list($junk, $extension) = explode("/", $type, 2);
$filename = "message-{$message_id}-inline-image-{$count}." . $extension;
$destpath = JPATH_SITE . DS . FSS_Settings::get('attach_location') . DS . 'support' . DS;
$destname = FSS_File_Helper::makeAttachFilename("support", $filename, date("Y-m-d", strtotime($message->posted)), $this, $message->user_id);
if (file_put_contents($destpath . $destname, $image_data)) {
$size = filesize($destpath . $destname);
$qry = "INSERT INTO #__fss_ticket_attach (ticket_ticket_id, filename, diskfile, size, user_id, added, message_id, inline) VALUES ('";
$qry .= FSSJ3Helper::getEscaped($db, $this->id) . "',";
$qry .= "'" . FSSJ3Helper::getEscaped($db, $filename) . "',";
$qry .= "'" . FSSJ3Helper::getEscaped($db, $destname) . "',";
$qry .= "'" . $size . "',";
$qry .= "'" . FSSJ3Helper::getEscaped($db, $message->user_id) . "',";
$qry .= "'" . $message->posted . "', " . $message->id . ", 1)";
$db->setQuery($qry);
$db->Query();
$attach_id = $db->insertid();
}
$key = FSS_Helper::base64url_encode(FSS_Helper::encrypt($attach_id, FSS_Helper::getEncKey("file")));
$replace = "[img]" . JURI::base() . "index.php?option=com_fss&view=image&fileid={$attach_id}&key={$key}" . "[/img]";
$body = substr($body, 0, $start) . $replace . substr($body, $end + 6);
}
if ($count > 0) {
$qry = "UPDATE #__fss_ticket_messages SET body = \"" . $db->escape($body) . "\" WHERE id = " . $db->escape($message_id);
$db->setQuery($qry);
$db->Query();
}
}
示例3: processInlineImages
function processInlineImages($message_id, $body = null)
{
// scan body for [cid:image001.png@01D04526.5927F8D0] and replace with any images attached to that message
$db = JFactory::getDBO();
if ($body == "") {
$qry = "SELECT * FROM #__fss_ticket_messages WHERE id = " . $db->escape($message_id);
$db->setQuery($qry);
$message = $db->loadObject();
$body = $message->body;
}
$qry = "SELECT * FROM #__fss_ticket_attach WHERE message_id = " . $db->escape($message_id);
$db->setQuery($qry);
$attach = $db->loadObjectList();
if (preg_match_all("/\\[cid\\:(.*)\\@.*\\]/", $body, $matches)) {
$changed = false;
foreach ($matches[0] as $offset => $match) {
$image = $matches[1][$offset];
foreach ($attach as $att) {
if ($att->filename == $image) {
$attach_id = $att->id;
$key = FSS_Helper::base64url_encode(FSS_Helper::encrypt($attach_id, FSS_Helper::getEncKey("file")));
$replace = "[img]" . JURI::base() . "index.php?option=com_fss&view=image&fileid={$attach_id}&key={$key}" . "[/img]";
$body = str_replace($match, $replace, $body);
$changed = true;
}
}
}
if ($changed) {
$qry = "UPDATE #__fss_ticket_messages SET body = '" . $db->escape($body) . "' WHERE id = " . $db->escape($message_id);
$db->setQuery($qry);
$db->Query();
}
}
return $body;
}