diff options
| author | spiderr <spiderr@bitweaver.org> | 2021-02-06 18:27:25 -0500 |
|---|---|---|
| committer | spiderr <spiderr@bitweaver.org> | 2021-02-06 18:27:25 -0500 |
| commit | 19cec5c7f1bda5401745ba51085cf04dc1325488 (patch) | |
| tree | d40bf0793654efa6394d4a20b01ba11f83eea314 | |
| parent | 27cf663db5b6dd51e058927b123f593e02669020 (diff) | |
| download | fisheye-19cec5c7f1bda5401745ba51085cf04dc1325488.tar.gz fisheye-19cec5c7f1bda5401745ba51085cf04dc1325488.tar.bz2 fisheye-19cec5c7f1bda5401745ba51085cf04dc1325488.zip | |
fix default gallery additions
| -rw-r--r-- | .htaccess | 7 | ||||
| -rw-r--r-- | includes/upload_inc.php | 27 |
2 files changed, 22 insertions, 12 deletions
@@ -2,4 +2,11 @@ RewriteEngine on RewriteRule ^image/([0-9]+)(/[0-9/]+)*/?([A-Za-z]+)*$ view_image.php?image_id=$1&gallery_path=$2&size=$3 [L,QSA] RewriteRule ^gallery([0-9/]+)*/([0-9]+)/?$ view.php?gallery_id=$2&gallery_path=$1 [L,QSA] + + RewriteCond %{SCRIPT_FILENAME} -f [OR] + RewriteCond %{SCRIPT_FILENAME}/index.php -f + RewriteRule ^(.*)$ - [L] + + RewriteCond %{SCRIPT_FILENAME}.php -f + RewriteRule ^(.*)$ $1.php [L,QSA] </IfModule> 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; } |
