First commit

This commit is contained in:
2025-06-18 10:24:27 +08:00
commit ebc39cd5dd
3873 changed files with 412712 additions and 0 deletions

View File

@@ -0,0 +1,361 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_activity.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class block_activity extends discuz_block {
var $setting = array();
function __construct(){
$this->setting = array(
'tids' => array(
'title' => 'activitylist_tids',
'type' => 'text'
),
'uids' => array(
'title' => 'activitylist_uids',
'type' => 'text'
),
'keyword' => array(
'title' => 'activitylist_keyword',
'type' => 'text'
),
'fids' => array(
'title' => 'activitylist_fids',
'type' => 'mselect',
'value' => array()
),
'viewmod' => array(
'title' => 'threadlist_viewmod',
'type' => 'radio'
),
'digest' => array(
'title' => 'activitylist_digest',
'type' => 'mcheckbox',
'value' => array(
array(1, 'activitylist_digest_1'),
array(2, 'activitylist_digest_2'),
array(3, 'activitylist_digest_3'),
array(0, 'activitylist_digest_0')
),
),
'stick' => array(
'title' => 'activitylist_stick',
'type' => 'mcheckbox',
'value' => array(
array(1, 'activitylist_stick_1'),
array(2, 'activitylist_stick_2'),
array(3, 'activitylist_stick_3'),
array(0, 'activitylist_stick_0')
),
),
'recommend' => array(
'title' => 'activitylist_recommend',
'type' => 'radio'
),
'place' => array(
'title' => 'activitylist_place',
'type' => 'text'
),
'class' => array(
'title' => 'activitylist_class',
'type' => 'select',
'value' => array()
),
'gender' => array(
'title' => 'activitylist_gender',
'type' => 'mradio',
'value' => array(
array('', 'activitylist_gender_0'),
array('1', 'activitylist_gender_1'),
array('2', 'activitylist_gender_2'),
),
'default' => ''
),
'orderby' => array(
'title' => 'activitylist_orderby',
'type'=> 'mradio',
'value' => array(
array('dateline', 'activitylist_orderby_dateline'),
array('weekstart', 'activitylist_orderby_weekstart'),
array('monthstart', 'activitylist_orderby_monthstart'),
array('weekexp', 'activitylist_orderby_weekexp'),
array('monthexp', 'activitylist_orderby_monthexp'),
array('weekhot', 'activitylist_orderby_weekhot'),
array('monthhot', 'activitylist_orderby_monthhot'),
array('alltimehot', 'activitylist_orderby_alltimehot'),
),
'default' => 'dateline'
),
'highlight' => array(
'title' => 'activitylist_highlight',
'type' => 'radio',
'default' => 0,
),
'titlelength' => array(
'title' => 'activitylist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'activitylist_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'activitylist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_activity_script_activity');
}
function blockclass() {
return array('activity', lang('blockclass', 'blockclass_activity_activity'));
}
function fields() {
return array(
'id' => array('name' => lang('blockclass', 'blockclass_field_id'), 'formtype' => 'text', 'datatype' => 'int'),
'url' => array('name' => lang('blockclass', 'blockclass_activity_field_url'), 'formtype' => 'text', 'datatype' => 'string'),
'title' => array('name' => lang('blockclass', 'blockclass_activity_field_title'), 'formtype' => 'title', 'datatype' => 'title'),
'pic' => array('name' => lang('blockclass', 'blockclass_activity_field_pic'), 'formtype' => 'pic', 'datatype' => 'pic'),
'summary' => array('name' => lang('blockclass', 'blockclass_activity_field_summary'), 'formtype' => 'summary', 'datatype' => 'summary'),
'time' => array('name' => lang('blockclass', 'blockclass_activity_field_time'), 'formtype' => 'text', 'datatype' => 'text'),
'expiration' => array('name' => lang('blockclass', 'blockclass_activity_field_expiration'), 'formtype' => 'text', 'datatype' => 'text'),
'author' => array('name' => lang('blockclass', 'blockclass_activity_field_author'), 'formtype' => 'text', 'datatype' => 'text'),
'authorid' => array('name' => lang('blockclass', 'blockclass_activity_field_authorid'), 'formtype' => 'text', 'datatype' => 'int'),
'cost' => array('name' => lang('blockclass', 'blockclass_activity_field_cost'), 'formtype' => 'text', 'datatype' => 'int'),
'place' => array('name' => lang('blockclass', 'blockclass_activity_field_place'), 'formtype' => 'text', 'datatype' => 'text'),
'class' => array('name' => lang('blockclass', 'blockclass_activity_field_class'), 'formtype' => 'text', 'datatype' => 'text'),
'gender' => array('name' => lang('blockclass', 'blockclass_activity_field_gender'), 'formtype' => 'text', 'datatype' => 'text'),
'number' => array('name' => lang('blockclass', 'blockclass_activity_field_number'), 'formtype' => 'text', 'datatype' => 'int'),
'applynumber' => array('name' => lang('blockclass', 'blockclass_activity_field_applynumber'), 'formtype' => 'text', 'datatype' => 'int'),
);
}
function fieldsconvert() {
return array(
'group_activity' => array(
'name' => lang('blockclass', 'blockclass_group_activity'),
'script' => 'groupactivity',
'searchkeys' => array(),
'replacekeys' => array(),
),
);
}
function getsetting() {
global $_G;
$settings = $this->setting;
if($settings['fids']) {
loadcache('forums');
$settings['fids']['value'][] = array(0, lang('portalcp', 'block_all_forum'));
foreach($_G['cache']['forums'] as $fid => $forum) {
$settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')).$forum['name']);
}
}
$activitytype = explode("\n", $_G['setting']['activitytype']);
$settings['class']['value'][] = array('', 'activitylist_class_all');
foreach($activitytype as $item) {
$item = trim($item);
$settings['class']['value'][] = array($item, $item);
}
return $settings;
}
function getdata($style, $parameter) {
global $_G;
$parameter = $this->cookparameter($parameter);
loadcache('forums');
$tids = !empty($parameter['tids']) ? explode(',', $parameter['tids']) : array();
$uids = !empty($parameter['uids']) ? explode(',', $parameter['uids']) : array();
$startrow = !empty($parameter['startrow']) ? intval($parameter['startrow']) : 0;
$items = !empty($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','weekstart','monthstart','weekexp','monthexp','weekhot','monthhot','alltimehot')) ? $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']) ? trim($parameter['class']) : '';
$gender = !empty($parameter['gender']) ? intval($parameter['gender']) : '';
$viewmod = !empty($parameter['viewmod']) ? 1 : 0;
$highlight = !empty($parameter['highlight']) ? 1 : 0;
$fids = array();
if(!empty($parameter['fids'])) {
if($parameter['fids'][0] == '0') {
unset($parameter['fids'][0]);
}
$fids = $parameter['fids'];
}
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
require_once libfile('function/post');
require_once libfile('function/search');
$datalist = $list = array();
$keyword = $keyword ? searchkey($keyword, "t.subject LIKE '%{text}%'") : '';
$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='0'";
$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';
} elseif(in_array($orderby, array('weekhot','monthhot'))) {
$historytime = 0;
switch($orderby) {
case 'weekhot':
$historytime = TIMESTAMP + 86400 * 7;
break;
case 'monthhot':
$historytime = TIMESTAMP + 86400 * 30;
break;
}
$where = ' WHERE a.expiration>='.TIMESTAMP.' AND a.expiration<='.$historytime;
$orderby = 'a.applynumber DESC';
} elseif($orderby == 'alltimehot') {
$where = ' WHERE (a.expiration>='.TIMESTAMP." OR a.expiration='0')";
$orderby = 'a.applynumber DESC';
} else {
$orderby = 't.dateline DESC';
}
$where .= $uids ? ' AND t.authorid IN ('.dimplode($uids).')' : '';
if($gender) {
$where .= " AND a.gender='$gender'";
}
if($class) {
$where .= " AND a.class='$class'";
}
$sqlfrom = " INNER JOIN `".DB::table('forum_thread')."` t ON t.tid=a.tid $sql AND t.displayorder>='0'";
$joinmethod = empty($tids) ? 'INNER' : 'LEFT';
if($recommend) {
$sqlfrom .= " $joinmethod JOIN `".DB::table('forum_forumrecommend')."` fc ON fc.tid=tr.tid";
}
$sqlfield = $highlight ? ', t.highlight' : '';
$query = DB::query("SELECT a.*, t.tid, t.subject, t.authorid, t.author, t.posttableid$sqlfield
FROM ".DB::table('forum_activity')." a $sqlfrom $where
ORDER BY $orderby
LIMIT $startrow,$items;"
);
require_once libfile('block_thread', 'class/block/forum');
$bt = new block_thread();
$listtids = $threadtids = $threads = $aid2tid = $attachtables = array();
while($data = DB::fetch($query)) {
$data['time'] = dgmdate($data['starttimefrom']);
if($data['starttimeto']) {
$data['time'] .= ' - '.dgmdate($data['starttimeto']);
}
if($style['getsummary']) {
$threadtids[$data['posttableid']][] = $data['tid'];
}
if($data['aid']) {
$aid2tid[$data['aid']] = $data['tid'];
$attachtable = getattachtableid($data['tid']);
$attachtables[$attachtable][] = $data['aid'];
}
$listtids[] = $data['tid'];
$list[$data['tid']] = array(
'id' => $data['tid'],
'idtype' => 'tid',
'title' => cutstr(str_replace('\\\'', '&#39;', $data['subject']), $titlelength, ''),
'url' => 'forum.php?mod=viewthread&tid='.$data['tid'].($viewmod ? '&from=portal' : ''),
'pic' => ($data['aid'] ? '' : $_G['style']['imgdir'].'/nophoto.gif'),
'picflag' => '0',
'fields' => array(
'fulltitle' => str_replace('\\\'', '&#39;', addslashes($data['subject'])),
'time' => $data['time'],
'expiration' => $data['expiration'] ? dgmdate($data['expiration']) : 'N/A',
'author' => $data['author'] ? $data['author'] : $_G['setting']['anonymoustext'],
'authorid' => $data['authorid'] ? $data['authorid'] : 0,
'cost' => $data['cost'],
'place' => $data['place'],
'class' => $data['class'],
'gender' => $data['gender'],
'number' => $data['number'],
'applynumber' => $data['applynumber'],
)
);
if($highlight && $data['highlight']) {
$list[$data['tid']]['fields']['showstyle'] = $bt->getthreadstyle($data['highlight']);
}
}
if(!empty($listtids)) {
$query = DB::query("SELECT tid,COUNT(*) as sum FROM ".DB::table('forum_activityapply')." WHERE tid IN(".dimplode($listtids).") GROUP BY tid");
while($value = DB::fetch($query)) {
$list[$value['tid']]['fields']['applynumber'] = $value['sum'];
}
$threads = $bt->getthread($threadtids, $summarylength, true);
if($threads) {
foreach($threads as $tid => $var) {
$list[$tid]['summary'] = $var;
}
}
foreach($attachtables as $tableid => $taids) {
$query = DB::query('SELECT aid, attachment, remote FROM '.DB::table('forum_attachment_'.$tableid).' WHERE aid IN ('.dimplode($taids).')');
while($avalue = DB::fetch($query)) {
$list[$aid2tid[$avalue['aid']]]['pic'] = 'forum/'.$avalue['attachment'];
$list[$aid2tid[$avalue['aid']]]['picflag'] = $avalue['remote'] ? '2' : '1';
}
}
foreach($listtids as $key => $value) {
$datalist[] = $list[$value];
}
}
return array('html' => '', 'data' => $datalist);
}
}
?>

View File

@@ -0,0 +1,73 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_activitycity.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_activity', 'class/block/forum');
class block_activitycity extends block_activity {
function __construct() {
$this->setting = array(
'fids' => array(
'title' => 'activitylist_fids',
'type' => 'mselect',
'value' => array()
),
'viewmod' => array(
'title' => 'threadlist_viewmod',
'type' => 'radio'
),
'place' => array(
'title' => 'activitylist_place',
'type' => 'text'
),
'class' => array(
'title' => 'activitylist_class',
'type' => 'select',
'value' => array()
),
'orderby' => array(
'title' => 'activitylist_orderby',
'type'=> 'mradio',
'value' => array(
array('dateline', 'activitylist_orderby_dateline'),
array('weekstart', 'activitylist_orderby_weekstart'),
array('monthstart', 'activitylist_orderby_monthstart'),
array('weekexp', 'activitylist_orderby_weekexp'),
array('monthexp', 'activitylist_orderby_monthexp'),
),
'default' => 'dateline'
),
'titlelength' => array(
'title' => 'activitylist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'activitylist_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'activitylist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_activity_script_activitycity');
}
}
?>

View File

@@ -0,0 +1,61 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_activitynew.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_activity', 'class/block/forum');
class block_activitynew extends block_activity {
function __construct() {
$this->setting = array(
'fids' => array(
'title' => 'activitylist_fids',
'type' => 'mselect',
'value' => array()
),
'viewmod' => array(
'title' => 'threadlist_viewmod',
'type' => 'radio'
),
'class' => array(
'title' => 'activitylist_class',
'type' => 'select',
'value' => array()
),
'titlelength' => array(
'title' => 'activitylist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'activitylist_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'activitylist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_activity_script_activitynew');
}
function cookparameter($parameter) {
$parameter['orderby'] = 'dateline';
return parent::cookparameter($parameter);
}
}
?>

View File

@@ -0,0 +1,173 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_forum.php 29623 2012-04-23 06:54:18Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class block_forum extends discuz_block {
var $setting = array();
function __construct() {
$this->setting = array(
'fids' => array(
'title' => 'forumlist_fids',
'type' => 'text',
),
'fups' => array(
'title' => 'forumlist_fups',
'type' => 'mselect',
'value' => array()
),
'titlelength' => array(
'title' => 'forumlist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'forumlist_summarylength',
'type' => 'text',
'default' => 80
),
'orderby' => array(
'title' => 'forumlist_orderby',
'type' => 'mradio',
'value' => array(
array('displayorder', 'forumlist_orderby_displayorder'),
array('threads', 'forumlist_orderby_threads'),
array('todayposts', 'forumlist_orderby_todayposts'),
array('posts', 'forumlist_orderby_posts')
),
'default' => 'displayorder'
)
);
}
function name() {
return lang('blockclass', 'blockclass_forum_script_forum');
}
function blockclass() {
return array('forum', lang('blockclass', 'blockclass_forum_forum'));
}
function fields() {
return array(
'id' => array('name' => lang('blockclass', 'blockclass_field_id'), 'formtype' => 'text', 'datatype' => 'int'),
'url' => array('name' => lang('blockclass', 'blockclass_forum_field_url'), 'formtype' => 'text', 'datatype' => 'string'),
'title' => array('name' => lang('blockclass', 'blockclass_forum_field_title'), 'formtype' => 'title', 'datatype' => 'title'),
'summary' => array('name' => lang('blockclass', 'blockclass_forum_field_summary'), 'formtype' => 'summary', 'datatype' => 'summary'),
'icon' => array('name' => lang('blockclass', 'blockclass_forum_field_icon'), 'formtype' => 'text', 'datatype' => 'string'),
'posts' => array('name'=>lang('blockclass', 'blockclass_forum_field_posts'), 'formtype' => 'text', 'datatype'=>'int'),
'threads' => array('name'=>lang('blockclass', 'blockclass_forum_field_threads'), 'formtype' => 'text', 'datatype'=>'int'),
'todayposts' => array('name'=>lang('blockclass', 'blockclass_forum_field_todayposts'), 'formtype' => 'text', 'datatype'=>'int'),
);
}
function fieldsconvert() {
return array(
'group_group' => array(
'name' => lang('blockclass', 'blockclass_group_group'),
'script' => 'group',
'searchkeys' => array(),
'replacekeys' => array(),
),
'portal_category' => array(
'name' => lang('blockclass', 'blockclass_portal_category'),
'script' => 'portalcategory',
'searchkeys' => array('threads'),
'replacekeys' => array('articles'),
),
);
}
function getsetting() {
global $_G;
$settings = $this->setting;
loadcache('forums');
$settings['fups']['value'][] = array(0, lang('portalcp', 'block_all_forum'));
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
foreach($_G['cache']['forums'] as $fid => $forum) {
$settings['fups']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')).$forum['name']);
}
return $settings;
}
function getdata($style, $parameter) {
global $_G;
$parameter = $this->cookparameter($parameter);
$fids = !empty($parameter['fids']) ? explode(',',$parameter['fids']) : array();
$fups = isset($parameter['fups']) && !in_array(0, (array)$parameter['fups']) ? $parameter['fups'] : '';
$orderby = isset($parameter['orderby']) ? (in_array($parameter['orderby'],array('displayorder','threads','posts', 'todayposts')) ? $parameter['orderby'] : 'displayorder') : 'displayorder';
$titlelength = isset($parameter['titlelength']) ? intval($parameter['titlelength']) : 40;
$summarylength = isset($parameter['summarylength']) ? intval($parameter['summarylength']) : 80;
$startrow = isset($parameter['startrow']) ? intval($parameter['startrow']) : 0;
$items = !empty($parameter['items']) ? intval($parameter['items']) : 10;
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
$sqlban = !empty($bannedids) ? ' AND f.fid NOT IN ('.dimplode($bannedids).')' : '';
if(empty($fups)) {
loadcache('forums');
if(empty($_G['cache']['forums'])) {
$fups = array('0');
} else {
$fups = array_keys($_G['cache']['forums']);
}
}
$wheres = array();
if($fids) {
$wheres[] = 'f.`fid` IN ('.dimplode($fids).')';
}
if($fups) {
$wheres[] = 'f.`fup` IN ('.dimplode($fups).')';
}
$wheres[] = "f.`status`='1'";
$wheres[] = "f.`type`!='group'";
$wheresql = implode(' AND ', $wheres);
$ffadd1 = ", ff.icon, ff.description";
$ffadd2 = "LEFT JOIN `".DB::table('forum_forumfield')."` ff ON f.`fid`=ff.`fid`";
$query = DB::query("SELECT f.* $ffadd1
FROM `".DB::table('forum_forum')."` f $ffadd2
WHERE $wheresql
$sqlban
ORDER BY ".($orderby == 'displayorder' ? "f.fup, f.`displayorder` ASC " : "f.`$orderby` DESC")
." LIMIT $startrow, $items"
);
$datalist = $list = array();
$attachurl = preg_match('/^(http|ftp|ftps|https):\/\//', $_G['setting']['attachurl']) ? $_G['setting']['attachurl'] : $_G['siteurl'].$_G['setting']['attachurl'];
while($data = DB::fetch($query)) {
if(!empty($data['icon'])) {
$data['icon'] = preg_match('/^(http|ftp|ftps|https):\/\//', $data['icon']) ? $data['icon'] : $attachurl.'common/'.$data['icon'];
} else {
$data['icon'] = STATICURL.'image/common/forum_new.gif';
}
$list[] = array(
'id' => $data['fid'],
'idtype' => 'fid',
'title' => cutstr($data['name'], $titlelength, ''),
'url' => 'forum.php?mod=forumdisplay&fid='.$data['fid'],
'pic' => '',
'summary' => cutstr($data['description'], $summarylength, ''),
'fields' => array(
'fulltitle' => $data['name'],
'icon' => $data['icon'],
'threads' => intval($data['threads']),
'posts' => intval($data['posts']),
'todayposts' => intval($data['todayposts'])
)
);
}
return array('html' => '', 'data' => $list);
}
}
?>

View File

@@ -0,0 +1,576 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_thread.php 32768 2013-03-07 09:40:05Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class block_thread extends discuz_block {
var $setting = array();
function __construct(){
$this->setting = array(
'tids' => array(
'title' => 'threadlist_tids',
'type' => 'text'
),
'uids' => array(
'title' => 'threadlist_uids',
'type' => 'text'
),
'keyword' => array(
'title' => 'threadlist_keyword',
'type' => 'text'
),
'tagkeyword' => array(
'title' => 'threadlist_tagkeyword',
'type' => 'text'
),
'fids' => array(
'title' => 'threadlist_fids',
'type' => 'mselect',
'value' => array()
),
'typeids' => array(
'title' => 'threadlist_typeids',
'type' => 'text'
),
'sortids' => array(
'title' => 'threadlist_sortids',
'type' => 'mselect',
'value' => array()
),
'reply' => array(
'title' => 'threadlist_reply',
'type' => 'radio'
),
'digest' => array(
'title' => 'threadlist_digest',
'type' => 'mcheckbox',
'value' => array(
array(1, 'threadlist_digest_1'),
array(2, 'threadlist_digest_2'),
array(3, 'threadlist_digest_3'),
array(0, 'threadlist_digest_0')
),
),
'stick' => array(
'title' => 'threadlist_stick',
'type' => 'mcheckbox',
'value' => array(
array(1, 'threadlist_stick_1'),
array(2, 'threadlist_stick_2'),
array(3, 'threadlist_stick_3'),
array(0, 'threadlist_stick_0')
),
),
'recommend' => array(
'title' => 'threadlist_recommend',
'type' => 'radio'
),
'special' => array(
'title' => 'threadlist_special',
'type' => 'mcheckbox',
'value' => array(
array(1, 'threadlist_special_1'),
array(2, 'threadlist_special_2'),
array(3, 'threadlist_special_3'),
array(4, 'threadlist_special_4'),
array(5, 'threadlist_special_5'),
array(0, 'threadlist_special_0'),
)
),
'viewmod' => array(
'title' => 'threadlist_viewmod',
'type' => 'radio'
),
'rewardstatus' => array(
'title' => 'threadlist_special_reward',
'type' => 'mradio',
'value' => array(
array(0, 'threadlist_special_reward_0'),
array(1, 'threadlist_special_reward_1'),
array(2, 'threadlist_special_reward_2')
),
'default' => 0,
),
'picrequired' => array(
'title' => 'threadlist_picrequired',
'type' => 'radio',
'value' => '0'
),
'orderby' => array(
'title' => 'threadlist_orderby',
'type'=> 'mradio',
'value' => array(
array('lastpost', 'threadlist_orderby_lastpost'),
array('dateline', 'threadlist_orderby_dateline'),
array('replies', 'threadlist_orderby_replies'),
array('views', 'threadlist_orderby_views'),
array('heats', 'threadlist_orderby_heats'),
array('recommends', 'threadlist_orderby_recommends'),
),
'default' => 'lastpost'
),
'postdateline' => array(
'title' => 'threadlist_postdateline',
'type'=> 'mradio',
'value' => array(
array('0', 'threadlist_postdateline_nolimit'),
array('3600', 'threadlist_postdateline_hour'),
array('86400', 'threadlist_postdateline_day'),
array('604800', 'threadlist_postdateline_week'),
array('2592000', 'threadlist_postdateline_month'),
),
'default' => '0'
),
'lastpost' => array(
'title' => 'threadlist_lastpost',
'type'=> 'mradio',
'value' => array(
array('0', 'threadlist_lastpost_nolimit'),
array('3600', 'threadlist_lastpost_hour'),
array('86400', 'threadlist_lastpost_day'),
array('604800', 'threadlist_lastpost_week'),
array('2592000', 'threadlist_lastpost_month'),
),
'default' => '0'
),
'highlight' => array(
'title' => 'threadlist_highlight',
'type' => 'radio',
'default' => 0,
),
'titlelength' => array(
'title' => 'threadlist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'threadlist_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'threadlist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_thread_script_thread');
}
function blockclass() {
return array('thread', lang('blockclass', 'blockclass_forum_thread'));
}
function fields() {
return array(
'id' => array('name' => lang('blockclass', 'blockclass_field_id'), 'formtype' => 'text', 'datatype' => 'int'),
'url' => array('name' => lang('blockclass', 'blockclass_thread_field_url'), 'formtype' => 'text', 'datatype' => 'string'),
'title' => array('name' => lang('blockclass', 'blockclass_thread_field_title'), 'formtype' => 'title', 'datatype' => 'title'),
'pic' => array('name' => lang('blockclass', 'blockclass_thread_field_pic'), 'formtype' => 'pic', 'datatype' => 'pic'),
'summary' => array('name' => lang('blockclass', 'blockclass_thread_field_summary'), 'formtype' => 'summary', 'datatype' => 'summary'),
'author' => array('name' => lang('blockclass', 'blockclass_thread_field_author'), 'formtype' => 'text', 'datatype' => 'string'),
'authorid' => array('name' => lang('blockclass', 'blockclass_thread_field_authorid'), 'formtype' => 'text', 'datatype' => 'int'),
'avatar' => array('name' => lang('blockclass', 'blockclass_thread_field_avatar'), 'formtype' => 'text', 'datatype' => 'string'),
'avatar_middle' => array('name' => lang('blockclass', 'blockclass_thread_field_avatar_middle'), 'formtype' => 'text', 'datatype' => 'string'),
'avatar_big' => array('name' => lang('blockclass', 'blockclass_thread_field_avatar_big'), 'formtype' => 'text', 'datatype' => 'string'),
'forumurl' => array('name' => lang('blockclass', 'blockclass_thread_field_forumurl'), 'formtype' => 'text', 'datatype' => 'string'),
'forumname' => array('name' => lang('blockclass', 'blockclass_thread_field_forumname'), 'formtype' => 'text', 'datatype' => 'string'),
'typename' => array('name' => lang('blockclass', 'blockclass_thread_field_typename'), 'formtype' => 'text', 'datatype' => 'string'),
'typeicon' => array('name' => lang('blockclass', 'blockclass_thread_field_typeicon'), 'formtype' => 'text', 'datatype' => 'string'),
'typeurl' => array('name' => lang('blockclass', 'blockclass_thread_field_typeurl'), 'formtype' => 'text', 'datatype' => 'string'),
'sortname' => array('name' => lang('blockclass', 'blockclass_thread_field_sortname'), 'formtype' => 'text', 'datatype' => 'string'),
'sorturl' => array('name' => lang('blockclass', 'blockclass_thread_field_sorturl'), 'formtype' => 'text', 'datatype' => 'string'),
'posts' => array('name' => lang('blockclass', 'blockclass_thread_field_posts'), 'formtype' => 'text', 'datatype' => 'int'),
'todayposts' => array('name' => lang('blockclass', 'blockclass_thread_field_todayposts'), 'formtype' => 'text', 'datatype' => 'int'),
'lastposter' => array('name' => lang('blockclass', 'blockclass_thread_field_lastposter'), 'formtype' => 'string', 'datatype' => 'string'),
'lastpost' => array('name' => lang('blockclass', 'blockclass_thread_field_lastpost'), 'formtype' => 'date', 'datatype' => 'date'),
'dateline' => array('name' => lang('blockclass', 'blockclass_thread_field_dateline'), 'formtype' => 'date', 'datatype' => 'date'),
'replies' => array('name' => lang('blockclass', 'blockclass_thread_field_replies'), 'formtype' => 'text', 'datatype' => 'int'),
'views' => array('name' => lang('blockclass', 'blockclass_thread_field_views'), 'formtype' => 'text', 'datatype' => 'int'),
'heats' => array('name' => lang('blockclass', 'blockclass_thread_field_heats'), 'formtype' => 'text', 'datatype' => 'int'),
'recommends' => array('name' => lang('blockclass', 'blockclass_thread_field_recommends'), 'formtype' => 'text', 'datatype' => 'int'),
);
}
function fieldsconvert() {
return array(
'portal_article' => array(
'name' => lang('blockclass', 'blockclass_portal_article'),
'script' => 'article',
'searchkeys' => array('author', 'authorid', 'forumurl', 'forumname', 'posts', 'views', 'replies'),
'replacekeys' => array('username', 'uid', 'caturl', 'catname', 'articles', 'viewnum', 'commentnum'),
),
'space_blog' => array(
'name' => lang('blockclass', 'blockclass_space_blog'),
'script' => 'blog',
'searchkeys' => array('author', 'authorid', 'views', 'replies'),
'replacekeys' => array('username', 'uid', 'viewnum', 'replynum'),
),
'group_thread' => array(
'name' => lang('blockclass', 'blockclass_group_thread'),
'script' => 'groupthread',
'searchkeys' => array('forumname', 'forumurl'),
'replacekeys' => array('groupname', 'groupurl'),
),
);
}
function getsetting() {
global $_G;
$settings = $this->setting;
if($settings['fids']) {
loadcache('forums');
$settings['fids']['value'][] = array(0, lang('portalcp', 'block_all_forum'));
foreach($_G['cache']['forums'] as $fid => $forum) {
$settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')).$forum['name']);
}
}
if($settings['sortids']) {
$settings['sortids']['value'][] = array(0, 'threadlist_sortids_all');
$query = DB::query("SELECT typeid, name, special FROM ".DB::table('forum_threadtype')." WHERE special>'0' ORDER BY typeid DESC");
while($threadtype = DB::fetch($query)) {
$settings['sortids']['value'][] = array($threadtype['typeid'], $threadtype['name']);
}
}
return $settings;
}
function getdata($style, $parameter) {
global $_G;
$returndata = array('html' => '', 'data' => '');
$parameter = $this->cookparameter($parameter);
loadcache('forums', 'stamps');
$tids = !empty($parameter['tids']) ? explode(',', $parameter['tids']) : array();
$uids = !empty($parameter['uids']) ? explode(',', $parameter['uids']) : array();
$startrow = isset($parameter['startrow']) ? intval($parameter['startrow']) : 0;
$items = !empty($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('lastpost','dateline','replies','views','heats','recommends')) ? $parameter['orderby'] : 'lastpost') : 'lastpost';
$lastposter = !empty($parameter['lastposter']) ? $parameter['lastposter'] : '';
$lastpost = isset($parameter['lastpost']) ? intval($parameter['lastpost']) : 0;
$postdateline = isset($parameter['postdateline']) ? intval($parameter['postdateline']) : 0;
$titlelength = !empty($parameter['titlelength']) ? intval($parameter['titlelength']) : 40;
$summarylength = !empty($parameter['summarylength']) ? intval($parameter['summarylength']) : 80;
$recommend = !empty($parameter['recommend']) ? 1 : 0;
$reply = !empty($parameter['reply']);
$keyword = !empty($parameter['keyword']) ? $parameter['keyword'] : '';
$tagkeyword = !empty($parameter['tagkeyword']) ? $parameter['tagkeyword'] : '';
$typeids = !empty($parameter['typeids']) ? explode(',',$parameter['typeids']) : array();
$sortids = !empty($parameter['sortids']) && !in_array(0, (array)$parameter['sortids']) ? $parameter['sortids'] : array();
$special = !empty($parameter['special']) ? $parameter['special'] : array();
$rewardstatus = !empty($parameter['rewardstatus']) ? intval($parameter['rewardstatus']) : 0;
$picrequired = !empty($parameter['picrequired']) ? 1 : 0;
$viewmod = !empty($parameter['viewmod']) ? 1 : 0;
$highlight = !empty($parameter['highlight']) ? 1 : 0;
$fids = array();
if(!empty($parameter['fids'])) {
if(isset($parameter['fids'][0]) && $parameter['fids'][0] == '0') {
unset($parameter['fids'][0]);
}
$fids = $parameter['fids'];
}
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
require_once libfile('function/post');
require_once libfile('function/search');
require_once libfile('function/discuzcode');
$datalist = $list = $listtids = $pictids = $pics = $threadtids = $threadtypeids = $tagids = array();
$keyword = $keyword ? searchkey($keyword, "t.subject LIKE '%{text}%'") : '';
if($tagkeyword) {
if(!($tagids = DB::fetch_all('SELECT tagid FROM '.DB::table('common_tag').' WHERE 1'.searchkey($tagkeyword, "tagname LIKE '%{text}%'"), '', 'tagid'))) {
return array('data' => '');
}
}
$threadsorts = $threadtypes = array();
$querytmp = DB::query("SELECT typeid, name, special FROM ".DB::table('forum_threadtype')." WHERE special>'0'");
while($value = DB::fetch($querytmp)) {
$threadsorts[$value['typeid']] = $value;
}
$querytmp = DB::query("SELECT * FROM ".DB::table('forum_threadclass'));
foreach(C::t('forum_threadclass')->range() as $value) {
$threadtypes[$value['typeid']] = $value;
}
$sql = ($fids ? ' AND t.fid IN ('.dimplode($fids).')' : '')
.($tids ? ' AND t.tid IN ('.dimplode($tids).')' : '')
.($uids ? ' AND t.authorid IN ('.dimplode($uids).')' : '')
.($typeids ? ' AND t.typeid IN ('.dimplode($typeids).')' : '')
.($sortids ? ' AND t.sortid IN ('.dimplode($sortids).')' : '')
.($special ? ' AND t.special IN ('.dimplode($special).')' : '')
.((in_array(3, $special) && $rewardstatus) ? ($rewardstatus == 1 ? ' AND t.price < 0' : ' AND t.price > 0') : '')
.($digest ? ' AND t.digest IN ('.dimplode($digest).')' : '')
.($stick ? ' AND t.displayorder IN ('.dimplode($stick).')' : '')
.($bannedids ? ' AND t.tid NOT IN ('.dimplode($bannedids).')' : '')
.$keyword
." AND t.isgroup='0'";
if($postdateline) {
$time = TIMESTAMP - $postdateline;
$sql .= " AND t.dateline >= '$time'";
}
if($lastpost) {
$time = TIMESTAMP - $lastpost;
$sql .= " AND t.lastpost >= '$time'";
}
if($orderby == 'heats') {
$sql .= " AND t.heats>'0'";
}
$sqlfrom = $sqlfield = $joinmethodpic = '';
if($picrequired) {
$joinmethodpic = 'INNER';
} else if($style['getpic']) {
$joinmethodpic = 'LEFT';
}
if($joinmethodpic) {
$sqlfrom .= " $joinmethodpic JOIN `".DB::table('forum_threadimage')."` ti ON t.tid=ti.tid";
$sqlfield = ', ti.attachment as attachmenturl, ti.remote';
}
$joinmethod = empty($tids) ? 'INNER' : 'LEFT';
if($recommend) {
$sqlfrom .= " $joinmethod JOIN `".DB::table('forum_forumrecommend')."` fc ON fc.tid=t.tid";
}
if($reply) {
$sql .= " AND t.replies>'0'";
}
if($tagids) {
$sqlfrom .= " $joinmethod JOIN `".DB::table('common_tagitem')."` tim ON tim.tagid IN (".dimplode(array_keys($tagids)).") AND tim.itemid=t.tid AND tim.idtype='tid' ";
}
$maxwhere = '';
if(!$tids && !$fids && !$digest && !$stick && $_G['setting']['blockmaxaggregationitem']) {
$maxwhere = ($maxid = $this->getmaxid() - $_G['setting']['blockmaxaggregationitem']) > 0 ? 't.tid > '.$maxid.' AND ' : '';
}
$query = DB::query("SELECT DISTINCT t.*$sqlfield
FROM `".DB::table('forum_thread')."` t
$sqlfrom WHERE {$maxwhere}t.readperm='0'
$sql
AND t.displayorder>='0'
ORDER BY t.$orderby DESC
LIMIT $startrow,$items;"
);
while($data = DB::fetch($query)) {
$_G['block_thread'][$data['tid']] = $data;
if($style['getsummary']) {
$threadtids[$data['posttableid']][] = $data['tid'];
}
$listtids[$data['tid']] = $data['tid'];
$list[$data['tid']] = array(
'id' => $data['tid'],
'idtype' => 'tid',
'title' => cutstr(str_replace('\\\'', '&#39;', addslashes($data['subject'])), $titlelength, ''),
'url' => 'forum.php?mod=viewthread&tid='.$data['tid'].($viewmod ? '&from=portal' : ''),
'pic' => $data['attachmenturl'] ? 'forum/'.$data['attachmenturl'] : STATICURL.'image/common/nophoto.gif',
'picflag' => $data['attachmenturl'] ? ($data['remote'] ? '2' : '1') : '0',
'fields' => array(
'fulltitle' => str_replace('\\\'', '&#39;', addslashes($data['subject'])),
'threads' => $data['threads'],
'author' => $data['author'] ? $data['author'] : $_G['setting']['anonymoustext'],
'authorid' => $data['author'] ? $data['authorid'] : 0,
'avatar' => avatar(($data['author'] ? $data['authorid'] : 0), 'small', true, false, false, $_G['setting']['ucenterurl']),
'avatar_middle' => avatar(($data['author'] ? $data['authorid'] : 0), 'middle', true, false, false, $_G['setting']['ucenterurl']),
'avatar_big' => avatar(($data['author'] ? $data['authorid'] : 0), 'big', true, false, false, $_G['setting']['ucenterurl']),
'posts' => $data['posts'],
'todayposts' => $data['todayposts'],
'lastposter' => str_replace('\\\'', '&#39;', addslashes($data['lastposter'])),
'lastpost' => $data['lastpost'],
'dateline' => $data['dateline'],
'replies' => $data['replies'],
'forumurl' => 'forum.php?mod=forumdisplay&fid='.$data['fid'],
'forumname' => $_G['cache']['forums'][$data['fid']]['name'],
'typename' => discuzcode($threadtypes[$data['typeid']]['name'], 0, 0, 0, 1, 1, 0, 0, 0, 0, 0),
'typeicon' => $threadtypes[$data['typeid']]['icon'],
'typeurl' => 'forum.php?mod=forumdisplay&fid='.$data['fid'].'&filter=typeid&typeid='.$data['typeid'],
'sortname' => discuzcode($threadsorts[$data['sortid']]['name'], 0, 0, 0, 1, 1, 0, 0, 0, 0, 0),
'sorturl' => 'forum.php?mod=forumdisplay&fid='.$data['fid'].'&filter=sortid&sortid='.$data['sortid'],
'views' => $data['views'],
'heats' => $data['heats'],
'recommends' => $data['recommends'],
'hourviews' => $data['views'],
'todayviews' => $data['views'],
'weekviews' => $data['views'],
'monthviews' => $data['views']
)
);
if($highlight && $data['highlight']) {
$list[$data['tid']]['fields']['showstyle'] = $this->getthreadstyle($data['highlight']);
}
}
if($listtids) {
$threads = $this->getthread($threadtids, $summarylength);
if($threads) {
foreach($threads as $tid => $var) {
$list[$tid]['summary'] = $var;
}
}
foreach($listtids as $key => $value) {
$datalist[] = $list[$value];
}
}
$returndata['data'] = $datalist;
return $returndata;
}
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[$tid][] = $trade;
} elseif($thread['special'] == 3) {
$extcredits = $_G['settings']['extcredits'];
$creditstransextra = $_G['settings']['creditstransextra'];
$rewardend = $thread['price'] < 0;
$rewardprice = abs($thread['price']);
$message = threadmessagecutstr($thread, $var, $messagelength, '');
} elseif($thread['special'] == 4) {
$message = threadmessagecutstr($thread, $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 = threadmessagecutstr($thread, $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 = threadmessagecutstr($thread, $var, $messagelength, '');
}
include template('common/block_thread');
$returnarr[$tid] = $return;
}
}
return $returnarr;
}
function getpic($tid) {
global $_G;
if(!$tid) {
return '';
}
$pic = DB::fetch_first("SELECT attachment, remote FROM ".DB::table(getattachtablebytid($tid))." WHERE tid='$tid' AND isimage IN (1, -1) ORDER BY dateline DESC LIMIT 0,1");
return $pic;
}
function getpics($tids) {
$data = array();
$tids = !empty($tids) && is_array($tids) ? $tids : array($tids);
$tids = array_map('intval', $tids);
$tids = array_filter($tids);
if(!empty($tids)) {
$query = DB::query('SELECT * FROM '.DB::table('forum_threadimage').' WHERE tid IN ('.dimplode($tids).')');
while($value = DB::fetch($query)) {
$data[$value['tid']] = $value;
}
}
return $data;
}
function getthreadstyle($highlight) {
$rt = array();
if($highlight) {
$color = array('', '#EE1B2E', '#EE5023', '#996600', '#3C9D40', '#2897C5', '#2B65B7', '#8F2A90', '#EC1282');
$string = sprintf('%02d', $highlight);
$stylestr = sprintf('%03b', $string[0]);
$rt = array(
'title_b' => $stylestr[0] ? '1' : '',
'title_i' => $stylestr[1] ? '1' : '',
'title_u' => $stylestr[2] ? '1' : '',
'title_c' => $string[1] ? $color[$string[1]] : '',
);
}
return $rt;
}
function getmaxid() {
loadcache('databasemaxid');
$data = getglobal('cache/databasemaxid');
if(!is_array($data)) {
$data = array();
}
if(!isset($data['thread']) || TIMESTAMP - $data['thread']['dateline'] >= 86400) {
$data['thread']['dateline'] = TIMESTAMP;
$data['thread']['id'] = DB::result_first('SELECT MAX(tid) FROM '.DB::table('forum_thread'));
savecache('databasemaxid', $data);
}
return $data['thread']['id'];
}
}
?>

View File

@@ -0,0 +1,85 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_threaddigest.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_thread', 'class/block/forum');
class block_threaddigest extends block_thread {
function __construct() {
$this->setting = array(
'fids' => array(
'title' => 'threadlist_fids',
'type' => 'mselect',
'value' => array()
),
'digest' => array(
'title' => 'threadlist_digest',
'type' => 'mcheckbox',
'value' => array(
array(1, 'threadlist_digest_1'),
array(2, 'threadlist_digest_2'),
array(3, 'threadlist_digest_3'),
array(0, 'threadlist_digest_0')
),
),
'special' => array(
'title' => 'threadlist_special',
'type' => 'mcheckbox',
'value' => array(
array(1, 'threadlist_special_1'),
array(2, 'threadlist_special_2'),
array(3, 'threadlist_special_3'),
array(4, 'threadlist_special_4'),
array(5, 'threadlist_special_5'),
array(0, 'threadlist_special_0'),
),
'default' => array('0')
),
'viewmod' => array(
'title' => 'threadlist_viewmod',
'type' => 'radio'
),
'rewardstatus' => array(
'title' => 'threadlist_special_reward',
'type' => 'mradio',
'value' => array(
array(0, 'threadlist_special_reward_0'),
array(1, 'threadlist_special_reward_1'),
array(2, 'threadlist_special_reward_2')
),
'default' => 0,
),
'picrequired' => array(
'title' => 'threadlist_picrequired',
'type' => 'radio',
'value' => '0'
),
'titlelength' => array(
'title' => 'threadlist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'threadlist_summarylength',
'type' => 'text',
'default' => 80
),
);
}
function name() {
return lang('blockclass', 'blockclass_thread_script_threaddigest');
}
}
?>

View File

@@ -0,0 +1,112 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_threadhot.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_thread', 'class/block/forum');
class block_threadhot extends block_thread {
function __construct() {
$this->setting = array(
'fids' => array(
'title' => 'threadlist_fids',
'type' => 'mselect',
'value' => array()
),
'special' => array(
'title' => 'threadlist_special',
'type' => 'mcheckbox',
'value' => array(
array(1, 'threadlist_special_1'),
array(2, 'threadlist_special_2'),
array(3, 'threadlist_special_3'),
array(4, 'threadlist_special_4'),
array(5, 'threadlist_special_5'),
array(0, 'threadlist_special_0'),
),
'default' => array('0')
),
'viewmod' => array(
'title' => 'threadlist_viewmod',
'type' => 'radio'
),
'rewardstatus' => array(
'title' => 'threadlist_special_reward',
'type' => 'mradio',
'value' => array(
array(0, 'threadlist_special_reward_0'),
array(1, 'threadlist_special_reward_1'),
array(2, 'threadlist_special_reward_2')
),
'default' => 0,
),
'picrequired' => array(
'title' => 'threadlist_picrequired',
'type' => 'radio',
'value' => '0'
),
'orderby' => array(
'title' => 'threadlist_orderby',
'type'=> 'mradio',
'value' => array(
array('lastpost', 'threadlist_orderby_lastpost'),
array('dateline', 'threadlist_orderby_dateline'),
array('replies', 'threadlist_orderby_replies'),
array('views', 'threadlist_orderby_views'),
array('heats', 'threadlist_orderby_heats'),
array('recommends', 'threadlist_orderby_recommends'),
),
'default' => 'heats'
),
'postdateline' => array(
'title' => 'threadlist_postdateline',
'type'=> 'mradio',
'value' => array(
array('0', 'threadlist_postdateline_nolimit'),
array('3600', 'threadlist_postdateline_hour'),
array('86400', 'threadlist_postdateline_day'),
array('604800', 'threadlist_postdateline_week'),
array('2592000', 'threadlist_postdateline_month'),
),
'default' => '0'
),
'lastpost' => array(
'title' => 'threadlist_lastpost',
'type'=> 'mradio',
'value' => array(
array('0', 'threadlist_lastpost_nolimit'),
array('3600', 'threadlist_lastpost_hour'),
array('86400', 'threadlist_lastpost_day'),
array('604800', 'threadlist_lastpost_week'),
array('2592000', 'threadlist_lastpost_month'),
),
'default' => '0'
),
'titlelength' => array(
'title' => 'threadlist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'threadlist_summarylength',
'type' => 'text',
'default' => 80
),
);
}
function name() {
return lang('blockclass', 'blockclass_thread_script_threadhot');
}
}
?>

View File

@@ -0,0 +1,112 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_threadnew.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_thread', 'class/block/forum');
class block_threadnew extends block_thread {
function __construct() {
$this->setting = array(
'fids' => array(
'title' => 'threadlist_fids',
'type' => 'mselect',
'value' => array()
),
'special' => array(
'title' => 'threadlist_special',
'type' => 'mcheckbox',
'value' => array(
array(1, 'threadlist_special_1'),
array(2, 'threadlist_special_2'),
array(3, 'threadlist_special_3'),
array(4, 'threadlist_special_4'),
array(5, 'threadlist_special_5'),
array(0, 'threadlist_special_0'),
),
'default' => array('0')
),
'viewmod' => array(
'title' => 'threadlist_viewmod',
'type' => 'radio'
),
'rewardstatus' => array(
'title' => 'threadlist_special_reward',
'type' => 'mradio',
'value' => array(
array(0, 'threadlist_special_reward_0'),
array(1, 'threadlist_special_reward_1'),
array(2, 'threadlist_special_reward_2')
),
'default' => 0,
),
'picrequired' => array(
'title' => 'threadlist_picrequired',
'type' => 'radio',
'value' => '0'
),
'orderby' => array(
'title' => 'threadlist_orderby',
'type'=> 'mradio',
'value' => array(
array('lastpost', 'threadlist_orderby_lastpost'),
array('dateline', 'threadlist_orderby_dateline'),
),
'default' => 'lastpost'
),
'postdateline' => array(
'title' => 'threadlist_postdateline',
'type'=> 'mradio',
'value' => array(
array('0', 'threadlist_postdateline_nolimit'),
array('3600', 'threadlist_postdateline_hour'),
array('86400', 'threadlist_postdateline_day'),
array('604800', 'threadlist_postdateline_week'),
array('2592000', 'threadlist_postdateline_month'),
),
'default' => '0'
),
'lastpost' => array(
'title' => 'threadlist_lastpost',
'type'=> 'mradio',
'value' => array(
array('0', 'threadlist_lastpost_nolimit'),
array('3600', 'threadlist_lastpost_hour'),
array('86400', 'threadlist_lastpost_day'),
array('604800', 'threadlist_lastpost_week'),
array('2592000', 'threadlist_lastpost_month'),
),
'default' => '0'
),
'titlelength' => array(
'title' => 'threadlist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'threadlist_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'threadlist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_thread_script_threadnew');
}
}
?>

View File

@@ -0,0 +1,74 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_threadspecial.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_thread', 'class/block/forum');
class block_threadspecial extends block_thread {
function __construct() {
$this->setting = array(
'fids' => array(
'title' => 'threadlist_fids',
'type' => 'mselect',
'value' => array()
),
'special' => array(
'title' => 'threadlist_special',
'type' => 'mcheckbox',
'value' => array(
array(1, 'threadlist_special_1'),
array(2, 'threadlist_special_2'),
array(3, 'threadlist_special_3'),
array(4, 'threadlist_special_4'),
array(5, 'threadlist_special_5'),
),
'default' => array('1')
),
'viewmod' => array(
'title' => 'threadlist_viewmod',
'type' => 'radio'
),
'rewardstatus' => array(
'title' => 'threadlist_special_reward',
'type' => 'mradio',
'value' => array(
array(0, 'threadlist_special_reward_0'),
array(1, 'threadlist_special_reward_1'),
array(2, 'threadlist_special_reward_2')
),
'default' => 0,
),
'picrequired' => array(
'title' => 'threadlist_picrequired',
'type' => 'radio',
'value' => '0'
),
'titlelength' => array(
'title' => 'threadlist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'threadlist_summarylength',
'type' => 'text',
'default' => 80
),
);
}
function name() {
return lang('blockclass', 'blockclass_thread_script_threadspecial');
}
}
?>

View File

@@ -0,0 +1,90 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_threadspecified.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_thread', 'class/block/forum');
class block_threadspecified extends block_thread {
function __construct() {
$this->setting = array(
'tids' => array(
'title' => 'threadlist_tids',
'type' => 'text'
),
'uids' => array(
'title' => 'threadlist_uids',
'type' => 'text'
),
'keyword' => array(
'title' => 'threadlist_keyword',
'type' => 'text'
),
'fids' => array(
'title' => 'threadlist_fids',
'type' => 'mselect',
'value' => array()
),
'typeids' => array(
'title' => 'threadlist_typeids',
'type' => 'text'
),
'special' => array(
'title' => 'threadlist_special',
'type' => 'mcheckbox',
'value' => array(
array(1, 'threadlist_special_1'),
array(2, 'threadlist_special_2'),
array(3, 'threadlist_special_3'),
array(4, 'threadlist_special_4'),
array(5, 'threadlist_special_5'),
array(0, 'threadlist_special_0'),
),
'default' => array('0')
),
'viewmod' => array(
'title' => 'threadlist_viewmod',
'type' => 'radio'
),
'rewardstatus' => array(
'title' => 'threadlist_special_reward',
'type' => 'mradio',
'value' => array(
array(0, 'threadlist_special_reward_0'),
array(1, 'threadlist_special_reward_1'),
array(2, 'threadlist_special_reward_2')
),
'default' => 0,
),
'picrequired' => array(
'title' => 'threadlist_picrequired',
'type' => 'radio',
'value' => '0'
),
'titlelength' => array(
'title' => 'threadlist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'threadlist_summarylength',
'type' => 'text',
'default' => 80
),
);
}
function name() {
return lang('blockclass', 'blockclass_thread_script_threadspecified');
}
}
?>

View File

@@ -0,0 +1,84 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_threadstick.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_thread', 'class/block/forum');
class block_threadstick extends block_thread {
function __construct() {
$this->setting = array(
'fids' => array(
'title' => 'threadlist_fids',
'type' => 'mselect',
'value' => array()
),
'stick' => array(
'title' => 'threadlist_stick',
'type' => 'mcheckbox',
'value' => array(
array(1, 'threadlist_stick_1'),
array(2, 'threadlist_stick_2'),
array(3, 'threadlist_stick_3'),
array(0, 'threadlist_stick_0')
),
),
'special' => array(
'title' => 'threadlist_special',
'type' => 'mcheckbox',
'value' => array(
array(1, 'threadlist_special_1'),
array(2, 'threadlist_special_2'),
array(3, 'threadlist_special_3'),
array(4, 'threadlist_special_4'),
array(5, 'threadlist_special_5'),
array(0, 'threadlist_special_0'),
),
'default' => array('0')
),
'viewmod' => array(
'title' => 'threadlist_viewmod',
'type' => 'radio'
),
'rewardstatus' => array(
'title' => 'threadlist_special_reward',
'type' => 'mradio',
'value' => array(
array(0, 'threadlist_special_reward_0'),
array(1, 'threadlist_special_reward_1'),
array(2, 'threadlist_special_reward_2')
),
'default' => 0,
),
'picrequired' => array(
'title' => 'threadlist_picrequired',
'type' => 'radio',
'value' => '0'
),
'titlelength' => array(
'title' => 'threadlist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'threadlist_summarylength',
'type' => 'text',
'default' => 80
),
);
}
function name() {
return lang('blockclass', 'blockclass_thread_script_threadstick');
}
}
?>

View File

@@ -0,0 +1,273 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_trade.php 32768 2013-03-07 09:40:05Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class block_trade extends discuz_block {
var $setting = array();
function __construct(){
$this->setting = array(
'tids' => array(
'title' => 'tradelist_tids',
'type' => 'text'
),
'uids' => array(
'title' => 'tradelist_uids',
'type' => 'text'
),
'keyword' => array(
'title' => 'tradelist_keyword',
'type' => 'text'
),
'fids' => array(
'title' => 'tradelist_fids',
'type' => 'mselect',
'value' => array()
),
'viewmod' => array(
'title' => 'threadlist_viewmod',
'type' => 'radio'
),
'digest' => array(
'title' => 'tradelist_digest',
'type' => 'mcheckbox',
'value' => array(
array(1, 'tradelist_digest_1'),
array(2, 'tradelist_digest_2'),
array(3, 'tradelist_digest_3'),
array(0, 'tradelist_digest_0')
),
),
'stick' => array(
'title' => 'tradelist_stick',
'type' => 'mcheckbox',
'value' => array(
array(1, 'tradelist_stick_1'),
array(2, 'tradelist_stick_2'),
array(3, 'tradelist_stick_3'),
array(0, 'tradelist_stick_0')
),
),
'recommend' => array(
'title' => 'tradelist_recommend',
'type' => 'radio'
),
'orderby' => array(
'title' => 'tradelist_orderby',
'type'=> 'mradio',
'value' => array(
array('dateline', 'tradelist_orderby_dateline'),
array('todayhots', 'tradelist_orderby_todayhots'),
array('weekhots', 'tradelist_orderby_weekhots'),
array('monthhots', 'tradelist_orderby_monthhots'),
),
'default' => 'dateline'
),
'highlight' => array(
'title' => 'tradelist_highlight',
'type' => 'radio',
'default' => 0,
),
'titlelength' => array(
'title' => 'tradelist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'tradelist_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'tradelist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_trade_script_trade');
}
function blockclass() {
return array('trade', lang('blockclass', 'blockclass_trade_trade'));
}
function fields() {
return array(
'id' => array('name' => lang('blockclass', 'blockclass_field_id'), 'formtype' => 'text', 'datatype' => 'int'),
'url' => array('name' => lang('blockclass', 'blockclass_trade_field_url'), 'formtype' => 'text', 'datatype' => 'string'),
'title' => array('name' => lang('blockclass', 'blockclass_trade_field_title'), 'formtype' => 'title', 'datatype' => 'title'),
'pic' => array('name' => lang('blockclass', 'blockclass_trade_field_pic'), 'formtype' => 'pic', 'datatype' => 'pic'),
'summary' => array('name' => lang('blockclass', 'blockclass_trade_field_summary'), 'formtype' => 'summary', 'datatype' => 'summary'),
'totalitems' => array('name' => lang('blockclass', 'blockclass_trade_field_totalitems'), 'formtype' => 'text', 'datatype' => 'int'),
'author' => array('name' => lang('blockclass', 'blockclass_trade_field_author'), 'formtype' => 'text', 'datatype' => 'text'),
'authorid' => array('name' => lang('blockclass', 'blockclass_trade_field_authorid'), 'formtype' => 'text', 'datatype' => 'int'),
'price' => array('name' => lang('blockclass', 'blockclass_trade_field_price'), 'formtype' => 'text', 'datatype' => 'text'),
);
}
function fieldsconvert() {
return array(
'group_trade' => array(
'name' => lang('blockclass', 'blockclass_group_trade'),
'script' => 'grouptrade',
'searchkeys' => array(),
'replacekeys' => array(),
),
);
}
function getsetting() {
global $_G;
$settings = $this->setting;
if($settings['fids']) {
loadcache('forums');
$settings['fids']['value'][] = array(0, lang('portalcp', 'block_all_forum'));
foreach($_G['cache']['forums'] as $fid => $forum) {
$settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')).$forum['name']);
}
}
return $settings;
}
function getdata($style, $parameter) {
global $_G;
$parameter = $this->cookparameter($parameter);
loadcache('forums');
$tids = !empty($parameter['tids']) ? explode(',', $parameter['tids']) : 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'] : '';
$viewmod = !empty($parameter['viewmod']) ? 1 : 0;
$highlight = !empty($parameter['highlight']) ? 1 : 0;
$fids = array();
if(!empty($parameter['fids'])) {
if($parameter['fids'][0] == '0') {
unset($parameter['fids'][0]);
}
$fids = $parameter['fids'];
}
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
require_once libfile('function/post');
require_once libfile('function/search');
$datalist = $list = $listpids = $threadpids = $aid2pid = $attachtables = array();
$keyword = $keyword ? searchkey($keyword, "t.subject LIKE '%{text}%'") : '';
$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='0'";
$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'";
$joinmethod = empty($tids) ? 'INNER' : 'LEFT';
if($recommend) {
$sqlfrom .= " $joinmethod JOIN `".DB::table('forum_forumrecommend')."` fc ON fc.tid=tr.tid";
}
$sqlfield = $highlight ? ', t.highlight' : '';
$query = DB::query("SELECT tr.pid, tr.tid, tr.aid, tr.price, tr.credit, tr.subject, tr.totalitems, tr.seller, tr.sellerid, t.posttableid$sqlfield
FROM ".DB::table('forum_trade')." tr $sqlfrom $where
ORDER BY tr.$orderby DESC
LIMIT $startrow,$items;"
);
require_once libfile('block_thread', 'class/block/forum');
$bt = new block_thread();
while($data = DB::fetch($query)) {
if($style['getsummary']) {
$threadpids[$data['posttableid']][] = $data['pid'];
}
if($data['aid']) {
$aid2pid[$data['aid']] = $data['pid'];
$attachtable = getattachtableid($data['tid']);
$attachtables[$attachtable][] = $data['aid'];
}
$listpids[] = $data['pid'];
$list[$data['pid']] = array(
'id' => $data['pid'],
'idtype' => 'pid',
'title' => cutstr(str_replace('\\\'', '&#39;', addslashes($data['subject'])), $titlelength, ''),
'url' => 'forum.php?mod=viewthread&do=tradeinfo&tid='.$data['tid'].'&pid='.$data['pid'].($viewmod ? '&from=portal' : ''),
'pic' => ($data['aid'] ? '' : $_G['style']['imgdir'].'/nophoto.gif'),
'picflag' => '0',
'fields' => array(
'fulltitle' => str_replace('\\\'', '&#39;', addslashes($data['subject'])),
'totalitems' => $data['totalitems'],
'author' => $data['seller'] ? $data['seller'] : $_G['setting']['anonymoustext'],
'authorid' => $data['sellerid'] ? $data['sellerid'] : 0,
'price' => ($data['price'] > 0 ? '&yen; '.$data['price'] : '').($data['credit'] > 0 ? ($data['price'] > 0 ? lang('block/tradelist', 'tradelist_price_add') : '').$data['credit'].' '.$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][5]]['unit'].$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][5]]['title'] : ''),
)
);
if($highlight && $data['highlight']) {
$list[$data['tid']]['fields']['showstyle'] = $bt->getthreadstyle($data['highlight']);
}
}
if(!empty($listpids)) {
foreach($threadpids as $key => $var) {
$posttable = $key == 0 ? 'forum_post' : 'forum_post_'.$key;
$query = DB::query("SELECT pid, message FROM ".DB::table($posttable)." WHERE pid IN (".dimplode($var).")");
while($result = DB::fetch($query)) {
$list[$result['pid']]['summary'] = messagecutstr($result['message'], $summarylength, '');
}
}
foreach($attachtables as $tableid => $taids) {
$query = DB::query('SELECT aid, attachment, remote FROM '.DB::table('forum_attachment_'.$tableid).' WHERE aid IN ('.dimplode($taids).')');
while($avalue = DB::fetch($query)) {
$list[$aid2pid[$avalue['aid']]]['pic'] = 'forum/'.$avalue['attachment'];
$list[$aid2pid[$avalue['aid']]]['picflag'] = $avalue['remote'] ? '2' : '1';
}
}
foreach($listpids as $key => $value) {
$datalist[] = $list[$value];
}
}
return array('html' => '', 'data' => $datalist);
}
}
?>

View File

@@ -0,0 +1,61 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_tradehot.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_trade', 'class/block/forum');
class block_tradehot extends block_trade {
function __construct() {
$this->setting = array(
'fids' => array(
'title' => 'tradelist_fids',
'type' => 'mselect',
'value' => array()
),
'viewmod' => array(
'title' => 'threadlist_viewmod',
'type' => 'radio'
),
'orderby' => array(
'title' => 'tradelist_orderby',
'type'=> 'mradio',
'value' => array(
array('todayhots', 'tradelist_orderby_todayhots'),
array('weekhots', 'tradelist_orderby_weekhots'),
array('monthhots', 'tradelist_orderby_monthhots'),
),
'default' => 'weekhots'
),
'titlelength' => array(
'title' => 'tradelist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'tradelist_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'tradelist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_trade_script_tradehot');
}
}
?>

View File

@@ -0,0 +1,56 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_tradenew.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_trade', 'class/block/forum');
class block_tradenew extends block_trade {
function __construct() {
$this->setting = array(
'fids' => array(
'title' => 'tradelist_fids',
'type' => 'mselect',
'value' => array()
),
'viewmod' => array(
'title' => 'threadlist_viewmod',
'type' => 'radio'
),
'titlelength' => array(
'title' => 'tradelist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'tradelist_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'tradelist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_trade_script_tradenew');
}
function cookparameter($parameter) {
$parameter['orderby'] = 'dateline';
return parent::cookparameter($parameter);
}
}
?>

View File

@@ -0,0 +1,58 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_tradespecified.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_trade', 'class/block/forum');
class block_tradespecified extends block_trade {
function __construct() {
$this->setting = array(
'tids' => array(
'title' => 'tradelist_tids',
'type' => 'text'
),
'viewmod' => array(
'title' => 'threadlist_viewmod',
'type' => 'radio'
),
'uids' => array(
'title' => 'tradelist_uids',
'type' => 'text'
),
'keyword' => array(
'title' => 'tradelist_keyword',
'type' => 'text'
),
'fids' => array(
'title' => 'tradelist_fids',
'type' => 'mselect',
'value' => array()
),
'titlelength' => array(
'title' => 'tradelist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'tradelist_summarylength',
'type' => 'text',
'default' => 80
),
);
}
function name() {
return lang('blockclass', 'blockclass_trade_script_tradespecified');
}
}
?>

View File

@@ -0,0 +1,19 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: blockclass.php 27449 2012-02-01 05:32:35Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$blockclass = array(
'name' => lang('blockclass', 'blockclass_forum'),
);
?>

View File