blob: 6fd11a21cf637eaa4bddaf0bb062b0251fd0e066 (
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
49
50
51
52
|
<?php
/**
* @version $Header: /cvsroot/bitweaver/_bit_liberty/attachment_uploader.php,v 1.6 2007/04/18 20:52:39 nickpalmer Exp $
* @package liberty
* @subpackage functions
*/
/**
* required setup
*/
require_once( '../bit_setup_inc.php' );
require_once(LIBERTY_PKG_PATH."LibertyAttachable.php");
global $gBitSmarty, $gContent;
$gContent = new LibertyAttachable();
if (!empty($_REQUEST['content_id'])) {
$gContent->mContentId = $_REQUEST['content_id'];
}
if (isset($_FILES['upload'])) {
if (!$gContent->storeAttachments($_REQUEST, FALSE)) {
$gBitSmarty->assign('errors', $gContent->mErrors);
}
elseif (empty($gContent->mContentId)) {
// Fake it for preflight
$gContent->mStorage[$_REQUEST['attachment_id']] = $gContent->getAttachment($_REQUEST['attachment_id']);
}
}
// load the attachments up
if (!empty($gContent->mContentId)) {
$gContent->load();
}
elseif (!empty($_REQUEST['existing_attachment_id'])) {
// Fake it for preflight
foreach( $_REQUEST['existing_attachment_id'] as $id) {
if (!empty($id)) {
$gContent->mStorage[$id] = $gContent->getAttachment($id);
}
}
}
// Make them come out in the right order
if (!empty($gContent->mStorage)) {
ksort($gContent->mStorage);
}
$gBitSmarty->assign('gContent', $gContent);
$gBitSmarty->assign('libertyUploader', true);
echo $gBitSmarty->display('bitpackage:liberty/attachment_uploader.tpl');
?>
|