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,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