本文整理汇总了PHP中nggdb::find_all_galleries方法的典型用法代码示例。如果您正苦于以下问题:PHP nggdb::find_all_galleries方法的具体用法?PHP nggdb::find_all_galleries怎么用?PHP nggdb::find_all_galleries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nggdb
的用法示例。
在下文中一共展示了nggdb::find_all_galleries方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nggdb
function npu_plugin_options()
{
?>
<?php
if (current_user_can('manage_options')) {
if (isset($_POST['Submit'])) {
npu_update_options();
echo "<div class=\"updated\">\n" . "<p>" . "<strong>" . __('Settings saved.') . "</strong>" . "</p>\n" . "</div>\n";
}
if (isset($_POST['Restore'])) {
npu_restore_options();
echo "<div class=\"updated\">\n" . "<p>" . "<strong>" . __('Default settings restored.') . "</strong>" . "</p>\n" . "</div>\n";
}
}
?>
<div class="wrap">
<div class="icon32" id="icon-options-general"><br/></div>
<h2>NextGEN Public Uploader</h2>
<p><strong><?php
_e('Author', 'ngg-public-uploader');
?>
:</strong> <a href="http://webdevstudios.com">WebDevStudios</a></p>
<p><strong><?php
_e('Current Version', 'ngg-public-uploader');
?>
:</strong> <?php
echo NG_PUBLIC_UPLOADER_VERSION;
?>
</p>
<p><strong><?php
_e('Shortcode Examples', 'ngg-public-uploader');
?>
: </strong><code>[ngg_uploader]</code> or <code>[ngg_uploader id = 1]</code></p>
<p><strong><a href="http://webdevstudios.com/support/wordpress-plugins/nextgen-public-uploader/"><?php
_e('Visit The Plugin Homepage', 'ngg-public-uploader');
?>
</a></strong></p>
<p><strong><a href="http://webdevstudios.com/support/forum/nextgen-public-uploader/"><?php
_e('Visit The Support Forum', 'ngg-public-uploader');
?>
</a></strong></p>
<p><strong><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3084056"><?php
_e('Donate To This Plugin', 'ngg-public-uploader');
?>
</a></strong></p>
<form method="post">
<input type="hidden" name="action" value="update" />
<?php
wp_nonce_field('update-options');
?>
<input type="hidden" name="npu_update_options" value="1">
<table class="form-table">
<?php
include_once NGGALLERY_ABSPATH . "lib/ngg-db.php";
$nggdb = new nggdb();
$gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
?>
<tr valign="top">
<th scope="row"><?php
_e('Default Gallery ID', 'ngg-public-uploader');
?>
:</th>
<td>
<select name="npu_default_gallery">
<option selected><?php
echo get_option('npu_default_gallery');
?>
</option>
<?php
foreach ($gallerylist as $gallery) {
$name = empty($gallery->title) ? $gallery->name : $gallery->title;
?>
<?php
if (get_option('npu_default_gallery') != $gallery->gid) {
?>
<option <?php
selected($gallery->gid, $gal_id);
?>
value="<?php
echo $gallery->gid;
?>
"><?php
_e($gallery->gid, 'nggallery');
?>
</option>
<?php
}
?>
<?php
}
?>
</select>
<span class="description"><?php
_e('Select the default gallery ID when using', 'ngg-public-uploader');
?>
[ngg_uploader].</span>
//.........这里部分代码省略.........
示例2: form
function form($instance)
{
// Set Defaults
$instance = wp_parse_args((array) $instance, array('gal_id' => '0'));
include_once NGGALLERY_ABSPATH . "lib/ngg-db.php";
$nggdb = new nggdb();
$gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
?>
<p><label for="<?php
echo $this->get_field_id('title');
?>
"><?php
_e('Title:', 'nextgen-public-uploader');
?>
</label>
<input class="widefat" id="<?php
echo $this->get_field_id('title');
?>
" name="<?php
echo $this->get_field_name('title');
?>
" type="text" value="<?php
echo esc_attr($instance['title']);
?>
" /></p>
<p>
<label for="<?php
echo $this->get_field_id('gal_id');
?>
"><?php
_e('Upload to :', 'nextgen-public-uploader');
?>
</label>
<select id="<?php
echo $this->get_field_id('gal_id');
?>
" name="<?php
echo $this->get_field_name('gal_id');
?>
">
<option value="0" ><?php
_e('Choose gallery', 'nextgen-public-uploader');
?>
</option>
<?php
foreach ($gallerylist as $gallery) {
$name = empty($gallery->title) ? $gallery->name : $gallery->title;
echo '<option ' . selected($instance['gal_id'], $gallery->gid, false) . ' value="' . $gallery->gid . '">ID: ' . $gallery->gid . ' – ' . $name . '</option>';
}
?>
</select>
</p>
<?php
}
示例3: npu_upload_control
public function npu_upload_control($widget_args = 1)
{
global $wp_registered_widgets, $wpdb;
static $updated = false;
if (is_numeric($widget_args)) {
$widget_args = array('number' => $widget_args);
}
$widget_args = wp_parse_args($widget_args, array('number' => -1));
extract($widget_args, EXTR_SKIP);
$options = get_option('npu_gal_upload');
if (!is_array($options)) {
$options = array();
}
if (!$updated && !empty($_POST['sidebar'])) {
$sidebar = (string) $_POST['sidebar'];
$sidebar_widgets = wp_get_sidebars_widgets();
if (isset($sidebar_widgets[$sidebar])) {
$this_sidebar =& $sidebar_widgets[$sidebar];
} else {
$this_sidebar = array();
}
foreach ($this_sidebar as $_widget_id) {
if ('npu_gallery_upload' == $wp_registered_widgets[$_widget_id]['classname'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number'])) {
$widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];
if (!in_array("npu-gallery-upload-{$widget_number}", $_POST['widget-id'])) {
unset($options[$widget_number]);
}
}
}
foreach ((array) $_POST['widget_npu_upload'] as $widget_number => $widget_npu_upload) {
if (!isset($widget_npu_upload['gal_id']) && isset($options[$widget_number])) {
continue;
}
$widget_npu_upload = stripslashes_deep($widget_npu_upload);
$options[$widget_number]['title'] = $widget_npu_upload['title'];
$options[$widget_number]['gal_id'] = $widget_npu_upload['gal_id'];
}
update_option('npu_gal_upload', $options);
$updated = true;
}
if (-1 == $number) {
$title = 'Upload';
$gal_id = 0;
$number = '%i%';
} else {
extract((array) $options[$number]);
}
include_once NGGALLERY_ABSPATH . "lib/ngg-db.php";
$nggdb = new nggdb();
$gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
?>
<p>
<label for="npu_upload-title-<?php
echo $number;
?>
"><?php
_e('Title :', 'nggallery');
?>
<input id="npu_upload-title-<?php
echo $number;
?>
" name="widget_npu_upload[<?php
echo $number;
?>
][title]" type="text" class="widefat" value="<?php
echo $title;
?>
" />
</label>
</p>
<p>
<label for="npu_upload-id-<?php
echo $number;
?>
"><?php
_e('Upload to :', 'nggallery');
?>
<select id="npu_upload-id-<?php
echo $number;
?>
" name="widget_npu_upload[<?php
echo $number;
?>
][gal_id]" >
<option value="0" ><?php
_e('Choose gallery', 'nggallery');
?>
</option>
<?php
foreach ($gallerylist as $gallery) {
$name = empty($gallery->title) ? $gallery->name : $gallery->title;
?>
<option <?php
selected($gallery->gid, $gal_id);
?>
value="<?php
echo $gallery->gid;
?>
"><?php
_e($gallery->gid . ' - ' . $name, 'nggallery');
//.........这里部分代码省略.........
示例4: nggallery_admin_add_gallery
function nggallery_admin_add_gallery()
{
global $wpdb, $ngg;
// same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
$filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
// link for the flash file
$swf_upload_link = NGGALLERY_URLPATH . 'admin/upload.php';
$swf_upload_link = wp_nonce_url($swf_upload_link, 'ngg_swfupload');
//flash doesn't seem to like encoded ampersands, so convert them back here
$swf_upload_link = str_replace('&', '&', $swf_upload_link);
$defaultpath = $ngg->options['gallerypath'];
if ($_POST['addgallery']) {
check_admin_referer('ngg_addgallery');
$newgallery = attribute_escape($_POST['galleryname']);
if (!empty($newgallery)) {
nggAdmin::create_gallery($newgallery, $defaultpath);
}
}
if ($_POST['zipupload']) {
check_admin_referer('ngg_addgallery');
if ($_FILES['zipfile']['error'] == 0) {
$messagetext = nggAdmin::import_zipfile(intval($_POST['zipgalselect']));
} else {
nggGallery::show_error(__('Upload failed!', 'nggallery'));
}
}
if ($_POST['importfolder']) {
check_admin_referer('ngg_addgallery');
$galleryfolder = $_POST['galleryfolder'];
if (!empty($galleryfolder) and $defaultpath != $galleryfolder) {
nggAdmin::import_gallery($galleryfolder);
}
}
if ($_POST['uploadimage']) {
check_admin_referer('ngg_addgallery');
if ($_FILES['MF__F_0_0']['error'] == 0) {
$messagetext = nggAdmin::upload_images();
} else {
nggGallery::show_error(__('Upload failed!', 'nggallery'));
}
}
if (isset($_POST['swf_callback'])) {
if ($_POST['galleryselect'] == "0") {
nggGallery::show_error(__('No gallery selected !', 'nggallery'));
} else {
// get the path to the gallery
$galleryID = (int) $_POST['galleryselect'];
$gallerypath = $wpdb->get_var("SELECT path FROM {$wpdb->nggallery} WHERE gid = '{$galleryID}' ");
nggAdmin::import_gallery($gallerypath);
}
}
if (isset($_POST['disable_flash'])) {
check_admin_referer('ngg_addgallery');
$ngg->options['swfUpload'] = false;
update_option('ngg_options', $ngg->options);
}
if (isset($_POST['enable_flash'])) {
check_admin_referer('ngg_addgallery');
$ngg->options['swfUpload'] = true;
update_option('ngg_options', $ngg->options);
}
//get all galleries (after we added new ones)
$gallerylist = nggdb::find_all_galleries();
?>
<?php
if ($ngg->options['swfUpload']) {
?>
<!-- SWFUpload script -->
<script type="text/javascript">
var ngg_swf_upload;
window.onload = function () {
ngg_swf_upload = new SWFUpload({
// Backend settings
upload_url : "<?php
echo $swf_upload_link;
?>
",
flash_url : "<?php
echo NGGALLERY_URLPATH;
?>
admin/js/swfupload.swf",
// Button Settings
button_placeholder_id : "spanButtonPlaceholder",
button_width: 300,
button_height: 27,
button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
button_cursor: SWFUpload.CURSOR.HAND,
// File Upload Settings
file_size_limit : "<?php
echo wp_max_upload_size();
?>
b",
file_types : "*.jpg;*.gif;*.png",
file_types_description : "<?php
_e('Image Files', 'nggallery');
?>
//.........这里部分代码省略.........
示例5: nggdb
<ul>
<li id="rss_tab" class="current"><span><a href="javascript:mcTabs.displayTab('rss_tab','rss_panel');" onmousedown="return false;"><?php
_e("Gallery", 'ngg-public-uploader');
?>
</a></span></li>
</ul>
</div>
<div class="panel_wrapper">
<div id="rss_panel" class="panel current">
<br />
<table border="0" cellpadding="4" cellspacing="0">
<?php
include_once NGGALLERY_ABSPATH . "lib/ngg-db.php";
$nggdb = new nggdb();
$gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
?>
<tr>
<td nowrap="nowrap"><label for="rsstag"><?php
_e("Select Gallery:", 'ngg-public-uploader');
?>
</label></td>
<td>
<select id="rsstag" name="rsstag">
<?php
foreach ($gallerylist as $gallery) {
$name = empty($gallery->title) ? $gallery->name : $gallery->title;
$galleryid = $gallery->gid . ': ';
?>
<option value="<?php
echo $gallery->gid;
示例6: nggallery_manage_gallery_main
function nggallery_manage_gallery_main()
{
global $wpdb, $ngg;
?>
<div class="wrap">
<h2><?php
_e('Gallery Overview', 'nggallery');
?>
</h2>
<br style="clear: both;"/>
<table class="widefat">
<thead>
<tr>
<th scope="col" ><?php
_e('ID');
?>
</th>
<th scope="col" ><?php
_e('Title', 'nggallery');
?>
</th>
<th scope="col" ><?php
_e('Description', 'nggallery');
?>
</th>
<th scope="col" ><?php
_e('Author', 'nggallery');
?>
</th>
<th scope="col" ><?php
_e('Page ID', 'nggallery');
?>
</th>
<th scope="col" ><?php
_e('Quantity', 'nggallery');
?>
</th>
<th scope="col" ><?php
_e('Action');
?>
</th>
</tr>
</thead>
<tbody>
<?php
$gallerylist = nggdb::find_all_galleries('gid', 'asc', TRUE);
if ($gallerylist) {
foreach ($gallerylist as $gallery) {
$class = $class == 'class="alternate"' ? '' : 'class="alternate"';
$gid = $gallery->gid;
$name = empty($gallery->title) ? $gallery->name : $gallery->title;
$author_user = get_userdata((int) $gallery->author);
?>
<tr id="gallery-<?php
echo $gid;
?>
" <?php
echo $class;
?>
>
<th scope="row"><?php
echo $gid;
?>
</th>
<td>
<?php
if (nggAdmin::can_manage_this_gallery($gallery->author)) {
?>
<a href="<?php
echo wp_nonce_url($ngg->manage_page->base_page . "&mode=edit&gid=" . $gid, 'ngg_editgallery');
?>
" class='edit' title="<?php
_e('Edit');
?>
" >
<?php
echo $name;
?>
</a>
<?php
} else {
?>
<?php
echo $gallery->title;
?>
<?php
}
?>
</td>
<td><?php
echo $gallery->galdesc;
?>
</td>
<td><?php
echo $author_user->display_name;
?>
</td>
<td><?php
echo $gallery->pageid;
?>
//.........这里部分代码省略.........
示例7: array
function npu_plugin_settings()
{
// Register our settings section
add_settings_section('npu_settings', __('Plugin Settings', 'nextgen-public-uploader'), 'npu_settings_description', 'nextgen-public-uploader');
// Register all our settings
register_setting('npu_settings', 'npu_default_gallery', 'npu_settings_sanitization');
register_setting('npu_settings', 'npu_user_role_select', 'npu_settings_sanitization');
register_setting('npu_settings', 'npu_image_description_select', 'npu_settings_sanitization');
register_setting('npu_settings', 'npu_exclude_select', 'npu_settings_sanitization');
register_setting('npu_settings', 'npu_notification_email', 'npu_settings_sanitization');
register_setting('npu_settings', 'npu_upload_button', 'npu_settings_sanitization');
register_setting('npu_settings', 'npu_no_file', 'npu_settings_sanitization');
register_setting('npu_settings', 'npu_description_text', 'npu_settings_sanitization');
register_setting('npu_settings', 'npu_notlogged', 'npu_settings_sanitization');
register_setting('npu_settings', 'npu_upload_success', 'npu_settings_sanitization');
register_setting('npu_settings', 'npu_upload_failed', 'npu_settings_sanitization');
register_setting('npu_settings', 'npu_image_link_love', 'npu_settings_sanitization');
// Setup the options for our gallery selector
$gallery_options = array();
include_once NGGALLERY_ABSPATH . 'lib/ngg-db.php';
$nggdb = new nggdb();
$gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
foreach ($gallerylist as $gallery) {
$name = !empty($gallery->title) ? $gallery->title : $gallery->name;
$gallery_options[$gallery->gid] = 'ID: ' . $gallery->gid . ' – ' . $name;
}
// Setup the options for our role selector
$role_options = array('99' => __('Visitor', 'nextgen-public-uploader'), '0' => __('Subscriber', 'nextgen-public-uploader'), '1' => __('Contributor', 'nextgen-public-uploader'), '2' => __('Author', 'nextgen-public-uploader'), '7' => __('Editor', 'nextgen-public-uploader'), '10' => __('Admin', 'nextgen-public-uploader'));
// Add our settings fields
add_settings_field('npu_default_gallery', __('Default Gallery:', 'nextgen-public-uploader'), 'npu_settings_select', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_default_gallery', 'description' => sprintf(__('The default gallery ID when using %s with no ID specified.', 'nextgen-public-uploader'), '<code>[ngg_uploader]</code>'), 'options' => $gallery_options));
add_settings_field('npu_user_role_select', __('Minimum User Role:', 'nextgen-public-uploader'), 'npu_settings_select', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_user_role_select', 'description' => __('The minimum user role required for image uploading.', 'nextgen-public-uploader'), 'options' => $role_options));
add_settings_field('npu_exclude_select', __('Uploads Require Approval:', 'nextgen-public-uploader'), 'npu_settings_checkbox', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_exclude_select', 'description' => '', 'value' => 'Enabled', 'label' => __('Exclude images from appearing in galleries until they have been approved.', 'nextgen-public-uploader')));
add_settings_field('npu_image_description_select', __('Show Description Field:', 'nextgen-public-uploader'), 'npu_settings_checkbox', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_image_description_select', 'description' => '', 'value' => 'Enabled', 'label' => __('Enable the Image Description text field.', 'nextgen-public-uploader')));
add_settings_field('npu_description_text', __('Image Description Label:', 'nextgen-public-uploader'), 'npu_settings_text', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_description_text', 'description' => __('Default label shown for the image description textbox.', 'nextgen-public-uploader')));
add_settings_field('npu_notification_email', __('Notification Email:', 'nextgen-public-uploader'), 'npu_settings_text', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_notification_email', 'description' => __('The email address to be notified when a image has been submitted.', 'nextgen-public-uploader')));
add_settings_field('npu_upload_button', __('Upload Button Text:', 'nextgen-public-uploader'), 'npu_settings_text', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_upload_button', 'description' => __('Custom text for upload button.', 'nextgen-public-uploader')));
add_settings_field('npu_no_file', __('No File Selected Warning:', 'nextgen-public-uploader'), 'npu_settings_text', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_no_file', 'description' => __('Warning displayed when no file has been selected for upload.', 'nextgen-public-uploader')));
add_settings_field('npu_notlogged', __('Unauthorized Warning:', 'nextgen-public-uploader'), 'npu_settings_text', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_notlogged', 'description' => __('Warning displayed when a user does not have permission to upload.', 'nextgen-public-uploader')));
add_settings_field('npu_upload_success', __('Upload Success Message:', 'nextgen-public-uploader'), 'npu_settings_text', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_upload_success', 'description' => __('Message displayed when an image has been successfully uploaded.', 'nextgen-public-uploader')));
add_settings_field('npu_upload_failed', __('Upload Failed Message:', 'nextgen-public-uploader'), 'npu_settings_text', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_upload_failed', 'description' => __('Message displayed when an image failed to upload.', 'nextgen-public-uploader')));
add_settings_field('npu_image_link_love', __('Link Love:', 'nextgen-public-uploader'), 'npu_settings_checkbox', 'nextgen-public-uploader', 'npu_settings', array('ID' => 'npu_image_link_love', 'description' => '', 'value' => true, 'label' => __('Display link to this plugin in your site\'s footer (because you love us!)', 'nextgen-public-uploader')));
}
示例8: nggallery_picturelist
function nggallery_picturelist()
{
// *** show picture list
global $wpdb, $user_ID, $ngg;
// GET variables
$act_gid = $ngg->manage_page->gid;
$showTags = $ngg->manage_page->showTags;
$hideThumbs = $ngg->manage_page->hideThumbs;
// Load the gallery metadata
$gallery = nggdb::find_gallery($act_gid);
if (!$gallery) {
nggGallery::show_error(__('Gallery not found.', 'nggallery'));
return;
}
// get picture values
$picturelist = nggdb::get_gallery($act_gid, $ngg->options['galSort'], $ngg->options['galSortDir'], false);
// get the current author
$act_author_user = get_userdata((int) $gallery->author);
// list all galleries
$gallerylist = nggdb::find_all_galleries();
?>
<script type="text/javascript">
function showDialog( windowId ) {
var form = document.getElementById('updategallery');
var elementlist = "";
for (i = 0, n = form.elements.length; i < n; i++) {
if(form.elements[i].type == "checkbox") {
if(form.elements[i].name == "doaction[]")
if(form.elements[i].checked == true)
if (elementlist == "")
elementlist = form.elements[i].value
else
elementlist += "," + form.elements[i].value ;
}
}
jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
jQuery("#" + windowId + "_imagelist").val(elementlist);
// console.log (jQuery("#TB_imagelist").val());
tb_show("", "#TB_inline?width=640&height=120&inlineId=" + windowId + "&modal=true", false);
}
</script>
<script type="text/javascript">
<!--
function checkAll(form)
{
for (i = 0, n = form.elements.length; i < n; i++) {
if(form.elements[i].type == "checkbox") {
if(form.elements[i].name == "doaction[]") {
if(form.elements[i].checked == true)
form.elements[i].checked = false;
else
form.elements[i].checked = true;
}
}
}
}
function getNumChecked(form)
{
var num = 0;
for (i = 0, n = form.elements.length; i < n; i++) {
if(form.elements[i].type == "checkbox") {
if(form.elements[i].name == "doaction[]")
if(form.elements[i].checked == true)
num++;
}
}
return num;
}
// this function check for a the number of selected images, sumbmit false when no one selected
function checkSelected() {
var numchecked = getNumChecked(document.getElementById('updategallery'));
if(numchecked < 1) {
alert('<?php
echo js_escape(__("No images selected", 'nggallery'));
?>
');
return false;
}
//TODO: For copy to and move to we need some better way around
if (jQuery('#bulkaction').val() == 'copy_to') {
showDialog('selectgallery');
return false;
}
if (jQuery('#bulkaction').val() == 'move_to') {
showDialog('selectgallery');
return false;
}
return confirm('<?php
echo sprintf(js_escape(__("You are about to start the bulk edit for %s images \n \n 'Cancel' to stop, 'OK' to proceed.", 'nggallery')), "' + numchecked + '");
?>
');
}
//.........这里部分代码省略.........
示例9: header
$rss = '';
if ($mode == 'last_pictures') {
// Get additional parameters
$page = (int) $_GET["page"];
if (!isset($page) || $page == '') {
$page = 0;
}
$show = (int) $_GET["show"];
if (!isset($show) || $show == '' || $show == 0) {
$show = 10;
}
$rss = nggMediaRss::get_last_pictures_mrss($page, $show);
} else {
if ($mode == 'gallery') {
// Get all galleries
$galleries = nggdb::find_all_galleries();
if (count($galleries) == 0) {
header('content-type:text/plain;charset=utf-8');
echo sprintf(__("No galleries have been yet created.", "nggallery"), $gid);
exit;
}
// Get additional parameters
$gid = (int) $_GET['gid'];
//if no gid is present, take the first gallery
if (!isset($gid) || $gid == '' || $gid == 0) {
$first = current($galleries);
$gid = $first->gid;
}
// Set the main gallery object
$gallery = $galleries[$gid];
if (!isset($gallery) || $gallery == null) {