Esempio n. 1
0
function html_img_nav_menu()
{
    global $xoopsModuleConfig, $_SERVER, $_GET, $CURRENT_PIC_DATA, $PHP_SELF;
    global $album, $cat, $pos, $pic_count;
    global $xoopsTpl, $album_name;
    $cat_link = is_numeric($album) ? '' : '&cat=' . $cat;
    $human_pos = $pos + 1;
    $page = ceil(($pos + 1) / ($xoopsModuleConfig['thumbrows'] * $xoopsModuleConfig['thumbcols']));
    $pid = $CURRENT_PIC_DATA['pid'];
    if ($pos > 0) {
        $prev = $pos - 1;
        $prev_data = get_pic_data($album, $pic_count, $album_name, $prev, 1, false);
        $prev_data[0]['pid'] = $album == 'topn' ? '' : $prev_data[0]['pid'];
        #mc
        $prev_tgt = "{$PHP_SELF}?album={$album}{$cat_link}&pos={$prev}&pid=" . $prev_data[0]['pid'];
        $prev_title = _MD_DIS_PREV;
    } else {
        $prev_tgt = "javascript:;";
        $prev_title = "";
    }
    if ($pos < $pic_count - 1) {
        $next = $pos + 1;
        $next_data = get_pic_data($album, $pic_count, $album_name, $next, 1, false);
        $next_data[0]['pid'] = $album == 'topn' ? '' : $next_data[0]['pid'];
        #mc
        $next_tgt = "{$PHP_SELF}?album={$album}{$cat_link}&amp;pos={$next}&amp;pid=" . $next_data[0]['pid'];
        $next_title = _MD_DIS_NEXT;
    } else {
        $next_tgt = "javascript:;";
        $next_title = "";
    }
    if (USER_CAN_SEND_ECARDS) {
        $ecard_tgt = "ecard.php?album={$album}{$cat_link}&amp;pid={$pid}&amp;pos={$pos}";
        $ecard_title = _MD_DIS_SEND_CARD;
    } else {
        $ecard_tgt = "javascript:alert('" . addslashes(_MD_DIS_CARD_DISABLEMSG) . "');";
        $ecard_title = _MD_DIS_CARD_DISABLE;
    }
    $thumb_tgt = "thumbnails.php?album={$album}{$cat_link}&amp;page={$page}";
    $slideshow_tgt = "{$PHP_SELF}?pid={$pid}&amp;album={$album}{$cat_link}&amp;pid={$pid}&amp;slideshow=5000";
    $pic_pos = sprintf(_MD_DIS_PICPOS, $human_pos, $pic_count);
    $xoopsTpl->assign('thumb_tgt', $thumb_tgt);
    $xoopsTpl->assign('thumb_title', _MD_DIS_BACK_TNPAGE);
    $xoopsTpl->assign('pic_info_title', _MD_DIS_SHOW_PIC_INFO);
    $xoopsTpl->assign('slideshow_tgt', $slideshow_tgt);
    $xoopsTpl->assign('slideshow_title', _MD_DIS_SLIDE);
    $xoopsTpl->assign('pic_pos', $pic_pos);
    $xoopsTpl->assign('ecard_tgt', $ecard_tgt);
    $xoopsTpl->assign('ecard_title', $ecard_title);
    $xoopsTpl->assign('prev_tgt', $prev_tgt);
    $xoopsTpl->assign('prev_title', $prev_title);
    $xoopsTpl->assign('next_tgt', $next_tgt);
    $xoopsTpl->assign('next_title', $next_title);
}
Esempio n. 2
0
// to add more images, just continue
// the pattern, adding to the array below
<?php 
$i = 0;
$j = 0;
//$pid = (int)$_GET['pid'];
$start_img = '';
$pic_data = get_pic_data($album, $pic_count, $album_name, -1, -1, false);
if (is_numeric($_GET['album'])) {
    $pic_data = get_pic_data($album, $pic_count, $album_name, -1, -1, false);
} else {
    // fix memory consumption for meta albums (see http://coppermine-gallery.net/forum/index.php?topic=31945.0 and http://www.pragmamx.org/Forum-topic-23429.html
    $col = intval($CONFIG['thumbcols']) > 1 ? $CONFIG['thumbcols'] : 4;
    $row = intval($CONFIG['thumbrows']) > 1 ? $CONFIG['thumbrows'] : 4;
    $limit = $col * $row * 10;
    $pic_data = get_pic_data($album, $pic_count, $album_name, 0, $limit, 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;
    }
Esempio n. 3
0
/**
 * 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);
    }
}
Esempio n. 4
0
function enl_main($html)
{
    global $thisplugin, $thumb_list, $ENLARGEITSET, $CONFIG;
    // enabled for current user type?
    if (GALLERY_ADMIN_MODE && !$ENLARGEITSET['enl_adminmode']) {
        return $html;
    }
    if (USER_ID && !$ENLARGEITSET['enl_registeredmode']) {
        return $html;
    }
    if (!USER_ID && !$ENLARGEITSET['enl_guestmode']) {
        return $html;
    }
    // get search string depending on thumb_use setting and SEF
    switch ($CONFIG['thumb_use']) {
        case "wd":
            if (!$ENLARGEITSET['enl_sefmode']) {
                $ausdruck = "#<!-- BEGIN enlargeit -->\\s*<a\\s*onclick=\"\"\\s*href=\"displayimage.php\\?(.*)\">\\s*<img\\s*src=\"(.*?)" . $CONFIG['thumb_pfx'] . "(.*?)\"\\s*.*\\s*width=\"(.*)\"\\s*border=\".*\"\\s*.*\\s*alt=\"(.*?)\"\\s*title=\".*\n.*\n.*\n.*?\"\\s*/><br /></a><!-- END enlargeit -->#i";
            } else {
                $ausdruck = "#<!-- BEGIN enlargeit -->\\s*<a\\s*onclick=\"\"\\s*href=\"displayimage-(.*)\\.html\">\\s*<img\\s*src=\"(.*?)" . $CONFIG['thumb_pfx'] . "(.*?)\"\\s*.*\\s*width=\"(.*)\"\\s*border=\".*\"\\s*.*\\s*alt=\"(.*?)\"\\s*title=\".*\n.*\n.*\n.*?\"\\s*/><br /></a><!-- END enlargeit -->#i";
            }
            break;
        case "ht":
            if (!$ENLARGEITSET['enl_sefmode']) {
                $ausdruck = "#<!-- BEGIN enlargeit -->\\s*<a\\s*onclick=\"\"\\s*href=\"displayimage.php\\?(.*)\">\\s*<img\\s*src=\"(.*?)" . $CONFIG['thumb_pfx'] . "(.*?)\"\\s*.*\\s*height=\"(.*)\"\\s*border=\".*\"\\s*.*\\s*alt=\"(.*?)\"\\s*title=\".*\n.*\n.*\n.*?\"\\s*/><br /></a><!-- END enlargeit -->#i";
            } else {
                $ausdruck = "#<!-- BEGIN enlargeit -->\\s*<a\\s*onclick=\"\"\\s*href=\"displayimage-(.*)\\.html\">\\s*<img\\s*src=\"(.*?)" . $CONFIG['thumb_pfx'] . "(.*?)\"\\s*.*\\s*height=\"(.*)\"\\s*border=\".*\"\\s*.*\\s*alt=\"(.*?)\"\\s*title=\".*\n.*\n.*\n.*?\"\\s*/><br /></a><!-- END enlargeit -->#i";
            }
            break;
        default:
            if (!$ENLARGEITSET['enl_sefmode']) {
                $ausdruck = "#<!-- BEGIN enlargeit -->\\s*<a\\s*onclick=\"\"\\s*href=\"displayimage.php\\?(.*)\">\\s*<img\\s*src=\"(.*?)" . $CONFIG['thumb_pfx'] . "(.*?)\"\\s*.*\\s*width=\"(.*)\"\\s*height=\"(.*)\"\\s*border=\".*\"\\s*.*\\s*alt=\"(.*?)\"\\s*title=\".*\n.*\n.*\n.*?\"\\s*/><br /></a><!-- END enlargeit -->#i";
            } else {
                $ausdruck = "#<!-- BEGIN enlargeit -->\\s*<a\\s*onclick=\"\"\\s*href=\"displayimage-(.*)\\.html\">\\s*<img\\s*src=\"(.*?)" . $CONFIG['thumb_pfx'] . "(.*?)\"\\s*.*\\s*width=\"(.*)\"\\s*height=\"(.*)\"\\s*border=\".*\"\\s*.*\\s*alt=\"(.*?)\"\\s*title=\".*\n.*\n.*\n.*?\"\\s*/><br /></a><!-- END enlargeit -->#i";
            }
    }
    // get album, cat and pos for each thumb
    preg_match_all($ausdruck, $html, $treffer, PREG_SET_ORDER);
    $i = 0;
    foreach ($treffer as $match) {
        $i++;
        //File Type detection - EnlargeIt! is for images and SWF files only
        switch ($CONFIG['thumb_use']) {
            case "wd":
                $enl_filetype = explode(".", $match[5]);
                if (substr($match[5], 0, 8) == 'youtube_') {
                    $enl_filetype[1] = 'ytb';
                }
                if (substr($match[5], -5) == '.divx') {
                    $enl_filetype[1] = 'dvx';
                }
                if (substr($match[5], -4) == '.flv') {
                    $enl_filetype[1] = 'flv';
                }
                break;
            case "ht":
                $enl_filetype = explode(".", $match[5]);
                if (substr($match[5], 0, 8) == 'youtube_') {
                    $enl_filetype[1] = 'ytb';
                }
                if (substr($match[5], -5) == '.divx') {
                    $enl_filetype[1] = 'dvx';
                }
                if (substr($match[5], -4) == '.flv') {
                    $enl_filetype[1] = 'flv';
                }
                break;
            default:
                $enl_filetype = explode(".", $match[6]);
                if (substr($match[6], 0, 8) == 'youtube_') {
                    $enl_filetype[1] = 'ytb';
                }
                if (substr($match[6], -5) == '.divx') {
                    $enl_filetype[1] = 'dvx';
                }
                if (substr($match[6], -4) == '.flv') {
                    $enl_filetype[1] = 'flv';
                }
        }
        $enl_filetyplower = strtolower($enl_filetype[1]);
        if ($enl_filetyplower == 'jpg' || $enl_filetyplower == 'jpeg' || $enl_filetyplower == 'jpe' || $enl_filetyplower == 'png' || $enl_filetyplower == 'gif' || $enl_filetyplower == 'bmp' || $enl_filetyplower == 'jpc' || $enl_filetyplower == 'jp2' || $enl_filetyplower == 'jpx' || $enl_filetyplower == 'jb2' || $enl_filetyplower == 'swc' || $enl_filetyplower == 'swf' || $enl_filetyplower == 'ytb' || $enl_filetyplower == 'dvx' || $enl_filetyplower == 'flv') {
            // get pos, album, cat out of URL
            if (!$ENLARGEITSET['enl_sefmode']) {
                preg_match_all("#album=(.+)&amp;cat=(.+)&amp;pos=(.+)#i", $match[1], $enl_gotit);
            } else {
                preg_match_all("#(.+?)-(.+?)-(.+)#i", $match[1], $enl_gotit);
            }
            if ($enl_gotit[0]) {
                $album = $enl_gotit[1][0];
                $cat = (int) $enl_gotit[2][0];
                $pos = (int) $enl_gotit[3][0];
            } else {
                if (!$ENLARGEITSET['enl_sefmode']) {
                    preg_match_all("/album=(.+)&amp;pos=(.+)/", $match[1], $enl_gotittoo);
                } else {
                    preg_match_all("/(.+?)-(.+)/", $match[1], $enl_gotittoo);
                }
                if ($enl_gotittoo[0]) {
                    $album = $enl_gotittoo[1][0];
                    $cat = 0;
                    $pos = (int) $enl_gotittoo[2][0];
                } else {
                    $album = '';
                    $cat = 0;
                    $pos = 0;
                }
            }
            if (!$album) {
                $album = '';
            }
            if (!$cat) {
                $cat = 0;
            }
            if (!$pos) {
                $pos = 0;
            }
            // Retrieve data for the current picture
            if ($pos < 0) {
                $pid = $pos < 0 ? -$pos : $pid;
                $result = cpg_db_query("SELECT aid from {$CONFIG['TABLE_PICTURES']} WHERE pid='{$pid}' LIMIT 1");
                $row = mysql_fetch_array($result);
                $album = $row['aid'];
                $pic_data = get_pic_data($album, $pic_count, $album_name, -1, -1, false);
                for ($pos = 0; $pic_data[$pos]['pid'] != $pid && $pos < $pic_count; $pos++) {
                }
                $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
                $CURRENT_PIC_DATA = $pic_data[0];
            } else {
                $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
                if (count($pic_data) == 0 && $pos >= $pic_count) {
                    $pos = $pic_count - 1;
                    $human_pos = $pos + 1;
                    $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
                }
                $CURRENT_PIC_DATA = $pic_data[0];
            }
            if (!$ENLARGEITSET['enl_sefmode']) {
                $neu_str = '<a onclick="return false;" href="displayimage.php?' . $match[1];
            } else {
                $neu_str = '<a onclick="return false;" href="displayimage-' . $match[1] . '.html';
            }
            if ($ENLARGEITSET['enl_pictype'] == 1) {
                $enl_path = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
            } else {
                if ($ENLARGEITSET['enl_pictype'] == 2) {
                    $enl_path = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CONFIG['normal_pfx'] . $CURRENT_PIC_DATA['filename'];
                } else {
                    if ($ENLARGEITSET['enl_pictype'] == 0 && is_file($CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CONFIG['normal_pfx'] . $CURRENT_PIC_DATA['filename'])) {
                        $enl_path = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CONFIG['normal_pfx'] . $CURRENT_PIC_DATA['filename'];
                    } else {
                        $enl_path = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
                    }
                }
            }
            if ($enl_filetyplower == 'swf') {
                $enl_swfheight = $CURRENT_PIC_DATA['pheight'];
                $enl_swfwidth = $CURRENT_PIC_DATA['pwidth'];
                if ($enl_swfheight == 0) {
                    $enl_swfheight = 400;
                }
                if ($enl_swfwidth == 0) {
                    $enl_swfwidth = 400;
                }
                $neu_str .= '"><img src="' . $match[2] . $CONFIG['thumb_pfx'] . $match[3] . '" longdesc="swf::' . path2url($enl_path) . '::' . $enl_swfwidth . '::' . $enl_swfheight;
            } else {
                if ($enl_filetyplower == 'ytb') {
                    $neu_str .= '"><img src="' . $match[2] . $CONFIG['thumb_pfx'] . $match[3] . '" longdesc="swf::' . str_replace(".jpg", "", str_replace("youtube_", "http://www.youtube.com/v/", $CURRENT_PIC_DATA['filename'])) . '&amp;fs=1&amp;rel=0::480::385';
                } else {
                    if ($enl_filetyplower == 'dvx') {
                        $enl_dvxheight = $CURRENT_PIC_DATA['pheight'] + 20;
                        $enl_dvxwidth = $CURRENT_PIC_DATA['pwidth'];
                        if ($enl_dvxheight == 20) {
                            $enl_dvxheight = 212;
                        }
                        if ($enl_dvxwidth == 0) {
                            $enl_dvxwidth = 320;
                        }
                        $neu_str .= '"><img src="' . $match[2] . $CONFIG['thumb_pfx'] . $match[3] . '" longdesc="dvx::' . path2url($enl_path) . '::' . $enl_dvxwidth . '::' . $enl_dvxheight;
                    } else {
                        if ($enl_filetyplower == 'flv') {
                            $enl_flvheight = $CURRENT_PIC_DATA['pheight'];
                            $enl_flvwidth = $CURRENT_PIC_DATA['pwidth'];
                            if ($enl_flvheight == 0) {
                                $enl_flvheight = 410;
                            }
                            if ($enl_flvwidth == 0) {
                                $enl_flvwidth = 500;
                            }
                            if ($ENLARGEITSET['enl_flvplayer'] == 1) {
                                $neu_str .= '"><img src="' . $match[2] . $CONFIG['thumb_pfx'] . $match[3] . '" longdesc="fl2::../../../' . path2url($enl_path) . '::' . $enl_flvwidth . '::' . $enl_flvheight;
                            } else {
                                $neu_str .= '"><img src="' . $match[2] . $CONFIG['thumb_pfx'] . $match[3] . '" longdesc="flv::../../../' . path2url($enl_path) . '::' . $enl_flvwidth . '::' . $enl_flvheight;
                            }
                        } else {
                            $neu_str .= '"><img src="' . $CONFIG['fullpath'] . path2url($CURRENT_PIC_DATA['filepath'] . $CONFIG['thumb_pfx'] . $CURRENT_PIC_DATA['filename']) . '" longdesc="' . path2url($enl_path);
                        }
                    }
                }
            }
            // build the rest of the string depending on thumb_use setting
            switch ($CONFIG['thumb_use']) {
                case "ht":
                    $neu_str .= '" border="0" height="' . $match[4] . '" name="' . $CURRENT_PIC_DATA['pid'] . '" class="enlargeimg" onclick="enlarge(this);" alt="' . $CURRENT_PIC_DATA['title'] . '" title="" /><br /></a>';
                    break;
                case "wd":
                    $neu_str .= '" border="0" width="' . $match[4] . '" name="' . $CURRENT_PIC_DATA['pid'] . '" class="enlargeimg" onclick="enlarge(this);" alt="' . $CURRENT_PIC_DATA['title'] . '" title="" /><br /></a>';
                    break;
                default:
                    $neu_str .= '" border="0" width="' . $match[4] . '" height="' . $match[5] . '" name="' . $CURRENT_PIC_DATA['pid'] . '" class="enlargeimg" onclick="enlarge(this);" alt="' . $CURRENT_PIC_DATA['title'] . '" title="" /><br /></a>';
                    break;
            }
            if ($CURRENT_PIC_DATA['pid'] == $_GET['enlarge']) {
                $html = str_replace("enl_gifpath = 'plugins/enlargeit/js/'", "enl_openpic = \"enl" . $i . "\";enl_gifpath = 'plugins/enlargeit/js/'", $html);
            }
            //$neu_str .= "<script type=\"text/javascript\">enl_openpic = \"enl".$i."\";</script>";
            // replace
            $html = str_replace($match[0], $neu_str, $html);
        }
    }
    return $html;
}
/**
 * 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;
    }
}
Esempio n. 6
0
function display_thumbnails($album, $cat, $page, $thumbcols, $thumbrows, $display_tabs)
{
    global $xoopsModuleConfig, $xoopsTpl;
    $myts =& MyTextSanitizer::getInstance();
    // MyTextSanitizer object
    $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++;
            $image_size = compute_img_size($row['pwidth'], $row['pheight'], $xoopsModuleConfig['thumb_width']);
            $pic_title = _MD_FUNC_FNAME . $myts->makeTBoxData4Show($row['filename']) . "\n" . _MD_FUNC_FSIZE . ($row['filesize'] >> 10) . _MD_KB . "\n" . _MD_FUNC_DIM . $row['pwidth'] . "x" . $row['pheight'] . "\n" . _MD_FUNC_DATE . formatTimestamp($row['ctime'], 'm');
            $thumb_list[$i]['pos'] = $key < 0 ? $key : $i - 1 + $lower_limit;
            $thumb_list[$i]['image'] = "<img src=\"" . get_pic_url($row, 'thumb') . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"{$pic_title}\" />";
            # deleted </a> at end mcleines
            $thumb_list[$i]['caption'] = $row['caption_text'];
            $thumb_list[$i]['admin_menu'] = '';
            $thumb_list[$i]['pid'] = $row['pid'];
        }
        $xoopsTpl->assign('no_img', 0);
        theme_display_thumbnails($thumb_list, $thumb_count, $album_name, $album, $cat, $page, $total_pages, is_numeric($album), $display_tabs);
    } else {
        $xoopsTpl->assign('no_img', 1);
        $xoopsTpl->assign('lang_no_img', _MD_NO_IMG_TO_DISPLAY);
        $xoopsTpl->assign('album_name', $myts->makeTBoxData4Show($album_name));
    }
}
Esempio n. 7
0
// Duration of crossfade (seconds)
var crossFadeDuration = 3

// Specify the image files
var Pic = new Array() // don't touch this
var Pid = new Array()
var Title = new Array() // don't touch this
// to add more images, just continue
// the pattern, adding to the array below
<?php 
$i = 0;
$j = 0;
$pid = (int) $_GET['pid'];
$start_img = '';
$pic_data = get_pic_data($_GET['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'])) {
Esempio n. 8
0
/**
 * 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;
}
Esempio n. 9
0
            $row = cpg_db_fetch_rowset($result);
            $cat = $row[0]['category'];
        }
        $CURRENT_CAT_NAME = populate_category_name($cat);
        get_meta_album_set($cat);
    } else {
        get_meta_album_set(0);
    }
    $pic_data = get_pic_data($album, $count, $album_name, 0, $XFDSET['xfd_feed_items'], false);
} elseif ($superCage->get->testInt('cat')) {
    // If on category page, show the last uploaded photos for all the albums in that category in feed
    $cat = $superCage->get->getInt('cat');
    $album = 'lastup';
    $CURRENT_CAT_NAME = populate_category_name($cat);
    get_meta_album_set($cat);
    $pic_data = get_pic_data($album, $count, $album_name, 0, $XFDSET['xfd_feed_items'], false);
} else {
    get_meta_album_set(0);
    $query = "SELECT pid,aid,filepath,filename,url_prefix,pwidth,pheight,filesize,ctime,title,keywords,votes,pic_rating,hits,caption,owner_id,u.user_name FROM {$CONFIG['TABLE_PICTURES']} r, {$CONFIG['TABLE_USERS']} u\r\n            {$RESTRICTEDWHERE} AND r.owner_id = u.user_id AND approved = 'YES' ORDER BY pid DESC LIMIT 0, {$XFDSET['xfd_feed_items']}";
    $result = cpg_db_query($query);
    $pic_data = cpg_db_fetch_rowset($result);
}
/**
 * MAIN CODE
 */
$feedtype = $superCage->get->keyExists('type') ? $superCage->get->getEscaped('type') : '';
header("Content-type: text/xml; charset={$CONFIG['charset']}");
if ($feedtype == "atom") {
    atom10();
} else {
    rss20();
Esempio n. 10
0
function lightbox_list($picId)
{
    ################################################
    //Set max number of images
    $max = 100;
    //(-1 for all pics in album)
    ################################################
    global $lang_display_image_php, $CONFIG;
    $i = 0;
    $pid = $picId['pid'];
    $aid = empty($_GET['album']) || $_GET['album'] == 'random' || $_GET['album'] == 'lastup' ? $picId['aid'] : $_GET['album'];
    $pic_data = get_pic_data($aid, $pic_count, $album_name, -1, -1, false);
    $imax = 0;
    //counter
    $max = $max / 2;
    foreach ($pic_data as $picture) {
        if ($picture['pid'] == $pid) {
            //the number of the picture in  order
            $picnumber = $imax;
        }
        $imax++;
    }
    //Check beginning and ending of album
    if (!($max == -1 / 2)) {
        if ($imax > $max) {
            if ($picnumber < $max || $picnumber == 0) {
                $down = 0;
                $up = 0 + $max * 2;
            } elseif ($picnumber + $max > $imax) {
                $down = $imax - $max * 2;
                $up = $imax;
            } else {
                $down = $picnumber - $max;
                $up = $picnumber + $max;
            }
        } else {
            $down = 0;
            $up = $imax;
        }
    } else {
        $down = 0;
        $up = $imax;
    }
    $pic_already_shown = false;
    //fix to remove duplicate entries
    foreach ($pic_data as $picture) {
        if ($i >= $down && $i <= $up) {
            if ($CONFIG['thumb_use'] == 'ht' && $picture['pheight'] > $CONFIG['picture_width']) {
                $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;
            } else {
                $condition = false;
            }
            $picture_page = "./displayimage.php?album=" . $picture['aid'] . "&pos=-" . $picture['pid'];
            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');
                }
                $picture_url_fullsize = get_pic_url($picture, 'fullsize');
                $pic_title = $picture['title'] ? $picture['title'] : strtr(preg_replace("/(.+)\\..*?\\Z/", "\\1", htmlspecialchars($picture['filename'])), "_", " ");
                if ($picture['pid'] == $pid && !$pic_already_shown) {
                    $picList .= "<a href=\"{$picture_url_fullsize}\" picpage=\"{$picture_page}\" rel=\"lightbox[list]\" pid=\"{$picture['pid']}\" title=\"{$pic_title}\" >";
                    $picList .= "<img src=\"{$picture_url}\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
                    $picList .= "</a>\n";
                    $pic_already_shown = true;
                    //fix to remove duplicate entries
                } else {
                    $picList .= "<a href=\"{$picture_url_fullsize}\" picpage=\"{$picture_page}\" rel=\"lightbox[list]\" title=\"{$pic_title}\"></a>\n";
                }
            }
        }
        $i++;
    }
    return $picList;
}
Esempio n. 11
0
/**
 * 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;
    }
}
else if(document.layers) xNN4=true;
else {xIE4Up=document.all && xUA.indexOf('msie')!=-1 && parseInt(navigator.appVersion)>=4;}

// Duration of crossfade (seconds)
var crossFadeDuration = 3

// Specify the image files
var Pic = new Array() // don't touch this
// to add more images, just continue
// the pattern, adding to the array below
<?php 
$i = 0;
$j = 0;
$pid = (int) $HTTP_GET_VARS['pid'];
$start_img = '';
$pic_data = get_pic_data($HTTP_GET_VARS['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;
    } else {
        $condition = false;
    }
    if (is_image($picture['filename'])) {
        if ($CONFIG['make_intermediate'] && $condition) {
            $picture_url = get_pic_url($picture, 'normal');
        } else {
Esempio n. 13
0
function enlargeit_addparams($params)
{
    global $thumb, $CONFIG, $template_thumbnail_view, $CURRENT_PIC_DATA, $enlargeit_supported_image_file_array, $enlargeit_supported_video_file_array;
    // enabled for current user type?
    if (GALLERY_ADMIN_MODE && !$CONFIG['plugin_enlargeit_adminmode']) {
        return $params;
    }
    if (USER_ID && !$CONFIG['plugin_enlargeit_registeredmode']) {
        return $params;
    }
    if (!USER_ID && !$CONFIG['plugin_enlargeit_guestmode']) {
        return $params;
    }
    // Populate the list of files that this plugin should be used with in the first place
    $image_array = explode('/', $CONFIG['plugin_enlargeit_img_types']);
    $movie_array = explode('/', $CONFIG['plugin_enlargeit_mov_types']);
    $enl_filetyplower = strtolower(ltrim(substr($thumb['filename'], strrpos($thumb['filename'], '.')), '.'));
    if (substr($thumb['filename'], 0, 8) == 'youtube_') {
        $enl_filetyplower = 'ytb';
    }
    // get file path depending if normal size pic exists and config setting enl_pictype
    if ($CONFIG['plugin_enlargeit_pictype'] == '1') {
        $enl_path = $CONFIG['fullpath'] . $thumb['filepath'] . $thumb['filename'];
    } elseif ($CONFIG['plugin_enlargeit_pictype'] == '2') {
        $enl_path = $CONFIG['fullpath'] . $thumb['filepath'] . $CONFIG['normal_pfx'] . $thumb['filename'];
    } elseif ($CONFIG['plugin_enlargeit_pictype'] == '0' && is_file($CONFIG['fullpath'] . $thumb['filepath'] . $CONFIG['normal_pfx'] . $thumb['filename'])) {
        $enl_path = $CONFIG['fullpath'] . $thumb['filepath'] . $CONFIG['normal_pfx'] . $thumb['filename'];
    } else {
        $enl_path = $CONFIG['fullpath'] . $thumb['filepath'] . $thumb['filename'];
    }
    // CASE 1: images
    if (in_array($enl_filetyplower, $image_array) == TRUE) {
        $enl_newthumb = '<img src="' . $CONFIG['fullpath'] . $thumb['filepath'] . $CONFIG['thumb_pfx'] . $thumb['filename'] . '" ';
        $enl_newthumb .= 'class="enlargeimg" ';
        if ($CONFIG['thumb_use'] == 'any' && $thumb['pwidth'] >= $thumb['pheight'] || $CONFIG['thumb_use'] == 'wd') {
            $enl_thumbheight = round($thumb['pheight'] / $thumb['pwidth'] * $CONFIG['thumb_width']);
            $enl_newthumb .= 'width="' . $CONFIG['thumb_width'] . '" height="' . $enl_thumbheight . '" ';
        } elseif ($CONFIG['thumb_use'] == 'any' && $thumb['pwidth'] < $thumb['pheight'] || $CONFIG['thumb_use'] == 'ht') {
            $enl_thumbwidth = round($thumb['pwidth'] / $thumb['pheight'] * $CONFIG['thumb_width']);
            $enl_newthumb .= 'width="' . $enl_thumbwidth . '" height="' . $CONFIG['thumb_width'] . '" ';
        }
        $enl_newthumb .= 'border="0" onclick="enlarge(this);" longdesc="' . path2url($enl_path) . '" name="' . $thumb['pid'] . '" ';
        $enl_newthumb .= 'alt="' . $thumb['title'] . '" />';
        $more_params = array('{LINK_ONCLICK}' => 'onclick="return false;"', '{THUMB}' => $enl_newthumb);
    } elseif (in_array($enl_filetyplower, $movie_array) == TRUE) {
        $pid = $thumb['pid'];
        // For flash or movie files we need some more data from the database
        $result = cpg_db_query("SELECT aid from {$CONFIG['TABLE_PICTURES']} WHERE pid='{$pid}' LIMIT 1");
        $row = mysql_fetch_array($result);
        $album = $row['aid'];
        $pic_data = get_pic_data($album, $pic_count, $album_name, -1, -1, false);
        for ($pos = 0; $pic_data[$pos]['pid'] != $pid && $pos < $pic_count; $pos++) {
            $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
        }
        $CURRENT_PIC_DATA = $pic_data[0];
        if ($CURRENT_PIC_DATA['pwidth'] == 0) {
            $CURRENT_PIC_DATA['pwidth'] = 500;
        }
        if ($CURRENT_PIC_DATA['pheight'] == 0) {
            $CURRENT_PIC_DATA['pheight'] = 410;
        }
        if ($enl_filetyplower == 'swf') {
            $enl_newthumb = '<img src="images/thumbs/thumb_swf.png" class="enlargeimg" width="' . $thumb['pwidth'] . '" height="' . $thumb['pheight'] . '" ';
        } else {
            $enl_newthumb = '<img src="images/thumbs/thumb_movie.png" class="enlargeimg" width="' . $thumb['pwidth'] . '" height="' . $thumb['pheight'] . '" ';
        }
        $enl_newthumb .= 'border="0" onclick="enlarge(this);" ';
        if ($enl_filetyplower == 'swf') {
            $enl_newthumb .= 'longdesc="swf::' . path2url($enl_path) . '::' . $CURRENT_PIC_DATA['pwidth'] . '::' . $CURRENT_PIC_DATA['pheight'] . '" ';
        } elseif ($enl_filetyplower == 'flv') {
            if ($CONFIG['plugin_enlargeit_flvplayer'] == '0') {
                $enl_newthumb .= 'longdesc="fl2::../../../../' . path2url($enl_path) . '::' . $CURRENT_PIC_DATA['pwidth'] . '::' . $CURRENT_PIC_DATA['pheight'] . '" ';
            } else {
                $enl_newthumb .= 'longdesc="flv::../../../../' . path2url($enl_path) . '::' . $CURRENT_PIC_DATA['pwidth'] . '::' . $CURRENT_PIC_DATA['pheight'] . '" ';
            }
        } elseif ($enl_filetyplower == 'dvx') {
            $enl_newthumb .= 'longdesc="dvx::' . path2url($enl_path) . '::' . $CURRENT_PIC_DATA['pwidth'] . '::' . $CURRENT_PIC_DATA['pheight'] . '" ';
        }
        $enl_newthumb .= 'name="' . $thumb['pid'] . '" alt="" title="' . $thumb['title'] . '" />';
        $more_params = array('{LINK_ONCLICK}' => 'onclick="return false;"', '{THUMB}' => $enl_newthumb);
    } else {
        $more_params = array('{LINK_ONCLICK}' => '');
    }
    return array_merge($params, $more_params);
}
Esempio n. 14
0
function lightbox_list($picId)
{
    global $lang_display_image_php, $CONFIG, $thisplugin, $LINEBREAK;
    // Set max size/count of picture list plugin_lightbox_nfn_maxpics
    $lb_max = $CONFIG['plugin_lightbox_nfn_maxpics'];
    if ($lb_max <= 1) {
        $max = -1;
    } else {
        $max = $lb_max;
    }
    $picList = '';
    // Script to displayimage page with a few variables
    $slide_time = $CONFIG['plugin_lightbox_nfn_slidetime'];
    $resize = $CONFIG['plugin_lightbox_nfn_sizespeed'];
    $imfade = $CONFIG['plugin_lightbox_nfn_imagefade'];
    $fadeinout = $CONFIG['plugin_lightbox_nfn_containerfade'];
    $swap_style = $CONFIG['plugin_lightbox_nfn_fade_swap'];
    $border = $CONFIG['plugin_lightbox_nfn_border'];
    $show_download = $CONFIG['plugin_lightbox_nfn_download'];
    if (USER_ID && $show_download == 1 || $show_download == 2) {
        $download_show = 1;
    } else {
        $download_show = 0;
    }
    $picList = <<<EOT
{$LINEBREAK}
<script type="text/javascript"><!--
jQuery(function() {var settings = {showDownload: {$download_show}, slideShowTimer: {$slide_time}, containerResizeSpeed: {$resize}, imageFade: {$imfade}, inFade: {$fadeinout}, swapFade: {$swap_style}}, settings;
\$('a.lightbox').lightBox(settings); });//-->\t
</script>
{$LINEBREAK}
EOT;
    $i = 0;
    $pid = $picId['pid'];
    $superCage = Inspekt::makeSuperCage();
    $lb_alb = $superCage->get->getRaw('album');
    $lb_ran = $superCage->get->getRaw('random');
    $aid = empty($lb_alb) || $lb_ran || $superCage->get->getRaw('lastup') ? $picId['aid'] : $lb_alb;
    $pic_data = get_pic_data($aid, $pic_count, $album_name, -1, -1, false);
    $imax = 0;
    //counter
    $max = $max / 2;
    foreach ($pic_data as $picture) {
        if ($picture['pid'] == $pid) {
            //the number of the picture in  order
            $picnumber = $imax;
        }
        $imax++;
    }
    //Check beginning and ending of album
    if (!($max == -1 / 2)) {
        if ($imax > $max) {
            if ($picnumber < $max || $picnumber == 0) {
                $down = 0;
                $up = 0 + $max * 2;
            } elseif ($picnumber + $max > $imax) {
                $down = $imax - $max * 2;
                $up = $imax;
            } else {
                $down = $picnumber - $max;
                $up = $picnumber + $max;
            }
        } else {
            $down = 0;
            $up = $imax;
        }
    } else {
        $down = 0;
        $up = $imax;
    }
    $pic_already_shown = false;
    //fix to remove duplicate entries
    foreach ($pic_data as $picture) {
        if ($i >= $down && $i <= $up) {
            if ($CONFIG['thumb_use'] == 'ht' && $picture['pheight'] > $CONFIG['picture_width']) {
                $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;
            } else {
                $condition = false;
            }
            $picture_page = "./displayimage.php?album=" . $picture['aid'] . "&pos=-" . $picture['pid'];
            if (is_image($picture['filename'])) {
                $superCage = Inspekt::makeSuperCage();
                if ($CONFIG['make_intermediate'] && $condition) {
                    $picture_url = get_pic_url($picture, 'normal');
                } else {
                    $picture_url = get_pic_url($picture, 'fullsize');
                }
                $picture_url_fullsize = get_pic_url($picture, 'fullsize');
                // add config here
                $pic_title = $picture['title'] ? $picture['title'] : strtr(preg_replace("/(.+)\\..*?\\Z/", "\\1", htmlspecialchars($picture['filename'])), "_", " ");
                $picture_page .= '#top_display_media';
                // 	variable set caption plugin_lightbox_nfn_caption
                $pic_caption = '';
                $show_caption = $CONFIG['plugin_lightbox_nfn_caption'];
                if ($show_caption == 1) {
                    $pic_caption = $picture['caption'] ? $picture['caption'] : strtr(preg_replace("/(.+)\\..*?\\Z/", "\\1", htmlspecialchars($picture['caption'])), "_", " ");
                }
                if ($picture['pid'] == $pid && !$pic_already_shown) {
                    $picList .= "<a href=\"{$picture_url_fullsize}\" picpage=\"{$picture_page}\" class=\"lightbox\" pid=\"{$picture['pid']}\" title=\"{$pic_title}\" caption=\"{$pic_caption}\">";
                    $picList .= "<img src=\"{$picture_url}\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
                    $picList .= "</a>\n";
                    $pic_already_shown = true;
                    //fix to remove duplicate entries
                } else {
                    $picList .= "<a href=\"{$picture_url_fullsize}\" picpage=\"{$picture_page}\" class=\"lightbox\" pid=\"{$picture['pid']}\" title=\"{$pic_title}\" caption=\"{$pic_caption}\" rel=\"nofollow\"></a>\n";
                }
            }
        }
        $i++;
    }
    return $picList;
}
function display_film_strip($album, $cat, $pos)
{
    global $CONFIG, $AUTHORIZED, $HTTP_GET_VARS;
    global $album_date_fmt, $lang_display_thumbnails, $lang_errors, $lang_byte_units;
    $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_display_thumbnails['filename'] . $row['filename'] . "\n" . $lang_display_thumbnails['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($pic_url);
                $row['pwidth'] = $image_info[0];
                $row['pheight'] = $image_info[1];
            }
            $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'] = $row['caption_text'];
            $thumb_list[$i]['admin_menu'] = '';
        }
        return theme_display_film_strip($thumb_list, $thumb_count, $album_name, $album, $cat, $pos, is_numeric($album));
    } else {
        theme_no_img_to_display($album_name);
    }
}
Esempio n. 16
0
    $cat = $_GET['cat'];
    $album_name_keyword = easyrss_get_cat_name($cat);
    $CURRENT_CAT_NAME = $album_name_keyword['name'];
    get_meta_album_set($cat, $META_ALBUM_SET);
}
if (isset($_GET['cat']) && $_GET['cat'] < 0) {
    $cat = $_GET['cat'];
    $album_name_keyword = get_album_name(-$cat);
    $CURRENT_CAT_NAME = $album_name_keyword['title'];
    $META_ALBUM_SET = "AND aid IN (" . -$cat . ")" . $ALBUM_SET;
}
//Changes these to point to your site if the following is not giving correct results.
$link_url = $CONFIG['ecards_more_pic_target'] . "displayimage.php?pos=-";
$image_url = $CONFIG['ecards_more_pic_target'] . "albums/";
$META_ALBUM_SET .= $forbidden_set_string;
$data = get_pic_data($album, $thumb_count, $album_name, $lower_limit, $thumb_per_page);
header("content-type: text/xml");
//maybe you must change the encoding to iso-8859-1.
$rssHeader = <<<EOT
<?xml version="1.0" encoding="iso-8859-7"?>
<rss version="2.0" 
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
>
<channel>
    <title>{$CONFIG['gallery_name']}: {$CONFIG['gallery_description']} - {$album_name}</title>
    <link>{$CONFIG['ecards_more_pic_target']}</link>
    <description>{$CONFIG['gallery_description']} - {$album_name}</description>
    <generator>{$CONFIG['ecards_more_pic_target']}rss.php</generator>
EOT;
echo $rssHeader;
Esempio n. 17
0
    }
    $row = mysql_fetch_array($result);
    $album = $row['aid'];
    $pic_data = get_pic_data($album, $pic_count, $album_name, -1, -1, false);
    for ($pos = 0; $pic_data[$pos]['pid'] != $pid && $pos < $pic_count; $pos++) {
    }
    $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
    $CURRENT_PIC_DATA = $pic_data[0];
} elseif (isset($_GET['pos'])) {
    $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
    if ($pic_count == 0) {
        cpg_die(INFORMATION, $lang_errors['no_img_to_display'], __FILE__, __LINE__);
    } elseif (count($pic_data) == 0 && $pos >= $pic_count) {
        $pos = $pic_count - 1;
        $human_pos = $pos + 1;
        $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
    }
    $CURRENT_PIC_DATA = $pic_data[0];
}
$enl_img = isset($_GET['enl_img']) ? $_GET['enl_img'] : 'wurst';
echo '<table cellspacing="1" style="width:100%;height:100%">';
echo '<tr>';
echo '<td colspan="2" class="enl_infotablehead" align="center"><b>' . $lang_rate_pic['rate_this_pic'] . '</b><br />';
if ($CURRENT_PIC_DATA['votes'] > 0) {
    echo sprintf($lang_picinfo['Rating'], $CURRENT_PIC_DATA['votes']) . ': ' . round($CURRENT_PIC_DATA['pic_rating'] / 2000, 2) . '/5';
}
echo '</td>';
echo '</tr>';
echo '<tr><td class="enl_infotable" width="50%" align="right"><a href="javascript:;" title="' . $lang_rate_pic['great'] . '" rel="nofollow"><img width="65" height="14" onclick="enl_ajaxfollow(this);" name="index.php?file=enlargeit/enl_rtepic&amp;pic=' . $CURRENT_PIC_DATA['pid'] . '&amp;rate=5&amp;enl_img=' . $enl_img . '" src="plugins/enlargeit/rating/rating5.gif" border="0" alt="' . $lang_rate_pic['great'] . '" /><br /></a></td><td class="enl_infotable" width="50%" align="left">' . $lang_rate_pic['great'] . '</td></tr>';
echo '<tr><td class="enl_infotable" width="50%" align="right"><a href="javascript:;" title="' . $lang_rate_pic['excellent'] . '" rel="nofollow"><img width="65" height="14" onclick="enl_ajaxfollow(this);" name="index.php?file=enlargeit/enl_rtepic&amp;pic=' . $CURRENT_PIC_DATA['pid'] . '&amp;rate=4&amp;enl_img=' . $enl_img . '" src="plugins/enlargeit/rating/rating4.gif" border="0" alt="' . $lang_rate_pic['excellent'] . '" /><br /></a></td><td class="enl_infotable" width="50%" align="left">' . $lang_rate_pic['excellent'] . '</td></tr>';
echo '<tr><td class="enl_infotable" width="50%" align="right"><a href="javascript:;" title="' . $lang_rate_pic['good'] . '" rel="nofollow"><img width="65" height="14" onclick="enl_ajaxfollow(this);" name="index.php?file=enlargeit/enl_rtepic&amp;pic=' . $CURRENT_PIC_DATA['pid'] . '&amp;rate=3&amp;enl_img=' . $enl_img . '" src="plugins/enlargeit/rating/rating3.gif" border="0" alt="' . $lang_rate_pic['good'] . '" /><br /></a></td><td class="enl_infotable" width="50%" align="left">' . $lang_rate_pic['good'] . '</td></tr>';
Esempio n. 18
0
function thumb_rotate_thumb_display($params)
{
    global $CONFIG;
    if ($CONFIG['plugin_thumb_rotate_admin_only'] == 1 && !GALLERY_ADMIN_MODE) {
        return $params;
    }
    $gd_extension_array = array('jpg', 'jpeg', 'gif', 'png');
    // Create the super cage
    $superCage = Inspekt::makeSuperCage();
    // Extract the needed information from the thumbnail params array
    $link_target_array = parse_url(str_replace('&amp;', '&', $params['{LINK_TGT}']));
    parse_str($link_target_array['query'], $link_target_param_array);
    unset($link_target_array);
    $pid = $link_target_param_array['pid'];
    $pos = $link_target_param_array['pos'];
    $album = $link_target_param_array['album'];
    unset($link_target_param_array);
    if (!$album) {
        // Try to extract the album from the URL param
        if ($superCage->get->keyExists('album') == TRUE) {
            $album = $superCage->get->getAlnum('album');
        }
    }
    if (is_int($album) != TRUE) {
        unset($album);
    }
    // Extract the needed information about the individual pic using the built-in methods of coppermine (code taken from displayimage.php)
    if ($pos < 0 && !$pid) {
        $pid = -$pos;
    }
    if (!$album) {
        $result = cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE pid='{$pid}' {$FORBIDDEN_SET} LIMIT 1");
        if (mysql_num_rows($result) == 0) {
            cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
        }
        $row = mysql_fetch_assoc($result);
        mysql_free_result($result);
        $album = $row['aid'];
    }
    if (!$pos) {
        $pos = get_pic_pos($album, $pid);
    }
    $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
    $CURRENT_PIC_DATA = $pic_data[0];
    $CURRENT_PIC_DATA['extension'] = ltrim(substr($CURRENT_PIC_DATA['filename'], strrpos($CURRENT_PIC_DATA['filename'], '.')), '.');
    $CURRENT_PIC_DATA['filename_without_extension'] = str_replace('.' . $CURRENT_PIC_DATA['extension'], '', $CURRENT_PIC_DATA['filename']);
    if ($CONFIG['thumb_use'] == 'any' || $CONFIG['thumb_use'] == 'ex') {
        $CURRENT_PIC_DATA['maxthumb'] = max($CONFIG['thumb_width'], $CONFIG['thumb_height']);
    } elseif ($CONFIG['thumb_use'] == 'ht') {
        $CURRENT_PIC_DATA['maxthumb'] = $CONFIG['thumb_height'];
    } else {
        $CURRENT_PIC_DATA['maxthumb'] = $CONFIG['thumb_width'];
    }
    $thumb_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CURRENT_PIC_DATA['maxthumb']);
    $CURRENT_PIC_DATA['twidth'] = $thumb_size['width'];
    $CURRENT_PIC_DATA['theight'] = $thumb_size['height'];
    // End Extract - we now have all needed data concerning the individual pic
    // Let's determine if the file is cached already
    $rotate_image_create_file = 0;
    $rotate_image_create_dbrecord = 0;
    $result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PREFIX']}plugin_thumb_rotate WHERE pid = '{$pid}'");
    if (!mysql_num_rows($result)) {
        // There is NO cached record in the database --- start
        mysql_free_result($result);
        $rotate_image_create_file = 1;
        $rotate_image_create_dbrecord = 1;
        // There is NO cached record in the database --- end
    } else {
        // There IS a cached record in the database --- start
        $row = mysql_fetch_array($result);
        $rotate_image_create_dbrecord = 0;
        if (file_exists($CONFIG['fullpath'] . $row['filepath'])) {
            $rotate_image_create_file = 0;
        } else {
            $rotate_image_create_file = 1;
        }
        mysql_free_result($result);
        // There IS a cached record in the database --- end
    }
    // Apply the delay --- start
    if ($CONFIG['plugin_thumb_rotate_timelimit'] > 0) {
        if (time() - $CONFIG['plugin_thumb_rotate_timestamp'] > $CONFIG['plugin_thumb_rotate_timelimit']) {
            // The time stamp difference is greater than the set config parameter, so we can proceed with thumbnail creation
        } else {
            // The time stamp difference is smaller - don't process the thumb to save resources
            $rotate_image_create_file = 0;
            $rotate_image_create_dbrecord = 0;
        }
    }
    // Apply the delay --- end
    if ($rotate_image_create_file == 1) {
        $created_image_array = thumb_rotate_image_create($CURRENT_PIC_DATA);
        if ($CONFIG['plugin_thumb_rotate_timelimit'] > 0) {
            // Write the current time stamp to the db
            $time = time();
            cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$time}' WHERE name='plugin_thumb_rotate_timestamp'");
        }
    }
    if ($rotate_image_create_dbrecord == 1 && $created_image_array['path'] != '') {
        $result = cpg_db_query("INSERT IGNORE INTO {$CONFIG['TABLE_PREFIX']}plugin_thumb_rotate ( `pid` , `filepath`, `width`, `height` ) VALUES ('{$pid}', '{$created_image_array['path']}', '{$created_image_array['width']}', '{$created_image_array['height']}');");
    }
    if (!isset($created_image_array)) {
        $created_image_array['width'] = $row['width'];
        $created_image_array['height'] = $row['height'];
    }
    // Finally, let's manipulate the thumbnail HTML
    if (file_exists($CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CONFIG['plugin_thumb_rotate_thumb_pfx'] . $CURRENT_PIC_DATA['filename_without_extension'] . '.' . $CONFIG['plugin_thumb_rotate_filetype'])) {
        if (in_array(strtolower($CURRENT_PIC_DATA['extension']), $gd_extension_array)) {
            $params['{THUMB}'] = str_replace($CURRENT_PIC_DATA['filepath'] . $CONFIG['thumb_pfx'] . $CURRENT_PIC_DATA['filename'], $CURRENT_PIC_DATA['filepath'] . $CONFIG['plugin_thumb_rotate_thumb_pfx'] . $CURRENT_PIC_DATA['filename_without_extension'] . '.' . $CONFIG['plugin_thumb_rotate_filetype'], $params['{THUMB}']);
            $params['{THUMB}'] = str_replace('width="' . $thumb_size['width'] . '"', 'width="' . $created_image_array['width'] . '"', $params['{THUMB}']);
            // Replace the existing width attributes
            $params['{THUMB}'] = str_replace('height="' . $thumb_size['height'] . '"', 'height="' . $created_image_array['height'] . '"', $params['{THUMB}']);
            // Replace the existing height attributes
        } else {
            $params['{THUMB}'] = str_replace($THEME_DIR . 'images/thumbs/thumb_' . $CURRENT_PIC_DATA['extension'] . '.png', $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CONFIG['plugin_thumb_rotate_thumb_pfx'] . $CURRENT_PIC_DATA['filename_without_extension'] . '.' . $CONFIG['plugin_thumb_rotate_filetype'], $params['{THUMB}']);
            $params['{THUMB}'] = str_replace('images/thumbs/thumb_' . $CURRENT_PIC_DATA['extension'] . '.png', $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CONFIG['plugin_thumb_rotate_thumb_pfx'] . $CURRENT_PIC_DATA['filename_without_extension'] . '.' . $CONFIG['plugin_thumb_rotate_filetype'], $params['{THUMB}']);
        }
        $params['{THUMB}'] = str_replace('class="image"', 'class="image" style="border:none;"', $params['{THUMB}']);
        // Remove border CSS
    }
    //$params['{THUMB}'] .= $created_image_array['height'];
    return $params;
}