本文整理汇总了PHP中getforumimg函数的典型用法代码示例。如果您正苦于以下问题:PHP getforumimg函数的具体用法?PHP getforumimg怎么用?PHP getforumimg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getforumimg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before_feed
public function before_feed()
{
$message = !$this->param['price'] && !$this->param['readperm'] ? $this->param['message'] : '';
$this->feed['icon'] = 'activity';
$this->feed['title_template'] = 'feed_thread_activity_title';
$this->feed['body_template'] = 'feed_thread_activity_message';
$this->feed['body_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$this->tid}\">{$this->param['subject']}</a>", 'starttimefrom' => $_GET['starttimefrom'][$this->activitytime], 'activityplace' => $this->activity['place'], 'message' => messagecutstr($message, 150));
if ($_GET['activityaid']) {
$this->feed['images'] = array(getforumimg($_GET['activityaid']));
$this->feed['image_links'] = array("forum.php?mod=viewthread&do=tradeinfo&tid={$this->tid}&pid={$this->pid}");
}
}
示例2: forumdisplay_variables
function forumdisplay_variables(&$variables)
{
global $_G;
if (!$_G['wechat']['setting']['wsq_allow'] || !$_G['wechat']['setting']['showactivity']['tids']) {
return;
}
$tids = array();
foreach ($variables['forum_threadlist'] as &$thread) {
if (in_array($thread['tid'], $_G['wechat']['setting']['showactivity']['tids'])) {
$thread['showactivity'] = 1;
$tids[] = $thread['tid'];
}
}
$activities = C::t('forum_activity')->fetch_all($tids);
foreach ($activities as $tid => $activity) {
$variables['showactivity'][$tid]['starttimefrom'] = dgmdate($activities[$tid]['starttimefrom']);
$variables['showactivity'][$tid]['expiration'] = dgmdate($activities[$tid]['expiration']);
$variables['showactivity'][$tid]['applynumber'] = $activities[$tid]['applynumber'];
$variables['showactivity'][$tid]['thumb'] = $activity['aid'] ? $_G['siteurl'] . getforumimg($activity['aid'], 0, 400, 400) : '';
}
}
示例3: elseif
$feed['title_template'] = 'feed_thread_debatevote_title_1';
} elseif ($stand == 2) {
$feed['title_template'] = 'feed_thread_debatevote_title_2';
} else {
$feed['title_template'] = 'feed_thread_debatevote_title_3';
}
$feed['title_data'] = array('subject' => "<a href=\"{$_G['siteurl']}forum.php?mod=viewthread&tid={$_G['tid']}\">{$thread['subject']}</a>", 'author' => "<a href=\"home.php?mod=space&uid={$thread['authorid']}\">{$thread['author']}</a>");
} elseif ($thread['authorid'] != $_G['uid']) {
$post_url = "forum.php?mod=redirect&goto=findpost&pid={$pid}&ptid={$_G['tid']}";
$feed['icon'] = 'post';
$feed['title_template'] = !empty($thread['author']) ? 'feed_reply_title' : 'feed_reply_title_anonymous';
$feed['title_data'] = array('subject' => "<a href=\"{$post_url}\">{$thread['subject']}</a>", 'author' => "<a href=\"home.php?mod=space&uid={$thread['authorid']}\">{$thread['author']}</a>");
if (!empty($_G['forum_attachexist'])) {
$firstaid = DB::result_first("SELECT aid FROM " . DB::table('forum_attachment') . " WHERE pid='{$pid}' AND dateline>'0' AND isimage='1' ORDER BY dateline LIMIT 1");
if ($firstaid) {
$feed['images'] = array(getforumimg($firstaid));
$feed['image_links'] = array($post_url);
}
}
}
$feed['title_data']['hash_data'] = "tid{$_G[tid]}";
$feed['id'] = $tid;
$feed['idtype'] = 'tid';
postfeed($feed);
}
include_once libfile('function/stat');
updatestat($thread['isgroup'] ? 'grouppost' : 'post');
$page = getstatus($thread['status'], 4) ? 1 : @ceil(($thread['special'] ? $thread['replies'] + 1 : $thread['replies'] + 2) / $_G['ppp']);
$url = empty($_POST['portal_referer']) ? "forum.php?mod=viewthread&tid={$thread[tid]}&pid={$pid}&page={$page}&extra={$extra}#pid{$pid}" : $_POST['portal_referer'];
showmessage($replymessage, $url, $param);
}
示例4: if
<td> </td>
<td>
<label class="labeltxt">图片</label>
<select name="selectattach" onchange="updateimginfo(this.value)" class="ps" style="width: 132px">
<option value="">不显示</option><?php if(is_array($imgattach)) foreach($imgattach as $imginfo) { ?><option value="<?php echo $imginfo['aid'];?>"<?php if($selectattach == $imginfo['aid']) { ?> selected="selected"<?php } ?>><?php echo $imginfo['filename'];?></option>
<?php } ?>
</select>
</td>
</tr>
<tr class="dopt">
<td> </td>
<td>
<label class="labeltxt"> </label>
<img id="selectimg" src="<?php echo STATICURL;?>image/common/none.gif" width="120" height="80" />
<script type="text/javascript" reload="1">
var imgk = new Array();<?php if(is_array($imgattach)) foreach($imgattach as $imginfo) { $a = '\"\'\t\\""\\\''."\\\\";$k = getforumimg($imginfo['aid'], 1, 120, 80);?>imgk[<?php echo $imginfo['aid'];?>] = '<?php echo $k;?>';
<?php } ?>
function updateimginfo(aid) {
if(aid) {
$('selectimg').src=imgk[aid];
} else {
$('selectimg').src='<?php echo STATICURL;?>image/common/none.gif';
}
}
<?php if($selectattach) { ?>updateimginfo('<?php echo $selectattach;?>');<?php } ?>
</script>
</td>
</tr>
<?php } } ?>
</table>
</li>
示例5: getdata
function getdata($style, $parameter)
{
global $_G;
$parameter = $this->cookparameter($parameter);
loadcache('grouptype');
$typeids = !empty($parameter['gtids']) && !in_array('0', $parameter['gtids']) ? $parameter['gtids'] : array_keys($_G['cache']['grouptype']['first']);
$tids = !empty($parameter['tids']) ? explode(',', $parameter['tids']) : array();
$fids = !empty($parameter['fids']) ? explode(',', $parameter['fids']) : array();
$uids = !empty($parameter['uids']) ? explode(',', $parameter['uids']) : array();
$startrow = isset($parameter['startrow']) ? intval($parameter['startrow']) : 0;
$items = isset($parameter['items']) ? intval($parameter['items']) : 10;
$digest = isset($parameter['digest']) ? $parameter['digest'] : 0;
$stick = isset($parameter['stick']) ? $parameter['stick'] : 0;
$orderby = isset($parameter['orderby']) ? in_array($parameter['orderby'], array('dateline', 'todayhots', 'weekhots', 'monthhots')) ? $parameter['orderby'] : 'dateline' : 'dateline';
$titlelength = !empty($parameter['titlelength']) ? intval($parameter['titlelength']) : 40;
$summarylength = !empty($parameter['summarylength']) ? intval($parameter['summarylength']) : 80;
$recommend = !empty($parameter['recommend']) ? 1 : 0;
$keyword = !empty($parameter['keyword']) ? $parameter['keyword'] : '';
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
if (empty($fids)) {
$plusids = $typeids ? array(0) : array();
foreach ($typeids as $typeid) {
if (!empty($_G['cache']['grouptype']['first'][$typeid]['secondlist'])) {
$plusids = array_merge($plusids, $_G['cache']['grouptype']['first'][$typeid]['secondlist']);
}
}
$typeids = array_merge($typeids, $plusids);
$groups = array();
if ($typeids) {
$query = DB::query('SELECT f.fid, f.name, ff.description FROM ' . DB::table('forum_forum') . " f LEFT JOIN " . DB::table('forum_forumfield') . " ff ON f.fid = ff.fid WHERE f.fup IN (" . dimplode($typeids) . ")");
while ($value = DB::fetch($query)) {
$groups[$value['fid']] = $value;
$fids[] = intval($value['fid']);
}
}
}
require_once libfile('function/post');
$datalist = $list = array();
if ($keyword) {
if (preg_match("(AND|\\+|&|\\s)", $keyword) && !preg_match("(OR|\\|)", $keyword)) {
$andor = ' AND ';
$keywordsrch = '1';
$keyword = preg_replace("/( AND |&| )/is", "+", $keyword);
} else {
$andor = ' OR ';
$keywordsrch = '0';
$keyword = preg_replace("/( OR |\\|)/is", "+", $keyword);
}
$keyword = str_replace('*', '%', addcslashes($keyword, '%_'));
foreach (explode('+', $keyword) as $text) {
$text = trim($text);
if ($text) {
$keywordsrch .= $andor;
$keywordsrch .= "tr.subject LIKE '%{$text}%'";
}
}
$keyword = " AND ({$keywordsrch})";
} else {
$keyword = '';
}
$sql = ($fids ? ' AND t.fid IN (' . dimplode($fids) . ')' : '') . ($tids ? ' AND t.tid IN (' . dimplode($tids) . ')' : '') . ($digest ? ' AND t.digest IN (' . dimplode($digest) . ')' : '') . ($stick ? ' AND t.displayorder IN (' . dimplode($stick) . ')' : '') . " AND t.isgroup='1'";
$where = '';
if (in_array($orderby, array('todayhots', 'weekhots', 'monthhots'))) {
$historytime = 0;
switch ($orderby) {
case 'todayhots':
$historytime = mktime(0, 0, 0, date('m', TIMESTAMP), date('d', TIMESTAMP), date('Y', TIMESTAMP));
break;
case 'weekhots':
$week = gmdate('w', TIMESTAMP) - 1;
$week = $week != -1 ? $week : 6;
$historytime = mktime(0, 0, 0, date('m', TIMESTAMP), date('d', TIMESTAMP) - $week, date('Y', TIMESTAMP));
break;
case 'monthhots':
$historytime = mktime(0, 0, 0, date('m', TIMESTAMP), 1, date('Y', TIMESTAMP));
break;
}
$where = ' WHERE tr.dateline>=' . $historytime;
$orderby = 'totalitems';
}
$where .= ($uids ? ' AND tr.sellerid IN (' . dimplode($uids) . ')' : '') . $keyword;
$where .= $bannedids ? ' AND tr.pid NOT IN (' . dimplode($bannedids) . ')' : '';
$sqlfrom = " INNER JOIN `" . DB::table('forum_thread') . "` t ON t.tid=tr.tid {$sql} AND t.displayorder>='0'";
if ($recommend) {
$sqlfrom .= " INNER JOIN `" . DB::table('forum_forumrecommend') . "` fc ON fc.tid=tr.tid";
}
$query = DB::query("SELECT tr.pid, tr.tid, tr.aid, tr.price, tr.credit, tr.subject, tr.totalitems, tr.seller, tr.sellerid\n\t\t\tFROM " . DB::table('forum_trade') . " tr {$sqlfrom} {$where}\n\t\t\tORDER BY tr.{$orderby} DESC\n\t\t\tLIMIT {$startrow},{$items};");
include_once libfile('block/thread', 'class');
$bt = new block_thread();
while ($data = DB::fetch($query)) {
$list[] = array('id' => $data['pid'], 'idtype' => 'pid', 'title' => cutstr(str_replace('\\\'', ''', addslashes($data['subject'])), $titlelength), 'url' => 'forum.php?mod=viewthread&do=tradeinfo&tid=' . $data['tid'] . '&pid=' . $data['pid'], 'pic' => $data['aid'] ? getforumimg($data['aid']) : IMGDIR . '/nophoto.gif', 'picflag' => '0', 'summary' => !empty($style['getsummary']) ? $bt->getthread($data['tid'], $summarylength, true) : '', 'fields' => array('totalitems' => $data['totalitems'], 'author' => $data['seller'] ? $data['seller'] : 'Anonymous', 'authorid' => $data['sellerid'] ? $data['sellerid'] : 0, 'price' => ($data['price'] > 0 ? '¥ ' . $data['price'] : '') . ($data['credit'] > 0 ? ($data['price'] > 0 ? lang('block/grouptrade', 'grouptrade_price_add') : '') . $data['credit'] . ' ' . $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][5]]['unit'] . $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][5]]['title'] : '')));
}
return array('html' => '', 'data' => $list);
}
示例6: foreach
echo $curaidkey + 1;
?>
</span> 张 / 共 <?php
echo $count;
?>
张</span>
</div>
<ul class="postalbum_c"><?php
if (is_array($imglist['url'])) {
foreach ($imglist['url'] as $key => $imgurl) {
?>
<li class="postalbum_u" id="u_<?php
echo $key;
?>
"><?php
$imgurl = getforumimg($imglist[aid][$key], 0, 2000, 550, 'fixnone');
?>
<img class="postalbum_i" load="0" id="img_<?php
echo $key;
?>
" <?php
if ($curaidkey == $key) {
?>
src="<?php
echo $imgurl;
?>
"<?php
}
?>
zsrc="<?php
echo $imgurl;
示例7: showsorttemplate
function showsorttemplate($sortid, $fid, $sortoptionarray, $templatearray, $threadlist, $threadids = array())
{
global $_G;
$searchtitle = $searchvalue = $searchunit = $stemplate = $searchtids = $sortlistarray = $skipaids = $sortdata = array();
$addsortid = !empty($sortid) ? "sortid='{$sortid}' AND" : '';
$addthreadid = !empty($threadids) ? "AND tid IN (" . dimplode($threadids) . ")" : '';
$query = DB::query("SELECT sortid, tid, optionid, value, expiration FROM " . DB::table('forum_typeoptionvar') . " WHERE {$addsortid} fid='{$fid}' {$addthreadid}");
while ($sortthread = DB::fetch($query)) {
$optionid = $sortthread['optionid'];
$sortid = $sortthread['sortid'];
$tid = $sortthread['tid'];
$arrayoption = $sortoptionarray[$sortid][$optionid];
if ($sortoptionarray[$sortid][$optionid]['subjectshow']) {
$_G['optionvaluelist'][$sortid][$tid][$arrayoption['identifier']]['title'] = $arrayoption['title'];
$_G['optionvaluelist'][$sortid][$tid][$arrayoption['identifier']]['unit'] = $arrayoption['unit'];
if (in_array($arrayoption['type'], array('radio', 'checkbox', 'select'))) {
if ($arrayoption['type'] == 'checkbox') {
foreach (explode("\t", $sortthread['value']) as $choiceid) {
$sortthreadlist[$tid][$arrayoption['title']] .= $arrayoption['choices'][$choiceid] . ' ';
$_G['optionvaluelist'][$sortid][$tid][$arrayoption['identifier']]['value'] .= $arrayoption['choices'][$choiceid] . ' ';
}
} elseif ($arrayoption['type'] == 'select') {
$sortthreadlist[$tid][$arrayoption['title']] = $_G['optionvaluelist'][$sortid][$tid][$arrayoption['identifier']]['value'] = $arrayoption['choices'][$sortthread['value']]['content'];
} else {
$sortthreadlist[$tid][$arrayoption['title']] = $_G['optionvaluelist'][$sortid][$tid][$arrayoption['identifier']]['value'] = $arrayoption['choices'][$sortthread['value']];
}
} elseif ($arrayoption['type'] == 'image') {
$imgoptiondata = unserialize($sortthread['value']);
if (empty($templatearray[$sortid])) {
$maxwidth = $arrayoption['maxwidth'] ? 'width="' . $arrayoption['maxwidth'] . '"' : '';
$maxheight = $arrayoption['maxheight'] ? 'height="' . $arrayoption['maxheight'] . '"' : '';
$sortthreadlist[$tid][$arrayoption['title']] = $_G['optionvaluelist'][$sortid][$tid][$arrayoption['identifier']]['value'] = $imgoptiondata['url'] ? "<img src=\"{$imgoptiondata['url']}\" onload=\"thumbImg(this)\" {$maxwidth} {$maxheight} border=\"0\">" : '';
} else {
$sortthread['value'] = '';
if ($imgoptiondata['aid']) {
$sortthread['value'] = getforumimg($imgoptiondata['aid'], 0, 120, 120);
} elseif ($imgoptiondata['url']) {
$sortthread['value'] = $imgoptiondata['url'];
}
$sortthreadlist[$tid][$arrayoption['title']] = $_G['optionvaluelist'][$sortid][$tid][$arrayoption['identifier']]['value'] = $sortthread['value'] ? $sortthread['value'] : './static/image/common/nophotosmall.gif';
}
} else {
$sortthreadlist[$tid][$arrayoption['title']] = $_G['optionvaluelist'][$sortid][$tid][$arrayoption['identifier']]['value'] = $sortthread['value'] ? $sortthread['value'] : $arrayoption['defaultvalue'];
}
$sortthreadlist[$tid]['sortid'] = $sortid;
$sortthreadlist[$tid]['expiration'] = $sortthread['expiration'] && $sortthread['expiration'] <= TIMESTAMP ? 1 : 0;
}
}
if ($templatearray && $sortthreadlist) {
foreach ($threadlist as $thread) {
$thread['digest'] = $thread['digest'] ? ' <img src="' . $_G['style']['imgdir'] . '/digest_' . $thread['digest'] . '.gif" class="vm" alt="" title="" />' : '';
$sortdata[$thread['tid']]['subject'] = '<a href="forum.php?mod=viewthread&tid=' . $thread['tid'] . '" ' . $thread['highlight'] . '>' . $thread['subject'] . '</a>' . $thread['digest'];
$sortdata[$thread['tid']]['author'] = '<a href="home.php?mod=space&uid=' . $thread['authorid'] . '" target="_blank">' . $thread['author'] . '</a>';
}
foreach ($sortoptionarray as $sortid => $optionarray) {
foreach ($optionarray as $option) {
if ($option['subjectshow']) {
$searchtitle[$sortid][] = '/{(' . $option['identifier'] . ')}/e';
$searchvalue[$sortid][] = '/\\[(' . $option['identifier'] . ')value\\]/e';
$searchunit[$sortid][] = '/\\[(' . $option['identifier'] . ')unit\\]/e';
}
}
}
foreach ($sortthreadlist as $tid => $option) {
$sortid = $option['sortid'];
$sortexpiration[$sortid][$tid] = $option['expiration'];
$stemplate[$sortid][$tid] = preg_replace(array("/\\{sortname\\}/i", "/\\{author\\}/i", "/\\{subject\\}/i", "/\\[url\\](.+?)\\[\\/url\\]/i"), array('<a href="forum.php?mod=forumdisplay&fid=' . $_G['fid'] . '&filter=sortid&sortid=' . $sortid . '">' . $_G['forum']['threadsorts']['types'][$sortid] . '</a>', $sortdata[$tid]['author'], $sortdata[$tid]['subject'], "<a href=\"forum.php?mod=viewthread&tid={$tid}\">\\1</a>"), stripslashes($templatearray[$sortid]));
$stemplate[$sortid][$tid] = preg_replace($searchtitle[$sortid], "showlistoption('\\1', 'title', '{$tid}', '{$sortid}')", $stemplate[$sortid][$tid]);
$stemplate[$sortid][$tid] = preg_replace($searchvalue[$sortid], "showlistoption('\\1', 'value', '{$tid}', '{$sortid}')", $stemplate[$sortid][$tid]);
$stemplate[$sortid][$tid] = preg_replace($searchunit[$sortid], "showlistoption('\\1', 'unit', '{$tid}', '{$sortid}')", $stemplate[$sortid][$tid]);
}
}
$sortlistarray['template'] = $stemplate;
$sortlistarray['expiration'] = $sortexpiration;
return $sortlistarray;
}
示例8: array
$feed = array();
if (!empty($_G['gp_addfeed']) && $_G['forum']['allowfeed'] && !$isanonymous) {
$feed['icon'] = 'goods';
$feed['title_template'] = 'feed_thread_goods_title';
if ($_G['gp_item_price'] > 0) {
if ($_G['setting']['creditstransextra'][5] != -1 && $_G['gp_item_credit']) {
$feed['body_template'] = 'feed_thread_goods_message_1';
} else {
$feed['body_template'] = 'feed_thread_goods_message_2';
}
} else {
$feed['body_template'] = 'feed_thread_goods_message_3';
}
$feed['body_data'] = array('itemname' => "<a href=\"{$_G['siteurl']}forum.php?mod=viewthread&do=tradeinfo&tid={$tid}&pid={$pid}\">{$_G['gp_item_name']}</a>", 'itemprice' => $_G['gp_item_price'], 'itemcredit' => $_G['gp_item_credit'], 'creditunit' => $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][5]]['unit'] . $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][5]]['title']);
if ($_G['gp_tradeaid']) {
$feed['images'] = array(getforumimg($_G['gp_tradeaid']));
$feed['image_links'] = array("{$_G['siteurl']}forum.php?mod=viewthread&do=tradeinfo&tid={$tid}&pid={$pid}");
}
if ($_G['gp_tradeaid']) {
$attachment = DB::fetch_first("SELECT * FROM " . DB::table('forum_attachment') . " WHERE aid='{$_G['gp_tradeaid']}'");
if (in_array($attachment['filetype'], array('image/gif', 'image/jpeg', 'image/png'))) {
$_G['setting']['attachurl'] = preg_match("/^((https?|ftps?):\\/\\/|www\\.)/i", $_G['setting']['attachurl']) ? $_G['setting']['attachurl'] : $_G['siteurl'] . $_G['setting']['attachurl'];
$imgurl = $_G['setting']['attachurl'] . '/forum/' . $attachment['attachment'] . ($attachment['thumb'] && $attachment['filetype'] != 'image/gif' ? '.thumb.jpg' : '');
$feed['images'][] = $attachment['attachment'] ? $imgurl : '';
$feed['image_links'][] = $attachment['attachment'] ? "{$_G['siteurl']}forum.php?mod=viewthread&tid={$tid}" : '';
}
}
$feed['title_data']['hash_data'] = "tid{$tid}";
$feed['id'] = $tid;
$feed['idtype'] = 'tid';
postfeed($feed);
示例9: getnews
private function getnews($tid, $news)
{
$data = C::t('forum_post')->fetch_threadpost_by_tid_invisible($tid);
$tableid = getattachtableid($tid);
$img = C::t('forum_attachment_n')->fetch_max_image($tableid, 'tid', $tid);
$news['title'] = $data['subject'];
$message = preg_replace('/\\[attach\\].+\\[\\/attach\\]/is', '', $data['message']);
$message = preg_replace('/\\[hide\\].*?\\[\\/hide\\]/is', '', $message);
$message = preg_replace('/\\{\\:soso_e(\\d+)\\:\\}/is', '', $message);
$message = preg_replace('/\\[img\\].*?\\[\\/img\\]/is', '', $message);
$news['description'] = cutstr(strip_tags($message), 250);
if ($img['aid']) {
$news['picurl'] = getforumimg($img['aid'], '', '360', '200');
}
$news['url'] = $_G['siteurl'] . 'forum.php?mod=viewthread&mobile=2&tid=' . $tid . '&openid=' . $postObj->FromUserName;
return $news;
}
示例10: before_replyfeed
public function before_replyfeed()
{
if ($this->forum['allowfeed'] && !$this->param['isanonymous']) {
if ($this->param['special'] == 2 && !empty($_GET['trade'])) {
$creditstransextra = $this->setting['creditstransextra'];
$extcredits = $this->setting['extcredits'];
$this->feed['icon'] = 'goods';
$this->feed['title_template'] = 'feed_thread_goods_title';
if ($_GET['item_price'] > 0) {
if ($creditstransextra[5] != -1 && $_GET['item_credit']) {
$this->feed['body_template'] = 'feed_thread_goods_message_1';
} else {
$this->feed['body_template'] = 'feed_thread_goods_message_2';
}
} else {
$this->feed['body_template'] = 'feed_thread_goods_message_3';
}
$this->feed['body_data'] = array('itemname' => "<a href=\"forum.php?mod=viewthread&do=tradeinfo&tid=" . $this->thread['tid'] . "&pid=" . $this->pid . "\">" . dhtmlspecialchars($_GET['item_name']) . "</a>", 'itemprice' => $_GET['item_price'], 'itemcredit' => $_GET['item_credit'], 'creditunit' => $extcredits[$creditstransextra[5]]['unit'] . $extcredits[$creditstransextra[5]]['title']);
if ($_GET['tradeaid']) {
$this->feed['images'] = array(getforumimg($_GET['tradeaid']));
$this->feed['image_links'] = array("forum.php?mod=viewthread&do=tradeinfo&tid=" . $this->thread['tid'] . "&pid=" . $this->pid);
}
}
}
}
示例11: getthread
function getthread($tidarray, $messagelength = 80, $nospecial = false)
{
global $_G;
if (!$tidarray) {
return '';
}
$notexists = $messagearr = $returnarr = array();
foreach ($tidarray as $var) {
foreach ($var as $v) {
if (empty($_G['block_thread'][$v])) {
$notexists[] = $v;
}
}
}
if ($notexists) {
$query = DB::query("SELECT tid, fid, subject, posttableid, price, special FROM " . DB::table('forum_thread') . " WHERE tid IN (" . dimplode($notexists) . ")");
while ($result = DB::fetch($query)) {
$_G['block_thread'][$result['tid']] = $result;
}
}
foreach ($tidarray as $key => $var) {
if ($key == 0) {
$posttable = 'forum_post';
} else {
$posttable = "forum_post_{$key}";
}
$query = DB::query("SELECT tid, message FROM " . DB::table($posttable) . " WHERE tid IN (" . dimplode($var) . ") AND first=1");
while ($result = DB::fetch($query)) {
$messagearr[$result['tid']] = $result['message'];
}
}
require_once libfile('function/post');
require_once libfile('function/discuzcode');
if ($messagearr) {
foreach ($messagearr as $tid => $var) {
$thread = $_G['block_thread'][$tid];
if ($nospecial) {
$thread['special'] = 0;
}
if ($thread['special'] == 1) {
$polloptions = array();
$multiple = DB::result_first("SELECT multiple FROM " . DB::table('forum_poll') . " WHERE tid='{$tid}'");
$optiontype = $multiple ? 'checkbox' : 'radio';
$query = DB::query("SELECT polloptionid, polloption FROM " . DB::table('forum_polloption') . " WHERE tid='{$tid}' ORDER BY displayorder");
while ($polloption = DB::fetch($query)) {
$polloption['polloption'] = preg_replace("/\\[url=(https?){1}:\\/\\/([^\\[\"']+?)\\](.+?)\\[\\/url\\]/i", "<a href=\"\\1://\\2\" target=\"_blank\">\\3</a>", $polloption['polloption']);
$polloptions[] = $polloption;
}
} elseif ($thread['special'] == 2) {
$trade = C::t('forum_trade')->fetch_first_goods($tid);
$trade['aid'] = $trade['aid'] ? getforumimg($trade['aid']) : '';
$trades[] = $trade;
} elseif ($thread['special'] == 3) {
$extcredits = $_G['settings']['extcredits'];
$creditstransextra = $_G['settings']['creditstransextra'];
$rewardend = $thread['price'] < 0;
$rewardprice = abs($thread['price']);
$message = messagecutstr($var, $messagelength);
} elseif ($thread['special'] == 4) {
$message = messagecutstr($var, $messagelength);
$activity = DB::fetch_first("SELECT aid, number, applynumber FROM " . DB::table('forum_activity') . " WHERE tid='{$tid}'");
$activity['aid'] = $activity['aid'] ? getforumimg($activity['aid']) : '';
$activity['aboutmember'] = $activity['number'] - $activity['applynumber'];
} elseif ($thread['special'] == 5) {
$message = messagecutstr($var, $messagelength);
$debate = C::t('forum_debate')->fetch($tid);
$debate['affirmvoteswidth'] = $debate['affirmvotes'] ? intval(80 * (($debate['affirmvotes'] + 1) / ($debate['affirmvotes'] + $debate['negavotes'] + 1))) : 1;
$debate['negavoteswidth'] = $debate['negavotes'] ? intval(80 * (($debate['negavotes'] + 1) / ($debate['affirmvotes'] + $debate['negavotes'] + 1))) : 1;
$debate['affirmpoint'] = discuzcode($debate['affirmpoint'], 0, 0, 0, 1, 1, 0, 0, 0, 0, 0);
$debate['negapoint'] = discuzcode($debate['negapoint'], 0, 0, 0, 1, 1, 0, 0, 0, 0, 0);
} else {
$message = messagecutstr($var, $messagelength);
}
include template('common/block_thread');
$returnarr[$tid] = $return;
}
}
return $returnarr;
}
示例12: getPublishPollObj
//.........这里部分代码省略.........
$values = array('fid' => $_G['fid'], 'tid' => $tid, 'pid' => $pid, 'coverimg' => '');
$param = array();
if ($_G['forum']['picstyle']) {
if (!setthreadcover($pid, 0, $threadimageaid)) {
preg_match_all("/(\\[img\\]|\\[img=\\d{1,4}[x|\\,]\\d{1,4}\\])\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/is", $message, $imglist, PREG_SET_ORDER);
$values['coverimg'] = "<p id=\"showsetcover\">" . lang('message', 'post_newthread_set_cover') . "<span id=\"setcoverwait\"></span></p><script>if(\$('forward_a')){\$('forward_a').style.display='none';setTimeout(\"\$('forward_a').style.display=''\", 5000);};ajaxget('forum.php?mod=ajax&action=setthreadcover&tid={$tid}&pid={$pid}&fid={$_G['fid']}&imgurl={$imglist[0][2]}&newthread=1', 'showsetcover', 'setcoverwait')</script>";
$param['clean_msgforward'] = 1;
$param['timeout'] = $param['refreshtime'] = 15;
}
}
if (!$isInsertForumImage && $threadimageaid && empty($imagearr)) {
if (!$threadimage) {
$threadimage = C::t('forum_attachment_n')->fetch('tid:' . $tid, $threadimageaid);
}
$threadimage = daddslashes($threadimage);
C::t('forum_threadimage')->insert(array('tid' => $tid, 'attachment' => $threadimage['attachment'], 'remote' => $threadimage['remote']));
$isInsertForumImage = true;
}
}
}
$feed = array('icon' => '', 'title_template' => '', 'title_data' => array(), 'body_template' => '', 'body_data' => array(), 'title_data' => array(), 'images' => array());
if (1) {
$message = !$price && !$readperm ? $message : '';
if ($special == 0) {
$feed['icon'] = 'thread';
$feed['title_template'] = 'feed_thread_title';
$feed['body_template'] = 'feed_thread_message';
$feed['body_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$tid}\">{$subject}</a>", 'message' => messagecutstr($message, 150));
if (!empty($_G['forum_attachexist'])) {
$imgattach = C::t('forum_attachment_n')->fetch_max_image('tid:' . $tid, 'pid', $pid);
$firstaid = $imgattach['aid'];
unset($imgattach);
if ($firstaid) {
$feed['images'] = array(getforumimg($firstaid));
$feed['image_links'] = array("forum.php?mod=viewthread&do=tradeinfo&tid={$tid}&pid={$pid}");
}
}
} elseif ($special > 0) {
if ($special == 1) {
$pvs = explode("\t", messagecutstr($polloptionpreview, 150));
$s = '';
$i = 1;
foreach ($pvs as $pv) {
$s .= $i . '. ' . $pv . '<br />';
}
$s .= ' ...';
$feed['icon'] = 'poll';
$feed['title_template'] = 'feed_thread_poll_title';
$feed['body_template'] = 'feed_thread_poll_message';
$feed['body_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$tid}\">{$subject}</a>", 'message' => $s);
} elseif ($special == 3) {
$feed['icon'] = 'reward';
$feed['title_template'] = 'feed_thread_reward_title';
$feed['body_template'] = 'feed_thread_reward_message';
$feed['body_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$tid}\">{$subject}</a>", 'rewardprice' => $rewardprice, 'extcredits' => $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][2]]['title']);
} elseif ($special == 4) {
$feed['icon'] = 'activity';
$feed['title_template'] = 'feed_thread_activity_title';
$feed['body_template'] = 'feed_thread_activity_message';
$feed['body_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$tid}\">{$subject}</a>", 'starttimefrom' => $_GET['starttimefrom'][$activitytime], 'activityplace' => $activity['place'], 'message' => messagecutstr($message, 150));
if ($_GET['activityaid']) {
$feed['images'] = array(getforumimg($_GET['activityaid']));
$feed['image_links'] = array("forum.php?mod=viewthread&do=tradeinfo&tid={$tid}&pid={$pid}");
}
} elseif ($special == 5) {
$feed['icon'] = 'debate';
示例13: recommendupdate
//.........这里部分代码省略.........
$tids[] = $thread['tid'];
if (!$modedtids || !in_array($thread['tid'], $modedtids)) {
$addthread[$thread['tid']] = array('fid' => $thread['fid'], 'tid' => $thread['tid'], 'position' => 1, 'displayorder' => $i, 'subject' => $thread['subject'], 'author' => $thread['author'], 'authorid' => $thread['authorid'], 'moderatorid' => 0, 'expiration' => 0, 'highlight' => $thread['highlight']);
$i++;
}
}
if ($tids && $imagenum) {
$attachtables = array();
foreach ($tids as $tid) {
$attachtables[getattachtablebytid($tid)][] = $tid;
}
foreach ($attachtables as $attachtable => $tids) {
$attachmentpost = array();
$postlist = C::t('forum_post')->fetch_all_by_tid(0, $tids, false, '', 0, 0, 1);
if ($postlist) {
$pids = array();
foreach ($postlist as $post) {
$pids[] = $post['pid'];
}
$attachmentlist = C::t('forum_attachment_n')->fetch_all_by_pid_width('tid:' . $tids[0], $pids, $imgw);
if ($attachmentlist) {
foreach ($attachmentlist as $k => $attachment) {
$attachmentpost[$k]['fid'] = $postlist[$attachment['pid']]['fid'];
$attachmentpost[$k]['tid'] = $postlist[$attachment['pid']]['tid'];
$attachmentpost[$k]['aid'] = $attachment['aid'];
}
}
unset($postlist, $attachmentlist, $pids);
}
foreach ($attachmentpost as $attachment) {
if (isset($recommendimagelist[$attachment['tid']])) {
continue;
}
$key = md5($attachment['aid'] . '|' . $imgw . '|' . $imgh);
$recommendlist[$attachment['tid']]['filename'] = $attachment['aid'] . "\t" . $imgw . "\t" . $imgh . "\t" . $key;
$recommendimagelist[$attachment['tid']] = $recommendlist[$attachment['tid']];
$recommendimagelist[$attachment['tid']]['subject'] = addslashes($recommendimagelist[$attachment['tid']]['subject']);
$addthread[$attachment['tid']]['aid'] = '';
$addthread[$attachment['tid']]['filename'] = $recommendlist[$attachment['tid']]['filename'];
$addthread[$attachment['tid']]['typeid'] = 1;
if (count($recommendimagelist) == $imagenum) {
break;
}
}
}
}
unset($recommendimagelist);
if ($addthread) {
foreach ($addthread as $row) {
C::t('forum_forumrecommend')->insert($row, false, true);
}
$modrecommend['updatetime'] = TIMESTAMP;
$modrecommendnew = serialize($modrecommend);
C::t('forum_forumfield')->update($fid, array('modrecommend' => $modrecommendnew));
}
}
$recommendlists = $recommendlist = array();
foreach (C::t('forum_forumrecommend')->fetch_all_by_fid($fid, $position) as $recommend) {
if ($recommend['expiration'] && $recommend['expiration'] > TIMESTAMP || !$recommend['expiration']) {
if ($recommend['filename'] && strexists($recommend['filename'], "\t")) {
$imgd = explode("\t", $recommend['filename']);
if ($imgd[0] && $imgd[3]) {
$recommend['filename'] = getforumimg($imgd[0], 0, $imgd[1], $imgd[2]);
}
}
$recommendlist[] = $recommend;
if ($recommend['typeid'] && count($recommendimagelist) < $imagenum) {
$recommendimagelist[] = $recommend;
}
}
if (count($recommendlist) == $num) {
break;
}
}
if ($recommendlist) {
$_G['forum_colorarray'] = array('', '#EE1B2E', '#EE5023', '#996600', '#3C9D40', '#2897C5', '#2B65B7', '#8F2A90', '#EC1282');
foreach ($recommendlist as $thread) {
if ($thread['highlight']) {
$string = sprintf('%02d', $thread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$thread['highlight'] = ' style="';
$thread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$thread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$thread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$thread['highlight'] .= $string[1] ? 'color: ' . $_G['forum_colorarray'][$string[1]] : '';
$thread['highlight'] .= '"';
} else {
$thread['highlight'] = '';
}
$recommendlists[$thread['tid']]['author'] = $thread['author'];
$recommendlists[$thread['tid']]['authorid'] = $thread['authorid'];
$recommendlists[$thread['tid']]['subject'] = $modrecommend['maxlength'] ? cutstr($thread['subject'], $modrecommend['maxlength']) : $thread['subject'];
$recommendlists[$thread['tid']]['subjectstyles'] = $thread['highlight'];
}
}
if ($recommendimagelist && $recommendlist) {
$recommendlists['images'] = $recommendimagelist;
}
return $recommendlists;
}
示例14: getdata
//.........这里部分代码省略.........
$stick = isset($parameter['stick']) ? $parameter['stick'] : 0;
$orderby = isset($parameter['orderby']) ? in_array($parameter['orderby'], array('dateline', 'weekstart', 'monthstart', 'weekexp', 'monthexp')) ? $parameter['orderby'] : 'dateline' : 'dateline';
$titlelength = !empty($parameter['titlelength']) ? intval($parameter['titlelength']) : 40;
$summarylength = !empty($parameter['summarylength']) ? intval($parameter['summarylength']) : 80;
$recommend = !empty($parameter['recommend']) ? 1 : 0;
$keyword = !empty($parameter['keyword']) ? $parameter['keyword'] : '';
$place = !empty($parameter['place']) ? $parameter['place'] : '';
$class = !empty($parameter['class']) ? $parameter['class'] : '';
$gender = !empty($parameter['gender']) ? intval($parameter['gender']) : '';
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
if (empty($fids)) {
$plusids = $typeids ? array(0) : array();
foreach ($typeids as $typeid) {
if (!empty($_G['cache']['grouptype']['first'][$typeid]['secondlist'])) {
$plusids = array_merge($plusids, $_G['cache']['grouptype']['first'][$typeid]['secondlist']);
}
}
$typeids = array_merge($typeids, $plusids);
$groups = array();
if ($typeids) {
$query = DB::query('SELECT f.fid, f.name, ff.description FROM ' . DB::table('forum_forum') . " f LEFT JOIN " . DB::table('forum_forumfield') . " ff ON f.fid = ff.fid WHERE f.fup IN (" . dimplode($typeids) . ")");
while ($value = DB::fetch($query)) {
$groups[$value['fid']] = $value;
$fids[] = intval($value['fid']);
}
}
}
require_once libfile('function/post');
$datalist = $list = array();
if ($keyword) {
if (preg_match("(AND|\\+|&|\\s)", $keyword) && !preg_match("(OR|\\|)", $keyword)) {
$andor = ' AND ';
$keywordsrch = '1';
$keyword = preg_replace("/( AND |&| )/is", "+", $keyword);
} else {
$andor = ' OR ';
$keywordsrch = '0';
$keyword = preg_replace("/( OR |\\|)/is", "+", $keyword);
}
$keyword = str_replace('*', '%', addcslashes($keyword, '%_'));
foreach (explode('+', $keyword) as $text) {
$text = trim($text);
if ($text) {
$keywordsrch .= $andor;
$keywordsrch .= "t.subject LIKE '%{$text}%'";
}
}
$keyword = " AND ({$keywordsrch})";
} else {
$keyword = '';
}
$sql = ($fids ? ' AND t.fid IN (' . dimplode($fids) . ')' : '') . $keyword . ($tids ? ' AND t.tid IN (' . dimplode($tids) . ')' : '') . ($bannedids ? ' AND t.tid NOT IN (' . dimplode($bannedids) . ')' : '') . ($digest ? ' AND t.digest IN (' . dimplode($digest) . ')' : '') . ($stick ? ' AND t.displayorder IN (' . dimplode($stick) . ')' : '') . " AND t.isgroup='1'";
$where = '';
if (in_array($orderby, array('weekstart', 'monthstart'))) {
$historytime = 0;
switch ($orderby) {
case 'weekstart':
$historytime = TIMESTAMP + 86400 * 7;
break;
case 'monthstart':
$historytime = TIMESTAMP + 86400 * 30;
break;
}
$where = ' WHERE a.starttimefrom >= ' . TIMESTAMP . ' AND a.starttimefrom<=' . $historytime;
$orderby = 'a.starttimefrom ASC';
} elseif (in_array($orderby, array('weekexp', 'monthexp'))) {
$historytime = 0;
switch ($orderby) {
case 'weekexp':
$historytime = TIMESTAMP + 86400 * 7;
break;
case 'monthexp':
$historytime = TIMESTAMP + 86400 * 30;
break;
}
$where = ' WHERE a.expiration >= ' . TIMESTAMP . ' AND a.expiration<=' . $historytime;
$orderby = 'a.expiration ASC';
} else {
$orderby = 't.dateline DESC';
}
$where .= $uids ? ' AND t.authorid IN (' . dimplode($uids) . ')' : '';
if ($gender) {
$where .= " AND a.gender='{$gender}'";
}
$sqlfrom = " INNER JOIN `" . DB::table('forum_thread') . "` t ON t.tid=a.tid {$sql} AND t.displayorder>='0'";
if ($recommend) {
$sqlfrom .= " INNER JOIN `" . DB::table('forum_forumrecommend') . "` fc ON fc.tid=tr.tid";
}
$query = DB::query("SELECT a.*, t.tid, t.subject, t.authorid, t.author\n\t\t\tFROM " . DB::table('forum_activity') . " a {$sqlfrom} {$where}\n\t\t\tORDER BY {$orderby}\n\t\t\tLIMIT {$startrow},{$items};");
include_once libfile('block/thread', 'class');
$bt = new block_thread();
while ($data = DB::fetch($query)) {
$data['time'] = dgmdate($data['starttimefrom']);
if ($data['starttimeto']) {
$data['time'] .= ' - ' . dgmdate($data['starttimeto']);
}
$list[] = array('id' => $data['pid'], 'idtype' => 'pid', 'title' => cutstr(str_replace('\\\'', ''', addslashes($data['subject'])), $titlelength), 'url' => 'forum.php?mod=viewthread&tid=' . $data['tid'], 'pic' => $data['aid'] ? getforumimg($data['aid']) : IMGDIR . '/nophoto.gif', 'picflag' => '0', 'summary' => !empty($style['getsummary']) ? $bt->getthread($data['tid'], $summarylength, true) : '', 'fields' => array('time' => $data['time'], 'expiration' => $data['expiration'] ? dgmdate($data['expiration']) : 'N/A', 'author' => $data['author'] ? $data['author'] : 'Anonymous', 'authorid' => $data['authorid'] ? $data['authorid'] : 0, 'cost' => $data['cost'], 'place' => $data['place'], 'class' => $data['class'], 'gender' => $data['gender'], 'number' => $data['number'], 'applynumber' => $data['applynumber']));
}
return array('html' => '', 'data' => $list);
}
示例15: attachinpost
function attachinpost($attach)
{
global $_G;
$attach['refcheck'] = !$attach['remote'] && $_G['setting']['attachrefcheck'] || $attach['remote'] && ($_G['setting']['ftp']['hideurl'] || $attach['isimage'] && $_G['setting']['attachimgpost'] && strtolower(substr($_G['setting']['ftp']['attachurl'], 0, 3)) == 'ftp');
$mobilethumburl = $attach['attachimg'] && $_G['setting']['showimages'] && (!$attach['price'] || $attach['payed']) && ($_G['group']['allowgetimage'] || $_G['uid'] == $attach['uid']) ? getforumimg($attach['aid'], 0, 140, 140, 'fixnone') : '';
$aidencode = packaids($attach);
$is_archive = $_G['forum_thread']['is_archived'] ? '&fid=' . $_G['fid'] . '&archiveid=' . $_G[forum_thread][archiveid] : '';
$return = <<<EOF
EOF;
if ($attach['attachimg'] && $_G['setting']['showimages'] && (!$attach['price'] || $attach['payed']) && ($_G['group']['allowgetimage'] || $_G['uid'] == $attach['uid'])) {
if ($_G['setting']['mobile']['mobilesimpletype'] == 0) {
$return .= <<<EOF
<a href="forum.php?mod=viewthread&tid={$attach['tid']}&aid={$attach['aid']}&from=album&page={$_G['page']}" class="orange"><img id="aimg_{$attach['aid']}" src="{$mobilethumburl}" alt="{$attach['imgalt']}" title="{$attach['imgalt']}" /></a>
EOF;
}
} else {
if (!$attach['price'] || $attach['payed']) {
$return .= <<<EOF
<div id="attach_{$attach['aid']}" class="box attach mbn" >
EOF;
if ($_G['setting']['mobile']['mobilesimpletype'] == 0) {
$return .= <<<EOF
{$attach['attachicon']}
EOF;
}
if (!$attach['price'] || $attach['payed']) {
$return .= <<<EOF
<a href="forum.php?mod=attachment{$is_archive}&aid={$aidencode}" target="_blank">{$attach['filename']}</a>
EOF;
} else {
$return .= <<<EOF
<a href="forum.php?mod=misc&action=attachpay&aid={$attach['aid']}&tid={$attach['tid']}" target="_blank">{$attach['filename']}</a>
EOF;
}
$return .= <<<EOF
<em class="xg1">({$attach['attachsize']})</em>
<em class="xg1"><br />(下载次数: {$attach['downloads']}, {$attach['dateline']} 上传)
</em>
EOF;
if (!$attach['attachimg'] && $_G['getattachcredits']) {
$return .= <<<EOF
<p>下载积分: {$_G['getattachcredits']}</p>
EOF;
}
$return .= <<<EOF
</div>
EOF;
}
}
$return .= <<<EOF
EOF;
return $return;
}