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,76 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_buyinvitecode.php 31572 2012-09-10 08:59:03Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(submitcheck('buysubmit')) {
if(payment::enable()) {
$language = lang('forum/misc');
$amount = intval($_GET['amount']);
$email = dhtmlspecialchars($_GET['email']);
if($amount < 1) {
showmessage('buyinvitecode_no_count');
}
if(strlen($email) < 6 || !preg_match("/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/", $email)) {
showmessage('buyinvitecode_email_error');
}
$price = $amount * $_G['setting']['inviteconfig']['invitecodeprice'] * 100;
$orderid = '';
$requesturl = payment::create_order(
'payment_invite',
$_G['setting']['bbname'].' - '.lang('forum/misc', 'invite_payment'),
lang('forum/misc', 'invite_forum_payment').' '.intval($amount).' '.lang('forum/misc', 'invite_forum_payment_unit'),
$price,
$_G['siteurl'] . 'misc.php?mod=buyinvitecode&action=paysucceed&orderid={out_biz_no}',
array(
'num' => $amount,
'email' => $email,
'ip' => $_G['clientip'],
'port' => $_G['remoteport']
)
);
include isset($_REQUEST['inajax']) ? template('common/header_ajax') : template('common/header');
echo '<form id="payform" action="'.$requesturl.'" method="post"></form><script type="text/javascript" reload="1">document.getElementById(\'payform\').submit();</script>';
include isset($_REQUEST['inajax']) ? template('common/footer_ajax') : template('common/footer');
dexit();
} else {
showmessage('action_closed', NULL);
}
}
if($_GET['action'] == 'paysucceed' && $_GET['orderid']) {
$orderid = $_GET['orderid'];
$order = C::t('forum_order')->fetch($orderid);
if(!$order) {
showmessage('parameters_error');
}
$codes = array();
foreach(C::t('common_invite')->fetch_all_orderid($orderid) as $code) {
$codes[] = $code['code'];
}
if(empty($codes)) {
showmessage('buyinvitecode_no_id');
}
$codetext = implode("\r\n", $codes);
}
if($_G['group']['maxinviteday']) {
$maxinviteday = time() + 86400 * $_G['group']['maxinviteday'];
} else {
$maxinviteday = time() + 86400 * 10;
}
$maxinviteday = dgmdate($maxinviteday, 'Y-m-d H:i');
$_G['setting']['inviteconfig']['invitecodeprompt'] = nl2br($_G['setting']['inviteconfig']['invitecodeprompt']);
include template('common/buyinvitecode');
?>

View File

@@ -0,0 +1,38 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_diyhelp.php 25889 2011-11-24 09:52:20Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$allowdiy = false; //diy权限:$_G['group']['allowdiy'] || $_G['group']['allowaddtopic'] && $topic['uid'] == $_G['uid'] || $_G['group']['allowmanagetopic']
$ref = $_GET['diy'] == 'yes';//DIY模式中
if(!$ref && $_GET['action'] == 'get') {
if($_GET['type'] == 'index') {
if($_G['group']['allowdiy']) {
$allowdiy = true;
}
} else if($_GET['type'] == 'topic') {
$topic = array();
$topicid = max(0, intval($_GET['topicid']));
if($topicid) {
if($_G['group']['allowmanagetopic']) {
$allowdiy = true;
} else if($_G['group']['allowaddtopic']) {
if(($topic=C::t('portal_topic')->fetch($topicid)) && $topic['uid'] == $_G['uid']) {
$allowdiy = true;
}
}
}
}
}
include_once template('portal/portal_diyhelp');
?>

View File

@@ -0,0 +1,15 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_error.php 6790 2010-03-25 12:30:53Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
exit('Access Denied, Error mod request!')
?>

View File

@@ -0,0 +1,82 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_faq.php 32267 2012-12-12 03:26:40Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$keyword = isset($_GET['keyword']) ? dhtmlspecialchars($_GET['keyword']) : '';
$faqparent = $faqsub = array();
foreach(C::t('forum_faq')->fetch_all_by_fpid() as $faq) {
if(empty($faq['fpid'])) {
$faqparent[$faq['id']] = $faq;
if($_GET['id'] == $faq['id']) {
$ctitle = $faq['title'];
}
} else {
$faqsub[$faq['fpid']][] = $faq;
}
}
if($_GET['action'] == 'faq') {
$id = intval($_GET['id']);
$faq = C::t('forum_faq')->fetch_all_by_fpid($id);
if($faq) {
$ffaq = $faq[$id];
$navtitle = $ctitle;
$navigation = "<em>&rsaquo;</em> $ctitle";
$faqlist = array();
$messageid = empty($_GET['messageid']) ? 0 : $_GET['messageid'];
foreach(C::t('forum_faq')->fetch_all_by_fpid($id) as $faq) {
if(!$messageid) {
$messageid = $faq['id'];
}
$faqlist[] = $faq;
}
} else {
showmessage('faq_content_empty', 'misc.php?mod=faq');
}
} elseif($_GET['action'] == 'search') {
$navtitle = lang('core', 'search');
if(submitcheck('searchsubmit')) {
if(($keyword = $_GET['keyword'])) {
$sqlsrch = '';
$searchtype = in_array($_GET['searchtype'], array('all', 'title', 'message')) ? $_GET['searchtype'] : 'all';
$faqlist = array();
foreach(C::t('forum_faq')->fetch_all_by_fpid('', $keyword) as $faq) {
if(!empty($faq['fpid'])) {
$faq['title'] = preg_replace("/(?<=[\s\"\]>()]|[\x7f-\xff]|^)(".preg_quote($keyword, '/').")(([.,:;-?!()\s\"<\[]|[\x7f-\xff]|$))/siU", "<u><b><font color=\"#FF0000\">\\1</font></b></u>\\2", $faq['title']);
$faq['message'] = preg_replace("/(?<=[\s\"\]>()]|[\x7f-\xff]|^)(".preg_quote($keyword, '/').")(([.,:;-?!()\s\"<\[]|[\x7f-\xff]|$))/siU", "<u><b><font color=\"#FF0000\">\\1</font></b></u>\\2", $faq['message']);
$faqlist[] = $faq;
}
}
} else {
showmessage('faq_keywords_empty', 'misc.php?mod=faq');
}
$keyword = dhtmlspecialchars($keyword);
}
} elseif($_GET['action'] == 'plugin' && !empty($_GET['id'])) {
$navtitle = $_G['setting']['plugins']['faq'][$_GET['id']]['name'];
$navigation = '<em>&rsaquo;</em> '.$_G['setting']['plugins']['faq'][$_GET['id']]['name'];
include pluginmodule($_GET['id'], 'faq');
} else {
$navtitle = lang('core', 'faq');
}
include template('common/faq');
?>

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_getatuser.php 25782 2011-11-22 05:29:19Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$result = '';
$search_str = getgpc('search_str');
if($_G['uid']) {
$atlist = $atlist_cookie = array();
$limit = 200;
if(getcookie('atlist')) {
$cookies = explode(',', $_G['cookie']['atlist']);
foreach(C::t('common_member')->fetch_all($cookies, false) as $row) {
if ($row['uid'] != $_G['uid'] && in_array($row['uid'], $cookies)) {
$atlist_cookie[$row['uid']] = $row['username'];
}
}
}
foreach(C::t('home_follow')->fetch_all_following_by_uid($_G['uid'], 0, 0, $limit) as $row) {
if($atlist_cookie[$row['followuid']]) {
continue;
}
$atlist[$row['followuid']] = $row['fusername'];
}
$num = count($atlist);
if($num < $limit) {
$query = C::t('home_friend')->fetch_all_by_uid($_G['uid'], 0, $limit * 2);
foreach($query as $row) {
if(count($atlist) == $limit) {
break;
}
if($atlist_cookie[$row['fuid']]) {
continue;
}
$atlist[$row['fuid']] = $row['fusername'];
}
}
$result = implode(',', $atlist_cookie).($atlist_cookie && $atlist ? ',' : '').implode(',', $atlist);
}
include template('common/getatuser');
?>

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: misc_imgcropper.php 36314 2016-12-19 08:02:23Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$_GET['img'] = htmlspecialchars($_GET['img']);
$_GET['bid'] = intval($_GET['bid']);
$_GET['picflag'] = intval($_GET['picflag']);
$_GET['ictype'] = !empty($_GET['ictype']) ? 'block' : '';
$_GET['width'] = intval($_GET['width']);
$_GET['height'] = intval($_GET['height']);
if(!submitcheck('imgcroppersubmit')) {
if($_GET['op'] == 'loadcropper') {
$cboxwidth = $_GET['width'] > 50 ? $_GET['width'] : 300;
$cboxheight = $_GET['height'] > 50 ? $_GET['height'] : 300;
$cbgboxwidth = $cboxwidth + 300;
$cbgboxheight = $cboxheight + 300;
$dragpl = ($cbgboxwidth - $cboxwidth)/2;
$dragpt = ($cbgboxheight - $cboxheight)/2;
} else {
$prefix = $_GET['picflag'] == 2 ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
}
include_once template("common/misc_imgcropper");
} else {
$pathinfos = pathinfo($_GET['cutimg']);
if(!in_array(strtolower($pathinfos['extension']), array('jpg', 'jpeg', 'gif', 'png', 'bmp'))) {
showmessage('imagepreview_errorcode_0', null, null, array('showdialog' => true, 'closetime' => true));
}
$cropfile = md5($_GET['cutimg']).'.jpg';
$ictype = $_GET['ictype'];
if($ictype == 'block') {
require_once libfile('function/block');
$block = C::t('common_block')->fetch($_GET['bid']);
$cropfile = block_thumbpath($block, array('picflag' => intval($_GET['picflag']), 'pic' => $_GET['cutimg']));
$cutwidth = $block['picwidth'];
$cutheight = $block['picheight'];
} else {
$cutwidth = $_GET['cutwidth'];
$cutheight = $_GET['cutheight'];
}
$top = intval($_GET['cuttop'] < 0 ? 0 : $_GET['cuttop']);
$left = intval($_GET['cutleft'] < 0 ? 0 : $_GET['cutleft']);
$picwidth = $cutwidth > $_GET['picwidth'] ? $cutwidth : $_GET['picwidth'];
$picheight = $cutheight > $_GET['picheight'] ? $cutheight : $_GET['picheight'];
require_once libfile('class/image');
$image = new image();
$prefix = $_GET['picflag'] == 2 ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
if(!$image->Thumb($prefix.$_GET['cutimg'], $cropfile, $picwidth, $picheight)) {
showmessage('imagepreview_errorcode_'.$image->errorcode, null, null, array('showdialog' => true, 'closetime' => true));
}
$image->Cropper($image->target, $cropfile, $cutwidth, $cutheight, $left, $top);
showmessage('do_success', dreferer(), array('icurl' => $cropfile), array('showdialog' => true, 'closetime' => true));
}
?>

View File

@@ -0,0 +1,92 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_initsys.php 36334 2017-01-03 01:32:35Z nemohou $
*/
@set_time_limit(0);
@ignore_user_abort(TRUE);
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(file_exists(DISCUZ_ROOT.'./data/install.lock') && file_exists(DISCUZ_ROOT.'./data/update.lock')) {
exit('Access Denied');
}
@touch(DISCUZ_ROOT.'./data/install.lock');
@touch(DISCUZ_ROOT.'./data/update.lock');
if(!($_G['adminid'] == 1 && $_GET['formhash'] == formhash()) && $_G['setting']) {
exit('Access Denied');
}
require_once libfile('function/cache');
updatecache();
require_once libfile('function/block');
blockclass_cache();
if($_G['config']['output']['tplrefresh']) {
cleartemplatecache();
}
$plugins = array('mobile');
$opens = array('mobile');
require_once libfile('function/plugin');
require_once libfile('function/admincp');
foreach($plugins as $pluginid) {
$importfile = DISCUZ_ROOT.'./source/plugin/'.$pluginid.'/discuz_plugin_'.$pluginid.'.xml';
if(!file_exists($importfile)) {
continue;
}
$systemvalue = 2;
$importtxt = @implode('', file($importfile));
$pluginarray = getimportdata('Discuz! Plugin', $importtxt);
$plugin = C::t('common_plugin')->fetch_by_identifier($pluginid);
if($plugin) {
$modules = dunserialize($plugin['modules']);
if($modules['system'] > 0) {
if($pluginarray['plugin']['version'] != $plugin['version']) {
pluginupgrade($pluginarray, '');
if($pluginarray['upgradefile']) {
$plugindir = DISCUZ_ROOT.'./source/plugin/'.$pluginarray['plugin']['directory'];
if(file_exists($plugindir.'/'.$pluginarray['upgradefile'])) {
@include_once $plugindir.'/'.$pluginarray['upgradefile'];
}
}
}
if($modules['system'] != $systemvalue) {
$modules['system'] = $systemvalue;
$modules = serialize($modules);
C::t('common_plugin')->update($plugin['pluginid'], array('modules' => $modules));
}
continue;
}
C::t('common_plugin')->delete_by_identifier($pluginid);
}
if($plugin['available']) {
$opens[] = $pluginid;
}
$pluginarray['plugin']['modules'] = dunserialize(dstripslashes($pluginarray['plugin']['modules']));
$pluginarray['plugin']['modules']['system'] = $systemvalue;
$pluginarray['plugin']['modules'] = serialize($pluginarray['plugin']['modules']);
plugininstall($pluginarray, '', in_array($pluginid, $opens));
if($pluginarray['installfile']) {
$plugindir = DISCUZ_ROOT.'./source/plugin/'.$pluginarray['plugin']['directory'];
if(file_exists($plugindir.'/'.$pluginarray['installfile'])) {
@include_once $plugindir.'/'.$pluginarray['installfile'];
}
}
}
?>

View File

@@ -0,0 +1,170 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_invite.php 33107 2013-04-26 03:43:21Z andyzheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(!$_G['setting']['friendstatus']) {
showmessage("friend_status_off");
}
require_once libfile('function/friend');
$_GET['action'] = dhtmlspecialchars(preg_replace("/[^\[A-Za-z0-9_\]]/", '', $_GET['action']));
$friendgrouplist = friend_group_list();
if($_GET['action'] == 'group') {
$id = intval($_GET['id']);
$groupuserinfo = C::t('forum_groupuser')->fetch_userinfo($_G['uid'], $id);
if(empty($groupuserinfo['uid'])) {
showmessage('group_invite_failed');
}
$foruminfo = C::t('forum_forum')->fetch($id);
$grouplevel = $foruminfo['level'];
loadcache('grouplevels');
$grouplevel = $_G['grouplevels'][$grouplevel];
$membermaximum = $grouplevel['specialswitch']['membermaximum'];
if(!empty($membermaximum)) {
$curnum = C::t('forum_groupuser')->fetch_count_by_fid($id, -1);
if($curnum >= $membermaximum) {
showmessage('group_member_maximum', '', array('membermaximum' => $membermaximum));
}
}
$groupname = $foruminfo['name'];
$invitename = lang('group/misc', 'group_join', array('groupname' => $groupname));
if(!submitcheck('invitesubmit')) {
$friends = friend_list($_G['uid'], 100);
if(!empty($friends)) {
$frienduids = array_keys($friends);
$inviteduids = array();
$query = C::t('forum_groupinvite')->fetch_all_inviteuid($id, $frienduids, $_G['uid']);
foreach($query as $inviteuser) {
$inviteduids[$inviteuser['inviteuid']] = $inviteuser['inviteuid'];
}
$query = C::t('forum_groupuser')->fetch_all_userinfo($frienduids, $id);
foreach($query as $inviteuser) {
$inviteduids[$inviteuser['uid']] = $inviteuser['uid'];
}
}
$inviteduids = !empty($inviteduids) ? implode(',', $inviteduids) : '';
} else {
$uids = $_GET['uids'];
if($uids) {
if(count($uids) > 20) {
showmessage('group_choose_friends_max');
}
foreach(C::t('common_member')->fetch_all($uids, false, 0) as $uid => $user) {
C::t('forum_groupinvite')->insert(array('fid' => $id, 'uid' => $_G['uid'], 'inviteuid' => $uid, 'dateline' => TIMESTAMP), true, true);
$already = C::t('forum_groupinvite')->affected_rows();
if($already == 1) {
notification_add($uid, 'group', 'group_member_invite', array('groupname' => $groupname, 'fid' => $id, 'url' =>'forum.php?mod=group&action=join&fid='.$id, 'from_id' => $id, 'from_idtype' => 'invite_group'), 1);
}
}
showmessage('group_invite_succeed', "forum.php?mod=group&fid=$id");
} else {
showmessage('group_invite_choose_member', "forum.php?mod=group&fid=$id");
}
}
} elseif($_GET['action'] == 'thread') {
$inviteduids = array();
$id = intval($_GET['id']);
$thread = C::t('forum_thread')->fetch_thread($id);
$at = 0;
$maxselect = 20;
if(empty($_GET['activity'])) {
$at = 1;
$maxselect = 0;
if($_G['group']['allowat']) {
$atnum = 0;
foreach(C::t('home_notification')->fetch_all_by_authorid_fromid($_G['uid'], $id, 'at') as $row) {
$atnum ++;
$inviteduids[$row['uid']] = $row['uid'];
}
$maxselect = $_G['group']['allowat'] - $atnum;
} else {
showmessage('noperm_at_user');
}
if($maxselect <= 0) {
showmessage('thread_at_usernum_limit');
}
$invitename = lang('forum/misc', 'at_invite');
} else {
$invitename = lang('forum/misc', 'join_activity');
}
if(!submitcheck('invitesubmit')) {
$inviteduids = !empty($inviteduids) ? implode(',', $inviteduids) : '';
} else {
$uids = $_GET['uids'];
if($uids) {
if(count($uids) > $maxselect) {
showmessage('group_choose_friends_max');
}
$post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($id);
require_once libfile('function/post');
$post['message'] = threadmessagecutstr($thread, $post['message'], 150);
foreach(C::t('common_member')->fetch_all($uids, false, 0) as $uid => $user) {
if($at) {
notification_add($uid, 'at', 'at_message', array('from_id' => $id, 'from_idtype' => 'at', 'buyerid' => $_G['uid'], 'buyer' => $_G['username'], 'tid' => $id, 'subject' => $thread['subject'], 'pid' => $post['pid'], 'message' => $post['message']));
} else {
notification_add($uid, 'thread', 'thread_invite', array('subject' => $thread['subject'], 'invitename' => $invitename, 'tid' => $id, 'from_id' => $id, 'from_idtype' => 'invite_thread'));
}
}
showmessage(($at ? 'at_succeed' : 'group_invite_succeed'), "forum.php?mod=viewthread&tid=$id");
} else {
showmessage(($at ? 'at_choose_member' : 'group_invite_choose_member'), "forum.php?mod=viewthread&tid=$id");
}
}
} elseif($_GET['action'] == 'blog') {
$id = intval($_GET['id']);
$blog = C::t('home_blog')->fetch($id);
if(!submitcheck('invitesubmit')) {
$inviteduids = '';
} else {
$uids = $_GET['uids'];
if($uids) {
if(count($uids) > 20) {
showmessage('group_choose_friends_max');
}
foreach(C::t('common_member')->fetch_all($uids, false, 0) as $uid => $user) {
notification_add($uid, 'blog', 'blog_invite', array('subject' => $blog['subject'], 'uid' => $blog['uid'], 'blogid' => $id, 'from_id' => $id, 'from_idtype' => 'invite_blog'));
}
showmessage('group_invite_succeed', "home.php?mod=space&uid=".$blog['uid']."&do=blog&id=$id");
} else {
showmessage('group_invite_choose_member', "home.php?mod=space&uid=".$blog['uid']."&do=blog&id=$id");
}
}
} elseif($_GET['action'] == 'article') {
$id = intval($_GET['id']);
$article = C::t('portal_article_title')->fetch($id);
if(!submitcheck('invitesubmit')) {
$inviteduids = '';
} else {
require_once libfile('function/portal');
$article_url = fetch_article_url($article);
$uids = $_GET['uids'];
if($uids) {
if(count($uids) > 20) {
showmessage('group_choose_friends_max');
}
foreach(C::t('common_member')->fetch_all($uids, false, 0) as $uid => $user) {
notification_add($uid, 'article', 'article_invite', array('subject' => $article['title'], 'url' => $article_url, 'from_id' => $id, 'from_idtype' => 'invite_article'));
}
showmessage('group_invite_succeed', $article_url);
} else {
showmessage('group_invite_choose_member', $article_url);
}
}
}
include template('common/invite');
?>

View File

@@ -0,0 +1,94 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_mobile.php 36284 2016-12-12 00:47:50Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if($mod == 'mobile' && defined('IN_MOBILE')) {
if($_G['setting']['domain']['app']['mobile']) {
dheader('Location:'.$_G['scheme'].'://'.$_G['setting']['domain']['app']['mobile']);
} else {
dheader('Location:'.$_G['siteurl'].'forum.php?mobile=yes');
}
} elseif(!$_G['setting']['mobile']['allowmobile']) {
dheader("Location:".($_G['setting']['domain']['app']['default'] ? $_G['scheme'].'://'.$_G['setting']['domain']['app']['default'] : $_G['siteurl']));
}
include DISCUZ_ROOT.'./source/language/touch/lang_template.php';
$_G['lang'] = array_merge($_G['lang'], $lang);
$navtitle = $_G['lang']['misc_mobile_title'];
if(getgpc('view') == true) {
include libfile('function/forumlist');
loadcache('userstats');
loadcache('historyposts');
$postdata = $_G['cache']['historyposts'] ? explode("\t", $_G['cache']['historyposts']) : array(0,0);
$postdata[0] = intval($postdata[0]);
$postdata[1] = intval($postdata[1]);
$query = C::t('forum_forum')->fetch_all_forum(1);
$threads = $posts = $todayposts = 0;
foreach($query as $forum) {
if($forum['type'] != 'group') {
$threads += $forum['threads'];
$posts += $forum['posts'];
$todayposts += $forum['todayposts'];
if($forum['type'] == 'forum' && isset($catlist[$forum['fup']])) {
if(forum($forum)) {
$catlist[$forum['fup']]['forums'][] = $forum['fid'];
$forum['orderid'] = $catlist[$forum['fup']]['forumscount']++;
$forum['subforums'] = '';
$forumlist[$forum['fid']] = $forum;
}
} elseif(isset($forumlist[$forum['fup']])) {
$forumlist[$forum['fup']]['threads'] += $forum['threads'];
$forumlist[$forum['fup']]['posts'] += $forum['posts'];
$forumlist[$forum['fup']]['todayposts'] += $forum['todayposts'];
}
} else {
$forum['forumscount'] = 0;
$catlist[$forum['fid']] = $forum;
}
}
$_GET['forumlist'] = 1;
define('IN_MOBILE',2);
define('IN_PREVIEW',1);
ob_start();
include template('forum/discuz');
} else {
if(getglobal('setting/domain/app/mobile')) {
$url = $_G['scheme'].'://'.$_G['setting']['domain']['app']['mobile'];
$file = 'newmobiledomain.png';
} else {
$url = $_G['siteurl'];
$file = 'newmobile.png';
}
$qrimg = DISCUZ_ROOT.'./data/cache/'.$file;
if(!file_exists($qrimg)) {
require_once DISCUZ_ROOT.'source/plugin/mobile/qrcode.class.php';
QRcode::png($url, $qrimg, QR_ECLEVEL_Q, 4);
}
include template('touch/common/preview');
}
function output_preview() {
$content = ob_get_contents();
ob_end_clean();
ob_start();
$content = preg_replace_callback("/(\<a[^\>]+href=\").*?(\"[^\>]*\>)/", 'output_preview_callback_replace_href_21', $content);
$content = preg_replace("/\<script.+?\<\/script\>/", '', $content);
$content = str_replace('</body>' , '<script>document.querySelectorAll(\'a\').forEach(function (a) {a.addEventListener(\'click\', function (e) {e.preventDefault();return false;});})</script></body>', $content);
echo $content;
exit;
}
function output_preview_callback_replace_href_21($matches) {
return $matches[1].'misc.php?mod=mobile&view=true'.$matches[2];;
}
?>

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_patch.php 33690 2013-08-02 09:07:22Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if($_GET['action'] == 'pluginnotice') {
require_once libfile('function/admincp');
require_once libfile('function/plugin');
require_once libfile('function/cloudaddons');
$pluginarray = C::t('common_plugin')->fetch_all_data();
$addonids = $vers = array();
foreach($pluginarray as $row) {
if(ispluginkey($row['identifier'])) {
$addonids[] = $row['identifier'].'.plugin';
$vers[$row['identifier'].'.plugin'] = $row['version'];
}
}
$checkresult = dunserialize(cloudaddons_upgradecheck($addonids));
savecache('addoncheck_plugin', $checkresult);
$newversion = 0;
if(is_array($checkresult)) {
foreach($checkresult as $addonid => $value) {
list(, $newver, $sysver) = explode(':', $value);
if($sysver && $sysver > $vers[$addonid] || $newver) {
$newversion++;
}
}
}
include template('common/header_ajax');
if($newversion) {
$lang = lang('forum/misc');
echo '<div class="bm"><div class="bm_h cl"><a href="javascript:;" onclick="$(\'plugin_notice\').style.display=\'none\';setcookie(\'pluginnotice\', 1, 86400)" class="y" title="'.$lang['patch_close'].'">'.$lang['patch_close'].'</a>';
echo '<h2 class="i">'.$lang['plugin_title'].'</h2></div><div class="bm_c">';
echo '<div class="cl bbda pbm">'.lang('forum/misc', 'plugin_memo', array('number' => $newversion)).'</div>';
echo '<div class="ptn cl"><a href="admin.php?action=plugins" class="xi2 y">'.$lang['plugin_link'].' &raquo;</a></div>';
echo '</div></div>';
}
include template('common/footer_ajax');
exit;
} elseif($_GET['action'] == 'ipnotice') {
require_once libfile('function/misc');
include template('common/header_ajax');
if($_G['cookie']['lip'] && $_G['cookie']['lip'] != ',' && $_G['uid'] && getglobal('setting/disableipnotice') != 1) {
$status = C::t('common_member_status')->fetch($_G['uid']);
$lip = explode(',', $_G['cookie']['lip']);
$lastipConvert = convertip($lip[0]);
$lastipDate = dgmdate($lip[1]);
$nowipConvert = convertip($status['lastip']);
$lastipConvert = process_ipnotice($lastipConvert);
$nowipConvert = process_ipnotice($nowipConvert);
if($lastipConvert != $nowipConvert && stripos($lastipConvert, $nowipConvert) === false && stripos($nowipConvert, $lastipConvert) === false) {
$lang = lang('forum/misc');
include template('common/ipnotice');
}
}
include template('common/footer_ajax');
exit;
}
?>

View File

@@ -0,0 +1,486 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_ranklist.php 32807 2013-03-13 08:49:49Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(!$_G['setting']['rankliststatus']) {
showmessage('ranklist_status_off');
}
$page = $_G['page'];
$type = $_GET['type'];
$_G['disabledwidthauto'] = 1;
if(!in_array($type, array('index', 'member', 'thread', 'blog', 'poll', 'picture', 'activity', 'forum', 'group'))) {
$type = 'index';
}
$ranklist_setting = $_G['setting']['ranklist'];
$navtitle = lang('core', 'title_ranklist_'.$type);
$allowtype = array('member' => 'ranklist', 'thread' => 'forum', 'blog' => 'blog', 'poll' => 'forum', 'picture' => 'album', 'activity' => 'forum', 'forum' => 'forum', 'group' => 'group');
if($type != 'index') {
if(!array_key_exists($type, $allowtype) || !$_G['setting'][$allowtype[$type].'status'] || !$ranklist_setting[$type]['available']) {
showmessage('ranklist_this_status_off');
}
}
include libfile('misc/ranklist_'.$type, 'include');
function getranklist_thread($num = 20, $view = 'replies', $orderby = 'all') {
global $_G;
$dateline = '';
$timestamp = 0;
if($orderby == 'today') {
$timestamp = TIMESTAMP - 86400;
} elseif($orderby == 'thisweek') {
$timestamp = TIMESTAMP - 604800;
} elseif($orderby == 'thismonth') {
$timestamp = TIMESTAMP - 2592000;
}
$data = array();
$rank = 0;
$notfid = $_G['setting']['ranklist']['ignorefid'] ? explode(',', $_G['setting']['ranklist']['ignorefid']) : array();
foreach(C::t('forum_thread')->fetch_all_rank_thread($timestamp, $notfid, $view, $num) as $thread) {
++$rank;
$thread['rank'] = $rank;
$thread['dateline'] = dgmdate($thread['dateline']);
$data[] = $thread;
}
return $data;
}
function getranklist_poll($num = 20, $view = 'heats', $orderby = 'all') {
global $_G;
$dateline = '';
$timestamp = 0;
if($orderby == 'today') {
$timestamp = TIMESTAMP - 86400;
} elseif($orderby == 'thisweek') {
$timestamp = TIMESTAMP - 604800;
} elseif($orderby == 'thismonth') {
$timestamp = TIMESTAMP - 2592000;
}
$data = array();
require_once libfile('function/forum');
$rank = 0;
$notfid = $_G['setting']['ranklist']['ignorefid'] ? explode(',', $_G['setting']['ranklist']['ignorefid']) : array();
foreach(C::t('forum_thread')->fetch_all_rank_poll($timestamp, $notfid, $view, $num) as $poll) {
++$rank;
$poll['rank'] = $rank;
$poll['avatar'] = avatar($poll['authorid'], 'small');
$poll['dateline'] = dgmdate($poll['dateline']);
$poll['pollpreview'] = explode("\t", trim($poll['pollpreview']));
$data[] = $poll;
}
return $data;
}
function getranklist_activity($num = 20, $view = 'heats', $orderby = 'all') {
global $_G;
$dateline = '';
$timestamp = 0;
if($orderby == 'today') {
$timestamp = TIMESTAMP - 86400;
} elseif($orderby == 'thisweek') {
$timestamp = TIMESTAMP - 604800;
} elseif($orderby == 'thismonth') {
$timestamp = TIMESTAMP - 2592000;
}
$data = array();
$rank = 0;$attachtables = array();
$notfid = $_G['setting']['ranklist']['ignorefid'] ? explode(',', $_G['setting']['ranklist']['ignorefid']) : array();
foreach(C::t('forum_thread')->fetch_all_rank_activity($timestamp, $notfid, $view, $num) as $thread) {
++$rank;
$thread['rank'] = $rank;
$thread['starttimefrom'] = dgmdate($thread['starttimefrom']);
if($thread['starttimeto']) {
$thread['starttimeto'] = dgmdate($thread['starttimeto']);
} else {
$thread['starttimeto'] = '';
}
if($thread['expiration'] && TIMESTAMP > $thread['expiration']) {
$thread['has_expiration'] = true;
} else {
$thread['has_expiration'] = false;
}
$data[$thread['tid']] = $thread;
$attachtables[getattachtableid($thread['tid'])][] = $thread['aid'];
}
foreach($attachtables as $attachtable => $aids) {
$attachs = C::t('forum_attachment_n')->fetch_all_attachment($attachtable, $aids);
foreach($attachs as $attach) {
$attach['attachurl'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/'.$attach['attachment'];
$data[$attach['tid']] = array_merge($data[$attach['tid']], $attach);
}
}
return $data;
}
function getranklist_picture($num = 20, $view = 'hot', $orderby = 'all') {
if($orderby == 'thisweek') {
$timestamp = TIMESTAMP - 604800;
$dateline = 'p.'.DB::field('dateline', $timestamp, '>=');
} elseif($orderby == 'thismonth') {
$timestamp = TIMESTAMP - 2592000;
$dateline = 'p.'.DB::field('dateline', $timestamp, '>=');
} elseif($orderby == 'today') {
$timestamp = TIMESTAMP - 86400;
$dateline = 'p.'.DB::field('dateline', $timestamp, '>=');
}
$data = array();
$query = C::t('home_pic')->fetch_all_by_sql($dateline, 'p.'.DB::order($view, 'DESC'), 0, $num);
require_once libfile('function/home');
$rank = 0;
foreach($query as $value) {
++$rank;
$picture = array('picid' => $value['picid'], 'uid' => $value['uid'], 'username' => $value['username'], 'title' => $value['title'], 'filepath' => $value['filepath'], 'thumb' => $value['thumb'], 'remote' => $value['remote'], 'hot' => $value['hot'], 'sharetimes' => $value['sharetimes'], 'click1' => $value['click1'], 'click2' => $value['click2'], 'click3' => $value['click3'], 'click4' => $value['click4'], 'click5' => $value['click5'], 'click6' => $value['click6'], 'click7' => $value['click7'], 'click8' => $value['click8'], 'albumid' => $value['albumid'], 'albumname' => $value['albumname'], 'friend' => $value['friend']);
$picture['rank'] = $rank;
$picture['url'] = $picture['friend'] == 0 ? pic_get($picture['filepath'], 'album', $picture['thumb'], $picture['remote']) : STATICURL.'image/common/nopublish.svg';;
$picture['origurl'] = pic_get($picture['filepath'], 'album', 0, $picture['remote']);
$data[] = $picture;
}
return $data;
}
function getranklist_pictures_index($num = 20, $dateline = 0, $orderby = 'hot DESC') {
$picturelist = array();
$query = C::t('home_pic')->fetch_all_by_sql('p.hot>3', 'p.dateline DESC', 0, $num);
require_once libfile('function/home');
foreach($query as $value) {
$picture = array('picid' => $value['picid'], 'uid' => $value['uid'], 'username' => $value['username'], 'title' => $value['title'], 'filepath' => $value['filepath'], 'thumb' => $value['thumb'], 'remote' => $value['remote'], 'albumid' => $value['albumid'], 'albumname' => $value['albumname'], 'friend' => $value['friend']);
$picture['url'] = $picture['friend'] == 0 ? pic_get($picture['filepath'], 'album', $picture['thumb'], $picture['remote']) : STATICURL.'image/common/nopublish.svg';;
$picture['origurl'] = $picture['friend'] == 0 ? pic_get($picture['filepath'], 'album', 0, $picture['remote']) : STATICURL.'image/common/nopublish.svg';
$picturelist[] = $picture;
}
return $picturelist;
}
function getranklist_members($offset = 0, $limit = 20) {
require_once libfile('function/forum');
$members = array();
$topusers = C::t('home_show')->fetch_all_by_unitprice($offset, $limit, true);
foreach($topusers as $member) {
$member['avatar'] = avatar($member['uid'], 'small');
$member['note'] = htmlspecialchars(dhtmlspecialchars($member['note']));
$members[] = $member;
}
return $members;
}
function getranklist_girls($offset = 0, $limit = 20, $orderby = 'ORDER BY s.unitprice DESC, s.credit DESC') {
return C::t('common_member')->fetch_all_girls_for_ranklist($offset, $limit, $orderby);
}
function getranklist_blog($num = 20, $view = 'hot', $orderby = 'all') {
$dateline = $timestamp = '';
if($orderby == 'today') {
$timestamp = TIMESTAMP - 86400;
} elseif($orderby == 'thisweek') {
$timestamp = TIMESTAMP - 604800;
} elseif($orderby == 'thismonth') {
$timestamp = TIMESTAMP - 2592000;
}
$data = array();
$data_blog = C::t('home_blog')->range_blog(0, $num, 'DESC', $view, 0, 0, null, $timestamp);
$blogids = array_keys($data_blog);
$data_blogfield = C::t('home_blogfield')->fetch_all($blogids);
require_once libfile('function/forum');
require_once libfile('function/post');
$rank = 0;
foreach($data_blog as $curblogid => $blog) {
$blog = array_merge($blog, (array)$data_blogfield[$curblogid]);
++$rank;
$blog['rank'] = $rank;
$blog['dateline'] = dgmdate($blog['dateline']);
$blog['avatar'] = avatar($blog['uid'], 'small');
$blog['message'] = preg_replace('/<([^>]*?)>/', '', $blog['message']);
$blog['message'] = messagecutstr($blog['message'], 140);
$data[] = $blog;
}
return $data;
}
function getranklist_forum($num = 20, $view = 'threads') {
global $_G;
$data = array();
$timelimit = 0;
if($view == 'posts') {
$key = 'posts';
} elseif($view == 'today') {
$key = 'todayposts';
} else {
$key = 'threads';
}
$query = C::t('forum_forum')->fetch_all_for_ranklist(1, 0, $key, 0, $num, explode(',', $_G['setting']['ranklist']['ignorefid']));
$i = 1;
foreach($query as $row) {
$result = array('fid' => $row['fid'], 'name' => $row['name']);
$result['posts'] = $row[$key];
$result['rank'] = $i;
$data[] = $result;
$i++;
}
return $data;
}
function getranklist_group($num = 20, $view = 'threads') {
global $_G;
$timestamp = TIMESTAMP;
$data = array();
$timelimit = 0;
if($view == 'posts') {
$key = 'posts';
} elseif($view == 'today'){
$key = 'todayposts';
} elseif($view == 'credit'){
$key = 'commoncredits';
} elseif($view == 'member'){
$key = 'membernum';
} else {
$key = 'threads';
}
$query = C::t('forum_forum')->fetch_all_for_ranklist(3, 'sub', $key, 0, $num, explode(',', $_G['setting']['ranklist']['ignorefid']));
$i = 1;
foreach($query as $row) {
$result = array('fid' => $row['fid'], 'name' => $row['name']);
$result[$key] = $result['posts'] = $row[$key];
$result['rank'] = $i;
$data[] = $result;
$i++;
}
return $data;
}
function getranklist_member($num = 20, $view = 'credit', $orderby = 'all') {
$data = array();
$functionname = 'getranklist_member_'.$view;
$data = $functionname($num, $orderby);
return $data;
}
function getranklist_member_credit($num, $orderby) {
return C::t('common_member')->fetch_all_order_by_credit_for_ranklist($num, $orderby);
}
function getranklist_member_friendnum($num) {
return C::t('common_member')->fetch_all_order_by_friendnum_for_ranklist($num);
}
function getranklist_member_invite($num, $orderby) {
global $_G;
if($orderby == 'thisweek') {
$dateline = TIMESTAMP - 604800;
} elseif($orderby == 'thismonth') {
$dateline = TIMESTAMP - 2592000;
} elseif($orderby == 'today') {
$dateline = TIMESTAMP - 86400;
}
$invite = $invitearray = $inviteuidarray = $invitefieldarray = array();
foreach(C::t('common_invite')->fetch_all_invitenum_group_by_uid($dateline) as $result) {
$invitearray[] = $result;
$inviteuidarray[] = $result['uid'];
}
$invitememberfield = C::t('common_member')->fetch_all($inviteuidarray, false, 0);
if($invitearray) {
foreach($invitearray as $key => $var) {
$invite[] = $var;
$invite[$key]['username'] = $invitememberfield[$var['uid']]['username'];
$invite[$key]['groupid'] = $invitememberfield[$var['uid']]['groupid'];
}
}
return $invite;
}
function getranklist_member_onlinetime($num, $orderby) {
global $_G;
if($orderby == 'thismonth') {
$orderby = 'thismonth';
$online = 'thismonth AS onlinetime';
} elseif($orderby == 'all') {
$orderby = 'total';
$online = 'total AS onlinetime';
}
$onlinetime = $onlinetimearray = $onlinetimeuidarray = $onlinetimefieldarray = array();
$onlinetimearray = C::t('common_onlinetime')->range_by_field(0, $num, $orderby, 'DESC');
$onlinetimeuidarray = array_keys($onlinetimearray);
$onlinetimefieldarray = C::t('common_member')->fetch_all($onlinetimeuidarray, false, 0);
if($onlinetimearray) {
foreach($onlinetimearray as $key => $var) {
$var['onlinetime'] = $var[$orderby];
$var['username'] = $onlinetimefieldarray[$var['uid']]['username'];
$var['groupid'] = $onlinetimefieldarray[$var['uid']]['groupid'];
$onlinetime[$key] = $var;
}
}
return $onlinetime;
}
function getranklist_member_blog($num) {
global $_G;
$blogs = array();
$sql = "SELECT m.uid,m.username,m.groupid,c.blogs FROM ".DB::table('common_member').
" m LEFT JOIN ".DB::table('common_member_count')." c ON m.uid=c.uid WHERE c.blogs>0 ORDER BY blogs DESC LIMIT 0, $num";
$query = DB::query($sql);
while($result = DB::fetch($query)) {
$blogs[] = $result;
}
return $blogs;
}
function getranklist_member_gender($gender, $num = 20) {
global $_G;
$num = intval($num);
$num = $num ? $num : 20;
$users = array();
$query = DB::query("SELECT c.uid, c.views FROM ".DB::table('common_member_count')." c
LEFT JOIN ".DB::table('common_member_profile')." p ON c.uid=p.uid
WHERE c.views>0 AND p.gender = '$gender' ORDER BY c.views DESC LIMIT 0, $num");
while($user = DB::fetch($query)) {
$users[$user['uid']] = $user;
}
$uids = array_keys($users);
if($uids) {
foreach(C::t('common_member')->fetch_all($uids, false, 0) as $uid => $value) {
$users[$uid] = array_merge($users[$uid], $value);
}
}
return $users;
}
function getranklist_member_beauty($num = 20) {
return getranklist_member_gender(2, $num);
}
function getranklist_member_handsome($num = 20) {
return getranklist_member_gender(1, $num);
}
function getranklist_member_post($num, $orderby) {
global $_G;
$timestamp = TIMESTAMP;
$posts = array();
$timelimit = 0;
if($orderby == 'digestposts') {
$sql = "SELECT m.username, m.uid, mc.digestposts AS posts
FROM ".DB::table('common_member')." m
LEFT JOIN ".DB::table('common_member_count')." mc ON mc.uid=m.uid WHERE mc.digestposts>0
ORDER BY mc.digestposts DESC LIMIT 0, $num";
} elseif($orderby == 'thismonth') {
$timelimit = $timestamp-86400*30;
} elseif($orderby == 'today') {
$timelimit = $timestamp-86400;
} else {
$sql = "SELECT m.username, m.uid, mc.posts
FROM ".DB::table('common_member')." m
LEFT JOIN ".DB::table('common_member_count')." mc ON mc.uid=m.uid WHERE mc.posts>0
ORDER BY mc.posts DESC LIMIT 0, $num";
}
if($timelimit) {
$posts = C::t('forum_post')->fetch_all_top_post_author(0, $timelimit, $num);
} else {
$query = DB::query($sql);
while($result = DB::fetch($query)) {
$posts[] = $result;
}
}
return $posts;
}
function getranklistdata($type, $view = '', $orderby = 'all') {
if (!function_exists('getranklist_'.$type)) {
return array();
}
global $_G;
$cache_time = $_G['setting']['ranklist'][$type]['cache_time'];
$cache_num = $_G['setting']['ranklist'][$type]['show_num'];
if($cache_time <= 0 ) {
$cache_time = 5;
}
$cache_time = $cache_time * 3600;
if($cache_num <= 0 ) {
$cache_num = 20;
}
$ranklistvars = array();
loadcache('ranklist_'.$type);
if(!isset($_G['cache']['ranklist_'.$type]) || !is_array($_G['cache']['ranklist_'.$type])) {
$_G['cache']['ranklist_'.$type] = array();
}
if(!isset($_G['cache']['ranklist_'.$type][$view]) || !is_array($_G['cache']['ranklist_'.$type][$view])) {
$_G['cache']['ranklist_'.$type][$view] = array();
}
if(!isset($_G['cache']['ranklist_'.$type][$view][$orderby]) || !is_array($_G['cache']['ranklist_'.$type][$view][$orderby])) {
$_G['cache']['ranklist_'.$type][$view][$orderby] = array();
}
$ranklistvars = & $_G['cache']['ranklist_'.$type][$view][$orderby];
if(empty($ranklistvars['lastupdated']) || (TIMESTAMP - $ranklistvars['lastupdated'] > $cache_time)) {
$functionname = 'getranklist_'.$type;
if(!discuz_process::islocked('ranklist_update', 600)) {
$ranklistvars = $functionname($cache_num, $view, $orderby);
$ranklistvars['lastupdated'] = TIMESTAMP;
$ranklistvars['lastupdate'] = dgmdate(TIMESTAMP);
$ranklistvars['nextupdate'] = dgmdate(TIMESTAMP + $cache_time);
$_G['cache']['ranklist_'.$type][$view][$orderby] = $ranklistvars;
savecache('ranklist_'.$type, $_G['cache']['ranklist_'.$type]);
}
discuz_process::unlock('ranklist_update');
}
$_G['lastupdate'] = $ranklistvars['lastupdate'];
$_G['nextupdate'] = $ranklistvars['nextupdate'];
unset($ranklistvars['lastupdated'], $ranklistvars['lastupdate'], $ranklistvars['nextupdate']);
return $ranklistvars;
}
function getignorefid($pre = '') {
global $_G;
$fidsql = '';
if($_G['setting']['ranklist']['ignorefid']) {
$fidsql = ' AND '.($pre ? $pre.'.' : '').'fid NOT IN('.dimplode(explode(',', $_G['setting']['ranklist']['ignorefid'])).')';
}
return $fidsql;
}
?>

View File

@@ -0,0 +1,75 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_report.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(empty($_G['uid'])) {
showmessage('not_loggedin', null, array(), array('login' => 1));
}
$rtype = $_GET['rtype'];
$rid = intval($_GET['rid']);
$tid = intval($_GET['tid']);
$fid = intval($_GET['fid']);
$uid = intval($_GET['uid']);
$default_url = array(
'user' => 'home.php?mod=space&uid=',
'post' => 'forum.php?mod=redirect&goto=findpost&ptid='.$tid.'&pid=',
'thread' => 'forum.php?mod=viewthread&tid=',
'group' => 'forum.php?mod=group&fid=',
'album' => 'home.php?mod=space&do=album&uid='.$uid.'&id=',
'blog' => 'home.php?mod=space&do=blog&uid='.$uid.'&id=',
'pic' => 'home.php?mod=space&do=album&uid='.$uid.'&picid='
);
$url = '';
if($rid && !empty($default_url[$rtype])) {
$url = $default_url[$rtype].intval($rid);
} else {
$url = addslashes(dhtmlspecialchars(base64_decode($_GET['url'])));
$url = preg_match("/^http[s]?:\/\/[^\[\"']+$/i", trim($url)) ? trim($url) : '';
}
if(empty($url) || empty($_G['inajax'])) {
showmessage('report_parameters_invalid');
}
$urlkey = md5($url);
if(submitcheck('reportsubmit')) {
$message = censor(cutstr(dhtmlspecialchars(trim($_GET['message'])), 200, ''));
$message = $_G['username'].'&nbsp;:&nbsp;'.rtrim($message, "\\");
if($reportid = C::t('common_report')->fetch_by_urlkey($urlkey)) {
C::t('common_report')->update_num($reportid, $message);
} else {
$data = array('url' => $url, 'urlkey' => $urlkey, 'uid' => $_G['uid'], 'username' => $_G['username'], 'message' => $message, 'dateline' => TIMESTAMP);
if($fid) {
$data['fid'] = $fid;
}
C::t('common_report')->insert($data);
$report_receive = dunserialize($_G['setting']['report_receive']);
$moderators = array();
if($report_receive['adminuser']) {
foreach($report_receive['adminuser'] as $touid) {
notification_add($touid, 'report', 'new_report', array('from_id' => 1, 'from_idtype' => 'newreport', 'username' => $_G['username']), 1);
}
}
if($fid && $rtype == 'post') {
foreach(C::t('forum_moderator')->fetch_all_by_fid($fid, false) as $row) {
$moderators[] = $row['uid'];
}
if($report_receive['supmoderator']) {
$moderators = array_unique(array_merge($moderators, $report_receive['supmoderator']));
}
foreach($moderators as $touid) {
$touid != $_G['uid'] && !in_array($touid, $report_receive['adminuser']) && notification_add($touid, 'report', 'new_post_report', array('fid' => $fid, 'from_id' => 1, 'from_idtype' => 'newreport', 'username' => $_G['username']), 1);
}
}
}
showmessage('report_succeed', '', array(), array('closetime' => true, 'showdialog' => 1, 'alert' => 'right'));
}
require_once libfile('function/misc');
include template('common/report');
?>

View File

@@ -0,0 +1,214 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_seccode.php 34646 2014-06-17 03:23:15Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$idhash = isset($_GET['idhash']) && preg_match('/^\w+$/', $_GET['idhash']) ? $_GET['idhash'] : '';
$modid = isset($_GET['modid']) && preg_match('/^[\w:]+$/', $_GET['modid']) ? $_GET['modid'] : '';
if(getgpc('action') == 'update' && !defined("IN_MOBILE")) {
$message = '';
$showid = 'seccode_'.$idhash;
$rand = random(5, 1);
$htmlcode = '';
$ani = $_G['setting']['seccodedata']['animator'] ? '_ani' : '';
if($_G['setting']['seccodedata']['type'] == 2) {
$htmlcode = extension_loaded('ming') ?
"$('seccodeswf_$idhash').innerHTML='".lang('core', 'seccode_image'.$ani.'_tips')."' + AC_FL_RunContent('width', '".$_G['setting']['seccodedata']['width']."', 'height', '".$_G['setting']['seccodedata']['height']."', 'src', 'misc.php?mod=seccode&update=$rand&idhash=$idhash','quality', 'high', 'wmode', 'transparent', 'bgcolor', '#ffffff','align', 'middle', 'menu', 'false', 'allowScriptAccess', 'never');" :
"$('seccodeswf_$idhash').innerHTML='".lang('core', 'seccode_image'.$ani.'_tips')."' + AC_FL_RunContent('width', '".$_G['setting']['seccodedata']['width']."', 'height', '".$_G['setting']['seccodedata']['height']."', 'src', '{$_G['siteurl']}static/image/seccode/flash/flash2.swf', 'FlashVars', 'sFile=".rawurlencode("{$_G['siteurl']}misc.php?mod=seccode&update=$rand&idhash=$idhash")."', 'menu', 'false', 'allowScriptAccess', 'never', 'swLiveConnect', 'true', 'wmode', 'transparent');";
$message = '<span id="seccodeswf_'.$idhash.'"></span>';
} elseif($_G['setting']['seccodedata']['type'] == 3) {
$htmlcode = "(function(){var a=document.createElement('audio');a.src='{$_G['siteurl']}misc.php?mod=seccode&update=$rand&idhash=$idhash&fromFlash=1',a.style.display='none',$('seccodeplay_$idhash').onclick=function(){a.play()},$('seccodeswf_$idhash').appendChild(a)})();";
$message = '<span id="seccodeswf_'.$idhash.'">'.lang('core', 'seccode_sound_tips').'</span>'.lang('forum/misc', 'seccode_player', array('idhash' => $idhash));
} else {
if(!is_numeric($_G['setting']['seccodedata']['type']) && preg_match('/^[\w\d:_]+$/i', $_G['setting']['seccodedata']['type'])) {
$etype = explode(':', $_G['setting']['seccodedata']['type']);
if(count($etype) > 1) {
$codefile = DISCUZ_ROOT.'./source/plugin/'.$etype[0].'/seccode/seccode_'.$etype[1].'.php';
$class = $etype[1];
} else {
$codefile = libfile('seccode/'.$_G['setting']['seccodedata']['type'], 'class');
$class = $_G['setting']['seccodedata']['type'];
}
if(file_exists($codefile)) {
@include_once $codefile;
$class = 'seccode_'.$class;
if(class_exists($class)) {
$code = new $class();
if(method_exists($code, 'make')) {
ob_start();
$seccode = $code->make($idhash, $modid);
make_seccode($seccode);
$message = preg_replace("/\r|\n/", '', ob_get_contents());
ob_end_clean();
}
}
}
} else {
$message = lang('core', 'seccode_image'.$ani.'_tips').'<img onclick="updateseccode(\''.$idhash.'\')" width="'.$_G['setting']['seccodedata']['width'].'" height="'.$_G['setting']['seccodedata']['height'].'" src="misc.php?mod=seccode&update='.$rand.'&idhash='.$idhash.'" class="vm" alt="" />';
}
}
$imemode = $_G['setting']['seccodedata']['type'] != 1 ? 'ime-mode:disabled;' : '';
$message = str_replace("'", "\'", $message);
$seclang = lang('forum/misc');
header("Content-Type: application/javascript");
echo <<<EOF
if($('$showid')) {
if(!$('v$showid')) {
var sectpl = seccheck_tpl['$idhash'] != '' ? seccheck_tpl['$idhash'].replace(/<hash>/g, 'code$idhash') : '';
var sectplcode = sectpl != '' ? sectpl.split('<sec>') : Array('<br />',': ','<br />','');
var string = '<input name="seccodehash" type="hidden" value="$idhash" /><input name="seccodemodid" type="hidden" value="$modid" />' + sectplcode[0] + '{$seclang['seccode']}' + sectplcode[1] + '<input name="seccodeverify" id="seccodeverify_$idhash" type="text" autocomplete="off" style="{$imemode}width:100px" class="txt px vm" onblur="checksec(\'code\', \'$idhash\', 0, null, \'$modid\')" />' +
' <a href="javascript:;" onclick="updateseccode(\'$idhash\');doane(event);" class="xi2">{$seclang['seccode_update']}</a>' +
'<span id="checkseccodeverify_$idhash"><i class="fico-checkbox fic4 fc-t fnmr vm"></i></span>' +
sectplcode[2] + '<span id="v$showid">$message</span>' + sectplcode[3];
evalscript(string);
$('$showid').innerHTML = string;
} else {
var string = '$message';
evalscript(string);
$('v$showid').innerHTML = string;
}
$htmlcode
}
EOF;
} elseif(getgpc('action') == 'update' && defined("IN_MOBILE") && constant("IN_MOBILE") == 2) {
$message = '';
$showid = 'seccode_'.$idhash;
$rand = random(5, 1);
$htmlcode = '';
$ani = $_G['setting']['seccodedata']['animator'] ? '_ani' : '';
if($_G['setting']['seccodedata']['type'] == 2 || $_G['setting']['seccodedata']['type'] == 3) {
$message = '<img onclick="updateseccode(\''.$idhash.'\')" width="'.$_G['setting']['seccodedata']['width'].'" height="'.$_G['setting']['seccodedata']['height'].'" src="misc.php?mod=seccode&mobile='.constant("IN_MOBILE").'&update='.$rand.'&idhash='.$idhash.'" class="seccodeimg" alt="" style="display: inline; visibility: visible;" />';
} else {
if(!is_numeric($_G['setting']['seccodedata']['type']) && preg_match('/^[\w\d:_]+$/i', $_G['setting']['seccodedata']['type'])) {
$etype = explode(':', $_G['setting']['seccodedata']['type']);
if(count($etype) > 1) {
$codefile = DISCUZ_ROOT.'./source/plugin/'.$etype[0].'/seccode/seccode_'.$etype[1].'.php';
$class = $etype[1];
} else {
$codefile = libfile('seccode/'.$_G['setting']['seccodedata']['type'], 'class');
$class = $_G['setting']['seccodedata']['type'];
}
if(file_exists($codefile)) {
@include_once $codefile;
$class = 'seccode_'.$class;
if(class_exists($class)) {
$code = new $class();
if(method_exists($code, 'make')) {
ob_start();
$seccode = $code->make($idhash, $modid);
make_seccode($seccode);
$message = preg_replace("/\r|\n/", '', ob_get_contents());
ob_end_clean();
}
}
}
} else {
$message = '<img onclick="updateseccode(\''.$idhash.'\')" width="'.$_G['setting']['seccodedata']['width'].'" height="'.$_G['setting']['seccodedata']['height'].'" src="misc.php?mod=seccode&mobile='.constant("IN_MOBILE").'&update='.$rand.'&idhash='.$idhash.'" class="seccodeimg" alt="" style="display: inline; visibility: visible;" />';
}
}
$imemode = $_G['setting']['seccodedata']['type'] != 1 ? 'ime-mode:disabled;' : '';
$message = str_replace("'", "\'", $message);
$seclang = lang('forum/misc');
header("Content-Type: application/javascript");
echo <<<EOF
if(document.getElementById('$showid')) {
if(!document.getElementById('v$showid')) {
var sectpl = seccheck_tpl['$idhash'] != '' ? seccheck_tpl['$idhash'].replace(/<hash>/g, 'code$idhash') : '';
var sectplcode = sectpl != '' ? sectpl.split('<sec>') : Array('<br />',': ','<br />','');
var string = '<input name="seccodehash" type="hidden" value="$idhash" /><input name="seccodemodid" type="hidden" value="$modid" /><input type="text" class="txt px vm" style="ime-mode:disabled;width:115px;background:white;" autocomplete="off" value="" id="seccodeverify_$idhash" name="seccodeverify" placeholder="$seclang[seccode]" fwin="seccode"><span id="v$showid">$message</span>';
evalscript(string);
document.getElementById('$showid').innerHTML = string;
} else {
var string = '$message';
evalscript(string);
document.getElementById('v$showid').innerHTML = string;
}
$htmlcode
}
EOF;
} elseif(getgpc('action') == 'check') {
include template('common/header_ajax');
echo helper_seccheck::check_seccode($_GET['secverify'], $_GET['idhash'], 1, $modid, true) ? 'succeed' : 'invalid';
include template('common/footer_ajax');
} else {
$refererhost = parse_url(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');
$refererhost['host'] = (isset($refererhost['host']) ? $refererhost['host'] : '').(!empty($refererhost['port']) ? (':'.$refererhost['port']) : '');
if(($_G['setting']['seccodedata']['type'] < 2 && ($refererhost['host'] != $_SERVER['HTTP_HOST'])) || ((defined("IN_MOBILE") && in_array($_G['setting']['seccodedata']['type'], array(2, 3)) && ($refererhost['host'] != $_SERVER['HTTP_HOST'])) && ($_G['setting']['seccodedata']['type'] == 2 && !extension_loaded('ming') && $_POST['fromFlash'] != 1 || $_G['setting']['seccodedata']['type'] == 3 && $_GET['fromFlash'] != 1))) {
exit('Access Denied');
}
if(is_numeric($_G['setting']['seccodedata']['type']) || !preg_match('/^[\w\d:_]+$/i', $_G['setting']['seccodedata']['type'])) {
$seccode = make_seccode();
if(!$_G['setting']['nocacheheaders']) {
@header("Expires: -1");
@header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
@header("Pragma: no-cache");
}
require_once libfile('class/seccode');
$code = new seccode();
$code->code = $seccode;
$code->type = (in_array($_G['setting']['seccodedata']['type'], array(2, 3)) && defined("IN_MOBILE")) ? 0 : $_G['setting']['seccodedata']['type'];
$code->width = $_G['setting']['seccodedata']['width'];
$code->height = $_G['setting']['seccodedata']['height'];
$code->background = $_G['setting']['seccodedata']['background'];
$code->adulterate = $_G['setting']['seccodedata']['adulterate'];
$code->ttf = $_G['setting']['seccodedata']['ttf'];
$code->angle = $_G['setting']['seccodedata']['angle'];
$code->warping = $_G['setting']['seccodedata']['warping'];
$code->scatter = $_G['setting']['seccodedata']['scatter'];
$code->color = $_G['setting']['seccodedata']['color'];
$code->size = $_G['setting']['seccodedata']['size'];
$code->shadow = $_G['setting']['seccodedata']['shadow'];
$code->animator = $_G['setting']['seccodedata']['animator'];
$code->fontpath = DISCUZ_ROOT.'./static/image/seccode/font/';
$code->datapath = DISCUZ_ROOT.'./static/image/seccode/';
$code->includepath = DISCUZ_ROOT.'./source/class/';
$code->display();
} else {
$etype = explode(':', $_G['setting']['seccodedata']['type']);
if(count($etype) > 1) {
$codefile = DISCUZ_ROOT.'./source/plugin/'.$etype[0].'/seccode/seccode_'.$etype[1].'.php';
$class = $etype[1];
} else {
$codefile = libfile('seccode/'.$_G['setting']['seccodedata']['type'], 'class');
$class = $_G['setting']['seccodedata']['type'];
}
if(file_exists($codefile)) {
@include_once $codefile;
$class = 'seccode_'.$class;
if(class_exists($class)) {
make_seccode();
$code = new $class();
$image = $code->image($idhash, $modid);
if($image) {
dheader('location: '.$image);
}
}
}
}
}
?>

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$
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if($_GET['action'] == 'send') {
$refererhost = parse_url($_SERVER['HTTP_REFERER']);
$refererhost['host'] .= !empty($refererhost['port']) ? (':'.$refererhost['port']) : '';
if($refererhost['host'] != $_SERVER['HTTP_HOST']) {
showmessage('submit_invalid');
}
$svctype = empty($_GET['svctype']) ? 0 : $_GET['svctype'];
$secmobicc = empty($_GET['secmobicc']) ? $_G['member']['secmobicc'] : $_GET['secmobicc'];
$secmobile = empty($_GET['secmobile']) ? $_G['member']['secmobile'] : $_GET['secmobile'];
list($seccodecheck, $secqaacheck) = seccheck('card');
if((!$seccodecheck && !$secqaacheck) || submitcheck('seccodesubmit', 0, $seccodecheck, $secqaacheck)) {
$length = $_G['setting']['smsdefaultlength'] ? $_G['setting']['smsdefaultlength'] : 4;
$secmobseccode = random($length, 1);
if(empty($secmobicc) || !preg_match('#^(\d){1,3}$#', $secmobicc)) {
showmessage('profile_secmobicc_illegal');
} else if(empty($secmobile) || !preg_match('#^(\d){1,12}$#', $secmobile)) {
showmessage('profile_secmobile_illegal');
}
$result = sms::send($_G['uid'], 0, $svctype, $secmobicc, $secmobile, $secmobseccode, 0);
if($result >= 0) {
showmessage('secmobseccode_send_success', '', array(), array('alert' => 'right'));
} else {
if($result <= -1 && $result >= -9) {
showmessage('secmobseccode_send_err_'.abs($result));
} else {
showmessage('secmobseccode_send_failure');
}
}
} else {
$handlekey = 'sendsecmobseccode';
include template('common/secmobseccode');
}
}

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: misc_secqaa.php 33682 2013-08-01 06:37:41Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$idhash = isset($_GET['idhash']) && preg_match('/^\w+$/', $_GET['idhash']) ? $_GET['idhash'] : '';
if($_GET['action'] == 'update' && !defined("IN_MOBILE")) {
$refererhost = parse_url($_SERVER['HTTP_REFERER']);
$refererhost['host'] .= !empty($refererhost['port']) ? (':'.$refererhost['port']) : '';
if($refererhost['host'] != $_SERVER['HTTP_HOST']) {
exit('Access Denied');
}
$message = '';
$showid = 'secqaa_'.$idhash;
if($_G['setting']['secqaa']) {
$question = make_secqaa();
}
$message = preg_replace("/\r|\n/", '', $question);
$message = str_replace("'", "\'", $message);
$seclang = lang('forum/misc');
header("Content-Type: application/javascript");
echo <<<EOF
if($('$showid')) {
var sectpl = seccheck_tpl['$idhash'] != '' && typeof seccheck_tpl['$idhash'] != 'undefined' ? seccheck_tpl['$idhash'].replace(/<hash>/g, 'code$idhash') : '';
var sectplcode = sectpl != '' ? sectpl.split('<sec>') : Array('<br />',': ','<br />','');
var string = '<input name="secqaahash" type="hidden" value="$idhash" />' + sectplcode[0] + '{$seclang['secqaa']}' + sectplcode[1] + '<input name="secanswer" id="secqaaverify_$idhash" type="text" autocomplete="off" style="{$imemode}width:100px" class="txt px vm" onblur="checksec(\'qaa\', \'$idhash\')" />' +
' <a href="javascript:;" onclick="updatesecqaa(\'$idhash\');doane(event);" class="xi2">{$seclang['seccode_update']}</a>' +
'<span id="checksecqaaverify_$idhash"><img src="' + STATICURL + 'image/common/none.gif" width="16" height="16" class="vm" /></span>' +
sectplcode[2] + '$message' + sectplcode[3];
evalscript(string);
$('$showid').innerHTML = string;
}
EOF;
} elseif(getgpc('action') == 'update' && defined("IN_MOBILE") && constant("IN_MOBILE") == 2) {
$refererhost = parse_url($_SERVER['HTTP_REFERER']);
$refererhost['host'] .= !empty($refererhost['port']) ? (':'.$refererhost['port']) : '';
if($refererhost['host'] != $_SERVER['HTTP_HOST']) {
exit('Access Denied');
}
$message = '';
$showid = 'secqaa_'.$idhash;
if($_G['setting']['secqaa']) {
$question = make_secqaa();
}
$message = preg_replace("/\r|\n/", '', $question);
$message = str_replace("'", "\'", $message);
$seclang = lang('forum/misc');
header("Content-Type: application/javascript");
echo <<<EOF
if(document.getElementById('$showid')) {
if(!document.getElementById('v$showid')) {
var sectpl = seccheck_tpl['$idhash'] != '' && typeof seccheck_tpl['$idhash'] != 'undefined' ? seccheck_tpl['$idhash'].replace(/<hash>/g, 'code$idhash') : '';
var sectplcode = sectpl != '' ? sectpl.split('<sec>') : Array('<br />',': ','','');
var string = '<input name="secqaahash" type="hidden" value="$idhash" /><input type="text" class="txt px vm" style="ime-mode:disabled;width:115px;background:white;" autocomplete="off" value="" name="secanswer" id="secqaaverify_$idhash" placeholder="$seclang[secqaa]" /><span id="v$showid"><a href="javascript:;" onclick="updatesecqaa(\'$idhash\');" class="xi2">' + '$message' +
'</a></span>' +
'<span id="checksecqaaverify_$idhash"></span>';
evalscript(string);
document.getElementById('$showid').innerHTML = string;
} else {
var string = '<a href="javascript:;" onclick="updatesecqaa(\'$idhash\');" class="xi2">' + '$message' +
'</a>';
evalscript(string);
document.getElementById('v$showid').innerHTML = string;
}
}
EOF;
} elseif($_GET['action'] == 'check') {
include template('common/header_ajax');
echo helper_seccheck::check_secqaa($_GET['secverify'], $idhash, true) ? 'succeed' : 'invalid';
include template('common/footer_ajax');
}
?>

View File

@@ -0,0 +1,554 @@
<?php
/*
[Discuz!] (C)2001-2099 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: misc_stat.php 31889 2012-10-22 03:27:56Z liulanbo $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
define('CACHE_TIME', 18000);
$op = getgpc('op');
if(!in_array($op, array('basic', 'trade', 'team', 'trend', 'modworks', 'memberlist', 'forumstat', 'trend'))) {
$op = 'basic';
}
if(!$_G['group']['allowstatdata'] && $op != 'trend') {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
$navtitle = lang('core', 'title_stats_'.$op).' - '.lang('core', 'title_stats');
loadcache('statvars');
if($op == 'basic') {
$statvars = getstatvars('basic');
extract($statvars);
include template('forum/stat_main');
} elseif($op == 'trade') {
$statvars = getstatvars('trade');
extract($statvars);
include template('forum/stat_trade');
} elseif($op == 'team') {
$statvars = getstatvars('team');
extract($statvars);
include template('forum/stat_team');
} elseif($op == 'modworks' && $_G['setting']['modworkstatus']) {
$statvars = getstatvars('modworks');
extract($statvars);
if($_GET['exportexcel']) {
$filename = 'stat_modworks_'.($username ? $username.'_' : '').$starttime.'_'.$endtime.'.csv';
$filenameencode = strtolower(CHARSET) == 'utf-8' ? rawurlencode($filename) : rawurlencode(diconv($filename, CHARSET, 'UTF-8'));
$rfc6266blacklist = strexists($_SERVER['HTTP_USER_AGENT'], 'UCBrowser') || strexists($_SERVER['HTTP_USER_AGENT'], 'Quark') || strexists($_SERVER['HTTP_USER_AGENT'], 'SogouM') || strexists($_SERVER['HTTP_USER_AGENT'], 'baidu');
include template('forum/stat_misc_export');
$csvstr = ob_get_contents();
ob_end_clean();
header('Content-Encoding: none');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.$filenameencode.'"'.(($filename == $filenameencode || $rfc6266blacklist) ? '' : '; filename*=utf-8\'\''.$filenameencode));
header('Pragma: no-cache');
header('Expires: 0');
if($_G['charset'] != 'gbk') {
$csvstr = diconv($csvstr, $_G['charset'], 'GBK');
}
echo $csvstr;
exit;
} else {
include template('forum/stat_misc');
}
} elseif($op == 'memberlist' && $_G['setting']['memliststatus']) {
$statvars = getstatvars('memberlist');
extract($statvars);
include template('forum/stat_memberlist');
} elseif($op == 'forumstat') {
$statvars = getstatvars('forumstat');
extract($statvars);
include template('forum/stat_misc');
} elseif($op == 'trend') {
include libfile('misc/stat', 'include');
} else {
showmessage('undefined_action');
}
function getstatvars($type) {
global $_G;
$statvars = & $_G['cache']['statvars'][$type];
if(!empty($statvars['lastupdated']) && TIMESTAMP - $statvars['lastupdated'] < CACHE_TIME) {
return $statvars;
}
switch($type) {
case 'basic':
case 'trade':
case 'onlinetime':
case 'team':
case 'modworks':
case 'memberlist':
case 'forumstat':
$statvars = call_user_func('getstatvars_'.$type, ($type == 'forumstat' ? getgpc('fid') : ''));//getstatvars_forumstat($_GET['fid']);
break;
}
return $statvars;
}
function getstatvars_basic() {
global $_G;
$statvars = array();
$statvars['members'] = C::t('common_member')->count();
$members_runtime = C::t('common_member')->fetch_runtime();
$statvars['membersaddavg'] = $members_runtime > 0.00001 ? (round($statvars['members'] / $members_runtime)) : 0;
$statvars['memnonpost'] = C::t('common_member_count')->count_by_posts(0);
$statvars['mempost'] = $statvars['members'] - $statvars['memnonpost'];
$statvars['admins'] = C::t('common_member')->count_admins();
$statvars['lastmember'] = C::t('common_member')->count_by_regdate(TIMESTAMP - 86400);
$statvars['mempostpercent'] = number_format((double)$statvars['mempost'] / $statvars['members'] * 100, 2);
$bestmember = C::t('forum_post')->fetch_all_top_post_author(0, $_G['timestamp']-86400, 1);
$bestmember = isset($bestmember[0]) ? $bestmember[0] : array('username' => '');
$bestmember['author'] = $bestmember['username'];
$statvars['bestmem'] = isset($bestmember['author']) ? $bestmember['author'] : null;
$statvars['bestmemposts'] = isset($bestmember['posts']) ? $bestmember['posts'] : null;
$postsinfo = C::t('forum_post')->fetch_posts(0);
$statvars['posts'] = $postsinfo['posts'];
$runtime= $postsinfo['runtime'];
$statvars['postsaddavg'] = $runtime > 0.00001 ? round($statvars['posts'] / $runtime) : 0;
$statvars['mempostavg'] = sprintf ("%01.2f", $statvars['members'] ? ($statvars['posts'] / $statvars['members']) : 0);
$statvars['forums'] = C::t('forum_forum')->fetch_all_fids(0, 'forum', 0, 0, 0, 1);
$hotforum = C::t('forum_forum')->fetch_all_for_ranklist(1, '', 'posts', 0, 1);
$statvars['hotforum'] = array('posts' => $hotforum[0]['posts'], 'threads' => $hotforum[0]['threads'], 'fid' => $hotforum[0]['fid'], 'name' => $hotforum[0]['name']);
$statvars['threads'] = C::t('forum_thread')->count_all_thread();
$statvars['postsaddtoday'] = C::t('forum_post')->count_by_dateline(0, TIMESTAMP - 86400);
$statvars['threadreplyavg'] = sprintf ("%01.2f", $statvars['threads'] ? (($statvars['posts'] - $statvars['threads']) / $statvars['threads']) : 0);
$statvars['membersaddtoday'] = $statvars['lastmember'];
$statvars['activeindex'] = round((($statvars['members'] ? ($statvars['membersaddavg'] / $statvars['members']) : 0) + ($statvars['posts'] ? ($statvars['postsaddavg'] / $statvars['posts']) : 0)) * 1500 + $statvars['threadreplyavg'] * 10 + $statvars['mempostavg'] * 1 + $statvars['mempostpercent'] / 10);
$statvars['lastupdate'] = dgmdate(TIMESTAMP);
$statvars['nextupdate'] = dgmdate(TIMESTAMP + CACHE_TIME);
$statvars['lastupdated'] = TIMESTAMP;
$_G['cache']['statvars']['basic'] = $statvars;
savecache('statvars', $_G['cache']['statvars']);
return $statvars;
}
function getstatvars_trade() {
global $_G;
$statvars = array();
$query = C::t('forum_trade')->fetch_all_statvars('tradesum');
foreach($query as $data) {
$tradesums[] = $data;
}
$statvars['tradesums'] = $tradesums;
$query = C::t('forum_trade')->fetch_all_statvars('credittradesum');
foreach($query as $data) {
$credittradesums[] = $data;
}
$statvars['credittradesums'] = $credittradesums;
$query = C::t('forum_trade')->fetch_all_statvars('totalitems');
foreach($query as $data) {
$totalitems[] = $data;
}
$statvars['totalitems'] = $totalitems;
$statvars['lastupdate'] = dgmdate(TIMESTAMP);
$statvars['nextupdate'] = dgmdate(TIMESTAMP + CACHE_TIME);
$statvars['lastupdated'] = TIMESTAMP;
$_G['cache']['statvars']['trade'] = $statvars;
savecache('statvars', $_G['cache']['statvars']);
return $statvars;
}
function getstatvars_team() {
global $_G;
$statvars = array();
$team = array();
$forums = $moderators = $members = $fuptemp = array();
$categories = array(0 => array('fid' => 0, 'fup' => 0, 'type' => 'group', 'name' => $_G['setting']['bbname']));
$uids = array();
foreach(C::t('forum_moderator')->fetch_all_no_inherited() as $moderator) {
$moderators[$moderator['fid']][] = $moderator['uid'];
$uids[$moderator['uid']] = $moderator['uid'];
}
$totaloffdays = $totalol = $totalthismonthol = 0;
$admins = array();
$members = C::t('common_member')->fetch_all($uids) + C::t('common_member')->fetch_all_by_adminid(array(1, 2));
$uids = array_keys($members);
$onlinetime = $_G['setting']['oltimespan'] ? C::t('common_onlinetime')->fetch_all($uids) : array();
$member_status = C::t('common_member_status')->fetch_all($uids);
$member_count = C::t('common_member_count')->fetch_all($uids);
foreach($members as $uid => $member) {
$member = array_merge($member, $member_status[$uid], $member_count[$uid], (array)$onlinetime[$uid]);
$member['thismonthol'] = $member['thismonth'];
$member['totalol'] = $member['total'];
if($member['adminid'] == 1 || $member['adminid'] == 2) {
$admins[] = $member['uid'];
}
$member['offdays'] = intval((TIMESTAMP - $member['lastactivity']) / 86400);
$totaloffdays += $member['offdays'];
if($_G['setting']['oltimespan']) {
$member['totalol'] = round($member['totalol'] / 60, 2);
$member['thismonthol'] = gmdate('Yn', $member['lastactivity']) == gmdate('Yn', TIMESTAMP) ? round($member['thismonthol'] / 60, 2) : 0;
$totalol += $member['totalol'];
$totalthismonthol += $member['thismonthol'];
}
$members[$member['uid']] = $member;
$uids[$member['uid']] = $member['uid'];
}
$totalthismonthposts = 0;
foreach(C::t('forum_post')->fetch_all_author_posts_by_dateline(0, $uids, $_G['timestamp']-86400*30) as $post) {
$members[$post['authorid']]['thismonthposts'] = $post['posts'];
$totalthismonthposts += $post['posts'];
}
$totalmodposts = $totalmodactions = 0;
if($_G['setting']['modworkstatus']) {
$starttime = gmdate("Y-m-1", TIMESTAMP + $_G['setting']['timeoffset'] * 3600);
foreach(C::t('forum_modwork')->fetch_all_user_count_by_dateline($starttime) as $member) {
$members[$member['uid']]['modactions'] = $member['actioncount'];
$totalmodactions += $member['actioncount'];
}
}
$query = C::t('forum_forum')->fetch_all_by_status(1, 1);
foreach($query as $val) {
$forum = array('fid' => $val['fid'], 'fup' => $val['fup'], 'type' => $val['type'], 'name' => $val['name'], 'inheritedmod' => $val['inheritedmod']);
$moderators[$forum['fid']] = (isset($moderators[$forum['fid']]) && is_array($moderators[$forum['fid']])) ? $moderators[$forum['fid']] : array();
$forum['moderators'] = count($moderators[$forum['fid']]);
switch($forum['type']) {
case 'group':
$categories[$forum['fid']] = $forum;
$forums[$forum['fid']][$forum['fid']] = $forum;
$catfid = $forum['fid'];
break;
case 'forum':
$forums[$forum['fup']][$forum['fid']] = $forum;
$fuptemp[$forum['fid']] = $forum['fup'];
$catfid = $forum['fup'];
break;
case 'sub':
$forums[$fuptemp[$forum['fup']]][$forum['fid']] = $forum;
$catfid = $fuptemp[$forum['fup']];
break;
}
if(!empty($moderators[$forum['fid']])) {
$categories[$catfid]['moderating'] = 1;
}
}
foreach($categories as $fid => $category) {
if(empty($category['moderating'])) {
unset($categories[$fid]);
}
}
$team = array (
'categories' => $categories,
'forums' => $forums,
'admins' => $admins,
'moderators' => $moderators,
'members' => $members,
'avgoffdays' => count($members) ? ($totaloffdays / count($members)) : 0,
'avgthismonthposts' => count($members) ? ($totalthismonthposts / count($members)) : 0,
'avgtotalol' => count($members) ? ($totalol / count($members)) : 0,
'avgthismonthol' => count($members) ? ($totalthismonthol / count($members)) : 0,
'avgmodactions' => count($members) ? ($totalmodactions / count($members)) : 0,
);
loadcache('usergroups');
if(is_array($team)) {
foreach($team['members'] as $uid => $member) {
$member['thismonthposts'] = intval($member['thismonthposts']);
$team['members'][$uid]['offdays'] = $member['offdays'] > $team['avgoffdays'] ? '<b><i>'.$member['offdays'].'</i></b>' : $member['offdays'];
$team['members'][$uid]['thismonthposts'] = $member['thismonthposts'] < $team['avgthismonthposts'] / 2 ? '<b><i>'.$member['thismonthposts'].'</i></b>' : $member['thismonthposts'];
$team['members'][$uid]['lastactivity'] = dgmdate($member['lastactivity'] + $_G['setting']['timeoffset'] * 3600, 'd');
$team['members'][$uid]['thismonthol'] = $member['thismonthol'] < $team['avgthismonthol'] / 2 ? '<b><i>'.$member['thismonthol'].'</i></b>' : $member['thismonthol'];
$team['members'][$uid]['totalol'] = $member['totalol'] < $team['avgtotalol'] / 2 ? '<b><i>'.$member['totalol'].'</i></b>' : $member['totalol'];
$team['members'][$uid]['modposts'] = $member['modposts'] < $team['avgmodposts'] / 2 ? '<b><i>'.intval($member['modposts']).'</i></b>' : intval($member['modposts']);
$team['members'][$uid]['modactions'] = $member['modactions'] < $team['avgmodactions'] / 2 ? '<b><i>'.intval($member['modactions']).'</i></b>' : intval($member['modactions']);
$team['members'][$uid]['grouptitle'] = $_G['cache']['usergroups'][$member['adminid']]['grouptitle'];
}
}
$statvars['team'] = $team;
$statvars['lastupdate'] = dgmdate(TIMESTAMP);
$statvars['nextupdate'] = dgmdate(TIMESTAMP + CACHE_TIME);
$statvars['lastupdated'] = TIMESTAMP;
$_G['cache']['statvars']['team'] = $statvars;
savecache('statvars', $_G['cache']['statvars']);
return $statvars;
}
function getstatvars_modworks() {
global $_G;
$statvars = array();
$before = $_GET['before'];
$before = (isset($before) && $before > 0 && $before <= $_G['setting']['maxmodworksmonths']) ? intval($before) : 0 ;
$modworks_starttime = $_GET['modworks_starttime'];
$modworks_endtime = $_GET['modworks_endtime'];
list($now['year'], $now['month'], $now['day']) = explode("-", dgmdate(TIMESTAMP, 'Y-n-j'));
$monthlinks = array();
$uid = !empty($_GET['uid']) ? $_GET['uid'] : 0;
for($i = 0; $i <= $_G['setting']['maxmodworksmonths']; $i++) {
$month = date("Y-m", mktime(0, 0, 0, $now['month'] - $i, 1, $now['year']));
if($i != $before) {
$monthlinks[$i] = "<li><a href=\"misc.php?mod=stat&op=modworks&before=$i&uid=$uid\" hidefocus=\"true\">$month</a></li>";
} else {
if(!isset($_GET['before']) && $modworks_starttime && $modworks_endtime) {
$starttime = dgmdate(strtotime($modworks_starttime), 'Y-m-d');
$endtime = dgmdate(strtotime($modworks_endtime), 'Y-m-d');
$monthlinks[$i] = "<li><a href=\"misc.php?mod=stat&op=modworks&before=$i&uid=$uid\" hidefocus=\"true\">$month</a></li>";
} else {
$starttime = $month.'-01';
$endtime = date("Y-m-01", mktime(0, 0, 0, $now['month'] - $i + 1 , 1, $now['year']));
$monthlinks[$i] = "<li class=\"xw1 a\"><a href=\"misc.php?mod=stat&op=modworks&before=$i&uid=$uid\" hidefocus=\"true\">$month</a></li>";
}
}
}
$statvars['monthlinks'] = $monthlinks;
$expiretime = date('Y-m', mktime(0, 0, 0, $now['month'] - $_G['setting']['maxmodworksmonths'] - 1, 1, $now['year']));
$mergeactions = array('OPN' => 'CLS', 'ECL' => 'CLS', 'UEC' => 'CLS', 'EOP' => 'CLS', 'UEO' => 'CLS',
'UDG' => 'DIG', 'EDI' =>'DIG', 'UED' => 'DIG', 'UST' => 'STK', 'EST' => 'STK', 'UES' => 'STK',
'DLP' => 'DEL', 'PRN' => 'DEL', 'UDL' => 'DEL', 'UHL' => 'HLT', 'EHL' => 'HLT', 'UEH' => 'HLT',
'SPL' => 'MRG', 'ABL' => 'EDT', 'RBL' => 'EDT');
if($uid) {
$uid = $_GET['uid'];
$member = getuserbyuid($uid, 1);
if(empty($member) || !is_array($member) || in_array($_G['adminid'], array(0, -1))) {
showmessage('member_not_found');
}
$modactions = $totalactions = array();
$starttime_dateline = strtotime($starttime);
$endtime_dateline = strtotime($endtime);
$endtime_dateline = $endtime_dateline > TIMESTAMP ? TIMESTAMP : $endtime_dateline;
while($starttime_dateline <= $endtime_dateline) {
$modactions[dgmdate($starttime_dateline, 'Y-m-d')] = array();
$starttime_dateline += 86400;
}
foreach(C::t('forum_modwork')->fetch_all_by_uid_dateline($uid, $starttime, $endtime) as $data) {
if(isset($mergeactions[$data['modaction']])) {
$data['modaction'] = $mergeactions[$data['modaction']];
}
$modactions[$data['dateline']]['total'] += $data['count'];
$modactions[$data['dateline']][$data['modaction']]['count'] += $data['count'];
$modactions[$data['dateline']][$data['modaction']]['posts'] += $data['posts'];
$totalactions[$data['modaction']]['count'] += $data['count'];
$totalactions[$data['modaction']]['posts'] += $data['posts'];
$totalactions['total'] += $data['count'];
}
$statvars['modactions'] = $modactions;
$statvars['totalactions'] = $totalactions;
$statvars['username'] = $member['username'];
} else {
$members = $total = array();
$uids = $totalmodactions = 0;
$members = C::t('common_member')->fetch_all_by_adminid(array(1, 2, 3));
foreach(C::t('forum_modwork')->fetch_all_user_count_posts_by_uid_dateline(array_keys($members), $starttime, $endtime) as $data) {
if(isset($mergeactions[$data['modaction']])) {
$data['modaction'] = $mergeactions[$data['modaction']];
}
$members[$data['uid']]['total'] += $data['count'];
$totalmodactioncount += $data['count'];
$members[$data['uid']][$data['modaction']]['count'] += $data['count'];
$members[$data['uid']][$data['modaction']]['posts'] += $data['posts'];
$total[$data['modaction']]['count'] += $data['count'];
$total[$data['modaction']]['posts'] += $data['posts'];
$total['total'] += $data['count'];
}
$avgmodactioncount = count($members) ? ($totalmodactioncount / count($members)) : 0;
foreach($members as $id => $member) {
$members[$id]['totalactions'] = intval($members[$id]['totalactions']);
$members[$id]['username'] = ($members[$id]['total'] < $avgmodactioncount / 2) ? ('<b><i>'.$members[$id]['username'].'</i></b>') : ($members[$id]['username']);
}
if(!empty($before)) {
C::t('forum_modwork')->delete_by_dateline($expiretime.'-01');
} else {
$members['thismonth'] = $starttime;
$members['lastupdate'] = TIMESTAMP;
unset($members['lastupdate'], $members['thismonth']);
}
$statvars['members'] = $members;
$statvars['total'] = $total;
}
$modactioncode = lang('forum/modaction');
$bgarray = array();
foreach($modactioncode as $key => $val) {
if(isset($mergeactions[$key])) {
unset($modactioncode[$key]);
}
}
$statvars['modactioncode'] = $modactioncode;
$tdcols = count($modactioncode) + 1;
$tdwidth = floor(90 / ($tdcols - 1)).'%';
$statvars['tdwidth'] = $tdwidth;
$statvars['uid'] = $uid;
$statvars['starttime'] = $starttime;
$statvars['endtime'] = $endtime;
return $statvars;
}
function getstatvars_memberlist() {
global $_G;
$statvars = array();
$srchmem = $_GET['srchmem'];
$page = $_G['setting']['membermaxpages'] && isset($_GET['page']) && $_GET['page'] > $_G['setting']['membermaxpages'] ? 1 : $_GET['page'];
if(empty($page)) {
$page = 1;
}
$start_limit = ($page - 1) * $_G['setting']['memberperpage'];
$statvars['memberlist'] = C::t('common_member')->fetch_all_stat_memberlist($srchmem, $_GET['order'], $_GET['asc'] ? 'ASC' : 'DESC', $start_limit, $_G['setting']['memberperpage']);
$num = !empty($srchmem) ? C::t('common_member')->count_by_like_username($srchmem) : C::t('common_member')->count();
$multipage = multi($num, $_G['setting']['memberperpage'], $page, 'misc.php?mod=stat&op=memberlist&srchmem='.rawurlencode($srchmem).'&order='.rawurlencode($_GET['order']).'&asc='.rawurlencode($_GET['asc']), $_G['setting']['membermaxpages']);
$statvars['multipage'] = $multipage;
return $statvars;
}
function getstatvars_forumstat($fid) {
global $_G;
$xml = '<'."?xml version=\"1.0\" encoding=\"utf-8\"?><chart>";
$statvars = array();
$monthdays = array('31', '29', '31', '30', '31', '30', '31', '31', '30', '31', '30', '31');
if(!$fid) {
$query = C::t('forum_forum')->fetch_all_fids();
$forums = array();
foreach($query as $val) {
$forums[] = array('fid' => $val['fid'], 'type' => $val['type'], 'name' => $val['name'], 'posts' => $val['posts']);
}
$statvars['forums'] = $forums;
} else {
$foruminfo = C::t('forum_forum')->fetch($fid);
$statvars['foruminfo'] = array('fid' => $foruminfo['fid'], 'name' => $foruminfo['name'], 'posts' => $foruminfo['posts'], 'threads' => $foruminfo['threads'], 'todayposts' => $foruminfo['todayposts']);
$current_date = $end_date = date('Y-m-d');
$current_month = $end_month = date('Y-m');
$current_month_start = $end_month_start = $current_month . '-01';
if($_GET['month']) {
$end_month = trim($_GET['month']);
$month = substr($end_month, strpos($end_month, '-') + 1);
$end_date = $end_month . '-' . $monthdays[$month - 1];
$end_month_start = $end_month . '-' . '01';
}
$statvars['month'] = $end_month;
$logs = array();
$xml .= "<xaxis>";
$xmlvalue = '';
$xaxisindex = 0;
foreach(C::t('forum_statlog')->fetch_all_by_logdate($end_month_start, $end_date, $fid) as $log) {
$logs[] = $log;
list($yyyy, $mm, $dd) = explode('-', $log['logdate']);
$xaxisindex++;
$xml .= "<value xid=\"{$xaxisindex}\">{$mm}{$dd}</value>";
$xmlvalue .= "<value xid=\"{$xaxisindex}\">{$log['value']}</value>";
}
$xml .= "</xaxis>";
$xml .= "<graphs>";
$xml .= "<graph gid=\"0\" title=\"".diconv(lang('spacecp', 'do_stat_post_number'), CHARSET, 'UTF-8')."\">";
$xml .= $xmlvalue;
$xml .= "</graph>";
$xml .= "</graphs>";
$xml .= "</chart>";
if($_GET['xml']) {
@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;
}
$statvars['logs'] = $logs;
$mindate = C::t('forum_statlog')->fetch_min_logdate_by_fid($fid);
if(!$mindate) {
return $statvars;
}
list($minyear, $minmonth, $minday) = explode('-', $mindate);
$minmonth = $minyear . '-' . $minmonth;
$month = $minmonth;
$monthlist = array();
while(datecompare($month, $current_month) <= 0) {
$monthlist[] = $month;
$month = getnextmonth($month);
}
$statvars['monthlist'] = $monthlist;
$monthposts = array();
foreach(C::t('forum_statlog')->fetch_all_by_fid_type($fid) as $data) {
list($year, $month, $day) = explode('-', $data['logdate']);
if(isset($monthposts[$year.'-'.$month])) {
$monthposts[$year.'-'.$month] += $data['value'];
} else {
$monthposts[$year.'-'.$month] = $data['value'];
}
}
$statvars['monthposts'] = $monthposts;
}
$statvars['statuspara'] = "misc.php?mod=stat&op=forumstat&fid=$fid&month={getgpc('month')}&xml=1";
return $statvars;
}
function datecompare($date1, $date2) {
$year1 = $month1 = $day1 = 1;
$year2 = $month2 = $day2 = 1;
list($year1, $month1, $day1) = explode('-', $date1);
list($year2, $month2, $day2) = explode('-', $date2);
return mktime(0, 0, 0, $month1, $day1, $year1) - mktime(0, 0, 0, $month2, $day2, $year2);
}
function getnextmonth($monthdate) {
list($year, $month) = explode('-', $monthdate);
$month = $month + 1;
if($month > 12) {
$month = 1;
$year = $year + 1;
}
$month = sprintf("%02d", $month);
return $year . '-' . $month;
}

View File

@@ -0,0 +1,252 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_swfupload.php 35377 2015-07-07 05:20:23Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$_G['uid'] = intval($_POST['uid']);
if((empty($_G['uid']) && $_GET['operation'] != 'upload') || $_POST['hash'] != md5(substr(md5($_G['config']['security']['authkey']), 8).$_G['uid'])) {
exit();
} else {
if($_G['uid']) {
$_G['member'] = getuserbyuid($_G['uid']);
}
$_G['groupid'] = $_G['member']['groupid'];
loadcache('usergroup_'.$_G['member']['groupid']);
$_G['group'] = $_G['cache']['usergroup_'.$_G['member']['groupid']];
}
if($_GET['operation'] == 'upload') {
if(empty($_GET['simple'])) {
$_FILES['Filedata']['name'] = diconv(urldecode($_FILES['Filedata']['name']), 'UTF-8');
$_FILES['Filedata']['type'] = $_GET['filetype'];
}
$forumattachextensions = '';
$fid = intval($_GET['fid']);
if($fid) {
$forum = $fid != $_G['fid'] ? C::t('forum_forum')->fetch_info_by_fid($fid) : $_G['forum'];
if($forum['status'] == 3 && $forum['level']) {
$levelinfo = C::t('forum_grouplevel')->fetch($forum['level']);
if($postpolicy = $levelinfo['postpolicy']) {
$postpolicy = dunserialize($postpolicy);
$forumattachextensions = $postpolicy['attachextensions'];
}
} else {
$forumattachextensions = $forum['attachextensions'];
}
if($forumattachextensions) {
$_G['group']['attachextensions'] = $forumattachextensions;
}
}
$upload = new forum_upload();
} elseif($_GET['operation'] == 'poll') {
if(!$_G['group']['allowpostpoll'] || !$_G['group']['allowpostimage']) {
exit("{\"aid\":0, \"errorcode\":4}");
}
$upload = new discuz_upload();
$_FILES["Filedata"]['name'] = addslashes(diconv(urldecode($_FILES["Filedata"]['name']), 'UTF-8'));
$upload->init($_FILES['Filedata'], 'forum');
$attach = $upload->attach;
if(!$upload->attach['isimage']) {
$errorcode = 4;
} else {
$upload->save();
$errorcode = 0;
}
if($upload->error()) {
$errorcode = 4;
} else {
if($attach['isimage']) {
require_once libfile('class/image');
$image = new image();
$thumbimgwidth = 300;
$thumbimgheight = 300;
$attach['thumb'] = $image->Thumb($attach['target'], '', $thumbimgwidth, $thumbimgheight, 2);
$image->Watermark($attach['target'], '', 'forum');
$imginfo = @getimagesize($attach['target']);
if($imginfo !== FALSE) {
$attach['width'] = $imginfo[0];
$attach['height'] = $imginfo[1];
}
}
if(ftpperm($attach['ext'], $attach['size'])) {
if(ftpcmd('upload', 'forum/'.$attach['attachment']) && (!$attach['thumb'] || ftpcmd('upload', 'forum/'.getimgthumbname($attach['attachment'])))) {
@unlink($_G['setting']['attachdir'].'/forum/'.$attach['attachment']);
@unlink($_G['setting']['attachdir'].'/forum/'.getimgthumbname($attach['attachment']));
$attach['remote'] = 1;
} else {
if(getglobal('setting/ftp/mirror')) {
@unlink($attach['target']);
@unlink(getimgthumbname($attach['target']));
$errorcode = 5;
}
}
}
}
if(!$errorcode) {
$aid = intval($_GET['aid']);
$setarr = array(
'uid' => $_G['uid'],
'filename' => $attach['name'],
'attachment' => $attach['attachment'],
'filesize' => $attach['size'],
'thumb' => $attach['thumb'],
'remote' => $attach['remote'],
'dateline' => $_G['timestamp'],
'width' => $attach['width'],
'height' => $attach['height']
);
$image = array();
if($aid) {
$image = C::t('forum_polloption_image')->fetch($aid);
}
if($image['uid'] == $_G['uid']) {
C::t('forum_polloption_image')->update($aid, $setarr);
@unlink($_G['setting']['attachdir'].'/forum/'.$image['attachment']);
@unlink($_G['setting']['attachdir'].'/forum/'.getimgthumbname($image['attachment']));
$attach['attachid'] = $aid;
} else {
$attach['attachid'] = C::t('forum_polloption_image')->insert($setarr, true);
}
require_once libfile('function/home');
$smallimg = pic_get($attach['attachment'], 'forum', $attach['thumb'], $attach['remote']);
$bigimg = pic_get($attach['attachment'], 'forum', 0, $attach['remote']);
echo "{\"aid\":{$attach['attachid']}, \"smallimg\":\"$smallimg\", \"bigimg\":\"$bigimg\", \"errorcode\":$errorcode}";
exit();
} else {
echo "{\"aid\":0, \"errorcode\":$errorcode}";
}
} elseif($_GET['operation'] == 'album') {
$showerror = true;
if(helper_access::check_module('album')) {
require_once libfile('function/spacecp');
if($_FILES["Filedata"]['error']) {
$file = lang('spacecp', 'file_is_too_big');
} else {
require_once libfile('function/home');
$_FILES["Filedata"]['name'] = addslashes(diconv(urldecode($_FILES["Filedata"]['name']), 'UTF-8'));
$file = pic_save($_FILES["Filedata"], 0, '', true, 0);
if(!empty($file) && is_array($file)) {
$url = pic_get($file['filepath'], 'album', $file['thumb'], $file['remote']);
$bigimg = pic_get($file['filepath'], 'album', 0, $file['remote']);
echo "{\"picid\":\"{$file['picid']}\", \"url\":\"$url\", \"bigimg\":\"$bigimg\"}";
$showerror = false;
}
}
}
if($showerror) {
echo "{\"picid\":\"0\", \"url\":\"0\", \"bigimg\":\"0\"}";
}
} elseif($_GET['operation'] == 'portal') {
$aid = intval($_POST['aid']);
$catid = intval($_POST['catid']);
$msg = '';
$errorcode = 0;
require_once libfile('function/portalcp');
if($aid) {
$article = C::t('portal_article_title')->fetch($aid);
if(!$article) {
$errorcode = 1;
}
if(check_articleperm($catid, $aid, $article, false, true) !== true) {
$errorcode = 2;
}
} else {
if(check_articleperm($catid, $aid, null, false, true) !== true) {
$errorcode = 3;
}
}
$upload = new discuz_upload();
$_FILES["Filedata"]['name'] = addslashes(diconv(urldecode($_FILES["Filedata"]['name']), 'UTF-8'));
$upload->init($_FILES['Filedata'], 'portal');
$attach = $upload->attach;
if(!$upload->error()) {
$upload->save();
}
if($upload->error()) {
$errorcode = 4;
}
if(!$errorcode) {
if($attach['isimage'] && empty($_G['setting']['portalarticleimgthumbclosed'])) {
require_once libfile('class/image');
$image = new image();
$thumbimgwidth = $_G['setting']['portalarticleimgthumbwidth'] ? $_G['setting']['portalarticleimgthumbwidth'] : 300;
$thumbimgheight = $_G['setting']['portalarticleimgthumbheight'] ? $_G['setting']['portalarticleimgthumbheight'] : 300;
$attach['thumb'] = $image->Thumb($attach['target'], '', $thumbimgwidth, $thumbimgheight, 2);
$image->Watermark($attach['target'], '', 'portal');
}
if(ftpperm($attach['ext'], $attach['size'])) {
if(ftpcmd('upload', 'portal/'.$attach['attachment']) && (!$attach['thumb'] || ftpcmd('upload', 'portal/'.getimgthumbname($attach['attachment'])))) {
@unlink($_G['setting']['attachdir'].'/portal/'.$attach['attachment']);
@unlink($_G['setting']['attachdir'].'/portal/'.getimgthumbname($attach['attachment']));
$attach['remote'] = 1;
} else {
if(getglobal('setting/ftp/mirror')) {
@unlink($attach['target']);
@unlink(getimgthumbname($attach['target']));
$errorcode = 5;
}
}
}
$setarr = array(
'uid' => $_G['uid'],
'filename' => $attach['name'],
'attachment' => $attach['attachment'],
'filesize' => $attach['size'],
'isimage' => $attach['isimage'],
'thumb' => $attach['thumb'],
'remote' => $attach['remote'],
'filetype' => $attach['extension'],
'dateline' => $_G['timestamp'],
'aid' => $aid
);
$setarr['attachid'] = C::t('portal_attachment')->insert($setarr, true);
if($attach['isimage']) {
require_once libfile('function/home');
$smallimg = pic_get($attach['attachment'], 'portal', $attach['thumb'], $attach['remote']);
$bigimg = pic_get($attach['attachment'], 'portal', 0, $attach['remote']);
$coverstr = addslashes(serialize(array('pic'=>'portal/'.$attach['attachment'], 'thumb'=>$attach['thumb'], 'remote'=>$attach['remote'])));
echo "{\"aid\":{$setarr['attachid']}, \"isimage\":{$attach['isimage']}, \"smallimg\":\"$smallimg\", \"bigimg\":\"$bigimg\", \"errorcode\":$errorcode, \"cover\":\"$coverstr\"}";
exit();
} else {
$fileurl = 'portal.php?mod=attachment&id='.$attach['attachid'];
echo "{\"aid\":{$setarr['attachid']}, \"isimage\":{$attach['isimage']}, \"file\":\"$fileurl\", \"errorcode\":$errorcode}";
exit();
}
} else {
echo "{\"aid\":0, \"errorcode\":$errorcode}";
}
}
?>

View File

@@ -0,0 +1,175 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_tag.php 32232 2012-12-03 08:57:08Z zhangjie $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$id = intval($_GET['id']);
$type = trim($_GET['type']);
$name = trim($_GET['name']);
$page = intval($_GET['page']);
if($type == 'countitem') {
$num = 0;
if($id) {
$num = C::t('common_tagitem')->count_by_tagid($id);
}
include_once template('tag/tag');
exit();
}
$taglang = lang('tag/template', 'tag');
if($id || $name) {
$tpp = 20;
$page = max(1, intval($page));
$start_limit = ($page - 1) * $tpp;
if($id) {
$tag = C::t('common_tag')->fetch_info($id);
} else {
if(!preg_match('/^([\x7f-\xff_-]|\w|\s)+$/', $name) || strlen($name) > 20) {
showmessage('parameters_error');
}
$name = addslashes($name);
$tag = C::t('common_tag')->fetch_info(0, $name);
}
if($tag['status'] == 1) {
showmessage('tag_closed');
}
$tagname = $tag['tagname'];
$id = $tag['tagid'];
$searchtagname = $name;
$navtitle = $tagname ? $taglang.' - '.$tagname : $taglang;
$metakeywords = $tagname ? $taglang.' - '.$tagname : $taglang;
$metadescription = $tagname ? $taglang.' - '.$tagname : $taglang;
$showtype = '';
$count = '';
$summarylen = 300;
if($type == 'thread') {
$showtype = 'thread';
$tidarray = $threadlist = array();
$count = C::t('common_tagitem')->select($id, 0, 'tid', '', '', 0, 0, 0, 1);
if($count) {
$query = C::t('common_tagitem')->select($id, 0, 'tid', '', '', $start_limit, $tpp);
foreach($query as $result) {
$tidarray[$result['itemid']] = $result['itemid'];
}
$threadlist = getthreadsbytids($tidarray);
$multipage = multi($count, $tpp, $page, "misc.php?mod=tag&id={$tag['tagid']}&type=thread");
}
} elseif($type == 'blog') {
$showtype = 'blog';
$blogidarray = $bloglist = array();
$count = C::t('common_tagitem')->select($id, 0, 'blogid', '', '', 0, 0, 0, 1);
if($count) {
$query = C::t('common_tagitem')->select($id, 0, 'blogid', '', '', $start_limit, $tpp);
foreach($query as $result) {
$blogidarray[$result['itemid']] = $result['itemid'];
}
$bloglist = getblogbyid($blogidarray);
$multipage = multi($count, $tpp, $page, "misc.php?mod=tag&id={$tag['tagid']}&type=blog");
}
} else {
$shownum = 20;
$tidarray = $threadlist = array();
$query = C::t('common_tagitem')->select($id, 0, 'tid', '', '', $shownum);
foreach($query as $result) {
$tidarray[$result['itemid']] = $result['itemid'];
}
$threadlist = getthreadsbytids($tidarray);
if(helper_access::check_module('blog')) {
$blogidarray = $bloglist = array();
$query = C::t('common_tagitem')->select($id, 0, 'blogid', '', '', $shownum);
foreach($query as $result) {
$blogidarray[$result['itemid']] = $result['itemid'];
}
$bloglist = getblogbyid($blogidarray);
}
}
include_once template('tag/tagitem');
} else {
$navtitle = $metakeywords = $metadescription = $taglang;
$viewthreadtags = 100;
$tagarray = array();
$query = C::t('common_tag')->fetch_all_by_status(0, '', $viewthreadtags, 0, 0, 'DESC');
foreach($query as $result) {
$tagarray[] = $result;
}
include_once template('tag/tag');
}
function getthreadsbytids($tidarray) {
global $_G;
$threadlist = array();
if(!empty($tidarray)) {
loadcache('forums');
include_once libfile('function_misc', 'function');
$fids = array();
foreach(C::t('forum_thread')->fetch_all_by_tid($tidarray) as $result) {
if($result['displayorder'] >= 0){
if(!isset($_G['cache']['forums'][$result['fid']]['name'])) {
$fids[$result['fid']][] = $result['tid'];
} else {
$result['name'] = $_G['cache']['forums'][$result['fid']]['name'];
}
$threadlist[$result['tid']] = procthread($result);
}
}
if(!empty($fids)) {
foreach(C::t('forum_forum')->fetch_all_by_fid(array_keys($fids)) as $fid => $forum) {
foreach($fids[$fid] as $tid) {
$threadlist[$tid]['forumname'] = $forum['name'];
}
}
}
}
return $threadlist;
}
function getblogbyid($blogidarray) {
global $_G, $summarylen;
$bloglist = array();
if(!empty($blogidarray)) {
$data_blog = C::t('home_blog')->fetch_all_blog($blogidarray, 'dateline', 'DESC');
$data_blogfield = C::t('home_blogfield')->fetch_all($blogidarray);
require_once libfile('function/spacecp');
require_once libfile('function/home');
$classarr = array();
foreach($data_blog as $curblogid => $result) {
$result = array_merge($result, (array)$data_blogfield[$curblogid]);
$result['dateline'] = dgmdate($result['dateline']);
$classarr = getclassarr($result['uid']);
$result['classname'] = $classarr[$result['classid']]['classname'];
if($result['friend'] == 4) {
$result['message'] = $result['pic'] = '';
} else {
$result['message'] = getstr($result['message'], $summarylen, 0, 0, 0, -1);
}
$result['message'] = preg_replace("/&[a-z]+\;/i", '', $result['message']);
if($result['pic']) {
$result['pic'] = pic_cover_get($result['pic'], $result['picflag']);
}
$bloglist[] = $result;
}
}
return $bloglist;
}
?>

View File

@@ -0,0 +1,53 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_userstatus.php 32720 2013-03-04 10:21:58Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$output = array();
$output['uid'] = $_G['uid'];
$tablename = '';
if($_GET['type'] === 'topic' && $typeid = intval($_GET['typeid'])) {
$tablename = 'portal_topic';
C::t('portal_topic')->increase($typeid, array('viewnum' => 1));
} elseif($_GET['type'] === 'article' && $typeid = intval($_GET['typeid'])) {
C::t('portal_article_count')->increase($typeid, array('viewnum' => 1));
$tablename = 'portal_article_count';
}
if($tablename) {
$dynamicdata = C::t($tablename)->fetch($typeid);
$output['viewnum'] = $dynamicdata['viewnum'];
$output['commentnum'] = $dynamicdata['commentnum'];
}
if($output['uid']) {
$_G['style']['tplfile'] = 'misc/userstatus';
if(check_diy_perm($topic)){
require template('common/header_diynav');
echo $diynav;
}
$output['diynav'] = str_replace(array("\r", "\n"), '' ,ob_get_contents());
ob_end_clean();
$_G['gzipcompress'] ? ob_start('ob_gzhandler') : ob_start();
require template('common/header_userstatus');
$output['userstatus'] = str_replace(array("\r", "\n"), '' ,ob_get_contents());
ob_end_clean();
$_G['gzipcompress'] ? ob_start('ob_gzhandler') : ob_start();
require template('common/header_qmenu');
$output['qmenu'] = str_replace(array("\r", "\n"), '' ,ob_get_contents());
ob_end_clean();
$_G['gzipcompress'] ? ob_start('ob_gzhandler') : ob_start();
}
header("Content-Type: application/json");
echo helper_json::encode($output);
?>