本文整理汇总了PHP中template_eval函数的典型用法代码示例。如果您正苦于以下问题:PHP template_eval函数的具体用法?PHP template_eval怎么用?PHP template_eval使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了template_eval函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FileMove_config_button
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);
}
示例2: keywords_add_config_button
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);
}
示例3: photo_summary_add_admin_button
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);
}
示例4: keyword_list_add_admin_button
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);
}
示例5: assemble_template_buttons
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;
}
示例6: fix_displayimage
//.........这里部分代码省略.........
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&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);
}
}
}
示例7: create_album
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';
}
示例8: theme_vanity
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);
}
示例9: theme_vanity
function theme_vanity()
{
global $template_vanity;
return template_eval($template_vanity, $params);
}
示例10: define
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__);
}
示例11: theme_display_thumbnails
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) ? '' : '&cat=' . $cat;
$date_link = $date == '' ? '' : '&date=' . $date;
if ($superCage->get->getInt('uid')) {
$uid_link = '&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 . '&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 . '&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) ? "&page={$page}" : '';
$target = "displayimage.php?album={$aid}{$cat_link}{$date_link}&pid={$thumb['pid']}{$uid_link}&msg_id={$thumb['msg_id']}{$page}#comment{$thumb['msg_id']}";
} else {
$target = "displayimage.php?album={$aid}{$cat_link}{$date_link}&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
//.........这里部分代码省略.........
示例12: cpg_db_query
$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);
}
示例13: list_users
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&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("&cat=" . (FIRST_USER_CAT + $user['user_id'])));
}
$page_link = URL::index("&cat=1&page=%d");
theme_display_thumbnails($user_list, $user_count, '', $page_link, $PAGE, $totalPages, false, true, 'user');
}
示例14: create_album
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';
}
示例15: theme_display_thumbnails
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) ? '' : '&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 . '&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 . '&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 . '&page=%d'));
} else {
// start of modified section
$pl = $superCage->get->getAlpha('letter') ? '&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 . '&page=%d' . $pl));
$theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&page=%d' . $pl));
$theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&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}&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;
}