Exemplo n.º 1
0
function keywords_add_config_button($href, $title, $target, $link)
{
    global $template_gallery_admin_menu;
    $new_template = $template_gallery_admin_menu;
    $button = template_extract_block($new_template, 'documentation');
    $params = array('{DOCUMENTATION_HREF}' => $href, '{DOCUMENTATION_TITLE}' => $title, 'target="cpg_documentation"' => $target, '{DOCUMENTATION_LNK}' => $link);
    $new_button = "<!-- BEGIN {$link} -->" . template_eval($button, $params) . "<!-- END {$link} -->\n";
    template_extract_block($template_gallery_admin_menu, 'documentation', "<!-- BEGIN documentation -->" . $button . "<!-- END documentation -->\n" . $new_button);
}
Exemplo n.º 2
0
function FileMove_config_button($href, $title, $target, $link)
{
    global $template_gallery_admin_menu;
    $new_template = $template_gallery_admin_menu;
    $button = template_extract_block($new_template, 'update_database');
    $params = array('update.php' => $href, '{UPDATE_DATABASE_TITLE}' => $title, 'target="cpg_documentation"' => $target, '{UPDATE_DATABASE_LNK}' => $link, '{UPDATE_DATABASE_ICO}' => cpg_fetch_icon('download', 1));
    $new_button = "<!-- BEGIN {$link} -->" . template_eval($button, $params) . "<!-- END {$link} -->\n";
    template_extract_block($template_gallery_admin_menu, 'update_database', "<!-- BEGIN update_database -->" . $button . "<!-- END update_database -->\n" . $new_button);
}
Exemplo n.º 3
0
function keyword_list_add_admin_button($href, $title, $target, $link)
{
    global $template_sys_menu, $template_sys_menu_spacer;
    require 'plugins/keyword_list/include/init.inc.php';
    $new_template = $template_sys_menu;
    $button = template_extract_block($new_template, 'faq');
    $params = array('{FAQ_LNK}' => $target, '{FAQ_TITLE}' => $title, '{FAQ_TGT}' => $href, 'faq' => $link);
    $new_button = "<!-- BEGIN {$link} -->" . template_eval($button, $params) . "<!-- END {$link} -->\n";
    template_extract_block($template_sys_menu, 'faq', "<!-- BEGIN faq -->" . $button . "<!-- END faq -->\n" . $new_button);
}
Exemplo n.º 4
0
function photo_summary_add_admin_button($href, $title, $target, $link)
{
    global $template_sys_menu, $template_sys_menu_spacer;
    require 'plugins/photo_summary/include/init.inc.php';
    $new_template = $template_sys_menu;
    $button = template_extract_block($new_template, 'upload_pic');
    $params = array('{UPL_PIC_LNK}' => $target, '{UPL_PIC_TITLE}' => $title, '{UPL_PIC_TGT}' => $href, 'upload_pic' => $link);
    $new_button = "<!-- BEGIN {$link} -->" . template_eval($button, $params) . "<!-- END {$link} -->\n";
    template_extract_block($template_sys_menu, 'upload_pic', "<!-- BEGIN upload_pic -->" . $button . "<!-- END upload_pic -->\n" . $new_button);
}
function form_publish()
{
    global $CONFIG, $CAT_LIST, $PHP_SELF;
    global $ONNEXT_SCRIPT, $ONBACK_SCRIPT, $WIZARD_BUTTONS;
    global $template_select_album;
    global $lang_xp_publish_php;
    $alb_count = 0;
    $html_album_list = html_album_list($alb_count);
    $html_cat_list = html_cat_list();
    if (!(USER_CAN_CREATE_ALBUMS || USER_IS_ADMIN)) {
        template_extract_block($template_select_album, 'existing_albums');
        template_extract_block($template_select_album, 'create_album');
        $params = array('{WELCOME}' => sprintf($lang_xp_publish_php['welcome'], USER_NAME), '{NO_ALBUM}' => $lang_xp_publish_php['no_alb']);
        echo template_eval($template_select_album, $params);
        $WIZARD_BUTTONS = "false,false,false";
    } elseif (!$alb_count) {
        template_extract_block($template_select_album, 'no_album');
        template_extract_block($template_select_album, 'existing_albums');
        if (!USER_IS_ADMIN) {
            template_extract_block($template_select_album, 'select_category');
        }
        $params = array('{WELCOME}' => sprintf($lang_xp_publish_php['welcome'], USER_NAME), '{CREATE_NEW}' => $lang_xp_publish_php['create_new'], '{ALBUM}' => $lang_xp_publish_php['album'], '{CATEGORY}' => $lang_xp_publish_php['category'], '{SELECT_CATEGORY}' => $html_cat_list, '{POST_ACTION}' => $PHP_SELF . '?cmd=create_album');
        echo template_eval($template_select_album, $params);
        $ONNEXT_SCRIPT = 'create_alb();';
        $ONBACK_SCRIPT = 'window.external.FinalBack();';
        $WIZARD_BUTTONS = 'true,true,false';
    } else {
        template_extract_block($template_select_album, 'no_album');
        if (!USER_IS_ADMIN) {
            template_extract_block($template_select_album, 'select_category');
        }
        $params = array('{WELCOME}' => sprintf($lang_xp_publish_php['welcome'], USER_NAME), '{UPLOAD}' => $lang_xp_publish_php['upload'], '{ALBUM}' => $lang_xp_publish_php['album'], '{SELECT_ALBUM}' => $html_album_list, '{CATEGORY}' => $lang_xp_publish_php['category'], '{SELECT_CATEGORY}' => $html_cat_list, '{CREATE_NEW}' => $lang_xp_publish_php['create_new'], '{POST_ACTION}' => $PHP_SELF . '?cmd=create_album');
        echo template_eval($template_select_album, $params);
        $ONNEXT_SCRIPT = 'create_alb_or_use_existing();';
        $ONBACK_SCRIPT = 'window.external.FinalBack();';
        $WIZARD_BUTTONS = 'true,true,false';
    }
}
Exemplo n.º 6
0
function enlargeit_html_comments($pid)
{
    global $CONFIG, $USER, $CURRENT_ALBUM_DATA, $comment_date_fmt, $HTML_SUBST;
    global $enlargeit_image_comments, $enlargeit_add_your_comment, $lang_display_comments;
    $html = '';
    // report to moderator buttons
    $tmpl_comment_edit_box = template_extract_block($enlargeit_image_comments, 'edit_box_smilies', '{EDIT}');
    template_extract_block($enlargeit_image_comments, 'edit_box_no_smilies');
    template_extract_block($enlargeit_add_your_comment, 'input_box_no_smilies');
    $tmpl_comments_buttons = template_extract_block($enlargeit_image_comments, 'buttons', '{BUTTONS}');
    $tmpl_comments_ipinfo = template_extract_block($enlargeit_image_comments, 'ipinfo', '{IPINFO}');
    if ($CONFIG['comments_sort_descending'] == 1) {
        $comment_sort_order = 'DESC';
    } else {
        $comment_sort_order = 'ASC';
    }
    $result = cpg_db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip, pid FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='{$pid}' ORDER BY msg_id {$comment_sort_order}");
    while ($row = mysql_fetch_array($result)) {
        $user_can_edit = GALLERY_ADMIN_MODE || USER_ID && USER_ID == $row['author_id'] && USER_CAN_POST_COMMENTS || !USER_ID && USER_CAN_POST_COMMENTS && $USER['ID'] == $row['author_md5_id'];
        $comment_buttons = $user_can_edit ? $tmpl_comments_buttons : '';
        $comment_edit_box = '';
        $comment_ipinfo = $row['msg_raw_ip'] && GALLERY_ADMIN_MODE ? $tmpl_comments_ipinfo : '';
        $comment_body = make_clickable($row['msg_body']);
        $smilies = '';
        $ip = $row['msg_hdr_ip'];
        if ($row['msg_hdr_ip'] != $row['msg_raw_ip']) {
            $ip .= ' [' . $row['msg_raw_ip'] . ']';
        }
        $params = array('{EDIT}' => &$comment_edit_box, '{BUTTONS}' => &$comment_buttons, '{IPINFO}' => &$comment_ipinfo);
        $template = template_eval($enlargeit_image_comments, $params);
        $params = array('{MSG_AUTHOR}' => stripslashes($row['msg_author']), '{MSG_ID}' => $row['msg_id'], '{PID}' => $row['pid'], '{EDIT_TITLE}' => &$lang_display_comments['edit_title'], '{CONFIRM_DELETE}' => &$lang_display_comments['confirm_delete'], '{MSG_DATE}' => localised_date($row['msg_date'], $comment_date_fmt), '{MSG_BODY}' => bb_decode($comment_body), '{MSG_BODY_RAW}' => $row['msg_body'], '{OK}' => &$lang_display_comments['OK'], '{SMILIES}' => '', '{IP}' => $ip, '{REPORT_COMMENT_TITLE}' => &$lang_display_comments['report_comment_title'], '{WIDTH}' => $CONFIG['picture_table_width']);
        $html .= template_eval($template, $params);
    }
    if (USER_CAN_POST_COMMENTS && $CURRENT_ALBUM_DATA['comments'] == 'YES') {
        if (USER_ID) {
            $user_name_input = '<tr><td><input type="hidden" name="msg_author" value="" /></td>';
            template_extract_block($enlargeit_add_your_comment, 'user_name_input', $user_name_input);
            $user_name = '';
        } else {
            if (isset($USER['name'])) {
                $user_name = strtr($USER['name'], $HTML_SUBST);
            } else {
                $user_name = $lang_display_comments['your_name'];
            }
        }
        $params = array('{ADD_YOUR_COMMENT}' => $lang_display_comments['add_your_comment'], '{NAME}' => $lang_display_comments['name'], '{COMMENT}' => $lang_display_comments['comment'], '{PIC_ID}' => $pid, '{USER_NAME}' => $user_name, '{MAX_COM_LENGTH}' => $CONFIG['max_com_size'], '{OK}' => $lang_display_comments['OK'], '{SMILIES}' => '', '{WIDTH}' => $CONFIG['picture_table_width']);
        template_extract_block($enlargeit_add_your_comment, 'smilies');
        $html .= template_eval($enlargeit_add_your_comment, $params);
    }
    return $html;
}
Exemplo n.º 7
0
function theme_slideshow()
{
    global $CONFIG, $lang_display_image_php, $template_display_media;
    pageheader($lang_display_image_php['slideshow']);
    include "include/slideshow.inc.php";
    $start_slideshow = '<script language="JavaScript" type="text/JavaScript">runSlideShow()</script>';
    template_extract_block($template_display_media, 'img_desc', $start_slideshow);
    $params = array('{CELL_HEIGHT}' => $CONFIG['picture_width'] + 100, '{IMAGE}' => '<img src="' . $start_img . '" name="SlideShow" class="image" /><br />', '{ADMIN_MENU}' => '');
    starttable();
    echo <<<EOT
        <tr>
            <td align="center" class="navmenu" style="white-space: nowrap;">
                <div id="Title"></div>
            </td>
        </tr>
EOT;
    endtable();
    starttable();
    echo template_eval($template_display_media, $params);
    endtable();
    starttable();
    echo <<<EOT
        <tr>
                <td align="center" class="navmenu" style="white-space: nowrap;">
                        <a href="javascript:endSlideShow()" class="navmenu">{$lang_display_image_php['stop_slideshow']}</a>
                </td>
        </tr>

EOT;
    endtable();
    pagefooter();
}
Exemplo n.º 8
0
function slideshow()
{
    global $CONFIG, $template_display_picture, $CPG_M_DIR;
    if (function_exists('theme_slideshow')) {
        theme_slideshow();
        return;
    }
    pageheader(SLIDESHOW_TITLE);
    require_once "includes/coppermine/slideshow.inc";
    $start_slideshow = '<script language="JavaScript" type="text/JavaScript">runSlideShow()</script>';
    template_extract_block($template_display_picture, 'img_desc', $start_slideshow);
    $params = array('{CELL_HEIGHT}' => $CONFIG['picture_width'] + 100, '{IMAGE}' => '<img src="' . $start_img . '" name="SlideShow" class="image" alt="" /><br />', '{ADMIN_MENU}' => '');
    starttable();
    echo template_eval($template_display_picture, $params);
    endtable();
    starttable();
    echo '
		<tr>
		<td style="text-align:center"  class="navmenu" style="white-space: nowrap;">
		<a href="javascript:endSlideShow()" class="navmenu">' . STOP_SLIDESHOW . '</a>
		</td>
		</tr>
';
    endtable();
    pagefooter();
}
Exemplo n.º 9
0
function theme_slideshow($start_img, $title)
{
    global $CONFIG, $lang_display_image_php, $template_display_media, $lang_common, $album, $pid, $slideshow;
    global $cat, $date, $THEME_DIR;
    pageheader($lang_display_image_php['slideshow']);
    template_extract_block($template_display_media, 'img_desc', $start_slideshow);
    /** set styles to slideshow background */
    $setDimentionW = $CONFIG['picture_width'] + 100;
    $setDimentionH = $CONFIG['picture_width'] + 10;
    if (defined('THEME_HAS_PROGRESS_GRAPHICS')) {
        $prefix = $THEME_DIR;
    } else {
        $prefix = '';
    }
    $params = array('{SLIDESHOW_STYLE}' => 'width:' . $setDimentionW . 'px; height: ' . $setDimentionH . 'px; position: relative;', '{IMAGE}' => '<img id="showImage" src="' . $start_img . '" class="image" alt="" border="" /><br />', '{ADMIN_MENU}' => '', '{LOADER_ICON_PATH}' => $prefix . 'images/loader.gif');
    echo '<a name="top_display_media"></a>';
    starttable();
    echo <<<EOT
        <tr class="noscript">
            <td align="center" class="tableh2">
              <noscript>
                  {$lang_common['javascript_needed']}
              </noscript>
            </td>
        </tr>
        <tr>
            <td align="center" class="navmenu" style="white-space: nowrap;">
                <div id="title">{$title}</div>
            </td>
        </tr>
EOT;
    endtable();
    starttable();
    echo template_eval($template_display_media, $params);
    endtable();
    starttable();
    echo <<<EOT
        <tr>
                <td align="center" id="back-to" class="navmenu" >
                        <a class="navmenu" style="cursor:pointer">{$lang_display_image_php['stop_slideshow']}</a>
                </td>
        </tr>

EOT;
    endtable();
    pagefooter();
}
Exemplo n.º 10
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) ? '' : '&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 = '';
    }
    $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;
}
Exemplo n.º 11
0
    function theme_slideshow($start_img, $title)
    {
        global $CONFIG, $lang_display_image_php, $template_display_media, $lang_common, $album, $pid, $slideshow;
        global $cat, $date;
        pageheader($lang_display_image_php['slideshow']);
        template_extract_block($template_display_media, 'img_desc', $start_slideshow);
        $params = array('{CELL_HEIGHT}' => $CONFIG['picture_width'] + 100, '{IMAGE}' => '<img src="' . $start_img . '" name="SlideShow" class="image" id="showImage" />', '{ADMIN_MENU}' => '');
        starttable();
        echo <<<EOT
        <noscript>
        <tr>
            <td align="center" class="tableh2">
              {$lang_common['javascript_needed']}
            </td>
        </tr>
        </noscript>
        <tr>
            <td align="center" class="navmenu" style="white-space: nowrap;">
                <div id="Title">{$title}</div>
            </td>
        </tr>
EOT;
        endtable();
        starttable();
        echo template_eval($template_display_media, $params);
        endtable();
        starttable();
        echo <<<EOT
        <tr>
                <td align="center" class="navmenu" style="white-space: nowrap;">
                        <a class="navmenu" style="cursor:pointer">{$lang_display_image_php['stop_slideshow']}</a>
                </td>
        </tr>

EOT;
        endtable();
        pagefooter();
    }
Exemplo n.º 12
0
    function theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode = 'thumb', $date = '')
    {
        global $CONFIG;
        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, $lang_main_menu;
        global $REFERER, $lightbox;
        // plugin addition
        $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 : $cat, '{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;
        }
        // plugin addition
        $lightbox['data']['referrer'] = urldecode($REFERER);
        if ($superCage->post->keyExists('search') && !$superCage->get->keyExists('album')) {
            $lightbox['data']['referrer'] .= "?album=search";
        }
        if (isset($lightbox['data']['activate_favsel'])) {
            echo '<form action="' . $lightbox['data']['referrer'] . '" method="post">';
        }
        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}' => $thumb['caption'], '{ADMIN_MENU}' => $thumb['admin_menu']);
                } elseif ($aid == 'random') {
                    // 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']) . '\');';
                        }
                    } else {
                        $target = "displayimage.php?pid={$thumb['pid']}{$uid_link}";
                    }
                    $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => $target, '{THUMB}' => $thumb['image'], '{CAPTION}' => $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']) . '\');';
                        }
                    } else {
                        $target = "displayimage.php?album={$aid}{$cat_link}{$date_link}&amp;pid={$thumb['pid']}{$uid_link}";
                    }
                    $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => $target, '{THUMB}' => $thumb['image'], '{CAPTION}' => $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}' => $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;
        // plugin addition
        if ($lightbox['message'] != '') {
            echo <<<EOT
\t\t<tr>
\t\t\t<td class="tableb" colspan="{$thumbcols}">
\t\t\t\t<div class="cpg_message_info">
\t\t\t\t\t{$lightbox['message']}
\t\t\t\t</div>
\t\t\t</td>
\t\t</tr>
EOT;
        }
        if (isset($lightbox['data']['activate_favkill'])) {
            $confirm = addslashes($lightbox['lang']['Confirm']);
            echo <<<EOT
\t\t<tr>
\t\t\t<td class="tablef" align="center" colspan="{$thumbcols}">
\t\t\t\t<button type="submit" class="button" value="{$lightbox['lang']['Remove selected']}">{$lightbox['icon']['delete']}{$lightbox['lang']['Remove selected']}</button>&nbsp;&nbsp;&nbsp;
\t\t\t\t<button type="submit" class="button" name="clear_favs" value="{$lightbox['lang']['Remove all']}" onclick="return confirm('{$confirm}');">{$lightbox['icon']['delete_all']}{$lightbox['lang']['Remove all']}</button>
\t\t\t</td>
\t\t</tr>
EOT;
        } elseif (isset($lightbox['data']['activate_favsel'])) {
            echo <<<EOT
\t\t<tr>
\t\t\t<td class="tablef" align="center" colspan="{$thumbcols}">
\t\t\t\t<button type="submit" class="button" value="{$lightbox['lang']['Add selected']}" title="{$lightbox['lang']['Add selected files to favorites']}">{$lightbox['icon']['add']}{$lightbox['lang']['Add selected']}</button>&nbsp;
\t\t\t\t<a href="thumbnails.php?album=favpics" title="{$lang_main_menu['fav_title']}" class="admin_menu">{$lightbox['icon']['favorites']}{$lang_main_menu['fav_lnk']}</a>
\t\t\t</td>
\t\t</tr>
EOT;
        }
        if ($display_tabs) {
            $params = array('{THUMB_COLS}' => $thumbcols, '{TABS}' => $tabs_html);
            echo template_eval($tabs, $params);
        }
        endtable();
        // plugin addition
        if (isset($lightbox['data']['activate_favsel'])) {
            echo '</form>';
        }
        echo $spacer;
    }
Exemplo n.º 13
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;
}
Exemplo n.º 14
0
 function theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode = 'thumb')
 {
     global $CONFIG;
     global $template_thumb_view_title_row, $template_fav_thumb_view_title_row, $lang_thumb_view, $template_tab_display, $template_thumbnail_view, $lang_album_list;
     $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;
     $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['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . '&amp;page=%d'));
         $theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . '&amp;page=%d'));
         $theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . '&amp;page=%d'));
     } else {
         // start of modified section
         $pl = $superCage->get->getAlpha('letter') ? '&amp;letter=' . $superCage->get->getAlpha('letter') : '';
         $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['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d' . $pl));
         $theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d' . $pl));
         $theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d' . $pl));
         // end of modified section
     }
     $thumbcols = $CONFIG['thumbcols'];
     $cell_width = ceil(100 / $CONFIG['thumbcols']) . '%';
     $tabs_html = $display_tabs ? create_tabs($nbThumb, $page, $total_pages, $theme_thumb_tab_tmpl) : '';
     // The sort order options are not available for meta albums
     if ($sort_options) {
         $param = array('{ALBUM_NAME}' => $album_name, '{AID}' => $aid, '{PAGE}' => $page, '{NAME}' => $lang_thumb_view['name'], '{TITLE}' => $lang_thumb_view['title'], '{DATE}' => $lang_thumb_view['date'], '{SORT_TA}' => $lang_thumb_view['sort_ta'], '{SORT_TD}' => $lang_thumb_view['sort_td'], '{SORT_NA}' => $lang_thumb_view['sort_na'], '{SORT_ND}' => $lang_thumb_view['sort_nd'], '{SORT_DA}' => $lang_thumb_view['sort_da'], '{SORT_DD}' => $lang_thumb_view['sort_dd'], '{POSITION}' => $lang_thumb_view['position'], '{SORT_PA}' => $lang_thumb_view['sort_pa'], '{SORT_PD}' => $lang_thumb_view['sort_pd']);
         $title = template_eval($template_thumb_view_title_row, $param);
     } else {
         if ($aid == 'favpics' && $CONFIG['enable_zipdownload'] == 1) {
             //Lots of stuff can be added here later
             $param = array('{ALBUM_NAME}' => $album_name, '{DOWNLOAD_ZIP}' => $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 {
         makejumpbox();
         starttable('100%');
     }
     echo $header;
     $i = 0;
     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}' => $thumb['caption'], '{ADMIN_MENU}' => $thumb['admin_menu']);
             } else {
                 $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => "displayimage.php?album={$aid}{$cat_link}&amp;pos={$thumb['pos']}", '{THUMB}' => $thumb['image'], '{CAPTION}' => $thumb['caption'], '{ADMIN_MENU}' => $thumb['admin_menu']);
             }
         } else {
             $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => "index.php?cat={$thumb['cat']}", '{THUMB}' => $thumb['image'], '{CAPTION}' => $thumb['caption'], '{ADMIN_MENU}' => '');
         }
         echo template_eval($thumb_cell, $params);
         if ($i % $thumbcols == 0 && $i < count($thumb_list)) {
             echo $row_separator;
         }
     }
     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;
 }
Exemplo n.º 15
0
function fix_displayimage()
{
    // no specifics for Thumbnail page today.
    if (!defined("DISPLAYIMAGE_PHP")) {
        return;
    }
    global $CONFIG, $film_strip;
    global $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $comments, $picture, $votes, $pic_info, $template_display_media, $THEME_DIR;
    global $saved_template_image_comments, $saved_template_add_your_comment, $lang_display_comments, $lang_contest, $template_image_rating;
    if (!array_key_exists('aid', $CURRENT_ALBUM_DATA)) {
        return;
    }
    //checks if current album is a contest - not extracted in displayimage.php
    $result = cpg_db_query("SELECT contest FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid='{$CURRENT_ALBUM_DATA['aid']}'");
    if ($row = mysql_fetch_row($result)) {
        $CURRENT_ALBUM_DATA['contest'] = $row[0];
    } else {
        return;
    }
    // display the votes as a voting page.
    if ($CURRENT_ALBUM_DATA['votes'] != 'YES' && $CURRENT_ALBUM_DATA['contest'] == 'YES') {
        if (!defined('MAX_RATING')) {
            define('MAX_RATING', 5);
        }
        $title = $lang_contest['result'];
        $votetext = $CURRENT_PIC_DATA['votes'] ? sprintf($lang_contest['evaluation'], round($CURRENT_PIC_DATA['pic_rating'] / 2000, 1), MAX_RATING, $CURRENT_PIC_DATA['votes']) : $lang_rate_pic['no_votes'];
        $votes = $template_image_rating;
        $pattern = "#(<a href)(.*?)(</a>)#s";
        if (preg_match_all($pattern, $votes, $matches)) {
            foreach ($matches[0] as $key => $match) {
                if (preg_match("rating", $match)) {
                    $votes = ereg_replace(preg_quote($match), "", $votes);
                }
            }
        }
        $votes = ereg_replace("{VOTES}", $votetext, $votes);
        $votes = ereg_replace("{TITLE}", $title, $votes);
        $votes = ereg_replace("{LOCATION}", $THEME_DIR, $votes);
        if (preg_match("<!-- BEGIN rating_boxes -->", $votes)) {
            template_extract_block($votes, 'rating_boxes', '');
        }
    }
    //to be used only for contests in progress
    if ($CURRENT_ALBUM_DATA['votes'] == 'YES' && $CURRENT_ALBUM_DATA['contest'] == 'YES') {
        // do not display pic infos,owner names, captions
        $pic_info = "";
        $pattern = "#(<!-- BEGIN img_desc -->)(.*?)(<!-- END img_desc -->)#s";
        if (preg_match($pattern, $picture, $matches)) {
            $picture = str_replace($matches[0], $matches[1] . $matches[3], $picture);
        }
        //findout which image has already been noted by user in the contest and show them with a square in the film strip
        $myvotes = array();
        $query = "SELECT concat(filepath,'{$CONFIG['thumb_pfx']}',filename) FROM `{$CONFIG['TABLE_PREFIX']}user_votes` AS T1, `{$CONFIG['TABLE_PREFIX']}pictures` AS T2 WHERE T1.pid=T2.pid AND user_id  = " . USER_ID;
        $result = cpg_db_query($query);
        while ($row = mysql_fetch_row($result)) {
            $myvotes[] = $row[0];
        }
        $pattern = "#(<img )(.*?albums.*?)(\" border=\"0\")(.*?)(/>)#s";
        if (preg_match_all($pattern, $film_strip, $matches)) {
            foreach ($matches[0] as $key => $match) {
                foreach ($myvotes as $v) {
                    if (strpos($match, $v) !== FALSE) {
                        $matches[3][$key] = " style=\"border:1pix;border-color:grey;\"";
                        break;
                    }
                }
                $film_strip = ereg_replace(preg_quote($match), $matches[1][$key] . $matches[2][$key] . $matches[3][$key] . $matches[4][$key] . $matches[5][$key], $film_strip);
            }
            $film_strip = ereg_replace("class=\"image\"", "", $film_strip);
        }
        //removes alt and title from film_strip
        $pattern = "#(alt=\")(.*?)(\")#s";
        if (preg_match_all($pattern, $film_strip, $matches)) {
            foreach ($matches[0] as $key => $match) {
                $film_strip = ereg_replace(preg_quote($match), "", $film_strip);
            }
        }
        $pattern = "#(title=\")(.*?)(\")#s";
        if (preg_match_all($pattern, $film_strip, $matches)) {
            foreach ($matches[0] as $key => $match) {
                $film_strip = ereg_replace(preg_quote($match), "", $film_strip);
            }
        }
        //and try to set a border on current vote
        $result = cpg_db_query("SELECT rating FROM `{$CONFIG['TABLE_PREFIX']}user_votes` WHERE pid = {$CURRENT_PIC_DATA['pid']} AND user_id  = " . USER_ID);
        if ($row = mysql_fetch_row($result)) {
            $pattern = "#(<img.*?rating{$row[0]}.*?)(border=\"0\")(.*?/>)#s";
            if (preg_match($pattern, $votes, $matches)) {
                $votes = ereg_replace(preg_quote($matches[0]), $matches[1] . "border=\"2\"" . $matches[3], $votes);
            }
        }
        // find if user can vote (not own image) and if can vote verifies that the voting block is not hidden
        if ($CURRENT_PIC_DATA['owner_id'] == USER_ID || !USER_CAN_RATE_PICTURES) {
            //<a href="javascript:location.href='./ratepic.php?pic=22&amp;rate=1'" title="Beurk"><img src="themes/alphadxd/images/rating1.gif" border="0" alt="Beurk" /></a>
            $pattern = "#(<a href.*?ratepic.*?\\>)(.*?)(</a>)#s";
            if (preg_match_all($pattern, $votes, $matches)) {
                foreach ($matches[0] as $key => $match) {
                    $votes = ereg_replace(preg_quote($match), $matches[2][$key], $votes);
                }
            }
        } else {
            $votes = ereg_replace(preg_quote("display: none;"), "", $votes);
        }
        // only display current user's comments in a contest
        if ($CURRENT_ALBUM_DATA['comments'] != 'YES') {
            return;
        }
        $comments = '';
        $pid = $CURRENT_PIC_DATA['pid'];
        if (!$CONFIG['enable_smilies']) {
            $tmpl_comment_edit_box = template_extract_block($saved_template_image_comments, 'edit_box_no_smilies', '{EDIT}');
            template_extract_block($saved_template_image_comments, 'edit_box_smilies');
            template_extract_block($saved_template_add_your_comment, 'input_box_smilies');
        } else {
            $tmpl_comment_edit_box = template_extract_block($saved_template_image_comments, 'edit_box_smilies', '{EDIT}');
            template_extract_block($saved_template_image_comments, 'edit_box_no_smilies');
            template_extract_block($saved_template_add_your_comment, 'input_box_no_smilies');
        }
        $tmpl_comments_buttons = template_extract_block($saved_template_image_comments, 'buttons', '{BUTTONS}');
        template_extract_block($saved_template_image_comments, 'ipinfo', '');
        //suppressed by PL
        template_extract_block($saved_template_image_comments, 'report_comment_button');
        // won't report on own comment, would we?
        $newpostok = true;
        $query = "SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip, pid FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='{$pid}' AND msg_author='" . USER_NAME . "' ORDER BY msg_id DESC LIMIT 1";
        $result = cpg_db_query($query);
        if ($row = mysql_fetch_array($result)) {
            $user_can_edit = true;
            $comment_buttons = $tmpl_comments_buttons;
            $comment_edit_box = $tmpl_comment_edit_box;
            if ($CONFIG['enable_smilies']) {
                $comment_body = process_smilies(make_clickable($row['msg_body']));
                $smilies = generate_smilies("f{$row['msg_id']}", 'msg_body');
            } else {
                $comment_body = make_clickable($row['msg_body']);
                $smilies = '';
            }
            $params = array('{EDIT}' => &$tmpl_comment_edit_box, '{BUTTONS}' => &$tmpl_comments_buttons);
            $template = template_eval($saved_template_image_comments, $params);
            $params = array('{MSG_AUTHOR}' => stripslashes($row['msg_author']), '{MSG_ID}' => $row['msg_id'], '{PID}' => $row['pid'], '{EDIT_TITLE}' => &$lang_display_comments['edit_title'], '{CONFIRM_DELETE}' => &$lang_display_comments['confirm_delete'], '{MSG_DATE}' => localised_date($row['msg_date'], '%d %B %Y'), '{MSG_BODY}' => bb_decode($comment_body), '{MSG_BODY_RAW}' => $row['msg_body'], '{OK}' => &$lang_display_comments['OK'], '{SMILIES}' => $smilies, '{REPORT_COMMENT_TITLE}' => &$lang_display_comments['report_comment_title'], '{WIDTH}' => $CONFIG['picture_table_width']);
            $comments .= template_eval($template, $params);
            $newpostok = false;
            // only 1 comment per author
        }
        if (USER_ID == $CURRENT_PIC_DATA['owner_id'] || USER_ID == 0) {
            $newpostok = false;
        }
        if ($newpostok) {
            $user_name_input = '<tr><td><input type="hidden" name="msg_author" value="' . stripslashes(USER_NAME) . '" /></td>';
            template_extract_block($saved_template_add_your_comment, 'user_name_input', $user_name_input);
            $user_name = '';
            $params = array('{ADD_YOUR_COMMENT}' => $lang_display_comments['add_your_comment'], '{NAME}' => $lang_display_comments['name'], '{COMMENT}' => "", '{PIC_ID}' => $pid, '{USER_NAME}' => $user_name, '{MAX_COM_LENGTH}' => $CONFIG['max_com_size'], '{OK}' => $lang_display_comments['OK'], '{SMILIES}' => '', '{WIDTH}' => $CONFIG['picture_table_width']);
            if ($CONFIG['enable_smilies']) {
                $params['{SMILIES}'] = generate_smilies();
            } else {
                template_extract_block($saved_template_add_your_comment, 'smilies');
            }
            $comments .= template_eval($saved_template_add_your_comment, $params);
        }
    }
}
function msg_box($title, $msg_text, $button_text = "", $button_link = "", $width = "-1")
{
    global $template_msg_box;
    if (!$button_text) {
        template_extract_block($template_msg_box, 'button');
    }
    $params = array('{MESSAGE}' => $msg_text, '{LINK}' => $button_link, '{TEXT}' => $button_text);
    starttable($width, $title);
    echo template_eval($template_msg_box, $params);
    endtable();
}
Exemplo n.º 17
0
function theme_main_menu($which)
{
    global $AUTHORIZED, $CONFIG, $album, $actual_cat, $cat, $REFERER, $CPG_PHP_SELF;
    global $lang_main_menu, $template_sys_menu, $template_sub_menu, $lang_gallery_admin_menu;
    static $sys_menu = '', $sub_menu = '';
    if (${$which} != '') {
        return ${$which};
    }
    //Check whether user has permission to upload file to the current album if any
    $upload_allowed = false;
    if (isset($album) && is_numeric($album)) {
        if (GALLERY_ADMIN_MODE) {
            $upload_allowed = true;
        } else {
            if (USER_ID) {
                $query = "SELECT null FROM {$CONFIG['TABLE_ALBUMS']} WHERE category='" . (FIRST_USER_CAT + USER_ID) . "' AND aid = '{$album}'";
                $user_albums = cpg_db_query($query);
                if (mysql_num_rows($user_albums)) {
                    $upload_allowed = true;
                } else {
                    $upload_allowed = false;
                }
            }
            if (!$upload_allowed) {
                $query = "SELECT null FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < " . FIRST_USER_CAT . " AND uploads='YES' AND (visibility = '0' OR visibility IN " . USER_GROUP_SET . ") AND aid = '{$album}'";
                $public_albums = cpg_db_query($query);
                if (mysql_num_rows($public_albums)) {
                    $upload_allowed = true;
                } else {
                    $upload_allowed = false;
                }
            }
        }
    }
    $album_l = isset($album) ? "?album={$album}" : '';
    $album_12 = $upload_allowed ? "?album={$album}" : '';
    $cat_l = isset($actual_cat) ? "?cat={$actual_cat}" : (isset($cat) ? "?cat={$cat}" : '?cat=0');
    $cat_l2 = isset($cat) ? "&amp;cat={$cat}" : '';
    $my_gallery_id = FIRST_USER_CAT + USER_ID;
    if ($which == 'sys_menu') {
        if (USER_ID) {
            // visitor is logged in
            template_extract_block($template_sys_menu, 'login');
            if ($CONFIG['contact_form_registered_enable'] == 0) {
                template_extract_block($template_sys_menu, 'contact');
            }
            if ($CONFIG['display_sidebar_user'] != 2) {
                template_extract_block($template_sys_menu, 'sidebar');
            }
            list($timestamp, $form_token) = getFormToken();
        } else {
            // visitor is not logged in
            if ($CONFIG['contact_form_guest_enable'] == 0) {
                template_extract_block($template_sys_menu, 'contact');
            }
            if ($CONFIG['display_sidebar_guest'] != 2) {
                template_extract_block($template_sys_menu, 'sidebar');
            }
            template_extract_block($template_sys_menu, 'logout');
            template_extract_block($template_sys_menu, 'my_profile');
            $timestamp = $form_token = '';
        }
        if (!USER_IS_ADMIN) {
            template_extract_block($template_sys_menu, 'enter_admin_mode');
            template_extract_block($template_sys_menu, 'leave_admin_mode');
        } else {
            if (GALLERY_ADMIN_MODE) {
                template_extract_block($template_sys_menu, 'enter_admin_mode');
            } else {
                template_extract_block($template_sys_menu, 'leave_admin_mode');
            }
        }
        if (!USER_CAN_CREATE_ALBUMS) {
            template_extract_block($template_sys_menu, 'my_gallery');
        }
        if (USER_CAN_CREATE_ALBUMS) {
            template_extract_block($template_sys_menu, 'my_profile');
        }
        if (!USER_CAN_UPLOAD_PICTURES && !USER_CAN_CREATE_ALBUMS) {
            template_extract_block($template_sys_menu, 'upload_pic');
        }
        if (USER_ID || !$CONFIG['allow_user_registration']) {
            template_extract_block($template_sys_menu, 'register');
        }
        if (!USER_ID || !$CONFIG['allow_memberlist'] || GALLERY_ADMIN_MODE) {
            template_extract_block($template_sys_menu, 'allow_memberlist');
        }
        $param = array('{HOME_TGT}' => $CONFIG['home_target'], '{HOME_ICO}' => cpg_fetch_icon('home', 1), '{HOME_LNK}' => $lang_main_menu['home_lnk'], '{CONTACT_TGT}' => "contact.php?referer={$REFERER}", '{CONTACT_ICO}' => cpg_fetch_icon('contact', 1), '{CONTACT_LNK}' => $lang_main_menu['contact_lnk'], '{MY_GAL_TGT}' => "index.php?cat={$my_gallery_id}", '{MY_GAL_ICO}' => cpg_fetch_icon('my_gallery', 1), '{MY_GAL_LNK}' => $lang_main_menu['my_gal_lnk'], '{MEMBERLIST_TGT}' => "usermgr.php", '{MEMBERLIST_ICO}' => cpg_fetch_icon('memberlist', 1), '{MEMBERLIST_LNK}' => $lang_main_menu['memberlist_lnk'], '{MY_PROF_TGT}' => "profile.php?op=edit_profile", '{MY_PROF_ICO}' => cpg_fetch_icon('my_profile', 1), '{MY_PROF_LNK}' => $lang_main_menu['my_prof_lnk'], '{ADM_MODE_TGT}' => "mode.php?admin_mode=1&amp;referer={$REFERER}", '{ADM_MODE_ICO}' => cpg_fetch_icon('admin_mode_on', 1), '{ADM_MODE_LNK}' => $lang_main_menu['adm_mode_lnk'], '{USR_MODE_TGT}' => "mode.php?admin_mode=0&amp;referer={$REFERER}", '{USR_MODE_ICO}' => cpg_fetch_icon('admin_mode_off', 1), '{USR_MODE_LNK}' => $lang_main_menu['usr_mode_lnk'], '{SIDEBAR_TGT}' => "sidebar.php?action=install", '{SIDEBAR_LNK}' => $lang_main_menu['sidebar_lnk'], '{SIDEBAR_ICO}' => cpg_fetch_icon('sidebar', 1), '{UPL_PIC_TGT}' => "upload.php{$album_12}", '{UPL_PIC_LNK}' => $lang_main_menu['upload_pic_lnk'], '{UPL_PIC_ICO}' => cpg_fetch_icon('upload', 1), '{REGISTER_TGT}' => "register.php", '{REGISTER_LNK}' => $lang_main_menu['register_lnk'], '{REGISTER_ICO}' => cpg_fetch_icon('add_user', 1), '{LOGIN_LNK}' => $lang_main_menu['login_lnk'], '{LOGIN_ICO}' => cpg_fetch_icon('login', 1), '{LOGOUT_TGT}' => "logout.php?form_token={$form_token}&amp;timestamp={$timestamp}&amp;referer={$REFERER}", '{LOGOUT_LNK}' => $lang_main_menu['logout_lnk'] . " [" . stripslashes(USER_NAME) . "]", '{LOGOUT_ICO}' => cpg_fetch_icon('logout', 1), '{UPL_APP_LNK}' => $lang_gallery_admin_menu['upl_app_lnk'], '{UPL_APP_TGT}' => "editpics.php?mode=upload_approval", '{UPL_APP_ICO}' => cpg_fetch_icon('file_approval', 1), '{ALB_LIST_TGT}' => "index.php{$cat_l}", '{ALB_LIST_LNK}' => $lang_main_menu['alb_list_lnk'], '{ALB_LIST_ICO}' => cpg_fetch_icon('alb_mgr', 1), '{CUSTOM_LNK_TGT}' => $CONFIG['custom_lnk_url'], '{CUSTOM_LNK_LNK}' => $CONFIG['custom_lnk_name'], '{CUSTOM_ICO}' => cpg_fetch_icon('online', 1), '{LASTUP_TGT}' => "thumbnails.php?album=lastup{$cat_l2}", '{LASTUP_LNK}' => $lang_main_menu['lastup_lnk'], '{LASTUP_ICO}' => cpg_fetch_icon('last_uploads', 1), '{LASTCOM_TGT}' => "thumbnails.php?album=lastcom{$cat_l2}", '{LASTCOM_LNK}' => $lang_main_menu['lastcom_lnk'], '{LASTCOM_ICO}' => cpg_fetch_icon('comment', 1), '{TOPN_TGT}' => "thumbnails.php?album=topn{$cat_l2}", '{TOPN_LNK}' => $lang_main_menu['topn_lnk'], '{TOPN_ICO}' => cpg_fetch_icon('most_viewed', 1), '{TOPRATED_TGT}' => "thumbnails.php?album=toprated{$cat_l2}", '{TOPRATED_LNK}' => $lang_main_menu['toprated_lnk'], '{TOPRATED_ICO}' => cpg_fetch_icon('top_rated', 1), '{FAV_TGT}' => "thumbnails.php?album=favpics", '{FAV_LNK}' => $lang_main_menu['fav_lnk'], '{FAV_ICO}' => cpg_fetch_icon('favorites', 1), '{BROWSEBYDATE_TGT}' => 'calendar.php', '{BROWSEBYDATE_LNK}' => $lang_main_menu['browse_by_date_lnk'], '{BROWSEBYDATE_ICO}' => cpg_fetch_icon('calendar', 1), '{SEARCH_TGT}' => "search.php", '{SEARCH_LNK}' => $lang_main_menu['search_lnk'], '{SEARCH_ICO}' => cpg_fetch_icon('search', 1), '{UPL_APP_LNK}' => $lang_gallery_admin_menu['upl_app_lnk'], '{UPL_APP_TGT}' => "editpics.php?mode=upload_approval", '{UPL_APP_ICO}' => cpg_fetch_icon('file_approval', 1));
        if ($CPG_PHP_SELF != 'login.php') {
            $param['{LOGIN_TGT}'] = "login.php?referer={$REFERER}";
        } else {
            $param['{LOGIN_TGT}'] = "login.php";
        }
        if (!$CONFIG['custom_lnk_url']) {
            template_extract_block($template_sys_menu, 'custom_link');
        }
        $sys_menu = template_eval($template_sys_menu, $param);
    }
    return ${$which};
}
Exemplo n.º 18
0
function codebase_sys_user_button($href, $title, $target, $link, $before = 'home')
{
    global $template_sys_menu;
    $new_template = $template_sys_menu;
    $button = template_extract_block($new_template, $before);
    switch ($before) {
        case 'my_gallery':
            $uc_before = 'MY_GAL';
            break;
        case 'allow_memberlist':
            $uc_before = 'MEMBERLIST';
            break;
        case 'upload_approval':
            $uc_before = 'UPL_APP';
            break;
        case 'enter_admin_mode':
            $uc_before = 'ADM_MODE';
            break;
        case 'leave_admin_mode':
            $uc_before = 'ADM_MODE';
            break;
        case 'leave_admin_mode':
            $uc_before = 'USR_MODE';
            break;
        case 'upload_pic':
            $uc_before = 'UPL_PIC';
            break;
        case 'my_profile':
            $uc_before = 'MY_PROF';
        default:
            $uc_before = strtoupper($before);
    }
    $params = array("{{$uc_before}_LNK}" => $link, "{{$uc_before}_TITLE}" => $title, "{{$uc_before}_TGT}" => $href);
    $new_button = "<!-- BEGIN {$link} -->" . template_eval($button, $params) . "<!-- END {$link} -->\n";
    $new_button = preg_replace('/<ul>.*<\\/ul>/s', '', $new_button);
    template_extract_block($template_sys_menu, $before, "<!-- BEGIN {$before} -->" . $button . "<!-- END {$before} -->\n" . $new_button);
}
Exemplo n.º 19
0
function theme_no_img_to_display($album_name)
{
    global $lang_errors, $template_no_img_to_display;
    static $template = '';
    static $spacer;
    if (!$template) {
        $template = $template_no_img_to_display;
        $spacer = template_extract_block($template, 'spacer');
    }
    $params = array('{TEXT}' => $lang_errors['no_img_to_display']);
    starttable('100%', $album_name);
    echo template_eval($template, $params);
    endtable();
}
Exemplo n.º 20
0
function doc_config()
{
    global $template_config;
    $template = eval_tmplfile($template_config, false);
    if (is_admin()) {
        echo template_extract_block($template, 'doc_config_title');
        echo template_extract_block($template, 'doc_config_desc');
    } else {
        echo template_extract_block($template, 'default_config_title');
        //if function is called by another page
    }
}