diff --git a/include/functions.php b/include/functions.php index 86ad48b7..5688c688 100644 --- a/include/functions.php +++ b/include/functions.php @@ -131,18 +131,17 @@ function format_quotes($s) function print_attachment($dlkey, $enableimage = true, $imageresizer = true) { - global $Cache, $httpdirectory_attachment; - global $lang_functions; + $httpdirectory_attachment = get_setting('attachment.httpdirectory'); 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__); $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) { - return "
".$lang_functions['text_attachment_key'].$dlkey.$lang_functions['text_not_found']."
"; + return "
".nexus_trans('attachment.text_key').$dlkey.nexus_trans('attachment.not_found')."
"; } else{ $id = $row['id']; @@ -163,7 +162,7 @@ function print_attachment($dlkey, $enableimage = true, $imageresizer = true) if($imageresizer == true) $onclick = " onclick=\"Previewurl('".$url."')\""; else $onclick = ""; - $return = "\"".htmlspecialchars($row['filename'])."\"".$lang_functions['text_size'].": ".mksize($row['filesize'])."
".gettime($row['added']))."', 'styleClass', 'attach', 'x', findPosition(this)[0], 'y', findPosition(this)[1]-58);\" />"; + $return = "\"".htmlspecialchars($row['filename'])."\"".nexus_trans('attachment.size').": ".mksize($row['filesize'])."
".gettime($row['added']))."', 'styleClass', 'attach', 'x', findPosition(this)[0], 'y', findPosition(this)[1]-58);\" />"; } else $return = ""; } @@ -205,7 +204,7 @@ function print_attachment($dlkey, $enableimage = true, $imageresizer = true) $icon = "\"other\""; } } - $return = "
".$icon."  ".$lang_functions['text_downloads'].": ".number_format($row['downloads'])."
".gettime($row['added']))."', 'styleClass', 'attach', 'x', findPosition(this)[0], 'y', findPosition(this)[1]-58);\">".htmlspecialchars($row['filename'])."
  (".mksize($row['filesize']).")
"; + $return = "
".$icon."  ".nexus_trans('attachment.downloads').": ".number_format($row['downloads'])."
".gettime($row['added']))."', 'styleClass', 'attach', 'x', findPosition(this)[0], 'y', findPosition(this)[1]-58);\">".htmlspecialchars($row['filename'])."
  (".mksize($row['filesize']).")
"; } return $return; } diff --git a/resources/lang/en/attachment.php b/resources/lang/en/attachment.php new file mode 100644 index 00000000..adf8a002 --- /dev/null +++ b/resources/lang/en/attachment.php @@ -0,0 +1,8 @@ + 'Attachment for key ', + 'not_found' => ' not found', + 'size' => 'Size', + 'downloads' => 'Downloads', +]; diff --git a/resources/lang/zh_CN/attachment.php b/resources/lang/zh_CN/attachment.php new file mode 100644 index 00000000..6f0d89a2 --- /dev/null +++ b/resources/lang/zh_CN/attachment.php @@ -0,0 +1,8 @@ + '附件', + 'not_found' => '无效', + 'size' => '大小', + 'downloads' => '下载', +]; diff --git a/resources/lang/zh_TW/attachment.php b/resources/lang/zh_TW/attachment.php new file mode 100644 index 00000000..430ccfe0 --- /dev/null +++ b/resources/lang/zh_TW/attachment.php @@ -0,0 +1,8 @@ + '附件', + 'not_found' => '無效', + 'size' => '大小', + 'downloads' => '下載', +];