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

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: misc_ajax.php 26657 2011-12-19 04:13:43Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$op = empty($_GET['op'])?'':$_GET['op'];
if($op == 'comment') {
$cid = empty($_GET['cid'])?0:intval($_GET['cid']);
$idtype_array = array('picid' => 'album', 'blogid' => 'blog', 'sid' => 'share', 'uid' => 'wall');
$cmt = C::t('home_comment')->fetch_comment($cid);
if(empty($cmt['idtype']) || !array_key_exists($cmt['idtype'], $idtype_array)) {
showmessage('no_privilege_comment', '', array(), array('return' => true));
} else if(!$_G['setting'][$idtype_array[$cmt['idtype']].'status']) {
showmessage($idtype_array[$cmt['idtype']].'_status_off');
}
if($cid) {
$ajax_edit = 1;
} else {
$ajax_edit = 0;
}
$list = array();
$value = C::t('home_comment')->fetch_latest_by_authorid($_G['uid'], $cid);
$list[] = $value;
} elseif($op == 'getfriendgroup') {
if (!$_G['setting']['friendstatus']) {
showmessage('friend_status_off');
}
$uid = intval($_GET['uid']);
if($_G['uid'] && $uid) {
$space = getuserbyuid($_G['uid']);
$query = C::t('home_friend')->fetch_all_by_uid_fuid($_G['uid'], $uid);
$value = $query[0];
}
require_once libfile('function/friend');
$groups = friend_group_list();
if(empty($value['gid'])) $value['gid'] = 0;
$group =$groups[$value['gid']];
} elseif($op == 'getfriendname') {
if (!$_G['setting']['friendstatus']) {
showmessage('friend_status_off');
}
$groupname = '';
$group = intval($_GET['group']);
if($_G['uid'] && $group) {
require_once libfile('function/friend');
$groups = friend_group_list();
$groupname = $groups[$group];
}
} elseif($op == 'share') {
if (!$_G['setting']['sharestatus']) {
showmessage('share_status_off');
}
require_once libfile('function/share');
$list = array();
foreach(C::t('home_share')->fetch_all_by_uid($_G['uid'], 0, 1) as $value) {
$value = mkshare($value);
$ajax_edit = 1;
$list[] = $value;
}
} elseif($op == 'album') {
if (!$_G['setting']['albumstatus']) {
showmessage('album_status_off');
}
$id = empty($_GET['id'])?0:intval($_GET['id']);
$perpage = 10;
$page = empty($_GET['page'])?1:intval($_GET['page']);
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
if(empty($_G['uid'])) {
showmessage('to_login', null, array(), array('showmsg' => true, 'login' => 1));
}
$count = C::t('home_pic')->check_albumpic($id, NULL, $_G['uid']);
$piclist = array();
$multi = '';
if($count) {
$query = C::t('home_pic')->fetch_all_by_albumid($id, $start, $perpage, 0, 0, 1, $_G['uid']);
foreach($query as $value) {
$value['bigpic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote'], 0);
$value['pic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote']);
$piclist[] = $value;
}
$multi = multi($count, $perpage, $page, "home.php?mod=misc&ac=ajax&op=album&id=$id");
}
} elseif($op == 'docomment') {
if (!$_G['setting']['doingstatus']) {
showmessage('doing_status_off');
}
$doid = intval($_GET['doid']);
$clist = $do = array();
$icon = $_GET['icon'] == 'plus' ? 'minus' : 'plus';
if($doid) {
if($value = C::t('home_doing')->fetch($doid)) {
$value['icon'] = 'plus';
if($value['replynum'] > 0 && ($value['replynum'] < 20 || $doid == $value['doid'])) {
$doids[] = $value['doid'];
$value['icon'] = 'minus';
} elseif($value['replynum']<1) {
$value['icon'] = 'minus';
}
$value['id'] = 0;
$value['layer'] = 0;
$clist[] = $value;
}
}
if($_GET['icon'] == 'plus' && $value['replynum']) {
$tree = new lib_tree();
foreach(C::t('home_docomment')->fetch_all_by_doid($doid) as $value) {
if(empty($value['upid'])) {
$value['upid'] = "do";
}
$tree->setNode($value['id'], $value['upid'], $value);
}
$values = $tree->getChilds("do");
foreach ($values as $key => $id) {
$one = $tree->getValue($id);
$one['layer'] = $tree->getLayer($id) * 2;
$clist[] = $one;
}
}
} elseif($op == 'delnotice') {
if(empty($_G['uid'])) {
showmessage('no_privilege_guest');
}
$id = intval($_GET['id']);
if($id) {
C::t('home_notification')->delete_by_id_uid($id, $_G['uid']);
}
showmessage('do_success');
} elseif($op == 'getreward') {
$reward = '';
if($_G['cookie']['reward_log']) {
$log = explode(',', $_G['cookie']['reward_log']);
if(count($log) == 2 && $log[1]) {
loadcache('creditrule');
$creditlog = C::t('common_credit_rule_log')->fetch($log[1]);
$rule = $_G['cache']['creditrule'][$log[0]];
$rule['cyclenum'] = $rule['rewardnum']? $rule['rewardnum'] - $creditlog['cyclenum'] : 0;
}
dsetcookie('reward_log', '');
}
} elseif($op == 'district') {
$container = $_GET['container'];
$showlevel = intval($_GET['level']);
$showlevel = $showlevel >= 1 && $showlevel <= 5 ? $showlevel : 5;
$values = array(intval($_GET['countryid']), intval($_GET['pid']), intval($_GET['cid']), intval($_GET['did']), intval($_GET['coid']));
$containertype = in_array($_GET['containertype'], array('birth', 'reside'), true) ? $_GET['containertype'] : 'birth';
$level = 1;
if($values[0]) {
$level++;
} else if($_G['uid'] && !empty($_GET['showdefault'])) {
space_merge($_G['member'], 'profile');
$district = array();
if($containertype == 'birth') {
if(!empty($_G['member']['birthcountry'])) {
$district[] = $_G['member']['birthcountry'];
if(!empty($_G['member']['birthprovince'])) {
$district[] = $_G['member']['birthprovince'];
}
if(!empty($_G['member']['birthcity'])) {
$district[] = $_G['member']['birthcity'];
}
if(!empty($_G['member']['birthdist'])) {
$district[] = $_G['member']['birthdist'];
}
if(!empty($_G['member']['birthcommunity'])) {
$district[] = $_G['member']['birthcommunity'];
}
}
} else {
if(!empty($_G['member']['residecountry'])) {
$district[] = $_G['member']['residecountry'];
if(!empty($_G['member']['resideprovince'])) {
$district[] = $_G['member']['resideprovince'];
}
if(!empty($_G['member']['residecity'])) {
$district[] = $_G['member']['residecity'];
}
if(!empty($_G['member']['residedist'])) {
$district[] = $_G['member']['residedist'];
}
if(!empty($_G['member']['residecommunity'])) {
$district[] = $_G['member']['residecommunity'];
}
}
}
if(!empty($district)) {
foreach(C::t('common_district')->fetch_all_by_name($district) as $value) {
$key = $value['level'];
$values[$key] = $value['id'];
}
$level++;
}
}
if($values[1]) {
$level++;
}
if($values[2]) {
$level++;
}
if($values[3]) {
$level++;
}
if($values[4]) {
$level++;
}
$showlevel = $level;
$elems = array();
if($_GET['country']) {
$elems = array($_GET['country'], $_GET['province'], $_GET['city'], $_GET['district'], $_GET['community']);
}
include_once libfile('function/profile');
$html = showdistrict($values, $elems, $container, $showlevel, $containertype);
} elseif($_GET['op'] == 'createalbum') {
if (!$_G['setting']['albumstatus']) {
showmessage('album_status_off');
}
$albumname = 'new:'.$_GET['name'];
require_once libfile('function/spacecp');
$albumid = album_creat_by_id($albumname, intval($_GET['catid']));
}
include template('home/misc_ajax');
?>

View File

@@ -0,0 +1,91 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_category.php 31560 2012-09-10 03:47:45Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(!$_G['setting']['forumstatus']) {
showmessage('forum_status_off');
}
$gquery = C::t('forum_forum')->fetch_all_info_by_fids($gid);
$query = C::t('forum_forum')->fetch_all_info_by_fids(0, 1, 0, $gid, 1, 0, 0, 'forum');
if(!empty($_G['member']['accessmasks'])) {
$fids = array_keys($query);
$accesslist = C::t('forum_access')->fetch_all_by_fid_uid($fids, $_G['uid']);
foreach($query as $key => $val) {
$query[$key]['allowview'] = $accesslist[$key];
}
}
if(empty($gquery) || empty($query)) {
showmessage('forum_nonexistence', NULL);
}
$query = array_merge($gquery, $query);
$fids = array();
foreach($query as $forum) {
$forum['extra'] = dunserialize($forum['extra']);
if(!is_array($forum['extra'])) {
$forum['extra'] = array();
}
if($forum['type'] != 'group') {
$threads += $forum['threads'];
$posts += $forum['posts'];
$todayposts += $forum['todayposts'];
if(forum($forum)) {
$forum['orderid'] = isset($catlist[$forum['fup']]['forumscount']) ? $catlist[$forum['fup']]['forumscount'] : 0;
$catlist[$forum['fup']]['forumscount'] = $forum['orderid'] + 1;
$forum['subforums'] = '';
$forumlist[$forum['fid']] = $forum;
$catlist[$forum['fup']]['forums'][] = $forum['fid'];
$fids[] = $forum['fid'];
}
} else {
$forum['collapseimg'] = 'collapsed_no.gif';
$forum['collapseicon'] = '_no';
$collapse['category_'.$forum['fid']] = '';
if($forum['moderators']) {
$forum['moderators'] = moddisplay($forum['moderators'], 'flat');
}
$catlist[$forum['fid']] = $forum;
$navigation = '<em>&rsaquo;</em> '.$forum['name'];
$navtitle_g = strip_tags($forum['name']);
}
}
if($catlist) {
foreach($catlist as $key => $var) {
$catlist[$key]['forumcolumns'] = $var['catforumcolumns'];
if($var['forumscount'] && $var['catforumcolumns']) {
$catlist[$key]['forumcolwidth'] = (floor(100 / $var['catforumcolumns']) - 0.1).'%';
$catlist[$key]['endrows'] = '';
if($colspan = $var['forumscount'] % $var['catforumcolumns']) {
while(($var['catforumcolumns'] - $colspan) > 0) {
$catlist[$key]['endrows'] .= '<td>&nbsp;</td>';
$colspan ++;
}
$catlist[$key]['endrows'] .= '</tr>';
}
}
}
}
$query = C::t('forum_forum')->fetch_all_subforum_by_fup($fids);
foreach($query as $forum) {
if($_G['setting']['subforumsindex'] && $forumlist[$forum['fup']]['permission'] == 2) {
$forumurl = !empty($forum['domain']) && !empty($_G['setting']['domain']['root']['forum']) ? $_G['scheme'].'://'.$forum['domain'].'.'.$_G['setting']['domain']['root']['forum'] : 'forum.php?mod=forumdisplay&fid='.$forum['fid'];
$forumlist[$forum['fup']]['subforums'] .= '<a href="'.$forumurl.'"><u>'.$forum['name'].'</u></a>&nbsp;&nbsp;';
}
$forumlist[$forum['fup']]['threads'] += $forum['threads'];
$forumlist[$forum['fup']]['posts'] += $forum['posts'];
$forumlist[$forum['fup']]['todayposts'] += $forum['todayposts'];
}
?>

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: misc_emailcheck.php 33688 2013-08-02 03:00:15Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$uid = 0;
$email = '';
$_GET['hash'] = empty($_GET['hash']) ? '' : $_GET['hash'];
if($_GET['hash']) {
list($uid, $email, $time) = explode("\t", authcode($_GET['hash'], 'DECODE', md5(substr(md5($_G['config']['security']['authkey']), 0, 16))));
$uid = intval($uid);
}
if($uid && isemail($email) && $time > TIMESTAMP - 86400) {
$member = getuserbyuid($uid);
$member = array_merge(C::t('common_member_field_forum')->fetch($uid), $member);
list($dateline, $operation, $idstring) = explode("\t", $member['authstr']);
if($dateline != $time || $operation != 3 || $idstring != substr(md5($email), 0, 6)) {
showmessage('email_check_error', 'index.php');
}
$setarr = array('email'=>$email, 'emailstatus'=>'1');
if($member['freeze'] == 2) {
$setarr['freeze'] = 0;
}
loaducenter();
$ucresult = uc_user_edit(addslashes($member['username']), '', '', $email, 1);
if($ucresult == -8) {
showmessage('email_check_account_invalid', '', array(), array('return' => true));
} elseif($ucresult == -4) {
showmessage('profile_email_illegal', '', array(), array('return' => true));
} elseif($ucresult == -5) {
showmessage('profile_email_domain_illegal', '', array(), array('return' => true));
} elseif($ucresult == -6) {
showmessage('profile_email_duplicate', '', array(), array('return' => true));
}
if($_G['setting']['regverify'] == 1 && $member['groupid'] == 8) {
$membergroup = C::t('common_usergroup')->fetch_by_credits($member['credits']);
$setarr['groupid'] = $membergroup['groupid'];
}
$oldemail = $member['email'];
updatecreditbyaction('realemail', $uid);
C::t('common_member')->update($uid, $setarr);
C::t('common_member_field_forum')->update($uid, array('authstr' => ''));
C::t('common_member_validate')->delete($uid);
dsetcookie('newemail', "", -1);
if(!function_exists('sendmail')) {
include libfile('function/mail');
}
$reset_email_subject = array(
'tpl' => 'email_reset',
'var' => array(
'username' => $member['username'],
'bbname' => $_G['setting']['bbname'],
'siteurl' => $_G['setting']['securesiteurl'],
'datetime' => dgmdate(time(), 'Y-m-d H:i:s'),
'request_datetime' => dgmdate($time, 'Y-m-d H:i:s'),
'email' => $email,
'clientip' => $_G['clientip']
)
);
if(!sendmail("{$member['username']} <$oldemail>", $reset_email_subject)) {
runlog('sendmail', "$oldemail sendmail failed.");
}
showmessage('email_check_sucess', 'home.php?mod=spacecp&ac=profile&op=password', array('email' => $email));
} else {
showmessage('email_check_error', 'index.php');
}
?>

View File

@@ -0,0 +1,86 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_forumselect.php 34303 2014-01-15 04:32:19Z hypowang $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(!$_G['setting']['forumstatus']) {
showmessage('forum_status_off');
}
if(!isset($_G['cache']['forums'])) {
loadcache('forums');
}
$grouplist = $commonlist = '';
$special = isset($_GET['special']) ? intval($_GET['special']) : null;
$forumlist = $subforumlist = array();
$i = array();
if(!$special) {
$commonfids = explode('D', $_G['cookie']['visitedfid']);
foreach($commonfids as $k => $fid) {
if($_G['cache']['forums'][$fid]['type'] == 'sub') {
$commonfids[] = $_G['cache']['forums'][$fid]['fup'];
unset($commonfids[$k]);
}
}
$commonfids = array_unique($commonfids);
foreach($commonfids as $fid) {
$fid = intval($fid);
$commonlist .= '<li fid="'.$fid.'">'.$_G['cache']['forums'][$fid]['name'].'</li>';
}
}
foreach($_G['cache']['forums'] as $forum) {
if(!$forum['status'] || $forum['status'] == 2) {
continue;
}
if($forum['type'] != 'group' && $special !== null) {
$allow = false;
if(!$forum['postperm'] || $forum['postperm'] && forumperm($forum['postperm'])) {
if($special == 1) {
$allow = $_G['group']['allowpostpoll'] && substr($forum['allowpostspecial'], -1, 1);
} elseif($special == 2) {
$allow = $_G['group']['allowposttrade'] && substr($forum['allowpostspecial'], -2, 1);
} elseif($special == 3) {
$allow = $_G['group']['allowpostreward'] && isset($_G['setting']['extcredits'][$_G['setting']['creditstransextra'][2]]) && substr($forum['allowpostspecial'], -3, 1);
} elseif($special == 4) {
$allow = $_G['group']['allowpostactivity'] && substr($forum['allowpostspecial'], -4, 1);
} elseif($special == 5) {
$allow = $_G['group']['allowpostdebate'] && substr($forum['allowpostspecial'], -5, 1);
} else {
$allow = true;
$special = 0;
}
}
if(!$allow) {
continue;
}
}
if($forum['type'] == 'group') {
$grouplist .= '<li fid="'.$forum['fid'].'">'.$forum['name'].'</li>';
$visible[$forum['fid']] = true;
} elseif($forum['type'] == 'forum' && isset($visible[$forum['fup']]) && (!$forum['viewperm'] || ($forum['viewperm'] && forumperm($forum['viewperm'])) || strstr($forum['users'], "\t{$_G['uid']}\t"))) {
$forumlist[$forum['fup']] .= '<li fid="'.$forum['fid'].'">'.$forum['name'].'</li>';
$visible[$forum['fid']] = true;
} elseif($forum['type'] == 'sub' && isset($visible[$forum['fup']]) && (!$forum['viewperm'] || ($forum['viewperm'] && forumperm($forum['viewperm'])) || strstr($forum['users'], "\t{$_G['uid']}\t"))) {
$subforumlist[$forum['fup']] .= '<li fid="'.$forum['fid'].'">'.$forum['name'].'</li>';
}
}
include template('forum/post_forumselect');
exit;
?>

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: misc_inputpwd.php 24741 2011-10-10 03:41:51Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(submitcheck('pwdsubmit')) {
$blogid = empty($_POST['blogid'])?0:intval($_POST['blogid']);
$albumid = empty($_POST['albumid'])?0:intval($_POST['albumid']);
$itemarr = array();
if($blogid) {
if (!$_G['setting']['blogstatus']) {
showmessage('blog_status_off');
}
$itemarr = C::t('home_blog')->fetch($blogid);
$itemurl = "home.php?mod=space&uid={$itemarr['uid']}&do=blog&id={$itemarr['blogid']}";
$cookiename = 'view_pwd_blog_'.$blogid;
} elseif($albumid) {
if (!$_G['setting']['albumstatus']) {
showmessage('album_status_off');
}
$itemarr = C::t('home_album')->fetch_album($albumid);
$itemurl = "home.php?mod=space&uid={$itemarr['uid']}&do=album&id={$itemarr['albumid']}";
$cookiename = 'view_pwd_album_'.$albumid;
}
if(empty($itemarr)) {
showmessage('news_does_not_exist');
}
if($itemarr['password'] && $_POST['viewpwd'] == $itemarr['password']) {
dsetcookie($cookiename, md5(md5($itemarr['password'])));
showmessage('proved_to_be_successful', $itemurl, array('succeed'=>1), array('showmsg'=>1, 'timeout'=>1));
} else {
showmessage('password_is_not_passed', $itemurl, array('succeed'=>0), array('showmsg'=>1));
}
}
?>

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: misc_promotion.php 25889 2011-11-24 09:52:20Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
global $_G;
if(!empty($_GET['fromuid'])) {
$fromuid = intval($_GET['fromuid']);
$fromuser = '';
} else {
$fromuser = $_GET['fromuser'];
$fromuid = '';
}
if(!$_G['uid'] || !($fromuid == $_G['uid'] || $fromuser == $_G['username'])) {
if($_G['setting']['creditspolicy']['promotion_visit']) {
if(!C::t('forum_promotion')->fetch($_G['clientip'])) {
C::t('forum_promotion')->insert(array('ip' => $_G['clientip'], 'port' => $_G['remoteport'], 'uid' => $fromuid, 'username' => $fromuser), false, true);
updatecreditbyaction('promotion_visit', $fromuid);
}
}
if($_G['setting']['creditspolicy']['promotion_register']) {
if(!empty($fromuser) && empty($fromuid)) {
if(empty($_G['cookie']['promotion'])) {
$fromuid = C::t('common_member')->fetch_uid_by_username($fromuser);
} else {
$fromuid = intval($_G['cookie']['promotion']);
}
}
if($fromuid) {
dsetcookie('promotion', ($_G['cookie']['promotion'] = $fromuid), 1800);
}
}
}
?>

View File

@@ -0,0 +1,35 @@
<?php
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$activitylist = '';
$orderby = in_array($_GET['orderby'], array('thisweek', 'thismonth', 'today', 'all')) ? $_GET['orderby'] : '';
$navname = $_G['setting']['navs'][8]['navname'];
switch($_GET['view']) {
case 'heats':
$gettype = 'heat';
break;
case 'sharetimes':
$gettype = 'share';
break;
case 'favtimes':
$gettype = 'favorite';
break;
default: $_GET['view'] = 'heats';
}
$view = $_GET['view'];
$dateline = !empty($before) ? TIMESTAMP - $before : 0;
$activitylist = getranklistdata($type, $view, $orderby);
$lastupdate = $_G['lastupdate'];
$nextupdate = $_G['nextupdate'];
$navtitle = lang('ranklist/navtitle', 'ranklist_title_activity_'.$gettype).' - '.$navname;
$metakeywords = lang('ranklist/navtitle', 'ranklist_title_activity_'.$gettype);
$metadescription = lang('ranklist/navtitle', 'ranklist_title_activity_'.$gettype);
include template('diy:ranklist/activity');
?>

View File

@@ -0,0 +1,61 @@
<?php
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
loadcache('click');
$clicks = empty($_G['cache']['click']['blogid'])?array():$_G['cache']['click']['blogid'];
$bloglist = '';
$orderby = in_array($_GET['orderby'], array('thisweek', 'thismonth', 'today', 'all')) ? $_GET['orderby'] : '';
$navname = $_G['setting']['navs'][8]['navname'] . ' - ' . $_G['setting']['bbname'];
switch($_GET['view']) {
case 'heats':
$view = 'hot';
$navtitle = lang('ranklist/navtitle', 'ranklist_title_blog_heat').' - '.$navname;
$metakeywords = lang('ranklist/navtitle', 'ranklist_title_blog_heat');
$metadescription = lang('ranklist/navtitle', 'ranklist_title_blog_heat');
break;
case 'replies':
$view = 'replynum';
$navtitle = lang('ranklist/navtitle', 'ranklist_title_blog_reply').' - '.$navname;
$metakeywords = lang('ranklist/navtitle', 'ranklist_title_blog_reply');
$metadescription = lang('ranklist/navtitle', 'ranklist_title_blog_reply');
break;
case 'views':
$view = 'viewnum';
$navtitle = lang('ranklist/navtitle', 'ranklist_title_blog_view').' - '.$navname;
$metakeywords = lang('ranklist/navtitle', 'ranklist_title_blog_view');
$metadescription = lang('ranklist/navtitle', 'ranklist_title_blog_view');
break;
case 'sharetimes':
$view = 'sharetimes';
$navtitle = lang('ranklist/navtitle', 'ranklist_title_blog_share').' - '.$navname;
$metakeywords = lang('ranklist/navtitle', 'ranklist_title_blog_share');
$metadescription = lang('ranklist/navtitle', 'ranklist_title_blog_share');
break;
case 'favtimes':
$view = 'favtimes';
$navtitle = lang('ranklist/navtitle', 'ranklist_title_blog_favorite').' - '.$navname;
$metakeywords = lang('ranklist/navtitle', 'ranklist_title_blog_favorite');
$metadescription = lang('rankilist/template', 'ranklist_title_blog_favorite');
break;
default:
if($clicks[$_GET['view']]) {
$view = 'click'.$_GET['view'];
$navtitle = lang('ranklist/navtitle', 'ranklist_title_blog_'.$_GET['view']).' - '.$navname;
$metakeywords = lang('ranklist/navtitle', 'ranklist_title_blog_'.$_GET['view']);
$metadescription = lang('ranklist/navtitle', 'ranklist_title_blog_'.$_GET['view']);
} else {
$view = 'hot';
$_GET['view'] = 'heats';
}
}
$bloglist = getranklistdata($type, $view, $orderby);
$lastupdate = $_G['lastupdate'];
$nextupdate = $_G['nextupdate'];
include template('diy:ranklist/blog');
?>

View File

@@ -0,0 +1,43 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_ranklist_forum.php 25889 2011-11-24 09:52:20Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$forumsrank = '';
$view = 'threads';
$navname = $_G['setting']['navs'][8]['navname'];
switch($_GET['view']) {
case 'posts':
$gettype = 'post';
break;
case 'thismonth':
$gettype = 'post_30';
break;
case 'today':
$gettype = 'post_24';
break;
case 'threads':
$gettype = 'thread';
break;
default: $_GET['view'] = 'threads';
}
$view = $_GET['view'];
$forumsrank = getranklistdata($type, $view);
$lastupdate = $_G['lastupdate'];
$nextupdate = $_G['nextupdate'];
$navtitle = lang('ranklist/navtitle', 'ranklist_title_forum_'.$gettype).' - '.$navname;
$metakeywords = lang('ranklist/navtitle', 'ranklist_title_forum_'.$gettype);
$metadescription = lang('ranklist/navtitle', 'ranklist_title_forum_'.$gettype);
include template('diy:ranklist/forum');
?>

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: misc_ranklist_group.php 25889 2011-11-24 09:52:20Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(!$_G['setting']['groupstatus']) {
showmessage('ranklist_this_status_off');
}
$groupsrank = '';
$view = 'threads';
$navname = $_G['setting']['navs'][8]['navname'];
switch($_GET['view']) {
case 'posts':
$gettype = 'post';
break;
case 'today':
$gettype = 'post_24';
break;
case 'threads':
$gettype = 'thread';
break;
case 'credit':
$gettype = 'credit';
break;
case 'member':
$gettype = 'member';
break;
default: $_GET['view'] = 'credit';
}
$view = $_GET['view'];
$groupsrank = getranklistdata($type, $view);
$lastupdate = $_G['lastupdate'];
$nextupdate = $_G['nextupdate'];
$navtitle = lang('ranklist/navtitle', 'ranklist_title_group_'.$gettype).' - '.$navname;
$metakeywords = lang('ranklist/navtitle', 'ranklist_title_group_'.$gettype);
$metadescription = lang('ranklist/navtitle', 'ranklist_title_group_'.$gettype);
include template('diy:ranklist/group');
?>

View File

@@ -0,0 +1,130 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_ranklist_index.php 27449 2012-02-01 05:32:35Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
loadcache('ranklist_index');
$cache_time = $ranklist_setting['cache_time'];
if($cache_time <= 0 ) $cache_time = 1;
$cache_time = $cache_time * 3600;
define('RANKLIST_INDEX_CACHE_TIME', $cache_time);
function is_ranklistcache_available($name) {
global $_G;
if(!is_array($_G['cache']['ranklist_index'])) {
$_G['cache']['ranklist_index'] = array();
}
if($_G['cache']['ranklist_index'][$name]['lastupdated'] && TIMESTAMP - $_G['cache']['ranklist_index'][$name]['lastupdated'] < RANKLIST_INDEX_CACHE_TIME) {
return true;
}
return false;
}
function getranklistcache($name, $dateline = '') {
global $_G;
if(is_ranklistcache_available($name)) {
$ranklist = $_G['cache']['ranklist_index'][$name];
unset($ranklist['lastupdated']);
return $ranklist;
}
switch($name) {
case 'pictures':
$ranklist = getranklist_pictures_index(9);
break;
case 'threads_hot':
$ranklist = getranklist_thread(10, 'heats', $dateline);
break;
case 'blogs_hot':
$ranklist = getranklist_blog(10, 'hot', $dateline);
break;
case 'polls_hot':
$ranklist = getranklist_poll(10, 'heats', $dateline);
break;
case 'activities_hot':
$ranklist = getranklist_activity(10, 'heats', $dateline);
break;
case 'girllist':
$ranklist = getranklist_girls(0, 10);
break;
}
$ranklist['lastupdated'] = TIMESTAMP;
ranklist_cache_push($name, $ranklist);
return $ranklist;
}
function ranklist_cache_push($name, $ranklist) {
global $_G;
$_G['cache']['ranklist_index'][$name] = $ranklist;
$_G['cache']['ranklist_index']['lastupdated'] = $ranklist['lastupdated'];
$_G['ranklist_cacheupdated'] = true;
}
$dateline = $before = '';
$before = $ranklist_setting['index_select'] ? $ranklist_setting['index_select'] : 'thisweek';
switch($before) {
case 'all':
$dateline = '0';
break;
case 'today':
$dateline = '86400';
break;
case 'thisweek':
$dateline = '604800';
break;
case 'thismonth':
$dateline = '2592000';
break;
default: $dateline = '604800';
}
$dateline = !empty($dateline) ? TIMESTAMP - $dateline : 0;
$i = 0;
if($ranklist_setting['picture']['available']) {
$pictures = getranklistcache('pictures');
}
if($ranklist_setting['thread']['available']) {
$threads_hot = getranklistcache('threads_hot', $before);
$i++;
$thread_pos = $i;
}
if($ranklist_setting['blog']['available']) {
$blogs_hot = getranklistcache('blogs_hot', $before);
$i++;
$blog_pos = $i;
}
if($ranklist_setting['poll']['available']) {
$polls_hot = getranklistcache('polls_hot', $before);
$i++;
$poll_pos = $i;
}
if($ranklist_setting['activity']['available']) {
$activities_hot = getranklistcache('activities_hot', $before);
$i++;
$activity_pos = $i;
}
if($ranklist_setting['member']['available']) {
$memberlist = getranklist_members(0, 27);
}
if($_G['ranklist_cacheupdated']) {
savecache('ranklist_index', $_G['cache']['ranklist_index']);
}
unset($pictures['lastupdated'], $threads_hot['lastupdated'], $blogs_hot['lastupdated']);
unset($polls_hot['lastupdated'], $activities_hot['lastupdated'], $memberlist['lastupdated']);
$navtitle = $_G['setting']['navs'][8]['navname'];
$metakeywords = $navtitle;
$metadescription = $navtitle;
include template('diy:ranklist/ranklist');
?>

View File

@@ -0,0 +1,261 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_ranklist_member.php 26628 2011-12-16 10:20:35Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
loadcache('usergroups');
$multi = $gettype = '';
$list = array();
$cachetip = TRUE;
$perpage = 20;
$page = empty($_GET['page']) ? 1 : intval($_GET['page']);
if($page < 1) {
$page = 1;
}
$start = ($page - 1) * $perpage;
require_once libfile('function/home');
ckstart($start, $perpage);
$creditkey = $cache_name = '';
$fuids = array();
$count = 0;
$now_pos = 0;
$now_choose = '';
if ($_GET['view'] == 'credit') {
$gettype = 'credit';
$creditsrank_change = 1;
$extcredits = $_G['setting']['extcredits'];
$now_choose = $_GET['orderby'] && $extcredits[$_GET['orderby']] ? $_GET['orderby'] : 'all';
if(!$_GET['orderby'] || !$extcredits[$_GET['orderby']]) {
$_GET['orderby'] = 'all';
}
if($_G['uid']) {
$mycredits = $now_choose == 'all' ? $_G['member']['credits'] : getuserprofile('extcredits'.$now_choose);
$cookie_name = 'space_top_credit_'.$_G['uid'].'_'.$now_choose;
if($_G['cookie'][$cookie_name]) {
$now_pos = $_G['cookie'][$cookie_name];
} else {
if($now_choose == 'all') {
$now_pos = C::t('common_member')->count_by_credits($mycredits);
} else {
$now_pos = C::t('common_member_count')->count_by_extcredits($now_choose, $mycredits);
}
$now_pos++;
dsetcookie($cookie_name, $now_pos);
}
} else {
$now_pos = -1;
}
$view = $_GET['view'];
$orderby = $_GET['orderby'];
$list = getranklistdata($type, $view, $orderby);
} elseif ($_GET['view'] == 'friendnum' && helper_access::check_module('friend')) {
$gettype = 'friend';
if($_G['uid']) {
$space = $_G['member'];
space_merge($space, 'count');
$cookie_name = 'space_top_'.$_GET['view'].'_'.$_G['uid'];
if($_G['cookie'][$cookie_name]) {
$now_pos = $_G['cookie'][$cookie_name];
} else {
$now_pos = C::t('common_member_count')->count_by_friends($space['friends']);
$now_pos++;
dsetcookie($cookie_name, $now_pos);
}
} else {
$now_pos = -1;
}
$view = $_GET['view'];
$orderby = $_GET['orderby'];
$list = getranklistdata($type, $view, $orderby);
} elseif ($_GET['view'] == 'invite') {
$gettype = 'invite';
$now_pos = -1;
$inviterank_change = 1;
$now_choose = 'thisweek';
switch($_GET['orderby']) {
case 'thismonth':
$now_choose = 'thismonth';
break;
case 'today':
$now_choose = 'today';
break;
case 'thisweek':
$now_choose = 'thisweek';
break;
default :
$now_choose = 'all';
}
$view = $_GET['view'];
$orderby = $_GET['orderby'];
$list = getranklistdata($type, $view, $orderby);
} elseif($_GET['view'] == 'blog' && helper_access::check_module('blog')) {
$gettype = 'blog';
$now_pos = -1;
$view = $_GET['view'];
$orderby = $_GET['orderby'];
$list = getranklistdata($type, $view, $orderby);
} elseif($_GET['view'] == 'beauty') {
$gettype = 'girl';
$now_pos = -1;
$view = $_GET['view'];
$orderby = $_GET['orderby'];
$list = getranklistdata($type, $view, $orderby);
} elseif($_GET['view'] == 'handsome') {
$gettype = 'boy';
$now_pos = -1;
$view = $_GET['view'];
$orderby = $_GET['orderby'];
$list = getranklistdata($type, $view, $orderby);
} elseif($_GET['view'] == 'post' && helper_access::check_module('forum')) {
$gettype = 'post';
$postsrank_change = 1;
$now_pos = -1;
$now_choose = 'posts';
switch($_GET['orderby']) {
case 'digestposts':
$now_choose = 'digestposts';
break;
case 'thismonth':
$now_choose = 'thismonth';
break;
case 'today':
$now_choose = 'today';
break;
}
$view = $_GET['view'];
$orderby = $_GET['orderby'];
$list = getranklistdata($type, $view, $orderby);
} elseif($_GET['view'] == 'onlinetime' && !$_G['setting']['sessionclose']) {
$gettype = 'onlinetime';
$onlinetimerank_change = 1;
$now_pos = -1;
$now_choose = 'thismonth';
switch($_GET['orderby']) {
case 'thismonth':
$now_choose = 'thismonth';
break;
case 'all':
$now_choose = 'all';
break;
default :
$_GET['orderby'] = 'thismonth';
}
$view = $_GET['view'];
$orderby = $_GET['orderby'];
$list = getranklistdata($type, $view, $orderby);
} else {
if(!$ranklist_setting['membershow']) {
header('Location: misc.php?mod=ranklist&type=member&view=beauty');
}
$announcement = $ranklist_setting['membershowannouncement'];
$gettype = 'bid';
$cachetip = FALSE;
$_GET['view'] = 'show';
$creditid = 0;
if($_G['setting']['creditstransextra'][6]) {
$creditid = intval($_G['setting']['creditstransextra'][6]);
$creditkey = 'extcredits'.$creditid;
} elseif ($_G['setting']['creditstrans']) {
$creditid = intval($_G['setting']['creditstrans']);
$creditkey = 'extcredits'.$creditid;
}
$extcredits = $_G['setting']['extcredits'];
$count = C::t('home_show')->count_by_credit();
$space = array();
if($count) {
$space = $_G['member'];
space_merge($space, 'count');
$space['credit'] = empty($creditkey) ? 0 : $space[$creditkey];
$myshowinfo = C::t('home_show')->fetch_by_uid_credit($space['uid']); //DB::fetch_first("SELECT unitprice, credit FROM ".DB::table('home_show')." WHERE uid='{$space['uid']}' AND credit>0");
$myallcredit = intval($myshowinfo['credit']);
$space['unitprice'] = intval($myshowinfo['unitprice']);
$now_pos = C::t('home_show')->count_by_credit($space['unitprice']);//DB::result_first("SELECT COUNT(*) FROM ".DB::table('home_show')." WHERE unitprice>='{$space['unitprice']}' AND credit>0");
$deluser = false;
$query = C::t('home_show')->fetch_all_by_unitprice($start, $perpage);
foreach ($query as $value) {
if(!$deluser && $value['show_credit'] < 1) {
$deluser = true;
} else {
$list[$value['uid']] = $value;
}
}
if($deluser) {
C::t('home_show')->delete_by_credit(1);
}
$multi = multi($count, $perpage, $page, "misc.php?mod=ranklist&type=member&view={$_GET['view']}");
}
}
if($cachetip) {
$lastupdate = $_G['lastupdate'];
$nextupdate = $_G['nextupdate'];
}
$myfuids =array();
$query = C::t('home_friend')->fetch_all($_G['uid']);
foreach($query as $value) {
$myfuids[$value['fuid']] = $value['fuid'];
}
$myfuids[$_G['uid']] = $_G['uid'];
$i = $_GET['page'] ? ($_GET['page']-1)*$perpage+1 : 1;
foreach($list as $key => $value) {
$fuids[] = $value['uid'];
if(isset($value['lastactivity'])) $value['lastactivity'] = dgmdate($value['lastactivity'], 't');
$value['isfriend'] = empty($myfuids[$value['uid']])?0:1;
$list[$key] = $value;
$list[$key]['rank'] = $i;
$i++;
}
$ols = array();
if($fuids) {
foreach(C::app()->session->fetch_all_by_uid($fuids) as $value) {
if(!$value['invisible']) {
$ols[$value['uid']] = $value['lastactivity'];
} elseif ($_GET['view'] == 'online' && $list[$value['uid']]) {
unset($list[$value['uid']]);
}
}
}
$a_actives = array($_GET['view'] => ' class="a"');
$navname = $_G['setting']['navs'][8]['navname'];
$navtitle = lang('ranklist/navtitle', 'ranklist_title_member_'.$gettype).' - '.$navname;
$metakeywords = lang('ranklist/navtitle', 'ranklist_title_member_'.$gettype);
$metadescription = lang('ranklist/navtitle', 'ranklist_title_member_'.$gettype);
include template('diy:ranklist/member');
?>

View File

@@ -0,0 +1,44 @@
<?php
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
loadcache('click');
$clicks = empty($_G['cache']['click']['picid'])?array():$_G['cache']['click']['picid'];
$picturelist = '';
$orderby = in_array($_GET['orderby'], array('thisweek', 'thismonth', 'today', 'all')) ? $_GET['orderby'] : '';
$navname = $_G['setting']['navs'][8]['navname'];
switch($_GET['view']) {
case 'hot':
$view = 'hot';
$navtitle = lang('ranklist/navtitle', 'ranklist_title_picture_heat').' - '.$navname;
$metakeywords = lang('ranklist/navtitle', 'ranklist_title_picture_heat');
$metadescription = lang('ranklist/navtitle', 'ranklist_title_picture_heat');
break;
case 'sharetimes':
$view = 'sharetimes';
$navtitle = lang('ranklist/navtitle', 'ranklist_title_picture_share'). ' - '.$navname;
$metakeywords = lang('ranklist/navtitle', 'ranklist_title_picture_share');
$metadescription = lang('ranklist/navtitle', 'ranklist_title_picture_share');
break;
default:
if($clicks[$_GET['view']]) {
$view = 'click'.$_GET['view'];
$navtitle = lang('ranklist/navtitle', 'ranklist_title_picture_'.$_GET['view']).' - '.$navname;
$metakeywords = lang('ranklist/navtitle', 'ranklist_title_picture_'.$_GET['view']);
$metadescription = lang('ranklist/navtitle', 'ranklist_title_picture_'.$_GET['view']);
} else {
$_GET['view'] = 'hot';
$view = 'hot';
}
}
$picturelist = getranklistdata($type, $view, $orderby);
$lastupdate = $_G['lastupdate'];
$nextupdate = $_G['nextupdate'];
include template('diy:ranklist/picture');
?>

View File

@@ -0,0 +1,34 @@
<?php
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$polllist = '';
$orderby = in_array($_GET['orderby'], array('thisweek', 'thismonth', 'today', 'all')) ? $_GET['orderby'] : '';
$navname = $_G['setting']['navs'][8]['navname'];
switch($_GET['view']) {
case 'heats':
$gettype = 'heat';
break;
case 'sharetimes':
$gettype = 'share';
break;
case 'favtimes':
$gettype = 'favorite';
break;
default:
$_GET['view'] = 'heats';
}
$view = $_GET['view'];
$polllist = getranklistdata($type, $view, $orderby);
$lastupdate = $_G['lastupdate'];
$nextupdate = $_G['nextupdate'];
$navtitle = lang('ranklist/navtitle', 'ranklist_title_poll_'.$gettype).' - '.$navname;
$metakeywords = lang('ranklist/navtitle', 'ranklist_title_poll_'.$gettype);
$metadescription = lang('ranklist/navtitle', 'ranklist_title_poll_'.$gettype);
include template('diy:ranklist/poll');
?>

View File

@@ -0,0 +1,39 @@
<?php
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$threadlist = '';
$orderby = in_array($_GET['orderby'], array('thisweek', 'thismonth', 'today', 'all')) ? $_GET['orderby'] : '';
$navname = $_G['setting']['navs'][8]['navname'];
switch($_GET['view']) {
case 'replies':
$gettype = 'reply';
break;
case 'views':
$gettype = 'view';
break;
case 'sharetimes':
$gettype = 'share';
break;
case 'favtimes':
$gettype = 'favorite';
break;
case 'heats':
$gettype = 'heat';
break;
default: $_GET['view'] = 'replies';
}
$view = $_GET['view'];
$threadlist = getranklistdata($type, $view, $orderby);
$lastupdate = $_G['lastupdate'];
$nextupdate = $_G['nextupdate'];
$navtitle = lang('ranklist/navtitle', 'ranklist_title_thread_'.$gettype).' - '.$navname;
$metakeywords = lang('ranklist/navtitle', 'ranklist_title_thread_'.$gettype);
$metadescription = lang('ranklist/navtitle', 'ranklist_title_thread_'.$gettype);
include template('diy:ranklist/thread');
?>

View File

@@ -0,0 +1,151 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_security.php 25889 2011-11-24 09:52:20Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
global $_G;
if(is_string($this->config['security']['attackevasive'])) {
$attackevasive_tmp = explode('|', $this->config['security']['attackevasive']);
$attackevasive = 0;
foreach($attackevasive_tmp AS $key => $value) {
$attackevasive += intval($value);
}
unset($attackevasive_tmp);
} else {
$attackevasive = $this->config['security']['attackevasive'];
}
$lastrequest = isset($_G['cookie']['lastrequest']) ? authcode($_G['cookie']['lastrequest'], 'DECODE') : '';
if($attackevasive & 1 || $attackevasive & 4) {
dsetcookie('lastrequest', authcode(TIMESTAMP, 'ENCODE'), TIMESTAMP + 816400, 1, true);
}
if($attackevasive & 1) {
if(TIMESTAMP - $lastrequest < 1) {
securitymessage('attackevasive_1_subject', 'attackevasive_1_message');
}
}
if(($attackevasive & 2) && ($_SERVER['HTTP_X_FORWARDED_FOR'] ||
$_SERVER['HTTP_VIA'] || $_SERVER['HTTP_PROXY_CONNECTION'] ||
$_SERVER['HTTP_USER_AGENT_VIA'] || $_SERVER['HTTP_CACHE_INFO'] ||
$_SERVER['HTTP_PROXY_CONNECTION'])) {
securitymessage('attackevasive_2_subject', 'attackevasive_2_message', FALSE);
}
if($attackevasive & 4) {
if(empty($lastrequest) || TIMESTAMP - $lastrequest > 300) {
securitymessage('attackevasive_4_subject', 'attackevasive_4_message');
}
}
if($attackevasive & 8) {
list($visitcode, $visitcheck, $visittime) = explode('|', authcode($_G['cookie']['visitcode'], 'DECODE'));
if(!$visitcode || !$visitcheck || !$visittime || TIMESTAMP - $visittime > 60 * 60 * 4 ) {
if(empty($_POST['secqsubmit']) || ($visitcode != md5($_POST['answer']))) {
$answer = 0;
$question = '';
for ($i = 0; $i< rand(2, 5); $i ++) {
$r = rand(1, 20);
$question .= $question ? ' + '.$r : $r;
$answer += $r;
}
$question .= ' = ?';
dsetcookie('visitcode', authcode(md5($answer).'|0|'.TIMESTAMP, 'ENCODE'), TIMESTAMP + 816400, 1, true);
securitymessage($question, '<input type="text" name="answer" size="8" maxlength="150" /><input type="submit" name="secqsubmit" class="button" value=" Submit " />', FALSE, TRUE);
} else {
dsetcookie('visitcode', authcode($visitcode.'|1|'.TIMESTAMP, 'ENCODE'), TIMESTAMP + 816400, 1, true);
}
}
}
function securitymessage($subject, $message, $reload = TRUE, $form = FALSE) {
global $_G;
include_once DISCUZ_ROOT.'./source/language/lang_security.php';
if(!is_array($lang)) {
$lang = array();
}
$subject = isset($lang[$subject]) ? $lang[$subject] : $subject;
$message = isset($lang[$message]) ? $lang[$message] : $message;
if($_GET['inajax']) {
security_ajaxshowheader();
echo '<div id="attackevasive_1" class="popupmenu_option"><b style="font-size: 16px">'.$subject.'</b><br /><br />'.$message.'</div>';
security_ajaxshowfooter();
} else {
$charset = getglobal('config/output/charset');
@header('Content-Type: text/html; charset='.$charset);
echo '<html>';
echo '<head>';
echo '<meta charset="'.$_G['charset'].'" />';
echo '<meta name="renderer" content="webkit" />';
echo '<meta http-equiv="X-UA-Compatible" content="IE=edge" />';
echo '<title>'.$subject.'</title>';
echo '</head>';
echo '<body bgcolor="#FFFFFF">';
if($reload) {
echo '<script language="JavaScript">';
echo 'function reload() {';
echo ' document.location.reload();';
echo '}';
echo 'setTimeout("reload()", 1001);';
echo '</script>';
}
if($form) {
echo '<form action="'.$_G['PHP_SELF'].'" method="post" autocomplete="off">';
}
echo '<table cellpadding="0" cellspacing="0" border="0" width="700" align="center" height="85%">';
echo ' <tr align="center" valign="middle">';
echo ' <td>';
echo ' <table cellpadding="10" cellspacing="0" border="0" width="80%" align="center" style="font-family: Verdana, Tahoma; color: #666666; font-size: 11px">';
echo ' <tr>';
echo ' <td valign="middle" align="center" bgcolor="#EBEBEB">';
echo ' <br /><br /> <b style="font-size: 16px">'.$subject.'</b> <br /><br />';
echo $message;
echo ' <br /><br />';
echo ' </td>';
echo ' </tr>';
echo ' </table>';
echo ' </td>';
echo ' </tr>';
echo '</table>';
if($form) {
echo '</form>';
}
echo '</body>';
echo '</html>';
}
exit();
}
function security_ajaxshowheader() {
$charset = getglobal('config/output/charset');
ob_end_clean();
@header("Expires: -1");
@header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
@header("Pragma: no-cache");
@header("Content-type: application/xml; charset=".$charset);
echo "<?xml version=\"1.0\" encoding=\"".$charset."\"?>\n<root><![CDATA[";
}
function security_ajaxshowfooter() {
echo ']]></root>';
exit();
}
?>

View File

@@ -0,0 +1,72 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_sendmail.php 30849 2012-06-26 02:21:32Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
header('Content-Type: text/javascript');
$pernum = 1;
dsetcookie('sendmail', '1', 300);
$lockfile = DISCUZ_ROOT.'./data/sendmail.lock';
@$filemtime = filemtime($lockfile);
if($_G['timestamp'] - $filemtime < 5) exit();
touch($lockfile);
@set_time_limit(0);
$list = $sublist = $cids = $touids = array();
foreach(C::t('common_mailcron')->fetch_all_by_sendtime($_G['timestamp'], 0, $pernum) as $value) {
if($value['touid']) $touids[$value['touid']] = $value['touid'];
$cids[] = $value['cid'];
$list[$value['cid']] = $value;
}
if(empty($cids)) exit();
foreach(C::t('common_mailqueue')->fetch_all_by_cid($cids) as $value) {
$sublist[$value['cid']][] = $value;
}
if($touids) {
C::t('common_member_status')->update($touids, array('lastsendmail' => TIMESTAMP), 'UNBUFFERED');
}
C::t('common_mailcron')->delete($cids);
C::t('common_mailqueue')->delete_by_cid($cids);
require_once libfile('function/mail');
foreach ($list as $cid => $value) {
$mlist = $sublist[$cid];
if($value['email'] && $mlist) {
$subject = getstr($mlist[0]['subject'], 80, 0, 0, 0, -1);
$message = '';
if(count($mlist) == 1) {
$message = '<br>'.$mlist[0]['message'];
} else {
foreach ($mlist as $subvalue) {
if($subvalue['message']) {
$message .= "<br><strong>{$subvalue['subject']}</strong><br>{$subvalue['message']}<br>";
} else {
$message .= $subvalue['subject'].'<br>';
}
}
}
if(!sendmail($value['email'], $subject, $message)) {
runlog('sendmail', "{$value['email']} sendmail failed.");
}
}
}
?>

View File

@@ -0,0 +1,132 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_stat.php 34937 2014-09-04 03:08:56Z hypowang $
*/
if (!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (empty($_G['setting']['updatestat'])) {
showmessage('not_open_updatestat');
}
if (!checkperm('allowstatdata')) {
showmessage('no_privilege_statdata');
}
$cols = array();
$cols['login'] = array('login', 'mobilelogin', 'connectlogin', 'register', 'invite');
if (empty($_G['setting']['connect']['allow'])) {
unset($cols['login'][2]);
}
$cols['forum'] = array('thread', 'poll', 'activity', 'reward', 'debate', 'trade', 'post');
$cols['tgroup'] = array('group', 'groupthread', 'grouppost');
$cols['home'] = array('doing', 'docomment', 'blog', 'blogcomment', 'pic', 'piccomment', 'share', 'sharecomment');
$cols['space'] = array('wall', 'poke', 'click', 'sendpm', 'addfriend', 'friend');
$type = !empty($_GET['types']) ? array() : (empty($_GET['type']) ? 'all' : $_GET['type']);
$primarybegin = !empty($_GET['primarybegin']) ? $_GET['primarybegin'] : dgmdate($_G['timestamp'] - 2592000, 'Y-m-d');
$primaryend = !empty($_GET['primaryend']) ? $_GET['primaryend'] : dgmdate($_G['timestamp'], 'Y-m-d');
$beginunixstr = strtotime($primarybegin);
$endunixstr = strtotime($primaryend);
if ($beginunixstr > $endunixstr) {
showmessage('start_time_is_greater_than_end_time', NULL, array(), array('return' => true));
} else if ($beginunixstr == $endunixstr) {
showmessage('start_time_end_time_is_equal_to', NULL, array(), array('return' => true));
}
if (!empty($_GET['xml'])) {
$xaxis = '';
$graph = array();
$count = 1;
$begin = dgmdate($beginunixstr, 'Ymd');
$end = dgmdate($endunixstr, 'Ymd');
$field = '*';
if (!empty($_GET['merge'])) {
if (empty($_GET['types'])) {
$_GET['types'] = array_merge($cols['login'], $cols['forum'], $cols['tgroup'], $cols['home'], $cols['space']);
}
if (!array_diff($_GET['types'], array_merge($cols['login'], $cols['forum'], $cols['tgroup'], $cols['home'], $cols['space']))) {
$field = 'daytime,`' . implode('`+`', $_GET['types']) . '` AS statistic';
}
$type = 'statistic';
}
foreach (C::t('common_stat')->fetch_all_stat($begin, $end, $field) as $value) {
$xaxis .= "<value xid='$count'>" . substr($value['daytime'], 4, 4) . "</value>";
if ($type == 'all') {
foreach ($cols as $ck => $cvs) {
if ($ck == 'login') {
$graph['login'] .= "<value xid='$count'>{$value['login']}</value>";
$graph['register'] .= "<value xid='$count'>{$value['register']}</value>";
} else {
$num = 0;
foreach ($cvs as $cvk) {
$num = $value[$cvk] + $num;
}
$graph[$ck] .= "<value xid='$count'>" . $num . "</value>";
}
}
} else {
if (empty($_GET['types']) || !empty($_GET['merge'])) {
$graph[$type] .= "<value xid='$count'>" . $value[$type] . "</value>";
} else {
foreach ($_GET['types'] as $t) {
$graph[$t] .= "<value xid='$count'>" . $value[$t] . "</value>";
}
}
}
$count++;
}
$xml = '';
$xml .= '<' . "?xml version=\"1.0\" encoding=\"utf-8\"?>";
$xml .= '<chart><xaxis>';
$xml .= $xaxis;
$xml .= "</xaxis><graphs>";
$count = 0;
foreach ($graph as $key => $value) {
$title = diconv(lang('spacecp', "do_stat_$key"), CHARSET, 'utf-8');
if ($title == '') {
continue;
}
$xml .= "<graph gid='$count' title='" . $title . "'>";
$xml .= $value;
$xml .= '</graph>';
$count++;
}
$xml .= '</graphs></chart>';
@header("Expires: -1");
@header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
@header("Pragma: no-cache");
@header("Content-type: application/xml; charset=utf-8");
echo $xml;
exit();
}
$actives = array();
if($type == 'all') {
$actives[$type] = ' class="a"';
} else {
$type = '';
}
require_once libfile('function/home');
$siteurl = getsiteurl();
$types = '';
$merge = !empty($_GET['merge']) ? '&merge=1' : '';
if (is_array(getgpc('types'))) {
foreach (getgpc('types') as $value) {
$types .= '&types[]=' . $value;
$actives[$value] = ' class="a"';
}
}
$statuspara = "misc.php?mod=stat&op=trend&xml=1&type=$type&primarybegin=$primarybegin&primaryend=$primaryend{$types}{$merge}";
include template('home/misc_stat');

View File

@@ -0,0 +1,211 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_swfupload.php 25756 2011-11-22 02:47:45Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('function/spacecp');
$op = empty($_GET['op'])?'':$_GET['op'];
$isupload = empty($_GET['cam']) && empty($_GET['doodle']) ? true : false;
$iscamera = isset($_GET['cam']) ? true : false;
$isdoodle = isset($_GET['doodle']) ? true : false;
$fileurl = '';
if(!empty($_POST['uid'])) {
$_G['uid'] = intval($_POST['uid']);
if(empty($_G['uid']) || $_POST['hash'] != md5($_G['uid'].UC_KEY)) {
exit();
}
$member = getuserbyuid($_G['uid']);
$_G['username'] = addslashes($member['username']);
loadcache('usergroup_'.$member['groupid']);
$_G['group'] = $_G['cache']['usergroup_'.$member['groupid']];
} elseif (empty($_G['uid'])) {
showmessage('to_login', null, array(), array('showmsg' => true, 'login' => 1));
}
if($op == "finish") {
$albumid = intval($_GET['albumid']);
if($albumid > 0) {
album_update_pic($albumid);
}
$space = getuserbyuid($_G['uid']);
if(ckprivacy('upload', 'feed')) {
require_once libfile('function/feed');
feed_publish($albumid, 'albumid');
}
exit();
} elseif($op == 'config') {
$hash = md5($_G['uid'].UC_KEY);
$uploadurl = urlencode(getsiteurl().'home.php?mod=misc&ac=swfupload'.($iscamera ? '&op=screen' : ($isdoodle ? '&op=doodle&from=':'')));
if($isupload) {
if(!checkperm('allowupload')) {
$hash = '';
}
} else {
$filearr = $dirstr = array();
if($iscamera) {
$directory = dreaddir(DISCUZ_ROOT.'./static/image/foreground');
foreach($directory as $key => $value) {
$dirstr = DISCUZ_ROOT.'./static/image/foreground/'.$value;
if(is_dir($dirstr)) {
$filearr = dreaddir($dirstr, array('jpg','jpeg','gif','png','webp'));
if(!empty($filearr)) {
if(is_file($dirstr.'/categories.txt')) {
$catfile = @file($dirstr.'/categories.txt');
$dirarr[$key][0] = trim($catfile[0]);
} else {
$dirarr[$key][0] = trim($value);
}
$dirarr[$key][1] = trim('static/image/foreground/'.$value.'/');
$dirarr[$key][2] = $filearr;
}
}
}
} elseif($isdoodle) {
$filearr = dreaddir(DISCUZ_ROOT.'./static/image/doodle/big', array('jpg','jpeg','gif','png','webp'));
}
}
$feedurl = urlencode(getsiteurl().'home.php?mod=misc&ac=swfupload&op=finish&random='.random(8).'&albumid=');
$albumurl = urlencode(getsiteurl().'home.php?mod=space&do=album'.($isdoodle ? '&picid=' : '&id='));
$max = 0;
if(!empty($_G['group']['maximagesize'])) {
$max = intval($_G['group']['maximagesize']);
} else {
require_once libfile('function/upload');
$max = getmaxupload();
$unit = strtolower(substr($max, -1, 1));
if($unit == 'k') {
$max = intval($max)*1024;
} elseif($unit == 'm') {
$max = intval($max)*1024*1024;
} elseif($unit == 'g') {
$max = intval($max)*1024*1024*1024;
}
}
$albums = getalbums($_G['uid']);
loadcache('albumcategory');
$categorys = $_G['cache']['albumcategory'];
$categorystat = $_G['setting']['albumcategorystat'] && !empty($categorys) ? intval($_G['setting']['albumcategorystat']) : 0;
$categoryrequired = $_G['setting']['albumcategoryrequired'] && !empty($categorys) ? intval($_G['setting']['albumcategoryrequired']) : 0;
} elseif($op == "screen" || $op == "doodle") {
if(empty($GLOBALS['HTTP_RAW_POST_DATA'])) {
$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
}
$status = "failure";
$dosave = true;
if($op == "doodle") {
$magic = C::t('common_magic')->fetch_member_magic($_G['uid'], 'doodle');
if(empty($magic) || $magic['num'] < 1) {
$uploadfiles = -8;
$dosave = false;
}
}
if($dosave && !empty($GLOBALS['HTTP_RAW_POST_DATA'])) {
$_SERVER['HTTP_ALBUMID'] = addslashes(diconv(urldecode($_SERVER['HTTP_ALBUMID']), 'UTF-8'));
$from = false;
if($op == 'screen') {
$from = 'camera';
} elseif($_GET['from'] == 'album') {
$from = 'uploadimage';
}
$_G['setting']['allowwatermark'] = 0;
$uploadfiles = stream_save($GLOBALS['HTTP_RAW_POST_DATA'], $_SERVER['HTTP_ALBUMID'], 'jpg', '', '', 0, $from);
}
$uploadResponse = true;
$picid = $proid = $albumid = 0;
if($uploadfiles && is_array($uploadfiles)) {
$status = "success";
$albumid = $uploadfiles['albumid'];
$picid = $uploadfiles['picid'];
if($op == "doodle") {
$fileurl = pic_get($uploadfiles['filepath'], 'album', $uploadfiles['thumb'], $uploadfiles['remote'], 0);
$remote = $uploadfiles['remote'] > 1 ? $uploadfiles['remote'] - 2 : $uploadfiles['remote'];
if(!$remote) {
if(!preg_match("/^http\:\/\//i", $fileurl)) {
$fileurl = getsiteurl().$fileurl;
}
}
require_once libfile('function/magic');
usemagic($magic['magicid'], $magic['num'], 1);
updatemagiclog($magic['magicid'], '2', '1', '0');
if($albumid > 0) {
album_update_pic($albumid);
}
}
} else {
switch ($uploadfiles) {
case -1:
$uploadfiles = lang('spacecp', 'inadequate_capacity_space');
break;
case -2:
$uploadfiles = lang('spacecp', 'only_allows_upload_file_types');
break;
case -4:
$uploadfiles = lang('spacecp', 'ftp_upload_file_size');
break;
case -8:
$uploadfiles = lang('spacecp', 'has_not_more_doodle');
break;
default:
$uploadfiles = lang('spacecp', 'mobile_picture_temporary_failure');
break;
}
}
} elseif($_FILES && $_POST) {
if($_FILES["Filedata"]['error']) {
$uploadfiles = lang('spacecp', 'file_is_too_big');
} else {
$_FILES["Filedata"]['name'] = addslashes(diconv(urldecode($_FILES["Filedata"]['name']), 'UTF-8'));
$_POST['albumid'] = addslashes(diconv(urldecode($_POST['albumid']), 'UTF-8'));
$catid = $_POST['catid'] ? intval($_POST['catid']) : 0;
$uploadfiles = pic_save($_FILES["Filedata"], $_POST['albumid'], addslashes(diconv(urldecode($_POST['title']), 'UTF-8')), true, $catid);
}
$proid = $_POST['proid'];
$uploadResponse = true;
$albumid = 0;
if($uploadfiles && is_array($uploadfiles)) {
$status = "success";
$albumid = $uploadfiles['albumid'];
} else {
$status = "failure";
}
}
$newalbumname = dgmdate($_G['timestamp'], 'Ymd');
include template("home/misc_swfupload");
$outxml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$outxml .= diconv(ob_get_contents(), $_G['charset'], 'UTF-8');
obclean();
@header("Expires: -1");
@header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
@header("Pragma: no-cache");
@header("Content-type: application/xml; charset=utf-8");
echo $outxml;
?>