db; $context =& $f->context; $tpl =& $f->tpl; $prefix = $options['gallery_prefix']; $id = $_GET['gi']; $slug = $_GET['g']; if (empty($id)) $id = 1; if (empty($slug)) die("No gallery"); $q = "SELECT * FROM {$prefix}_gallery_images WHERE gallery = '{$slug}' ORDER BY number"; $db->query($q); $image =& $db->all(); $num = count($image); $img = array(); $i = 1; foreach ($image as $k) { $img['number'] = $i; $img['gallery'] = $k['gallery']; $img['big_name'] = $k['big_name']; if ($i == $id) break; $i++; } if ($id > $num) $img['number'] = 1; $first_img = ($img['number'] == 1) ? true : false; $last_img = ($img['number'] == $num) ? true : false; $galnav = array(); if (!$first_img) { $prev = (int)$img['number'] - 1; $prev_photo = $options['wp_url'] . '/' . $options['gallery_dir'] . "/big/" . $slug . "/" . $prev; $gal_prev = "« Foto anterior |"; } if (!$last_img) { $next = (int)$img['number'] + 1; $next_photo = $options['wp_url'] . '/' . $options['gallery_dir'] . "/big/" . $slug . "/" . $next; $gal_next = "| Foto siguiente»"; } $gallery_path = $options['wp_url'] . '/' . $options['gallery_dir'] . "/" . $slug; $gallery_navigation = "
{$gal_prev} Volver a la galeria {$gal_next}
"; $abspath = $options['wp_url'] . $options['gallery_abspath']; $img_path = $abspath . $img['gallery'] . '/' . $img['big_name']; switch ($options['shortname']) : case "racingpasion": case "vidaextra": case "notasdefutbol": case "moto22": case "motos": $ext = "gif"; break; default: $ext = "jpg"; endswitch; $tpl->setVar('uri_logo', $options['wp_url'] . "/images/logo." . $ext); $tpl->setVar('img_path', $img_path); $tpl->setVar('img_title', $img['big_name']); $tpl->setVar('gallery_navigation', $gallery_navigation); $tpl->setVar('title', $options['blogname']); $tpl->setVar('uri', $options['wp_url']); $f->templates['index'] = 'show_fullimage.xml'; $f->renderPage(false); ?>