First commit

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

View File

@@ -0,0 +1,142 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: collection_comment.php 33715 2013-08-07 01:59:25Z andyzheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(empty($_G['uid'])) {
showmessage('login_before_enter_home', null, array(), array('showmsg' => true, 'login' => 1));
}
$oplist = array('add', 'del', 'pop', 'recommend');
if(!in_array($op, $oplist)) {
$op = '';
}
if(empty($op) || $op == 'add') {
$_GET['handlekey'] = 'addComment';
if(!$ctid) {
showmessage('undefined_action', NULL);
}
if(!$_G['group']['allowcommentcollection']) {
showmessage('collection_comment_closed');
}
require_once libfile('function/spacecp');
if(!$_G['collection']['ctid']) {
showmessage('collection_permission_deny');
}
$waittime = interval_check('post');
if($waittime > 0) {
showmessage('operating_too_fast', '', array('waittime' => $waittime), array('return' => true));
}
$memberrate = C::t('forum_collectioncomment')->fetch_rate_by_ctid_uid($_G['collection']['ctid'], $_G['uid']);
if(!trim($_GET['message']) && ((!$memberrate && !$_GET['ratescore']) || $memberrate)) {
showmessage('collection_edit_checkentire');
}
if($_G['setting']['maxpostsize'] && strlen($_GET['message']) > $_G['setting']['maxpostsize']) {
showmessage('post_message_toolong', '', array('maxpostsize' => $_G['setting']['maxpostsize']));
}
$newcomment = array(
'ctid' => $_G['collection']['ctid'],
'uid' => $_G['uid'],
'username' => $_G['username'],
'message' => dhtmlspecialchars(censor($_GET['message'])),
'dateline' => $_G['timestamp'],
'useip' => $_G['clientip'],
'port' => $_G['remoteport']
);
if(!$memberrate) {
$newcomment['rate'] = $_GET['ratescore'];
} else {
$_GET['ratescore'] = 0;
}
C::t('forum_collectioncomment')->insert($newcomment);
C::t('forum_collection')->update_by_ctid($_G['collection']['ctid'], 0, 0, 1, 0, $_GET['ratescore'], $_G['collection']['ratenum']);
if($_G['collection']['uid'] != $_G['uid']) {
notification_add($_G['collection']['uid'], "system", 'collection_becommented', array('from_id'=>$_G['collection']['ctid'], 'from_idtype'=>'collectioncomment', 'ctid'=>$_G['collection']['ctid'], 'collectionname'=>$_G['collection']['name']), 1);
}
C::t('common_member_status')->update($_G['uid'], array('lastpost' => TIMESTAMP), 'UNBUFFERED');
showmessage('collection_comment_succ', $tid ? 'forum.php?mod=viewthread&tid='.$tid : dreferer());
} elseif($op == 'del') {
if(!submitcheck('formhash')) {
showmessage('undefined_action', NULL);
} else {
if(!$_G['collection']['ctid'] || !checkcollectionperm($_G['collection'], $_G['uid']) || empty($_GET['delcomment']) || !is_array($_GET['delcomment']) || count($_GET['delcomment']) == 0) {
showmessage('undefined_action', NULL);
}
$delrows = C::t('forum_collectioncomment')->delete_by_cid_ctid($_GET['delcomment'], $_G['collection']['ctid']);
C::t('forum_collection')->update_by_ctid($_G['collection']['ctid'], 0, 0, -$delrows);
showmessage('collection_comment_remove_succ', 'forum.php?mod=collection&action=view&op=comment&ctid='.$ctid);
}
} elseif($op == 'pop') {
$collectionthread = C::t('forum_collectionthread')->fetch_by_ctid_tid($ctid, $tid);
if(!$collectionthread['ctid']) {
showmessage('collection_permission_deny');
}
$thread = C::t('forum_thread')->fetch_thread($tid);
include template('forum/collection_commentpop');
} elseif($op == 'recommend') {
if(!$_G['collection']['ctid']) {
showmessage('collection_permission_deny');
}
if(!submitcheck('formhash')) {
include template('forum/collection_recommend');
} else {
if(!$_GET['threadurl']) {
showmessage('collection_recommend_url', '', array(), array('alert'=> 'error', 'closetime' => true, 'showdialog' => 1));
}
$touid = &$_G['collection']['uid'];
$coef = 1;
$subject = $message = lang('message', 'collection_recommend_message', array('fromuser' => $_G['username'], 'collectioname' => $_G['collection']['name'], 'url' => $_GET['threadurl']));
if(C::t('home_blacklist')->count_by_uid_buid($touid, $_G['uid'])) {
showmessage('is_blacklist', '', array(), array('return' => true));
}
if(($value = getuserbyuid($touid))) {
require_once libfile('function/friend');
$value['onlyacceptfriendpm'] = $value['onlyacceptfriendpm'] ? $value['onlyacceptfriendpm'] : ($_G['setting']['onlyacceptfriendpm'] ? 1 : 2);
if($_G['group']['allowsendallpm'] || $value['onlyacceptfriendpm'] == 2 || ($value['onlyacceptfriendpm'] == 1 && friend_check($touid))) {
$return = sendpm($touid, $subject, $message, '', 0, 0);
} else {
showmessage('message_can_not_send_onlyfriend', '', array(), array('return' => true));
}
} else {
showmessage('message_bad_touid', '', array(), array('return' => true));
}
if($return > 0) {
include_once libfile('function/stat');
updatestat('sendpm', 0, $coef);
C::t('common_member_status')->update($_G['uid'], array('lastpost' => TIMESTAMP), 'UNBUFFERED');
!($_G['group']['exempt'] & 1) && updatecreditbyaction('sendpm', 0, array(), '', $coef);
showmessage('collection_recommend_succ', '', array(), array('alert'=> 'right', 'closetime' => true, 'showdialog' => 1));
}
}
}
?>

View File

@@ -0,0 +1,412 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: collection_edit.php 33065 2013-04-16 10:06:07Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$titlelimit = 30;
$desclimit = 250;
$reasonlimit = 250;
$oplist = array('add', 'edit', 'remove', 'addthread', 'delthread', 'acceptinvite', 'removeworker', 'invite');
if(!in_array($op, $oplist)) {
$op = '';
}
if(empty($_G['uid'])) {
showmessage('login_before_enter_home', null, array(), array('showmsg' => true, 'login' => 1));
}
if(empty($op) || $op == 'add') {
if(!helper_access::check_module('collection')) {
showmessage('quickclear_noperm');
}
$_GET['handlekey'] = 'createcollection';
$navtitle = lang('core', 'title_collection_create');
$createdcollectionnum = C::t('forum_collection')->count_by_uid($_G['uid']);
$reamincreatenum = $_G['group']['allowcreatecollection']-$createdcollectionnum;
if(!$_G['group']['allowcreatecollection'] || $reamincreatenum <= 0) {
showmessage('collection_create_exceed_limit');
}
if(!$_GET['submitcollection']) {
include template('forum/collection_add');
} else {
if(!submitcheck('collectionsubmit')) {
showmessage('undefined_action', NULL);
}
if(!$_GET['title']) {
showmessage('collection_edit_checkentire');
}
$newCollectionTitle = censor(dhtmlspecialchars($_GET['title']));
$newCollectionTitle = cutstr($newCollectionTitle, $titlelimit, '');
$newcollection = array(
'name' => $newCollectionTitle,
'uid' => $_G['uid'],
'username' => $_G['username'],
'desc' => dhtmlspecialchars(cutstr(censor($_GET['desc']), $desclimit, '')),
'dateline' => $_G['timestamp'],
'lastupdate' => $_G['timestamp'],
'lastvisit' => $_G['timestamp'],
'keyword' => parse_keyword($_GET['keyword'], true)
);
$newctid = C::t('forum_collection')->insert($newcollection, true);
if($newctid) {
showmessage('collection_create_succ', 'forum.php?mod=collection&action=view&ctid='.$newctid, array('ctid'=>$newctid, 'title'=>$newCollectionTitle), array('closetime' => '2', 'showmsg' => ($_GET['inajax'] ? '0' : '1')));
}
}
} elseif($op == 'edit') {
$navtitle = lang('core', 'title_collection_edit');
if(!$ctid) {
showmessage('undefined_action', NULL);
}
if(!$_G['collection']['ctid'] || !checkcollectionperm($_G['collection'], $_G['uid'])) {
showmessage('collection_permission_deny');
}
if(!submitcheck('collectionsubmit')) {
include template('forum/collection_add');
} else {
if(!$_GET['title']) {
showmessage('collection_edit_checkentire');
}
if($_GET['formhash'] != FORMHASH) {
showmessage('undefined_action', NULL);
}
$newCollectionTitle = censor(dhtmlspecialchars($_GET['title']));
$newCollectionTitle = cutstr($newCollectionTitle, 30, '');
$newcollection = array(
'name' => $newCollectionTitle,
'desc' => dhtmlspecialchars(cutstr(censor($_GET['desc']), $desclimit, '')),
'keyword' => parse_keyword($_GET['keyword'], true)
);
C::t('forum_collection')->update($ctid, $newcollection);
if($_GET['title'] != $_G['collection']['name']) {
C::t('forum_collectionteamworker')->update_by_ctid($ctid, $_GET['title']);
}
showmessage('collection_edit_succ', 'forum.php?mod=collection&action=view&ctid='.$ctid);
}
} elseif($op == 'remove') {
if($_GET['formhash'] != FORMHASH) {
showmessage('undefined_action', NULL);
}
if($_G['collection'] && checkcollectionperm($_G['collection'], $_G['uid'])) {
require_once libfile('function/delete');
deletecollection($_G['collection']['ctid']);
showmessage('collection_delete_succ', 'forum.php?mod=collection&op=my');
} else {
showmessage('collection_permission_deny');
}
} elseif($op == 'addthread') {
if((!$_G['forum_thread'] || !$_G['forum']) && !is_array($_GET['tids'])) {
showmessage('thread_nonexistence');
}
if(!is_array($_GET['tids']) && $_G['forum']['disablecollect']) {
showmessage('collection_forum_deny', '', array(), array('showdialog' => 1));
}
if(!submitcheck('addthread')) {
$createdcollectionnum = C::t('forum_collection')->count_by_uid($_G['uid']);
$reamincreatenum = $_G['group']['allowcreatecollection']-$createdcollectionnum;
$collections = getmycollection($_G['uid']);
$tidcollections = array();
if(count($collections) > 0) {
$tidrelated = C::t('forum_collectionrelated')->fetch($tid, true);
$tidcollections = explode("\t", $tidrelated['collection']);
}
$allowcollections = array_diff(array_keys($collections), $tidcollections);
if($reamincreatenum <= 0 && count($allowcollections) <= 0) {
showmessage('collection_none_avail_collection', '', array(), array('showdialog' => 1));
}
include template('forum/collection_select');
} else {
if(!$ctid) {
showmessage('collection_no_selected', '', array(), array('showdialog' => 1));
}
if(!is_array($_GET['tids'])) {
$tid = $_G['tid'];
$thread[$tid] = &$_G['thread'];
}
$collectiondata = C::t('forum_collection')->fetch_all($ctid);
if(!is_array($collectiondata) || count($collectiondata) < 0) {
showmessage('undefined_action', NULL);
} else {
foreach ($collectiondata as $curcollectiondata) {
if(!$curcollectiondata['ctid']) {
showmessage('collection_permission_deny', '', array(), array('showdialog' => 1));
}
if(!checkcollectionperm($curcollectiondata, $_G['uid'], true)) {
showmessage('collection_non_creator', '', array(), array('showdialog' => 1));
}
if(!is_array($_GET['tids'])) {
$checkexistctid[$tid] = C::t('forum_collectionthread')->fetch_by_ctid_tid($curcollectiondata['ctid'], $thread[$tid]['tid']);
if($checkexistctid[$tid]['ctid']) {
showmessage('collection_thread_exists', '', array(), array('showdialog' => 1));
}
$tids[0] = $tid;
$checkexist[$tid] = C::t('forum_collectionrelated')->fetch($tid, true);
} else {
$thread = C::t('forum_thread')->fetch_all($_GET['tids']);
foreach ($thread as $perthread) {
$fids[$perthread['fid']] = $perthread['fid'];
}
$fids = array_keys($fids);
$foruminfo = C::t('forum_forumfield')->fetch_all($fids);
$tids = array_keys($thread);
$checkexistctid = C::t('forum_collectionthread')->fetch_all_by_ctid_tid($curcollectiondata['ctid'], $tids);
$checkexist = C::t('forum_collectionrelated')->fetch_all($tids, true);
}
$addsum = 0;
foreach ($tids as $curtid) {
$thread_fid = $thread[$curtid]['fid'];
if(!$checkexistctid[$curtid]['ctid'] && !$foruminfo[$thread_fid]['disablecollect']) {
$newthread = array(
'ctid' => $curcollectiondata['ctid'],
'tid' => $thread[$curtid]['tid'],
'dateline' => $thread[$curtid]['dateline'],
'reason' => cutstr(censor(dhtmlspecialchars($_GET['reason'])), $reasonlimit, '')
);
C::t('forum_collectionthread')->insert($newthread);
} else {
continue;
}
if(!$checkexist[$curtid]) {
C::t('forum_collectionrelated')->insert(array('tid'=>$curtid, 'collection'=>$curcollectiondata['ctid']."\t"));
$checkexist[$curtid] = 1;
} else {
C::t('forum_collectionrelated')->update_collection_by_ctid_tid($curcollectiondata['ctid'], $curtid);
}
if(!getstatus($thread[$curtid]['status'], 9)) {
C::t('forum_thread')->update_status_by_tid($curtid, '256');
}
if($_G['uid'] != $thread[$curtid]['authorid']) {
notification_add($thread[$curtid]['authorid'], "system", 'collection_becollected', array('from_id'=>$_G['collection']['ctid'], 'from_idtype'=>'collectionthread', 'ctid'=>$_G['collection']['ctid'], 'collectionname'=>$_G['collection']['name'], 'tid'=>$curtid, 'threadname'=>$thread[$curtid]['subject']), 1);
}
$addsum++;
}
if($addsum > 0) {
$lastpost = array(
'lastpost' => $thread[$tids[0]]['tid'],
'lastsubject' => $thread[$tids[0]]['subject'],
'lastposttime' => $thread[$tids[0]]['dateline'],
'lastposter' => $thread[$tids[0]]['author']
);
C::t('forum_collection')->update_by_ctid($curcollectiondata['ctid'], $addsum, 0, 0, $_G['timestamp'], 0, 0, $lastpost);
}
}
}
showmessage('collection_collect_succ', dreferer(), array(), array('alert'=> 'right', 'closetime' => true, 'locationtime' => true, 'showdialog' => 1));
}
} elseif($op == 'delthread') {
if($_GET['formhash'] != FORMHASH) {
showmessage('undefined_action', NULL);
}
if(!$ctid || empty($_GET['delthread']) || !is_array($_GET['delthread']) || count($_GET['delthread']) == 0) {
showmessage('collection_no_thread');
}
if(!$_G['collection']['ctid'] || !checkcollectionperm($_G['collection'], $_G['uid'])) {
showmessage('collection_permission_deny');
}
require_once libfile('function/delete');
deleterelatedtid($_GET['delthread'], $_G['collection']['ctid']);
$decthread = C::t('forum_collectionthread')->delete_by_ctid_tid($ctid, $_GET['delthread']);
$lastpost = null;
if(in_array($_G['collection']['lastpost'], $_GET['delthread']) && ($_G['collection']['threadnum'] - $decthread) > 0) {
$collection_thread = C::t('forum_collectionthread')->fetch_by_ctid_dateline($ctid);
if($collection_thread) {
$thread = C::t('forum_thread')->fetch_thread($collection_thread['tid']);
$lastpost = array(
'lastpost' => $thread['tid'],
'lastsubject' => $thread['subject'],
'lastposttime' => $thread['dateline'],
'lastposter' => $thread['authorid']
);
}
}
C::t('forum_collection')->update_by_ctid($ctid, -$decthread, 0, 0, 0, 0, 0, $lastpost);
showmessage('collection_remove_thread', 'forum.php?mod=collection&action=view&ctid='.$ctid);
} elseif($op == 'invite') {
if(!$ctid) {
showmessage('undefined_action', NULL);
}
if(!$_G['collection']['ctid'] || !checkcollectionperm($_G['collection'], $_G['uid'])) {
showmessage('collection_permission_deny');
}
$collectionteamworker = C::t('forum_collectionteamworker')->fetch_all_by_ctid($ctid);
$submitworkers = (!empty($_GET['users']) && is_array($_GET['users'])) ? count($_GET['users']) : 0;
if((count($collectionteamworker) + $submitworkers) >= $maxteamworkers) {
showmessage('collection_teamworkers_exceed');
}
require_once libfile('function/friend');
if($_GET['username'] && !$_GET['users']) {
$_GET['users'][] = $_GET['username'];
}
if(!$_GET['users']) {
if($_POST['formhash']) {
showmessage('collection_teamworkers_noselect', NULL);
}
$friends = array();
if($space['friendnum']) {
$query = C::t('home_friend')->fetch_all_by_uid($_G['uid'], 0, 100, true);
foreach($query as $value) {
$value['uid'] = $value['fuid'];
$value['username'] = daddslashes($value['fusername']);
$friends[] = $value;
}
}
$friendgrouplist = friend_group_list();
include template('forum/collection_invite');
} else {
$invitememberuids = array();
if(is_array($_GET['users'])) {
$invitememberuids = C::t('common_member')->fetch_all_uid_by_username($_GET['users']);
}
if(!$invitememberuids) {
showmessage('collection_no_teamworkers');
}
if(!friend_check($invitememberuids) || in_array($_G['uid'], $invitememberuids)) {
showmessage('collection_non_friend');
}
$collectionteamworker = array_keys($collectionteamworker);
if(in_array($invitememberuids, $collectionteamworker)) {
showmessage('collection_teamworkers_exists');
}
foreach($invitememberuids as $invitememberuid) {
$data = array('ctid'=>$ctid,'uid'=>$invitememberuid,'dateline'=>$_G['timestamp']);
C::t('forum_collectioninvite')->insert($data, false, true);
notification_add($invitememberuid, "system", 'invite_collection', array('ctid'=>$_G['collection']['ctid'], 'collectionname'=>$_G['collection']['name'], 'dateline'=>$_G['timestamp']), 1);
}
showmessage('collection_invite_succ', 'forum.php?mod=collection&action=view&ctid='.$ctid, array(), array('alert'=> 'right', 'closetime' => true, 'showdialog' => 1));
}
} elseif($op == 'acceptinvite') {
if(!submitcheck('ctid', 1)) {
showmessage('undefined_action', NULL);
} else {
$collectioninvite = C::t('forum_collectioninvite')->fetch_by_ctid_uid($ctid, $_G['uid']);
if(!$collectioninvite['ctid'] || $_GET['dateline'] != $collectioninvite['dateline']) {
showmessage('undefined_action', NULL);
}
$teamworkernum = C::t('forum_collectionteamworker')->count_by_ctid($ctid);
if($teamworkernum >= $maxteamworkers) {
showmessage('collection_teamworkers_exceed');
}
C::t('forum_collectioninvite')->delete_by_ctid_uid($ctid, $_G['uid']);
$newworker = array(
'ctid'=>$ctid,
'uid'=>$_G['uid'],
'name'=>$_G['collection']['name'],
'username'=>$_G['username'],
'lastvisit' => $_G['timestamp']
);
C::t('forum_collectionteamworker')->insert($newworker, false, true);
showmessage('collection_invite_accept', 'forum.php?mod=collection&action=view&ctid='.$ctid);
}
} elseif($op == 'removeworker') {
if(!submitcheck('ctid', 1)) {
showmessage('undefined_action', NULL);
} else {
if($_GET['formhash'] != FORMHASH) {
showmessage('undefined_action', NULL);
}
if(!$_G['collection']['ctid']) {
showmessage('collection_permission_deny');
}
if($_GET['uid'] != $_G['uid']) {
if($_G['collection']['uid'] != $_G['uid']) {
showmessage('collection_remove_deny');
}
$removeuid = $_GET['uid'];
} else {
$removeuid = $_G['uid'];
}
$collectionteamworker = array_keys(C::t('forum_collectionteamworker')->fetch_all_by_ctid($ctid));
if(!in_array($removeuid, $collectionteamworker)) {
showmessage('collection_teamworkers_nonexists');
}
C::t('forum_collectionteamworker')->delete_by_ctid_uid($ctid, $removeuid);
notification_add($removeuid, "system", 'exit_collection', array('ctid'=>$_G['collection']['ctid'], 'collectionname'=>$_G['collection']['name']), 1);
if($_GET['inajax']) {
showmessage('', dreferer(), array(), array('msgtype' => 3, 'showmsg' => 1));
} else {
showmessage('collection_teamworkers_exit_succ', 'forum.php?mod=collection&action=view&ctid='.$ctid);
}
}
}
?>

View File

@@ -0,0 +1,59 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: collection_follow.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(!$op || !$ctid || $_GET['formhash'] != FORMHASH) {
showmessage('undefined_action', NULL);
}
if(!$_G['collection']['ctid'] || $_G['collection']['uid'] == $_G['uid']) {
showmessage('collection_permission_deny');
}
$_GET['handlekey'] = 'followcollection';
if($op == 'follow') {
$follownum = C::t('forum_collectionfollow')->count_by_uid($_G['uid']);
if($follownum >= $_G['group']['allowfollowcollection']) {
showmessage('collection_follow_limited', '', array('limit' => $_G['group']['allowfollowcollection']), array('closetime' => '2', 'showmsg' => '1'));
}
$collectionfollow = C::t('forum_collectionfollow')->fetch_by_ctid_uid($ctid, $_G['uid']);
if(!$collectionfollow['ctid']) {
$data = array(
'uid' => $_G['uid'],
'username' => $_G['username'],
'ctid' => $ctid,
'dateline' => $_G['timestamp'],
'lastvisit' => $_G['timestamp']
);
C::t('forum_collectionfollow')->insert($data);
C::t('forum_collection')->update_by_ctid($ctid, 0, 1, 0);
if($_G['collection']['uid'] != $_G['uid']) {
updatecreditbyaction('followedcollection', $_G['collection']['uid']);
notification_add($_G['collection']['uid'], "system", 'collection_befollowed', array('from_id'=>$_G['collection']['ctid'], 'from_idtype'=>'collectionfollow', 'ctid'=>$_G['collection']['ctid'], 'collectionname'=>$_G['collection']['name']), 1);
}
showmessage('collection_follow_succ', dreferer(), array('status'=>1), array('closetime' => '2', 'showmsg' => '1'));
}
} elseif($op == 'unfo') {
$collectionfollow = C::t('forum_collectionfollow')->fetch_by_ctid_uid($ctid, $_G['uid']);
if($collectionfollow['ctid']) {
C::t('forum_collectionfollow')->delete_by_ctid_uid($ctid, $_G['uid']);
C::t('forum_collection')->update_by_ctid($ctid, 0, -1, 0);
showmessage('collection_unfollow_succ', dreferer(), array('status'=>2), array('closetime' => '2', 'showmsg' => '1'));
}
}
?>

View File

@@ -0,0 +1,104 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: collection_index.php 33200 2013-05-06 12:27:49Z laoguozhang $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$navtitle = lang('core', 'title_collection');
$searchtitle = '';
$oplist = array('all', 'my', 'search');
if(!in_array($op, $oplist)) {
$op = '';
}
$cpp = 20;
$start = ($page-1)*$cpp;
if($op == 'all' || $op == 'search') {
if($op == 'search' && $_GET['kw']) {
dheader('Location: search.php?mod=collection&searchsubmit=yes&srchtxt='.urlencode($_GET['kw']));
exit;
} else {
$orderbyarr = array('follownum', 'threadnum', 'commentnum', 'dateline');
$count = C::t('forum_collection')->count();
}
$orderby = (in_array($_GET['order'], $orderbyarr)) ? $_GET['order'] : 'dateline';
$collectiondata = processCollectionData(C::t('forum_collection')->fetch_all('', $orderby, 'DESC', $start, $cpp, $searchtitle), array(), $orderby);
$htmlsearchtitle = dhtmlspecialchars($searchtitle);
$multipage = multi($count, $cpp, $page, 'forum.php?mod=collection&order='.$orderby.'&op='.$op.(($htmlsearchtitle) ? '&kw='.$htmlsearchtitle : ''));
include template('forum/collection_all');
} elseif ($op == 'my') {
$mycollection = C::t('forum_collection')->fetch_all_by_uid($_G['uid']);
$myctid = array_keys($mycollection);
$teamworker = C::t('forum_collectionteamworker')->fetch_all_by_uid($_G['uid']);
$twctid = array_keys($teamworker);
$follow = C::t('forum_collectionfollow')->fetch_all_by_uid($_G['uid']);
if(empty($follow)) {
$follow = array();
}
$followctid = array_keys($follow);
if(!$myctid) {
$myctid = array();
}
if(!$twctid) {
$twctid = array();
}
if(!$followctid) {
$followctid = array();
}
$ctidlist = array_merge($myctid, $twctid, $followctid);
if(count($ctidlist) > 0) {
$tfcollection = $mycollection + $teamworker + $follow;
$collectiondata = C::t('forum_collection')->fetch_all($ctidlist, 'dateline', 'DESC');
$collectiondata = processCollectionData($collectiondata, $tfcollection);
}
include template('forum/collection_mycollection');
} else {
if(!$tid) {
$collectiondata = array();
loadcache('collection');
if(TIMESTAMP - $_G['cache']['collection']['dateline'] > 300) {
$collection = getHotCollection(500, false);
$collectioncache = array('dateline' => TIMESTAMP, 'data' => $collection);
savecache('collection', $collectioncache);
} else {
$collection = &$_G['cache']['collection']['data'];
}
$count = count($collection);
for($i = $start; $i < $start+$cpp; $i++) {
if(!$collection[$i]) {
continue;
}
$collectiondata[] = $collection[$i];
}
unset($collection);
$collectiondata = processCollectionData($collectiondata);
} else {
$tidrelate = C::t('forum_collectionrelated')->fetch($tid);
$ctids = explode("\t", $tidrelate['collection'], -1);
$count = count($ctids);
$collectiondata = C::t('forum_collection')->fetch_all($ctids, 'follownum', 'DESC', $start, $cpp);
$collectiondata = processCollectionData($collectiondata);
}
$multipage = multi($count, $cpp, $page, 'forum.php?mod=collection'.($tid ? '&tid='.$tid : ''));
include template('forum/collection_index');
}
?>

View File

@@ -0,0 +1,125 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: collection_view.php 33065 2013-04-16 10:06:07Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$oplist = array('comment', 'followers', 'related');
if(!in_array($op, $oplist)) {
$op = '';
}
$fromoplist = array('my', 'all');
$fromop = (!in_array($_GET['fromop'], $fromoplist)) ? '' : $_GET['fromop'];
$fromtid = dintval($_GET['fromtid']);
$tids = $fids = array();
if(!$_G['collection']['ctid']) {
showmessage('collection_permission_deny');
}
$navtitle = $_G['collection']['name'].' - '.lang('core', 'title_collection');
$permission = checkcollectionperm($_G['collection'], $_G['uid']);
$avgrate = number_format($_G['collection']['rate'], 1);
$start = ($page-1)*$tpp;
$collectionfollowdata = C::t('forum_collectionfollow')->fetch_by_ctid_uid($ctid, $_G['uid']);
$collectionteamworker = C::t('forum_collectionteamworker')->fetch_all_by_ctid($_G['collection']['ctid']);
$_G['collection']['arraykeyword'] = parse_keyword($_G['collection']['keyword'], false, false);
if($_G['collection']['arraykeyword']) {
foreach ($_G['collection']['arraykeyword'] as $kid=>$s_keyword) {
$metakeywords .= ($metakeywords ? ',' : '').$s_keyword;
$_G['collection']['urlkeyword'][$kid] = rawurlencode($s_keyword);
}
}
$metadescription = $_G['collection']['name'];
if($_G['collection']['ratenum']) {
$star = imgdisplayrate($avgrate);
}
if(!$op || $op == 'related') {
$isteamworkers = in_array($_G['uid'], array_keys($collectionteamworker));
$search_status = FALSE;
require_once libfile('function/friend');
$friendgrouplist = friend_group_list();
if(!$op && $op != 'related') {
if($_G['collection']['uid'] == $_G['uid']) {
$lastvisit = $_G['collection']['lastvisit'];
if($_G['collection']['lastupdate'] >= $lastvisit) {
C::t('forum_collection')->update($ctid, array('lastvisit' => TIMESTAMP), true, true);
}
} elseif($isteamworkers) {
$lastvisit = $collectionteamworker[$_G['uid']]['lastvisit'];
if($_G['collection']['lastupdate'] >= $lastvisit) {
C::t('forum_collectionteamworker')->update_teamworker($ctid, $_G['uid'], array('lastvisit' => TIMESTAMP), true, true);
}
} elseif($collectionfollowdata['ctid']) {
$lastvisit = $collectionfollowdata['lastvisit'];
if($_G['collection']['lastupdate'] >= $lastvisit) {
C::t('forum_collectionfollow')->update_collectionfollow($ctid, $_G['uid'], array('lastvisit' => TIMESTAMP), true, true);
}
} else {
$lastvisit = null;
}
$collectiontids = C::t('forum_collectionthread')->fetch_all_by_ctid($_G['collection']['ctid'], $start, $tpp);
$tids = array_keys($collectiontids);
$threadlist = C::t('forum_thread')->fetch_all_by_tid($tids);
collectionThread($threadlist, false, $lastvisit, $collectiontids);
$multipage = multi($_G['collection']['threadnum'], $tpp, $page, "forum.php?mod=collection&action=view&ctid={$_G['collection']['ctid']}");
$userCollections = C::t('forum_collection')->fetch_all_by_uid($_G['collection']['uid'], 0, 5, $_G['collection']['ctid']);
}
if($_G['collection']['commentnum'] > 0) {
$commentlist = C::t('forum_collectioncomment')->fetch_all_by_ctid($_G['collection']['ctid'], 0, 5);
foreach($commentlist as &$curvalue) {
$curvalue['dateline'] = dgmdate($curvalue['dateline'], 'u', '9999', getglobal('setting/dateformat'));
$curvalue['message'] = cutstr($curvalue['message'], 150);
$curvalue['rateimg'] = imgdisplayrate($curvalue['rate']);
}
$memberrate = C::t('forum_collectioncomment')->fetch_rate_by_ctid_uid($_G['collection']['ctid'], $_G['uid']);
}
$followers = C::t('forum_collectionfollow')->fetch_all_collectionfollow($ctid, true, 0, 6);
include template('forum/collection_view');
} elseif($op == 'comment') {
$navtitle = lang('core', 'title_collection_comment_list').' - '.$navtitle;
if($_G['collection']['commentnum'] > 0) {
$start = ($page-1)*$_G['setting']['postperpage'];
$commentlist = C::t('forum_collectioncomment')->fetch_all_by_ctid($_G['collection']['ctid'], $start, $_G['setting']['postperpage']);
foreach($commentlist as &$curvalue) {
$curvalue['dateline'] = dgmdate($curvalue['dateline'], 'u', '9999', getglobal('setting/dateformat'));
$curvalue['rateimg'] = imgdisplayrate($curvalue['rate']);
}
$multipage = multi($_G['collection']['commentnum'], $_G['setting']['postperpage'], $page, "forum.php?mod=collection&action=view&op=comment&ctid={$_G['collection']['ctid']}");
$memberrate = C::t('forum_collectioncomment')->fetch_rate_by_ctid_uid($_G['collection']['ctid'], $_G['uid']);
}
include template('forum/collection_comment');
} elseif($op == 'followers') {
$navtitle = lang('core', 'title_collection_followers_list').' - '.$navtitle;
$cmemberperpage = 28;
$start = ($page-1)*$cmemberperpage;
$followers = C::t('forum_collectionfollow')->fetch_all_collectionfollow($ctid, true, $start, $cmemberperpage);
$multipage = multi($_G['collection']['follownum'], $cmemberperpage, $page, "forum.php?mod=collection&action=view&op=followers&ctid={$_G['collection']['ctid']}");
include template('forum/collection_followers');
}
?>

View File

View File

@@ -0,0 +1,22 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_announcement_daily.php 25786 2011-11-22 06:17:25Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$delnum = C::t('forum_announcement')->delete_all_by_endtime($_G['timestamp']);
if($delnum) {
require_once libfile('function/cache');
updatecache(array('announcements', 'announcements_forum'));
}
?>

View File

@@ -0,0 +1,21 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_cleanfeed.php 29135 2012-03-27 08:25:02Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if($_G['setting']['feedday'] < 3) $_G['setting']['feedday'] = 3;
$deltime = $_G['timestamp'] - $_G['setting']['feedday']*3600*24;
$f_deltime = $_G['timestamp'] - $_G['setting']['feedday']*3600*24;
C::t('home_feed')->delete_by_dateline($deltime);
C::t('home_feed')->optimize_table();
?>

View File

@@ -0,0 +1,22 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_cleannotification.php 24556 2011-09-26 06:16:03Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
C::t('home_notification')->delete_clear(0, 2);
C::t('home_notification')->delete_clear(1, 30);
$deltime = $_G['timestamp'] - 7*3600*24;
C::t('home_pokearchive')->delete_by_dateline($deltime);
C::t('home_notification')->optimize();
?>

View File

@@ -0,0 +1,21 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_cleantrace.php 24958 2011-10-19 02:54:32Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$maxday = 90;
$deltime = $_G['timestamp'] - $maxday*3600*24;
C::t('home_clickuser')->delete_by_dateline($deltime);
C::t('home_visitor')->delete_by_dateline($deltime);
?>

View File

@@ -0,0 +1,146 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_cleanup_daily.php 33675 2013-08-01 02:09:09Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('function/cache');
updatecache('forumrecommend');
if(C::t('common_advertisement')->close_endtime()) {
updatecache(array('setting', 'advs'));
}
C::t('forum_threaddisablepos')->truncate();
C::t('common_searchindex')->truncate();
C::t('forum_threadmod')->delete_by_dateline($_G['timestamp']-31536000);
C::t('forum_forumrecommend')->delete_old();
C::t('home_visitor')->delete_by_dateline($_G['timestamp']-7776000);
C::t('forum_postcache')->delete_by_dateline(TIMESTAMP-86400);
C::t('forum_newthread')->delete_by_dateline(TIMESTAMP-1296000);
C::t('common_seccheck')->truncate();
if($_G['setting']['heatthread']['type'] == 2 && $_G['setting']['heatthread']['period']) {
$partakeperoid = 86400 * $_G['setting']['heatthread']['period'];
C::t('forum_threadpartake')->delete_threadpartake($_G['timestamp'] - $partakeperoid);
}
C::t('common_member_count')->clear_today_data();
C::t('forum_trade')->update_closed($_G['timestamp']);
C::t('forum_tradelog')->clear_failure(7);
C::t('forum_tradelog')->expiration_payed(7);
C::t('forum_tradelog')->expiration_finished(7);
if($_G['setting']['cachethreadon']) {
removedir($_G['setting']['cachethreaddir'], TRUE);
touch($_G['setting']['cachethreaddir'].'/index.htm');
}
removedir($_G['setting']['attachdir'].'image', TRUE);
@touch($_G['setting']['attachdir'].'image/index.htm');
C::t('forum_attachment_unused')->clear();
C::t('forum_polloption_image')->clear();
$uids = $members = array();
$members = C::t('common_member')->fetch_all_ban_by_groupexpiry(TIMESTAMP);
if(($uids = array_keys($members))) {
$setarr = array();
foreach(C::t('common_member_field_forum')->fetch_all($uids) as $uid => $member) {
$member['groupterms'] = dunserialize($member['groupterms']);
$member['groupid'] = $members[$uid]['groupid'];
$member['credits'] = $members[$uid]['credits'];
if(!empty($member['groupterms']['main']['groupid'])) {
$groupidnew = $member['groupterms']['main']['groupid'];
$adminidnew = $member['groupterms']['main']['adminid'];
unset($member['groupterms']['main']);
unset($member['groupterms']['ext'][$member['groupid']]);
$setarr['groupexpiry'] = groupexpiry($member['groupterms']);
} else {
$query = C::t('common_usergroup')->fetch_by_credits($member['credits'], 'member');
$groupidnew = $query['groupid'];
$adminidnew = 0;
}
$setarr['adminid'] = $adminidnew;
$setarr['groupid'] = $groupidnew;
C::t('common_member')->update($uid, $setarr);
C::t('common_member_field_forum')->update($uid, array('groupterms' => ($member['groupterms'] ? serialize($member['groupterms']) : '')));
}
}
if(!empty($_G['setting']['advexpiration']['allow'])) {
$endtimenotice = mktime(0, 0, 0, date('m', TIMESTAMP), date('d', TIMESTAMP), date('Y', TIMESTAMP)) + $_G['setting']['advexpiration']['day'] * 86400;
$advs = array();
foreach(C::t('common_advertisement')->fetch_all_endtime($endtimenotice) as $adv) {
$advs[] = '<a href="admin.php?action=adv&operation=edit&advid='.$adv['advid'].'" target="_blank">'.$adv['title'].'</a>';
}
if($advs) {
$users = explode("\n", $_G['setting']['advexpiration']['users']);
$users = array_map('trim', $users);
if($users) {
foreach(C::t('common_member')->fetch_all_by_username($users) as $member) {
$noticelang = array('day' => $_G['setting']['advexpiration']['day'], 'advs' => implode("<br />", $advs), 'from_id' => 0, 'from_idtype' => 'advexpire');
if(in_array('notice', $_G['setting']['advexpiration']['method'])) {
notification_add($member['uid'], 'system', 'system_adv_expiration', $noticelang, 1);
}
if(in_array('mail', $_G['setting']['advexpiration']['method'])) {
$advexpvar = array(
'tpl' => 'adv_expiration',
'var' => $noticelang,
'svar' => $noticelang,
);
if(!sendmail("{$member['username']} <{$member['email']}>", $advexpvar)) {
runlog('sendmail', "{$member['email']} sendmail failed.");
}
}
}
}
}
}
$count = C::t('common_card')->count_by_where("status = '1' AND cleardateline <= '{$_G['timestamp']}'");
if($count) {
C::t('common_card')->update_to_overdue($_G['timestamp']);
$card_info = serialize(array('num' => $count));
$cardlog = array(
'info' => $card_info,
'dateline' => $_G['timestamp'],
'operation' => 9
);
C::t('common_card_log')->insert($cardlog);
}
C::t('common_member_action_log')->delete_by_dateline($_G['timestamp'] - 86400);
C::t('forum_collectioninvite')->delete_by_dateline($_G['timestamp'] - 86400*7);
loadcache('seccodedata', true);
$_G['cache']['seccodedata']['register']['show'] = 0;
savecache('seccodedata', $_G['cache']['seccodedata']);
function removedir($dirname, $keepdir = FALSE) {
$dirname = str_replace(array( "\n", "\r", '..'), array('', '', ''), $dirname);
if(!is_dir($dirname)) {
return FALSE;
}
$handle = opendir($dirname);
while(($file = readdir($handle)) !== FALSE) {
if($file != '.' && $file != '..') {
$dir = $dirname . DIRECTORY_SEPARATOR . $file;
is_dir($dir) ? removedir($dir) : unlink($dir);
}
}
closedir($handle);
return !$keepdir ? (@rmdir($dirname) ? TRUE : FALSE) : TRUE;
}
?>

View File

@@ -0,0 +1,17 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_cleanup_monthly.php 26922 2011-12-27 10:00:36Z svn_project_zhangjie $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
C::t('common_mytask')->delete_exceed(2592000);
?>

View File

@@ -0,0 +1,20 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_follow_daily.php 25889 2011-11-24 09:52:20Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$removetime = TIMESTAMP - $_G['setting']['followretainday'] * 86400;
foreach(C::t('home_follow_feed')->fetch_all_by_dateline($removetime, '<=') as $feed) {
C::t('home_follow_feed')->insert_archiver($feed);
C::t('home_follow_feed')->delete($feed['feedid']);
}
?>

View File

@@ -0,0 +1,41 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_magic_daily.php 24589 2011-09-27 07:45:55Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(!empty($_G['setting']['magicstatus'])) {
$magicarray = array();
foreach(C::t('common_magic')->fetch_all_data(1) as $magic) {
if($magic['supplytype'] && $magic['supplynum']) {
$magicarray[$magic['magicid']]['supplytype'] = $magic['supplytype'];
$magicarray[$magic['magicid']]['supplynum'] = $magic['supplynum'];
}
}
list($daynow, $weekdaynow) = explode('-', dgmdate(TIMESTAMP, 'd-w', $_G['setting']['timeoffset']));
foreach($magicarray as $id => $magic) {
$autosupply = 0;
if($magic['supplytype'] == 1) {
$autosupply = 1;
} elseif($magic['supplytype'] == 2 && $weekdaynow == 1) {
$autosupply = 1;
} elseif($magic['supplytype'] == 3 && $daynow == 1) {
$autosupply = 1;
}
if(!empty($autosupply)) {
C::t('common_magic')->update($id, array('num' => $magic['supplynum']));
}
}
}
?>

View File

@@ -0,0 +1,42 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_medal_daily.php 24698 2011-10-08 08:36:47Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$medalnewarray = $medalsnew = $uids = array();
foreach(C::t('forum_medallog')->fetch_all_by_expiration(TIMESTAMP) as $medalnew) {
$uids[] = $medalnew['uid'];
$medalnews[] = $medalnew;
}
$membermedals = array();
foreach(C::t('common_member_field_forum')->fetch_all($uids) as $member) {
$membermedals[$member['uid']] = $member['medals'];
}
foreach($medalnews as $medalnew) {
$medalnew['medals'] = empty($medalnewarray[$medalnew['uid']]) ? explode("\t", $membermedals[$medalnew['uid']]) : explode("\t", $medalnewarray[$medalnew['uid']]);
foreach($medalnew['medals'] as $key => $medalnewid) {
list($medalid, $medalexpiration) = explode("|", $medalnewid);
if($medalnew['medalid'] == $medalid) {
unset($medalnew['medals'][$key]);
}
}
$medalnewarray[$medalnew['uid']] = implode("\t", $medalnew['medals']);
C::t('forum_medallog')->update($medalnew['id'], array('status' => 0));
C::t('common_member_field_forum')->update($medalnew['uid'], array('medals' => $medalnewarray[$medalnew['uid']]), 'UNBUFFERED');
C::t('common_member_medal')->delete_by_uid_medalid($medalnew['uid'], $medalnew['medalid']);
}
?>

View File

@@ -0,0 +1,18 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_member_optimize_daily.php 28623 2012-03-06 09:01:58Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(getglobal('setting/membersplit')) {
C::t('common_member')->split(100);
}
?>

View File

@@ -0,0 +1,16 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_onlinetime_monthly.php 24402 2011-09-16 12:18:32Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
C::t('common_onlinetime')->update_thismonth();
?>

View File

@@ -0,0 +1,17 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_promotion_hourly.php 24377 2011-09-15 11:02:12Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
C::t('forum_promotion')->delete_all();
?>

View File

@@ -0,0 +1,52 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_publish_halfhourly.php 31463 2012-08-30 08:59:17Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('function/forum');
require_once libfile('function/post');
loadcache('cronpublish');
$dataChanged = false;
$cron_publish_ids = array();
$cron_publish_ids = getglobal('cache/cronpublish');
if (is_array($cron_publish_ids) && count($cron_publish_ids) > 0) {
$threadall = C::t('forum_thread')->fetch_all_by_tid($cron_publish_ids);
foreach ($cron_publish_ids as $tid) {
if(!$threadall[$tid]) {
unset($cron_publish_ids[$tid]);
$dataChanged = true;
}
}
foreach ($threadall as $stid=>$sdata) {
if ($sdata['dateline'] <= getglobal('timestamp')) {
threadpubsave($stid, true);
unset($cron_publish_ids[$stid]);
$dataChanged = true;
}
}
if ($dataChanged === true) {
savecache('cronpublish', $cron_publish_ids);
}
}
if (!is_array($cron_publish_ids)) {
$cron_publish_try = dunserialize($cron_publish_ids);
if (!is_array($cron_publish_try)) {
$cron_publish_try = array();
}
savecache('cronpublish', $cron_publish_try);
}
?>

View File

@@ -0,0 +1,19 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_secqaa_daily.php 6752 2010-03-25 08:47:54Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if($_G['setting']['secqaa']['status'] > 0) {
require_once libfile('function/cache');
updatecache('secqaa');
}
?>

View File

@@ -0,0 +1,22 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_security_daily.php 29568 2012-04-19 03:39:25Z songlixin $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$queryf = C::t('forum_forum')->fetch_all_fids();
foreach($queryf as $forum) {
$thread = C::t('forum_thread')->fetch_by_fid_displayorder($forum['fid']);
$thread['shortsubject'] = cutstr($thread['subject'], 80);
$lastpost = "{$thread['tid']}\t{$thread['shortsubject']}\t{$thread['lastpost']}\t{$thread['lastposter']}";
C::t('forum_forum')->update($forum['fid'], array('lastpost' => $lastpost));
}
?>

View File

@@ -0,0 +1,18 @@
<?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');
}
$removetime = TIMESTAMP - $_G['setting']['smstimelimit'] + 86400;
foreach(C::t('common_smslog')->fetch_all_by_dateline($removetime, '<=') as $smslog) {
C::t('common_smslog')->insert_archiver($smslog);
C::t('common_smslog')->delete($smslog['smslogid']);
}

View File

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

View File

@@ -0,0 +1,86 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_threadexpiry_hourly.php 33625 2013-07-19 06:03:49Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
C::t('common_seccheck')->delete_expiration();
$actionarray = array();
foreach(C::t('forum_threadmod')->fetch_all_by_expiration_status($_G['timestamp']) as $expiry) {
switch($expiry['action']) {
case 'EST': $actionarray['UES'][] = $expiry['tid']; break;
case 'EHL': $actionarray['UEH'][] = $expiry['tid']; break;
case 'ECL': $actionarray['UEC'][] = $expiry['tid']; break;
case 'EOP': $actionarray['UEO'][] = $expiry['tid']; break;
case 'EDI': $actionarray['UED'][] = $expiry['tid']; break;
case 'TOK': $actionarray['UES'][] = $expiry['tid']; break;
case 'CCK': $actionarray['UEH'][] = $expiry['tid']; break;
case 'CLK': $actionarray['UEC'][] = $expiry['tid']; break;
case 'SPA': $actionarray['SPD'][] = $expiry['tid']; break;
}
}
if($actionarray) {
foreach($actionarray as $action => $tids) {
switch($action) {
case 'UES':
C::t('forum_thread')->update($actionarray[$action], array('displayorder'=>0), true);
C::t('forum_threadmod')->update_by_tid_action($tids, array('EST', 'TOK'), array('status'=>0));
require_once libfile('function/cache');
updatecache('globalstick');
break;
case 'UEH':
C::t('forum_thread')->update($actionarray[$action], array('highlight'=>0), true);
C::t('forum_threadmod')->update_by_tid_action($tids, array('EHL', 'CCK'), array('status'=>0));
break;
case 'UEC':
case 'UEO':
$closed = $action == 'UEO' ? 1 : 0;
C::t('forum_thread')->update($actionarray[$action], array('closed'=>$closed), true);
C::t('forum_threadmod')->update_by_tid_action($tids, array('EOP', 'ECL', 'CLK'), array('status'=>0));
break;
case 'UED':
C::t('forum_threadmod')->update_by_tid_action($tids, array('EDI'), array('status'=>0));
$digestarray = $authoridarry = array();
foreach(C::t('forum_thread')->fetch_all_by_tid($actionarray[$action]) as $digest) {
$authoridarry[] = $digest['authorid'];
$digestarray[$digest['digest']][] = $digest['authorid'];
}
foreach($digestarray as $digest => $authorids) {
batchupdatecredit('digest', $authorids, array("digestposts=digestposts+'-1'"), -$digest, $fid = 0);
}
C::t('forum_thread')->update($actionarray[$action], array('digest'=>0), true);
break;
case 'SPD':
C::t('forum_thread')->update($actionarray[$action], array('stamp'=>-1), true);
C::t('forum_threadmod')->update_by_tid_action($tids, array('SPA'), array('status'=>0));
break;
}
}
require_once libfile('function/post');
foreach($actionarray as $action => $tids) {
updatemodlog(implode(',', $tids), $action, 0, 1);
}
}
?>

View File

@@ -0,0 +1,50 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_todayheats_daily.php 31913 2012-10-24 06:52:26Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$yesterday = strtotime(dgmdate(TIMESTAMP, 'Y-m-d'))-86400;
$data = $tids = $fids = $hotnum = array();
$daystr = dgmdate($yesterday, 'Ymd');
foreach(C::t('forum_thread')->fetch_all_for_guide('hot', 0, array(), $_G['setting']['heatthread']['guidelimit'], $yesterday, 0, 0) as $thread) {
$data[$thread['tid']] = array(
'cid' => 0,
'fid' => $thread['fid'],
'tid' => $thread['tid']
);
$fids[$thread['fid']] = array('fid' => $thread['fid'], 'dateline' => $daystr, 'hotnum' => 0);
$tids[$thread['fid']][$thread['tid']] = $thread['tid'];
}
if($data) {
$cids = C::t('forum_threadcalendar')->fetch_all_by_fid_dateline(array_keys($fids), $daystr);
foreach($cids as $fid => $cinfo) {
$hotnum[$cinfo['cid']] = count($tids[$fid]);
foreach($tids[$fid] as $tid) {
$data[$tid]['cid'] = $cinfo['cid'];
}
unset($fids[$fid]);
}
if($fids) {
C::t('forum_threadcalendar')->insert_multiterm($fids);
foreach(C::t('forum_threadcalendar')->fetch_all_by_fid_dateline(array_keys($fids), $daystr) as $fid => $cinfo) {
$hotnum[$cinfo['cid']] = count($tids[$fid]);
foreach($tids[$fid] as $tid) {
$data[$tid]['cid'] = $cinfo['cid'];
}
}
}
C::t('forum_threadhot')->insert_multiterm($data);
foreach($hotnum as $cid => $num) {
C::t('forum_threadcalendar')->update($cid, array('hotnum' => $num));
}
}
?>

View File

@@ -0,0 +1,34 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_todaypost_daily.php 31920 2012-10-24 09:18:33Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$yesterdayposts = intval(C::t('forum_forum')->fetch_sum_todaypost());
C::t('forum_forum')->update_oldrank_and_yesterdayposts();
$historypost = C::t('common_setting')->fetch_setting('historyposts');
$hpostarray = explode("\t", $historypost);
$_G['setting']['historyposts'] = $hpostarray[1] < $yesterdayposts ? "$yesterdayposts\t$yesterdayposts" : "$yesterdayposts\t$hpostarray[1]";
C::t('common_setting')->update_setting('historyposts', $_G['setting']['historyposts']);
$date = date('Y-m-d', TIMESTAMP - 86400);
C::t('forum_statlog')->insert_stat_log($date);
C::t('forum_forum')->clear_todayposts();
$rank = 1;
foreach(C::t('forum_statlog')->fetch_all_rank_by_logdate($date) as $value) {
C::t('forum_forum')->update($value['fid'], array('rank' => $rank));
$rank++;
}
savecache('historyposts', $_G['setting']['historyposts']);
?>

View File

@@ -0,0 +1,25 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cron_todayviews_daily.php 26812 2011-12-23 08:21:29Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$updateviews = array();
$deltids = array();
foreach(C::t('forum_threadaddviews')->fetch_all_order_by_tid(500) as $tid => $addview) {
$deltids[$tid] = $updateviews[$addview['addviews']][] = $tid;
}
if($deltids) {
C::t('forum_threadaddviews')->delete($deltids);
}
foreach($updateviews as $views => $tids) {
C::t('forum_thread')->increase($tids, array('views' => $views), true);
}
?>

View File

@@ -0,0 +1 @@

1
source/include/index.htm Normal file
View File

@@ -0,0 +1 @@

View File

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,48 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_inputpwd.php 24741 2011-10-10 03:41:51Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(submitcheck('pwdsubmit')) {
$blogid = empty($_POST['blogid'])?0:intval($_POST['blogid']);
$albumid = empty($_POST['albumid'])?0:intval($_POST['albumid']);
$itemarr = array();
if($blogid) {
if (!$_G['setting']['blogstatus']) {
showmessage('blog_status_off');
}
$itemarr = C::t('home_blog')->fetch($blogid);
$itemurl = "home.php?mod=space&uid={$itemarr['uid']}&do=blog&id={$itemarr['blogid']}";
$cookiename = 'view_pwd_blog_'.$blogid;
} elseif($albumid) {
if (!$_G['setting']['albumstatus']) {
showmessage('album_status_off');
}
$itemarr = C::t('home_album')->fetch_album($albumid);
$itemurl = "home.php?mod=space&uid={$itemarr['uid']}&do=album&id={$itemarr['albumid']}";
$cookiename = 'view_pwd_album_'.$albumid;
}
if(empty($itemarr)) {
showmessage('news_does_not_exist');
}
if($itemarr['password'] && $_POST['viewpwd'] == $itemarr['password']) {
dsetcookie($cookiename, md5(md5($itemarr['password'])));
showmessage('proved_to_be_successful', $itemurl, array('succeed'=>1), array('showmsg'=>1, 'timeout'=>1));
} else {
showmessage('password_is_not_passed', $itemurl, array('succeed'=>0), array('showmsg'=>1));
}
}
?>

View File

@@ -0,0 +1,48 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc_promotion.php 25889 2011-11-24 09:52:20Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
global $_G;
if(!empty($_GET['fromuid'])) {
$fromuid = intval($_GET['fromuid']);
$fromuser = '';
} else {
$fromuser = $_GET['fromuser'];
$fromuid = '';
}
if(!$_G['uid'] || !($fromuid == $_G['uid'] || $fromuser == $_G['username'])) {
if($_G['setting']['creditspolicy']['promotion_visit']) {
if(!C::t('forum_promotion')->fetch($_G['clientip'])) {
C::t('forum_promotion')->insert(array('ip' => $_G['clientip'], 'port' => $_G['remoteport'], 'uid' => $fromuid, 'username' => $fromuser), false, true);
updatecreditbyaction('promotion_visit', $fromuid);
}
}
if($_G['setting']['creditspolicy']['promotion_register']) {
if(!empty($fromuser) && empty($fromuid)) {
if(empty($_G['cookie']['promotion'])) {
$fromuid = C::t('common_member')->fetch_uid_by_username($fromuser);
} else {
$fromuid = intval($_G['cookie']['promotion']);
}
}
if($fromuid) {
dsetcookie('promotion', ($_G['cookie']['promotion'] = $fromuid), 1800);
}
}
}
?>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

View File

@@ -0,0 +1,161 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: modcp_announcement.php 29236 2012-03-30 05:34:47Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
exit('Access Denied');
}
$annlist = null;
$add_successed = $edit_successed = false;
$op = empty($_GET['op']) ? 'add' : $_GET['op'];
$announce = array('subject' => '', 'message' => '', 'starttime' => '', 'endtime' => '');
$announce['checked'] = array('selected="selected"', '');
switch($op) {
case 'add':
$announce['starttime'] = dgmdate(TIMESTAMP, 'd');
$announce['endtime'] = dgmdate(TIMESTAMP + 86400 * 30, 'd');
if(submitcheck('submit')) {
$message = is_array($_GET['message']) ? $_GET['message'][$_GET['type']] : '';
save_announce(0, $_GET['starttime'], $_GET['endtime'], $_GET['subject'], $_GET['type'], $message, 0);
$add_successed = true;
}
break;
case 'manage':
$annlist = get_annlist();
if(submitcheck('submit')) {
$delids = array();
if(!empty($_GET['delete']) && is_array($_GET['delete'])) {
foreach($_GET['delete'] as $id) {
$id = intval($id);
if(isset($annlist[$id])) {
unset($annlist[$id]);
$delids[] = $id;
}
}
if($delids) {
C::t('forum_announcement')->delete_by_id_username($delids, $_G['username']);
}
}
$updateorder = false;
if(!empty($_GET['order']) && is_array($_GET['order'])) {
foreach ($_GET['order'] as $id => $val) {
$val = intval($val);
if(isset($annlist[$id]) && $annlist[$id]['displayorder'] != $val) {
$annlist[$id]['displayorder'] = $val;
C::t('forum_announcement')->update_displayorder_by_id_username($id, $val, $_G['username']);
$updateorder = true;
}
}
}
if($delids || $updateorder) {
update_announcecache();
}
}
break;
case 'edit':
$id = intval($_GET['id']);
$announce = C::t('forum_announcement')->fetch_by_id_username($id, $_G['username']);
if(!count($announce)) {
showmessage('modcp_ann_nofound');
}
if(!submitcheck('submit')) {
$announce['starttime'] = $announce['starttime'] ? dgmdate($announce['starttime'], 'd') : '';
$announce['endtime'] = $announce['endtime'] ? dgmdate($announce['endtime'], 'd') : '';
$announce['subject'] = strip_tags($announce['subject']);
$announce['message'] = $announce['type'] != 1 ? dhtmlspecialchars($announce['message']) : $announce['message'];
$announce['checked'] = $announce['type'] != 1 ? array('selected="selected"', '') : array('', 'selected="selected"');
} else {
$announce['starttime'] = $_GET['starttime'];
$announce['endtime'] = $_GET['endtime'];
$announce['checked'] = $_GET['type'] != 1 ? array('selected="selected"', '') : array('', 'selected="selected"');
$message = $_GET['message'][$_GET['type']];
save_announce($id, $_GET['starttime'], $_GET['endtime'], $_GET['subject'], $_GET['type'], $message, $_GET['displayorder']);
$announce['subject'] = dhtmlspecialchars(trim($_GET['subject']));
if(intval($_GET['type']) == 1) {
list($message) = explode("\n", trim($message));
$announce['message'] = dhtmlspecialchars($message);
} else {
$announce['message'] = dhtmlspecialchars(trim($message));
}
$edit_successed = true;
}
break;
}
$annlist = get_annlist();
function get_annlist() {
global $_G;
$annlist = C::t('forum_announcement')->fetch_all_by_displayorder();
foreach ($annlist as $announce) {
$announce['disabled'] = $announce['author'] != $_G['member']['username'] ? 'disabled' : '';
$announce['starttime'] = $announce['starttime'] ? dgmdate($announce['starttime'], 'd') : '-';
$announce['endtime'] = $announce['endtime'] ? dgmdate($announce['endtime'], 'd') : '-';
$annlist[$announce['id']] = $announce;
}
return $annlist;
}
function update_announcecache() {
require_once libfile('function/cache');
updatecache(array('announcements', 'announcements_forum'));
}
function save_announce($id, $starttime, $endtime, $subject, $type, $message, $displayorder = 0) {
global $_G;
$displayorder = intval($displayorder);
$type = intval($type);
$starttime = empty($starttime) || strtotime($starttime) < TIMESTAMP ? TIMESTAMP : strtotime($starttime);
$endtime = empty($endtime) ? 0 : (strtotime($endtime) < $starttime ? ($starttime + 86400 * 30) : strtotime($endtime));
$subject = dhtmlspecialchars(trim($subject));
if($type == 1) {
list($message) = explode("\n", trim($message));
$message = dhtmlspecialchars($message);
} else {
$type = 0;
$message = trim($message);
}
if(empty($subject) || empty($message)) {
acpmsg('modcp_ann_empty');
} elseif($type == 1 && !preg_match('/^https?:\/\//is', $message)) {
acpmsg('modcp_ann_urlerror');
} else {
$data = array('author'=>$_G['username'], 'subject'=>$subject, 'type'=>$type, 'starttime'=>$starttime, 'endtime'=>$endtime,
'message'=>$message, 'displayorder'=>$displayorder);
if(empty($id)) {
C::t('forum_announcement')->insert($data);
} else {
C::t('forum_announcement')->update($id, $data, true);
}
update_announcecache();
return true;
}
}
?>

View File

@@ -0,0 +1,128 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: modcp_forum.php 32563 2013-02-21 03:38:50Z zhangguosheng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
exit('Access Denied');
}
$forumupdate = $listupdate = false;
$op = !in_array($op , array('editforum', 'recommend')) ? 'editforum' : $op;
if(empty($_G['fid'])) {
if(!empty($_G['cookie']['modcpfid'])) {
$fid = $_G['cookie']['modcpfid'];
} else {
list($fid) = array_keys($modforums['list']);
}
dheader("Location: {$cpscript}?mod=modcp&action={$_GET['action']}&op=$op&fid=$fid");
}
if($_G['fid'] && $_G['forum']['ismoderator']) {
if($op == 'editforum') {
require_once libfile('function/editor');
$alloweditrules = $_G['adminid'] == 1 || $_G['forum']['alloweditrules'] ? true : false;
if(!submitcheck('editsubmit')) {
$_G['forum']['rules'] = html2bbcode($_G['forum']['rules']);
} else {
require_once libfile('function/discuzcode');
$forumupdate = true;
$rulesnew = $alloweditrules ? preg_replace('/on(mousewheel|mouseover|click|load|onload|submit|focus|blur)="[^"]*"/i', '', discuzcode($_GET['rulesnew'], 1, 0, 0, 0, 1, 1, 0, 0, 1)) : $_G['forum']['rules'];
C::t('forum_forumfield')->update($_G['fid'], array('rules' => $rulesnew));
$_G['forum']['description'] = html2bbcode($descnew);
$_G['forum']['rules'] = html2bbcode($rulesnew);
}
} elseif($op == 'recommend') {
$useradd = 0;
if($_G['adminid'] == 3) {
$useradd = $_G['uid'];
}
$ordernew = !empty($_GET['ordernew']) && is_array($_GET['ordernew']) ? $_GET['ordernew'] : array();
if(submitcheck('editsubmit') && $_G['forum']['modrecommend']['sort'] != 1) {
$threads = array();
foreach($_GET['order'] as $id => $position) {
$threads[$id]['order'] = $position;
}
foreach($_GET['subject'] as $id => $title) {
$threads[$id]['subject'] = $title;
}
foreach($_GET['expirationrecommend'] as $id => $expiration) {
$expiration = trim($expiration);
if(!empty($expiration)) {
if(!preg_match('/^\d{4}-\d{1,2}-\d{1,2} +\d{1,2}:\d{1,2}$/', $expiration)) {
showmessage('recommend_expiration_invalid');
}
list($expiration_date, $expiration_time) = explode(' ', $expiration);
list($expiration_year, $expiration_month, $expiration_day) = explode('-', $expiration_date);
list($expiration_hour, $expiration_min) = explode(':', $expiration_time);
$expiration_sec = 0;
$expiration_timestamp = mktime($expiration_hour, $expiration_min, $expiration_sec, $expiration_month, $expiration_day, $expiration_year);
} else {
$expiration_timestamp = 0;
}
$threads[$id]['expiration'] = $expiration_timestamp;
}
if($_GET['delete']) {
$listupdate = true;
C::t('forum_forumrecommend')->delete($_GET['delete']);
}
if(!empty($_GET['delete']) && is_array($_GET['delete'])) {
foreach($_GET['delete'] as $id) {
$threads[$id]['delete'] = true;
unset($threads[$id]);
}
}
foreach($threads as $id => $item) {
$item['displayorder'] = intval($item['order']);
$item['subject'] = dhtmlspecialchars($item['subject']);
C::t('forum_forumrecommend')->update($id, array(
'subject' => $item['subject'],
'displayorder' => $item['displayorder'],
'expiration' => $item['expiration']
));
}
$listupdate = true;
}
$page = max(1, intval($_G['page']));
$start_limit = ($page - 1) * $_G['tpp'];
$threadcount = C::t('forum_forumrecommend')->count_by_fid($_G['fid']);
$multipage = multi($threadcount, $_G['tpp'], $page, "$cpscript?action={$_GET['action']}&fid={$_G['fid']}&page=$page");
$threadlist = $moderatormembers = array();
$moderatorids = array();
foreach(C::t('forum_forumrecommend')->fetch_all_by_fid($_G['fid'], false, $useradd, $start_limit, $_G['tpp']) as $thread) {
if($thread['moderatorid']) {
$moderatorids[$thread['moderatorid']] = $thread['moderatorid'];
}
$thread['authorlink'] = $thread['authorid'] ? "<a href=\"home.php?mod=space&uid={$thread['authorid']}\" target=\"_blank\">{$thread['author']}</a>" : 'Guest';
$thread['expiration'] = $thread['expiration'] ? dgmdate($thread['expiration']) : '';
$threadlist[] = $thread;
}
if($moderatorids) {
$moderatormembers = C::t('common_member')->fetch_all($moderatorids, false, 0);
}
}
}
?>

View File

@@ -0,0 +1,168 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: modcp_forumaccess.php 26544 2011-12-15 02:19:09Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
exit('Access Denied');
}
$list = $logids = array();
include_once(libfile('function/forumlist'));
$forumlistall = forumselect(false, false, $_G['fid']);
$adderror = $successed = 0;
$new_user = isset($_GET['new_user']) ? trim($_GET['new_user']) : '';
if($_G['fid'] && $_G['forum']['ismoderator'] && $new_user != '' && submitcheck('addsubmit')) {
$deleteaccess = isset($_GET['deleteaccess']) ? 1 : 0;
foreach (array('view', 'post', 'reply', 'getattach', 'getimage', 'postattach', 'postimage') as $key) {
${'new_'.$key} = isset($_GET['new_'.$key]) ? intval($_GET['new_'.$key]) : '';
}
if($new_user != '') {
$user = C::t('common_member')->fetch_by_username($new_user);
$uid = $user['uid'];
if(empty($user)) {
$adderror = 1;
} elseif($user['adminid'] && $_G['adminid'] != 1) {
$adderror = 2;
} else {
$access = C::t('forum_access')->fetch_all_by_fid_uid($_G['fid'], $uid);
$access = $access[0];
if($deleteaccess) {
if($access && $_G['adminid'] != 1 && inwhitelist($access)) {
$adderror = 3;
} else {
$successed = true;
$access && delete_access($uid, $_G['fid']);
}
} elseif($new_view || $new_post || $new_reply || $new_getattach || $new_getimage || $new_postattach || $new_postimage) {
if($new_view == -1) {
$new_view = $new_post = $new_reply = $new_getattach = $new_getimage = $new_postattach = $new_postimage = -1;
} else {
$new_view = 0;
$new_post = $new_post ? -1 : 0;
$new_reply = $new_reply ? -1 : 0;
$new_getattach = $new_getattach ? -1 : 0;
$new_getimage = $new_getimage ? -1 : 0;
$new_postattach = $new_postattach ? -1 : 0;
$new_postimage = $new_postimage ? -1 : 0;
}
if(empty($access)) {
$successed = true;
$data = array('uid' => $uid, 'fid' => $_G['fid'], 'allowview' => $new_view, 'allowpost' => $new_post, 'allowreply' => $new_reply,
'allowgetattach' => $new_getattach, 'allowgetimage' => $new_getimage,
'allowpostattach' => $new_postattach, 'allowpostimage' => $new_postimage,
'adminuser' => $_G['uid'], 'dateline' => $_G['timestamp']);
C::t('forum_access')->insert($data);
C::t('common_member')->update($uid, array('accessmasks' => 1), 'UNBUFFERED');
} elseif($new_view == -1 && $access['allowview'] == 1 && $_G['adminid'] != 1) {
$adderror = 3;
} else {
if($_G['adminid'] > 1) {
$new_view = $access['allowview'] == 1 ? 1 : $new_view;
$new_post = $access['allowpost'] == 1 ? 1 : $new_post;
$new_reply = $access['allowreply'] == 1 ? 1 : $new_reply;
$new_getattach = $access['allowgetattach'] == 1 ? 1 : $new_getattach;
$new_getimage = $access['allowgetimage'] == 1 ? 1 : $new_getimage;
$new_postattach = $access['postattach'] == 1 ? 1 : $new_postattach;
$new_postimage = $access['postimage'] == 1 ? 1 : $new_postimage;
}
$successed = true;
$data = array('allowview' => $new_view, 'allowpost' => $new_post, 'allowreply' => $new_reply,
'allowgetattach' => $new_getattach, 'allowgetimage' => $new_getimage,
'allowpostattach' => $new_postattach, 'allowpostimage' => $new_postimage,
'adminuser' => $_G['uid'], 'dateline' => $_G['timestamp']);
C::t('forum_access')->update_for_uid($uid, $_G['fid'], $data);
C::t('common_member')->update($uid, array('accessmasks' => 1), 'UNBUFFERED');
}
}
}
}
$new_user = $adderror ? $new_user : '';
}
$new_user = dhtmlspecialchars($new_user);
$suser = isset($_GET['suser']) ? trim($_GET['suser']) : '';
if(submitcheck('searchsubmit')) {
if($suser != '') {
$suid = C::t('common_member')->fetch_uid_by_username($suser);
}
}
$suser = dhtmlspecialchars($suser);
$page = max(1, intval($_G['page']));
$ppp = 10;
$list = array('pagelink' => '', 'data' => array());
if($num = C::t('forum_access')->fetch_all_by_fid_uid($_G['fid'], $suid, 1)) {
$page = $page > ceil($num / $ppp) ? ceil($num / $ppp) : $page;
$start_limit = ($page - 1) * $ppp;
$list['pagelink'] = multi($num, $ppp, $page, "forum.php?mod=modcp&fid={$_G['fid']}&action={$_GET['action']}");
$query = C::t('forum_access')->fetch_all_by_fid_uid($_G['fid'], $suid, 0, $start_limit, $ppp);
$uidarray = array();
foreach($query as $access) {
$uidarray[$access['uid']] = $access['uid'];
$uidarray[$access['adminuser']] = $access['adminuser'];
$access['allowview'] = accessimg($access['allowview']);
$access['allowpost'] = accessimg($access['allowpost']);
$access['allowreply'] = accessimg($access['allowreply']);
$access['allowpostattach'] = accessimg($access['allowpostattach']);
$access['allowgetattach'] = accessimg($access['allowgetattach']);
$access['allowgetimage'] = accessimg($access['allowgetimage']);
$access['allowpostimage'] = accessimg($access['allowpostimage']);
$access['dateline'] = dgmdate($access['dateline'], 'd');
$access['forum'] = '<a href="forum.php?mod=forumdisplay&fid='.$access['fid'].'" target="_blank">'.strip_tags($_G['cache']['forums'][$access['fid']]['name']).'</a>';
$list['data'][] = $access;
}
$users = array();
if($uids = dimplode($uidarray)) {
$users = C::t('common_member')->fetch_all_username_by_uid($uidarray);
}
}
function delete_access($uid, $fid) {
C::t('forum_access')->delete_by_fid($fid, $uid);
$mask = C::t('forum_access')->count_by_uid($uid);
if(!$mask) {
C::t('common_member')->update($uid, array('accessmasks' => ''), 'UNBUFFERED');
}
}
function accessimg($access) {
return $access == -1 ? '<i class="fico-remove_circle fc-i"></i>' :
($access == 1 ? '<i class="fico-check_right fc-v"></i>' : '<i class="fico-stars fc-p"></i>');
}
function inwhitelist($access) {
$return = false;
foreach (array('allowview', 'allowpost', 'allowreply', 'allowpostattach', 'allowgetattach', 'allowgetimage') as $key) {
if($access[$key] == 1) {
$return = true;
break;
}
}
return $return;
}
?>

View File

@@ -0,0 +1,56 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: modcp_home.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
exit('Access Denied');
}
if($op == 'addnote' && submitcheck('submit')) {
$newaccess = 4 + ($_GET['newaccess'][2] << 1) + $_GET['newaccess'][3];
$newexpiration = TIMESTAMP + (intval($_GET['newexpiration']) > 0 ? intval($_GET['newexpiration']) : 30) * 86400;
$newmessage = nl2br(dhtmlspecialchars(trim($_GET['newmessage'])));
if($newmessage != '') {
C::t('common_adminnote')->insert(array(
'admin' => $_G['username'],
'access' => $newaccess,
'adminid' => $_G['adminid'],
'dateline' => $_G['timestamp'],
'expiration' => $newexpiration,
'message' => $newmessage,
));
}
}
if($op == 'delete' && submitcheck('notlistsubmit')) {
if(is_array($_GET['delete']) && $deleteids = dimplode($_GET['delete'])) {
C::t('common_adminnote')->delete_note($_GET['delete'], ($_G['adminid'] == 1 ? '' : $_G['username']));
}
}
switch($_G['adminid']) {
case 1: $access = '1,2,3,4,5,6,7'; break;
case 2: $access = '2,3,6,7'; break;
default: $access = '1,3,5,7'; break;
}
$notelist = array();
foreach(C::t('common_adminnote')->fetch_all_by_access(explode(',', $access)) as $note) {
if($note['expiration'] < TIMESTAMP) {
C::t('common_adminnote')->delete_note($note['id']);
} else {
$note['expiration'] = ceil(($note['expiration'] - $note['dateline']) / 86400);
$note['dateline'] = dgmdate($note['dateline']);
$note['checkbox'] = '<input type="checkbox" name="delete[]" class="pc" '.($note['admin'] == $_G['member']['username'] || $_G['adminid'] == 1 ? "value=\"{$note['id']}\"" : 'disabled').'>';
$note['admin'] = '<a href="home.php?mod=space&username='.rawurlencode($note['admin']).'" target="_blank">'.$note['admin'].'</a>';
$notelist[] = $note;
}
}
?>

View File

@@ -0,0 +1,97 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: modcp_log.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
exit('Access Denied');
}
if(!isset($_G['cache']['forums'])) {
loadcache('forums');
}
$language = lang('forum/misc');
$lpp = empty($_GET['lpp']) ? 20 : intval($_GET['lpp']);
$lpp = min(200, max(5, $lpp));
$logdir = DISCUZ_ROOT.'./data/log/';
$logfiles = get_log_files($logdir, 'modcp');
$logs = array();
foreach($logfiles as $logfile) {
$logs = array_merge($logs, file($logdir.$logfile));
}
$page = max(1, intval($_G['page']));
$start = ($page - 1) * $lpp;
$logs = array_reverse($logs);
if(!empty($_GET['keyword'])) {
foreach($logs as $key => $value) {
if(strpos($value, $_GET['keyword']) === FALSE) {
unset($logs[$key]);
}
}
} else {
$_GET['keyword'] = '';
}
$num = count($logs);
$multipage = multi($num, $lpp, $page, "$cpscript?mod=modcp&action=log&lpp=$lpp&keyword=".rawurlencode($_GET['keyword']));
$logs = array_slice($logs, $start, $lpp);
$keyword = isset($_GET['keyword']) ? dhtmlspecialchars($_GET['keyword']) : '';
$usergroup = array();
$filters = '';
$loglist = array();
foreach($logs as $logrow) {
$log = explode("\t", $logrow);
if(empty($log[1])) {
continue;
}
$log[1] = dgmdate($log[1], 'y-n-j H:i');
if(strtolower($log[2]) == strtolower($_G['member']['username'])) {
$log[2] = '<a href="home.php?mod=space&username='.rawurlencode($log[2]).'" target="_blank"><b>'.$log[2].'</b></a>';
}
$log[5] = trim($log[5]);
$check = 'modcp_logs_action_'.$log[5];
$log[5] = isset($language[$check]) ? $language[$check] : $log[5];
$log[7] = intval($log[7]);
$log[7] = !empty($log[7]) ? '<a href="forum.php?mod=forumdisplay&fid='.$log[7].'" target="_blank">'.strip_tags("{$_G['cache']['forums'][$log[7]]['name']}").'</a>' : '';
$log[8] = str_replace(array('GET={};', 'POST={};', 'mod=modcp;', 'action='.$log[5].';', 'diy=;', 'op='.$log[6].';'), '', $log[8]);
$log[8] = cutstr($log['8'], 60);
$loglist[] = $log;
}
function get_log_files($logdir='', $action='action') {
$dir = opendir($logdir);
$files = array();
while($entry = readdir($dir)) {
$files[] = $entry;
}
closedir($dir);
sort($files);
$logfile = $action;
$logfiles = array();
foreach($files as $file) {
if(strpos($file, $logfile) !== FALSE) {
$logfiles[] = $file;
}
}
$logfiles = array_slice($logfiles, -2, 2);
return $logfiles;
}
?>

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: modcp_login.php 6752 2010-03-25 08:47:54Z cnteacher $
*/
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
exit('Access Denied');
}
?>

View File

@@ -0,0 +1,303 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: modcp_member.php 33701 2013-08-06 05:04:36Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
exit('Access Denied');
}
if($op == 'edit') {
$_GET['uid'] = isset($_GET['uid']) ? intval($_GET['uid']) : '';
$_GET['username'] = isset($_GET['username']) ? trim($_GET['username']) : '';
$member = loadmember($_GET['uid'], $_GET['username'], $error);
$usernameenc = $member ? rawurlencode($member['username']) : '';
if($member && submitcheck('editsubmit') && !$error) {
if($_G['group']['allowedituser']) {
if(!empty($_GET['clearavatar'])) {
loaducenter();
uc_user_deleteavatar($member['uid']);
}
require_once libfile('function/discuzcode');
if($_GET['bionew']) {
$biohtmlnew = nl2br(dhtmlspecialchars($_GET['bionew']));
} else {
$biohtmlnew = '';
}
if($_GET['signaturenew']) {
$signaturenew = censor($_GET['signaturenew']);
$sightmlnew = discuzcode($signaturenew, 1, 0, 0, 0, $member['allowsigbbcode'], $member['allowsigimgcode'], 0, 0, 1);
} else {
$sightmlnew = $signaturenew = '';
}
!empty($_GET['locationnew']) && $locationnew = dhtmlspecialchars($_GET['locationnew']);
if($_G['setting']['profilehistory']) {
C::t('common_member_profile_history')->insert(array_merge(C::t('common_member_profile')->fetch(intval($member['uid'])), array('dateline' => time())));
}
C::t('common_member_profile')->update($member['uid'], array('bio' => $biohtmlnew));
C::t('common_member_field_forum')->update($member['uid'], array('sightml' => $sightmlnew));
}
acpmsg('members_edit_succeed', "$cpscript?mod=modcp&action={$_GET['action']}&op=$op");
} elseif($member) {
require_once libfile('function/editor');
$bio = explode("\t\t\t", $member['bio']);
$member['bio'] = html2bbcode($bio[0]);
$member['biotrade'] = !empty($bio[1]) ? html2bbcode($bio[1]) : '';
$member['signature'] = html2bbcode($member['sightml']);
$username = !empty($_GET['username']) ? $member['username'] : '';
}
} elseif($op == 'ban' && ($_G['group']['allowbanuser'] || $_G['group']['allowbanvisituser'])) {
$_GET['uid'] = isset($_GET['uid']) ? intval($_GET['uid']) : '';
$_GET['username'] = isset($_GET['username']) ? trim($_GET['username']) : '';
$member = loadmember($_GET['uid'], $_GET['username'], $error);
$usernameenc = $member ? rawurlencode($member['username']) : '';
include_once libfile('function/member');
$clist = crime('getactionlist', $member['uid']);
if(($member['type'] == 'system' && in_array($member['groupid'], array(1, 2, 3, 6, 7, 8))) || $member['type'] == 'special') {
acpmsg('modcp_member_ban_illegal');
}
if($member && submitcheck('bansubmit') && !$error) {
$setarr = array();
$reason = dhtmlspecialchars(trim($_GET['reason']));
if(!$reason && ($_G['group']['reasonpm'] == 1 || $_G['group']['reasonpm'] == 3)) {
acpmsg('admin_reason_invalid');
}
if($_GET['bannew'] == 4 || $_GET['bannew'] == 5) {
if($_GET['bannew'] == 4 && !$_G['group']['allowbanuser'] || $_GET['bannew'] == 5 && !$_G['group']['allowbanvisituser']) {
acpmsg('admin_nopermission');
}
$groupidnew = $_GET['bannew'];
$banexpirynew = !empty($_GET['banexpirynew']) ? TIMESTAMP + $_GET['banexpirynew'] * 86400 : 0;
$banexpirynew = $banexpirynew > TIMESTAMP ? $banexpirynew : 0;
if($banexpirynew) {
$member['groupterms'] = $member['groupterms'] && is_array($member['groupterms']) ? $member['groupterms'] : array();
if($member['groupid'] == 4 || $member['groupid'] == 5) {
$member['groupterms']['main']['time'] = $banexpirynew;
if (empty($member['groupterms']['main']['groupid'])) {
$groupnew = C::t('common_usergroup')->fetch_by_credits($member['credits']);
$member['groupterms']['main']['groupid'] = $groupnew['groupid'];
}
if (!isset($member['groupterms']['main']['adminid'])) {
$member['groupterms']['main']['adminid'] = $member['adminid'];
}
}else{
$member['groupterms']['main'] = array('time' => $banexpirynew, 'adminid' => $member['adminid'], 'groupid' => $member['groupid']);
}
$member['groupterms']['ext'][$groupidnew] = $banexpirynew;
$setarr['groupexpiry'] = groupexpiry($member['groupterms']);
} else {
$setarr['groupexpiry'] = 0;
}
if(in_array($member['adminid'], array(0, -1))) {
$member_status = C::t('common_member_status')->fetch($member['uid']);
}
$adminidnew = -1;
C::t('forum_postcomment')->delete_by_authorid($member['uid'], false, true);
} elseif($member['groupid'] == 4 || $member['groupid'] == 5) {
if(!empty($member['groupterms']['main']['groupid'])) {
$groupidnew = $member['groupterms']['main']['groupid'];
$adminidnew = $member['groupterms']['main']['adminid'];
unset($member['groupterms']['main']);
unset($member['groupterms']['ext'][$member['groupid']]);
$setarr['groupexpiry'] = groupexpiry($member['groupterms']);
} else {
$usergroup = C::t('common_usergroup')->fetch_by_credits($member['credits']);
$groupidnew = $usergroup['groupid'];
$adminidnew = 0;
}
} else {
$groupidnew = $member['groupid'];
$adminidnew = $member['adminid'];
}
$setarr['adminid'] = $adminidnew;
$setarr['groupid'] = $groupidnew;
C::t('common_member')->update($member['uid'], $setarr);
if(DB::affected_rows()) {
savebanlog($member['username'], $member['groupid'], $groupidnew, $banexpirynew, $reason);
}
C::t('common_member_field_forum')->update($member['uid'], array('groupterms' => serialize($member['groupterms'])));
if($_GET['bannew'] == 4) {
$notearr = array(
'user' => "<a href=\"home.php?mod=space&uid={$_G['uid']}\">{$_G['username']}</a>",
'day' => $_GET['banexpirynew'],
'reason' => $reason,
'from_id' => 0,
'from_idtype' => 'banspeak'
);
notification_add($member['uid'], 'system', 'member_ban_speak', $notearr, 1);
}
if($_GET['bannew'] == 5) {
$notearr = array(
'user' => "<a href=\"home.php?mod=space&uid={$_G['uid']}\">{$_G['username']}</a>",
'day' => $_GET['banexpirynew'],
'reason' => $reason,
'from_id' => 0,
'from_idtype' => 'banvisit'
);
notification_add($member['uid'], 'system', 'member_ban_visit', $notearr, 1);
}
if($_GET['bannew'] == 4 || $_GET['bannew'] == 5) {
crime('recordaction', $member['uid'], ($_GET['bannew'] == 4 ? 'crime_banspeak' : 'crime_banvisit'), $reason);
}
acpmsg('modcp_member_ban_succeed', "$cpscript?mod=modcp&action={$_GET['action']}&op=$op");
}
} elseif($op == 'ipban' && $_G['group']['allowbanip']) {
if (array_key_exists('security', $_G['config']) && array_key_exists('useipban', $_G['config']['security']) && $_G['config']['security']['useipban'] == 0) {
acpmsg('admin_nopermission');
}
require_once libfile('function/misc');
$iptoban = getgpc('ip') ? dhtmlspecialchars(getgpc('ip')) : '';
$updatecheck = $addcheck = $deletecheck = $adderror = 0;
if(submitcheck('ipbansubmit')) {
$_GET['delete'] = isset($_GET['delete']) ? $_GET['delete'] : '';
if($_GET['delete']) {
$deletecheck = C::t('common_banned')->delete_by_id($_GET['delete'], $_G['adminid'], $_G['username']);
}
if($_GET['ipnew']) {
$addcheck = ipbanadd($_GET['ipnew'], $_GET['validitynew'], $adderror);
if(!$addcheck) {
$iptoban = $_GET['ipnew'];
}
}
if(!empty($_GET['expirationnew']) && is_array($_GET['expirationnew'])) {
foreach($_GET['expirationnew'] as $id => $expiration) {
if($expiration === intval($expiration)) {
$expiration = $expiration > 1 ? (TIMESTAMP + $expiration * 86400) : TIMESTAMP + 86400;
$updatecheck = C::t('common_banned')->update_expiration_by_id($id, $expiration, $_G['adminid'], $_G['username']);
}
}
}
}
$iplist = array();
foreach(C::t('common_banned')->fetch_all_order_dateline() as $banned) {
for($i = 1; $i <= 4; $i++) {
if($banned["ip$i"] == -1) {
$banned["ip$i"] = '*';
}
}
$banned['disabled'] = $_G['adminid'] != 1 && $banned['admin'] != $_G['member']['username'] ? 'disabled' : '';
$banned['dateline'] = dgmdate($banned['dateline'], 'd');
$banned['expiration'] = dgmdate($banned['expiration'], 'd');
$banned['theip'] = $banned['ip'];
$banned['location'] = convertip($banned['theip']);
$iplist[$banned['id']] = $banned;
}
} else {
showmessage('undefined_action');
}
function loadmember(&$uid, &$username, &$error) {
global $_G;
$uid = !empty($_GET['uid']) && is_numeric($_GET['uid']) && $_GET['uid'] > 0 ? $_GET['uid'] : '';
$username = isset($_GET['username']) && $_GET['username'] != '' ? dhtmlspecialchars(trim($_GET['username'])) : '';
$member = array();
if($uid || $username != '') {
$member = $uid ? getuserbyuid($uid) : C::t('common_member')->fetch_by_username($username);
if($member) {
$uid = $member['uid'];
$member = array_merge($member, C::t('common_member_field_forum')->fetch($uid), C::t('common_member_profile')->fetch($uid),
C::t('common_usergroup')->fetch($member['groupid']), C::t('common_usergroup_field')->fetch($member['groupid']));
}
if(!$member) {
$error = 2;
} elseif(($member['grouptype'] == 'system' && in_array($member['groupid'], array(1, 2, 3, 6, 7, 8))) || in_array($member['adminid'], array(1,2,3))) {
$error = 3;
} else {
$member['groupterms'] = dunserialize($member['groupterms']);
$member['banexpiry'] = !empty($member['groupterms']['main']['time']) && ($member['groupid'] == 4 || $member['groupid'] == 5) ? dgmdate($member['groupterms']['main']['time'], 'Y-n-j') : '';
$error = 0;
}
} else {
$error = 1;
}
return $member;
}
function ipbanadd($ipnew, $validitynew, &$error) {
global $_G;
if($ipnew != '') {
$ipnew = ip::to_ip($ipnew);
$is_cidr = ip::validate_cidr($ipnew, $ipnew);
if (!ip::validate_ip($ipnew) && !$is_cidr) {
$error = 1;
return FALSE;
}
if($_G['adminid'] != 1 && $is_cidr) {
$error = 2;
return FALSE;
}
if(ip::check_ip($_G['clientip'], $ipnew)) {
$error = 3;
return FALSE;
}
if($banned = C::t('common_banned')->fetch_by_ip($ipnew)) {
$error = 3;
return FALSE;
}
$expiration = $validitynew > 1 ? (TIMESTAMP + $validitynew * 86400) : TIMESTAMP + 86400;
list($lower, $upper) = ip::calc_cidr_range($ipnew, true);
$data = array(
'ip' => $ipnew,
'lowerip' => $lower,
'upperip' => $upper,
'admin' => $_G['username'],
'dateline' => $_G['timestamp'],
'expiration' => $expiration
);
C::t('common_banned')->insert($data);
return TRUE;
}
return FALSE;
}
?>

View File

@@ -0,0 +1,673 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: modcp_moderate.php 32077 2012-11-07 04:38:04Z liulanbo $
*/
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
exit('Access Denied');
}
if(!$_G['setting']['forumstatus'] && $op != 'members') {
showmessage('forum_status_off');
}
$modact = empty($_GET['modact']) || !in_array($_GET['modact'] , array('delete', 'ignore', 'validate')) ? 'ignore' : $_GET['modact'];
if($op == 'members') {
$filter = isset($_GET['filter']) ? intval($_GET['filter']) : 0;
$filtercheck = array('', '', '');
$filtercheck[$filter] = 'selected';
if(submitcheck('dosubmit', 1) || submitcheck('modsubmit')) {
if(empty($modact) || !in_array($modact, array('ignore', 'validate', 'delete'))) {
showmessage('modcp_noaction');
}
$list = array();
if($_GET['moderate'] && is_array($_GET['moderate'])) {
foreach($_GET['moderate'] as $val) {
if(is_numeric($val) && $val) {
$list[] = $val;
}
}
}
if(submitcheck('dosubmit', 1)) {
$_GET['handlekey'] = 'mods';
include template('forum/modcp_moderate_float');
dexit();
} elseif ($uids = $list) {
$members = $uidarray = array();
$member_validate = C::t('common_member_validate')->fetch_all($uids);
foreach(C::t('common_member')->fetch_all($uids, false, 0) as $uid => $member) {
if(($member['groupid'] == 8 || (in_array($member['freeze'], array(-1, 2)) && $modact != 'delete')) && $member['status'] == $filter) {
$members[$uid] = array_merge((array)$member_validate[$uid], $member);
}
}
if(($uids = array_keys($members))) {
$reason = dhtmlspecialchars(trim($_GET['reason']));
if($_GET['modact'] == 'delete') {
C::t('common_member')->delete_no_validate($uids);
}
if($_GET['modact'] == 'validate') {
C::t('common_member')->update($uids, array('adminid' => '0', 'groupid' => $_G['setting']['newusergroupid'], 'freeze' => 0));
C::t('common_member_validate')->delete($uids);
}
if($_GET['modact'] == 'ignore') {
C::t('common_member_validate')->update($uids, array('moddate' => $_G['timestamp'], 'admin' => $_G['username'], 'status' => '1', 'remark' => $reason));
}
$sendemail = isset($_GET['sendemail']) ? $_GET['sendemail'] : 0;
if($sendemail) {
if(!function_exists('sendmail')) {
include libfile('function/mail');
}
foreach($members as $uid => $member) {
$member['regdate'] = dgmdate($member['regdate']);
$member['submitdate'] = dgmdate($member['submitdate']);
$member['moddate'] = dgmdate(TIMESTAMP);
$member['operation'] = $_GET['modact'];
$member['remark'] = $reason ? $reason : 'N/A';
$moderate_member_message = array(
'tpl' => 'moderate_member',
'var' => array(
'username' => $member['username'],
'bbname' => $_G['setting']['bbname'],
'regdate' => $member['regdate'],
'submitdate' => $member['submitdate'],
'submittimes' => $member['submittimes'],
'message' => $member['message'],
'modresult' => lang('email', 'moderate_member_'.$member['operation']),
'moddate' => $member['moddate'],
'adminusername' => $_G['member']['username'],
'remark' => $member['remark'],
'siteurl' => $_G['siteurl'],
)
);
if(!sendmail("{$member['username']} <{$member['email']}>", $moderate_member_message)) {
runlog('sendmail', "{$member['email']} sendmail failed.");
}
}
}
} else {
showmessage('modcp_moduser_invalid');
}
showmessage('modcp_mod_succeed', "{$cpscript}?mod=modcp&action={$_GET['action']}&op=$op&filter=$filter");
} else {
showmessage('modcp_moduser_invalid');
}
} else {
$count = C::t('common_member_validate')->fetch_all_status_by_count();
$page = max(1, intval($_G['page']));
$_G['setting']['memberperpage'] = 20;
$start_limit = ($page - 1) * $_G['setting']['memberperpage'];
$multipage = multi($count[$filter], $_G['setting']['memberperpage'], $page, "{$cpscript}?mod=modcp&action={$_GET['action']}&op=$op&fid={$_G['fid']}&filter=$filter");
$vuids = array();
$memberlist = $member_validate = $common_member = $member_status = array();
if(($member_validate = C::t('common_member_validate')->fetch_all_by_status($filter, $start_limit, $_G['setting']['memberperpage']))) {
$uids = array_keys($member_validate);
$common_member = C::t('common_member')->fetch_all($uids, false, 0);
$member_status = C::t('common_member_status')->fetch_all($uids, false, 0);
}
foreach($member_validate as $uid => $member) {
$member = array_merge($member, (array)$common_member[$uid], (array)$member_status[$uid]);
if($member['groupid'] != 8 && !in_array($member['freeze'], array(-1, 2))) {
$vuids[] = $member['uid'];
continue;
}
$member['regdate'] = dgmdate($member['regdate']);
$member['submitdate'] = dgmdate($member['submitdate']);
$member['moddate'] = $member['moddate'] ? dgmdate($member['moddate']) : $lang['none'];
$member['message'] = dhtmlspecialchars($member['message']);
$member['admin'] = $member['admin'] ? "<a href=\"home.php?mod=space&username=".rawurlencode($member['admin'])."\" target=\"_blank\">{$member['admin']}</a>" : $lang['none'];
$memberlist[] = $member;
}
if($vuids) {
C::t('common_member_validate')->delete($vuids, 'UNBUFFERED');
}
return true;
}
}
if(empty($modforums['fids'])) {
return false;
} elseif($_G['fid'] && ($_G['forum']['type'] == 'group' || !$_G['forum']['ismoderator'])) {
return false;
} else {
$modfids = "";
if($_G['fid']) {
$modfids = $_G['fid'];
$modfidsadd = "fid='{$_G['fid']}'";
} elseif($_G['adminid'] == 1) {
$modfidsadd = "";
} else {
$modfids = $modforums['fids'];
$modfidsadd = "fid in ({$modforums['fids']})";
}
}
$updatestat = false;
$op = !in_array($op , array('replies', 'threads')) ? 'threads' : $op;
$filter = !empty($_GET['filter']) ? -3 : 0;
$filtercheck = array(0 => '', '-3' => '');
$filtercheck[$filter] = 'selected="selected"';
$pstat = $filter == -3 ? -3 : -2;
$moderatestatus = $filter == -3 ? 1 : 0;
$tpp = 10;
$page = max(1, intval($_G['page']));
$start_limit = ($page - 1) * $tpp;
$postlist = array();
$posttableselect = '';
$modpost = array('validate' => 0, 'delete' => 0, 'ignore' => 0);
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
require_once libfile('function/post');
if(submitcheck('dosubmit', 1) || submitcheck('modsubmit')) {
$list = array();
if($_GET['moderate'] && is_array($_GET['moderate'])) {
foreach($_GET['moderate'] as $val) {
if(is_numeric($val) && $val) {
$moderation[$modact][] = $val;
}
}
}
if(submitcheck('modsubmit')) {
$updatestat = $op == 'replies' ? 1 : 2;
$modpost = array(
'ignore' => count($moderation['ignore']),
'delete' => count($moderation['delete']),
'validate' => count($moderation['validate'])
);
} elseif(submitcheck('dosubmit', 1)) {
$_GET['handlekey'] = 'mods';
$list = $moderation[$modact];
include template('forum/modcp_moderate_float');
dexit();
}
}
if($op == 'replies') {
$posttableid = intval($_GET['posttableid']);
$posttable = getposttable($posttableid);
$posttableselect = getposttableselect();
if(submitcheck('modsubmit')) {
$pmlist = array();
if($ignorepids = dimplode($moderation['ignore'])) {
C::t('forum_post')->update_post($posttableid, $moderation['ignore'], array('invisible' => -3), true, false, 0, -2, ($modfids ? explode(',', $modfids) : null));
updatemoderate('pid', $moderation['ignore'], 1);
}
if($deletepids = dimplode($moderation['delete'])) {
$deleteauthorids = array();
$recyclebinpids = array();
$pids = array();
foreach(C::t('forum_post')->fetch_all_post($posttableid, $moderation['delete']) as $post) {
if($post['invisible'] != $pstat || $post['first'] != 0 || ($modfids ? !in_array($post['fid'], explode(',', $modfids)) : 0)) {
continue;
}
if($modforums['recyclebins'][$post['fid']]) {
$recyclebinpids[] = $post['pid'];
} else {
$pids[] = $post['pid'];
}
if($post['authorid'] && $post['authorid'] != $_G['uid']) {
$pmlist[] = array(
'act' => $_GET['reason'] ? 'modreplies_delete_reason' : 'modreplies_delete',
'notevar' => array('modusername' => ($_G['setting']['moduser_public'] ? $_G['username'] : ''), 'reason' => dhtmlspecialchars($_GET['reason']), 'post' => messagecutstr($post['message'], 30)),
'authorid' => $post['authorid'],
);
}
if($_GET['crimerecord']) {
require_once libfile('function/member');
crime('recordaction', $post['authorid'], 'crime_delpost', lang('forum/misc', 'crime_postreason', array('reason' => dhtmlspecialchars($_GET['reason']), 'tid' => $post['tid'], 'pid' => $post['pid'])));
}
$deleteauthorids[$post['authorid']] = $post['authorid'];
}
if($recyclebinpids) {
C::t('forum_post')->update_post($posttableid, $recyclebinpids, array('invisible' => '-5'), true);
}
if($pids) {
require_once libfile('function/delete');
deletepost($pids, 'pid', false, $posttableid);
}
if($_G['group']['allowbanuser'] && ($_GET['banuser'] || $_GET['userdelpost']) && $deleteauthorids) {
$members = C::t('common_member')->fetch_all($deleteauthorids);
$banuins = array();
foreach($members as $member) {
if(($_G['cache']['usergroups'][$member['groupid']]['type'] == 'system' &&
in_array($member['groupid'], array(1, 2, 3, 6, 7, 8))) || $_G['cache']['usergroups'][$member['groupid']]['type'] == 'special') {
continue;
}
$banuins[$member['uid']] = $member['uid'];
}
if($banuins) {
if($_GET['banuser']) {
C::t('common_member')->update($banuins, array('groupid' => 4));
}
if($_GET['userdelpost']) {
require_once libfile('function/delete');
deletememberpost($banuins);
}
}
}
updatemodworks('DLP', count($moderation['delete']));
updatemoderate('pid', $moderation['delete'], 2);
}
$repliesmod = 0;
if($validatepids = dimplode($moderation['validate'])) {
$threads = $lastpost = $attachments = $pidarray = array();
$postlist = $tids = array();
foreach(C::t('forum_post')->fetch_all_post($posttableid, $moderation['validate']) as $post) {
if($post['invisible'] != $pstat || $post['first'] != '0' || ($modfids ? !in_array($post['fid'], explode(',', $modfids)) : 0)) {
continue;
}
$tids[$post['tid']] = $post['tid'];
$postlist[] = $post;
}
$threadlist = C::t('forum_thread')->fetch_all($tids);
foreach($postlist as $post) {
$post['lastpost'] = $threadlist[$post['tid']]['lastpost'];
$repliesmod ++;
$pidarray[] = $post['pid'];
if(getstatus($post['status'], 3) == 0) {
updatepostcredits('+', $post['authorid'], 'reply', $post['fid']);
$attachcount = C::t('forum_attachment_n')->count_by_id('tid:'.$post['tid'], 'pid', $post['pid']);
updatecreditbyaction('postattach', $post['authorid'], array(), '', $attachcount, 1, $post['fid']);
}
$threads[$post['tid']]['posts']++;
if($post['dateline'] > $post['lastpost'] && $post['dateline'] > $lastpost[$post['tid']]) {
$threads[$post['tid']]['lastpost'] = $post['dateline'];
$threads[$post['tid']]['lastposter'] = $post['anonymous'] && $post['dateline'] != $post['lastpost'] ? '' : addslashes($post['author']);
}
if($threads[$post['tid']]['attachadd'] || $post['attachment']) {
$threads[$post['tid']]['attachment'] = 1;
}
$pm = 'pm_'.$post['pid'];
if($post['authorid'] && $post['authorid'] != $_G['uid']) {
$pmlist[] = array(
'act' => 'modreplies_validate',
'notevar' => array('modusername' => ($_G['setting']['moduser_public'] ? $_G['username'] : ''), 'reason' => dhtmlspecialchars($_GET['reason']), 'pid' => $post['pid'], 'tid' => $post['tid'], 'post' => messagecutstr($post['message'], 30), 'from_id' => 0, 'from_idtype' => 'modreplies'),
'authorid' => $post['authorid'],
);
}
}
unset($postlist, $tids, $threadlist);
foreach($threads as $tid => $thread) {
$updatedata = array('replies'=>$thread['posts']);
if(isset($thread['lastpost'])) {
$updatedata['lastpost'] = array($thread['lastpost']);
$updatedata['lastposter'] = array($thread['lastposter']);
}
if(isset($thread['attachment'])) {
$updatedata['attachment'] = $thread['attachment'];
}
C::t('forum_thread')->increase($tid, $updatedata);
}
if($_G['fid']) {
updateforumcount($_G['fid']);
} else {
$fids = array_keys($modforums['list']);
foreach($fids as $f) {
updateforumcount($f);
}
}
if(!empty($pidarray)) {
$pidarray[] = 0;
$repliesmod = C::t('forum_post')->update_post($posttableid, $pidarray, array('invisible' => '0'), true);
updatemodworks('MOD', $repliesmod);
updatemoderate('pid', $pidarray, 2);
} else {
updatemodworks('MOD', 1);
}
}
if($pmlist) {
foreach($pmlist as $pm) {
$post = $pm['post'];
$_G['tid'] = intval($pm['tid']);
notification_add($pm['authorid'], 'system', $pm['act'], $pm['notevar'], 1);
}
}
showmessage('modcp_mod_succeed', "{$cpscript}?mod=modcp&action={$_GET['action']}&op=$op&filter=$filter&fid={$_G['fid']}");
}
$attachlist = array();
require_once libfile('function/discuzcode');
require_once libfile('function/attachment');
$ppp = 10;
$page = max(1, intval($_G['page']));
$start_limit = ($page - 1) * $ppp;
$modcount = C::t('common_moderate')->count_by_search_for_post($posttable, $moderatestatus, 0, ($modfids ? explode(',', $modfids) : null));
$multipage = multi($modcount, $ppp, $page, "{$cpscript}?mod=modcp&action={$_GET['action']}&op=$op&filter=$filter&fid={$_G['fid']}&showcensor={$_GET['showcensor']}");
if($modcount) {
$attachtablearr = array();
$_fids = array();
foreach(C::t('common_moderate')->fetch_all_by_search_for_post($posttable, $moderatestatus, 0, ($modfids ? explode(',', $modfids) : null), null, null, null, $start_limit, $ppp) as $post) {
$_fids[$post['fid']] = $post['fid'];
$_tids[$post['tid']] = $post['tid'];
$post['id'] = $post['pid'];
$post['dateline'] = dgmdate($post['dateline']);
$post['subject'] = $post['subject'] ? '<b>'.$post['subject'].'</b>' : '';
$post['message'] = nl2br(dhtmlspecialchars($post['message']));
if(!empty($_GET['showcensor'])) {
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
$censor->check($post['subject']);
$censor->check($post['message']);
$censor_words = $censor->words_found;
if(count($censor_words) > 3) {
$censor_words = array_slice($censor_words, 0, 3);
}
$post['censorwords'] = implode(', ', $censor_words);
}
if($post['attachment']) {
$attachtable = getattachtableid($post['tid']);
$attachtablearr[$attachtable][$post['pid']] = $post['pid'];
}
$postlist[$post['pid']] = $post;
}
$_threads = $_forums = array();
if($_fids) {
$_forums = C::t('forum_forum')->fetch_all($_fids);
foreach($postlist as &$_post) {
$_forum = $_forums[$_post['fid']];
$_arr = array(
'forumname' => $_forum['name'],
'allowsmilies' => $_forum['allowsmilies'],
'allowhtml' => $_forum['allowhtml'],
'allowbbcode' => $_forum['allowbbcode'],
'allowimgcode' => $_forum['allowimgcode'],
);
$_post = array_merge($_post, $_arr);
}
}
if($_tids) {
$_threads = C::t('forum_thread')->fetch_all($_tids);
foreach($postlist as &$_post) {
$_post['tsubject'] = $_threads[$_post['tid']]['subject'];
}
}
if(!empty($attachtablearr)) {
foreach($attachtablearr as $attachtable => $pids) {
foreach(C::t('forum_attachment_n')->fetch_all_by_id($attachtable, 'pid', $pids) as $attach) {
$_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
$attach['url'] = $attach['isimage']
? " {$attach['filename']} (".sizecount($attach['filesize']).")<br /><br /><img src=\"{$_G['setting']['attachurl']}forum/{$attach['attachment']}\" onload=\"if(this.width > 100) {this.resized=true; this.width=100;}\">"
: "<a href=\"".$_G['setting']['attachurl']."forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (".sizecount($attach['filesize']).")";
$postlist[$attach['pid']]['message'] .= "<br /><br />File: ".attachtype(fileext($attach['filename'])."\t").$attach['url'];
}
}
}
}
} else {
if(submitcheck('modsubmit')) {
if(!empty($moderation['ignore'])) {
C::t('forum_thread')->update_by_tid_displayorder($moderation['ignore'], -2, array('displayorder'=>-3), ($modfids ? explode(',', $modfids) : null));
updatemoderate('tid', $moderation['ignore'], 1);
}
$threadsmod = 0;
$pmlist = array();
$reason = trim($_GET['reason']);
if(!empty($moderation['delete'])) {
$deleteauthorids = array();
$deletetids = array();
$recyclebintids = '0';
foreach(C::t('forum_thread')->fetch_all_by_tid_displayorder($moderation['delete'], $pstat, '=', ($modfids ? explode(',', $modfids) : null)) as $thread) {
if($modforums['recyclebins'][$thread['fid']]) {
$recyclebintids .= ','.$thread['tid'];
} else {
$deletetids[] = $thread['tid'];
}
if($thread['authorid'] && $thread['authorid'] != $_G['uid']) {
$pmlist[] = array(
'act' => $_GET['reason'] ? 'modthreads_delete_reason' : 'modthreads_delete',
'notevar' => array('reason' => dhtmlspecialchars($_GET['reason']), 'threadsubject' => $thread['subject']),
'authorid' => $thread['authorid'],
);
}
if($_GET['crimerecord']) {
require_once libfile('function/member');
crime('recordaction', $thread['authorid'], 'crime_delpost', lang('forum/misc', 'crime_postreason', array('reason' => dhtmlspecialchars($_GET['reason']), 'tid' => $thread['tid'], 'pid' => $thread['pid'])));
}
$deleteauthorids[$thread['authorid']] = $thread['authorid'];
}
if($recyclebintids) {
$rows = C::t('forum_thread')->update(explode(',', $recyclebintids), array('displayorder' => -1, 'moderated' => 1));
updatemodworks('MOD', $rows);
C::t('forum_post')->update_by_tid(0, explode(',', $recyclebintids), array('invisible' => -1), true);
updatemodlog($recyclebintids, 'DEL');
}
require_once libfile('function/delete');
deletethread($deletetids);
if($_G['group']['allowbanuser'] && ($_GET['banuser'] || $_GET['userdelpost']) && $deleteauthorids) {
$members = C::t('common_member')->fetch_all($deleteauthorids);
$banuins = array();
foreach($members as $member) {
if(($_G['cache']['usergroups'][$member['groupid']]['type'] == 'system' &&
in_array($member['groupid'], array(1, 2, 3, 6, 7, 8))) || $_G['cache']['usergroups'][$member['groupid']]['type'] == 'special') {
continue;
}
$banuins[$member['uid']] = $member['uid'];
}
if($banuins) {
if($_GET['banuser']) {
C::t('common_member')->update($banuins, array('groupid' => 4));
}
if($_GET['userdelpost']) {
deletememberpost($banuins);
}
}
}
updatemoderate('tid', $moderation['delete'], 2);
}
if($validatetids = dimplode($moderation['validate'])) {
$tids = $moderatedthread = array();
foreach(C::t('forum_thread')->fetch_all_by_tid_displayorder($moderation['validate'], $pstat, '=', ($modfids ? explode(',', $modfids) : null)) as $thread) {
$tids[] = $thread['tid'];
$poststatus = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
$poststatus = $poststatus['status'];
if(getstatus($poststatus, 3) == 0) {
updatepostcredits('+', $thread['authorid'], 'post', $thread['fid']);
$attachcount = C::t('forum_attachment_n')->count_by_id('tid:'.$thread['tid'], 'tid', $thread['tid']);
updatecreditbyaction('postattach', $thread['authorid'], array(), '', $attachcount, 1, $thread['fid']);
}
$validatedthreads[] = $thread;
if($thread['authorid'] && $thread['authorid'] != $_G['uid']) {
$pmlist[] = array(
'act' => 'modthreads_validate',
'notevar' => array('reason' => dhtmlspecialchars($_GET['reason']), 'tid' => $thread['tid'], 'threadsubject' => $thread['subject'], 'from_id' => 0, 'from_idtype' => 'modthreads'),
'authorid' => $thread['authorid'],
);
}
}
if($tids) {
$tidstr = dimplode($tids);
C::t('forum_post')->update_by_tid(0, $tids, array('invisible' => 0), true, false, 1);
C::t('forum_thread')->update($tids, array('displayorder'=>0, 'moderated'=>1));
$threadsmod = DB::affected_rows();
if($_G['fid']) {
updateforumcount($_G['fid']);
} else {
$fids = array_keys($modforums['list']);
foreach($fids as $f) {
updateforumcount($f);
}
}
updatemodworks('MOD', $threadsmod);
updatemodlog($tidstr, 'MOD');
updatemoderate('tid', $tids, 2);
}
}
if($pmlist) {
foreach($pmlist as $pm) {
$threadsubject = $pm['thread'];
$_G['tid'] = intval($pm['tid']);
notification_add($pm['authorid'], 'system', $pm['act'], $pm['notevar'], 1);
}
}
showmessage('modcp_mod_succeed', "{$cpscript}?mod=modcp&action={$_GET['action']}&op=$op&filter=$filter&fid={$_G['fid']}");
}
$modcount = C::t('common_moderate')->count_by_seach_for_thread($moderatestatus, ($modfids ? explode(',', $modfids) : null));
$multipage = multi($modcount, $_G['tpp'], $page, "{$cpscript}?mod=modcp&action={$_GET['action']}&op=$op&filter=$filter&fid={$_G['fid']}&showcensor={$_GET['showcensor']}");
if($modcount) {
$posttablearr = array();
foreach(C::t('common_moderate')->fetch_all_by_search_for_thread($moderatestatus, ($modfids ? explode(',', $modfids) : null), $start_limit, $_G['tpp']) as $thread) {
$thread['id'] = $thread['tid'];
if($thread['authorid'] && $thread['author'] != '') {
$thread['author'] = "<a href=\"home.php?mod=space&uid={$thread['authorid']}\" target=\"_blank\">{$thread['author']}</a>";
} elseif($thread['authorid']) {
$thread['author'] = "<a href=\"home.php?mod=space&uid={$thread['authorid']}\" target=\"_blank\">UID {$thread['uid']}</a>";
} else {
$thread['author'] = 'guest';
}
$thread['dateline'] = dgmdate($thread['dateline']);
$posttable = $thread['posttableid'] ? (string)$thread['posttableid'] : '0';
$posttablearr[$posttable][$thread['tid']] = $thread['tid'];
$postlist[$thread['tid']] = $thread;
}
$attachtablearr = array();
foreach($posttablearr as $posttable => $tids) {
foreach(C::t('forum_post')->fetch_all_by_tid($posttable, $tids, true, '', 0, 0, 1) as $post) {
$thread = $postlist[$post['tid']] + $post;
$thread['message'] = nl2br(dhtmlspecialchars($thread['message']));
if(!empty($_GET['showcensor'])) {
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
$censor->check($thread['subject']);
$censor->check($thread['message']);
$censor_words = $censor->words_found;
if(count($censor_words) > 3) {
$censor_words = array_slice($censor_words, 0, 3);
}
$thread['censorwords'] = implode(', ', $censor_words);
}
if($thread['attachment']) {
$attachtable = getattachtableid($thread['tid']);
$attachtablearr[$attachtable][$thread['tid']] = $thread['tid'];
} else {
$thread['attach'] = '';
}
if($thread['sortid']) {
require_once libfile('function/threadsort');
$threadsortshow = threadsortshow($thread['sortid'], $thread['tid']);
foreach($threadsortshow['optionlist'] as $option) {
$thread['sortinfo'] .= $option['title'].' '.$option['value']."<br />";
}
} else {
$thread['sortinfo'] = '';
}
$postlist[$post['tid']] = $thread;
}
}
if(!empty($attachtablearr)) {
require_once libfile('function/attachment');
foreach($attachtablearr as $attachtable => $tids) {
foreach(C::t('forum_attachment_n')->fetch_all_by_id($attachtable, 'tid', $tids) as $attach) {
$tid = $attach['tid'];
$_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
$attach['url'] = $attach['isimage']
? " {$attach['filename']} (".sizecount($attach['filesize']).")<br /><br /><img src=\"".$_G['setting']['attachurl']."forum/{$attach['attachment']}\" onload=\"if(this.width > 100) {this.resized=true; this.width=100;}\">"
: "<a href=\"".$_G['setting']['attachurl']."forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (".sizecount($attach['filesize']).")";
$postlist[$tid]['attach'] .= "<br /><br />{$lang['attachment']}: ".attachtype(fileext($attach['filename'])."\t").$attach['url'];
}
}
}
}
}
?>

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: modcp_noperm.php 6752 2010-03-25 08:47:54Z cnteacher $
*/
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
exit('Access Denied');
}
?>

View File

@@ -0,0 +1,18 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: modcp_plugin.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
exit('Access Denied');
}
$modtpl = $_GET['id'];
include pluginmodule($_GET['id'], 'modcp_'.$op);
?>

View File

@@ -0,0 +1,210 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: modcp_recyclebin.php 27222 2012-01-11 08:01:39Z monkey $
*/
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
exit('Access Denied');
}
$op = !in_array($op , array('list', 'delete', 'search', 'restore')) ? 'list' : $op;
$do = !empty($_GET['do']) ? dhtmlspecialchars($_GET['do']) : '';
$tidarray = array();
$action = $_GET['action'];
$result = array();
foreach (array('threadoption', 'viewsless', 'viewsmore', 'repliesless', 'repliesmore', 'noreplydays', 'typeid') as $key) {
$$key = isset($_GET[''.$key]) && is_numeric($_GET[''.$key]) ? intval($_GET[''.$key]) : '';
$result[$key] = $$key;
}
foreach (array('starttime', 'endtime', 'keywords', 'users') as $key) {
$$key = isset($_GET[''.$key]) ? trim($_GET[''.$key]) : '';
$result[$key] = isset($_GET[''.$key]) ? dhtmlspecialchars($_GET[''.$key]) : '';
}
$threadoptionselect = array('','','','','','', '', '', '', '', 999=>'', 888=>'');
$threadoptionselect[$threadoption] = 'selected';
$postlist = array();
$total = $multipage = '';
$cachekey = 'srchresult_recycle_thread'.$_G['fid'];
if($_G['fid'] && $_G['forum']['ismoderator'] && !empty($modforums['recyclebins'][$_G['fid']])) {
$srchupdate = false;
if(in_array($_G['adminid'], array(1, 2, 3)) && ($op == 'delete' || $op == 'restore') && submitcheck('dosubmit')) {
if(!empty($_GET['moderate'])) {
foreach(C::t('forum_thread')->fetch_all_by_tid_displayorder($_GET['moderate'], -1, '=', $_G['fid']) as $tid) {
$tidarray[] = $tid['tid'];
}
if($tidarray) {
if($op == 'delete' && $_G['group']['allowclearrecycle']) {
require_once libfile('function/delete');
deletethread($tidarray);
}
if($op == 'restore') {
require_once libfile('function/post');
undeletethreads($tidarray);
}
if($_GET['oldop'] == 'search') {
$srchupdate = true;
}
}
}
$op = dhtmlspecialchars($_GET['oldop']);
showmessage('modcp_recyclebin_'.$op.'_succeed', '', array(), array('break' => 1));
}
if($op == 'search' && submitcheck('searchsubmit')) {
$conditions = array();
if($threadoption > 0 && $threadoption < 255) {
$conditions['specialthread'] = 1;
$conditions['special'] = $threadoption;
} elseif($threadoption == 999) {
$conditions['digest'] = array(1,2,3);
} elseif($threadoption == 888) {
$conditions['sticky'] = 1;
}
$viewsless !== ''? $conditions['viewsless'] = $viewsless : '';
$viewsmore !== ''? $conditions['viewsmore'] = $viewsmore : '';
$repliesless !== ''? $conditions['repliesless'] = $repliesless : '';
$repliesmore !== ''? $conditions['repliesmore'] = $repliesmore : '';
$noreplydays !== ''? $conditions['noreplydays'] = $noreplydays : '';
$starttime != '' ? $conditions['starttime'] = $starttime : '';
$endtime != '' ? $conditions['endtime'] = $endtime : '';
if(trim($keywords)) {
$conditions['keywords'] = $keywords;
}
if(trim($users)) {
$conditions['users'] = trim($users);
}
if($_GET['typeid']) {
$conditions['intype'] = $_GET['typeid'];
}
if(!empty($conditions)) {
$tids = $comma = '';
$count = 0;
$conditions['fid'] = $_G['fid'];
$conditions['sticky'] = 3;
foreach(C::t('forum_thread')->fetch_all_search($conditions, 0, 0, 1000, 'lastpost') as $thread) {
$tids .= $comma.$thread['tid'];
$comma = ',';
$count ++;
}
$result['tids'] = $tids;
$result['count'] = $count;
$result['fid'] = $_G['fid'];
$modsession->set($cachekey, $result, true);
unset($result, $tids);
$page = 1;
} else {
$op = 'list';
}
}
$page = max(1, intval($_G['page']));
$total = 0;
$query = $multipage = '';
if($op == 'list') {
$total = C::t('forum_thread')->count_by_fid_typeid_displayorder($_G['fid'], $_GET['typeid'], -1);
$tpage = ceil($total / $_G['tpp']);
$page = min($tpage, $page);
$multipage = multi($total, $_G['tpp'], $page, "$cpscript?mod=modcp&action=$action&op=$op&fid={$_G['fid']}&do=$do");
if($total) {
$start = ($page - 1) * $_G['tpp'];
$threads = C::t('forum_thread')->fetch_all_by_fid_typeid_displayorder($_G['fid'], $_GET['typeid'], -1, '=', $start, $_G['tpp']);
}
}
if($op == 'search') {
$result = $modsession->get($cachekey);
if($result) {
if($srchupdate && $result['count'] && $tidarray) {
$td = explode(',', $result['tids']);
$newtids = $comma = $newcount = '';
if(is_array($td)) {
foreach ($td as $v) {
$v = intval($v);
if(!in_array($v, $tidarray)) {
$newcount ++;
$newtids .= $comma.$v;
$comma = ',';
}
}
$result['count'] = $newcount;
$result['tids'] = $newtids;
$modsession->set($cachekey, $result, true);
}
}
$threadoptionselect[$result['threadoption']] = 'selected';
$total = $result['count'];
$tpage = ceil($total / $_G['tpp']);
$page = min($tpage, $page);
$multipage = multi($total, $_G['tpp'], $page, "$cpscript?mod=modcp&action=$action&op=$op&fid={$_G['fid']}&do=$do");
if($total) {
$start = ($page - 1) * $_G['tpp'];
$threads = C::t('forum_thread')->fetch_all_by_tid_fid_displayorder(explode(',', $result['tids']), $_G['fid'], -1, 'lastpost', $start, $_G['tpp']);
}
}
}
$postlist = array();
if($threads) {
require_once libfile('function/misc');
foreach($threads as $thread) {
$post = procthread($thread);
$post['modthreadkey'] = modauthkey($post['tid']);
$postlist[$post['tid']] = $post;
}
if($postlist) {
$tids = array_keys($postlist);
foreach(C::t('forum_threadmod')->fetch_all_by_tid($tids) as $row) {
if(empty($postlist[$row['tid']]['reason'])) {
$postlist[$row['tid']]['reason'] = $row['reason'];
}
}
}
}
}
?>

View File

@@ -0,0 +1,165 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: modcp_recyclebinpost.php 27222 2012-01-11 08:01:39Z monkey $
*/
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
exit('Access Denied');
}
$op = !in_array($op , array('list', 'delete', 'search', 'restore')) ? 'list' : $op;
$do = !empty($_GET['do']) ? dhtmlspecialchars($_GET['do']) : '';
$pidarray = array();
$action = $_GET['action'];
$result = array();
foreach (array('starttime', 'endtime', 'keywords', 'users') as $key) {
$$key = isset($_GET[''.$key]) ? trim($_GET[''.$key]) : '';
$result[$key] = isset($_GET[''.$key]) ? dhtmlspecialchars($_GET[''.$key]) : '';
}
$postlist = array();
$total = $multipage = '';
$posttableid = intval(getgpc('posttableid'));
$posttableselect = getposttableselect();
$cachekey = 'srchresult_recycle_post_'.$posttableid.'_'.$_G['fid'];
if($_G['fid'] && $_G['forum']['ismoderator'] && !empty($modforums['recyclebins'][$_G['fid']])) {
$srchupdate = false;
if(in_array($_G['adminid'], array(1, 2, 3)) && ($op == 'delete' || $op == 'restore') && submitcheck('dosubmit')) {
if($ids = dimplode($_GET['moderate'])) {
$pidarray = array();
foreach(C::t('forum_post')->fetch_all_post($posttableid, $_GET['moderate'], false) as $post) {
if($post['fid'] != $_G['fid'] || $post['invisible'] != '-5') {
continue;
}
$pidarray[] = $post['pid'];
}
if($pidarray) {
require_once libfile('function/misc');
if ($op == 'delete' && $_G['group']['allowclearrecycle']){
recyclebinpostdelete($pidarray, $posttableid);
}
if ($op == 'restore') {
recyclebinpostundelete($pidarray, $posttableid);
}
if($_GET['oldop'] == 'search') {
$srchupdate = true;
}
}
}
$op = dhtmlspecialchars($_GET['oldop']);
showmessage('modcp_recyclebinpost_'.$op.'_succeed', '', array(), array('break' => 1));
}
if($op == 'search' && submitcheck('searchsubmit')) {
if($starttime || $endtime || trim($keywords) || trim($users)) {
$pids = array();
foreach(C::t('forum_post')->fetch_all_by_search($posttableid, null, $keywords, -5, null, null, ($users ? explode(',', str_replace(' ', '', trim($users))) : null), strtotime($starttime), strtotime($endtime), null, null, 0, 1000) as $value) {
$postlist[] = $value;
$pids[] = $value['pid'];
}
$result['pids'] = implode(',', $pids);
$result['count'] = count($pids);
$result['fid'] = $_G['fid'];
$result['posttableid'] = $posttableid;
$modsession->set($cachekey, $result, true);
unset($result, $pids);
$page = 1;
} else {
$op = 'list';
}
}
$page = max(1, intval($_G['page']));
$total = 0;
$query = $multipage = '';
$fields = 'message, useip, attachment, htmlon, smileyoff, bbcodeoff, pid, tid, fid, author, dateline, subject, authorid, anonymous';
if($op == 'list') {
$total = C::t('forum_post')->count_by_fid_invisible($posttableid, $_G['fid'], '-5');
$tpage = ceil($total / $_G['tpp']);
$page = min($tpage, $page);
$multipage = multi($total, $_G['tpp'], $page, "$cpscript?mod=modcp&action=$action&amp;op=$op&amp;fid={$_G['fid']}&amp;do=$do");
if($total) {
$start = ($page - 1) * $_G['tpp'];
foreach(C::t('forum_post')->fetch_all_by_fid($posttableid, $_G['fid'], true, 'DESC', $start, $_G['tpp'], null, '-5') as $value) {
$postlist[] = $value;
}
}
}
if($op == 'search') {
$result = $modsession->get($cachekey);
if($result) {
if($srchupdate && $result['count'] && $pidarray) {
$pd = explode(',', $result['pids']);
$newpids = $comma = $newcount = '';
if(is_array($pd)) {
foreach ($pd as $v) {
$v = intval($v);
if(!in_array($v, $pidarray)) {
$newcount ++;
$newpids .= $comma.$v; $comma = ',';
}
}
$result['count'] = $newcount;
$result['pids'] = $newpids;
$modsession->set($cachekey, $result, true);
}
}
$total = $result['count'];
$tpage = ceil($total / $_G['tpp']);
$page = min($tpage, $page);
$multipage = multi($total, $_G['tpp'], $page, "$cpscript?mod=modcp&action=$action&amp;op=$op&amp;fid={$_G['fid']}&amp;do=$do");
if($total) {
$start = ($page - 1) * $_G['tpp'];
$postlist = C::t('forum_post')->fetch_all_by_pid($posttableid, explode(',', $result['pids']), true, 'DESC', $start, $_G['tpp'], $_G['fid'], -5);
}
}
}
if($postlist) {
require_once libfile('function/misc');
require_once libfile('function/post');
require_once libfile('function/discuzcode');
foreach($postlist as $key => $post) {
$post['modthreadkey'] = modauthkey($post['tid']);
$post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], sprintf('%00b', $post['htmlon']), $_G['forum']['allowsmilies'], $_G['forum']['allowbbcode'], $_G['forum']['allowimgcode'], $_G['forum']['allowhtml']);
$post['message'] = preg_replace('/<a[^>]*>(.*?)<\/a>/i', '$1', $post['message']);
$post['dateline'] = dgmdate($post['dateline'], 'Y-m-d H:i:s');
$postlist[$key] = $post;
}
}
}
?>

View File

@@ -0,0 +1,68 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: modcp_report.php 29666 2012-04-24 08:07:56Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
exit('Access Denied');
}
if(!empty($_G['fid'])) {
$curcredits = $_G['setting']['creditstransextra'][8] ? $_G['setting']['creditstransextra'][8] : $_G['setting']['creditstrans'];
$report_reward = dunserialize($_G['setting']['report_reward']);
if(submitcheck('reportsubmit')) {
if($_GET['reportids']) {
foreach($_GET['reportids'] as $reportid) {
if(C::t('common_report')->fetch_count(0, $reportid)) {
$creditchange = '';
$uid = $_GET['reportuids'][$reportid];
if($uid != $_G['uid']) {
$msg = !empty($_GET['msg'][$reportid]) ? '<br />'.dhtmlspecialchars($_GET['msg'][$reportid]) : '';
if(!empty($_GET['creditsvalue'][$reportid])) {
$credittag = $_GET['creditsvalue'][$reportid] > 0 ? '+' : '';
if($report_reward['max'] < $_GET['creditsvalue'][$reportid] || $_GET['creditsvalue'][$reportid] < $report_reward['min']) {
showmessage('quickclear_noperm', "$cpscript?mod=modcp&action=report&fid={$_G['fid']}");
}
$creditchange = '<br />'.lang('forum/misc', 'report_msg_your').$_G['setting']['extcredits'][$curcredits]['title'].'&nbsp;'.$credittag.$_GET['creditsvalue'][$reportid];
updatemembercount($uid, array($curcredits => intval($_GET['creditsvalue'][$reportid])), true, 'RPC', $reportid);
}
if($creditchange || $msg) {
notification_add($uid, 'report', 'report_change_credits', array('creditchange' => $creditchange, 'msg' => $msg), 1);
}
}
$opresult = !empty($_GET['creditsvalue'][$reportid])? $curcredits."\t".intval($_GET['creditsvalue'][$reportid]) : 'ignore';
C::t('common_report')->update($reportid, array('opuid' => $_G['uid'], 'opname' => $_G['username'], 'optime' => TIMESTAMP, 'opresult' => $opresult));
}
}
showmessage('modcp_report_success', "$cpscript?mod=modcp&action=report&fid={$_G['fid']}&lpp=$lpp");
}
}
$rewardlist = '';
$offset = abs(ceil(($report_reward['max'] - $report_reward['min']) / 10));
if($report_reward['max'] > $report_reward['min']) {
for($vote = $report_reward['max']; $vote >= $report_reward['min']; $vote -= $offset) {
if($vote != 0) {
$rewardlist .= $vote ? '<option value="'.$vote.'">'.($vote > 0 ? '+'.$vote : $vote).'</option>' : '';
} else {
$rewardlist .= '<option value="0" selected>'.lang('forum/misc', 'report_noreward').'</option>';
}
}
}
$reportlist = array();
$lpp = empty($_GET['lpp']) ? 20 : intval($_GET['lpp']);
$lpp = min(200, max(5, $lpp));
$page = max(1, intval($_G['page']));
$start = ($page - 1) * $lpp;
$reportcount = C::t('common_report')->fetch_count(0, 0, $_G['fid']);
$query = C::t('common_report')->fetch_all_report($start, $lpp, 0, $_G['fid']);
foreach($query as $row) {
$row['dateline'] = dgmdate($row['dateline']);
$reportlist[] = $row;
}
$multipage = multi($reportcount, $lpp, $page, "$cpscript?mod=modcp&action=report&fid={$_G['fid']}&lpp=$lpp");
}
?>

View File

@@ -0,0 +1,377 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: modcp_thread.php 28845 2012-03-15 00:59:32Z monkey $
*/
if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
exit('Access Denied');
}
$op = !in_array($op , array('thread', 'post')) ? 'thread' : $op;
$do = getgpc('do') ? dhtmlspecialchars(getgpc('do')) : '';
$modtpl = $op == 'post' ? 'modcp_post' : 'modcp_thread';
$modtpl = 'forum/'.$modtpl;
$threadoptionselect = array('','','','','','', '', '', '', '', 999=>'', 888=>'');
$threadoptionselect[getgpc('threadoption')] = 'selected';
if($op == 'thread') {
$result = array();
foreach (array('threadoption', 'viewsless', 'viewsmore', 'repliesless', 'repliesmore', 'noreplydays', 'typeid') as $key) {
$_GET[''.$key] = isset($_GET[''.$key]) && is_numeric($_GET[''.$key]) ? intval($_GET[''.$key]) : '';
$result[$key] = $_GET[''.$key];
}
foreach (array('starttime', 'endtime', 'keywords', 'users') as $key) {
$result[$key] = isset($_GET[''.$key]) ? dhtmlspecialchars($_GET[''.$key]) : '';
}
if($_G['fid'] && $_G['forum']['ismoderator']) {
if($do == 'search' && submitcheck('submit', 1)) {
$conditions = array();
if($_GET['threadoption'] > 0 && $_GET['threadoption'] < 255) {
$conditions['specialthread'] = 1;
$conditions['special'] = $_GET['threadoption'];
} elseif($_GET['threadoption'] == 999) {
$conditions['digest'] = array(1,2,3);
} elseif($_GET['threadoption'] == 888) {
$conditions['sticky'] = 1;
}
$_GET['viewsless'] !== ''? $conditions['viewsless'] = $_GET['viewsless'] : '';
$_GET['viewsmore'] !== ''? $conditions['viewsmore'] = $_GET['viewsmore'] : '';
$_GET['repliesless'] !== ''? $conditions['repliesless'] = $_GET['repliesless'] : '';
$_GET['repliesmore'] !== ''? $conditions['repliesmore'] = $_GET['repliesmore'] : '';
$_GET['noreplydays'] !== ''? $conditions['noreplydays'] = $_GET['noreplydays'] : '';
$_GET['starttime'] != '' ? $conditions['starttime'] = $_GET['starttime'] : '';
$_GET['endtime'] != '' ? $conditions['endtime'] = $_GET['endtime'] : '';
if(trim($_GET['keywords'])) {
$conditions['keywords'] = $_GET['keywords'];
}
if(trim($_GET['users'])) {
$conditions['users'] = trim($_GET['users']);
}
if($_GET['typeid']) {
$conditions['intype'] = $_GET['typeid'];
}
if(!empty($conditions)) {
$conditions['inforum'] = $_G['fid'];
if(!isset($conditions['sticky'])) $conditions['sticky'] = 0;
$tids = $comma = '';
$count = 0;
foreach(C::t('forum_thread')->fetch_all_search($conditions, 0, 0, 1000, 'displayorder DESC, lastpost') as $thread) {
$tids .= $comma.$thread['tid'];
$comma = ',';
$count ++;
}
$result['tids'] = $tids;
$result['count'] = $count;
$result['fid'] = $_G['fid'];
$modsession->set('srchresult', $result, true);
unset($result, $tids);
$do = 'list';
$page = 1;
} else {
$do = '';
}
}
$page = $_G['page'];
$total = 0;
$query = $multipage = '';
if(empty($do)) {
$total = C::t('forum_thread')->count_by_fid_typeid_displayorder($_G['fid'], $_GET['typeid'], 0, '>=');
$tpage = ceil($total / $_G['tpp']);
$page = min($tpage, $page);
$multipage = multi($total, $_G['tpp'], $page, "$cpscript?mod=modcp&amp;action={$_GET['action']}&amp;op=$op&amp;fid={$_G['fid']}&amp;do=$do&amp;posttableid=".(isset($posttableid) ? $posttableid : ''));
if($total) {
$start = ($page - 1) * $_G['tpp'];
$threads = C::t('forum_thread')->fetch_all_by_fid_typeid_displayorder($_G['fid'], $_GET['typeid'], 0, '>=', $start, $_G['tpp']);
}
} else {
$result = $modsession->get('srchresult');
$threadoptionselect[$result['threadoption']] = 'selected';
if($result['fid'] == $_G['fid']) {
$total = $result['count'];
$tpage = ceil($total / $_G['tpp']);
$page = min($tpage, $page);
$multipage = multi($total, $_G['tpp'], $page, "$cpscript?mod=modcp&amp;action={$_GET['action']}&amp;op=$op&amp;fid={$_G['fid']}&amp;do=$do&amp;posttableid=$posttableid");
if($total) {
$start = ($page - 1) * $_G['tpp'];
$threads = C::t('forum_thread')->fetch_all_by_tid_fid_displayorder(explode(',', $result['tids']), null, null, 'lastpost', $start, $_G['tpp']);
}
}
}
$postlist = array();
if(!empty($threads)) {
require_once libfile('function/misc');
foreach($threads as $thread) {
$postlist[] = procthread($thread);
}
}
}
return;
}
if($op == 'post') {
$error = 0;
$result = array();
$_GET['starttime'] = !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", getgpc('starttime')) ? dgmdate(TIMESTAMP - 86400 * ($_G['adminid'] == 2 ? 13 : ($_G['adminid'] == 3 ? 6 : 60)), 'Y-m-d') : getgpc('starttime');
$_GET['endtime'] = $_G['adminid'] == 3 || !preg_match("/^(0|\d{4}\-\d{1,2}\-\d{1,2})$/", getgpc('endtime')) ? dgmdate(TIMESTAMP, 'Y-m-d') : getgpc('endtime');
foreach (array('threadoption', 'starttime', 'endtime', 'keywords', 'users', 'useip') as $key) {
$$key = isset($_GET[''.$key]) ? trim($_GET[''.$key]) : '';
$result[$key] = dhtmlspecialchars($$key);
}
$threadoptionselect = range(1, 3);
$posttableid = intval(getgpc('posttableid'));
$posttableselect = getposttableselect();
$cachekey = 'srchresult_p_'.$posttableid.'_'.$_G['fid'];
$fidadd = '';
$fidaddarr = array();
if($_G['fid'] && !empty($modforums['list'][$_G['fid']])) {
$fidaddarr = array($_G['fid']);
$fidadd = "AND fid='{$_G['fid']}'";
} else {
if($_G['adminid'] == 1 && $_G['adminid'] == $_G['groupid']) {
$fidadd = '';
} elseif(!$modforums['fids']) {
$fidaddarr = array(0);
$fidadd = 'AND 0 ';
} else {
$fidaddarr = explode(',', $modforums['fids']);
$fidadd = "AND fid in({$modforums['fids']})";
}
}
if($do == 'delete' && submitcheck('deletesubmit')) {
if(!$_G['group']['allowmassprune']) {
$error = 4;
return;
}
$pidsdelete = $tidsdelete = array();
$prune = array('forums' => array(), 'thread' => array());
if($pids = dimplode($_GET['delete'])) {
$result = $modsession->get($cachekey);
$result['pids'] = explode(',', $result['pids']);
$keys = array_flip($result['pids']);
foreach(C::t('forum_post')->fetch_all_post($posttableid, $_GET['delete'], false) as $post) {
if($fidaddarr && !in_array($post['fid'], $fidaddarr)) {
continue;
}
$prune['forums'][$post['fid']] = $post['fid'];
$pidsdelete[$post['fid']][$post['pid']] = $post['pid'];
$pids_tids[$post['pid']] = $post['tid'];
if($post['first']) {
$tidsdelete[$post['pid']] = $post['tid'];
} else {
@$prune['thread'][$post['tid']]++;
}
$key = $keys[$post['pid']];
unset($result['pids'][$key]);
}
$result['count'] = count($result['pids']);
$result['pids'] = implode(',', $result['pids']);
$modsession->set($cachekey, $result, true);
unset($result);
}
if($pidsdelete) {
require_once libfile('function/post');
require_once libfile('function/delete');
$forums = C::t('forum_forum')->fetch_all($prune['forums']);
foreach($pidsdelete as $fid => $pids) {
foreach($pids as $pid) {
if(!$tidsdelete[$pid]) {
$deletedposts = deletepost(array($pid), 'pid', !getgpc('nocredit'), $posttableid, $forums[$fid]['recyclebin']);
updatemodlog($pids_tids[$pid], 'DLP');
} else {
$deletedthreads = deletethread(array($tidsdelete[$pid]), false, !getgpc('nocredit'), $forums[$fid]['recyclebin']);
updatemodlog($tidsdelete[$pid], 'DEL');
}
}
}
if(count($prune['thread']) < 50) {
foreach($prune['thread'] as $tid => $decrease) {
updatethreadcount($tid);
}
} else {
$repliesarray = array();
foreach($prune['thread'] as $tid => $decrease) {
$repliesarray[$decrease][] = $tid;
}
foreach($repliesarray as $decrease => $tidarray) {
C::t('forum_thread')->increase($tidarray, array('replies'=>-$decrease));
}
}
foreach(array_unique($prune['forums']) as $id) {
updateforumcount($id);
}
}
$do = 'list';
showmessage('modcp_thread_delete_succeed', '', array(), array('break' => 1));
}
if($do == 'search' && submitcheck('searchsubmit', 1)) {
if(($starttime == '0' && $endtime == '0') || ($keywords == '' && $useip == '' && $users == '')) {
$error = 1;
return ;
}
$sql = '';
if($threadoption == 1) {
$first = 1;
} elseif($threadoption == 2) {
$first = 0;
}
if($starttime != '0') {
$starttime = strtotime($starttime);
}
if($_G['adminid'] == 1 && $endtime != dgmdate(TIMESTAMP, 'Y-m-d')) {
if($endtime != '0') {
$endtime = strtotime($endtime);
}
} else {
$endtime = TIMESTAMP;
}
if(($_G['adminid'] == 2 && $endtime - $starttime > 86400 * 14) || ($_G['adminid'] == 3 && $endtime - $starttime > 86400 * 7)) {
$error = '2';
return;
}
if($users != '') {
$uids = C::t('common_member')->fetch_all_uid_by_username(array_map('trim', explode(',', $users)));
if(!$uids) {
$uids = array(0);
}
}
if(trim($keywords)) {
foreach(explode(',', str_replace(' ', '', $keywords)) as $value) {
if(strlen($value) <= 3) {
$error = 3;
return;
}
}
}
$useip = trim($useip);
if($useip != '') {
$useip = str_replace('*', '%', $useip);
}
if($uids || $keywords || $useip) {
$pids = array();
foreach(C::t('forum_post')->fetch_all_by_search($posttableid, null, $keywords, 0, $fidaddarr, $uids, null, $starttime, $endtime, $useip, $first, 0, 1000) as $post) {
$pids[] = $post['pid'];
}
$result['pids'] = implode(',', $pids);
$result['count'] = count($pids);
$result['fid'] = $_G['fid'];
$result['posttableid'] = $posttableid;
$modsession->set($cachekey, $result, true);
unset($result, $pids);
$do = 'list';
$page = 1;
} else {
$do = '';
}
}
$page = max(1, intval($_G['page']));
$total = 0;
$query = $multipage = '';
if($do == 'list') {
$postarray = array();
$result = $modsession->get($cachekey);
$threadoptionselect[$result['threadoption']] = 'selected';
if($result['fid'] == $_G['fid']) {
$total = $result['count'];
$tpage = ceil($total / $_G['tpp']);
$page = min($tpage, $page);
$multipage = multi($total, $_G['tpp'], $page, "$cpscript?mod=modcp&amp;action={$_GET['action']}&amp;op=$op&amp;fid={$_G['fid']}&amp;do=$do&amp;posttableid=$posttableid");
if($total && $result['pids']) {
$start = ($page - 1) * $_G['tpp'];
$tids = array();
$postlist = C::t('forum_post')->fetch_all_by_pid($result['posttableid'], explode(',', $result['pids']), true, 'DESC', $start, $_G['tpp']);
foreach($postlist as $post) {
$tids[$post['tid']] = $post['tid'];
}
$threadlist = C::t('forum_thread')->fetch_all($tids);
foreach($postlist as $post) {
$post['tsubject'] = $threadlist[$post['tid']]['subject'];
$postarray[] = $post;
}
unset($threadlist, $postlist, $tids);
}
}
}
$postlist = array();
if(!empty($postarray)) {
require_once libfile('function/post');
foreach($postarray as $post) {
$post['dateline'] = dgmdate($post['dateline']);
$post['message'] = messagecutstr($post['message'], 200);
$post['forum'] = $modforums['list'][$post['fid']];
$post['modthreadkey'] = modauthkey($post['tid']);
$postlist[] = $post;
}
}
}
?>

View File

View File

@@ -0,0 +1,786 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: portalcp_article.php 36278 2016-12-09 07:52:35Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$op = in_array($_GET['op'], array('edit', 'delete', 'related', 'batch', 'pushplus', 'verify', 'checkhtmlname')) ? $_GET['op'] : 'add';
$aid = intval($_GET['aid']);
$catid = intval($_GET['catid']);
list($seccodecheck, $secqaacheck) = seccheck('publish');
$article = $article_content = array();
if($aid) {
$article = C::t('portal_article_title')->fetch($aid);
if(!$article) {
showmessage('article_not_exist', dreferer());
}
}
loadcache('portalcategory');
$portalcategory = $_G['cache']['portalcategory'];
if($catid && empty($portalcategory[$catid])) {
showmessage('portal_category_not_find', dreferer());
}
if(empty($article) && $catid && $portalcategory[$catid]['disallowpublish']) {
showmessage('portal_category_disallowpublish', dreferer());
}
if(empty($catid) && $article) {
$catid = $article['catid'];
}
$htmlstatus = !empty($_G['setting']['makehtml']['flag']) && $portalcategory[$catid]['fullfoldername'];
if(submitcheck("articlesubmit", 0, $seccodecheck, $secqaacheck)) {
if($aid) {
check_articleperm($article['catid'], $aid, $article);
} else {
check_articleperm($catid);
}
$_POST['title'] = getstr(trim($_POST['title']), $_G['setting']['maxsubjectsize']);
if(strlen($_POST['title']) < 1 || dstrlen($_POST['title']) < $_G['setting']['minsubjectsize']) {
showmessage('title_not_too_little');
}
$_POST['title'] = censor($_POST['title'], NULL, FALSE, FALSE);
$_POST['pagetitle'] = getstr(trim($_POST['pagetitle']), 60);
$_POST['pagetitle'] = censor($_POST['pagetitle'], NULL, FALSE, FALSE);
$htmlname = basename(trim($_POST['htmlname']));
$highlight_style = $_GET['highlight_style'];
$style = '';
$style = implode('|',$highlight_style);
if(empty($_POST['summary'])) $_POST['summary'] = preg_replace("/(\s|\<strong\>##########NextPage(\[title=.*?\])?##########\<\/strong\>)+/", ' ', $_POST['content']);
$summary = portalcp_get_summary($_POST['summary']);
$summary = censor($summary, NULL, FALSE, FALSE);
$_GET['author'] = dhtmlspecialchars($_GET['author']);
$_GET['url'] = str_replace('&amp;', '&', dhtmlspecialchars($_GET['url']));
$_GET['from'] = dhtmlspecialchars($_GET['from']);
$_GET['fromurl'] = str_replace('&amp;', '&', dhtmlspecialchars($_GET['fromurl']));
$_GET['dateline'] = !empty($_GET['dateline']) ? strtotime($_GET['dateline']) : TIMESTAMP;
if(!preg_match('/^https?:\/\//is', $_GET['url'])) {
$_GET['url'] = '';
}
if(!preg_match('/^https?:\/\//is', $_GET['fromurl'])) {
$_GET['fromurl'] = '';
}
if(censormod($_POST['title']) || $_G['group']['allowpostarticlemod']) {
$article_status = 1;
} else {
$article_status = 0;
}
$setarr = array(
'title' => $_POST['title'],
'author' => $_GET['author'],
'from' => $_GET['from'],
'fromurl' => $_GET['fromurl'],
'dateline' => intval($_GET['dateline']),
'url' => $_GET['url'],
'allowcomment' => !empty($_POST['forbidcomment']) ? '0' : '1',
'summary' => $summary,
'catid' => intval($_POST['catid']),
'tag' => article_make_tag($_POST['tag']),
'status' => $article_status,
'highlight' => $style,
'showinnernav' => empty($_POST['showinnernav']) ? '0' : '1',
);
if(empty($setarr['catid'])) {
showmessage('article_choose_system_category');
}
if($_GET['conver']) {
$converfiles = dunserialize($_GET['conver']);
$setarr['pic'] = $converfiles['pic'];
$setarr['thumb'] = intval($converfiles['thumb']);
$setarr['remote'] = intval($converfiles['remote']);
}
$id = 0;
$idtype = '';
if(empty($article)) {
$setarr['uid'] = $_G['uid'];
$setarr['username'] = $_G['username'];
$setarr['id'] = intval($_POST['id']);
$setarr['htmlname'] = $htmlname;
$table = '';
if($setarr['id']) {
if($_POST['idtype']=='blogid') {
$table = 'home_blogfield';
$setarr['idtype'] = 'blogid';
$id = $setarr['id'];
$idtype = $setarr['idtype'];
} else {
$table = 'forum_thread';
$setarr['idtype'] = 'tid';
require_once libfile('function/discuzcode');
$id = C::t('forum_post')->fetch_threadpost_by_tid_invisible($setarr['id']);
$id = $id['pid'];
$idtype = 'pid';
}
}
$aid = C::t('portal_article_title')->insert($setarr, 1);
if($table) {
if($_POST['idtype']=='blogid') {
C::t('home_blogfield')->update($setarr['id'], array('pushedaid' => $aid));
} elseif($setarr['idtype']=='tid') {
$modarr = array(
'tid' => $setarr['id'],
'uid' => $_G['uid'],
'username' => $_G['username'],
'dateline' => TIMESTAMP,
'action' => 'PTA',
'status' => '1',
'stamp' => '',
);
C::t('forum_threadmod')->insert($modarr);
C::t('forum_thread')->update($setarr['id'], array('moderated' => 1, 'pushedaid' => $aid));
}
}
C::t('common_member_status')->update($_G['uid'], array('lastpost' => TIMESTAMP), 'UNBUFFERED');
C::t('portal_category')->increase($setarr['catid'], array('articles' => 1));
C::t('portal_category')->update($setarr['catid'], array('lastpublish' => TIMESTAMP));
C::t('portal_article_count')->insert(array('aid'=>$aid, 'catid'=>$setarr['catid'], 'viewnum'=>1));
} else {
if($htmlname && $article['htmlname'] !== $htmlname) {
$setarr['htmlname'] = $htmlname;
$oldarticlename = $article['htmldir'].$article['htmlname'];
unlink($oldarticlename.'.'.$_G['setting']['makehtml']['extendname']);
for($i = 1; $i < $article['contents']; $i++) {
unlink($oldarticlename.$i.'.'.$_G['setting']['makehtml']['extendname']);
}
}
C::t('portal_article_title')->update($aid, $setarr);
}
$content = getstr($_POST['content'], 0, 0, 0, 0, 1);
$content = censor($content, NULL, FALSE, FALSE);
if(censormod($content) || $_G['group']['allowpostarticlemod']) {
$article_status = 1;
} else {
$article_status = 0;
}
$regexp = '/(\<strong\>##########NextPage(\[title=(.*?)\])?##########\<\/strong\>)+/is';
preg_match_all($regexp, $content ,$arr);
$pagetitle = !empty($arr[3]) ? $arr[3] : array();
$pagetitle = array_map('trim', $pagetitle);
array_unshift($pagetitle, $_POST['pagetitle']);
$contents = preg_split($regexp, $content);
$cpostcount = count($contents);
$dbcontents = C::t('portal_article_content')->fetch_all_by_aid($aid);
$pagecount = $cdbcount = count($dbcontents);
if($cdbcount > $cpostcount) {
$cdelete = array();
foreach(array_splice($dbcontents, $cpostcount) as $value) {
$cdelete[$value['cid']] = $value['cid'];
}
if(!empty($cdelete)) {
C::t('portal_article_content')->delete($cdelete);
}
$pagecount = $cpostcount;
}
foreach($dbcontents as $key => $value) {
C::t('portal_article_content')->update($value['cid'], array('title' => $pagetitle[$key], 'content' => $contents[$key], 'pageorder' => $key+1));
unset($pagetitle[$key], $contents[$key]);
}
if($cdbcount < $cpostcount) {
foreach($contents as $key => $value) {
C::t('portal_article_content')->insert(array('aid' => $aid, 'id' => $setarr['id'], 'idtype' => $setarr['idtype'], 'title' => $pagetitle[$key], 'content' => $contents[$key], 'pageorder' => $key+1, 'dateline' => TIMESTAMP));
}
$pagecount = $cpostcount;
}
$updatearticle = array('contents' => $pagecount);
if($article_status == 1) {
$updatearticle['status'] = 1;
updatemoderate('aid', $aid);
manage_addnotify('verifyarticle');
}
$updatearticle = array_merge($updatearticle, portalcp_article_pre_next($catid, $aid));
C::t('portal_article_title')->update($aid, $updatearticle);
$newaids = array();
$_POST['attach_ids'] = explode(',', $_POST['attach_ids']);
foreach ($_POST['attach_ids'] as $newaid) {
$newaid = intval($newaid);
if($newaid) $newaids[$newaid] = $newaid;
}
if($newaids) {
C::t('portal_attachment')->update_to_used($newaids, $aid);
}
addrelatedarticle($aid, $_POST['raids']);
if($_GET['from_idtype'] && $_GET['from_id']) {
$id = intval($_GET['from_id']);
$notify = array();
switch ($_GET['from_idtype']) {
case 'blogid':
$blog = C::t('home_blog')->fetch($id);
if(!empty($blog)) {
$notify = array(
'url' => "home.php?mod=space&uid={$blog['uid']}&do=blog&id=$id",
'subject' => $blog['subject']
);
$touid = $blog['uid'];
}
break;
case 'tid':
$thread = C::t('forum_thread')->fetch_thread($id);
if(!empty($thread)) {
$notify = array(
'url' => "forum.php?mod=viewthread&tid=$id",
'subject' => $thread['subject']
);
$touid = $thread['authorid'];
}
break;
}
if(!empty($notify)) {
$notify['newurl'] = 'portal.php?mod=view&aid='.$aid;
notification_add($touid, 'pusearticle', 'puse_article', $notify, 1);
}
}
if(trim($_GET['from']) != '') {
$from_cookie = '';
$from_cookie_array = array();
$from_cookie = getcookie('from_cookie');
$from_cookie_array = explode("\t", $from_cookie);
$from_cookie_array[] = $_GET['from'];
$from_cookie_array = array_unique($from_cookie_array);
$from_cookie_array = array_filter($from_cookie_array);
$from_cookie_num = count($from_cookie_array);
$from_cookie_start = $from_cookie_num - 10;
$from_cookie_start = $from_cookie_start > 0 ? $from_cookie_start : 0;
$from_cookie_array = array_slice($from_cookie_array, $from_cookie_start, $from_cookie_num);
$from_cookie = implode("\t", $from_cookie_array);
dsetcookie('from_cookie', $from_cookie);
}
dsetcookie('clearUserdata', 'home');
$op = 'add_success';
$article_add_url = 'portal.php?mod=portalcp&ac=article&catid='.$catid;
$article = C::t('portal_article_title')->fetch($aid);
$viewarticleurl = $_POST['url'] ? "portal.php?mod=list&catid={$_POST['catid']}" : fetch_article_url($article);
include_once template("portal/portalcp_article");dexit();
} elseif(submitcheck('pushplussubmit')) {
if($aid) {
check_articleperm($article['catid'], $aid, $article);
} else {
showmessage('no_article_specified_for_pushplus', dreferer());
}
$tourl = !empty($_POST['toedit']) ? 'portal.php?mod=portalcp&ac=article&op=edit&aid='.$aid : dreferer();
$pids = (array)$_POST['pushpluspids'];
$posts = array();
$tid = intval($_GET['tid']);
if($tid && $pids) {
foreach(C::t('forum_post')->fetch_all_post('tid:'.$tid, $pids) as $value) {
if($value['tid'] != $tid) {
continue;
}
$posts[$value['pid']] = $value;
}
}
if(empty($posts)) {
showmessage('no_posts_for_pushplus', dreferer());
}
$pageorder = C::t('portal_article_content')->fetch_max_pageorder_by_aid($aid);
$pageorder = intval($pageorder + 1);
$inserts = array();
foreach($posts as $post) {
$summary = portalcp_get_postmessage($post);
$summary .= lang('portalcp', 'article_pushplus_info', array('author'=>$post['author'], 'url'=>'forum.php?mod=redirect&goto=findpost&ptid='.$post['tid'].'&pid='.$post['pid']));
$inserts[] = array('aid'=>$aid, 'content'=>$summary, 'pageorder'=>$pageorder, 'dateline'=>$_G['timestamp'], 'id'=>$post['pid'], 'idtype' =>'pid');
$pageorder++;
}
C::t('portal_article_content')->insert_batch($inserts);
$pluscount = C::t('portal_article_content')->count_by_aid($aid);
C::t('portal_article_title')->update($aid, array('contents' => $pluscount, 'owncomment' => 1));
$commentnum = C::t('portal_comment')->count_by_id_idtype($aid, 'aid');
C::t('portal_article_count')->update($aid, array('commentnum'=>intval($commentnum)));
showmessage('pushplus_do_success', $tourl, array(), array('header'=>1, 'refreshtime'=>0));
} elseif(submitcheck('verifysubmit')) {
if($aid) {
check_articleperm($article['catid'], $aid, $article, true);
} else {
showmessage('article_not_exist', dreferer());
}
if($_POST['status'] == '0') {
C::t('portal_article_title')->update($aid, array('status'=>'0'));
updatemoderate('aid', $aid, 2);
$tourl = dreferer(fetch_article_url($article));
showmessage('article_passed', $tourl);
} elseif($_POST['status'] == '2') {
C::t('portal_article_title')->update($aid, array('status'=>'2'));
updatemoderate('aid', $aid, 1);
$tourl = dreferer(fetch_article_url($article));
showmessage('article_ignored', $tourl);
} elseif($_POST['status'] == '-1') {
include_once libfile('function/delete');
deletearticle(array($aid), 0);
updatemoderate('aid', $aid, 2);
$tourl = dreferer('portal.php?mod=portalcp&catid='.$article['catid']);
showmessage('article_deleted', $tourl);
} else {
showmessage('select_operation');
}
}
if($op == 'delete') {
if(!$aid) {
showmessage('article_edit_nopermission');
}
check_articleperm($article['catid'], $aid, $article);
if(submitcheck('deletesubmit')) {
include_once libfile('function/delete');
$article = deletearticle(array(intval($_POST['aid'])), intval($_POST['optype']));
showmessage('article_delete_success', "portal.php?mod=list&catid={$article[0]['catid']}");
}
} elseif($op == 'related') {
$raid = intval($_GET['raid']);
$ra = array();
if($raid) {
$ra = C::t('portal_article_title')->fetch($raid);
}
} elseif($op == 'batch') {
check_articleperm($catid);
$aids = $_POST['aids'];
$optype = $_POST['optype'];
if(empty($optype) || $optype == 'push') showmessage('article_action_invalid');
$aids = array_map('intval', $aids);
$aids = array_filter($aids);
if(empty($aids)) showmessage('article_not_choose');
if (submitcheck('batchsubmit')) {
if ($optype == 'trash' || $optype == 'delete') {
require_once libfile('function/delete');
$istrash = $optype == 'trash' ? 1 : 0;
$article = deletearticle($aids, $istrash);
showmessage('article_delete_success', dreferer("portal.php?mod=portalcp&ac=category&catid={$article[0]['catid']}"));
} elseif($optype == 'move') {
if($catid) {
$categoryUpdate = array();
foreach(C::t('portal_article_title')->fetch_all($aids) as $s_article) {
$categoryUpdate[$s_article['catid']] = $categoryUpdate[$s_article['catid']] ? --$categoryUpdate[$s_article['catid']] : -1;
$categoryUpdate[$catid] = $categoryUpdate[$catid] ? ++$categoryUpdate[$catid] : 1;
}
foreach($categoryUpdate as $scatid=>$scatnum) {
if($scatnum) {
C::t('portal_category')->increase($scatid, array('articles' => $scatnum));
}
}
C::t('portal_article_title')->update($aids, array('catid'=>$catid));
showmessage('article_move_success', dreferer("portal.php?mod=portalcp&ac=category&catid=$catid"));
} else {
showmessage('article_move_select_cat', dreferer());
}
}
}
} elseif($op == 'verify') {
if($aid) {
check_articleperm($article['catid'], $aid, $article);
} else {
showmessage('article_not_exist', dreferer());
}
} elseif($op == 'pushplus') {
if($aid) {
check_articleperm($article['catid'], $aid, $article);
} else {
showmessage('no_article_specified_for_pushplus', dreferer());
}
$pids = (array)$_POST['topiclist'];
$tid = intval($_GET['tid']);
$pushedids = array();
$pushcount = $pushedcount = 0;
if(!empty($pids)) {
foreach(C::t('portal_article_content')->fetch_all_by_aid($aid) as $value) {
$pushedids[] = intval($value['id']);
$pushedcount++;
}
$pids = array_diff($pids, $pushedids);
}
$pushcount = count($pids);
if(empty($pids)) {
showmessage($pushedids ? 'all_posts_pushed_already' : 'no_posts_for_pushplus');
}
} else if($op == 'checkhtmlname') {
$htmlname = basename(trim($_GET['htmlname']));
if($htmlstatus) {
$_time = !empty($article) ? $article['dateline'] : TIMESTAMP;
if(file_exists(helper_makehtml::fetch_dir($portalcategory[$catid]['fullfoldername'], $_time).$htmlname.'.'.$_G['setting']['makehtml']['extendname'])) {
showmessage('html_existed');
} else {
showmessage('html_have_no_exists');
}
} else {
showmessage('make_html_closed');
}
} else {
if(empty($_G['cache']['portalcategory'])) {
showmessage('portal_has_not_category');
}
if(!checkperm('allowmanagearticle') && !checkperm('allowpostarticle')) {
$allowcategorycache = array();
if($allowcategory = getallowcategory($_G['uid'])) {
foreach($allowcategory as $catid => $category) {
$allowcategorycache[$catid] = $_G['cache']['portalcategory'][$catid];
}
}
foreach($allowcategorycache as &$_value) {
if($_value['upid'] && !isset($allowcategorycache[$_value['upid']])) {
$_value['level'] = 0;
}
}
$_G['cache']['portalcategory'] = $allowcategorycache;
}
if(empty($_G['cache']['portalcategory'])) {
showmessage('portal_article_add_nopermission');
}
$category = $_G['cache']['portalcategory'];
$cate = $category[$catid];
$categoryselect = category_showselect('portal', 'catid', true, !empty($article['catid']) ? $article['catid'] : $catid);
if($aid) {
$catid = intval($article['catid']);
}
if($aid && $article['highlight']) {
$stylecheck = '';
$stylecheck = explode('|', $article['highlight']);
}
$from_cookie_str = '';
$from_cookie = array();
$from_cookie_str = stripcslashes(getcookie('from_cookie'));
$from_cookie = explode("\t", $from_cookie_str);
$from_cookie = array_filter($from_cookie);
if($article) {
foreach(C::t('portal_article_content')->fetch_all_by_aid($aid) as $key => $value) {
$nextpage = '';
if($key > 0) {
$pagetitle = $value['title'] ? '[title='.$value['title'].']' : '';
$nextpage = "\r\n".'<strong>##########NextPage'.$pagetitle.'##########</strong>';
} else {
$article_content['title'] = $value['title'];
}
$article_content['content'] .= $nextpage.$value['content'];
}
$article_content['content'] = dhtmlspecialchars($article_content['content']);
$article['attach_image'] = $article['attach_file'] = '';
foreach(C::t('portal_attachment')->fetch_all_by_aid($aid) as $value) {
if($value['isimage']) {
if($article['pic']) {
$value['pic'] = $article['pic'];
}
} else {
}
$attachs[] = $value;
}
if($article['idtype'] == 'tid') {
foreach(C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$article['id'], 'tid', $article['id']) as $value) {
if($value['isimage']) {
if($article['pic']) {
$value['pic'] = $article['pic'];
}
$value['attachid'] = $value['aid'];
} else {
}
$value['from'] = 'forum';
$attachs[] = $value;
}
}
if($article['pic']) {
$article['conver'] = addslashes(serialize(array('pic'=>$article['pic'], 'thumb'=>$article['thumb'], 'remote'=>$article['remote'])));
}
$article['related'] = array();
if(($relateds = C::t('portal_article_related')->fetch_all_by_aid($aid))) {
foreach(C::t('portal_article_title')->fetch_all(array_keys($relateds)) as $raid=>$value) {
$article['related'][$raid] = $value['title'];
}
}
}
$_GET['from_id'] = empty ($_GET['from_id'])?0:intval($_GET['from_id']);
if($_GET['from_idtype'] != 'blogid') $_GET['from_idtype'] = 'tid';
$idtypes = array($_GET['from_idtype'] => ' selected');
if($_GET['from_idtype'] && $_GET['from_id']) {
$havepush = C::t('portal_article_title')->fetch_count_for_idtype($_GET['from_id'], $_GET['from_idtype']);
if($havepush) {
if($_GET['from_idtype'] == 'blogid') {
showmessage('article_push_blogid_invalid_repeat', '', array(), array('return'=>true));
} else {
showmessage('article_push_tid_invalid_repeat', '', array(), array('return'=>true));
}
}
switch ($_GET['from_idtype']) {
case 'blogid':
$blog = array_merge(
C::t('home_blog')->fetch($_GET['from_id']),
C::t('home_blogfield')->fetch($_GET['from_id'])
);
if($blog) {
if($blog['friend']) {
showmessage('article_push_invalid_private');
}
$article['title'] = getstr($blog['subject'], 0);
$article['summary'] = portalcp_get_summary($blog['message']);
$article['fromurl'] = 'home.php?mod=space&uid='.$blog['uid'].'&do=blog&id='.$blog['blogid'];
$article['author'] = $blog['username'];
$article_content['content'] = dhtmlspecialchars($blog['message']);
}
break;
default:
$posttable = getposttablebytid($_GET['from_id']);
$thread = C::t('forum_thread')->fetch_thread($_GET['from_id']);
$thread = array_merge($thread, C::t('forum_post')->fetch_threadpost_by_tid_invisible($_GET['from_id']));
if($thread) {
$article['title'] = $thread['subject'];
$thread['message'] = portalcp_get_postmessage($thread, $_GET['getauthorall']);
$article['summary'] = portalcp_get_summary($thread['message']);
$article['fromurl'] = 'forum.php?mod=viewthread&tid='.$thread['tid'];
$article['author'] = $thread['author'];
$article_content['content'] = dhtmlspecialchars($thread['message']);
$article['attach_image'] = $article['attach_file'] = '';
foreach(C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$thread['tid'], 'pid', $thread['pid'], 'aid DESC') as $attach) {
$attachcode = '[attach]'.$attach['aid'].'[/attach]';
if(!strexists($article_content['content'], $attachcode)) {
$article_content['content'] .= '<br /><br />'.$attachcode;
}
if($attach['isimage']) {
if($article['pic']) {
$attach['pic'] = $article['pic'];
}
} else {
}
$attach['from'] = 'forum';
$attachs[] = $attach;
}
}
break;
}
}
if(!empty($article['dateline'])) {
$article['dateline'] = dgmdate($article['dateline']);
}
if(!empty($attachs)) {
$article['attachs'] = get_upload_content($attachs);
}
$article_tags = article_parse_tags($article['tag']);
$tag_names = article_tagnames();
}
require_once libfile('function/upload');
$swfconfig = getuploadconfig($_G['uid'], 0, false);
require_once libfile('function/spacecp');
$albums = getalbums($_G['uid']);
include_once template("portal/portalcp_article");
function portalcp_get_summary($message) {
$message = preg_replace(array("/\[attach\].*?\[\/attach\]/", "/\&[a-z]+\;/i", "/\<script.*?\<\/script\>/"), '', $message);
$message = preg_replace("/\[.*?\]/", '', $message);
$message = getstr(strip_tags($message), 200);
return $message;
}
function portalcp_get_postmessage($post, $getauthorall = '') {
global $_G;
$forum = C::t('forum_forum')->fetch($post['fid']);
require_once libfile('function/discuzcode');
$language = lang('forum/misc');
if($forum['type'] == 'sub' && $forum['status'] == 3) {
loadcache('grouplevels');
$grouplevel = $_G['grouplevels'][$forum['level']];
$group_postpolicy = $grouplevel['postpolicy'];
if(is_array($group_postpolicy)) {
$forum = array_merge($forum, $group_postpolicy);
}
}
$post['message'] = preg_replace($language['post_edit_regexp'], '', $post['message']);
$_message = '';
if($getauthorall) {
foreach(C::t('forum_post')->fetch_all_by_tid('tid:'.$post['tid'], $post['tid'], true, '', 0, 0, null, null, $post['authorid']) as $value){
if(!$value['first']) {
$value['message'] = preg_replace("/\s?\[quote\][\n\r]*(.+?)[\n\r]*\[\/quote\]\s?/is", '', $value['message']);
$value['message'] = discuzcode($value['message'], $value['smileyoff'], $value['bbcodeoff'], $value['htmlon'] & 1, $forum['allowsmilies'], $forum['allowbbcode'], ($forum['allowimgcode'] && $_G['setting']['showimages'] ? 1 : 0), $forum['allowhtml'], 0, 0, $value['authorid'], $forum['allowmediacode'], $value['pid']);
portalcp_parse_postattch($value);
$_message .= '<br /><br />'.$value['message'];
}
}
}
$msglower = strtolower($post['message']);
if(strpos($msglower, '[/media]') !== FALSE) {
$post['message'] = preg_replace_callback("/\[media=([\w%,]+)\]\s*([^\[\<\r\n]+?)\s*\[\/media\]/is", 'portalcp_get_postmessage_callback_parsearticlemedia_12', $post['message']);
}
if(strpos($msglower, '[/audio]') !== FALSE) {
$post['message'] = preg_replace_callback("/\[audio(=1)*\]\s*([^\[\<\r\n]+?)\s*\[\/audio\]/is", 'portalcp_get_postmessage_callback_parsearticlemedia_2', $post['message']);
}
if(strpos($msglower, '[/flash]') !== FALSE) {
$post['message'] = preg_replace_callback("/\[flash(=(\d+),(\d+))?\]\s*([^\[\<\r\n]+?)\s*\[\/flash\]/is", 'portalcp_get_postmessage_callback_parsearticlemedia_4', $post['message']);
}
$post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], $post['htmlon'] & 1, $forum['allowsmilies'], $forum['allowbbcode'], ($forum['allowimgcode'] && $_G['setting']['showimages'] ? 1 : 0), $forum['allowhtml'], 0, 0, $post['authorid'], $forum['allowmediacode'], $post['pid']);
portalcp_parse_postattch($post);
if(strpos($post['message'], '[/flash1]') !== FALSE) {
$post['message'] = str_replace('[/flash1]', '[/flash]', $post['message']);
}
return $post['message'].$_message;
}
function portalcp_get_postmessage_callback_parsearticlemedia_12($matches) {
return parsearticlemedia($matches[1], $matches[2]);
}
function portalcp_get_postmessage_callback_parsearticlemedia_2($matches) {
return parsearticlemedia('mid,0,0', $matches[2]);
}
function portalcp_get_postmessage_callback_parsearticlemedia_4($matches) {
return parsearticlemedia('swf,0,0', $matches[4]);
}
function portalcp_parse_postattch(&$post) {
static $allpostattchs = null;
if($allpostattchs === null) {
$allpostattchs = array();
foreach(C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$post['tid'], 'tid', $post['tid']) as $attch) {
$allpostattchs[$attch['pid']][$attch['aid']] = $attch['aid'];
}
}
$attachs = $allpostattchs[$post['pid']];
if(preg_match_all("/\[attach\](\d+)\[\/attach\]/i", $post['message'], $matchaids)) {
$attachs = array_diff($allpostattchs[$post['pid']], $matchaids[1]);
}
if($attachs) {
$add = '';
foreach($attachs as $attachid) {
$add .= '<br/>'.'[attach]'.$attachid.'[/attach]';
}
$post['message'] .= $add;
}
}
function parsearticlemedia($params, $url) {
global $_G;
$params = explode(',', $params);
$url = addslashes($url);
if($flv = parseflv($url, 0, 0)) {
$url = $flv['flv'];
$params[0] = 'swf';
}
if(in_array(count($params), array(3, 4))) {
$type = $params[0];
$url = str_replace(array('<', '>'), '', str_replace('\\"', '\"', $url));
switch($type) {
case 'mp3':
case 'wma':
case 'ra':
case 'ram':
case 'wav':
case 'mid':
return '[flash=mp3]'.$url.'[/flash1]';
case 'rm':
case 'rmvb':
case 'rtsp':
return '[flash=real]'.$url.'[/flash1]';
case 'swf':
return '[flash]'.$url.'[/flash1]';
case 'asf':
case 'asx':
case 'wmv':
case 'mms':
case 'avi':
case 'mpg':
case 'mpeg':
case 'mov':
return '[flash=media]'.$url.'[/flash1]';
default:
return '<a href="'.$url.'" target="_blank">'.$url.'</a>';
}
}
return;
}
function portalcp_article_pre_next($catid, $aid) {
$data = array(
'preaid' => C::t('portal_article_title')->fetch_preaid_by_catid_aid($catid, $aid),
'nextaid' => C::t('portal_article_title')->fetch_nextaid_by_catid_aid($catid, $aid),
);
if($data['preaid']) {
C::t('portal_article_title')->update($data['preaid'], array(
'preaid' => C::t('portal_article_title')->fetch_preaid_by_catid_aid($catid, $data['preaid']),
'nextaid' => C::t('portal_article_title')->fetch_nextaid_by_catid_aid($catid, $data['preaid']),
)
);
}
return $data;
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,111 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: portalcp_category.php 30378 2012-05-24 09:52:46Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(!$_G['setting']['portalstatus']) {
dheader('location:portal.php?mod=portalcp&ac=portalblock');
}
require_once libfile('function/portalcp');
$catid = max(0,intval($_GET['catid']));
$perpagearr = array(20, 30,40, 50, 100);
$_GET['type'] = isset($_GET['type']) && in_array($_GET['type'], array('unrecommend', 'recommended', 'me')) ? $_GET['type'] : 'all';
$perpage = isset($_GET['perpage']) && in_array($_GET['perpage'], $perpagearr) ? $_GET['perpage'] : 20;
$typearr[$_GET['type']] = 'class="a"';
$theurl = "portal.php?mod=portalcp&ac=category&catid=$catid&perpage=$perpage&type={$_GET['type']}&formhash=".FORMHASH."&searchkey=".urlencode($_GET['searchkey']);
$allowmanage = checkperm('allowmanagearticle');
$allowpost = checkperm('allowpostarticle');
$catids = $wherearr = array();
$category = $_G['cache']['portalcategory'];
$permission = getallowcategory($_G['uid']);
if($catid) {
if (!$allowmanage && !$allowpost && empty($permission[$catid]['allowmanage']) && empty($permission[$catid]['allowpublish'])) {
showmessage('portal_nopermission');
}
$cate = $category[$catid];
if(empty($cate)) {
showmessage('article_category_empty');
}
$catids = category_get_childids('portal', $catid);
$catids[] = $catid;
} else {
$catids = array_keys($permission);
if (!$allowmanage && !$allowpost && empty($catids)) {
showmessage('portal_nopermission');
}
}
if($_GET['type'] == 'me' || (!$admincp2 && !$allowmanage)) {
$wherearr[] = " uid='{$_G['uid']}'";
}
if($catids) {
$wherearr[] = " catid IN (".dimplode($catids).")";
}
if($_GET['searchkey']) {
$_GET['searchkey'] = addslashes(stripsearchkey($_GET['searchkey']));
$wherearr[] = "title LIKE '%{$_GET['searchkey']}%'";
$_GET['searchkey'] = dhtmlspecialchars($_GET['searchkey']);
}
if($_GET['type'] == 'recommended') {
$wherearr[] = "bid != ''";
} elseif($_GET['type'] == 'unrecommend') {
$wherearr[] = "bid = ''";
}
$wheresql = implode(' AND ', $wherearr);
$page = max(1,intval($_GET['page']));
$start = ($page-1)*$perpage;
if($start<0) $start = 0;
$list = array();
$multi = '';
$article_tags = article_tagnames();
$count = C::t('portal_article_title')->fetch_all_by_sql($wheresql, '', 0, 0, 1);
if($count) {
$query = C::t('portal_article_title')->fetch_all_by_sql($wheresql, 'ORDER BY dateline DESC', $start, $perpage);
foreach($query as $value) {
if($value['pic']) $value['pic'] = pic_get($value['pic'], 'portal', $value['thumb'], $value['remote']);
$value['dateline'] = dgmdate($value['dateline']);
$value['allowmanage'] = ($allowmanage || !empty($permission[$value['catid']]['allowmanage'])) ? true : false;
$value['allowpublish'] = ($value['allowmanage'] || $allowpost || !empty($permission[$value['catid']]['allowpublish'])) ? true : false;
$value['taghtml'] = '';
$tags = article_parse_tags($value['tag']);
foreach($tags as $k=>$v) {
if($v) {
$value['taghtml'] .= "[{$article_tags[$k]}] ";
}
}
$style = array();
if($value['highlight']) {
$style = explode('|', $value['highlight']);
$value['highlight'] = ' style="';
$value['highlight'] .= $style[0] ? 'color: '.$style[0].';' : '';
$value['highlight'] .= $style[1] ? 'font-weight: bold;' : '';
$value['highlight'] .= $style[2] ? 'font-style: italic;' : '';
$value['highlight'] .= $style[3] ? 'text-decoration: underline;' : '';
$value['highlight'] .= '"';
}
$list[] = $value;
}
$multi = multi($count, $perpage, $page, $theurl);
$categoryselect = category_showselect('portal', 'catid', false, $catid);
}
include_once template("portal/portalcp_category");
?>

View File

@@ -0,0 +1,134 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: portalcp_comment.php 33715 2013-08-07 01:59:25Z andyzheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$cid = intval($_GET['cid']);
$comment = array();
if($cid && $_GET['op'] != 'requote') {
$comment = C::t('portal_comment')->fetch($cid);
}
if($_GET['op'] == 'requote') {
$aid = $_GET['aid'];
$article = C::t('portal_article_title')->fetch($aid);
if($article['idtype'] == 'tid') {
$comment = C::t('forum_post')->fetch_post('tid:'.$article['id'], $cid);
$comment['uid'] = $comment['authorid'];
$comment['username'] = $comment['author'];
} elseif($article['idtype'] == 'blogid') {
$comment = C::t('home_comment')->fetch_comment($cid);
$comment['uid'] = $comment['authorid'];
$comment['username'] = $comment['author'];
} else {
$comment = C::t('portal_comment')->fetch($cid);
}
unset($aid, $article);
if(!empty($comment['message'])) {
include_once libfile('class/bbcode');
$bbcode = & bbcode::instance();
$comment['message'] = $bbcode->html2bbcode($comment['message']);
$comment['message'] = preg_replace("/\[quote\].*?\[\/quote\]/is", '', $comment['message']);
$comment['message'] = getstr($comment['message'], 150, 0, 0, 2, -1);
}
} elseif($_GET['op'] == 'edit') {
if(empty($comment)) {
showmessage('comment_edit_noexist');
}
if((!$_G['group']['allowmanagearticle'] && $_G['uid'] != $comment['uid'] && $_G['adminid'] != 1 && $_GET['modarticlecommentkey'] != modauthkey($comment['cid'])) || $_G['groupid'] == '7') {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
if(submitcheck('editsubmit')) {
$message = getstr($_POST['message'], 0, 0, 0, 2);
if(strlen($message) < 2) showmessage('content_is_too_short');
$message = censor($message, NULL, FALSE, FALSE);
if(censormod($message) || $_G['group']['allowcommentarticlemod']) {
$comment_status = 1;
} else {
$comment_status = 0;
}
C::t('portal_comment')->update($comment['cid'], array('message' => $message, 'status' => $comment_status, 'postip' => $_G['clientip'], 'port' => $_G['remoteport']));
showmessage('do_success', dreferer());
}
include_once libfile('class/bbcode');
$bbcode = & bbcode::instance();
$comment['message'] = $bbcode->html2bbcode($comment['message']);
} elseif($_GET['op'] == 'delete') {
if(empty($comment)) {
showmessage('comment_delete_noexist');
}
if(!$_G['group']['allowmanagearticle'] && $_G['uid'] != $comment['uid']) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
if(submitcheck('deletesubmit')) {
C::t('portal_comment')->delete($cid);
$idtype = in_array($comment['idtype'], array('aid' ,'topicid')) ? $comment['idtype'] : 'aid';
$tablename = $idtype == 'aid' ? 'portal_article_count' : 'portal_topic';
C::t($tablename)->increase($comment['id'], array('commentnum' => -1));
showmessage('do_success', dreferer());
}
}
list($seccodecheck, $secqaacheck) = seccheck('publish');
if(submitcheck('commentsubmit', 0, $seccodecheck, $secqaacheck)) {
if(!checkperm('allowcommentarticle')) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
$id = 0;
$idtype = '';
if(!empty($_POST['aid'])) {
$id = intval($_POST['aid']);
$idtype = 'aid';
} elseif(!empty($_POST['topicid'])) {
$id = intval($_POST['topicid']);
$idtype = 'topicid';
}
$message = $_POST['message'];
require_once libfile('function/spacecp');
cknewuser();
$waittime = interval_check('post');
if($waittime > 0) {
showmessage('operating_too_fast', '', array('waittime' => $waittime), array('return' => true));
}
$retmessage = addportalarticlecomment($id, $message, $idtype);
if($retmessage == 'do_success') {
showmessage('do_success', $_POST['referer'] ? $_POST['referer'] : "portal.php?mod=comment&id=$id&idtype=$idtype");
} else {
showmessage($retmessage, dreferer("portal.php?mod=comment&id=$id&idtype=$idtype"));
}
}
include_once template("portal/portalcp_comment");
?>

View File

@@ -0,0 +1,478 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: portalcp_diy.php 33949 2013-09-05 02:16:25Z laoguozhang $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$op = in_array($_GET['op'], array('style', 'diy', 'image', 'export', 'import', 'blockclass')) ? $_GET['op'] : '';
if (submitcheck('uploadsubmit')) {
$topicid = intval($_POST['topicid']);
if($topicid) {
$topic = C::t('portal_topic')->fetch($topicid);
if(empty($topic)) {
topic_upload_error('diy_topic_noexist');
}
}
topic_checkperm($topic);
$upload = new discuz_upload();
$upload->init($_FILES['attach'], 'portal');
$attach = $upload->attach;
if(!$upload->error()) {
$upload->save();
}
if($upload->error()) {
topic_upload_error($attach, $upload->error());
} else {
if($attach['isimage']) {
require_once libfile('class/image');
$image = new image();
$attach['thumb'] = $image->Thumb($attach['target'], '', '80', '50');
}
if(ftpperm($attach['ext'], $attach['size'])) {
if(ftpcmd('upload', 'portal/'.$attach['attachment'])) {
if($attach['thumb']) {
ftpcmd('upload', 'portal/'.getimgthumbname($attach['attachment']));
}
$attach['remote'] = 1;
} else {
if(getglobal('setting/ftp/mirror')) {
@unlink($attach['target']);
@unlink(getimgthumbname($attach['target']));
topic_upload_error($attach, 'diy_remote_upload_failed');
}
}
}
$setarr = array(
'uid' => $_G['uid'],
'username' => $_G['username'],
'filename' => $attach['name'],
'filepath' => $attach['attachment'],
'size' => $attach['size'],
'thumb' => $attach['thumb'],
'remote' => $attach['remote'],
'dateline' => $_G['timestamp'],
'topicid' => $topicid
);
$setarr['picid'] = C::t('portal_topic_pic')->insert($setarr, true);
topic_upload_show($topicid);
}
} elseif (submitcheck('diysubmit')) {
require_once libfile('function/portalcp');
$tpldirectory = getstr($_POST['tpldirectory'], 80);
$template = getstr($_POST['template'], 50);
if(dsign($tpldirectory.$template) !== $_POST['diysign']) {
showmessage('diy_sign_invalid');
}
$tpldirectory = ($tpldirectory) ? $tpldirectory : $_G['cache']['style_default']['tpldir'];
$savemod = getstr($_POST['savemod'], 1);
$recover = getstr($_POST['recover'], 1);
$optype = getstr($_POST['optype'],10);
tpl_checkperm($template);
list($template, $clonefile) = explode(':', $template);
list($mod,$file) = explode('/', $template);
$targettplname = $template;
if ($savemod == '1' && !empty($clonefile)) {
$targettplname = $template.'_'.$clonefile;
}
$istopic = $iscategory = $isarticle = false;
if($template == 'portal/portal_topic_content') {
$template = gettopictplname($clonefile);
$istopic = true;
} elseif ($template == 'portal/list') {
$template = getportalcategorytplname($clonefile);
$iscategory = true;
} elseif ($template == 'portal/view') {
$template = getportalarticletplname($clonefile, $template);
$isarticle = true;
}
if(($istopic || $iscategory || $isarticle) && strpos($template, ':') !== false) {
list($tpldirectory, $template) = explode(':', $template);
}
$checktpl = checkprimaltpl($tpldirectory.':'.$template);
if($checktpl !== true) {
showmessage($checktpl);
}
if($optype == 'canceldiy') {
@unlink(DISCUZ_ROOT.'./data/diy/'.$tpldirectory.'/'.$targettplname.'_diy_preview.htm');
if($targettplname == $template) @unlink(DISCUZ_ROOT.'./data/diy/'.$tpldirectory.'/'.$targettplname.'_'.$clonefile.'_diy_preview.htm');
showmessage('do_success');
}
if ($recover == '1') {
$file = './data/diy/'.$tpldirectory.'/'.$targettplname.'.htm';
if (is_file($file.'.bak')) {
copy ($file.'.bak', $file);
} else {
showmessage('diy_backup_noexist');
}
} else {
$templatedata = array();
checksecurity($_POST['spacecss']);
$templatedata['spacecss'] = preg_replace("/(\<|\>)/is", '', $_POST['spacecss']);
$style = empty($_POST['style'])?'':preg_replace("/[^0-9a-z]/i", '', $_POST['style']);
if($style) {
$cssfile = DISCUZ_ROOT.'./static/topic/'.$style.'/style.css';
if(!file_exists($cssfile)) {
showmessage('theme_does_not_exist');
} else {
$templatedata['style'] = "static/topic/$style/style.css";
}
}
$layoutdata = getstr($_POST['layoutdata'],0,0,0,0,1);
require_once libfile('class/xml');
$templatedata['layoutdata'] = xml2array($layoutdata);
if (empty($templatedata['layoutdata'])) showmessage('diy_data_format_invalid');
$r = save_diy_data($tpldirectory, $template, $targettplname, $templatedata, true, $optype);
include_once libfile('function/cache');
updatecache('diytemplatename');
if ($r && $optype != 'savecache') {
if (!$iscategory && !$istopic && empty($savemod) && !empty($clonefile)) {
$delfile = DISCUZ_ROOT.'./data/diy/'.$tpldirectory.'/'.$template.'_'.$clonefile.'.htm';
if (file_exists($delfile)) {
unlink($delfile);
@unlink($delfile.'.bak');
C::t('common_template_block')->delete_by_targettplname("{$template}_{$clonefile}", $tpldirectory);
C::t('common_diy_data')->delete("{$template}_{$clonefile}", $tpldirectory);
include_once libfile('function/cache');
updatecache('diytemplatename');
}
}
}
}
$tourl = empty($_POST['gobackurl']) || strpos($_POST['gobackurl'],'op=add') != false || strpos($_POST['gobackurl'],'&diy=yes') != false ?
str_replace('&diy=yes','',$_SERVER['HTTP_REFERER']) : $_POST['gobackurl'];
$tourl = preg_replace('/[\?|&]preview=yes/', '', $tourl);
showmessage('do_success', $tourl,array('rejs'=>$_POST['rejs']));
}
if($op == 'blockclass') {
loadcache('blockclass');
} elseif($op == 'style') {
if(!$_G['group']['allowmanagetopic'] && !$_G['group']['allowdiy'] && !$_G['group']['allowaddtopic']) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
$themes = gettheme('topic');
} elseif ($op == 'diy' || $op == 'image') {
$topicid = intval($_GET['topicid']);
$topic = C::t('portal_topic')->fetch($topicid);
topic_checkperm($topic);
$perpage = 6;
$page = max(1, intval($_GET['page']));
$start= ($page-1) * $perpage;
$list = array();
if ($topicid) {
$count = C::t('portal_topic_pic')->count_by_topicid($topicid);
if (!empty($count)) {
foreach(C::t('portal_topic_pic')->fetch_all_by_topicid($topicid, $start, $perpage) as $value) {
$value['pic'] = pic_get($value['filepath'], 'portal', $value['thumb'], $value['remote']);
$list[] = $value;
}
}
$multi= multi($count, $perpage, $page, "portal.php?mod=portalcp&ac=diy&op=image&topicid=$topicid");
}
} elseif ($op == 'delete') {
$topicid = intval($_GET['topicid']);
$topic = C::t('portal_topic')->fetch($topicid);
topic_checkperm($topic);
$picid = intval($_GET['picid']);
} elseif ($op == 'export') {
if (submitcheck('exportsubmit')) {
$tpl = $_POST['tpl'];
$tpldirectory = $_POST['tpldirectory'];
$frame = $_POST['frame'];
$type = $_POST['type'];
if (!empty($tpl)) {
tpl_checkperm($tpl);
list($tpl,$id) = explode(':', $tpl);
$tplname = $id ? $tpl.'_'.$id : $tpl;
$diydata = C::t('common_diy_data')->fetch_diy($tplname, $tpldirectory);
if(empty($diydata) && $id) $diydata = C::t('common_diy_data')->fetch_diy($tpl, $tpldirectory);
if ($diydata) {
$filename = $diydata['targettplname'];
$diycontent = dunserialize($diydata['diycontent']);
if (empty($diycontent)) showmessage('diy_no_export_data');
if ($frame) {
$area = '';
$filename = $frame;
$framedata = array();
foreach ($diycontent['layoutdata'] as $key => $value) {
$framedata = getobjbyname($frame, $value);
if ($framedata) {
$area = $key;
getframeblock(array($framedata['type'].'`'.$frame => $framedata['content']));
break;
}
}
} else {
foreach ($diycontent['layoutdata'] as $key => $value) {
if (!empty($value)) getframeblock($value);
}
}
$diycontent['blockdata'] = block_export($_G['curtplbid']);
if ($frame) {
$diycontent['spacecss'] = getcssdata($diycontent['spacecss']);
$diycontent['layoutdata'] = array();
$area = empty($area) ? 'diy1' : $area;
$diycontent['layoutdata'][$area][$framedata['type'].'`'.$frame] = $framedata['content'] ? $framedata['content'] : array();
}
dheader('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
dheader('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
dheader('Cache-Control: no-cache, must-revalidate');
dheader('Pragma: no-cache');
dheader('Content-Encoding: none');
if ($type == 'txt') {
$str = serialize($diycontent);
dheader('Content-Length: '.strlen($str));
dheader('Content-Disposition: attachment; filename='.$filename.'.txt');
dheader('Content-Type: text/plain');
} else {
require_once libfile('class/xml');
$str = array2xml($diycontent, true);
dheader('Content-Length: '.strlen($str));
dheader('Content-Disposition: attachment; filename='.$filename.'.xml');
dheader('Content-Type: text/xml');
}
echo $str;
exit();
} else {
showmessage('diy_export_no_data','/');
}
} else {
showmessage('diy_export_tpl_invalid','/');
}
}
showmessage('diy_operation_invalid','/');
} elseif ($op == 'import') {
$tpl = $_POST['tpl'] ? $_POST['tpl'] : $_GET['tpl'];
tpl_checkperm($tpl);
$tpldir = './template/default/portal/diyxml/';
if ($_G['style']['tpldir'] && preg_match("#^\./template/\w+$#i", $_G['style']['tpldir']) && is_dir(DISCUZ_ROOT.$_G['style']['tpldir'].'/portal/diyxml/')) {
$tpldir = $_G['style']['tpldir'].'/portal/diyxml/';
}
if (submitcheck('importsubmit')) {
$isinner = false;
$filename = '';
if($_POST['importfilename']) {
if (!preg_match("/^\w+$/i", $_POST['importfilename'])) {
showmessage('do_success','portal.php',array('status'=>0));
}
$filename = DISCUZ_ROOT.$tpldir.$_POST['importfilename'].'.xml';
if(!file_exists($filename)) {
$filename = DISCUZ_ROOT.$tpldir.$_POST['importfilename'].'.php';
}
$isinner = true;
} else {
$upload = new discuz_upload();
$upload->init($_FILES['importfile'], 'temp');
$attach = $upload->attach;
if(!$upload->error()) {
$upload->save();
}
if($upload->error()) {
showmessage($upload->error(),'portal.php',array('status'=>$upload->error()));
} else {
$filename = $attach['target'];
}
}
if($filename && file_exists($filename)) {
$arr = import_diy($filename);
if(!$isinner) {
@unlink($filename);
}
if (!empty($arr)) {
$search = array('/\<script/i', '/\<\/script\>/i', "/\r/", "/\n/", '/(\[script [^>]*?)(src=)(.*?\[\/script\])/');
$replace = array('[script', '[/script]', '', '', '$1[src=]$3');
$arr['css'] = str_replace(array("\r","\n"),array(''),$arr['css']);
$arr['mapping'] = is_array($arr['mapping']) ? $arr['mapping'] : array($arr['mapping']);
$jsarr = array('status'=>1,'css'=>$arr['css'],'bids'=>implode(',',$arr['mapping']));
foreach ($arr['html'] as $key => $value) {
$value = preg_replace($search,$replace,$value);
$jsarr['html'][$key] = $value;
}
showmessage('do_success','portal.php',$jsarr);
} else {
showmessage('do_success','portal.php',array('status'=>0));
}
} else {
showmessage('do_success','portal.php',array('status'=>0));
}
}
$xmlarr = array();
if ($_GET['type'] == 1) {
$xmlfilepath = DISCUZ_ROOT.$tpldir;
if(($dh = @opendir($xmlfilepath))) {
while(($file = @readdir($dh)) !== false) {
if(in_array(fileext($file), array('xml', 'php'))) {
$xmlarr[substr($file, 0, -4)] = getdiyxmlname($file, $xmlfilepath);
}
}
closedir($dh);
}
arsort($xmlarr);
}
} else {
showmessage('undefined_action');
}
include_once template("portal/portalcp_diy");
function topic_upload_error($attach, $msg='') {
echo '<script>';
echo 'parent.document.getElementById(\'uploadmsg\').innerHTML = \''.$attach['name'].' '.lang('home/template', 'upload_error').$msg.'\';';
echo '</script>';
exit();
}
function topic_upload_show($topicid) {
echo '<script>';
echo 'parent.ajaxget("portal.php?mod=portalcp&ac=diy&op=image&topicid='.$topicid.'&", "diyimages");';
echo 'parent.document.uploadpic.attach.value = \'\';';
echo 'Util.toggleEle(\'upload\')';
echo '</script>';
exit();
}
function tpl_checkperm($tpl) {
global $_G;
list($file,$id) = explode(':', $tpl);
if ($file == 'portal/portal_topic_content') {
$topicid = max(0,intval($id));
$topic = C::t('portal_topic')->fetch($topicid);
topic_checkperm($topic);
} elseif($file == 'portal/list'){
$catid = max(0,intval($id));
$category = $_G['cache']['portalcategory'][$catid];
category_checkperm($category);
} else {
if(!$_G['group']['allowdiy']) {
showmessage('diy_nopermission');
}
}
}
function category_checkperm($category) {
global $_G;
if(empty($category)) {
showmessage('topic_not_exist');
}
if($_G['group']['allowdiy']) return true;
if(!$_G['group']['allowdiy'] && (!$_G['group']['allowaddtopic'] || $_G['uid'] != $topic['uid'])) {
showmessage('topic_edit_nopermission');
}
}
function topic_checkperm($topic) {
global $_G;
if(empty($topic)) {
showmessage('topic_not_exist');
}
if(!$_G['group']['allowmanagetopic'] && (!$_G['group']['allowaddtopic'] || $_G['uid'] != $topic['uid'])) {
showmessage('topic_edit_nopermission');
}
}
function gettopictplname($topicid) {
$topicid = max(0,intval($topicid));
$topic = C::t('portal_topic')->fetch($topicid);
return !empty($topic) && !empty($topic['primaltplname']) ? $topic['primaltplname'] : getglobal('cache/style_default/tpldir').':portal/portal_topic_content';
}
function getportalcategorytplname($catid) {
global $_G;
$catid = max(0,intval($catid));
$category = $_G['cache']['portalcategory'][$catid];
return !empty($category) && !empty($category['primaltplname']) ? $category['primaltplname'] : getglobal('cache/style_default/tpldir').':portal/list';
}
function getportalarticletplname($catid, $primaltplname = ''){
if(($catid = intval($catid))) {
if(($category = C::t('portal_category')->fetch($catid))) {
$primaltplname = $category['articleprimaltplname'];
}
if(empty($primaltplname)) {
$primaltplname = getglobal('cache/style_default/tpldir').':portal/view';
C::t('portal_category')->update($catid, array('articleprimaltplname' => $primaltplname));
}
}
return $primaltplname;
}
function getdiyxmlname($filename, $path) {
$content = @file_get_contents($path.$filename);
$name = $filename;
if($content) {
preg_match("/\<\!\-\-\[name\](.+?)\[\/name\]\-\-\>/i", trim($content), $mathes);
if(!empty($mathes[1])) {
preg_match("/^\{lang (.+?)\}$/", $mathes[1], $langs);
if(!empty($langs[1])) {
$name = lang('portalcp', $langs[1]);
} else {
$name = dhtmlspecialchars($mathes[1]);
}
}
}
return $name;
}
?>

View File

@@ -0,0 +1,140 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: portalcp_index.php 25889 2011-11-24 09:52:20Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(!$_G['setting']['portalstatus']) {
dheader('location:portal.php?mod=portalcp&ac=portalblock');
}
$op = $_GET['op'] = 'list';
$allowpostarticle = checkperm('allowmanagearticle') || checkperm('allowpostarticle') || $admincp2 || $admincp3;
if($op == 'list') {
if(checkperm('allowdiy')) {
} elseif(!checkperm('allowmanagearticle') && checkperm('allowpostarticle') && !$admincp2 || (!$admincp2 && $admincp3)) {
dheader('location:portal.php?mod=portalcp&ac=category');
} elseif($_G['member']['allowadmincp'] == 8 || $_G['member']['allowadmincp'] == 32) {
dheader('location:portal.php?mod=portalcp&ac=portalblock');
}
}
require_once libfile('function/portalcp');
$category = $_G['cache']['portalcategory'];
$permissioncategory = $permission = array();
if (checkperm('allowmanagearticle')) {
$permissioncategory = $category;
} elseif ($admincp2) {
$permission = getallowcategory($_G['uid']);
if(!empty($permission)) {
$permissioncategory = getpermissioncategory($category,array_keys($permission));
}
}
if($op == 'list') {
$categorytree = '';
foreach($permissioncategory as $key => $value) {
if ($category[$key]['level'] == 0) {
$categorytree .= showcategoryrow($key, 0);
}
}
}
include_once template("portal/portalcp_index");
function showcategoryrow($key, $level = 0, $last = '') {
global $category, $permissioncategory, $permission;
$value = $category[$key];
$return = '';
$op = $addarticle = $artilcemanage = '';
$value['articles'] = category_get_num('portal', $key);
if (checkperm('allowmanagearticle') || checkperm('allowmanage') || $permission[$key]['allowmanage']) {
$addarticle .= '<a href="portal.php?mod=portalcp&ac=category&catid='.$key.'" class="y">'.lang('portalcp', 'article_manage').'</a>';
}
if ((checkperm('allowmanagearticle') || checkperm('allowpostarticle') || $permission[$key]['allowmanage'] || $permission[$key]['allowpublish']) && empty($value['disallowpublish'])) {
$artilcemanage .= '<a href="portal.php?mod=portalcp&ac=article&catid='.$value['catid'].'" target="_blank" class="y">'.lang('portalcp', 'article_publish').'</a>';
}
if($addarticle && $artilcemanage) {
$op = $addarticle.'<span class="pipe y">|</span>'.$artilcemanage;
} else {
$op = $addarticle ? $addarticle : $artilcemanage;
}
if($level == 2) {
$class = $last ? 'lastchildcat' : 'childcat';
$return = '<tr class="hover"><td><div class="'.$class.'"><a href="portal.php?mod=portalcp&ac=category&catid='.$key.'">'.$value['catname'].'</a>'.
'</div></td><td>'.$value['articles'].'</td><td>'.$op.'</td></tr>';
} elseif($level == 1) {
$return = '<tr class="hover"><td><div class="cat"><a href="portal.php?mod=portalcp&ac=category&catid='.$key.'">'.$value['catname'].'</a>'.
'</td><td>'.$value['articles'].'</td><td>'.$op.'</td></tr>';
$children = checkperm('allowmanagearticle') ? $category[$key]['children'] : $permissioncategory[$key]['permissionchildren'];
$i = 1;
$l = is_array($children) ? count($children) : 0;
foreach($children as $v){
$return .= showcategoryrow($v, 2 ,$i++ == $l);
}
} else {
$return = '<tr class="hover"><td><div class="parentcat"><a href="portal.php?mod=portalcp&ac=category&catid='.$key.'">'.$value['catname'].'</a>'.
'</div></td><td>'.$value['articles'].'</td><td>'.$op.'</td></tr>';
$children = checkperm('allowmanagearticle') ? $category[$key]['children'] : $permissioncategory[$key]['permissionchildren'];
foreach($children as $v){
$return .= showcategoryrow($v, 1);
}
}
return $return;
}
function showcategoryrowpush($key, $level = 0, $last = '') {
global $_G, $category, $permissioncategory, $permission;
$value = $category[$key];
$return = '';
$op = '';
if (checkperm('allowmanagearticle') || checkperm('allowpostarticle') || $permission[$key]['allowpublish'] || $permission[$key]['allowmanage']) {
if(empty($value['disallowpublish'])){
$value['pushurl'] = '<a href="portal.php?mod=portalcp&ac=article&catid='.$key.'&from_idtype='.$_GET['idtype'].'&from_id='.$_GET['id'].'" target="_blank" onclick="hideWindow(\''.$_GET['handlekey'].'\')">'.$value['catname'].'</a>';
} else {
$value['pushurl'] = $value['catname'];
}
}
if($level == 2) {
$class = $last ? 'lastchildcat' : 'childcat';
$return = '<tr class="hover"><td>&nbsp;</td><td><div class="'.$class.'">'.$value['pushurl'].'</div></td></tr>';
} elseif($level == 1) {
$return = '<tr class="hover"><td>&nbsp;</td><td><div class="cat">'.$value['pushurl'].'</div></td></tr>';
$children = checkperm('allowmanagearticle') ? $category[$key]['children'] : $permissioncategory[$key]['permissionchildren'];
$i = 1;
$l = is_array($children) ? count($children) : 0;
foreach($children as $v) {
$return .= showcategoryrowpush($v, 2, $i++ == $l);
}
} else {
$children = checkperm('allowmanagearticle') ? $category[$key]['children'] : $permissioncategory[$key]['permissionchildren'];
$childrennum = is_array($children) ? count($children) : 0;
$toggle = $childrennum > 25 ? ' style="display:none"' : '';
$return = '<tbody><tr class="hover"><td onclick="toggle_group(\'group_'.$value['catid'].'\')"><a id="a_group_'.$value['catid'].'" href="javascript:;">'.($toggle ? '[+]' : '[-]').'</a></td>'
.'<td><div class="parentcat">'.$value['pushurl'].'</div></td></tr></tbody>
<tbody id="group_'.$value['catid'].'"'.$toggle.'>';
foreach($children as $v) {
$return .= showcategoryrowpush($v, 1, '');
}
$return .= '</tdoby>';
}
return $return;
}
?>

View File

@@ -0,0 +1,21 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: portalcp_plugin.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$pluginkey = 'portalcp';
$navtitle = $_G['setting']['plugins'][$pluginkey][$_GET['id']]['name'];
include pluginmodule($_GET['id'], $pluginkey);
include template('portal/portalcp_plugin');
?>

View File

@@ -0,0 +1,321 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: portalcp_portalblock.php 31958 2012-10-26 05:11:05Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('function/block');
$op = in_array($_GET['op'], array('recommend', 'getblocklist', 'verifydata', 'verifieddata')) ? $_GET['op'] : 'getblocklist';
$initemdata = $op === 'verifydata' || $op === 'verifieddata' ? true : false;
$_GET['idtype'] = dhtmlspecialchars($_GET['idtype']);
$_GET['id'] = intval($_GET['id']);
$allowdiy = checkperm('allowdiy');
if(!$allowdiy && !$admincp4 && !$admincp5 && !$admincp6) {
showmessage('portal_nopermission', dreferer());
}
loadcache('diytemplatename');
$pagebids = $tpls = $blocks = $tplpermissions = $wherearr = $blockfavorite = $topblocks = $blockdata = array();
if(submitcheck('getblocklistsubmit') || submitcheck('verifieddatasubmit') || submitcheck('verifydatasubmit')) {
if($allowdiy) {
$tpls = array_keys($_G['cache']['diytemplatename']);
} else {
$permissions = getallowdiytemplate($_G['uid']);
foreach($permissions as $value) {
if($value['allowmanage'] || ($value['allowrecommend'] && empty($value['needverify']))) {
$tpls[] = $value['targettplname'];
}
}
}
if(!$allowdiy) {
foreach(C::t('common_block_permission')->fetch_all_by_uid($_G['uid']) as $bid => $value) {
if($value['allowmanage'] == 1 || ($value['allowrecommend'] == 1 && $value['needverify'] == 0)) {
$bids[$value['bid']] = intval($value['bid']);
}
}
}
if(!$allowdiy && empty($bids)) {
showmessage('portal_nopermission', dreferer());
}
if(submitcheck('getblocklistsubmit')) {
$updatebids = $_GET['bids'];
$updatebids = array_map('intval', $updatebids);
$updatebids = array_filter($updatebids);
$updatebids = !$allowdiy ? array_intersect($bids, $updatebids) : $updatebids;
if($updatebids) {
C::t('common_block')->update_dateline_to_expired($updatebids, TIMESTAMP);
}
showmessage('portalcp_block_push_the_update_line', dreferer());
} else if (submitcheck('verifydatasubmit')) {
if(!in_array($_POST['optype'], array('pass', 'delete'))) {
showmessage('select_a_option', dreferer());
}
$ids = $updatebids = array();
if($_POST['ids']) {
foreach(C::t('common_block_item_data')->fetch_all($_POST['ids']) as $value) {
if($allowdiy || in_array($value['bid'], $bids)) {
$ids[$value['dataid']] = intval($value['dataid']);
$updatebids[$value['bid']] = $value['bid'];
}
}
}
if(empty($ids)) {
showmessage('select_a_moderate_data', dreferer());
}
if($_POST['optype']=='pass') {
C::t('common_block_item_data')->update($ids, array('isverified' => '1', 'verifiedtime' => $_G['timestamp']));
if($updatebids) {
C::t('common_block')->update_dateline_to_expired($updatebids, TIMESTAMP);
}
} elseif($_POST['optype']=='delete') {
C::t('common_block_item_data')->delete($ids);
}
showmessage('operation_done', dreferer());
} else if (submitcheck('verifieddatasubmit')) {
$ids = array();
if(!empty($_POST['ids'])) {
foreach(C::t('common_block_item_data')->fetch_all($_POST['ids']) as $value) {
if($allowdiy || in_array($value['bid'], $bids)) {
$ids[$value['dataid']] = intval($value['dataid']);
}
}
}
if($ids) {
C::t('common_block_item_data')->delete($ids);
}
$displayorder = array_map('intval', $_POST['displayorder']);
foreach($displayorder as $dataid => $displayorder) {
if($displayorder !== intval($_POST['olddisplayorder'][$dataid])) {
C::t('common_block_item_data')->update($dataid, array('displayorder' => $displayorder));
}
}
showmessage('do_success', dreferer());
}
} else {
$perpage = $op == 'recommend' ? 16 : 30;
$page = max(1,intval($_GET['page']));
$start = ($page-1)*$perpage;
if($start<0) $start = 0;
$theurl = 'portal.php?mod=portalcp&ac=portalblock&op='.$op.'&idtype='.$_GET['idtype'].'&id='.$_GET['id'];
$showfavorite = $page == 1 ? true : false;
$multi = $fields = $leftjoin = '';
$blockfavorite = block_get_favorite($_G['uid']);
if($allowdiy) {
$tpls = $_G['cache']['diytemplatename'];
} else {
$tplpermissions = getallowdiytemplate($_G['uid']);
foreach($tplpermissions as $value) {
if($value['allowmanage'] || ($value['allowrecommend'] && empty($value['needverify'])) || ($op=='recommend' && $value['allowrecommend'])) {
$tpls[$value['targettplname']] = isset($_G['cache']['diytemplatename'][$value['targettplname']]) ? $_G['cache']['diytemplatename'][$value['targettplname']] : $value['targettplname'];
}
}
$fields = ',bp.allowmanage,bp.allowrecommend,bp.needverify';
$leftjoin = ' LEFT JOIN '.DB::table('common_block_permission').' bp ON b.bid=bp.bid';
$wherearr[] = "bp.uid='{$_G['uid']}'";
$wherearr[] = "(bp.allowmanage='1' OR (bp.allowrecommend='1'".($op == 'recommend' ? '' : "AND bp.needverify='0'")."))";
}
$hasinblocks = array();
if($op == 'recommend' && in_array($_GET['idtype'], array('tid', 'gtid', 'blogid', 'picid', 'aid'), true) && ($_GET['id'] = dintval($_GET['id']))) {
$hasinblocks = C::t('common_block')->fetch_all_recommended_block($_GET['id'], $_GET['idtype'], $wherearr, $leftjoin, $fields);
}
if($_GET['searchkey']) {
$_GET['searchkey'] = trim($_GET['searchkey']);
$showfavorite = false;
if (preg_match('/^[#]?(\d+)$/', $_GET['searchkey'],$match)) {
$bid = intval($match[1]);
$wherearr[] = " (b.bid='$bid' OR b.name='$bid')";
} else {
$wherearr[] = " b.name LIKE '%".stripsearchkey($_GET['searchkey'])."%'";
$perpage = 10000;
}
$_GET['searchkey'] = dhtmlspecialchars($_GET['searchkey']);
$theurl .= '&searchkey='.$_GET['searchkey'];
}
if($_GET['targettplname']) {
$showfavorite = false;
$targettplname = trim($_GET['targettplname']);
$pagebids = array_keys(C::t('common_template_block')->fetch_all_by_targettplname($targettplname));
if(!empty($pagebids)) {
$wherearr[] = "b.bid IN (".dimplode($pagebids).")";
$perpage = 10000;
} else {
$wherearr[] = "b.bid='0'";
}
$_GET['targettplname'] = dhtmlspecialchars($_GET['targettplname']);
$theurl .= '&targettplname='.$_GET['targettplname'];
}
if($op == 'recommend') {
$rewhere = array();
switch ($_GET['idtype']) {
case 'tid' :
$rewhere[] = "(blockclass='forum_thread' OR blockclass='forum_activity' OR blockclass='forum_trade')";
break;
case 'gtid' :
$rewhere[] = "(blockclass='group_thread' OR blockclass='group_activity' OR blockclass='group_trade')";
break;
case 'blogid' :
$rewhere[] = "blockclass ='space_blog'";
break;
case 'picid' :
$rewhere[] = "blockclass ='space_pic'";
break;
case 'aid' :
$rewhere[] = "blockclass ='portal_article'";
break;
}
$wherearr = array_merge($rewhere, $wherearr);
$where = $wherearr ? ' WHERE '.implode(' AND ', $wherearr) : '';
if(($count = C::t('common_block')->count_by_where($where, $leftjoin))) {
foreach(C::t('common_block')->fetch_all_by_where($where, $start, $perpage, $leftjoin, $fields) as $value) {
$value = formatblockvalue($value);
if(!$value['favorite'] || !$showfavorite) {
$blocks[$value['bid']] = $value;
}
}
if(!empty($blockfavorite) && $showfavorite) {
$blocks = $blockfavorite + $blocks;
}
$theurl = $_G['inajax'] ? $theurl.'&getdata=yes' : $theurl;
if($_G['inajax']) $_GET['ajaxtarget'] = 'itemeditarea';
$multi = multi($count, $perpage, $page, $theurl);
}
} else {
$where = empty($wherearr) ? '' : ' WHERE '.implode(' AND ', $wherearr);
if(($count = C::t('common_block')->count_by_where($where, $leftjoin))) {
foreach(C::t('common_block')->fetch_all_by_where($where, $initemdata ? 0 : $start, $initemdata ? 0 : $perpage, $leftjoin, $fields) as $value) {
$value = formatblockvalue($value);
if(!$value['favorite'] || !$showfavorite) {
$blocks[$value['bid']] = $value;
}
}
if(!empty($blockfavorite) && $showfavorite) {
$blocks = $blockfavorite + $blocks;
}
$multi = $initemdata ? '' : multi($count, $perpage, $page, $theurl);
}
}
if($blocks) {
$losttpls = $alldata = array();
$bids = array_keys($blocks);
if($bids) {
foreach(C::t('common_template_block')->fetch_all_by_bid($bids) as $value) {
$alldata[] = $value;
if(!isset($_G['cache']['diytemplatename'][$value['targettplname']])) {
$losttpls[$value['targettplname']] = $value['targettplname'];
}
}
if($losttpls) {
$lostnames = getdiytplnames($losttpls);
foreach($lostnames as $pre => $datas) {
foreach($datas as $id => $name) {
$_G['cache']['diytemplatename'][$pre.$id] = $tpls[$pre.$id] = $name;
}
}
}
foreach($alldata as $value) {
$diyurl = block_getdiyurl($value['targettplname']);
$diyurl = $diyurl['url'];
$tplname = isset($_G['cache']['diytemplatename'][$value['targettplname']]) ? $_G['cache']['diytemplatename'][$value['targettplname']] : $value['targettplname'];
if(!isset($tpls[$value['targettplname']])) {
$tpls[$value['targettplname']] = $tplname;
}
$blocks[$value['bid']]['page'][$value['targettplname']] = $diyurl ? '<a href="'.$diyurl.'" target="_blank">'.$tplname.'</a>' : $tplname;
}
}
if($initemdata) {
$isverified = $op === 'verifieddata' ? 1 : 0;
$count = C::t('common_block_item_data')->count_by_bid($bids, $isverified);
$blockdata = $count ? C::t('common_block_item_data')->fetch_all_by_bid($bids, $isverified, $start, $perpage) : array();
$multi = multi($count, $perpage, $page, $theurl);
}
}
}
include_once template("portal/portalcp_portalblock");
function formatblockvalue($value) {
global $blockfavorite;
$value['name'] = empty($value['name']) ? '<strong>#'.$value['bid'].'</strong>' : $value['name'];
$theclass = block_getclass($value['blockclass']);
$value['blockclassname'] = $theclass['name'];
$value['datasrc'] = $theclass['script'][$value['script']];
$value['isrecommendable'] = block_isrecommendable($value);
$value['perm'] = formatblockpermissoin($value);
$value['favorite'] = isset($blockfavorite[$value['bid']]) ? true : false;
return $value;
}
function formatblockpermissoin($block) {
static $allowdiy = null;
$allowdiy = isset($allowdiy) ? $allowdiy : checkperm('allowdiy');;
$perm = array('allowproperty' => 0, 'allowdata'=> 0);
$bid = !empty($block) ? $block['bid'] : 0;
if(!empty($bid)) {
if($allowdiy) {
$perm = array('allowproperty' => 1, 'allowdata'=> 1);
} else {
if($block['allowmanage']) {
$perm = array('allowproperty' => 1, 'allowdata'=> 1);
}
if ($block['allowrecommend'] && !$block['needverify']) {
$perm['allowdata'] = 1;
}
}
}
return $perm;
}
function block_get_favorite($uid){
static $allowdiy = null;
$allowdiy = isset($allowdiy) ? $allowdiy : checkperm('allowdiy');
$blockfavorite = $permission = array();
$uid = intval($uid);
if($uid) {
foreach(C::t('common_block_favorite')->fetch_all_by_uid($uid) as $value) {
$blockfavorite[$value['bid']] = $value['bid'];
}
}
if(!empty($blockfavorite)) {
$blocks = C::t('common_block')->fetch_all($blockfavorite);
if(!$allowdiy) {
$permission = C::t('common_block_permission')->fetch_all_by_uid($uid);
}
foreach($blocks as $bid => $value) {
if(!$allowdiy && $permission[$bid]) {
$value = array_merge($value, $permission[$bid]);
}
$value = formatblockvalue($value);
$value['favorite'] = true;
$blockfavorite[$value['bid']] = $value;
}
$blockfavorite = array_filter($blockfavorite, 'is_array');
}
return $blockfavorite;
}
?>

View File

@@ -0,0 +1,104 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: portalcp_related.php 30723 2012-06-14 03:49:17Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$op = in_array($_GET['op'], array('manual','search','add','get')) ? $_GET['op'] : '';
$aid = intval($_GET['aid']);
$catid = intval($_GET['catid']);
if($aid) {
check_articleperm($catid, $aid);
} else {
check_articleperm($catid);
}
$wherearr = $articlelist = $relatedarr = array();
if($op == 'manual') {
$manualid = intval($_GET['manualid']);
$ra = array();
if($manualid) {
$ra = C::t('portal_article_title')->fetch($manualid);
}
} elseif($op == 'get') {
$id = trim($_GET['id']);
$getidarr = explode(',', $id);
$getidarr = array_map('intval', $getidarr);
$getidarr = array_unique($getidarr);
$getidarr = array_filter($getidarr);
if($getidarr) {
$list = array();
$query = C::t('portal_article_title')->fetch_all($getidarr);
foreach($query as $value) {
$list[$value['aid']] = $value;
}
foreach($getidarr as $getid) {
if($list[$getid]) {
$articlelist[] = $list[$getid];
}
}
}
} elseif($op == 'search') {
$catids = array();
$searchkey = addslashes(stripsearchkey($_GET['searchkey']));
$searchcate = intval($_GET['searchcate']);
$catids = category_get_childids('portal', $searchcate);
$catids[] = $searchcate;
if($searchkey) {
$wherearr[] = "title LIKE '%$searchkey%'";
}
$searchkey = dhtmlspecialchars($searchkey);
if($searchcate) {
$wherearr[] = "catid IN (".dimplode($catids).")";
}
$wheresql = implode(' AND ', $wherearr);
$count = C::t('portal_article_title')->fetch_all_by_sql($wheresql, '', 0, 0, 1);
if($count) {
$query = C::t('portal_article_title')->fetch_all_by_sql($wheresql, 'ORDER BY dateline DESC', 0, 50);
foreach($query as $value) {
$articlelist[] = $value;
}
}
} elseif($op == 'add') {
$relatedid = trim($_GET['relatedid']);
$relatedarr = explode(',', $relatedid);
$relatedarr = array_map('intval', $relatedarr);
$relatedarr = array_unique($relatedarr);
$relatedarr = array_filter($relatedarr);
if($relatedarr) {
$query = C::t('portal_article_title')->fetch_all($relatedarr);
$list = array();
foreach($query as $value) {
$list[$value['aid']] = $value;
}
foreach($relatedarr as $relateid) {
if($list[$relateid]) {
$articlelist[] = $list[$relateid];
}
}
}
if($_GET['update'] && $aid) {
addrelatedarticle($aid, $relatedarr);
}
} else {
$count = 0;
$query = C::t('portal_article_title')->range_title(0, 50);
foreach($query as $value) {
$articlelist[] = $value;
$count++;
}
}
$category = category_showselect('portal', 'searchcate', false, $_GET['searchcate']);
include_once template("portal/portalcp_related_article");
?>

View File

@@ -0,0 +1,73 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: portalcp_topic.php 27484 2012-02-02 05:08:02Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$allowmanage = $allowadd = 0;
if($_G['group']['allowaddtopic'] || $_G['group']['allowmanagetopic']) {
$allowadd = 1;
}
$op = in_array($_GET['op'], array('edit')) ? $_GET['op'] : 'add';
$topicid = $_GET['topicid'] ? intval($_GET['topicid']) : 0;
$topic = '';
if($topicid) {
$topic = C::t('portal_topic')->fetch($topicid);
if(empty($topic)) {
showmessage('topic_not_exist');
}
if($_G['group']['allowmanagetopic'] || ($_G['group']['allowaddtopic'] && $topic['uid'] == $_G['uid'])) {
$allowmanage = 1;
}
$coverpath = $topic['picflag'] == '0' ? $topic['cover'] : '';
if($topic['cover']) {
if($topic['picflag'] == '1') {
$topic['cover'] = $_G['setting']['attachurl'].$topic['cover'];
} elseif ($topic['picflag'] == '2') {
$topic['cover'] = $_G['setting']['ftp']['attachurl'].$topic['cover'];
}
}
}
if(($topicid && !$allowmanage) || (!$topicid && !$allowadd)) {
showmessage('topic_edit_nopermission', dreferer());
}
$tpls = array();
foreach($alltemplate = C::t('common_template')->range() as $template) {
if(($dir = dir(DISCUZ_ROOT.$template['directory'].'/portal/'))) {
while(false !== ($file = $dir->read())) {
$file = strtolower($file);
if (fileext($file) == 'htm' && substr($file, 0, 13) == 'portal_topic_') {
$tpls[$template['directory'].':portal/'.str_replace('.htm','',$file)] = getprimaltplname($template['directory'].':portal/'.$file);
}
}
}
}
if (empty($tpls)) showmessage('topic_has_on_template', dreferer());
if(submitcheck('editsubmit')) {
include_once libfile('function/portalcp');
if(is_numeric($topicid = updatetopic($topic))){
showmessage('do_success', 'portal.php?mod=topic&topicid='.$topicid);
} else {
showmessage($topicid, dreferer());
}
}
include_once template("portal/portalcp_topic");
?>

View File

@@ -0,0 +1,198 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: portalcp_upload.php 30107 2012-05-11 02:10:58Z svn_project_zhangjie $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$operation = $_GET['op'] ? $_GET['op'] : '';
$upload = new discuz_upload();
$downremotefile = false;
$aid = intval(getgpc('aid'));
$catid = intval(getgpc('catid'));
if($aid) {
$article = C::t('portal_article_title')->fetch($aid);
if(!$article) {
portal_upload_error(lang('portalcp', 'article_noexist'));
}
if(check_articleperm($catid, $aid, $article, false, true) !== true) {
portal_upload_error(lang('portalcp', 'article_noallowed'));
}
} else {
if(($return = check_articleperm($catid, $aid, null, false, true)) !== true) {
portal_upload_error(lang('portalcp', $return));
}
}
if($operation == 'downremotefile') {
$arrayimageurl = $temp = $imagereplace = array();
$string = $_GET['content'];
$downremotefile = true;
preg_match_all("/\<img.+\bsrc\b\s*=('|\"|)(.*)('|\"|)([\s].*)?\>/ismU", $string, $temp, PREG_SET_ORDER);
if(is_array($temp) && !empty($temp)) {
foreach($temp as $tempvalue) {
$tempvalue[2] = str_replace('\"', '', $tempvalue[2]);
if(strlen($tempvalue[2])){
$arrayimageurl[] = $tempvalue[2];
}
}
$arrayimageurl = array_unique($arrayimageurl);
if($arrayimageurl) {
foreach($arrayimageurl as $tempvalue) {
$imageurl = $tempvalue;
$imagereplace['oldimageurl'][] = $imageurl;
$attach['ext'] = $upload->fileext($imageurl);
if(!$upload->is_image_ext($attach['ext'])) {
continue;
}
$content = '';
if(preg_match('/^(http(s?):\/\/|\.)/i', $imageurl)) {
$content = dfsockopen($imageurl);
} elseif(checkperm('allowdownlocalimg')) {
if(preg_match('/^data\/(.*?)\.thumb\.jpg$/i', $imageurl)) {
$content = file_get_contents(substr($imageurl, 0, strrpos($imageurl, '.')-6));
} elseif(preg_match('/^data\/(.*?)\.(jpg|jpeg|gif|png)$/i', $imageurl)) {
$content = file_get_contents($imageurl);
}
}
if(empty($content)) continue;
$temp = explode('/', $imageurl);
$attach['name'] = trim($temp[count($temp)-1]);
$attach['thumb'] = '';
$attach['isimage'] = $upload -> is_image_ext($attach['ext']);
$attach['extension'] = $upload -> get_target_extension($attach['ext']);
$attach['attachdir'] = $upload -> get_target_dir('portal');
$attach['attachment'] = $attach['attachdir'] . $upload->get_target_filename('portal').'.'.$attach['extension'];
$attach['target'] = getglobal('setting/attachdir').'./portal/'.$attach['attachment'];
if(!@$fp = fopen($attach['target'], 'wb')) {
continue;
} else {
flock($fp, 2);
fwrite($fp, $content);
fclose($fp);
}
if(!$upload->get_image_info($attach['target'])) {
@unlink($attach['target']);
continue;
}
$attach['size'] = filesize($attach['target']);
$attachs[] = daddslashes($attach);
}
}
}
} else {
$upload->init($_FILES['attach'], 'portal');
$attach = $upload->attach;
if(!$upload->error()) {
$upload->save();
}
if($upload->error()) {
portal_upload_error($upload->error());
}
$attachs[] = $attach;
}
if($attachs) {
foreach($attachs as $attach) {
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']));
portal_upload_error(lang('portalcp', 'upload_remote_failed'));
}
}
}
$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($downremotefile) {
$attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'portal/';
$imagereplace['newimageurl'][] = $attach['url'].$attach['attachment'];
}
portal_upload_show($setarr);
}
if($downremotefile && $imagereplace) {
$string = preg_replace(array("/\<(script|style|iframe)[^\>]*?\>.*?\<\/(\\1)\>/si", "/\<!*(--|doctype|html|head|meta|link|body)[^\>]*?\>/si"), '', $string);
$string = str_replace($imagereplace['oldimageurl'], $imagereplace['newimageurl'], $string);
$string = str_replace("\n", '<br>', $string);
$string = str_replace(array("\r", "\n", "\r\n"), '', addcslashes($string, '/"\\\''));
print <<<EOF
<script type="text/javascript">
var f = parent.window.frames["uchome-ifrHtmlEditor"].window.frames["HtmlEditor"];
f.document.body.innerHTML = '$string';
</script>
EOF;
}
exit();
}
function portal_upload_error($msg) {
echo '<script>';
echo 'if(parent.$(\'localfile_'.$_GET['attach_target_id'].'\') != null)parent.$(\'localfile_'.$_GET['attach_target_id'].'\').innerHTML = \''.lang('portalcp', 'upload_error').$msg.'\';else alert(\''.$msg.'\')';
echo '</script>';
exit();
}
function portal_upload_show($attach) {
global $_G;
$imagehtml = $filehtml = $coverstr ='';
if($attach['isimage']) {
$imagehtml = get_uploadcontent($attach, 'portal', 'upload');
$coverstr = addslashes(serialize(array('pic'=>'portal/'.$attach['attachment'], 'thumb'=>$attach['thumb'], 'remote'=>$attach['remote'])));
} else {
$filehtml = get_uploadcontent($attach, 'portal', 'upload');
}
echo '<script type="text/javascript" src="'.$_G['setting']['jspath'].'handlers.js?'.$_G['style']['verhash'].'"></script>';
echo '<script>';
if($imagehtml) echo 'var tdObj = getInsertTdId(parent.$(\'imgattachlist\'), \'attach_list_'.$attach['attachid'].'\');tdObj.innerHTML = \''.addslashes($imagehtml).'\';';
if($filehtml) echo 'parent.$(\'attach_file_body\').innerHTML = \''.addslashes($filehtml).'\'+parent.$(\'attach_file_body\').innerHTML;';
echo 'if(parent.$(\'localfile_'.$_GET['attach_target_id'].'\') != null)parent.$(\'localfile_'.$_GET['attach_target_id'].'\').style.display = \'none\';';
echo 'parent.$(\'attach_ids\').value += \','.$attach['attachid'].'\';';
if($coverstr) echo 'if(parent.$(\'conver\').value == \'\')parent.$(\'conver\').value = \''.$coverstr.'\';';
echo '</script>';
}
?>

View File

View File

@@ -0,0 +1,37 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: post_albumphoto.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if (!defined('IN_DISCUZ')) {
exit('Access Denied');
}
include_once libfile('function/home');
$perpage = 8;
$page = max(1, $_GET['page']);
$start_limit = ($page - 1) * $perpage;
$aid = intval($_GET['aid']);
$photolist = array();
$query = C::t('home_album')->fetch_all_by_uid($_G['uid'], false, 0, 0, $aid);
$count = $query[0]['picnum'];
$albuminfo = C::t('home_album')->fetch_album($aid, $_G['uid']);
if(empty($albuminfo)) {
showmessage('to_view_the_photo_does_not_exist');
}
$query = C::t('home_pic')->fetch_all_by_albumid($aid, $start_limit, $perpage, 0, 0, 1);
foreach($query as $value) {
$value['bigpic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote'], 0);
$value['pic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote']);
$value['count'] = $count;
$value['url'] = (preg_match('/^https?:\/\//is', $value['bigpic']) ? '' : $_G['siteurl']) . $value['bigpic'];
$value['thumburl'] = (preg_match('/^https?:\/\//is', $value['pic']) ? '' : $_G['siteurl']) . $value['pic'];
$photolist[] = $value;
}
$_GET['ajaxtarget'] = 'albumphoto';
$multi = multi($count, $perpage, $page, "forum.php?mod=post&action=albumphoto&aid=$aid");
include template('forum/ajax_albumlist');
exit;

View File

@@ -0,0 +1,530 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: post_editpost.php 36284 2016-12-12 00:47:50Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$orig = get_post_by_tid_pid($_G['tid'], $pid);
$isfirstpost = $orig['first'] ? 1 : 0;
if($isfirstpost && (($special == 1 && !$_G['group']['allowpostpoll']) || ($special == 2 && !$_G['group']['allowposttrade']) || ($special == 3 && !$_G['group']['allowpostreward']) || ($special == 4 && !$_G['group']['allowpostactivity']) || ($special == 5 && !$_G['group']['allowpostdebate']))) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
if($_G['setting']['magicstatus']) {
$magiclog = C::t('forum_threadmod')->fetch_by_tid_magicid($_G['tid'], 10);
$magicid = $magiclog['magicid'];
$_G['group']['allowanonymous'] = $_G['group']['allowanonymous'] || $magicid ? 1 : $_G['group']['allowanonymous'];
}
$isorigauthor = $_G['uid'] && $_G['uid'] == $orig['authorid'];
$isanonymous = ($_G['group']['allowanonymous'] || $orig['anonymous']) && getgpc('isanonymous') ? 1 : 0;
$audit = $orig['invisible'] == -2 || $thread['displayorder'] == -2 ? $_GET['audit'] : 0;
if(empty($orig)) {
showmessage('post_nonexistence');
} elseif((!$_G['forum']['ismoderator'] || !$_G['group']['alloweditpost'] || (in_array($orig['adminid'], array(1, 2, 3)) && $_G['adminid'] > $orig['adminid'])) && !(($_G['forum']['alloweditpost'] || $orig['invisible'] == -3)&& $isorigauthor)) {
showmessage('post_edit_nopermission', NULL);
} elseif($isorigauthor && !$_G['forum']['ismoderator'] && $orig['invisible'] != -3) {
$alloweditpost_status = getstatus($_G['setting']['alloweditpost'], $special + 1);
if(!$alloweditpost_status && $_G['group']['edittimelimit'] && TIMESTAMP - $orig['dateline'] > $_G['group']['edittimelimit'] * 60) {
showmessage('post_edit_timelimit', NULL, array('edittimelimit' => $_G['group']['edittimelimit']));
}
}
$thread['pricedisplay'] = $thread['price'] == -1 ? 0 : $thread['price'];
if($special == 5) {
$debate = array_merge($thread, daddslashes(C::t('forum_debate')->fetch($_G['tid'])));
$firststand = C::t('forum_debatepost')->get_firststand($_G['tid'], $_G['uid']);
if(!$isfirstpost && $debate['endtime'] && $debate['endtime'] < TIMESTAMP && !$_G['forum']['ismoderator']) {
showmessage('debate_end');
}
if($isfirstpost && $debate['umpirepoint'] && !$_G['forum']['ismoderator']) {
showmessage('debate_umpire_comment_invalid');
}
}
$rushreply = getstatus($thread['status'], 3);
if($isfirstpost && $isorigauthor && $_G['group']['allowreplycredit']) {
if($replycredit_rule = C::t('forum_replycredit')->fetch($_G['tid'])) {
if($thread['replycredit']) {
$replycredit_rule['lasttimes'] = $thread['replycredit'] / $replycredit_rule['extcredits'];
}
$replycredit_rule['extcreditstype'] = $replycredit_rule['extcreditstype'] ? $replycredit_rule['extcreditstype'] : $_G['setting']['creditstransextra'][10];
}
}
if(!submitcheck('editsubmit')) {
$thread['hiddenreplies'] = getstatus($thread['status'], 2);
$postinfo = C::t('forum_post')->fetch_post('tid:'.$_G['tid'], $pid);
if($postinfo['fid'] != $_G['fid'] || $postinfo['tid'] != $_G['tid']) {
$postinfo = array();
}
$usesigcheck = $postinfo['usesig'] ? 'checked="checked"' : '';
$urloffcheck = $postinfo['parseurloff'] ? 'checked="checked"' : '';
$smileyoffcheck = $postinfo['smileyoff'] == 1 ? 'checked="checked"' : '';
$codeoffcheck = $postinfo['bbcodeoff'] == 1 ? 'checked="checked"' : '';
$tagoffcheck = $postinfo['htmlon'] & 2 ? 'checked="checked"' : '';
$htmloncheck = $postinfo['htmlon'] & 1 ? 'checked="checked"' : '';
if(!$isfirstpost) {
$_G['group']['allowimgcontent'] = 0;
}
if($isfirstpost && $imgcontentcheck && $_G['group']['allowimgcontent']) {
$editor['editormode'] = 0;
}
if($htmloncheck) {
$editor['editormode'] = 0;
$editor['allowswitcheditor'] = 1;
}
$showthreadsorts = ($thread['sortid'] || !empty($sortid)) && $isfirstpost;
$sortid = empty($sortid) ? $thread['sortid'] : $sortid;
$poll = $temppoll = array();
if($isfirstpost) {
if($postinfo['tags']) {
$tagarray_all = $array_temp = $threadtag_array = array();
$tagarray_all = explode("\t", $postinfo['tags']);
if($tagarray_all) {
foreach($tagarray_all as $var) {
if($var) {
$array_temp = explode(',', $var);
$threadtag_array[] = $array_temp['1'];
}
}
}
$postinfo['tag'] = implode(',', $threadtag_array);
}
$allownoticeauthor = getstatus($thread['status'], 6);
if($rushreply) {
$postinfo['rush'] = C::t('forum_threadrush')->fetch($_G['tid']);
if($postinfo['rush']['creditlimit'] == -996) {
$postinfo['rush']['creditlimit'] = '';
}
$postinfo['rush']['stopfloor'] = $postinfo['rush']['stopfloor'] ? $postinfo['rush']['stopfloor'] : '';
$postinfo['rush']['starttimefrom'] = $postinfo['rush']['starttimefrom'] ? dgmdate($postinfo['rush']['starttimefrom'], 'Y-m-d H:i') : '';
$postinfo['rush']['starttimeto'] = $postinfo['rush']['starttimeto'] ? dgmdate($postinfo['rush']['starttimeto'], 'Y-m-d H:i') : '';
}
if($special == 127) {
$sppos = strpos($postinfo['message'], chr(0).chr(0).chr(0));
$specialextra = substr($postinfo['message'], $sppos + 3);
if($specialextra && array_key_exists($specialextra, $_G['setting']['threadplugins']) && in_array($specialextra, $_G['forum']['threadplugin']) && in_array($specialextra, $_G['group']['allowthreadplugin'])) {
$postinfo['message'] = substr($postinfo['message'], 0, $sppos);
} else {
showmessage('post_edit_nopermission_threadplign');
$special = 0;
$specialextra = '';
}
}
$thread['freecharge'] = $_G['setting']['maxchargespan'] && TIMESTAMP - $thread['dateline'] >= $_G['setting']['maxchargespan'] * 3600 ? 1 : 0;
$freechargehours = !$thread['freecharge'] ? $_G['setting']['maxchargespan'] - intval((TIMESTAMP - $thread['dateline']) / 3600) : 0;
if($thread['special'] == 1 && ($_G['group']['alloweditpoll'] || $thread['authorid'] == $_G['uid'])) {
$pollinfo = C::t('forum_poll')->fetch($_G['tid']);
if($pollinfo['isimage']) {
$pollimages = C::t('forum_polloption_image')->fetch_all_by_tid($_G['tid']);
require_once libfile('function/home');
}
$query = C::t('forum_polloption')->fetch_all_by_tid($_G['tid']);
foreach($query as $temppoll) {
$poll['multiple'] = $pollinfo['multiple'];
$poll['visible'] = $pollinfo['visible'];
$poll['maxchoices'] = $pollinfo['maxchoices'];
$poll['expiration'] = $pollinfo['expiration'];
$poll['overt'] = $pollinfo['overt'];
$poll['isimage'] = $pollinfo['isimage'];
$poll['polloptionid'][] = $temppoll['polloptionid'];
$poll['displayorder'][] = $temppoll['displayorder'];
$poll['polloption'][] = $temppoll['polloption'];
$attach = array();
if($pollinfo['isimage'] && $pollimages[$temppoll['polloptionid']]) {
$attach = $pollimages[$temppoll['polloptionid']];
$attach['small'] = pic_get($attach['attachment'], 'forum', $attach['thumb'], $attach['remote']);
$attach['big'] = pic_get($attach['attachment'], 'forum', 0, $attach['remote']);
$poll['imginfo'][$temppoll['polloptionid']] = $attach;
}
}
} elseif($thread['special'] == 3) {
$rewardprice = $thread['price'];
} elseif($thread['special'] == 4) {
$activitytypelist = $_G['setting']['activitytype'] ? explode("\n", trim($_G['setting']['activitytype'])) : '';
$activity = C::t('forum_activity')->fetch($_G['tid']);
$activity['starttimefrom'] = dgmdate($activity['starttimefrom'], 'Y-m-d H:i');
$activity['starttimeto'] = $activity['starttimeto'] ? dgmdate($activity['starttimeto'], 'Y-m-d H:i') : '';
$activity['expiration'] = $activity['expiration'] ? dgmdate($activity['expiration'], 'Y-m-d H:i') : '';
$activity['ufield'] = $activity['ufield'] ? dunserialize($activity['ufield']) : array();
if($activity['ufield']['extfield']) {
$activity['ufield']['extfield'] = implode("\n", $activity['ufield']['extfield']);
}
} elseif($thread['special'] == 5 ) {
$debate['endtime'] = $debate['endtime'] ? dgmdate($debate['endtime'], 'Y-m-d H:i') : '';
}
if ($_G['group']['allowsetpublishdate']) {
loadcache('cronpublish');
$cron_publish_ids = getglobal('cache/cronpublish');
if (in_array($_G['tid'], (array)$cron_publish_ids)) {
$cronpublish = 1;
$cronpublishdate = dgmdate($thread['dateline'], "dt");
}
}
}
if($thread['special'] == 2 && ($thread['authorid'] == $_G['uid'] && $_G['group']['allowposttrade'] || $_G['group']['allowedittrade'])) {
$trade = C::t('forum_trade')->fetch_goods(0, $pid);
if($trade) {
$trade['expiration'] = $trade['expiration'] ? date('Y-m-d', $trade['expiration']) : '';
$trade['costprice'] = $trade['costprice'] > 0 ? $trade['costprice'] : '';
$trade['message'] = dhtmlspecialchars($trade['message']);
$expiration_7days = date('Y-m-d', TIMESTAMP + 86400 * 7);
$expiration_14days = date('Y-m-d', TIMESTAMP + 86400 * 14);
$expiration_month = date('Y-m-d', mktime(0, 0, 0, date('m')+1, date('d'), date('Y')));
$expiration_3months = date('Y-m-d', mktime(0, 0, 0, date('m')+3, date('d'), date('Y')));
$expiration_halfyear = date('Y-m-d', mktime(0, 0, 0, date('m')+6, date('d'), date('Y')));
$expiration_year = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y')+1));
} else {
$special = 0;
$trade = array();
}
}
if($isfirstpost && $specialextra) {
@include_once DISCUZ_ROOT.'./source/plugin/'.$_G['setting']['threadplugins'][$specialextra]['module'].'.class.php';
$classname = 'threadplugin_'.$specialextra;
if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'editpost')) {
$threadplughtml = $threadpluginclass->editpost($_G['fid'], $_G['tid']);
}
}
$postinfo['subject'] = str_replace('"', '&quot;', $postinfo['subject']);
$postinfo['message'] = dhtmlspecialchars($postinfo['message']);
$selectgroupid = 0;
if($postinfo['first'] == 1) {
preg_match("/(\[groupid=(\d+)\].*\[\/groupid\])/i", $postinfo['message'], $matchs);
if($matchs) {
$postinfo['message'] = str_replace($matchs[1], '', $postinfo['message']);
$selectgroupid = $matchs[2];
}
if(helper_access::check_module('group')) {
$mygroups = $groupids = array();
$groupids = C::t('forum_groupuser')->fetch_all_fid_by_uids($_G['uid']);
array_slice($groupids, 0, 20);
$query = C::t('forum_forum')->fetch_all_info_by_fids($groupids);
foreach($query as $group) {
$mygroups[$group['fid']] = $group['name'];
}
}
}
$language = lang('forum/misc');
$postinfo['message'] = preg_replace($postinfo['htmlon'] ? $language['post_edithtml_regexp'] : (!$_G['forum']['allowbbcode'] || $postinfo['bbcodeoff'] ? $language['post_editnobbcode_regexp'] : $language['post_edit_regexp']), '', $postinfo['message']);
if($special == 5) {
$standselected = array($firststand => 'selected="selected"');
}
if($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) {
$attachlist = getattach($pid);
$attachs = $attachlist['attachs'];
$imgattachs = $attachlist['imgattachs'];
unset($attachlist);
$attachfind = $attachreplace = array();
if(!empty($attachs['used'])) {
foreach($attachs['used'] as $attach) {
if($attach['isimage']) {
$attachfind[] = "/\[attach\]{$attach['aid']}\[\/attach\]/i";
$attachreplace[] = '[attachimg]'.$attach['aid'].'[/attachimg]';
}
}
}
if(!empty($imgattachs['used'])) {
foreach($imgattachs['used'] as $attach) {
$attachfind[] = "/\[attach\]{$attach['aid']}\[\/attach\]/i";
$attachreplace[] = '[attachimg]'.$attach['aid'].'[/attachimg]';
}
}
$attachfind && $postinfo['message'] = preg_replace($attachfind, $attachreplace, $postinfo['message']);
}
if($special == 2 && $trade['aid'] && !empty($imgattachs['used']) && is_array($imgattachs['used'])) {
foreach($imgattachs['used'] as $k => $tradeattach) {
if($tradeattach['aid'] == $trade['aid']) {
unset($imgattachs['used'][$k]);
break;
}
}
}
if($special == 4 && $activity['aid'] && !empty($imgattachs['used']) && is_array($imgattachs['used'])) {
foreach($imgattachs['used'] as $k => $activityattach) {
if($activityattach['aid'] == $activity['aid']) {
unset($imgattachs['used'][$k]);
break;
}
}
}
if($sortid) {
require_once libfile('post/threadsorts', 'include');
foreach($_G['forum_optionlist'] as $option) {
if($option['type'] == 'image') {
foreach($imgattachs['used'] as $k => $sortattach) {
if($sortattach['aid'] == $option['value']['aid']) {
unset($imgattachs['used'][$k]);
break;
}
}
}
}
}
$imgattachs['unused'] = !$sortid ? (isset($imgattachs['unused']) ? $imgattachs['unused'] : '') : '';
include template('forum/post');
} else {
if($_GET['mygroupid']) {
$mygroupid = explode('__', $_GET['mygroupid']);
$mygid = intval($mygroupid[0]);
if($mygid) {
$mygname = $mygroupid[1];
if(count($mygroupid) > 2) {
unset($mygroupid[0]);
$mygname = implode('__', $mygroupid);
}
$message .= '[groupid='.intval($mygid).']'.$mygname.'[/groupid]';
}
}
$modpost = C::m('forum_post', $_G['tid'], $pid);
$modpost->param('redirecturl', "forum.php?mod=viewthread&tid={$_G['tid']}&page={$_GET['page']}&extra=$extra".($vid && $isfirstpost ? "&vid=$vid" : '')."#pid$pid");
if(empty($_GET['delete'])) {
if($isfirstpost) {
if($thread['special'] == 1 && ($_G['group']['alloweditpoll'] || $isorigauthor) && !empty($_GET['polls'])) {
} elseif($thread['special'] == 3 && $isorigauthor) {
} elseif($thread['special'] == 4 && $_G['group']['allowpostactivity']) {
} elseif($thread['special'] == 5 && $_G['group']['allowpostdebate']) {
} elseif($specialextra) {
@include_once DISCUZ_ROOT.'./source/plugin/'.$_G['setting']['threadplugins'][$specialextra]['module'].'.class.php';
$classname = 'threadplugin_'.$specialextra;
if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'editpost_submit')) {
$threadpluginclass->editpost_submit($_G['fid'], $_G['tid']);
}
}
} else {
}
$feed = array();
if($isfirstpost && $special == 127) {
$message .= chr(0).chr(0).chr(0).$specialextra;
}
if($isfirstpost) {
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_sort', 'method' => 'before_editpost'));
if($thread['special'] == 3) {
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_reward', 'method' => 'before_editpost'));
}
if($thread['special'] == 1) {
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_poll', 'method' => 'before_editpost'));
}
if($thread['special'] == 4 && $_G['group']['allowpostactivity']) {
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_activity', 'method' => 'before_editpost'));
}
if($thread['special'] == 5 && $_G['group']['allowpostdebate']) {
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_debate', 'method' => 'before_editpost'));
}
if($_G['group']['allowreplycredit']) {
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_replycredit', 'method' => 'before_editpost'));
}
if($rushreply) {
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_rushreply', 'method' => 'before_editpost'));
}
$modpost->attach_after_method('editpost', array('class' => 'extend_thread_follow', 'method' => 'after_editpost'));
}
if($_G['group']['allowat']) {
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_allowat', 'method' => 'before_editpost'));
$modpost->attach_after_method('editpost', array('class' => 'extend_thread_allowat', 'method' => 'after_editpost'));
}
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_image', 'method' => 'before_editpost'));
if($special == '2' && $_G['group']['allowposttrade']) {
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_trade', 'method' => 'before_editpost'));
}
$modpost->attach_before_method('editpost', array('class' => 'extend_thread_filter', 'method' => 'before_editpost'));
$modpost->attach_after_method('editpost', array('class' => 'extend_thread_filter', 'method' => 'after_editpost'));
$param = array(
'subject' => $subject,
'message' => $message,
'special' => $special,
'sortid' => $sortid,
'typeid' => $typeid,
'isanonymous' => $isanonymous,
'cronpublish' => $_GET['cronpublish'],
'cronpublishdate' => $_GET['cronpublishdate'],
'save' => $_GET['save'],
'readperm' => $readperm,
'price' => $_GET['price'],
'ordertype' => $_GET['ordertype'],
'hiddenreplies' => $_GET['hiddenreplies'],
'allownoticeauthor' => $_GET['allownoticeauthor'],
'audit' => $_GET['audit'],
'tags' => $_GET['tags'],
'bbcodeoff' => $_GET['bbcodeoff'],
'smileyoff' => $_GET['smileyoff'],
'parseurloff' => $_GET['parseurloff'],
'usesig' => $_GET['usesig'],
'htmlon' => $_GET['htmlon'],
'extramessage' => $extramessage,
);
if($_G['group']['allowimgcontent']) {
$param['imgcontent'] = $_GET['imgcontent'];
$param['imgcontentwidth'] = $_G['setting']['imgcontentwidth'] ? intval($_G['setting']['imgcontentwidth']) : 100;
}
if($isfirstpost && $isorigauthor && $_G['group']['allowreplycredit']) {
$param['replycredit_rule'] = $replycredit_rule;
}
$modpost->editpost($param);
} else {
if($thread['special'] == 3) {
$modpost->attach_before_method('deletepost', array('class' => 'extend_thread_reward', 'method' => 'before_deletepost'));
}
if($rushreply) {
$modpost->attach_before_method('deletepost', array('class' => 'extend_thread_rushreply', 'method' => 'before_deletepost'));
}
if($thread['replycredit'] && $isfirstpost) {
$modpost->attach_before_method('deletepost', array('class' => 'extend_thread_replycredit', 'method' => 'before_deletepost'));
}
$modpost->attach_before_method('deletepost', array('class' => 'extend_thread_image', 'method' => 'before_deletepost'));
if($thread['special'] == 2) {
$modpost->attach_after_method('deletepost', array('class' => 'extend_thread_trade', 'method' => 'after_deletepost'));
}
if($isfirstpost) {
$modpost->attach_after_method('deletepost', array('class' => 'extend_thread_sort', 'method' => 'after_deletepost'));
}
$modpost->attach_after_method('deletepost', array('class' => 'extend_thread_filter', 'method' => 'after_deletepost'));
$param = array(
'special' => $special,
'isanonymous' => $isanonymous,
);
$modpost->deletepost($param);
}
if($specialextra) {
@include_once DISCUZ_ROOT.'./source/plugin/'.$_G['setting']['threadplugins'][$specialextra]['module'].'.class.php';
$classname = 'threadplugin_'.$specialextra;
if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'editpost_submit_end')) {
$threadpluginclass->editpost_submit_end($_G['fid'], $_G['tid']);
}
}
if($_G['forum']['threadcaches']) {
deletethreadcaches($_G['tid']);
}
$param = array('fid' => $_G['fid'], 'tid' => $_G['tid'], 'pid' => $pid);
dsetcookie('clearUserdata', 'forum');
if($_G['forum_auditstatuson']) {
if($audit == 1) {
updatemoderate($isfirstpost ? 'tid' : 'pid', $isfirstpost ? $_G['tid'] : $pid, '2');
showmessage('auditstatuson_succeed', $modpost->param('redirecturl'), $param);
} else {
updatemoderate($isfirstpost ? 'tid' : 'pid', $isfirstpost ? $_G['tid'] : $pid);
showmessage('audit_edit_succeed', '', $param, array('alert' => 'right'));
}
} else {
if(!empty($_GET['delete']) && $isfirstpost) {
showmessage('post_edit_delete_succeed', "forum.php?mod=forumdisplay&fid={$_G['fid']}", $param);
} elseif(!empty($_GET['delete'])) {
showmessage('post_edit_delete_succeed', "forum.php?mod=viewthread&tid={$_G['tid']}&page={$_GET['page']}&extra=$extra".($vid && $isfirstpost ? "&vid=$vid" : ''), $param);
} else {
if($isfirstpost && $modpost->param('modnewthreads')) {
C::t('forum_post')->update_post($thread['posttableid'], $pid, array('status' => 4), false, false, null, -2, null, 0);
updatemoderate('tid', $_G['tid']);
showmessage('edit_newthread_mod_succeed', $modpost->param('redirecturl'), $param);
} elseif(!$isfirstpost && $modpost->param('modnewreplies')) {
C::t('forum_post')->update_post($thread['posttableid'], $pid, array('status' => 4), false, false, null, -2, null, 0);
updatemoderate('pid', $pid);
showmessage('edit_reply_mod_succeed', "forum.php?mod=forumdisplay&fid={$_G['fid']}", $param);
} else {
showmessage('post_edit_succeed', $modpost->param('redirecturl'), $param);
}
}
}
}
?>

View File

@@ -0,0 +1,464 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: post_newreply.php 33709 2013-08-06 09:06:56Z andyzheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('function/forumlist');
$isfirstpost = 0;
$_G['group']['allowimgcontent'] = 0;
$showthreadsorts = 0;
$quotemessage = '';
if($special == 5) {
$debate = array_merge($thread, daddslashes(C::t('forum_debate')->fetch($_G['tid'])));
$firststand = C::t('forum_debatepost')->get_firststand($_G['tid'], $_G['uid']);
$stand = $firststand ? $firststand : intval($_GET['stand']);
if($debate['endtime'] && $debate['endtime'] < TIMESTAMP) {
showmessage('debate_end');
}
}
if(!$_G['uid'] && !((!$_G['forum']['replyperm'] && $_G['group']['allowreply']) || ($_G['forum']['replyperm'] && forumperm($_G['forum']['replyperm'])))) {
showmessage('replyperm_login_nopermission', NULL, array(), array('login' => 1));
} elseif(empty($_G['forum']['allowreply'])) {
if(!$_G['forum']['replyperm'] && !$_G['group']['allowreply']) {
showmessage('replyperm_none_nopermission', NULL, array(), array('login' => 1));
} elseif($_G['forum']['replyperm'] && !forumperm($_G['forum']['replyperm'])) {
showmessagenoperm('replyperm', $_G['forum']['fid']);
}
} elseif($_G['forum']['allowreply'] == -1) {
showmessage('post_forum_newreply_nopermission', NULL);
}
if(!$_G['uid'] && ($_G['setting']['need_avatar'] || $_G['setting']['need_secmobile'] || $_G['setting']['need_email'] || $_G['setting']['need_friendnum'])) {
showmessage('replyperm_login_nopermission', NULL, array(), array('login' => 1));
}
if(empty($thread)) {
showmessage('thread_nonexistence');
} elseif($thread['price'] > 0 && $thread['special'] == 0 && !$_G['uid']) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
} elseif($thread['readperm'] && $thread['readperm'] > $_G['group']['readaccess'] && $thread['authorid'] != $_G['uid']){ //readperm verify, thread poster excluded
showmessagenoperm('replyperm', $_G['forum']['fid']);
}
checklowerlimit('reply', 0, 1, $_G['forum']['fid']);
if($_G['setting']['commentnumber'] && !empty($_GET['comment'])) {
if(!submitcheck('commentsubmit', 0, $seccodecheck, $secqaacheck)) {
showmessage('submitcheck_error', NULL);
}
$post = C::t('forum_post')->fetch_post('tid:'.$_G['tid'], $_GET['pid']);
if(!$post || !($_G['setting']['commentpostself'] || $post['authorid'] != $_G['uid']) || !(($post['first'] && $_G['setting']['commentfirstpost'] && in_array($_G['group']['allowcommentpost'], array(1, 3)) || (!$post['first'] && in_array($_G['group']['allowcommentpost'], array(2, 3)))))) {
showmessage('postcomment_error');
}
if($thread['closed'] && !$_G['forum']['ismoderator'] && !$thread['isgroup']) {
showmessage('post_thread_closed');
} elseif(!$thread['isgroup'] && $post_autoclose = checkautoclose($thread)) {
showmessage($post_autoclose, '', array('autoclose' => $_G['forum']['autoclose']));
} elseif(checkflood()) {
showmessage('post_flood_ctrl', '', array('floodctrl' => $_G['setting']['floodctrl']));
} elseif(checkmaxperhour('pid')) {
showmessage('post_flood_ctrl_posts_per_hour', '', array('posts_per_hour' => $_G['group']['maxpostsperhour']));
}
$commentscore = '';
if(!empty($_GET['commentitem']) && !empty($_G['uid']) && $post['authorid'] != $_G['uid']) {
foreach($_GET['commentitem'] as $itemk => $itemv) {
if($itemv !== '') {
$commentscore .= strip_tags(trim($itemk)).': <i>'.intval($itemv).'</i> ';
}
}
}
$comment = cutstr(($commentscore ? $commentscore.'<br />' : '').censor(trim(dhtmlspecialchars($_GET['message'])), '***'), 200, ' ');
if(!$comment) {
showmessage('post_sm_isnull');
}
$pcid = C::t('forum_postcomment')->insert(array(
'tid' => $post['tid'],
'pid' => $post['pid'],
'author' => $_G['username'],
'authorid' => $_G['uid'],
'dateline' => TIMESTAMP,
'comment' => $comment,
'score' => $commentscore ? 1 : 0,
'useip' => $_G['clientip'],
'port'=> $_G['remoteport']
), true);
C::t('forum_post')->update_post('tid:'.$_G['tid'], $_GET['pid'], array('comment' => 1));
$comments = $thread['comments'] ? $thread['comments'] + 1 : C::t('forum_postcomment')->count_by_tid($_G['tid']);
C::t('forum_thread')->update($_G['tid'], array('comments' => $comments));
!empty($_G['uid']) && $thread['displayorder'] != -4 && updatepostcredits('+', $_G['uid'], 'reply', $_G['fid']);
if(!empty($_G['uid']) && $_G['uid'] != $post['authorid']) {
notification_add($post['authorid'], 'pcomment', 'comment_add', array(
'tid' => $_G['tid'],
'pid' => $_GET['pid'],
'subject' => $thread['subject'],
'from_id' => $_G['tid'],
'from_idtype' => 'pcomment',
'commentmsg' => cutstr(str_replace(array('[b]', '[/b]', '[/color]'), '', preg_replace("/\[color=([#\w]+?)\]/i", "", $comment)), 200)
));
}
update_threadpartake($post['tid']);
$pcid = C::t('forum_postcomment')->fetch_standpoint_by_pid($_GET['pid']);
$pcid = $pcid['id'];
if(!empty($_G['uid']) && $_GET['commentitem']) {
$totalcomment = array();
foreach(C::t('forum_postcomment')->fetch_all_by_pid_score($_GET['pid'], 1) as $comment) {
$comment['comment'] = addslashes($comment['comment']);
if(strexists($comment['comment'], '<br />')) {
if(preg_match_all("/([^:]+?):\s<i>(\d+)<\/i>/", $comment['comment'], $a)) {
foreach($a[1] as $k => $itemk) {
$totalcomment[trim($itemk)][] = $a[2][$k];
}
}
}
}
$totalv = '';
foreach($totalcomment as $itemk => $itemv) {
$totalv .= strip_tags(trim($itemk)).': <i>'.(floatval(sprintf('%1.1f', array_sum($itemv) / count($itemv)))).'</i> ';
}
if($pcid) {
C::t('forum_postcomment')->update($pcid, array('comment' => $totalv, 'dateline' => TIMESTAMP + 1));
} else {
C::t('forum_postcomment')->insert(array(
'tid' => $post['tid'],
'pid' => $post['pid'],
'author' => '',
'authorid' => '-1',
'dateline' => TIMESTAMP + 1,
'comment' => $totalv
));
}
}
C::t('forum_postcache')->delete($post['pid']);
showmessage('comment_add_succeed', "forum.php?mod=viewthread&tid={$post['tid']}&pid={$post['pid']}&page={$_GET['page']}&extra=$extra#pid{$post['pid']}", array('tid' => $post['tid'], 'pid' => $post['pid']));
}
if($special == 127) {
$postinfo = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_G['tid']);
$sppos = strrpos($postinfo['message'], chr(0).chr(0).chr(0));
$specialextra = substr($postinfo['message'], $sppos + 3);
}
if(getstatus($thread['status'], 3)) {
$rushinfo = C::t('forum_threadrush')->fetch($_G['tid']);
if($rushinfo['creditlimit'] != -996) {
$checkcreditsvalue = $_G['setting']['creditstransextra'][11] ? getuserprofile('extcredits'.$_G['setting']['creditstransextra'][11]) : $_G['member']['credits'];
if($checkcreditsvalue < $rushinfo['creditlimit']) {
$creditlimit_title = $_G['setting']['creditstransextra'][11] ? $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][11]]['title'] : lang('forum/misc', 'credit_total');
showmessage('post_rushreply_creditlimit', '', array('creditlimit_title' => $creditlimit_title, 'creditlimit' => $rushinfo['creditlimit']));
}
}
}
if(!submitcheck('replysubmit', 0, $seccodecheck, $secqaacheck)) {
$st_p = $_G['uid'].'|'.TIMESTAMP;
dsetcookie('st_p', $st_p.'|'.md5($st_p.$_G['config']['security']['authkey']));
if($thread['special'] == 2 && ((!isset($_GET['addtrade']) || $thread['authorid'] != $_G['uid']) && !$tradenum = C::t('forum_trade')->fetch_counter_thread_goods($_G['tid']))) {
showmessage('trade_newreply_nopermission', NULL);
}
$language = lang('forum/misc');
$noticeauthor = $noticetrimstr = '';
if(isset($_GET['repquote']) && $_GET['repquote'] = intval($_GET['repquote'])) {
$thaquote = C::t('forum_post')->fetch_post('tid:'.$_G['tid'], $_GET['repquote']);
if(!($thaquote && ($thaquote['invisible'] == 0 || $thaquote['authorid'] == $_G['uid'] && $thaquote['invisible'] == -2))) {
$thaquote = array();
}
if($thaquote['tid'] != $_G['tid']) {
showmessage('reply_quotepost_error', NULL);
}
if(getstatus($thread['status'], 2) && $thaquote['authorid'] != $_G['uid'] && $_G['uid'] != $thread['authorid'] && $thaquote['first'] != 1 && !$_G['forum']['ismoderator']) {
showmessage('reply_quotepost_error', NULL);
}
if(!($thread['price'] && !$thread['special'] && $thaquote['first'])) {
$quotefid = $thaquote['fid'];
$message = $thaquote['message'];
if(strpos($message, '[/password]') !== FALSE) {
$message = '';
}
if($_G['setting']['bannedmessages'] && $thaquote['authorid']) {
$author = getuserbyuid($thaquote['authorid']);
if(!$author['groupid'] || $author['groupid'] == 4 || $author['groupid'] == 5) {
$message = $language['post_banned'];
} elseif($thaquote['status'] & 1) {
$message = $language['post_single_banned'];
}
}
$time = dgmdate($thaquote['dateline']);
$message = messagecutstr($message, 100);
$message = implode("\n", array_slice(explode("\n", $message), 0, 3));
$thaquote['useip'] = substr($thaquote['useip'], 0, strrpos($thaquote['useip'], '.')).'.x';
if($thaquote['author'] && $thaquote['anonymous']) {
$thaquote['author'] = lang('forum/misc', 'anonymoususer');
} elseif(!$thaquote['author']) {
$thaquote['author'] = lang('forum/misc', 'guestuser').' '.$thaquote['useip'];
} else {
$thaquote['author'] = $thaquote['author'];
}
$post_reply_quote = lang('forum/misc', 'post_reply_quote', array('author' => $thaquote['author'], 'time' => $time));
$noticeauthormsg = dhtmlspecialchars($message);
if(!defined('IN_MOBILE')) {
$message = "[quote][size=2][url=forum.php?mod=redirect&goto=findpost&pid={$_GET['repquote']}&ptid={$_G['tid']}][color=#999999]{$post_reply_quote}[/color][/url][/size]\n{$message}[/quote]";
} else {
$message = "[quote][color=#999999]{$post_reply_quote}[/color]\n[color=#999999]{$message}[/color][/quote]";
}
$quotemessage = discuzcode($message, 0, 0);
$noticeauthor = dhtmlspecialchars(authcode('q|'.$thaquote['authorid'], 'ENCODE'));
$noticetrimstr = dhtmlspecialchars($message);
$message = '';
}
$reppid = $_GET['repquote'];
} elseif(isset($_GET['reppost']) && $_GET['reppost'] = intval($_GET['reppost'])) {
$thapost = C::t('forum_post')->fetch_post('tid:'.$_G['tid'], $_GET['reppost']);
if(!($thapost && ($thapost['invisible'] == 0 || $thapost['authorid'] == $_G['uid'] && $thapost['invisible'] == -2))) {
$thapost = array();
}
if($thapost['tid'] != $_G['tid']) {
showmessage('targetpost_donotbelongto_thisthread', NULL);
}
$thapost['useip'] = substr($thapost['useip'], 0, strrpos($thapost['useip'], '.')).'.x';
if($thapost['author'] && $thapost['anonymous']) {
$thapost['author'] = '[color=Olive]'.lang('forum/misc', 'anonymoususer').'[/color]';
} elseif(!$thapost['author']) {
$thapost['author'] = '[color=Olive]'.lang('forum/misc', 'guestuser').'[/color] '.$thapost['useip'];
} else {
$thapost['author'] = '[color=Olive]'.$thapost['author'].'[/color]';
}
$quotemessage = discuzcode($message, 0, 0);
$noticeauthormsg = dhtmlspecialchars(messagecutstr($thapost['message'], 100));
$noticeauthor = dhtmlspecialchars(authcode('r|'.$thapost['authorid'], 'ENCODE'));
$noticetrimstr = dhtmlspecialchars($message);
$message = '';
$reppid = $_GET['reppost'];
}
if(isset($_GET['addtrade']) && $thread['special'] == 2 && $_G['group']['allowposttrade'] && $thread['authorid'] == $_G['uid']) {
$expiration_7days = date('Y-m-d', TIMESTAMP + 86400 * 7);
$expiration_14days = date('Y-m-d', TIMESTAMP + 86400 * 14);
$trade['expiration'] = $expiration_month = date('Y-m-d', mktime(0, 0, 0, date('m')+1, date('d'), date('Y')));
$expiration_3months = date('Y-m-d', mktime(0, 0, 0, date('m')+3, date('d'), date('Y')));
$expiration_halfyear = date('Y-m-d', mktime(0, 0, 0, date('m')+6, date('d'), date('Y')));
$expiration_year = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y')+1));
}
if($thread['replies'] <= $_G['ppp']) {
$postlist = array();
if($thread['price'] > 0 && $thread['special'] == 0) {
$postlist = C::t('forum_post')->fetch_all_by_tid('tid:'.$_G['tid'], $_G['tid'], true, 'DESC', 0, 0, 0, 0);
} else {
$postlist = C::t('forum_post')->fetch_all_by_tid('tid:'.$_G['tid'], $_G['tid'], true, 'DESC', 0, 0, null, 0);
}
if($_G['setting']['bannedmessages']) {
$uids = array();
foreach($postlist as $post) {
$uids[] = $post['authorid'];
}
$users = C::t('common_member')->fetch_all($uids);
}
foreach($postlist as $k => $post) {
$post['dateline'] = dgmdate($post['dateline'], 'u');
if($_G['setting']['bannedmessages'] && ($post['authorid'] && (empty($post['groupid']) || $post['groupid'] == 4 || $post['groupid'] == 5))) {
$post['message'] = $language['post_banned'];
} elseif($post['status'] & 1) {
$post['message'] = $language['post_single_banned'];
} else {
$post['message'] = preg_replace("/\[hide=?\d*\](.*?)\[\/hide\]/is", "[b]{$language['post_hidden']}[/b]", $post['message']);
$post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], $post['htmlon'] & 1, $_G['forum']['allowsmilies'], $_G['forum']['allowbbcode'], $_G['forum']['allowimgcode'], $_G['forum']['allowhtml'], $_G['forum']['jammer']);
}
if($_G['setting']['bannedmessages']) {
$post['groupid'] = $users[$post['authorid']]['groupid'];
}
$postlist[$k] = $post;
}
}
unset($uids, $users);
if($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) {
$attachlist = getattach(0);
$attachs = $attachlist['attachs'];
$imgattachs = $attachlist['imgattachs'];
unset($attachlist);
}
getgpc('infloat') ? include template('forum/post_infloat') : include template('forum/post');
} else {
$modpost = C::m('forum_post', $_G['tid']);
$bfmethods = $afmethods = array();
$params = array(
'subject' => $subject,
'message' => $message,
'special' => $special,
'extramessage' => isset($extramessage) ? $extramessage : '',
'bbcodeoff' => getgpc('bbcodeoff'),
'smileyoff' => getgpc('smileyoff'),
'htmlon' => getgpc('htmlon'),
'parseurloff' => getgpc('parseurloff'),
'usesig' => getgpc('usesig'),
'isanonymous' => getgpc('isanonymous'),
'noticetrimstr' => getgpc('noticetrimstr'),
'noticeauthor' => getgpc('noticeauthor'),
'from' => getgpc('from'),
'sechash' => getgpc('sechash'),
'geoloc' => diconv(getgpc('geoloc'), 'UTF-8'),
);
if(!empty($_GET['trade']) && $thread['special'] == 2 && $_G['group']['allowposttrade']) {
$bfmethods[] = array('class' => 'extend_thread_trade', 'method' => 'before_newreply');
}
$attentionon = empty($_GET['attention_add']) ? 0 : 1;
$attentionoff = empty($attention_remove) ? 0 : 1;
$bfmethods[] = array('class' => 'extend_thread_rushreply', 'method' => 'before_newreply');
if($_G['group']['allowat']) {
$bfmethods[] = array('class' => 'extend_thread_allowat', 'method' => 'before_newreply');
}
$bfmethods[] = array('class' => 'extend_thread_comment', 'method' => 'before_newreply');
$modpost->attach_before_method('newreply', array('class' => 'extend_thread_filter', 'method' => 'before_newreply'));
if($_G['group']['allowat']) {
$afmethods[] = array('class' => 'extend_thread_allowat', 'method' => 'after_newreply');
}
$afmethods[] = array('class' => 'extend_thread_rushreply', 'method' => 'after_newreply');
$afmethods[] = array('class' => 'extend_thread_comment', 'method' => 'after_newreply');
if(helper_access::check_module('follow') && !empty($_GET['adddynamic'])) {
$afmethods[] = array('class' => 'extend_thread_follow', 'method' => 'after_newreply');
}
if($thread['replycredit'] > 0 && $thread['authorid'] != $_G['uid'] && $_G['uid']) {
$afmethods[] = array('class' => 'extend_thread_replycredit', 'method' => 'after_newreply');
}
if($special == 5) {
$afmethods[] = array('class' => 'extend_thread_debate', 'method' => 'after_newreply');
}
$afmethods[] = array('class' => 'extend_thread_image', 'method' => 'after_newreply');
if($special == 2 && $_G['group']['allowposttrade'] && $thread['authorid'] == $_G['uid']) {
$afmethods[] = array('class' => 'extend_thread_trade', 'method' => 'after_newreply');
}
$afmethods[] = array('class' => 'extend_thread_filter', 'method' => 'after_newreply');
if($_G['forum']['allowfeed']) {
if($special == 2 && !empty($_GET['trade'])) {
$modpost->attach_before_method('replyfeed', array('class' => 'extend_thread_trade', 'method' => 'before_replyfeed'));
$modpost->attach_after_method('replyfeed', array('class' => 'extend_thread_trade', 'method' => 'after_replyfeed'));
} elseif($special == 3 && $thread['authorid'] != $_G['uid']) {
$modpost->attach_before_method('replyfeed', array('class' => 'extend_thread_reward', 'method' => 'before_replyfeed'));
} elseif($special == 5 && $thread['authorid'] != $_G['uid']) {
$modpost->attach_before_method('replyfeed', array('class' => 'extend_thread_debate', 'method' => 'before_replyfeed'));
}
}
if(!isset($_GET['addfeed'])) {
$space = array();
space_merge($space, 'field_home');
$_GET['addfeed'] = isset($space['privacy']['feed']['newreply']) ? $space['privacy']['feed']['newreply'] : null;
}
$modpost->attach_before_methods('newreply', $bfmethods);
$modpost->attach_after_methods('newreply', $afmethods);
$return = $modpost->newreply($params);
$pid = $modpost->pid;
if($specialextra) {
@include_once DISCUZ_ROOT.'./source/plugin/'.$_G['setting']['threadplugins'][$specialextra]['module'].'.class.php';
$classname = 'threadplugin_'.$specialextra;
if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'newreply_submit_end')) {
$threadpluginclass->newreply_submit_end($_G['fid'], $_G['tid']);
}
}
if($modpost->pid && !$modpost->param('modnewreplies')) {
if(!empty($_GET['addfeed'])) {
$modpost->replyfeed();
}
}
if($modpost->param('modnewreplies')) {
$url = "forum.php?mod=viewthread&tid=".$_G['tid'];
} else {
$antitheft = '';
if(!empty($_G['setting']['antitheft']['allow']) && empty($_G['setting']['antitheft']['disable']['thread']) && empty($_G['forum']['noantitheft'])) {
$sign = helper_antitheft::get_sign($_G['tid'], 'tid');
if($sign) {
$antitheft = '&_dsign='.$sign;
}
}
$url = "forum.php?mod=viewthread&tid=".$_G['tid']."&pid=".$modpost->pid."&page=".$modpost->param('page')."$antitheft&extra=".$extra."#pid".$modpost->pid;
}
if(!isset($inspacecpshare)) {
showmessage($return , $url, $modpost->param('showmsgparam'));
}
}
?>

View File

@@ -0,0 +1,312 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: post_newthread.php 33695 2013-08-03 04:39:22Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(empty($_G['forum']['fid']) || $_G['forum']['type'] == 'group') {
showmessage('forum_nonexistence');
}
if(($special == 1 && !$_G['group']['allowpostpoll']) || ($special == 2 && !$_G['group']['allowposttrade']) || ($special == 3 && !$_G['group']['allowpostreward']) || ($special == 4 && !$_G['group']['allowpostactivity']) || ($special == 5 && !$_G['group']['allowpostdebate'])) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
if(getglobal('setting/connect/allow') && $_G['setting']['accountguard']['postqqonly'] && !$_G['member']['conisbind']) {
showmessage('postperm_qqonly_nopermission');
}
if(!$_G['uid'] && !((!$_G['forum']['postperm'] && $_G['group']['allowpost']) || ($_G['forum']['postperm'] && forumperm($_G['forum']['postperm'])))) {
if(!defined('IN_MOBILE')) {
showmessage('postperm_login_nopermission', NULL, array(), array('login' => 1));
} else {
showmessage('postperm_login_nopermission_mobile', NULL, array('referer' => rawurlencode(dreferer())), array('login' => 1));
}
} elseif(empty($_G['forum']['allowpost'])) {
if(!$_G['forum']['postperm'] && !$_G['group']['allowpost']) {
showmessage('postperm_none_nopermission', NULL, array(), array('login' => 1));
} elseif($_G['forum']['postperm'] && !forumperm($_G['forum']['postperm'])) {
showmessagenoperm('postperm', $_G['fid'], $_G['forum']['formulaperm']);
}
} elseif($_G['forum']['allowpost'] == -1) {
showmessage('post_forum_newthread_nopermission', NULL);
}
if(!$_G['uid'] && ($_G['setting']['need_avatar'] || $_G['setting']['need_secmobile'] || $_G['setting']['need_email'] || $_G['setting']['need_friendnum'])) {
showmessage('postperm_login_nopermission', NULL, array(), array('login' => 1));
}
checklowerlimit('post', 0, 1, $_G['forum']['fid']);
if(!submitcheck('topicsubmit', 0, $seccodecheck, $secqaacheck)) {
$st_t = $_G['uid'].'|'.TIMESTAMP;
dsetcookie('st_t', $st_t.'|'.md5($st_t.$_G['config']['security']['authkey']));
if(helper_access::check_module('group')) {
$mygroups = $groupids = array();
$groupids = C::t('forum_groupuser')->fetch_all_fid_by_uids($_G['uid']);
array_slice($groupids, 0, 20);
$query = C::t('forum_forum')->fetch_all_info_by_fids($groupids);
foreach($query as $group) {
$mygroups[$group['fid']] = $group['name'];
}
}
$savethreads = array();
$savethreadothers = array();
foreach(C::t('forum_post')->fetch_all_by_authorid(0, $_G['uid'], false, '', 0, 20, 1, -3) as $savethread) {
$savethread['dateline'] = dgmdate($savethread['dateline'], 'u');
if($_G['fid'] == $savethread['fid']) {
$savethreads[] = $savethread;
} else {
$savethreadothers[] = $savethread;
}
}
$savethreadcount = count($savethreads);
$savethreadothercount = count($savethreadothers);
if($savethreadothercount) {
loadcache('forums');
}
$savecount = $savethreadcount + $savethreadothercount;
unset($savethread);
$isfirstpost = 1;
$allownoticeauthor = 1;
$tagoffcheck = '';
$showthreadsorts = !empty($sortid) || getglobal('forum/threadsorts/required') && empty($special);
if(empty($sortid) && empty($special) && getglobal('forum/threadsorts/required') && $_G['forum']['threadsorts']['types']) {
$tmp = array_keys($_G['forum']['threadsorts']['types']);
$sortid = $tmp[0];
require_once libfile('post/threadsorts', 'include');
}
if($special == 2 && $_G['group']['allowposttrade']) {
$expiration_7days = date('Y-m-d', TIMESTAMP + 86400 * 7);
$expiration_14days = date('Y-m-d', TIMESTAMP + 86400 * 14);
$trade['expiration'] = $expiration_month = date('Y-m-d', mktime(0, 0, 0, date('m')+1, date('d'), date('Y')));
$expiration_3months = date('Y-m-d', mktime(0, 0, 0, date('m')+3, date('d'), date('Y')));
$expiration_halfyear = date('Y-m-d', mktime(0, 0, 0, date('m')+6, date('d'), date('Y')));
$expiration_year = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y')+1));
} elseif($specialextra) {
$threadpluginclass = null;
if(isset($_G['setting']['threadplugins'][$specialextra]['module'])) {
$threadpluginfile = DISCUZ_ROOT.'./source/plugin/'.$_G['setting']['threadplugins'][$specialextra]['module'].'.class.php';
if(file_exists($threadpluginfile)) {
@include_once $threadpluginfile;
$classname = 'threadplugin_'.$specialextra;
if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'newthread')) {
$threadplughtml = $threadpluginclass->newthread($_G['fid']);
$pluginlang = lang('plugin/'.$specialextra);
$buttontext = property_exists($threadpluginclass, 'buttontext') ? (isset($pluginlang[$threadpluginclass->buttontext]) ? $pluginlang[$threadpluginclass->buttontext] : $threadpluginclass->buttontext) : '';
$iconfile = $threadpluginclass->iconfile;
$iconsflip = $_G['cache']['icons'] ? array_flip($_G['cache']['icons']) : array();
$thread['iconid'] = $iconsflip[$iconfile];
}
}
}
if(!is_object($threadpluginclass)) {
$specialextra = '';
}
}
if($special == 4) {
$activity = array('starttimeto' => '', 'starttimefrom' => '', 'place' => '', 'class' => '', 'cost' => '', 'number' => '', 'gender' => '', 'expiration' => '');
$activitytypelist = $_G['setting']['activitytype'] ? explode("\n", trim($_G['setting']['activitytype'])) : '';
}
if($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) {
$attachlist = getattach(0);
$attachs = $attachlist['attachs'];
$imgattachs = $attachlist['imgattachs'];
unset($attachlist);
}
!isset($attachs['unused']) && $attachs['unused'] = array();
!isset($imgattachs['unused']) && $imgattachs['unused'] = array();
getgpc('infloat') ? include template('forum/post_infloat') : include template('forum/post');
} else {
if(getgpc('mygroupid')) {
$mygroupid = explode('__', $_GET['mygroupid']);
$mygid = intval($mygroupid[0]);
if($mygid) {
$mygname = $mygroupid[1];
if(count($mygroupid) > 2) {
unset($mygroupid[0]);
$mygname = implode('__', $mygroupid);
}
$message .= '[groupid='.intval($mygid).']'.$mygname.'[/groupid]';
C::t('forum_forum')->update_commoncredits(intval($mygroupid[0]));
}
}
$modthread = C::m('forum_thread');
$bfmethods = $afmethods = array();
$params = array(
'subject' => $subject,
'message' => $message,
'typeid' => $typeid,
'sortid' => $sortid,
'special' => $special,
);
$_GET['save'] = $_G['uid'] ? $_GET['save'] : 0;
if ($_G['group']['allowsetpublishdate'] && $_GET['cronpublish'] && $_GET['cronpublishdate']) {
$publishdate = strtotime($_GET['cronpublishdate']);
if ($publishdate > $_G['timestamp']) {
$_GET['save'] = 1;
} else {
$publishdate = $_G['timestamp'];
}
} else {
$publishdate = $_G['timestamp'];
}
$params['publishdate'] = $publishdate;
$params['save'] = $_GET['save'];
$params['sticktopic'] = getgpc('sticktopic');
$params['digest'] = getgpc('addtodigest');
$params['readperm'] = $readperm;
$params['isanonymous'] = getgpc('isanonymous');
$params['price'] = $_GET['price'];
if(in_array($special, array(1, 2, 3, 4, 5))) {
$specials = array(
1 => 'extend_thread_poll',
2 => 'extend_thread_trade',
3 => 'extend_thread_reward',
4 => 'extend_thread_activity',
5 => 'extend_thread_debate'
);
$bfmethods[] = array('class' => $specials[$special], 'method' => 'before_newthread');
$afmethods[] = array('class' => $specials[$special], 'method' => 'after_newthread');
if(!empty($_GET['addfeed'])) {
$modthread->attach_before_method('feed', array('class' => $specials[$special], 'method' => 'before_feed'));
}
}
if($special == 1) {
} elseif($special == 3) {
} elseif($special == 4) {
} elseif($special == 5) {
} elseif($specialextra) {
@include_once DISCUZ_ROOT.'./source/plugin/'.$_G['setting']['threadplugins'][$specialextra]['module'].'.class.php';
$classname = 'threadplugin_'.$specialextra;
if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'newthread_submit')) {
$threadpluginclass->newthread_submit($_G['fid']);
}
$special = 127;
$params['special'] = 127;
$params['message'] .= chr(0).chr(0).chr(0).$specialextra;
}
$params['typeexpiration'] = getgpc('typeexpiration');
$params['ordertype'] = getgpc('ordertype');
$params['hiddenreplies'] = getgpc('hiddenreplies');
$params['allownoticeauthor'] = $_GET['allownoticeauthor'];
$params['tags'] = $_GET['tags'];
$params['bbcodeoff'] = getgpc('bbcodeoff');
$params['smileyoff'] = getgpc('smileyoff');
$params['parseurloff'] = getgpc('parseurloff');
$params['usesig'] = $_GET['usesig'];
$params['htmlon'] = getgpc('htmlon');
if($_G['group']['allowimgcontent']) {
$params['imgcontent'] = $_GET['imgcontent'];
$params['imgcontentwidth'] = $_G['setting']['imgcontentwidth'] ? intval($_G['setting']['imgcontentwidth']) : 100;
}
$params['geoloc'] = diconv(getgpc('geoloc'), 'UTF-8');
if(getgpc('rushreply')) {
$bfmethods[] = array('class' => 'extend_thread_rushreply', 'method' => 'before_newthread');
$afmethods[] = array('class' => 'extend_thread_rushreply', 'method' => 'after_newthread');
}
$bfmethods[] = array('class' => 'extend_thread_replycredit', 'method' => 'before_newthread');
$afmethods[] = array('class' => 'extend_thread_replycredit', 'method' => 'after_newthread');
if($sortid) {
$bfmethods[] = array('class' => 'extend_thread_sort', 'method' => 'before_newthread');
$afmethods[] = array('class' => 'extend_thread_sort', 'method' => 'after_newthread');
}
$bfmethods[] = array('class' => 'extend_thread_allowat', 'method' => 'before_newthread');
$afmethods[] = array('class' => 'extend_thread_allowat', 'method' => 'after_newthread');
$afmethods[] = array('class' => 'extend_thread_image', 'method' => 'after_newthread');
if(!empty($_GET['adddynamic'])) {
$afmethods[] = array('class' => 'extend_thread_follow', 'method' => 'after_newthread');
}
$modthread->attach_before_methods('newthread', $bfmethods);
$modthread->attach_after_methods('newthread', $afmethods);
$return = $modthread->newthread($params);
$tid = $modthread->tid;
$pid = $modthread->pid;
dsetcookie('clearUserdata', 'forum');
if($specialextra) {
$classname = 'threadplugin_'.$specialextra;
if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'newthread_submit_end')) {
$threadpluginclass->newthread_submit_end($_G['fid'], $modthread->tid);
}
}
if(!$modthread->param('modnewthreads') && !empty($_GET['addfeed'])) {
$modthread->feed();
}
if(!empty($_G['setting']['rewriterule']['forum_viewthread']) && is_array($_G['setting']['rewritestatus']) && in_array('forum_viewthread', $_G['setting']['rewritestatus'])) {
$returnurl = rewriteoutput('forum_viewthread', 1, '', $modthread->tid, 1, '', $extra);
} else {
$returnurl = "forum.php?mod=viewthread&tid={$modthread->tid}&extra=$extra";
}
$values = array('fid' => $modthread->forum('fid'), 'tid' => $modthread->tid, 'pid' => $modthread->pid, 'coverimg' => '', 'sechash' => !empty($_GET['sechash']) ? $_GET['sechash'] : '');
showmessage($return, $returnurl, array_merge($values, (array)$modthread->param('values')), $modthread->param('param'));
}
?>

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: post_threadsorts.php 23995 2011-08-18 09:41:27Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('function/threadsort');
threadsort_checkoption($sortid);
$forum_optionlist = getsortedoptionlist();
loadcache(array('threadsort_option_'.$sortid, 'threadsort_template_'.$sortid));
$sqlarr = array();
foreach($_G['cache']['threadsort_option_'.$sortid] AS $key => $val) {
if($val['profile']) {
$sqlarr[] = $val['profile'];
}
}
if($sqlarr) {
$member_profile = array();
$_member_profile = C::t('common_member_profile')->fetch($_G['uid']);
foreach($sqlarr as $val) {
$member_profile[$val] = $_member_profile[$val];
}
unset($_member_profile);
}
threadsort_optiondata($pid, $sortid, $_G['cache']['threadsort_option_'.$sortid], $_G['cache']['threadsort_template_'.$sortid]);
?>

View File

View File

@@ -0,0 +1,147 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: space_activity.php 30378 2012-05-24 09:52:46Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['forumstatus']) {
showmessage('forum_status_off');
}
$minhot = $_G['setting']['feedhotmin']<1?3:$_G['setting']['feedhotmin'];
$page = empty($_GET['page'])?1:intval($_GET['page']);
if($page<1) $page=1;
$id = empty($_GET['id'])?0:intval($_GET['id']);
$opactives['activity'] = 'class="a"';
$_GET['view'] = in_array($_GET['view'], array('we', 'me', 'all')) ? $_GET['view'] : 'we';
$_GET['order'] = in_array($_GET['order'], array('hot', 'dateline')) ? $_GET['order'] : 'dateline';
$perpage = 20;
$perpage = mob_perpage($perpage);
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
$list = array();
$userlist = array();
$hiddennum = $count = $pricount = 0;
$gets = array(
'mod' => 'space',
'uid' => $space['uid'],
'do' => 'activity',
'view' => $_GET['view'],
'order' => $_GET['order'],
'type' => $_GET['type'],
'fuid' => $_GET['fuid'],
'searchkey' => $_GET['searchkey']
);
$theurl = 'home.php?'.url_implode($gets);
$multi = '';
$wheresql = '1';
$threadsql = $apply_sql = '';
$f_index = '';
$need_count = true;
require_once libfile('function/misc');
if($_GET['view'] == 'me') {
$viewtype = in_array($_GET['type'], array('orig', 'apply')) ? $_GET['type'] : 'orig';
$orderactives = array($viewtype => ' class="a"');
} else {
space_merge($space, 'field_home');
if($space['feedfriend']) {
$fuid_actives = array();
require_once libfile('function/friend');
$fuid = intval($_GET['fuid']);
if($fuid && friend_check($fuid, $space['uid'])) {
$fuid_actives = array($fuid=>' selected');
$frienduid = $fuid;
} else {
$theurl = "home.php?mod=space&uid={$space['uid']}&do=$do&view=we";
$frienduid = explode(',', $space['feedfriend']);
}
$query = C::t('home_friend')->fetch_all_by_uid($space['uid'], 0, 100, true);
foreach($query as $value) {
$userlist[] = $value;
}
} else {
$need_count = false;
}
}
$actives = array($_GET['view'] =>' class="a"');
if($need_count) {
if(!empty($_GET['searchkey'])) {
$_GET['searchkey'] = stripsearchkey($_GET['searchkey']);
}
$count = C::t('forum_activity')->fetch_all_for_search($_GET['view'], $_GET['order'], $_GET['searchkey'], $_GET['type'], $frienduid, $space['uid'], $minhot, 1);
if($count) {
$query = C::t('forum_activity')->fetch_all_for_search($_GET['view'], $_GET['order'], $_GET['searchkey'], $_GET['type'], $frienduid, $space['uid'], $minhot, 0, $start, $perpage);
loadcache('forums');
$daytids = $tids = array();
foreach($query as $value) {
if(empty($value['author']) && $value['authorid'] != $_G['uid']) {
$hiddennum++;
continue;
}
$date = dgmdate($value['starttimefrom'], 'Ymd');
$posttableid = $value['posttableid'] ? $value['posttableid'] : 0;
$tids[$posttableid][$value['tid']] = $value['tid'];
$value['week'] = dgmdate($value['starttimefrom'], 'w');
$value['month'] = dgmdate($value['starttimefrom'], 'n'.lang('space', 'month'));
$value['day'] = dgmdate($value['starttimefrom'], 'j');
$value['time'] = dgmdate($value['starttimefrom'], 'Y'.lang('space', 'year').'m'.lang('space', 'month').'d'.lang('space', 'day'));
$value['starttimefrom'] = dgmdate($value['starttimefrom']);
$daytids[$value['tid']] = $date;
$list[$date][$value['tid']] = procthread($value);
}
if($tids) {
require_once libfile('function/post');
foreach($tids as $ptid=>$ids) {
foreach(C::t('forum_post')->fetch_all_by_tid($ptid, $ids, true, '', 0, 0, 1) as $value) {
$date = $daytids[$value['tid']];
$value['message'] = messagecutstr($value['message'], 150);
$list[$date][$value['tid']]['message'] = $value['message'];
}
}
}
$multi = multi($count, $perpage, $page, $theurl);
}
}
if($_G['uid']) {
if($_GET['view'] == 'all') {
$navtitle = lang('core', 'title_view_all').lang('core', 'title_activity');
} elseif($_GET['view'] == 'me') {
$navtitle = lang('core', 'title_my_activity');
} else {
$navtitle = lang('core', 'title_friend_activity');
}
} else {
if($_GET['order'] == 'hot') {
$navtitle = lang('core', 'title_top_activity');
} else {
$navtitle = lang('core', 'title_newest_activity');
}
}
include_once template("diy:home/space_activity");
?>

View File

@@ -0,0 +1,459 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: space_album.php 33249 2013-05-09 07:27:16Z kamichen $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['albumstatus']) {
showmessage('album_status_off');
}
$minhot = $_G['setting']['feedhotmin']<1?3:intval($_G['setting']['feedhotmin']);
$id = empty($_GET['id'])?0:intval($_GET['id']);
$picid = empty($_GET['picid'])?0:intval($_GET['picid']);
$page = empty($_GET['page'])?1:intval($_GET['page']);
if($page<1) $page=1;
if($id) {
$perpage = 20;
$perpage = mob_perpage($perpage);
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
if($id > 0) {
$album = C::t('home_album')->fetch_album($id, $space['uid']);
if(empty($album)) {
showmessage('to_view_the_photo_does_not_exist');
}
ckfriend_album($album);
$album['picnum'] = $count = C::t('home_pic')->check_albumpic($id);
if(empty($count) && !$space['self']) {
C::t('home_album')->delete($id);
showmessage('to_view_the_photo_does_not_exist', "home.php?mod=space&uid={$album['uid']}&do=album&view=me");
}
if($album['catid']) {
$album['catname'] = C::t('home_album_category')->fetch_catname_by_catid($album['catid']);
$album['catname'] = dhtmlspecialchars($album['catname']);
}
} else {
$count = C::t('home_pic')->check_albumpic(0, NULL, $space['uid']);
$album = array(
'uid' => $space['uid'],
'albumid' => -1,
'albumname' => lang('space', 'default_albumname'),
'picnum' => $count
);
}
$albumlist = array();
$maxalbum = $nowalbum = $key = 0;
$query = C::t('home_album')->fetch_all_by_uid($space['uid'], 'updatetime', 0, 100);
foreach($query as $value) {
if($value['friend'] != 4 && ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
$value['pic'] = pic_cover_get($value['pic'], $value['picflag']);
} elseif ($value['picnum']) {
$value['pic'] = STATICURL.'image/common/nopublish.svg';
} else {
$value['pic'] = '';
}
$albumlist[$key][$value['albumid']] = $value;
$key = count($albumlist[$key]) == 5 ? ++$key : $key;
}
$maxalbum = count($albumlist);
$list = array();
$pricount = 0;
if($count) {
$query = C::t('home_pic')->fetch_all_by_albumid($id, $start, $perpage, 0, 0, 1, $space['uid']);
foreach($query as $value) {
if($value['status'] == 0 || $value['uid'] == $_G['uid'] || $_G['adminid'] == 1) {
$value['pic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote']);
$list[] = $value;
} else {
$pricount++;
}
}
}
$multi = multi($count, $perpage, $page, "home.php?mod=space&uid={$album['uid']}&do=$do&id=$id#comment");
$actives = array('me' =>' class="a"');
$_G['home_css'] = 'album';
$diymode = intval($_G['cookie']['home_diymode']);
$seodata = array('album' => $album['albumname'], 'user' => $album['username'], 'depict' => $album['depict']);
list($navtitle, $metadescription, $metakeywords) = get_seosetting('album', $seodata);
if(empty($navtitle)) {
$navtitle = (empty($album['albumname']) ? '' : $album['albumname'].' - ').lang('space', 'sb_album', array('who' => $album['username']));
$nobbname = false;
} else {
$nobbname = true;
}
if(empty($metakeywords)) {
$metakeywords = $album['albumname'];
}
if(empty($metadescription)) {
$metadescription = $album['albumname'];
}
include_once template("diy:home/space_album_view");
} elseif ($picid) {
$query = C::t('home_pic')->fetch_all_by_uid($space['uid'], 0, 1, $picid);
$pic = $query[0];
if(!$pic || ($pic['status'] == 1 && $pic['uid'] != $_G['uid'] && $_G['adminid'] != 1 && $_GET['modpickey'] != modauthkey($pic['picid']))) {
showmessage('view_images_do_not_exist');
}
$picid = $pic['picid'];
$theurl = "home.php?mod=space&uid={$pic['uid']}&do=$do&picid=$picid";
$album = array();
if($pic['albumid']) {
$album = C::t('home_album')->fetch_album($pic['albumid']);
if(!$album) {
C::t('home_pic')->update_for_albumid($pic['albumid'], array('albumid' => 0));
}
}
if($album) {
ckfriend_album($album);
} else {
$album['picnum'] = C::t('home_pic')->check_albumpic(0, NULL, $pic['uid']);
$album['albumid'] = $pic['albumid'] = '-1';
}
$piclist = $list = $keys = array();
$keycount = 0;
$query = C::t('home_pic')->fetch_all_by_albumid($pic['albumid'], 0, 0, 0, 0, 1, $space['uid']);
foreach($query as $value) {
if($value['status'] == 0 || $value['uid'] == $_G['uid'] || $_G['adminid'] == 1) {
$keys[$value['picid']] = $keycount;
$list[$keycount] = $value;
$keycount++;
}
}
$upid = $nextid = 0;
$nowkey = $keys[$picid];
$endkey = $keycount - 1;
if($endkey>4) {
$newkeys = array($nowkey-2, $nowkey-1, $nowkey, $nowkey+1, $nowkey+2);
if($newkeys[1] < 0) {
$newkeys[0] = $endkey-1;
$newkeys[1] = $endkey;
} elseif($newkeys[0] < 0) {
$newkeys[0] = $endkey;
}
if($newkeys[3] > $endkey) {
$newkeys[3] = 0;
$newkeys[4] = 1;
} elseif($newkeys[4] > $endkey) {
$newkeys[4] = 0;
}
$upid = $list[$newkeys[1]]['picid'];
$nextid = $list[$newkeys[3]]['picid'];
foreach ($newkeys as $nkey) {
$piclist[$nkey] = $list[$nkey];
}
} else {
$newkeys = array($nowkey-1, $nowkey, $nowkey+1);
if($newkeys[0] < 0) {
$newkeys[0] = $endkey;
}
if($newkeys[2] > $endkey) {
$newkeys[2] = 0;
}
$upid = $list[$newkeys[0]]['picid'];
$nextid = $list[$newkeys[2]]['picid'];
$piclist = $list;
}
foreach ($piclist as $key => $value) {
$value['pic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote']);
$piclist[$key] = $value;
}
$pic['pic'] = pic_get($pic['filepath'], 'album', $pic['thumb'], $pic['remote'], 0);
$pic['size'] = formatsize($pic['size']);
$pic['postip'] = ip::to_display($pic['postip']);
$exifs = array();
$allowexif = function_exists('exif_read_data');
if(isset($_GET['exif']) && $allowexif) {
require_once libfile('function/exif');
$exifs = getexif($pic['pic']);
}
$perpage = 20;
$perpage = mob_perpage($perpage);
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
$cid = empty($_GET['cid'])?0:intval($_GET['cid']);
$siteurl = getsiteurl();
$list = array();
$count = C::t('home_comment')->count_by_id_idtype($pic['picid'], 'picid', $cid);
if($count) {
$query = C::t('home_comment')->fetch_all_by_id_idtype($pic['picid'], 'picid', $start, $perpage, $cid);
foreach($query as $value) {
$list[] = $value;
}
}
$multi = multi($count, $perpage, $page, $theurl);
if(empty($album['albumname'])) $album['albumname'] = lang('space', 'default_albumname');
$pic_url = $pic['pic'];
if(!preg_match("/^(http|https)\:\/\/.+?/i", $pic['pic'])) {
$pic_url = getsiteurl().$pic['pic'];
}
$pic_url2 = rawurlencode($pic['pic']);
$hash = md5($pic['uid']."\t".$pic['dateline']);
$id = $pic['picid'];
$idtype = 'picid';
$maxclicknum = 0;
loadcache('click');
$clicks = empty($_G['cache']['click']['picid'])?array():$_G['cache']['click']['picid'];
foreach ($clicks as $key => $value) {
$value['clicknum'] = $pic["click{$key}"];
$value['classid'] = mt_rand(1, 4);
if($value['clicknum'] > $maxclicknum) $maxclicknum = $value['clicknum'];
$clicks[$key] = $value;
}
$clickuserlist = array();
foreach(C::t('home_clickuser')->fetch_all_by_id_idtype($id, $idtype, 0, 20) as $value) {
$value['clickname'] = $clicks[$value['clickid']]['name'];
$clickuserlist[] = $value;
}
$actives = array('me' =>' class="a"');
if($album['picnum']) {
$sequence = $nowkey + 1;
}
$diymode = intval($_G['cookie']['home_diymode']);
$navtitle = $album['albumname'];
if($pic['title']) {
$navtitle = $pic['title'].' - '.$navtitle;
}
$metakeywords = $pic['title'] ? $pic['title'] : $album['albumname'];
$metadescription = $pic['title'] ? $pic['title'] : $album['albumname'];
include_once template("diy:home/space_album_pic");
} else {
loadcache('albumcategory');
$category = $_G['cache']['albumcategory'];
$perpage = 20;
$perpage = mob_perpage($perpage);
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
$_GET['friend'] = intval($_GET['friend']);
$default = array();
$f_index = '';
$list = array();
$pricount = 0;
$picmode = 0;
$_GET['view'] = in_array($_GET['view'], array('we', 'me', 'all')) ? $_GET['view'] : 'we';
$_GET['order'] = in_array($_GET['order'], array('hot', 'dateline')) ? $_GET['order'] : 'dateline';
$gets = array(
'mod' => 'space',
'uid' => $space['uid'],
'do' => 'album',
'view' => $_GET['view'],
'catid' => $_GET['catid'],
'order' => $_GET['order'],
'fuid' => $_GET['fuid'],
'searchkey' => $_GET['searchkey'],
'from' => $_GET['from']
);
$theurl = 'home.php?'.url_implode($gets);
$actives = array($_GET['view'] =>' class="a"');
$need_count = true;
if($_GET['view'] == 'all') {
$wheresql = '1';
if($_GET['order'] == 'hot') {
$orderactives = array('hot' => ' class="a"');
$picmode = 1;
$need_count = false;
$ordersql = 'p.dateline';
$count = C::t('home_pic')->fetch_all_by_sql('p.'.DB::field('hot', $minhot, '>='), '', 0, 0, 1);
if($count) {
$query = C::t('home_pic')->fetch_all_by_sql('p.'.DB::field('hot', $minhot, '>='), 'p.dateline DESC', $start, $perpage);
foreach($query as $value) {
if($value['friend'] != 4 && ckfriend($value['uid'], $value['friend'], $value['target_ids']) && ($value['status'] == 0 || $value['uid'] == $_G['uid'] || $_G['adminid'] == 1)) {
$value['pic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote']);
$list[] = $value;
} else {
$pricount++;
}
}
}
} else {
$orderactives = array('dateline' => ' class="a"');
}
} elseif($_GET['view'] == 'we') {
space_merge($space, 'field_home');
$uids = array();
if($space['feedfriend']) {
$uids = explode(',', $space['feedfriend']);
$f_index = 'updatetime';
$fuid_actives = array();
require_once libfile('function/friend');
$fuid = intval($_GET['fuid']);
if($fuid && friend_check($fuid)) {
$uids = array($fuid);
$f_index = '';
$fuid_actives = array($fuid=>' selected');
}
$query = C::t('home_friend')->fetch_all_by_uid($space['uid'], 0, 500, true);
foreach($query as $value) {
$userlist[] = $value;
}
} else {
$need_count = false;
}
} else {
if($_GET['from'] == 'space') $diymode = 1;
$uids = array($space['uid']);
}
if($need_count) {
if($searchkey = stripsearchkey($_GET['searchkey'])) {
$sqlSearchKey = $searchkey;
$searchkey = dhtmlspecialchars($searchkey);
}
$catid = empty($_GET['catid'])?0:intval($_GET['catid']);
$count = C::t('home_album')->fetch_all_by_search(3, $uids, $sqlSearchKey, true, $catid, 0, 0, '');
if($count) {
$query = C::t('home_album')->fetch_all_by_search(1, $uids, $sqlSearchKey, true, $catid, 0, 0, '', '', 'updatetime', 'DESC', $start, $perpage, $f_index);
foreach($query as $value) {
if($value['friend'] != 4 && ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
$value['pic'] = pic_cover_get($value['pic'], $value['picflag']);
} elseif ($value['picnum']) {
$value['pic'] = STATICURL.'image/common/nopublish.svg';
} else {
$value['pic'] = '';
}
$list[] = $value;
}
}
}
$multi = multi($count, $perpage, $page, $theurl);
dsetcookie('home_diymode', $diymode);
if($_G['uid']) {
if($_GET['view'] == 'all') {
$navtitle = lang('core', 'title_view_all').lang('core', 'title_album');
} elseif($_GET['view'] == 'me') {
$navtitle = lang('core', 'title_my_album');
} else {
$navtitle = lang('core', 'title_friend_album');
}
} else {
if($_GET['order'] == 'hot') {
$navtitle = lang('core', 'title_hot_pic_recommend');
} else {
$navtitle = lang('core', 'title_newest_update_album');
}
}
if($space['username']) {
$navtitle = lang('space', 'sb_album', array('who' => $space['username']));
}
$metakeywords = $navtitle;
$metadescription = $navtitle;
include_once template("diy:home/space_album_list");
}
function ckfriend_album($album) {
global $_G, $space;
if($_G['adminid'] != 1) {
if(!ckfriend($album['uid'], $album['friend'], $album['target_ids'])) {
if(empty($_G['uid'])) {
showmessage('to_login', null, array(), array('showmsg' => true, 'login' => 1));
}
require_once libfile('function/friend');
$isfriend = friend_check($album['uid']);
space_merge($space, 'count');
space_merge($space, 'profile');
$_G['privacy'] = 1;
require_once libfile('space/profile', 'include');
include template('home/space_privacy');
exit();
} elseif(!$space['self'] && $album['friend'] == 4) {
$cookiename = "view_pwd_album_{$album['albumid']}";
$cookievalue = empty($_G['cookie'][$cookiename])?'':$_G['cookie'][$cookiename];
if($cookievalue != md5(md5($album['password']))) {
$invalue = $album;
include template('home/misc_inputpwd');
exit();
}
}
}
}
?>

View File

@@ -0,0 +1,380 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: space_blog.php 32130 2012-11-14 09:20:40Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['blogstatus']) {
showmessage('blog_status_off');
}
$minhot = $_G['setting']['feedhotmin']<1?3:$_G['setting']['feedhotmin'];
$page = empty($_GET['page'])?1:intval($_GET['page']);
if($page<1) $page=1;
$id = empty($_GET['id'])?0:intval($_GET['id']);
$_G['colorarray'] = array('', '#EE1B2E', '#EE5023', '#996600', '#3C9D40', '#2897C5', '#2B65B7', '#8F2A90', '#EC1282');
if($id) {
$blog = array_merge(
C::t('home_blog')->fetch($id),
C::t('home_blogfield')->fetch($id)
);
if($blog['uid'] != $space['uid']) {
$blog = null;
}
if(!(!empty($blog) && ($blog['status'] == 0 || $blog['uid'] == $_G['uid'] || $_G['adminid'] == 1 || $_GET['modblogkey'] == modauthkey($blog['blogid'])))) {
showmessage('view_to_info_did_not_exist');
}
if(!ckfriend($blog['uid'], $blog['friend'], $blog['target_ids'])) {
require_once libfile('function/friend');
$isfriend = friend_check($blog['uid']);
space_merge($space, 'count');
space_merge($space, 'profile');
$_G['privacy'] = 1;
require_once libfile('space/profile', 'include');
include template('home/space_privacy');
exit();
} elseif(!$space['self'] && $blog['friend'] == 4 && $_G['adminid'] != 1) {
$cookiename = "view_pwd_blog_{$blog['blogid']}";
$cookievalue = empty($_G['cookie'][$cookiename])?'':$_G['cookie'][$cookiename];
if($cookievalue != md5(md5($blog['password']))) {
$invalue = $blog;
include template('home/misc_inputpwd');
exit();
}
}
if(!empty($_G['setting']['antitheft']['allow']) && empty($_G['setting']['antitheft']['disable']['blog'])) {
helper_antitheft::check($id, 'bid');
}
$classarr = C::t('home_class')->fetch($blog['classid']);
if($blog['catid']) {
$blog['catname'] = C::t('home_blog_category')->fetch_catname_by_catid($blog['catid']);
$blog['catname'] = dhtmlspecialchars($blog['catname']);
}
require_once libfile('function/blog');
$blog['message'] = blog_bbcode($blog['message']);
$otherlist = $newlist = array();
$otherlist = array();
$query = C::t('home_blog')->fetch_all_by_uid($space['uid'], 'dateline', 0, 6);
foreach($query as $value) {
if($value['blogid'] != $blog['blogid'] && empty($value['friend']) && $value['status'] == 0) {
$otherlist[] = $value;
}
}
$newlist = array();
$query = C::t('home_blog')->fetch_all_by_hot($minhot, 'dateline', 0, 6);
foreach($query as $value) {
if($value['blogid'] != $blog['blogid'] && empty($value['friend']) && $value['status'] == 0) {
$newlist[] = $value;
}
}
$perpage = 20;
$perpage = mob_perpage($perpage);
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
$count = $blog['replynum'];
$list = array();
if($count) {
if($_GET['goto']) {
$page = ceil($count/$perpage);
$start = ($page-1)*$perpage;
} else {
$cid = empty($_GET['cid'])?0:intval($_GET['cid']);
}
$query = C::t('home_comment')->fetch_all_by_id_idtype($id, 'blogid', $start, $perpage, $cid);
foreach($query as $value) {
$list[] = $value;
}
if(empty($list) && empty($cid)) {
$count = C::t('home_comment')->count_by_id_idtype($id, 'blogid');
C::t('home_blog')->update($blog['blogid'], array('replynum'=>$count));
}
}
$multi = multi($count, $perpage, $page, "home.php?mod=space&uid={$blog['uid']}&do=$do&id=$id#comment");
if(!$_G['setting']['preventrefresh'] || !$space['self'] && $_G['cookie']['viewid'] != 'blog_'.$blog['blogid']) {
C::t('home_blog')->increase($blog['blogid'], 0, array('viewnum' => 1));
dsetcookie('viewid', 'blog_'.$blog['blogid']);
}
$hash = md5($blog['uid']."\t".$blog['dateline']);
$id = $blog['blogid'];
$idtype = 'blogid';
$maxclicknum = 0;
loadcache('click');
$clicks = empty($_G['cache']['click']['blogid'])?array():$_G['cache']['click']['blogid'];
foreach ($clicks as $key => $value) {
$value['clicknum'] = $blog["click{$key}"];
$value['classid'] = mt_rand(1, 4);
if($value['clicknum'] > $maxclicknum) $maxclicknum = $value['clicknum'];
$clicks[$key] = $value;
}
$clickuserlist = array();
foreach(C::t('home_clickuser')->fetch_all_by_id_idtype($id, $idtype, 0, 24) as $value) {
$value['clickname'] = $clicks[$value['clickid']]['name'];
$clickuserlist[] = $value;
}
$actives = array('me' =>' class="a"');
$diymode = intval($_G['cookie']['home_diymode']);
$tagarray_all = $array_temp = $blogtag_array = $blogmetatag_array = array();
$blogmeta_tag = '';
$tagarray_all = explode("\t", $blog['tag']);
if($tagarray_all) {
foreach($tagarray_all as $var) {
if($var) {
$array_temp = explode(',', $var);
$blogtag_array[] = $array_temp;
$blogmetatag_array[] = $array_temp['1'];
}
}
}
$blog['tag'] = $blogtag_array;
$blogmeta_tag = implode(',', $blogmetatag_array);
$blog['postip'] = ip::to_display($blog['postip']);
$summary = cutstr(strip_tags($blog['message']), 140);
$seodata = array('subject' => $blog['subject'], 'user' => $blog['username'], 'summary' => $summary, 'tags' => $blogmeta_tag);
list($navtitle, $metadescription, $metakeywords) = get_seosetting('blog', $seodata);
if(empty($navtitle)) {
$navtitle = $blog['subject'].' - '.lang('space', 'sb_blog', array('who' => $blog['username']));
$nobbname = false;
} else {
$nobbname = true;
}
if(empty($metakeywords)) {
$metakeywords = $blogmeta_tag ? $blogmeta_tag : $blog['subject'];
}
if(empty($metadescription)) {
$metadescription = $summary;
}
if(!$_G['setting']['relatedlinkstatus']) {
$_G['relatedlinks'] = get_related_link('blog');
} else {
$blog['message'] = parse_related_link($blog['message'], 'blog');
}
include_once template("diy:home/space_blog_view");
} else {
loadcache('blogcategory');
$category = $_G['cache']['blogcategory'];
$_GET['view'] = in_array($_GET['view'], array('we', 'me', 'all')) ? $_GET['view'] : 'we';
$_GET['order'] = in_array($_GET['order'], array('hot', 'dateline')) ? $_GET['order'] : 'dateline';
$perpage = 10;
$perpage = mob_perpage($perpage);
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
$summarylen = 300;
$classarr = array();
$list = array();
$userlist = array();
$stickblogs = array();
$count = $pricount = 0;
$gets = array(
'mod' => 'space',
'uid' => $space['uid'],
'do' => 'blog',
'view' => $_GET['view'],
'order' => $_GET['order'],
'classid' => $_GET['classid'],
'catid' => $_GET['catid'],
'clickid' => $_GET['clickid'],
'fuid' => $_GET['fuid'],
'searchkey' => $_GET['searchkey'],
'from' => $_GET['from'],
'friend' => $_GET['friend']
);
$theurl = 'home.php?'.url_implode($gets);
$multi = '';
$f_index = $searchsubject = '';
$uids = array();
$need_count = true;
$status = null;
if($_GET['view'] == 'all') {
if($_GET['order'] == 'hot') {
$gthot = $minhot;
$orderactives = array('hot' => ' class="a"');
} else {
$orderactives = array('dateline' => ' class="a"');
}
$status = 0;
} elseif($_GET['view'] == 'me') {
space_merge($space, 'field_home');
$stickblogs = explode(',', $space['stickblogs']);
$stickblogs = array_filter($stickblogs);
$uids[] = $space['uid'];
$classid = empty($_GET['classid'])?0:intval($_GET['classid']);
$privacyfriend = empty($_GET['friend'])?0:intval($_GET['friend']);
$query = C::t('home_class')->fetch_all_by_uid($space['uid']);
foreach($query as $value) {
$classarr[$value['classid']] = $value['classname'];
}
if($_GET['from'] == 'space') $diymode = 1;
$status = array(0, 1);
} else {
space_merge($space, 'field_home');
if($space['feedfriend']) {
$fuid_actives = array();
require_once libfile('function/friend');
$fuid = intval($_GET['fuid']);
if($fuid && friend_check($fuid, $space['uid'])) {
$uids[] = $fuid;
$fuid_actives = array($fuid=>' selected');
} else {
$uids = explode(',', $space['feedfriend']);
$theurl = "home.php?mod=space&uid={$space['uid']}&do=$do&view=we";
$f_index = 'dateline';
}
$query = C::t('home_friend')->fetch_all_by_uid($space['uid'], 0, 100, true);
foreach($query as $value) {
$userlist[] = $value;
}
$status = 0;
} else {
$need_count = false;
}
}
$actives = array($_GET['view'] =>' class="a"');
if($need_count) {
if($searchkey = stripsearchkey($_GET['searchkey'])) {
$searchsubject = $searchkey;
$searchkey = dhtmlspecialchars($searchkey);
}
$catid = empty($_GET['catid'])?0:intval($_GET['catid']);
$count = C::t('home_blog')->count_all_by_search(null, $uids, null, null, $gthot, null, null, null, null, null, $privacyfriend, null, null, null, $classid, $catid, $searchsubject, true, $status);
if($count) {
$query = C::t('home_blog')->fetch_all_by_search(1, null, $uids, null, null, $gthot, null, null, null, null, null, $privacyfriend, null, null, null, 'dateline', 'DESC', $start, $perpage, $classid, $catid, $searchsubject, $f_index, false, $status);
}
}
if($count) {
foreach($query as $value) {
if(ckfriend($value['uid'], $value['friend'], $value['target_ids']) && ($value['status'] == 0 || $value['uid'] == $_G['uid'] || $_G['adminid'] == 1)) {
if(!empty($stickblogs) && in_array($value['blogid'], $stickblogs)) {
continue;
}
if($value['friend'] == 4) {
$value['message'] = $value['pic'] = '';
} else {
$value['message'] = getstr($value['message'], $summarylen, 0, 0, 0, -1);
}
$value['message'] = preg_replace("/&[a-z]+\;/i", '', $value['message']);
if($value['pic']) $value['pic'] = pic_cover_get($value['pic'], $value['picflag']);
$value['dateline'] = dgmdate($value['dateline']);
$list[] = $value;
} else {
$pricount++;
}
}
$multi = multi($count, $perpage, $page, $theurl);
if(!empty($stickblogs)) {
$list = array_merge(blog_get_stick($space['uid'], $stickblogs, $summarylen), $list);
}
}
dsetcookie('home_diymode', $diymode);
if($_G['uid']) {
if($_GET['view'] == 'all') {
$navtitle = lang('core', 'title_view_all').lang('core', 'title_blog');
} elseif($_GET['view'] == 'me') {
$navtitle = lang('core', 'title_my_blog');
} else {
$navtitle = lang('core', 'title_friend_blog');
}
} else {
if($_GET['order'] == 'hot') {
$navtitle = lang('core', 'title_recommend_blog');
} else {
$navtitle = lang('core', 'title_newest_blog');
}
}
if($space['username']) {
$navtitle = lang('space', 'sb_blog', array('who' => $space['username']));
}
$metakeywords = $navtitle;
$metadescription = $navtitle;
$navtitle = helper_seo::get_title_page($navtitle, $_G['page']);
space_merge($space, 'field_home');
include_once template("diy:home/space_blog_list");
}
function blog_get_stick($uid, $stickblogs, $summarylen) {
$list = $stickids = array();
if($stickblogs) {
$data_blog = C::t('home_blog')->fetch_all_blog($stickblogs);
$data_blogfield = C::t('home_blogfield')->fetch_all($stickblogs);
foreach ($stickblogs as $blogid) {
if(!empty($data_blog[$blogid]) && !empty($data_blogfield[$blogid])) {
$value = array_merge($data_blog[$blogid], $data_blogfield[$blogid]);
if(ckfriend($value['uid'], $value['friend'], $value['target_ids']) && ($value['status'] == 0 || $value['uid'] == $_G['uid'] || $_G['adminid'] == 1)) {
$value['message'] = getstr($value['message'], $summarylen, 0, 0, 0, -1);
$value['message'] = preg_replace("/&[a-z]+\;/i", '', $value['message']);
if($value['pic']) $value['pic'] = pic_cover_get($value['pic'], $value['picflag']);
$value['dateline'] = dgmdate($value['dateline']);
$value['stickflag'] = true;
$list[$value['blogid']] = $value;
$stickids[] = $value['blogid'];
}
}
}
if(count($stickids) != count($stickblogs)) {
C::t('common_member_field_home')->update($uid, array('stickblogs' => implode(',', $stickids)));
}
}
return $list;
}
?>

View File

@@ -0,0 +1,173 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: space_debate.php 28220 2012-02-24 07:52:50Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['forumstatus']) {
showmessage('forum_status_off');
}
$minhot = $_G['setting']['feedhotmin']<1?3:$_G['setting']['feedhotmin'];
$page = empty($_GET['page'])?1:intval($_GET['page']);
if($page<1) $page=1;
$id = empty($_GET['id'])?0:intval($_GET['id']);
$opactives['debate'] = 'class="a"';
$_GET['view'] = in_array($_GET['view'], array('we', 'me', 'all')) ? $_GET['view'] : 'we';
$_GET['order'] = in_array($_GET['order'], array('hot', 'dateline')) ? $_GET['order'] : 'dateline';
$perpage = 20;
$perpage = mob_perpage($perpage);
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
$list = $userlist = array();
$count = $pricount = 0;
$gets = array(
'mod' => 'space',
'uid' => $space['uid'],
'do' => 'debate',
'view' => $_GET['view'],
'order' => $_GET['order'],
'type' => $_GET['type'],
'fuid' => $_GET['fuid'],
'searchkey' => $_GET['searchkey']
);
$theurl = 'home.php?'.url_implode($gets);
$multi = '';
$f_index = '';
$ordersql = 't.dateline DESC';
$need_count = true;
$join = $authorid = $replies = 0;
$displayorder = null;
$subject = '';
if($_GET['view'] == 'me') {
if($_GET['type'] == 'reply') {
$authorid = $space['uid'];
$join = true;
} else {
$authorid = $space['uid'];
}
$viewtype = in_array($_GET['type'], array('orig', 'reply')) ? $_GET['type'] : 'orig';
$typeactives = array($viewtype => ' class="a"');
} else {
space_merge($space, 'field_home');
if($space['feedfriend']) {
$fuid_actives = array();
require_once libfile('function/friend');
$fuid = intval($_GET['fuid']);
if($fuid && friend_check($fuid, $space['uid'])) {
$authorid = $fuid;
$fuid_actives = array($fuid=>' selected');
} else {
$authorid = explode(',', $space['feedfriend']);
$theurl = "home.php?mod=space&uid={$space['uid']}&do=$do&view=we";
}
$query = C::t('home_friend')->fetch_all_by_uid($space['uid'], 0, 100, true);
foreach($query as $value) {
$userlist[] = $value;
}
} else {
$need_count = false;
}
}
$actives = array($_GET['view'] =>' class="a"');
if($need_count) {
if($_GET['view'] != 'me') {
$displayorder = 0;
}
if($searchkey = stripsearchkey($_GET['searchkey'])) {
$subject = $searchkey;
$searchkey = dhtmlspecialchars($searchkey);
}
$count = C::t('forum_thread')->count_by_special(5, $authorid, $replies, $displayorder, $subject, $join);
if($count) {
$dids = $special = $multitable = $tids = array();
require_once libfile('function/post');
foreach(C::t('forum_thread')->fetch_all_by_special(5, $authorid, $replies, $displayorder, $subject, $join, $start, $perpage) as $value) {
$value['dateline'] = dgmdate($value['dateline']);
if($_GET['view'] == 'me' && $_GET['type'] == 'reply' && $page == 1 && count($special) < 2) {
$value['message'] = messagecutstr($value['message'], 200);
$special[$value['tid']] = $value;
} else {
if($page == 1 && count($special) < 2) {
$tids[$value['posttableid']][$value['tid']] = $value['tid'];
$special[$value['tid']] = $value;
} else {
$list[$value['tid']] = $value;
}
}
$dids[$value['tid']] = $value['tid'];
}
if($tids) {
foreach($tids as $postid => $tid) {
foreach(C::t('forum_post')->fetch_all_by_tid(0, $tid) as $value) {
$special[$value['tid']]['message'] = messagecutstr($value['message'], 200);
}
}
}
if($dids) {
foreach(C::t('forum_debate')->fetch_all($dids) as $value) {
$value['negavotesheight'] = $value['affirmvotesheight'] = '8px';
if($value['affirmvotes'] || $value['negavotes']) {
$allvotes = $value['affirmvotes'] + $value['negavotes'];
$value['negavotesheight'] = round($value['negavotes']/$allvotes * 100, 2).'%';
$value['affirmvotesheight'] = round($value['affirmvotes']/$allvotes * 100, 2).'%';
}
if($list[$value['tid']]) {
$list[$value['tid']] = array_merge($value, $list[$value['tid']]);
} elseif($special[$value['tid']]) {
$special[$value['tid']] = array_merge($value, $special[$value['tid']]);
}
}
}
$multi = multi($count, $perpage, $page, $theurl);
}
}
if($_G['uid']) {
if($_GET['view'] == 'all') {
$navtitle = lang('core', 'title_view_all').lang('core', 'title_debate');
} elseif($_GET['view'] == 'me') {
$navtitle = lang('core', 'title_my_debate');
} else {
$navtitle = lang('core', 'title_friend_debate');
}
} else {
if($_GET['order'] == 'hot') {
$navtitle = lang('core', 'title_top_debate');
} else {
$navtitle = lang('core', 'title_newest_debate');
}
}
include_once template("diy:home/space_debate");
?>

View File

@@ -0,0 +1,176 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: space_doing.php 29155 2012-03-27 10:39:12Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['doingstatus']) {
showmessage('doing_status_off');
}
$perpage = 20;
$perpage = mob_perpage($perpage);
$page = empty($_GET['page'])?0:intval($_GET['page']);
if($page<1) $page=1;
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
$dolist = array();
$count = 0;
$_GET['view'] = in_array($_GET['view'], array('we', 'me', 'all')) ? $_GET['view'] : 'we';
$gets = array(
'mod' => 'space',
'uid' => $space['uid'],
'do' => 'doing',
'view' => $_GET['view'],
'searchkey' => $_GET['searchkey'],
'from' => $_GET['from']
);
$theurl = 'home.php?'.url_implode($gets);
$f_index = '';
$diymode = 0;
if($_GET['view'] == 'all') {
$f_index = 'dateline';
} elseif($_GET['view'] == 'we') {
space_merge($space, 'field_home');
if($space['feedfriend']) {
$uids = array_merge(explode(',', $space['feedfriend']), array($space['uid']));
$f_index = 'dateline';
} else {
$uids = array($space['uid']);
}
} else {
if($_GET['from'] == 'space') $diymode = 1;
$uids = $_GET['highlight'] ? array() : array($space['uid']);
}
$actives = array($_GET['view'] =>' class="a"');
$doid = empty($_GET['doid'])?0:intval($_GET['doid']);
$doids = $clist = $newdoids = array();
$pricount = 0;
if($doid) {
$count = 1;
$f_index = '';
$theurl .= "&doid=$doid";
}
if($searchkey = stripsearchkey($_GET['searchkey'])) {
$searchkey = dhtmlspecialchars($searchkey);
}
if(empty($count)) {
$count = C::t('home_doing')->fetch_all_search($start, $perpage, 3, $uids, '', $searchkey, '', '' ,'', 1, $doid, $f_index);
}
if($count) {
$query = C::t('home_doing')->fetch_all_search($start, $perpage, 1, $uids, '', $searchkey, '', '' ,'', 1, $doid, $f_index);
foreach($query as $value) {
if(!empty($value['ip'])) {
$value['ip'] = ip::to_display($value['ip']);
}
if($value['status'] == 0 || $value['uid'] == $_G['uid'] || $_G['adminid'] == 1) {
$doids[] = $value['doid'];
$dolist[] = $value;
} else {
$pricount ++;
}
}
}
if($doid) {
$dovalue = empty($dolist)?array():$dolist[0];
if($dovalue) {
if($dovalue['uid'] == $_G['uid']) {
$actives = array('me'=>' class="a"');
} else {
$actives = array('all'=>' class="a"');
}
}
}
if($doids) {
$tree = new lib_tree();
$values = array();
foreach(C::t('home_docomment')->fetch_all_by_doid($doids) as $value) {
$newdoids[$value['doid']] = $value['doid'];
if(empty($value['upid'])) {
$value['upid'] = "do{$value['doid']}";
}
if(!empty($value['ip'])) {
$value['ip'] = ip::to_display($value['ip']);
}
$tree->setNode($value['id'], $value['upid'], $value);
}
}
$showdoinglist = array();
foreach ($newdoids as $cdoid) {
$values = $tree->getChilds("do$cdoid");
$show = false;
foreach ($values as $key => $id) {
$one = $tree->getValue($id);
$one['layer'] = $tree->getLayer($id) * 2 - 2;
$one['style'] = "padding-left:{$one['layer']}em;";
if($_GET['highlight'] && $one['id'] == $_GET['highlight']) {
$one['style'] .= 'color:#F60;';
}
if($one['layer'] > 0){
if($one['layer']%3 == 2) {
$one['class'] = ' dtls';
} else {
$one['class'] = ' dtll';
}
}
if(!$show && $one['uid']) {
$show = true;
}
$clist[$cdoid][] = $one;
}
$showdoinglist[$cdoid] = $show;
}
$multi = multi($count, $perpage, $page, $theurl);
dsetcookie('home_diymode', $diymode);
if($_G['uid']) {
if($_GET['view'] == 'all') {
$navtitle = lang('core', 'title_view_all').lang('core', 'title_doing');
} elseif($_GET['view'] == 'me') {
$navtitle = lang('core', 'title_doing_view_me');
} else {
$navtitle = lang('core', 'title_me_friend_doing');
}
$defaultstr = getdefaultdoing();
} else {
$navtitle = lang('core', 'title_newest_doing');
}
if($space['username']) {
$navtitle = lang('space', 'sb_doing', array('who' => $space['username']));
}
$metakeywords = $navtitle;
$metadescription = $navtitle;
include_once template('diy:home/space_doing');
?>

View File

@@ -0,0 +1,124 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: space_favorite.php 33832 2013-08-20 03:32:32Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['favoritestatus']) {
showmessage('favorite_status_off');
}
$space = getuserbyuid($_G['uid']);
$page = empty($_GET['page'])?1:intval($_GET['page']);
if($page<1) $page=1;
$id = empty($_GET['id'])?0:intval($_GET['id']);
$perpage = 20;
$_G['disabledwidthauto'] = 0;
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
$idtypes = array('thread'=>'tid', 'forum'=>'fid', 'blog'=>'blogid', 'group'=>'gid', 'album'=>'albumid', 'space'=>'uid', 'article'=>'aid');
$_GET['type'] = isset($idtypes[$_GET['type']]) ? $_GET['type'] : 'all';
$actives[$_GET['type']] = ' class="a"';
$gets = array(
'mod' => 'space',
'uid' => $space['uid'],
'do' => 'favorite',
'type' => $_GET['type'],
'from' => $_GET['from']
);
$theurl = 'home.php?'.url_implode($gets);
$wherearr = $list = array();
$favid = empty($_GET['favid'])?0:intval($_GET['favid']);
$idtype = isset($idtypes[$_GET['type']]) ? $idtypes[$_GET['type']] : '';
$count = C::t('home_favorite')->count_by_uid_idtype($_G['uid'], $idtype, $favid);
if($count) {
$icons = array(
'tid'=>'<img src="'.STATICURL.'image/feed/thread.gif" alt="thread" class="t" /> ',
'fid'=>'<img src="'.STATICURL.'image/feed/discuz.gif" alt="forum" class="t" /> ',
'blogid'=>'<img src="'.STATICURL.'image/feed/blog.gif" alt="blog" class="t" /> ',
'gid'=>'<img src="'.STATICURL.'image/feed/group.gif" alt="group" class="t" /> ',
'uid'=>'<img src="'.STATICURL.'image/feed/profile.gif" alt="space" class="t" /> ',
'albumid'=>'<img src="'.STATICURL.'image/feed/album.gif" alt="album" class="t" /> ',
'aid'=>'<img src="'.STATICURL.'image/feed/article.gif" alt="article" class="t" /> ',
);
$articles = array();
foreach(C::t('home_favorite')->fetch_all_by_uid_idtype($_G['uid'], $idtype, $favid, $start,$perpage) as $value) {
$value['icon'] = isset($icons[$value['idtype']]) ? $icons[$value['idtype']] : '';
$value['url'] = makeurl($value['id'], $value['idtype'], $value['spaceuid']);
$value['description'] = !empty($value['description']) ? nl2br($value['description']) : '';
$list[$value['favid']] = $value;
if($value['idtype'] == 'aid') {
$articles[$value['favid']] = $value['id'];
}
}
if(!empty($articles)) {
include_once libfile('function/portal');
$_urls = array();
foreach(C::t('portal_article_title')->fetch_all($articles) as $aid => $article) {
$_urls[$aid] = fetch_article_url($article);
}
foreach ($articles as $favid => $aid) {
$list[$favid]['url'] = $_urls[$aid];
}
}
}
$multi = multi($count, $perpage, $page, $theurl);
dsetcookie('home_diymode', $diymode);
if(!$_GET['type']) {
$_GET['type'] = 'all';
}
if($_GET['type'] == 'group') {
$navtitle = lang('core', 'title_group_favorite', array('gorup' => $_G['setting']['navs'][3]['navname']));
} else {
$navtitle = lang('core', 'title_'.$_GET['type'].'_favorite');
}
include_once template("diy:home/space_favorite");
function makeurl($id, $idtype, $spaceuid=0) {
$url = '';
switch($idtype) {
case 'tid':
$url = 'forum.php?mod=viewthread&tid='.$id;
break;
case 'fid':
$url = 'forum.php?mod=forumdisplay&fid='.$id;
break;
case 'blogid':
$url = 'home.php?mod=space&uid='.$spaceuid.'&do=blog&id='.$id;
break;
case 'gid':
$url = 'forum.php?mod=group&fid='.$id;
break;
case 'uid':
$url = 'home.php?mod=space&uid='.$id;
break;
case 'albumid':
$url = 'home.php?mod=space&uid='.$spaceuid.'&do=album&id='.$id;
break;
case 'aid':
$url = 'portal.php?mod=view&aid='.$id;
break;
}
return $url;
}
?>

View File

@@ -0,0 +1,272 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: space_friend.php 32006 2012-10-30 09:51:28Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['friendstatus']) {
showmessage('friend_status_off');
}
$perpage = 24;
$perpage = mob_perpage($perpage);
$list = $ols = $fuids = array();
$count = 0;
$page = empty($_GET['page'])?0:intval($_GET['page']);
if($page<1) $page = 1;
$start = ($page-1)*$perpage;
$_GET['view'] = in_array($_GET['view'], array('online', 'visitor', 'trace', 'blacklist', 'me')) ? $_GET['view'] : 'me';
$_GET['order'] = in_array($_GET['order'], array('hot', 'dateline')) ? $_GET['order'] : 'dateline';
ckstart($start, $perpage);
if($_GET['view'] == 'online') {
$theurl = "home.php?mod=space&uid={$space['uid']}&do=friend&view=online";
$actives = array('me'=>' class="a"');
space_merge($space, 'field_home');
$onlinedata = array();
$wheresql = '';
if($_GET['type']=='near') {
$theurl = "home.php?mod=space&uid={$space['uid']}&do=friend&view=online&type=near";
if(($count = C::app()->session->count_by_ip($_G['clientip']))) {
$onlinedata = C::app()->session->fetch_all_by_ip($_G['clientip'], $start, $perpage);
}
} elseif($_GET['type']=='friend') {
$theurl = "home.php?mod=space&uid={$space['uid']}&do=friend&view=online&type=friend";
if(!empty($space['feedfriend'])) {
$onlinedata = C::app()->session->fetch_all_by_uid(explode(',', $space['feedfriend']), $start, $perpage);
}
$count = count($onlinedata);
} elseif($_GET['type']=='member') {
$theurl = "home.php?mod=space&uid={$space['uid']}&do=friend&view=online&type=member";
$wheresql = " WHERE uid>0";
if(($count = C::app()->session->count(1))) {
$onlinedata = C::app()->session->fetch_member(1, 2, $start, $perpage);
}
} else {
$_GET['type']='all';
$theurl = "home.php?mod=space&uid={$space['uid']}&do=friend&view=online&type=all";
if(($count = C::app()->session->count_invisible(0))) {
$onlinedata = C::app()->session->fetch_member(0, 2, $start, $perpage);
}
}
if($count) {
foreach($onlinedata as $value) {
if($_GET['type']=='near') {
if($value['uid'] == $space['uid']) {
$count = $count-1;
continue;
}
}
if(!$value['invisible']) $ols[$value['uid']] = $value['lastactivity'];
$list[$value['uid']] = $value;
$fuids[$value['uid']] = $value['uid'];
}
if($fuids) {
require_once libfile('function/friend');
friend_check($space['uid'], $fuids);
$fieldhome = C::t('common_member_field_home')->fetch_all($fuids);
foreach(C::t('common_member')->fetch_all($fuids) as $uid => $value) {
$value = array_merge($value, $fieldhome[$uid]);
$value['isfriend'] = $uid==$space['uid'] || $_G["home_friend_".$space['uid'].'_'.$uid] ? 1 : 0;
$list[$uid] = array_merge($list[$uid], $value);
}
}
}
$multi = multi($count, $perpage, $page, $theurl);
} elseif($_GET['view'] == 'visitor' || $_GET['view'] == 'trace') {
$theurl = "home.php?mod=space&uid={$space['uid']}&do=friend&view={$_GET['view']}";
$actives = array('me'=>' class="a"');
if($_GET['view'] == 'visitor') {
$count = C::t('home_visitor')->count_by_uid($space['uid']);
} else {
$count = C::t('home_visitor')->count_by_vuid($space['uid']);
}
if($count) {
if($_GET['view'] == 'visitor') {
$visitors = C::t('home_visitor')->fetch_all_by_uid($space['uid'], $start, $perpage);
} else {
$visitors = C::t('home_visitor')->fetch_all_by_vuid($space['uid'], $start, $perpage);
}
foreach($visitors as $value) {
if($_GET['view'] == 'visitor') {
$value['uid'] = $value['vuid'];
$value['username'] = $value['vusername'];
}
$fuids[] = $value['uid'];
$list[$value['uid']] = $value;
}
}
$multi = multi($count, $perpage, $page, $theurl);
} elseif($_GET['view'] == 'blacklist') {
$theurl = "home.php?mod=space&uid={$space['uid']}&do=friend&view={$_GET['view']}";
$actives = array('me'=>' class="a"');
$count = C::t('home_blacklist')->count_by_uid_buid($space['uid']);
if($count) {
$backlist = C::t('home_blacklist')->fetch_all_by_uid($space['uid'], $start,$perpage);
$members = C::t('common_member')->fetch_all(array_keys($backlist));
foreach($backlist as $buid => $value) {
$value = array_merge($value, $members[$buid]);
$value['isfriend'] = 0;
$fuids[] = $value['uid'];
$list[$value['uid']] = $value;
}
}
$multi = multi($count, $perpage, $page, $theurl);
} else {
$theurl = "home.php?mod=space&uid={$space['uid']}&do=$do";
$actives = array('me'=>' class="a"');
$_GET['view'] = 'me';
$querydata = array();
if($space['self']) {
require_once libfile('function/friend');
$groups = friend_group_list();
$group = !isset($_GET['group'])?'-1':intval($_GET['group']);
if($group > -1) {
$querydata['gid'] = $group;
$theurl .= "&group=$group";
}
}
if($_GET['searchkey']) {
require_once libfile('function/search');
$querydata['searchkey'] = $_GET['searchkey'];
$theurl .= "&searchkey={$_GET['searchkey']}";
}
$count = C::t('home_friend')->fetch_all_search($space['uid'], $querydata['gid'], $querydata['searchkey'], true);
$membercount = C::t('common_member_count')->fetch($_G['uid']);
$friendnum = $membercount['friends'];
unset($membercount);
if($count) {
$query = C::t('home_friend')->fetch_all_search($space['uid'], $querydata['gid'], $querydata['searchkey'], false, $start, $perpage, $_GET['order'] ? true : false);
foreach($query as $value) {
$value['uid'] = $value['fuid'];
$_G["home_friend_".$space['uid'].'_'.$value['uid']] = $value['isfriend'] = 1;
$fuids[$value['uid']] = $value['uid'];
$list[$value['uid']] = $value;
}
} elseif(!$friendnum) {
if(($specialuser_count = C::t('home_specialuser')->count_by_status(1))) {
foreach(C::t('home_specialuser')->fetch_all_by_status(1, 7) as $value) {
if($_G['uid'] !== $value['uid']) {
$fuids[$value['uid']] = $value['uid'];
$specialuser_list[$value['uid']] = $value;
}
if(count($fuids) >= 6) {
break;
}
}
$specialuser_list = getfollowflag($specialuser_list);
}
if(($online_count = C::app()->session->count(1)) > 1) {
$oluids = $online_list = array();
foreach(C::app()->session->fetch_member(1, 2, 7) as $value) {
if($value['uid'] != $_G['uid'] && count($oluids) <= 6) {
$fuids[$value['uid']] = $value['uid'];
$oluids[$value['uid']] = $value['uid'];
$online_list[$value['uid']] = $value;
}
}
$online_list = getfollowflag($online_list);
$fieldhome = C::t('common_member_field_home')->fetch_all($oluids, false, 0);
foreach(C::t('common_member')->fetch_all($oluids, false, 0) as $uid => $value) {
$value = array_merge($value, $fieldhome[$uid]);
$online_list[$uid] = array_merge($online_list[$uid], $value);
}
}
}
$diymode = 1;
if($space['self'] && ($_GET['from'] != 'space' || !$_G['setting']['homepagestyle'])) $diymode = 0;
if($diymode) {
$theurl .= "&from=space";
}
$multi = multi($count, $perpage, $page, $theurl);
if($space['self']) {
$groupselect = array($group => ' class="a"');
$maxfriendnum = checkperm('maxfriendnum');
if($maxfriendnum) {
$maxfriendnum = checkperm('maxfriendnum') + $space['addfriend'];
}
}
}
if($fuids) {
foreach(C::app()->session->fetch_all_by_uid($fuids) as $value) {
if(!$value['invisible']) {
$ols[$value['uid']] = $value['lastactivity'];
} elseif($list[$value['uid']] && !in_array($_GET['view'], array('me', 'trace', 'blacklist'))) {
unset($list[$value['uid']]);
$count = $count - 1;
}
}
if($_GET['view'] != 'me') {
require_once libfile('function/friend');
friend_check($fuids);
}
if($list) {
$fieldhome = C::t('common_member_field_home')->fetch_all($fuids);
foreach(C::t('common_member')->fetch_all($fuids) as $uid => $value) {
$fieldhome_value = is_array($fieldhome[$uid]) ? $fieldhome[$uid] : array();
$value = array_merge($value, $fieldhome_value);
$value['isfriend'] = $uid==$space['uid'] || $_G["home_friend_".$space['uid'].'_'.$uid] ? 1 : 0;
if(empty($list[$uid])) $list[$uid] = array();
$list[$uid] = array_merge($list[$uid], $value);
}
}
}
if($list) {
$list = getfollowflag($list);
}
$navtitle = lang('core', 'title_friend_list');
$navtitle = lang('space', 'sb_friend', array('who' => $space['username']));
$metakeywords = lang('space', 'sb_friend', array('who' => $space['username']));
$metadescription = lang('space', 'sb_share', array('who' => $space['username']));
$a_actives = array($_GET['view'].$_GET['type'] => ' class="a"');
include_once template("diy:home/space_friend");
function getfollowflag($data) {
global $_G;
if($data) {
$follows = C::t('home_follow')->fetch_all_by_uid_followuid($_G['uid'], array_keys($data));
foreach($data as $uid => $value) {
$data[$uid]['follow'] = isset($follows[$uid]) ? 1 : 0;
}
}
return $data;
}
?>

View File

@@ -0,0 +1,412 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: space_home.php 30780 2012-06-19 06:01:52Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(!$_G['uid'] && $_G['setting']['privacy']['view']['home']) {
showmessage('home_no_privilege', '', array(), array('login' => true));
}
require_once libfile('function/feed');
if(empty($_G['setting']['feedhotday'])) {
$_G['setting']['feedhotday'] = 2;
}
$minhot = $_G['setting']['feedhotmin']<1?3:$_G['setting']['feedhotmin'];
space_merge($space, 'count');
if($_G['uid'] != $space['uid'] && !$_G['group']['allowviewprofile']) {
if(!$_G['uid']) {
showmessage('home_no_privilege', '', array(), array('login' => true));
} else {
showmessage('no_privilege_profile');
}
}
if(empty($_GET['view'])) {
if($space['self']) {
if($_G['setting']['showallfriendnum'] && $space['friends'] < $_G['setting']['showallfriendnum']) {
$_GET['view'] = 'all';
} else {
$_GET['view'] = 'we';
}
} else {
$_GET['view'] = 'all';
}
} elseif(!in_array($_GET['view'], array('we', 'me', 'all', 'app'))) {
$_GET['view'] = 'all';
}
$_GET['order'] = in_array($_GET['order'], array('hot', 'dateline')) ? $_GET['order'] : 'dateline';
$perpage = $_G['setting']['feedmaxnum']<20?20:$_G['setting']['feedmaxnum'];
$perpage = mob_perpage($perpage);
if($_GET['view'] == 'all' && $_GET['order'] == 'hot') {
$perpage = 50;
}
$page = intval($_GET['page']);
if($page < 1) $page = 1;
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
$_G['home_today'] = $_G['timestamp'] - ($_G['timestamp'] + $_G['setting']['timeoffset'] * 3600) % 86400;
$gets = array(
'mod' => 'space',
'uid' => $space['uid'],
'do' => 'home',
'view' => $_GET['view'],
'order' => $_GET['order'],
'type' => $_GET['type'],
'icon' => $_GET['icon']
);
$theurl = 'home.php?'.url_implode($gets);
$hotlist = array();
if(!IS_ROBOT) {
$feed_users = $feed_list = $user_list = $filter_list = $list = $magic = array();
if($_GET['view'] != 'app') {
if($space['self'] && empty($start) && $_G['setting']['feedhotnum'] > 0 && ($_GET['view'] == 'we' || $_GET['view'] == 'all')) {
$hotlist_all = array();
$hotstarttime = $_G['timestamp'] - $_G['setting']['feedhotday']*3600*24;
$query = C::t('home_feed')->fetch_all_by_hot($hotstarttime);
foreach ($query as $value) {
if($value['hot']>0 && ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
if(empty($hotlist)) {
$hotlist[$value['feedid']] = $value;
} else {
$hotlist_all[$value['feedid']] = $value;
}
}
}
$nexthotnum = $_G['setting']['feedhotnum'] - 1;
if($nexthotnum > 0) {
if(count($hotlist_all)> $nexthotnum) {
$hotlist_key = array_rand($hotlist_all, $nexthotnum);
if($nexthotnum == 1) {
$hotlist[$hotlist_key] = $hotlist_all[$hotlist_key];
} else {
foreach ($hotlist_key as $key) {
$hotlist[$key] = $hotlist_all[$key];
}
}
} else {
$hotlist = array_merge($hotlist, $hotlist_all);
}
}
}
}
$need_count = true;
$uids = array();
$multi = $hot = '';
if($_GET['view'] == 'all') {
if($_GET['order'] == 'dateline') {
$ordersql = "dateline DESC";
$f_index = '';
$findex = '';
$orderactives = array('dateline' => ' class="a"');
} else {
$hot = $minhot;
$ordersql = "dateline DESC";
$f_index = '';
$findex = '';
$orderactives = array('hot' => ' class="a"');
}
} elseif($_GET['view'] == 'me') {
$uids = array($space['uid']);
$ordersql = "dateline DESC";
$f_index = '';
$findex = '';
$diymode = 1;
if($space['self'] && $_GET['from'] != 'space') $diymode = 0;
} else {
space_merge($space, 'field_home');
if(empty($space['feedfriend'])) {
$need_count = false;
} else {
$uids = array_merge(explode(',', $space['feedfriend']), array(0));
$ordersql = "dateline DESC";
$f_index = 'USE INDEX(dateline)';
$findex = 'dateline';
}
}
$icon = empty($_GET['icon'])?'':trim($_GET['icon']);
$gid = !isset($_GET['gid'])?'-1':intval($_GET['gid']);
if($gid>=0) {
$fuids = array();
$query = C::t('home_friend')->fetch_all_by_uid_gid($_G['uid'], $gid);
foreach($query as $value) {
$fuids[] = $value['fuid'];
}
if(empty($fuids)) {
$need_count = false;
} else {
$uids = $fuids;
}
}
$gidactives[$gid] = ' class="a"';
$count = $filtercount = 0;
if($need_count) {
$query = C::t('home_feed')->fetch_all_by_search(1, $uids, $icon, '', '', '', $hot, '', $start, $perpage, $findex);
if($_GET['view'] == 'me') {
foreach ($query as $value) {
if(!isset($hotlist[$value['feedid']]) && !isset($hotlist_all[$value['feedid']]) && ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
$value = mkfeed($value);
if($value['dateline']>=$_G['home_today']) {
$list['today'][] = $value;
} elseif ($value['dateline']>=$_G['home_today']-3600*24) {
$list['yesterday'][] = $value;
} else {
$theday = dgmdate($value['dateline'], 'Y-m-d');
$list[$theday][] = $value;
}
}
$count++;
}
} else {
$hash_datas = array();
$more_list = array();
$uid_feedcount = array();
foreach($query as $value) {
if(!isset($hotlist[$value['feedid']]) && !isset($hotlist_all[$value['feedid']]) && ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
$value = mkfeed($value);
if(ckicon_uid($value)) {
if($value['dateline']>=$_G['home_today']) {
$dkey = 'today';
} elseif ($value['dateline']>=$_G['home_today']-3600*24) {
$dkey = 'yesterday';
} else {
$dkey = dgmdate($value['dateline'], 'Y-m-d');
}
$maxshownum = 3;
if(empty($value['uid'])) $maxshownum = 10;
if(empty($value['hash_data'])) {
if(empty($feed_users[$dkey][$value['uid']])) $feed_users[$dkey][$value['uid']] = $value;
if(empty($uid_feedcount[$dkey][$value['uid']])) $uid_feedcount[$dkey][$value['uid']] = 0;
$uid_feedcount[$dkey][$value['uid']]++;
if($uid_feedcount[$dkey][$value['uid']]>$maxshownum) {
$more_list[$dkey][$value['uid']][] = $value;
} else {
$feed_list[$dkey][$value['uid']][] = $value;
}
} elseif(empty($hash_datas[$value['hash_data']])) {
$hash_datas[$value['hash_data']] = 1;
if(empty($feed_users[$dkey][$value['uid']])) $feed_users[$dkey][$value['uid']] = $value;
if(empty($uid_feedcount[$dkey][$value['uid']])) $uid_feedcount[$dkey][$value['uid']] = 0;
$uid_feedcount[$dkey][$value['uid']] ++;
if($uid_feedcount[$dkey][$value['uid']]>$maxshownum) {
$more_list[$dkey][$value['uid']][] = $value;
} else {
$feed_list[$dkey][$value['uid']][$value['hash_data']] = $value;
}
} else {
$user_list[$value['hash_data']][] = "<a href=\"home.php?mod=space&uid={$value['uid']}\">{$value['username']}</a>";
}
} else {
$filtercount++;
$filter_list[] = $value;
}
}
$count++;
}
}
$multi = simplepage($count, $perpage, $page, $theurl);
}
}
$olfriendlist = $visitorlist = $task = $ols = $birthlist = $guidelist = array();
$oluids = array();
$groups = array();
$defaultusers = $newusers = $showusers = array();
if($space['self'] && empty($start)) {
space_merge($space, 'field_home');
if($_GET['view'] == 'we') {
require_once libfile('function/friend');
$groups = friend_group_list();
}
$isnewer = ($_G['timestamp']-$space['regdate'] > 3600*24*7) ?0:1;
if($isnewer && $_G['setting']['homestyle']) {
$friendlist = array();
$query = C::t('home_friend')->fetch_all($space['uid']);
foreach($query as $value) {
$friendlist[$value['fuid']] = 1;
}
foreach(C::t('home_specialuser')->fetch_all_by_status(1) as $value) {
if(empty($friendlist[$value['uid']])) {
$defaultusers[] = $value;
$oluids[] = $value['uid'];
}
}
}
if($space['newprompt']) {
space_merge($space, 'status');
}
if($_G['setting']['homestyle']) {
foreach(C::t('home_visitor')->fetch_all_by_uid($space['uid'], 12) as $value) {
$visitorlist[$value['vuid']] = $value;
$oluids[] = $value['vuid'];
}
if($oluids) {
foreach(C::app()->session->fetch_all_by_uid($oluids) as $value) {
if(!$value['invisible']) {
$ols[$value['uid']] = 1;
} elseif ($visitorlist[$value['uid']]) {
unset($visitorlist[$value['uid']]);
}
}
}
$oluids = array();
$olfcount = 0;
if($space['feedfriend']) {
foreach(C::app()->session->fetch_all_by_uid(explode(',', $space['feedfriend']), 15) as $value) {
if($olfcount < 15 && !$value['invisible']) {
$olfriendlist[$value['uid']] = $value;
$ols[$value['uid']] = 1;
$oluids[$value['uid']] = $value['uid'];
$olfcount++;
}
}
}
if($olfcount < 15) {
$query = C::t('home_friend')->fetch_all_by_uid($space['uid'], 0, 32, true);
foreach($query as $value) {
$value['uid'] = $value['fuid'];
$value['username'] = $value['fusername'];
if(empty($oluids[$value['uid']])) {
$olfriendlist[$value['uid']] = $value;
$olfcount++;
if($olfcount == 15) break;
}
}
}
if($space['feedfriend']) {
$birthdaycache = C::t('forum_spacecache')->fetch_spacecache($_G['uid'], 'birthday');
if(empty($birthdaycache) || TIMESTAMP > $birthdaycache['expiration']) {
$birthlist = C::t('common_member_profile')->fetch_all_will_birthday_by_uid($space['feedfriend']);
C::t('forum_spacecache')->insert(array(
'uid' => $_G['uid'],
'variable' => 'birthday',
'value' => serialize($birthlist),
'expiration' => getexpiration(),
), false, true);
} else {
$birthlist = dunserialize($birthdaycache['value']);
}
}
if($_G['setting']['taskstatus']) {
require_once libfile('class/task');
$tasklib = & task::instance();
$taskarr = $tasklib->tasklist('canapply');
$task = count($taskarr) ? $taskarr[array_rand($taskarr)] : array();
}
if($_G['setting']['magicstatus']) {
loadcache('magics');
if(!empty($_G['cache']['magics'])) {
$magic = $_G['cache']['magics'][array_rand($_G['cache']['magics'])];
$magic['description'] = cutstr($magic['description'], 34, '');
$magic['pic'] = strtolower($magic['identifier']).'.gif';
}
}
}
} elseif(empty($_G['uid'])) {
$defaultusers = C::t('home_specialuser')->fetch_all_by_status(1, 12);
$query = C::t('home_show')->fetch_all_by_credit(0, 12); //DB::query("SELECT * FROM ".DB::table('home_show')." ORDER BY credit DESC LIMIT 0,12");
foreach($query as $value) {
$showusers[] = $value;
}
foreach(C::t('common_member')->range(0, 12,'DESC') as $uid => $value) {
$value['regdate'] = dgmdate($value['regdate'], 'u', 9999, 'm-d');
$newusers[$uid] = $value;
}
}
dsetcookie('home_readfeed', $_G['timestamp'], 365*24*3600);
if($_G['uid']) {
$defaultstr = getdefaultdoing();
space_merge($space, 'status');
if(!$space['profileprogress']) {
include_once libfile('function/profile');
$space['profileprogress'] = countprofileprogress();
}
}
$actives = array($_GET['view'] => ' class="a"');
if($_GET['from'] == 'space') {
if($_GET['do'] == 'home') {
$navtitle = lang('space', 'sb_feed', array('who' => $space['username']));
$metakeywords = lang('space', 'sb_feed', array('who' => $space['username']));
$metadescription = lang('space', 'sb_feed', array('who' => $space['username']));
}
} else {
list($navtitle, $metadescription, $metakeywords) = get_seosetting('home');
if(!$navtitle) {
$navtitle = $_G['setting']['navs'][4]['navname'];
$nobbname = false;
} else {
$nobbname = true;
}
if(!$metakeywords) {
$metakeywords = $_G['setting']['navs'][4]['navname'];
}
if(!$metadescription) {
$metadescription = $_G['setting']['navs'][4]['navname'];
}
}
if(empty($cp_mode)) include_once template("diy:home/space_home");
?>

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: space_index.php 31354 2012-08-16 03:03:08Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(($_G['adminid'] == 1 && $_G['setting']['allowquickviewprofile'] && $_GET['view'] != 'admin' && $_GET['diy'] != 'yes') || defined('IN_MOBILE')) {
dheader("Location:home.php?mod=space&uid={$space['uid']}&do=profile");
}
require_once libfile('function/space');
space_merge($space, 'field_home');
$userdiy = getuserdiydata($space);
if ($_GET['op'] == 'getmusiclist') {
if(empty($space['uid'])) {
exit();
}
$reauthcode = substr(md5($_G['authkey'].$space['uid']), 6, 16);
if($reauthcode == $_GET['hash']) {
space_merge($space,'field_home');
$userdiy = getuserdiydata($space);
helper_output::json($userdiy['parameters']['music']);
}
exit();
}else{
if(!$_G['setting']['preventrefresh'] || $_G['uid'] && !$space['self'] && $_G['cookie']['viewid'] != 'uid_'.$space['uid']) {
member_count_update($space['uid'], array('views' => 1));
$viewuids[$space['uid']] = $space['uid'];
dsetcookie('viewid', 'uid_'.$space['uid']);
}
show_view();
if($_GET['additional'] == 'removevlog') {
C::t('home_visitor')->delete_by_uid_vuid($space['uid'], $_G['uid']);
}
if($do != 'profile' && !ckprivacy($do, 'view')) {
$_G['privacy'] = 1;
require_once libfile('space/profile', 'include');
include template('home/space_privacy');
exit();
}
$widths = getlayout($userdiy['currentlayout']);
$leftlist = formatdata($userdiy, 'left', $space);
$centerlist = formatdata($userdiy, 'center', $space);
$rightlist = formatdata($userdiy, 'right', $space);
dsetcookie('home_diymode', 1);
}
$navtitle = !empty($space['spacename']) ? $space['spacename'] : lang('space', 'sb_space', array('who' => $space['username']));
$metakeywords = lang('space', 'sb_space', array('who' => $space['username']));
$metadescription = lang('space', 'sb_space', array('who' => $space['username']));
$space['medals'] = getuserprofile('medals');
if($space['medals']) {
loadcache('medals');
foreach($space['medals'] = explode("\t", $space['medals']) as $key => $medalid) {
list($medalid, $medalexpiration) = explode("|", $medalid);
if(isset($_G['cache']['medals'][$medalid]) && (!$medalexpiration || $medalexpiration > TIMESTAMP)) {
$space['medals'][$key] = $_G['cache']['medals'][$medalid];
} else {
unset($space['medals'][$key]);
}
}
}
include_once(template('home/space_index'));
function formatdata($data, $position, $space) {
$list = array();
foreach ((array)$data['block']['frame`frame1']['column`frame1_'.$position] as $blockname => $blockdata) {
if (strpos($blockname, 'block`') === false || empty($blockdata) || !isset($blockdata['attr']['name'])) continue;
$name = $blockdata['attr']['name'];
if(check_ban_block($name, $space)) {
$list[$name] = getblockhtml($name, $data['parameters'][$name]);
}
}
return $list;
}
?>

View File

@@ -0,0 +1,118 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: space_notice.php 34047 2013-09-25 04:41:45Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$perpage = 30;
$perpage = mob_perpage($perpage);
$page = empty($_GET['page'])?0:intval($_GET['page']);
if($page<1) $page = 1;
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
$list = array();
$mynotice = $count = 0;
$multi = '';
if(empty($_G['member']['category_num']['manage']) && !in_array($_G['adminid'], array(1,2,3))) {
unset($_G['notice_structure']['manage']);
}
$view = (!empty($_GET['view']) && (isset($_G['notice_structure'][$_GET['view']]))) ? $_GET['view'] : 'all';
$actives = array($view=>' class="a"');
$opactives[$view] = 'class="a"';
$categorynum = $newprompt = array();
if($view) {
if(!empty($_GET['ignore'])) {
C::t('home_notification')->ignore($_G['uid']);
}
foreach (array('wall', 'piccomment', 'blogcomment', 'clickblog', 'clickpic', 'sharecomment', 'doing', 'friend', 'credit', 'bbs', 'system', 'thread', 'task', 'group') as $key) {
$noticetypes[$key] = lang('notification', "type_$key");
}
$isread = in_array($_GET['isread'], array(0, 1)) ? intval($_GET['isread']) : 0;
$category = $type = '';
if(isset($_G['notice_structure'][$view])) {
if(!in_array($view, array('mypost', 'interactive'))) {
$category = $view;
} else {
$deftype = $_G['notice_structure'][$view][0];
if($_G['member']['newprompt_num']) {
foreach($_G['notice_structure'][$view] as $subtype) {
if($_G['member']['newprompt_num'][$subtype]) {
$deftype = $subtype;
break;
}
}
}
$type = in_array($_GET['type'], $_G['notice_structure'][$view]) ? trim($_GET['type']) : $deftype;
}
}
$wherearr = array();
$new = -1;
if(!empty($type)) {
$wherearr[] = "`type`='$type'";
}
$sql = ' AND '.implode(' AND ', $wherearr);
$newnotify = false;
$count = C::t('home_notification')->count_by_uid($_G['uid'], $new, $type, $category);
if($count) {
if($new == 1 && $perpage == 30) {
$perpage = 200;
}
foreach(C::t('home_notification')->fetch_all_by_uid($_G['uid'], $new, $type, $start, $perpage, $category) as $value) {
if($value['new']) {
$newnotify = true;
$value['style'] = 'color:#000;font-weight:bold;';
} else {
$value['style'] = '';
}
$value['rowid'] = '';
if(in_array($value['type'], array('friend', 'poke'))) {
$value['rowid'] = ' id="'.($value['type'] == 'friend' ? 'pendingFriend_' : 'pokeQuery_').$value['authorid'].'" ';
}
if($value['from_num'] > 0) $value['from_num'] = $value['from_num'] - 1;
$list[$value['id']] = $value;
}
$multi = '';
$multi = multi($count, $perpage, $page, "home.php?mod=space&do=$do&view=$view&type=$type&isread=1");
}
if($newnotify) {
C::t('home_notification')->ignore($_G['uid'], $type, $category, true, true);
}
helper_notification::update_newprompt($_G['uid'], ($type ? $type : $category));
if($_G['member']['newprompt']) {
$recountprompt = 0;
foreach($_G['member']['category_num'] as $promptnum) {
$recountprompt += $promptnum;
}
$recountprompt += $mynotice;
if($recountprompt == 0) {
C::t('common_member')->update($_G['uid'], array('newprompt' => 0));
}
}
$readtag = array($type => ' class="a"');
}
dsetcookie('promptstate_'.$_G['uid'], '', 31536000);
include_once template("diy:home/space_notice");
?>

View File

@@ -0,0 +1,21 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: space_plugin.php 33362 2013-05-31 09:31:22Z andyzheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$pluginkey = 'space_'.$_GET['op'];
$_GET['id'] = $_GET['id'] ? preg_replace("/[^A-Za-z0-9_:]/", '', $_GET['id']) : '';
$navtitle = $_G['setting']['plugins'][$pluginkey][$_GET['id']]['name'];
include pluginmodule($_GET['id'], $pluginkey);
include template('home/space_plugin');
?>

View File

@@ -0,0 +1,213 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: space_pm.php 33421 2013-06-09 03:30:16Z jeffjzhang $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
loaducenter();
$list = array();
$plid = empty($_GET['plid'])?0:intval($_GET['plid']);
$daterange = empty($_GET['daterange'])?0:intval($_GET['daterange']);
$touid = empty($_GET['touid'])?0:intval($_GET['touid']);
$opactives['pm'] = 'class="a"';
if(empty($_G['member']['category_num']['manage']) && !in_array($_G['adminid'], array(1,2,3))) {
unset($_G['notice_structure']['manage']);
}
if($_GET['subop'] == 'view') {
$type = $_GET['type'];
$page = empty($_GET['page']) ? 0 : intval($_GET['page']);
$chatpmmember = intval($_GET['chatpmmember']);
$chatpmmemberlist = array();
if($chatpmmember) {
$chatpmmember = uc_pm_chatpmmemberlist($_G['uid'], $plid);
if(!empty($chatpmmember)) {
$authorid = $founderuid = $chatpmmember['author'];
$chatpmmemberlist = C::t('common_member')->fetch_all($chatpmmember['member']);
foreach(C::t('common_member_field_home')->fetch_all($chatpmmember['member']) as $uid => $member) {
$chatpmmemberlist[$uid] = array_merge($member, $chatpmmemberlist[$uid]);
}
}
require_once libfile('function/friend');
$friendgrouplist = friend_group_list();
$actives = array('chatpmmember'=>' class="a"');
} else {
if($touid) {
$ols = array();
if(defined('IN_MOBILE')) {
$perpage = 5;
} else {
$perpage = 10;
}
$perpage = mob_perpage($perpage);
if(!$daterange) {
$member = getuserbyuid($touid);
$tousername = $member['username'];
unset($member);
$count = uc_pm_view_num($_G['uid'], $touid, 0);
if(!$page) {
$page = ceil($count/$perpage);
}
$list = uc_pm_view($_G['uid'], 0, $touid, 5, ceil($count/$perpage)-$page+1, $perpage, 0, 0);
$multi = pmmulti($count, $perpage, $page, "home.php?mod=space&do=pm&subop=view&touid=$touid");
} else {
showmessage('parameters_error');
}
} else {
if(defined('IN_MOBILE')) {
$perpage = 10;
} else {
$perpage = 50;
}
$perpage = mob_perpage($perpage);
$count = uc_pm_view_num($_G['uid'], $plid, 1);
if(!$daterange) {
if(!$page) {
$page = ceil($count/$perpage);
}
$list = uc_pm_view($_G['uid'], 0, $plid, 5, ceil($count/$perpage)-$page+1, $perpage, $type, 1);
$multi = pmmulti($count, $perpage, $page, "home.php?mod=space&do=pm&subop=view&plid=$plid&type=$type");
} else {
$list = uc_pm_view($_G['uid'], 0, $plid, 5, ceil($count/$perpage)-$page+1, $perpage, $type, 1);
$chatpmmember = uc_pm_chatpmmemberlist($_G['uid'], $plid);
if(!empty($chatpmmember)) {
$authorid = $founderuid = $chatpmmember['author'];
$chatpmmemberlist = C::t('common_member')->fetch_all($chatpmmember['member']);
foreach(C::t('common_member_field_home')->fetch_all($chatpmmember['member']) as $uid => $member) {
$chatpmmemberlist[$uid] = array_merge($member, $chatpmmemberlist[$uid]);
}
foreach(C::app()->session->fetch_all_by_uid($chatpmmember['member']) as $value) {
if(!$value['invisible']) {
$ols[$value['uid']] = $value['lastactivity'];
}
}
}
$membernum = count($chatpmmemberlist);
$subject = $list[0]['subject'];
$refreshtime = $_G['setting']['chatpmrefreshtime'];
}
}
$founderuid = empty($list)?0:$list[0]['founderuid'];
$pmid = empty($list)?0:$list[0]['pmid'];
}
$actives['privatepm'] = ' class="a"';
} elseif($_GET['subop'] == 'viewg') {
$grouppm = C::t('common_grouppm')->fetch($_GET['pmid']);
if(!$grouppm) {
$grouppm = array_merge((array)C::t('common_member_grouppm')->fetch_gpm($_G['uid'], $_GET['pmid']), $grouppm);
}
if($grouppm) {
$grouppm['numbers'] = $grouppm['numbers'] - 1;
}
if(!$grouppm['status']) {
C::t('common_member_grouppm')->update($_G['uid'], $_GET['pmid'], array('status' => 1, 'dateline' => TIMESTAMP));
}
$actives['announcepm'] = ' class="a"';
} elseif($_GET['subop'] == 'ignore') {
$ignorelist = uc_pm_blackls_get($_G['uid']);
$actives = array('ignore'=>' class="a"');
} elseif($_GET['subop'] == 'setting') {
$actives = array('setting'=>' class="a"');
$acceptfriendpmstatus = $_G['member']['onlyacceptfriendpm'] ? $_G['member']['onlyacceptfriendpm'] : ($_G['setting']['onlyacceptfriendpm'] ? 1 : 2);
$ignorelist = uc_pm_blackls_get($_G['uid']);
} else {
$filter = in_array($_GET['filter'], array('newpm', 'privatepm', 'announcepm')) ? $_GET['filter'] : 'privatepm';
$perpage = 15;
$perpage = mob_perpage($perpage);
$page = empty($_GET['page'])?0:intval($_GET['page']);
if($page<1) $page = 1;
$grouppms = $gpmids = $gpmstatus = array();
$newpm = $newpmcount = 0;
if($filter == 'privatepm' && $page == 1 || $filter == 'announcepm' || $filter == 'newpm') {
$announcepm = 0;
foreach(C::t('common_member_grouppm')->fetch_all_by_uid($_G['uid'], $filter == 'announcepm' ? 1 : 0) as $gpmid => $gpuser) {
$gpmstatus[$gpmid] = $gpuser['status'];
if($gpuser['status'] == 0) {
$announcepm ++;
}
}
$gpmids = array_keys($gpmstatus);
if($gpmids) {
foreach(C::t('common_grouppm')->fetch_all_by_id_authorid($gpmids) as $grouppm) {
$grouppm['message'] = cutstr(strip_tags($grouppm['message']), 100, '');
$grouppms[] = $grouppm;
}
}
}
if($filter == 'privatepm' || $filter == 'newpm') {
$result = uc_pm_list($_G['uid'], $page, $perpage, 'inbox', $filter, 200);
$count = $result['count'];
$list = $result['data'];
}
if($filter == 'privatepm' && $page == 1 || $filter == 'newpm') {
$newpmarr = uc_pm_checknew($_G['uid'], 1);
$newpm = $newpmarr['newpm'];
}
$newpmcount = $newpm + $announcepm;
if($_G['member']['newpm']) {
C::t('common_member')->update($_G['uid'], array('newpm' => 0));
uc_pm_ignore($_G['uid']);
}
$multi = multi($count, $perpage, $page, "home.php?mod=space&do=pm&filter=$filter", 0, 5);
$actives = array($filter=>' class="a"');
}
if(!empty($list)) {
$today = $_G['timestamp'] - ($_G['timestamp'] + $_G['setting']['timeoffset'] * 3600) % 86400;
foreach ($list as $key => $value) {
$value['lastsummary'] = str_replace('&amp;', '&', $value['lastsummary']);
$value['lastsummary'] = preg_replace("/&[a-z]+\;/i", '', $value['lastsummary']);
$value['daterange'] = 5;
if($value['lastdateline'] >= $today) {
$value['daterange'] = 1;
} elseif($value['lastdateline'] >= $today - 86400) {
$value['daterange'] = 2;
} elseif($value['lastdateline'] >= $today - 172800) {
$value['daterange'] = 3;
} elseif($value['lastdateline'] >= $today - 604800) {
$value['daterange'] = 4;
}
$list[$key] = $value;
}
}
include_once template("diy:home/space_pm");
function pmmulti($count, $perpage, $curpage, $mpurl) {
$return = '';
$lang['next'] = lang('core', 'nextpage');
$lang['prev'] = lang('core', 'prevpage');
$next = $curpage < ceil($count/$perpage) ? '<a href="'.$mpurl.'&amp;page='.($curpage + 1).'#last" class="nxt">'.$lang['next'].'</a>' : '';
$prev = $curpage > 1 ? '<span class="pgb"><a href="'.$mpurl.'&amp;page='.($curpage - 1).'#last">'.$lang['prev'].'</a></span>' : '';
if($next || $prev) {
$return = '<div class="pg">'.$prev.$next.'</div>';
}
return $return;
}
?>

View File

@@ -0,0 +1,146 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: space_poll.php 28220 2012-02-24 07:52:50Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['forumstatus']) {
showmessage('forum_status_off');
}
$minhot = $_G['setting']['feedhotmin']<1?3:$_G['setting']['feedhotmin'];
$page = empty($_GET['page'])?1:intval($_GET['page']);
if($page<1) $page=1;
$id = empty($_GET['id'])?0:intval($_GET['id']);
$_GET['order'] = in_array($_GET['order'], array('hot', 'dateline')) ? $_GET['order'] : 'dateline';
$opactives['poll'] = 'class="a"';
$_GET['view'] = in_array($_GET['view'], array('we', 'me', 'all')) ? $_GET['view'] : 'we';
$perpage = 20;
$perpage = mob_perpage($perpage);
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
$list = array();
$userlist = array();
$count = $pricount = 0;
$gets = array(
'mod' => 'space',
'uid' => $space['uid'],
'do' => 'poll',
'view' => $_GET['view'],
'order' => $_GET['order'],
'fuid' => $_GET['fuid'],
'filter' => $_GET['filter'],
'searchkey' => $_GET['searchkey']
);
$theurl = 'home.php?'.url_implode($gets);
$multi = '';
$f_index = '';
$ordersql = 't.dateline DESC';
$need_count = true;
$join = $authorid = $replies = 0;
$displayorder = null;
$subject = '';
if($_GET['view'] == 'me') {
$filter = in_array($_GET['filter'], array('publish', 'join')) ? $_GET['filter'] : 'publish';
if($filter == 'join') {
$join = true;
$authorid = $space['uid'];
} else {
$authorid = $space['uid'];
}
$filteractives = array($filter => ' class="a"');
} else {
space_merge($space, 'field_home');
if($space['feedfriend']) {
$fuid_actives = array();
require_once libfile('function/friend');
$fuid = intval($_GET['fuid']);
if($fuid && friend_check($fuid, $space['uid'])) {
$authorid = $fuid;
$fuid_actives = array($fuid=>' selected');
} else {
$authorid = explode(',', $space['feedfriend']);
$theurl = "home.php?mod=space&uid={$space['uid']}&do=$do&view=we";
}
$query = C::t('home_friend')->fetch_all_by_uid($space['uid'], 0, 100, true);
foreach($query as $value) {
$userlist[] = $value;
}
} else {
$need_count = false;
}
}
$actives = array($_GET['view'] =>' class="a"');
if($need_count) {
if($_GET['view'] != 'me') {
$displayorder = 0;
}
if($searchkey = stripsearchkey($_GET['searchkey'])) {
$subject = $searchkey;
$searchkey = dhtmlspecialchars($searchkey);
}
$count = C::t('forum_thread')->count_by_special(1, $authorid, $replies, $displayorder, $subject, $join);
if($count) {
loadcache('forums');
$tids = array();
require_once libfile('function/misc');
foreach(C::t('forum_thread')->fetch_all_by_special(1, $authorid, $replies, $displayorder, $subject, $join, $start, $perpage) as $value) {
if(empty($value['author']) && $value['authorid'] != $_G['uid']) {
$hiddennum++;
continue;
}
$tids[$value['tid']] = $value['tid'];
$list[$value['tid']] = procthread($value);
}
if($tids) {
$query = C::t('forum_poll')->fetch_all($tids);
foreach($query as $value) {
$value['pollpreview'] = explode("\t", trim($value['pollpreview']));
$list[$value['tid']]['poll'] = $value;
}
}
$multi = multi($count, $perpage, $page, $theurl);
}
}
if($_G['uid']) {
$_GET['view'] = !$_GET['view'] ? 'we' : $_GET['view'];
$navtitle = lang('core', 'title_'.$_GET['view'].'_poll');
} else {
$_GET['order'] = !$_GET['order'] ? 'dateline' : $_GET['order'];
$navtitle = lang('core', 'title_'.$_GET['order'].'_poll');
}
$actives = array($_GET['view'] => ' class="a"');
include_once template("diy:home/space_poll");
?>

View File

@@ -0,0 +1,198 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: space_profile.php 29279 2012-03-31 09:06:19Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(!$_G['uid'] && getglobal('setting/privacy/view/profile')) {
showmessage('home_no_privilege', '', array(), array('login' => true));
}
require_once libfile('function/spacecp');
$inarchive = isset($space['_inarchive']) && $space['_inarchive'];
space_merge($space, 'count', $inarchive);
space_merge($space, 'field_home', $inarchive);
space_merge($space, 'field_forum', $inarchive);
space_merge($space, 'profile', $inarchive);
space_merge($space, 'status', $inarchive);
getonlinemember(array($space['uid']));
if($_G['uid'] != $space['uid'] && !$_G['group']['allowviewprofile']) {
if(!$_G['uid']) {
showmessage('home_no_privilege', '', array(), array('login' => true));
} else {
showmessage('no_privilege_profile');
}
}
$space['admingroup'] = $_G['cache']['usergroups'][$space['adminid']];
$space['admingroup']['icon'] = g_icon($space['adminid'], 1);
$space['group'] = $_G['cache']['usergroups'][$space['groupid']];
$space['group']['icon'] = g_icon($space['groupid'], 1);
$encodeusername = rawurlencode($space['username']);
if($space['extgroupids']) {
$newgroup = array();
$e_ids = explode("\t", $space['extgroupids']);
foreach ($e_ids as $e_id) {
$newgroup[] = $_G['cache']['usergroups'][$e_id]['grouptitle'];
}
$space['extgroupids'] = implode(',', $newgroup);
}
$space['regdate'] = dgmdate($space['regdate']);
if($space['lastvisit']) $space['lastvisit'] = dgmdate($space['lastvisit']);
if($space['lastactivity']) {
$space['lastactivitydb'] = $space['lastactivity'];
$space['lastactivity'] = dgmdate($space['lastactivity']);
}
if($space['lastpost']) $space['lastpost'] = dgmdate($space['lastpost']);
if($space['lastsendmail']) $space['lastsendmail'] = dgmdate($space['lastsendmail']);
if($_G['uid'] == $space['uid'] || getglobal('group/allowviewip')) {
$space['regip_loc'] = ip::convert($space['regip']);
$space['lastip_loc'] = ip::convert($space['lastip']);
$space['regip'] = ip::to_display($space['regip']);
$space['lastip'] = ip::to_display($space['lastip']);
}
$space['buyerrank'] = 0;
if($space['buyercredit']){
foreach($_G['setting']['ec_credit']['rank'] AS $level => $credit) {
if($space['buyercredit'] <= $credit) {
$space['buyerrank'] = $level;
break;
}
}
}
$space['sellerrank'] = 0;
if($space['sellercredit']){
foreach($_G['setting']['ec_credit']['rank'] AS $level => $credit) {
if($space['sellercredit'] <= $credit) {
$space['sellerrank'] = $level;
break;
}
}
}
$space['attachsize'] = formatsize($space['attachsize']);
$space['timeoffset'] = empty($space['timeoffset']) ? '9999' : $space['timeoffset'];
if(strtotime($space['regdate']) + $space['oltime'] * 3600 > TIMESTAMP) {
$space['oltime'] = 0;
}
require_once libfile('function/friend');
$isfriend = friend_check($space['uid'], 1);
if(!$_G['adminid']){
if(getglobal('setting/privacy/view/profile') == 1 && !$isfriend && !$space['self']) {
showmessage('specified_user_is_not_your_friend', '', array(), array());
}
if(getglobal('setting/privacy/view/profile') == 2 && !$space['self']) {
showmessage('is_blacklist', '', array(), array());
}
}
loadcache('profilesetting');
include_once libfile('function/profile');
$profiles = array();
$privacy = $space['privacy']['profile'] ? $space['privacy']['profile'] : array();
if($_G['setting']['verify']['enabled']) {
space_merge($space, 'verify');
}
foreach($_G['cache']['profilesetting'] as $fieldid => $field) {
if($_G['setting']['nsprofiles']) {
break;
}
if(!$field['available'] || in_array($fieldid, array('birthcountry', 'birthprovince', 'birthdist', 'birthcommunity', 'residecountry', 'resideprovince', 'residedist', 'residecommunity'))) {
continue;
}
if(
$field['available'] && (strlen($space[$fieldid]) > 0 || ($fieldid == 'birthcity' && strlen($space['birthcountry']) && strlen($space['birthprovince']) || $fieldid == 'residecity' && strlen($space['residecountry']) && strlen($space['resideprovince']))) &&
($space['self'] || empty($privacy[$fieldid]) || ($isfriend && $privacy[$fieldid] == 1)) &&
(!$_G['inajax'] && !$field['invisible'] || $_G['inajax'] && $field['showincard'])
) {
$val = profile_show($fieldid, $space);
if($val !== false) {
if($fieldid == 'realname' && $_G['uid'] != $space['uid'] && !ckrealname(1)) {
continue;
}
if($field['formtype'] == 'file' && $val) {
$imgurl = getglobal('setting/attachurl').'./profile/'.$val;
$val = '<span><a href="'.$imgurl.'" target="_blank"><img src="'.$imgurl.'" style="max-width: 500px;" /></a></span>';
}
if($val == '') $val = '-';
$profiles[$fieldid] = array('title'=>$field['title'], 'value'=>$val);
}
}
}
$count = C::t('forum_moderator')->count_by_uid($space['uid']);
if($count) {
foreach(C::t('forum_moderator')->fetch_all_by_uid($space['uid']) as $result) {
$moderatefids[] = $result['fid'];
}
$query = C::t('forum_forum')->fetch_all_info_by_fids($moderatefids);
foreach($query as $result) {
$manage_forum[$result['fid']] = $result['name'];
}
}
if(!$_G['inajax'] && $_G['setting']['groupstatus']) {
$groupcount = C::t('forum_groupuser')->fetch_all_group_for_user($space['uid'], 1);
if($groupcount > 0) {
$fids = C::t('forum_groupuser')->fetch_all_fid_by_uids($space['uid']);
$usergrouplist = C::t('forum_forum')->fetch_all_info_by_fids($fids);
}
}
if($space['medals']) {
loadcache('medals');
foreach($space['medals'] = explode("\t", $space['medals']) as $key => $medalid) {
list($medalid, $medalexpiration) = explode("|", $medalid);
if(isset($_G['cache']['medals'][$medalid]) && (!$medalexpiration || $medalexpiration > TIMESTAMP)) {
$space['medals'][$key] = $_G['cache']['medals'][$medalid];
$space['medals'][$key]['medalid'] = $medalid;
} else {
unset($space['medals'][$key]);
}
}
}
$upgradecredit = $space['uid'] && $space['group']['type'] == 'member' && $space['group']['creditslower'] != 9999999 ? $space['group']['creditslower'] - $space['credits'] : false;
$allowupdatedoing = $space['uid'] == $_G['uid'] && checkperm('allowdoing');
dsetcookie('home_diymode', 1);
$navtitle = lang('space', 'sb_profile', array('who' => $space['username']));
$metakeywords = lang('space', 'sb_profile', array('who' => $space['username']));
$metadescription = lang('space', 'sb_profile', array('who' => $space['username']));
$clist = array();
if(in_array($_G['adminid'], array(1, 2, 3))) {
include_once libfile('function/member');
$clist = crime('getactionlist', $space['uid']);
}
show_view();
if(!getglobal('privacy')) {
if(!$_G['inajax']) {
include_once template("home/space_profile");
} else {
$_GET['do'] = 'card';
if(helper_access::check_module('follow')) {
$follow = C::t('home_follow')->fetch_by_uid_followuid($_G['uid'], $space['uid']);
}
include_once template("home/space_card");
}
}
?>

View File

@@ -0,0 +1,140 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: space_reward.php 33848 2013-08-21 06:24:53Z hypowang $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['forumstatus']) {
showmessage('forum_status_off');
}
$minhot = $_G['setting']['feedhotmin']<1?3:$_G['setting']['feedhotmin'];
$page = empty($_GET['page'])?1:intval($_GET['page']);
if($page<1) $page=1;
$id = empty($_GET['id'])?0:intval($_GET['id']);
$_GET['flag'] = empty($_GET['flag']) ? 0 : intval($_GET['flag']);
$_GET['fuid'] = empty($_GET['fuid']) ? 0 : intval($_GET['fuid']);
$opactives['reward'] = 'class="a"';
$_GET['view'] = in_array($_GET['view'], array('we', 'me', 'all')) ? $_GET['view'] : 'we';
$_GET['order'] = preg_replace("/[^\[A-Za-z0-9_\]]/", '', $_GET['order']);
$perpage = 20;
$perpage = mob_perpage($perpage);
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
$list = $userlist = array();
$hiddennum = $count = $pricount = 0;
$gets = array(
'mod' => 'space',
'uid' => $space['uid'],
'do' => 'reward',
'view' => $_GET['view'],
'order' => $_GET['order'],
'flag' => $_GET['flag'],
'type' => $_GET['type'],
'fuid' => $_GET['fuid'],
'searchkey' => $_GET['searchkey']
);
$theurl = 'home.php?'.url_implode($gets);
$multi = '';
$conditions['special'] = 3;
$conditions['specialthread'] = 1;
$f_index = '';
$ordersql = 't.dateline DESC';
$need_count = true;
require_once libfile('function/misc');
if($_GET['view'] == 'me') {
$conditions = array('authorid' => $space['uid'], 'special' => 3, 'specialthread' => 1);
} else {
space_merge($space, 'field_home');
if($space['feedfriend']) {
$fuid_actives = array();
require_once libfile('function/friend');
$fuid = intval($_GET['fuid']);
if($fuid && friend_check($fuid, $space['uid'])) {
$conditions = array('authorid' => $fuid, 'special' => 3, 'specialthread' => 1);
$fuid_actives = array($fuid=>' selected');
} else {
$conditions['authorid'] = explode(',', $space['feedfriend']);
}
$query = C::t('home_friend')->fetch_all_by_uid($space['uid'], 0, 100, true);
foreach($query as $value) {
$userlist[] = $value;
}
} else {
$need_count = false;
}
}
$actives = array($_GET['view'] =>' class="a"');
if($need_count) {
if($_GET['view'] != 'me') {
$conditions['sticky'] = 0;
}
if($searchkey = stripsearchkey($_GET['searchkey'])) {
$conditions['keywords'] = $searchkey;
$searchkey = dhtmlspecialchars($searchkey);
}
if($_GET['flag'] < 0) {
$wheresql .= " AND t.price < '0'";
$conditions['pricesless'] = 0;
$alltype .= '1';
} elseif($_GET['flag'] > 0) {
$wheresql .= " AND t.price > '0'";
$conditions['pricemore'] = 0;
$alltype .= '0';
}
$count = C::t('forum_thread')->count_search($conditions);
if($count) {
foreach(C::t('forum_thread')->fetch_all_search($conditions, 0, $start, $perpage, 'dateline') as $value) {
if(empty($value['author']) && $value['authorid'] != $_G['uid']) {
$hiddennum++;
continue;
}
$list[] = procthread($value);
}
$multi = multi($count, $perpage, $page, $theurl);
}
}
$creditid = 0;
if($_G['setting']['creditstransextra'][2]) {
$creditid = intval($_G['setting']['creditstransextra'][2]);
} elseif ($_G['setting']['creditstrans']) {
$creditid = intval($_G['setting']['creditstrans']);
}
if($_G['uid']) {
$_GET['view'] = !$_GET['view'] ? 'we' : $_GET['view'];
$navtitle = lang('core', 'title_'.$_GET['view'].'_reward');
} else {
$_GET['order'] = !$_GET['order'] ? 'dateline' : $_GET['order'];
$navtitle = lang('core', 'title_'.$_GET['order'].'_reward');
}
include_once template("diy:home/space_reward");
?>

View File

@@ -0,0 +1,142 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: space_share.php 28049 2012-02-21 09:30:06Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['sharestatus']) {
showmessage('share_status_off');
}
$page = empty($_GET['page'])?1:intval($_GET['page']);
if($page<1) $page=1;
$id = empty($_GET['id'])?0:intval($_GET['id']);
$_GET['type'] = in_array($_GET['type'], array('all', 'link', 'video', 'music', 'flash', 'blog', 'album', 'pic', 'poll', 'space', 'thread', 'article'))? $_GET['type'] : 'all';
$_GET['view'] = in_array($_GET['view'], array('we', 'me', 'all')) ? $_GET['view'] : 'we';
if($id) {
if(!IS_ROBOT) {
$share = C::t('home_share')->fetch_by_sid_uid($id, $space['uid']);
if(empty($share)) {
showmessage('share_does_not_exist');
}
require_once libfile('function/share');
$share = mkshare($share);
$perpage = 50;
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
$list = array();
$cid = empty($_GET['cid'])?0:intval($_GET['cid']);
$csql = $cid?"cid='$cid' AND":'';
$count = C::t('home_comment')->count_by_id_idtype($id, 'sid', $cid);
if($count) {
$query = C::t('home_comment')->fetch_all_by_id_idtype($id, 'sid', $start, $perpage, $cid);
foreach($query as $value) {
$list[] = $value;
}
$multi = multi($count, $perpage, $page, "home.php?mod=space&uid={$share['uid']}&do=share&id=$id", '', 'comment_ul');
}
$diymode = intval($_G['cookie']['home_diymode']);
}
include_once template("diy:home/space_share_view");
} else {
$perpage = 20;
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
$gets = array(
'mod' => 'space',
'uid' => $space['uid'],
'do' => 'share',
'view' => $_GET['view'],
'from' => $_GET['from']
);
$navtheurl = $theurl = 'home.php?'.url_implode($gets);
$theurl .= '&type='.$_GET['type'];
if(!IS_ROBOT) {
$f_index = '';
$need_count = true;
if(empty($_GET['view'])) $_GET['view'] = 'we';
$uids = 0;
$type = '';
if($_GET['view'] == 'all') {
$wheresql = "1";
} elseif($_GET['view'] == 'we') {
space_merge($space, 'field_home');
if($space['feedfriend']) {
$uids = explode(',', $space['feedfriend']);
$f_index = 'USE INDEX(dateline)';
} else {
$need_count = false;
}
} else {
if($_GET['from'] == 'space') $diymode = 1;
$uids = $space['uid'];
}
$actives = array($_GET['view'] => ' class="a"');
if($_GET['type'] && $_GET['type'] != 'all') {
$sub_actives = array('type_'.$_GET['type'] => ' class="a"');
$type = $_GET['type'];
} else {
$sub_actives = array('type_all' => ' class="a"');
}
$list = array();
$pricount = 0;
$sid = empty($_GET['sid'])?0:intval($_GET['sid']);
if($need_count) {
$count = C::t('home_share')->count_by_sid_uid_type($sid, $uids, $type);
if($count) {
require_once libfile('function/share');
foreach(C::t('home_share')->fetch_all_by_sid_uid_type($sid, $uids, $type, $start, $perpage) as $value) {
$value = mkshare($value);
if($value['status'] == 0 || $value['uid'] == $_G['uid'] || $_G['adminid'] == 1) {
$list[] = $value;
} else {
$pricount ++;
}
}
$multi = multi($count, $perpage, $page, $theurl);
}
}
}
dsetcookie('home_diymode', $diymode);
$navtitle = lang('core', 'title_share_'.$_GET['type']);
$navtitle .= lang('core', 'title_share');
if($space['username']) {
$navtitle = lang('space', 'sb_sharing', array('who' => $space['username']));
}
$metakeywords = $navtitle;
$metadescription = $navtitle;
include_once template("diy:home/space_share_list");
}
?>

View File

@@ -0,0 +1,370 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: space_thread.php 31365 2012-08-20 03:19:33Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['forumstatus']) {
showmessage('forum_status_off');
}
$minhot = $_G['setting']['feedhotmin']<1?3:$_G['setting']['feedhotmin'];
$page = empty($_GET['page'])?1:intval($_GET['page']);
if($page<1) $page=1;
$id = empty($_GET['id'])?0:intval($_GET['id']);
$opactives['thread'] = 'class="a"';
$_GET['view'] = in_array($_GET['view'], array('we', 'me', 'all')) ? $_GET['view'] : 'we';
$_GET['order'] = in_array(getgpc('order'), array('hot', 'dateline')) ? $_GET['order'] : 'dateline';
$allowviewuserthread = $_G['setting']['allowviewuserthread'];
$perpage = 20;
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
$list = array();
$userlist = array();
$hiddennum = $count = $pricount = 0;
$_GET['from'] = dhtmlspecialchars(preg_replace("/[^\[A-Za-z0-9_\]]/", '', getgpc('from')));
$gets = array(
'mod' => 'space',
'uid' => $space['uid'],
'do' => 'thread',
'fid' => getgpc('fid'),
'view' => $_GET['view'],
'type' => getgpc('type'),
'order' => $_GET['order'],
'fuid' => getgpc('fuid'),
'searchkey' => getgpc('searchkey'),
'from' => $_GET['from'],
'filter' => getgpc('filter')
);
$theurl = 'home.php?'.url_implode($gets);
unset($gets['fid']);
$forumurl = 'home.php?'.url_implode($gets);
$multi = '';
$authorid = 0;
$replies = $closed = $displayorder = null;
$dglue = '=';
$vfid = getgpc('fid') ? intval($_GET['fid']) : null;
require_once libfile('function/misc');
require_once libfile('function/forum');
loadcache(array('forums'));
$fids = $comma = '';
if($_GET['view'] != 'me') {
$displayorder = 0;
$dglue = '>=';
}
$f_index = '';
$ordersql = 't.dateline DESC';
$need_count = true;
$viewuserthread = false;
$listcount = 0;
if($_GET['view'] == 'me') {
if($_GET['from'] == 'space') $diymode = 1;
$allowview = true;
$viewtype = in_array(getgpc('type'), array('reply', 'thread', 'postcomment')) ? $_GET['type'] : 'thread';
$filter = in_array(getgpc('filter'), array('recyclebin', 'ignored', 'save', 'aduit', 'close', 'common')) ? $_GET['filter'] : '';
if($space['uid'] != $_G['uid'] && in_array($viewtype, array('reply', 'thread'))) {
if($allowviewuserthread === -1 && $_G['adminid'] != 1) {
$allowview = false;
}
if($allowview) {
$viewuserthread = true;
$viewfids = str_replace("'", '', $allowviewuserthread);
if(!empty($viewfids)) {
$viewfids = explode(',', $viewfids);
}
}
}
if($viewtype == 'thread' && $allowview) {
$authorid = $space['uid'];
if($filter == 'recyclebin') {
$displayorder = -1;
} elseif($filter == 'aduit') {
$displayorder = -2;
} elseif($filter == 'ignored') {
$displayorder = -3;
} elseif($filter == 'save') {
$displayorder = -4;
} elseif($filter == 'close') {
$closed = 1;
} elseif($filter == 'common') {
$closed = 0;
$displayorder = 0;
$dglue = '>=';
}
$ordersql = 't.tid DESC';
} elseif($viewtype == 'postcomment') {
$posttable = getposttable();
require_once libfile('function/post');
$pids = $tids = array();
$postcommentarr = C::t('forum_postcomment')->fetch_all_by_authorid($_G['uid'], $start, $perpage);
foreach($postcommentarr as $value) {
$pids[] = $value['pid'];
$tids[] = $value['tid'];
}
$pids = C::t('forum_post')->fetch_all_post(0, $pids);
$tids = C::t('forum_thread')->fetch_all($tids);
$list = $fids = array();
foreach($postcommentarr as $value) {
$value['authorid'] = $pids[$value['pid']]['authorid'];
$value['fid'] = $pids[$value['pid']]['fid'];
$value['invisible'] = $pids[$value['pid']]['invisible'];
$value['dateline'] = $pids[$value['pid']]['dateline'];
$value['message'] = $pids[$value['pid']]['message'];
$value['special'] = $tids[$value['tid']]['special'];
$value['status'] = $tids[$value['tid']]['status'];
$value['subject'] = $tids[$value['tid']]['subject'];
$value['digest'] = $tids[$value['tid']]['digest'];
$value['attachment'] = $tids[$value['tid']]['attachment'];
$value['replies'] = $tids[$value['tid']]['replies'];
$value['views'] = $tids[$value['tid']]['views'];
$value['lastposter'] = $tids[$value['tid']]['lastposter'];
$value['lastpost'] = $tids[$value['tid']]['lastpost'];
$value['tid'] = $pids[$value['pid']]['tid'];
$fids[] = $value['fid'];
$value['comment'] = messagecutstr($value['comment'], 100);
$list[] = procthread($value);
}
unset($pids, $tids, $postcommentarr);
if($fids) {
$fids = array_unique($fids);
$query = C::t('forum_forum')->fetch_all($fids);
foreach($query as $forum) {
$forums[$forum['fid']] = $forum['name'];
}
}
$multi = simplepage(count($list), $perpage, $page, $theurl);
$need_count = false;
} elseif($allowview) {
$invisible = null;
$postsql = $threadsql = '';
if($filter == 'recyclebin') {
$invisible = -5;
} elseif($filter == 'aduit') {
$invisible = -2;
} elseif($filter == 'save' || $filter == 'ignored') {
$invisible = -3;
$displayorder = -4;
} elseif($filter == 'close') {
$closed = 1;
} elseif($filter == 'common') {
$invisible = 0;
$displayorder = 0;
$dglue = '>=';
$closed = 0;
} else {
if($space['uid'] != $_G['uid']) {
$invisible = 0;
}
}
require_once libfile('function/post');
$posts = C::t('forum_post')->fetch_all_by_authorid(0, $space['uid'], true, 'DESC', $start, $perpage, 0, $invisible, $vfid);
$listcount = count($posts);
foreach($posts as $pid => $post) {
$delrow = false;
if($post['anonymous'] && $post['authorid'] != $_G['uid']) {
$delrow = true;
} elseif($viewuserthread && $post['authorid'] != $_G['uid']) {
if(($_G['adminid'] != 1 && !empty($viewfids) && !in_array($post['fid'], $viewfids))) {
$delrow = true;
}
}
if($delrow) {
unset($posts[$pid]);
$hiddennum++;
continue;
} else {
$tids[$post['tid']][] = $pid;
$post['message'] = $post['status'] & 1 && $_G['adminid'] != 1 ? '' : (!getstatus($post['status'], 2) || $post['authorid'] == $_G['uid'] ? messagecutstr($post['message'], 100) : '');
$posts[$pid] = $post;
}
}
if(!empty($tids)) {
$threads = C::t('forum_thread')->fetch_all_by_tid_displayorder(array_keys($tids), $displayorder, $dglue, array(), $closed);
foreach($threads as $tid => $thread) {
$delrow = false;
if($_G['adminid'] != 1 && $thread['displayorder'] < 0) {
$delrow = true;
} elseif($_G['adminid'] != 1 && $_G['uid'] != $thread['authorid'] && getstatus($thread['status'], 2)) {
$delrow = true;
} elseif(!isset($_G['cache']['forums'][$thread['fid']])) {
if(!$_G['setting']['groupstatus']) {
$delrow = true;
} else {
$gids[$thread['fid']] = $thread['tid'];
}
}
if($delrow) {
foreach($tids[$tid] as $pid) {
unset($posts[$pid]);
$hiddennum++;
}
unset($tids[$tid]);
unset($threads[$tid]);
continue;
} else {
$threads[$tid] = procthread($thread);
$forums[$thread['fid']] = $threads[$tid]['forumname'];
}
}
if(!empty($gids)) {
$groupforums = C::t('forum_forum')->fetch_all_name_by_fid(array_keys($gids));
foreach($gids as $fid => $tid) {
$threads[$tid]['forumname'] = $groupforums[$fid]['name'];
$forums[$fid] = $groupforums[$fid]['name'];
}
}
if(!empty($tids)) {
foreach($tids as $tid => $pids) {
foreach($pids as $pid) {
if(!isset($threads[$tid])) {
unset($posts[$pid]);
unset($tids[$tid]);
$hiddennum++;
continue;
}
}
}
}
$list = &$threads;
}
$multi = simplepage($listcount, $perpage, $page, $theurl);
$need_count = false;
}
if(!$allowview) {
$need_count = false;
}
$orderactives = array($viewtype => ' class="a"');
} else {
if(!$_G['setting']['friendstatus']) {
showmessage('friend_status_off');
}
space_merge($space, 'field_home');
if($space['feedfriend']) {
$fuid_actives = array();
require_once libfile('function/friend');
$fuid = intval($_GET['fuid']);
if($fuid && friend_check($fuid, $space['uid'])) {
$authorid = $fuid;
$fuid_actives = array($fuid=>' selected');
} else {
$authorid = explode(',', $space['feedfriend']);
}
$query = C::t('home_friend')->fetch_all_by_uid($_G['uid'], 0, 100, true);
foreach($query as $value) {
$userlist[] = $value;
}
} else {
$need_count = false;
}
}
$actives = array($_GET['view'] =>' class="a"');
if($need_count) {
if($searchkey = stripsearchkey(getgpc('searchkey'))) {
$searchkey = dhtmlspecialchars($searchkey);
}
loadcache('forums');
$gids = $fids = $forums = array();
foreach(C::t('forum_thread')->fetch_all_by_authorid_displayorder($authorid, $displayorder, $dglue, $closed, $searchkey, $start, $perpage, $replies, $vfid) as $tid => $value) {
if(empty($value['author']) && $value['authorid'] != $_G['uid']) {
$hiddennum++;
continue;
} elseif($viewuserthread && $value['authorid'] != $_G['uid']) {
if(($_G['adminid'] != 1 && !empty($viewfids) && !in_array($value['fid'], $viewfids)) || $value['displayorder'] < 0) {
$hiddennum++;
continue;
}
}
if(!isset($_G['cache']['forums'][$value['fid']])) {
if(!$_G['setting']['groupstatus']) {
$hiddennum++;
continue;
} else {
$gids[$value['fid']] = $value['tid'];
}
}
$list[$value['tid']] = procthread($value);
$forums[$value['fid']] = $list[$value['tid']]['forumname'];
}
if(!empty($gids)) {
$gforumnames = C::t('forum_forum')->fetch_all_name_by_fid(array_keys($gids));
foreach($gids as $fid => $tid) {
$list[$tid]['forumname'] = $gforumnames[$fid]['name'];
$forums[$fid] = $gforumnames[$fid]['name'];
}
}
$threads = &$list;
if($_GET['view'] != 'all') {
$listcount = count($list)+$hiddennum;
$multi = simplepage($listcount, $perpage, $page, $theurl);
}
}
require_once libfile('function/forumlist');
$forumlist = forumselect(FALSE, 0, intval(getgpc('fid')));
dsetcookie('home_diymode', $diymode);
if($_G['uid']) {
$_GET['view'] = !$_GET['view'] ? 'we' : $_GET['view'];
$navtitle = lang('core', 'title_'.$_GET['view'].'_thread');
} else {
$navtitle = lang('core', 'title_thread');
}
if($space['username']) {
$navtitle = lang('space', 'sb_thread', array('who' => $space['username']));
}
$metakeywords = $navtitle;
$metadescription = $navtitle;
if(!getglobal('follow')) {
include_once template("diy:home/space_thread");
}
?>

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