本文整理汇总了PHP中bb_decode函数的典型用法代码示例。如果您正苦于以下问题:PHP bb_decode函数的具体用法?PHP bb_decode怎么用?PHP bb_decode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bb_decode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_comment
function check_comment(&$str)
{
global $CONFIG, $lang_bad_words, $queries;
// Added according to Andi's proposal: optimization of strip-Tags and max. comment length
// convert some entities
$str = str_replace(array('&', '"', '<', '>', ' ', '''), array('&', '"', '<', '>', ' ', "'"), $str);
// strip tags and cut to max allowed length
$str = trim(substr(strip_tags($str), 0, $CONFIG['max_com_size']));
// re convert some entities
$str = str_replace(array('"', '<', '>', "'"), array('"', '<', '>', '''), $str);
if ($CONFIG['filter_bad_words']) {
$ercp = array();
foreach ($lang_bad_words as $word) {
$ercp[] = '/' . ($word[0] == '*' ? '' : '\\b') . str_replace('*', '', $word) . ($word[strlen($word) - 1] == '*' ? '' : '\\b') . '/i';
}
$str = preg_replace($ercp, '(...)', $str);
}
$com_words = explode(' ', strip_tags(bb_decode($str)));
$replacements = array();
foreach ($com_words as $key => $word) {
if (utf_strlen($word) > $CONFIG['max_com_wlength']) {
$replacements[] = $word;
}
}
$str = str_replace($replacements, '(...)', $str);
}
示例2: check_comment
function check_comment(&$str)
{
global $CONFIG, $lang_bad_words;
// convert some entities
$str = str_replace(array('&', '"', '<', '>', ' ', '''), array('&', '"', '<', '>', ' ', "'"), $str);
// if '<' is no start of a tag (e.g. a lower than + equal), convert it to entity to prevent strip_tags() to clip the comment wrongly
$str = preg_replace("/<([0-9<>=])/", '<\\1', $str);
// strip tags and cut to max allowed length
$str = trim(substr(strip_tags($str), 0, $CONFIG['max_com_size']));
// re convert some entities
$str = str_replace(array('"', '<', '>', "'"), array('"', '<', '>', '''), $str);
if ($CONFIG['filter_bad_words']) {
$ercp = array();
foreach ($lang_bad_words as $word) {
$ercp[] = '/' . ($word[0] == '*' ? '' : '\\b') . str_replace('*', '', $word) . ($word[strlen($word) - 1] == '*' ? '' : '\\b') . '/i';
}
$str = preg_replace($ercp, '(...)', $str);
}
$com_words = explode(' ', strip_tags(bb_decode($str)));
$replacements = array();
foreach ($com_words as $key => $word) {
if (utf_strlen($word) > $CONFIG['max_com_wlength']) {
$replacements[] = $word;
}
}
$str = str_replace($replacements, '(...)', $str);
}
示例3: format_message
function format_message($message)
{
if (!function_exists('process_smilies')) {
include BASE_DIR . 'include' . DS . 'smilies.inc.php';
}
return make_clickable(process_smilies(bb_decode($message)));
}
示例4: check_comment
function check_comment(&$str)
{
global $CONFIG, $lang_bad_words, $queries;
if ($CONFIG['filter_bad_words']) {
$ercp = array();
foreach ($lang_bad_words as $word) {
$ercp[] = '/' . ($word[0] == '*' ? '' : '\\b') . str_replace('*', '', $word) . ($word[strlen($word) - 1] == '*' ? '' : '\\b') . '/i';
}
$str = preg_replace($ercp, '(...)', $str);
}
$com_words = explode(' ', strip_tags(bb_decode($str)));
$replacements = array();
foreach ($com_words as $key => $word) {
if (utf_strlen($word) > $CONFIG['max_com_wlength']) {
$replacements[] = $word;
}
}
$str = str_replace($replacements, '(...)', $str);
}
示例5: 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);
}
}
}
示例6: define
$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__);
}
示例7: get_pic_data
function get_pic_data($album, &$count, &$album_name, $limit1 = -1, $limit2 = -1, $set_caption = true)
{
global $USER, $CONFIG, $ALBUM_SET, $CURRENT_CAT_NAME, $CURRENT_ALBUM_KEYWORD, $HTTP_GET_VARS, $HTML_SUBST, $THEME_DIR, $FAVPICS;
global $album_date_fmt, $lastcom_date_fmt, $lastup_date_fmt, $lasthit_date_fmt;
global $lang_get_pic_data, $lang_meta_album_names, $lang_errors;
$sort_array = array('na' => 'filename ASC', 'nd' => 'filename DESC', 'ta' => 'title ASC', 'td' => 'title DESC', 'da' => 'pid ASC', 'dd' => 'pid DESC');
$sort_code = isset($USER['sort']) ? $USER['sort'] : $CONFIG['default_sort_order'];
$sort_order = isset($sort_array[$sort_code]) ? $sort_array[$sort_code] : $sort_array[$CONFIG['default_sort_order']];
$limit = $limit1 != -1 ? ' LIMIT ' . $limit1 : '';
$limit .= $limit2 != -1 ? ' ,' . $limit2 : '';
if ($limit2 == 1) {
$select_columns = '*';
} else {
$select_columns = 'pid, filepath, filename, url_prefix, filesize, pwidth, pheight, ctime, aid';
}
// Keyword
if (!empty($CURRENT_ALBUM_KEYWORD)) {
$keyword = "OR keywords like '%{$CURRENT_ALBUM_KEYWORD}%'";
} else {
$keyword = '';
}
// Regular albums
if (is_numeric($album)) {
$album_name_keyword = get_album_name($album);
$album_name = $album_name_keyword['title'];
$album_keyword = $album_name_keyword['keyword'];
if (!empty($album_keyword)) {
$keyword = "OR keywords like '%{$album_keyword}%'";
}
$approved = GALLERY_ADMIN_MODE ? '' : 'AND approved=\'YES\'';
$result = db_query("SELECT COUNT(*) from {$CONFIG['TABLE_PICTURES']} WHERE aid='{$album}' {$keyword} {$approved} {$ALBUM_SET}");
$nbEnr = mysql_fetch_array($result);
$count = $nbEnr[0];
mysql_free_result($result);
if ($select_columns != '*') {
$select_columns .= ', title, caption,hits,owner_id,owner_name';
}
$result = db_query("SELECT {$select_columns} from {$CONFIG['TABLE_PICTURES']} WHERE aid='{$album}' {$keyword} {$approved} {$ALBUM_SET} ORDER BY {$sort_order} {$limit}");
$rowset = db_fetch_rowset($result);
mysql_free_result($result);
// Set picture caption
if ($set_caption) {
foreach ($rowset as $key => $row) {
$caption = "<span class=\"thumb_title\">";
$caption .= $rowset[$key]['title'] || $rowset[$key]['hits'] ? $rowset[$key]['title'] : '';
if ($CONFIG['views_in_thumbview']) {
if ($rowset[$key]['title']) {
$caption .= " – ";
}
$caption .= sprintf($lang_get_pic_data['n_views'], $rowset[$key]['hits']);
}
$caption .= "</span>";
if ($CONFIG['caption_in_thumbview']) {
$caption .= $rowset[$key]['caption'] ? "<span class=\"thumb_caption\">" . bb_decode($rowset[$key]['caption']) . "</span>" : '';
}
if ($CONFIG['display_comment_count']) {
$comments_nr = count_pic_comments($row['pid']);
if ($comments_nr > 0) {
$caption .= "<span class=\"thumb_num_comments\">" . sprintf($lang_get_pic_data['n_comments'], $comments_nr) . "</span>";
}
}
if ($CONFIG['display_uploader']) {
$caption .= '<span class="thumb_title"><a href ="profile.php?uid=' . $rowset[$key]['owner_id'] . '">' . $rowset[$key]['owner_name'] . '</a></span>';
}
$rowset[$key]['caption_text'] = $caption;
}
}
return $rowset;
}
// Meta albums
switch ($album) {
case 'lastcom':
// Last comments
if ($ALBUM_SET && $CURRENT_CAT_NAME) {
$album_name = $album_name = $lang_meta_album_names['lastcom'] . ' - ' . $CURRENT_CAT_NAME;
} else {
$album_name = $lang_meta_album_names['lastcom'];
}
$query = "SELECT COUNT(*) from {$CONFIG['TABLE_COMMENTS']}, {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND {$CONFIG['TABLE_COMMENTS']}.pid = {$CONFIG['TABLE_PICTURES']}.pid {$keyword} {$ALBUM_SET}";
$result = db_query($query);
$nbEnr = mysql_fetch_array($result);
$count = $nbEnr[0];
mysql_free_result($result);
if ($select_columns == '*') {
$select_columns = 'p.*';
} else {
$select_columns = str_replace('pid', 'c.pid', $select_columns) . ', msg_id, author_id, msg_author, UNIX_TIMESTAMP(msg_date) as msg_date, msg_body, aid';
}
$TMP_SET = str_replace($CONFIG['TABLE_PICTURES'], 'p', $ALBUM_SET);
$result = db_query("SELECT {$select_columns} FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE approved = 'YES' AND c.pid = p.pid {$keyword} {$TMP_SET} ORDER by msg_id DESC {$limit}");
$rowset = db_fetch_rowset($result);
mysql_free_result($result);
if ($set_caption) {
foreach ($rowset as $key => $row) {
if ($row['author_id']) {
$user_link = '<a href ="profile.php?uid=' . $row['author_id'] . '">' . $row['msg_author'] . '</a>';
} else {
$user_link = $row['msg_author'];
}
$msg_body = strlen($row['msg_body']) > 50 ? @substr($row['msg_body'], 0, 50) . "..." : $row['msg_body'];
//.........这里部分代码省略.........
示例8: make_pic_descr
//.........这里部分代码省略.........
$content = str_replace($cmd, "<br />", $content);
break;
case "{adate}":
$content = str_replace($cmd, strftime("%x", $pic['ctime']), $content);
break;
case "{album}":
$content = str_replace($cmd, $pic['atitle'], $content);
break;
case "{fname}":
$content = str_replace($cmd, $pic['filename'], $content);
break;
case "{fsize}":
$content = str_replace($cmd, intval($pic['filesize'] / 1024) . " kB", $content);
break;
case "{title}":
$content = str_replace($cmd, $pic['title'], $content);
break;
case "{hits}":
$content = str_replace($cmd, $pic['hits'], $content);
break;
case "{rating}":
$content = str_replace($cmd, $pic['rating'], $content);
break;
case "{descr}":
$content = str_replace($cmd, $pic['caption'], $content);
break;
case "{miniCMS}":
if (isset($CONFIG['TABLE_CMS'])) {
$txt = getMiniCMS($pic['pid']);
}
$content = str_replace($cmd, $txt, $content);
break;
case "{owner}":
$content = str_replace($cmd, $pic['owner_name'], $content);
break;
case "{cat}":
$i = $pic['category'];
if (!isset($alb_name[$i])) {
$query = "SELECT title FROM " . $CONFIG['TABLE_ALBUMS'] . " WHERE aid=" . $pic['category'];
if ($result = cpg_db_query($query)) {
$title = cpg_db_fetch_row($result);
$alb_name[$pic['category']] = $title['title'];
}
}
$name = $alb_name[$pic['category']];
$content = str_replace($cmd, $name, $content);
break;
case "{bread}":
$breadcrumb = " ";
breadcrumb($pic['category'], $breadcrumb, $BREADCRUMB_TEXT);
$content = str_replace($cmd, $breadcrumb, $content);
break;
case "{make}":
$exif = exif_parse_file("albums/" . $pic['file']);
$param = substr($exif['Make'], 0, -1);
$content = str_replace($cmd, $param, $content);
break;
case "{model}":
$param = substr($exif['Model'], 0, -1);
$content = str_replace($cmd, $param, $content);
break;
case "{keyw}":
$content = str_replace($cmd, $pic['keywords'], $content);
break;
case "{date}":
$param = substr($exif['DateTime Original'], 0, -1);
$content = str_replace($cmd, $param, $content);
break;
default:
/*print_r ($exif);
die();*/
$lookup = substr($cmd, 1, -1);
if (isset($exif[$lookup])) {
$param = $exif[$lookup];
if (!ord(substr($param, -1))) {
$param = substr($param, 0, -1);
//some exif values ends with a ascii 0 character
}
} else {
$param = substr($cmd, 1, -1) . " not valid anchor";
// $param = $cmd." not valid anchor";
}
$content = str_replace($cmd, $param, $content);
break;
}
// if ($n>5) die ("ut: ".$content);
}
$content = substr($content, 1);
$ret .= "<td valign=\"top\">" . $content . "</td></tr>";
if ($comments == "Yes") {
$coms = get_pic_comments($pic['pid']);
if (count($coms) > 0) {
foreach ($coms as $com) {
$ret .= "<tr><td> </td><td><p>" . $com['msg_author'] . ": " . $com['msg_body'] . "</td></tr>";
}
}
}
$ret .= "</table>";
return bb_decode($ret);
}
示例9: foreach
foreach ($data as $picture) {
$titlefield = $CONFIG[plugin_easyrss_titlefield];
$caption_text = "<br>" . $picture[hits] . " " . $lang_plugin_easyrss['views'];
$caption_text .= "<br>" . date('M d, Y', $picture[ctime]);
$thumb_url = "{$image_url}{$picture['filepath']}{$CONFIG['thumb_pfx']}{$picture['filename']}";
$keywords = explode(" ", trim($picture[keywords]));
$category_string = "";
foreach ($keywords as $keyword) {
$category_string .= "<category>{$keyword}</category>";
}
$pubDate = gmdate("D, d M Y H:i:s", $picture[ctime]);
$description = '<a href="' . $link_url . $picture['pid'] . '"><img src="' . $thumb_url . '" border="1" vspace="2" hspace="2"> <align="center" ></a><br>';
if ($titlefield == "title") {
$description .= bb_decode($picture[caption]);
}
$description .= bb_decode($caption_text);
$description = htmlspecialchars($description);
$item = '<item>
<title>' . ($picture[$titlefield] ? $picture[$titlefield] : $lang_plugin_easyrss['no'] . $lang_plugin_easyrss['label_' . $titlefield]) . '</title>
<link>' . $link_url . $picture[pid] . '</link>
<pubDate>' . $pubDate . ' GMT</pubDate>
' . $category_string . '
<description>' . $description . '</description>
</item>';
echo $item;
}
$rssFooter = <<<EOT
</channel>
</rss>
EOT;
echo $rssFooter;
示例10: atom10
function atom10()
{
global $CONFIG, $result, $base, $gallery_name, $CURRENT_CAT_NAME, $album, $album_name, $pic_data;
$superCage = Inspekt::makeSuperCage();
// Decide what kind of title to be shown
if ((int) $album) {
$title = " | Album: {$album_name}";
} elseif ($superCage->get->testInt('cat')) {
$title = " | Category: {$CURRENT_CAT_NAME}";
} elseif ($album) {
$title = ' | ' . strip_tags($album_name);
}
print "<?xml version=\"1.0\" encoding=\"{$CONFIG['charset']}\"?>\n";
print "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n";
print "<title>{$gallery_name}{$title}</title>\n";
print "<link href=\"{$base}\" />\n";
print "<updated>" . rfc3339date(time()) . "</updated>\n";
print "<author><name>Admin</name></author>\n";
print "<id>{$base}/</id>\n";
print "<generator uri=\"http://coppermine-gallery.net/\" version=\"1.0\">Coppermine Atom Aggregator</generator>\n";
print "<link rel=\"self\" type=\"application/atom+xml\" href=\"{$base}" . $_SERVER["PHP_SELF"] . "?type=atom\" />\n\n";
foreach ($pic_data as $row) {
print "\t<entry>\n";
print "\t\t<title> {$row['title']} </title>\n";
print "\t\t<link href=\"{$base}/displayimage.php?pid={$row['pid']}\" />\n";
print "\t\t<id>{$base}/displayimage.php?pid={$row['pid']}</id>\n";
print "\t\t<updated>" . rfc3339date($row['ctime']) . "</updated>\n";
print "\t\t<content type=\"html\">\n";
echo htmlspecialchars("<p><a href=\"{$base}/displayimage.php?pid={$row['pid']}\"><img src=\"{$base}/" . get_pic_url($row, 'thumb') . "\" alt=\"{$row['filename']}\" /></a></p>", ENT_COMPAT, $CONFIG['charset']);
echo htmlspecialchars("<p>" . bb_decode($row['caption']) . " </p>", ENT_COMPAT, $CONFIG['charset']);
echo htmlspecialchars("<p>" . bb_decode($row['keywords']) . "</p>", ENT_COMPAT, $CONFIG['charset']);
if (isset($row['msg_body']) && !empty($row['msg_body'])) {
// We have comment for the photo. Must be lastcom metaalbum feed. Display the comment
echo htmlspecialchars("<p><b>Comment:</b> (<i>" . date('Y-m-d H:m:s', $row['msg_date']) . "</i>) - {$row['msg_author']}</p>", ENT_COMPAT, $CONFIG['charset']);
if ($CONFIG['enable_smilies']) {
include_once "include/smilies.inc.php";
$row['msg_body'] = process_smilies($row['msg_body']);
}
echo htmlspecialchars("<p>" . bb_decode($row['msg_body']) . " </p>", ENT_COMPAT, $CONFIG['charset']);
}
print "\n\t\t</content>\n";
print "\t</entry>\n";
print "\n";
}
print "</feed>";
}
示例11: html_picture
function html_picture()
{
global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER, $HTTP_COOKIE_VARS;
global $album, $comment_date_fmt, $template_display_picture;
global $lang_display_image_php, $lang_picinfo;
$pid = $CURRENT_PIC_DATA['pid'];
if (!isset($USER['liv']) || !is_array($USER['liv'])) {
$USER['liv'] = array();
}
// Add 1 to hit counter
// if ($album != "lasthits" && !in_array($pid, $USER['liv']) && isset($HTTP_COOKIE_VARS[$CONFIG['cookie_name'] . '_data'])) {
if ($album != "lasthits" && !in_array($pid, $USER['liv'])) {
add_hit($pid);
if (count($USER['liv']) > 4) {
array_shift($USER['liv']);
}
array_push($USER['liv'], $pid);
}
if ($CONFIG['thumb_use'] == 'ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width']) {
// The wierd comparision is because only picture_width is stored
$condition = true;
} elseif ($CONFIG['thumb_use'] == 'wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']) {
$condition = true;
} elseif ($CONFIG['thumb_use'] == 'any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']) {
$condition = true;
} else {
$condition = false;
}
if ($CONFIG['make_intermediate'] && $condition) {
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
} else {
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
}
$pic_thumb_url = get_pic_url($CURRENT_PIC_DATA, 'thumb');
$picture_menu = USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID || GALLERY_ADMIN_MODE ? html_picture_menu($pid) : '';
$image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width']);
$pic_title = '';
$mime_content = get_type($CURRENT_PIC_DATA['filename']);
if ($CURRENT_PIC_DATA['title'] != '') {
$pic_title .= $CURRENT_PIC_DATA['title'] . "\n";
}
if ($CURRENT_PIC_DATA['caption'] != '') {
$pic_title .= $CURRENT_PIC_DATA['caption'] . "\n";
}
if ($CURRENT_PIC_DATA['keywords'] != '') {
$pic_title .= $lang_picinfo['Keywords'] . ": " . $CURRENT_PIC_DATA['keywords'];
}
if ($CURRENT_PIC_DATA['pwidth'] == 0 || $CURRENT_PIC_DATA['pheight'] == 0) {
$image_size['geom'] = '';
$image_size['whole'] = '';
} elseif ($mime_content['content'] == 'movie' || $mime_content['content'] == 'audio') {
$ctrl_offset['mov'] = 15;
$ctrl_offset['wmv'] = 45;
$ctrl_offset['swf'] = 0;
$ctrl_offset['rm'] = 0;
$ctrl_offset_default = 45;
$ctrl_height = isset($ctrl_offset[$mime_content['extension']]) ? $ctrl_offset[$mime_content['extension']] : $ctrl_offset_default;
$image_size['whole'] = 'width="' . $CURRENT_PIC_DATA['pwidth'] . '" height="' . ($CURRENT_PIC_DATA['pheight'] + $ctrl_height) . '"';
}
if ($mime_content['content'] == 'image') {
if (isset($image_size['reduced'])) {
$winsizeX = $CURRENT_PIC_DATA['pwidth'] + 16;
$winsizeY = $CURRENT_PIC_DATA['pheight'] + 16;
$pic_html = "<a href=\"javascript:;\" onClick=\"MM_openBrWindow('displayimage.php?pid={$pid}&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=yes,status=yes,resizable=yes,width={$winsizeX},height={$winsizeY}')\">";
$pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
$pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
$pic_html .= "</a>\n";
} else {
$pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" /><br />\n";
}
} elseif ($mime_content['content'] == 'document') {
$pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img src=\"" . $pic_thumb_url . "\" border=\"0\" class=\"image\" /></a>\n<br />";
} else {
$pic_html = "<object {$image_size['whole']}><param name=\"autostart\" value=\"true\"><param name=\"src\" value=\"" . $picture_url . "\"><embed {$image_size['whole']} src=\"" . $picture_url . "\" autostart=\"true\"></embed></object><br />\n";
}
if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) {
template_extract_block($template_display_picture, 'img_desc');
} else {
if (!$CURRENT_PIC_DATA['title']) {
template_extract_block($template_display_picture, 'title');
}
if (!$CURRENT_PIC_DATA['caption']) {
template_extract_block($template_display_picture, 'caption');
}
}
$params = array('{CELL_HEIGHT}' => '100', '{IMAGE}' => $pic_html, '{ADMIN_MENU}' => $picture_menu, '{TITLE}' => $CURRENT_PIC_DATA['title'], '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']));
return template_eval($template_display_picture, $params);
}
示例12: list_cat_albums
//.........这里部分代码省略.........
$totalPages = ceil($nbAlb / $alb_per_page);
if ($PAGE > $totalPages) {
$PAGE = 1;
}
$lower_limit = ($PAGE - 1) * $alb_per_page;
$upper_limit = min($nbAlb, $PAGE * $alb_per_page);
$limit = "LIMIT " . $lower_limit . "," . ($upper_limit - $lower_limit);
/*
$sql = "SELECT a.aid, a.title, a.description, visibility, filepath, ".
"filename, url_prefix, pwidth, pheight ".
"FROM {$CONFIG['TABLE_ALBUMS']} as a ".
"LEFT JOIN {$CONFIG['TABLE_PICTURES']} as p ON thumb=pid ".
"WHERE category = $cat ORDER BY a.pos ".$limit;
*/
$sql = 'SELECT a.aid, a.title, a.description, visibility, filepath, ' . 'filename, url_prefix, pwidth, pheight ' . 'FROM ' . $CONFIG['TABLE_ALBUMS'] . ' as a ' . 'LEFT JOIN ' . $CONFIG['TABLE_PICTURES'] . ' as p ' . 'ON a.thumb=p.pid ' . 'WHERE category=' . $cat . $album_filter . ' ORDER BY a.pos ' . $limit;
$alb_thumbs_q = db_query($sql);
$alb_thumbs = db_fetch_rowset($alb_thumbs_q);
mysql_free_result($alb_thumbs_q);
$disp_album_count = count($alb_thumbs);
$album_set = '';
foreach ($alb_thumbs as $value) {
$album_set .= $value['aid'] . ', ';
}
$album_set = '(' . substr($album_set, 0, -2) . ')';
$sql = "SELECT aid, count(pid) as pic_count, max(pid) as last_pid, max(ctime) as last_upload " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE aid IN {$album_set} AND approved = 'YES' " . "GROUP BY aid";
$alb_stats_q = db_query($sql);
$alb_stats = db_fetch_rowset($alb_stats_q);
mysql_free_result($alb_stats_q);
foreach ($alb_stats as $key => $value) {
$cross_ref[$value['aid']] =& $alb_stats[$key];
}
for ($alb_idx = 0; $alb_idx < $disp_album_count; $alb_idx++) {
$alb_thumb =& $alb_thumbs[$alb_idx];
$aid = $alb_thumb['aid'];
if (isset($cross_ref[$aid])) {
$alb_stat = $cross_ref[$aid];
$count = $alb_stat['pic_count'];
} else {
$alb_stat = array();
$count = 0;
}
// Inserts a thumbnail if the album contains 1 or more images
$visibility = $alb_thumb['visibility'];
if ($visibility == '0' || $visibility == FIRST_USER_CAT + USER_ID || in_array($visibility, $USER_DATA['groups']) || $USER_DATA['can_see_all_albums'] || $CONFIG['allow_private_albums'] == 0) {
// test for visibility
if ($count > 0) {
// Inserts a thumbnail if the album contains 1 or more images
if ($alb_thumb['filename']) {
$picture =& $alb_thumb;
} else {
$sql = "SELECT filepath, filename, url_prefix, pwidth, pheight " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='{$alb_stat['last_pid']}'";
$result = db_query($sql);
$picture = mysql_fetch_array($result);
mysql_free_result($result);
}
$pic_url = get_pic_url($picture, 'thumb');
if (!is_image($picture['filename'])) {
$image_info = getimagesize($pic_url);
$picture['pwidth'] = $image_info[0];
$picture['pheight'] = $image_info[1];
}
$image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size']);
$alb_list[$alb_idx]['thumb_pic'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$picture['filename']}\">";
} else {
// Inserts an empty thumbnail if the album contains 0 images
$image_size = compute_img_size(100, 75, $CONFIG['alb_list_thumb_size']);
$alb_list[$alb_idx]['thumb_pic'] = "<img src=\"images/nopic.jpg\" {$image_size['geom']} alt=\"\" border=\"0\" class=\"image\" />";
}
} elseif ($CONFIG['show_private']) {
$image_size = compute_img_size(100, 75, $CONFIG['alb_list_thumb_size']);
$alb_list[$alb_idx]['thumb_pic'] = "<img src=\"images/private.jpg\" {$image_size['geom']} alt=\"\" border=\"0\" class=\"image\" />";
}
// Prepare everything
if ($visibility == '0' || $visibility == FIRST_USER_CAT + USER_ID || in_array($visibility, $USER_DATA['groups']) || $USER_DATA['can_see_all_albums']) {
$last_upload_date = $count ? localised_date($alb_stat['last_upload'], $lastup_date_fmt) : '';
$alb_list[$alb_idx]['aid'] = $alb_thumb['aid'];
$alb_list[$alb_idx]['album_title'] = $alb_thumb['title'];
$alb_list[$alb_idx]['album_desc'] = bb_decode($alb_thumb['description']);
$alb_list[$alb_idx]['pic_count'] = $count;
$alb_list[$alb_idx]['last_upl'] = $last_upload_date;
$alb_list[$alb_idx]['album_info'] = sprintf($lang_list_albums['n_pictures'], $count) . ($count ? sprintf($lang_list_albums['last_added'], $last_upload_date) : "");
$alb_list[$alb_idx]['album_adm_menu'] = GALLERY_ADMIN_MODE || USER_ADMIN_MODE && $cat == USER_ID + FIRST_USER_CAT ? html_albummenu($alb_thumb['aid']) : '';
} elseif ($CONFIG['show_private']) {
// uncomment this else block to show private album description
$last_upload_date = $count ? localised_date($alb_stat['last_upload'], $lastup_date_fmt) : '';
$alb_list[$alb_idx]['aid'] = $alb_thumb['aid'];
$alb_list[$alb_idx]['album_title'] = $alb_thumb['title'];
$alb_list[$alb_idx]['album_desc'] = bb_decode($alb_thumb['description']);
$alb_list[$alb_idx]['pic_count'] = $count;
$alb_list[$alb_idx]['last_upl'] = $last_upload_date;
$alb_list[$alb_idx]['album_info'] = sprintf($lang_list_albums['n_pictures'], $count) . ($count ? sprintf($lang_list_albums['last_added'], $last_upload_date) : "");
$alb_list[$alb_idx]['album_adm_menu'] = GALLERY_ADMIN_MODE || USER_ADMIN_MODE && $cat == USER_ID + FIRST_USER_CAT ? html_albummenu($alb_thumb['aid']) : '';
}
}
ob_start();
theme_display_album_list_cat($alb_list, $nbAlb, $cat, $PAGE, $totalPages);
$cat_albums = ob_get_contents();
ob_end_clean();
return $cat_albums;
}
示例13: cpg_db_query
}
$user_thumb = '';
if ($picture_count) {
$sql = "SELECT filepath, filename, url_prefix, pwidth, pheight " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='" . $thumb_pid . "'";
$result = cpg_db_query($sql);
if (mysql_num_rows($result)) {
$picture = mysql_fetch_array($result);
mysql_free_result($result);
$pic_url = get_pic_url($picture, 'thumb');
if (!is_image($picture['filename'])) {
$image_info = getimagesize(urldecode($pic_url));
$picture['pwidth'] = $image_info[0];
$picture['pheight'] = $image_info[1];
}
$image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['thumb_width']);
$mime_content = cpg_get_type($picture['filename']);
$user_thumb = '<img src="' . $pic_url . '" class="image"' . $image_size['geom'] . ' border="0" alt="" />';
$user_thumb = '<td width="50%" valign="top" align="center">' . '<a href="thumbnails.php?album=lastupby&uid=' . $uid . '">' . '<span class="thumb_title">' . $lang_register_php['last_uploads'] . ' ' . $user_data['user_name'] . '<br /></span>' . $user_thumb . '</a></td>';
}
}
$quick_jump = $user_thumb . $lastcom ? '<table width="100%" border="0" cellspacing="5"><tr>' . $user_thumb . $lastcom . '</tr></table>' : '';
$form_data = array('username' => $user_data['user_name'], 'reg_date' => localised_date($user_data['user_regdate'], $register_date_fmt), 'group' => $user_data['group_name'], 'user_profile1' => $user_data['user_profile1'], 'user_profile2' => $user_data['user_profile2'], 'user_profile3' => $user_data['user_profile3'], 'user_profile4' => $user_data['user_profile4'], 'user_profile5' => $user_data['user_profile5'], 'user_profile6' => bb_decode($user_data['user_profile6']), 'user_thumb' => $quick_jump, 'pic_count' => $pic_count);
$title = sprintf($lang_register_php['x_s_profile'], $user_data['user_name']);
pageheader($title);
starttable(-1, $title, 2);
make_form($display_profile_form_param, $form_data);
endtable();
pagefooter();
ob_end_flush();
break;
}
示例14: display_thumbnails
/**
* display_thumbnails()
*
* Generates data to display thumbnails of pictures in an album
*
* @param mixed $album Either the album ID or the meta album name
* @param integer $cat Either the category ID or album ID if negative
* @param integer $page Page number to display
* @param integer $thumbcols
* @param integer $thumbrows
* @param boolean $display_tabs
**/
function display_thumbnails($album, $cat, $page, $thumbcols, $thumbrows, $display_tabs)
{
global $CONFIG, $AUTHORIZED, $USER;
global $album_date_fmt, $lang_display_thumbnails, $lang_errors, $lang_byte_units, $lang_common;
$superCage = Inspekt::makeSuperCage();
$thumb_per_page = $thumbcols * $thumbrows;
$lower_limit = ($page - 1) * $thumb_per_page;
$pic_data = get_pic_data($album, $thumb_count, $album_name, $lower_limit, $thumb_per_page);
$total_pages = ceil($thumb_count / $thumb_per_page);
$i = 0;
if (count($pic_data) > 0) {
foreach ($pic_data as $key => $row) {
$i++;
$pic_title = $lang_common['filename'] . '=' . $row['filename'] . "\n" . $lang_common['filesize'] . '=' . ($row['filesize'] >> 10) . $lang_byte_units[1] . "\n" . $lang_display_thumbnails['dimensions'] . $row['pwidth'] . "x" . $row['pheight'] . "\n" . $lang_display_thumbnails['date_added'] . localised_date($row['ctime'], $album_date_fmt);
$pic_url = get_pic_url($row, 'thumb');
if (!is_image($row['filename'])) {
$image_info = cpg_getimagesize(urldecode($pic_url));
$row['pwidth'] = $image_info[0];
$row['pheight'] = $image_info[1];
}
//thumb cropping - if we display a system thumb we calculate the dimension by any and not ex
if ($row['system_icon'] == 'true') {
$image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width'], true);
} else {
$image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);
}
$thumb_list[$i]['pos'] = $key < 0 ? $key : $i - 1 + $lower_limit;
$thumb_list[$i]['pid'] = $row['pid'];
$thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"{$pic_title}\"/>";
$thumb_list[$i]['caption'] = bb_decode($row['caption_text']);
$thumb_list[$i]['admin_menu'] = '';
$thumb_list[$i]['aid'] = $row['aid'];
$thumb_list[$i]['pwidth'] = $row['pwidth'];
$thumb_list[$i]['pheight'] = $row['pheight'];
if (defined('API_CALL')) {
$thumb_list[$i]['title'] = $row['title'];
$thumb_list[$i]['filename'] = get_pic_url($row);
}
}
// Print out XML photo list and exit
if (defined('API_CALL')) {
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
echo $superCage->post->getAlpha('album') ? "<" . $superCage->post->getAlpha('album') . ">\n" : "<api_search>\n";
foreach ($thumb_list as $pic) {
$file = preg_replace('/%7E/', '~', $pic['filename']);
echo " <picture id=\"{$pic['pid']}\">\n";
echo " <title>{$pic['title']}</title>\n";
echo " <file>{$file}</file>\n";
echo " <width>{$pic['pwidth']}</width>\n";
echo " <height>{$pic['pheight']}</height>\n";
echo " </picture>\n";
}
echo $superCage->post->getAlpha('album') ? "</" . $superCage->post->getAlpha('album') . ">" : "</api_search>";
exit;
}
// Add a hit to album counter if it is a numeric album
if (is_numeric($album)) {
// Create an array to hold the album id for hits (if not created)
if (!isset($USER['liv_a']) || !is_array($USER['liv_a'])) {
$USER['liv_a'] = array();
}
// Add 1 to album hit counter
if (!USER_IS_ADMIN && !in_array($album, $USER['liv_a']) && $superCage->cookie->keyExists($CONFIG['cookie_name'] . '_data')) {
add_album_hit($album);
if (count($USER['liv_a']) > 4) {
array_shift($USER['liv_a']);
}
array_push($USER['liv_a'], $album);
user_save_profile();
}
}
//Using getRaw(). The date is sanitized in the called function.
$date = $superCage->get->keyExists('date') ? cpgValidateDate($superCage->get->getRaw('date')) : null;
theme_display_thumbnails($thumb_list, $thumb_count, $album_name, $album, $cat, $page, $total_pages, is_numeric($album), $display_tabs, 'thumb', $date);
} else {
if (defined('API_CALL')) {
new OAuthException('No pictures found');
} else {
theme_no_img_to_display($album_name);
}
}
}
示例15: cpg_db_query
$sender_email_warning = '';
$form_action = "{$CPG_PHP_SELF}?pid={$pid}";
// Get picture thumbnail url
$result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} p WHERE pid='{$pid}' {$FORBIDDEN_SET}");
if (!$result->numRows()) {
cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
}
$row = $result->fetchArray(true);
$thumb_pic_url = get_pic_url($row, 'thumb');
if ($what == 'comment') {
$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, approval FROM {$CONFIG['TABLE_COMMENTS']} WHERE msg_id='{$cid}' AND approval = 'YES' AND pid='{$pid}'");
if (!$result->numRows()) {
cpg_die(ERROR, $lang_errors['non_exist_comment'], __FILE__, __LINE__);
}
$row = $result->fetchArray(true);
$comment = bb_decode($row['msg_body']);
if ($CONFIG['enable_smilies']) {
$comment = process_smilies($comment);
}
$msg_author = $row['msg_author'];
$comment_field_name = sprintf($lang_report_php['comment_field_name'], $msg_author);
$type = $lang_report_php['type_comment'];
$template = $template_report_comment_email;
$form_action = "{$CPG_PHP_SELF}?pid={$pid}&msg_id={$cid}&what=comment";
//template_extract_block($template_report_form, 'reason_missing'); //need help to toggle off reason(missing) since doesn't apply to comments
} else {
//template_extract_block($template_report_form, 'display_comment'); //need help remove comment preview when reporting picture
}
// Check supplied email address
$valid_sender_email = Inspekt::isEmail($sender_email);
$invalid_email = '<div class="cpg_message_error">' . $lang_report_php['invalid_email'] . '</div>';