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
|
<?php
require_once( '../bit_setup_inc.php' );
require_once( FISHEYE_PKG_PATH.'FisheyeGallery.php');
require_once( FISHEYE_PKG_PATH.'FisheyeImage.php');
global $gBitSystem;
include_once( FISHEYE_PKG_PATH.'gallery_lookup_inc.php' );
include_once( FISHEYE_PKG_PATH.'image_lookup_inc.php' );
if ( (!empty($gContent->mImageId)) && ($gContent->mInfo['user_id'] != $gBitUser->mUserId && !$gBitUser->isAdmin()) ) {
// This user does not own this image and they are not an Administrator
$smarty->assign( 'msg', tra( "You do not own this image!" ) );
$gBitSystem->display( "error.tpl" );
die;
}
if( !empty($_REQUEST['saveImage']) || !empty($_REQUEST['regenerateThumbnails'] ) ) {
if (empty($_REQUEST['gallery_id']) && empty($_REQUEST['image_id'])) {
// We have no way to know what gallery to add an image to or what image to edit!
$smarty->assign( 'msg', tra( "No gallery or image was specified" ) );
$gBitSystem->display( "error.tpl" );
die;
}
// Store/Update the image
if (isset($_FILES['imageFile']) && is_uploaded_file($_FILES['imageFile']['tmp_name'])) {
$_REQUEST['upload'] = &$_FILES['imageFile'];
$_REQUEST['upload']['process_storage'] = STORAGE_IMAGE;
}
$_REQUEST['purge_from_galleries'] = TRUE;
if( !empty( $_REQUEST['rotate_image'] ) ) {
$gContent->rotateImage( $_REQUEST['rotate_image'] );
}
if( $gContent->store($_REQUEST) ) {
$gContent->addToGalleries( $_REQUEST['galleryAdditions'] );
// maybe we need to resize the original and generate thumbnails
if( !empty( $_REQUEST['resize'] ) ) {
$gContent->resizeOriginal( $_REQUEST['resize'] );
}
if( !empty( $_REQUEST['generate_thumbnails'] ) ) {
$gContent->generateThumbnails();
}
if ( $gBitSystem->isPackageActive('categories') ) {
$cat_desc = $gLibertySystem->mContentTypes[FISHEYEIMAGE_CONTENT_TYPE_GUID]['content_description'].' by '.$gBitUser->getDisplayName( FALSE, array( 'real_name' => $gContent->mInfo['creator_real_name'], 'user' => $gContent->mInfo['creator_user'], 'user_id'=>$gContent->mInfo['user_id'] ) );
$cat_name = $gContent->getTitle();
$cat_href = $gContent->getDisplayUrl();
$cat_objid = $gContent->mContentId;
$cat_obj_type = FISHEYEIMAGE_CONTENT_TYPE_GUID;
include_once( CATEGORIES_PKG_PATH.'categorize_inc.php' );
}
if( empty( $gContent->mErrors ) ) {
// add a refresh parameter to the URL so the thumbnails will properly refresh first go reload
header( 'Location: '.$gContent->getDisplayUrl().($gBitSystem->isFeatureActive( 'pretty_urls' ) ? '?' : '&' ).'refresh=1' );
die;
}
}
} elseif( !empty($_REQUEST['delete']) ) {
$gContent->hasUserPermission( 'bit_p_admin_fisheye', TRUE, tra( "You do not have permission to delete this image." ) );
if( !empty( $_REQUEST['cancel'] ) ) {
// user cancelled - just continue on, doing nothing
} elseif( empty( $_REQUEST['confirm'] ) ) {
$formHash['delete'] = TRUE;
$formHash['image_id'] = $gContent->mImageId;
$gBitSystem->confirmDialog( $formHash, array( 'warning' => 'Are you sure you want to delete the image '.$gContent->getTitle().'? <p> It will be removed from all galleries to which it belongs.</p>' ) );
} else {
if( $gContent->expunge() ) {
$url = ( is_object( $gGallery ) ? $gGallery->getDisplayUrl() : FISHEYE_PKG_URL );
header( "Location: $url" );
}
}
}
$errors = $gContent->mErrors;
$smarty->assign_by_ref('errors', $errors);
$gContent->loadParentGalleries();
// Get a list of all existing galleries
$gFisheyeGallery = new FisheyeGallery();
$listHash = array( 'user_id'=>$gContent->mInfo['user_id'], 'max_records' => -1 );
$galleryList = $gFisheyeGallery->getList( $listHash );
$smarty->assign_by_ref('galleryList', $galleryList);
$smarty->assign('requested_gallery', !empty($_REQUEST['gallery_id']) ? $_REQUEST['gallery_id'] : NULL);
if( $gBitSystem->isPackageActive( 'gatekeeper' ) ) {
global $gGatekeeper;
$smarty->assign( 'securities', $gGatekeeper->getSecurityList( $gBitUser->mUserId ) );
}
$gBitSystem->display( 'bitpackage:fisheye/edit_image.tpl', 'Edit Image: '.$gContent->getTitle() );
?>
|