diff options
Diffstat (limited to 'admin')
-rw-r--r-- | admin/element_set_global.php | 25 | ||||
-rw-r--r-- | admin/include/functions.php | 1 | ||||
-rw-r--r-- | admin/picture_modify.php | 22 | ||||
-rw-r--r-- | admin/rating.php | 1 |
4 files changed, 36 insertions, 13 deletions
diff --git a/admin/element_set_global.php b/admin/element_set_global.php index 4b22f112f..e0df2d96b 100644 --- a/admin/element_set_global.php +++ b/admin/element_set_global.php @@ -107,9 +107,13 @@ SELECT id INNER JOIN '.IMAGES_TABLE.' ON image_id = id WHERE category_id = '.$_POST['dissociate'].' AND id IN ('.implode(',', $collection).') - AND category_id != storage_category_id + AND ( + category_id != storage_category_id + OR storage_category_id IS NULL + ) ;'; $dissociables = array_from_query($query, 'id'); + echo '<pre>'; print_r($dissociables); echo '</pre>'; if (!empty($dissociables)) { @@ -245,14 +249,19 @@ display_select_cat_wrapper($query, array(), 'associate_options', true); if (count($page['cat_elements_id']) > 0) { $query = ' -SELECT DISTINCT(category_id) AS id, c.name, uppercats, global_rank - FROM '.IMAGE_CATEGORY_TABLE.' AS ic, - '.CATEGORIES_TABLE.' AS c, - '.IMAGES_TABLE.' AS i +SELECT + DISTINCT(category_id) AS id, + c.name, + c.uppercats, + c.global_rank + FROM '.IMAGE_CATEGORY_TABLE.' AS ic + JOIN '.CATEGORIES_TABLE.' AS c ON c.id = ic.category_id + JOIN '.IMAGES_TABLE.' AS i ON i.id = ic.image_id WHERE ic.image_id IN ('.implode(',', $page['cat_elements_id']).') - AND ic.category_id = c.id - AND ic.image_id = i.id - AND ic.category_id != i.storage_category_id + AND ( + ic.category_id != i.storage_category_id + OR i.storage_category_id IS NULL + ) ;'; display_select_cat_wrapper($query, array(), 'dissociate_options', true); } diff --git a/admin/include/functions.php b/admin/include/functions.php index af98d1cb3..fb482c3aa 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -1057,6 +1057,7 @@ function update_path() $query = ' SELECT DISTINCT(storage_category_id) FROM '.IMAGES_TABLE.' + WHERE storage_category_id IS NOT NULL ;'; $cat_ids = array_from_query($query, 'storage_category_id'); $fulldirs = get_fulldirs($cat_ids); diff --git a/admin/picture_modify.php b/admin/picture_modify.php index d9437eb20..5c71610da 100644 --- a/admin/picture_modify.php +++ b/admin/picture_modify.php @@ -177,7 +177,12 @@ SELECT * ;'; $row = mysql_fetch_array(pwg_query($query)); -$storage_category_id = $row['storage_category_id']; +$storage_category_id = null; +if (!empty($row['storage_category_id'])) +{ + $storage_category_id = $row['storage_category_id']; +} + $image_file = $row['file']; // tags @@ -397,13 +402,22 @@ $query = ' SELECT id,name,uppercats,global_rank FROM '.CATEGORIES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = category_id - WHERE image_id = '.$_GET['image_id'].' - AND id != '.$storage_category_id.' + WHERE image_id = '.$_GET['image_id']; +if (isset($storage_category_id)) +{ + $query.= ' + AND id != '.$storage_category_id; +} +$query.= ' ;'; display_select_cat_wrapper($query, array(), 'associated_options'); $result = pwg_query($query); -$associateds = array($storage_category_id); +$associateds = array(); +if (isset($storage_category_id)) +{ + array_push($associateds, $storage_category_id); +} while ($row = mysql_fetch_array($result)) { array_push($associateds, $row['id']); diff --git a/admin/rating.php b/admin/rating.php index 53ec75a7f..a9aa12712 100644 --- a/admin/rating.php +++ b/admin/rating.php @@ -167,7 +167,6 @@ SELECT i.id, i.file, i.tn_ext, i.average_rate, - i.storage_category_id, MAX(r.date) AS recently_rated, COUNT(r.rate) AS nb_rates, SUM(r.rate) AS sum_rates, |