summaryrefslogtreecommitdiff
path: root/attachments.php
blob: 945ad12411739cbc02e73d07dc398251b316b5e2 (plain)
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
<?php

/**
 * attachment_browser
 *
 * @author   spider <spider@steelsun.com>
 * @version  $Revision$
 * @package  liberty
 * @subpackage functions
 */

/**
 * bit setup
 */
use Bitweaver\KernelTools;
use Bitweaver\Liberty\LibertyMime;

require_once("../kernel/includes/setup_inc.php");

$gContent = new LibertyMime();

if( !$gBitUser->isRegistered() ) {
	$gBitSystem->fatalError( KernelTools::tra( 'You need to be logged in to view this page.' ));
}

$feedback = [];
$listHash = &$_REQUEST;
if( $gBitUser->isAdmin() ) {
	if( !empty( $listHash['login'] ) && $listHash['login'] == 'all' ) {
		$listHash['user_id'] = null;
	} elseif( !empty( $listHash['login'] ) ) {
		if( $userInfo = $gBitUser->getUserInfo( [ 'login' => $listHash['login'] ] ) ) {
			$listHash['user_id'] = $userInfo['user_id'];
		} else {
			$feedback['error'] = KernelTools::tra( 'That user does not exist.' );
		}
	} else {
		$listHash['user_id'] = $gBitUser->mUserId;
	}
} else {
	$listHash['user_id'] = $gBitUser->mUserId;
}
$attachments = $gContent->getAttachmentList( $listHash );

$gBitSmarty->assign( 'listInfo', $listHash['listInfo'] );
$gBitSmarty->assign( 'attachments', $attachments );
$gBitSmarty->assign( 'feedback', $feedback );
$gBitSystem->display( 'bitpackage:liberty/attachments.tpl', KernelTools::tra( 'Attachments' ), [ 'display_mode' => 'display' ]);