function slideshow() { global $CONFIG, $template_display_picture, $CPG_M_DIR; if (function_exists('theme_slideshow')) { theme_slideshow(); return; } pageheader(SLIDESHOW_TITLE); require_once "includes/coppermine/slideshow.inc"; $start_slideshow = '<script language="JavaScript" type="text/JavaScript">runSlideShow()</script>'; template_extract_block($template_display_picture, 'img_desc', $start_slideshow); $params = array('{CELL_HEIGHT}' => $CONFIG['picture_width'] + 100, '{IMAGE}' => '<img src="' . $start_img . '" name="SlideShow" class="image" alt="" /><br />', '{ADMIN_MENU}' => ''); starttable(); echo template_eval($template_display_picture, $params); endtable(); starttable(); echo ' <tr> <td style="text-align:center" class="navmenu" style="white-space: nowrap;"> <a href="javascript:endSlideShow()" class="navmenu">' . STOP_SLIDESHOW . '</a> </td> </tr> '; endtable(); pagefooter(); }
/** * display_slideshow() * * gets data for thumbnails in an album for the film stript using Ajax call * * this added by Nuwan Sameera Hettiarachchi * * @param integer $album * @param integer $cat * @param integer $pos **/ function &display_slideshow($pos, $ajax_show = 0) { global $CONFIG, $album, $pid, $slideshow, $USER; $superCage = Inspekt::makeSuperCage(); $Pic = array(); $Pid = array(); $Title = array(); $i = 0; $j = 0; /** get the pic details by querying database*/ $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false); /** calculate total amount of pic a perticular album */ if ($ajax_show == 0) { set_js_var('Pic_count', $pic_count); } foreach ($pic_data as $picture) { if (is_image($picture['filename'])) { if ($CONFIG['make_intermediate'] && cpg_picture_dimension_exceeds_intermediate_limit($picture['pwidth'], $picture['pheight'])) { $picture_url = get_pic_url($picture, 'normal'); } else { $picture_url = get_pic_url($picture, 'fullsize'); } $Pic[$i] = htmlspecialchars($picture_url, ENT_QUOTES); /*if ($picture['pid'] == $pid) { $j = $i; $start_img = $picture_url; }*/ //$j and $start_img are never used } else { $pic_url = get_pic_url($picture, 'thumb'); $Pic[$i] = htmlspecialchars($pic_url); } $Pid[$i] = $picture['pid']; $Title[$i] = $picture['title'] ? $picture['title'] : $picture['filename']; $i++; } /** set variables to jquery.slideshow.js */ set_js_var('Time', $slideshow); set_js_var('Pid', $pid); /*if (!$i) { $Pic[0] = 'images/thumb_document.jpg'; }*/ // Add the hit if slideshow hits are enabled in config if ((!USER_IS_ADMIN && $CONFIG['count_admin_hits'] == 0 || $CONFIG['count_admin_hits'] == 1) && $CONFIG['slideshow_hits'] != 0) { // Add 1 to hit counter if (!in_array($Pid['0'], $USER['liv']) && $superCage->cookie->keyExists($CONFIG['cookie_name'] . '_data')) { add_hit($Pid['0']); if (count($USER['liv']) > 4) { array_shift($USER['liv']); } array_push($USER['liv'], $Pid['0']); user_save_profile(); } } /** show slide show on first time*/ if ($ajax_show == 0) { theme_slideshow($Pic['0'], $Title['0']); } /** now we make a array to encode*/ $dataArray = array('url' => $Pic['0'], 'title' => $Title['0'], 'pid' => $Pid['0']); $dataJson = json_encode($dataArray); /** send variable to javascript script*/ if ($ajax_show == 1) { header("Content-Type: text/plain"); echo $dataJson; } }
$CURRENT_ALBUM_DATA = mysql_fetch_array($result); if (is_numeric($album)) { $cat = -$album; $actual_cat = $CURRENT_ALBUM_DATA['category']; breadcrumb($actual_cat, $breadcrumb, $breadcrumb_text); $cat = -$album; } else { $actual_cat = $CURRENT_ALBUM_DATA['category']; breadcrumb($actual_cat, $breadcrumb, $breadcrumb_text); } } if (isset($CLEAN['fullsize'])) { theme_display_fullsize_pic(); ob_end_flush(); } elseif (isset($CLEAN['slideshow'])) { theme_slideshow(); ob_end_flush(); } else { //if (!isset($_GET['pos'])) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__); //Commented by Abbas if (!$CLEAN['pos'] && !$CLEAN['pid']) { cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__); } $picture_title = $CURRENT_PIC_DATA['title'] ? $CURRENT_PIC_DATA['title'] : strtr(preg_replace("/(.+)\\..*?\\Z/", "\\1", htmlspecialchars($CURRENT_PIC_DATA['filename'])), "_", " "); $nav_menu = theme_html_img_nav_menu(); $picture = theme_html_picture(); $votes = theme_html_rating_box(); $pic_info = html_picinfo(); $comments = theme_html_comments($CURRENT_PIC_DATA['pid']); if ($CURRENT_PIC_DATA['keywords']) { $meta_keywords = "<meta name=\"keywords\" content=\"" . $CURRENT_PIC_DATA['keywords'] . "\"/>"; }
function slideshow() { global $CONFIG, $HTTP_GET_VARS, $lang_display_image_php, $template_display_picture; if (function_exists('theme_slideshow')) { theme_slideshow(); return; } pageheader($lang_display_image_php['slideshow']); include "include/slideshow.inc.php"; $start_slideshow = '<script language="JavaScript" type="text/JavaScript">runSlideShow()</script>'; template_extract_block($template_display_picture, 'img_desc', $start_slideshow); $params = array('{CELL_HEIGHT}' => $CONFIG['picture_width'] + 100, '{IMAGE}' => '<img src="' . $start_img . '" name="SlideShow" class="image" /><br />', '{ADMIN_MENU}' => ''); starttable(); echo template_eval($template_display_picture, $params); endtable(); starttable(); echo <<<EOT <tr> <td align="center" class="navmenu" style="white-space: nowrap;"> <a href="javascript:endSlideShow()" class="navmenu">{$lang_display_image_php['stop_slideshow']}</a> </td> </tr> EOT; endtable(); pagefooter(); }
/** * display_slideshow() * * gets data for thumbnails in an album for the film stript using Ajax call * * this added by Nuwan Sameera Hettiarachchi * * @param integer $album * @param integer $cat * @param integer $pos **/ function &display_slideshow($pos, $ajax_show = 0) { global $CONFIG, $lang_display_image_php, $template_display_media, $lang_common, $album, $pid, $slideshow; global $cat, $date; print $Pid; $Pic = array(); $Pid = array(); $Title = array(); $i = 0; $j = 0; $a = 0; //$pid = (int)$_GET['pid']; $start_img = ''; $pic_data = get_pic_data($album, $pic_count, $album_name, -1, -1, false); foreach ($pic_data as $picture) { if ($CONFIG['thumb_use'] == 'ht' && $picture['pheight'] > $CONFIG['picture_width']) { // The wierd comparision is because only picture_width is stored $condition = true; } elseif ($CONFIG['thumb_use'] == 'wd' && $picture['pwidth'] > $CONFIG['picture_width']) { $condition = true; } elseif ($CONFIG['thumb_use'] == 'any' && max($picture['pwidth'], $picture['pheight']) > $CONFIG['picture_width']) { $condition = true; //thumb cropping } elseif ($CONFIG['thumb_use'] == 'ex' && max($picture['pwidth'], $picture['pheight']) > $CONFIG['picture_width']) { $condition = true; } else { $condition = false; } if (is_image($picture['filename'])) { if ($CONFIG['make_intermediate'] && $condition) { $picture_url = get_pic_url($picture, 'normal'); } else { $picture_url = get_pic_url($picture, 'fullsize'); } if ($picture['title']) { $Title_get = $picture['title']; } else { $Title_get = $picture['filename']; } $Pic[$i] = htmlspecialchars($picture_url, ENT_QUOTES); $Pid[$i] = $picture['pid']; $Title[$i] = $Title_get; if ($picture['pid'] == $pid) { $j = $i; $start_img = $picture_url; } $i++; } } $Pic_length = count($Pic); set_js_var('Time', $slideshow); set_js_var('Pic_count', $Pic_length); set_js_var('Pid', $pid); if (!$i) { echo "Pic[0] = 'images/thumb_document.jpg'\n"; } if ($ajax_show == 0) { theme_slideshow($Pic[$pos], $Title[$pos]); } $a = array('url' => $Pic[$pos], 'title' => $Title[$pos], 'pid' => $Pid[$pos]); $a_jons = json_encode($a); if ($ajax_show == 1) { echo $a_jons; } }