ORDER BY pm.id DESC
;';
$mailboxes = query2array($query);
foreach ($mailboxes as $idx => $mailbox) {
    $mailboxes[$idx]['album'] = get_cat_display_name_cache($mailbox['uppercats'], null, false);
    $mailboxes[$idx]['data'] = json_encode($mailbox);
}
$template->assign(array('mailboxes' => $mailboxes, 'PWG_TOKEN' => get_pwg_token()));
// list of albums
$query = '
SELECT id,name,uppercats,global_rank
  FROM ' . CATEGORIES_TABLE . '
;';
display_select_cat_wrapper($query, isset($category_options_selected) ? $category_options_selected : array(), 'category_options');
// groups
$query = '
SELECT id
  FROM ' . GROUPS_TABLE . '
;';
$group_ids = query2array($query, null, 'id');
$query = '
SELECT id
  FROM ' . GROUPS_TABLE . '
  WHERE pfemail_notify = \'true\'
;';
$groups_selected = query2array($query, null, 'id');
$template->assign(array('CACHE_KEYS' => get_admin_client_cache_keys(array('groups')), 'groups' => $group_ids, 'groups_selected' => $groups_selected));
// +-----------------------------------------------------------------------+
// | sending html code                                                     |
// +-----------------------------------------------------------------------+
$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
Exemplo n.º 2
0
  WHERE group_id IN (' . implode(',', $group_granted_ids) . ') 
';
    $result = pwg_query($query);
    while ($row = pwg_db_fetch_assoc($result)) {
        if (!isset($granted_groups[$row['group_id']])) {
            $granted_groups[$row['group_id']] = array();
        }
        $granted_groups[$row['group_id']][] = $row['user_id'];
    }
    $user_granted_by_group_ids = array();
    foreach ($granted_groups as $group_users) {
        $user_granted_by_group_ids = array_merge($user_granted_by_group_ids, $group_users);
    }
    $user_granted_by_group_ids = array_unique($user_granted_by_group_ids);
    $user_granted_indirect_ids = array_diff($user_granted_by_group_ids, $user_granted_direct_ids);
    $template->assign('nb_users_granted_indirect', count($user_granted_indirect_ids));
    foreach ($granted_groups as $group_id => $group_users) {
        $group_usernames = array();
        foreach ($group_users as $user_id) {
            if (in_array($user_id, $user_granted_indirect_ids)) {
                $group_usernames[] = $users[$user_id];
            }
        }
        $template->append('user_granted_indirect_groups', array('group_name' => $groups[$group_id], 'group_users' => implode(', ', $group_usernames)));
    }
}
// +-----------------------------------------------------------------------+
// |                           sending html code                           |
// +-----------------------------------------------------------------------+
$template->assign(array('PWG_TOKEN' => get_pwg_token(), 'INHERIT' => $conf['inheritance_by_default'], 'CACHE_KEYS' => get_admin_client_cache_keys(array('groups', 'users'))));
$template->assign_var_from_handle('ADMIN_CONTENT', 'cat_perm');
Exemplo n.º 3
0
//    linked category
// 4. if no category reachable, no jumpto link
$query = '
SELECT category_id
  FROM ' . IMAGE_CATEGORY_TABLE . '
  WHERE image_id = ' . $_GET['image_id'] . '
;';
$authorizeds = array_diff(array_from_query($query, 'category_id'), explode(',', calculate_permissions($user['id'], $user['status'])));
if (isset($_GET['cat_id']) and in_array($_GET['cat_id'], $authorizeds)) {
    $url_img = make_picture_url(array('image_id' => $_GET['image_id'], 'image_file' => $image_file, 'category' => $cache['cat_names'][$_GET['cat_id']]));
} else {
    foreach ($authorizeds as $category) {
        $url_img = make_picture_url(array('image_id' => $_GET['image_id'], 'image_file' => $image_file, 'category' => $cache['cat_names'][$category]));
        break;
    }
}
if (isset($url_img)) {
    $template->assign('U_JUMPTO', $url_img);
}
// associate to albums
$query = '
SELECT id
  FROM ' . CATEGORIES_TABLE . '
    INNER JOIN ' . IMAGE_CATEGORY_TABLE . ' ON id = category_id
  WHERE image_id = ' . $_GET['image_id'] . '
;';
$associated_albums = query2array($query, null, 'id');
$template->assign(array('associated_albums' => $associated_albums, 'represented_albums' => $represented_albums, 'STORAGE_ALBUM' => $storage_category_id, 'CACHE_KEYS' => get_admin_client_cache_keys(array('tags', 'categories'))));
trigger_notify('loc_end_picture_modify');
//----------------------------------------------------------- sending html code
$template->assign_var_from_handle('ADMIN_CONTENT', 'picture_modify');
Exemplo n.º 4
0
    MAX(DATE(date_available))
  FROM ' . IMAGES_TABLE . '
    JOIN ' . IMAGE_CATEGORY_TABLE . ' ON image_id = id
  WHERE category_id = ' . $category['id'] . '
;';
    list($image_count, $min_date, $max_date) = pwg_db_fetch_row(pwg_query($query));
    if ($min_date == $max_date) {
        $intro = l10n('This album contains %d photos, added on %s.', $image_count, format_date($min_date));
    } else {
        $intro = l10n('This album contains %d photos, added between %s and %s.', $image_count, format_date($min_date), format_date($max_date));
    }
} else {
    $intro = l10n('This album contains no photo.');
}
$intro .= '<br>' . l10n('Numeric identifier : %d', $category['id']);
$template->assign(array('INTRO' => $intro, 'U_MANAGE_RANKS' => $base_url . 'element_set_ranks&amp;cat_id=' . $category['id'], 'CACHE_KEYS' => get_admin_client_cache_keys(array('categories'))));
if ($category['is_virtual']) {
    $template->assign(array('U_DELETE' => $self_url . '&amp;delete=' . $category['id'] . '&amp;pwg_token=' . get_pwg_token()));
} else {
    $category['cat_full_dir'] = get_complete_dir($_GET['cat_id']);
    $template->assign(array('CAT_FULL_DIR' => preg_replace('/\\/$/', '', $category['cat_full_dir'])));
    if ($conf['enable_synchronization']) {
        $template->assign('U_SYNC', $base_url . 'site_update&amp;site=1&amp;cat_id=' . $category['id']);
    }
}
// representant management
if ($category['has_images'] or !empty($category['representative_picture_id'])) {
    $tpl_representant = array();
    // picture to display : the identified representant or the generic random
    // representant ?
    if (!empty($category['representative_picture_id'])) {
$template->assign('selected_category', $selected_category);
// image level options
$selected_level = isset($_POST['level']) ? $_POST['level'] : 0;
$template->assign(array('level_options' => get_privacy_level_options(), 'level_options_selected' => array($selected_level)));
// +-----------------------------------------------------------------------+
// | Setup errors/warnings                                                 |
// +-----------------------------------------------------------------------+
// Errors
$setup_errors = array();
$error_message = ready_for_upload_message();
if (!empty($error_message)) {
    $setup_errors[] = $error_message;
}
if (!function_exists('gd_info')) {
    $setup_errors[] = l10n('GD library is missing');
}
$template->assign(array('setup_errors' => $setup_errors, 'CACHE_KEYS' => get_admin_client_cache_keys(array('categories'))));
// Warnings
if (isset($_GET['hide_warnings'])) {
    $_SESSION['upload_hide_warnings'] = true;
}
if (!isset($_SESSION['upload_hide_warnings'])) {
    $setup_warnings = array();
    if ($conf['use_exif'] and !function_exists('read_exif_data')) {
        $setup_warnings[] = l10n('Exif extension not available, admin should disable exif use');
    }
    if (get_ini_size('upload_max_filesize') > get_ini_size('post_max_size')) {
        $setup_warnings[] = l10n('In your php.ini file, the upload_max_filesize (%sB) is bigger than post_max_size (%sB), you should change this setting', get_ini_size('upload_max_filesize', false), get_ini_size('post_max_size', false));
    }
    $template->assign(array('setup_warnings' => $setup_warnings, 'hide_warnings_link' => PHOTOS_ADD_BASE_URL . '&amp;hide_warnings=1'));
}
Exemplo n.º 6
0
    }
    $query .= '
  ' . $conf['order_by'] . '
  LIMIT ' . $page['nb_images'] . ' OFFSET ' . $page['start'] . '
;';
    $result = pwg_query($query);
    while ($row = pwg_db_fetch_assoc($result)) {
        $element_ids[] = $row['id'];
        $src_image = new SrcImage($row);
        $query = '
SELECT
    id,
    name
  FROM ' . IMAGE_TAG_TABLE . ' AS it
    JOIN ' . TAGS_TABLE . ' AS t ON t.id = it.tag_id
  WHERE image_id = ' . $row['id'] . '
;';
        $tag_selection = get_taglist($query);
        $legend = render_element_name($row);
        if ($legend != get_name_from_file($row['file'])) {
            $legend .= ' (' . $row['file'] . ')';
        }
        $template->append('elements', array_merge($row, array('ID' => $row['id'], 'TN_SRC' => DerivativeImage::url(IMG_THUMB, $src_image), 'FILE_SRC' => DerivativeImage::url(IMG_LARGE, $src_image), 'LEGEND' => $legend, 'U_EDIT' => get_root_url() . 'admin.php?page=photo-' . $row['id'], 'NAME' => htmlspecialchars(@$row['name']), 'AUTHOR' => htmlspecialchars(@$row['author']), 'LEVEL' => !empty($row['level']) ? $row['level'] : '0', 'DESCRIPTION' => htmlspecialchars(@$row['comment']), 'DATE_CREATION' => $row['date_creation'], 'TAGS' => $tag_selection)));
    }
    $template->assign(array('ELEMENT_IDS' => implode(',', $element_ids), 'CACHE_KEYS' => get_admin_client_cache_keys(array('tags'))));
}
trigger_notify('loc_end_element_set_unit');
// +-----------------------------------------------------------------------+
// |                           sending html code                           |
// +-----------------------------------------------------------------------+
$template->assign_var_from_handle('ADMIN_CONTENT', 'batch_manager_unit');
Exemplo n.º 7
0
        $query .= '
    JOIN ' . IMAGE_CATEGORY_TABLE . ' ON id = image_id';
    }
    $query .= '
  WHERE id IN (' . implode(',', $page['cat_elements_id']) . ')';
    if ($is_category) {
        $query .= '
    AND category_id = ' . $_SESSION['bulk_manager_filter']['category'];
    }
    $query .= '
  ' . $conf['order_by'] . '
  LIMIT ' . $page['nb_images'] . ' OFFSET ' . $page['start'] . '
;';
    $result = pwg_query($query);
    $thumb_params = ImageStdParams::get_by_type(IMG_THUMB);
    // template thumbnail initialization
    while ($row = pwg_db_fetch_assoc($result)) {
        $nb_thumbs_page++;
        $src_image = new SrcImage($row);
        $ttitle = render_element_name($row);
        if ($ttitle != get_name_from_file($row['file'])) {
            $ttitle .= ' (' . $row['file'] . ')';
        }
        $template->append('thumbnails', array_merge($row, array('thumb' => new DerivativeImage($thumb_params, $src_image), 'TITLE' => $ttitle, 'FILE_SRC' => DerivativeImage::url(IMG_LARGE, $src_image), 'U_EDIT' => get_root_url() . 'admin.php?page=photo-' . $row['id'])));
    }
    $template->assign('thumb_params', $thumb_params);
}
$template->assign(array('nb_thumbs_page' => $nb_thumbs_page, 'nb_thumbs_set' => count($page['cat_elements_id']), 'CACHE_KEYS' => get_admin_client_cache_keys(array('tags', 'categories'))));
trigger_notify('loc_end_element_set_global');
//----------------------------------------------------------- sending html code
$template->assign_var_from_handle('ADMIN_CONTENT', 'batch_manager_global');