pwg_query($query); break; } } else { if (isset($_POST['trueify']) and isset($_POST['cat_false']) and count($_POST['cat_false']) > 0) { switch ($_GET['section']) { case 'comments': $query = ' UPDATE ' . CATEGORIES_TABLE . ' SET commentable = \'true\' WHERE id IN (' . implode(',', $_POST['cat_false']) . ') ;'; pwg_query($query); break; case 'visible': set_cat_visible($_POST['cat_false'], 'true'); break; case 'status': set_cat_status($_POST['cat_false'], 'public'); break; case 'representative': // theoretically, all categories in $_POST['cat_false'] contain at // least one element, so Piwigo can find a representant. set_random_representant($_POST['cat_false']); break; } } } // +-----------------------------------------------------------------------+ // | template init | // +-----------------------------------------------------------------------+
single_update(CATEGORIES_TABLE, $data, array('id' => $data['id'])); if (isset($_POST['apply_commentable_on_sub'])) { $subcats = get_subcat_ids(array('id' => $data['id'])); $query = ' UPDATE ' . CATEGORIES_TABLE . ' SET commentable = \'' . $data['commentable'] . '\' WHERE id IN (' . implode(',', $subcats) . ') ;'; pwg_query($query); } // retrieve cat infos before continuing (following updates are expensive) $cat_info = get_cat_info($_GET['cat_id']); if ($_POST['visible'] == 'true_sub') { set_cat_visible(array($_GET['cat_id']), true, true); } elseif ($cat_info['visible'] != get_boolean($_POST['visible'])) { set_cat_visible(array($_GET['cat_id']), $_POST['visible']); } // in case the use moves his album to the gallery root, we force // $_POST['parent'] from 0 to null to be compared with // $cat_info['id_uppercat'] if (empty($_POST['parent'])) { $_POST['parent'] = null; } // only move virtual albums if (empty($cat_info['dir']) and $cat_info['id_uppercat'] != $_POST['parent']) { move_categories(array($_GET['cat_id']), $_POST['parent']); } $_SESSION['page_infos'][] = l10n('Album updated successfully'); $redirect = true; } elseif (isset($_POST['set_random_representant'])) { set_random_representant(array($_GET['cat_id']));