allow setting of image_order via add_post()

This commit is contained in:
Daku 2014-05-30 15:21:32 +01:00
parent bca4fdffa5
commit 77769d2c17

View File

@ -1,7 +1,7 @@
<?php <?php
/** /**
* Name: Pools System * Name: Pools System
* Author: Sein Kraft <mail@seinkraft.info>, jgen <jgen.tech@gmail.com> * Author: Sein Kraft <mail@seinkraft.info>, jgen <jgen.tech@gmail.com>, Daku <admin@codeanimu.net>
* License: GPLv2 * License: GPLv2
* Description: Allow users to create groups of images and order them. * Description: Allow users to create groups of images and order them.
* Documentation: This extension allows users to created named groups of * Documentation: This extension allows users to created named groups of
@ -903,14 +903,13 @@ class Pools extends Extension {
* @param int $poolID * @param int $poolID
* @param int $imageID * @param int $imageID
* @param bool $history * @param bool $history
* @param int $imageOrder
*/ */
private function add_post(/*int*/ $poolID, /*int*/ $imageID, $history=false) { private function add_post(/*int*/ $poolID, /*int*/ $imageID, $history=false, $imageOrder=0) {
global $database, $config; global $database, $config;
if(!$this->check_post($poolID, $imageID)) { if(!$this->check_post($poolID, $imageID)) {
$imageOrder = 0; if($config->get_bool("poolsAutoIncrementOrder") && $imageOrder === 0){
if($config->get_bool("poolsAutoIncrementOrder")){
$imageOrder = $database->get_one(" $imageOrder = $database->get_one("
SELECT CASE WHEN image_order IS NOT NULL THEN MAX(image_order) + 1 ELSE 0 END SELECT CASE WHEN image_order IS NOT NULL THEN MAX(image_order) + 1 ELSE 0 END
FROM pool_images FROM pool_images