-
Notifications
You must be signed in to change notification settings - Fork 1
/
files_detail.php
executable file
·187 lines (166 loc) · 5.89 KB
/
files_detail.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?php include("includes/header.php"); ?>
<body class="page-header-fixed">
<?php include("includes/head.php"); ?>
<!-- BEGIN CONTAINER -->
<div class="page-container">
<?php include("includes/sidebar.php"); ?>
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
<div class="page-content">
<!-- BEGIN PAGE HEADER-->
<div class="row">
<div class="col-md-12">
<!-- BEGIN PAGE TITLE & BREADCRUMB-->
<h3 class="page-title">
<?php echo CMS_TITULO; ?>
</h3>
<ul class="page-breadcrumb breadcrumb">
<li class="btn-group">
<button type="button" class="btn blue dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="1000" data-close-others="true">
<span>Nuevo</span><i class="fa fa-angle-down"></i>
</button>
<ul class="dropdown-menu pull-right" role="menu">
<li>
<a href="files_new.php">Nuevo archivo</a>
</li>
</ul>
</li>
<li>
<i class="fa fa-file"></i>
<a href="files.php">Archivos</a>
<i class="fa fa-angle-right"></i>
</li>
<li>
<i class="fa fa-file"></i>
<a>Detalle de archivo</a>
</li>
</ul>
<!-- END PAGE TITLE & BREADCRUMB-->
</div>
</div>
<!-- END PAGE HEADER-->
<!-- content -->
<div class="row">
<div class="col-md-12">
<!-- BEGIN SAMPLE TABLE PORTLET-->
<div class="portlet box red">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-th"></i>Detalle
</div>
</div>
<div class="portlet-body flip-scroll">
<?php
$id=intval($_GET['f']);
$sql="SELECT * FROM `files` INNER JOIN users ON user_id=file_author WHERE file_id=:id";
$database->query($sql);
$database->bind(':id', $id);
$row = $database->single();
$seed = '0123456789abcdefghijklmnopqrstuvwxyz';
$hash = sha1(uniqid($seed . mt_rand(), true));
$ext = explode(".", $row['file_filename']);
if($ext[1]=="pdf") {
$icon="pdf.png";
} else if($ext[1]=="xls" || $ext[1]=="xlsx") {
$icon="xls.png";
} else if($ext[1]=="doc" || $ext[1]=="docx") {
$icon="doc.png";
} else if($ext[1]=="jpg" || $ext[1]=="jpeg") {
$icon="pic.png";
} else {
$icon="view.png";
}
$fecha= $row['file_day']." de ".date_mes($row['file_month'])." de ".$row['file_year'];
echo '<p>
<strong>Archivo:</strong> '.$row['file_title'].'<br>
<strong>Creador:</strong> '.$row['user_fullname'].'<br>
<strong>Fecha:</strong> '.$fecha.'<br>
<strong>Descargar:</strong> <a href="download.php?mes='.$hash.'&id='.$row['file_month'].'&file='.$row['file_id'].'&day='.$hash.'&file='.$row['file_filename'].'&y='.$row['file_year'].'&year='.date('Y').$hash.date('m').'"><img title="Ver archivos" src="images/icons/'.$icon.'"></a>
<br><br>
<strong>Comentarios al subir:</strong>
<br>'.utf8_decode($row['file_comment']).'<br>
<br><br>
</p>';
?>
</div>
</div>
<!-- END SAMPLE TABLE PORTLET-->
<!-- Notas PORTLET-->
<div class="portlet box blue">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-th"></i>Comentarios
</div>
</div>
<div class="portlet-body flip-scroll">
<?php
if(intval($_GET['e']==1)) {
echo crear_alerta("error", "<strong>Error:</strong> al crear el comentario");
} else if(intval($_GET['e']==2)) {
echo crear_alerta("success", "<strong>Exito:</strong> comentario creado correctamente");
}
$forma = array(
"action" => "files_comments.php",
"id" => "",
"method" => "post",
"enctype" => 0,
"edit" => 1,
"edit_values" => array(
array("name"=>"id","value"=>$id)
),
"submit" => "Enviar"
);
$fields = array (
array(
"type" => "textarea",
"label" => "Tu comentario",
"icon" => "fa-cogs",
"required" => true,
"name" => "comments",
"value" => "",
"placeholder" => "comentarios sobre el archivo",
"disabled" => false,
"data_values" => array(),
"editor" => false
)
);
echo create_form($forma, $fields);
?>
<br><br>
<table class="table table-bordered table-striped table-condensed flip-content">
<tbody>
<tr>
<td colspan="2">
<strong>Mensajes</strong>
</td>
</tr>
<?php
$sql="SELECT * FROM files_comments INNER JOIN users ON user_id=comments_author WHERE comments_file= :id ORDER BY comments_id DESC";
$database->query($sql);
$database->bind(':id', $id);
$rows = $database->resultset();
foreach($rows as &$row_n) {
echo '<tr>
<td width="35%">
<em>'.$row_n['user_fullname'].'</em> ('.$row_n['comments_date'].')
</td>
<td>
'.$row_n['comments_comment'].'
</td>
</tr>';
}
?>
</tbody>
</table>
</div>
</div>
<!-- END notas PORTLET-->
</div>
</div>
<!-- end content -->
</div>
</div>
<!-- END CONTENT -->
</div>
<!-- END CONTAINER -->
<?php include("includes/footer.php"); ?>