/** * insertCategory * * @return boolean */ protected function insertCategory() { // If mass_photos_category is set, we already created the category // just set the newCategoryId and move on if (isset($_SESSION['mass_photos_category'])) { $this->newCategoryId = $_SESSION['mass_photos_category']; } else { // Insert new category if (!parent::insertCategory()) { return false; } // Set var so we don't create a category with each file in the upload $_SESSION['mass_photos_category'] = $this->newCategoryId; } return true; }
/** * insertCategory * * Overwrite the base insertCategory function, so we can prevent * multiple categories being created with each photo type. * * @return void */ protected function insertCategory() { // if we are uploading multiple photos at once, // then when only insert category the first time // if mass_photos_category is set, then that means // we already inserted the category, so just move on if (isset($_SESSION['mass_photos_category'])) { $this->newCategoryId = $_SESSION['mass_photos_category']; return true; } // Don't insert category for thumb or full if ($this->formData['photo_type'] !== 'main') { $this->newCategoryId = $_SESSION['photos'][0]['category']; return true; } // Only for main $ret = parent::insertCategory(); if (!$ret) { return false; } // Set var so we don't create a category with each file in the upload $_SESSION['mass_photos_category'] = $this->newCategoryId; return true; }