;'; $formats = query2array($query); if (!empty($formats)) { $format_strings = array(); foreach ($formats as $format) { $format_strings[] = sprintf('%s (%.2fMB)', $format['ext'], $format['filesize'] / 1024); } $intro_vars['formats'] = l10n('Formats: %s', implode(', ', $format_strings)); } $template->assign('INTRO', $intro_vars); if (in_array(get_extension($row['path']), $conf['picture_ext'])) { $template->assign('U_COI', get_root_url() . 'admin.php?page=picture_coi&image_id=' . $_GET['image_id']); } // image level options $selected_level = isset($_POST['level']) ? $_POST['level'] : $row['level']; $template->assign(array('level_options' => get_privacy_level_options(), 'level_options_selected' => array($selected_level))); // categories $query = ' SELECT category_id, uppercats FROM ' . IMAGE_CATEGORY_TABLE . ' AS ic INNER JOIN ' . CATEGORIES_TABLE . ' AS c ON c.id = ic.category_id WHERE image_id = ' . $_GET['image_id'] . ' ;'; $result = pwg_query($query); while ($row = pwg_db_fetch_assoc($result)) { $name = get_cat_display_name_cache($row['uppercats'], get_root_url() . 'admin.php?page=album-'); if ($row['category_id'] == $storage_category_id) { $template->assign('STORAGE_CATEGORY', $name); } else { $template->append('related_categories', $name);
} elseif ($conf['picture_slideshow_icon']) { $template->assign(array('U_SLIDESHOW_START' => add_url_params($picture['current']['url'], array('slideshow' => '')))); } $template->assign(array('SECTION_TITLE' => $page['section_title'], 'PHOTO' => $title_nb, 'IS_HOME' => 'categories' == $page['section'] and !isset($page['category']), 'LEVEL_SEPARATOR' => $conf['level_separator'], 'U_UP' => $url_up, 'DISPLAY_NAV_BUTTONS' => $conf['picture_navigation_icons'], 'DISPLAY_NAV_THUMB' => $conf['picture_navigation_thumb'])); if ($conf['picture_metadata_icon']) { $template->assign('U_METADATA', $url_metadata); } //------------------------------------------------------- upper menu management // admin links if (is_admin()) { if (isset($page['category'])) { $template->assign(array('U_SET_AS_REPRESENTATIVE' => add_url_params($url_self, array('action' => 'set_as_representative')))); } $url_admin = get_root_url() . 'admin.php?page=photo-' . $page['image_id'] . (isset($page['category']) ? '&cat_id=' . $page['category']['id'] : ''); $template->assign(array('U_CADDIE' => add_url_params($url_self, array('action' => 'add_to_caddie')), 'U_PHOTO_ADMIN' => $url_admin)); $template->assign('available_permission_levels', get_privacy_level_options()); } // favorite manipulation if (!is_a_guest() and $conf['picture_favorite_icon']) { // verify if the picture is already in the favorite of the user $query = ' SELECT COUNT(*) AS nb_fav FROM ' . FAVORITES_TABLE . ' WHERE image_id = ' . $page['image_id'] . ' AND user_id = ' . $user['id'] . ' ;'; $row = pwg_db_fetch_assoc(pwg_query($query)); $is_favorite = $row['nb_fav'] != 0; $template->assign('favorite', array('IS_FAVORITE' => $is_favorite, 'U_FAVORITE' => add_url_params($url_self, array('action' => !$is_favorite ? 'add_to_favorites' : 'remove_from_favorites')))); } //--------------------------------------------------------- picture information
$tpl_introduction = array('sync' => $_POST['sync'], 'sync_meta' => isset($_POST['sync_meta']) ? true : false, 'display_info' => isset($_POST['display_info']) and $_POST['display_info'] == 1, 'add_to_caddie' => isset($_POST['add_to_caddie']) and $_POST['add_to_caddie'] == 1, 'subcats_included' => isset($_POST['subcats-included']) and $_POST['subcats-included'] == 1, 'privacy_level_selected' => (int) @$_POST['privacy_level'], 'meta_all' => isset($_POST['meta_all']) ? true : false, 'meta_empty_overrides' => isset($_POST['meta_empty_overrides']) ? true : false); if (isset($_POST['cat']) and is_numeric($_POST['cat'])) { $cat_selected = array($_POST['cat']); } else { $cat_selected = array(); } } else { $tpl_introduction = array('sync' => 'dirs', 'sync_meta' => true, 'display_info' => false, 'add_to_caddie' => false, 'subcats_included' => true, 'privacy_level_selected' => 0, 'meta_all' => false, 'meta_empty_overrides' => false); $cat_selected = array(); if (isset($_GET['cat_id'])) { check_input_parameter('cat_id', $_GET, false, PATTERN_ID); $cat_selected = array($_GET['cat_id']); $tpl_introduction['sync'] = 'files'; } } $tpl_introduction['privacy_level_options'] = get_privacy_level_options(); $template->assign('introduction', $tpl_introduction); $query = ' SELECT id,name,uppercats,global_rank FROM ' . CATEGORIES_TABLE . ' WHERE site_id = ' . $site_id; display_select_cat_wrapper($query, $cat_selected, 'category_options', false); if (count($errors) > 0) { foreach ($errors as $error) { $template->append('sync_errors', array('ELEMENT' => $error['path'], 'LABEL' => $error['type'] . ' (' . $error_labels[$error['type']][0] . ')')); } foreach ($error_labels as $error_type => $error_description) { $template->append('sync_error_captions', array('TYPE' => $error_type, 'LABEL' => $error_description[1])); } } if (count($infos) > 0 and isset($_POST['display_info']) and $_POST['display_info'] == 1) {
$tag_ids = array(); if (!empty($_POST['tags-' . $row['id']])) { $tag_ids = get_tag_ids($_POST['tags-' . $row['id']]); } set_tags($tag_ids, $row['id']); } mass_updates(IMAGES_TABLE, array('primary' => array('id'), 'update' => array('name', 'author', 'level', 'comment', 'date_creation')), $datas); $page['infos'][] = l10n('Photo informations updated'); invalidate_user_cache(); } // +-----------------------------------------------------------------------+ // | template init | // +-----------------------------------------------------------------------+ $template->set_filenames(array('batch_manager_unit' => 'batch_manager_unit.tpl')); $base_url = PHPWG_ROOT_PATH . 'admin.php'; $template->assign(array('U_ELEMENTS_PAGE' => $base_url . get_query_string_diff(array('display', 'start')), 'F_ACTION' => $base_url . get_query_string_diff(array()), 'level_options' => get_privacy_level_options())); // +-----------------------------------------------------------------------+ // | global mode thumbnails | // +-----------------------------------------------------------------------+ // how many items to display on this page if (!empty($_GET['display'])) { $page['nb_images'] = intval($_GET['display']); } else { $page['nb_images'] = 5; } if (count($page['cat_elements_id']) > 0) { $nav_bar = create_navigation_bar($base_url . get_query_string_diff(array('start')), count($page['cat_elements_id']), $page['start'], $page['nb_images']); $template->assign(array('navbar' => $nav_bar)); $element_ids = array(); $is_category = false; if (isset($_SESSION['bulk_manager_filter']['category']) and !isset($_SESSION['bulk_manager_filter']['category_recursive'])) {