You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.6 KiB

<?php
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
$get_attachment = $db->query("SELECT * FROM " . PREFIX . "_forum_files WHERE topic_id = '$tid' and file_attach = '1'");
while ($row = $db->get_row($get_attachment))
{
if ($row['file_type'] == "image")
{
$img_full = $config['http_home_url'].'uploads/forum/images/'.$row['onserver'];
$attachment = "<img src=\"{$img_full}\" border=\"0\">";
}
elseif ($row['file_type'] == "thumb")
{
$img_full = $config['http_home_url'].'uploads/forum/images/'.$row['onserver'];
$img_thumb = $config['http_home_url'].'uploads/forum/thumbs/'.$row['onserver'];
$hs_expand = "onClick=\"return hs.expand(this)\"";
$attachment = "<a href=\"{$img_full}\" {$hs_expand}><img src=\"{$img_thumb}\" border=\"0\"></a>";
}
else
{
$attachment_down = $a_forum_url."act=attachment&id=".$row['file_id'];
$attachment = "<a href=\"$attachment_down\">{$row['file_name']}</a> ({$row['dcount']} | ".mksize($row['file_size']).")";
//$onserver_url = "{$config['http_home_url']}uploads/forum/files/{$row['onserver']}";
}
if (!$ajax_edit_attach){
$tpl->result['posts'] = str_replace('[attachment='.$row['file_id'].']', $attachment, $tpl->result['posts']);
//$tpl->result['posts'] = preg_replace("#\[attachment={$row['file_id']}:(.*)\]#i", $onserver_url, $tpl->result['posts']);
}
else{
$post_text = str_replace('[attachment='.$row['file_id'].']', $attachment, $post_text);
//$post_text = preg_replace("#\[attachment={$row['file_id']}:(.*)\]#i", $onserver_url, $post_text);
}
}
?>