function theme_html_img_nav_menu() { global $CONFIG, $CURRENT_PIC_DATA, $meta_nav, $THEME_DIR; //$PHP_SELF, global $album, $cat, $pos, $pic_count, $pic_data, $lang_img_nav_bar, $lang_text_dir, $template_img_navbar; $cat_link = is_numeric($album) ? '' : '&cat=' . $cat; $date_link = $_GET['date'] == '' ? '' : '&date=' . cpgValidateDate($_GET['date']); $uid_link = is_numeric($_GET['uid']) ? '&uid=' . $_GET['uid'] : ''; $human_pos = $pos + 1; $page = ceil(($pos + 1) / ($CONFIG['thumbrows'] * $CONFIG['thumbcols'])); $pid = $CURRENT_PIC_DATA['pid']; $start = 0; $start_tgt = "{$_SERVER['PHP_SELF']}?album={$album}{$cat_link}{$date_link}&pid={$pic_data[$start]['pid']}"; $start_title = $lang_img_nav_bar['go_album_start']; $meta_nav .= "<link rel=\"start\" href=\"{$start_tgt}\" title=\"{$start_title}\" />\n"; $end = $pic_count - 1; $end_tgt = "{$_SERVER['PHP_SELF']}?album={$album}{$cat_link}{$date_link}&pid={$pic_data[$end]['pid']}"; $end_title = $lang_img_nav_bar['go_album_end']; $meta_nav .= "<link rel=\"last\" href=\"{$end_tgt}\" title=\"{$end_title}\" />\n"; if ($pos > 0) { $prev = $pos - 1; $prev_tgt = "{$_SERVER['PHP_SELF']}?album={$album}{$cat_link}{$date_link}&pid={$pic_data[$prev]['pid']}{$uid_link}"; $prev_title = $lang_img_nav_bar['prev_title']; $meta_nav .= "<link rel=\"prev\" href=\"{$prev_tgt}\" title=\"{$prev_title}\" />\n"; } else { $prev_tgt = "javascript:;"; $prev_title = ""; } if ($pos < $pic_count - 1) { $next = $pos + 1; $next_tgt = "{$_SERVER['PHP_SELF']}?album={$album}{$cat_link}{$date_link}&pid={$pic_data[$next]['pid']}{$uid_link}"; $next_title = $lang_img_nav_bar['next_title']; $meta_nav .= "<link rel=\"next\" href=\"{$next_tgt}\" title=\"{$next_title}\"/>\n"; } else { $next_tgt = "javascript:;"; $next_title = ""; } if (USER_CAN_SEND_ECARDS) { $ecard_tgt = "ecard.php?album={$album}{$cat_link}{$date_link}&pid={$pid}&pos={$pos}"; $ecard_title = $lang_img_nav_bar['ecard_title']; } else { template_extract_block($template_img_navbar, 'ecard_button'); // added to remove button if cannot send ecard /*$ecard_tgt = "javascript:alert('" . addslashes($lang_img_nav_bar['ecard_disabled_msg']) . "');"; $ecard_title = $lang_img_nav_bar['ecard_disabled'];*/ } //report to moderator buttons if ($CONFIG['report_post'] == 1 && USER_CAN_SEND_ECARDS) { $report_tgt = "report_file.php?album={$album}{$cat_link}{$date_link}&pid={$pid}&pos={$pos}"; } else { // remove button if report toggle is off template_extract_block($template_img_navbar, 'report_file_button'); } $thumb_tgt = "thumbnails.php?album={$album}{$cat_link}{$date_link}&page={$page}{$uid_link}"; $meta_nav .= "<link rel=\"up\" href=\"{$thumb_tgt}\" title=\"" . $lang_img_nav_bar['thumb_title'] . "\"/>\n"; $slideshow_tgt = "{$_SERVER['PHP_SELF']}?album={$album}{$cat_link}{$date_link}{$uid_link}&pid={$pid}&slideshow=" . $CONFIG['slideshow_interval']; $pic_pos = sprintf($lang_img_nav_bar['pic_pos'], $human_pos, $pic_count); if (defined('THEME_HAS_NAVBAR_GRAPHICS')) { $location = $THEME_DIR; } else { $location = ''; } $params = array('{THUMB_TGT}' => $thumb_tgt, '{THUMB_TITLE}' => $lang_img_nav_bar['thumb_title'], '{PIC_INFO_TITLE}' => $lang_img_nav_bar['pic_info_title'], '{SLIDESHOW_TGT}' => $slideshow_tgt, '{SLIDESHOW_TITLE}' => $lang_img_nav_bar['slideshow_title'], '{PIC_POS}' => $pic_pos, '{ECARD_TGT}' => $ecard_tgt, '{ECARD_TITLE}' => $ecard_title, '{PREV_TGT}' => $prev_tgt, '{PREV_TITLE}' => $prev_title, '{NEXT_TGT}' => $next_tgt, '{NEXT_TITLE}' => $next_title, '{PREV_IMAGE}' => $lang_text_dir == 'ltr' ? 'prev' : 'next', '{NEXT_IMAGE}' => $lang_text_dir == 'ltr' ? 'next' : 'prev', '{REPORT_TGT}' => $report_tgt, '{REPORT_TITLE}' => $lang_img_nav_bar['report_title'], '{LOCATION}' => $location); return template_eval($template_img_navbar, $params); }
function theme_html_img_nav_menu() { global $CONFIG, $CURRENT_PIC_DATA, $meta_nav, $THEME_DIR, $CPG_PHP_SELF, $LINEBREAK; //$PHP_SELF, global $album, $cat, $pos, $pic_count, $pic_data, $lang_img_nav_bar, $lang_text_dir, $template_img_navbar; $superCage = Inspekt::makeSuperCage(); $template_img_navbar = CPGPluginAPI::filter('theme_img_navbar', $template_img_navbar); $cat_link = is_numeric($album) ? '' : '&cat=' . $cat; //$date_link = $_GET['date']=='' ? '' : '&date=' . cpgValidateDate($_GET['date']); if ($superCage->get->keyExists('date')) { //date will be validated $date_link = '&date=' . cpgValidateDate($superCage->get->getRaw('date')); } else { $date_link = ''; } //$uid_link = is_numeric($_GET['uid']) ? '&uid=' . $_GET['uid'] : ''; if ($superCage->get->getInt('uid')) { $uid_link = '&uid=' . $superCage->get->getInt('uid'); } else { $uid_link = ''; } $human_pos = $pos + 1; $page = ceil(($pos + 1) / ($CONFIG['thumbrows'] * $CONFIG['thumbcols'])); $pid = $CURRENT_PIC_DATA['pid']; if ($pos > 0) { $start = 0; //$start_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&pos=$start"; // Abbas - added pid in URL instead of pos $start_tgt = "{$CPG_PHP_SELF}?album={$album}{$cat_link}{$date_link}&pid={$pic_data[$start]['pid']}"; $start_title = $lang_img_nav_bar['go_album_start']; $meta_nav .= "<link rel=\"start\" href=\"{$start_tgt}\" title=\"{$start_title}\" />" . $LINEBREAK; $start_image = $lang_text_dir == 'ltr' ? 'start.png' : 'end.png'; $prev = $pos - 1; //$prev_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&pos=$prev$uid_link";// Abbas - added pid in URL instead of pos if ($album == 'lastcom' || $album == 'lastcomby') { $page = cpg_get_comment_page_number($pic_data[$prev]['msg_id']); $page = is_numeric($page) ? "&page={$page}" : ''; $prev_tgt = "{$CPG_PHP_SELF}?album={$album}{$cat_link}{$date_link}&pid={$pic_data[$prev]['pid']}{$uid_link}&msg_id={$pic_data[$prev]['msg_id']}{$page}#comment{$pic_data[$prev]['msg_id']}"; $start_tgt .= "{$uid_link}&msg_id={$pic_data[$start]['msg_id']}{$page}#comment{$pic_data[$start]['msg_id']}"; } else { $prev_tgt = "{$CPG_PHP_SELF}?album={$album}{$cat_link}{$date_link}&pid={$pic_data[$prev]['pid']}{$uid_link}#top_display_media"; $start_tgt .= "{$uid_link}#top_display_media"; } $prev_title = $lang_img_nav_bar['prev_title']; $meta_nav .= "<link rel=\"prev\" href=\"{$prev_tgt}\" title=\"{$prev_title}\" />" . $LINEBREAK; $prev_image = $lang_text_dir == 'ltr' ? 'prev.png' : 'next.png'; } else { // on first image, so no previous button/link $prev_tgt = "javascript:;"; $prev_title = ""; $prev_image = $lang_text_dir == 'ltr' ? 'prev_inactive.png' : 'next_inactive.png'; $start_tgt = "javascript:;"; $start_title = ""; $start_image = $lang_text_dir == 'ltr' ? 'start_inactive.png' : 'end_inactive.png'; } if ($pos < $pic_count - 1) { $end = $pic_count - 1; //$end_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&pos=$end";// Abbas - added pid in URL instead of pos $end_tgt = "{$CPG_PHP_SELF}?album={$album}{$cat_link}{$date_link}&pid={$pic_data[$end]['pid']}"; $end_title = $lang_img_nav_bar['go_album_end']; $meta_nav .= "<link rel=\"last\" href=\"{$end_tgt}\" title=\"{$end_title}\" />" . $LINEBREAK; $end_image = $lang_text_dir == 'ltr' ? 'end.png' : 'start.png'; $next = $pos + 1; //$next_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&pos=$next$uid_link";// Abbas - added pid in URL instead of pos if ($album == 'lastcom' || $album == 'lastcomby') { $page = cpg_get_comment_page_number($pic_data[$next]['msg_id']); $page = is_numeric($page) ? "&page={$page}" : ''; $next_tgt = "{$CPG_PHP_SELF}?album={$album}{$cat_link}{$date_link}&pid={$pic_data[$next]['pid']}{$uid_link}&msg_id={$pic_data[$next]['msg_id']}{$page}#comment{$pic_data[$next]['msg_id']}"; $end_tgt .= "{$uid_link}&msg_id={$pic_data[$end]['msg_id']}{$page}#comment{$pic_data[$end]['msg_id']}"; } else { $next_tgt = "{$CPG_PHP_SELF}?album={$album}{$cat_link}{$date_link}&pid={$pic_data[$next]['pid']}{$uid_link}#top_display_media"; $end_tgt .= "{$uid_link}#top_display_media"; } $next_title = $lang_img_nav_bar['next_title']; $meta_nav .= "<link rel=\"next\" href=\"{$next_tgt}\" title=\"{$next_title}\"/>" . $LINEBREAK; $next_image = $lang_text_dir == 'ltr' ? 'next.png' : 'prev.png'; } else { // on last image, so no next button/link $next_tgt = "javascript:;"; $next_title = ""; $next_image = $lang_text_dir == 'ltr' ? 'next_inactive.png' : 'prev_inactive.png'; $end_tgt = "javascript:;"; $end_title = ""; $end_image = $lang_text_dir == 'ltr' ? 'end_inactive.png' : 'start_inactive.png'; } if (USER_CAN_SEND_ECARDS) { $ecard_tgt = "ecard.php?album={$album}{$cat_link}{$date_link}&pid={$pid}&pos={$pos}"; $ecard_title = $lang_img_nav_bar['ecard_title']; } else { template_extract_block($template_img_navbar, 'ecard_button'); // added to remove button if cannot send ecard /* $ecard_tgt = "javascript:alert('" . addslashes($lang_img_nav_bar['ecard_disabled_msg']) . "');"; $ecard_title = $lang_img_nav_bar['ecard_disabled']; */ } // report to moderator buttons $report_tgt = ''; if ($CONFIG['report_post'] == 1 && USER_CAN_SEND_ECARDS) { $report_tgt = "report_file.php?album={$album}{$cat_link}{$date_link}&pid={$pid}&pos={$pos}"; } else { // remove button if report toggle is off template_extract_block($template_img_navbar, 'report_file_button'); } $thumb_tgt = "thumbnails.php?album={$album}{$cat_link}{$date_link}&page={$page}{$uid_link}"; $meta_nav .= "<link rel=\"up\" href=\"{$thumb_tgt}\" title=\"" . $lang_img_nav_bar['thumb_title'] . "\"/>" . $LINEBREAK; // needed when viewing slideshow of meta albums lastcom/lastcomby $msg_id = $album == 'lastcom' || $album == 'lastcomby' ? "&msg_id={$pic_data[$pos]['msg_id']}&page={$page}" : ''; $slideshow_tgt = "{$CPG_PHP_SELF}?album={$album}{$cat_link}{$date_link}{$uid_link}&pid={$pid}{$msg_id}&slideshow=" . $CONFIG['slideshow_interval'] . '#top_display_media'; // if set, this will override the default slideshow button to be inserted by displayimage.js $slideshow_btn = ''; // if set, this will override the default pic_info button to be inserted by displayimage.js $pic_info_btn = ''; $pic_pos = sprintf($lang_img_nav_bar['pic_pos'], $human_pos, $pic_count); if (defined('THEME_HAS_NAVBAR_GRAPHICS')) { $location = $THEME_DIR; } else { $location = ''; } // add javascript vars $js_buttons = array('pic_info_title' => $lang_img_nav_bar['pic_info_title'], 'pic_info_btn' => $pic_info_btn, 'slideshow_tgt' => $slideshow_tgt, 'slideshow_title' => $lang_img_nav_bar['slideshow_title'], 'slideshow_btn' => $slideshow_btn, 'loc' => $location); set_js_var('buttons', $js_buttons); $params = array('{THUMB_TGT}' => $thumb_tgt, '{THUMB_TITLE}' => $lang_img_nav_bar['thumb_title'], '{PIC_POS}' => $pic_pos, '{ECARD_TGT}' => $ecard_tgt, '{ECARD_TITLE}' => $ecard_title, '{START_TGT}' => $start_tgt, '{START_TITLE}' => $start_title, '{START_IMAGE}' => $start_image, '{PREV_TGT}' => $prev_tgt, '{PREV_TITLE}' => $prev_title, '{PREV_IMAGE}' => $prev_image, '{NEXT_TGT}' => $next_tgt, '{NEXT_TITLE}' => $next_title, '{NEXT_IMAGE}' => $next_image, '{END_TGT}' => $end_tgt, '{END_TITLE}' => $end_title, '{END_IMAGE}' => $end_image, '{REPORT_TGT}' => $report_tgt, '{REPORT_TITLE}' => $lang_img_nav_bar['report_title'], '{LOCATION}' => $location); return template_eval($template_img_navbar, $params); }
/** * display_film_strip() * * gets data for thumbnails in an album for the film strip * * @param integer $album * @param integer $cat * @param integer $pos **/ function display_film_strip($album, $cat, $pos) { global $CONFIG, $AUTHORIZED; global $album_date_fmt, $lang_display_thumbnails, $lang_errors, $lang_byte_units, $lang_common; $max_item = $CONFIG['max_film_strip_items']; //$thumb_per_page = $pos+$CONFIG['max_film_strip_items']; $thumb_per_page = $max_item * 2; $l_limit = max(0, $pos - $CONFIG['max_film_strip_items']); $new_pos = max(0, $pos - $l_limit); $pic_data = get_pic_data($album, $thumb_count, $album_name, $l_limit, $thumb_per_page); if (count($pic_data) < $max_item) { $max_item = count($pic_data); } $lower_limit = 3; if (!isset($pic_data[$new_pos + 1])) { $lower_limit = $new_pos - $max_item + 1; } else { if (!isset($pic_data[$new_pos + 2])) { $lower_limit = $new_pos - $max_item + 2; } else { if (!isset($pic_data[$new_pos - 1])) { $lower_limit = $new_pos; } else { $hf = $max_item / 2; $ihf = (int) ($max_item / 2); if ($new_pos > $hf) { $lower_limit = $new_pos - $ihf; } elseif ($new_pos <= $hf) { $lower_limit = 0; } } } } $pic_data = array_slice($pic_data, $lower_limit, $max_item); $i = $l_limit; if (count($pic_data) > 0) { foreach ($pic_data as $key => $row) { $hi = $pos == $i + $lower_limit ? '1' : ''; $i++; $pic_title = $lang_common['filename'] . '=' . $row['filename'] . "\n" . $lang_common['filesize'] . '=' . ($row['filesize'] >> 10) . $lang_byte_units[1] . "\n" . $lang_display_thumbnails['dimensions'] . $row['pwidth'] . "x" . $row['pheight'] . "\n" . $lang_display_thumbnails['date_added'] . localised_date($row['ctime'], $album_date_fmt); $pic_url = get_pic_url($row, 'thumb'); if (!is_image($row['filename'])) { $image_info = getimagesize(urldecode($pic_url)); $row['pwidth'] = $image_info[0]; $row['pheight'] = $image_info[1]; } //thumb cropping if ($row['system_icon'] == 'true') { $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width'], true); } else { $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']); } $p = $i - 1 + $lower_limit; $p = $p < 0 ? 0 : $p; $thumb_list[$i]['pos'] = $key < 0 ? $key : $p; $thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"{$pic_title}\" />"; $thumb_list[$i]['caption'] = $CONFIG['display_film_strip_filename'] ? '<span class="thumb_filename">' . $row['filename'] . '</span>' : ''; $thumb_list[$i]['admin_menu'] = ''; ######### Added by Abbas ############# $thumb_list[$i]['pid'] = $row['pid']; ###################################### } $date = isset($_GET['date']) ? cpgValidateDate($_GET['date']) : null; return theme_display_film_strip($thumb_list, $thumb_count, $album_name, $album, $cat, $pos, is_numeric($album), 'thumb', $date); } else { theme_no_img_to_display($album_name); } }
/** * display_film_strip() * * gets data for thumbnails in an album for the film strip * * @param integer $album * @param integer $cat * @param integer $pos **/ function display_film_strip($album, $cat, $pos, $ajax_call) { global $CONFIG, $LINEBREAK; global $lang_date, $lang_display_thumbnails, $lang_byte_units, $lang_common, $pic_count, $ajax_call, $pos; $superCage = Inspekt::makeSuperCage(); $max_item = $CONFIG['max_film_strip_items']; $thumb_width = $CONFIG['thumb_width']; /** set to variable with to javascript*/ set_js_var('thumb_width', $thumb_width); set_js_var('thumb_use', $CONFIG['thumb_use']); if ($CONFIG['max_film_strip_items'] % 2 == 0) { $max_item = $CONFIG['max_film_strip_items'] + 1; $pic_count = $pic_count + 1; } $max_item_real = $max_item; /** check the thumb_per_page variable valid to query database*/ if ($pic_count < $max_item_real) { $max_item_real = $pic_count; } /** pass the max_items to the dispalyimage.js file */ set_js_var('max_item', $max_item_real); $max_block_items = $CONFIG['max_film_strip_items']; $thumb_per_page = $max_item_real; /** assign the varible $l_limit diffen */ $l_limit = (int) ($max_item_real / 2); $l_limit = max(0, $pos - $l_limit); /** set $l_limit to last images */ if ($l_limit > $pic_count - $max_item_real) { $l_limit = $pic_count - $max_item_real; } $pic_data = get_pic_data($album, $thumb_count, $album_name, $l_limit, $thumb_per_page, false, 'filmstrip'); if (count($pic_data) < $max_item) { $max_item = count($pic_data); } $lower_limit = 0; if ($ajax_call == 2) { $lower_limit = $max_item_real - 1; $max_item = 1; } elseif ($ajax_call == 1) { $lower_limit = 0; $max_item = 1; } $pic_data = array_slice($pic_data, $lower_limit, $max_item); $i = $l_limit; set_js_var('count', $pic_count); $cat_link = is_numeric($album) ? '' : '&cat=' . $cat; //FIXME: Where does this '$date' come from? if (isset($date) && $date != '') { $date_link = '&date=' . $date; } else { $date_link = ''; } if ($superCage->get->getInt('uid')) { $uid_link = '&uid=' . $superCage->get->getInt('uid'); } else { $uid_link = ''; } if (count($pic_data) > 0) { foreach ($pic_data as $key => $row) { //$hi is never used //$hi = (($pos == ($i + $lower_limit)) ? '1': ''); $i++; $pic_alt = $row['filename']; $pic_title = $lang_common['filename'] . '=' . $row['filename'] . $LINEBREAK . $lang_common['filesize'] . '=' . ($row['filesize'] >> 10) . $lang_byte_units[1] . $LINEBREAK . $lang_display_thumbnails['dimensions'] . $row['pwidth'] . "x" . $row['pheight'] . $LINEBREAK . $lang_display_thumbnails['date_added'] . localised_date($row['ctime'], $lang_date['album']); list($pic_title) = CPGPluginAPI::filter('thumb_strip_html_title', array($pic_title, $row)); $pic_url = get_pic_url($row, 'thumb'); /*if (!is_image($row['filename'])) { $image_info = cpg_getimagesize(urldecode($pic_url)); $row['pwidth'] = $image_info[0]; $row['pheight'] = $image_info[1]; } //thumb cropping /*if (array_key_exists('system_icon', $row) && ($row['system_icon'] == true)) { $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width'], true); } else { $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']); }*/ // values never used $p = $i - 1 + $lower_limit; $p = $p < 0 ? 0 : $p; $thumb_list[$i]['pos'] = $key < 0 ? $key : $p; $thumb_list[$i]['image'] = '<img src="' . $pic_url . '" class="strip_image" border="0" alt="' . $row['filename'] . '" title="' . $pic_title . '" />'; $thumb_list[$i]['admin_menu'] = ''; $thumb_list[$i]['pid'] = $row['pid']; $thumb_list[$i]['msg_id'] = isset($row['msg_id']) ? $row['msg_id'] : ''; // needed for get_pic_pos() $msg_id = isset($row['msg_id']) ? '&msg_id=' . $row['msg_id'] : ''; $page = isset($row['msg_id']) ? '&page=' . cpg_get_comment_page_number($row['msg_id']) : ''; $hash = isset($row['msg_id']) ? '#comment' . $row['msg_id'] : '#top_display_media'; $target = "displayimage.php?album={$album}{$cat_link}{$date_link}&pid={$row['pid']}{$msg_id}{$page}{$uid_link}{$hash}"; } // Get the pos for next and prev links in filmstrip navigation $filmstrip_next_pos = $pos + 1; $filmstrip_prev_pos = $pos - 1; // If next pos is greater then total pics then make it pic_count - 1 $filmstrip_next_pos = $filmstrip_next_pos >= $pic_count ? $pic_count - 1 : $filmstrip_next_pos; // If prev pos is less than 0 then make it 0 $filmstrip_prev_pos = $filmstrip_prev_pos < 0 ? 0 : $filmstrip_prev_pos; //Using getRaw(). The date is sanitized in the called function. $date = $superCage->get->keyExists('date') ? cpgValidateDate($superCage->get->getRaw('date')) : null; if ($ajax_call == 2 || $ajax_call == 1) { $setArray = array('url' => $pic_url, 'target' => $target, 'alt' => $pic_alt, 'title' => $pic_title); header("Content-Type: text/plain"); echo json_encode($setArray); } else { return theme_display_film_strip($thumb_list, $thumb_count, $album_name, $album, $cat, $pos, is_numeric($album), 'thumb', $date, $filmstrip_prev_pos, $filmstrip_next_pos, $max_block_items, $thumb_width); } } else { if ($ajax_call == 2 || $ajax_call == 1) { $setArray = array('url' => 'images/stamp.png', 'target' => 'images/stamp.png', 'alt' => 'stamp.png', 'title' => ''); header("Content-Type: text/plain"); echo json_encode($setArray); } else { theme_no_img_to_display($album_name); } } }
/** * display_thumbnails() * * Generates data to display thumbnails of pictures in an album * * @param mixed $album Either the album ID or the meta album name * @param integer $cat Either the category ID or album ID if negative * @param integer $page Page number to display * @param integer $thumbcols * @param integer $thumbrows * @param boolean $display_tabs **/ function fetchcontent_display_thumbnails($album, $cat, $page, $thumbcols, $thumbrows, $display_tabs) { global $CONFIG, $USER, $LINEBREAK; global $lang_date, $lang_display_thumbnails, $lang_byte_units, $lang_common; $superCage = Inspekt::makeSuperCage(); $thumb_per_page = $thumbcols * $thumbrows; $lower_limit = ($page - 1) * $thumb_per_page; $pic_data = get_pic_data($album, $thumb_count, $album_name, $lower_limit, $thumb_per_page); $total_pages = ceil($thumb_count / $thumb_per_page); $i = 0; if (count($pic_data) > 0) { foreach ($pic_data as $key => $row) { $i++; $pic_title = $lang_common['filename'] . '=' . $row['filename'] . $LINEBREAK . $lang_common['filesize'] . '=' . ($row['filesize'] >> 10) . $lang_byte_units[1] . $LINEBREAK . $lang_display_thumbnails['dimensions'] . $row['pwidth'] . "x" . $row['pheight'] . $LINEBREAK . $lang_display_thumbnails['date_added'] . localised_date($row['ctime'], $lang_date['album']); $pic_url = get_pic_url($row, 'thumb'); if (!is_image($row['filename'])) { $image_info = cpg_getimagesize(urldecode($pic_url)); $row['pwidth'] = $image_info[0]; $row['pheight'] = $image_info[1]; } // thumb cropping - if we display a system thumb we calculate the dimension by any and not ex if (array_key_exists('system_icon', $row) && $row['system_icon'] == true) { $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width'], true); } else { $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']); } $thumb_list[$i]['pos'] = $key < 0 ? $key : $i - 1 + $lower_limit; $thumb_list[$i]['pid'] = $row['pid']; // $thumb_list[$i]['image'] = '<img src="' . $pic_url . '" class="image" ' . $image_size['geom'] . ' border="0" alt="' . $row['filename'] . '" title="' . $pic_title . '" />'; // commented out for fetchcontent $thumb_list[$i]['thumbpath'] = $pic_url; // Added for fetchcontent $thumb_list[$i]['thumbsize'] = $image_size['geom']; // Added for fetchcontent $thumb_list[$i]['caption'] = bb_decode($row['caption_text']); $thumb_list[$i]['admin_menu'] = ''; $thumb_list[$i]['aid'] = $row['aid']; $thumb_list[$i]['pwidth'] = $row['pwidth']; $thumb_list[$i]['pheight'] = $row['pheight']; // cpg1.5: new thumb fields below $thumb_list[$i]['title'] = $row['title']; $thumb_list[$i]['description'] = $row['caption']; $thumb_list[$i]['filepath'] = $row['filepath']; $thumb_list[$i]['filename'] = $row['filename']; $thumb_list[$i]['filesize'] = $row['filesize']; $thumb_list[$i]['msg_id'] = isset($row['msg_id']) ? $row['msg_id'] : ''; // needed for get_pic_pos() } // Add a hit to album counter if it is a numeric album if (is_numeric($album)) { // Create an array to hold the album id for hits (if not created) if (!isset($USER['liv_a']) || !is_array($USER['liv_a'])) { $USER['liv_a'] = array(); } // Add 1 to album hit counter if ((!USER_IS_ADMIN && $CONFIG['count_admin_hits'] == 0 || $CONFIG['count_admin_hits'] == 1) && !in_array($album, $USER['liv_a']) && $superCage->cookie->keyExists($CONFIG['cookie_name'] . '_data')) { add_album_hit($album); if (count($USER['liv_a']) > 4) { array_shift($USER['liv_a']); } array_push($USER['liv_a'], $album); user_save_profile(); } } //Using getRaw(). The date is sanitized in the called function. $date = $superCage->get->keyExists('date') ? cpgValidateDate($superCage->get->getRaw('date')) : null; // This is the difference to the original function taken from Coppermine's core: we don't process the data further, but put it into an array and return it $return = array('thumb_list' => $thumb_list, 'thumb_count' => $thumb_count, 'album_name' => $album_name, 'aid' => $album, 'cat' => $cat, 'page' => $page, 'total_pages' => $total_pages, 'sort_options' => is_numeric($album), 'display_tabs' => $display_tabs, 'mode' => 'thumb', 'date' => $date); } elseif (is_numeric($album)) { $return = array('album_name' => $album_name); } return $return; }
/** * display_film_strip() * * gets data for thumbnails in an album for the film strip * * @param integer $album * @param integer $cat * @param integer $pos **/ function display_film_strip($album, $cat, $pos, $ajax_call) { // print $pos; global $CONFIG, $AUTHORIZED; global $album_date_fmt, $lang_display_thumbnails, $lang_errors, $lang_byte_units, $lang_common, $pic_count, $ajax_call, $pos; $superCage = Inspekt::makeSuperCage(); $max_item = $CONFIG['max_film_strip_items']; if ($CONFIG['max_film_strip_items'] % 2 == 0) { $max_item = $CONFIG['max_film_strip_items'] + 1; } //print $max_item; $max_item_real = $max_item; /**check the thumb_per_page variable valid to query database*/ if ($pic_count < $max_item_real) { $max_item_real = $pic_count; } //pass the max_items to the dispalyimage.js file set_js_var('max_item', $max_item_real); $max_item_to_set_width = $CONFIG['max_film_strip_items']; //$thumb_per_page = $pos+$CONFIG['max_film_strip_items']; $thumb_per_page = $max_item_real; //assign the varible $l_limit diffen $l_limit = (int) ($max_item_real / 2); $l_limit = max(0, $pos - $l_limit); //set $l_limit to last images if ($l_limit > $pic_count - $max_item_real) { $l_limit = $pic_count - $max_item_real; } $pic_data = get_pic_data($album, $thumb_count, $album_name, $l_limit, $thumb_per_page); if (count($pic_data) < $max_item) { $max_item = count($pic_data); } $lower_limit = 0; if ($ajax_call == 2) { $lower_limit = $max_item_real - 1; $max_item = 1; } if ($ajax_call == 1) { $lower_limit = 0; $max_item = 1; } $pic_data = array_slice($pic_data, $lower_limit, $max_item); $i = $l_limit; //set javascript count variable:: added by Nuwan Sameera Hettiarachchi set_js_var('count', $pic_count); $cat_link = is_numeric($album) ? '' : '&cat=' . $cat; $date_link = $date == '' ? '' : '&date=' . $date; if ($superCage->get->getInt('uid')) { $uid_link = '&uid=' . $superCage->get->getInt('uid'); } else { $uid_link = ''; } if (count($pic_data) > 0) { foreach ($pic_data as $key => $row) { $hi = $pos == $i + $lower_limit ? '1' : ''; $i++; $pic_title = $lang_common['filename'] . '=' . $row['filename'] . "\n" . $lang_common['filesize'] . '=' . ($row['filesize'] >> 10) . $lang_byte_units[1] . "\n" . $lang_display_thumbnails['dimensions'] . $row['pwidth'] . "x" . $row['pheight'] . "\n" . $lang_display_thumbnails['date_added'] . localised_date($row['ctime'], $album_date_fmt); $pic_url = get_pic_url($row, 'thumb'); //print $pic_url; if (!is_image($row['filename'])) { $image_info = cpg_getimagesize(urldecode($pic_url)); $row['pwidth'] = $image_info[0]; $row['pheight'] = $image_info[1]; } //thumb cropping if ($row['system_icon'] == 'true') { $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width'], true); } else { $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']); } $p = $i - 1 + $lower_limit; $p = $p < 0 ? 0 : $p; $thumb_list[$i]['pos'] = $key < 0 ? $key : $p; $thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"strip_image\" border=\"0\" alt=\"{$row['filename']}\" title=\"{$pic_title}\" />"; $thumb_list[$i]['caption'] = $CONFIG['display_film_strip_filename'] ? '<span class="thumb_filename">' . $row['filename'] . '</span>' : ''; $thumb_list[$i]['admin_menu'] = ''; ######### Added by Abbas ############# $thumb_list[$i]['pid'] = $row['pid']; ###################################### $target = "displayimage.php?album={$album}{$cat_link}{$date_link}&pid={$row['pid']}{$uid_link}"; } // Get the pos for next and prev links in filmstrip navigation $filmstrip_next_pos = $pos + 1; $filmstrip_prev_pos = $pos - 1; // If next pos is greater then total pics then make it pic_count - 1 $filmstrip_next_pos = $filmstrip_next_pos >= $pic_count ? $pic_count - 1 : $filmstrip_next_pos; // If prev pos is less than 0 then make it 0 $filmstrip_prev_pos = $filmstrip_prev_pos < 0 ? 0 : $filmstrip_prev_pos; //Using getRaw(). The date is sanitized in the called function. $date = $superCage->get->keyExists('date') ? cpgValidateDate($superCage->get->getRaw('date')) : null; if ($ajax_call == 2 || $ajax_call == 1) { $a = array('url' => $pic_url, 'target' => $target); $a_jons = json_encode($a); echo $a_jons; } else { // print $thumb_count; return theme_display_film_strip($thumb_list, $thumb_count, $album_name, $album, $cat, $pos, is_numeric($album), 'thumb', $date, $filmstrip_prev_pos, $filmstrip_next_pos, $max_item_to_set_width); } } else { theme_no_img_to_display($album_name); } }