-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathfile.attachables.php
35 lines (28 loc) · 990 Bytes
/
file.attachables.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
<?php
include 'core/Page.php';
if ( !Session::logged_in() ) die;
// get attachable files for user
global $auth, $auth_database;
$f_model=new File($auth_database);
$fi_model=new FileImage($auth_database);
if ( Auth::ACL('su') ) $files=$f_model->All("ORDER BY Uploaded DESC");
else $files=$f_model->Select(array("Uploader"=>$auth['ID']),"*","","Uploaded DESC");
if ( false_or_null($files) ) {
echo 'You have not uploaded any files yet.'; die;
}
echo '<table>';
foreach ( $files as $f ) {
$fi=$fi_model->byFile($f['ID']);
echo '<tr>';
if ( !false_or_null($fi) ) {
$table='FileImage';
echo '<td><img src="'.$fi_model->ThumbName($fi).'"></td>';
} else {
$table='File';
echo '<td>'.$f['Name'].'</td>';
}
echo '<td>'.human_datetime($f['Uploaded']).'</td>';
echo '<td><button onclick="javascript:add_attachment(\''.$table.'\','.$f['ID'].');" class="tinybutton"><span class="fi-plus"></span> Attach</button></td>';
echo '</tr>';
}
echo '</table>';