I'm getting the following error: Parse error: syntax error, unexpected T_ELSE in /public_html/wp-content/plugins/nextgen-gallery/nggfunctions.php on line 1283
Here are lines 1000 through 1300:
// get the id's of the preview images
// Line 1000
$imagesID = array();
if ( is_array($unsort_galleries) ) {
foreach ($unsort_galleries as $gallery_row)
$imagesID[] = $gallery_row->previewpic;
}
$albumPreview = $wpdb->get_results('SELECT pid, filename FROM '.$wpdb->nggpictures.' WHERE pid IN (\''.implode('\',\'', $imagesID).'\')', OBJECT_K);
// re-order them and populate some
foreach ($sortorder as $key) {
//if we have a prefix 'a' then it's a subalbum, instead a gallery
if (substr( $key, 0, 1) == 'a') {
// get the album content
if ( !$subalbum = $nggdb->find_album(substr( $key, 1)) )
continue;
//populate the sub album values
$galleries[$key]->counter = 0;
if ($subalbum->previewpic > 0)
$image = $nggdb->find_image( $subalbum->previewpic );
$galleries[$key]->previewpic = $subalbum->previewpic;
$galleries[$key]->previewurl = isset($image->thumbURL) ? $image->thumbURL : '';
$galleries[$key]->previewname = $subalbum->name;
//link to the subalbum
$args['album'] = ( $ngg_options['usePermalinks'] ) ? $subalbum->slug : $subalbum->id;
$args['gallery'] = false;
$args['nggpage'] = false;
$pageid = (isset($subalbum->pageid) ? $subalbum->pageid : 0);
if ($pageid > 0) {
$galleries[$key]->pagelink = get_permalink($pageid);
} else {
$galleries[$key]->pagelink = $nggRewrite->get_permalink($args);
}
$galleries[$key]->galdesc = html_entity_decode ( nggGallery::i18n($subalbum->albumdesc) );
$galleries[$key]->title = html_entity_decode ( nggGallery::i18n($subalbum->name) );
// apply a filter on gallery object before the output
$galleries[$key] = apply_filters('ngg_album_galleryobject', $galleries[$key]);
continue;
}
// If a gallery is not found it should be ignored
if (!$unsort_galleries[$key])
continue;
// Add the counter value if avaible
$galleries[$key] = $unsort_galleries[$key];
//Line 1100
// add the file name and the link
if ($galleries[$key]->previewpic != 0) {
$galleries[$key]->previewname = $albumPreview[$galleries[$key]->previewpic]->filename;
$galleries[$key]->previewurl = site_url().'/' . $galleries[$key]->path . '/thumbs/thumbs_' . $albumPreview[$galleries[$key]->previewpic]->filename;
} else {
$first_image = $wpdb->get_row('SELECT * FROM '. $wpdb->nggpictures .' WHERE exclude != 1 AND galleryid = '. $key .' ORDER by pid DESC limit 0,1');
$galleries[$key]->previewpic = $first_image->pid;
$galleries[$key]->previewname = $first_image->filename;
$galleries[$key]->previewurl = site_url() . '/' . $galleries[$key]->path . '/thumbs/thumbs_' . $first_image->filename;
}
// choose between variable and page link
if ($ngg_options['galNoPages']) {
$args['album'] = ( $ngg_options['usePermalinks'] ) ? $album->slug : $album->id;
$args['gallery'] = ( $ngg_options['usePermalinks'] ) ? $galleries[$key]->slug : $key;
$args['nggpage'] = false;
$galleries[$key]->pagelink = $nggRewrite->get_permalink($args);
} else {
$galleries[$key]->pagelink = get_permalink( $galleries[$key]->pageid );
}
// description can contain HTML tags
$galleries[$key]->galdesc = html_entity_decode ( stripslashes($galleries[$key]->galdesc) ) ;
// i18n
$galleries[$key]->title = html_entity_decode ( nggGallery::i18n( stripslashes($galleries[$key]->title) ) ) ;
// apply a filter on gallery object before the output
$galleries[$key] = apply_filters('ngg_album_galleryobject', $galleries[$key]);
}
// check for page navigation
if ($maxElement > 0) {
if ( !is_home() || $pageid == get_the_ID() ) {
$page = ( !empty( $nggpage ) ) ? (int) $nggpage : 1;
}
else $page = 1;
$start = $offset = ( $page - 1 ) * $maxElement;
$total = count($galleries);
// remove the element if we didn't start at the beginning
if ($start > 0 ) array_splice($galleries, 0, $start);
// return the list of images we need
array_splice($galleries, $maxElement);
$nggNav = new nggNavigation;
// Line 1200
$navigation = $nggNav->create_navigation($page, $total, $maxElement);
} else {
$navigation = '<div class="ngg-clear"></div>';
}
// apply a filter on $galleries before the output
$galleries = apply_filters('ngg_album_galleries', $galleries);
// if sombody didn't enter any template , take the extend version
$filename = ( empty($template) ) ? 'album-extend' : 'album-' . $template ;
// create the output
$out = nggGallery::capture ( $filename, array ('album' => $album, 'galleries' => $galleries, 'pagination' => $navigation) );
return $out;
}
/**
* nggShowImageBrowser()
*
* @access public
* @param int|string $galleryID or gallery name
* @param string $template (optional) name for a template file, look for imagebrowser-$template
* @return the content
*/
function nggShowImageBrowser($galleryID, $template = '') {
global $wpdb;
$ngg_options = nggGallery::get_option('ngg_options');
//Set sort order value, if not used (upgrade issue)
$ngg_options['galSort'] = ($ngg_options['galSort']) ? $ngg_options['galSort'] : 'pid';
$ngg_options['galSortDir'] = ($ngg_options['galSortDir'] == 'DESC') ? 'DESC' : 'ASC';
// get the pictures
$picturelist = nggdb::get_gallery($galleryID, $ngg_options['galSort'], $ngg_options['galSortDir']);
if (is_array($picturelist)) {
$out = '<font style="color:#fff">'.$gallerycontent->title.'</font><div class="ngg-galleryoverview" id="ngg-gallery-'. $galleryID .'">';
else //Line 1283
$out = __('[Gallery not found]','nggallery');
$out = apply_filters('ngg_show_imagebrowser_content', $out, $galleryID);
return $out;
}
// Line 1300