mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 20:17:24 +08:00
make print_attachment() available on laravel mode
This commit is contained in:
@@ -131,18 +131,17 @@ function format_quotes($s)
|
|||||||
|
|
||||||
function print_attachment($dlkey, $enableimage = true, $imageresizer = true)
|
function print_attachment($dlkey, $enableimage = true, $imageresizer = true)
|
||||||
{
|
{
|
||||||
global $Cache, $httpdirectory_attachment;
|
$httpdirectory_attachment = get_setting('attachment.httpdirectory');
|
||||||
global $lang_functions;
|
|
||||||
if (strlen($dlkey) == 32){
|
if (strlen($dlkey) == 32){
|
||||||
if (!$row = $Cache->get_value('attachment_'.$dlkey.'_content')){
|
if (!$row = \Nexus\Database\NexusDB::cache_get('attachment_'.$dlkey.'_content')){
|
||||||
$res = sql_query("SELECT * FROM attachments WHERE dlkey=".sqlesc($dlkey)." LIMIT 1") or sqlerr(__FILE__,__LINE__);
|
$res = sql_query("SELECT * FROM attachments WHERE dlkey=".sqlesc($dlkey)." LIMIT 1") or sqlerr(__FILE__,__LINE__);
|
||||||
$row = mysql_fetch_array($res);
|
$row = mysql_fetch_array($res);
|
||||||
$Cache->cache_value('attachment_'.$dlkey.'_content', $row, 86400);
|
\Nexus\Database\NexusDB::cache_put('attachment_'.$dlkey.'_content', $row, 86400);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$row)
|
if (!$row)
|
||||||
{
|
{
|
||||||
return "<div style=\"text-decoration: line-through; font-size: 7pt\">".$lang_functions['text_attachment_key'].$dlkey.$lang_functions['text_not_found']."</div>";
|
return "<div style=\"text-decoration: line-through; font-size: 7pt\">".nexus_trans('attachment.text_key').$dlkey.nexus_trans('attachment.not_found')."</div>";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$id = $row['id'];
|
$id = $row['id'];
|
||||||
@@ -163,7 +162,7 @@ function print_attachment($dlkey, $enableimage = true, $imageresizer = true)
|
|||||||
if($imageresizer == true)
|
if($imageresizer == true)
|
||||||
$onclick = " onclick=\"Previewurl('".$url."')\"";
|
$onclick = " onclick=\"Previewurl('".$url."')\"";
|
||||||
else $onclick = "";
|
else $onclick = "";
|
||||||
$return = "<img id=\"attach".$id."\" style=\"max-width: 700px\" alt=\"".htmlspecialchars($row['filename'])."\" src=\"".$url."\"". $onclick . " onmouseover=\"domTT_activate(this, event, 'content', '".htmlspecialchars("<strong>".$lang_functions['text_size']."</strong>: ".mksize($row['filesize'])."<br />".gettime($row['added']))."', 'styleClass', 'attach', 'x', findPosition(this)[0], 'y', findPosition(this)[1]-58);\" />";
|
$return = "<img id=\"attach".$id."\" style=\"max-width: 700px\" alt=\"".htmlspecialchars($row['filename'])."\" src=\"".$url."\"". $onclick . " onmouseover=\"domTT_activate(this, event, 'content', '".htmlspecialchars("<strong>".nexus_trans('attachment.size')."</strong>: ".mksize($row['filesize'])."<br />".gettime($row['added']))."', 'styleClass', 'attach', 'x', findPosition(this)[0], 'y', findPosition(this)[1]-58);\" />";
|
||||||
}
|
}
|
||||||
else $return = "";
|
else $return = "";
|
||||||
}
|
}
|
||||||
@@ -205,7 +204,7 @@ function print_attachment($dlkey, $enableimage = true, $imageresizer = true)
|
|||||||
$icon = "<img alt=\"other\" src=\"pic/attachicons/common.gif\" />";
|
$icon = "<img alt=\"other\" src=\"pic/attachicons/common.gif\" />";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$return = "<div class=\"attach\">".$icon." <a href=\"".htmlspecialchars("getattachment.php?id=".$id."&dlkey=".$dlkey)."\" target=\"_blank\" id=\"attach".$id."\" onmouseover=\"domTT_activate(this, event, 'content', '".htmlspecialchars("<strong>".$lang_functions['text_downloads']."</strong>: ".number_format($row['downloads'])."<br />".gettime($row['added']))."', 'styleClass', 'attach', 'x', findPosition(this)[0], 'y', findPosition(this)[1]-58);\">".htmlspecialchars($row['filename'])."</a> <font class=\"size\">(".mksize($row['filesize']).")</font></div>";
|
$return = "<div class=\"attach\">".$icon." <a href=\"".htmlspecialchars("getattachment.php?id=".$id."&dlkey=".$dlkey)."\" target=\"_blank\" id=\"attach".$id."\" onmouseover=\"domTT_activate(this, event, 'content', '".htmlspecialchars("<strong>".nexus_trans('attachment.downloads')."</strong>: ".number_format($row['downloads'])."<br />".gettime($row['added']))."', 'styleClass', 'attach', 'x', findPosition(this)[0], 'y', findPosition(this)[1]-58);\">".htmlspecialchars($row['filename'])."</a> <font class=\"size\">(".mksize($row['filesize']).")</font></div>";
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'text_key' => 'Attachment for key ',
|
||||||
|
'not_found' => ' not found',
|
||||||
|
'size' => 'Size',
|
||||||
|
'downloads' => 'Downloads',
|
||||||
|
];
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'text_key' => '附件',
|
||||||
|
'not_found' => '无效',
|
||||||
|
'size' => '大小',
|
||||||
|
'downloads' => '下载',
|
||||||
|
];
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'text_key' => '附件',
|
||||||
|
'not_found' => '無效',
|
||||||
|
'size' => '大小',
|
||||||
|
'downloads' => '下載',
|
||||||
|
];
|
||||||
Reference in New Issue
Block a user