summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspiderr <spiderr@bitweaver.org>2024-03-18 14:45:23 -0400
committerspiderr <spiderr@bitweaver.org>2024-03-18 14:45:23 -0400
commitfd8528d52f1be3e8794ab743f8e66442164a8c1f (patch)
tree5db7544091e0316e855edeaecf6d8965f5fd1715
parent0511f8c46fe11bfe814f4bc3e92aae91258a969d (diff)
downloadfisheye-fd8528d52f1be3e8794ab743f8e66442164a8c1f.tar.gz
fisheye-fd8528d52f1be3e8794ab743f8e66442164a8c1f.tar.bz2
fisheye-fd8528d52f1be3e8794ab743f8e66442164a8c1f.zip
add pRequest to fisheye_handle_upload; cleanup some upload gallery_additions; tidy GetRow to avoid null results processing FisheyeGallery
-rw-r--r--includes/classes/FisheyeGallery.php11
-rw-r--r--includes/upload_inc.php16
2 files changed, 16 insertions, 11 deletions
diff --git a/includes/classes/FisheyeGallery.php b/includes/classes/FisheyeGallery.php
index 7b1fe21..745b50a 100644
--- a/includes/classes/FisheyeGallery.php
+++ b/includes/classes/FisheyeGallery.php
@@ -117,17 +117,18 @@ class FisheyeGallery extends FisheyeBase {
LEFT JOIN `".BIT_DB_PREFIX."users_users` uuc ON (uuc.`user_id` = lc.`user_id`)
$whereSql";
- if( $rs = $this->mDb->query($query, $bindVars) ) {
- $this->mInfo = $rs->fields;
- $this->mContentId = $rs->fields['content_id'];
+ if( $rowHash = $this->mDb->GetRow($query, $bindVars) ) {
+ $this->mInfo = $rowHash;
+ $this->mContentId = $rowHash['content_id'];
+
LibertyContent::load();
if( @$this->verifyId($this->mInfo['gallery_id'] ) ) {
$this->mGalleryId = $this->mInfo['gallery_id'];
$this->mContentId = $this->mInfo['content_id'];
- $this->mInfo['creator'] = (isset( $rs->fields['creator_real_name'] ) ? $rs->fields['creator_real_name'] : $rs->fields['creator_user'] );
- $this->mInfo['editor'] = (isset( $rs->fields['modifier_real_name'] ) ? $rs->fields['modifier_real_name'] : $rs->fields['modifier_user'] );
+ $this->mInfo['creator'] = (isset( $rowHash['creator_real_name'] ) ? $rowHash['creator_real_name'] : $rowHash['creator_user'] );
+ $this->mInfo['editor'] = (isset( $rowHash['modifier_real_name'] ) ? $rowHash['modifier_real_name'] : $rowHash['modifier_user'] );
// Set some basic defaults for how to display a gallery if they're not already set
if (empty($this->mInfo['thumbnail_size'])) {
diff --git a/includes/upload_inc.php b/includes/upload_inc.php
index b136452..c3f1c64 100644
--- a/includes/upload_inc.php
+++ b/includes/upload_inc.php
@@ -9,7 +9,7 @@
/**
* fisheye_handle_upload
*/
-function fisheye_handle_upload( &$pFiles ) {
+function fisheye_handle_upload( &$pFiles, &$pRequest ) {
global $gBitUser, $gContent, $gBitSystem, $fisheyeErrors, $fisheyeWarnings, $fisheyeSuccess, $gFisheyeUploads;
// first of all set the execution time for this process to unlimited
@@ -32,6 +32,15 @@ function fisheye_handle_upload( &$pFiles ) {
}
}
+ if( !is_object( $gContent ) || !$gContent->isValid() ) {
+ $gContent = new FisheyeGallery( $_REQUEST['gallery_additions'][0] );
+ if( !$gContent->load() ) {
+ unset( $gContent );
+ $_REQUEST['gallery_additions'] = array( fisheye_get_default_gallery_id( $gBitUser->mUserId, $gBitUser->getDisplayName()."'s Gallery" ) );
+ }
+ }
+
+
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'] ) ) {
@@ -61,11 +70,6 @@ function fisheye_handle_upload( &$pFiles ) {
$upErrors = array_merge( $upErrors, fisheye_store_upload( $upImages[$key], $upData[$key], !empty( $_REQUEST['rotate_image'] )));
}
- if( !is_object( $gContent ) || !$gContent->isValid() ) {
- $gContent = new FisheyeGallery( $_REQUEST['gallery_additions'][0] );
- $gContent->load();
- }
-
if( !empty( $gFisheyeUploads ) ){
$_REQUEST['uploaded_objects'] = &$gFisheyeUploads;
$gContent->invokeServices( "content_post_upload_function", $_REQUEST );