Beispiel #1
0
function theme_display_film_strip(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $pos, $sort_options, $mode = 'thumb', $date = '', $filmstrip_prev_pos, $filmstrip_next_pos, $max_block_items, $thumb_width)
{
    global $CONFIG, $THEME_DIR;
    global $template_film_strip, $lang_film_strip, $lang_common, $pic_count, $mar_pic;
    $superCage = Inspekt::makeSuperCage();
    static $template = '';
    static $thumb_cell = '';
    static $empty_cell = '';
    static $spacer = '';
    if (defined('THEME_HAS_FILM_STRIP_GRAPHIC')) {
        set_js_var('vertstrip', 1);
    }
    if (!$template) {
        $template = $template_film_strip;
        $thumb_cell = template_extract_block($template, 'thumb_cell');
        $empty_cell = template_extract_block($template, 'empty_cell');
    }
    $cat_link = is_numeric($aid) ? '' : '&cat=' . $cat;
    $date_link = $date == '' ? '' : '&date=' . $date;
    if ($superCage->get->getInt('uid')) {
        $uid_link = '&uid=' . $superCage->get->getInt('uid');
    } else {
        $uid_link = '';
    }
    $i = 0;
    $thumb_strip = '';
    foreach ($thumb_list as $thumb) {
        $i++;
        if ($mode == 'thumb') {
            if ($thumb['pos'] == $pos && !$superCage->get->keyExists('film_strip')) {
                $thumb['image'] = str_replace('class="image"', 'class="image middlethumb"', $thumb['image']);
            }
            // determine if thumbnail link targets should open in a pop-up
            if ($CONFIG['thumbnail_to_fullsize'] == 1) {
                // code for full-size pop-up
                if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
                    $target = 'javascript:;" onclick="alert(\'' . sprintf($lang_errors['login_needed'], '', '', '', '') . '\');';
                } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
                    $target = 'javascript:;" onclick="alert(\'' . sprintf($lang_errors['access_intermediate_only'], '', '', '', '') . '\');';
                } else {
                    $target = 'javascript:;" onclick="MM_openBrWindow(\'displayimage.php?pid=' . $thumb['pid'] . '&fullsize=1\',\'' . uniqid(rand()) . '\',\'scrollbars=yes,toolbar=no,status=no,resizable=yes,width=' . ((int) $thumb['pwidth'] + (int) $CONFIG['fullsize_padding_x']) . ',height=' . ((int) $thumb['pheight'] + (int) $CONFIG['fullsize_padding_y']) . '\');';
                }
            } elseif ($aid == 'lastcom' || $aid == 'lastcomby') {
                $page = cpg_get_comment_page_number($thumb['msg_id']);
                $page = is_numeric($page) ? "&amp;page={$page}" : '';
                $target = "displayimage.php?album={$aid}{$cat_link}{$date_link}&amp;pid={$thumb['pid']}{$uid_link}&amp;msg_id={$thumb['msg_id']}{$page}#comment{$thumb['msg_id']}";
            } else {
                $target = "displayimage.php?album={$aid}{$cat_link}{$date_link}&amp;pid={$thumb['pid']}{$uid_link}#top_display_media";
            }
            $params = array('{LINK_TGT}' => $target, '{THUMB}' => $thumb['image'], '{ONE_WIDTH}' => "width:" . $thumb_width . "px; float: left");
        } else {
            $params = array('{LINK_TGT}' => "index.php?cat={$thumb['cat']}", '{THUMB}' => $thumb['image'], '{ONE_WIDTH}' => "width:" . $thumb_width . "px; float: left");
        }
        $thumb_strip .= template_eval($thumb_cell, $params);
    }
    $tile1 = $THEME_DIR . 'images/tile1.gif';
    $tile2 = $THEME_DIR . 'images/tile2.gif';
    if (defined('THEME_HAS_NAVBAR_GRAPHICS')) {
        $location = $THEME_DIR;
    } else {
        $location = '';
    }
    $max_itme_width_ul = $max_block_items;
    if ($max_block_items % 2 == 0) {
        $max_itme_width_ul = $max_block_items + 1;
    }
    $set_width_to_film = "width:" . $max_block_items * ($thumb_width + 4) . "px; position:relative;";
    $params = array('{THUMB_STRIP}' => $thumb_strip, '{COLS}' => $i, '{TILE1}' => $tile1, '{TILE2}' => $tile2, '{SET_WIDTH}' => $set_width_to_film);
    ob_start();
    echo '<div id="filmstrip">';
    if (!defined('THEME_HAS_FILM_STRIP_GRAPHIC')) {
        starttable($CONFIG['picture_table_width']);
    }
    echo template_eval($template, $params);
    if (!defined('THEME_HAS_FILM_STRIP_GRAPHIC')) {
        endtable();
    }
    echo '</div>';
    $film_strip = ob_get_contents();
    ob_end_clean();
    return $film_strip;
}
Beispiel #2
0
function theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode = 'thumb', $date = '')
{
    global $CONFIG, $CURRENT_ALBUM_DATA;
    global $template_thumb_view_title_row, $template_fav_thumb_view_title_row, $lang_thumb_view, $lang_common, $template_tab_display, $template_thumbnail_view, $lang_album_list, $lang_errors;
    $superCage = Inspekt::makeSuperCage();
    static $header = '';
    static $thumb_cell = '';
    static $empty_cell = '';
    static $row_separator = '';
    static $footer = '';
    static $tabs = '';
    static $spacer = '';
    if ($header == '') {
        $thumb_cell = template_extract_block($template_thumbnail_view, 'thumb_cell');
        $tabs = template_extract_block($template_thumbnail_view, 'tabs');
        $header = template_extract_block($template_thumbnail_view, 'header');
        $empty_cell = template_extract_block($template_thumbnail_view, 'empty_cell');
        $row_separator = template_extract_block($template_thumbnail_view, 'row_separator');
        $footer = template_extract_block($template_thumbnail_view, 'footer');
        $spacer = template_extract_block($template_thumbnail_view, 'spacer');
    }
    $cat_link = is_numeric($aid) ? '' : '&amp;cat=' . $cat;
    $date_link = $date == '' ? '' : '&amp;date=' . $date;
    if ($superCage->get->getInt('uid')) {
        $uid_link = '&amp;uid=' . $superCage->get->getInt('uid');
    } else {
        $uid_link = '';
    }
    $theme_thumb_tab_tmpl = $template_tab_display;
    if ($mode == 'thumb') {
        $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $aid == 'lastalb' ? $lang_album_list['album_on_page'] : $lang_thumb_view['pic_on_page']));
        $theme_thumb_tab_tmpl['page_link'] = strtr($theme_thumb_tab_tmpl['page_link'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . $date_link . $uid_link . '&amp;page=%d'));
    } else {
        $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_thumb_view['user_on_page']));
        $theme_thumb_tab_tmpl['page_link'] = strtr($theme_thumb_tab_tmpl['page_link'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));
    }
    $thumbcols = $CONFIG['thumbcols'];
    $cell_width = ceil(100 / $CONFIG['thumbcols']) . '%';
    $tabs_html = $display_tabs ? create_tabs($nbThumb, $page, $total_pages, $theme_thumb_tab_tmpl) : '';
    if (!GALLERY_ADMIN_MODE && stripos($template_thumb_view_title_row, 'admin_buttons') !== false) {
        template_extract_block($template_thumb_view_title_row, 'admin_buttons');
    }
    // The sort order options are not available for meta albums
    if ($sort_options) {
        if (GALLERY_ADMIN_MODE) {
            $param = array('{ALBUM_ID}' => $aid, '{CAT_ID}' => $cat > 0 ? $cat : $CURRENT_ALBUM_DATA['category'], '{MODIFY}' => cpg_fetch_icon('modifyalb', 1) . $lang_common['album_properties'], '{PARENT_CAT}' => cpg_fetch_icon('category', 1) . $lang_common['parent_category'], '{EDIT_PICS}' => cpg_fetch_icon('edit', 1) . $lang_common['edit_files'], '{ALBUM_MGR}' => cpg_fetch_icon('alb_mgr', 1) . $lang_common['album_manager']);
        } else {
            $param = array();
        }
        $param['{ALBUM_NAME}'] = $album_name;
        $title = template_eval($template_thumb_view_title_row, $param);
    } elseif ($aid == 'favpics' && $CONFIG['enable_zipdownload'] > 0) {
        //Lots of stuff can be added here later
        $param = array('{ALBUM_NAME}' => $album_name, '{DOWNLOAD_ZIP}' => cpg_fetch_icon('zip', 2) . $lang_thumb_view['download_zip']);
        $title = template_eval($template_fav_thumb_view_title_row, $param);
    } else {
        $title = $album_name;
    }
    if ($mode == 'thumb') {
        starttable('100%', $title, $thumbcols);
    } else {
        starttable('100%');
    }
    echo $header;
    $i = 0;
    global $thumb;
    // make $thumb accessible to plugins
    foreach ($thumb_list as $thumb) {
        $i++;
        if ($mode == 'thumb') {
            if ($aid == 'lastalb') {
                $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => "thumbnails.php?album={$thumb['aid']}", '{THUMB}' => $thumb['image'], '{CAPTION}' => str_replace('.gif', '.png', $thumb['caption']), '{ADMIN_MENU}' => $thumb['admin_menu']);
            } else {
                // determine if thumbnail link targets should open in a pop-up
                if ($CONFIG['thumbnail_to_fullsize'] == 1) {
                    // code for full-size pop-up
                    if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
                        $target = 'javascript:;" onclick="alert(\'' . sprintf($lang_errors['login_needed'], '', '', '', '') . '\');';
                    } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
                        $target = 'javascript:;" onclick="alert(\'' . sprintf($lang_errors['access_intermediate_only'], '', '', '', '') . '\');';
                    } else {
                        $target = 'javascript:;" onclick="MM_openBrWindow(\'displayimage.php?pid=' . $thumb['pid'] . '&fullsize=1\',\'' . uniqid(rand()) . '\',\'scrollbars=yes,toolbar=no,status=no,resizable=yes,width=' . ((int) $thumb['pwidth'] + (int) $CONFIG['fullsize_padding_x']) . ',height=' . ((int) $thumb['pheight'] + (int) $CONFIG['fullsize_padding_y']) . '\');';
                    }
                } elseif ($aid == 'random') {
                    $target = "displayimage.php?pid={$thumb['pid']}{$uid_link}#top_display_media";
                } elseif ($aid == 'lastcom' || $aid == 'lastcomby') {
                    $page = cpg_get_comment_page_number($thumb['msg_id']);
                    $page = is_numeric($page) ? "&amp;page={$page}" : '';
                    $target = "displayimage.php?album={$aid}{$cat_link}{$date_link}&amp;pid={$thumb['pid']}{$uid_link}&amp;msg_id={$thumb['msg_id']}{$page}#comment{$thumb['msg_id']}";
                } else {
                    $target = "displayimage.php?album={$aid}{$cat_link}{$date_link}&amp;pid={$thumb['pid']}{$uid_link}#top_display_media";
                }
                $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => $target, '{THUMB}' => $thumb['image'], '{CAPTION}' => str_replace('.gif', '.png', $thumb['caption']), '{ADMIN_MENU}' => $thumb['admin_menu']);
            }
        } else {
            // mode != 'thumb'
            // Used for mode = 'user' from list_users() in index.php
            $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => "index.php?cat={$thumb['cat']}", '{THUMB}' => $thumb['image'], '{CAPTION}' => str_replace('.gif', '.png', $thumb['caption']), '{ADMIN_MENU}' => '');
        }
        // Plugin Filter: allow plugin to modify or add tags to process
        $params = CPGPluginAPI::filter('theme_display_thumbnails_params', $params);
        echo template_eval($thumb_cell, $params);
        if ($i % $thumbcols == 0 && $i < count($thumb_list)) {
            echo $row_separator;
        }
    }
    // foreach $thumb
    unset($thumb);
    // unset $thumb to avoid conflicting with global
    for (; $i % $thumbcols; $i++) {
        echo $empty_cell;
    }
    echo $footer;
    if ($display_tabs) {
        $params = array('{THUMB_COLS}' => $thumbcols, '{TABS}' => $tabs_html);
        echo template_eval($tabs, $params);
    }
    endtable();
    echo $spacer;
}
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) ? '' : '&amp;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']) ? '&amp;uid=' . $_GET['uid'] : '';
    if ($superCage->get->getInt('uid')) {
        $uid_link = '&amp;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&amp;pos=$start"; // Abbas - added pid in URL instead of pos
        $start_tgt = "{$CPG_PHP_SELF}?album={$album}{$cat_link}{$date_link}&amp;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&amp;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) ? "&amp;page={$page}" : '';
            $prev_tgt = "{$CPG_PHP_SELF}?album={$album}{$cat_link}{$date_link}&amp;pid={$pic_data[$prev]['pid']}{$uid_link}&amp;msg_id={$pic_data[$prev]['msg_id']}{$page}#comment{$pic_data[$prev]['msg_id']}";
            $start_tgt .= "{$uid_link}&amp;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}&amp;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&amp;pos=$end";// Abbas - added pid in URL instead of pos
        $end_tgt = "{$CPG_PHP_SELF}?album={$album}{$cat_link}{$date_link}&amp;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&amp;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) ? "&amp;page={$page}" : '';
            $next_tgt = "{$CPG_PHP_SELF}?album={$album}{$cat_link}{$date_link}&amp;pid={$pic_data[$next]['pid']}{$uid_link}&amp;msg_id={$pic_data[$next]['msg_id']}{$page}#comment{$pic_data[$next]['msg_id']}";
            $end_tgt .= "{$uid_link}&amp;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}&amp;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}&amp;pid={$pid}&amp;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}&amp;pid={$pid}&amp;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}&amp;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' ? "&amp;msg_id={$pic_data[$pos]['msg_id']}&amp;page={$page}" : '';
    $slideshow_tgt = "{$CPG_PHP_SELF}?album={$album}{$cat_link}{$date_link}{$uid_link}&amp;pid={$pid}{$msg_id}&amp;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, $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) ? '' : '&amp;cat=' . $cat;
    //FIXME: Where does this '$date' come from?
    if (isset($date) && $date != '') {
        $date_link = '&amp;date=' . $date;
    } else {
        $date_link = '';
    }
    if ($superCage->get->getInt('uid')) {
        $uid_link = '&amp;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']) ? '&amp;msg_id=' . $row['msg_id'] : '';
            $page = isset($row['msg_id']) ? '&amp;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}&amp;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);
        }
    }
}