summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorspiderr <spiderr@bitweaver.org>2021-02-06 18:27:25 -0500
committerspiderr <spiderr@bitweaver.org>2021-02-06 18:27:25 -0500
commit19cec5c7f1bda5401745ba51085cf04dc1325488 (patch)
treed40bf0793654efa6394d4a20b01ba11f83eea314 /includes
parent27cf663db5b6dd51e058927b123f593e02669020 (diff)
downloadfisheye-19cec5c7f1bda5401745ba51085cf04dc1325488.tar.gz
fisheye-19cec5c7f1bda5401745ba51085cf04dc1325488.tar.bz2
fisheye-19cec5c7f1bda5401745ba51085cf04dc1325488.zip
fix default gallery additions
Diffstat (limited to 'includes')
-rw-r--r--includes/upload_inc.php27
1 files changed, 15 insertions, 12 deletions
diff --git a/includes/upload_inc.php b/includes/upload_inc.php
index 90957fb..b136452 100644
--- a/includes/upload_inc.php
+++ b/includes/upload_inc.php
@@ -23,6 +23,15 @@ function fisheye_handle_upload( &$pFiles ) {
$i = 0;
usort( $pFiles, 'fisheye_sort_uploads' );
+ // No gallery was specified, let's try to find one or create one.
+ if( empty( $_REQUEST['gallery_additions'] ) ) {
+ if( $gBitUser->hasPermission( 'p_fisheye_create' )) {
+ $_REQUEST['gallery_additions'] = array( fisheye_get_default_gallery_id( $gBitUser->mUserId, $gBitUser->getDisplayName()."'s Gallery" ) );
+ } else {
+ $gBitSystem->fatalError( tra( "You don't have permissions to create a new gallery. Please select an existing one to insert your images to." ));
+ }
+ }
+
foreach( array_keys( $pFiles ) as $key ) {
$pFiles[$key]['type'] = $gBitSystem->verifyMimeType( $pFiles[$key]['tmp_name'] );
if( preg_match( '/(^image|pdf|vnd)/i', $pFiles[$key]['type'] ) ) {
@@ -36,18 +45,8 @@ function fisheye_handle_upload( &$pFiles ) {
} elseif( !empty( $pFiles[$key]['tmp_name'] ) && !empty( $pFiles[$key]['name'] ) ) {
$upArchives[$key] = $pFiles[$key];
}
- $i++;
- }
- $gallery_additions = array();
-
- // No gallery was specified, let's try to find one or create one.
- if( empty( $_REQUEST['gallery_additions'] ) ) {
- if( $gBitUser->hasPermission( 'p_fisheye_create' )) {
- $upData['gallery_additions'] = array( fisheye_get_default_gallery_id( $gBitUser->mUserId, $gBitUser->getDisplayName()."'s Gallery" ) );
- } else {
- $gBitSystem->fatalError( tra( "You don't have permissions to create a new gallery. Please select an existing one to insert your images to." ));
- }
+ $i++;
}
foreach( array_keys( $upArchives ) as $key ) {
@@ -135,7 +134,11 @@ function fisheye_store_upload( &$pFileHash, $pImageData = array(), $pAutoRotate=
if( $pAutoRotate ) {
$image->rotateImage( 'auto' );
}
- $image->addToGalleries( BitBase::getParameter( $pImageData, 'gallery_additions' ) );
+ if( !($galleryAdditions = BitBase::getParameter( $pImageData, 'gallery_additions' )) ) {
+ global $gBitUser;
+ $galleryAdditions = array( fisheye_get_default_gallery_id( $gBitUser->mUserId, $gBitUser->getDisplayName()."'s Gallery" ) );
+ }
+ $image->addToGalleries( $galleryAdditions );
$gFisheyeUploads[] = $image;
}