-
Notifications
You must be signed in to change notification settings - Fork 0
/
view_document.php
101 lines (100 loc) · 3.14 KB
/
view_document.php
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
include 'db_connect.php';
$qry = $conn->query("SELECT * FROM documents where md5(id) = '{$_GET['id']}' ");
if($qry->num_rows > 0 ){
foreach($qry->fetch_array() as $k => $v){
if($k == 'title')
$k = 'ftitle';
$$k = $v;
}
}else{
}
?>
<div class="col-lg-12">
<?php if(isset($_SESSION['login_id'])): ?>
<div class="row">
<div class="col-md-12 mb-2">
<button class="btn bg-light border float-right" type="button" id="share"><i class="fa fa-share"></i> Share This Document</button>
</div>
</div>
<?php endif; ?>
<div class="row">
<div class="col-md-7">
<div class="card card-outline card-info">
<div class="card-header">
<div class="card-tools">
<small class="text-muted">
Date Uploaded: <?php echo date("M d, Y",strtotime($date_created)) ?>
</small>
</div>
</div>
<div class="card-body">
<div class="callout callout-info">
<dl>
<dt>Title</dt>
<dd><?php echo $ftitle ?></dd>
</dl>
</div>
<div class="callout callout-info">
<dl>
<dt>Description</dt>
<dd><?php echo html_entity_decode($description) ?></dd>
</dl>
</div>
</div>
</div>
</div>
<div class="col-md-5">
<div class="card card-outline card-primary">
<div class="card-header">
<h3><b>File/s</b></h3>
</div>
<div class="card-body">
<div class="col-md-12">
<div class="alert alert-info px-2 py-1"><i class="fa fa-info-circle"></i> Click the file to download.</div>
<div class="row">
<?php
if(isset($file_json) && !empty($file_json)):
foreach(json_decode($file_json) as $k => $v):
if(is_file('assets/uploads/'.$v)):
$_f = file_get_contents('assets/uploads/'.$v);
$dname = explode('_', $v);
?>
<div class="col-sm-3">
<a href="download.php?f=<?php echo $v ?>" target="_blank" class="text-white border-rounded file-item p-1">
<span class="img-fluid bg-dark border-rounded px-2 py-2 d-flex justify-content-center align-items-center" style="width: 100px;height: 100px">
<h3 class="bg-dark"><i class="fa fa-download"></i></h3>
</span>
<span class="text-dark"><?php echo $dname[1] ?></span>
</a>
</div>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$('.file-item').hover(function(){
$(this).addClass("active")
})
$('file-item').mouseout(function(){
$(this).removeClass("active")
})
$('.file-item').click(function(e){
e.preventDefault()
_conf("Are you sure to download this file?","dl",['"'+$(this).attr('href')+'"'])
})
function dl($link){
start_load()
window.open($link,"_blank")
end_load()
}
$('#share').click(function(){
uni_modal("<i class='fa fa-share'></i> Share this document using the link.","modal_share_link.php?did=<?php echo md5($id) ?>")
})
</script>