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,80 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_article.php 13141 2010-07-22 00:56:42Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_article {
var $version = '1.0';
var $name = 'article_name';
var $description = 'article_desc';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $targets = array('portal');
var $imagesizes = array('250x60', '250x250', '250x300', '658x40', '658x60');
var $categoryvalue = array();
function getsetting() {
global $_G;
$settings = array(
'position' => array(
'title' => 'article_position',
'type' => 'mradio',
'value' => array(
array(1, 'article_position_float'),
array(2, 'article_position_up'),
array(3, 'article_position_down'),
),
'default' => 1,
),
'category' => array(
'title' => 'article_category',
'type' => 'mselect',
'value' => array(),
),
);
loadcache('portalcategory');
$this->getcategory(0);
$settings['category']['value'] = $this->categoryvalue;
return $settings;
}
function getcategory($upid) {
global $_G;
foreach($_G['cache']['portalcategory'] as $category) {
if($category['upid'] == $upid) {
$this->categoryvalue[] = array($category['catid'], str_repeat('&nbsp;', $category['level'] * 4).$category['catname']);
$this->getcategory($category['catid']);
}
}
}
function setsetting(&$advnew, &$parameters) {
global $_G;
if(is_array($advnew['targets'])) {
$advnew['targets'] = implode("\t", $advnew['targets']);
}
if(is_array($parameters['extra']['category']) && in_array(0, $parameters['extra']['category'])) {
$parameters['extra']['category'] = array();
}
}
function evalcode() {
return array(
'check' => '
$checked = $params[2] == $parameter[\'position\'] && (!$parameter[\'category\'] || $parameter[\'category\'] && in_array($_G[\'catid\'], $parameter[\'category\']));
',
'create' => '$adcode = $codes[$adids[array_rand($adids)]];',
);
}
}
?>

View File

@@ -0,0 +1,79 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_articlelist.php 13141 2010-07-22 00:56:42Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_articlelist {
var $version = '1.0';
var $name = 'articlelist_name';
var $description = 'articlelist_desc';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $targets = array('portal');
var $imagesizes = array('658x40', '658x60');
function getsetting() {
$settings = array(
'position' => array(
'title' => 'articlelist_position',
'type' => 'mradio',
'value' => array(
array(1, 'articlelist_position_up1'),
array(2, 'articlelist_position_up2'),
array(3, 'articlelist_position_down1'),
array(4, 'articlelist_position_down2'),
),
'default' => 1,
),
'category' => array(
'title' => 'articlelist_category',
'type' => 'mselect',
'value' => array(),
),
);
loadcache('portalcategory');
$this->getcategory(0);
$settings['category']['value'] = $this->categoryvalue;
return $settings;
}
function getcategory($upid) {
global $_G;
foreach($_G['cache']['portalcategory'] as $category) {
if($category['upid'] == $upid) {
$this->categoryvalue[] = array($category['catid'], str_repeat('&nbsp;', $category['level'] * 4).$category['catname']);
$this->getcategory($category['catid']);
}
}
}
function setsetting(&$advnew, &$parameters) {
global $_G;
if(is_array($advnew['targets'])) {
$advnew['targets'] = implode("\t", $advnew['targets']);
}
if(is_array($parameters['extra']['category']) && in_array(0, $parameters['extra']['category'])) {
$parameters['extra']['category'] = array();
}
}
function evalcode() {
return array(
'check' => '
$checked = $params[2] == $parameter[\'position\'] && (!$parameter[\'category\'] || $parameter[\'category\'] && in_array($_G[\'catid\'], $parameter[\'category\']));
',
'create' => '$adcode = $codes[$adids[array_rand($adids)]];',
);
}
}
?>

View File

@@ -0,0 +1,41 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_blog.php 7169 2010-03-30 06:34:18Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_blog {
var $version = '1.0';
var $name = 'blog_name';
var $description = 'blog_desc';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $targets = array('home');
var $imagesizes = array('120x60', '120x240');
function getsetting() {
}
function setsetting(&$advnew, &$parameters) {
global $_G;
if(is_array($advnew['targets'])) {
$advnew['targets'] = implode("\t", $advnew['targets']);
}
}
function evalcode() {
return array(
'create' => '$adcode = $codes[$adids[array_rand($adids)]];',
);
}
}
?>

View File

@@ -0,0 +1,129 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_cornerbanner.php 26692 2011-12-20 05:27:38Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_cornerbanner {
var $version = '1.1';
var $name = 'cornerbanner_name';
var $description = 'cornerbanner_desc';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $targets = array('portal', 'home', 'member', 'forum', 'group', 'plugin', 'custom');
var $imagesizes = array('300x250', '290x200', '250x180');
function getsetting() {
global $_G;
$settings = array(
'fids' => array(
'title' => 'cornerbanner_fids',
'type' => 'mselect',
'value' => array(),
),
'groups' => array(
'title' => 'cornerbanner_groups',
'type' => 'mselect',
'value' => array(),
),
'category' => array(
'title' => 'cornerbanner_category',
'type' => 'mselect',
'value' => array(),
),
'disableclose' => array(
'title' => 'cornerbanner_disableclose',
'type' => 'mradio',
'value' => array(
array(0, 'cornerbanner_show'),
array(1, 'cornerbanner_hidden'),
),
'default' => 0,
),
'animator' => array(
'title' => 'cornerbanner_animator',
'type' => 'radio',
'default' => 0,
),
);
loadcache(array('forums', 'grouptype'));
$settings['fids']['value'][] = $settings['groups']['value'][] = array(0, '&nbsp;');
$settings['fids']['value'][] = $settings['groups']['value'][] = array(-1, 'cornerbanner_index');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
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']);
}
foreach($_G['cache']['grouptype']['first'] as $gid => $group) {
$settings['groups']['value'][] = array($gid, str_repeat('&nbsp;', 4).$group['name']);
if($group['secondlist']) {
foreach($group['secondlist'] as $sgid) {
$settings['groups']['value'][] = array($sgid, str_repeat('&nbsp;', 8).$_G['cache']['grouptype']['second'][$sgid]['name']);
}
}
}
loadcache('portalcategory');
$this->categoryvalue[] = array(-1, 'cornerbanner_index');
$this->getcategory(0);
$settings['category']['value'] = $this->categoryvalue;
return $settings;
}
function getcategory($upid) {
global $_G;
foreach($_G['cache']['portalcategory'] as $category) {
if($category['upid'] == $upid) {
$this->categoryvalue[] = array($category['catid'], str_repeat('&nbsp;', $category['level'] * 4).$category['catname']);
$this->getcategory($category['catid']);
}
}
}
function setsetting(&$advnew, &$parameters) {
global $_G;
if(is_array($advnew['targets'])) {
$advnew['targets'] = implode("\t", $advnew['targets']);
}
if(is_array($parameters['extra']['fids']) && in_array(0, $parameters['extra']['fids'])) {
$parameters['extra']['fids'] = array();
}
if(is_array($parameters['extra']['groups']) && in_array(0, $parameters['extra']['groups'])) {
$parameters['extra']['groups'] = array();
}
if(is_array($parameters['extra']['category']) && in_array(0, $parameters['extra']['category'])) {
$parameters['extra']['category'] = array();
}
$parameters['extra']['animator'] = $parameters['animator'];
}
function evalcode($adv) {
return array(
'check' => '
if($_G[\'basescript\'] == \'forum\' && $parameter[\'fids\'] && !(in_array($_G[\'fid\'], $parameter[\'fids\']) || CURMODULE == \'index\' && in_array(-1, $parameter[\'fids\']) || defined(\'IN_ARCHIVER\') && in_array(-2, $parameter[\'fids\']))
|| $_G[\'basescript\'] == \'group\' && $parameter[\'groups\'] && !(in_array($_G[\'grouptypeid\'], $parameter[\'groups\']) || CURMODULE == \'index\' && in_array(-1, $parameter[\'groups\']))
|| $_G[\'basescript\'] == \'portal\' && $parameter[\'category\'] && !(!empty($_G[\'catid\']) && in_array($_G[\'catid\'], $parameter[\'category\']) || empty($_G[\'catid\']) && in_array(-1, $parameter[\'category\']))
) {
$checked = false;
}',
'create' => '
if(empty($parameter[\'disableclose\'])) {
$adid = $adids[array_rand($adids)];
$aniscript = $parameter[\'animator\'] ? \'<script type="text/javascript">_attachEvent(window, \\\'load\\\', function () {var ad_corner_obj = $(\\\'ad_corner_close\\\').parentNode,ad_corner_height = ad_corner_obj.clientHeight,ad_corner_hi=0,ad_corner_si=setInterval(function () { ad_corner_obj.style.visibility=\\\'visible\\\';ad_corner_obj.style.overflow=\\\'hidden\\\';ad_corner_obj.style.height=ad_corner_hi+\\\'px\\\';ad_corner_hi+=10;if(ad_corner_height<ad_corner_hi) {ad_corner_obj.style.overflow=\\\'visible\\\';clearInterval(ad_corner_si);}}, 1);}, document);</script>\' : \'\';
$adcode = empty($_G[\'cookie\'][\'adclose_\'.$adid]) ? \'<p class="close" id="ad_corner_close" onclick="setcookie(\\\'adclose_\'.$adid.\'\\\', 1, 86400);this.parentNode.style.display=\\\'none\\\'"><a href="javascript:;"><img src="\'.STATICURL.\'image/common/ad_close.gif" /></a></p>\'.$codes[$adid].$aniscript : \'\';
$extra = \'style="\'.($parameter[\'animator\'] ? \';visibility:hidden\': \'\').\'"\';
} else {
$adcode = $codes[$adids[array_rand($adids)]];
}
',
);
}
}
?>

View File

@@ -0,0 +1,140 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_couplebanner.php 26692 2011-12-20 05:27:38Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_couplebanner {
var $version = '1.1';
var $name = 'couplebanner_name';
var $description = 'couplebanner_desc';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $targets = array('portal', 'home', 'member', 'forum', 'group', 'search', 'plugin', 'custom');
var $imagesizes = array('60x120', '60x250', '60x468');
function getsetting() {
global $_G;
$settings = array(
'fids' => array(
'title' => 'couplebanner_fids',
'type' => 'mselect',
'value' => array(),
),
'groups' => array(
'title' => 'couplebanner_groups',
'type' => 'mselect',
'value' => array(),
),
'category' => array(
'title' => 'couplebanner_category',
'type' => 'mselect',
'value' => array(),
),
'position' => array(
'title' => 'couplebanner_position',
'type' => 'mradio',
'value' => array(
array(1, 'couplebanner_position_left'),
array(2, 'couplebanner_position_right'),
),
'default' => 1,
),
'coupleadid' => array(
'title' => 'couplebanner_coupleadid',
'type' => 'select',
'value' => array(),
),
'disableclose' => array(
'title' => 'couplebanner_disableclose',
'type' => 'mradio',
'value' => array(
array(0, 'couplebanner_show'),
array(1, 'couplebanner_hidden'),
),
'default' => 0,
)
);
loadcache(array('forums', 'grouptype'));
$settings['fids']['value'][] = $settings['groups']['value'][] = array(0, '&nbsp;');
$settings['fids']['value'][] = $settings['groups']['value'][] = array(-1, 'couplebanner_index');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
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']);
}
foreach($_G['cache']['grouptype']['first'] as $gid => $group) {
$settings['groups']['value'][] = array($gid, str_repeat('&nbsp;', 4).$group['name']);
if($group['secondlist']) {
foreach($group['secondlist'] as $sgid) {
$settings['groups']['value'][] = array($sgid, str_repeat('&nbsp;', 8).$_G['cache']['grouptype']['second'][$sgid]['name']);
}
}
}
foreach(C::t('common_advertisement')->fetch_all_by_type('couplebanner') as $couple) {
$settings['coupleadid']['value'][] = array($couple['advid'], $couple['title']);
}
loadcache('portalcategory');
$this->categoryvalue[] = array(-1, 'couplebanner_index');
$this->getcategory(0);
$settings['category']['value'] = $this->categoryvalue;
return $settings;
}
function getcategory($upid) {
global $_G;
foreach($_G['cache']['portalcategory'] as $category) {
if($category['upid'] == $upid) {
$this->categoryvalue[] = array($category['catid'], str_repeat('&nbsp;', $category['level'] * 4).$category['catname']);
$this->getcategory($category['catid']);
}
}
}
function setsetting(&$advnew, &$parameters) {
global $_G;
if(is_array($advnew['targets'])) {
$advnew['targets'] = implode("\t", $advnew['targets']);
}
if(is_array($parameters['extra']['fids']) && in_array(0, $parameters['extra']['fids'])) {
$parameters['extra']['fids'] = array();
}
if(is_array($parameters['extra']['groups']) && in_array(0, $parameters['extra']['groups'])) {
$parameters['extra']['groups'] = array();
}
if(is_array($parameters['extra']['category']) && in_array(0, $parameters['extra']['category'])) {
$parameters['extra']['category'] = array();
}
}
function evalcode() {
return array(
'check' => '
if($params[2] != $parameter[\'position\']
|| $_G[\'basescript\'] == \'forum\' && $parameter[\'fids\'] && !(in_array($_G[\'fid\'], $parameter[\'fids\']) || CURMODULE == \'index\' && in_array(-1, $parameter[\'fids\']))
|| $_G[\'basescript\'] == \'group\' && $parameter[\'groups\'] && !(in_array($_G[\'grouptypeid\'], $parameter[\'groups\']) || CURMODULE == \'index\' && in_array(-1, $parameter[\'groups\']))
|| $_G[\'basescript\'] == \'portal\' && $parameter[\'category\'] && !(!empty($_G[\'catid\']) && in_array($_G[\'catid\'], $parameter[\'category\']) || empty($_G[\'catid\']) && in_array(-1, $parameter[\'category\']))
) {
$checked = false;
}',
'create' => '
if(empty($_G[\'couplebrother\'])) {
$coupleadid = $adids[array_rand($adids)];
$_G[\'couplebrother\'] = $parameters[$coupleadid][\'coupleadid\'];
} else {
$coupleadid = $_G[\'couplebrother\'];
}
$adcode = empty($parameter[\'disableclose\']) ? (empty($_G[\'cookie\'][\'adclose_\'.$coupleadid]) ? $codes[$coupleadid].\'<br /><a href="javascript:;" onclick="setcookie(\\\'adclose_\'.$coupleadid.\'\\\', 1, 86400);this.parentNode.style.display=\\\'none\\\'"><img src="\'.STATICURL.\'image/common/ad_close.gif" /></a>\' : \'\') : $codes[$coupleadid];
',
);
}
}
?>

View File

@@ -0,0 +1,50 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_custom.php 29605 2012-04-23 02:27:52Z liulanbo $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_custom {
var $version = '1.0';
var $name = 'custom_name';
var $description = 'custom_desc';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $targets = array('portal', 'home', 'member', 'forum', 'group', 'plugin', 'api', 'search', 'misc');
var $imagesizes = array('60x120', '60x250', '60x468', '120x60', '120x240', '120x60', '250x60', '100x100', '468x40', '468x60', '658x60', '728x90', '760x90', '950x90', '950x130');
var $customname = '';
function getsetting() {
global $_G;
$custom = C::t('common_advertisement_custom')->fetch($_GET['customid']);
if(!$custom) {
echo '<br >';cpmsg(lang('adv/custom', 'custom_id_notfound'));
}
$this->customname = $custom['name'];
}
function setsetting(&$advnew, &$parameters) {
global $_G;
$advnew['targets'] = implode("\t", $this->targets);
}
function evalcode($adv) {
return array(
'check' => '
if($customid != $parameter[\'customid\']) {
$checked = false;
}',
'create' => '$adcode = $codes[$adids[array_rand($adids)]];',
);
}
}
?>

View File

@@ -0,0 +1,41 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_feed.php 7169 2010-03-30 06:34:18Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_feed {
var $version = '1.0';
var $name = 'feed_name';
var $description = 'feed_desc';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $targets = array('home');
var $imagesizes = array('468x40', '468x60', '658x60');
function getsetting() {
}
function setsetting(&$advnew, &$parameters) {
global $_G;
if(is_array($advnew['targets'])) {
$advnew['targets'] = implode("\t", $advnew['targets']);
}
}
function evalcode() {
return array(
'create' => '$adcode = $codes[$adids[array_rand($adids)]];',
);
}
}
?>

View File

@@ -0,0 +1,126 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_float.php 26692 2011-12-20 05:27:38Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_float {
var $version = '1.1';
var $name = 'float_name';
var $description = 'float_desc';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $targets = array('portal', 'home', 'member', 'forum', 'group', 'search', 'plugin', 'custom');
var $imagesizes = array('60x120', '60x250', '60x468');
function getsetting() {
global $_G;
$settings = array(
'fids' => array(
'title' => 'float_fids',
'type' => 'mselect',
'value' => array(),
),
'groups' => array(
'title' => 'float_groups',
'type' => 'mselect',
'value' => array(),
),
'category' => array(
'title' => 'float_category',
'type' => 'mselect',
'value' => array(),
),
'position' => array(
'title' => 'float_position',
'type' => 'mradio',
'value' => array(
array(1, 'float_position_left'),
array(2, 'float_position_right'),
),
'default' => 1,
),
'disableclose' => array(
'title' => 'float_disableclose',
'type' => 'mradio',
'value' => array(
array(0, 'float_show'),
array(1, 'float_hidden'),
),
'default' => 0,
)
);
loadcache(array('forums', 'grouptype'));
$settings['fids']['value'][] = $settings['groups']['value'][] = array(0, '&nbsp;');
$settings['fids']['value'][] = $settings['groups']['value'][] = array(-1, 'float_index');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
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']);
}
foreach($_G['cache']['grouptype']['first'] as $gid => $group) {
$settings['groups']['value'][] = array($gid, str_repeat('&nbsp;', 4).$group['name']);
if($group['secondlist']) {
foreach($group['secondlist'] as $sgid) {
$settings['groups']['value'][] = array($sgid, str_repeat('&nbsp;', 8).$_G['cache']['grouptype']['second'][$sgid]['name']);
}
}
}
loadcache('portalcategory');
$this->categoryvalue[] = array(-1, 'float_index');
$this->getcategory(0);
$settings['category']['value'] = $this->categoryvalue;
return $settings;
}
function getcategory($upid) {
global $_G;
foreach($_G['cache']['portalcategory'] as $category) {
if($category['upid'] == $upid) {
$this->categoryvalue[] = array($category['catid'], str_repeat('&nbsp;', $category['level'] * 4).$category['catname']);
$this->getcategory($category['catid']);
}
}
}
function setsetting(&$advnew, &$parameters) {
global $_G;
if(is_array($advnew['targets'])) {
$advnew['targets'] = implode("\t", $advnew['targets']);
}
if(is_array($parameters['extra']['fids']) && in_array(0, $parameters['extra']['fids'])) {
$parameters['extra']['fids'] = array();
}
if(is_array($parameters['extra']['groups']) && in_array(0, $parameters['extra']['groups'])) {
$parameters['extra']['groups'] = array();
}
if(is_array($parameters['extra']['category']) && in_array(0, $parameters['extra']['category'])) {
$parameters['extra']['category'] = array();
}
}
function evalcode() {
return array(
'check' => '
if($params[2] != $parameter[\'position\']
|| $_G[\'basescript\'] == \'forum\' && $parameter[\'fids\'] && !(in_array($_G[\'fid\'], $parameter[\'fids\']) || CURMODULE == \'index\' && in_array(-1, $parameter[\'fids\']))
|| $_G[\'basescript\'] == \'group\' && $parameter[\'groups\'] && !(in_array($_G[\'grouptypeid\'], $parameter[\'groups\']) || CURMODULE == \'index\' && in_array(-1, $parameter[\'groups\']))
|| $_G[\'basescript\'] == \'portal\' && $parameter[\'category\'] && !(!empty($_G[\'catid\']) && in_array($_G[\'catid\'], $parameter[\'category\']) || empty($_G[\'catid\']) && in_array(-1, $parameter[\'category\']))
) {
$checked = false;
}',
'create' => '
$adcode = empty($parameter[\'disableclose\']) ? (empty($_G[\'cookie\'][\'adclose_\'.$coupleadid]) ? $codes[$adids[array_rand($adids)]].\'<br /><a href="javascript:;" onclick="setcookie(\\\'adclose_\'.$coupleadid.\'\\\', 1, 86400);this.parentNode.style.display=\\\'none\\\'"><img src="\'.STATICURL.\'image/common/ad_close.gif" /></a>\' : \'\') : $codes[$adids[array_rand($adids)]];
'
);
}
}
?>

View File

@@ -0,0 +1,117 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_footerbanner.php 22514 2011-05-10 11:11:11Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_footerbanner {
var $version = '1.0';
var $name = 'footerbanner_name';
var $description = 'footerbanner_desc';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $targets = array('portal', 'home', 'member', 'forum', 'group', 'search', 'plugin', 'custom');
var $imagesizes = array('468x60', '658x60', '728x90', '760x90', '950x90', '950x130');
function getsetting() {
global $_G;
$settings = array(
'fids' => array(
'title' => 'footerbanner_fids',
'type' => 'mselect',
'value' => array(),
),
'groups' => array(
'title' => 'footerbanner_groups',
'type' => 'mselect',
'value' => array(),
),
'category' => array(
'title' => 'footerbanner_category',
'type' => 'mselect',
'value' => array(),
),
'position' => array(
'title' => 'footerbanner_position',
'type' => 'mradio',
'value' => array(
array(1, 'footerbanner_position_up'),
array(2, 'footerbanner_position_middle'),
array(3, 'footerbanner_position_down'),
),
'default' => 1,
),
);
loadcache(array('forums', 'grouptype'));
$settings['fids']['value'][] = $settings['groups']['value'][] = array(0, '&nbsp;');
$settings['fids']['value'][] = $settings['groups']['value'][] = array(-1, 'footerbanner_index');
$settings['fids']['value'][] = array(-2, 'Archiver');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
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']);
}
foreach($_G['cache']['grouptype']['first'] as $gid => $group) {
$settings['groups']['value'][] = array($gid, str_repeat('&nbsp;', 4).$group['name']);
if($group['secondlist']) {
foreach($group['secondlist'] as $sgid) {
$settings['groups']['value'][] = array($sgid, str_repeat('&nbsp;', 8).$_G['cache']['grouptype']['second'][$sgid]['name']);
}
}
}
loadcache('portalcategory');
$this->categoryvalue[] = array(-1, 'footerbanner_index');
$this->getcategory(0);
$settings['category']['value'] = $this->categoryvalue;
return $settings;
}
function getcategory($upid) {
global $_G;
foreach($_G['cache']['portalcategory'] as $category) {
if($category['upid'] == $upid) {
$this->categoryvalue[] = array($category['catid'], str_repeat('&nbsp;', $category['level'] * 4).$category['catname']);
$this->getcategory($category['catid']);
}
}
}
function setsetting(&$advnew, &$parameters) {
global $_G;
if(is_array($advnew['targets'])) {
$advnew['targets'] = implode("\t", $advnew['targets']);
}
if(is_array($parameters['extra']['fids']) && in_array(0, $parameters['extra']['fids'])) {
$parameters['extra']['fids'] = array();
}
if(is_array($parameters['extra']['groups']) && in_array(0, $parameters['extra']['groups'])) {
$parameters['extra']['groups'] = array();
}
if(is_array($parameters['extra']['category']) && in_array(0, $parameters['extra']['category'])) {
$parameters['extra']['category'] = array();
}
}
function evalcode() {
return array(
'check' => '
if($params[2] != $parameter[\'position\']
|| $_G[\'basescript\'] == \'forum\' && $parameter[\'fids\'] && !(!defined(\'IN_ARCHIVER\') && (in_array($_G[\'fid\'], $parameter[\'fids\']) || CURMODULE == \'index\' && in_array(-1, $parameter[\'fids\'])) || defined(\'IN_ARCHIVER\') && in_array(-2, $parameter[\'fids\']))
|| $_G[\'basescript\'] == \'group\' && $parameter[\'groups\'] && !(in_array($_G[\'grouptypeid\'], $parameter[\'groups\']) || CURMODULE == \'index\' && in_array(-1, $parameter[\'groups\']))
|| $_G[\'basescript\'] == \'portal\' && $parameter[\'category\'] && !(!empty($_G[\'catid\']) && in_array($_G[\'catid\'], $parameter[\'category\']) || empty($_G[\'catid\']) && in_array(-1, $parameter[\'category\']))
) {
$checked = false;
}',
'create' => '$adcode = $codes[$adids[array_rand($adids)]];',
);
}
}
?>

View File

@@ -0,0 +1,110 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_headerbanner.php 22514 2011-05-10 11:11:11Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_headerbanner {
var $version = '1.0';
var $name = 'headerbanner_name';
var $description = 'headerbanner_desc';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $targets = array('portal', 'home', 'member', 'forum', 'group', 'plugin', 'custom');
var $imagesizes = array('468x40', '468x60', '658x60', '728x90', '760x90', '950x90');
function getsetting() {
global $_G;
$settings = array(
'fids' => array(
'title' => 'headerbanner_fids',
'type' => 'mselect',
'value' => array(),
),
'groups' => array(
'title' => 'headerbanner_groups',
'type' => 'mselect',
'value' => array(),
),
'category' => array(
'title' => 'headerbanner_category',
'type' => 'mselect',
'value' => array(),
),
);
loadcache(array('forums', 'grouptype'));
$settings['fids']['value'][] = $settings['groups']['value'][] = array(0, '&nbsp;');
$settings['fids']['value'][] = $settings['groups']['value'][] = array(-1, 'headerbanner_index');
$settings['fids']['value'][] = array(-2, 'Archiver');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
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']);
}
foreach($_G['cache']['grouptype']['first'] as $gid => $group) {
$settings['groups']['value'][] = array($gid, str_repeat('&nbsp;', 4).$group['name']);
if($group['secondlist']) {
foreach($group['secondlist'] as $sgid) {
$settings['groups']['value'][] = array($sgid, str_repeat('&nbsp;', 8).$_G['cache']['grouptype']['second'][$sgid]['name']);
}
}
}
loadcache('portalcategory');
$this->categoryvalue[] = array(-1, 'headerbanner_index');
$this->getcategory(0);
$settings['category']['value'] = $this->categoryvalue;
return $settings;
}
function getcategory($upid) {
global $_G;
foreach($_G['cache']['portalcategory'] as $category) {
if($category['upid'] == $upid) {
$this->categoryvalue[] = array($category['catid'], str_repeat('&nbsp;', $category['level'] * 4).$category['catname']);
$this->getcategory($category['catid']);
}
}
}
function setsetting(&$advnew, &$parameters) {
global $_G;
if(is_array($advnew['targets'])) {
$advnew['targets'] = implode("\t", $advnew['targets']);
}
if(is_array($parameters['extra']['fids']) && in_array(0, $parameters['extra']['fids'])) {
$parameters['extra']['fids'] = array();
}
if(is_array($parameters['extra']['groups']) && in_array(0, $parameters['extra']['groups'])) {
$parameters['extra']['groups'] = array();
}
if(is_array($parameters['extra']['category']) && in_array(0, $parameters['extra']['category'])) {
$parameters['extra']['category'] = array();
}
}
function evalcode($adv) {
return array(
'check' => '
if($_G[\'basescript\'] == \'forum\' && $parameter[\'fids\'] && !(!defined(\'IN_ARCHIVER\') && (in_array($_G[\'fid\'], $parameter[\'fids\']) || CURMODULE == \'index\' && in_array(-1, $parameter[\'fids\'])) || defined(\'IN_ARCHIVER\') && in_array(-2, $parameter[\'fids\']))
|| $_G[\'basescript\'] == \'group\' && $parameter[\'groups\'] && !(in_array($_G[\'grouptypeid\'], $parameter[\'groups\']) || CURMODULE == \'index\' && in_array(-1, $parameter[\'groups\']))
|| $_G[\'basescript\'] == \'portal\' && $parameter[\'category\'] && !(!empty($_G[\'catid\']) && in_array($_G[\'catid\'], $parameter[\'category\']) || empty($_G[\'catid\']) && in_array(-1, $parameter[\'category\']))
) {
$checked = false;
}',
'create' => '
$adid = $adids[array_rand($adids)];
$extra = $parameters[$adid][\'height\'] ? \' style="line-height:\'.$parameters[$adid][\'height\'].\'px;height:\'.$parameters[$adid][\'height\'].\'px"\' : \'\';
$adcode = $codes[$adid];
',
);
}
}
?>

View File

@@ -0,0 +1,76 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_intercat.php 26440 2011-12-13 06:28:38Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_intercat {
var $version = '1.1';
var $name = 'intercat_name';
var $description = 'intercat_desc';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $targets = array('forum');
var $imagesizes = array('468x60', '658x60', '728x90', '760x90', '950x90');
function getsetting() {
global $_G;
$settings = array(
'fids' => array(
'title' => 'intercat_fids',
'type' => 'mselect',
'value' => array(),
),
'position' => array(
'title' => 'intercat_position',
'type' => 'mradio',
'value' => array(),
'default' => 0,
),
);
loadcache('forums');
$settings['fids']['value'][] = array(0, '&nbsp;');
$settings['fids']['value'][] = array(-1, 'intercat_position_fav');
$settings['position']['value'][] = array(0, 'intercat_position_random');
$settings['position']['value'][] = array(-1, 'intercat_position_fav');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
foreach($_G['cache']['forums'] as $fid => $forum) {
if($forum['type'] == 'group') {
$settings['fids']['value'][] = array($fid, $forum['name']);
$settings['position']['value'][] = array($fid, $forum['name']);
}
}
return $settings;
}
function setsetting(&$advnew, &$parameters) {
global $_G;
if(is_array($advnew['targets'])) {
$advnew['targets'] = implode("\t", $advnew['targets']);
}
if(is_array($parameters['extra']['fids']) && in_array(0, $parameters['extra']['fids'])) {
$parameters['extra']['fids'] = array();
}
}
function evalcode() {
return array(
'check' => '
if(!(!$parameter[\'position\'] || $parameter[\'position\'] && $params[2] == $parameter[\'position\'] || $parameter[\'fids\'] && in_array($_GET[\'gid\'], $parameter[\'fids\']))) {
$checked = false;
}',
'create' => '$adcode = $codes[$adids[array_rand($adids)]];',
);
}
}
?>

View File

@@ -0,0 +1,93 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_interthread.php 24553 2011-09-26 03:21:13Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_interthread {
var $version = '1.1';
var $name = 'interthread_name';
var $description = 'interthread_desc';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $targets = array('forum', 'group');
var $imagesizes = array('468x60', '658x60', '728x90', '760x90');
function getsetting() {
global $_G;
$settings = array(
'fids' => array(
'title' => 'interthread_fids',
'type' => 'mselect',
'value' => array(),
),
'groups' => array(
'title' => 'interthread_groups',
'type' => 'mselect',
'value' => array(),
),
'pnumber' => array(
'title' => 'interthread_pnumber',
'type' => 'mselect',
'value' => array(),
'default' => array(0),
),
);
loadcache(array('forums', 'grouptype'));
$settings['fids']['value'][] = $settings['groups']['value'][] = array(0, '&nbsp;');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
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']);
}
foreach($_G['cache']['grouptype']['first'] as $gid => $group) {
$settings['groups']['value'][] = array($gid, $group['name']);
if($group['secondlist']) {
foreach($group['secondlist'] as $sgid) {
$settings['groups']['value'][] = array($sgid, str_repeat('&nbsp;', 8).$_G['cache']['grouptype']['second'][$sgid]['name']);
}
}
}
for($i = 1;$i <= $_G['ppp'];$i++) {
$settings['pnumber']['value'][$i] = array($i, '> #'.$i);
}
return $settings;
}
function setsetting(&$advnew, &$parameters) {
global $_G;
if(is_array($advnew['targets'])) {
$advnew['targets'] = implode("\t", $advnew['targets']);
}
if(is_array($parameters['extra']['fids']) && in_array(0, $parameters['extra']['fids'])) {
$parameters['extra']['fids'] = array();
}
if(is_array($parameters['extra']['groups']) && in_array(0, $parameters['extra']['groups'])) {
$parameters['extra']['groups'] = array();
}
}
function evalcode() {
return array(
'check' => '
$parameter[\'pnumber\'] = $parameter[\'pnumber\'] ? $parameter[\'pnumber\'] : array(1);
if(!in_array($params[2] + 1, (array)$parameter[\'pnumber\'])
|| $_G[\'basescript\'] == \'forum\' && $parameter[\'fids\'] && !in_array($_G[\'fid\'], $parameter[\'fids\'])
|| $_G[\'basescript\'] == \'group\' && $parameter[\'groups\'] && !in_array($_G[\'grouptypeid\'], $parameter[\'groups\'])
) {
$checked = false;
}',
'create' => '$adcode = $codes[$adids[array_rand($adids)]];',
);
}
}
?>

View File

@@ -0,0 +1,41 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_search.php 22150 2011-04-22 07:36:09Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_search {
var $version = '1.0';
var $name = 'search_name';
var $description = 'search_desc';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $targets = array('search');
var $imagesizes = array('120x60', '120x240');
function getsetting() {}
function setsetting(&$advnew, &$parameters) {
global $_G;
if(is_array($advnew['targets'])) {
$advnew['targets'] = implode("\t", $advnew['targets']);
}
}
function evalcode() {
return array(
'check' => '',
'create' => '$adcode = $codes[$adids[array_rand($adids)]];',
);
}
}
?>

View File

@@ -0,0 +1,105 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_subnavbanner.php 19237 2010-12-23 04:27:46Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_subnavbanner {
var $version = '1.0';
var $name = 'subnavbanner_name';
var $description = 'subnavbanner_desc';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $targets = array('portal', 'home', 'member', 'forum', 'group', 'plugin', 'custom');
var $imagesizes = array('468x40', '468x60', '658x60', '728x90', '760x90', '950x90');
function getsetting() {
global $_G;
$settings = array(
'fids' => array(
'title' => 'subnavbanner_fids',
'type' => 'mselect',
'value' => array(),
),
'groups' => array(
'title' => 'subnavbanner_groups',
'type' => 'mselect',
'value' => array(),
),
'category' => array(
'title' => 'subnavbanner_category',
'type' => 'mselect',
'value' => array(),
),
);
loadcache(array('forums', 'grouptype'));
$settings['fids']['value'][] = $settings['groups']['value'][] = array(0, '&nbsp;');
$settings['fids']['value'][] = $settings['groups']['value'][] = array(-1, 'subnavbanner_index');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
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']);
}
foreach($_G['cache']['grouptype']['first'] as $gid => $group) {
$settings['groups']['value'][] = array($gid, str_repeat('&nbsp;', 4).$group['name']);
if($group['secondlist']) {
foreach($group['secondlist'] as $sgid) {
$settings['groups']['value'][] = array($sgid, str_repeat('&nbsp;', 8).$_G['cache']['grouptype']['second'][$sgid]['name']);
}
}
}
loadcache('portalcategory');
$this->categoryvalue[] = array(-1, 'subnavbanner_index');
$this->getcategory(0);
$settings['category']['value'] = $this->categoryvalue;
return $settings;
}
function getcategory($upid) {
global $_G;
foreach($_G['cache']['portalcategory'] as $category) {
if($category['upid'] == $upid) {
$this->categoryvalue[] = array($category['catid'], str_repeat('&nbsp;', $category['level'] * 4).$category['catname']);
$this->getcategory($category['catid']);
}
}
}
function setsetting(&$advnew, &$parameters) {
global $_G;
if(is_array($advnew['targets'])) {
$advnew['targets'] = implode("\t", $advnew['targets']);
}
if(is_array($parameters['extra']['fids']) && in_array(0, $parameters['extra']['fids'])) {
$parameters['extra']['fids'] = array();
}
if(is_array($parameters['extra']['groups']) && in_array(0, $parameters['extra']['groups'])) {
$parameters['extra']['groups'] = array();
}
if(is_array($parameters['extra']['category']) && in_array(0, $parameters['extra']['category'])) {
$parameters['extra']['category'] = array();
}
}
function evalcode($adv) {
return array(
'check' => '
if($_G[\'basescript\'] == \'forum\' && $parameter[\'fids\'] && !(in_array($_G[\'fid\'], $parameter[\'fids\']) || CURMODULE == \'index\' && in_array(-1, $parameter[\'fids\']))
|| $_G[\'basescript\'] == \'group\' && $parameter[\'groups\'] && !(in_array($_G[\'grouptypeid\'], $parameter[\'groups\']) || CURMODULE == \'index\' && in_array(-1, $parameter[\'groups\']))
|| $_G[\'basescript\'] == \'portal\' && $parameter[\'category\'] && !(!empty($_G[\'catid\']) && in_array($_G[\'catid\'], $parameter[\'category\']) || empty($_G[\'catid\']) && in_array(-1, $parameter[\'category\']))
) {
$checked = false;
}',
'create' => '$adcode = $codes[$adids[array_rand($adids)]];'
);
}
}
?>

View File

@@ -0,0 +1,125 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_text.php 13462 2010-07-27 07:26:27Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_text {
var $version = '2.0';
var $name = 'text_name';
var $description = 'text_desc';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $targets = array('forum', 'group', 'home', 'portal');
var $imagesizes = array('120x60', '250x60', '100x100');
function getsetting() {
global $_G;
$settings = array(
'fids' => array(
'title' => 'text_fids',
'type' => 'mselect',
'value' => array(),
),
'groups' => array(
'title' => 'text_groups',
'type' => 'mselect',
'value' => array(),
),
'category' => array(
'title' => 'text_category',
'type' => 'mselect',
'value' => array(),
),
);
loadcache(array('forums', 'grouptype'));
$settings['fids']['value'][] = $settings['groups']['value'][] = array(0, '&nbsp;');
$settings['fids']['value'][] = $settings['groups']['value'][] = array(-1, 'text_index');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
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']);
}
foreach($_G['cache']['grouptype']['first'] as $gid => $group) {
$settings['groups']['value'][] = array($gid, $group['name']);
if($group['secondlist']) {
foreach($group['secondlist'] as $sgid) {
$settings['groups']['value'][] = array($sgid, str_repeat('&nbsp;', 4).$_G['cache']['grouptype']['second'][$sgid]['name']);
}
}
}
loadcache('portalcategory');
$this->getcategory(0);
$settings['category']['value'] = $this->categoryvalue;
return $settings;
}
function getcategory($upid) {
global $_G;
foreach($_G['cache']['portalcategory'] as $category) {
if($category['upid'] == $upid) {
$this->categoryvalue[] = array($category['catid'], str_repeat('&nbsp;', $category['level'] * 4).$category['catname']);
$this->getcategory($category['catid']);
}
}
}
function setsetting(&$advnew, &$parameters) {
global $_G;
if(is_array($advnew['targets'])) {
$advnew['targets'] = implode("\t", $advnew['targets']);
}
if(is_array($parameters['extra']['fids']) && in_array(0, $parameters['extra']['fids'])) {
$parameters['extra']['fids'] = array();
}
if(is_array($parameters['extra']['groups']) && in_array(0, $parameters['extra']['groups'])) {
$parameters['extra']['groups'] = array();
}
}
function evalcode() {
return array(
'check' => '
if($_G[\'basescript\'] == \'forum\' && $parameter[\'fids\'] && !(in_array($_G[\'fid\'], $parameter[\'fids\']) || CURMODULE == \'index\' && in_array(-1, $parameter[\'fids\']))
|| $_G[\'basescript\'] == \'group\' && $parameter[\'groups\'] && !(in_array($_G[\'grouptypeid\'], $parameter[\'groups\']) || CURMODULE == \'index\' && in_array(-1, $parameter[\'groups\']))
|| $_G[\'basescript\'] == \'portal\' && $parameter[\'category\'] && !(in_array($_G[\'catid\'], $parameter[\'category\']))
) {
$checked = false;
}',
'create' => '
$advcount = count($adids);
if($advcount > 5) {
$minfillpercent = 0;
for($cols = 5; $cols >= 3; $cols--) {
if(($remainder = $advcount % $cols) == 0) {
$advcols = $cols;
break;
} elseif($remainder / $cols > $minfillpercent) {
$minfillpercent = $remainder / $cols;
$advcols = $cols;
}
}
} else {
$advcols = $advcount;
}
$adcode = \'\';
for($i = 0; $i < $advcols * ceil($advcount / $advcols); $i++) {
$adcode .= (($i + 1) % $advcols == 1 || $advcols == 1 ? \'<tr>\' : \'\').
\'<td width="\'.intval(100 / $advcols).\'%">\'.(isset($codes[$adids[$i]]) ? $codes[$adids[$i]] : \'&nbsp;\').\'</td>\'.
(($i + 1) % $advcols == 0 ? "</tr>\n" : \'\');
}
$adcode = \'<table cellpadding="0" cellspacing="1">\'.$adcode.\'</table>\';
',
);
}
}
?>

View File

@@ -0,0 +1,115 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_thread.php 23660 2011-08-02 06:59:11Z maruitao $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_thread {
var $version = '1.0';
var $name = 'thread_name';
var $description = 'thread_desc';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $targets = array('forum', 'group');
var $imagesizes = array('120x60', '120x240');
function getsetting() {
global $_G;
$settings = array(
'fids' => array(
'title' => 'thread_fids',
'type' => 'mselect',
'value' => array(),
),
'groups' => array(
'title' => 'thread_groups',
'type' => 'mselect',
'value' => array(),
),
'position' => array(
'title' => 'thread_position',
'type' => 'mradio',
'value' => array(
array(2, 'thread_position_top'),
array(3, 'thread_position_right'),
array(1, 'thread_position_bottom'),
),
'default' => 1,
),
'pnumber' => array(
'title' => 'thread_pnumber',
'type' => 'mselect',
'value' => array(
array(0, 'thread_pnumber_all'),
),
'default' => array(0),
),
);
loadcache(array('forums', 'grouptype'));
$settings['fids']['value'][] = $settings['groups']['value'][] = array(0, '&nbsp;');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
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']);
}
foreach($_G['cache']['grouptype']['first'] as $gid => $group) {
$settings['groups']['value'][] = array($gid, $group['name']);
if($group['secondlist']) {
foreach($group['secondlist'] as $sgid) {
$settings['groups']['value'][] = array($sgid, str_repeat('&nbsp;', 4).$_G['cache']['grouptype']['second'][$sgid]['name']);
}
}
}
for($i = 1;$i <= $_G['ppp'];$i++) {
$settings['pnumber']['value'][$i] = array($i, '> #'.$i);
}
return $settings;
}
function setsetting(&$advnew, &$parameters) {
global $_G;
if(is_array($advnew['targets'])) {
$advnew['targets'] = implode("\t", $advnew['targets']);
}
if(is_array($parameters['extra']['fids']) && in_array(0, $parameters['extra']['fids'])) {
$parameters['extra']['fids'] = array();
}
if(is_array($parameters['extra']['groups']) && in_array(0, $parameters['extra']['groups'])) {
$parameters['extra']['groups'] = array();
}
if(is_array($parameters['extra']['pnumber']) && in_array(0, $parameters['extra']['pnumber'])) {
$parameters['extra']['pnumber'] = array();
}
}
function evalcode($adv) {
return array(
'check' => '
if($params[2] != $parameter[\'position\']
|| $parameter[\'pnumber\'] && !in_array($params[3] + 1, (array)$parameter[\'pnumber\'])
|| $_G[\'basescript\'] == \'forum\' && $parameter[\'fids\'] && !in_array($_G[\'fid\'], $parameter[\'fids\'])
|| $_G[\'basescript\'] == \'group\' && $parameter[\'groups\'] && !in_array($_G[\'grouptypeid\'], $parameter[\'groups\'])
) {
$checked = false;
}',
'create' => '
$adid = $adids[array_rand($adids)];
if($parameters[$adid][\'position\'] == 3) {
$_G[\'thread\'][\'contentmr\'] = $parameters[$adid][\'width\'] ? $parameters[$adid][\'width\'].\'px\' : \'auto\';
$extra = \'style="margin-left:10px;width:\'.$_G[\'thread\'][\'contentmr\'].\'"\';
}
$adcode = $codes[$adid];
',
);
}
}
?>

View File

@@ -0,0 +1,145 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: adv_threadlist.php 29052 2012-03-23 09:07:40Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class adv_threadlist {
var $version = '1.0';
var $name = 'threadlist_name';
var $description = 'threadlist_desc';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $targets = array('forum', 'group');
var $imagesizes = array('120x60', '468x40', '468x60');
function getsetting() {
global $_G;
$settings = array(
'fids' => array(
'title' => 'threadlist_fids',
'type' => 'mselect',
'value' => array(),
),
'groups' => array(
'title' => 'threadlist_groups',
'type' => 'mselect',
'value' => array(),
),
'pos' => array(
'title' => 'threadlist_pos',
'type' => 'text',
'value' => '',
),
'mode' => array(
'title' => 'threadlist_mode',
'type' => 'mradio',
'value' => array(
array(0, 'threadlist_mode_0'),
array(1, 'threadlist_mode_1'),
),
),
'tid' => array(
'title' => 'threadlist_tid',
'type' => 'text',
'value' => '',
),
'threadurl' => array(
'title' => 'threadlist_threadurl',
'type' => 'text',
'value' => '',
),
);
loadcache(array('forums', 'grouptype'));
$settings['fids']['value'][] = $settings['groups']['value'][] = array(0, '&nbsp;');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
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']);
}
foreach($_G['cache']['grouptype']['first'] as $gid => $group) {
$settings['groups']['value'][] = array($gid, $group['name']);
if($group['secondlist']) {
foreach($group['secondlist'] as $sgid) {
$settings['groups']['value'][] = array($sgid, str_repeat('&nbsp;', 4).$_G['cache']['grouptype']['second'][$sgid]['name']);
}
}
}
return $settings;
}
function setsetting(&$advnew, &$parameters) {
global $_G;
if(is_array($advnew['targets'])) {
$advnew['targets'] = implode("\t", $advnew['targets']);
}
if(is_array($parameters['extra']['fids']) && in_array(0, $parameters['extra']['fids'])) {
$parameters['extra']['fids'] = array();
}
if(is_array($parameters['extra']['groups']) && in_array(0, $parameters['extra']['groups'])) {
$parameters['extra']['groups'] = array();
}
$parameters['extra']['pos'] = $parameters['pos'];
$parameters['extra']['tid'] = $parameters['tid'];
$parameters['extra']['threadurl'] = $parameters['threadurl'];
}
function evalcode() {
return array(
'check' => '
if($GLOBALS[\'page\'] != 1 || !empty($_GET[\'filter\'])
|| $_G[\'basescript\'] == \'forum\' && $parameter[\'fids\'] && !in_array($_G[\'fid\'], $parameter[\'fids\'])
|| $_G[\'basescript\'] == \'group\' && $parameter[\'groups\'] && !in_array($_G[\'grouptypeid\'], $parameter[\'groups\'])
) {
$checked = false;
} else {
if(empty($_G[\'adv_vtp_count\'])) {
for($i = 1;$i <= $_G[\'forum_threadnum\'];$i++) {
if(empty($parameter[\'pos\'])) {
$_G[\'adv_vtp\'][0][$i][] = $adid;
} elseif($parameter[\'pos\'] == $i) {
$_G[\'adv_vtp\'][1][$i][] = $adid;
}
}
$_G[\'adv_vtp_showed\'] = $_G[\'adv_vtp_thread\'] = array();
}
if($parameter[\'mode\'] && $parameter[\'tid\']) {
$_G[\'adv_vtp_tids\'][] = $parameter[\'tid\'];
}
}',
'create' => '
$_G[\'adv_vtp_count\']++;
if($_G[\'adv_vtp_count\'] == 1 && !empty($_G[\'adv_vtp_tids\'])) {
foreach(C::t(\'forum_thread\')->fetch_all_by_tid($_G[\'adv_vtp_tids\']) as $row) {
$_G[\'adv_vtp_thread\'][$row[\'tid\']] = $row;
}
}
$vt = $_G[\'adv_vtp_thread\'];
$adi = !empty($_G[\'adv_vtp\'][1][$_G[\'adv_vtp_count\']]) ? 1 : 0;
$adary = !empty($_G[\'adv_vtp\'][$adi][$_G[\'adv_vtp_count\']]) && is_array($_G[\'adv_vtp\'][$adi][$_G[\'adv_vtp_count\']]) ? array_diff($_G[\'adv_vtp\'][$adi][$_G[\'adv_vtp_count\']], $_G[\'adv_vtp_showed\']) : array();
$adid = empty($adary) ? 0 : $adary[array_rand($adary)];
$_G[\'adv_vtp_showed\'][] = $adid;
$vttid = $parameters[$adid][\'tid\'];
$notag = true;
$adcode = $adid ? (!$parameters[$adid][\'mode\'] ? \'<tbody><tr><td colspan=\'.($_G[\'forum\'][\'ismoderator\'] && !$_GET[\'archiveid\'] ? 6 : 5).\'>\'.$codes[$adid].\'</td></tr></tbody>\'
: \'<tr><td class="icn"><a href="forum.php?mod=viewthread&tid=\'.$vt[$vttid][\'tid\'].\'" target="_blank"><img src="\'.$_G[\'style\'][\'imgdir\'].\'/folder_new.gif" /></a></td>\'.
($_G[\'forum\'][\'ismoderator\'] && !$_GET[\'archiveid\'] ? \'<td class="o"></td>\' : \'\').
\'<td class="new"><a href="\'.($parameters[$adid][\'threadurl\'] ? $parameters[$adid][\'threadurl\'] : \'forum.php?mod=viewthread&tid=\'.$vt[$vttid][\'tid\']).\'" class="xst">\'.$codes[$adid].\'</a></td>\'.
\'<td class="by"><cite><a href="home.php?mod=space&uid=\'.$vt[$vttid][\'authorid\'].\'">\'.$vt[$vttid][\'author\'].\'</a></cite><em>\'.dgmdate($vt[$vttid][\'dateline\'], \'d\').\'</em></td>\'.
\'<td class="num"><a href="forum.php?mod=viewthread&tid=\'.$vt[$vttid][\'tid\'].\'" class="xi2">\'.$vt[$vttid][\'replies\'].\'</a><em>\'.$vt[$vttid][\'views\'].\'</em></td>\'.
\'<td class="by"><cite><a href="forum.php?mod=viewthread&tid=\'.$vt[$vttid][\'tid\'].\'">\'.$vt[$vttid][\'lastposter\'].\'</a></cite>\'.
\'<em><a href="forum.php?mod=redirect&tid=\'.$vt[$vttid][\'tid\'].\'&goto=lastpost#lastpost">\'.dgmdate($vt[$vttid][\'lastpost\'], \'u\').\'</a></em></td>\'.
\'</tr>\') : \'\';',
);
}
}
?>

View File

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

View File

@@ -0,0 +1,190 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_group.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class block_group extends discuz_block {
var $setting = array();
function __construct(){
$this->setting = array(
'gtids' => array(
'title' => 'grouplist_gtids',
'type' => 'mselect',
'value' => array(
),
),
'fids' => array(
'title' => 'grouplist_fids',
'type' => 'text'
),
'titlelength' => array(
'title' => 'grouplist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'grouplist_summarylength',
'type' => 'text',
'default' => 80
),
'orderby' => array(
'title' => 'grouplist_orderby',
'type' => 'mradio',
'value' => array(
array('displayorder', 'grouplist_orderby_displayorder'),
array('threads', 'grouplist_orderby_threads'),
array('posts', 'grouplist_orderby_posts'),
array('todayposts', 'grouplist_orderby_todayposts'),
array('membernum', 'grouplist_orderby_membernum'),
array('dateline', 'grouplist_orderby_dateline'),
array('level', 'grouplist_orderby_level'),
array('commoncredits', 'grouplist_orderby_commoncredits'),
array('activity', 'grouplist_orderby_activity')
),
'default' => 'displayorder'
)
);
}
function getsetting() {
global $_G;
$settings = $this->setting;
if($settings['gtids']) {
loadcache('grouptype');
$settings['gtids']['value'][] = array(0, lang('portalcp', 'block_all_type'));
foreach($_G['cache']['grouptype']['first'] as $gid=>$group) {
$settings['gtids']['value'][] = array($gid, $group['name']);
if($group['secondlist']) {
foreach($group['secondlist'] as $subgid) {
$settings['gtids']['value'][] = array($subgid, '&nbsp;&nbsp;'.$_G['cache']['grouptype']['second'][$subgid]['name']);
}
}
}
}
return $settings;
}
function name() {
return lang('blockclass', 'blockclass_group_script_group');
}
function blockclass() {
return array('group', lang('blockclass', 'blockclass_group_group'));
}
function fields() {
return array(
'id' => array('name' => lang('blockclass', 'blockclass_field_id'), 'formtype' => 'text', 'datatype' => 'int'),
'url' => array('name' => lang('blockclass', 'blockclass_group_field_url'), 'formtype' => 'text', 'datatype' => 'string'),
'title' => array('name' => lang('blockclass', 'blockclass_group_field_title'), 'formtype' => 'title', 'datatype' => 'title'),
'pic' => array('name' => lang('blockclass', 'blockclass_group_field_pic'), 'formtype' => 'pic', 'datatype' => 'pic'),
'summary' => array('name' => lang('blockclass', 'blockclass_group_field_summary'), 'formtype' => 'summary', 'datatype' => 'summary'),
'icon' => array('name' => lang('blockclass', 'blockclass_group_field_icon'), 'formtype' => 'text', 'datatype' => 'string'),
'foundername' => array('name' => lang('blockclass', 'blockclass_group_field_foundername'), 'formtype' => 'text', 'datatype' => 'string'),
'founderuid' => array('name' => lang('blockclass', 'blockclass_group_field_founderuid'), 'formtype' => 'text', 'datatype' => 'int'),
'posts' => array('name' => lang('blockclass', 'blockclass_group_field_posts'), 'formtype' => 'text', 'datatype' => 'int'),
'todayposts' => array('name' => lang('blockclass', 'blockclass_group_field_todayposts'), 'formtype' => 'text', 'datatype' => 'int'),
'threads' => array('name' => lang('blockclass', 'blockclass_group_field_threads'), 'formtype' => 'date', 'datatype' => 'int'),
'membernum' => array('name' => lang('blockclass', 'blockclass_group_field_membernum'), 'formtype' => 'text', 'datatype' => 'int'),
'dateline' => array('name' => lang('blockclass', 'blockclass_group_field_dateline'), 'formtype' => 'date', 'datatype' => 'date'),
'level' => array('name' => lang('blockclass', 'blockclass_group_field_level'), 'formtype' => 'text', 'datatype' => 'int'),
'commoncredits' => array('name' => lang('blockclass', 'blockclass_group_field_commoncredits'), 'formtype' => 'text', 'datatype' => 'int'),
'activity' => array('name' => lang('blockclass', 'blockclass_group_field_activity'), 'formtype' => 'text', 'datatype' => 'int'),
);
}
function fieldsconvert() {
return array(
'forum_forum' => array(
'name' => lang('blockclass', 'blockclass_forum_forum'),
'script' => 'forum',
'searchkeys' => array(),
'replacekeys' => array(),
),
'portal_category' => array(
'name' => lang('blockclass', 'blockclass_portal_category'),
'script' => 'portalcategory',
'searchkeys' => array('threads'),
'replacekeys' => array('articles'),
),
);
}
function getdata($style, $parameter) {
global $_G;
$parameter = $this->cookparameter($parameter);
loadcache('grouptype');
$typeids = array();
if(!empty($parameter['gtids'])) {
if($parameter['gtids'][0] == '0') {
unset($parameter['gtids'][0]);
}
$typeids = $parameter['gtids'];
}
if(empty($typeids)) $typeids = array_keys($_G['cache']['grouptype']['second']);
$fids = !empty($parameter['fids']) ? explode(',',$parameter['fids']) : array();
$items = isset($parameter['items']) ? intval($parameter['items']) : 10;
$titlelength = !empty($parameter['titlelength']) ? intval($parameter['titlelength']) : 40;
$summarylength = !empty($parameter['summarylength']) ? intval($parameter['summarylength']) : 80;
$orderby = in_array($parameter['orderby'], array('displayorder','posts','todayposts','threads', 'membernum', 'dateline', 'level', 'activity', 'commoncredits')) ? $parameter['orderby'] : 'displayorder';
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
$sqlban = !empty($bannedids) ? ' AND f.fid NOT IN ('.dimplode($bannedids).')' : '';
if($fids) {
$wheresql = "f.fid IN (".dimplode($fids).") AND f.status='3' AND f.type='sub' $sqlban";
} else {
$wheresql = !empty($typeids) ? "f.fup IN (".dimplode($typeids).") AND f.status='3' AND f.type='sub' $sqlban" : "0";
}
$wheresql .= " AND f.level > '0'";
if(in_array($orderby, array('posts', 'todayposts', 'threads', 'level', 'commoncredits'))) {
$orderbysql = "f.$orderby DESC";
} elseif(in_array($orderby, array('dateline', 'activity', 'membernum'))) {
$orderbysql = "ff.$orderby DESC";
} else {
$orderbysql = "f.displayorder ASC";
}
$list = array();
$query = DB::query('SELECT f.*, ff.* FROM '.DB::table('forum_forum').' f LEFT JOIN '.DB::table('forum_forumfield')." ff ON f.fid = ff.fid WHERE $wheresql ORDER BY $orderbysql LIMIT $items");
while($data = DB::fetch($query)) {
$list[] = array(
'id' => $data['fid'],
'idtype' => 'fid',
'title' => cutstr($data['name'], $titlelength, ''),
'url' => 'forum.php?mod=group&fid='.$data['fid'],
'pic' => 'group/'.$data['banner'],
'picflag' => '1',
'summary' => cutstr($data['description'], $summarylength, ''),
'fields' => array(
'fulltitle' => $data['name'],
'icon' => !empty($data['icon']) ? $_G['setting']['attachurl'].'group/'.$data['icon'] : STATICURL.'image/common/nophoto.gif',
'founderuid' => $data['founderuid'],
'foundername' => $data['foundername'],
'threads' => $data['threads'],
'posts' => $data['posts'],
'todayposts' => $data['todayposts'],
'dateline' => $data['dateline'],
'level' => $data['level'],
'membernum' => $data['membernum'],
'activity' => $data['activity'],
'commoncredits' => $data['commoncredits'],
)
);
}
return array('html' => '', 'data' => $list);
}
}
?>

View File

@@ -0,0 +1,383 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_groupactivity.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class block_groupactivity extends discuz_block {
var $setting = array();
function __construct(){
$this->setting = array(
'tids' => array(
'title' => 'groupactivity_tids',
'type' => 'text'
),
'uids' => array(
'title' => 'groupactivity_uids',
'type' => 'text'
),
'keyword' => array(
'title' => 'groupactivity_keyword',
'type' => 'text'
),
'fids' => array(
'title' => 'groupactivity_fids',
'type' => 'text'
),
'gtids' => array(
'title' => 'groupactivity_gtids',
'type' => 'mselect',
'value' => array(
),
),
'digest' => array(
'title' => 'groupactivity_digest',
'type' => 'mcheckbox',
'value' => array(
array(1, 'groupactivity_digest_1'),
array(2, 'groupactivity_digest_2'),
array(3, 'groupactivity_digest_3'),
array(0, 'groupactivity_digest_0')
),
),
'stick' => array(
'title' => 'groupactivity_stick',
'type' => 'mcheckbox',
'value' => array(
array(1, 'groupactivity_stick_1'),
array(2, 'groupactivity_stick_2'),
array(3, 'groupactivity_stick_3'),
array(0, 'groupactivity_stick_0')
),
),
'recommend' => array(
'title' => 'groupactivity_recommend',
'type' => 'radio'
),
'place' => array(
'title' => 'groupactivity_place',
'type' => 'text'
),
'class' => array(
'title' => 'groupactivity_class',
'type' => 'select',
'value' => array()
),
'gender' => array(
'title' => 'groupactivity_gender',
'type' => 'mradio',
'value' => array(
array('', 'groupactivity_gender_0'),
array('1', 'groupactivity_gender_1'),
array('2', 'groupactivity_gender_2'),
),
'default' => ''
),
'orderby' => array(
'title' => 'groupactivity_orderby',
'type'=> 'mradio',
'value' => array(
array('dateline', 'groupactivity_orderby_dateline'),
array('weekstart', 'groupactivity_orderby_weekstart'),
array('monthstart', 'groupactivity_orderby_monthstart'),
array('weekexp', 'groupactivity_orderby_weekexp'),
array('monthexp', 'groupactivity_orderby_monthexp'),
),
'default' => 'dateline'
),
'gviewperm' => array(
'title' => 'groupactivity_gviewperm',
'type' => 'mradio',
'value' => array(
array('-1', 'groupactivity_gviewperm_nolimit'),
array('0', 'groupactivity_gviewperm_only_member'),
array('1', 'groupactivity_gviewperm_all_member')
),
'default' => '-1'
),
'highlight' => array(
'title' => 'groupactivity_highlight',
'type' => 'radio',
'default' => 0,
),
'titlelength' => array(
'title' => 'groupactivity_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'groupactivity_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'groupactivity_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_group_activity');
}
function blockclass() {
return array('activity', lang('blockclass', 'blockclass_group_activity'));
}
function fields() {
return array(
'id' => array('name' => lang('blockclass', 'blockclass_field_id'), 'formtype' => 'text', 'datatype' => 'int'),
'url' => array('name' => lang('blockclass', 'blockclass_groupactivity_field_url'), 'formtype' => 'text', 'datatype' => 'string'),
'title' => array('name' => lang('blockclass', 'blockclass_groupactivity_field_title'), 'formtype' => 'title', 'datatype' => 'title'),
'pic' => array('name' => lang('blockclass', 'blockclass_groupactivity_field_pic'), 'formtype' => 'pic', 'datatype' => 'pic'),
'summary' => array('name' => lang('blockclass', 'blockclass_groupactivity_field_summary'), 'formtype' => 'summary', 'datatype' => 'summary'),
'time' => array('name' => lang('blockclass', 'blockclass_groupactivity_field_time'), 'formtype' => 'text', 'datatype' => 'text'),
'expiration' => array('name' => lang('blockclass', 'blockclass_groupactivity_field_expiration'), 'formtype' => 'text', 'datatype' => 'text'),
'author' => array('name' => lang('blockclass', 'blockclass_groupactivity_field_author'), 'formtype' => 'text', 'datatype' => 'text'),
'authorid' => array('name' => lang('blockclass', 'blockclass_groupactivity_field_authorid'), 'formtype' => 'text', 'datatype' => 'int'),
'cost' => array('name' => lang('blockclass', 'blockclass_groupactivity_field_cost'), 'formtype' => 'text', 'datatype' => 'int'),
'place' => array('name' => lang('blockclass', 'blockclass_groupactivity_field_place'), 'formtype' => 'text', 'datatype' => 'text'),
'class' => array('name' => lang('blockclass', 'blockclass_groupactivity_field_class'), 'formtype' => 'text', 'datatype' => 'text'),
'gender' => array('name' => lang('blockclass', 'blockclass_groupactivity_field_gender'), 'formtype' => 'text', 'datatype' => 'text'),
'number' => array('name' => lang('blockclass', 'blockclass_groupactivity_field_number'), 'formtype' => 'text', 'datatype' => 'int'),
'applynumber' => array('name' => lang('blockclass', 'blockclass_groupactivity_field_applynumber'), 'formtype' => 'text', 'datatype' => 'int'),
);
}
function fieldsconvert() {
return array(
'forum_activity' => array(
'name' => lang('blockclass', 'blockclass_forum_activity'),
'script' => 'activity',
'searchkeys' => array(),
'replacekeys' => array(),
),
);
}
function getsetting() {
global $_G;
$settings = $this->setting;
if($settings['gtids']) {
loadcache('grouptype');
$settings['gtids']['value'][] = array(0, lang('portalcp', 'block_all_type'));
foreach($_G['cache']['grouptype']['first'] as $gid=>$group) {
$settings['gtids']['value'][] = array($gid, $group['name']);
if($group['secondlist']) {
foreach($group['secondlist'] as $subgid) {
$settings['gtids']['value'][] = array($subgid, '&nbsp;&nbsp;'.$_G['cache']['grouptype']['second'][$subgid]['name']);
}
}
}
}
$activitytype = explode("\n", $_G['setting']['activitytype']);
$settings['class']['value'][] = array('', 'groupactivity_class_all');
foreach($activitytype as $item) {
$settings['class']['value'][] = array($item, $item);
}
return $settings;
}
function getdata($style, $parameter) {
global $_G;
$parameter = $this->cookparameter($parameter);
loadcache('grouptype');
$typeids = array();
if(!empty($parameter['gtids'])) {
if($parameter['gtids'][0] == '0') {
unset($parameter['gtids'][0]);
}
$typeids = $parameter['gtids'];
}
$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 = !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')) ? $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']) : '';
$gviewperm = isset($parameter['gviewperm']) ? intval($parameter['gviewperm']) : -1;
$highlight = !empty($parameter['highlight']) ? 1 : 0;
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
$gviewwhere = $gviewperm == -1 ? '' : " AND ff.gviewperm='$gviewperm'";
$groups = array();
if(empty($fids) && $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).") AND threads > 0$gviewwhere");
while($value = DB::fetch($query)) {
$groups[$value['fid']] = $value;
$fids[] = intval($value['fid']);
}
if(empty($fids)){
return array('html' => '', 'data' => '');
}
}
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).')' : '')
.($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).')' : '')
.$keyword;
if(empty($fids)) {
$sql .= " AND t.isgroup='1'";
if($gviewwhere) {
$sql .= $gviewwhere;
}
}
$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 = ' AND 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 = ' AND 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'";
}
$where = $sql." AND t.displayorder>='0' ".$where;
$sqlfrom = " INNER JOIN `".DB::table('forum_thread')."` t ON t.tid=a.tid ";
$joinmethod = empty($tids) ? 'INNER' : 'LEFT';
if($recommend) {
$sqlfrom .= " $joinmethod JOIN `".DB::table('forum_forumrecommend')."` fc ON fc.tid=tr.tid";
}
$sqlfield = '';
if(empty($fids)) {
$sqlfield = ', f.name groupname';
$sqlfrom .= ' LEFT JOIN '.DB::table('forum_forum').' f ON t.fid=f.fid LEFT JOIN '.DB::table('forum_forumfield').' ff ON f.fid = ff.fid';
}
$sqlfield = $highlight ? ', t.highlight' : '';
$query = DB::query("SELECT a.*, t.tid, t.subject, t.authorid, t.author$sqlfield
FROM ".DB::table('forum_activity')." a $sqlfrom
WHERE 1$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;', addslashes($data['subject'])), $titlelength, ''),
'url' => 'forum.php?mod=viewthread&tid='.$data['tid'],
'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,78 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_groupactivitycity.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_groupactivity', 'class/block/group');
class block_groupactivitycity extends block_groupactivity {
function __construct() {
$this->setting = array(
'gtids' => array(
'title' => 'groupactivity_gtids',
'type' => 'mselect',
'value' => array(
),
),
'place' => array(
'title' => 'groupactivity_place',
'type' => 'text'
),
'class' => array(
'title' => 'groupactivity_class',
'type' => 'select',
'value' => array()
),
'orderby' => array(
'title' => 'groupactivity_orderby',
'type'=> 'mradio',
'value' => array(
array('dateline', 'groupactivity_orderby_dateline'),
array('weekstart', 'groupactivity_orderby_weekstart'),
array('monthstart', 'groupactivity_orderby_monthstart'),
array('weekexp', 'groupactivity_orderby_weekexp'),
array('monthexp', 'groupactivity_orderby_monthexp'),
),
'default' => 'dateline'
),
'gviewperm' => array(
'title' => 'groupactivity_gviewperm',
'type' => 'mradio',
'value' => array(
array('0', 'groupactivity_gviewperm_only_member'),
array('1', 'groupactivity_gviewperm_all_member')
),
'default' => '1'
),
'titlelength' => array(
'title' => 'groupactivity_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'groupactivity_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'groupactivity_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_groupactivity_script_groupactivitycity');
}
}
?>

View File

@@ -0,0 +1,67 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_groupactivitynew.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_groupactivity', 'class/block/group');
class block_groupactivitynew extends block_groupactivity {
function __construct() {
$this->setting = array(
'gtids' => array(
'title' => 'groupactivity_gtids',
'type' => 'mselect',
'value' => array(
),
),
'class' => array(
'title' => 'groupactivity_class',
'type' => 'select',
'value' => array()
),
'gviewperm' => array(
'title' => 'groupactivity_gviewperm',
'type' => 'mradio',
'value' => array(
array('0', 'groupactivity_gviewperm_only_member'),
array('1', 'groupactivity_gviewperm_all_member')
),
'default' => '1'
),
'titlelength' => array(
'title' => 'groupactivity_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'groupactivity_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'groupactivity_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_groupactivity_script_groupactivitynew');
}
function cookparameter($parameter) {
$parameter['orderby'] = 'dateline';
return parent::cookparameter($parameter);
}
}
?>

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_grouphot.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_group', 'class/block/group');
class block_grouphot extends block_group {
function __construct() {
$this->setting = array(
'gtids' => array(
'title' => 'grouplist_gtids',
'type' => 'mselect',
'value' => array(
),
),
'titlelength' => array(
'title' => 'grouplist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'grouplist_summarylength',
'type' => 'text',
'default' => 80
),
'orderby' => array(
'title' => 'grouplist_orderby',
'type' => 'mradio',
'value' => array(
array('threads', 'grouplist_orderby_threads'),
array('posts', 'grouplist_orderby_posts'),
array('todayposts', 'grouplist_orderby_todayposts'),
array('membernum', 'grouplist_orderby_membernum'),
),
'default' => 'posts'
)
);
}
function name() {
return lang('blockclass', 'blockclass_group_script_grouphot');
}
}
?>

View File

@@ -0,0 +1,50 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_groupnew.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_group', 'class/block/group');
class block_groupnew extends block_group {
function __construct() {
$this->setting = array(
'gtids' => array(
'title' => 'grouplist_gtids',
'type' => 'mselect',
'value' => array(
),
),
'titlelength' => array(
'title' => 'grouplist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'grouplist_summarylength',
'type' => 'text',
'default' => 80
)
);
}
function name() {
return lang('blockclass', 'blockclass_group_script_groupnew');
}
function cookparameter($parameter) {
$parameter['orderby'] = 'dateline';
return parent::cookparameter($parameter);
}
}
?>

View File

@@ -0,0 +1,42 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_groupspecified.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_group', 'class/block/group');
class block_groupspecified extends block_group {
function __construct() {
$this->setting = array(
'fids' => array(
'title' => 'grouplist_fids',
'type' => 'text'
),
'titlelength' => array(
'title' => 'grouplist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'grouplist_summarylength',
'type' => 'text',
'default' => 80
)
);
}
function name() {
return lang('blockclass', 'blockclass_group_script_groupspecified');
}
}
?>

View File

@@ -0,0 +1,395 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_groupthread.php 29437 2012-04-12 05:24:35Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class block_groupthread extends discuz_block {
var $setting = array();
function __construct(){
$this->setting = array(
'tids' => array(
'title' => 'groupthread_tids',
'type' => 'text'
),
'fids' => array(
'title' => 'groupthread_fids',
'type' => 'text'
),
'keyword' => array(
'title' => 'threadlist_keyword',
'type' => 'text'
),
'gtids' => array(
'title' => 'groupthread_gtids',
'type' => 'mselect',
'value' => array(
),
),
'uids' => array(
'title' => 'groupthread_uids',
'type' => 'text'
),
'digest' => array(
'title' => 'groupthread_digest',
'type' => 'mcheckbox',
'value' => array(
array(1, 'groupthread_digest_1'),
array(2, 'groupthread_digest_2'),
array(3, 'groupthread_digest_3'),
array(0, 'groupthread_digest_0')
),
),
'stick' => array(
'title' => 'groupthread_stick',
'type' => 'mcheckbox',
'value' => array(
array(1, 'groupthread_stick_1'),
array(0, 'groupthread_stick_0')
),
),
'special' => array(
'title' => 'groupthread_special',
'type' => 'mcheckbox',
'value' => array(
array(1, 'groupthread_special_1'),
array(2, 'groupthread_special_2'),
array(3, 'groupthread_special_3'),
array(4, 'groupthread_special_4'),
array(5, 'groupthread_special_5'),
array(0, 'groupthread_special_0'),
)
),
'rewardstatus' => array(
'title' => 'groupthread_special_reward',
'type' => 'mradio',
'value' => array(
array(0, 'groupthread_special_reward_0'),
array(1, 'groupthread_special_reward_1'),
array(2, 'groupthread_special_reward_2')
),
'default' => 0,
),
'picrequired' => array(
'title' => 'groupthread_picrequired',
'type' => 'radio',
'value' => '0'
),
'orderby' => array(
'title' => 'groupthread_orderby',
'type'=> 'mradio',
'value' => array(
array('lastpost', 'groupthread_orderby_lastpost'),
array('dateline', 'groupthread_orderby_dateline'),
array('replies', 'groupthread_orderby_replies'),
array('views', 'groupthread_orderby_views'),
array('heats', 'groupthread_orderby_heats'),
array('recommends', 'groupthread_orderby_recommends'),
),
'default' => 'lastpost'
),
'postdateline' => array(
'title' => 'groupthread_postdateline',
'type'=> 'mradio',
'value' => array(
array('0', 'groupthread_postdateline_nolimit'),
array('3600', 'groupthread_postdateline_hour'),
array('86400', 'groupthread_postdateline_day'),
array('604800', 'groupthread_postdateline_week'),
array('2592000', 'groupthread_postdateline_month'),
),
'default' => '0'
),
'lastpost' => array(
'title' => 'groupthread_lastpost',
'type'=> 'mradio',
'value' => array(
array('0', 'groupthread_lastpost_nolimit'),
array('3600', 'groupthread_lastpost_hour'),
array('86400', 'groupthread_lastpost_day'),
array('604800', 'groupthread_lastpost_week'),
array('2592000', 'groupthread_lastpost_month'),
),
'default' => '0'
),
'gviewperm' => array(
'title' => 'groupthread_gviewperm',
'type' => 'mradio',
'value' => array(
array('-1', 'groupthread_gviewperm_nolimit'),
array('0', 'groupthread_gviewperm_only_member'),
array('1', 'groupthread_gviewperm_all_member')
),
'default' => '-1'
),
'highlight' => array(
'title' => 'groupthread_highlight',
'type' => 'radio',
'default' => 0,
),
'titlelength' => array(
'title' => 'groupthread_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'groupthread_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'groupthread_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_groupthread_script_groupthread');
}
function blockclass() {
return array('thread', lang('blockclass', 'blockclass_group_thread'));
}
function fields() {
return array(
'id' => array('name' => lang('blockclass', 'blockclass_field_id'), 'formtype' => 'text', 'datatype' => 'int'),
'url' => array('name' => lang('blockclass', 'blockclass_groupthread_field_url'), 'formtype' => 'text', 'datatype' => 'string'),
'title' => array('name' => lang('blockclass', 'blockclass_groupthread_field_title'), 'formtype' => 'title', 'datatype' => 'title'),
'pic' => array('name' => lang('blockclass', 'blockclass_groupthread_field_pic'), 'formtype' => 'pic', 'datatype' => 'pic'),
'summary' => array('name' => lang('blockclass', 'blockclass_groupthread_field_summary'), 'formtype' => 'summary', 'datatype' => 'summary'),
'author' => array('name' => lang('blockclass', 'blockclass_groupthread_field_author'), 'formtype' => 'text', 'datatype' => 'string'),
'authorid' => array('name' => lang('blockclass', 'blockclass_groupthread_field_authorid'), 'formtype' => 'text', 'datatype' => 'int'),
'avatar' => array('name' => lang('blockclass', 'blockclass_groupthread_field_avatar'), 'formtype' => 'text', 'datatype' => 'string'),
'avatar_middle' => array('name' => lang('blockclass', 'blockclass_groupthread_field_avatar_middle'), 'formtype' => 'text', 'datatype' => 'string'),
'avatar_big' => array('name' => lang('blockclass', 'blockclass_groupthread_field_avatar_big'), 'formtype' => 'text', 'datatype' => 'string'),
'posts' => array('name' => lang('blockclass', 'blockclass_groupthread_field_posts'), 'formtype' => 'text', 'datatype' => 'int'),
'todayposts' => array('name' => lang('blockclass', 'blockclass_groupthread_field_todayposts'), 'formtype' => 'text', 'datatype' => 'int'),
'lastpost' => array('name' => lang('blockclass', 'blockclass_groupthread_field_lastpost'), 'formtype' => 'date', 'datatype' => 'date'),
'dateline' => array('name' => lang('blockclass', 'blockclass_groupthread_field_dateline'), 'formtype' => 'date', 'datatype' => 'date'),
'replies' => array('name' => lang('blockclass', 'blockclass_groupthread_field_replies'), 'formtype' => 'text', 'datatype' => 'int'),
'views' => array('name' => lang('blockclass', 'blockclass_groupthread_field_views'), 'formtype' => 'text', 'datatype' => 'int'),
'heats' => array('name' => lang('blockclass', 'blockclass_groupthread_field_heats'), 'formtype' => 'text', 'datatype' => 'int'),
'recommends' => array('name' => lang('blockclass', 'blockclass_groupthread_field_recommends'), 'formtype' => 'text', 'datatype' => 'int'),
'groupname' => array('name' => lang('blockclass', 'blockclass_groupthread_field_groupname'), 'formtype' => 'text', 'datatype' => 'string'),
'groupurl' => array('name' => lang('blockclass', 'blockclass_groupthread_field_groupurl'), 'formtype' => 'text', 'datatype' => 'string'),
);
}
function fieldsconvert() {
return array(
'portal_article' => array(
'name' => lang('blockclass', 'blockclass_portal_article'),
'script' => 'article',
'searchkeys' => array('author', 'authorid', 'groupurl', 'groupname', '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'),
),
'forum_thread' => array(
'name' => lang('blockclass', 'blockclass_forum_thread'),
'script' => 'thread',
'replacekeys' => array('forumname', 'forumurl'),
'searchkeys' => array('groupname', 'groupurl'),
),
);
}
function getsetting() {
global $_G;
$settings = $this->setting;
if($settings['gtids']) {
loadcache('grouptype');
$settings['gtids']['value'][] = array(0, lang('portalcp', 'block_all_type'));
foreach($_G['cache']['grouptype']['first'] as $gid=>$group) {
$settings['gtids']['value'][] = array($gid, $group['name']);
if($group['secondlist']) {
foreach($group['secondlist'] as $subgid) {
$settings['gtids']['value'][] = array($subgid, '&nbsp;&nbsp;'.$_G['cache']['grouptype']['second'][$subgid]['name']);
}
}
}
}
return $settings;
}
function getdata($style, $parameter) {
global $_G;
$parameter = $this->cookparameter($parameter);
loadcache('grouptype');
$typeids = array();
if(!empty($parameter['gtids'])) {
if(isset($parameter['gtids'][0]) && $parameter['gtids'][0] == '0') {
unset($parameter['gtids'][0]);
}
$typeids = $parameter['gtids'];
}
$tids = !empty($parameter['tids']) ? explode(',', $parameter['tids']) : array();
$fids = !empty($parameter['fids']) ? explode(',', $parameter['fids']) : array();
$uids = !empty($parameter['uids']) ? explode(',', $parameter['uids']) : array();
$keyword = !empty($parameter['keyword']) ? $parameter['keyword'] : '';
$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;
$special = isset($parameter['special']) ? $parameter['special'] : array();
$lastpost = isset($parameter['lastpost']) ? intval($parameter['lastpost']) : 0;
$postdateline = isset($parameter['postdateline']) ? intval($parameter['postdateline']) : 0;
$rewardstatus = isset($parameter['rewardstatus']) ? intval($parameter['rewardstatus']) : 0;
$titlelength = !empty($parameter['titlelength']) ? intval($parameter['titlelength']) : 40;
$summarylength = !empty($parameter['summarylength']) ? intval($parameter['summarylength']) : 80;
$orderby = in_array($parameter['orderby'], array('dateline','replies','views','threads', 'heats', 'recommends')) ? $parameter['orderby'] : 'lastpost';
$picrequired = !empty($parameter['picrequired']) ? 1 : 0;
$gviewperm = isset($parameter['gviewperm']) ? intval($parameter['gviewperm']) : -1;
$highlight = !empty($parameter['highlight']) ? 1 : 0;
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
$gviewwhere = $gviewperm == -1 ? '' : " AND ff.gviewperm='$gviewperm'";
$groups = array();
if(empty($fids) && $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).") AND threads > 0$gviewwhere");
while($value = DB::fetch($query)) {
$groups[$value['fid']] = $value;
$fids[] = intval($value['fid']);
}
if(empty($fids)){
return array('html' => '', 'data' => '');
}
}
require_once libfile('function/post');
require_once libfile('function/search');
$datalist = $list = $listtids = $pictids = $pics = $threadtids = $threads = array();
$threadtypeids = array();
$keyword = $keyword ? searchkey($keyword, "t.subject LIKE '%{text}%'") : '';
$sql = ($fids ? ' AND t.fid IN ('.dimplode($fids).')' : '')
.($tids ? ' AND t.tid IN ('.dimplode($tids).')' : '')
.($bannedids ? ' AND t.tid NOT IN ('.dimplode($bannedids).')' : '')
.($uids ? ' AND t.authorid IN ('.dimplode($uids).')' : '')
.($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).')' : '')
.$keyword;
if(empty($fids)) {
$sql .= " AND t.isgroup='1'";
if($gviewwhere) {
$sql .= $gviewwhere;
}
}
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 AND ti.tid>0";
$sqlfield = ', ti.attachment as attachmenturl, ti.remote';
}
if(empty($fids)) {
$sqlfield .= ', f.name groupname';
$sqlfrom .= ' LEFT JOIN '.DB::table('forum_forum').' f ON t.fid=f.fid LEFT JOIN '.DB::table('forum_forumfield').' ff ON f.fid = ff.fid';
}
$query = DB::query("SELECT t.* $sqlfield
FROM `".DB::table('forum_thread')."` t
$sqlfrom WHERE t.readperm='0'
$sql
AND t.displayorder>='0'
ORDER BY t.$orderby DESC
LIMIT $startrow,$items;"
);
require_once libfile('block_thread', 'class/block/forum');
$bt = new block_thread();
while($data = DB::fetch($query)) {
if($data['closed'] > 1 && $data['closed'] < $data['tid']) continue;
$_G['block_thread'][$data['tid']] = $data;
if($style['getsummary']) {
$threadtids[$data['posttableid']][] = $data['tid'];
}
$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'],
'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'])),
'icon' => 'forum/'.$data['icon'],
'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']),
'dateline' => $data['dateline'],
'lastpost' => $data['lastpost'],
'posts' => $data['posts'],
'todayposts' => $data['todayposts'],
'replies' => $data['replies'],
'views' => $data['views'],
'heats' => $data['heats'],
'recommends' => $data['recommends'],
'groupname' => empty($groups[$data['fid']]['name']) ? $data['groupname'] : $groups[$data['fid']]['name'],
'groupurl' => 'forum.php?mod=group&fid='.$data['fid'],
)
);
if($highlight && $data['highlight']) {
$list[$data['tid']]['fields']['showstyle'] = $bt->getthreadstyle($data['highlight']);
}
}
$threads = $bt->getthread($threadtids, $summarylength);
if($threads) {
foreach($threads as $tid => $var) {
$list[$tid]['summary'] = $var;
}
}
if($listtids) {
foreach($listtids as $key => $value) {
$datalist[] = $list[$value];
}
}
return array('html' => '', 'data' => $datalist);
}
}
?>

View File

@@ -0,0 +1,102 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_groupthreadhot.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_groupthread', 'class/block/group');
class block_groupthreadhot extends block_groupthread {
function __construct() {
$this->setting = array(
'gtids' => array(
'title' => 'groupthread_gtids',
'type' => 'mselect',
'value' => array(
),
),
'special' => array(
'title' => 'groupthread_special',
'type' => 'mcheckbox',
'value' => array(
array(1, 'groupthread_special_1'),
array(2, 'groupthread_special_2'),
array(3, 'groupthread_special_3'),
array(4, 'groupthread_special_4'),
array(5, 'groupthread_special_5'),
array(0, 'groupthread_special_0'),
)
),
'rewardstatus' => array(
'title' => 'groupthread_special_reward',
'type' => 'mradio',
'value' => array(
array(0, 'groupthread_special_reward_0'),
array(1, 'groupthread_special_reward_1'),
array(2, 'groupthread_special_reward_2')
),
'default' => 0,
),
'picrequired' => array(
'title' => 'groupthread_picrequired',
'type' => 'radio',
'value' => '0'
),
'orderby' => array(
'title' => 'groupthread_orderby',
'type'=> 'mradio',
'value' => array(
array('replies', 'groupthread_orderby_replies'),
array('views', 'groupthread_orderby_views'),
array('heats', 'groupthread_orderby_heats'),
array('recommends', 'groupthread_orderby_recommends'),
),
'default' => 'replies'
),
'lastpost' => array(
'title' => 'groupthread_lastpost',
'type'=> 'mradio',
'value' => array(
array('0', 'groupthread_lastpost_nolimit'),
array('3600', 'groupthread_lastpost_hour'),
array('86400', 'groupthread_lastpost_day'),
array('604800', 'groupthread_lastpost_week'),
array('2592000', 'groupthread_lastpost_month'),
),
'default' => '0'
),
'gviewperm' => array(
'title' => 'groupthread_gviewperm',
'type' => 'mradio',
'value' => array(
array('0', 'groupthread_gviewperm_only_member'),
array('1', 'groupthread_gviewperm_all_member')
),
'default' => '1'
),
'titlelength' => array(
'title' => 'groupthread_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'groupthread_summarylength',
'type' => 'text',
'default' => 80
),
);
}
function name() {
return lang('blockclass', 'blockclass_groupthread_script_groupthreadhot');
}
}
?>

View File

@@ -0,0 +1,101 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_groupthreadnew.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_groupthread', 'class/block/group');
class block_groupthreadnew extends block_groupthread {
function __construct() {
$this->setting = array(
'gtids' => array(
'title' => 'groupthread_gtids',
'type' => 'mselect',
'value' => array(
),
),
'special' => array(
'title' => 'groupthread_special',
'type' => 'mcheckbox',
'value' => array(
array(1, 'groupthread_special_1'),
array(2, 'groupthread_special_2'),
array(3, 'groupthread_special_3'),
array(4, 'groupthread_special_4'),
array(5, 'groupthread_special_5'),
array(0, 'groupthread_special_0'),
)
),
'rewardstatus' => array(
'title' => 'groupthread_special_reward',
'type' => 'mradio',
'value' => array(
array(0, 'groupthread_special_reward_0'),
array(1, 'groupthread_special_reward_1'),
array(2, 'groupthread_special_reward_2')
),
'default' => 0,
),
'picrequired' => array(
'title' => 'groupthread_picrequired',
'type' => 'radio',
'value' => '0'
),
'orderby' => array(
'title' => 'groupthread_orderby',
'type'=> 'mradio',
'value' => array(
array('lastpost', 'groupthread_orderby_lastpost'),
array('dateline', 'groupthread_orderby_dateline'),
),
'default' => 'lastpost'
),
'lastpost' => array(
'title' => 'groupthread_lastpost',
'type'=> 'mradio',
'value' => array(
array('0', 'groupthread_lastpost_nolimit'),
array('3600', 'groupthread_lastpost_hour'),
array('86400', 'groupthread_lastpost_day'),
array('604800', 'groupthread_lastpost_week'),
array('2592000', 'groupthread_lastpost_month'),
),
'default' => '0'
),
'gviewperm' => array(
'title' => 'groupthread_gviewperm',
'type' => 'mradio',
'value' => array(
array('0', 'groupthread_gviewperm_only_member'),
array('1', 'groupthread_gviewperm_all_member')
),
'default' => '1'
),
'titlelength' => array(
'title' => 'groupthread_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'groupthread_summarylength',
'type' => 'text',
'default' => 80
),
);
}
function name() {
return lang('blockclass', 'blockclass_groupthread_script_groupthreadnew');
}
}
?>

View File

@@ -0,0 +1,80 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_groupthreadspecial.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_groupthread', 'class/block/group');
class block_groupthreadspecial extends block_groupthread {
function __construct() {
$this->setting = array(
'gtids' => array(
'title' => 'groupthread_gtids',
'type' => 'mselect',
'value' => array(
),
),
'special' => array(
'title' => 'groupthread_special',
'type' => 'mcheckbox',
'value' => array(
array(1, 'groupthread_special_1'),
array(2, 'groupthread_special_2'),
array(3, 'groupthread_special_3'),
array(4, 'groupthread_special_4'),
array(5, 'groupthread_special_5'),
),
'default' => array(0)
),
'rewardstatus' => array(
'title' => 'groupthread_special_reward',
'type' => 'mradio',
'value' => array(
array(0, 'groupthread_special_reward_0'),
array(1, 'groupthread_special_reward_1'),
array(2, 'groupthread_special_reward_2')
),
'default' => 0,
),
'picrequired' => array(
'title' => 'groupthread_picrequired',
'type' => 'radio',
'value' => '0'
),
'gviewperm' => array(
'title' => 'groupthread_gviewperm',
'type' => 'mradio',
'value' => array(
array('0', 'groupthread_gviewperm_only_member'),
array('1', 'groupthread_gviewperm_all_member')
),
'default' => '1'
),
'titlelength' => array(
'title' => 'groupthread_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'groupthread_summarylength',
'type' => 'text',
'default' => 80
),
);
}
function name() {
return lang('blockclass', 'blockclass_groupthread_script_groupthreadspecial');
}
}
?>

View File

@@ -0,0 +1,76 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_groupthreadspecified.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_groupthread', 'class/block/group');
class block_groupthreadspecified extends block_groupthread {
function __construct() {
$this->setting = array(
'tids' => array(
'title' => 'groupthread_tids',
'type' => 'text'
),
'fids' => array(
'title' => 'groupthread_fids',
'type' => 'text'
),
'uids' => array(
'title' => 'groupthread_uids',
'type' => 'text'
),
'special' => array(
'title' => 'groupthread_special',
'type' => 'mcheckbox',
'value' => array(
array(1, 'groupthread_special_1'),
array(2, 'groupthread_special_2'),
array(3, 'groupthread_special_3'),
array(4, 'groupthread_special_4'),
array(5, 'groupthread_special_5'),
array(0, 'groupthread_special_0'),
)
),
'rewardstatus' => array(
'title' => 'groupthread_special_reward',
'type' => 'mradio',
'value' => array(
array(0, 'groupthread_special_reward_0'),
array(1, 'groupthread_special_reward_1'),
array(2, 'groupthread_special_reward_2')
),
'default' => 0,
),
'picrequired' => array(
'title' => 'groupthread_picrequired',
'type' => 'radio',
'value' => '0'
),
'titlelength' => array(
'title' => 'groupthread_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'groupthread_summarylength',
'type' => 'text',
'default' => 80
),
);
}
function name() {
return lang('blockclass', 'blockclass_groupthread_script_groupthreadspecified');
}
}
?>

View File

@@ -0,0 +1,319 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_grouptrade.php 32768 2013-03-07 09:40:05Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class block_grouptrade extends discuz_block {
var $setting = array();
function __construct(){
$this->setting = array(
'tids' => array(
'title' => 'grouptrade_tids',
'type' => 'text'
),
'uids' => array(
'title' => 'grouptrade_uids',
'type' => 'text'
),
'keyword' => array(
'title' => 'grouptrade_keyword',
'type' => 'text'
),
'fids' => array(
'title' => 'grouptrade_fids',
'type' => 'text'
),
'gtids' => array(
'title' => 'grouptrade_gtids',
'type' => 'mselect',
'value' => array(
),
),
'digest' => array(
'title' => 'grouptrade_digest',
'type' => 'mcheckbox',
'value' => array(
array(1, 'grouptrade_digest_1'),
array(2, 'grouptrade_digest_2'),
array(3, 'grouptrade_digest_3'),
array(0, 'grouptrade_digest_0')
),
),
'stick' => array(
'title' => 'grouptrade_stick',
'type' => 'mcheckbox',
'value' => array(
array(1, 'grouptrade_stick_1'),
array(2, 'grouptrade_stick_2'),
array(3, 'grouptrade_stick_3'),
array(0, 'grouptrade_stick_0')
),
),
'recommend' => array(
'title' => 'grouptrade_recommend',
'type' => 'radio'
),
'orderby' => array(
'title' => 'grouptrade_orderby',
'type'=> 'mradio',
'value' => array(
array('dateline', 'grouptrade_orderby_dateline'),
array('todayhots', 'grouptrade_orderby_todayhots'),
array('weekhots', 'grouptrade_orderby_weekhots'),
array('monthhots', 'grouptrade_orderby_monthhots'),
),
'default' => 'dateline'
),
'gviewperm' => array(
'title' => 'grouptrade_gviewperm',
'type' => 'mradio',
'value' => array(
array('-1', 'grouptrade_gviewperm_nolimit'),
array('0', 'grouptrade_gviewperm_only_member'),
array('1', 'grouptrade_gviewperm_all_member')
),
'default' => '-1'
),
'highlight' => array(
'title' => 'grouptrade_highlight',
'type' => 'radio',
'default' => 0,
),
'titlelength' => array(
'title' => 'grouptrade_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'grouptrade_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'grouptrade_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_grouptrade_script_grouptrade');
}
function blockclass() {
return array('trade', lang('blockclass', 'blockclass_group_trade'));
}
function fields() {
return array(
'id' => array('name' => lang('blockclass', 'blockclass_field_id'), 'formtype' => 'text', 'datatype' => 'int'),
'url' => array('name' => lang('blockclass', 'blockclass_grouptrade_field_url'), 'formtype' => 'text', 'datatype' => 'string'),
'title' => array('name' => lang('blockclass', 'blockclass_grouptrade_field_title'), 'formtype' => 'title', 'datatype' => 'title'),
'pic' => array('name' => lang('blockclass', 'blockclass_grouptrade_field_pic'), 'formtype' => 'pic', 'datatype' => 'pic'),
'summary' => array('name' => lang('blockclass', 'blockclass_grouptrade_field_summary'), 'formtype' => 'summary', 'datatype' => 'summary'),
'totalitems' => array('name' => lang('blockclass', 'blockclass_grouptrade_field_totalitems'), 'formtype' => 'text', 'datatype' => 'int'),
'author' => array('name' => lang('blockclass', 'blockclass_grouptrade_field_author'), 'formtype' => 'text', 'datatype' => 'text'),
'authorid' => array('name' => lang('blockclass', 'blockclass_grouptrade_field_authorid'), 'formtype' => 'text', 'datatype' => 'int'),
'price' => array('name' => lang('blockclass', 'blockclass_grouptrade_field_price'), 'formtype' => 'text', 'datatype' => 'text'),
);
}
function fieldsconvert() {
return array(
'forum_trade' => array(
'name' => lang('blockclass', 'blockclass_forum_trade'),
'script' => 'trade',
'searchkeys' => array(),
'replacekeys' => array(),
),
);
}
function getsetting() {
global $_G;
$settings = $this->setting;
if($settings['gtids']) {
loadcache('grouptype');
$settings['gtids']['value'][] = array(0, lang('portalcp', 'block_all_type'));
foreach($_G['cache']['grouptype']['first'] as $gid=>$group) {
$settings['gtids']['value'][] = array($gid, $group['name']);
if($group['secondlist']) {
foreach($group['secondlist'] as $subgid) {
$settings['gtids']['value'][] = array($subgid, '&nbsp;&nbsp;'.$_G['cache']['grouptype']['second'][$subgid]['name']);
}
}
}
}
return $settings;
}
function getdata($style, $parameter) {
global $_G;
$parameter = $this->cookparameter($parameter);
loadcache('grouptype');
$typeids = array();
if(!empty($parameter['gtids'])) {
if($parameter['gtids'][0] == '0') {
unset($parameter['gtids'][0]);
}
$typeids = $parameter['gtids'];
}
$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'] : '';
$highlight = !empty($parameter['highlight']) ? 1 : 0;
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
$gviewperm = isset($parameter['gviewperm']) ? intval($parameter['gviewperm']) : -1;
$gviewwhere = $gviewperm == -1 ? '' : " AND ff.gviewperm='$gviewperm'";
$groups = array();
if(empty($fids) && $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).") AND threads > 0$gviewwhere");
while($value = DB::fetch($query)) {
$groups[$value['fid']] = $value;
$fids[] = intval($value['fid']);
}
if(empty($fids)){
return array('html' => '', 'data' => '');
}
}
require_once libfile('function/post');
require_once libfile('function/search');
$datalist = $list = $listpids = $threadpids = $aid2pid = $attachtables = array();
$keyword = $keyword ? searchkey($keyword, "tr.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).')' : '');
if(empty($fids)) {
$sql .= " AND t.isgroup='1'";
if($gviewwhere) {
$sql .= $gviewwhere;
}
}
$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 = dgmdate(TIMESTAMP, 'w', getglobal('setting/timeformat')) - 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 = ' AND tr.dateline>='.$historytime;
$orderby = 'totalitems';
}
$where .= ($uids ? ' AND tr.sellerid IN ('.dimplode($uids).')' : '').$keyword;
$where .= ($bannedids ? ' AND tr.pid NOT IN ('.dimplode($bannedids).')' : '');
$where = "$sql AND t.displayorder>='0' $where";
$sqlfrom = " INNER JOIN `".DB::table('forum_thread')."` t ON t.tid=tr.tid ";
$joinmethod = empty($tids) ? 'INNER' : 'LEFT';
if($recommend) {
$sqlfrom .= " $joinmethod JOIN `".DB::table('forum_forumrecommend')."` fc ON fc.tid=tr.tid";
}
$sqlfield = '';
if(empty($fids)) {
$sqlfield = ', f.name groupname';
$sqlfrom .= ' LEFT JOIN '.DB::table('forum_forum').' f ON t.fid=f.fid LEFT JOIN '.DB::table('forum_forumfield').' ff ON f.fid = ff.fid';
}
$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$sqlfield
FROM ".DB::table('forum_trade')." tr $sqlfrom
WHERE 1$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'],
'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/grouptrade', 'grouptrade_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,67 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_grouptradehot.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_grouptrade', 'class/block/group');
class block_grouptradehot extends block_grouptrade {
function __construct() {
$this->setting = array(
'gtids' => array(
'title' => 'grouptrade_gtids',
'type' => 'mselect',
'value' => array(
),
),
'orderby' => array(
'title' => 'grouptrade_orderby',
'type'=> 'mradio',
'value' => array(
array('todayhots', 'grouptrade_orderby_todayhots'),
array('weekhots', 'grouptrade_orderby_weekhots'),
array('monthhots', 'grouptrade_orderby_monthhots'),
),
'default' => 'weekhots'
),
'gviewperm' => array(
'title' => 'grouptrade_gviewperm',
'type' => 'mradio',
'value' => array(
array('0', 'grouptrade_gviewperm_only_member'),
array('1', 'grouptrade_gviewperm_all_member')
),
'default' => '1'
),
'titlelength' => array(
'title' => 'grouptrade_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'grouptrade_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'grouptrade_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_grouptrade_script_grouptradehot');
}
}
?>

View File

@@ -0,0 +1,62 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_grouptradenew.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_grouptrade', 'class/block/group');
class block_grouptradenew extends block_grouptrade {
function __construct() {
$this->setting = array(
'gtids' => array(
'title' => 'grouptrade_gtids',
'type' => 'mselect',
'value' => array(
),
),
'gviewperm' => array(
'title' => 'grouptrade_gviewperm',
'type' => 'mradio',
'value' => array(
array('0', 'grouptrade_gviewperm_only_member'),
array('1', 'grouptrade_gviewperm_all_member')
),
'default' => '1'
),
'titlelength' => array(
'title' => 'grouptrade_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'grouptrade_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'grouptrade_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_grouptrade_script_grouptradenew');
}
function cookparameter($parameter) {
$parameter['orderby'] = 'dateline';
return parent::cookparameter($parameter);
}
}
?>

View File

@@ -0,0 +1,59 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_grouptradespecified.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_grouptrade', 'class/block/group');
class block_grouptradespecified extends block_grouptrade {
function __construct() {
$this->setting = array(
'tids' => array(
'title' => 'grouptrade_tids',
'type' => 'text'
),
'uids' => array(
'title' => 'grouptrade_uids',
'type' => 'text'
),
'keyword' => array(
'title' => 'grouptrade_keyword',
'type' => 'text'
),
'fids' => array(
'title' => 'grouptrade_fids',
'type' => 'text'
),
'gtids' => array(
'title' => 'grouptrade_gtids',
'type' => 'mselect',
'value' => array(
),
),
'titlelength' => array(
'title' => 'grouptrade_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'grouptrade_summarylength',
'type' => 'text',
'default' => 80
),
);
}
function name() {
return lang('blockclass', 'blockclass_grouptrade_script_grouptradespecified');
}
}
?>

View File

@@ -0,0 +1,20 @@
<?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_group'),
);
?>

View File

View File

@@ -0,0 +1,71 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_adv.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('commonblock_html', 'class/block/html');
class block_adv extends commonblock_html {
function __construct() {}
function name() {
return lang('blockclass', 'blockclass_html_script_adv');
}
function getsetting() {
global $_G;
$settings = array(
'adv' => array(
'title' => 'adv_adv',
'type' => 'mradio',
'value' => array(),
),
'title' => array(
'title' => 'adv_title',
'type' => 'text',
)
);
foreach(C::t('common_advertisement_custom')->fetch_all_data() as $value) {
$settings['adv']['value'][] = array($value['name'], $value['name']);
}
return $settings;
}
function getdata($style, $parameter) {
$advid = 0;
if(!empty($parameter['title'])) {
$adv = C::t('common_advertisement_custom')->fetch_by_name($parameter['title']);
if(empty($adv)) {
$advid = C::t('common_advertisement_custom')->insert(array('name' => $parameter['title']), true);
} else {
$advid = $adv['id'];
}
} elseif(!empty($parameter['adv'])) {
$adv = C::t('common_advertisement_custom')->fetch_by_name($parameter['adv']);
$advid = intval($adv['id']);
} else {
$return = 'Empty Ads';
}
if($advid) {
$flag = false;
if(getglobal('inajax')) {
$flag = true;
setglobal('inajax', 0);
}
$return = adshow('custom_'.$advid);
if($flag) setglobal('inajax', 1);
}
return array('html' => $return, 'data' => null);
}
}
?>

View File

@@ -0,0 +1,107 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_announcement.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class block_announcement extends discuz_block {
var $setting = array();
function __construct(){
$this->setting = array(
'type' => array(
'title' => 'announcement_type',
'type' => 'mcheckbox',
'value' => array(
array('0', 'announcement_type_text'),
array('1', 'announcement_type_link'),
),
'default' => array('0')
),
'titlelength' => array(
'title' => 'announcement_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'announcement_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'announcement_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_announcement_script_announcement');
}
function blockclass() {
return array('announcement', lang('blockclass', 'blockclass_html_announcement'));
}
function fields() {
return array(
'url' => array('name' => lang('blockclass', 'blockclass_announcement_field_url'), 'formtype' => 'text', 'datatype' => 'string'),
'title' => array('name' => lang('blockclass', 'blockclass_announcement_field_title'), 'formtype' => 'title', 'datatype' => 'title'),
'summary' => array('name' => lang('blockclass', 'blockclass_announcement_field_summary'), 'formtype' => 'summary', 'datatype' => 'summary'),
'starttime' => array('name' => lang('blockclass', 'blockclass_announcement_field_starttime'), 'formtype' => 'text', 'datatype' => 'date'),
'endtime' => array('name' => lang('blockclass', 'blockclass_announcement_field_endtime'), 'formtype' => 'text', 'datatype' => 'date'),
);
}
function getsetting() {
global $_G;
$settings = $this->setting;
return $settings;
}
function getdata($style, $parameter) {
global $_G;
$type = !empty($parameter['type']) && is_array($parameter['type']) ? array_map('intval', $parameter['type']) : array('0');
$titlelength = !empty($parameter['titlelength']) ? intval($parameter['titlelength']) : 40;
$summarylength = !empty($parameter['summarylength']) ? intval($parameter['summarylength']) : 80;
$startrow = !empty($parameter['startrow']) ? intval($parameter['startrow']) : '0';
$items = !empty($parameter['items']) ? intval($parameter['items']) : 10;
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
$time = TIMESTAMP;
$list = array();
foreach(C::t('forum_announcement')->fetch_all_by_time($time, $type, $bannedids, $startrow, $items) as $data) {
$list[] = array(
'id' => $data['id'],
'idtype' => 'announcementid',
'title' => cutstr(str_replace('\\\'', '&#39;', strip_tags($data['subject'])), $titlelength, ''),
'url' => $data['type']=='1' ? $data['message'] : 'forum.php?mod=announcement&id='.$data['id'],
'pic' => '',
'picflag' => '',
'summary' => cutstr(str_replace('\\\'', '&#39;', $data['message']), $summarylength, ''),
'fields' => array(
'starttime' => $data['starttime'],
'endtime' => $data['endtime'],
)
);
}
return array('html' => '', 'data' => $list);
}
}
?>

View File

@@ -0,0 +1,83 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_banner.php 28625 2012-03-06 09:09:49Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('commonblock_html', 'class/block/html');
class block_banner extends commonblock_html {
function __construct() {}
function name() {
return lang('blockclass', 'blockclass_html_script_banner');
}
function getsetting() {
global $_G;
$settings = array(
'pic' => array(
'title' => 'banner_pic',
'type' => 'mfile',
'default' => 'http://'
),
'url' => array(
'title' => 'banner_url',
'type' => 'text',
'default' => ''
),
'atarget' => array(
'title' => 'banner_atarget',
'type' => 'select',
'value' => array(
array('_blank', 'banner_atarget_blank'),
array('_self', 'banner_atarget_self'),
array('_top', 'banner_atarget_top'),
),
'default' => '_blank'
),
'width' => array(
'title' => 'banner_width',
'type' => 'text',
'default' => '100%'
),
'height' => array(
'title' => 'banner_height',
'type' => 'text',
'default' => ''
),
'text' => array(
'title' => 'banner_text',
'type' => 'textarea',
'default' => ''
),
);
return $settings;
}
function getdata($style, $parameter) {
$parameter = dhtmlspecialchars($this->cookparameter($parameter));
$return = '<img src="'.$parameter['pic'].'"'
.($parameter['width'] ? ' width="'.$parameter['width'].'"' : '')
.($parameter['height'] ? ' height="'.$parameter['height'].'"' : '')
.($parameter['text'] ? ' alt="'.$parameter['text'].'" title="'.$parameter['text'].'"' : '')
.' />';
if($parameter['url']) {
$target = $parameter['atarget'] ? " target=\"{$parameter['atarget']}\"" : '';
$return = "<a href=\"{$parameter['url']}\"$target>$return</a>";
}
return array('html' => $return, 'data' => null);
}
}
?>

View File

@@ -0,0 +1,42 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_blank.php 27543 2012-02-03 08:56:21Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('commonblock_html', 'class/block/html');
class block_blank extends commonblock_html {
function __construct() {}
function name() {
return lang('blockclass', 'blockclass_html_script_blank');
}
function getsetting() {
global $_G;
$settings = array(
'content' => array(
'title' => 'blank_content',
'type' => 'mtextarea'
)
);
return $settings;
}
function getdata($style, $parameter) {
require_once libfile('function/home');
$return = getstr($parameter['content'], '', 1, 0, 0, 1);
return array('html' => $return, 'data' => null);
}
}
?>

View File

@@ -0,0 +1,66 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_forumtree.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('commonblock_html', 'class/block/html');
class block_forumtree extends commonblock_html {
function __construct() {}
function name() {
return lang('blockclass', 'blockclass_html_script_forumtree');
}
function getsetting() {
global $_G;
$settings = array(
'fids' => array(
'title' => 'forumtree_fids',
'type' => 'mselect',
'value' => array()
),
);
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;
if(!$_G['cache']['forums']) {
loadcache('forums');
}
$forumlist = array();
$parameter['fids'] = (array)$parameter['fids'];
$parameter['fids'] = array_map('intval', $parameter['fids']);
foreach($_G['cache']['forums'] as $forum) {
if(!$forum['status']) {
continue;
}
if(!$parameter['fids'] || in_array(0, $parameter['fids']) || in_array($forum['fid'], $parameter['fids'])) {
$forum['name'] = addslashes($forum['name']);
$forum['type'] != 'group' && $haschild[$forum['fup']] = true;
$forumlist[] = $forum;
}
}
include template('common/block_forumtree');
return array('html' => $return, 'data' => null);
}
}
?>

View File

@@ -0,0 +1,108 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_friendlink.php 24531 2011-09-23 05:45:11Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('commonblock_html', 'class/block/html');
class block_friendlink extends commonblock_html {
function __construct() {}
function name() {
return lang('blockclass', 'blockclass_html_script_friendlink');
}
function getsetting() {
global $_G;
$settings = array(
'content' => array(
'title' => 'friendlink_content',
'type' => 'mradio',
'value' => array(
array('both', 'friendlink_content_both'),
array('logo', 'friendlink_content_logo'),
array('text', 'friendlink_content_text')
),
'default' => 'both'
),
'type' => array(
'title' => 'friendlink_type',
'type' => 'mcheckbox',
'value' => array(
array('1', 'friendlink_type_group1'),
array('2', 'friendlink_type_group2'),
array('3', 'friendlink_type_group3'),
array('4', 'friendlink_type_group4'),
),
'default' => array('1','2','3','4')
)
);
return $settings;
}
function getdata($style, $parameter) {
$type = !empty($parameter['type']) && is_array($parameter) ? $parameter['type'] : array();
$b = '0000';
for($i=1;$i<=4;$i++) {
if(in_array($i, $type)) {
$b[$i-1] = '1';
}
}
$type = intval($b, '2');
$query = C::t('common_friendlink')->fetch_all_by_displayorder($type);
$group1 = $group2 = $group3 = array();
foreach ($query as $value) {
if($parameter['content']=='logo') {
$group2[] = $value;
} elseif($parameter['content']=='text') {
$group3[] = $value;
} else {
if($value['description']) {
$group1[] = $value;
} elseif($value['logo']) {
$group2[] = $value;
} else {
$group3[] = $value;
}
}
}
$return = '<div class="bn lk">';
if($group1) {
$return .= '<ul class="m cl">';
foreach($group1 as $value) {
$return .= '<li class="cl">'
. '<div class="forumlogo"><a target="_blank" href="'.$value['url'].'"><img border="0" alt="'.$value['name'].'" src="'.$value['logo'].'"></a></div>'
. '<div class="forumcontent"><h5><a target="_blank" href="'.$value['url'].'">'.$value['name'].'</a></h5><p>'.$value['description'].'</p></div>'
. '</li>';
}
$return .= '</ul>';
}
if($group2) {
$return .= '<div class="cl mbm">';
foreach($group2 as $value) {
$return .= '<a target="_blank" href="'.$value['url'].'"><img border="0" alt="'.$value['name'].'" src="'.$value['logo'].'"></a>';
}
$return .= '</div>';
}
if($group3) {
$return .= '<ul class="x cl">';
foreach($group3 as $value) {
$return .= '<li><a target="_blank" href="'.$value['url'].'">'.$value['name'].'</a></li>';
}
$return .= '</ul>';
}
$return .= '</div>';
return array('html' => $return, 'data' => null);
}
}
?>

View File

@@ -0,0 +1,62 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_google.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('commonblock_html', 'class/block/html');
class block_google extends commonblock_html {
function __construct() {}
function name() {
return lang('blockclass', 'blockclass_html_script_google');
}
function getsetting() {
global $_G;
$settings = array(
'lang' => array(
'title' => 'google_lang',
'type' => 'mradio',
'value' => array(
array('', 'google_lang_any'),
array('en', 'google_lang_en'),
array('zh-CN', 'google_lang_zh-CN'),
array('zh-TW', 'google_lang_zh-TW')
)
),
'default' => array(
'title' => 'google_default',
'type' => 'mradio',
'value' => array(
array(0, 'google_default_0'),
array(1, 'google_default_1'),
)
),
'client' => array(
'title' => 'google_client',
'type' => 'text',
),
);
return $settings;
}
function getdata($style, $parameter) {
$parameter = dhtmlspecialchars($this->cookparameter($parameter));
$return = '<script type="text/javascript">var google_host="'.$_SERVER['HTTP_HOST'].'",google_charset="'.CHARSET.'",google_client="'.$parameter['client'].'",google_hl="'.$parameter['lang'].'",google_lr="'.($parameter['lang'] ? 'lang_'.$parameter['lang'] : '').'";google_default_0="'.($parameter['default'] == 0 ? ' selected' : '').'";google_default_1="'.($parameter['default'] == 1 ? ' selected' : '').'";</script><script type="text/javascript" src="'.STATICURL.'js/google.js"></script>';
return array('html' => $return, 'data' => null);
}
}
?>

View File

@@ -0,0 +1,48 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_line.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('commonblock_html', 'class/block/html');
class block_line extends commonblock_html {
function __construct() {}
function name() {
return lang('blockclass', 'blockclass_html_script_line');
}
function getsetting() {
global $_G;
$settings = array(
'style' => array(
'title' => 'line_style',
'type' => 'mradio',
'value' => array(
array('dash', 'line_style_dash'),
array('line', 'line_style_line'),
),
'default' => 'dash'
)
);
return $settings;
}
function getdata($style, $parameter) {
$class = $parameter['style'] == 'line' ? 'l' : 'da';
$return = "<hr class='$class' />";
return array('html' => $return, 'data' => null);
}
}
?>

View File

@@ -0,0 +1,99 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_search.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('commonblock_html', 'class/block/html');
class block_search extends commonblock_html {
function __construct() {}
function name() {
return lang('blockclass', 'blockclass_html_script_search');
}
function getsetting() {
global $_G;
$settings = array();
return $settings;
}
function getdata($style, $parameter) {
global $_G;
$lang = lang('template');
$slist = array();
$checked = ' class="curtype"';
if($_G['setting']['search']) {
if($_G['setting']['search']['portal']['status']) {
$slist['portal'] = '<li><a href="javascript:;" rel="article"'.$checked.'>'.$lang['article'].'</a></li>';
$checked = '';
}
if($_G['setting']['search']['forum']['status']) {
$slist['forum'] = '<li><a href="javascript:;" rel="forum"'.$checked.'>'.$lang['thread'].'</a></li>';
$checked = '';
}
if ($_G['setting']['search']['blog']['status']) {
$slist['blog'] = '<li><a href="javascript:;" rel="blog"'.$checked.'>'.$lang['blog'].'</a></li>';
$checked = '';
}
if ($_G['setting']['search']['album']['status']) {
$slist['album'] = '<li><a href="javascript:;" rel="album"'.$checked.'>'.$lang['album'].'</a></li>';
$checked = '';
}
if ($_G['setting']['groupstatus'] && $_G['setting']['search']['group']['status']) {
$slist['group'] = '<li><a href="javascript:;" rel="group"'.$checked.'>'.$_G['setting']['navs'][3]['navname'].'</a></li>';
$checked = '';
}
$slist['user'] = '<li><a href="javascript:;" rel="user"'.$checked.'>'.$lang['users'].'</a></li>';
}
if($slist) {
$slist = implode('', $slist);
$hotsearch = '';
if ($_G['setting']['srchhotkeywords']) {
$hotsearch = '<strong class="xw1 xi1">'.$lang['hot_search'].': </strong>';
foreach($_G['setting']['srchhotkeywords'] as $val) {
$val = trim($val);
if($val) {
$hotsearch .= '<a href="search.php?mod=forum&srchtxt='.rawurlencode($val).'&formhash={FORMHASH}&searchsubmit=true" target="_blank" class="xi2">'.$val.'</a>';
}
}
}
$html = <<<EOT
<div id="scbar" class="cl" style="border-top: 1px solid #CCC;">
<form id="scbar_form" class="z" method="post" autocomplete="off" onsubmit="searchFocus($('srchtxt'))" action="search.php?searchsubmit=yes" target="_blank">
<input type="hidden" name="mod" id="scbar_mod" value="search" />
<input type="hidden" name="formhash" value="{FORMHASH}" />
<input type="hidden" name="srchtype" value="title" />
<table cellspacing="0" cellpadding="0">
<tr>
<td class="scbar_icon_td"></td>
<td class="scbar_txt_td"><input type="text" name="srchtxt" id="scbar_txt" class="xg1" value="{$lang['enter_content']}" autocomplete="off" onfocus="if(this.value=='{$lang['enter_content']}'){this.value='';this.className=''}" onblur="if(this.value==''){this.value='{$lang['enter_content']}';this.className='xg1'}" /></td>
<td class="scbar_type_td"><a href="javascript:;" id="scbar_type" class="showmenu xg1" onclick="showMenu({'ctrlid':this.id,'pos':'34'})">{$lang['search']}</a></td>
<td class="scbar_btn_td"><button type="submit" id="scbar_btn" name="searchsubmit" class="pn pnc" value="true"><strong class="xi2">{$lang['search']}</strong></button></td>
<td class="scbar_hot_td">
<div id="scbar_hot">
$hotsearch
</div>
</td>
</tr>
</table>
</form>
</div>
<ul id="scbar_type_menu" class="p_pop" style="display: none;">$slist</ul>
<script type="text/javascript">initSearchmenu('scbar');</script>
EOT;
}
return array('html' => $html, 'data' => null);
}
}
?>

View File

@@ -0,0 +1,274 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_sort.php 29557 2012-04-18 10:10:07Z svn_project_zhangjie $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('commonblock_html', 'class/block/html');
class block_sort extends commonblock_html {
var $setting = array();
function __construct(){
$this->setting = array(
'tids' => array(
'title' => 'sortlist_tids',
'type' => 'text'
),
'fids' => array(
'title' => 'sortlist_fids',
'type' => 'mselect',
'value' => array()
),
'sortids' => array(
'title' => 'sortlist_sortids',
'type' => 'mradio',
'value' => array()
),
'digest' => array(
'title' => 'sortlist_digest',
'type' => 'mcheckbox',
'value' => array(
array(1, 'sortlist_digest_1'),
array(2, 'sortlist_digest_2'),
array(3, 'sortlist_digest_3'),
array(0, 'sortlist_digest_0')
),
),
'stick' => array(
'title' => 'sortlist_stick',
'type' => 'mcheckbox',
'value' => array(
array(1, 'sortlist_stick_1'),
array(2, 'sortlist_stick_2'),
array(3, 'sortlist_stick_3'),
array(0, 'sortlist_stick_0')
),
),
'recommend' => array(
'title' => 'sortlist_recommend',
'type' => 'radio'
),
'orderby' => array(
'title' => 'sortlist_orderby',
'type'=> 'mradio',
'value' => array(
array('lastpost', 'sortlist_orderby_lastpost'),
array('dateline', 'sortlist_orderby_dateline'),
array('replies', 'sortlist_orderby_replies'),
array('views', 'sortlist_orderby_views'),
array('heats', 'sortlist_orderby_heats'),
array('recommends', 'sortlist_orderby_recommends'),
),
'default' => 'lastpost'
),
'lastpost' => array(
'title' => 'sortlist_lastpost',
'type'=> 'mradio',
'value' => array(
array('0', 'sortlist_lastpost_nolimit'),
array('3600', 'sortlist_lastpost_hour'),
array('86400', 'sortlist_lastpost_day'),
array('604800', 'sortlist_lastpost_week'),
array('2592000', 'sortlist_lastpost_month'),
),
'default' => '0'
),
'startrow' => array(
'title' => 'sortlist_startrow',
'type' => 'text',
'default' => 0
),
'showitems' => array(
'title' => 'sortlist_showitems',
'type' => 'text',
'default' => 10
),
);
}
function name() {
return lang('blockclass', 'blockclass_html_script_sort');
}
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']) {
$defaultvalue = '';
$query = DB::query("SELECT typeid, name, special FROM ".DB::table('forum_threadtype')." ORDER BY typeid DESC");
while($threadtype = DB::fetch($query)) {
if($threadtype['special']) {
if(empty($defaultvalue)) {
$defaultvalue = $threadtype['typeid'];
}
$settings['sortids']['value'][] = array($threadtype['typeid'], $threadtype['name']);
}
}
$settings['sortids']['default'] = $defaultvalue;
}
return $settings;
}
function getdata($style, $parameter) {
global $_G;
$parameter = $this->cookparameter($parameter);
loadcache('forums');
$tids = !empty($parameter['tids']) ? explode(',', $parameter['tids']) : array();
$fids = isset($parameter['fids']) && !in_array(0, (array)$parameter['fids']) ? $parameter['fids'] : array_keys($_G['cache']['forums']);
$startrow = !empty($parameter['startrow']) ? intval($parameter['startrow']) : 0;
$items = !empty($parameter['showitems']) ? intval($parameter['showitems']) : 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';
$lastpost = isset($parameter['lastpost']) ? intval($parameter['lastpost']) : 0;
$recommend = !empty($parameter['recommend']) ? 1 : 0;
$sortid = isset($parameter['sortids']) ? intval($parameter['sortids']) : '';
if($fids) {
$thefids = array();
foreach($fids as $fid) {
if($_G['cache']['forums'][$fid]['type']=='group') {
$thefids[] = $fid;
}
}
if($thefids) {
foreach($_G['cache']['forums'] as $value) {
if($value['fup'] && in_array($value['fup'], $thefids)) {
$fids[] = intval($value['fid']);
}
}
}
$fids = array_unique($fids);
}
$datalist = $list = array();
$threadtypeids = array();
$sql = ($tids ? ' AND t.tid IN ('.dimplode($tids).')' : '')
.($sortid ? ' AND t.sortid='.$sortid : '')
.($fids ? ' AND t.fid IN ('.dimplode($fids).')' : '')
.($digest ? ' AND t.digest IN ('.dimplode($digest).')' : '')
.($stick ? ' AND t.displayorder IN ('.dimplode($stick).')' : '')
." AND t.closed='0' AND t.isgroup='0'";
if($lastpost) {
$historytime = TIMESTAMP - $lastpost;
$sql .= " AND t.dateline>='$historytime'";
}
if($orderby == 'heats') {
$_G['setting']['indexhot']['days'] = !empty($_G['setting']['indexhot']['days']) ? intval($_G['setting']['indexhot']['days']) : 8;
$heatdateline = TIMESTAMP - 86400 * $_G['setting']['indexhot']['days'];
$sql .= " AND t.dateline>'$heatdateline' AND t.heats>'0'";
}
$sqlfrom = "FROM `".DB::table('forum_thread')."` t";
$joinmethod = empty($tids) ? 'INNER' : 'LEFT';
if($recommend) {
$sqlfrom .= " $joinmethod JOIN `".DB::table('forum_forumrecommend')."` fc ON fc.tid=t.tid";
}
require_once libfile('function/threadsort');
$templatearray = $sortoptionarray = array();
loadcache(array('threadsort_option_'.$sortid, 'threadsort_template_'.$sortid));
sortthreadsortselectoption($sortid);
$templatearray[$sortid] = $_G['cache']['threadsort_template_'.$sortid]['block'];
$sortoptionarray[$sortid] = $_G['cache']['threadsort_option_'.$sortid];
$isthreadtype = (strpos($templatearray[$sortid], '{typename}') !== false || strpos($templatearray[$sortid], '{typename_url}') !== false ) ? true : false;
$threadtypes = array();
if($isthreadtype && $fids) {
foreach(C::t('forum_forumfield')->fetch_all($fids) as $fid => $forum) {
$threadtypes[$fid] = dunserialize($forum['threadtypes']);
}
}
$html = '';
$threadlist = $verify = $verifyuids = array();
$query = DB::query("SELECT t.*
$sqlfrom WHERE 1 $sql
AND t.readperm='0'
AND t.displayorder>='0'
ORDER BY t.$orderby DESC
LIMIT $startrow,$items;"
);
while($thread = DB::fetch($query)) {
if(isset($_G['setting']['verify']['enabled']) && $_G['setting']['verify']['enabled']) {
$verifyuids[$thread['authorid']] = $thread['authorid'];
}
if($thread['highlight']) {
$color = array('', '#EE1B2E', '#EE5023', '#996600', '#3C9D40', '#2897C5', '#2B65B7', '#8F2A90', '#EC1282');
$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: '.$color[$string[1]] : '';
$thread['highlight'] .= '"';
} else {
$thread['highlight'] = '';
}
$thread['lastposterenc'] = rawurlencode($thread['lastposter']);
$fid = $thread['fid'];
if($thread['typeid'] && $isthreadtype && $threadtypes[$fid] && !empty($threadtypes[$fid]['prefix']) && isset($threadtypes[$fid]['types'][$thread['typeid']])) {
if($threadtypes[$fid]['prefix'] == 1) {
$thread['typehtml'] = '<em>[<a href="forum.php?mod=forumdisplay&fid='.$fid.'&amp;filter=typeid&amp;typeid='.$thread['typeid'].'">'.$threadtypes[$fid]['types'][$thread['typeid']].'</a>]</em>';
} elseif($threadtypes[$fid]['icons'][$thread['typeid']] && $threadtypes[$fid]['prefix'] == 2) {
$thread['typehtml'] = '<em><a title="'.$threadtypes[$fid]['types'][$thread['typeid']].'" href="forum.php?mod=forumdisplay&fid='.$fid.'&amp;filter=typeid&amp;typeid='.$thread['typeid'].'">'.'<img style="vertical-align: middle;padding-right:4px;" src="'.$threadtypes[$fid]['icons'][$thread['typeid']].'" alt="'.$threadtypes[$fid]['types'][$thread['typeid']].'" /></a></em>';
}
$thread['typename'] = $threadtypes[$fid]['types'][$thread['typeid']];
} else {
$thread['typename'] = $thread['typehtml'] = '';
}
$thread['dateline'] = dgmdate($thread['dateline'], 'u', '9999', getglobal('setting/dateformat'));
$thread['lastpost'] = dgmdate($thread['lastpost'], 'u');
$threadlist[$thread['tid']] = $thread;
}
if(!empty($threadlist)) {
if($verifyuids) {
foreach(C::t('common_member_verify')->fetch_all($verifyuids) as $value) {
foreach($_G['setting']['verify'] as $vid => $vsetting) {
if($vsetting['available'] && $vsetting['showicon'] && $value['verify'.$vid] == 1) {
$srcurl = '';
if(!empty($vsetting['icon'])) {
$srcurl = $vsetting['icon'];
}
$verify[$value['uid']] .= "<a href=\"home.php?mod=spacecp&ac=profile&op=verify&vid=$vid\" target=\"_blank\">".(!empty($srcurl) ? '<img src="'.$srcurl.'" class="vm" alt="'.$vsetting['title'].'" title="'.$vsetting['title'].'" />' : $vsetting['title']).'</a>';
}
}
}
}
$html = implode('', showsortmodetemplate($sortid, $fids, $sortoptionarray, $templatearray, $threadlist, array_keys($threadlist), $verify));
}
return array('html' => $html, 'data' => null);
}
}
?>

View File

@@ -0,0 +1,201 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_stat.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('commonblock_html', 'class/block/html');
class block_stat extends commonblock_html {
function __construct() {}
function name() {
return lang('blockclass', 'blockclass_html_script_stat');
}
function getsetting() {
global $_G;
$settings = array(
'option' => array(
'title' => 'stat_option',
'type' => 'mcheckbox',
'value' => array(
array('posts', 'stat_option_posts'),
array('groups', 'stat_option_groups'),
array('members', 'stat_option_members'),
array('groupnewposts', 'stat_option_groupnewposts'),
array('bbsnewposts', 'stat_option_bbsnewposts'),
array('bbslastposts', 'stat_option_bbslastposts'),
array('onlinemembers', 'stat_option_onlinemembers'),
array('maxmembers', 'stat_option_maxmembers'),
array('doings', 'stat_option_doings'),
array('blogs', 'stat_option_blogs'),
array('albums', 'stat_option_albums'),
array('pics', 'stat_option_pics'),
array('shares', 'stat_option_shares'),
),
'default' => array('posts', 'groups', 'members')
),
'tip' => array(
'title' => 'stat_edit_showtitle',
'type' => lang('block/stat', 'stat_edit_showtitle_detail'),
),
'posts_title' => array(
'title' => 'stat_option_posts',
'type' => 'text',
'default' => lang('block/stat', 'stat_posts')
),
'groups_title' => array(
'title' => 'stat_option_groups',
'type' => 'text',
'default' => lang('block/stat', 'stat_groups')
),
'members_title' => array(
'title' => 'stat_option_members',
'type' => 'text',
'default' => lang('block/stat', 'stat_members')
),
'groupnewposts_title' => array(
'title' => 'stat_option_groupnewposts',
'type' => 'text',
'default' => lang('block/stat', 'stat_groupnewposts')
),
'bbsnewposts_title' => array(
'title' => 'stat_option_bbsnewposts',
'type' => 'text',
'default' => lang('block/stat', 'stat_bbsnewposts')
),
'bbslastposts_title' => array(
'title' => 'stat_option_bbslastposts',
'type' => 'text',
'default' => lang('block/stat', 'stat_bbslastposts')
),
'onlinemembers_title' => array(
'title' => 'stat_option_onlinemembers',
'type' => 'text',
'default' => lang('block/stat', 'stat_onlinemembers')
),
'maxmembers_title' => array(
'title' => 'stat_option_maxmembers',
'type' => 'text',
'default' => lang('block/stat', 'stat_maxmembers')
),
'doings_title' => array(
'title' => 'stat_option_doings',
'type' => 'text',
'default' => lang('block/stat', 'stat_doings')
),
'blogs_title' => array(
'title' => 'stat_option_blogs',
'type' => 'text',
'default' => lang('block/stat', 'stat_blogs')
),
'albums_title' => array(
'title' => 'stat_option_albums',
'type' => 'text',
'default' => lang('block/stat', 'stat_albums')
),
'pics_title' => array(
'title' => 'stat_option_pics',
'type' => 'text',
'default' => lang('block/stat', 'stat_pics')
),
'shares_title' => array(
'title' => 'stat_option_shares',
'type' => 'text',
'default' => lang('block/stat', 'stat_shares')
),
);
return $settings;
}
function getdata($style, $parameter) {
$parameter = $this->cookparameter($parameter);
global $_G;
if(in_array('posts', $parameter['option']) || in_array('bbsnewposts', $parameter['option'])) {
$sql = "SELECT sum(f.posts) AS posts, sum(f.todayposts) AS todayposts FROM ".DB::table('forum_forum')." f WHERE f.status='1'";
$forum = DB::fetch_first($sql);
}
if(in_array('groups', $parameter['option']) || in_array('groupnewposts', $parameter['option'])) {
loadcache('groupindex');
}
$index = count($parameter['option']) - 1;
$html = '<div class="tns"><table cellspacing="0" cellpadding="4" border="0"><tbody><tr>';
if(in_array('posts', $parameter['option'])) {
$class = ($index-- == 0) ? ' class="bbn"' : '';
$html .= "<th$class><p>".intval($forum['posts']).'</p>'.(!empty($parameter['posts_title']) ? $parameter['posts_title'] : lang('block/stat', 'stat_posts')).'</th>';
}
if(in_array('groups', $parameter['option'])) {
$class = ($index-- == 0) ? ' class="bbn"' : '';
$html .= "<th$class><p>".intval($_G['cache']['groupindex']['groupnum']).'</p>'.(!empty($parameter['groups_title']) ? $parameter['groups_title'] : lang('block/stat', 'stat_groups')).'</th>';
}
if(in_array('members', $parameter['option'])) {
loadcache('userstats');
$class = ($index-- == 0) ? ' class="bbn"' : '';
$html .= "<th$class><p>".intval($_G['cache']['userstats']['totalmembers']).'</p>'.(!empty($parameter['members_title']) ? $parameter['members_title'] : lang('block/stat', 'stat_members')).'</th>';
}
if(in_array('groupnewposts', $parameter['option'])) {
$class = ($index-- == 0) ? ' class="bbn"' : '';
$html .= "<th$class><p>".intval($_G['cache']['groupindex']['todayposts']).'</p>'.(!empty($parameter['groupnewposts_title']) ? $parameter['groupnewposts_title'] : lang('block/stat', 'stat_groupnewposts')).'</th>';
}
if(in_array('bbsnewposts', $parameter['option'])) {
$class = ($index-- == 0) ? ' class="bbn"' : '';
$html .= "<th$class><p>".intval($forum['todayposts']).'</p>'.(!empty($parameter['bbsnewposts_title']) ? $parameter['bbsnewposts_title'] : lang('block/stat', 'stat_bbsnewposts')).'</th>';
}
if(in_array('bbslastposts', $parameter['option'])) {
loadcache('historyposts');
$postdata = $_G['cache']['historyposts'] ? explode("\t", $_G['cache']['historyposts']) : array();
$class = ($index-- == 0) ? ' class="bbn"' : '';
$html .= "<th$class><p>".intval($postdata[0]).'</p>'.(!empty($parameter['bbslastposts_title']) ? $parameter['bbslastposts_title'] : lang('block/stat', 'stat_bbslastposts')).'</th>';
}
if(in_array('onlinemembers', $parameter['option'])) {
$num = !empty($_G['cookie']['onlineusernum']) ? intval($_G['cookie']['onlineusernum']) : C::app()->session->count();
$class = ($index-- == 0) ? ' class="bbn"' : '';
$html .= "<th$class><p>".intval($num).'</p>'.(!empty($parameter['onlinemembers_title']) ? $parameter['onlinemembers_title'] : lang('block/stat', 'stat_onlinemembers')).'</th>';
}
if(in_array('maxmembers', $parameter['option'])) {
loadcache('onlinerecord');
$onlineinfo = explode("\t", $_G['cache']['onlinerecord']);
$num = !empty($onlineinfo[0]) ? intval($onlineinfo[0]) : 0;
$class = ($index-- == 0) ? ' class="bbn"' : '';
$html .= "<th$class><p>".intval($num).'</p>'.(!empty($parameter['maxmembers_title']) ? $parameter['maxmembers_title'] : lang('block/stat', 'stat_maxmembers')).'</th>';
}
if(in_array('doings', $parameter['option'])) {
$num = C::t('home_doing')->count();
$class = ($index-- == 0) ? ' class="bbn"' : '';
$html .= "<th$class><p>".intval($num).'</p>'.(!empty($parameter['doings_title']) ? $parameter['doings_title'] : lang('block/stat', 'stat_doings')).'</th>';
}
if(in_array('blogs', $parameter['option'])) {
$num = C::t('home_blog')->count();
$class = ($index-- == 0) ? ' class="bbn"' : '';
$html .= "<th$class><p>".intval($num).'</p>'.(!empty($parameter['blogs_title']) ? $parameter['blogs_title'] : lang('block/stat', 'stat_blogs')).'</th>';
}
if(in_array('albums', $parameter['option'])) {
$num = C::t('home_album')->count();
$class = ($index-- == 0) ? ' class="bbn"' : '';
$html .= "<th$class><p>".intval($num).'</p>'.(!empty($parameter['albums_title']) ? $parameter['albums_title'] : lang('block/stat', 'stat_albums')).'</th>';
}
if(in_array('pics', $parameter['option'])) {
$num = C::t('home_pic')->count();
$class = ($index-- == 0) ? ' class="bbn"' : '';
$html .= "<th$class><p>".intval($num).'</p>'.(!empty($parameter['pics_title']) ? $parameter['pics_title'] : lang('block/stat', 'stat_pics')).'</th>';
}
if(in_array('shares', $parameter['option'])) {
$num = C::t('home_share')->count();
$class = ($index-- == 0) ? ' class="bbn"' : '';
$html .= "<th$class><p>".intval($num).'</p>'.(!empty($parameter['shares_title']) ? $parameter['shares_title'] : lang('block/stat', 'stat_shares')).'</th>';
}
$html .= '</tr></tbody></table></div>';
return array('html' => $html, 'data' => null);
}
}
?>

View File

@@ -0,0 +1,60 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_vedio.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('commonblock_html', 'class/block/html');
class block_vedio extends commonblock_html {
function __construct() {}
function name() {
return lang('blockclass', 'blockclass_html_script_vedio');
}
function getsetting() {
global $_G;
$settings = array(
'url' => array(
'title' => 'vedio_url',
'type' => 'text',
'default' => 'http://'
),
'width' => array(
'title' => 'vedio_width',
'type' => 'text',
'default' => ''
),
'height' => array(
'title' => 'vedio_height',
'type' => 'text',
'default' => ''
),
);
return $settings;
}
function getdata($style, $parameter) {
require_once libfile('function/discuzcode');
$parameter['width'] = !empty($parameter['width']) ? intval($parameter['width']) : 'auto';
$parameter['height'] = !empty($parameter['height']) ? intval($parameter['height']) : 'auto';
$parameter['url'] = addslashes($parameter['url']);
$return = parseflv($parameter['url'], $parameter['width'], $parameter['height']);
if($return == false) {
$return = $parameter['url'];
}
return array('html' => $return, 'data' => null);
}
}
?>

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_html'),
);
?>

View File

@@ -0,0 +1,24 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: commonblock_html.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class commonblock_html extends discuz_block{
function fields() {
return array();
}
function blockclass() {
return array('html', lang('blockclass', 'blockclass_html_html'));
}
}

View File

View File

View File

@@ -0,0 +1,414 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_member.php 32370 2013-01-07 03:00:27Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class block_member extends discuz_block {
var $setting = array();
function __construct() {
$this->setting = array(
'uids' => array(
'title' => 'memberlist_uids',
'type' => 'text'
),
'groupid' => array(
'title' => 'memberlist_groupid',
'type' => 'mselect',
'value' => array()
),
'special' => array(
'title' => 'memberlist_special',
'type' => 'mradio',
'value' => array(
array('', 'memberlist_special_nolimit'),
array('0', 'memberlist_special_hot'),
array('1', 'memberlist_special_default'),
),
'default' => ''
),
'gender' => array(
'title' => 'memberlist_gender',
'type' => 'mradio',
'value' => array(
array('1', 'memberlist_gender_male'),
array('2', 'memberlist_gender_female'),
array('', 'memberlist_gender_nolimit'),
),
'default' => ''
),
'birthcity' => array(
'title' => 'memberlist_birthcity',
'type' => 'district',
'value' => array('xbirthcountry', 'xbirthprovince', 'xbirthcity', 'xbirthdist', 'xbirthcommunity'),
),
'residecity' => array(
'title' => 'memberlist_residecity',
'type' => 'district',
'value' => array('xresidecountry', 'xresideprovince', 'xresidecity', 'xresidedist', 'xresidecommunity')
),
'avatarstatus' => array(
'title' => 'memberlist_avatarstatus',
'type' => 'radio',
'default' => ''
),
'emailstatus' => array(
'title' => 'memberlist_emailstatus',
'type' => 'mcheckbox',
'value' => array(
array(1, 'memberlist_yes'),
),
'default' => ''
),
'secmobilestatus' => array(
'title' => 'memberlist_secmobilestatus',
'type' => 'mcheckbox',
'value' => array(
array(1, 'memberlist_yes'),
),
'default' => ''
),
'verifystatus' => array(
'title' => 'memberlist_verifystatus',
'type' => 'mcheckbox',
'value' => array(),
'default' => '',
),
'orderby' => array(
'title' => 'memberlist_orderby',
'type' => 'mradio',
'value' => array(
array('credits', 'memberlist_orderby_credits'),
array('extcredits', 'memberlist_orderby_extcredits'),
array('threads', 'memberlist_orderby_threads'),
array('posts', 'memberlist_orderby_posts'),
array('blogs', 'memberlist_orderby_blogs'),
array('doings', 'memberlist_orderby_doings'),
array('albums', 'memberlist_orderby_albums'),
array('sharings', 'memberlist_orderby_sharings'),
array('digestposts', 'memberlist_orderby_digestposts'),
array('regdate', 'memberlist_orderby_regdate'),
array('show', 'memberlist_orderby_show'),
array('special', 'memberlist_orderby_special'),
array('todayposts', 'memberlist_orderby_todayposts'),
),
'default' => 'credits'
),
'extcredit' => array(
'title' => 'memberlist_orderby_extcreditselect',
'type' => 'select',
'value' => array()
),
'lastpost' => array(
'title' => 'memberlist_lastpost',
'type' => 'mradio',
'value' => array(
array('', 'memberlist_lastpost_nolimit'),
array('3600', 'memberlist_lastpost_hour'),
array('86400', 'memberlist_lastpost_day'),
array('604800', 'memberlist_lastpost_week'),
array('2592000', 'memberlist_lastpost_month'),
),
'default' => ''
),
'startrow' => array(
'title' => 'memberlist_startrow',
'type' => 'text',
'default' => 0
),
);
$verifys = getglobal('setting/verify');
if(!empty($verifys)) {
foreach($verifys as $key => $value) {
if($value['title']) {
$this->setting['verifystatus']['value'][] = array($key, $value['title']);
}
}
}
if(empty($this->setting['verifystatus']['value'])) {
unset($this->setting['verifystatus']);
}
}
function name() {
return lang('blockclass', 'blockclass_member_script_member');
}
function blockclass() {
return array('member', lang('blockclass', 'blockclass_member_member'));
}
function fields() {
global $_G;
$fields = array(
'id' => array('name' => lang('blockclass', 'blockclass_field_id'), 'formtype' => 'text', 'datatype' => 'int'),
'url' => array('name' => lang('blockclass', 'blockclass_member_field_url'), 'formtype' => 'text', 'datatype' => 'string'),
'title' => array('name' => lang('blockclass', 'blockclass_member_field_title'), 'formtype' => 'title', 'datatype' => 'title'),
'avatar' => array('name' => lang('blockclass', 'blockclass_member_field_avatar'), 'formtype' => 'text', 'datatype' => 'string'),
'avatar_middle' => array('name' => lang('blockclass', 'blockclass_member_field_avatar_middle'), 'formtype' => 'text', 'datatype' => 'string'),
'avatar_big' => array('name' => lang('blockclass', 'blockclass_member_field_avatar_big'), 'formtype' => 'text', 'datatype' => 'string'),
'regdate' => array('name' => lang('blockclass', 'blockclass_member_field_regdate'), 'formtype' => 'date', 'datatype' => 'date'),
'posts' => array('name' => lang('blockclass', 'blockclass_member_field_posts'), 'formtype' => 'text', 'datatype' => 'int'),
'threads' => array('name' => lang('blockclass', 'blockclass_member_field_threads'), 'formtype' => 'text', 'datatype' => 'int'),
'digestposts' => array('name' => lang('blockclass', 'blockclass_member_field_digestposts'), 'formtype' => 'text', 'datatype' => 'int'),
'credits' => array('name' => lang('blockclass', 'blockclass_member_field_credits'), 'formtype' => 'text', 'datatype' => 'int'),
'reason' => array('name' => lang('blockclass', 'blockclass_member_field_reason'), 'formtype' => 'text', 'datatype' => 'string'),
'unitprice' => array('name' => lang('blockclass', 'blockclass_member_field_unitprice'), 'formtype' => 'text', 'datatype' => 'int'),
'showcredit' => array('name' => lang('blockclass', 'blockclass_member_field_showcredit'), 'formtype' => 'text', 'datatype' => 'int'),
'shownote' => array('name' => lang('blockclass', 'blockclass_member_field_shownote'), 'formtype' => 'text', 'datatype' => 'string'),
);
foreach($_G['setting']['extcredits'] as $key=>$value) {
$fields['extcredits'.$key] = array('name'=>$value['title'], 'formtype'=>'text', 'datatype'=>'int');
}
loadcache('profilesetting');
foreach($_G['cache']['profilesetting'] as $key=>$value) {
if($value['available']) {
$fields[$key] = array('name'=>$value['title'], 'formtype'=>'text', 'datatype'=>'string');
}
}
return $fields;
}
function getsetting() {
global $_G;
$settings = $this->setting;
if($settings['extcredit']) {
foreach($_G['setting']['extcredits'] as $id => $credit) {
$settings['extcredit']['value'][] = array($id, $credit['title']);
}
}
if($settings['groupid']) {
$settings['groupid']['value'][] = array(0, lang('portalcp', 'block_all_group'));
foreach(C::t('common_usergroup')->fetch_all_by_type(array('member', 'special')) as $value) {
$settings['groupid']['value'][] = array($value['groupid'], $value['grouptitle']);
}
}
return $settings;
}
function getdata($style, $parameter) {
global $_G;
$parameter = $this->cookparameter($parameter);
$uids = !empty($parameter['uids']) ? explode(',',$parameter['uids']) : array();
$groupid = !empty($parameter['groupid']) && !in_array(0, $parameter['groupid']) ? $parameter['groupid'] : array();
$startrow = !empty($parameter['startrow']) ? intval($parameter['startrow']) : 0;
$items = !empty($parameter['items']) ? intval($parameter['items']) : 10;
$orderby = isset($parameter['orderby']) && in_array($parameter['orderby'],array('credits', 'extcredits', 'threads', 'posts', 'digestposts', 'regdate', 'show', 'blogs', 'albums', 'doings', 'sharings', 'special', 'todayposts')) ? $parameter['orderby'] : '';
$special = isset($parameter['special']) && strlen($parameter['special']) ? intval($parameter['special']) : null;
$lastpost = !empty($parameter['lastpost']) ? intval($parameter['lastpost']) : '';
$avatarstatus = !empty($parameter['avatarstatus']) ? 1 : 0;
$emailstatus = !empty($parameter['emailstatus']) ? 1 : 0;
$secmobilestatus = !empty($parameter['secmobilestatus']) ? 1 : 0;
$verifystatus = !empty($parameter['verifystatus']) ? $parameter['verifystatus'] : array();
$profiles = array();
$profiles['gender'] = !empty($parameter['gender']) ? intval($parameter['gender']) : 0;
$profiles['residecountry'] = !empty($parameter['xresidecountry']) ? $parameter['xresidecountry'] : '';
$profiles['resideprovince'] = !empty($parameter['xresideprovince']) ? $parameter['xresideprovince'] : '';
$profiles['residecity'] = !empty($parameter['xresidecity']) ? $parameter['xresidecity'] : '';
$profiles['residedist'] = !empty($parameter['xresidedist']) ? $parameter['xresidedist'] : '';
$profiles['residecommunity'] = !empty($parameter['xresidecommunity']) ? $parameter['xresidecommunity'] : '';
$profiles['birthcountry'] = !empty($parameter['xbirthcountry']) ? $parameter['xbirthcountry'] : '';
$profiles['birthprovince'] = !empty($parameter['xbirthprovince']) ? $parameter['xbirthprovince'] : '';
$profiles['birthcity'] = !empty($parameter['xbirthcity']) ? $parameter['xbirthcity'] : '';
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
$list = $todayuids = $todayposts = array();
$tables = $wheres = array();
$sqlorderby = '';
$olditems = $items;
$tables[] = DB::table('common_member').' m';
if($groupid) {
$wheres[] = 'm.groupid IN ('.dimplode($groupid).')';
}
if($bannedids) {
$wheres[] = 'm.uid NOT IN ('.dimplode($bannedids).')';
}
if($avatarstatus) {
$wheres[] = "m.avatarstatus='1'";
}
if($emailstatus) {
$wheres[] = "m.emailstatus='1'";
}
if($secmobilestatus) {
$wheres[] = "m.secmobilestatus='1'";
}
if(!empty($verifystatus)) {
$flag = false;
foreach($verifystatus as $value) {
if(isset($_G['setting']['verify'][$value])) {
$flag = true;
$wheres[] = "cmv.verify$value='1'";
}
}
if($flag) {
$tables[] = DB::table('common_member_verify').' cmv';
$wheres[] = 'cmv.uid=m.uid';
}
}
$tables[] = DB::table('common_member_count').' mc';
$wheres[] = 'mc.uid=m.uid';
foreach($profiles as $key=>$value) {
if($value) {
$tables[] = DB::table('common_member_profile').' mp';
$wheres[] = 'mp.uid=m.uid';
$wheres[] = "mp.$key='$value'";
}
}
$reason = $show = '';
if($special !== null) {
$special = in_array($special, array(-1, 0, 1)) ? $special : -1;
$tables[] = DB::table('home_specialuser').' su';
if($special != -1) {
$wheres[] = "su.status='$special'";
}
$wheres[] = 'su.uid=m.uid';
$reason = ', su.reason';
}
if($lastpost && $orderby != 'todayposts') {
$time = TIMESTAMP - $lastpost;
$tables[] = DB::table('common_member_status')." ms";
$wheres[] = "ms.uid=m.uid";
$wheres[] = "ms.lastpost>'$time'";
}
switch($orderby) {
case 'credits':
case 'regdate':
$sqlorderby = " ORDER BY m.$orderby DESC";
break;
case 'extcredits':
$extcredits = 'extcredits'.(in_array($parameter['extcredit'], range(1, 8)) ? $parameter['extcredit'] : '1');
$sqlorderby = " ORDER BY mc.$extcredits DESC";
break;
case 'threads':
case 'posts':
case 'blogs':
case 'albums':
case 'doings':
case 'sharings':
case 'digestposts':
$sqlorderby = " ORDER BY mc.$orderby DESC";
break;
case 'show':
$show = ', s.unitprice, s.credit as showcredit, s.note as shownote';
$tables[] = DB::table('home_show')." s";
$wheres[] = 's.uid=m.uid';
$sqlorderby = ' ORDER BY s.unitprice DESC, s.credit DESC';
break;
case 'special':
$sqlorderby = $special !== null ? ' ORDER BY su.displayorder, dateline DESC' : '';
break;
case 'todayposts':
$todaytime = strtotime(dgmdate(TIMESTAMP, 'Ymd'));
$inuids = $uids ? ' AND uid IN ('.dimplode($uids).')' : '';
$items = $items * 5;
$query = DB::query('SELECT uid, count(*) as sum FROM '.DB::table('common_member_action_log')."
WHERE dateline>=$todaytime AND action='".getuseraction('pid')."'$inuids GROUP BY uid ORDER BY sum DESC LIMIT $items");
while($value = DB::fetch($query)) {
$todayposts[$value['uid']] = $value['sum'];
$todayuids[] = $value['uid'];
}
if(empty($todayuids)) {
$todayuids = array(0);
}
$uids = $todayuids;
break;
}
if($uids) {
$wheres[] = 'm.uid IN ('.dimplode($uids).')';
}
$wheres[] = '(m.groupid < 4 OR m.groupid > 8)';
$tables = array_unique($tables);
$wheres = array_unique($wheres);
$tablesql = implode(',',$tables);
$wheresql = implode(' AND ',$wheres);
$query = DB::query("SELECT m.*, mc.*$reason$show FROM $tablesql WHERE $wheresql $sqlorderby LIMIT $startrow,$items");
$resultuids = array();
while($data = DB::fetch($query)){
$resultuids[] = intval($data['uid']);
$list[] = array(
'id' => $data['uid'],
'idtype' => 'uid',
'title' => $data['username'],
'url' => 'home.php?mod=space&uid='.$data['uid'],
'pic' => '',
'picflag' => 0,
'summary' => '',
'fields' => array(
'avatar' => avatar($data['uid'], 'small', true, false, false, $_G['setting']['ucenterurl']),
'avatar_middle' => avatar($data['uid'], 'middle', true, false, false, $_G['setting']['ucenterurl']),
'avatar_big' => avatar($data['uid'], 'big', true, false, false, $_G['setting']['ucenterurl']),
'credits' => $data['credits'],
'extcredits1' => $data['extcredits1'],
'extcredits2' => $data['extcredits2'],
'extcredits3' => $data['extcredits3'],
'extcredits4' => $data['extcredits4'],
'extcredits5' => $data['extcredits5'],
'extcredits6' => $data['extcredits6'],
'extcredits7' => $data['extcredits7'],
'extcredits8' => $data['extcredits8'],
'regdate' => $data['regdate'],
'posts' => empty($todayposts[$data['uid']]) ? $data['posts'] : $todayposts[$data['uid']],
'threads' => $data['threads'],
'digestposts' => $data['digestposts'],
'reason' => isset($data['reason']) ? $data['reason'] : '',
'unitprice' => isset($data['unitprice']) ? $data['unitprice'] : '',
'showcredit' => isset($data['showcredit']) ? $data['showcredit'] : '',
'shownote' => isset($data['shownote']) ? $data['shownote'] : '',
)
);
}
if($resultuids) {
include_once libfile('function/profile');
$profiles = array();
$query = DB::query('SELECT * FROM '.DB::table('common_member_profile')." WHERE uid IN (".dimplode($resultuids).")");
while($data = DB::fetch($query)) {
$profile = array();
foreach($data as $fieldid=>$fieldvalue) {
$fieldvalue = profile_show($fieldid, $data, true);
if(false !== $fieldvalue) {
$profile[$fieldid] = $fieldvalue;
}
}
$profiles[$data['uid']] = $profile;
}
for($i=0,$L=count($list); $i<$L; $i++) {
$uid = $list[$i]['id'];
if($profiles[$uid]) {
$list[$i]['fields'] = array_merge($list[$i]['fields'], $profiles[$uid]);
}
}
if(!empty($todayuids)) {
$datalist = array();
foreach($todayuids as $uid) {
foreach($list as $user) {
if($user['id'] == $uid) {
$datalist[] = $user;
break;
}
}
if(count($datalist) >= $olditems) {
break;
}
}
$list = $datalist;
}
}
return array('html' => '', 'data' => $list);
}
}
?>

View File

@@ -0,0 +1,46 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_membercredit.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_member', 'class/block/member');
class block_membercredit extends block_member {
function __construct() {
$this->setting = array(
'orderby' => array(
'title' => 'memberlist_orderby',
'type' => 'mradio',
'value' => array(
array('credits', 'memberlist_orderby_credits'),
array('extcredits', 'memberlist_orderby_extcredits'),
),
'default' => 'credits'
),
'extcredit' => array(
'title' => 'memberlist_orderby_extcreditselect',
'type' => 'select',
'value' => array()
),
'startrow' => array(
'title' => 'memberlist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_member_script_membercredit');
}
}
?>

View File

@@ -0,0 +1,62 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_membernew.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_member', 'class/block/member');
class block_membernew extends block_member {
function __construct() {
$this->setting = array(
'gender' => array(
'title' => 'memberlist_gender',
'type' => 'mradio',
'value' => array(
array('1', 'memberlist_gender_male'),
array('2', 'memberlist_gender_female'),
array('', 'memberlist_gender_nolimit'),
),
'default' => ''
),
'birthcity' => array(
'title' => 'memberlist_birthcity',
'type' => 'district',
'value' => array('xbirthcountry', 'xbirthprovince', 'xbirthcity', 'xbirthdist', 'xbirthcommunity'),
),
'residecity' => array(
'title' => 'memberlist_residecity',
'type' => 'district',
'value' => array('xresidecountry', 'xresideprovince', 'xresidecity', 'xresidedist', 'xresidecommunity')
),
'avatarstatus' => array(
'title' => 'memberlist_avatarstatus',
'type' => 'radio',
'default' => ''
),
'startrow' => array(
'title' => 'memberlist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_member_script_membernew');
}
function cookparameter($parameter) {
$parameter['orderby'] = 'regdate';
return parent::cookparameter($parameter);
}
}
?>

View File

@@ -0,0 +1,54 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_memberposts.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_member', 'class/block/member');
class block_memberposts extends block_member {
function __construct() {
$this->setting = array(
'orderby' => array(
'title' => 'memberlist_orderby',
'type' => 'mradio',
'value' => array(
array('threads', 'memberlist_orderby_threads'),
array('posts', 'memberlist_orderby_posts'),
array('digestposts', 'memberlist_orderby_digestposts'),
),
'default' => 'threads'
),
'lastpost' => array(
'title' => 'memberlist_lastpost',
'type' => 'mradio',
'value' => array(
array('', 'memberlist_lastpost_nolimit'),
array('3600', 'memberlist_lastpost_hour'),
array('86400', 'memberlist_lastpost_day'),
array('604800', 'memberlist_lastpost_week'),
array('2592000', 'memberlist_lastpost_month'),
),
'default' => ''
),
'startrow' => array(
'title' => 'memberlist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_member_script_memberposts');
}
}
?>

View File

@@ -0,0 +1,37 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_membershow.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_member', 'class/block/member');
class block_membershow extends block_member {
function __construct() {
$this->setting = array(
'startrow' => array(
'title' => 'memberlist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function cookparameter($parameter) {
$parameter['orderby'] = 'show';
return parent::cookparameter($parameter);
}
function name() {
return lang('blockclass', 'blockclass_member_script_membershow');
}
}
?>

View File

@@ -0,0 +1,52 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_memberspecial.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_member', 'class/block/member');
class block_memberspecial extends block_member {
function __construct() {
$this->setting = array(
'special' => array(
'title' => 'memberlist_special',
'type' => 'mradio',
'value' => array(
array('', 'memberlist_special_nolimit'),
array('0', 'memberlist_special_hot'),
array('1', 'memberlist_special_default'),
),
'default' => ''
),
'startrow' => array(
'title' => 'memberlist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_member_script_memberspecial');
}
function cookparameter($parameter) {
if($parameter['special'] === '') {
$parameter['special'] = -1;
} else {
$parameter['special'] = intval($parameter['special']);
}
$parameter['orderby'] = 'special';
return parent::cookparameter($parameter);
}
}
?>

View File

@@ -0,0 +1,46 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_memberspecified.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_member', 'class/block/member');
class block_memberspecified extends block_member {
function __construct() {
$this->setting = array(
'uids' => array(
'title' => 'memberlist_uids',
'type' => 'text'
),
'groupid' => array(
'title' => 'memberlist_groupid',
'type' => 'mselect',
'value' => array()
),
'special' => array(
'title' => 'memberlist_special',
'type' => 'mradio',
'value' => array(
array('', 'memberlist_special_nolimit'),
array('0', 'memberlist_special_hot'),
array('1', 'memberlist_special_default'),
),
'default' => ''
),
);
}
function name() {
return lang('blockclass', 'blockclass_member_script_memberspecified');
}
}
?>

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_member'),
);
?>

View File

View File

@@ -0,0 +1,100 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_otherfriendlink.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class block_otherfriendlink extends discuz_block {
var $setting = array();
function __construct() {
$this->setting = array(
'type' => array(
'title' => 'friendlink_type',
'type' => 'mcheckbox',
'value' => array(
array('1', 'friendlink_type_group1'),
array('2', 'friendlink_type_group2'),
array('3', 'friendlink_type_group3'),
array('4', 'friendlink_type_group4'),
),
'default' => array('1','2','3','4')
),
'titlelength' => array(
'title' => 'friendlink_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'friendlink_summarylength',
'type' => 'text',
'default' => 80
),
);
}
function name() {
return lang('blockclass', 'blockclass_other_script_friendlink');
}
function blockclass() {
return array('otherfriendlink', lang('blockclass', 'blockclass_other_friendlink'));
}
function fields() {
return array(
'url' => array('name' => lang('blockclass', 'blockclass_other_friendlink_field_url'), 'formtype' => 'text', 'datatype' => 'string'),
'title' => array('name' => lang('blockclass', 'blockclass_other_friendlink_field_title'), 'formtype' => 'title', 'datatype' => 'title'),
'pic' => array('name' => lang('blockclass', 'blockclass_other_friendlink_field_pic'), 'formtype' => 'pic', 'datatype' => 'pic'),
'summary' => array('name' => lang('blockclass', 'blockclass_other_friendlink_field_summary'), 'formtype' => 'summary', 'datatype' => 'summary'),
);
}
function getsetting() {
return $this->setting;
}
function getdata($style, $parameter) {
$parameter = $this->cookparameter($parameter);
$titlelength = isset($parameter['titlelength']) ? intval($parameter['titlelength']) : 40;
$summarylength = isset($parameter['summarylength']) ? intval($parameter['summarylength']) : 80;
$type = !empty($parameter['type']) && is_array($parameter['type']) ? $parameter['type'] : array();
$b = '0000';
for($i=1;$i<=4;$i++) {
if(in_array($i, $type)) {
$b[$i-1] = '1';
}
}
$type = intval($b, '2');
$list = array();
$query = C::t('common_friendlink')->fetch_all_by_displayorder($type);
foreach ($query as $data) {
$list[] = array(
'id' => $data['id'],
'idtype' => 'flid',
'title' => cutstr($data['name'], $titlelength),
'url' => $data['url'],
'pic' => $data['logo'] ? $data['logo'] : $_G['style']['imgdir'].'/nophoto.gif',
'picflag' => '0',
'summary' => $data['description'],
'fields' => array(
'fulltitle' => $data['name'],
)
);
}
return array('html' => '', 'data' => $list);
}
}
?>

View File

@@ -0,0 +1,250 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_otherstat.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class block_otherstat extends discuz_block {
function __construct() {}
function name() {
return lang('blockclass', 'blockclass_other_script_stat');
}
function blockclass() {
return array('otherstat', lang('blockclass', 'blockclass_other_stat'));
}
function fields() {
return array(
'posts' => array('name' => lang('blockclass', 'blockclass_other_stat_posts'), 'formtype' => 'text', 'datatype' => 'int'),
'posts_title' => array('name' => lang('blockclass', 'blockclass_other_stat_posts_title'), 'formtype' => 'text', 'datatype' => 'string'),
'groups' => array('name' => lang('blockclass', 'blockclass_other_stat_groups'), 'formtype' => 'text', 'datatype' => 'int'),
'groups_title' => array('name' => lang('blockclass', 'blockclass_other_stat_groups_title'), 'formtype' => 'text', 'datatype' => 'string'),
'members' => array('name' => lang('blockclass', 'blockclass_other_stat_members'), 'formtype' => 'text', 'datatype' => 'int'),
'members_title' => array('name' => lang('blockclass', 'blockclass_other_stat_members_title'), 'formtype' => 'text', 'datatype' => 'string'),
'groupnewposts' => array('name' => lang('blockclass', 'blockclass_other_stat_groupnewposts'), 'formtype' => 'text', 'datatype' => 'int'),
'groupnewposts_title' => array('name' => lang('blockclass', 'blockclass_other_stat_groupnewposts_title'), 'formtype' => 'text', 'datatype' => 'string'),
'bbsnewposts' => array('name' => lang('blockclass', 'blockclass_other_stat_bbsnewposts'), 'formtype' => 'text', 'datatype' => 'int'),
'bbsnewposts_title' => array('name' => lang('blockclass', 'blockclass_other_stat_bbsnewposts_title'), 'formtype' => 'text', 'datatype' => 'string'),
'bbslastposts' => array('name' => lang('blockclass', 'blockclass_other_stat_bbslastposts'), 'formtype' => 'text', 'datatype' => 'int'),
'bbslastposts_title' => array('name' => lang('blockclass', 'blockclass_other_stat_bbslastposts_title'), 'formtype' => 'text', 'datatype' => 'string'),
'onlinemembers' => array('name' => lang('blockclass', 'blockclass_other_stat_onlinemembers'), 'formtype' => 'text', 'datatype' => 'int'),
'onlinemembers_title' => array('name' => lang('blockclass', 'blockclass_other_stat_onlinemembers_title'), 'formtype' => 'text', 'datatype' => 'string'),
'maxmembers' => array('name' => lang('blockclass', 'blockclass_other_stat_maxmembers'), 'formtype' => 'text', 'datatype' => 'int'),
'maxmembers_title' => array('name' => lang('blockclass', 'blockclass_other_stat_maxmembers_title'), 'formtype' => 'text', 'datatype' => 'string'),
'doings' => array('name' => lang('blockclass', 'blockclass_other_stat_doings'), 'formtype' => 'text', 'datatype' => 'int'),
'doings_title' => array('name' => lang('blockclass', 'blockclass_other_stat_doings_title'), 'formtype' => 'text', 'datatype' => 'string'),
'blogs' => array('name' => lang('blockclass', 'blockclass_other_stat_blogs'), 'formtype' => 'text', 'datatype' => 'int'),
'blogs_title' => array('name' => lang('blockclass', 'blockclass_other_stat_blogs_title'), 'formtype' => 'text', 'datatype' => 'string'),
'albums' => array('name' => lang('blockclass', 'blockclass_other_stat_albums'), 'formtype' => 'text', 'datatype' => 'int'),
'albums_title' => array('name' => lang('blockclass', 'blockclass_other_stat_albums_title'), 'formtype' => 'text', 'datatype' => 'string'),
'pics' => array('name' => lang('blockclass', 'blockclass_other_stat_pics'), 'formtype' => 'text', 'datatype' => 'int'),
'pics_title' => array('name' => lang('blockclass', 'blockclass_other_stat_pics_title'), 'formtype' => 'text', 'datatype' => 'string'),
'shares' => array('name' => lang('blockclass', 'blockclass_other_stat_shares'), 'formtype' => 'text', 'datatype' => 'int'),
'shares_title' => array('name' => lang('blockclass', 'blockclass_other_stat_shares_title'), 'formtype' => 'text', 'datatype' => 'string'),
);
}
function getsetting() {
global $_G;
$settings = array(
'option' => array(
'title' => 'stat_option',
'type' => 'mcheckbox',
'value' => array(
array('posts', 'stat_option_posts'),
array('groups', 'stat_option_groups'),
array('members', 'stat_option_members'),
array('groupnewposts', 'stat_option_groupnewposts'),
array('bbsnewposts', 'stat_option_bbsnewposts'),
array('bbslastposts', 'stat_option_bbslastposts'),
array('onlinemembers', 'stat_option_onlinemembers'),
array('maxmembers', 'stat_option_maxmembers'),
array('doings', 'stat_option_doings'),
array('blogs', 'stat_option_blogs'),
array('albums', 'stat_option_albums'),
array('pics', 'stat_option_pics'),
array('shares', 'stat_option_shares'),
),
'default' => array('posts', 'groups', 'members')
),
'tip' => array(
'title' => 'stat_edit_showtitle',
'type' => lang('block/stat', 'stat_edit_showtitle_detail'),
),
'posts_title' => array(
'title' => 'stat_option_posts',
'type' => 'text',
'default' => lang('block/stat', 'stat_posts')
),
'groups_title' => array(
'title' => 'stat_option_groups',
'type' => 'text',
'default' => lang('block/stat', 'stat_groups')
),
'members_title' => array(
'title' => 'stat_option_members',
'type' => 'text',
'default' => lang('block/stat', 'stat_members')
),
'groupnewposts_title' => array(
'title' => 'stat_option_groupnewposts',
'type' => 'text',
'default' => lang('block/stat', 'stat_groupnewposts')
),
'bbsnewposts_title' => array(
'title' => 'stat_option_bbsnewposts',
'type' => 'text',
'default' => lang('block/stat', 'stat_bbsnewposts')
),
'bbslastposts_title' => array(
'title' => 'stat_option_bbslastposts',
'type' => 'text',
'default' => lang('block/stat', 'stat_bbslastposts')
),
'onlinemembers_title' => array(
'title' => 'stat_option_onlinemembers',
'type' => 'text',
'default' => lang('block/stat', 'stat_onlinemembers')
),
'maxmembers_title' => array(
'title' => 'stat_option_maxmembers',
'type' => 'text',
'default' => lang('block/stat', 'stat_maxmembers')
),
'doings_title' => array(
'title' => 'stat_option_doings',
'type' => 'text',
'default' => lang('block/stat', 'stat_doings')
),
'blogs_title' => array(
'title' => 'stat_option_blogs',
'type' => 'text',
'default' => lang('block/stat', 'stat_blogs')
),
'albums_title' => array(
'title' => 'stat_option_albums',
'type' => 'text',
'default' => lang('block/stat', 'stat_albums')
),
'pics_title' => array(
'title' => 'stat_option_pics',
'type' => 'text',
'default' => lang('block/stat', 'stat_pics')
),
'shares_title' => array(
'title' => 'stat_option_shares',
'type' => 'text',
'default' => lang('block/stat', 'stat_shares')
),
);
return $settings;
}
function getdata($style, $parameter) {
global $_G;
$parameter = $this->cookparameter($parameter);
$fields = array(
'posts' => 0,
'posts_title' => !empty($parameter['posts_title']) ? $parameter['posts_title'] : lang('block/stat', 'stat_posts'),
'groups' => 0,
'groups_title' => !empty($parameter['groups_title']) ? $parameter['groups_title'] : lang('block/stat', 'stat_groups'),
'members' => 0,
'members_title' => !empty($parameter['members_title']) ? $parameter['members_title'] : lang('block/stat', 'stat_members'),
'groupnewposts' => 0,
'groupnewposts_title' => !empty($parameter['groupnewposts_title']) ? $parameter['groupnewposts_title'] : lang('block/stat', 'stat_groupnewposts'),
'bbsnewposts' => 0,
'bbsnewposts_title' => !empty($parameter['bbsnewposts_title']) ? $parameter['bbsnewposts_title'] : lang('block/stat', 'stat_bbsnewposts'),
'bbslastposts' => 0,
'bbslastposts_title' => !empty($parameter['bbslastposts_title']) ? $parameter['bbslastposts_title'] : lang('block/stat', 'stat_bbslastposts'),
'onlinemembers' => 0,
'onlinemembers_title' => !empty($parameter['onlinemembers_title']) ? $parameter['onlinemembers_title'] : lang('block/stat', 'stat_onlinemembers'),
'maxmembers' => 0,
'maxmembers_title' => !empty($parameter['maxmembers_title']) ? $parameter['maxmembers_title'] : lang('block/stat', 'stat_maxmembers'),
'doings' => 0,
'doings_title' => !empty($parameter['doings_title']) ? $parameter['doings_title'] : lang('block/stat', 'stat_doings'),
'blogs' => 0,
'blogs_title' => !empty($parameter['blogs_title']) ? $parameter['blogs_title'] : lang('block/stat', 'stat_blogs'),
'albums' => 0,
'albums_title' => !empty($parameter['albums_title']) ? $parameter['albums_title'] : lang('block/stat', 'stat_albums'),
'pics' => 0,
'pics_title' => !empty($parameter['pics_title']) ? $parameter['pics_title'] : lang('block/stat', 'stat_pics'),
'shares' => 0,
'shares_title' => !empty($parameter['shares_title']) ? $parameter['shares_title'] : lang('block/stat', 'stat_shares'),
);
if(in_array('posts', $parameter['option']) || in_array('bbsnewposts', $parameter['option'])) {
$sql = "SELECT sum(f.posts) AS posts, sum(f.todayposts) AS todayposts FROM ".DB::table('forum_forum')." f WHERE f.status='1'";
$forum = DB::fetch_first($sql);
}
if(in_array('groups', $parameter['option']) || in_array('groupnewposts', $parameter['option'])) {
loadcache('groupindex');
}
if(in_array('posts', $parameter['option'])) {
$fields['posts'] = intval($forum['posts']);
}
if(in_array('groups', $parameter['option'])) {
$fields['groups'] = intval($_G['cache']['groupindex']['groupnum']);
}
if(in_array('members', $parameter['option'])) {
loadcache('userstats');
$fields['members'] = intval($_G['cache']['userstats']['totalmembers']);
}
if(in_array('groupnewposts', $parameter['option'])) {
$fields['groupnewposts'] = intval($_G['cache']['groupindex']['todayposts']);
}
if(in_array('bbsnewposts', $parameter['option'])) {
$fields['bbsnewposts'] = intval($forum['todayposts']);
}
if(in_array('bbslastposts', $parameter['option'])) {
loadcache('historyposts');
$postdata = $_G['cache']['historyposts'] ? explode("\t", $_G['cache']['historyposts']) : array();
$fields['bbslastposts'] = intval($postdata[0]);
}
if(in_array('onlinemembers', $parameter['option'])) {
$num = !empty($_G['cookie']['onlineusernum']) ? intval($_G['cookie']['onlineusernum']) : C::app()->session->count();
$fields['onlinemembers'] = intval($num);
}
if(in_array('maxmembers', $parameter['option'])) {
loadcache('onlinerecord');
$onlineinfo = explode("\t", $_G['cache']['onlinerecord']);
$fields['maxmembers'] = !empty($onlineinfo[0]) ? intval($onlineinfo[0]) : 0;
}
if(in_array('doings', $parameter['option'])) {
$num = C::t('home_doing')->count();
$fields['doings'] = intval($num);
}
if(in_array('blogs', $parameter['option'])) {
$num = C::t('home_blog')->count();
$fields['blogs'] = intval($num);
}
if(in_array('albums', $parameter['option'])) {
$num = C::t('home_album')->count();
$fields['albums'] = intval($num);
}
if(in_array('pics', $parameter['option'])) {
$num = C::t('home_pic')->count();
$fields['pics'] = intval($num);
}
if(in_array('shares', $parameter['option'])) {
$num = C::t('home_share')->count();
$fields['shares'] = intval($num);
}
$list = array();
$list[1] = array(
'id' => 1,
'idtype' => 'statid',
'fields' => $fields
);
return array('html' => '', 'data' => $list);
}
}
?>

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_other'),
);
?>

View File

View File

@@ -0,0 +1,347 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_article.php 31313 2012-08-10 03:51:03Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class block_article extends discuz_block {
var $setting = array();
function __construct() {
global $_G;
$this->setting = array(
'aids' => array(
'title' => 'articlelist_aids',
'type' => 'text',
'value' => ''
),
'uids' => array(
'title' => 'articlelist_uids',
'type' => 'text',
'value' => ''
),
'keyword' => array(
'title' => 'articlelist_keyword',
'type' => 'text'
),
'catid' => array(
'title' => 'articlelist_catid',
'type' => 'mselect',
'value' => array(
),
),
'tag' => array(
'title' => 'articlelist_tag',
'type' => 'mcheckbox',
'value' => array(
),
),
'picrequired' => array(
'title' => 'articlelist_picrequired',
'type' => 'radio',
'default' => '0'
),
'starttime' => array(
'title' => 'articlelist_starttime',
'type' => 'calendar',
'default' => ''
),
'endtime' => array(
'title' => 'articlelist_endtime',
'type' => 'calendar',
'default' => ''
),
'orderby' => array(
'title' => 'articlelist_orderby',
'type' => 'mradio',
'value' => array(
array('dateline', 'articlelist_orderby_dateline'),
array('viewnum', 'articlelist_orderby_viewnum'),
array('commentnum', 'articlelist_orderby_commentnum'),
),
'default' => 'dateline'
),
'publishdateline' => array(
'title' => 'articlelist_publishdateline',
'type'=> 'mradio',
'value' => array(
array('0', 'articlelist_publishdateline_nolimit'),
array('3600', 'articlelist_publishdateline_hour'),
array('86400', 'articlelist_publishdateline_day'),
array('604800', 'articlelist_publishdateline_week'),
array('2592000', 'articlelist_publishdateline_month'),
),
'default' => '0'
),
'titlelength' => array(
'title' => 'articlelist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'articlelist_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'articlelist_startrow',
'type' => 'text',
'default' => 0
),
);
loadcache('click');
$clicks = !empty($_G['cache']['click']['aid']) ? $_G['cache']['click']['aid'] : array();
if(!empty($clicks)){
foreach($clicks as $key => $value) {
if($value['available']) {
$this->setting['orderby']['value'][] = array('click'.$key, lang('block/articlelist', 'articlelist_orderby_click', array('clickname'=>$value['name'])));
}
}
}
}
function name() {
return lang('blockclass', 'blockclass_article_script_article');
}
function blockclass() {
return array('article', lang('blockclass', 'blockclass_portal_article'));
}
function fields() {
return array(
'id' => array('name' => lang('blockclass', 'blockclass_field_id'), 'formtype' => 'text', 'datatype' => 'int'),
'uid' => array('name' => lang('blockclass', 'blockclass_article_field_uid'), 'formtype' => 'text', 'datatype' => 'int'),
'username' => array('name' => lang('blockclass', 'blockclass_article_field_username'), 'formtype' => 'text', 'datatype' => 'string'),
'avatar' => array('name' => lang('blockclass', 'blockclass_article_field_avatar'), 'formtype' => 'text', 'datatype' => 'string'),
'avatar_middle' => array('name' => lang('blockclass', 'blockclass_article_field_avatar_middle'), 'formtype' => 'text', 'datatype' => 'string'),
'avatar_big' => array('name' => lang('blockclass', 'blockclass_article_field_avatar_big'), 'formtype' => 'text', 'datatype' => 'string'),
'url' => array('name' => lang('blockclass', 'blockclass_article_field_url'), 'formtype' => 'text', 'datatype' => 'string'),
'title' => array('name' => lang('blockclass', 'blockclass_article_field_title'), 'formtype' => 'title', 'datatype' => 'title'),
'fromurl' => array('name' => lang('blockclass', 'blockclass_article_field_fromurl'), 'formtype' => 'text', 'datatype' => 'string'),
'from' => array('name' => lang('blockclass', 'blockclass_article_field_from'), 'formtype' => 'text', 'datatype' => 'string'),
'pic' => array('name' => lang('blockclass', 'blockclass_article_field_pic'), 'formtype' => 'pic', 'datatype' => 'pic'),
'summary' => array('name' => lang('blockclass', 'blockclass_article_field_summary'), 'formtype' => 'summary', 'datatype' => 'summary'),
'dateline' => array('name' => lang('blockclass', 'blockclass_article_field_dateline'), 'formtype' => 'date', 'datatype' => 'date'),
'caturl' => array('name' => lang('blockclass', 'blockclass_article_field_caturl'), 'formtype' => 'text', 'datatype' => 'string'),
'catname' => array('name' => lang('blockclass', 'blockclass_article_field_catname'), 'formtype' => 'text', 'datatype' => 'string'),
'articles' => array('name' => lang('blockclass', 'blockclass_article_field_articles'), 'formtype' => 'text', 'datatype' => 'int'),
'viewnum' => array('name' => lang('blockclass', 'blockclass_article_field_viewnum'), 'formtype' => 'text', 'datatype' => 'int'),
'commentnum' => array('name' => lang('blockclass', 'blockclass_article_field_commentnum'), 'formtype' => 'text', 'datatype' => 'int'),
);
}
function fieldsconvert() {
return array(
'forum_thread' => array(
'name' => lang('blockclass', 'blockclass_forum_thread'),
'script' => 'thread',
'searchkeys' => array('username', 'uid', 'caturl', 'catname', 'articles', 'viewnum', 'commentnum'),
'replacekeys' => array('author', 'authorid', 'forumurl', 'forumname', 'posts', 'views', 'replies'),
),
'group_thread' => array(
'name' => lang('blockclass', 'blockclass_group_thread'),
'script' => 'groupthread',
'searchkeys' => array('username', 'uid', 'caturl', 'catname', 'articles', 'viewnum', 'commentnum'),
'replacekeys' => array('author', 'authorid', 'groupurl', 'groupname', 'posts', 'views', 'replies'),
),
'space_blog' => array(
'name' => lang('blockclass', 'blockclass_space_blog'),
'script' => 'blog',
'searchkeys' => array('commentnum'),
'replacekeys' => array('replynum'),
),
);
}
function getsetting() {
global $_G;
$settings = $this->setting;
if($settings['catid']) {
$settings['catid']['value'][] = array(0, lang('portalcp', 'block_all_category'));
loadcache('portalcategory');
foreach($_G['cache']['portalcategory'] as $value) {
if($value['level'] == 0) {
$settings['catid']['value'][] = array($value['catid'], $value['catname']);
if($value['children']) {
foreach($value['children'] as $catid2) {
$value2 = $_G['cache']['portalcategory'][$catid2];
$settings['catid']['value'][] = array($value2['catid'], '-- '.$value2['catname']);
if($value2['children']) {
foreach($value2['children'] as $catid3) {
$value3 = $_G['cache']['portalcategory'][$catid3];
$settings['catid']['value'][] = array($value3['catid'], '---- '.$value3['catname']);
}
}
}
}
}
}
}
if($settings['tag']) {
$tagnames = article_tagnames();
foreach($tagnames as $k=>$v) {
$settings['tag']['value'][] = array($k, $v);
}
}
return $settings;
}
function getdata($style, $parameter) {
global $_G;
require_once libfile('function/portal');
$parameter = $this->cookparameter($parameter);
$aids = !empty($parameter['aids']) ? explode(',', $parameter['aids']) : array();
$uids = !empty($parameter['uids']) ? explode(',', $parameter['uids']) : array();
$keyword = !empty($parameter['keyword']) ? $parameter['keyword'] : '';
$tag = !empty($parameter['tag']) ? $parameter['tag'] : array();
$starttime = !empty($parameter['starttime']) ? strtotime($parameter['starttime']) : 0;
$endtime = !empty($parameter['endtime']) ? strtotime($parameter['endtime']) : 0;
$publishdateline = isset($parameter['publishdateline']) ? intval($parameter['publishdateline']) : 0;
$startrow = isset($parameter['startrow']) ? intval($parameter['startrow']) : 0;
$items = isset($parameter['items']) ? intval($parameter['items']) : 10;
$titlelength = isset($parameter['titlelength']) ? intval($parameter['titlelength']) : 40;
$summarylength = isset($parameter['summarylength']) ? intval($parameter['summarylength']) : 80;
$clickarr = array('click1', 'click2', 'click3', 'click4', 'click5', 'click6', 'click7', 'click8');
$orderby = in_array($parameter['orderby'], array_merge(array('dateline', 'viewnum', 'commentnum'), $clickarr)) ? $parameter['orderby'] : 'dateline';
$catid = array();
if(!empty($parameter['catid'])) {
if($parameter['catid'][0] == '0') {
unset($parameter['catid'][0]);
}
$catid = $parameter['catid'];
}
$picrequired = !empty($parameter['picrequired']) ? 1 : 0;
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
loadcache('portalcategory');
$list = array();
$wheres = array();
if($aids) {
$wheres[] = 'at.aid IN ('.dimplode($aids).')';
}
if($uids) {
$wheres[] = 'at.uid IN ('.dimplode($uids).')';
}
if($catid) {
include_once libfile('function/portalcp');
$childids = array();
foreach($catid as $id) {
if($_G['cache']['portalcategory'][$id]['disallowpublish']) {
$childids = array_merge($childids, category_get_childids('portal', $id));
}
}
$catid = array_merge($catid, $childids);
$catid = array_unique($catid);
$wheres[] = 'at.catid IN ('.dimplode($catid).')';
}
if(!$aids && !$catid && $_G['setting']['blockmaxaggregationitem']) {
if(($maxid = $this->getmaxid() - $_G['setting']['blockmaxaggregationitem'] ) > 0) {
$wheres[] = 'at.aid > '.$maxid;
}
}
if(empty($aids) && ($picrequired)) {
$wheres[] = "at.pic != ''";
}
if($publishdateline) {
$time = TIMESTAMP - $publishdateline;
$wheres[] = "at.dateline >= '$time'";
}
if($starttime) {
$wheres[] = "at.dateline >= '$starttime'";
}
if($endtime) {
$wheres[] = "at.dateline <= '$endtime'";
}
if($bannedids) {
$wheres[] = 'at.aid NOT IN ('.dimplode($bannedids).')';
}
$wheres[] = "at.status='0'";
if(is_array($tag)) {
$article_tags = array();
foreach($tag as $k) {
$article_tags[$k] = 1;
}
include_once libfile('function/portalcp');
$v=article_make_tag($article_tags);
if($v > 0) {
$wheres[] = "(at.tag & $v) = $v";
}
}
if($keyword) {
require_once libfile('function/search');
$keyword = searchkey($keyword, "at.title LIKE '%{text}%'");
}
$wheresql = $wheres ? implode(' AND ', $wheres) : '1';
if(in_array($orderby, $clickarr)) {
$orderby = "at.$orderby DESC,at.dateline DESC";
} else {
$orderby = ($orderby == 'dateline') ? 'at.dateline DESC ' : "ac.$orderby DESC";
}
$query = DB::query("SELECT at.*, ac.viewnum, ac.commentnum FROM ".DB::table('portal_article_title')." at LEFT JOIN ".DB::table('portal_article_count')." ac ON at.aid=ac.aid WHERE $wheresql$keyword ORDER BY $orderby LIMIT $startrow, $items");
while($data = DB::fetch($query)) {
if(empty($data['pic'])) {
$data['pic'] = STATICURL.'image/common/nophoto.gif';
$data['picflag'] = '0';
} else {
$data['pic'] = $data['pic'];
$data['picflag'] = $data['remote'] == '1' ? '2' : '1';
}
$list[] = array(
'id' => $data['aid'],
'idtype' => 'aid',
'title' => cutstr($data['title'], $titlelength, ''),
'url' => fetch_article_url($data),
'pic' => $data['pic'],
'picflag' => $data['picflag'],
'summary' => cutstr(strip_tags($data['summary']), $summarylength, ''),
'fields' => array(
'uid'=>$data['uid'],
'username'=>$data['username'],
'avatar' => avatar($data['uid'], 'small', true, false, false, $_G['setting']['ucenterurl']),
'avatar_middle' => avatar($data['uid'], 'middle', true, false, false, $_G['setting']['ucenterurl']),
'avatar_big' => avatar($data['uid'], 'big', true, false, false, $_G['setting']['ucenterurl']),
'fulltitle' => $data['title'],
'dateline'=>$data['dateline'],
'caturl'=> $_G['cache']['portalcategory'][$data['catid']]['caturl'],
'catname' => $_G['cache']['portalcategory'][$data['catid']]['catname'],
'fromurl'=> $data['fromurl'],
'from' => $data['from'],
'articles' => $_G['cache']['portalcategory'][$data['catid']]['articles'],
'viewnum' => intval($data['viewnum']),
'commentnum' => intval($data['commentnum'])
)
);
}
return array('html' => '', 'data' => $list);
}
function getmaxid() {
loadcache('databasemaxid');
$data = getglobal('cache/databasemaxid');
if(!is_array($data)) {
$data = array();
}
if(!isset($data['article']) || TIMESTAMP - $data['article']['dateline'] >= 86400) {
$data['article']['dateline'] = TIMESTAMP;
$data['article']['id'] = DB::result_first('SELECT MAX(aid) FROM '.DB::table('portal_article_title'));
savecache('databasemaxid', $data);
}
return $data['article']['id'];
}
}
?>

View File

@@ -0,0 +1,57 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_articlehot.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_article', 'class/block/portal');
class block_articlehot extends block_article {
function __construct() {
$this->setting = array(
'catid' => array(
'title' => 'articlelist_catid',
'type' => 'mselect',
'value' => array(
),
),
'picrequired' => array(
'title' => 'articlelist_picrequired',
'type' => 'radio',
'default' => '0'
),
'orderby' => array(
'title' => 'articlelist_orderby',
'type' => 'mradio',
'value' => array(
array('viewnum', 'articlelist_orderby_viewnum'),
array('commentnum', 'articlelist_orderby_commentnum'),
),
'default' => 'viewnum'
),
'titlelength' => array(
'title' => 'articlelist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'articlelist_summarylength',
'type' => 'text',
'default' => 80
)
);
}
function name() {
return lang('blockclass', 'blockclass_article_script_articlehot');
}
}
?>

View File

@@ -0,0 +1,48 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_articlenew.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_article', 'class/block/portal');
class block_articlenew extends block_article {
function __construct() {
$this->setting = array(
'catid' => array(
'title' => 'articlelist_catid',
'type' => 'mselect',
'value' => array(
),
),
'picrequired' => array(
'title' => 'articlelist_picrequired',
'type' => 'radio',
'default' => '0'
),
'titlelength' => array(
'title' => 'articlelist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'articlelist_summarylength',
'type' => 'text',
'default' => 80
)
);
}
function name() {
return lang('blockclass', 'blockclass_article_script_articlenew');
}
}
?>

View File

@@ -0,0 +1,64 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_articlespecified.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_article', 'class/block/portal');
class block_articlespecified extends block_article {
function __construct() {
$this->setting = array(
'aids' => array(
'title' => 'articlelist_aids',
'type' => 'text',
'value' => ''
),
'uids' => array(
'title' => 'articlelist_uids',
'type' => 'text',
'value' => ''
),
'tag' => array(
'title' => 'articlelist_tag',
'type' => 'mcheckbox',
'value' => array(
),
),
'starttime' => array(
'title' => 'articlelist_starttime',
'type' => 'calendar',
'default' => ''
),
'endtime' => array(
'title' => 'articlelist_endtime',
'type' => 'calendar',
'default' => ''
),
'titlelength' => array(
'title' => 'articlelist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'articlelist_summarylength',
'type' => 'text',
'default' => 80
)
);
}
function name() {
return lang('blockclass', 'blockclass_article_script_articlespecified');
}
}
?>

View File

@@ -0,0 +1,145 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_portalcategory.php 29236 2012-03-30 05:34:47Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class block_portalcategory extends discuz_block {
var $setting = array();
function __construct() {
$this->setting = array(
'thecatid' => array(
'title' => 'portalcategory_thecatid',
'type' => 'text',
),
'catid' => array(
'title' => 'portalcategory_catid',
'type' => 'mselect',
'value' => array(
),
),
'orderby' => array(
'title' => 'portalcategory_orderby',
'type' => 'mradio',
'value' => array(
array('displayorder', 'portalcategory_orderby_displayorder'),
array('articles', 'portalcategory_orderby_articles')
),
'default' => 'displayorder'
)
);
}
function name() {
return lang('blockclass', 'blockclass_category_script_portalcategory');
}
function blockclass() {
return array('category', lang('blockclass', 'blockclass_portal_category'));
}
function fields() {
return array(
'id' => array('name' => lang('blockclass', 'blockclass_field_id'), 'formtype' => 'text', 'datatype' => 'int'),
'url' => array('name' => lang('blockclass', 'blockclass_category_field_url'), 'formtype' => 'text', 'datatype' => 'string'),
'title' => array('name' => lang('blockclass', 'blockclass_category_field_title'), 'formtype' => 'title', 'datatype' => 'title'),
'articles' => array('name' => lang('blockclass', 'blockclass_category_field_articles'), 'formtype' => 'text', 'datatype' => 'int'),
);
}
function fieldsconvert() {
return array(
'forum_forum' => array(
'name' => lang('blockclass', 'blockclass_forum_forum'),
'script' => 'forum',
'searchkeys' => array('articles'),
'replacekeys' => array('threads'),
),
'group_group' => array(
'name' => lang('blockclass', 'blockclass_group_group'),
'script' => 'group',
'searchkeys' => array('articles'),
'replacekeys' => array('threads'),
),
);
}
function getsetting() {
global $_G;
$settings = $this->setting;
if($settings['catid']) {
$settings['catid']['value'][] = array(0, lang('portalcp', 'block_first_category'));
loadcache('portalcategory');
foreach($_G['cache']['portalcategory'] as $value) {
if($value['level'] == 0) {
$settings['catid']['value'][] = array($value['catid'], $value['catname']);
if($value['children']) {
foreach($value['children'] as $catid2) {
$value2 = $_G['cache']['portalcategory'][$catid2];
$settings['catid']['value'][] = array($value2['catid'], '-- '.$value2['catname']);
if($value2['children']) {
foreach($value2['children'] as $catid3) {
$value3 = $_G['cache']['portalcategory'][$catid3];
$settings['catid']['value'][] = array($value3['catid'], '---- '.$value3['catname']);
}
}
}
}
}
}
}
return $settings;
}
function getdata($style, $parameter) {
global $_G;
$parameter = $this->cookparameter($parameter);
loadcache('portalcategory');
$thecatid = !empty($parameter['thecatid']) ? explode(',',$parameter['thecatid']) : array();
if(!empty($parameter['catid'])) {
$catid = $parameter['catid'];
} else {
$catid = array_keys($_G['cache']['portalcategory']);
$catid[] = '0';
}
$orderby = $parameter['orderby'] == 'articles' ? ' ORDER BY articles DESC' : ' ORDER BY displayorder';
$wheres = array();
if($thecatid) {
$wheres[] = "catid IN (".dimplode($thecatid).")";
}
if($catid) {
$wheres[] = "upid IN (".dimplode($catid).")";
}
$wheresql = $wheres ? implode(' AND ', $wheres) : '1';
$list = array();
$query = DB::query('SELECT * FROM '.DB::table('portal_category')." WHERE $wheresql $orderby");
while($data = DB::fetch($query)) {
$list[] = array(
'id' => $data['catid'],
'idtype' => 'catid',
'title' => dhtmlspecialchars($data['catname']),
'url' => $_G['cache']['portalcategory'][$data['catid']]['caturl'],
'pic' => '',
'picflag' => '0',
'summary' => '',
'fields' => array(
'dateline'=>$data['dateline'],
'articles' => $data['articles']
)
);
}
return array('html' => '', 'data' => $list);
}
}
?>

View File

@@ -0,0 +1,145 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_topic.php 31470 2012-08-31 03:29:50Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class block_topic extends discuz_block {
var $setting = array();
function __construct() {
$this->setting = array(
'topicids' => array(
'title' => 'topiclist_topicids',
'type' => 'text',
'value' => ''
),
'uids' => array(
'title' => 'topiclist_uids',
'type' => 'text',
'value' => ''
),
'picrequired' => array(
'title' => 'topiclist_picrequired',
'type' => 'radio',
'default' => '0'
),
'orderby' => array(
'title' => 'topiclist_orderby',
'type' => 'mradio',
'value' => array(
array('dateline', 'topiclist_orderby_dateline'),
array('viewnum', 'topiclist_orderby_viewnum')
),
'default' => 'dateline'
),
'titlelength' => array(
'title' => 'topiclist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'summary' => 'topiclist_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'topiclist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_topic_script_topic');
}
function blockclass() {
return array('topic', lang('blockclass', 'blockclass_portal_topic'));
}
function fields() {
return array(
'id' => array('name' => lang('blockclass', 'blockclass_field_id'), 'formtype' => 'text', 'datatype' => 'int'),
'url' => array('name' => lang('blockclass', 'blockclass_topic_field_url'), 'formtype' => 'text', 'datatype' => 'string'),
'title' => array('name' => lang('blockclass', 'blockclass_topic_field_title'), 'formtype' => 'title', 'datatype' => 'title'),
'pic' => array('name' => lang('blockclass', 'blockclass_topic_field_pic'), 'formtype' => 'pic', 'datatype' => 'pic'),
'summary' => array('name' => lang('blockclass', 'blockclass_topic_field_summary'), 'formtype' => 'summary', 'datatype' => 'summary'),
'uid' => array('name' => lang('blockclass', 'blockclass_topic_field_uid'), 'formtype' => 'text', 'datatype' => 'int'),
'username' => array('name' => lang('blockclass', 'blockclass_topic_field_username'), 'formtype' => 'text', 'datatype' => 'string'),
'dateline' => array('name' => lang('blockclass', 'blockclass_topic_field_dateline'), 'formtype' => 'date', 'datatype' => 'date'),
'viewnum' => array('name' => lang('blockclass', 'blockclass_topic_field_viewnum'), 'formtype' => 'text', 'datatype' => 'int'),
);
}
function getsetting() {
global $_G;
$settings = $this->setting;
return $settings;
}
function getdata($style, $parameter) {
global $_G;
$parameter = $this->cookparameter($parameter);
$topicids = !empty($parameter['topicids']) ? explode(',',$parameter['topicids']) : 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;
$titlelength = $parameter['titlelength'] ? intval($parameter['titlelength']) : 40;
$summarylength = $parameter['summarylength'] ? intval($parameter['summarylength']) : 80;
$orderby = isset($parameter['orderby']) && in_array($parameter['orderby'],array('dateline', 'viewnum')) ? $parameter['orderby'] : 'dateline';
$picrequired = !empty($parameter['picrequired']) ? 1 : 0;
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
$datalist = $list = array();
$wherearr = array();
if($topicids) {
$wherearr[] = 'topicid IN ('.dimplode($topicids).')';
}
if($bannedids) {
$wherearr[] = 'topicid NOT IN ('.dimplode($bannedids).')';
}
if($uids) {
$wherearr[] = 'uid IN ('.dimplode($uids).')';
}
if($picrequired) {
$wherearr[] = "cover != ''";
}
$wherearr[] = "closed = '0'";
require_once libfile('function/portal');
foreach(C::t('portal_topic')->fetch_all_by_search_where($wherearr, "ORDER BY $orderby DESC", $startrow, $items) as $data) {
if(empty($data['cover'])) {
$data['cover'] = STATICURL.'image/common/nophoto.gif';
$data['picflag'] = '0';
}
$list[] = array(
'id' => $data['topicid'],
'idtype' => 'topicid',
'title' => cutstr($data['title'], $titlelength, ''),
'url' => !empty($_G['setting']['makehtml']['flag']) && !empty($_G['setting']['makehtml']['topichtmldir']) && !$data['htmlmade'] ? fetch_topic_url($data) : 'portal.php?mod=topic&topic='.$data['name'],
'pic' => $data['cover'] ? $data['cover'] : '',
'picflag' => $data['picflag'] ? $data['picflag'] : '',
'summary' => $data['summary'] ? cutstr($data['summary'], $summarylength, '') : '',
'fields' => array(
'fulltitle' => $data['title'],
'uid'=>$data['uid'],
'username'=>$data['username'],
'dateline'=>$data['dateline'],
'viewnum'=>$data['viewnum'],
)
);
}
return array('html' => '', 'data' => $list);
}
}
?>

View File

@@ -0,0 +1,52 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_topichot.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_topic', 'class/block/portal');
class block_topichot extends block_topic {
function __construct() {
$this->setting = array(
'picrequired' => array(
'title' => 'topiclist_picrequired',
'type' => 'radio',
'default' => '0'
),
'titlelength' => array(
'title' => 'topiclist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'summary' => 'topiclist_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'topiclist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_topic_script_topichot');
}
function cookeparameter($parameter) {
$parameter['orderby'] = 'viewnum';
return $parameter;
}
}
?>

View File

@@ -0,0 +1,52 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_topicnew.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_topic', 'class/block/portal');
class block_topicnew extends block_topic {
function __construct() {
$this->setting = array(
'picrequired' => array(
'title' => 'topiclist_picrequired',
'type' => 'radio',
'default' => '0'
),
'titlelength' => array(
'title' => 'topiclist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'summary' => 'topiclist_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'topiclist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_topic_script_topicnew');
}
function cookeparameter($parameter) {
$parameter['orderby'] = 'dateline';
return $parameter;
}
}
?>

View File

@@ -0,0 +1,47 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_topicspecified.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_topic', 'class/block/portal');
class block_topicspecified extends block_topic {
function __construct() {
$this->setting = array(
'topicids' => array(
'title' => 'topiclist_topicids',
'type' => 'text',
'value' => ''
),
'uids' => array(
'title' => 'topiclist_uids',
'type' => 'text',
'value' => ''
),
'titlelength' => array(
'title' => 'topiclist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'summary' => 'topiclist_summarylength',
'type' => 'text',
'default' => 80
)
);
}
function name() {
return lang('blockclass', 'blockclass_topic_script_topicspecified');
}
}
?>

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_portal'),
);
?>

View File

View File

@@ -0,0 +1,145 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_album.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class block_album extends discuz_block {
var $setting = array();
function __construct() {
$this->setting = array(
'aids' => array(
'title' => 'albumlist_aids',
'type' => 'text',
'value' => ''
),
'uids' => array(
'title' => 'albumlist_uids',
'type' => 'text',
'value' => ''
),
'catid' => array(
'title' => 'albumlist_catid',
'type' => 'mselect',
),
'orderby' => array(
'title' => 'albumlist_orderby',
'type' => 'mradio',
'value' => array(
array('dateline', 'albumlist_orderby_dateline'),
array('updatetime', 'albumlist_orderby_updatetime'),
array('picnum', 'albumlist_orderby_picnum'),
),
'default' => 'dateline'
),
'titlelength' => array(
'title' => 'albumlist_titlelength',
'type' => 'text',
'default' => 40
),
'startrow' => array(
'title' => 'albumlist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_album_script_album');
}
function blockclass() {
return array('album', lang('blockclass', 'blockclass_space_album'));
}
function fields() {
return array(
'id' => array('name' => lang('blockclass', 'blockclass_field_id'), 'formtype' => 'text', 'datatype' => 'int'),
'url' => array('name' => lang('blockclass', 'blockclass_album_field_url'), 'formtype' => 'text', 'datatype' => 'string'),
'title' => array('name' => lang('blockclass', 'blockclass_album_field_title'), 'formtype' => 'title', 'datatype' => 'title'),
'pic' => array('name' => lang('blockclass', 'blockclass_album_field_pic'), 'formtype' => 'pic', 'datatype' => 'pic'),
'uid' => array('name' => lang('blockclass', 'blockclass_album_field_uid'), 'formtype' => 'text', 'datatype' => 'int'),
'username' => array('name' => lang('blockclass', 'blockclass_album_field_username'), 'formtype' => 'text', 'datatype' => 'string'),
'dateline' => array('name' => lang('blockclass', 'blockclass_album_field_dateline'), 'formtype' => 'date', 'datatype' => 'date'),
'updatetime' => array('name' => lang('blockclass', 'blockclass_album_field_updatetime'), 'formtype' => 'date', 'datatype' => 'date'),
'picnum' => array('name' => lang('blockclass', 'blockclass_album_field_picnum'), 'formtype' => 'text', 'datatype' => 'int'),
);
}
function getsetting() {
global $_G;
$settings = $this->setting;
if($settings['catid']) {
$settings['catid']['value'][] = array(0, lang('portalcp', 'block_all_category'));
loadcache('albumcategory');
foreach($_G['cache']['albumcategory'] as $value) {
if($value['level'] == 0) {
$settings['catid']['value'][] = array($value['catid'], $value['catname']);
if($value['children']) {
foreach($value['children'] as $catid2) {
$value2 = $_G['cache']['albumcategory'][$catid2];
$settings['catid']['value'][] = array($value2['catid'], '-- '.$value2['catname']);
if($value2['children']) {
foreach($value2['children'] as $catid3) {
$value3 = $_G['cache']['albumcategory'][$catid3];
$settings['catid']['value'][] = array($value3['catid'], '---- '.$value3['catname']);
}
}
}
}
}
}
}
return $settings;
}
function getdata($style, $parameter) {
global $_G;
$parameter = $this->cookparameter($parameter);
$uids = !empty($parameter['uids']) ? explode(',', $parameter['uids']) : array();
$aids = !empty($parameter['aids']) ? explode(',', $parameter['aids']) : array();
$catid = !empty($parameter['catid']) ? $parameter['catid'] : array();
$startrow = isset($parameter['startrow']) ? intval($parameter['startrow']) : 0;
$items = isset($parameter['items']) ? intval($parameter['items']) : 10;
$titlelength = isset($parameter['titlelength']) ? intval($parameter['titlelength']) : 40;
$orderby = isset($parameter['orderby']) && in_array($parameter['orderby'],array('dateline', 'picnum', 'updatetime')) ? $parameter['orderby'] : 'dateline';
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
$list = array();
$query = C::t('home_album')->fetch_all_by_block($aids, $bannedids, $uids, $catid, $startrow, $items, $orderby);
foreach($query as $data) {
$list[] = array(
'id' => $data['albumid'],
'idtype' => 'albumid',
'title' => cutstr($data['albumname'], $titlelength, ''),
'url' => "home.php?mod=space&uid={$data['uid']}&do=album&id={$data['albumid']}",
'pic' => 'album/'.$data['pic'],
'picflag' => $data['picflag'],
'summary' => '',
'fields' => array(
'fulltitle' => $data['albumname'],
'uid'=>$data['uid'],
'username'=>$data['username'],
'dateline'=>$data['dateline'],
'updatetime'=>$data['updatetime'],
'picnum'=>$data['picnum'],
)
);
}
return array('html' => '', 'data' => $list);
}
}
?>

View File

@@ -0,0 +1,46 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_albumnew.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_album', 'class/block/space');
class block_albumnew extends block_album {
function __construct() {
$this->setting = array(
'catid' => array(
'title' => 'albumlist_catid',
'type' => 'mselect',
),
'titlelength' => array(
'title' => 'albumlist_titlelength',
'type' => 'text',
'default' => 40
),
'startrow' => array(
'title' => 'albumlist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_album_script_albumnew');
}
function cookparameter($parameter) {
$parameter['orderby'] = 'updatetime';
return parent::cookparameter($parameter);
}
}
?>

View File

@@ -0,0 +1,46 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_albumspecified.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_album', 'class/block/space');
class block_albumspecified extends block_album {
function __construct() {
$this->setting = array(
'catid' => array(
'title' => 'albumlist_catid',
'type' => 'mselect',
),
'aids' => array(
'title' => 'albumlist_aids',
'type' => 'text',
'value' => ''
),
'uids' => array(
'title' => 'albumlist_uids',
'type' => 'text',
'value' => ''
),
'titlelength' => array(
'title' => 'albumlist_titlelength',
'type' => 'text',
'default' => 40
)
);
}
function name() {
return lang('blockclass', 'blockclass_album_script_albumspecified');
}
}
?>

View File

@@ -0,0 +1,272 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_blog.php 29655 2012-04-24 05:51:56Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class block_blog extends discuz_block {
var $setting = array();
function __construct() {
$this->setting = array(
'blogids' => array(
'title' => 'bloglist_blogids',
'type' => 'text'
),
'uids' => array(
'title' => 'bloglist_uids',
'type' => 'text',
),
'catid' => array(
'title' => 'bloglist_catid',
'type'=>'mselect',
),
'picrequired' => array(
'title' => 'bloglist_picrequired',
'type' => 'radio',
'default' => '0'
),
'orderby' => array(
'title' => 'bloglist_orderby',
'type' => 'mradio',
'value' => array(
array('dateline', 'bloglist_orderby_dateline'),
array('viewnum', 'bloglist_orderby_viewnum'),
array('replynum', 'bloglist_orderby_replynum'),
array('hot', 'bloglist_orderby_hot')
),
'default' => 'dateline'
),
'hours' => array(
'title' => 'bloglist_hours',
'type' => 'mradio',
'value' => array(
array('', 'bloglist_hours_nolimit'),
array('1', 'bloglist_hours_hour'),
array('24', 'bloglist_hours_day'),
array('168', 'bloglist_hours_week'),
array('720', 'bloglist_hours_month'),
array('8760', 'bloglist_hours_year'),
),
'default' => ''
),
'titlelength' => array(
'title' => 'bloglist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'bloglist_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'bloglist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_blog_script_blog');
}
function blockclass() {
return array('blog', lang('blockclass', 'blockclass_space_blog'));
}
function fields() {
return array(
'id' => array('name' => lang('blockclass', 'blockclass_field_id'), 'formtype' => 'text', 'datatype' => 'int'),
'url' => array('name' => lang('blockclass', 'blockclass_blog_field_url'), 'formtype' => 'text', 'datatype' => 'string'),
'title' => array('name' => lang('blockclass', 'blockclass_blog_field_title'), 'formtype' => 'title', 'datatype' => 'title'),
'summary' => array('name' => lang('blockclass', 'blockclass_blog_field_summary'), 'formtype' => 'summary', 'datatype' => 'summary'),
'pic' => array('name' => lang('blockclass', 'blockclass_blog_field_pic'), 'formtype' => 'pic', 'datatype' => 'pic'),
'dateline' => array('name' => lang('blockclass', 'blockclass_blog_field_dateline'), 'formtype' => 'date', 'datatype' => 'date'),
'uid' => array('name' => lang('blockclass', 'blockclass_blog_field_uid'), 'formtype' => 'text', 'datatype' => 'int'),
'username' => array('name' => lang('blockclass', 'blockclass_blog_field_username'), 'formtype' => 'text', 'datatype' => 'string'),
'avatar' => array('name' => lang('blockclass', 'blockclass_blog_field_avatar'), 'formtype' => 'text', 'datatype' => 'string'),
'avatar_middle' => array('name' => lang('blockclass', 'blockclass_blog_field_avatar_middle'), 'formtype' => 'text', 'datatype' => 'string'),
'avatar_big' => array('name' => lang('blockclass', 'blockclass_blog_field_avatar_big'), 'formtype' => 'text', 'datatype' => 'string'),
'replynum' => array('name' => lang('blockclass', 'blockclass_blog_field_replynum'), 'formtype' => 'text', 'datatype' => 'int'),
'viewnum' => array('name' => lang('blockclass', 'blockclass_blog_field_viewnum'), 'formtype' => 'text', 'datatype' => 'int'),
'click1' => array('name' => lang('blockclass', 'blockclass_blog_field_click1'), 'formtype' => 'text', 'datatype' => 'int'),
'click2' => array('name' => lang('blockclass', 'blockclass_blog_field_click2'), 'formtype' => 'text', 'datatype' => 'int'),
'click3' => array('name' => lang('blockclass', 'blockclass_blog_field_click3'), 'formtype' => 'text', 'datatype' => 'int'),
'click4' => array('name' => lang('blockclass', 'blockclass_blog_field_click4'), 'formtype' => 'text', 'datatype' => 'int'),
'click5' => array('name' => lang('blockclass', 'blockclass_blog_field_click5'), 'formtype' => 'text', 'datatype' => 'int'),
'click6' => array('name' => lang('blockclass', 'blockclass_blog_field_click6'), 'formtype' => 'text', 'datatype' => 'int'),
'click7' => array('name' => lang('blockclass', 'blockclass_blog_field_click7'), 'formtype' => 'text', 'datatype' => 'int'),
'click8' => array('name' => lang('blockclass', 'blockclass_blog_field_click8'), 'formtype' => 'text', 'datatype' => 'int'),
);
}
function fieldsconvert() {
return array(
'forum_thread' => array(
'name' => lang('blockclass', 'blockclass_forum_thread'),
'script' => 'thread',
'searchkeys' => array('username', 'uid', 'viewnum', 'replynum'),
'replacekeys' => array('author', 'authorid', 'views', 'replies'),
),
'group_thread' => array(
'name' => lang('blockclass', 'blockclass_group_thread'),
'script' => 'groupthread',
'searchkeys' => array('username', 'uid', 'viewnum', 'replynum'),
'replacekeys' => array('author', 'authorid', 'views', 'replies'),
),
'portal_article' => array(
'name' => lang('blockclass', 'blockclass_portal_article'),
'script' => 'article',
'searchkeys' => array('replynum'),
'replacekeys' => array('commentnum'),
),
);
}
function getsetting() {
global $_G;
$settings = $this->setting;
if(!empty($settings['catid'])) {
$settings['catid']['value'][] = array(0, lang('portalcp', 'block_all_category'));
loadcache('blogcategory');
foreach($_G['cache']['blogcategory'] as $value) {
if($value['level'] == 0) {
$settings['catid']['value'][] = array($value['catid'], $value['catname']);
if($value['children']) {
foreach($value['children'] as $catid2) {
$value2 = $_G['cache']['blogcategory'][$catid2];
$settings['catid']['value'][] = array($value2['catid'], '-- '.$value2['catname']);
if($value2['children']) {
foreach($value2['children'] as $catid3) {
$value3 = $_G['cache']['blogcategory'][$catid3];
$settings['catid']['value'][] = array($value3['catid'], '---- '.$value3['catname']);
}
}
}
}
}
}
}
return $settings;
}
function getdata($style, $parameter) {
global $_G;
$parameter = $this->cookparameter($parameter);
$blogids = !empty($parameter['blogids']) ? explode(',',$parameter['blogids']) : array();
$uids = !empty($parameter['uids']) ? explode(',', $parameter['uids']) : array();
$catid = !empty($parameter['catid']) ? $parameter['catid'] : array();
$startrow = isset($parameter['startrow']) ? intval($parameter['startrow']) : 0;
$items = isset($parameter['items']) ? intval($parameter['items']) : 10;
$hours = isset($parameter['hours']) ? intval($parameter['hours']) : '';
$titlelength = $parameter['titlelength'] ? intval($parameter['titlelength']) : 40;
$summarylength = $parameter['summarylength'] ? intval($parameter['summarylength']) : 80;
$orderby = isset($parameter['orderby']) && in_array($parameter['orderby'],array('dateline', 'viewnum', 'replynum', 'hot')) ? $parameter['orderby'] : 'dateline';
$picrequired = !empty($parameter['picrequired']) ? 1 : 0;
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
$datalist = $list = array();
$wheres = array();
if(!$blogids && !$catid && $_G['setting']['blockmaxaggregationitem']) {
if(($maxid = $this->getmaxid() - $_G['setting']['blockmaxaggregationitem']) > 0) {
$wheres[] = 'b.blogid > '.$maxid;
}
}
if($blogids) {
$wheres[] = 'b.blogid IN ('.dimplode($blogids).')';
}
if($bannedids) {
$wheres[] = 'b.blogid NOT IN ('.dimplode($bannedids).')';
}
if($uids) {
$wheres[] = 'b.uid IN ('.dimplode($uids).')';
}
if($catid && !in_array('0', $catid)) {
$wheres[] = 'b.catid IN ('.dimplode($catid).')';
}
if($hours) {
$timestamp = TIMESTAMP - 3600 * $hours;
$wheres[] = "b.dateline >= '$timestamp'";
}
$tablesql = $fieldsql = '';
if($style['getsummary'] || $picrequired || $style['getpic']) {
if($picrequired) {
$wheres[] = "bf.pic != ''";
}
$tablesql = ' LEFT JOIN '.DB::table('home_blogfield')." bf ON b.blogid = bf.blogid";
$fieldsql = ', bf.pic, b.picflag, bf.message';
}
$wheres[] = "b.friend = '0'";
$wheres[] = "b.status='0'";
$wheresql = $wheres ? implode(' AND ', $wheres) : '1';
$sql = "SELECT b.* $fieldsql FROM ".DB::table('home_blog')." b $tablesql WHERE $wheresql ORDER BY b.$orderby DESC";
$query = DB::query($sql." LIMIT $startrow,$items;");
while($data = DB::fetch($query)) {
if(empty($data['pic'])) {
$data['pic'] = STATICURL.'image/common/nophoto.gif';
$data['picflag'] = '0';
} else {
$data['pic'] = preg_replace('/\.thumb\.jpg$/', '', $data['pic']);
$data['pic'] = 'album/'.$data['pic'];
$data['picflag'] = $data['remote'] == '1' ? '2' : '1';
}
$list[] = array(
'id' => $data['blogid'],
'idtype' => 'blogid',
'title' => cutstr($data['subject'], $titlelength, ''),
'url' => 'home.php?mod=space&uid='.$data['uid'].'&do=blog&id='.$data['blogid'],
'pic' => $data['pic'],
'picflag' => $data['picflag'],
'summary' => $data['message'] ? preg_replace("/&amp;[a-z]+\;/i", '', cutstr(strip_tags($data['message']), $summarylength, '')) : '',
'fields' => array(
'fulltitle' => $data['subject'],
'dateline'=>$data['dateline'],
'uid'=>$data['uid'],
'username'=>$data['username'],
'avatar' => avatar($data['uid'], 'small', true, false, false, $_G['setting']['ucenterurl']),
'avatar_middle' => avatar($data['uid'], 'middle', true, false, false, $_G['setting']['ucenterurl']),
'avatar_big' => avatar($data['uid'], 'big', true, false, false, $_G['setting']['ucenterurl']),
'replynum'=>$data['replynum'],
'viewnum'=>$data['viewnum'],
'click1'=>$data['click1'],
'click2'=>$data['click2'],
'click3'=>$data['click3'],
'click4'=>$data['click4'],
'click5'=>$data['click5'],
'click6'=>$data['click6'],
'click7'=>$data['click7'],
'click8'=>$data['click8'],
)
);
}
return array('html' => '', 'data' => $list);
}
function getmaxid() {
loadcache('databasemaxid');
$data = getglobal('cache/databasemaxid');
if(!is_array($data)) {
$data = array();
}
if(!isset($data['blog']) || TIMESTAMP - $data['blog']['dateline'] >= 86400) {
$data['blog']['dateline'] = TIMESTAMP;
$data['blog']['id'] = DB::result_first('SELECT MAX(blogid) FROM '.DB::table('home_blog'));
savecache('databasemaxid', $data);
}
return $data['blog']['id'];
}
}
?>

View File

@@ -0,0 +1,71 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_bloghot.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_blog', 'class/block/space');
class block_bloghot extends block_blog {
var $setting = array();
function __construct() {
$this->setting = array(
'hours' => array(
'title' => 'bloglist_hours',
'type' => 'mradio',
'value' => array(
array('', 'bloglist_hours_nolimit'),
array('1', 'bloglist_hours_hour'),
array('24', 'bloglist_hours_day'),
array('168', 'bloglist_hours_week'),
array('720', 'bloglist_hours_month'),
array('8760', 'bloglist_hours_year'),
),
'default' => '720'
),
'catid' => array(
'title' => 'bloglist_catid',
'type'=>'mselect',
),
'picrequired' => array(
'title' => 'bloglist_picrequired',
'type' => 'radio',
'default' => '0'
),
'titlelength' => array(
'title' => 'bloglist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'bloglist_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'bloglist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_blog_script_bloghot');
}
function cookparameter($parameter) {
$parameter['orderby'] = 'hot';
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_blognew.php 25525 2011-11-14 04:39:11Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_blog', 'class/block/space');
class block_blognew extends block_blog {
var $setting = array();
function __construct() {
$this->setting = array(
'catid' => array(
'title' => 'bloglist_catid',
'type'=>'mselect',
),
'picrequired' => array(
'title' => 'bloglist_picrequired',
'type' => 'radio',
'default' => '0'
),
'titlelength' => array(
'title' => 'bloglist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'bloglist_summarylength',
'type' => 'text',
'default' => 80
),
'startrow' => array(
'title' => 'bloglist_startrow',
'type' => 'text',
'default' => 0
),
);
}
function name() {
return lang('blockclass', 'blockclass_blog_script_blognew');
}
function cookparameter($parameter) {
$parameter['orderby'] = 'dateline';
return parent::cookparameter($parameter);
}
}
?>

View File

@@ -0,0 +1,50 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: block_blogspecified.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('block_blog', 'class/block/space');
class block_blogspecified extends block_blog {
function __construct() {
$this->setting = array(
'blogids' => array(
'title' => 'bloglist_blogids',
'type' => 'text'
),
'uids' => array(
'title' => 'bloglist_uids',
'type' => 'text',
),
'catid' => array(
'title' => 'bloglist_catid',
'type'=>'mselect',
),
'titlelength' => array(
'title' => 'bloglist_titlelength',
'type' => 'text',
'default' => 40
),
'summarylength' => array(
'title' => 'bloglist_summarylength',
'type' => 'text',
'default' => 80
)
);
}
function name() {
return lang('blockclass', 'blockclass_blog_script_blogspecified');
}
}
?>

Some files were not shown because too many files have changed in this diff Show More