-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathattlib.php
More file actions
67 lines (67 loc) · 3.46 KB
/
attlib.php
File metadata and controls
67 lines (67 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php if(!defined('EMLOG_ROOT')) {exit('error!');} ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>upload</title>
<link href="./views/css/css-att.css?v=<?php echo Option::EMLOG_VERSION; ?>" type=text/css rel=stylesheet>
<script type="text/javascript" src="./views/js/common.js?v=<?php echo Option::EMLOG_VERSION; ?>"></script>
</head>
<script>
function alertImgURL (a,imgUrl) {
alert("图片地址为:\n"+imgUrl+"\n由于Chrome、Firefox等浏览器不支持自动,请手动复制!");
}
function alertFileURL (attUrl,imgUrl) {
alert("文件地址为:\n"+attUrl+"\n由于Chrome、Firefox等浏览器不支持自动,请手动复制!");
}
function showupload(multi){
var as_logid = parent.document.getElementById('as_logid').value
window.location.href="attachment.php?action=selectFile&logid="+as_logid+"&multi="+multi;
}
function showattlib(){
var as_logid = parent.document.getElementById('as_logid').value
window.location.href="attachment.php?action=attlib&logid="+as_logid;
}
</script>
<body>
<div id="media-upload-header">
<span><a href="javascript:showupload(0);">上传附件</a></span>
<span><a href="javascript:showupload(1);">批量上传</a></span>
<span id="curtab"><a href="javascript:showattlib();">附件库(<?php echo $attachnum; ?>)</a></span>
</div>
<div id="media-upload-body">
<?php if(!$attach): ?>
<p id="attmsg">该文章没有附件</p>
<?php else:
foreach($attach as $key=>$value):
$extension = strtolower(substr(strrchr($value['filepath'], "."),1));
$atturl = BLOG_URL.substr($value['filepath'], 3);
if ($extension == 'zip' || $extension == 'rar'){
$imgpath = "./views/images/tar.gif";
$embedlink = "<a href=\"javascript: alertFileURL('$atturl', '{$value['filename']}', {$value['aid']});\">插入 </a>";
} elseif (in_array($extension, array('gif', 'jpg', 'jpeg', 'png', 'bmp'))) {
$imgpath = $value['filepath'];
$ed_imgpath = BLOG_URL.substr($imgpath,3);
$embedlink = "<a href=\"javascript: alertImgURL('$atturl', '$ed_imgpath',{$value['aid']}, '{$value['width']}', '{$value['height']}', '{$value['filename']}');\" title=\"插入原图\">原图</a>";
if (isset($value['thum_filepath'])) {
$thum_url = BLOG_URL.substr($value['thum_filepath'], 3);
$embedlink .= " <a href=\"javascript: alertImgURL('$atturl', '$thum_url',{$value['aid']}, '{$value['thum_width']}', '{$value['thum_height']}', '{$value['filename']}');\" title=\"插入缩略图\">缩略图</a>";
}
} else {
$imgpath = "./views/images/fnone.gif";
$embedlink = "<a href=\"javascript: alertFileURL('$atturl', '{$value['filename']}', {$value['aid']});\">插入 </a>";
}
?>
<li id="attlist"><a href="<?php echo $atturl; ?>" target="_blank" title="<?php echo $value['filename']; ?>"><img src="<?php echo $imgpath; ?>" width="90" height="90" border="0" align="absmiddle"/></a>
<?php if ($value['width'] && $value['height']): ?>
<br />
<?php echo $value['width']?>x<?php echo $value['height']?>
<?php else:?>
<br />
<?php echo subString($value['filename'], 0, 6) ?>
<?php endif;?>
<br /><a href="javascript: em_confirm(<?php echo $value['aid']; ?>, 'attachment', '<?php echo LoginAuth::genToken(); ?>');">删除</a> <?php echo $embedlink; ?></li>
<?php endforeach; endif; ?>
</div>
</body>
</html>