Ejemplo n.º 1
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);
}
Ejemplo n.º 2
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);
}
Ejemplo n.º 3
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);
}
Ejemplo n.º 4
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);
}
Ejemplo n.º 5
0
function assemble_template_buttons($template_buttons, $buttons)
{
    $counter = 0;
    $output = '';
    foreach ($buttons as $button) {
        if (isset($button[4])) {
            $spacer = $button[4];
        } else {
            $spacer = '';
        }
        $params = array('{SPACER}' => $spacer, '{BLOCK_ID}' => $button[3], '{HREF_TGT}' => $button[2], '{HREF_TITLE}' => $button[1], '{HREF_LNK}' => $button[0], '{HREF_ICON}' => $button[6], '{HREF_ATTRIBUTES}' => $button[5]);
        $output .= template_eval($template_buttons, $params);
    }
    return $output;
}
Ejemplo n.º 6
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 create_album()
{
    global $CONFIG, $HTTP_POST_VARS;
    global $ONNEXT_SCRIPT, $ONBACK_SCRIPT, $WIZARD_BUTTONS;
    global $template_create_album;
    global $lang_errors, $lang_xp_publish_php;
    if (!(USER_CAN_CREATE_ALBUMS || USER_IS_ADMIN)) {
        simple_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
    }
    if (USER_IS_ADMIN) {
        $category = (int) $HTTP_POST_VARS['cat'];
    } else {
        $category = FIRST_USER_CAT + USER_ID;
    }
    $query = "INSERT INTO {$CONFIG['TABLE_ALBUMS']} (category, title, uploads, pos, description) VALUES ('{$category}', '" . addslashes($HTTP_POST_VARS['new_alb_name']) . "', 'NO',  '0', '" . addslashes($HTTP_POST_VARS['new_alb_description']) . "')";
    db_query($query);
    $params = array('{NEW_ALB_CREATED}' => sprintf($lang_xp_publish_php['new_alb_created'], $HTTP_POST_VARS['new_alb_name']), '{CONTINUE}' => $lang_xp_publish_php['continue'], '{ALBUM_ID}' => mysql_insert_id());
    echo template_eval($template_create_album, $params);
    $ONNEXT_SCRIPT = 'startUpload();';
    $ONBACK_SCRIPT = 'window.external.FinalBack();';
    $WIZARD_BUTTONS = 'true,true,true';
}
Ejemplo n.º 8
0
function theme_vanity()
{
    global $CONFIG, $THEME_DIR, $template_vanity;
    if (defined('THEME_HAS_VANITY_GRAPHICS')) {
        $location = $THEME_DIR;
    } else {
        $location = '';
    }
    $params = array('{LOCATION}' => $location);
    return template_eval($template_vanity, $params);
}
Ejemplo n.º 9
0
function theme_vanity()
{
    global $template_vanity;
    return template_eval($template_vanity, $params);
}
Ejemplo n.º 10
0
define('IN_COPPERMINE', true);
define('DISPLAYREPORT_PHP', true);
require 'include/init.inc.php';
require 'include/smilies.inc.php';
if (!GALLERY_ADMIN_MODE) {
    cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
}
if ($superCage->get->keyExists('data')) {
    $get_data = $superCage->get->getEscaped('data');
} else {
    cpg_die(CRITICAL_ERROR, $lang_errors['param_missing'], __FILE__, __LINE__);
}
$data = array();
//$data = @unserialize(@base64_decode($_GET['data']));
$data = @unserialize(@base64_decode($get_data));
if (is_array($data)) {
    // Remove HTML tags as we can't trust what we receive
    //foreach($data as $key => $value) $data[$key] = strtr($value, $HTML_SUBST);
    // Load template parameters
    if ($data['t'] == 'comment') {
        $params = array('{LANG_DIR}' => $lang_text_dir, '{TITLE}' => sprintf($lang_report_php['report_subject'], $data['sn'], $data['t']), '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'], '{VIEW_REPORT_TGT}' => '', '{VIEW_REPORT_LNK}' => '', '{URL_PREFIX}' => '', '{SUBJECT}' => $data['su'], '{MESSAGE}' => nl2br(process_smilies($data['m'])), '{SENDER_EMAIL}' => $data['se'], '{SENDER_NAME}' => $data['sn'], '{VIEW_MORE_TGT}' => $CONFIG['ecards_more_pic_target'], '{VIEW_MORE_LNK}' => $lang_report_php['view_more_pics'], '{REASON}' => $data['r'], '{COMMENT}' => $data['c'], '{COMMENT_ID}' => $data['cid'], '{VIEW_COMMENT_LNK}' => $lang_report_php['view_comment'], '{COMMENT_LNK}' => $lang_report_php['go_comment'], '{COMMENT_TGT}' => "{$CONFIG['ecards_more_pic_target']}displayimage.php?pid=" . $data['pid'] . "#comment" . $data['cid'], '{PID}' => $data['pid']);
        // Parse template if report is on a comment
        echo template_eval($template_report_comment, $params);
    } else {
        $params = array('{LANG_DIR}' => $lang_text_dir, '{TITLE}' => sprintf($lang_report_php['report_subject'], $data['sn'], $data['t']), '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'], '{VIEW_REPORT_TGT}' => '', '{VIEW_REPORT_LNK}' => '', '{PIC_URL}' => $data['p'], '{PIC_TGT}' => "{$CONFIG['ecards_more_pic_target']}displayimage.php?pid=" . $data['pid'], '{URL_PREFIX}' => '', '{SUBJECT}' => $data['su'], '{MESSAGE}' => nl2br(process_smilies($data['m'])), '{SENDER_EMAIL}' => $data['se'], '{SENDER_NAME}' => $data['sn'], '{VIEW_MORE_TGT}' => $CONFIG['ecards_more_pic_target'], '{VIEW_MORE_LNK}' => $lang_report_php['view_more_pics'], '{REASON}' => $data['r'], '{PID}' => $data['pid']);
        // Parse template
        echo template_eval($template_report, $params);
    }
} else {
    cpg_die(CRITICAL_ERROR, $lang_report_php['invalid_data'], __FILE__, __LINE__);
}
Ejemplo n.º 11
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;
}
Ejemplo n.º 12
0
            $result = cpg_db_query($sql);
            if (($cat_count = mysql_num_rows($result)) > 0) {
                $rowset = cpg_db_fetch_rowset($result);
                $catStr .= '<ul>' . $LINEBREAK;
                foreach ($rowset as $subcat) {
                    $dtree_counter++;
                    // Album
                    $catStr .= '<li><a href="thumbnails.php?album=' . $subcat['aid'] . '">' . $subcat['title'] . '</a></li>' . $LINEBREAK;
                }
                $catStr .= '</ul>' . $LINEBREAK;
            }
        }
    }
    get_tree_subcat_data(0, 0);
    $output = <<<EOT
<ul id="tree" class="treeview">
<li><a href="index.php">{$CONFIG['gallery_name']}{$lang_list_categories['home']}</a>
{$catStr}
</li>
</ul>
EOT;
    if (defined('THEME_HAS_SIDEBAR_GRAPHICS')) {
        $location = $THEME_DIR;
    } else {
        $location = '';
    }
    // Load template parameters
    $params = array('{LANG_DIR}' => $lang_text_dir, '{TITLE}' => $lang_sidebar_php['sidebar'] . ' - ' . $CONFIG['gallery_name'], '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'], '{SIDEBAR_CONTENT}' => $output, '{SEARCH_TITLE}' => $lang_sidebar_php['search'], '{THEME}' => $CONFIG['theme'], '{LOCATION}' => $location, '{SEARCH_ICON}' => cpg_fetch_icon('search', 0), '{REFRESH_ICON}' => cpg_fetch_icon('reload', 0, $lang_sidebar_php['reload']));
    // Parse template
    echo template_eval($template_sidebar, $params);
}
Ejemplo n.º 13
0
function list_users()
{
    global $db, $CONFIG, $PAGE, $CPG_M_DIR, $CPG_M_URL;
    global $template_user_list_info_box;
    $sql = "SELECT user_id, username, user_avatar as avatar, user_avatar_type, a.title, " . "COUNT(DISTINCT a.aid) as alb_count, " . "COUNT(DISTINCT pid) as pic_count, " . "MAX(pid) as thumb_pid " . "FROM {$CONFIG['TABLE_USERS']} AS u " . "INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON (category = " . FIRST_USER_CAT . " + user_id " . " AND " . VIS_GROUPS . ")" . "LEFT JOIN {$CONFIG['TABLE_PICTURES']} AS p ON (p.aid = a.aid AND approved = '1') " . "GROUP BY user_id, username, user_avatar, user_avatar_type, a.title ORDER BY username";
    $result = $db->sql_query($sql);
    $user_count = $db->sql_numrows($result);
    if (!$user_count) {
        msg_box(USER_LIST, NO_USER_GAL, '', '', '100%');
        $db->sql_freeresult($result);
        return;
    }
    $user_per_page = $CONFIG['thumbcols'] * $CONFIG['thumbrows'];
    $totalPages = ceil($user_count / $user_per_page);
    if ($PAGE > $totalPages) {
        $PAGE = $totalPages;
    }
    $lower_limit = ($PAGE - 1) * $user_per_page;
    $upper_limit = min($user_count, $PAGE * $user_per_page);
    $row_count = $upper_limit - $lower_limit;
    $rowset = array();
    $i = 0;
    $db->sql_rowseek($lower_limit, $result);
    while (($row = $db->sql_fetchrow($result)) && $i++ < $row_count) {
        $rowset[] = $row;
    }
    $db->sql_freeresult($result);
    $user_list = array();
    for ($i = 0; $i < count($rowset); $i++) {
        $user =& $rowset[$i];
        $user_thumb = '<img src="' . $CPG_M_DIR . '/images/nopic.jpg" alt="' . NO_IMG_TO_DISPLAY . '" title="' . NO_IMG_TO_DISPLAY . '" class="image" border="0" />';
        $user_pic_count = $user['pic_count'];
        $user_thumb_pid = $user['thumb_pid'];
        $user_album_count = $user['alb_count'];
        // User avatar as config opt
        if (false === stripos($user['avatar'], 'blank.gif') && strlen($user['avatar']) > 3 && $CONFIG['avatar_private_album']) {
            global $MAIN_CFG;
            if ($user['user_avatar_type'] == 1) {
                $avatar = $MAIN_CFG['avatar']['path'] . '/';
            } else {
                if ($user['user_avatar_type'] == 2) {
                    $avatar = '';
                } else {
                    if ($user['user_avatar_type'] == 3) {
                        $avatar = $MAIN_CFG['avatar']['gallery_path'] . '/';
                    }
                }
            }
            if (isset($avatar)) {
                $user_thumb = '<img src="' . $avatar . $user['avatar'] . '" alt="" class="image" border="0" />';
            }
        } else {
            if ($user_pic_count) {
                $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='{$user_thumb_pid}'";
                $result = $db->sql_query($sql, false, __FILE__, __LINE__);
                if ($db->sql_numrows($result)) {
                    $picture = $db->sql_fetchrow($result);
                    $db->sql_freeresult($result);
                    $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['thumb_width']);
                    $user_thumb = "<img src=\"" . get_pic_url($picture, 'thumb') . "\" {$image_size['geom']} title=\"" . $user['username'] . "\" alt=\"" . $user['username'] . "\" border=\"0\" class=\"image\" />";
                    // $user['username']
                }
            }
        }
        $albums_txt = sprintf(N_ALBUMS, $user_album_count);
        $pictures_txt = sprintf(N_PICS, $user_pic_count);
        $params = array('{username}' => $user['username'], '{USER_PROFILE_LINK}' => URL::index("Your_Account&amp;profile=" . $user['user_id']), '{ALBUMS}' => $albums_txt, '{PICTURES}' => $pictures_txt);
        $caption = template_eval($template_user_list_info_box, $params);
        $user_list[] = array('cat' => FIRST_USER_CAT + $user['user_id'], 'image' => $user_thumb, 'caption' => $caption, 'url' => URL::index("&amp;cat=" . (FIRST_USER_CAT + $user['user_id'])));
    }
    $page_link = URL::index("&amp;cat=1&amp;page=%d");
    theme_display_thumbnails($user_list, $user_count, '', $page_link, $PAGE, $totalPages, false, true, 'user');
}
Ejemplo n.º 14
0
function create_album()
{
    global $CONFIG;
    global $ONNEXT_SCRIPT, $ONBACK_SCRIPT, $WIZARD_BUTTONS;
    global $template_create_album;
    global $lang_errors, $lang_xp_publish_php;
    $superCage = Inspekt::makeSuperCage();
    if (!(USER_CAN_CREATE_ALBUMS || USER_IS_ADMIN)) {
        simple_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
    }
    if (USER_IS_ADMIN) {
        $category = $superCage->post->getInt('cat');
    } else {
        $category = FIRST_USER_CAT + USER_ID;
    }
    $user_id = USER_ID;
    $query = "INSERT INTO {$CONFIG['TABLE_ALBUMS']} (category, title, uploads, pos, description, owner) VALUES ('{$category}', '" . $superCage->post->getEscaped('new_alb_name') . "', 'NO',  '0', '', {$user_id})";
    cpg_db_query($query);
    $new_alb_name = $superCage->post->getMatched('new_alb_name', '/^[0-9A-Za-z\\/_]+$/');
    $new_alb_name = $new_alb_name[1];
    $params = array('{NEW_ALB_CREATED}' => sprintf($lang_xp_publish_php['new_alb_created'], $new_alb_name), '{CONTINUE}' => $lang_xp_publish_php['continue'], '{ALBUM_ID}' => mysql_insert_id($CONFIG['LINK_ID']));
    echo template_eval($template_create_album, $params);
    $ONNEXT_SCRIPT = 'startUpload();';
    $ONBACK_SCRIPT = 'window.external.FinalBack();';
    $WIZARD_BUTTONS = 'true,true,true';
}
Ejemplo n.º 15
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;
 }
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();
}
Ejemplo n.º 17
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);
}
Ejemplo n.º 18
0
// Create and send the e-card
if (count($HTTP_POST_VARS) > 0 && $valid_sender_email && $valid_recipient_email) {
    $gallery_url_prefix = $CONFIG['ecards_more_pic_target'] . (substr($CONFIG['ecards_more_pic_target'], -1) == '/' ? '' : '/');
    if ($CONFIG['make_intermediate'] && max($row['pwidth'], $row['pheight']) > $CONFIG['picture_width']) {
        $n_picname = get_pic_url($row, 'normal');
    } else {
        $n_picname = get_pic_url($row, 'fullsize');
    }
    if (!stristr($n_picname, 'http:')) {
        $n_picname = $gallery_url_prefix . $n_picname;
    }
    $msg_content = nl2br(process_smilies($message, $gallery_url_prefix));
    $data = array('rn' => $HTTP_POST_VARS['recipient_name'], 'sn' => $HTTP_POST_VARS['sender_name'], 'se' => $sender_email, 'p' => $n_picname, 'g' => $greetings, 'm' => $message);
    $encoded_data = urlencode(base64_encode(serialize($data)));
    $params = array('{LANG_DIR}' => $lang_text_dir, '{TITLE}' => sprintf($lang_ecard_php['ecard_title'], $sender_name), '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'], '{VIEW_ECARD_TGT}' => "{$gallery_url_prefix}displayecard.php?data={$encoded_data}", '{VIEW_ECARD_LNK}' => $lang_ecard_php['view_ecard'], '{PIC_URL}' => $n_picname, '{URL_PREFIX}' => $gallery_url_prefix, '{GREETINGS}' => $greetings, '{MESSAGE}' => $msg_content, '{SENDER_EMAIL}' => $sender_email, '{SENDER_NAME}' => $sender_name, '{VIEW_MORE_TGT}' => $CONFIG['ecards_more_pic_target'], '{VIEW_MORE_LNK}' => $lang_ecard_php['view_more_pics']);
    $message = template_eval($template_ecard, $params);
    $tempTime = time();
    $message .= "Sent by {$sender_name} from IP {$_SERVER['REMOTE_ADDR']} at " . gmstrftime("%A,  %B,%d,%Y %I:%M %p ", time()) . " [GMT]";
    $subject = sprintf($lang_ecard_php['ecard_title'], $sender_name);
    $result = cpg_mail($recipient_email, $subject, $message, 'text/html', $sender_name, $sender_email);
    //write ecard log
    if ($CONFIG['log_ecards'] == 1) {
        $result_log = db_query("INSERT INTO {$CONFIG['TABLE_ECARDS']} (sender_name, sender_email, recipient_name, recipient_email, link, date, sender_ip) VALUES ('{$sender_name}', '{$sender_email}', '{$recipient_name}', '{$recipient_email}',   '{$encoded_data}', '{$tempTime}', '{$_SERVER["REMOTE_ADDR"]}')");
    }
    if (!USER_ID) {
        $USER['name'] = $sender_name;
        $USER['email'] = $sender_email;
    }
    if ($result) {
        pageheader($lang_ecard_php['title'], "<META http-equiv=\"refresh\" content=\"3;url=displayimage.php?album={$album}&pos={$pos}\">");
        msg_box($lang_cpg_die[INFORMATION], $lang_ecard_php['send_success'], $lang_continue, "displayimage.php?album={$album}&pos={$pos}");
Ejemplo n.º 19
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();
}
Ejemplo n.º 20
0
     foreach (get_post_var('reason') as $value) {
         $value = $lang_report_php["{$value}"];
         $reason_list .= "{$value}, ";
     }
 } else {
     $reasons .= "{$lang_report_php['no_reason_given']}";
 }
 $reason_list = substr($reason_list, 0, -2);
 //remove trailing comma and space
 $reasons .= $reason_list;
 $msg_content = nl2br(strip_tags($message));
 $data = array('sn' => $sender_name, 'se' => $sender_email, 'p' => $n_picname, 'su' => $subject, 'm' => $message, 'r' => $reasons, 'c' => $comment, 'cid' => $cid, 'pid' => $pid, 't' => $what);
 $encoded_data = urlencode(base64_encode(serialize($data)));
 $params = array('{LANG_DIR}' => $lang_text_dir, '{TITLE}' => sprintf($lang_report_php['report_subject'], $sender_name, $type), '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'], '{VIEW_REPORT_TGT}' => "{$gallery_url_prefix}displayreport.php?data={$encoded_data}", '{VIEW_REPORT_LNK}' => $lang_report_php['view_report'], '{VIEW_REPORT_LNK_PLAINTEXT}' => $lang_report_php['view_report_plaintext'], '{PIC_URL}' => $n_picname, '{URL_PREFIX}' => $gallery_url_prefix, '{PIC_TGT}' => "{$CONFIG['ecards_more_pic_target']}displayimage.php?pid=" . $pid, '{SUBJECT}' => $subject, '{MESSAGE}' => $msg_content, '{PLAINTEXT_MESSAGE}' => $message, '{SENDER_EMAIL}' => $sender_email, '{SENDER_NAME}' => $sender_name, '{VIEW_MORE_TGT}' => $CONFIG['ecards_more_pic_target'], '{VIEW_MORE_LNK}' => $lang_report_php['view_more_pics'], '{REASON}' => $reasons, '{COMMENT}' => $comment, '{COMMENT_ID}' => $cid, '{VIEW_COMMENT_LNK}' => $lang_report_php['view_comment'], '{COMMENT_TGT}' => "{$CONFIG['ecards_more_pic_target']}displayimage.php?pid={$pid}#comment{$cid}", '{PID}' => $pid);
 $message = template_eval($template, $params);
 $plaintext_message = template_eval($template_report_plaintext, $params);
 $tempTime = time();
 $message .= sprintf($lang_report_php['report_footer'], $sender_name, $raw_ip, localised_date(-1, $lang_date['comment']));
 $subject = sprintf($lang_report_php['report_subject'], $sender_name, $type);
 $result = cpg_mail('admin', $subject, $message, 'text/html', $sender_name, $sender_email, $plaintext_message);
 /*//write log
   if ($CONFIG['log_ecards'] == 1) {
       $result_log = cpg_db_query("INSERT INTO {$CONFIG['TABLE_ECARDS']} (sender_name, sender_email, recipient_name, recipient_email, link, date, sender_ip) VALUES ('$sender_name', '$sender_email', '$recipient_name', '$recipient_email',   '$encoded_data', '$tempTime', '$raw_ip')");
   }*/
 if (!USER_ID) {
     $USER['name'] = $sender_name;
     $USER['email'] = $sender_email;
 }
 if ($result) {
     pageheader($lang_report_php['title'], "<meta http-equiv=\"refresh\" content=\"3;url=displayimage.php?pid={$pid}\" />");
     msg_box($lang_cpg_die[INFORMATION], $lang_report_php['send_success'], $lang_common['continue'], "displayimage.php?pid={$pid}");
Ejemplo n.º 21
0
  $Date: 2008-04-12 12:00:19 +0200 (Sa, 12 Apr 2008) $
**********************************************/
define('IN_COPPERMINE', true);
define('DISPLAYECARD_PHP', true);
require 'include/init.inc.php';
require 'include/smilies.inc.php';
if (!isset($_GET['data'])) {
    cpg_die(CRITICAL_ERROR, $lang_errors['param_missing'], __FILE__, __LINE__);
}
$data = array();
$data = @unserialize(@base64_decode($_GET['data']));
// attempt to obtain full link from db if ecard logging enabled and min 12 chars of data is provided and only 1 match
if (!is_array($data) && $CONFIG['log_ecards'] && strlen($_GET['data']) > 12) {
    $result = cpg_db_query("SELECT link FROM {$CONFIG['TABLE_ECARDS']} WHERE link LIKE '{$_GET['data']}%'");
    if (mysql_num_rows($result) === 1) {
        $row = mysql_fetch_assoc($result);
        $data = @unserialize(@base64_decode($row['link']));
    }
}
if (is_array($data)) {
    // Remove HTML tags as we can't trust what we receive
    foreach ($data as $key => $value) {
        $data[$key] = strtr($value, $HTML_SUBST);
    }
    // Load template parameters
    $params = array('{LANG_DIR}' => $lang_text_dir, '{TITLE}' => sprintf($lang_ecard_php['ecard_title'], $data['sn']), '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'], '{VIEW_ECARD_TGT}' => '', '{VIEW_ECARD_LNK}' => '', '{PIC_URL}' => $data['p'], '{URL_PREFIX}' => '', '{GREETINGS}' => $data['g'], '{MESSAGE}' => bb_decode(process_smilies($data['m'])), '{SENDER_EMAIL}' => $data['se'], '{SENDER_NAME}' => $data['sn'], '{VIEW_MORE_TGT}' => $CONFIG['ecards_more_pic_target'], '{VIEW_MORE_LNK}' => $lang_ecard_php['view_more_pics'], '{PID}' => $data['pid'], '{PIC_TITLE}' => $data['pt'], '{PIC_CAPTION}' => $data['pc']);
    // Parse template
    echo template_eval($template_ecard, $params);
} else {
    cpg_die(CRITICAL_ERROR, $lang_displayecard_php['invalid_data'], __FILE__, __LINE__);
}
    print <<<EOT
    <tr>
            <td align="center" class="tableb">
          {$lang_errors['perm_denied']}
          </td>
    </tr>
EOT;
    endtable();
    pagefooter();
} else {
    // zipdownload allowed, go ahead...
    $filelist = array();
    if (count($FAVPICS) > 0) {
        if ($CONFIG['enable_zipdownload'] == 2) {
            $params = array('{GAL_NAME}' => $CONFIG['gallery_name'], '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'], '{GAL_URL}' => $CONFIG['ecards_more_pic_target'] . 'thumbnails.php?album=favpics', '{USERNAME}' => sprintf($lang_thumb_view['zipdownload_username'], USER_NAME), '{DATE}' => localised_date(-1, $lang_date['comment']), '{COPYRIGHTS}' => $lang_thumb_view['zipdownload_copyright']);
            $plaintext_message = template_eval($template_zipfile_plaintext, $params);
            // Garbage collection: get rid of existing readme file
            spring_cleaning('./' . $CONFIG['fullpath'] . 'edit', CPG_HOUR);
            // Create a unique file name
            $readme_filename = 'readme_' . time() . '.txt';
            // Create the temporary readme file
            if ($fd = @fopen($CONFIG['fullpath'] . 'edit/' . $readme_filename, 'wb')) {
                @fwrite($fd, $plaintext_message);
                @fclose($fd);
                // Add the plain text file to the file list
                $filelist[] = 'edit/' . $readme_filename;
            } else {
                // Something went wrong while creating the readme file.
                // We'll continue anyway.
            }
        }
Ejemplo n.º 23
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;
}
Ejemplo n.º 24
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;
    }
Ejemplo n.º 25
0
/**
* list_users()
*
* Get a list of users galleries
*/
function list_users()
{
    global $CONFIG, $PAGE;
    global $lang_list_users, $template_user_list_info_box, $cpg_udb;
    $user_count = 0;
    $rowset = $cpg_udb->list_users_query($user_count);
    if (!$rowset) {
        msg_box($lang_list_users['user_list'], $lang_list_users['no_user_gal'], '', '', 'info');
        return;
    }
    $user_per_page = $CONFIG['thumbcols'] * $CONFIG['thumbrows'];
    $totalPages = ceil($user_count / $user_per_page);
    $user_list = array();
    foreach ($rowset as $user) {
        $cpg_nopic_data = cpg_get_system_thumb('nopic.jpg', $user['user_id']);
        $user_thumb = '<img src="' . $cpg_nopic_data['thumb'] . '" ' . $cpg_nopic_data['whole'] . ' class="image thumbnail" border="0" alt="" />';
        $user_pic_count = $user['pic_count'];
        $user_thumb_pid = $user['gallery_pid'] ? $user['gallery_pid'] : $user['thumb_pid'];
        $user_album_count = $user['alb_count'];
        if ($user_pic_count) {
            $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='{$user_thumb_pid}' AND approved='YES'";
            $result = cpg_db_query($sql);
            if ($result->numRows()) {
                $picture = $result->fetchAssoc(true);
                $pic_url = get_pic_url($picture, 'thumb');
                if (!is_image($picture['filename'])) {
                    $image_info = cpg_getimagesize(urldecode($pic_url));
                    $picture['pwidth'] = $image_info[0];
                    $picture['pheight'] = $image_info[1];
                }
                //thumb cropping
                //$image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size']);
                if (array_key_exists('system_icon', $picture) && $picture['system_icon'] == true) {
                    $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size'], true, 'cat_thumb');
                } else {
                    $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size'], false, 'cat_thumb');
                }
                $user_thumb = "<img src=\"" . $pic_url . "\" class=\"image thumbnail\" {$image_size['geom']} border=\"0\" alt=\"\" />";
            }
        }
        $albums_txt = sprintf($lang_list_users['n_albums'], $user_album_count);
        $pictures_txt = sprintf($lang_list_users['n_pics'], $user_pic_count);
        $params = CPGPluginAPI::filter('user_caption_params', array('{USER_NAME}' => $user['user_name'], '{USER_ID}' => $user['user_id'], '{ALBUMS}' => $albums_txt, '{PICTURES}' => $pictures_txt));
        $caption = template_eval($template_user_list_info_box, $params);
        $user_list[] = array('cat' => FIRST_USER_CAT + $user['user_id'], 'image' => $user_thumb, 'caption' => $caption);
    }
    theme_display_thumbnails($user_list, $user_count, '', '', 1, $PAGE, $totalPages, false, true, 'user');
}
Ejemplo n.º 26
0
 function theme_minicms(&$cms_array)
 {
     global $template_minicms, $MINICMS;
     foreach ($cms_array as $cms) {
         if (GALLERY_ADMIN_MODE) {
             $params = array('{CMS_ID}' => $cms['ID'], '{CMS_TITLE}' => $cms['title'], '{CMS_CPOS}' => $cms['cpos'], '{CMS_NEXT_ID}' => $cms['next_ID'], '{CMS_PREV_ID}' => $cms['prev_ID']);
             $title_bar = template_eval($template_minicms['title_admin'], $params);
         } else {
             $title_bar = $cms['title'];
         }
         starttable("100%", $title_bar, 2);
         $params = array('{CMS_CONTENT}' => $cms['content']);
         echo template_eval($template_minicms['content'], $params);
         endtable();
     }
     if (GALLERY_ADMIN_MODE && $MINICMS['conid'] !== '' && $MINICMS['type'] !== '') {
         $params = array('{CONID}' => $MINICMS['conid'], '{TYPE}' => $MINICMS['type']);
         $title_bar = template_eval($template_minicms['addnew'], $params);
         starttable("100%", $title_bar, 2);
         endtable();
     }
 }
Ejemplo n.º 27
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};
}
Ejemplo n.º 28
0
        }
    }
} elseif ($superCage->post->keyExists('preview')) {
    if ($CONFIG['make_intermediate'] && max($row['pwidth'], $row['pheight']) > $CONFIG['picture_width']) {
        $n_picname = get_pic_url($row, 'normal');
    } else {
        $n_picname = get_pic_url($row, 'fullsize');
    }
    if (!stristr($n_picname, 'http:')) {
        $n_picname = $gallery_url_prefix . $n_picname;
    }
    $msg_content = process_smilies($message, $gallery_url_prefix);
    $data = array('sn' => $superCage->post->noTags('sender_name'), 'se' => $sender_email, 'p' => $n_picname, 'g' => $greetings, 'm' => $message, 'pid' => $pid, 'pt' => $pic_title, 'pc' => $pic_caption);
    $encoded_data = urlencode(base64_encode(serialize($data)));
    $params = array('{LANG_DIR}' => $lang_text_dir, '{TITLE}' => sprintf($lang_ecard_php['ecard_title'], $sender_name), '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'], '{VIEW_ECARD_TGT}' => "{$gallery_url_prefix}displayecard.php?data={$encoded_data}", '{VIEW_ECARD_LNK}' => $lang_ecard_php['preview_view_ecard'], '{PIC_URL}' => $n_picname, '{URL_PREFIX}' => $gallery_url_prefix, '{GREETINGS}' => $greetings, '{MESSAGE}' => bb_decode($msg_content), '{SENDER_EMAIL}' => $sender_email, '{SENDER_NAME}' => $sender_name, '{VIEW_MORE_TGT}' => $CONFIG['ecards_more_pic_target'], '{VIEW_MORE_LNK}' => $lang_ecard_php['view_more_pics'], '{PID}' => $pid, '{PIC_TITLE}' => $pic_title, '{PIC_CAPTION}' => bb_decode($pic_caption), '{PIC_MARKUP}' => $pic_markup);
    $eccontent = template_eval($template_ecard, $params);
    if (preg_match('#<body[^>]*>(.*)</body>#s', $eccontent, $matches)) {
        $eccontent = $matches[1];
    }
    starttable('100%', $icon_array['preview_table'] . $lang_ecard_php['preview']);
    echo '<tr><td>';
    echo $eccontent;
    echo '</td></tr>';
    endtable();
    echo '<br />';
}
if ($CONFIG['show_bbcode_help']) {
    $captionLabel = '&nbsp;' . cpg_display_help('f=empty.htm&amp;h=lang_bbcode_help_title&amp;t=lang_bbcode_help', 470, 245);
}
if ($row['pwidth'] == 0 || $row['pheight'] == 0) {
    $row['pwidth'] = $CONFIG['thumb_width'];
Ejemplo n.º 29
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();
}
Ejemplo n.º 30
0
function ias_die($msg_code, $msg_text, $error_file, $error_line, $output_buffer = false)
{
    global $CONFIG;
    $lang_ias_die = array(INFORMATION => 'Information', ERROR => 'Error', CRITICAL_ERROR => 'Critical error', 'file' => 'File: ', 'line' => 'Line: ');
    $template_ias_die = <<<EOT
    <tr>
      <td class="tableb" align="center">
        <font size="3"><b>{MESSAGE}</b></font>
        <!-- BEGIN file_line -->
        <br /><br />{FILE_TXT}{FILE} - {LINE_TXT}{LINE}
        <!-- END file_line -->
        <!-- BEGIN output_buffer -->
        <br /><br /><div align="left">{OUTPUT_BUFFER}</div>
        <!-- END output_buffer -->
        <br /><br />
      </td>
    </tr>
EOT;
    $ob = ob_get_contents();
    if ($ob) {
        ob_end_clean();
    }
    $params = array('{MESSAGE}' => $msg_text, '{FILE_TXT}' => $lang_ias_die['file'], '{FILE}' => $error_file, '{LINE_TXT}' => $lang_ias_die['line'], '{LINE}' => $error_line, '{OUTPUT_BUFFER}' => $ob);
    echo template_eval($template_ias_die, $params);
    exit;
}