First commit

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

View File

View File

@@ -0,0 +1,356 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_album.php 34045 2013-09-25 03:39:47Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['albumstatus']) {
showmessage('album_status_off');
}
$albumid = empty($_GET['albumid'])?0:intval($_GET['albumid']);
$picid = empty($_GET['picid'])?0:intval($_GET['picid']);
if($_GET['op'] == 'edit') {
if($albumid < 1) {
showmessage('photos_do_not_support_the_default_settings', "home.php?mod=spacecp&ac=album&uid={$_G['uid']}&op=editpic&quickforward=1");
}
if(!$album = C::t('home_album')->fetch_album($albumid)) {
showmessage('album_does_not_exist');
}
if($album['uid'] != $_G['uid'] && !checkperm('managealbum')) {
showmessage('no_privilege_album_edit');
}
if(submitcheck('editsubmit')) {
$_POST['albumname'] = getstr($_POST['albumname'], 50);
$_POST['albumname'] = censor($_POST['albumname']);
if(empty($_POST['albumname'])) {
showmessage('album_name_errors');
}
$_POST['friend'] = intval($_POST['friend']);
$_POST['target_ids'] = '';
if($_POST['friend'] == 2) {
$uids = array();
$names = empty($_POST['target_names'])?array():explode(',', preg_replace("/(\s+)/s", ',', $_POST['target_names']));
if($names) {
$uids = C::t('common_member')->fetch_all_uid_by_username($names);
}
if(empty($uids)) {
$_POST['friend'] = 3;
} else {
$_POST['target_ids'] = implode(',', $uids);
}
} elseif($_POST['friend'] == 4) {
$_POST['password'] = trim($_POST['password']);
if($_POST['password'] == '') $_POST['friend'] = 0;
}
if($_POST['friend'] !== 2) {
$_POST['target_ids'] = '';
}
if($_POST['friend'] !== 4) {
$_POST['password'] = '';
}
$_POST['catid'] = intval($_POST['catid']);
if($_POST['catid'] != $album['catid']) {
if($album['catid']) {
C::t('home_album_category')->update_num_by_catid('-1', $album['catid'], true);
}
if($_POST['catid']) {
C::t('home_album_category')->update_num_by_catid('1', $_POST['catid']);
}
}
C::t('home_album')->update($albumid, array('albumname'=>$_POST['albumname'], 'catid'=>$_POST['catid'], 'friend'=>$_POST['friend'], 'password'=>$_POST['password'], 'target_ids'=>$_POST['target_ids'], 'depict'=>dhtmlspecialchars($_POST['depict'])));
showmessage('spacecp_edit_ok', "home.php?mod=spacecp&ac=album&op=edit&albumid=$albumid");
}
$album['target_names'] = '';
$friendarr = array($album['friend'] => ' selected');
$passwordstyle = $selectgroupstyle = 'display:none';
if($album['friend'] == 4) {
$passwordstyle = '';
} elseif($album['friend'] == 2) {
$selectgroupstyle = '';
if($album['target_ids']) {
$names = array();
foreach(C::t('common_member')->fetch_all($album['target_ids']) as $uid => $value) {
$names[$uid] = $value['username'];
}
$album['target_names'] = implode(' ', $names);
}
}
require_once libfile('function/friend');
$groups = friend_group_list();
if($_G['setting']['albumcategorystat']) {
loadcache('albumcategory');
$category = $_G['cache']['albumcategory'];
$categoryselect = '';
if($category) {
$categoryselect = "<select id=\"catid\" name=\"catid\" width=\"120\"><option value=\"0\">------</option>";
foreach ($category as $value) {
if($value['level'] == 0) {
$selected = $album['catid'] == $value['catid']?' selected':'';
$categoryselect .= "<option value=\"{$value['catid']}\"{$selected}>{$value['catname']}</option>";
if(!$value['children']) {
continue;
}
foreach ($value['children'] as $catid) {
$selected = $album['catid'] == $catid?' selected':'';
$categoryselect .= "<option value=\"{$category[$catid]['catid']}\"{$selected}>-- {$category[$catid]['catname']}</option>";
if($category[$catid]['children']) {
foreach ($category[$catid]['children'] as $catid2) {
$selected = $album['catid'] == $catid2?' selected':'';
$categoryselect .= "<option value=\"{$category[$catid2]['catid']}\"{$selected}>---- {$category[$catid2]['catname']}</option>";
}
}
}
}
}
$categoryselect .= "</select>";
}
}
} elseif($_GET['op'] == 'delete') {
if(!$album = C::t('home_album')->fetch_album($albumid)) {
showmessage('album_does_not_exist');
}
if($album['uid'] != $_G['uid'] && !checkperm('managealbum')) {
showmessage('no_privilege_album_del');
}
$albums = getalbums($album['uid']);
if(empty($albums[$albumid])) {
showmessage('no_privilege_album_delother');
}
if(submitcheck('deletesubmit')) {
$_POST['moveto'] = intval($_POST['moveto']);
if($_POST['moveto'] < 0) {
require_once libfile('function/delete');
deletealbums(array($albumid));
} else {
if($_POST['moveto'] > 0 && $_POST['moveto'] != $albumid && !empty($albums[$_POST['moveto']])) {
C::t('home_pic')->update_for_albumid($albumid, array('albumid'=>$_POST['moveto']));
album_update_pic($_POST['moveto']);
} else {
C::t('home_pic')->update_for_albumid($albumid, array('albumid'=>0));
}
C::t('home_album')->delete($albumid);
}
showmessage('do_success', "home.php?mod=space&uid={$_GET['uid']}&do=album&view=me");
}
} elseif($_GET['op'] == 'editpic') {
$managealbum = checkperm('managealbum');
require_once libfile('class/bbcode');
if($albumid > 0) {
if(!$album = C::t('home_album')->fetch_album($albumid)) {
showmessage('album_does_not_exist', 'home.php?mod=space&uid='.$_G['uid'].'&do=album&view=me', array(), array('return' => true));
}
if($album['uid'] != $_G['uid'] && !$managealbum) {
showmessage('no_privilege_pic_edit', 'home.php?mod=space&uid='.$_G['uid'].'&do=album&view=me', array(), array('return' => true));
}
} else {
$album['uid'] = $_G['uid'];
}
if(submitcheck('editpicsubmit')) {
$return = true;
if($_GET['subop'] == 'update') {
foreach ($_POST['title'] as $picid => $value) {
if($value == $_GET['oldtitle'][$picid]) {
continue;
}
$title = getstr($value, 150);
$title = censor($title, NULL, FALSE, FALSE);
if(censormod($title) || $_G['group']['allowuploadmod']) {
$pic_status = 1;
updatemoderate("picid", $picid);
manage_addnotify('verifypic');
} else {
$pic_status = 0;
}
$wherearr = array('picid'=>$picid);
if(!$managealbum) $wherearr['uid'] = $_G['uid'];
C::t('home_pic')->update($picid, array('title'=>$title, 'status' => $pic_status));
}
}
if($_GET['subop'] == 'delete') {
if($_POST['ids']) {
require_once libfile('function/delete');
deletepics($_POST['ids']);
if($albumid > 0) $return = album_update_pic($albumid);
}
} elseif($_GET['subop'] == 'move') {
if($_POST['ids']) {
$sqluid = $managealbum ? '' : $_G['uid'];
$_POST['newalbumid'] = intval($_POST['newalbumid']);
if($_POST['newalbumid']) {
if(!$album = C::t('home_album')->fetch_album($_POST['newalbumid'], $sqluid)) {
$_POST['newalbumid'] = 0;
}
}
if($managealbum) {
$updatecount = C::t('home_pic')->update($_POST['ids'], array('albumid' => $_POST['newalbumid']));
}else {
$updatecount = C::t('home_pic')->update_for_uid($_G['uid'], $_POST['ids'], array('albumid' => $_POST['newalbumid']));
}
if($updatecount) {
if($albumid>0) {
C::t('home_album')->update_num_by_albumid($albumid, -$updatecount, 'picnum', $sqluid);
$return = album_update_pic($albumid);
}
if($_POST['newalbumid']) {
C::t('home_album')->update_num_by_albumid($_POST['newalbumid'], $updatecount, 'picnum', $sqluid);
$return = album_update_pic($_POST['newalbumid']);
}
}
}
}
$url = $return ? "home.php?mod=spacecp&ac=album&op=editpic&albumid=$albumid&page={$_POST['page']}" : 'home.php?mod=space&uid='.$_G['uid'].'&do=album&view=me';
if($_G['inajax']) {
showmessage('do_success', $url, array('title' => $title), array('showdialog' => 3, 'showmsg' => true, 'closetime' => true));
} else {
showmessage('do_success', $url);
}
}
$perpage = 10;
$page = empty($_GET['page'])?0:intval($_GET['page']);
if($page<1) $page = 1;
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
if($albumid > 0) {
$count = $picid?1:$album['picnum'];
} else {
$count = C::t('home_pic')->fetch_all_by_albumid($albumid, 0, 0, $picid, 0, 0, $_G['uid'], true);
}
$list = array();
if($count) {
if($page > 1 && $start >=$count) {
$page--;
$start = ($page-1)*$perpage;
}
$bbcode = & bbcode::instance();
$query = C::t('home_pic')->fetch_all_by_albumid($albumid, $start, $perpage, $picid, 0, 1, ($albumid > 0 ? 0 : $_G['uid']));
foreach($query as $value) {
if($picid) {
$value['checked'] = ' checked';
}
$value['title'] = $bbcode->html2bbcode($value['title']);
$value['pic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote']);
$value['bigpic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote'], 0);
$list[] = $value;
}
}
$multi = multi($count, $perpage, $page, "home.php?mod=spacecp&ac=album&op=editpic&albumid=$albumid");
$albumlist = getalbums($album['uid']);
} elseif($_GET['op'] == 'setpic') {
album_update_pic($albumid, $picid);
showmessage('do_success', dreferer(), array('picid' => $picid), array('showmsg' => true, 'closetime' => true));
} elseif($_GET['op'] == 'edittitle') {
$picid = empty($_GET['picid'])?0:intval($_GET['picid']);
$pic = C::t('home_pic')->fetch($picid);
if(!checkperm('managealbum') && $pic['uid'] != $_G['uid']) {
$pic = array();
}
} elseif($_GET['op'] == 'edithot') {
if(!checkperm('managealbum')) {
showmessage('no_privilege_edithot_album');
}
if(!$pic = C::t('home_pic')->fetch($picid)) {
showmessage('image_does_not_exist');
}
if(submitcheck('hotsubmit')) {
$_POST['hot'] = intval($_POST['hot']);
C::t('home_pic')->update($picid, array('hot'=>$_POST['hot']));
if($_POST['hot'] > 0) {
require_once libfile('function/feed');
feed_publish($picid, 'picid');
} else {
C::t('home_feed')->update_feed($picid, array('hot'=>$_POST['hot']), 'picid');
}
showmessage('do_success', dreferer());
}
} elseif($_GET['op'] == 'saveforumphoto') {
if(submitcheck('savephotosubmit')) {
$aid = intval($_GET['aid']);
$albumid = intval($_POST['albumid']);
if(!$aid) {
showmessage('parameters_error');
}
$attach = C::t('forum_attachment_n')->fetch_attachment('aid:'.$aid, $aid);
if(empty($attach) || !$attach['isimage']) {
showmessage('parameters_error');
}
if($albumid) {
$album = C::t('home_album')->fetch_album($albumid, $_G['uid']);
if(empty($album)) {
showmessage('album_does_not_exist');
}
} else {
$album = array('albumid' => 0);
}
$picdata = array(
'albumid' => $album['albumid'],
'uid' => $_G['uid'],
'username' => $_G['username'],
'dateline' => $attach['dateline'],
'postip' => $_G['clientip'],
'port' => $_G['remoteport'],
'filename' => censor($attach['filename']),
'title' => censor(cutstr(dhtmlspecialchars($attach['description']), 100)),
'type' => fileext($attach['attachment']),
'size' => $attach['filesize'],
'filepath' => $attach['attachment'],
'thumb' => $attach['thumb'],
'remote' => $attach['remote'] + 2
);
$picid = C::t('home_pic')->insert($picdata, 1);
showmessage('do_success', dreferer(), array('picid' => $picid), array('showdialog'=>true, 'showmsg' => true, 'closetime' => true));
} else {
$albumlist = C::t('home_album')->fetch_all_by_uid($_G['uid'], 'updatetime');
}
}
include_once template("home/spacecp_album");
?>

View File

@@ -0,0 +1,39 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_avatar.php 23850 2011-08-11 10:16:09Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(!$_G['group']['allowavatarupload']) {
showmessage('no_privilege_upload_avatar');
}
if(submitcheck('avatarsubmit')) {
showmessage('do_success', 'cp.php?ac=avatar&quickforward=1');
}
loaducenter();
if(UC_STANDALONE) {
define('UC_AVTAPI', $_G['siteurl'].'api/avatar');
}
$uc_avatarflash = uc_avatar($_G['uid'], 'virtual', 0);
$uc_avatarflash[] = 'standalone';
$uc_avatarflash[] = UC_STANDALONE;
if(empty($space['avatarstatus']) && uc_check_avatar($_G['uid'], 'middle')) {
C::t('common_member')->update($_G['uid'], array('avatarstatus'=>'1'));
updatecreditbyaction('setavatar');
}
$reload = intval($_GET['reload']);
$actives = array('avatar' =>' class="a"');
include template("home/spacecp_avatar");
?>

View File

@@ -0,0 +1,192 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_blog.php 28297 2012-02-27 08:35:59Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['blogstatus']) {
showmessage('blog_status_off');
}
$blogid = empty($_GET['blogid'])?0:intval($_GET['blogid']);
$op = empty($_GET['op'])?'':$_GET['op'];
$blog = array();
if($blogid) {
$blog = array_merge(
C::t('home_blog')->fetch($blogid),
C::t('home_blogfield')->fetch($blogid)
);
if($blog['tag']) {
$tagarray_all = $array_temp = $blogtag_array = array();
$tagarray_all = explode("\t", $blog['tag']);
if($tagarray_all) {
foreach($tagarray_all as $var) {
if($var) {
$array_temp = explode(',', $var);
$blogtag_array[] = $array_temp['1'];
}
}
}
$blog['tag'] = implode(',', $blogtag_array);
}
}
if(empty($blog)) {
if(!helper_access::check_module('blog') || !checkperm('allowblog')) {
showmessage('no_authority_to_add_log', '', array(), array('return' => true));
}
cknewuser();
$waittime = interval_check('post');
if($waittime > 0) {
showmessage('operating_too_fast', '', array('waittime' => $waittime), array('return' => true));
}
$blog['subject'] = empty($_GET['subject']) ? '' : (dstrlen($_GET['subject']) > $_G['setting']['maxsubjectsize'] ? getstr($_GET['subject'], $_G['setting']['maxsubjectsize']) : $_GET['subject']);
$blog['message'] = empty($_GET['message'])?'':getstr($_GET['message'], 5000);
} else {
if($_G['uid'] != $blog['uid'] && !checkperm('manageblog') && $_GET['modblogkey'] != modauthkey($blog['blogid'])) {
showmessage('no_authority_operation_of_the_log');
}
}
if(submitcheck('blogsubmit', 0, $seccodecheck, $secqaacheck) && helper_access::check_module('blog')) {
if(empty($blog['blogid'])) {
$blog = array();
} else {
if(!checkperm('allowblog')) {
showmessage('no_privilege_blog');
}
}
if($_G['setting']['blogcategorystat'] && $_G['setting']['blogcategoryrequired'] && !$_POST['catid']) {
showmessage('blog_choose_system_category');
}
require_once libfile('function/blog');
if($newblog = blog_post($_POST, $blog)) {
if(empty($blog) && $newblog['topicid']) {
$url = 'home.php?mod=space&uid='.$_G['uid'].'&do=topic&topicid='.$newblog['topicid'].'&view=blog&quickforward=1';
} else {
$url = 'home.php?mod=space&uid='.$newblog['uid'].'&do=blog&quickforward=1&id='.$newblog['blogid'];
}
if($_GET['modblogkey']) {
$url .= "&modblogkey={$_GET['modblogkey']}";
}
dsetcookie('clearUserdata', 'home');
showmessage('do_success', $url);
} else {
showmessage('that_should_at_least_write_things', NULL, array(), array('return'=>1));
}
}
if($_GET['op'] == 'delete') {
if(submitcheck('deletesubmit')) {
require_once libfile('function/delete');
if(deleteblogs(array($blogid))) {
showmessage('do_success', "home.php?mod=space&uid={$blog['uid']}&do=blog&view=me");
} else {
showmessage('failed_to_delete_operation');
}
}
} elseif($_GET['op'] == 'stick') {
space_merge($space, 'field_home');
$stickflag = $_GET['stickflag'] ? 1 : 0;
if(submitcheck('sticksubmit')) {
if($space['uid'] === $blog['uid'] && empty($blog['status'])) {
$stickblogs = explode(',', $space['stickblogs']);
$pos = array_search($blogid, $stickblogs);
if($pos !== false) {
unset($stickblogs[$pos]);
}
$blogs = implode(',', $stickblogs);
$blogs = empty($_POST['stickflag']) ? $blogs : $blogid.','.$blogs;
$stickblogs = explode(',', $blogs);
$stickblogs = array_filter($stickblogs);
$space['stickblogs'] = implode(',', $stickblogs);
C::t('common_member_field_home')->update($space['uid'], array('stickblogs' => $space['stickblogs']));
showmessage('do_success', dreferer("home.php?mod=space&uid={$blog['uid']}&do=blog&view=me"));
} else {
showmessage('failed_to_stick_operation');
}
}
} elseif($_GET['op'] == 'edithot') {
if(!checkperm('manageblog')) {
showmessage('no_privilege_edithot_blog');
}
if(submitcheck('hotsubmit')) {
$_POST['hot'] = intval($_POST['hot']);
C::t('home_blog')->update($blog['blogid'], array('hot'=>$_POST['hot']));
if($_POST['hot']>0) {
require_once libfile('function/feed');
feed_publish($blog['blogid'], 'blogid');
} else {
C::t('home_feed')->update_feed($blog['blogid'], array('hot'=>$_POST['hot']), 'blogid');
}
showmessage('do_success', "home.php?mod=space&uid={$blog['uid']}&do=blog&id={$blog['blogid']}");
}
} else {
$classarr = $blog['uid']?getclassarr($blog['uid']):getclassarr($_G['uid']);
$albums = getalbums($_G['uid']);
$friendarr = array($blog['friend'] => ' selected');
$passwordstyle = $selectgroupstyle = 'display:none';
if($blog['friend'] == 4) {
$passwordstyle = '';
} elseif($blog['friend'] == 2) {
$selectgroupstyle = '';
if($blog['target_ids']) {
$names = array();
if(!is_array($blog['target_ids'])){
$blog['target_ids'] = explode(",", $blog['target_ids']);
}
foreach(C::t('common_member')->fetch_all($blog['target_ids']) as $uid => $value) {
$names[$uid] = $value['username'];
}
$blog['target_names'] = implode(' ', $names);
}
}
$blog['message'] = dhtmlspecialchars($blog['message']);
$allowhtml = checkperm('allowhtml');
require_once libfile('function/friend');
$groups = friend_group_list();
if($_G['setting']['blogcategorystat']) {
loadcache('blogcategory');
$category = $_G['cache']['blogcategory'];
$categoryselect = '';
if($category) {
include_once libfile('function/portalcp');
$categoryselect = category_showselect('blog', 'catid', !$_G['setting']['blogcategoryrequired'] ? true : false, $blog['catid']);
}
}
$menuactives = array('space'=>' class="active"');
}
require_once libfile('function/upload');
$swfconfig = getuploadconfig($_G['uid'], 0, false);
include_once template("home/spacecp_blog");
?>

View File

@@ -0,0 +1,54 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_class.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['blogstatus']) {
showmessage('blog_status_off');
}
$classid = empty($_GET['classid'])?0:intval($_GET['classid']);
$op = empty($_GET['op'])?'':$_GET['op'];
$class = array();
if($classid) {
$class = C::t('home_class')->fetch($classid);
if($class['uid'] != $_G['uid']) {
$class = null;
}
}
if(empty($class)) showmessage('did_not_specify_the_type_of_operation');
if ($op == 'edit') {
if(submitcheck('editsubmit')) {
$_POST['classname'] = getstr($_POST['classname'], 40);
$_POST['classname'] = censor($_POST['classname']);
if(strlen($_POST['classname']) < 1) {
showmessage('enter_the_correct_class_name');
}
C::t('home_class')->update($classid, array('classname'=>$_POST['classname']));
showmessage('do_success', dreferer(),array('classid'=>$classid, 'classname' => $_POST['classname']), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
} elseif ($op == 'delete') {
if(submitcheck('deletesubmit')) {
C::t('home_blog')->update_classid_by_classid($classid, 0);
C::t('home_class')->delete($classid);
showmessage('do_success', dreferer());
}
}
include_once template("home/spacecp_class");
?>

View File

@@ -0,0 +1,200 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_click.php 31313 2012-08-10 03:51:03Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$clickid = empty($_GET['clickid'])?0:intval($_GET['clickid']);
$idtype = empty($_GET['idtype'])?'':trim($_GET['idtype']);
$id = empty($_GET['id'])?0:intval($_GET['id']);
loadcache('click');
$clicks = empty($_G['cache']['click'][$idtype])?array():$_G['cache']['click'][$idtype];
$click = $clicks[$clickid];
if(empty($click)) {
showmessage('click_error');
}
switch ($idtype) {
case 'picid':
if (!$_G['setting']['albumstatus']) {
showmessage('album_status_off');
}
$item = C::t('home_pic')->fetch($id);
if($item) {
$picfield = C::t('home_picfield')->fetch($id);
$album = C::t('home_album')->fetch_album($item['albumid']);
$item['hotuser'] = $picfield['hotuser'];
$item['friend'] = $album['friend'];
$item['username'] = $album['username'];
}
$tablename = 'home_pic';
break;
case 'aid':
if (!$_G['setting']['portalstatus']) {
showmessage('portal_status_off');
}
$item = C::t('portal_article_title')->fetch($id);
$tablename = 'portal_article_title';
break;
default:
if (!$_G['setting']['blogstatus']) {
showmessage('blog_status_off');
}
$idtype = 'blogid';
$item = array_merge(
C::t('home_blog')->fetch($id),
C::t('home_blogfield')->fetch($id)
);
$tablename = 'home_blog';
break;
}
if(!$item) {
showmessage('click_item_error');
}
$hash = md5($item['uid']."\t".$item['dateline']);
if($_GET['op'] == 'add') {
if(!checkperm('allowclick') || $_GET['hash'] != $hash) {
showmessage('no_privilege_click');
}
if($item['uid'] == $_G['uid']) {
showmessage('click_no_self');
}
if(isblacklist($item['uid'])) {
showmessage('is_blacklist');
}
if(C::t('home_clickuser')->count_by_uid_id_idtype($space['uid'], $id, $idtype)) {
showmessage('click_have');
}
$setarr = array(
'uid' => $space['uid'],
'username' => $_G['username'],
'id' => $id,
'idtype' => $idtype,
'clickid' => $clickid,
'dateline' => $_G['timestamp']
);
C::t('home_clickuser')->insert($setarr);
C::t($tablename)->update_click($id, $clickid, 1);
hot_update($idtype, $id, $item['hotuser']);
$q_note = '';
$q_note_values = array();
$fs = array();
switch ($idtype) {
case 'blogid':
$fs['title_template'] = 'feed_click_blog';
$fs['title_data'] = array(
'touser' => "<a href=\"home.php?mod=space&uid={$item['uid']}\">{$item['username']}</a>",
'subject' => "<a href=\"home.php?mod=space&uid={$item['uid']}&do=blog&id={$item['blogid']}\">{$item['subject']}</a>",
'click' => $click['name']
);
$q_note = 'click_blog';
$q_note_values = array(
'url'=>"home.php?mod=space&uid={$item['uid']}&do=blog&id={$item['blogid']}",
'subject'=>$item['subject'],
'from_id' => $item['blogid'],
'from_idtype' => 'blogid'
);
break;
case 'aid':
require_once libfile('function/portal');
$article_url = fetch_article_url($item);
$fs['title_template'] = 'feed_click_article';
$fs['title_data'] = array(
'touser' => "<a href=\"home.php?mod=space&uid={$item['uid']}\">{$item['username']}</a>",
'subject' => "<a href=\"$article_url\">{$item['title']}</a>",
'click' => $click['name']
);
$q_note = 'click_article';
$q_note_values = array(
'url'=>$article_url,
'subject'=>$item['title'],
'from_id' => $item['aid'],
'from_idtype' => 'aid'
);
break;
case 'picid':
$fs['title_template'] = 'feed_click_pic';
$fs['title_data'] = array(
'touser' => "<a href=\"home.php?mod=space&uid={$item['uid']}\">{$item['username']}</a>",
'click' => $click['name']
);
$fs['images'] = array(pic_get($item['filepath'], 'album', $item['thumb'], $item['remote']));
$fs['image_links'] = array("home.php?mod=space&uid={$item['uid']}&do=album&picid={$item['picid']}");
$fs['body_general'] = $item['title'];
$q_note = 'click_pic';
$q_note_values = array(
'url'=>"home.php?mod=space&uid={$item['uid']}&do=album&picid={$item['picid']}",
'from_id' => $item['picid'],
'from_idtype' => 'picid'
);
break;
}
if(empty($item['friend']) && ckprivacy('click', 'feed')) {
require_once libfile('function/feed');
$fs['title_data']['hash_data'] = "{$idtype}{$id}";
feed_add('click', $fs['title_template'], $fs['title_data'], '', array(), $fs['body_general'],$fs['images'], $fs['image_links']);
}
updatecreditbyaction('click', 0, array(), $idtype.$id);
require_once libfile('function/stat');
updatestat('click');
notification_add($item['uid'], 'click', $q_note, $q_note_values);
showmessage('click_success', '', array('idtype' => $idtype, 'id' => $id, 'clickid' => $clickid), array('msgtype' => 3, 'showmsg' => true, 'closetime' => true));
} elseif ($_GET['op'] == 'show') {
$maxclicknum = 0;
foreach ($clicks as $key => $value) {
$value['clicknum'] = $item["click{$key}"];
$value['classid'] = mt_rand(1, 4);
if($value['clicknum'] > $maxclicknum) $maxclicknum = $value['clicknum'];
$clicks[$key] = $value;
}
$perpage = 18;
$page = intval($_GET['page']);
$start = ($page-1)*$perpage;
if($start < 0) $start = 0;
$count = C::t('home_clickuser')->count_by_id_idtype($id, $idtype);
$clickuserlist = array();
$click_multi = '';
if($count) {
foreach(C::t('home_clickuser')->fetch_all_by_id_idtype($id, $idtype, $start, $perpage) as $value) {
$value['clickname'] = $clicks[$value['clickid']]['name'];
$clickuserlist[] = $value;
}
$click_multi = multi($count, $perpage, $page, "home.php?mod=spacecp&ac=click&op=show&clickid=$clickid&idtype=$idtype&id=$id");
}
}
include_once(template('home/spacecp_click'));
?>

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: spacecp_comment.php 28261 2012-02-27 02:26:09Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$idtype_array = array('picid' => 'album', 'blogid' => 'blog', 'sid' => 'share', 'uid' => 'wall');
$tospace = $pic = $blog = $album = $share = $poll = array();
include_once libfile('class/bbcode');
$bbcode = & bbcode::instance();
if($_POST['idtype'] == 'uid' && ($seccodecheck || $secqaacheck)) {
$seccodecheck = 0;
$secqaacheck = 0;
}
if(submitcheck('commentsubmit', 0, $seccodecheck, $secqaacheck)) {
if(!checkperm('allowcomment')) {
showmessage('no_privilege_comment', '', array(), array('return' => true));
}
cknewuser();
$waittime = interval_check('post');
if($waittime > 0) {
showmessage('operating_too_fast', '', array('waittime' => $waittime), array('return' => true));
}
$id = intval($_POST['id']);
$idtype = $_POST['idtype'];
$message = getstr($_POST['message'], 0, 0, 0, 2);
$cid = empty($_POST['cid'])?0:intval($_POST['cid']);
if(!array_key_exists($idtype, $idtype_array)) {
showmessage('no_privilege_comment', '', array(), array('return' => true));
} else if(!$_G['setting'][$idtype_array[$idtype].'status']) {
showmessage($idtype_array[$idtype].'_status_off');
}
if(strlen($message) < 2) {
showmessage('content_is_too_short', '', array(), array());
}
require_once libfile('function/comment');
$cidarr = add_comment($message, $id, $idtype, $cid);
if($cidarr['cid'] != 0) {
showmessage($cidarr['msg'], dreferer(), $cidarr['magvalues'], $_GET['quickcomment'] ? array('msgtype' => 3, 'showmsg' => true) : array('showdialog' => 3, 'showmsg' => true, 'closetime' => true));
} else {
showmessage('no_privilege_comment', '', array(), array('return' => true));
}
}
$cid = empty($_GET['cid'])?0:intval($_GET['cid']);
$cmt = C::t('home_comment')->fetch_comment($cid);
if(empty($cmt)) {
showmessage('comments_do_not_exist');
} else 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($_GET['op'] == 'edit') {
if($_G['adminid'] != 1 && $_GET['modcommentkey'] != modauthkey($_GET['cid'])) {
$authorid = intval($_G['uid']);
} else {
$authorid = '';
}
if(!$comment = C::t('home_comment')->fetch_comment($cid, $authorid)) {
showmessage('no_privilege_comment_edit');
}
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']['allowcommentmod']) {
$comment_status = 1;
} else {
$comment_status = 0;
}
if($comment_status == 1) {
$idtype = $comment['idtype'];
updatemoderate($idtype.'_cid', $cid);
manage_addnotify('verifycommontes');
}
C::t('home_comment')->update_comment($comment['cid'], array('message'=>$message, 'status'=>$comment_status));
showmessage('do_success', dreferer(), array('cid' => $comment['cid']), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
$comment['message'] = $bbcode->html2bbcode($comment['message']);
} elseif($_GET['op'] == 'delete') {
if(submitcheck('deletesubmit')) {
require_once libfile('function/delete');
if(deletecomments(array($cid))) {
showmessage('do_success', dreferer(), array('cid' => $cid), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
} else {
showmessage('no_privilege_comment_del');
}
}
} elseif($_GET['op'] == 'reply') {
if($cmt['idtype'] == 'uid' && ($seccodecheck || $secqaacheck)) {
$seccodecheck = 0;
$secqaacheck = 0;
}
$config = urlencode(getsiteurl().'home.php?mod=misc&ac=swfupload&op=config&doodle=1');
} else {
showmessage('undefined_action');
}
include template('home/spacecp_comment');
?>

View File

@@ -0,0 +1,57 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_common.php 24550 2011-09-26 02:58:48Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$op = empty($_GET['op'])?'':trim($_GET['op']);
if($op == 'ignore') {
$type = empty($_GET['type'])?'':preg_replace("/[^0-9a-zA-Z\_\-\.]/", '', $_GET['type']);
$id = empty($_GET['id']) ? 0 : intval($_GET['id']);
if(submitcheck('ignoresubmit')) {
$authorid = empty($_POST['authorid']) ? 0 : intval($_POST['authorid']);
if($type) {
$type_uid = $type.'|'.$authorid;
if(empty($space['privacy']['filter_note']) || !is_array($space['privacy']['filter_note'])) {
$space['privacy']['filter_note'] = array();
}
$space['privacy']['filter_note'][$type_uid] = $type_uid;
privacy_update();
}
showmessage('do_success', dreferer(), array('id' => $id ,'type' => $type ,'uid' => $authorid), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
}
$formid = random(8);
} elseif($op == 'closefeedbox') {
dsetcookie('closefeedbox', 1);
} elseif($op == 'modifyunitprice') {
if(!$_G['setting']['ranklist']['membershow']) {
exit('Access Denied');
}
$showinfo = C::t('home_show')->fetch($_G['uid']); //DB::fetch_first("SELECT credit, unitprice FROM ".DB::table('home_show')." WHERE uid='{$_G['uid']}'");
if(submitcheck('modifysubmit')) {
$unitprice = intval($_POST['unitprice']);
if($unitprice < 1) {
showmessage('showcredit_error', '', array(), array('return' => 1));
}
$unitprice = $unitprice > $showinfo['credit'] ? $showinfo['credit'] : $unitprice;
C::t('home_show')->update($_G['uid'], array('unitprice' => $unitprice));
showmessage('do_success', dreferer(), array('unitprice' => $unitprice), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
}
}
include template('home/spacecp_common');
?>

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: spacecp_credit.php 32023 2012-10-31 08:20:37Z liulanbo $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if($_G['inajax'] && $_GET['showcredit']) {
include template('common/extcredits');
exit;
}
include_once libfile('function/credit');
$perpage = 20;
$page = empty($_GET['page']) ? 1 : intval($_GET['page']);
if($page < 1) $page = 1;
$start = ($page-1) * $perpage;
ckstart($start, $perpage);
checkusergroup();
$operation = in_array(getgpc('op'), array('base', 'buy', 'transfer', 'exchange', 'log', 'rule')) ? trim($_GET['op']) : 'base';
$opactives = array($operation =>' class="a"');
if(in_array($operation, array('base', 'buy', 'transfer', 'exchange', 'rule'))) {
$operation = 'base';
}
if($_G['setting']['ec_ratio']) {
$is_enable_pay = payment::enable();
} else {
$is_enable_pay = false;
}
include_once libfile('spacecp/credit_'.$operation, 'include');
?>

View File

@@ -0,0 +1,331 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_credit_base.php 33663 2013-07-30 05:06:43Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(empty($_GET['op'])) $_GET['op'] = 'base';
if(in_array($_GET['op'], array('transfer', 'exchange'))) {
$taxpercent = sprintf('%1.2f', $_G['setting']['creditstax'] * 100).'%';
}
if($_GET['op'] == 'base') {
$loglist = $extcredits_exchange = array();
if(!empty($_G['setting']['extcredits'])) {
foreach($_G['setting']['extcredits'] as $key => $value) {
if($value['allowexchangein'] || $value['allowexchangeout']) {
$extcredits_exchange['extcredits'.$key] = array('title' => $value['title'], 'unit' => $value['unit']);
}
}
}
$count = C::t('common_credit_log')->count_by_uid($_G['uid']);
if($count) {
loadcache(array('magics'));
foreach(C::t('common_credit_log')->fetch_all_by_uid($_G['uid'], 0, 10) as $log) {
$credits = array();
$havecredit = false;
$maxid = $minid = 0;
foreach($_G['setting']['extcredits'] as $id => $credit) {
if($log['extcredits'.$id]) {
$havecredit = true;
if($log['operation'] == 'RPZ') {
$credits[] = $credit['title'].lang('spacecp', 'credit_update_reward_clean');
} else {
$credits[] = $credit['title'].' <span class="'.($log['extcredits'.$id] > 0 ? 'xi1' : 'xg1').'">'.($log['extcredits'.$id] > 0 ? '+' : '').$log['extcredits'.$id].'</span>';
}
if($log['operation'] == 'CEC' && !empty($log['extcredits'.$id])) {
if($log['extcredits'.$id] > 0) {
$log['maxid'] = $id;
} elseif($log['extcredits'.$id] < 0) {
$log['minid'] = $id;
}
}
}
}
if(!$havecredit) {
continue;
}
$log['credit'] = implode('<br/>', $credits);
if(in_array($log['operation'], array('RTC', 'RAC', 'STC', 'BTC', 'ACC', 'RCT', 'RCA', 'RCB'))) {
$tids[$log['relatedid']] = $log['relatedid'];
} elseif(in_array($log['operation'], array('SAC', 'BAC'))) {
$aids[$log['relatedid']] = $log['relatedid'];
} elseif(in_array($log['operation'], array('PRC', 'RSC'))) {
$pids[$log['relatedid']] = $log['relatedid'];
} elseif(in_array($log['operation'], array('TFR', 'RCV'))) {
$uids[$log['relatedid']] = $log['relatedid'];
} elseif($log['operation'] == 'TRC') {
$taskids[$log['relatedid']] = $log['relatedid'];
}
$loglist[] = $log;
}
$otherinfo = getotherinfo($aids, $pids, $tids, $taskids, $uids);
}
$navtitle = lang('core', 'title_credit');
$creditsformulaexp = str_replace('*', 'X', $_G['setting']['creditsformulaexp']);
} elseif($_GET['op'] == 'buy') {
if((!$_G['setting']['ec_ratio'] || !$is_enable_pay) && !$_G['setting']['card']['open']) {
showmessage('action_closed', NULL);
}
if(submitcheck('addfundsbuyform')) {
$amount = intval($_GET['addfundamount']);
if(!$amount) {
showmessage('memcp_credits_addfunds_msg_incorrect', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
$language = lang('forum/misc');
if(($_G['setting']['ec_mincredits'] && $amount < $_G['setting']['ec_mincredits']) || ($_G['setting']['ec_maxcredits'] && $amount > $_G['setting']['ec_maxcredits'])) {
showmessage('credits_addfunds_amount_invalid', '', array('ec_maxcredits' => $_G['setting']['ec_maxcredits'], 'ec_mincredits' => $_G['setting']['ec_mincredits']), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
if($_G['setting']['ec_maxcreditspermonth']) {
if(C::t('forum_order')->sum_amount_by_uid_submitdate_status($_G['uid'], $_G['timestamp'] - 2592000, array(2, 3)) + $amount > $_G['setting']['ec_maxcreditspermonth']) {
showmessage('credits_addfunds_toomuch', '', array('ec_maxcreditspermonth' => $_G['setting']['ec_maxcreditspermonth']), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
}
$price = round(($amount / $_G['setting']['ec_ratio'] * 100) / 100, 2);
$credits = $_G['setting']['extcredits'][$_G['setting']['creditstrans']];
$return_url = $_G['siteurl'] . 'home.php?mod=spacecp&ac=credit&op=base';
$pay_url = payment::create_order(
'payment_credit',
$_G['setting']['bbname'].' - '.lang('forum/misc', 'credit_payment'),
trim(lang('forum/misc', 'credit_forum_payment') . ' ' . $credits['title'] . ' ' . $amount . ' ' . $credits['unit']),
$price * 100,
$return_url,
array(
'index' => $_G['setting']['creditstrans'],
'value' => $amount,
'ip' => $_G['clientip'],
'port' => $_G['remoteport']
)
);
include isset($_REQUEST['inajax']) ? template('common/header_ajax') : template('common/header');
echo '<script type="text/javascript" reload="1">window.location.href = \''.$pay_url.'\';</script>';
include isset($_REQUEST['inajax']) ? template('common/footer_ajax') : template('common/footer');
dexit();
} elseif(submitcheck('addfundscardsubmit')) {
list($seccodecheck, $secqaacheck) = seccheck('card');
if($seccodecheck) {
if(!check_seccode($_GET['seccodeverify'], $_GET['seccodehash'])) {
showmessage('submit_seccode_invalid', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
}
if($secqaacheck) {
if(!check_secqaa($_GET['secanswer'], $_GET['secqaahash'])) {
showmessage('submit_secqaa_invalid', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
}
if(!$_POST['cardid']) {
showmessage('memcp_credits_card_msg_cardid_incorrect', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
if(!($card = C::t('common_card')->fetch($_POST['cardid']))) {
showmessage('memcp_credits_card_msg_card_unfined', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true, 'extrajs' => '<script type="text/javascript">updateseccode("'.$_GET['sechash'].'");</script>'));
} else {
if($card['status'] == 2) {
showmessage('memcp_credits_card_msg_used', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
if($card['cleardateline'] < TIMESTAMP) {
showmessage('memcp_credits_card_msg_cleardateline_early', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
if(C::t('common_card')->update_to_used($card['id'])) {
updatemembercount($_G['uid'], array($card['extcreditskey'] => $card['extcreditsval']), true, 'CDC', 1);
showmessage('memcp_credits_card_msg_succeed', 'home.php?mod=spacecp&ac=credit&op=base', array('extcreditstitle' => $_G['setting']['extcredits'][$card['extcreditskey']]['title'], 'extcreditsval' => $card['extcreditsval']), array('showdialog' => 1, 'alert' => 'right', 'showmsg' => true, 'locationtime' => true));
} else {
showmessage('memcp_credits_card_msg_used', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
}
} else {
if($_G['setting']['card']['open']) {
list($seccodecheck, $secqaacheck) = seccheck('card');
}
$active = array();
if($_G['setting']['ec_ratio'] && $is_enable_pay) {
$active['rmb'] = 1;
} elseif($_G['setting']['card']['open']) {
$active['card'] = 1;
}
}
} elseif($_GET['op'] == 'transfer') {
if(!empty($_G['setting']['submitlock']) && discuz_process::islocked('transferlock_'.$_G['uid'], 0, 1)) {
showmessage('credits_transfer_msg_locked', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
if(!($_G['setting']['transferstatus'] && $_G['group']['allowtransfer'])) {
showmessage('action_closed', NULL);
}
if(submitcheck('transfersubmit')) {
if($_GET['to'] == $_G['username']) {
showmessage('memcp_credits_transfer_msg_self_incorrect', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
$amount = intval($_GET['transferamount']);
if($amount <= 0) {
showmessage('credits_transaction_amount_invalid', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
} elseif(getuserprofile('extcredits'.$_G['setting']['creditstransextra'][9]) - $amount < ($minbalance = $_G['setting']['transfermincredits'])) {
showmessage('credits_transfer_balance_insufficient', '', array('title' => $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][9]]['title'], 'minbalance' => $minbalance), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
} elseif(!($netamount = floor($amount * (1 - $_G['setting']['creditstax'])))) {
showmessage('credits_net_amount_iszero', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
$to = C::t('common_member')->fetch_by_username($_GET['to']);
if(!$to) {
showmessage('memcp_credits_transfer_msg_user_incorrect', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
loaducenter();
$ucresult = uc_user_login(addslashes($_G['username']), $_GET['password']);
list($tmp['uid']) = $ucresult;
if($tmp['uid'] <= 0) {
showmessage('credits_password_invalid', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
updatemembercount($_G['uid'], array($_G['setting']['creditstransextra'][9] => -$amount), 1, 'TFR', $to['uid']);
updatemembercount($to['uid'], array($_G['setting']['creditstransextra'][9] => $netamount), 1, 'RCV', $_G['uid']);
if(!empty($_GET['transfermessage'])) {
$transfermessage = dhtmlspecialchars($_GET['transfermessage']);
notification_add($to['uid'], 'credit', 'transfer', array('credit' => $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][9]]['title'].' '.$netamount.' '.$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][9]]['unit'], 'transfermessage' => $transfermessage));
}
showmessage('credits_transfer_succeed', 'home.php?mod=spacecp&ac=credit&op=transfer', array(), array('showdialog' => 1, 'showmsg' => true, 'locationtime' => true));
}
} elseif ($_GET['op'] == 'exchange') {
if(!$_G['setting']['exchangestatus']) {
showmessage('action_closed', NULL);
}
$_CACHE['creditsettings'] = array();
if(file_exists(DISCUZ_ROOT.'/uc_client/data/cache/creditsettings.php')) {
include_once(DISCUZ_ROOT.'/uc_client/data/cache/creditsettings.php');
}
if(submitcheck('exchangesubmit')) {
if($_G['setting']['submitlock'] && discuz_process::islocked('exchangelock_'.$_G['uid'], 0, 1)){
showmessage('memcp_credits_exchange_msg_locked', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
$tocredits = $_GET['tocredits'];
$fromcredits = $_GET['fromcredits'];
$exchangeamount = $_GET['exchangeamount'];
$outexange = strexists($tocredits, '|');
if($outexange && !empty($_GET['outi'])) {
$fromcredits = $_GET['fromcredits_'.$_GET['outi']];
}
if($fromcredits == $tocredits) {
showmessage('memcp_credits_exchange_msg_num_invalid', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
if($outexange) {
$netamount = floor($exchangeamount * $_CACHE['creditsettings'][$tocredits]['ratiosrc'][$fromcredits] / $_CACHE['creditsettings'][$tocredits]['ratiodesc'][$fromcredits]);
} else {
if($_G['setting']['extcredits'][$tocredits]['ratio'] < $_G['setting']['extcredits'][$fromcredits]['ratio']) {
$netamount = ceil($exchangeamount * $_G['setting']['extcredits'][$tocredits]['ratio'] / $_G['setting']['extcredits'][$fromcredits]['ratio'] * (1 + $_G['setting']['creditstax']));
} else {
$netamount = floor($exchangeamount * $_G['setting']['extcredits'][$tocredits]['ratio'] / $_G['setting']['extcredits'][$fromcredits]['ratio'] * (1 + $_G['setting']['creditstax']));
}
}
if(!$outexange && !$_G['setting']['extcredits'][$tocredits]['ratio']) {
showmessage('credits_exchange_invalid', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
if(!$outexange && !$_G['setting']['extcredits'][$fromcredits]['allowexchangeout']) {
showmessage('extcredits_disallowexchangeout', '', array('credittitle' => $_G['setting']['extcredits'][$fromcredits]['title']), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
if(!$outexange && !$_G['setting']['extcredits'][$tocredits]['allowexchangein']) {
showmessage('extcredits_disallowexchangein', '', array('credittitle' => $_G['setting']['extcredits'][$tocredits]['title']), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
if(!$netamount) {
showmessage('memcp_credits_exchange_msg_balance_insufficient', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
} elseif($exchangeamount <= 0) {
showmessage('credits_transaction_amount_invalid', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
} elseif(getuserprofile('extcredits'.$fromcredits) - $netamount < ($minbalance = $_G['setting']['exchangemincredits'])) {
showmessage('credits_exchange_balance_insufficient', '', array('title' => $_G['setting']['extcredits'][$fromcredits]['title'], 'minbalance' => $minbalance), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
loaducenter();
$ucresult = uc_user_login(addslashes($_G['username']), $_GET['password']);
list($tmp['uid']) = $ucresult;
if($tmp['uid'] <= 0) {
showmessage('credits_password_invalid', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
}
if(!$outexange) {
updatemembercount($_G['uid'], array($fromcredits => -$netamount, $tocredits => $exchangeamount), 1, 'CEC', $_G['uid']);
} else {
if(!array_key_exists($fromcredits, $_CACHE['creditsettings'][$tocredits]['creditsrc'])) {
showmessage('extcredits_dataerror', NULL);
}
list($toappid, $tocredits) = explode('|', $tocredits);
$ucresult = uc_credit_exchange_request($_G['uid'], $fromcredits, $tocredits, $toappid, $exchangeamount);
if(!$ucresult) {
showmessage('extcredits_dataerror', NULL);
}
updatemembercount($_G['uid'], array($fromcredits => -$netamount), 1, 'ECU', $_G['uid']);
$netamount = $amount;
$amount = $tocredits = 0;
}
showmessage('credits_transaction_succeed', 'home.php?mod=spacecp&ac=credit&op=exchange', array(), array('showdialog' => 1, 'showmsg' => true, 'locationtime' => true));
}
} else {
$wheresql = '';
$list = array();
$rid = intval($_GET['rid']);
if($_GET['rid']) {
$wheresql = " AND rid='$rid'";
}
require_once libfile('function/forumlist');
$select = forumselect(false, 0, $_GET['fid']);
$keys = array_keys($_G['setting']['extcredits']);
foreach(C::t('common_credit_rule')->fetch_all_by_rid($rid) as $value) {
if(!helper_access::check_module('doing') && $value['action'] == 'doing') {
continue;
} elseif(!helper_access::check_module('blog') && $value['action'] == 'publishblog') {
continue;
} elseif(!helper_access::check_module('wall') && in_array($value['action'], array('guestbook', 'getguestbook'))) {
continue;
}
if(empty($_GET['fid']) || in_array($value['action'], array('digest', 'post', 'reply', 'getattach', 'postattach'))) {
if(checkvalue($value, $keys)) {
$list[$value['action']] = $value;
}
}
}
if(!empty($_GET['fid'])) {
$_GET['fid'] = intval($_GET['fid']);
$foruminfo = C::t('forum_forumfield')->fetch($_GET['fid']);
$flist = dunserialize($foruminfo['creditspolicy']);
foreach($flist as $action => $value) {
$list[$value['action']] = $value;
}
}
}
include_once template("home/spacecp_credit_base");
function checkvalue($value, $creditids) {
$havevalue = false;
foreach($creditids as $key) {
if($value['extcredits'.$key]) {
$havevalue = true;
break;
}
}
return $havevalue;
}
?>

View File

@@ -0,0 +1,131 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_credit_log.php 31381 2012-08-21 07:56:35Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$page = empty($_GET['page'])?1:intval($_GET['page']);
if($page<1) $page=1;
$perpage = 20;
$start = ($page-1)*$perpage;
$gets = array(
'mod' => 'spacecp',
'op' => $_GET['op'],
'ac' => 'credit',
'suboperation' => $_GET['suboperation'],
'exttype' => $_GET['exttype'],
'income' => $_GET['income'],
'starttime' => $_GET['starttime'],
'endtime' => $_GET['endtime'],
'optype' => $_GET['optype']
);
$theurl = 'home.php?'.url_implode($gets);
$multi = '';
$_GET['income'] = intval($_GET['income']);
$incomeactives = array($_GET['income'] => ' selected="selected"');
$optypes = array_merge(lang('spacecp', 'logs_credit_update_INDEX'), lang('spacecp', 'logs_credit_update_SYS_INDEX'));
$endunixstr = $beginunixstr = 0;
if($_GET['starttime']) {
$beginunixstr = strtotime($_GET['starttime']);
$_GET['starttime'] = dgmdate($beginunixstr, 'Y-m-d');
}
if($_GET['endtime']) {
$endunixstr = strtotime($_GET['endtime'].' 23:59:59');
$_GET['endtime'] = dgmdate($endunixstr, 'Y-m-d');
}
if($beginunixstr && $endunixstr && $endunixstr < $beginunixstr) {
showmessage('start_time_is_greater_than_end_time');
}
if($_GET['suboperation'] == 'creditrulelog') {
$count = C::t('common_credit_rule_log')->count_by_uid($_G['uid']);
if($count) {
$rulelogs = C::t('common_credit_rule_log')->fetch_all_by_uid($_G['uid'], $start, $perpage);
$rules = C::t('common_credit_rule')->fetch_all_by_rid(C::t('common_credit_rule_log')->get_rids());
foreach($rulelogs as $value) {
$value['rulename'] = $rules[$value['rid']]['rulename'];
$list[] = $value;
}
}
} else {
loadcache('usergroups');
$suboperation = 'creditslog';
$optype = '';
if($_GET['optype'] && in_array($_GET['optype'], $optypes)) {
$optype = $_GET['optype'];
}
$exttype = intval($_GET['exttype']);
$income = intval($_GET['income']);
$count = C::t('common_credit_log')->count_by_search($_G['uid'], $optype, $beginunixstr, $endunixstr, $exttype, $income, $_G['setting']['extcredits']);
if($count) {
$aids = $pids = $tids = $taskids = $uids = $loglist = array();
loadcache(array('magics'));
foreach(C::t('common_credit_log')->fetch_all_by_search($_G['uid'], $optype, $beginunixstr, $endunixstr, $exttype, $income, $_G['setting']['extcredits'], $start,$perpage) as $log) {
$credits = array();
$havecredit = false;
$maxid = $minid = 0;
foreach($_G['setting']['extcredits'] as $id => $credit) {
if($log['extcredits'.$id]) {
$havecredit = true;
if($log['operation'] == 'RPZ') {
$credits[] = $credit['title'].lang('spacecp', 'credit_update_reward_clean');
} else {
$credits[] = $credit['title'].' <span class="'.($log['extcredits'.$id] > 0 ? 'xi1' : 'xg1').'">'.($log['extcredits'.$id] > 0 ? '+' : '').$log['extcredits'.$id].'</span>';
}
if($log['operation'] == 'CEC' && !empty($log['extcredits'.$id])) {
if($log['extcredits'.$id] > 0) {
$log['maxid'] = $id;
} elseif($log['extcredits'.$id] < 0) {
$log['minid'] = $id;
}
}
}
}
if(!$havecredit) {
continue;
}
$log['credit'] = implode('<br/>', $credits);
if(in_array($log['operation'], array('RTC', 'RAC', 'STC', 'BTC', 'ACC', 'RCT', 'RCA', 'RCB'))) {
$tids[$log['relatedid']] = $log['relatedid'];
} elseif(in_array($log['operation'], array('SAC', 'BAC'))) {
$aids[$log['relatedid']] = $log['relatedid'];
} elseif(in_array($log['operation'], array('PRC', 'RSC'))) {
$pids[$log['relatedid']] = $log['relatedid'];
} elseif(in_array($log['operation'], array('TFR', 'RCV'))) {
$uids[$log['relatedid']] = $log['relatedid'];
} elseif($log['operation'] == 'TRC') {
$taskids[$log['relatedid']] = $log['relatedid'];
}
$loglist[] = $log;
}
$otherinfo = getotherinfo($aids, $pids, $tids, $taskids, $uids);
}
}
if($count) {
$multi = multi($count, $perpage, $page, $theurl);
}
$optypehtml = '<select id="optype" name="optype" class="ps" width="168">';
$optypehtml .= '<option value="">'.lang('spacecp', 'logs_select_operation').'</option>';
foreach($optypes as $type) {
$optypehtml .= '<option value="'.$type.'"'.($type == $_GET['optype'] ? ' selected="selected"' : '').'>'.lang('spacecp', 'logs_credit_update_'.$type).'</option>';
}
$optypehtml .= '</select>';
include template('home/spacecp_credit_log');
?>

View File

@@ -0,0 +1,252 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_doing.php 33714 2013-08-07 01:42:26Z andyzheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['doingstatus']) {
showmessage('doing_status_off');
}
$doid = empty($_GET['doid'])?0:intval($_GET['doid']);
$id = empty($_GET['id'])?0:intval($_GET['id']);
if(helper_access::check_module('doing')) {
if(submitcheck('addsubmit')) {
if(!checkperm('allowdoing')) {
showmessage('no_privilege_doing');
}
cknewuser();
$waittime = interval_check('post');
if($waittime > 0) {
showmessage('operating_too_fast', '', array('waittime' => $waittime));
}
$message = getstr($_POST['message'], 200, 0, 0, 1);
$message = preg_replace("/\<br.*?\>/i", ' ', $message);
if(strlen($message) < 1) {
showmessage('should_write_that');
}
$message = censor($message, NULL, TRUE, TRUE);
if(is_array($message) && $message['message']) {
showmessage('do_success', dreferer(), array('message'=>$message['message']));
}
if(censormod($message) || $_G['group']['allowdoingmod']) {
$doing_status = 1;
} else {
$doing_status = 0;
}
$setarr = array(
'uid' => $_G['uid'],
'username' => $_G['username'],
'dateline' => $_G['timestamp'],
'message' => $message,
'ip' => $_G['clientip'],
'port' => $_G['remoteport'],
'status' => $doing_status,
);
$newdoid = C::t('home_doing')->insert($setarr, 1);
$setarr = array('recentnote'=>$message, 'spacenote'=>$message);
$credit = $experience = 0;
$extrasql = array('doings' => 1);
updatecreditbyaction('doing', 0, $extrasql);
C::t('common_member_field_home')->update($_G['uid'], $setarr);
if($_POST['to_signhtml'] && $_G['group']['maxsigsize']) {
if($_G['group']['maxsigsize'] < 200) {
$signhtml = getstr($_POST['message'], $_G['group']['maxsigsize'], 0, 0, 1);
$signhtml = preg_replace("/\<br.*?\>/i", ' ', $signhtml);
} else {
$signhtml = $message;
}
C::t('common_member_field_forum')->update($_G['uid'], array('sightml'=>$signhtml));
}
if(helper_access::check_module('feed') && ckprivacy('doing', 'feed') && $doing_status == '0') {
$feedarr = array(
'icon' => 'doing',
'uid' => $_G['uid'],
'username' => $_G['username'],
'dateline' => $_G['timestamp'],
'title_template' => lang('feed', 'feed_doing_title'),
'title_data' => serialize(array('message'=>$message)),
'body_template' => '',
'body_data' => '',
'id' => $newdoid,
'idtype' => 'doid'
);
C::t('home_feed')->insert($feedarr);
}
if($doing_status == '1') {
updatemoderate('doid', $newdoid);
manage_addnotify('verifydoing');
}
require_once libfile('function/stat');
updatestat('doing');
C::t('common_member_status')->update($_G['uid'], array('lastpost' => TIMESTAMP), 'UNBUFFERED');
if(!empty($_GET['fromcard'])) {
showmessage($message.lang('spacecp','card_update_doing'));
} else {
showmessage('do_success', dreferer(), array('doid' => $newdoid), $_GET['spacenote'] ? array('showmsg' => false):array('header' => true));
}
} elseif (submitcheck('commentsubmit')) {
if(!checkperm('allowdoing')) {
showmessage('no_privilege_doing_comment');
}
cknewuser();
$waittime = interval_check('post');
if($waittime > 0) {
showmessage('operating_too_fast', '', array('waittime' => $waittime));
}
$message = getstr($_POST['message'], 200, 0, 0, 1);
$message = preg_replace("/\<br.*?\>/i", ' ', $message);
if(strlen($message) < 1) {
showmessage('should_write_that');
}
$message = censor($message);
$updo = array();
if($id) {
$updo = C::t('home_docomment')->fetch($id);
}
if(empty($updo) && $doid) {
$updo = C::t('home_doing')->fetch($doid);
}
if(empty($updo)) {
showmessage('docomment_error');
} else {
if(isblacklist($updo['uid'])) {
showmessage('is_blacklist');
}
}
$updo['id'] = intval($updo['id']);
$updo['grade'] = intval($updo['grade']);
$setarr = array(
'doid' => $updo['doid'],
'upid' => $updo['id'],
'uid' => $_G['uid'],
'username' => $_G['username'],
'dateline' => $_G['timestamp'],
'message' => $message,
'ip' => $_G['clientip'],
'port' => $_G['remoteport'],
'grade' => $updo['grade']+1
);
if($updo['grade'] >= 3) {
$setarr['upid'] = $updo['upid'];
}
$newid = C::t('home_docomment')->insert($setarr, true);
C::t('home_doing')->update_replynum_by_doid(1, $updo['doid']);
if($updo['uid'] != $_G['uid']) {
notification_add($updo['uid'], 'comment', 'doing_reply', array(
'url'=>"home.php?mod=space&uid={$updo['uid']}&do=doing&view=me&doid={$updo['doid']}&highlight=$newid",
'from_id'=>$updo['doid'],
'from_idtype'=>'doid'));
updatecreditbyaction('comment', 0, array(), 'doing'.$updo['doid']);
}
include_once libfile('function/stat');
updatestat('docomment');
C::t('common_member_status')->update($_G['uid'], array('lastpost' => TIMESTAMP), 'UNBUFFERED');
showmessage('do_success', dreferer(), array('doid' => $updo['doid']));
}
}
if($_GET['op'] == 'delete') {
if(submitcheck('deletesubmit')) {
if($id) {
$allowmanage = checkperm('managedoing');
if($value = C::t('home_docomment')->fetch($id)) {
$home_doing = C::t('home_doing')->fetch($value['doid']);
$value['duid'] = $home_doing['uid'];
if($allowmanage || $value['uid'] == $_G['uid'] || $value['duid'] == $_G['uid'] ) {
C::t('home_docomment')->update($id, array('uid' => 0, 'username' => '', 'message' => ''));
if($value['uid'] != $_G['uid'] && $value['duid'] != $_G['uid']) {
batchupdatecredit('comment', $value['uid'], array(), -1);
}
C::t('home_doing')->update_replynum_by_doid(-1, $updo['doid']);
}
}
} else {
require_once libfile('function/delete');
deletedoings(array($doid));
}
dheader('location: '.dreferer());
exit();
}
} elseif ($_GET['op'] == 'getcomment') {
include_once(DISCUZ_ROOT.'./source/class/lib/lib_tree.php');
$tree = new lib_tree();
$list = array();
$highlight = 0;
$count = 0;
if(empty($_GET['close'])) {
foreach(C::t('home_docomment')->fetch_all_by_doid($doid) as $value) {
if(!empty($value['ip'])) {
$value['ip'] = ip::to_display($value['ip']);
}
$tree->setNode($value['id'], $value['upid'], $value);
$count++;
if($value['uid'] == $space['uid']) $highlight = $value['id'];
}
}
if($count) {
$values = $tree->getChilds();
foreach ($values as $key => $vid) {
$one = $tree->getValue($vid);
$one['layer'] = $tree->getLayer($vid) * 2;
$one['style'] = "padding-left:{$one['layer']}em;";
if($one['layer'] > 0){
if($one['layer']%3 == 2) {
$one['class'] = ' dtls';
} else {
$one['class'] = ' dtll';
}
}
if($one['id'] == $highlight && $one['uid'] == $space['uid']) {
$one['style'] .= 'color:#F60;';
}
$list[] = $one;
}
}
} elseif ($_GET['op'] == 'spacenote') {
space_merge($space, 'field_home');
}
include template('home/spacecp_doing');
?>

View File

@@ -0,0 +1,70 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_domain.php 24601 2011-09-27 12:26:41Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$domainlength = checkperm('domainlength');
if($_G['setting']['allowspacedomain'] && !empty($_G['setting']['domain']['root']['home']) && $domainlength) {
checklowerlimit('modifydomain');
} else {
showmessage('no_privilege_spacedomain');
}
if(submitcheck('domainsubmit')) {
$setarr = array();
$_POST['domain'] = strtolower(trim($_POST['domain']));
if($_POST['domain'] != $space['domain']) {
if(empty($domainlength) || empty($_POST['domain'])) {
$setarr['domain'] = '';
} else {
require_once libfile('function/domain');
if(domaincheck($_POST['domain'], $_G['setting']['domain']['root']['home'], $domainlength)) {
$setarr['domain'] = $_POST['domain'];
}
}
}
if($setarr) {
updatecreditbyaction('modifydomain');
C::t('common_member_field_home')->update($_G['uid'], $setarr);
require_once libfile('function/delete');
deletedomain($_G['uid'], 'home');
if(!empty($setarr['domain'])) {
C::t('common_domain')->insert(array('domain' => $setarr['domain'], 'domainroot' => $_G['setting']['domain']['root']['home'], 'id' => $_G['uid'], 'idtype' => 'home'));
}
}
showmessage('domain_succeed', 'home.php?mod=spacecp&ac=domain');
}
loadcache('creditrule');
getuserprofile('extcredits1');
$rule = $_G['cache']['creditrule']['modifydomain'];
$credits = $consume = $common = '';
for($i = 1; $i <= 8; $i++) {
if($_G['setting']['extcredits'][$i] && $rule['extcredits'.$i]) {
$consume .= $common.$_G['setting']['extcredits'][$i]['title'].$rule['extcredits'.$i].$_G['setting']['extcredits'][$i]['unit'];
$credits .= $common.$_G['setting']['extcredits'][$i]['title'].$_G['member']['extcredits'.$i].$_G['setting']['extcredits'][$i]['unit'];
$common = ',';
}
}
$defaultop = '';
$profilegroup = C::t('common_setting')->fetch_setting('profilegroup', true);
$actives = array('profile' =>' class="a"');
$opactives = array('domain' =>' class="a"');
include_once template("home/spacecp_domain");
?>

View File

@@ -0,0 +1,170 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_eccredit.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('function/ec_credit');
if($_GET['op'] == 'list') {
$from = !empty($_GET['from']) && in_array($_GET['from'], array('buyer', 'seller', 'myself')) ? $_GET['from'] : '';
$uid = !empty($_GET['uid']) ? intval($_GET['uid']) : $_G['uid'];
$filter = !empty($_GET['filter']) ? $_GET['filter'] : '';
switch($filter) {
case 'thisweek':
$dateline = intval($_G['timestamp'] - 604800);
break;
case 'thismonth':
$dateline = intval($_G['timestamp'] - 2592000);
break;
case 'halfyear':
$dateline = intval($_G['timestamp'] - 15552000);
break;
case 'before':
$dateline = intval($_G['timestamp'] - 15552000);
break;
default:
$dateline = false;
}
$level = !empty($_GET['level']) ? $_GET['level'] : '';
switch($level) {
case 'good':
$score = 1;
break;
case 'soso':
$score = 0;
break;
case 'bad':
$score = -1;
break;
default:
$score = false;
}
$page = max(1, intval($_GET['page']));
$start_limit = ($page - 1) * 10;
$num = C::t('forum_tradecomment')->count_list($from, $uid, $dateline, $score);
$multipage = multi($num, 10, $page, "home.php?mod=spacecp&ac=list&uid=$uid".($from ? "&from=$from" : NULL).($filter ? "&filter=$filter" : NULL).($level ? "&level=$level" : NULL));
$comments = array();
foreach(C::t('forum_tradecomment')->fetch_all_list($from, $uid, $dateline, $score, $start_limit) as $comment) {
$comment['expiration'] = dgmdate($comment['dateline'] + 30 * 86400, 'u');
$comment['dbdateline'] = $comment['dateline'];
$comment['dateline'] = dgmdate($comment['dateline'], 'u');
$comment['baseprice'] = sprintf('%0.2f', $comment['baseprice']);
$comments[] = $comment;
}
include template('home/spacecp_ec_list');
} elseif($_GET['op'] == 'rate' && ($orderid = $_GET['orderid']) && isset($_GET['type'])) {
require_once libfile('function/trade');
$type = intval($_GET['type']);
if(!$type) {
$raterid = 'buyerid';
$ratee = 'seller';
$rateeid = 'sellerid';
} else {
$raterid = 'sellerid';
$ratee = 'buyer';
$rateeid = 'buyerid';
}
$order = C::t('forum_tradelog')->fetch($orderid);
if(!$order || $order[$raterid] != $_G['uid']) {
showmessage('eccredit_order_notfound');
} elseif($order['ratestatus'] == 3 || ($type == 0 && $order['ratestatus'] == 1) || ($type == 1 && $order['ratestatus'] == 2)) {
showmessage('eccredit_rate_repeat');
} elseif(!trade_typestatus('successtrades', $order['status']) && !trade_typestatus('refundsuccess', $order['status'])) {
showmessage('eccredit_nofound');
}
$uid = $_G['uid'] == $order['buyerid'] ? $order['sellerid'] : $order['buyerid'];
if(!submitcheck('ratesubmit')) {
include template('home/spacecp_ec_rate');
} else {
$score = intval($_GET['score']);
$message = cutstr(dhtmlspecialchars($_GET['message']), 200);
$level = $score == 1 ? 'good' : ($score == 0 ? 'soso' : 'bad');
$pid = intval($order['pid']);
$order = daddslashes($order, 1);
C::t('forum_tradecomment')->insert(array(
'pid' => $pid,
'orderid' => $orderid,
'type' => $type,
'raterid' => $_G['uid'],
'rater' => $_G['username'],
'ratee' => $order[$ratee],
'rateeid' => $order[$rateeid],
'score' => $score,
'message' => $message,
'dateline' => $_G['timestamp']
));
if(!$order['offline'] || $order['credit']) {
if(C::t('forum_tradecomment')->get_month_score($_G['uid'], $type, $order[$rateeid]) < $_G['setting']['ec_credit']['maxcreditspermonth']) {
updateusercredit($uid, $type ? 'sellercredit' : 'buyercredit', $level);
}
}
if($type == 0) {
$ratestatus = $order['ratestatus'] == 2 ? 3 : 1;
} else {
$ratestatus = $order['ratestatus'] == 1 ? 3 : 2;
}
C::t('forum_tradelog')->update($order['orderid'], array('ratestatus' => $ratestatus));
if($ratestatus != 3) {
notification_add($order[$rateeid], 'goods', 'eccredit', array(
'orderid' => $orderid,
), 1);
}
showmessage('eccredit_succeed', 'home.php?mod=space&uid='.$_G['uid'].'&do=trade&view=eccredit');
}
} elseif($_GET['op'] == 'explain' && $_GET['id']) {
$id = intval($_GET['id']);
$ajaxmenuid = $_GET['ajaxmenuid'];
if(!submitcheck('explainsubmit', 1)) {
include template('home/spacecp_ec_explain');
} else {
$comment = C::t('forum_tradecomment')->fetch($id);
if(!$comment || $comment['rateeid'] != $_G['uid']) {
showmessage('eccredit_nofound');
} elseif($comment['explanation']) {
showmessage('eccredit_reexplanation_repeat');
} elseif($comment['dateline'] < TIMESTAMP - 30 * 86400) {
showmessage('eccredit_reexplanation_closed');
}
$explanation = cutstr(dhtmlspecialchars($_GET['explanation']), 200);
C::t('forum_tradecomment')->update($id, array('explanation' => $explanation));
$language = lang('forum/misc');
showmessage($language['eccredit_explain'].'&#58; '.$explanation, '', array(), array('msgtype' => 3, 'showmsg' => 1));
}
}
?>

View File

@@ -0,0 +1,220 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_favorite.php 34278 2013-12-03 09:46:45Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['favoritestatus']) {
showmessage('favorite_status_off');
}
$_GET['type'] = in_array($_GET['type'], array("thread", "forum", "group", "blog", "album", "article", "all")) ? $_GET['type'] : 'all';
if($_GET['op'] == 'delete') {
if($_GET['checkall']) {
if($_GET['favorite']) {
$deletecounter = array();
$data = C::t('home_favorite')->fetch_all($_GET['favorite']);
foreach($data as $dataone) {
$deletecounter[$dataone['idtype']]['idtype'] = $dataone['idtype'];
$deletecounter[$dataone['idtype']]['id'][] = $dataone['id'];
}
foreach($deletecounter as $thevalue) {
deletefavorite($thevalue);
}
C::t('home_favorite')->delete($_GET['favorite'], false, $_G['uid']);
}
showmessage('favorite_delete_succeed', 'home.php?mod=space&uid='.$_G['uid'].'&do=favorite&view=me&type='.$_GET['type'].'&quickforward=1');
} else {
$type = empty($_GET['type']) ? '' : $_GET['type'];
$id = empty($_GET['id']) ? 0 : intval($_GET['id']);
if($type && $id){
switch($type) {
case 'thread':
$idtype = 'tid';
break;
case 'forum':
$idtype = 'fid';
break;
case 'blog':
$idtype = 'blogid';
break;
case 'group':
$idtype = 'gid';
break;
case 'album':
$idtype = 'albumid';
break;
case 'space':
$idtype = 'uid';
break;
case 'article':
$idtype = 'aid';
break;
}
$thevalue = C::t('home_favorite')->fetch_by_id_idtype($id, $idtype, $_G['uid']);
$favid = $thevalue['favid'];
}else{
$favid = intval($_GET['favid']);
$thevalue = C::t('home_favorite')->fetch($favid);
}
if(empty($thevalue) || $thevalue['uid'] != $_G['uid']) {
showmessage('favorite_does_not_exist');
}
if(submitcheck('deletesubmit')) {
deletefavorite($thevalue);
C::t('home_favorite')->delete($favid);
showmessage('do_success', 'home.php?mod=space&uid='.$_G['uid'].'&do=favorite&view=me&type='.$_GET['type'].'&quickforward=1', array('favid' => $favid, 'id' => $thevalue['id']), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true, 'locationtime' => 3));
}
}
} else {
cknewuser();
$type = empty($_GET['type']) ? '' : $_GET['type'];
$id = empty($_GET['id']) ? 0 : intval($_GET['id']);
$spaceuid = empty($_GET['spaceuid']) ? 0 : intval($_GET['spaceuid']);
$idtype = $title = $icon = '';
switch($type) {
case 'thread':
$idtype = 'tid';
$thread = C::t('forum_thread')->fetch_thread($id);
$title = $thread['subject'];
$icon = '<img src="'.STATICURL.'image/feed/thread.gif" alt="thread" class="vm" /> ';
break;
case 'forum':
$idtype = 'fid';
$foruminfo = C::t('forum_forum')->fetch($id);
loadcache('forums');
$forum = $_G['cache']['forums'][$id];
if(!$forum['viewperm'] || ($forum['viewperm'] && forumperm($forum['viewperm'])) || strstr($forum['users'], "\t{$_G['uid']}\t")) {
$title = $foruminfo['status'] != 3 ? $foruminfo['name'] : '';
$icon = '<img src="'.STATICURL.'image/feed/discuz.gif" alt="forum" class="vm" /> ';
}
break;
case 'blog':
$idtype = 'blogid';
$bloginfo = C::t('home_blog')->fetch($id);
$title = ($bloginfo['uid'] == $spaceuid) ? $bloginfo['subject'] : '';
$icon = '<img src="'.STATICURL.'image/feed/blog.gif" alt="blog" class="vm" /> ';
break;
case 'group':
$idtype = 'gid';
$foruminfo = C::t('forum_forum')->fetch($id);
$title = $foruminfo['status'] == 3 ? $foruminfo['name'] : '';
$icon = '<img src="'.STATICURL.'image/feed/group.gif" alt="group" class="vm" /> ';
break;
case 'album':
$idtype = 'albumid';
$result = C::t('home_album')->fetch_album($id, $spaceuid);
$title = $result['albumname'];
$icon = '<img src="'.STATICURL.'image/feed/album.gif" alt="album" class="vm" /> ';
break;
case 'space':
$idtype = 'uid';
$_member = getuserbyuid($id);
$title = $_member['username'];
$unset($_member);
$icon = '<img src="'.STATICURL.'image/feed/profile.gif" alt="space" class="vm" /> ';
break;
case 'article':
$idtype = 'aid';
$article = C::t('portal_article_title')->fetch($id);
$title = $article['title'];
$icon = '<img src="'.STATICURL.'image/feed/article.gif" alt="article" class="vm" /> ';
break;
}
if(empty($idtype) || empty($title)) {
showmessage('favorite_cannot_favorite');
}
$fav = C::t('home_favorite')->fetch_by_id_idtype($id, $idtype, $_G['uid']);
if($fav) {
showmessage('favorite_repeat');
}
$description = $extrajs = '';
$description_show = nl2br($description);
$fav_count = C::t('home_favorite')->count_by_id_idtype($id, $idtype);
if(submitcheck('favoritesubmit') || ($type == 'forum' || $type == 'group' || $type == 'thread') && $_GET['formhash'] == FORMHASH) {
$arr = array(
'uid' => intval($_G['uid']),
'idtype' => $idtype,
'id' => $id,
'spaceuid' => $spaceuid,
'title' => getstr($title, 255),
'description' => getstr($_POST['description'], '', 0, 0, 1),
'dateline' => TIMESTAMP
);
$favid = C::t('home_favorite')->insert($arr, true);
switch($type) {
case 'thread':
C::t('forum_thread')->increase($id, array('favtimes'=>1));
require_once libfile('function/forum');
update_threadpartake($id);
break;
case 'forum':
C::t('forum_forum')->update_forum_counter($id, 0, 0, 0, 0, 1);
$extrajs = '<script type="text/javascript">$("number_favorite_num").innerHTML = parseInt($("number_favorite_num").innerHTML)+1;$("number_favorite").style.display="";</script>';
dsetcookie('nofavfid', '', -1);
break;
case 'blog':
C::t('home_blog')->increase($id, $spaceuid, array('favtimes' => 1));
break;
case 'group':
C::t('forum_forum')->update_forum_counter($id, 0, 0, 0, 0, 1);
break;
case 'album':
C::t('home_album')->update_num_by_albumid($id, 1, 'favtimes', $spaceuid);
break;
case 'space':
C::t('common_member_status')->increase($id, array('favtimes' => 1));
break;
case 'article':
C::t('portal_article_count')->increase($id, array('favtimes' => 1));
break;
}
showmessage('favorite_do_success', dreferer(), array('id' => $id, 'favid' => $favid), array('showdialog' => true, 'closetime' => true, 'extrajs' => $extrajs));
}
}
include template('home/spacecp_favorite');
function deletefavorite($thevalue = array()){
switch($thevalue['idtype']) {
case 'tid':
C::t('forum_thread')->increase($thevalue['id'], array('favtimes'=>-1));
break;
case 'fid':
C::t('forum_forum')->update_forum_counter($thevalue['id'], 0, 0, 0, 0, -1);
break;
case 'blogid':
C::t('home_blog')->increase($thevalue['id'], 0, array('favtimes' => -1));
break;
case 'gid':
C::t('forum_forum')->update_forum_counter($thevalue['id'], 0, 0, 0, 0, -1);
break;
case 'albumid':
C::t('home_album')->update_num_by_albumid($thevalue['id'], -1, 'favtimes', 0);
break;
case 'uid':
C::t('common_member_status')->increase($thevalue['id'], array('favtimes' => -1));
break;
case 'aid':
C::t('portal_article_count')->increase($thevalue['id'], array('favtimes' => -1));
break;
}
}
?>

View File

@@ -0,0 +1,141 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_feed.php 24613 2011-09-28 05:07:03Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['feedstatus']) {
showmessage('feed_status_off');
}
$feedid = empty($_GET['feedid'])?0:intval($_GET['feedid']);
$page = empty($_GET['page'])?0:intval($_GET['page']);
if($page<1) $page=1;
if($feedid) {
if(!$feed = C::t('home_feed')->fetch_feed('', '', '', $feedid)) {
showmessage('feed_no_found');
}
}
if(submitcheck('commentsubmit')) {
if(empty($feed['id']) || empty($feed['idtype'])) {
showmessage('non_normal_operation');
}
if($feed['idtype'] == 'doid') {
$_GET['id'] = intval($_POST['cid']);
$_GET['doid'] = $feed['id'];
require_once libfile('spacecp/doing', 'include');
} else {
$_POST['id'] = $feed['id'];
$_POST['idtype'] = $feed['idtype'];
require_once libfile('spacecp/comment', 'include');
}
}
if($_GET['op'] == 'delete') {
if(submitcheck('feedsubmit')) {
require_once libfile('function/delete');
if(deletefeeds(array($feedid))) {
showmessage('do_success', dreferer(), array('feedid' => $feedid));
} else {
showmessage('no_privilege_feed_del');
}
}
} elseif($_GET['op'] == 'ignore') {
$icon = empty($_GET['icon'])?'':preg_replace("/[^0-9a-zA-Z\_\-\.]/", '', $_GET['icon']);
if(submitcheck('feedignoresubmit')) {
$uid = empty($_POST['uid'])?0:intval($_POST['uid']);
if($icon) {
$icon_uid = $icon.'|'.$uid;
if(empty($space['privacy']['filter_icon']) || !is_array($space['privacy']['filter_icon'])) {
$space['privacy']['filter_icon'] = array();
}
$space['privacy']['filter_icon'][$icon_uid] = $icon_uid;
privacy_update();
}
showmessage('do_success', dreferer(), array('feedid' => $feedid), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
}
} elseif($_GET['op'] == 'getapp') {
} elseif($_GET['op'] == 'getcomment') {
if(empty($feed['id']) || empty($feed['idtype'])) {
showmessage('non_normal_operation');
}
$feedid = $feed['feedid'];
$list = array();
$multi = '';
if($feed['idtype'] == 'doid') {
$_GET['doid'] = $feed['id'];
require_once libfile('spacecp/doing', 'include');
} else {
$perpage = 5;
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
$count = C::t('home_comment')->count_by_id_idtype($feed['id'], $feed['idtype']);
if($count) {
$query = C::t('home_comment')->fetch_all_by_id_idtype($feed['id'], $feed['idtype'], $start, $perpage);
foreach($query as $value) {
$list[] = $value;
}
$multi = multi($count, $perpage, $page, "home.php?mod=spacecp&ac=feed&op=getcomment&feedid=$feedid");
}
}
} elseif($_GET['op'] == 'menu') {
$allowmanage = checkperm('managefeed');
if(empty($feed['uid'])) {
showmessage('non_normal_operation');
}
} else {
$url = "home.php?mod=space&uid={$feed['uid']}&quickforward=1";
switch ($feed['idtype']) {
case 'doid':
$url .= "&do=doing&id={$feed['id']}";
break;
case 'blogid':
$url .= "&do=blog&id={$feed['id']}";
break;
case 'picid':
$url .= "&do=album&picid={$feed['id']}";
break;
case 'albumid':
$url .= "&do=album&id={$feed['id']}";
break;
case 'sid':
$url .= "&do=share&id={$feed['id']}";
break;
default:
break;
}
dheader('location:'.$url);
}
include template('home/spacecp_feed');
?>

View File

@@ -0,0 +1,275 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_follow.php 32667 2013-02-28 07:07:30Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['followstatus']) {
showmessage('follow_status_off');
}
$ops = array('add', 'del', 'bkname', 'checkfeed', 'relay', 'getfeed', 'delete', 'newthread');
$op = in_array($_GET['op'], $ops) ? $_GET['op'] : '';
if($op == 'add') {
$_GET['handlekey'] = $_GET['handlekey'] ? $_GET['handlekey'] : 'followmod';
$followuid = intval($_GET['fuid']);
if($_GET['hash'] != FORMHASH || empty($followuid)) {
exit('Access Denied');
}
if($_G['uid'] == $followuid) {
showmessage('follow_not_follow_self');
}
if(!$_G['group']['allowfollow']) {
showmessage('follow_not_follow_others');
}
$special = intval($_GET['special']) ? intval($_GET['special']) : 0;
$followuser = getuserbyuid($followuid);
if(empty($followuser)) {
showmessage('space_does_not_exist');
}
$fields = C::t('common_member_field_home')->fetch($followuid);
if(!$fields['allowasfollow']) {
showmessage('follow_other_unfollow');
}
$mutual = 0;
$followed = C::t('home_follow')->fetch_by_uid_followuid($followuid, $_G['uid']);
if(!empty($followed)) {
if($followed['status'] == '-1') {
showmessage('follow_other_unfollow');
}
$mutual = 1;
C::t('home_follow')->update_by_uid_followuid($followuid, $_G['uid'], array('mutual'=>1));
}
$followed = C::t('home_follow')->fetch_by_uid_followuid($_G['uid'], $followuid);
if(empty($followed)) {
$followdata = array(
'uid' => $_G['uid'],
'username' => $_G['username'],
'followuid' => $followuid,
'fusername' => $followuser['username'],
'status' => 0,
'mutual' => $mutual,
'dateline' => TIMESTAMP
);
C::t('home_follow')->insert($followdata, false, true);
C::t('common_member_count')->increase($_G['uid'], array('following' => 1));
C::t('common_member_count')->increase($followuid, array('follower' => 1, 'newfollower' => 1));
if($_G['setting']['followaddnotice']) {
notification_add($followuid, 'follower', 'member_follow_add', array('count' => $count, 'from_id'=>$_G['uid'], 'from_idtype' => 'following'), 1);
}
} elseif($special) {
$status = $special == 1 ? 1 : 0;
C::t('home_follow')->update_by_uid_followuid($_G['uid'], $followuid, array('status'=>$status));
$special = $special == 1 ? 2 : 1;
} else {
showmessage('follow_followed_ta');
}
$type = !$special ? 'add' : 'special';
showmessage('follow_add_succeed', dreferer(), array('fuid' => $followuid, 'type' => $type, 'special' => $special, 'from' => !empty($_GET['from']) ? $_GET['from'] : 'list'), array('closetime' => '2', 'showmsg' => '1'));
} elseif($op == 'del') {
$_GET['handlekey'] = $_GET['handlekey'] ? $_GET['handlekey'] : 'followmod';
$delfollowuid = intval($_GET['fuid']);
if(empty($delfollowuid)) {
exit('Access Denied');
}
$affectedrows = C::t('home_follow')->delete_by_uid_followuid($_G['uid'], $delfollowuid);
if($affectedrows) {
C::t('home_follow')->update_by_uid_followuid($delfollowuid, $_G['uid'], array('mutual'=>0));
C::t('common_member_count')->increase($_G['uid'], array('following' => -1));
C::t('common_member_count')->increase($delfollowuid, array('follower' => -1, 'newfollower' => -1));
}
showmessage('follow_cancel_succeed', dreferer(), array('fuid' => $delfollowuid, 'type' => 'del', 'from' => !empty($_GET['from']) ? $_GET['from'] : 'list'), array('closetime' => '2', 'showmsg' => '1'));
} elseif($op == 'bkname') {
$followuid = intval($_GET['fuid']);
$followuser = C::t('home_follow')->fetch_by_uid_followuid($_G['uid'], $followuid);
if(empty($followuser)) {
showmessage('follow_not_assignation_user');
}
if(submitcheck('editbkname')) {
$bkname = cutstr(strip_tags($_GET['bkname']), 30, '');
C::t('home_follow')->update_by_uid_followuid($_G['uid'], $followuid, array('bkname'=>$bkname));
showmessage('follow_remark_succeed', dreferer(), array('bkname' => $bkname, 'btnstr' => empty($bkname) ? lang('spacecp', 'follow_add_remark') : lang('spacecp', 'follow_modify_remark')), array('showdialog'=>true, 'closetime' => true));
}
} elseif($op == 'newthread') {
if(!helper_access::check_module('follow')) {
showmessage('quickclear_noperm');
}
if(submitcheck('topicsubmit')) {
if(empty($_GET['syncbbs'])) {
$fid = intval($_G['setting']['followforumid']);
if(!($fid && C::t('forum_forum')->fetch($fid))) {
$fid = 0;
}
if(!$fid) {
$gid = C::t('forum_forum')->fetch_fid_by_name(lang('spacecp', 'follow_specified_group'));
if(!$gid) {
$gid = C::t('forum_forum')->insert(array('type' => 'group', 'name' => lang('spacecp', 'follow_specified_group'), 'status' => 0), true);
C::t('forum_forumfield')->insert(array('fid' => $gid));
}
$forumarr = array(
'fup' => $gid,
'type' => 'forum',
'name' => lang('spacecp', 'follow_specified_forum'),
'status' => 1,
'allowsmilies' => 1,
'allowbbcode' => 1,
'allowimgcode' => 1
);
$fid = C::t('forum_forum')->insert($forumarr, true);
C::t('forum_forumfield')->insert(array('fid' => $fid));
C::t('common_setting')->update_setting('followforumid', $fid);
include libfile('function/cache');
updatecache('setting');
}
} else {
$fid = intval($_GET['fid']);
}
loadcache(array('bbcodes_display', 'bbcodes', 'smileycodes', 'smilies', 'smileytypes', 'domainwhitelist', 'albumcategory'));
if(empty($_GET['syncbbs'])) {
$_GET['subject'] = cutstr($_GET['message'], 75, '');
}
$_POST['replysubmit'] = true;
$_GET['fid'] = $fid;
$_GET['action'] = 'newthread';
$_GET['allownoticeauthor'] = '1';
include_once libfile('function/forum');
require_once libfile('function/post');
loadforum();
$_G['forum']['picstyle'] = 0;
$skipmsg = 1;
include_once libfile('forum/post', 'module');
}
} elseif($op == 'relay') {
if(!helper_access::check_module('follow')) {
showmessage('quickclear_noperm');
}
$tid = intval($_GET['tid']);
$preview = $post = array();
$preview = C::t('forum_threadpreview')->fetch($tid);
if(empty($preview)) {
$post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($tid);
if($post['anonymous']) {
showmessage('follow_anonymous_unfollow');
}
}
if(empty($post) && empty($preview)) {
showmessage('follow_content_not_exist');
}
if(submitcheck('relaysubmit')) {
if(strlen($_GET['note'])>140) {
showmessage('follow_input_word_limit');
}
$count = C::t('home_follow_feed')->count_by_uid_tid($_G['uid'], $tid);
if(!$count) {
$count = C::t('home_follow_feed')->count_by_uid_tid($_G['uid'], $tid);
}
if($count && empty($_GET['addnewreply'])) {
showmessage('follow_only_allow_the_relay_time');
}
if($_GET['addnewreply']) {
$_G['setting']['seccodestatus'] = 0;
$_G['setting']['secqaa']['status'] = 0;
$_POST['replysubmit'] = true;
$_GET['tid'] = $tid;
$_GET['action'] = 'reply';
$_GET['message'] = $_GET['note'];
include_once libfile('function/forum');
require_once libfile('function/post');
loadforum();
$inspacecpshare = 1;
include_once libfile('forum/post', 'module');
}
require_once libfile('function/discuzcode');
require_once libfile('function/followcode');
$followfeed = array(
'uid' => $_G['uid'],
'username' => $_G['username'],
'tid' => $tid,
'note' => cutstr(followcode(dhtmlspecialchars($_GET['note']), 0, 0, 0, false), 140),
'dateline' => TIMESTAMP
);
C::t('home_follow_feed')->insert($followfeed);
C::t('common_member_count')->increase($_G['uid'], array('feeds'=>1));
if(empty($preview)) {
require_once libfile('function/discuzcode');
require_once libfile('function/followcode');
$feedcontent = array(
'tid' => $tid,
'content' => followcode($post['message'], $post['tid'], $post['pid'], 1000),
);
C::t('forum_threadpreview')->insert($feedcontent);
C::t('forum_thread')->update_status_by_tid($tid, '512');
} else {
C::t('forum_threadpreview')->update_relay_by_tid($tid, 1);
}
showmessage('relay_feed_success', dreferer(), array(), array('showdialog'=>true, 'closetime' => true));
}
$fastpost = $_G['setting']['fastpost'];
} elseif($op == 'checkfeed') {
header('Content-Type: text/javascript');
require_once libfile("function/member");
checkfollowfeed();
exit;
} elseif($op == 'getfeed') {
$archiver = $_GET['archiver'] ? true : false;
$uid = intval($_GET['uid']);
$page = empty($_GET['page']) ? 1 : intval($_GET['page']);
if($page<1) $page=1;
$perpage = 20;
$start = ($page-1)*$perpage;
if($uid) {
$list = getfollowfeed($uid, 'self', $archiver, $start, $perpage);
} else {
$type = in_array($_GET['viewtype'], array('special', 'follow', 'other')) ? $_GET['viewtype'] : 'follow';
$list = getfollowfeed($type == 'other' ? 0 : $_G['uid'], $type, $archiver, $start, $perpage);
}
if(empty($list['feed'])) {
$list = false;
}
if(!isset($_G['cache']['forums'])) {
loadcache('forums');
}
} elseif($op == 'delete') {
$archiver = false;
$feed = C::t('home_follow_feed')->fetch_by_feedid($_GET['feedid']);
if(empty($feed)) {
$feed = C::t('home_follow_feed')->fetch_by_feedid($_GET['feedid'], true);
$archiver = true;
}
if(empty($feed)) {
showmessage('follow_specify_follow_not_exist', '', array(), array('return' => true));
} elseif($feed['uid'] != $_G['uid'] && $_G['adminid'] != 1) {
showmessage('quickclear_noperm', '', array(), array('return' => true));
}
if(submitcheck('deletesubmit')) {
if(C::t('home_follow_feed')->delete_by_feedid($_GET['feedid'], $archiver)) {
C::t('common_member_count')->increase($feed['uid'], array('feeds'=>-1));
C::t('forum_threadpreview')->update_relay_by_tid($feed['tid'], -1);
showmessage('do_success', dreferer(), array('feedid' => $_GET['feedid']), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
} else {
showmessage('failed_to_delete_operation');
}
}
}
include template('home/spacecp_follow');
?>

View File

@@ -0,0 +1,549 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_friend.php 36272 2016-11-23 06:35:37Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['friendstatus']) {
showmessage('friend_status_off');
}
require_once libfile('function/friend');
$op = empty($_GET['op'])?'':$_GET['op'];
$uid = empty($_GET['uid'])?0:intval($_GET['uid']);
$_GET['from'] = preg_match('/^\w+$/', $_GET['from']) ? $_GET['from'] : '';
$space['key'] = helper_invite::generate_key($space['uid']);
$actives = array($op=>' class="a"');
if($op == 'add') {
if(!checkperm('allowfriend')) {
showmessage('no_privilege_addfriend');
}
if($uid == $_G['uid']) {
showmessage('friend_self_error');
}
if(friend_check($uid)) {
showmessage('you_have_friends');
}
$tospace = getuserbyuid($uid);
if(empty($tospace)) {
showmessage('space_does_not_exist');
}
$fields = C::t('common_member_field_home')->fetch($uid);
if(!$fields['allowasfriend']) {
showmessage('is_blacklist');
}
if(isblacklist($tospace['uid'])) {
showmessage('is_blacklist');
}
$groups = friend_group_list();
space_merge($space, 'count');
space_merge($space, 'field_home');
$maxfriendnum = checkperm('maxfriendnum');
if($maxfriendnum && $space['friends'] >= $maxfriendnum + $space['addfriend']) {
if($_G['setting']['magics']['friendnum']) {
showmessage('enough_of_the_number_of_friends_with_magic');
} else {
showmessage('enough_of_the_number_of_friends');
}
}
if(friend_request_check($uid)) {
if(submitcheck('add2submit')) {
$_POST['gid'] = intval($_POST['gid']);
friend_add($uid, $_POST['gid']);
if(ckprivacy('friend', 'feed')) {
require_once libfile('function/feed');
feed_add('friend', 'feed_friend_title', array('touser'=>"<a href=\"home.php?mod=space&uid={$tospace['uid']}\">{$tospace['username']}</a>"));
}
notification_add($uid, 'friend', 'friend_add');
showmessage('friends_add', dreferer(), array('username' => $tospace['username'], 'uid'=>$uid, 'from' => $_GET['from']), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
}
$op = 'add2';
$groupselect = empty($space['privacy']['groupname']) ? array(1 => ' checked') : array();
$navtitle = lang('core', 'title_friend_add');
include template('home/spacecp_friend');
exit();
} else {
if(C::t('home_friend_request')->count_by_uid_fuid($uid, $_G['uid'])) {
showmessage('waiting_for_the_other_test', '', array(), array('alert' => 'info'));
}
if(submitcheck('addsubmit')) {
$_POST['gid'] = intval($_POST['gid']);
$_POST['note'] = censor(htmlspecialchars(cutstr($_POST['note'], strtolower(CHARSET) == 'utf-8' ? 30 : 20, '')));
friend_add($uid, $_POST['gid'], $_POST['note']);
$note = array(
'uid' => $_G['uid'],
'url' => 'home.php?mod=spacecp&ac=friend&op=add&uid='.$_G['uid'].'&from=notice',
'from_id' => $_G['uid'],
'from_idtype' => 'friendrequest',
'note' => !empty($_POST['note']) ? lang('spacecp', 'friend_request_note', array('note' => $_POST['note'])) : ''
);
notification_add($uid, 'friend', 'friend_request', $note);
require_once libfile('function/mail');
$values = array(
'username' => $tospace['username'],
'url' => $_G['setting']['securesiteurl'].'home.php?mod=spacecp&ac=friend&amp;op=request'
);
sendmail_touser($uid, lang('spacecp', 'friend_subject', $values), '', 'friend_add');
showmessage('request_has_been_sent', dreferer(), array(), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
} else {
include_once template('home/spacecp_friend');
exit();
}
}
} elseif($op == 'ignore') {
if($uid) {
if(submitcheck('friendsubmit')) {
if(friend_check($uid)) {
friend_delete($uid);
} else {
friend_request_delete($uid);
}
showmessage('do_success', 'home.php?mod=spacecp&ac=friend&op=request', array('uid'=>$uid, 'from' => $_GET['from']), array('showdialog' => 1, 'showmsg' => true, 'closetime' => 0));
}
} elseif($_GET['key'] == $space['key']) {
$count = C::t('home_friend_request')->count_by_uid($_G['uid']);
if($count) {
C::t('home_friend_request')->delete_by_uid($_G['uid']);
dsetcookie('promptstate_'.$_G['uid'], $space['newprompt'], 31536000);
}
showmessage('do_success', 'home.php?mod=spacecp&ac=friend&op=request');
}
} elseif($op == 'addconfirm') {
if(!checkperm('allowfriend')) {
showmessage('no_privilege_addfriend');
}
if($_GET['key'] == $space['key']) {
$maxfriendnum = checkperm('maxfriendnum');
space_merge($space, 'field_home');
space_merge($space, 'count');
if($maxfriendnum && $space['friends'] >= $maxfriendnum + $space['addfriend']) {
if($_G['magic']['friendnum']) {
showmessage('enough_of_the_number_of_friends_with_magic');
} else {
showmessage('enough_of_the_number_of_friends');
}
}
if($value = C::t('home_friend_request')->fetch_by_uid($space['uid'])) {
friend_add($value['fuid']);
showmessage('friend_addconfirm_next', 'home.php?mod=spacecp&ac=friend&op=addconfirm&key='.$space['key'], array('username' => $value['fusername']), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
}
}
showmessage('do_success', 'home.php?mod=spacecp&ac=friend&op=request&quickforward=1');
} elseif($op == 'find') {
$maxnum = 36;
$recommenduser = $myfuids = $fuids =array();
$i = 0;
$query = C::t('home_friend')->fetch_all_by_uid($_G['uid'], 0, 0, true);
foreach($query as $value) {
if($i < 100) {
$fuids[$value['fuid']] = $value['fuid'];
}
$myfuids[$value['fuid']] = $value['fuid'];
$i++;
}
$myfuids[$space['uid']] = $space['uid'];
foreach(C::t('home_specialuser')->range() as $value) {
$recommenduser[$value['uid']] = $value;
}
$i = 0;
$nearlist = array();
foreach(C::app()->session->fetch_all_by_ip($_G['clientip'], 200) as $value) {
if($value['uid'] && empty($myfuids[$value['uid']])) {
$nearlist[$value['uid']] = $value;
$i++;
if($i>=$maxnum) break;
}
}
$i = 0;
$friendlist = array();
if($fuids) {
$query = C::t('home_friend')->fetch_all_by_uid($fuids, 0, 200);
$fuids[$space['uid']] = $space['uid'];
foreach($query as $value) {
$value['fuid'] = $value['uid'];
$value['fusername'] = $value['username'];
if(empty($myfuids[$value['uid']])) {
$friendlist[$value['uid']] = $value;
$i++;
if($i>=$maxnum) break;
}
}
}
$i = 0;
$onlinelist = array();
foreach(C::app()->session->fetch_member(1, 2, 200) as $value) {
if(empty($myfuids[$value['uid']]) && !isset($onlinelist[$value['uid']])) {
$onlinelist[$value['uid']] = $value;
$i++;
if($i>=$maxnum) break;
}
}
$navtitle = lang('core', 'title_people_might_know');
} elseif($op == 'changegroup') {
if(submitcheck('changegroupsubmit')) {
C::t('home_friend')->update_by_uid_fuid($_G['uid'], $uid, array('gid'=>intval($_POST['group'])));
friend_cache($_G['uid']);
showmessage('do_success', dreferer(), array('gid'=>intval($_POST['group'])), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
}
$query = C::t('home_friend')->fetch_all_by_uid_fuid($_G['uid'], $uid);
if(!$friend = $query[0]) {
showmessage('specified_user_is_not_your_friend');
}
$groupselect = array($friend['gid'] => ' checked');
$groups = friend_group_list();
} elseif($op == 'editnote') {
if(submitcheck('editnotesubmit')) {
$note = getstr($_POST['note'], 20);
C::t('home_friend')->update_by_uid_fuid($_G['uid'], $uid, array('note'=>$note));
showmessage('do_success', dreferer(), array('uid'=>$uid, 'note'=>$note), array('showdialog'=>1, 'msgtype' => 2, 'closetime' => true));
}
$query = C::t('home_friend')->fetch_all_by_uid_fuid($_G['uid'], $uid);
if(!$friend = $query[0]) {
showmessage('specified_user_is_not_your_friend');
}
} elseif($op == 'changenum') {
if(submitcheck('changenumsubmit')) {
$num = abs(intval($_POST['num']));
if($num > 9999) $num = 9999;
C::t('home_friend')->update_by_uid_fuid($_G['uid'], $uid, array('num'=>$num));
friend_cache($_G['uid']);
showmessage('do_success', dreferer(), array('fuid'=>$uid, 'num'=>$num), array('showmsg' => true, 'timeout' => 3, 'return'=>1));
}
$query = C::t('home_friend')->fetch_all_by_uid_fuid($_G['uid'], $uid);
if(!$friend = $query[0]) {
showmessage('specified_user_is_not_your_friend');
}
} elseif($op == 'group') {
if(submitcheck('groupsubmin')) {
if(empty($_POST['fuids'])) {
showmessage('please_correct_choice_groups_friend', dreferer());
}
$ids = $_POST['fuids'];
$groupid = intval($_POST['group']);
C::t('home_friend')->update_by_uid_fuid($_G['uid'], $ids, array('gid'=>$groupid));
friend_cache($_G['uid']);
showmessage('do_success', dreferer());
}
$perpage = 50;
$perpage = mob_perpage($perpage);
$page = empty($_GET['page'])?1:intval($_GET['page']);
if($page<1) $page = 1;
$start = ($page-1)*$perpage;
$list = array();
$multi = $wheresql = '';
space_merge($space, 'count');
if($space['friends']) {
$groups = friend_group_list();
$theurl = 'home.php?mod=spacecp&ac=friend&op=group';
$group = !isset($_GET['group'])?'-1':intval($_GET['group']);
if($group > -1) {
$wheresql = "AND main.gid='$group'";
$theurl .= "&group=$group";
}
$count = C::t('home_friend')->fetch_all_search($space['uid'], $group, '', true);
if($count) {
$query = C::t('home_friend')->fetch_all_search($space['uid'], $group, '', false, $start, $perpage, true);
foreach($query as $value) {
$value['uid'] = $value['fuid'];
$value['username'] = $value['fusername'];
$value['group'] = $groups[$value['gid']];
$list[] = $value;
}
}
$multi = multi($count, $perpage, $page, $theurl);
}
$actives = array('group'=>' class="a"');
} elseif($op == 'request') {
if(submitcheck('requestsubmin')) {
showmessage('do_success', dreferer());
}
$maxfriendnum = checkperm('maxfriendnum');
if($maxfriendnum) {
$maxfriendnum = $maxfriendnum + $space['addfriend'];
}
$perpage = 20;
$perpage = mob_perpage($perpage);
$page = empty($_GET['page'])?0:intval($_GET['page']);
if($page<1) $page = 1;
$start = ($page-1)*$perpage;
$list = $ols = array();
$count = C::t('home_friend_request')->count_by_uid($space['uid']);
if($count) {
$fuids = array();
foreach(C::t('home_friend_request')->fetch_all_by_uid($space['uid'], $start, $perpage) as $value) {
$fuids[$value['fuid']] = $value['fuid'];
$list[$value['fuid']] = $value;
}
if (!empty($fuids)) {
foreach(C::app()->session->fetch_all_by_uid($fuids) as $value) {
if(!$value['invisible']) {
$ols[$value['uid']] = 1;
}
}
}
} else {
dsetcookie('promptstate_'.$space['uid'], $space['newprompt'], 31536000);
}
$multi = multi($count, $perpage, $page, "home.php?mod=spacecp&ac=friend&op=request");
$navtitle = lang('core', 'title_friend_request');
} elseif($op == 'groupname') {
$groups = friend_group_list();
$group = intval($_GET['group']);
if(!isset($groups[$group])) {
showmessage('change_friend_groupname_error');
}
space_merge($space, 'field_home');
if(submitcheck('groupnamesubmit')) {
$space['privacy']['groupname'][$group] = getstr($_POST['groupname'], 20);
privacy_update();
showmessage('do_success', dreferer(), array('gid'=>$group), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
}
} elseif($op == 'groupignore') {
$groups = friend_group_list();
$group = intval($_GET['group']);
if(!isset($groups[$group])) {
showmessage('change_friend_groupname_error');
}
space_merge($space, 'field_home');
if(submitcheck('groupignoresubmit')) {
if(isset($space['privacy']['filter_gid'][$group])) {
unset($space['privacy']['filter_gid'][$group]);
$ignore = false;
} else {
$space['privacy']['filter_gid'][$group] = $group;
$ignore = true;
}
privacy_update();
friend_cache($_G['uid']);
showmessage('do_success', dreferer(), array('group' => $group, 'ignore' => $ignore), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
}
} elseif($op == 'blacklist') {
if($_GET['subop'] == 'delete') {
$_GET['uid'] = intval($_GET['uid']);
C::t('home_blacklist')->delete_by_uid_buid($space['uid'], $_GET['uid']);
$count = C::t('home_blacklist')->count_by_uid_buid($space['uid']);
C::t('common_member_count')->update($_G['uid'], array('blacklist' => $count));
showmessage('do_success', "home.php?mod=space&uid={$_G['uid']}&do=friend&view=blacklist&quickforward=1&start={$_GET['start']}");
}
if(submitcheck('blacklistsubmit')) {
$_POST['username'] = trim($_POST['username']);
if(!($tospace = C::t('common_member')->fetch_by_username($_POST['username']))) {
showmessage('space_does_not_exist');
}
if($tospace['uid'] == $space['uid']) {
showmessage('unable_to_manage_self');
}
friend_delete($tospace['uid']);
C::t('home_blacklist')->insert(array('uid'=>$space['uid'], 'buid'=>$tospace['uid'], 'dateline'=>$_G['timestamp']), false, false, true);
$count = C::t('home_blacklist')->count_by_uid_buid($space['uid']);
C::t('common_member_count')->update($_G['uid'], array('blacklist' => $count));
showmessage('do_success', "home.php?mod=space&uid={$_G['uid']}&do=friend&view=blacklist&quickforward=1&start={$_GET['start']}");
}
} elseif($op == 'rand') {
$userlist = $randuids = array();
space_merge($space, 'count');
if($space['friends']<5) {
$userlist = C::app()->session->fetch_member(1, 2, 100);
} else {
$query = C::t('home_friend')->fetch($_G['uid']);
foreach($query as $value) {
$userlist[$value['uid']] = $value['fuid'];
}
}
unset($userlist[$space['uid']]);
$randuids = sarray_rand($userlist, 1);
showmessage('do_success', "home.php?mod=space&quickforward=1&uid=".array_pop($randuids));
} elseif ($op == 'getcfriend') {
$fuid = empty($_GET['fuid']) ? 0 : intval($_GET['fuid']);
$list = array();
if($fuid) {
$friend = $friendlist = array();
$query = C::t('home_friend')->fetch_all_by_uid_common($space['uid'], $fuid);
foreach($query as $value) {
$friendlist[$value['uid']][] = $value['fuid'];
$friend[$value['fuid']] = $value;
}
if($friendlist[$_G['uid']] && $friendlist[$fuid]) {
$cfriend = array_intersect($friendlist[$_G['uid']], $friendlist[$fuid]);
$i = 0;
foreach($cfriend as $key => $uid) {
if(isset($friend[$uid])) {
$list[] = array('uid' => $friend[$uid]['fuid'], 'username' => $friend[$uid]['fusername']);
$i++;
if($i >= 15) break;
}
}
}
}
} elseif($op == 'getinviteuser') {
require_once libfile('function/search');
$perpage = 20;
$username = empty($_GET['username'])?'':searchkey($_GET['username'], "f.fusername LIKE '{text}%'");
$page = empty($_GET['page'])?0:intval($_GET['page']);
$gid = isset($_GET['gid']) ? intval($_GET['gid']) : -1;
if($page<1) $page = 1;
$start = ($page-1) * $perpage;
$json = array();
$wheresql = '';
if($gid > -1) {
$wheresql .= " AND f.gid='$gid'";
}
if(!empty($username)) {
$wheresql .= $username;
}
$count = $count_at = $singlenum = 0;
if($_GET['at'] == 1 && $gid < 0) {
$count_at = C::t('home_follow')->count_by_uid_username($_G['uid'], $_GET['username']);
if($count_at) {
foreach(C::t('home_follow')->fetch_all_by_uid_username($_G['uid'], $_GET['username'], $start, $perpage) as $value) {
$value['fusername'] = daddslashes($value['fusername']);
$value['avatar'] = avatar($value['followuid'], 'small', true);
$singlenum++;
$json[$value['followuid']] = "{$value['followuid']}:{'uid':{$value['followuid']}, 'username':'{$value['fusername']}', 'avatar':'{$value['avatar']}'}";
}
$perpage = $perpage - $singlenum;
$start = max($start - $count_at, 0);
}
}
if($perpage && $gid != -2) {
$count = C::t('home_friend')->fetch_all_search($_G['uid'], $gid, $_GET['username'], true);
if($count) {
$homefriend = C::t('home_friend')->fetch_all_search($_G['uid'], $gid, $_GET['username'], false, $start, $perpage, true);
$usrids = array();
foreach($homefriend as $key=>$usrs) {
$usrids[$key] = $usrs['fuid'];
}
$usernames = C::t('common_member')->fetch_all_username_by_uid($usrids);
foreach($homefriend as $value) {
$value['fusername'] = daddslashes($usernames[$value['fuid']]);
$value['avatar'] = avatar($value['fuid'], 'small', true);
$singlenum++;
$json[$value['fuid']] = "{$value['fuid']}:{'uid':{$value['fuid']}, 'username':'{$value['fusername']}', 'avatar':'{$value['avatar']}'}";
}
}
}
$jsstr = "{'userdata':{".implode(',', $json)."}, 'maxfriendnum':'".($count+$count_at)."', 'singlenum':'$singlenum'}";
} elseif($op == 'search') {
if(strlen($searchkey) < 2) {
showmessage('username_less_two_chars');
}
$list = array();
$list = C::t('common_member')->fetch_all_by_like_username($searchkey, 0, 100);
$navtitle = lang('core', 'title_search_friend');
}
include template('home/spacecp_friend');
?>

View File

@@ -0,0 +1,333 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_index.php 26205 2011-12-05 10:09:32Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$op = in_array($_GET['op'], array('start', 'layout', 'block', 'style', 'diy', 'image', 'getblock', 'edit', 'setmusic', 'getspaceinfo', 'savespaceinfo', 'editnv', 'getpersonalnv')) ? $_GET['op'] : 'start';
require_once libfile('function/space');
require_once libfile('function/portalcp');
if ($op == 'start') {
} elseif ($op == 'layout') {
$layoutarr = getlayout();
} elseif ($op == 'style') {
$themes = gettheme('space');
} elseif ($op == 'block') {
$block = getblockdata();
} elseif ($op == 'diy' || $op == 'image') {
$albumid = empty($_GET['albumid'])?0:intval($_GET['albumid']);
$page = empty($_GET['page'])?1:intval($_GET['page']);
if($page<1) $page=1;
$perpage = 6;
$perpage = mob_perpage($perpage);
$start = ($page-1)*$perpage;
ckstart($start, $perpage);
$albumlist = array();
$query = C::t('home_album')->fetch_all_by_uid($space['uid'], 'updatetime');
foreach($query as $value) {
if (!isset($_GET['albumid']) && empty($albumid)) $albumid = $value['albumid'];
$albumlist[$value['albumid']] = $value;
}
$count = C::t('home_pic')->check_albumpic(0, NULL, $space['uid']);
$albumlist[0] = array(
'uid' => $space['uid'],
'albumid' => 0,
'albumname' => lang('space', 'default_albumname'),
'picnum' => $count
);
if ($albumid > 0) {
if (!isset($albumlist[$albumid])) {
showmessage('to_view_the_photo_does_not_exist');
}
$count = $albumlist[$albumid]['picnum'];
} else {
$wheresql = "albumid='0' AND uid='{$space['uid']}'";
}
$list = array();
if($count) {
$query = C::t('home_pic')->fetch_all_by_albumid($albumid, $start, $perpage, 0, 0, 1, ($albumid > 0 ? 0 : $space['uid']));
foreach($query as $value) {
$value['pic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote']);
$list[] = $value;
}
}
$_GET['ajaxtarget'] = empty($_GET['ajaxtarget']) ? 'diyimages' : $_GET['ajaxtarget'];
$multi = multi($count, $perpage, $page, "home.php?mod=spacecp&ac=index&op=image&albumid=$albumid");
} elseif ($op == 'getblock') {
$blockname = getstr($_GET['blockname'],15);
$blockhtml = '';
if(check_ban_block($name, $space)) {
space_merge($space,'field_home');
$data = getuserdiydata($space);
$blockhtml = getblockhtml($blockname, $data['parameters'][$blockname]);
}
} elseif ($op == 'edit') {
$blockname = getstr($_GET['blockname'],15);
$blockdata = lang('space','blockdata');
if (!empty($blockdata[$blockname]) && check_ban_block($blockname, $space)) {
space_merge($space,'field_home');
$userdiy = getuserdiydata($space);
$para = $userdiy['parameters'][$blockname];
$para['title'] = !isset($para['title']) ? $blockdata[$blockname] : $para['title'];
} else {
showmessage('the_block_is_not_available');
}
} elseif ($op == 'editnv') {
space_merge($space,'field_home');
$blockposition = dunserialize($space['blockposition']);
$personalnv = !empty($blockposition) && isset($blockposition['nv']) ? $blockposition['nv'] : '';
} elseif ($op == 'savespaceinfo') {
space_merge($space,'field_home');
if (submitcheck('savespaceinfosubmit')) {
$spacename = censor(getstr($_POST['spacename'], 30));
$spacedescription = censor(getstr($_POST['spacedescription'], 135));
$setarr = array();
$setarr['spacename'] = $spacename;
$setarr['spacedescription'] = $spacedescription;
C::t('common_member_field_home')->update($_G['uid'], $setarr);
$space['spacename'] = $spacename;
$space['spacedescription'] = $spacedescription;
}
} elseif ($op == 'getspaceinfo') {
space_merge($space,'field_home');
} elseif ($op == 'getpersonalnv') {
space_merge($space,'field_home');
getuserdiydata($space);
$personalnv = isset($_G['blockposition']['nv']) ? $_G['blockposition']['nv'] : '';
if($personalnv && !empty($_GET['show'])) {
$personalnv['nvhidden'] = 0;
}
}
if (submitcheck('blocksubmit')) {
$blockname = getstr($_GET['blockname'],15);
if(check_ban_block($blockname, $space)) {
space_merge($space,'field_home');
$blockdata = dunserialize($space['blockposition']);
$title = censor(getstr($_POST['blocktitle'],50));
$blockdata['parameters'][$blockname]['title'] = $title;
if (in_array($blockname, array('block1', 'block2', 'block3', 'block4', 'block5'))) {
$content = censor(getstr($_POST['content'],1000,0,0,0,1));
$blockdata['parameters'][$blockname]['content'] = $content;
} elseif($blockname == 'profile') {
$blockdata['parameters'][$blockname]['banavatar'] = in_array($_GET['avatar'], array('big', 'middle', 'small')) ? $_GET['avatar'] : 'middle';
} elseif($blockname == 'statistic') {
$blockdata['parameters'][$blockname]['bancredits'] = $_GET['credits'] ? 0 : 1;
$blockdata['parameters'][$blockname]['banfriends'] = $_GET['friends'] ? 0 : 1;
$blockdata['parameters'][$blockname]['banthreads'] = $_GET['threads'] ? 0 : 1;
$blockdata['parameters'][$blockname]['banblogs'] = $_GET['blogs'] ? 0 : 1;
$blockdata['parameters'][$blockname]['banalbums'] = $_GET['albums'] ? 0 : 1;
$blockdata['parameters'][$blockname]['bansharings'] = $_GET['sharings'] ? 0 : 1;
$blockdata['parameters'][$blockname]['banviews'] = $_GET['views'] ? 0 : 1;
} elseif(in_array($blockname, array('personalinfo'))) {
} else {
$shownum = max(1,intval($_POST['shownum']));
if ($shownum <= 20) {
$blockdata['parameters'][$blockname]['shownum'] = $shownum;
}
}
if($blockname == 'blog') {
$blockdata['parameters'][$blockname]['showmessage'] = min(100000, abs(intval($_GET['showmessage'])));
}
$setarr = array();
$setarr['blockposition'] = serialize($blockdata);
C::t('common_member_field_home')->update($space['uid'], $setarr);
showmessage('do_success', 'portal.php?mod=spacecp&ac=index&op=getblock&blockname='.$blockname, array('blockname'=>$blockname));
} else {
showmessage('the_block_is_not_available');
}
}
if (submitcheck('editnvsubmit')) {
$hidden = intval($_POST['nvhidden']);
$nv = array('index', 'feed', 'doing', 'blog', 'album', 'topic', 'share', 'friends', 'wall', 'profile', 'follow');
space_merge($space,'field_home');
$blockdata = dunserialize($space['blockposition']);
$personalnv = array();
$personalnv['nvhidden'] = $hidden;
foreach($nv as $value) {
$namevalue = trim($_POST[$value]);
$personalnv['items'][$value] = getstr($namevalue,15);
$personalnv['banitems'][$value] = empty($_POST['ban'.$value]) ? 0 : 1;
}
$blockdata['nv'] = $personalnv;
$setarr = array();
$setarr['blockposition'] = serialize($blockdata);
C::t('common_member_field_home')->update($space['uid'], $setarr);
showmessage('do_success', 'portal.php?mod=spacecp&ac=index&op=getnv');
}
if (submitcheck('musicsubmit')) {
$blockname = getstr($_GET['blockname'],15);
space_merge($space,'field_home');
$blockdata = dunserialize($space['blockposition']);
if ($_POST['act'] == 'config') {
$config = array (
'showmod' => $_POST['showmod'],
'autorun' => $_POST['autorun'],
'shuffle' => $_POST['shuffle'],
'crontabcolor' => $_POST['crontabcolor'],
'height' => min(9999,abs(intval($_POST['height']))),
);
$blockdata['parameters']['music']['config'] = $config;
$blockdata['parameters']['music']['title']= censor(getstr($_POST['blocktitle'],50));
} elseif ($_POST['act'] == 'addmusic') {
$mp3url = $_POST['mp3url'];
$mp3name = $_POST['mp3name'];
$cdbj = $_POST['cdbj'];
$mp3list = empty($blockdata['parameters']['music']['mp3list']) ? array() : $blockdata['parameters']['music']['mp3list'];
foreach ($mp3url as $key => $value) {
if (!empty($value)) {
if(empty($mp3name[$key])) $mp3name[$key] = substr($value,strrpos($value,'/')+1,strlen($value));
$mp3list[] = array('mp3url'=>$value, 'mp3name'=>censor($mp3name[$key]), 'cdbj'=>$cdbj[$key]);
}
}
$blockdata['parameters']['music']['mp3list'] = $mp3list;
} elseif ($_POST['act'] == 'editlist') {
$mp3url = $_POST['mp3url'];
$mp3name = $_POST['mp3name'];
$cdbj = $_POST['cdbj'];
$mp3list = array();
foreach ($mp3url as $key => $value) {
if (!empty($value)) {
if(empty($mp3name[$key])) $mp3name[$key] = substr($value,strrpos($value,'/')+1,strlen($value));
$mp3list[] = array('mp3url'=>$value, 'mp3name'=>censor($mp3name[$key]), 'cdbj'=>$cdbj[$key]);
}
}
$blockdata['parameters']['music']['mp3list'] = $mp3list;
}
if (empty($blockdata['parameters']['music']['config'])) {
$blockdata['parameters']['music']['config'] = array (
'showmod' => 'default',
'autorun' => 'true',
'shuffle' => 'true',
'crontabcolor' => '#D2FF8C',
'buttoncolor' => '#1F43FF',
'fontcolor' => '#1F43FF',
);
}
$setarr = array();
$setarr['blockposition'] = serialize($blockdata);
C::t('common_member_field_home')->update($space['uid'], $setarr);
showmessage('do_success', 'home.php?mod=spacecp&ac=index&op=getblock&blockname='.$blockname, array('blockname'=>$blockname));
}
if (submitcheck('diysubmit')) {
$blockdata = array();
checksecurity($_POST['spacecss']);
$spacecss = $_POST['spacecss'];
$spacecss = preg_replace("/(\<|\>)/is", '', $spacecss);
$currentlayout = getstr($_POST['currentlayout'],5);
$style = empty($_POST['style'])?'':preg_replace("/[^0-9a-z]/i", '', $_POST['style']);
$layoutdata = $_POST['layoutdata'];
require_once libfile('class/xml');
$layoutdata = xml2array($layoutdata);
if (empty($layoutdata)) showmessage('space_data_format_invalid');
$layoutdata = $layoutdata['diypage'];
if($style && $style != 'uchomedefault') {
$cssfile = DISCUZ_ROOT.'./static/space/'.$style.'/style.css';
if(!file_exists($cssfile)) {
showmessage('theme_does_not_exist');
}
}
space_merge($space, 'field_home');
$blockdata = dunserialize($space['blockposition']);
$blockdata['block'] = $layoutdata;
$blockdata['currentlayout'] = $currentlayout;
$setarr = array();
$setarr['spacecss'] = $spacecss;
$setarr['blockposition'] = serialize($blockdata);
$setarr['theme'] = $style;
C::t('common_member_field_home')->update($space['uid'], $setarr);
showmessage('do_success','home.php?mod=space&uid='.$space['uid'].($_G['adminid'] == 1 && $_G['setting']['allowquickviewprofile'] ? '&view=admin' : ''));
}
if (submitcheck('uploadsubmit')) {
$albumid = $picid = 0;
if(!checkperm('allowupload')) {
echo "<script>";
echo "alert(\"".lang('spacecp', 'not_allow_upload')."\")";
echo "</script>";
exit();
}
$uploadfiles = pic_save($_FILES['attach'], $_POST['albumid'], $_POST['pic_title'], false);
if($uploadfiles && is_array($uploadfiles)) {
$albumid = $uploadfiles['albumid'];
$picid = $uploadfiles['picid'];
$uploadStat = 1;
require_once libfile('function/spacecp');
album_update_pic($albumid);
} else {
$uploadStat = $uploadfiles;
}
$picurl = pic_get($uploadfiles['filepath'], 'album', $uploadfiles['thumb'], $uploadfiles['remote']);
echo "<script>";
if($uploadStat == 1) {
echo "parent.spaceDiy.getdiy('diy', 'albumid', '$albumid');";
echo "parent.spaceDiy.setBgImage('$picurl');";
echo "parent.Util.toggleEle('upload');";
} else {
echo "parent.showDialog('$uploadStat','notice');";
}
echo "</script>";
exit();
}
include_once(template('home/spacecp_index'));
?>

View File

@@ -0,0 +1,279 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_invite.php 25042 2011-10-24 03:27:47Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$creditid = 0;
$creditnum = $_G['group']['inviteprice'];
if($_G['setting']['creditstrans']) {
$creditid = intval($_G['setting']['creditstransextra'][6] ? $_G['setting']['creditstransextra'][6] : $_G['setting']['creditstrans']);
} elseif($creditnum) {
showmessage('trade_credit_invalid', '', array(), array('return' => 1));
}
space_merge($space, 'count');
$baseurl = 'home.php?mod=spacecp&ac=invite';
$siteurl = getsiteurl();
$maxcount = 50;
$config = $_G['setting']['inviteconfig'];
$creditname = $config['inviterewardcredit'];
$allowinvite = ($_G['setting']['regstatus'] > 1 && $creditname && $_G['group']['allowinvite']) ? 1 : 0;
$unit = $_G['setting']['extcredits'][$creditname]['unit'];
$credittitle = $_G['setting']['extcredits'][$creditname]['title'];
$creditname = 'extcredits'.$creditname;
$inviteurl = $invite_code = '';
$creditkey = 'extcredits'.$creditid;
$extcredits = $_G['setting']['extcredits'][$creditid];
$mailvar = array(
'avatar' => avatar($space['uid'], 'middle'),
'uid' => $space['uid'],
'username' => $space['username'],
'sitename' => $_G['setting']['sitename'],
'siteurl' => $siteurl
);
if(!$creditnum) {
$inviteurl = getinviteurl(0, 0);
}
if(!$allowinvite) {
showmessage('close_invite', '', array(), $_G['inajax'] ? array('showdialog'=>1, 'showmsg' => true, 'closetime' => true) : array());
}
if(submitcheck('emailinvite')) {
if(!$_G['group']['allowmailinvite']) {
showmessage('mail_invite_not_allow', $baseurl);
}
$_POST['email'] = str_replace("\n", ',', $_POST['email']);
$newmails = array();
$mails = explode(",", $_POST['email']);
foreach ($mails as $value) {
$value = trim($value);
if(isemail($value)) {
$newmails[] = $value;
}
}
$newmails = array_unique($newmails);
$invitenum = count($newmails);
if($invitenum < 1) {
showmessage('mail_can_not_be_empty', $baseurl);
}
$msetarr = array();
if($creditnum) {
$allcredit = $invitenum * $creditnum;
if($space[$creditkey] < $allcredit) {
showmessage('mail_credit_inadequate', $baseurl);
}
foreach($newmails as $value) {
$code = strtolower(random(6));
$setarr = array(
'uid' => $_G['uid'],
'code' => $code,
'email' => daddslashes($value),
'type' => 1,
'inviteip' => $_G['clientip'],
'dateline' => $_G['timestamp'],
'status' => 3,
'endtime' => ($_G['group']['maxinviteday']?($_G['timestamp']+$_G['group']['maxinviteday']*24*3600):0)
);
$id = C::t('common_invite')->insert($setarr, true);
$mailvar['inviteurl'] = getinviteurl($id, $code);
createmail($value, $mailvar);
}
updatemembercount($_G['uid'], array($creditkey => "-$allcredit"));
} else {
$mailvar['inviteurl'] = $inviteurl;
foreach($newmails as $value) {
createmail($value, $mailvar);
}
}
showmessage('send_result_succeed',$baseurl);
} else if(submitcheck('invitesubmit')) {
$invitenum = intval($_POST['invitenum']);
if($invitenum < 1) $invitenum = 1;
if($_G['group']['maxinvitenum']) {
$daytime = $_G['timestamp'] - 24*3600;
$invitecount = C::t('common_invite')->count_by_uid_dateline($_G['uid'], $daytime);
if($invitecount + $invitenum > $_G['group']['maxinvitenum']) {
showmessage('max_invitenum_error', NULL, array('maxnum'=>$_G['group']['maxinvitenum']), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
}
}
$allcredit = $invitenum * $creditnum;
if($space[$creditkey] < $allcredit) {
showmessage('mail_credit_inadequate', $baseurl, array(), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
}
$havecode = false;
$dateline = $_G['timestamp'];
for($i=0; $i<$invitenum; $i++) {
$code = strtolower(random(6));
$havecode = true;
$invitedata = array(
'uid' => $_G['uid'],
'code' => $code,
'dateline' => $dateline,
'endtime' => $_G['group']['maxinviteday'] ? ($_G['timestamp']+$_G['group']['maxinviteday']*24*3600) : 0,
'inviteip' => $_G['clientip']
);
C::t('common_invite')->insert($invitedata);
}
if($havecode) {
require_once libfile('class/credit');
require_once libfile('function/credit');
$creditobj = new credit();
credit_log($_G['uid'], 'INV', $_G['uid'], array($creditkey => 0-$allcredit));
$creditobj->updatemembercount(array($creditkey => 0-$allcredit), $_G['uid']);
}
showmessage('do_success', $baseurl, array('deduction' => $allcredit, 'dateline' => $dateline), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true, 'return' => false));
}
if($_GET['op'] == 'resend') {
$id = $_GET['id'] ? intval($_GET['id']) : 0;
if(submitcheck('resendsubmit')) {
if(empty($id)) {
showmessage('send_result_resend_error', $baseurl);
}
if($value = C::t('common_invite')->fetch_by_id_uid($id, $_G['uid'])) {
if($creditnum) {
$inviteurl = getinviteurl($value['id'], $value['code']);
}
$mailvar['inviteurl'] = $inviteurl;
createmail($value['email'], $mailvar);
showmessage('send_result_succeed', dreferer(), array('id' => $id), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
} else {
showmessage('send_result_resend_error', $baseurl, array(), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
}
}
} elseif($_GET['op'] == 'delete') {
$id = $_GET['id'] ? intval($_GET['id']) : 0;
if(empty($id)) {
showmessage('there_is_no_record_of_invitation_specified', $baseurl);
}
if($value = C::t('common_invite')->fetch_by_id_uid($id, $_G['uid'])) {
if(submitcheck('deletesubmit')) {
C::t('common_invite')->delete($id);
showmessage('do_success', dreferer(), array('id' => $id), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
}
} else {
showmessage('there_is_no_record_of_invitation_specified', $baseurl, array(), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
}
} elseif ($_GET['op'] == 'showinvite') {
foreach(C::t('common_invite')->fetch_all_by_uid($_G['uid']) as $value) {
if(!$value['fuid'] && !$value['type']) {
$inviteurl = getinviteurl($value['id'], $value['code']);
$list[$value['code']] = $inviteurl;
}
}
} else {
$list = $flist = $dels = array();
$invitedcount = $count = 0;
foreach(C::t('common_invite')->fetch_all_by_uid($_G['uid']) as $value) {
if($value['fuid']) {
$flist[] = $value;
$invitedcount++;
} else {
if($_G['timestamp'] > $value['endtime']) {
$dels[] = $value['id'];
continue;
}
$inviteurl = getinviteurl($value['id'], $value['code']);
if($value['type']) {
$maillist[] = array(
'email' => $value['email'],
'url' => $inviteurl,
'id' => $value['id']
);
} else {
$list[$value['code']] = $inviteurl;
$count++;
}
}
}
if($dels) {
C::t('common_invite')->delete($dels);
}
$uri = $_SERVER['REQUEST_URI']?$_SERVER['REQUEST_URI']:($_SERVER['PHP_SELF']?$_SERVER['PHP_SELF']:$_SERVER['SCRIPT_NAME']);
$uri = substr($uri, 0, strrpos($uri, '/')+1);
$actives = array('invite'=>' class="a"');
}
$navtitle = lang('core', 'title_invite_friend');
include template('home/spacecp_invite');
function createmail($mail, $mailvar) {
global $_G;
$mailvar['saymsg'] = empty($_POST['saymsg'])?'':getstr($_POST['saymsg'], 500);
require_once libfile('function/mail');
$tplarray = array(
'tpl' => 'invitemail',
'var' => $mailvar,
'svar'=> $mailvar
);
if(!sendmail($mail, $tplarray)) {
runlog('sendmail', "$mail sendmail failed.");
}
}
function getinviteurl($inviteid, $invitecode) {
global $_G;
if($inviteid && $invitecode) {
$inviteurl = getsiteurl()."home.php?mod=invite&amp;id={$inviteid}&amp;c={$invitecode}";
} else {
$invite_code = helper_invite::generate_key($_G['uid']);
$inviteurl = getsiteurl()."home.php?mod=invite&amp;u={$_G['uid']}&amp;c=$invite_code";
}
return $inviteurl;
}
?>

View File

@@ -0,0 +1,122 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_magic.php 26763 2011-12-22 09:28:20Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['magicstatus']) {
showmessage('magics_close');
}
$space['credit'] = $space['credits'];
$op = empty($_GET['op']) ? "view" : $_GET['op'];
$mid = empty($_GET['mid']) ? '' : trim($_GET['mid']);
if(!checkperm('allowmagics')) {
showmessage('magic_groupid_not_allowed');
}
if($op == 'cancelflicker') {
$mid = 'flicker';
$_GET['idtype'] = 'cid';
$_GET['id'] = intval($_GET['id']);
$value = C::t('home_comment')->fetch_comment($_GET['id'], $_G['uid']);
if(!$value || !$value['magicflicker']) {
showmessage('no_flicker_yet');
}
if(submitcheck('cancelsubmit')) {
C::t('home_comment')->update_comment('', array('magicflicker'=>0), $_G['uid']);
showmessage('do_success', dreferer(), array(), array('showdialog' => 1, 'closetime' => true));
}
} elseif($op == 'cancelcolor') {
$mid = 'color';
$_GET['id'] = intval($_GET['id']);
$mapping = array('blogid'=>'blogfield', 'tid'=>'thread');
$tablename = $mapping[$_GET['idtype']];
if(empty($tablename)) {
showmessage('no_color_yet');
}
$value = C::t($tablename)->fetch($_GET['id']);
if(!$value || $value['uid'] != $_G['uid'] || !$value['magiccolor']) {
showmessage('no_color_yet');
}
if(submitcheck('cancelsubmit')) {
DB::update($tablename, array('magiccolor'=>0), array($_GET['idtype']=>$_GET['id']));
$feed = C::t('home_feed')->fetch_feed($_GET['id'], $_GET['idtype']);
if($feed) {
$feed['body_data'] = dunserialize($feed['body_data']);
if($feed['body_data']['magic_color']) {
unset($feed['body_data']['magic_color']);
}
$feed['body_data'] = serialize($feed['body_data']);
C::t('home_feed')->update_feed('', array('body_data'=>$feed['body_data']), '', '', $feed['feedid']);
}
showmessage('do_success', dreferer(), 0);
}
} elseif($op == 'receivegift') {
$uid = intval($_GET['uid']);
$mid = 'gift';
$memberfieldhome = C::t('common_member_field_home')->fetch($uid);
$info = $memberfieldhome['magicgift'] ? dunserialize($memberfieldhome['magicgift']) : array();
unset($memberfieldhome);
if(!empty($info['left'])) {
$info['receiver'] = is_array($info['receiver']) ? $info['receiver'] : array();
if(in_array($_G['uid'], $info['receiver'])) {
showmessage('haved_red_bag');
}
$percredit = min($info['left'], $info['percredit']);
$info['receiver'][] = $_G['uid'];
$info['left'] = $info['left'] - $percredit;
C::t('common_member_field_home')->update($uid, array('magicgift' => ($info['left'] > 0 ? serialize($info) : '')));
$credittype = '';
if(preg_match('/^extcredits[1-8]$/', $info['credittype'])) {
$extcredits = str_replace('extcredits', '', $info['credittype']);
updatemembercount($_G['uid'], array($extcredits => $percredit), 1, 'AGC', $info['magicid']);
$credittype = $_G['setting']['extcredits'][$extcredits]['title'];
}
showmessage('haved_red_bag_gain', dreferer(), array('percredit' => $percredit, 'credittype' => $credittype), array('showdialog' => 1, 'locationtime' => true));
}
showmessage('space_no_red_bag', dreferer(), array(), array('showdialog' => 1, 'locationtime' => true));
} elseif($op == 'retiregift') {
$mid = 'gift';
$memberfieldhome = C::t('common_member_field_home')->fetch($_G['uid']);
$info = $memberfieldhome['magicgift'] ? dunserialize($memberfieldhome['magicgift']) : array();
unset($memberfieldhome);
$leftcredit = intval($info['left']);
if($leftcredit<=0) {
C::t('common_member_field_home')->update($_G['uid'], array('magicgift' => ''));
showmessage('red_bag_no_credits');
}
$extcredits = str_replace('extcredits', '', $info['credittype']);
$credittype = $_G['setting']['extcredits'][$extcredits]['title'];
if(submitcheck('cancelsubmit')) {
C::t('common_member_field_home')->update($_G['uid'], array('magicgift' => ''));
if(preg_match('/^extcredits[1-8]$/', $info['credittype'])) {
updatemembercount($_G['uid'], array($extcredits => $leftcredit), 1, 'RGC', $info['magicid']);
}
showmessage('return_red_bag', dreferer(), array('leftcredit' => $leftcredit, 'credittype' => $credittype), array('showdialog' => 1, 'locationtime' => true));
}
}
include_once template('home/spacecp_magic');
?>

View File

@@ -0,0 +1,30 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_payment.php 36342 2021-05-17 15:26:19Z dplugin $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$operation = in_array($_GET['op'], array('order', 'pay')) ? trim($_GET['op']) : 'order';
$opactives = array($operation => ' class="a"');
if($_G['setting']['ec_ratio']) {
$is_enable_pay = payment::enable();
} else {
$is_enable_pay = false;
}
if(!$_G['setting']['ec_ratio'] || !$is_enable_pay) {
showmessage('action_closed', null);
}
include_once libfile('spacecp/payment_' . $operation, 'include');
?>

View File

@@ -0,0 +1,84 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_payment_order.php 36342 2021-05-17 15:26:53Z dplugin $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$page = empty($_GET['page']) ? 1 : intval($_GET['page']);
if($page < 1) {
$page = 1;
}
$perpage = 20;
$start = ($page - 1) * $perpage;
$gets = array(
'mod' => 'spacecp',
'ac' => 'payment',
'starttime' => $_GET['starttime'],
'endtime' => $_GET['endtime'],
'optype' => $_GET['optype']
);
$theurl = 'home.php?' . url_implode($gets);
$multi = '';
$endunixstr = $beginunixstr = 0;
if($_GET['starttime']) {
$beginunixstr = strtotime($_GET['starttime']);
$_GET['starttime'] = dgmdate($beginunixstr, 'Y-m-d');
}
if($_GET['endtime']) {
$endunixstr = strtotime($_GET['endtime'] . ' 23:59:59');
$_GET['endtime'] = dgmdate($endunixstr, 'Y-m-d');
}
if($beginunixstr && $endunixstr && $endunixstr < $beginunixstr) {
showmessage('start_time_is_greater_than_end_time');
}
$payment_type_data = C::t('common_payment_order')->fetch_type_all($_G['uid']);
$optype = '';
if($_GET['optype'] && in_array($_GET['optype'], array_keys($payment_type_data))) {
$optype = $_GET['optype'];
}
$count = C::t('common_payment_order')->count_by_search($_G['uid'], $optype, $beginunixstr, $endunixstr);
$order_list = array();
if($count) {
foreach(C::t('common_payment_order')->fetch_all_by_search($_G['uid'], $optype, $_GET['starttime'], $_GET['endtime'], '', '', '', $start, $perpage) as $order) {
$order['type_name'] = dhtmlspecialchars($order['type_name']);
$order['amount'] = number_format($order['amount'] / 100, 2, '.', ',');
$order['subject'] = dhtmlspecialchars($order['subject']);
$order['description'] = dhtmlspecialchars($order['description']);
$order['dateline'] = dgmdate($order['dateline'], 'Y-m-d H:i:s');
$status = $order['status'];
if(!$order['status'] && $order['expire_time'] < time()) {
$status = 2;
}
$order['status'] = $status;
$order['status_name'] = lang('spacecp', 'payment_status_' . $status);
$order_list[] = $order;
}
}
if($count) {
$multi = multi($count, $perpage, $page, $theurl);
}
$optypehtml = '<select id="optype" name="optype" class="ps" width="168">';
$optypehtml .= '<option value="">' . lang('spacecp', 'logs_select_operation') . '</option>';
foreach($payment_type_data as $type => $title) {
$optypehtml .= '<option value="' . $type . '"' . ($type == $_GET['optype'] ? ' selected="selected"' : '') . '>' . $title . '</option>';
}
$optypehtml .= '</select>';
include template('home/spacecp_payment_order');
?>

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: spacecp_payment_pay.php 36342 2021-05-17 15:27:15Z dplugin $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$order_id = intval($_GET['order_id']);
if(!$order_id) {
showmessage('payment_order_no_exist', '', array(), array('showdialog' => true));
}
$order = C::t('common_payment_order')->fetch($order_id);
if(!$order || $order['expire_time'] < time() || ($order['uid'] && $_G['uid'] != $order['uid'])) {
showmessage('payment_order_no_exist', '', array(), array('showdialog' => true));
}
if($order['status']) {
$return_url = $order['return_url'];
if(!$return_url) {
$return_url = $_G['siteurl'] . 'home.php?mod=spacecp&ac=payment';
}
showmessage('payment_succeed', $return_url, array(), array('alert' => 'right'));
}
if(submitcheck('paysubmit')) {
$pay_channel = daddslashes($_GET['pay_channel']);
$payclass = payment::get($pay_channel);
if(!$payclass) {
showmessage('payment_type_no_exist', $_G['siteurl'] . 'home.php?mod=spacecp&ac=payment&op=pay&order_id=' . $order_id, array(), array('showdialog' => true, 'locationtime' => 3));
}
if($pay_channel == 'qpay' && checkmobile() && strpos($_SERVER['HTTP_USER_AGENT'], ' QQ') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'MQQBrowser') !== false) {
$ec_qpay = C::t('common_setting')->fetch_setting('ec_qpay', true);
if($ec_qpay['jsapi']) {
$result = $payclass->pay_jsapi($order);
if($result['code'] == 200) {
$prepay_id = $result['prepay_id'];
$title = dhtmlspecialchars($order['subject']);
include template('home/spacecp_payment_qpayjsapi');
exit();
}
}
}
if($pay_channel == 'wechat' && checkmobile() && strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) {
$redirect_uri = $_G['siteurl'] . 'home.php?mod=spacecp&ac=payment&op=pay&sop=wxjsapi&order_id=' . $order_id;
$state = md5($order_id . $order['dateline']);
$pay_url = $payclass -> wechat_authorize($redirect_uri, $state);
dheader('Location: ' . $pay_url);
} else {
$result = $payclass->pay($order);
if($result['code'] != 200) {
showmessage($result['message'], $_G['siteurl'] . 'home.php?mod=spacecp&ac=payment&op=pay&order_id=' . $order_id, array(), array('showdialog' => true, 'locationtime' => 3));
}
$pay_url = $result['url'];
include template('home/spacecp_payment_redirect');
}
} elseif($_GET['sop'] == 'wxjsapi') {
$code = daddslashes($_GET['code']);
$state = daddslashes($_GET['state']);
if(!$code || !$state || !$order_id || $state != md5($order_id . $order['dateline'])) {
exit('Access Denied');
}
$payment = payment::get('wechat');
$result = $payment->wechat_access_token_by_code($code);
$result = json_decode($result, true);
if(!$result['openid']) {
if(strtoupper($_G['charset']) != 'UTF-8') {
$result['errmsg'] = diconv($result['errmsg'], 'UTF-8', $_G['charset']);
}
showmessage($result['errmsg'], $order['return_url'], array(), array('showdialog' => true, 'locationtime' => 3));
}
$result = $payment->pay_jsapi($order, $result['openid']);
if($result['code'] != 200) {
showmessage($result['message'], $order['return_url'], array(), array('showdialog' => true, 'locationtime' => 3));
}
$jsapidata = $payment->wechat_jsapidata($result['url']);
$title = dhtmlspecialchars($order['subject']);
include template('home/spacecp_payment_wxjsapi');
} elseif($_GET['sop'] == 'status') {
exit();
} else {
$order['subject'] = dhtmlspecialchars($order['subject']);
$order['description'] = dhtmlspecialchars($order['description']);
if($order['amount_fee']) {
$order['total_amount'] = number_format((intval($order['amount']) + intval($order['amount_fee'])) / 100, '2', '.', ',');
}
$order['amount'] = number_format($order['amount'] / 100, '2', '.', ',');
$pay_channel_list = array();
$channels = payment::channels();
foreach($channels as $channel) {
if($channel['enable']) {
$pay_channel_list[] = $channel;
}
}
include template('home/spacecp_payment_pay');
}
?>

View File

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

View File

@@ -0,0 +1,545 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_pm.php 35056 2014-11-03 08:01:19Z hypowang $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$pmid = empty($_GET['pmid'])?0:floatval($_GET['pmid']);
$uid = empty($_GET['uid'])?0:intval($_GET['uid']);
$plid = empty($_GET['plid'])?0:intval($_GET['plid']);
$opactives['pm'] = 'class="a"';
if($uid) {
$touid = $uid;
} else {
$touid = empty($_GET['touid'])?0:intval($_GET['touid']);
}
$daterange = empty($_GET['daterange'])?1:intval($_GET['daterange']);
loaducenter();
if($_GET['op'] == 'checknewpm') {
header('Content-Type: text/javascript');
if($_G['uid'] && !getstatus($_G['member']['newpm'], 1)) {
$ucnewpm = intval(uc_pm_checknew($_G['uid']));
$newpm = setstatus(1, $ucnewpm ? 1 : 0, $_G['member']['newpm']);
if($_G['member']['newpm'] != $newpm) {
C::t('common_member')->update($_G['uid'], array('newpm' => $newpm));
}
}
dsetcookie('checkpm', 1, 30);
exit();
} elseif($_GET['op'] == 'getpmuser') {
$otherpm = $json = array();
$result = uc_pm_list($_G['uid'], 1, 30, 'inbox', 'privatepm');
foreach($result['data'] as $key => $value) {
$value['lastauthor'] = daddslashes($value['lastauthor']);
$value['avatar'] = avatar($value['lastauthorid'], 'small', true);
if($value['isnew']) {
$json[$value['lastauthorid']] = "{$value['lastauthorid']}:{'uid':{$value['lastauthorid']}, 'username':'{$value['lastauthor']}', 'avatar':'{$value['avatar']}', 'plid':{$value['plid']}, 'isnew':{$value['isnew']}, 'daterange':{$value['daterange']}";
} else {
$otherpm[$value['lastauthorid']] = "{$value['lastauthorid']}:{'uid':{$value['lastauthorid']}, 'username':'{$value['lastauthor']}', 'avatar':'{$value['avatar']}', 'plid':{$value['plid']}, 'isnew':{$value['isnew']}, 'daterange':{$value['daterange']}";
}
}
if(!empty($otherpm)) {
$json = array_merge($json, $otherpm);
}
$jsstr = "{'userdata':{".implode(',', $json)."}}";
} elseif($_GET['op'] == 'showmsg') {
$msgonly = empty($_GET['msgonly']) ? 0 : intval($_GET['msgonly']);
$touid = empty($_GET['touid']) ? 0: intval($_GET['touid']);
$daterange = empty($_GET['daterange']) ? 1 : intval($_GET['daterange']);
$result = uc_pm_view($_G['uid'], 0, $touid, $daterange, 0, 0, 0, 0);
$msglist = array();
$msguser = $messageappend = '';
$online = 0;
foreach($result as $key => $value) {
if($value['authorid'] != $_G['uid']) {
$msguser = $value['author'];
}
$daykey = dgmdate($value['dateline'], 'Y-m-d');
$msglist[$daykey][$key] = $value;
}
if($touid && empty($msguser)) {
$member = getuserbyuid($touid);
$msguser = $member['username'];
}
if(!$msgonly) {
$online = C::app()->session->fetch_by_uid($touid) ? 1 : 0;
if($_G['member']['newpm']) {
$newpm = setstatus(1, 0, $_G['member']['newpm']);
C::t('common_member')->update($_G['uid'], array('newpm' => $newpm));
uc_pm_ignore($_G['uid']);
}
}
if(!empty($_GET['tradeid'])) {
$trade = C::t('forum_trade')->fetch_goods(0, $_GET['tradeid']);
if($trade) {
$messageappend = dhtmlspecialchars('[url='.$_G['siteurl'].'forum.php?mod=viewthread&tid='.$trade['tid'].'&do=tradeinfo&pid='.$trade['pid'].'][b]'.$trade['subject'].'[/b][/url]');
}
} elseif(!empty($_GET['commentid'])) {
$comment = C::t('forum_postcomment')->fetch($_GET['commentid']);
if($comment) {
$comment['comment'] = str_replace(array('[b]', '[/b]', '[/color]'), array(''), preg_replace("/\[color=([#\w]+?)\]/i", '', strip_tags($comment['comment'])));
$messageappend = dhtmlspecialchars('[url='.$_G['siteurl'].'forum.php?mod=redirect&goto=findpost&pid='.$comment['pid'].'&ptid='.$comment['tid'].'][b]'.lang('spacecp', 'pm_comment').'[/b][/url][quote]'.$comment['comment'].'[/quote]');
}
} elseif(!empty($_GET['tid']) && !empty($_GET['pid'])) {
$thread = C::t('forum_thread')->fetch_thread($_GET['tid']);
if($thread) {
$messageappend = dhtmlspecialchars('[url='.$_G['siteurl'].'forum.php?mod=redirect&goto=findpost&pid='.intval($_GET['pid']).'&ptid='.$thread['tid'].'][b]'.lang('spacecp', 'pm_thread_about', array('subject' => $thread['subject'])).'[/b][/url]');
}
}
} elseif($_GET['op'] == 'showchatmsg') {
$perpage = 50;
$perpage = mob_perpage($perpage);
$page = empty($_GET['page']) ? ceil($count/$perpage) : intval($_GET['page']);
$list = uc_pm_view($_G['uid'], 0, $plid, 5, ceil($count/$perpage)-$page+1, $perpage, 1, 1);
} elseif($_GET['op'] == 'delete') {
if($_GET['formhash'] != formhash()) {
showmessage('delete_pm_error_option');
}
$gpmid = is_array($_GET['deletepm_gpmid']) ? $_GET['deletepm_gpmid'] : 0;
$deluid = is_array($_GET['deletepm_deluid']) ? $_GET['deletepm_deluid'] : 0;
$delpmid = is_array($_GET['deletepm_pmid']) ? $_GET['deletepm_pmid'] : 0;
$delplid = is_array($_GET['deletepm_delplid']) ? $_GET['deletepm_delplid'] : 0;
$quitplid = is_array($_GET['deletepm_quitplid']) ? $_GET['deletepm_quitplid'] : 0;
if(empty($gpmid) && empty($deluid) && empty($delpmid) && empty($delplid) && empty($quitplid)) {
showmessage('delete_pm_error_option');
}
if(submitcheck('deletesubmit', 1)) {
$flag = true;
if(!empty($gpmid)) {
$return = C::t('common_member_grouppm')->update($_G['uid'], $gpmid, array('status' => -1));
$returnurl = 'home.php?mod=space&do=pm&filter=announcepm';
if(!$return) {
$flag = false;
}
}
if(!empty($deluid)) {
$return = uc_pm_deleteuser($_G['uid'], $deluid);
$returnurl = 'home.php?mod=space&do=pm&filter=privatepm';
if($return <= 0) {
$flag = false;
}
}
if(!empty($delpmid)) {
$return = uc_pm_delete($_G['uid'], 'inbox', $delpmid[0]);
$returnurl = 'home.php?mod=space&do=pm&subop=view&touid='.$touid;
if($return <= 0) {
$flag = false;
}
}
if(!empty($delplid)) {
$return = uc_pm_deletechat($_G['uid'], $delplid, 1);
$returnurl = 'home.php?mod=space&do=pm&filter=privatepm';
if(!$return) {
$flag = false;
}
}
if(!empty($quitplid)) {
$return = uc_pm_deletechat($_G['uid'], $quitplid);
$returnurl = 'home.php?mod=space&do=pm&filter=privatepm';
if(!$return) {
$flag = false;
}
}
if($flag) {
showmessage('delete_pm_success', $returnurl);
} else {
showmessage('this_message_could_note_be_option');
}
}
} elseif($_GET['op'] == 'send') {
$waittime = interval_check('post');
if($waittime > 0) {
showmessage('message_can_not_send_2', '', array(), array('return' => true));
}
cknewuser();
if(!checkperm('allowsendpm')) {
showmessage('no_privilege_sendpm', '', array(), array('return' => true));
}
if($touid) {
if(isblacklist($touid)) {
showmessage('is_blacklist', '', array(), array('return' => true));
}
}
if(submitcheck('pmsubmit')) {
if(!empty($_POST['username'])) {
$_POST['users'][] = $_POST['username'];
}
$users = empty($_POST['users']) ? array() : $_POST['users'];
$type = intval($_POST['type']);
$coef = 1;
if(!empty($users)) {
$coef = count($users);
}
!($_G['group']['exempt'] & 1) && checklowerlimit('sendpm', 0, $coef);
$message = (!empty($_POST['messageappend']) ? $_POST['messageappend']."\n" : '').trim($_POST['message']);
if(empty($message)) {
showmessage('unable_to_send_air_news', '', array(), array('return' => true));
}
$message = censor($message);
loadcache(array('smilies', 'smileytypes'));
foreach($_G['cache']['smilies']['replacearray'] AS $key => $smiley) {
$_G['cache']['smilies']['replacearray'][$key] = '[img]'.$_G['siteurl'].'static/image/smiley/'.$_G['cache']['smileytypes'][$_G['cache']['smilies']['typearray'][$key]]['directory'].'/'.$smiley.'[/img]';
}
$message = preg_replace($_G['cache']['smilies']['searcharray'], $_G['cache']['smilies']['replacearray'], $message);
$subject = '';
if($type == 1) {
$subject = dhtmlspecialchars(trim($_POST['subject']));
}
include_once libfile('function/friend');
$return = 0;
if($touid || $pmid) {
if($touid) {
if(($value = getuserbyuid($touid))) {
$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, $type);
} else {
showmessage('message_can_not_send_onlyfriend', '', array(), array('return' => true));
}
} else {
showmessage('message_bad_touid', '', array(), array('return' => true));
}
} else {
$topmuid = intval($_GET['topmuid']);
$return = sendpm($topmuid, $subject, $message, '', $pmid, 0);
}
} elseif($users) {
$newusers = $uidsarr = $membersarr = array();
if($users) {
$membersarr = C::t('common_member')->fetch_all_by_username($users);
foreach($membersarr as $aUsername=>$aUser) {
$uidsarr[] = $aUser['uid'];
}
}
if(empty($membersarr)) {
showmessage('message_bad_touser', '', array(), array('return' => true));
}
if(isset($membersarr[$_G['uid']])) {
showmessage('message_can_not_send_to_self', '', array(), array('return' => true));
}
friend_check($uidsarr);
foreach($membersarr as $key => $value) {
$value['onlyacceptfriendpm'] = $value['onlyacceptfriendpm'] ? $value['onlyacceptfriendpm'] : ($_G['setting']['onlyacceptfriendpm'] ? 1 : 2);
if($_G['group']['allowsendallpm'] || $value['onlyacceptfriendpm'] == 2 || ($value['onlyacceptfriendpm'] == 1 && $_G['home_friend_'.$value['uid'].'_'.$_G['uid']])) {
$newusers[$value['uid']] = $value['username'];
unset($users[array_search($value['username'], $users)]);
}
}
if(empty($newusers)) {
showmessage('message_can_not_send_onlyfriend', '', array(), array('return' => true));
}
foreach($newusers as $key=>$value) {
if(isblacklist($key)) {
showmessage('is_blacklist', '', array(), array('return' => true));
}
}
$coef = count($newusers);
$return = sendpm(implode(',', $newusers), $subject, $message, '', 0, 1, $type);
} else {
showmessage('message_can_not_send_9', '', 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));
!($_G['group']['exempt'] & 1) && updatecreditbyaction('sendpm', 0, array(), '', $coef);
if(!empty($newusers)) {
if($type == 1) {
$returnurl = 'home.php?mod=space&do=pm&filter=privatepm';
} else {
$returnurl = 'home.php?mod=space&do=pm';
}
$users = is_array($users) ? $users : array($users);
$newusers = is_array($newusers) ? $newusers : array($newusers);
showmessage(count($users) ? 'message_send_result' : 'do_success', $returnurl, array('users' => implode(',', $users), 'succeed' => count($newusers)));
} else {
if(!defined('IN_MOBILE')) {
showmessage('do_success', 'home.php?mod=space&do=pm&subop=view&touid='.$touid, array('pmid' => $return), $_G['inajax'] ? array('msgtype' => 3, 'showmsg' => false) : array());
} else {
showmessage('do_success', 'home.php?mod=space&do=pm&subop=view'.(intval($_POST['touid']) ? '&touid='.intval($_POST['touid']) : ( intval($_POST['plid']) ? '&plid='.intval($_POST['plid']).'&daterange=1&type=1' : '' )));
}
}
} else {
if(in_array($return, range(-16, -1))) {
showmessage('message_can_not_send_'.abs($return));
} else {
showmessage('message_can_not_send', '', array(), array('return' => true));
}
}
}
} elseif($_GET['op'] == 'ignore') {
if(submitcheck('ignoresubmit')) {
$single = intval($_GET['single']);
if($single) {
uc_pm_blackls_add($_G['uid'], $_POST['ignoreuser']);
showmessage('do_success', dreferer(), array(), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
} else {
uc_pm_blackls_set($_G['uid'], $_POST['ignorelist']);
showmessage('do_success', 'home.php?mod=space&do=pm&view=ignore', array(), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
}
}
} elseif($_GET['op'] == 'setting') {
if(submitcheck('settingsubmit')) {
if(!(intval($_GET['onlyacceptfriendpm']) && intval($_GET['onlyacceptfriendpm']) == $_GET['onlyacceptfriendpm'])) {
showmessage('pm_onlyacceptfriend_error', 'home.php?mod=space&do=pm&subop=setting');
}
uc_pm_blackls_set($_G['uid'], $_POST['ignorelist']);
$setarr['onlyacceptfriendpm'] = $_GET['onlyacceptfriendpm'];
C::t('common_member')->update($_G['uid'], $setarr);
showmessage('do_success_pm', 'home.php?mod=space&do=pm&subop=setting');
}
} elseif($_GET['op'] == 'pm_report') {
$waittime = interval_check('post');
if($waittime > 0) {
showmessage('operating_too_fast', '', array('waittime' => $waittime), array('return' => true));
}
if(!$pmid) {
showmessage('pm_report_error_nopm');
}
if($pmid && submitcheck('pmreportsubmit', 1)) {
$pms = uc_pm_view($_G['uid'], $pmid);
$pm = $pms[0];
if(empty($pm)) {
showmessage('pm_report_error_nopm');
}
if($pm['authorid'] == $_G['uid'] || !$pm['authorid']) {
showmessage('pm_report_error_nome');
}
$pmreportuser = explode(',', $_G['setting']['pmreportuser']);
if(empty($pmreportuser)) {
showmessage('pm_report_error_nopmreportuser');
}
$pmreportcontent = lang('spacecp', 'pm_report_content', array('reporterid' => $_G['uid'], 'reportername' => $_G['username'], 'uid' => $pm['authorid'], 'username' => $pm['author'], 'message' => $pm['message']));
foreach($pmreportuser as $key => $value) {
notification_add($value, 'pmreport', 'pmreportcontent', array('pmreportcontent' => $pmreportcontent), 0);
}
showmessage('do_success', dreferer(), array(), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
}
} elseif($_GET['op'] == 'pm_ignore') {
$waittime = interval_check('post');
if($waittime > 0) {
showmessage('operating_too_fast', '', array('waittime' => $waittime), array('return' => true));
}
$username = $_GET['username'];
if(!$username || !uc_get_user(addslashes($username))) {
showmessage('pm_ignore_error_nopm');
}
if(submitcheck('pmignoresubmit')) {
uc_pm_blackls_add($_G['uid'], addslashes($username));
showmessage('do_success', dreferer(), array(), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
}
} elseif($_GET['op'] == 'kickmember') {
$memberuid = intval($_GET['memberuid']);
if(!$memberuid) {
showmessage('pm_kickmember_error_nopm');
}
if(submitcheck('pmkickmembersubmit')) {
uc_pm_kickchatpm($plid, $_G['uid'], $memberuid);
showmessage('do_success', dreferer(), array(), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true, 'locationtime' => 3));
}
} elseif($_GET['op'] == 'appendmember') {
$memberusername = trim($_GET['memberusername']);
$members = array();
if($memberusername) {
$members = C::t('common_member')->fetch_all_by_username(explode(',', $memberusername));
}
if(empty($members)) {
showmessage('pm_appendkmember_error_nopm');
}
if(submitcheck('pmappendmembersubmit')) {
include_once libfile('function/friend');
$returns = array();
foreach($members as $member) {
$member['onlyacceptfriendpm'] = $member['onlyacceptfriendpm'] ? $member['onlyacceptfriendpm'] : ($_G['setting']['onlyacceptfriendpm'] ? 1 : 2);
if($_G['group']['allowsendallpm'] || $member['onlyacceptfriendpm'] == 2 || ($member['onlyacceptfriendpm'] == 1 && friend_check($member['uid']))) {
$return = uc_pm_appendchatpm($plid, $_G['uid'], $member['uid']);
$returns[] = array('uid' => $member['uid'], 'username' => $member['username'], 'return' => $return);
} else {
$returns[] = array('uid' => $member['uid'], 'username' => $member['username'], 'return' => 0);
}
}
$cannotappend = array();
foreach($returns as $value) {
if($value['return'] < 0) {
$cannotappend[] = $value['username'].'('.lang('spacecp', 'message_can_not_send_'.abs($value['return'])).')';
} elseif($value['return'] == 0) {
$cannotappend[] = $value['username'].'('.lang('spacecp', 'message_can_not_send_onlyfriend').')';
}
}
if(empty($cannotappend)) {
showmessage('do_success', dreferer(), array(), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true, 'locationtime' => 3));
} else {
showmessage('message_can_not_append_reason', dreferer(), array('cannotappend' => implode('<br />', $cannotappend)), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true, 'locationtime' => 5));
}
}
} elseif($_GET['op'] == 'setpmstatus') {
$gpmids = trim($_GET['gpmids']);
$plids = trim($_GET['plids']);
if($gpmids) {
$gpmidarr = explode(',', $gpmids);
C::t('common_member_grouppm')->update_to_read_by_unread($_G['uid'], $gpmidarr);
}
if($plids) {
$plidarr = explode(',', $plids);
uc_pm_readstatus($_G['uid'], array(), $plidarr, 0);
}
showmessage('do_success', '', array(), array('msgtype' => 3));
} elseif($_GET['op'] == 'viewpmid') {
$list = uc_pm_view($_G['uid'], $_GET['pmid']);
$value = $list[0];
include template('common/header_ajax');
include template('home/space_pm_node');
include template('common/footer_ajax');
exit;
} elseif($_GET['op'] == 'export') {
if(!$touid && !$plid) {
showmessage('pm_export_touser_not_exists');
}
if($touid) {
$list = uc_pm_view($_G['uid'], 0, $touid, 5, 0, 0, 0, 0);
} else {
$list = uc_pm_view($_G['uid'], 0, $plid, 5, 0, 0, 1, 1);
$subject = $list[0]['subject'];
}
if(count($list) == 0) {
showmessage('pm_emport_banned_export');
}
$filename = lang('space', 'export_pm').'.html';
if($touid) {
if($touser = uc_get_user($touid, 1)) {
$tousername = $touser[1];
$filename = $touser[1].'.html';
}
}
$contents = '<!DOCTYPE html>';
$contents .= '<html>';
$contents .= '<head><meta charset="'.CHARSET.'" /><meta name="renderer" content="webkit" /><meta http-equiv="X-UA-Compatible" content="IE=edge" /><title>'.lang('space', 'pm_export_header').'</title></head>';
$contents .= '<body>';
$contents .= lang('space', 'pm_export_header');
$contents .= "\r\n\r\n================================================================\r\n";
if($touser) {
$contents .= lang('space', 'pm_export_touser', array('touser' => '<a href="'.$_G['siteurl'].'home.php?mod=space&uid='.$touser[0].'">'.$touser[1].'</a>'));
$contents .= "\r\n================================================================\r\n";
} elseif($subject) {
$contents .= lang('space', 'pm_export_subject', array('subject' => $subject));
$contents .= "\r\n================================================================\r\n";
}
$contents .= "\r\n";
foreach($list as $key => $val) {
$contents .= $val['author']."\t".dgmdate($val['dateline'])."\r\n";
$contents .= str_replace(array('<br>', '<br />', '&nbsp;'), array("\r\n", "\r\n", ' '), $val['message'])."\r\n\r\n";
}
$contents .= '</body></html>';
$contents = nl2br($contents);
$filesize = strlen($contents);
$filenameencode = strtolower(CHARSET) == 'utf-8' ? rawurlencode($filename) : rawurlencode(diconv($filename, CHARSET, 'UTF-8'));
$rfc6266blacklist = strexists($_SERVER['HTTP_USER_AGENT'], 'UCBrowser') || strexists($_SERVER['HTTP_USER_AGENT'], 'Quark') || strexists($_SERVER['HTTP_USER_AGENT'], 'SogouM') || strexists($_SERVER['HTTP_USER_AGENT'], 'baidu');
dheader('Date: '.gmdate('D, d M Y H:i:s', $val['dateline']).' GMT');
dheader('Last-Modified: '.gmdate('D, d M Y H:i:s', $val['dateline']).' GMT');
dheader('Content-Encoding: none');
dheader('Content-Disposition: attachment; filename="'.$filenameencode.'"'.(($filename == $filenameencode || $rfc6266blacklist) ? '' : '; filename*=utf-8\'\''.$filenameencode));
dheader('Content-Type: application/octet-stream');
dheader('Content-Length: '.$filesize);
echo $contents;
die;
} else {
cknewuser();
if(!checkperm('allowsendpm')) {
showmessage('no_privilege_sendpm');
}
$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;
}
}
require_once libfile('function/friend');
$friendgrouplist = friend_group_list();
$type = intval($_GET['type']);
}
include_once template("home/spacecp_pm");
?>

View File

@@ -0,0 +1,178 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_poke.php 34369 2014-04-01 02:00:04Z jeffjzhang $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['friendstatus']) {
showmessage('friend_status_off');
}
$uid = empty($_GET['uid'])?0:intval($_GET['uid']);
$_GET['fuid'] = empty($_GET['fuid']) ? 0 : intval($_GET['fuid']);
if($uid == $_G['uid']) {
showmessage('not_to_their_own_greeted');
}
if($op == 'send' || $op == 'reply') {
if(!checkperm('allowpoke')) {
showmessage('no_privilege_poke');
}
cknewuser();
$tospace = array();
if($uid) {
$tospace = getuserbyuid($uid);
} elseif ($_POST['username']) {
$tospace = C::t('common_member')->fetch_uid_by_username($_POST['username']);
}
if($tospace && isblacklist($tospace['uid'])) {
showmessage('is_blacklist');
}
if(submitcheck('pokesubmit')) {
if(empty($tospace)) {
showmessage('space_does_not_exist');
}
$notetext = censor(htmlspecialchars(cutstr($_POST['note'], strtolower(CHARSET) == 'utf-8' ? 30 : 20, '')));
$setarr = array(
'pokeuid' => $uid+$_G['uid'],
'uid' => $uid,
'fromuid' => $_G['uid'],
'note' => $notetext, //need to do
'dateline' => $_G['timestamp'],
'iconid' => intval($_POST['iconid'])
);
C::t('home_pokearchive')->insert($setarr);
$setarr = array(
'uid' => $uid,
'fromuid' => $_G['uid'],
'fromusername' => $_G['username'],
'note' => $notetext,
'dateline' => $_G['timestamp'],
'iconid' => intval($_POST['iconid'])
);
C::t('home_poke')->insert($setarr, false, true);
require_once libfile('function/friend');
friend_addnum($tospace['uid']);
if($op == 'reply') {
C::t('home_poke')->delete_by_uid_fromuid($_G['uid'], $uid);
C::t('common_member')->increase($_G['uid'], array('newprompt' => -1));
}
updatecreditbyaction('poke', 0, array(), $uid);
if($setarr['iconid']) {
require_once libfile('function/spacecp');
$pokemsg = makepokeaction($setarr['iconid']);
} else {
$pokemsg = lang('home/template', 'say_hi');
}
if(!empty($setarr['note'])) {
$pokemsg .= ', '.lang('home/template', 'say').':'.$setarr['note'];
}
$note = array(
'fromurl' => 'home.php?mod=space&uid='.$_G['uid'],
'fromusername' => $_G['username'],
'fromuid' => $_G['uid'],
'from_id' => $_G['uid'],
'from_idtype' => 'pokequery',
'pokemsg' => $pokemsg
);
notification_add($uid, 'poke', 'poke_request', $note);
include_once libfile('function/stat');
updatestat('poke');
showmessage('poke_success', dreferer(), array('username' => $tospace['username'], 'uid' => $uid, 'from' => $_GET['from']), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
}
} elseif($op == 'ignore') {
if(submitcheck('ignoresubmit')) {
$where = empty($uid)?'':"AND fromuid='$uid'";
C::t('home_poke')->delete_by_uid_fromuid($_G['uid'], $uid);
C::t('home_notification')->delete_by_uid_type_authorid($_G['uid'], 'poke', $uid);
showmessage('has_been_hailed_overlooked', '', array('uid' => $uid, 'from' => $_GET['from']), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true, 'alert' => 'right'));
}
} elseif($op == 'view') {
$_GET['uid'] = intval($_GET['uid']);
$list = array();
foreach(C::t('home_poke')->fetch_all_by_uid_fromuid($space['uid'], $_GET['uid']) as $value) {
$pokeuid = $value['uid']+$value['fromuid'];
$value['uid'] = $value['fromuid'];
$value['username'] = $value['fromusername'];
require_once libfile('function/friend');
$value['isfriend'] = $value['uid']==$space['uid'] || friend_check($value['uid']) ? 1 : 0;
foreach(C::t('home_pokearchive')->fetch_all_by_pokeuid($pokeuid) as $subvalue) {
$list[$subvalue['pid']] = $subvalue;
}
}
} else {
$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);
$fuids = $list = array();
$count = C::t('home_poke')->count_by_uid($space['uid']);
if($count) {
foreach(C::t('home_poke')->fetch_all_by_uid($space['uid'], $start, $perpage) as $value) {
$value['uid'] = $value['fromuid'];
$value['username'] = $value['fromusername'];
$fuids[$value['uid']] = $value['uid'];
$list[$value['uid']] = $value;
}
if($fuids) {
require_once libfile('function/friend');
friend_check($fuids);
$value = array();
foreach($fuids as $key => $fuid) {
$value['isfriend'] = $fuid==$space['uid'] || $_G["home_friend_".$space['uid'].'_'.$fuid] ? 1 : 0;
$list[$fuid] = array_merge($list[$fuid], $value);
}
}
}
$multi = multi($count, $perpage, $page, "home.php?mod=spacecp&ac=poke");
}
$actives = array($op=='send'?'send':'poke' =>' class="a"');
include_once template('home/spacecp_poke');
?>

View File

@@ -0,0 +1,148 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_privacy.php 24946 2011-10-18 02:54:40Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
space_merge($space, 'field_home');
$operation = in_array(getgpc('op'), array('base', 'feed', 'filter', 'other', 'getgroup')) ? trim($_GET['op']) : 'base';
if(submitcheck('privacysubmit')) {
if($operation == 'base') {
$space['privacy']['view'] = array();
$viewtype = array('index', 'friend', 'wall', 'doing', 'blog', 'album', 'share', 'home', 'videoviewphoto');
foreach ($_POST['privacy']['view'] as $key => $value) {
if(in_array($key, $viewtype)) {
$space['privacy']['view'][$key] = intval($value);
}
}
}
if($operation == 'feed') {
$space['privacy']['feed'] = array();
if(isset($_POST['privacy']['feed'])) {
foreach ($_POST['privacy']['feed'] as $key => $value) {
$space['privacy']['feed'][$key] = 1;
}
}
}
privacy_update();
showmessage('do_success', 'home.php?mod=spacecp&ac=privacy&op='.$operation);
} elseif(submitcheck('privacy2submit')) {
$space['privacy']['filter_icon'] = array();
if(isset($_POST['privacy']['filter_icon'])) {
foreach($_POST['privacy']['filter_icon'] as $key => $value) {
$space['privacy']['filter_icon'][$key] = 1;
}
}
$space['privacy']['filter_gid'] = array();
if(isset($_POST['privacy']['filter_gid'])) {
foreach ($_POST['privacy']['filter_gid'] as $key => $value) {
$space['privacy']['filter_gid'][$key] = intval($value);
}
}
$space['privacy']['filter_note'] = array();
if(isset($_POST['privacy']['filter_note'])) {
foreach ($_POST['privacy']['filter_note'] as $key => $value) {
$space['privacy']['filter_note'][$key] = 1;
}
}
privacy_update();
require_once libfile('function/friend');
friend_cache($_G['uid']);
showmessage('do_success', 'home.php?mod=spacecp&ac=privacy&op='.$operation);
} elseif(submitcheck('privacy3submit')) {
$arr = array();
if(isset($_POST['allowasfriend'])) {
$arr['allowasfriend'] = (int)$_POST['allowasfriend'];
}
if(isset($_POST['allowasfollow'])) {
$arr['allowasfollow'] = (int)$_POST['allowasfollow'];
}
C::t('common_member_field_home')->update($_G['uid'], $arr);
showmessage('do_success', 'home.php?mod=spacecp&ac=privacy&op='.$operation);
}
if($operation == 'filter') {
require_once libfile('function/friend');
$groups = friend_group_list();
$filter_icons = empty($space['privacy']['filter_icon'])?array():$space['privacy']['filter_icon'];
$filter_note = empty($space['privacy']['filter_note'])?array():$space['privacy']['filter_note'];
$iconnames = $appids = $icons = $uids = $users = array();
foreach ($filter_icons as $key => $value) {
list($icon, $uid) = explode('|', $key);
$icons[$key] = $icon;
$uids[$key] = $uid;
}
foreach ($filter_note as $key => $value) {
list($type, $uid) = explode('|', $key);
$types[$key] = $type;
$uids[$key] = $uid;
}
if($uids) {
foreach(C::t('common_member')->fetch_all($uids) as $uid => $value) {
$users[$uid] = $value['username'];
}
}
} elseif ($operation == 'other') {
$arr = array();
$fields = C::t('common_member_field_home')->fetch($_G['uid']);
$arr['allowasfriend'][$fields['allowasfriend']] = ' selected="selected"';
$arr['allowasfollow'][$fields['allowasfollow']] = ' selected="selected"';
} elseif ($operation == 'getgroup') {
$gid = empty($_GET['gid'])?0:intval($_GET['gid']);
$users = array();
$query = C::t('home_friend')->fetch_all_by_uid_gid($_G['uid'], $gid, 0, 0, false);
foreach($query as $value) {
$users[] = $value['fusername'];
}
$ustr = empty($users)?'': dhtmlspecialchars(implode(' ', $users));
showmessage($ustr, '', array(), array('msgtype' => 3, 'handle'=>false));
} else {
$sels = array();
if($space['privacy']['view']) {
foreach ($space['privacy']['view'] as $key => $value) {
$sels['view'][$key] = array($value => ' selected');
}
}
if($space['privacy']['feed']) {
foreach ($space['privacy']['feed'] as $key => $value) {
$sels['feed'][$key] = ' checked';
}
}
}
$actives = array('privacy' =>' class="a"');
$opactives = array($operation =>' class="a"');
include template('home/spacecp_privacy');
?>

View File

@@ -0,0 +1,670 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_profile.php 36284 2016-12-12 00:47:50Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$defaultop = '';
$profilegroup = C::t('common_setting')->fetch_setting('profilegroup', true);
foreach($profilegroup as $key => $value) {
if($value['available']) {
$defaultop = $key;
break;
}
}
$operation = in_array(getgpc('op'), array('base', 'contact', 'edu', 'work', 'info', 'password', 'verify')) ? trim($_GET['op']) : $defaultop;
$space = getuserbyuid($_G['uid']);
space_merge($space, 'field_home');
space_merge($space, 'profile');
list($seccodecheck, $secqaacheck) = seccheck('password');
@include_once DISCUZ_ROOT.'./data/cache/cache_domain.php';
$spacedomain = isset($rootdomain['home']) && $rootdomain['home'] ? $rootdomain['home'] : array();
$_GET['id'] = getgpc('id') ? preg_replace("/[^A-Za-z0-9_:]/", '', $_GET['id']) : '';
if($operation != 'password') {
include_once libfile('function/profile');
loadcache('profilesetting');
if(empty($_G['cache']['profilesetting'])) {
require_once libfile('function/cache');
updatecache('profilesetting');
loadcache('profilesetting');
}
}
$allowcstatus = !empty($_G['group']['allowcstatus']) ? true : false;
$verify = C::t('common_member_verify')->fetch($_G['uid']);
if(!empty($verify) && is_array($verify)) {
foreach($verify as $key => $flag) {
if(in_array($key, array('verify1', 'verify2', 'verify3', 'verify4', 'verify5', 'verify6', 'verify7')) && $flag == 1) {
$verifyid = intval(substr($key, -1, 1));
if($_G['setting']['verify'][$verifyid]['available']) {
foreach($_G['setting']['verify'][$verifyid]['field'] as $field) {
$_G['cache']['profilesetting'][$field]['unchangeable'] = 1;
}
}
}
}
}
$validate = array();
if($_G['setting']['regverify'] == 2 && $_G['groupid'] == 8) {
$validate = C::t('common_member_validate')->fetch($_G['uid']);
if(empty($validate) || $validate['status'] != 1) {
$validate = array();
}
}
if(getglobal('setting/connect/allow')) {
$connect = C::t('#qqconnect#common_member_connect')->fetch($_G['uid']);
$conisregister = $operation == 'password' && $connect['conisregister'];
}
if(in_array('wechat', $_G['setting']['plugins']['available'])) {
if($_G['wechat']['setting']['wechat_qrtype']) {
$wechatuser = C::t('#wechat#common_member_wechatmp')->fetch($_G['uid']);
if($wechatuser && !$wechatuser['status']) {
$wechatuser['isregister'] = 1;
}
} else {
$wechatuser = C::t('#wechat#common_member_wechat')->fetch($_G['uid']);
}
$conisregister = $operation == 'password' && $wechatuser['isregister'];
}
if(submitcheck('profilesubmit')) {
require_once libfile('function/discuzcode');
$forum = $setarr = $verifyarr = $errorarr = array();
$forumfield = array('customstatus', 'sightml');
$censor = discuz_censor::instance();
if($_GET['vid']) {
$vid = intval($_GET['vid']);
if (getuserprofile('verify' . $vid) == 1) {
showmessage('spacecp_profile_message2');
}
$verifyconfig = $_G['setting']['verify'][$vid];
if($verifyconfig['available'] && (empty($verifyconfig['groupid']) || in_array($_G['groupid'], $verifyconfig['groupid']))) {
$verifyinfo = C::t('common_member_verify_info')->fetch_by_uid_verifytype($_G['uid'], $vid);
if(!empty($verifyinfo)) {
$verifyinfo['field'] = dunserialize($verifyinfo['field']);
}
foreach($verifyconfig['field'] as $key => $field) {
if(!isset($verifyinfo['field'][$key])) {
$verifyinfo['field'][$key] = $key;
}
}
} else {
$_GET['vid'] = $vid = 0;
$verifyconfig = array();
}
}
if(isset($_POST['birthcountry'])) {
$initcity = array('birthcountry', 'birthprovince', 'birthcity', 'birthdist', 'birthcommunity');
foreach($initcity as $key) {
$_GET[''.$key] = $_POST[$key] = !empty($_POST[$key]) ? $_POST[$key] : '';
}
}
if(isset($_POST['residecountry'])) {
$initcity = array('residecountry', 'resideprovince', 'residecity', 'residedist', 'residecommunity');
foreach($initcity as $key) {
$_GET[''.$key] = $_POST[$key] = !empty($_POST[$key]) ? $_POST[$key] : '';
}
}
foreach($_POST as $key => $value) {
$field = $_G['cache']['profilesetting'][$key];
if(in_array($field['formtype'], array('text', 'textarea')) || in_array($key, $forumfield)) {
$censor->check($value);
if($censor->modbanned() || $censor->modmoderated()) {
profile_showerror($key, lang('spacecp', 'profile_censor'));
}
}
if(in_array($key, $forumfield)) {
if($key == 'sightml') {
loadcache(array('smilies', 'smileytypes'));
$value = cutstr($value, $_G['group']['maxsigsize'], '');
foreach($_G['cache']['smilies']['replacearray'] AS $skey => $smiley) {
$_G['cache']['smilies']['replacearray'][$skey] = '[img]'.$_G['siteurl'].'static/image/smiley/'.$_G['cache']['smileytypes'][$_G['cache']['smilies']['typearray'][$skey]]['directory'].'/'.$smiley.'[/img]';
}
$value = preg_replace($_G['cache']['smilies']['searcharray'], $_G['cache']['smilies']['replacearray'], trim($value));
$forum[$key] = discuzcode($value, 1, 0, 0, 0, $_G['group']['allowsigbbcode'], $_G['group']['allowsigimgcode'], 0, 0, 1);
} elseif($key=='customstatus' && $allowcstatus) {
$forum[$key] = dhtmlspecialchars(trim($value));
}
continue;
} elseif($field && !$field['available']) {
continue;
} elseif($key == 'timeoffset') {
if($value >= -12 && $value <= 12 || $value == 9999) {
C::t('common_member')->update($_G['uid'], array('timeoffset' => intval($value)));
}
} elseif($key == 'site') {
if(!in_array(strtolower(substr($value, 0, 6)), array('http:/', 'https:', 'ftp://', 'rtsp:/', 'mms://')) && !preg_match('/^static\//', $value) && !preg_match('/^data\//', $value)) {
$value = 'http://'.$value;
}
}
if($field['formtype'] == 'file') {
if((!empty($_FILES[$key]) && $_FILES[$key]['error'] == 0) || (!empty($space[$key]) && empty($_GET['deletefile'][$key]))) {
$value = '1';
} else {
$value = '';
}
}
if(empty($field)) {
continue;
} elseif(profile_check($key, $value, $space)) {
$setarr[$key] = dhtmlspecialchars(trim($value));
} else {
if($key=='birthcountry' || $key=='birthprovince') {
$key = 'birthcity';
} elseif($key=='residecountry' || $key=='resideprovince' || $key=='residecommunity'||$key=='residedist') {
$key = 'residecity';
} elseif($key=='birthyear' || $key=='birthmonth') {
$key = 'birthday';
}
profile_showerror($key);
}
if($field['formtype'] == 'file') {
unset($setarr[$key]);
}
if (isset($setarr[$key]) && $_G['cache']['profilesetting'][$key]['unchangeable'] && $space[$key]) {
unset($setarr[$key]);
}
if($vid && $verifyconfig['available'] && isset($verifyconfig['field'][$key])) {
if(isset($verifyinfo['field'][$key]) && $setarr[$key] !== $space[$key]) {
$verifyarr[$key] = $setarr[$key];
}
unset($setarr[$key]);
}
if(isset($setarr[$key]) && $_G['cache']['profilesetting'][$key]['needverify']) {
if($setarr[$key] !== $space[$key]) {
$verifyarr[$key] = $setarr[$key];
}
unset($setarr[$key]);
}
}
if($_GET['deletefile'] && is_array($_GET['deletefile'])) {
foreach($_GET['deletefile'] as $key => $value) {
if(isset($_G['cache']['profilesetting'][$key]) && $_G['cache']['profilesetting'][$key]['formtype'] == 'file') {
$verifyarr[$key] = $setarr[$key] = '';
if(isprofileimage($space[$key])) {
@unlink(getglobal('setting/attachdir').'./profile/'.$space[$key]);
}
if(isprofileimage($verifyinfo['field'][$key])) {
@unlink(getglobal('setting/attachdir').'./profile/'.$verifyinfo['field'][$key]);
}
}
}
}
if($_FILES) {
$upload = new discuz_upload();
foreach($_FILES as $key => $file) {
if(!isset($_G['cache']['profilesetting'][$key])) {
continue;
}
$field = $_G['cache']['profilesetting'][$key];
if($field['formtype'] != 'file'){
continue;
}
if((!empty($file) && $file['error'] == 0) || (!empty($space[$key]) && empty($_GET['deletefile'][$key]))) {
$value = '1';
} else {
$value = '';
}
if(!profile_check($key, $value, $space)) {
profile_showerror($key);
} elseif($field['size'] && $field['size']*1024 < $file['size']) {
profile_showerror($key, lang('spacecp', 'filesize_lessthan').$field['size'].'KB');
} elseif($_G['cache']['profilesetting'][$key]['unchangeable'] && !empty($space[$key])){
profile_showerror($key);
}
$upload->init($file, 'profile');
$attach = $upload->attach;
if(!$upload->error()) {
$upload->save();
if(!$upload->get_image_info($attach['target'])) {
@unlink($attach['target']);
continue;
}
$setarr[$key] = '';
if(isprofileimage($space[$key])) {
@unlink(getglobal('setting/attachdir').'./profile/'.$space[$key]);
}
$attach['attachment'] = dhtmlspecialchars(trim($attach['attachment']));
if($vid && $verifyconfig['available'] && isset($verifyconfig['field'][$key])) {
if(isset($verifyinfo['field'][$key])) {
$verifyarr[$key] = $attach['attachment'];
if(isprofileimage($verifyinfo['field'][$key])) {
@unlink(getglobal('setting/attachdir').'./profile/'.$verifyinfo['field'][$key]);
}
}
continue;
}
if(isset($setarr[$key]) && $_G['cache']['profilesetting'][$key]['needverify']) {
$verifyarr[$key] = $attach['attachment'];
if(isprofileimage($verifyinfo['field'][$key])) {
@unlink(getglobal('setting/attachdir').'./profile/'.$verifyinfo['field'][$key]);
}
continue;
}
$setarr[$key] = $attach['attachment'];
}
}
}
if($vid && !empty($verifyinfo['field']) && is_array($verifyinfo['field'])) {
foreach($verifyinfo['field'] as $key => $fvalue) {
if(!isset($verifyconfig['field'][$key])) {
unset($verifyinfo['field'][$key]);
continue;
}
if(empty($verifyarr[$key]) && !isset($verifyarr[$key]) && isset($verifyinfo['field'][$key])) {
$verifyarr[$key] = !empty($fvalue) && $key != $fvalue ? $fvalue : $space[$key];
}
}
}
if($forum) {
if(!$_G['group']['maxsigsize']) {
$forum['sightml'] = '';
}
C::t('common_member_field_forum')->update($_G['uid'], $forum);
}
if(isset($_POST['birthmonth']) && ($space['birthmonth'] != $_POST['birthmonth'] || $space['birthday'] != $_POST['birthday'])) {
$setarr['constellation'] = get_constellation($_POST['birthmonth'], $_POST['birthday']);
}
if(isset($_POST['birthyear']) && $space['birthyear'] != $_POST['birthyear']) {
$setarr['zodiac'] = get_zodiac($_POST['birthyear']);
}
if($setarr) {
if($_G['setting']['profilehistory']) {
C::t('common_member_profile_history')->insert(array_merge(C::t('common_member_profile')->fetch($_G['uid']), array('dateline' => time())));
}
C::t('common_member_profile')->update($_G['uid'], $setarr);
}
if($verifyarr) {
C::t('common_member_verify_info')->delete_by_uid($_G['uid'], $vid);
$setverify = array(
'uid' => $_G['uid'],
'username' => $_G['username'],
'verifytype' => $vid,
'field' => serialize($verifyarr),
'dateline' => $_G['timestamp']
);
C::t('common_member_verify_info')->insert($setverify);
if(!(C::t('common_member_verify')->count_by_uid($_G['uid']))) {
C::t('common_member_verify')->insert(array('uid' => $_G['uid']));
}
if($_G['setting']['verify'][$vid]['available']) {
manage_addnotify('verify_'.$vid, 0, array('langkey' => 'manage_verify_field', 'verifyname' => $_G['setting']['verify'][$vid]['title'], 'doid' => $vid));
}
}
if(isset($_POST['privacy'])) {
foreach($_POST['privacy'] as $key=>$value) {
if(isset($_G['cache']['profilesetting'][$key])) {
$space['privacy']['profile'][$key] = intval($value);
}
}
C::t('common_member_field_home')->update($space['uid'], array('privacy'=>serialize($space['privacy'])));
}
include_once libfile('function/feed');
feed_add('profile', 'feed_profile_update_'.$operation, array('hash_data'=>'profile'));
countprofileprogress();
$message = $vid ? lang('spacecp', 'profile_verify_verifying', array('verify' => $verifyconfig['title'])) : '';
profile_showsuccess($message);
} elseif(submitcheck('passwordsubmit', 0, $seccodecheck, $secqaacheck)) {
$membersql = $memberfieldsql = $authstradd1 = $authstradd2 = $newpasswdadd = '';
$setarr = array();
$emailnew = dhtmlspecialchars($_GET['emailnew']);
$secmobiccnew = $_GET['secmobiccnew'];
$secmobilenew = $_GET['secmobilenew'];
$secmobseccode = $_GET['secmobseccodenew'];
$ignorepassword = 0;
if($_G['setting']['connect']['allow']) {
$connect = C::t('#qqconnect#common_member_connect')->fetch($_G['uid']);
if($connect['conisregister']) {
$_GET['oldpassword'] = '';
$ignorepassword = 1;
if(empty($_GET['newpassword'])) {
showmessage('profile_passwd_empty');
}
}
}
if(in_array('mobile', $_G['setting']['plugins']['available']) && $wechatuser['isregister']) {
$_GET['oldpassword'] = '';
$ignorepassword = 1;
if(empty($_GET['newpassword'])) {
showmessage('profile_passwd_empty');
}
}
if($_GET['questionidnew'] === '') {
$_GET['questionidnew'] = $_GET['answernew'] = '';
} else {
$secquesnew = $_GET['questionidnew'] > 0 ? random(8) : '';
}
if(!empty($_GET['newpassword']) && $_G['setting']['strongpw']) {
$strongpw_str = array();
if(in_array(1, $_G['setting']['strongpw']) && !preg_match("/\d+/", $_GET['newpassword'])) {
$strongpw_str[] = lang('member/template', 'strongpw_1');
}
if(in_array(2, $_G['setting']['strongpw']) && !preg_match("/[a-z]+/", $_GET['newpassword'])) {
$strongpw_str[] = lang('member/template', 'strongpw_2');
}
if(in_array(3, $_G['setting']['strongpw']) && !preg_match("/[A-Z]+/", $_GET['newpassword'])) {
$strongpw_str[] = lang('member/template', 'strongpw_3');
}
if(in_array(4, $_G['setting']['strongpw']) && !preg_match("/[^a-zA-z0-9]+/", $_GET['newpassword'])) {
$strongpw_str[] = lang('member/template', 'strongpw_4');
}
if($strongpw_str) {
showmessage(lang('member/template', 'password_weak').implode(',', $strongpw_str));
}
}
if(!empty($_GET['newpassword']) && $_GET['newpassword'] != addslashes($_GET['newpassword'])) {
showmessage('profile_passwd_illegal', '', array(), array('return' => true));
}
if(!empty($_GET['newpassword']) && $_GET['newpassword'] != $_GET['newpassword2']) {
showmessage('profile_passwd_notmatch', '', array(), array('return' => true));
}
if($emailnew != $_G['member']['email'] && $_G['setting']['change_email']) {
showmessage('profile_email_not_change', '', array(), array('return' => true));
}
if((strcmp($secmobiccnew, $_G['member']['secmobicc']) != 0 || strcmp($secmobilenew, $_G['member']['secmobile']) != 0) && $_G['setting']['change_secmobile']) {
showmessage('profile_secmobile_not_change', '', array(), array('return' => true));
}
if($secmobiccnew === '' && $secmobilenew !== '' && preg_match('#^(\d){1,12}$#', $secmobilenew)) {
$secmobiccnew = $_G['setting']['smsdefaultcc'];
}
if($secmobiccnew === '') {
$secmobiccnew == 0;
}elseif(!preg_match('#^(\d){1,3}$#', $secmobiccnew)) {
showmessage('profile_secmobicc_illegal', '', array(), array('return' => true));
}
if($secmobilenew === '') {
$secmobilenew == 0;
}elseif($secmobilenew !== '' && !preg_match('#^(\d){1,12}$#', $secmobilenew)) {
showmessage('profile_secmobile_illegal', '', array(), array('return' => true));
}
loaducenter();
if($emailnew != $_G['member']['email']) {
include_once libfile('function/member');
checkemail($emailnew);
}
$ucresult = uc_user_edit(addslashes($_G['username']), $_GET['oldpassword'], $_GET['newpassword'], '', $ignorepassword, $_GET['questionidnew'], $_GET['answernew'], $secmobiccnew, $secmobilenew);
if($ucresult == -1) {
showmessage('profile_passwd_wrong', '', 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));
} elseif($ucresult == -9) {
showmessage('profile_secmobile_duplicate', '', array(), array('return' => true));
}
if(!empty($_GET['newpassword']) || $secquesnew) {
$setarr['password'] = md5(random(10));
}
if($_G['setting']['connect']['allow']) {
C::t('#qqconnect#common_member_connect')->update($_G['uid'], array('conisregister' => 0));
}
if(in_array('mobile', $_G['setting']['plugins']['available']) && $wechatuser['isregister']) {
C::t('#wechat#common_member_wechat')->update($_G['uid'], array('isregister' => 0));
}
$authstr = false;
if($emailnew != $_G['member']['email']) {
if(emailcheck_send($space['uid'], $emailnew)) {
$authstr = true;
dsetcookie('newemail', "{$space['uid']}\t$emailnew\t{$_G['timestamp']}", 31536000);
}
}
if($_G['setting']['smsstatus'] && (strcmp($secmobiccnew, $_G['member']['secmobicc']) != 0 || strcmp($secmobilenew, $_G['member']['secmobile']) != 0) && empty($secmobseccode)) {
$length = $_G['setting']['smsdefaultlength'] ? $_G['setting']['smsdefaultlength'] : 4;
sms::send($_G['uid'], 0, 1, $secmobiccnew, $secmobilenew, random($length, 1), 0);
}
$setarr['secmobicc'] = $secmobiccnew == 0 ? '' : $secmobiccnew;
$setarr['secmobile'] = $secmobilenew == 0 ? '' : $secmobilenew;
if(strcmp($secmobiccnew, $_G['member']['secmobicc']) != 0 || strcmp($secmobilenew, $_G['member']['secmobile']) != 0) {
$setarr['secmobilestatus'] = sms::verify($_G['uid'], 1, $secmobiccnew, $secmobilenew, $secmobseccode);
}
if($setarr) {
if($_G['member']['freeze'] == 1) {
$setarr['freeze'] = 0;
}
C::t('common_member')->update($_G['uid'], $setarr);
}
if($_G['member']['freeze'] == 2 || $_G['member']['freeze'] == -1) {
$status = C::t('common_member_validate')->fetch($_G['uid']);
if($status) {
C::t('common_member_validate')->update($_G['uid'], array(
'submitdate' => TIMESTAMP,
'submittimes' => $status['submittimes'] + 1,
'status' => 0,
'message' => dhtmlspecialchars(addslashes($_POST['freezereson'])),
));
} else {
C::t('common_member_validate')->insert(array(
'uid' => $_G['uid'],
'submitdate' => TIMESTAMP,
'moddate' => 0,
'admin' => '',
'submittimes' => 1,
'status' => 0,
'message' => dhtmlspecialchars(addslashes($_POST['freezereson'])),
'remark' => '',
), false, true);
}
manage_addnotify('verifyuser');
}
if(!empty($_GET['newpassword'])) {
if(!function_exists('sendmail')) {
include libfile('function/mail');
}
$reset_password_subject = array(
'tpl' => 'password_reset',
'var' => array(
'username' => $_G['member']['username'],
'bbname' => $_G['setting']['bbname'],
'siteurl' => $_G['setting']['securesiteurl'],
'datetime' => dgmdate(time(), 'Y-m-d H:i:s'),
'clientip' => $_G['clientip']
)
);
if(!sendmail("{$_G['member']['username']} <{$_G['member']['email']}>", $reset_password_subject)) {
runlog('sendmail', "{$_G['member']['email']} sendmail failed.");
}
}
if((strcmp($secmobiccnew, $_G['member']['secmobicc']) != 0 || strcmp($secmobilenew, $_G['member']['secmobile']) != 0) && (!$_G['setting']['smsstatus'] || $setarr['secmobilestatus'])) {
if(!function_exists('sendmail')) {
include libfile('function/mail');
}
$reset_secmobile_subject = array(
'tpl' => 'secmobile_reset',
'var' => array(
'username' => $_G['member']['username'],
'bbname' => $_G['setting']['bbname'],
'siteurl' => $_G['setting']['securesiteurl'],
'datetime' => dgmdate(time(), 'Y-m-d H:i:s'),
'secmobile' => $_G['member']['secmobicc'].'-'.$_G['member']['secmobile'],
'clientip' => $_G['clientip']
)
);
if(!sendmail("{$_G['member']['username']} <{$_G['member']['email']}>", $reset_secmobile_subject)) {
runlog('sendmail', "{$_G['member']['email']} sendmail failed.");
}
}
if($authstr) {
showmessage('profile_email_verify', 'home.php?mod=spacecp&ac=profile&op=password');
} else {
showmessage('profile_succeed', 'home.php?mod=spacecp&ac=profile&op=password');
}
}
if($operation == 'password') {
$interval = $_G['setting']['mailinterval'] > 0 ? (int)$_G['setting']['mailinterval'] : 300;
$resend = getcookie('resendemail');
$resend = empty($resend) ? true : (TIMESTAMP - $resend) > $interval;
$newemail = getcookie('newemail');
$space['newemail'] = !$space['emailstatus'] ? $space['email'] : '';
if(!empty($newemail)) {
$mailinfo = explode("\t", $newemail);
if(is_array($mailinfo) && $mailinfo[0] == $_G['uid'] && isemail($mailinfo[1])) {
if($space['emailstatus'] && !$space['freeze'] && strcasecmp($mailinfo[1], $space['email']) === 0) {
dsetcookie('newemail', '', -1);
$space['newemail'] = '';
} else {
$space['newemail'] = $mailinfo[1];
}
}
}
if(getgpc('resend') && $resend && $_GET['formhash'] == FORMHASH) {
$toemail = $space['newemail'] ? $space['newemail'] : $space['email'];
if(emailcheck_send($space['uid'], $toemail)) {
dsetcookie('newemail', "{$space['uid']}\t$toemail\t{$_G['timestamp']}", 31536000);
dsetcookie('resendemail', TIMESTAMP);
showmessage('send_activate_mail_succeed', "home.php?mod=spacecp&ac=profile&op=password");
} else {
showmessage('send_activate_mail_error', 'home.php?mod=spacecp&ac=profile&op=password', array('interval' => $interval));
}
} elseif (getgpc('resend')) {
showmessage('send_activate_mail_error', 'home.php?mod=spacecp&ac=profile&op=password', array('interval' => $interval));
}
if(!empty($space['newemail'])) {
$acitvemessage = lang('spacecp', 'email_acitve_message', array('newemail' => $space['newemail'], 'imgdir' => $_G['style']['imgdir'], 'formhash' => FORMHASH));
}
$actives = array('password' =>' class="a"');
$navtitle = lang('core', 'title_password_security');
if($_G['member']['freeze'] == 2 || $_G['member']['freeze'] == -1) {
$fzvalidate = C::t('common_member_validate')->fetch($space['uid']);
$space['freezereson'] = $fzvalidate['message'];
$space['freezemodremark'] = $fzvalidate['remark'];
$space['freezemoddate'] = dgmdate($fzvalidate['moddate'], 'Y-m-d H:i:s');
$space['freezemodadmin'] = $fzvalidate['admin'];
$space['freezemodsubmittimes'] = $fzvalidate['submittimes'];
}
} else {
space_merge($space, 'field_home');
space_merge($space, 'field_forum');
require_once libfile('function/editor');
$space['sightml'] = html2bbcode($space['sightml']);
$vid = getgpc('vid') ? intval($_GET['vid']) : 0;
$privacy = $space['privacy']['profile'] ? $space['privacy']['profile'] : array();
$_G['setting']['privacy'] = $_G['setting']['privacy'] ? $_G['setting']['privacy'] : array();
$_G['setting']['privacy'] = is_array($_G['setting']['privacy']) ? $_G['setting']['privacy'] : dunserialize($_G['setting']['privacy']);
$_G['setting']['privacy']['profile'] = !empty($_G['setting']['privacy']['profile']) ? $_G['setting']['privacy']['profile'] : array();
$privacy = array_merge($_G['setting']['privacy']['profile'], $privacy);
$actives = array('profile' =>' class="a"');
$opactives = array($operation =>' class="a"');
$allowitems = array();
if(in_array($operation, array('base', 'contact', 'edu', 'work', 'info'))) {
$allowitems = $profilegroup[$operation]['field'];
} elseif($operation == 'verify') {
if($vid == 0) {
foreach($_G['setting']['verify'] as $key => $setting) {
if($setting['available'] && (empty($setting['groupid']) || in_array($_G['groupid'], $setting['groupid']))) {
$_GET['vid'] = $vid = $key;
break;
}
}
}
if(empty($_G['setting']['verify'][$vid]['groupid']) || in_array($_G['groupid'], $_G['setting']['verify'][$vid]['groupid'])) {
$actives = array('verify' =>' class="a"');
$opactives = array($operation.$vid =>' class="a"');
$allowitems = $_G['setting']['verify'][$vid]['field'];
}
}
$showbtn = ($vid && $verify['verify'.$vid] != 1) || empty($vid);
if(!empty($verify) && is_array($verify)) {
foreach($verify as $key => $flag) {
if(in_array($key, array('verify1', 'verify2', 'verify3', 'verify4', 'verify5', 'verify6')) && $flag == 1) {
$verifyid = intval(substr($key, -1, 1));
if($_G['setting']['verify'][$verifyid]['available']) {
foreach($_G['setting']['verify'][$verifyid]['field'] as $field) {
$_G['cache']['profilesetting'][$field]['unchangeable'] = 1;
}
}
}
}
}
if($vid) {
if($value = C::t('common_member_verify_info')->fetch_by_uid_verifytype($_G['uid'], $vid)) {
$field = dunserialize($value['field']);
foreach($field as $key => $fvalue) {
$space[$key] = $fvalue;
}
}
}
$htmls = $settings = array();
foreach($allowitems as $fieldid) {
if(!in_array($fieldid, array('sightml', 'customstatus', 'timeoffset'))) {
$html = profile_setting($fieldid, $space, $vid ? false : true);
if($html) {
$settings[$fieldid] = $_G['cache']['profilesetting'][$fieldid];
$htmls[$fieldid] = $html;
}
}
}
}
include template("home/spacecp_profile");
function profile_showerror($key, $extrainfo = '') {
echo '<script>';
echo 'parent.show_error("'.$key.'", "'.$extrainfo.'");';
echo '</script>';
exit();
}
function profile_showsuccess($message = '') {
echo '<script type="text/javascript">';
echo "parent.show_success('$message');";
echo '</script>';
exit();
}
?>

View File

@@ -0,0 +1,24 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_profilevalidate.php 6790 2010-03-25 12:30:53Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$profilevalidate = array(
'telephone' => '/^((\\(?\\d{3,4}\\)?)|(\\d{3,4}-)?)\\d{7,8}$/',
'mobile' => '/^(\+)?(86)?0?1\\d{10}$/',
'zipcode' => '/^\\d{5,6}$/',
'revenue' => '/^\\d+$/',
'height' => '/^\\d{1,3}$/',
'weight' => '/^\\d{1,3}$/',
'qq' => '/^[1-9]*[1-9][0-9]*$/'
);
?>

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: spacecp_promotion.php 25889 2011-11-24 09:52:20Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(!($_G['setting']['creditspolicy']['promotion_visit'] || $_G['setting']['creditspolicy']['promotion_register'])) {
showmessage('action_closed', NULL);
}
loadcache('creditrule');
$visit = $_G['cache']['creditrule']['promotion_visit'];
$register = $_G['cache']['creditrule']['promotion_register'];
$copystr = lang('spacecp', 'invite_you_to_visit', array('user' => $_G['username'], 'bbname' => daddslashes($_G['setting']['bbname'])));
$visitstr = $regstr = '';
foreach($_G['setting']['extcredits'] as $key => $credit) {
$creditkey = 'extcredits'.$key;
if($visit[$creditkey]) {
$visitstr .= $credit['title'].($visit[$creditkey] > 0 ? '+'.$visit[$creditkey] : $visit[$creditkey])."&nbsp;";
}
if($register[$creditkey]) {
$regstr .= $credit['title'].($register[$creditkey] > 0 ? '+'.$register[$creditkey] : $register[$creditkey])."&nbsp;";
}
}
include_once template("home/spacecp_promotion");
?>

View File

@@ -0,0 +1,179 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_search.php 28292 2012-02-27 07:23:14Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['friendstatus']) {
showmessage('friend_status_off');
}
$myfields = array('uid','gender','birthyear','birthmonth','birthday','birthcountry','birthprovince','birthcity','residecountry','resideprovince','residecity', 'residedist', 'residecommunity');
loadcache('profilesetting');
$fields = array();
foreach ($_G['cache']['profilesetting'] as $key => $value) {
if($value['title'] && $value['available'] && $value['allowsearch'] && !in_array($key, $myfields)) {
$fields[$value['fieldid']] = $value;
}
}
$nowy = dgmdate($_G['timestamp'], 'Y');
$_GET = daddslashes($_GET);
if(!empty($_GET['searchsubmit']) || !empty($_GET['searchmode'])) {
$_GET['searchsubmit'] = $_GET['searchmode'] = 1;
$wherearr = $fromarr = $uidjoin = array();
$fsql = '';
$fromarr['member'] = DB::table('common_member').' s';
if($searchkey = stripsearchkey($_GET['searchkey'])) {
$wherearr[] = 's.'.DB::field('username', $searchkey);
$searchkey = dhtmlspecialchars($searchkey);
} else {
foreach (array('uid','username','avatarstatus') as $value) {
if($_GET[$value]) {
if($value == 'username' && empty($_GET['precision'])) {
$_GET[$value] = stripsearchkey($_GET[$value]);
$wherearr[] = 's.'.DB::field($value, '%'.$_GET[$value].'%', 'like');
} else {
$wherearr[] = 's.'.DB::field($value, $_GET[$value]);
}
}
}
}
$startage = $endage = 0;
if($_GET['endage']) {
$startage = $nowy - intval($_GET['endage']);
}
if($_GET['startage']) {
$endage = $nowy - intval($_GET['startage']);
}
if($startage && $endage && $endage > $startage) {
$wherearr[] = 'sf.'.DB::field('birthyear', $startage, '>=').' AND sf.'.DB::field('birthyear', $endage, '<=');
} else if($startage && empty($endage)) {
$wherearr[] = 'sf.'.DB::field('birthyear', $startage, '>=');
} else if(empty($startage) && $endage) {
$wherearr[] = 'sf.'.DB::field('birthyear', $endage, '<=');
}
$havefield = 0;
foreach ($myfields as $fkey) {
$_GET[$fkey] = trim($_GET[$fkey]);
if($_GET[$fkey]) {
$havefield = 1;
$wherearr[] = 'sf.'.DB::field($fkey, $_GET[$fkey]);
}
}
foreach ($fields as $fkey => $fvalue) {
$_GET['field_'.$fkey] = empty($_GET['field_'.$fkey])?'':stripsearchkey($_GET['field_'.$fkey]);
if($_GET['field_'.$fkey]) {
$havefield = 1;
$wherearr[] = 'sf.'.DB::field($fkey, '%'.$_GET['field_'.$fkey].'%', 'like');
}
}
if($havefield || $startage || $endage) {
$fromarr['profile'] = DB::table('common_member_profile').' sf';
$wherearr['profile'] = "sf.uid=s.uid";
}
$list = $ols = array();
if($wherearr) {
$space['friends'] = array();
$query = C::t('home_friend')->fetch_all_by_uid($_G['uid'], 0, 0);
foreach($query as $value) {
$space['friends'][$value['fuid']] = $value['fuid'];
}
foreach(C::t('common_member')->fetch_all_for_spacecp_search($wherearr, $fromarr, 0, 100) as $value) {
$value['isfriend'] = ($value['uid']==$space['uid'] || $space['friends'][$value['uid']])?1:0;
$list[$value['uid']] = $value;
}
$follows = C::t('home_follow')->fetch_all_by_uid_followuid($_G['uid'], array_keys($list));
foreach($list as $uid => $value) {
$list[$uid]['follow'] = isset($follows[$uid]) ? 1 : 0;
}
if (!empty($list)) {
foreach(C::app()->session->fetch_all_by_uid(array_keys($list)) as $value) {
if(!$value['invisible']) {
$ols[$value['uid']] = 1;
}
}
}
}
} else {
$yearhtml = '';
for ($i=0; $i<50; $i++) {
$they = $nowy - $i;
$yearhtml .= "<option value=\"$they\">$they</option>";
}
$sexarr = array($space['sex']=>' checked=\"checked\"');
$birthyeayhtml = '';
for ($i=0; $i<100; $i++) {
$they = $nowy - $i;
if(empty($_GET['all'])) $selectstr = $they == $space['birthyear']?' selected=\"selected\"':'';
$birthyeayhtml .= "<option value=\"$they\"$selectstr>$they</option>";
}
$birthmonthhtml = '';
for ($i=1; $i<13; $i++) {
if(empty($_GET['all'])) $selectstr = $i == $space['birthmonth']?' selected=\"selected\"':'';
$birthmonthhtml .= "<option value=\"$i\"$selectstr>$i</option>";
}
$birthdayhtml = '';
for ($i=1; $i<29; $i++) {
if(empty($_GET['all'])) $selectstr = $i == $space['birthday']?' selected=\"selected\"':'';
$birthdayhtml .= "<option value=\"$i\"$selectstr>$i</option>";
}
$bloodhtml = '';
foreach (array('A','B','O','AB') as $value) {
if(empty($_GET['all'])) $selectstr = $value == $space['blood']?' selected=\"selected\"':'';
$bloodhtml .= "<option value=\"$value\"$selectstr>$value</option>";
}
$marryarr = array($space['marry'] => ' selected');
include_once libfile('function/profile');
$birthcityhtml = showdistrict(array(0,0,0), array('birthcountry', 'birthprovince', 'birthcity'), 'birthcitybox', null, 'birth');
$residecityhtml = showdistrict(array(0,0, 0, 0, 0), array('residecountry', 'resideprovince', 'residecity', 'residedist', 'residecommunity'), 'residecitybox', null, 'reside');
foreach ($fields as $fkey => $fvalue) {
if(empty($fvalue['choices'])) {
$fvalue['html'] = '<input type="text" name="field_'.$fkey.'" class="px" value="" />';
} else {
$fvalue['html'] = "<select name=\"field_$fkey\"><option value=\"\">---</option>";
$optionarr = explode("\n", $fvalue['choices']);
foreach ($optionarr as $ov) {
$ov = trim($ov);
if($ov) {
$fvalue['html'] .= "<option value=\"$ov\">$ov</option>";
}
}
$fvalue['html'] .= "</select>";
}
$fields[$fkey] = $fvalue;
}
}
$navtitle = lang('core', 'title_search_friend');
$actives = array($op=>' class="a"', 'search'=>' class="a"');
include template('home/spacecp_search');
?>

View File

@@ -0,0 +1,44 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_sendmail.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$_GET['op'] = empty($_GET['op']) ? '' : trim($_GET['op']);
if(empty($_G['setting']['sendmailday'])) {
showmessage('no_privilege_sendmailday');
}
if(submitcheck('setsendemailsubmit')) {
$_GET['sendmail'] = serialize($_GET['sendmail']);
C::t('common_member_field_home')->update($_G['uid'], array('acceptemail' => $_GET['sendmail']));
showmessage('do_success', 'home.php?mod=spacecp&ac=sendmail');
}
if(empty($space['email']) || !isemail($space['email'])) {
showmessage('email_input');
}
$sendmail = array();
if($space['acceptemail'] && is_array($space['acceptemail'])) {
foreach($space['acceptemail'] as $mkey=>$mailset) {
if($mkey != 'frequency') {
$sendmail[$mkey] = empty($space['acceptemail'][$mkey]) ? '' : ' checked';
} else {
$sendmail[$mkey] = array($space['acceptemail']['frequency'] => 'selected');
}
}
}
include_once template("home/spacecp_sendmail");
?>

View File

@@ -0,0 +1,551 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_share.php 33291 2013-05-22 05:59:13Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['sharestatus']) {
showmessage('share_status_off');
}
$sid = intval($_GET['sid']);
if($_GET['op'] == 'delete') {
if(submitcheck('deletesubmit')) {
require_once libfile('function/delete');
deleteshares(array($sid));
showmessage('do_success', $_GET['type']=='view'?'home.php?mod=space&quickforward=1&do=share':dreferer(), array('sid' => $sid), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true));
}
} elseif($_GET['op'] == 'edithot') {
if(!checkperm('manageshare')) {
showmessage('no_privilege_edithot_share');
}
if($sid) {
if(!$share = C::t('home_share')->fetch($sid)) {
showmessage('share_does_not_exist');
}
}
if(submitcheck('hotsubmit')) {
C::t('home_share')->update($sid, array('hot'=>$_POST['hot']));
C::t('home_feed')->update_feed($sid, array('hot'=>$_POST['hot']), 'sid');
showmessage('do_success', dreferer());
}
} else {
if(!checkperm('allowshare') || !helper_access::check_module('share')) {
showmessage('no_privilege_share');
}
cknewuser();
$type = empty($_GET['type'])?'':$_GET['type'];
$id = empty($_GET['id'])?0:intval($_GET['id']);
$note_uid = 0;
$note_message = '';
$note_values = array();
$hotarr = array();
$arr = array();
$feed_hash_data = '';
switch ($type) {
case 'space':
$feed_hash_data = "uid{$id}";
$tospace = getuserbyuid($id);
if(empty($tospace)) {
showmessage('space_does_not_exist');
}
if(isblacklist($tospace['uid'])) {
showmessage('is_blacklist');
}
$arr['itemid'] = $id;
$arr['fromuid'] = $id;
$arr['title_template'] = lang('spacecp', 'share_space');
$arr['body_template'] = '<b>{username}</b><br>{reside}<br>{spacenote}';
$arr['body_data'] = array(
'username' => "<a href=\"home.php?mod=space&uid=$id\">".$tospace['username']."</a>",
'reside' => $tospace['residecountry'].$tospace['resideprovince'].$tospace['residecity'],
'spacenote' => $tospace['spacenote']
);
loaducenter();
$isavatar = uc_check_avatar($id);
$arr['image'] = $isavatar?avatar($id, 'middle', true):$_G['setting']['avatarurl'].'/noavatar.svg';
$arr['image_link'] = "home.php?mod=space&uid=$id";
$note_uid = $id;
$note_message = 'share_space';
break;
case 'blog':
$feed_hash_data = "blogid{$id}";
$blog = array_merge(
C::t('home_blog')->fetch($id),
C::t('home_blogfield')->fetch($id)
);
if(!$blog) {
showmessage('blog_does_not_exist');
}
if(in_array($blog['status'], array(1, 2))) {
showmessage('moderate_blog_not_share');
}
if($blog['friend']) {
showmessage('logs_can_not_share');
}
if(isblacklist($blog['uid'])) {
showmessage('is_blacklist');
}
$arr['fromuid'] = $blog['uid'];
$arr['itemid'] = $id;
$arr['title_template'] = lang('spacecp', 'share_blog');
$arr['body_template'] = '<b>{subject}</b><br>{username}<br>{message}';
$arr['body_data'] = array(
'subject' => "<a href=\"home.php?mod=space&uid={$blog['uid']}&do=blog&id={$blog['blogid']}\">{$blog['subject']}</a>",
'username' => "<a href=\"home.php?mod=space&uid={$blog['uid']}\">".$blog['username']."</a>",
'message' => getstr($blog['message'], 150, 0, 0, 0, -1)
);
if($blog['pic']) {
$arr['image'] = pic_cover_get($blog['pic'], $blog['picflag']);
$arr['image_link'] = "home.php?mod=space&uid={$blog['uid']}&do=blog&id={$blog['blogid']}";
}
$note_uid = $blog['uid'];
$note_message = 'share_blog';
$note_values = array('url'=>"home.php?mod=space&uid={$blog['uid']}&do=blog&id={$blog['blogid']}", 'subject'=>$blog['subject'], 'from_id' => $id, 'from_idtype' => 'blogid');
$hotarr = array('blogid', $blog['blogid'], $blog['hotuser']);
break;
case 'album':
$feed_hash_data = "albumid{$id}";
if(!$album = C::t('home_album')->fetch_album($id)) {
showmessage('album_does_not_exist');
}
if($album['friend']) {
showmessage('album_can_not_share');
}
if(isblacklist($album['uid'])) {
showmessage('is_blacklist');
}
$arr['itemid'] = $id;
$arr['fromuid'] = $album['uid'];
$arr['title_template'] = lang('spacecp', 'share_album');
$arr['body_template'] = '<b>{albumname}</b><br>{username}';
$arr['body_data'] = array(
'albumname' => "<a href=\"home.php?mod=space&uid={$album['uid']}&do=album&id={$album['albumid']}\">{$album['albumname']}</a>",
'username' => "<a href=\"home.php?mod=space&uid={$album['uid']}\">".$album['username']."</a>"
);
$arr['image'] = pic_cover_get($album['pic'], $album['picflag']);
$arr['image_link'] = "home.php?mod=space&uid={$album['uid']}&do=album&id={$album['albumid']}";
$note_uid = $album['uid'];
$note_message = 'share_album';
$note_values = array('url'=>"home.php?mod=space&uid={$album['uid']}&do=album&id={$album['albumid']}", 'albumname'=>$album['albumname'], 'from_id' => $id, 'from_idtype' => 'albumid');
break;
case 'pic':
$feed_hash_data = "picid{$id}";
$pic = C::t('home_pic')->fetch($id);
if(!$pic) {
showmessage('image_does_not_exist');
}
$picfield = C::t('home_picfield')->fetch($id);
$album = C::t('home_album')->fetch_album($pic['albumid']);
$pic = array_merge($pic, $picfield, $album);
if(in_array($pic['status'], array(1, 2))) {
showmessage('moderate_pic_not_share');
}
if($pic['friend']) {
showmessage('image_can_not_share');
}
if(isblacklist($pic['uid'])) {
showmessage('is_blacklist');
}
if(empty($pic['albumid'])) $pic['albumid'] = 0;
if(empty($pic['albumname'])) $pic['albumname'] = lang('spacecp', 'default_albumname');
$arr['itemid'] = $id;
$arr['fromuid'] = $pic['uid'];
$arr['title_template'] = lang('spacecp', 'share_image');
$arr['body_template'] = lang('spacecp', 'album').': <b>{albumname}</b><br>{username}<br>{title}';
$arr['body_data'] = array(
'albumname' => "<a href=\"home.php?mod=space&uid={$pic['uid']}&do=album&id={$pic['albumid']}\">{$pic['albumname']}</a>",
'username' => "<a href=\"home.php?mod=space&uid={$pic['uid']}\">".$pic['username']."</a>",
'title' => getstr($pic['title'], 100, 0, 0, 0, -1)
);
$arr['image'] = pic_get($pic['filepath'], 'album', $pic['thumb'], $pic['remote']);
$arr['image_link'] = "home.php?mod=space&uid={$pic['uid']}&do=album&picid={$pic['picid']}";
$note_uid = $pic['uid'];
$note_message = 'share_pic';
$note_values = array('url'=>"home.php?mod=space&uid={$pic['uid']}&do=album&picid={$pic['picid']}", 'albumname'=>$pic['albumname'], 'from_id' => $id, 'from_idtype' => 'picid');
$hotarr = array('picid', $pic['picid'], $pic['hotuser']);
break;
case 'thread':
$feed_hash_data = "tid{$id}";
$actives = array('share' => ' class="active"');
$thread = C::t('forum_thread')->fetch_thread($id);
if(in_array($thread['displayorder'], array(-2, -3))) {
showmessage('moderate_thread_not_share');
}
require_once libfile('function/post');
$post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($id);
$arr['title_template'] = lang('spacecp', 'share_thread');
$arr['body_template'] = '<b>{subject}</b><br>{author}<br>{message}';
$attachment = !preg_match("/\[hide=?\d*\](.*?)\[\/hide\]/is", $post['message'], $a) && preg_match("/\[attach\]\d+\[\/attach\]/i", $a[1]);
$post['message'] = threadmessagecutstr($thread, $post['message']);
$arr['body_data'] = array(
'subject' => "<a href=\"forum.php?mod=viewthread&tid=$id\">{$thread['subject']}</a>",
'author' => "<a href=\"home.php?mod=space&uid={$thread['authorid']}\">{$thread['author']}</a>",
'message' => getstr($post['message'], 150, 0, 0, 0, -1)
);
$arr['itemid'] = $id;
$arr['fromuid'] = $thread['authorid'];
$attachment = $attachment ? C::t('forum_attachment_n')->fetch_max_image('tid:'.$id, 'tid', $id) : false;
if($attachment) {
$arr['image'] = pic_get($attachment['attachment'], 'forum', $attachment['thumb'], $attachment['remote'], 1);
$arr['image_link'] = "forum.php?mod=viewthread&tid=$id";
}
$note_uid = $thread['authorid'];
$note_message = 'share_thread';
$note_values = array('url'=>"forum.php?mod=viewthread&tid=$id", 'subject'=>$thread['subject'], 'from_id' => $id, 'from_idtype' => 'tid');
break;
case 'article':
$feed_hash_data = "articleid{$id}";
$article = C::t('portal_article_title')->fetch($id);
if(!$article) {
showmessage('article_does_not_exist');
}
if(in_array($article['status'], array(1, 2))) {
showmessage('moderate_article_not_share');
}
require_once libfile('function/portal');
$article_url = fetch_article_url($article);
$arr['itemid'] = $id;
$arr['fromuid'] = $article['uid'];
$arr['title_template'] = lang('spacecp', 'share_article');
$arr['body_template'] = '<b>{title}</b><br>{username}<br>{summary}';
$arr['body_data'] = array(
'title' => "<a href=\"$article_url\">{$article['title']}</a>",
'username' => "<a href=\"home.php?mod=space&uid={$article['uid']}\">".$article['username']."</a>",
'summary' => getstr($article['summary'], 150, 0, 0, 0, -1)
);
if($article['pic']) {
$arr['image'] = pic_get($article['pic'], 'portal', $article['thumb'], $article['remote'], 1, 1);
$arr['image_link'] = $article_url;
}
$note_uid = $article['uid'];
$note_message = 'share_article';
$note_values = array('url'=>$article_url, 'subject'=>$article['title'], 'from_id' => $id, 'from_idtype' => 'aid');
break;
default:
$actives = array('share' => ' class="active"');
$_G['refer'] = 'home.php?mod=space&uid='.$_G['uid'].'&do=share&view=me';
$type = 'link';
$_GET['op'] = 'link';
$linkdefault = 'http://';
$generaldefault = '';
break;
}
$commentcable = array('blog' => 'blogid', 'pic' => 'picid', 'thread' => 'thread', 'article' => 'article');
if(submitcheck('sharesubmit', 0, $seccodecheck, $secqaacheck)) {
$magvalues = array();
$redirecturl = '';
$showmessagecontent = '';
if($type == 'link') {
$link = dhtmlspecialchars(trim($_POST['link']));
preg_match("/((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|thunder|qqdl|synacast){1}:\/\/|www\.)[^\[\"']+/i", $link, $matches);
$link = $matches[0];
if($link) {
if(!preg_match("/^(http|ftp|https|mms)\:\/\/.{4,300}$/i", $link)) $link = '';
}
if(empty($link)) {
showmessage('url_incorrect_format');
}
$arr['itemid'] = '0';
$arr['fromuid'] = '0';
$arr['title_template'] = lang('spacecp', 'share_link');
$arr['body_template'] = '{link}';
$link_text = sub_url($link, 45);
$arr['body_data'] = array('link'=>"<a href=\"$link\" target=\"_blank\">".$link_text."</a>", 'data'=>$link);
$parseLink = parse_url($link);
require_once libfile('function/discuzcode');
$flashvar = parseflv($link);
if(empty($flashvar) && preg_match("/\.flv$/i", $link)) {
$flashvar = array(
'flv' => $link,
'imgurl' => ''
);
}
if(!empty($flashvar)) {
$title = geturltitle($link);
if($title) {
$arr['body_data'] = array('link'=>"<a href=\"$link\" target=\"_blank\">".$title."</a>", 'data'=>$link);
}
$arr['title_template'] = lang('spacecp', 'share_video');
$type = 'video';
$arr['body_data']['flashvar'] = $flashvar['flv'];
$arr['body_data']['host'] = 'flash';
$arr['body_data']['imgurl'] = $flashvar['imgurl'];
}
if(preg_match("/\.(mp3|wma)$/i", $link)) {
$arr['title_template'] = lang('spacecp', 'share_music');
$arr['body_data']['musicvar'] = $link;
$type = 'music';
}
if(preg_match("/\.swf$/i", $link)) {
$arr['title_template'] = lang('spacecp', 'share_flash');
$arr['body_data']['flashaddr'] = $link;
$type = 'flash';
}
if(preg_match("/\.(mp4|m4v|3gp|ogv|webm)$/i", $link)) {
$arr['title_template'] = lang('spacecp', 'share_video');
$arr['body_data']['videovar'] = $link;
$type = 'video';
}
}
if($_GET['iscomment'] && $_POST['general'] && $commentcable[$type] && $id) {
$_POST['general'] = censor($_POST['general']);
$currenttype = $commentcable[$type];
$currentid = $id;
if($currenttype == 'article') {
$article = C::t('portal_article_title')->fetch($currentid);
include_once libfile('function/portal');
loadcache('portalcategory');
$cat = $_G['cache']['portalcategory'][$article['catid']];
$article['allowcomment'] = !empty($cat['allowcomment']) && !empty($article['allowcomment']) ? 1 : 0;
if(!$article['allowcomment']) {
showmessage('no_privilege_commentadd', '', array(), array('return' => true));
}
if($article['idtype'] == 'blogid') {
$currentid = $article['id'];
$currenttype = 'blogid';
} elseif($article['idtype'] == 'tid') {
$currentid = $article['id'];
$currenttype = 'thread';
}
}
if($currenttype == 'thread') {
if($commentcable[$type] == 'article') {
$_POST['portal_referer'] = $article_url ? $article_url : 'portal.php?mod=view&aid='.$id;
}
$_G['setting']['seccodestatus'] = 0;
$_G['setting']['secqaa']['status'] = 0;
$_POST['replysubmit'] = true;
$_GET['tid'] = $currentid;
$_GET['action'] = 'reply';
$_GET['message'] = $_POST['general'];
include_once libfile('function/forum');
require_once libfile('function/post');
loadforum();
$inspacecpshare = 1;
include_once libfile('forum/post', 'module');
if($_POST['portal_referer']) {
$redirecturl = $_POST['portal_referer'];
} else {
if($modnewreplies) {
$redirecturl = "forum.php?mod=viewthread&tid=".$currentid;
} else {
$redirecturl = "forum.php?mod=viewthread&tid=".$currentid."&pid=".$modpost->pid."&page=".$modpost->param('page')."&extra=".$extra."#pid".$modpost->pid;
}
}
$showmessagecontent = ($modnewreplies && $commentcable[$type] != 'article') ? 'do_success_thread_share_mod' : '';
} elseif($currenttype == 'article') {
if(!checkperm('allowcommentarticle')) {
showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
include_once libfile('function/spacecp');
include_once libfile('function/portalcp');
cknewuser();
$waittime = interval_check('post');
if($waittime > 0) {
showmessage('operating_too_fast', '', array('waittime' => $waittime), array('return' => true));
}
$aid = intval($currentid);
$message = $_POST['general'];
$retmessage = addportalarticlecomment($aid, $message);
if($retmessage != 'do_success') {
showmessage($retmessage);
}
} elseif($currenttype == 'picid' || $currenttype == 'blogid') {
if(!checkperm('allowcomment')) {
showmessage('no_privilege_comment', '', array(), array('return' => true));
}
cknewuser();
$waittime = interval_check('post');
if($waittime > 0) {
showmessage('operating_too_fast', '', array('waittime' => $waittime), array('return' => true));
}
$message = getstr($_POST['general'], 0, 0, 0, 2);
if(strlen($message) < 2) {
showmessage('content_is_too_short', '', array(), array('return' => true));
}
include_once libfile('class/bbcode');
$bbcode = & bbcode::instance();
require_once libfile('function/comment');
$cidarr = add_comment($message, $currentid, $currenttype, 0);
if($cidarr['cid']) {
$magvalues['cid'] = $cidarr['cid'];
$magvalues['id'] = $currentid;
}
}
$magvalues['type'] = $commentcable[$type];
}
$arr['body_general'] = getstr($_POST['general'], 150, 0, 0, 1);
$arr['body_general'] = censor($arr['body_general'], NULL, FALSE, FALSE);
if(censormod($arr['body_general']) || $_G['group']['allowsharemod']) {
$arr['status'] = 1;
} else {
$arr['status'] = 0;
}
$arr['type'] = $type;
$arr['uid'] = $_G['uid'];
$arr['username'] = $_G['username'];
$arr['dateline'] = $_G['timestamp'];
if($arr['status'] == 0 && ckprivacy('share', 'feed')) {
require_once libfile('function/feed');
feed_add('share',
'{actor} '.$arr['title_template'],
array('hash_data' => $feed_hash_data),
$arr['body_template'],
$arr['body_data'],
$arr['body_general'],
array($arr['image']),
array($arr['image_link'])
);
}
$arr['body_data'] = serialize($arr['body_data']);
$sid = C::t('home_share')->insert($arr, true);
switch($type) {
case 'space':
C::t('common_member_status')->increase($id, array('sharetimes' => 1));
break;
case 'blog':
C::t('home_blog')->increase($id, null, array('sharetimes' => 1));
break;
case 'album':
C::t('home_album')->update_num_by_albumid($id, 1, 'sharetimes');
break;
case 'pic':
C::t('home_pic')->update_sharetimes($id);
break;
case 'thread':
C::t('forum_thread')->increase($id, array('sharetimes' => 1));
require_once libfile('function/forum');
update_threadpartake($id);
break;
case 'article':
C::t('portal_article_count')->increase($id, array('sharetimes' => 1));
break;
}
if($arr['status'] == 1) {
updatemoderate('sid', $sid);
manage_addnotify('verifyshare');
}
if($type == 'link' || !(C::t('home_share')->count_by_uid_itemid_type($_G['uid'], $id ? $id : '', $type ? $type : ''))) {
include_once libfile('function/stat');
updatestat('share');
}
if($note_uid && $note_uid != $_G['uid']) {
notification_add($note_uid, 'sharenotice', $note_message, $note_values);
}
$needle = $id ? $type.$id : '';
updatecreditbyaction('createshare', $_G['uid'], array('sharings' => 1), $needle);
$referer = "home.php?mod=space&uid={$_G['uid']}&do=share&view={$_GET['view']}&from={$_GET['from']}";
$magvalues['sid'] = $sid;
if(!$redirecturl) {
$redirecturl = dreferer();
}
if(!$showmessagecontent) {
$showmessagecontent = 'do_success';
}
showmessage($showmessagecontent, $redirecturl, $magvalues, ($_G['inajax'] && $_GET['view'] != 'me' ? array('showdialog'=>1, 'showmsg' => true, 'closetime' => true) : array()));
}
$arr['body_data'] = serialize($arr['body_data']);
require_once libfile('function/share');
$arr = mkshare($arr);
$arr['dateline'] = $_G['timestamp'];
}
if($type != 'link') {
if((C::t('home_share')->count_by_uid_itemid_type($_G['uid'], $id ? $id : '', $type ? $type : ''))) {
showmessage('spacecp_share_repeat');
}
}
$share_count = C::t('home_share')->count_by_uid_itemid_type(0, $id ? $id : '', $type ? $type : '');
include template('home/spacecp_share');
?>

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: spacecp_top.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['friendstatus']) {
showmessage('friend_status_off');
}
if(!$_G['setting']['ranklist']['membershow']) {
exit('Access Denied');
}
$operation = in_array($_GET['op'], array('modify')) ? trim($_GET['op']) : '';
if($_G['setting']['creditstransextra'][6]) {
$key = 'extcredits'.intval($_G['setting']['creditstransextra'][6]);
} elseif ($_G['setting']['creditstrans']) {
$key = 'extcredits'.intval($_G['setting']['creditstrans']);
} else {
showmessage('trade_credit_invalid', '', array(), array('return' => 1));
}
space_merge($space, 'count');
if(submitcheck('friendsubmit')) {
$showcredit = intval($_POST['stakecredit']);
if($showcredit > $space[$key]) $showcredit = $space[$key];
if($showcredit < 1) {
showmessage('showcredit_error');
}
$_POST['fusername'] = trim($_POST['fusername']);
$friend = C::t('home_friend')->fetch_all_by_uid_username($space['uid'], $_POST['fusername'], 0, 1);
$friend = $friend[0];
$fuid = $friend['fuid'];
if(empty($_POST['fusername']) || empty($fuid) || $fuid == $space['uid']) {
showmessage('showcredit_fuid_error', '', array(), array('return' => 1));
}
$count = getcount('home_show', array('uid'=>$fuid));
if($count) {
C::t('home_show')->update_credit_by_uid($fuid, $showcredit, false);
} else {
C::t('home_show')->insert(array('uid'=>$fuid, 'username'=>$_POST['fusername'], 'credit'=>$showcredit), false, true);
}
updatemembercount($space['uid'], array($_G['setting']['creditstransextra'][6] => (0-$showcredit)), true, 'RKC', $space['uid']);
notification_add($fuid, 'credit', 'showcredit', array('credit'=>$showcredit));
if(ckprivacy('show', 'feed')) {
require_once libfile('function/feed');
feed_add('show', 'feed_showcredit', array(
'fusername' => "<a href=\"home.php?mod=space&uid=$fuid\">{$friend['fusername']}</a>",
'credit' => $showcredit));
}
showmessage('showcredit_friend_do_success', "misc.php?mod=ranklist&type=member");
} elseif(submitcheck('showsubmit')) {
$showcredit = intval($_POST['showcredit']);
$unitprice = intval($_POST['unitprice']);
if($showcredit > $space[$key]) $showcredit = $space[$key];
if($showcredit < 1 || $unitprice < 1) {
showmessage('showcredit_error', '', array(), array('return' => 1));
}
$_POST['note'] = getstr($_POST['note'], 100);
$_POST['note'] = censor($_POST['note']);
$showarr = C::t('home_show')->fetch($_G['uid']);
if($showarr) {
$notesql = $_POST['note'] ? $_POST['note'] : false;
$unitprice = $unitprice > $showarr['credit']+$showcredit ? $showarr['credit']+$showcredit : $unitprice;
C::t('home_show')->update_credit_by_uid($_G['uid'], $showcredit, false, $unitprice, $notesql);
} else {
$unitprice = $unitprice > $showcredit ? $showcredit : $unitprice;
C::t('home_show')->insert(array('uid'=>$_G['uid'], 'username'=>$_G['username'], 'unitprice' => $unitprice, 'credit'=>$showcredit, 'note'=>$_POST['note']), false, true);
}
updatemembercount($space['uid'], array($_G['setting']['creditstransextra'][6] => (0-$showcredit)), true, 'RKC', $space['uid']);
if(ckprivacy('show', 'feed')) {
require_once libfile('function/feed');
feed_add('show', 'feed_showcredit_self', array('credit'=>$showcredit), '', array(), $_POST['note']);
}
showmessage('showcredit_do_success', dreferer());
}
?>

View File

@@ -0,0 +1,164 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_upload.php 32041 2012-11-01 07:28:28Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['setting']['albumstatus']) {
showmessage('album_status_off');
}
$albumid = empty($_GET['albumid'])?0:intval($_GET['albumid']);
$_GET['op'] = in_array($_GET['op'], array('recount', 'cam', 'flash', 'normal')) ? $_GET['op'] : 'normal';
if($_GET['op'] == 'recount') {
$newsize = C::t('home_pic')->count_size_by_uid($_G['uid']);
C::t('common_member_count')->update($_G['uid'], array('attachsize'=>$newsize));
showmessage('do_success', 'home.php?mod=spacecp&ac=upload');
}
if(submitcheck('albumsubmit') && helper_access::check_module('album')) {
if(!isset($_POST['title']) || !is_array($_POST['title']) || !count($_POST['title'])) {
showmessage('upload_select_image');
}
if($_POST['albumop'] == 'creatalbum') {
$catid = intval($catid);
$_POST['albumname'] = empty($_POST['albumname'])?'':getstr($_POST['albumname'], 50);
$_POST['albumname'] = censor($_POST['albumname'], NULL, TRUE);
if(is_array($_POST['albumname']) && $_POST['albumname']['message']) {
showmessage($_POST['albumname']['message']);
}
if(empty($_POST['albumname'])) $_POST['albumname'] = gmdate('Ymd');
$_POST['friend'] = intval($_POST['friend']);
$_POST['target_ids'] = '';
if($_POST['friend'] == 2) {
$uids = array();
$names = empty($_POST['target_names']) ? array() : explode(' ', str_replace(array(lang('spacecp', 'tab_space'), "\r\n", "\n", "\r"), ' ', $_POST['target_names']));
if($names) {
$uids = C::t('common_member')->fetch_all_uid_by_username($names);
}
if(empty($uids)) {
$_POST['friend'] = 3;
} else {
$_POST['target_ids'] = implode(',', $uids);
}
} elseif($_POST['friend'] == 4) {
$_POST['password'] = trim($_POST['password']);
if($_POST['password'] == '') $_POST['friend'] = 0;
}
if($_POST['friend'] !== 2) {
$_POST['target_ids'] = '';
}
if($_POST['friend'] !== 4) {
$_POST['password'] = '';
}
$setarr = array();
$setarr['albumname'] = $_POST['albumname'];
$setarr['catid'] = intval($_POST['catid']);
$setarr['uid'] = $_G['uid'];
$setarr['username'] = $_G['username'];
$setarr['dateline'] = $setarr['updatetime'] = $_G['timestamp'];
$setarr['friend'] = $_POST['friend'];
$setarr['password'] = $_POST['password'];
$setarr['target_ids'] = $_POST['target_ids'];
$setarr['depict'] = dhtmlspecialchars($_POST['depict']);
$albumid = C::t('home_album')->insert($setarr ,true);
if($setarr['catid']) {
C::t('home_album_category')->update_num_by_catid('1', $setarr['catid']);
}
if(empty($space['albumnum'])) {
$space['albums'] = C::t('home_album')->count_by_uid($space['uid']);
C::t('common_member_count')->update($_G['uid'], array('albums' => $space['albums']));
} else {
C::t('common_member_count')->increase($_G['uid'], array('albums' => 1));
}
} else {
$albumid = intval($_POST['albumid']);
$albuminfo = C::t('home_album')->fetch_album($albumid, $_G['uid']);
if(empty($albuminfo)) {
$albumid = 0;
}
}
$havetitle = trim(implode('', $_POST['title']));
if(!empty($havetitle)) {
foreach($_POST['title'] as $picid => $title) {
$title = dhtmlspecialchars($title);
C::t('home_pic')->update_for_uid($_G['uid'], $picid, array('title'=>$title, 'albumid' => $albumid));
}
} else {
$picids = array_keys($_POST['title']);
C::t('home_pic')->update_for_uid($_G['uid'], $picids, array('albumid' => $albumid));
}
if($albumid) {
album_update_pic($albumid);
}
if(ckprivacy('upload', 'feed')) {
require_once libfile('function/feed');
feed_publish($albumid, 'albumid');
}
showmessage('upload_images_completed', "home.php?mod=space&uid={$_G['uid']}&do=album&quickforward=1&id=".(empty($albumid)?-1:$albumid));
} else {
if(!checkperm('allowupload') || !helper_access::check_module('album')) {
showmessage('no_privilege_upload', '', array(), array('return' => true));
}
cknewuser();
$config = urlencode($_G['siteroot'].'home.php?mod=misc&ac=swfupload&op=config'.($_GET['op'] == 'cam'? '&cam=1' : ''));
$albums = getalbums($_G['uid']);
$actives = ($_GET['op'] == 'flash' || $_GET['op'] == 'cam')?array($_GET['op']=>' class="a"'):array('js'=>' class="a"');
$maxspacesize = checkperm('maxspacesize');
if(!empty($maxspacesize)) {
space_merge($space, 'count');
space_merge($space, 'field_home');
$maxspacesize = $maxspacesize + $space['addsize'] * 1024 * 1024;
$haveattachsize = ($maxspacesize < $space['attachsize'] ? '-':'').formatsize($maxspacesize - $space['attachsize']);
} else {
$haveattachsize = 0;
}
require_once libfile('function/friend');
$groups = friend_group_list();
loadcache('albumcategory');
$category = $_G['cache']['albumcategory'];
$categoryselect = '';
if($category) {
include_once libfile('function/portalcp');
$categoryselect = category_showselect('album', 'catid', !$_G['setting']['albumcategoryrequired'] ? true : false, $_GET['catid']);
}
}
$navtitle = lang('core', 'title_'.(!empty($_GET['op']) ? $_GET['op'] : 'normal').'_upload');
require_once libfile('function/upload');
$swfconfig = getuploadconfig($_G['uid'], 0, false);
include_once template("home/spacecp_upload");
?>

View File

@@ -0,0 +1,381 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_usergroup.php 34024 2013-09-22 08:55:00Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if($_G['inajax'] && $_GET['showextgroups']) {
require_once libfile('function/forumlist');
loadcache('usergroups');
$extgroupids = $_G['member']['extgroupids'] ? explode("\t", $_G['member']['extgroupids']) : array();
$group = array();
if($_G['uid'] && $_G['group']['grouptype'] == 'member' && $_G['group']['groupcreditslower'] != 999999999) {
$group['upgradecredit'] = $_G['group']['groupcreditslower'] - $_G['member']['credits'];
$group['upgradeprogress'] = 100 - ceil($group['upgradecredit'] / ($_G['group']['groupcreditslower'] - $_G['group']['groupcreditshigher']) * 100);
$group['upgradeprogress'] = max($group['upgradeprogress'], 2);
}
include template('forum/viewthread_profile_node');
include template('common/extgroups');
exit;
}
$do = in_array(getgpc('do'), array('buy', 'exit', 'switch', 'list', 'forum', 'expiry')) ? trim($_GET['do']) : 'usergroup';
$extgroupids = $_G['member']['extgroupids'] ? explode("\t", $_G['member']['extgroupids']) : array();
space_merge($space, 'count');
$credits = $space['credits'];
$forumselect = '';
$activeus = array();
$activeus[$do] = ' class="a"';
if(in_array($do, array('buy', 'exit'))) {
if($_G['groupid'] == 4 && $_G['member']['groupexpiry'] > 0 && $_G['member']['groupexpiry'] > TIMESTAMP) {
showmessage('usergroup_switch_not_allow');
}
$groupid = intval($_GET['groupid']);
$group = C::t('common_usergroup')->fetch($groupid);
if($group['type'] != 'special' || $group['system'] == 'private' || $group['radminid'] != 0) {
$group = null;
}
if(empty($group)) {
showmessage('usergroup_not_found');
}
$join = $do == 'buy' ? 1 : 0;
$group['dailyprice'] = $group['minspan'] = 0;
if($group['system'] != 'private') {
list($group['dailyprice'], $group['minspan']) = explode("\t", $group['system']);
if($group['dailyprice'] > -1 && $group['minspan'] == 0) {
$group['minspan'] = 1;
}
}
$creditstrans = $_G['setting']['creditstrans'];
if(!isset($_G['setting']['creditstrans'])) {
showmessage('credits_transaction_disabled');
}
if(!submitcheck('buysubmit')) {
$usermoney = $space['extcredits'.$creditstrans];
$usermaxdays = $group['dailyprice'] > 0 ? intval($usermoney / $group['dailyprice']) : 0;
$group['minamount'] = $group['dailyprice'] * $group['minspan'];
} else {
$memberfieldforum = C::t('common_member_field_forum')->fetch($_G['uid']);
$groupterms = dunserialize($memberfieldforum['groupterms']);
unset($memberfieldforum);
require_once libfile('function/forum');
if($join) {
$extgroupidsarray = array();
foreach(array_unique(array_merge($extgroupids, array($groupid))) as $extgroupid) {
if($extgroupid) {
$extgroupidsarray[] = $extgroupid;
}
}
$extgroupidsnew = implode("\t", $extgroupidsarray);
if($group['dailyprice']) {
if(($days = intval($_GET['days'])) < $group['minspan']) {
showmessage('usergroups_span_invalid', '', array('minspan' => $group['minspan']));
}
if($space['extcredits'.$creditstrans] - ($amount = $days * $group['dailyprice']) < ($minbalance = 0)) {
showmessage('credits_balance_insufficient', '', array('title'=> $_G['setting']['extcredits'][$creditstrans]['title'],'minbalance' => ($minbalance + $amount)));
}
$groupterms['ext'][$groupid] = ($groupterms['ext'][$groupid] > TIMESTAMP ? $groupterms['ext'][$groupid] : TIMESTAMP) + $days * 86400;
$groupexpirynew = groupexpiry($groupterms);
C::t('common_member')->update($_G['uid'], array('groupexpiry' => $groupexpirynew, 'extgroupids' => $extgroupidsnew));
updatemembercount($_G['uid'], array($creditstrans => "-$amount"), true, 'UGP', $extgroupidsnew);
C::t('common_member_field_forum')->update($_G['uid'], array('groupterms' => serialize($groupterms)));
} else {
C::t('common_member')->update($_G['uid'], array('extgroupids' => $extgroupidsnew));
}
showmessage('usergroups_join_succeed', "home.php?mod=spacecp&ac=usergroup".($_GET['gid'] ? "&gid={$_GET['gid']}" : '&do=list'), array('group' => $group['grouptitle']), array('showdialog' => 3, 'showmsg' => true, 'locationtime' => true));
} else {
if($groupid != $_G['groupid']) {
if(isset($groupterms['ext'][$groupid])) {
unset($groupterms['ext'][$groupid]);
}
$groupexpirynew = groupexpiry($groupterms);
C::t('common_member_field_forum')->update($_G['uid'], array('groupterms' => serialize($groupterms)));
} else {
$groupexpirynew = 'groupexpiry';
}
$extgroupidsarray = array();
foreach($extgroupids as $extgroupid) {
if($extgroupid && $extgroupid != $groupid) {
$extgroupidsarray[] = $extgroupid;
}
}
$extgroupidsnew = implode("\t", array_unique($extgroupidsarray));
C::t('common_member')->update($_G['uid'], array('groupexpiry' => $groupexpirynew, 'extgroupids' => $extgroupidsnew));
showmessage('usergroups_exit_succeed', "home.php?mod=spacecp&ac=usergroup".($_GET['gid'] ? "&gid={$_GET['gid']}" : '&do=list'), array('group' => $group['grouptitle']), array('showdialog' => 3, 'showmsg' => true, 'locationtime' => true));
}
}
} elseif($do == 'switch') {
$groupid = intval($_GET['groupid']);
if(!in_array($groupid, $extgroupids)) {
showmessage('usergroup_not_found');
}
if($_G['groupid'] == 4 && $_G['member']['groupexpiry'] > 0 && $_G['member']['groupexpiry'] > TIMESTAMP) {
showmessage('usergroup_switch_not_allow');
}
$group = C::t('common_usergroup')->fetch($groupid);
if(!$group['allowvisit']) {
showmessage("usergroup_switch_not_allowvisit");
}
if(submitcheck('groupsubmit')) {
$memberfieldforum = C::t('common_member_field_forum')->fetch($_G['uid']);
$groupterms = dunserialize($memberfieldforum['groupterms']);
unset($memberfieldforum);
$extgroupidsnew = $_G['groupid'];
$groupexpirynew = $groupterms['ext'][$groupid];
foreach($extgroupids as $extgroupid) {
if($extgroupid && $extgroupid != $groupid) {
$extgroupidsnew .= "\t".$extgroupid;
}
}
if($_G['adminid'] > 0 && $group['radminid'] > 0) {
$newadminid = $_G['adminid'] < $group['radminid'] ? $_G['adminid'] : $group['radminid'];
} elseif($_G['adminid'] > 0) {
$newadminid = $_G['adminid'];
} else {
$newadminid = $group['radminid'];
}
C::t('common_member')->update($_G['uid'], array('groupid' => $groupid, 'adminid' => $newadminid, 'groupexpiry' => $groupexpirynew, 'extgroupids' => $extgroupidsnew));
showmessage('usergroups_switch_succeed', "home.php?mod=spacecp&ac=usergroup".($_GET['gid'] ? "&gid={$_GET['gid']}" : '&do=list'), array('group' => $group['grouptitle']), array('showdialog' => 3, 'showmsg' => true, 'locationtime' => true));
}
} elseif($do == 'forum') {
if($_G['setting']['verify']['enabled']) {
$myverify= array();
getuserprofile('verify1');
for($i = 1; $i <= 6; $i++) {
if($_G['member']['verify'.$i] == 1) {
$myverify[] = $i;
}
}
$ar = array(1, 2, 3, 4, 5);
}
$language = lang('forum/misc');
$permlang = $language;
loadcache('forums');
$fids = array_keys($_G['cache']['forums']);
$perms = array('viewperm', 'postperm', 'replyperm', 'getattachperm', 'postattachperm', 'postimageperm');
$defaultperm = array(
array('viewperm' => 1, 'postperm' => 0, 'replyperm' => 0, 'getattachperm' => 1, 'postattachperm' => 0, 'postimageperm' => 0),
array('viewperm' => 1, 'postperm' => 1, 'replyperm' => 1, 'getattachperm' => 1, 'postattachperm' => 1, 'postimageperm' => 1),
);
if($_G['setting']['verify']['enabled']) {
for($i = 1; $i <= 6; $i++) {
if($_G['setting']['verify'][$i]['available']) {
$verifyicon[$i] = !empty($_G['setting']['verify'][$i]['icon']) ? '<img src="'.$_G['setting']['verify'][$i]['icon'].'" alt="'.$_G['setting']['verify'][$i]['title'].'" class="vm" title="'.$_G['setting']['verify'][$i]['title'].'" />' : $_G['setting']['verify'][$i]['title'];
}
}
}
$forumperm = $verifyperm = $myverifyperm = array();
$query = C::t('forum_forum')->fetch_all_info_by_fids($fids);
foreach($query as $forum) {
foreach($perms as $perm) {
if($forum[$perm]) {
if($_G['setting']['verify']['enabled']) {
for($i = 1; $i <= 6; $i++) {
$verifyperm[$forum['fid']][$perm] .= preg_match("/(^|\t)(v".$i.")(\t|$)/", $forum[$perm]) ? $verifyicon[$i] : '';
$includePerm = preg_match("/(^|\t)(v".$i.")(\t|$)/", $forum[$perm]) ? $verifyicon[$i] : '';
if(in_array($i, $myverify) && $includePerm) {
$myverifyperm[$forum['fid']][$perm] = 1;
}
}
}
$groupids = array($_G['groupid']);
if(!empty($_G['member']['extgroupids'])) {
$groupids = array_merge($groupids, explode("\t", $_G['member']['extgroupids']));
}
$forumperm[$forum['fid']][$perm] = preg_match("/(^|\t)(".implode('|', $groupids).")(\t|$)/", $forum[$perm]) ? 1 : 0;
} else {
$forumperm[$forum['fid']][$perm] = $defaultperm[$_G['groupid'] != 7 ? 1 : 0][$perm];
}
}
}
} elseif($do == 'list' || $do == 'expiry') {
$memberfieldforum = C::t('common_member_field_forum')->fetch($_G['uid']);
$groupterms = dunserialize($memberfieldforum['groupterms']);
unset($memberfieldforum);
$expgrouparray = $expirylist = $termsarray = array();
if(!empty($groupterms['ext']) && is_array($groupterms['ext'])) {
$termsarray = $groupterms['ext'];
}
if(!empty($groupterms['main']['time']) && (empty($termsarray[$_G['groupid']]) || $termsarray[$_G['groupid']] > $groupterm['main']['time'])) {
$termsarray[$_G['groupid']] = $groupterms['main']['time'];
}
foreach($termsarray as $expgroupid => $expiry) {
if($expiry <= TIMESTAMP) {
$expgrouparray[] = $expgroupid;
}
}
if(!empty($groupterms['ext'])) {
foreach($groupterms['ext'] as $extgroupid => $time) {
$expirylist[$extgroupid] = array('time' => dgmdate($time, 'd'), 'type' => 'ext', 'noswitch' => $time < TIMESTAMP);
}
}
if(!empty($groupterms['main'])) {
$expirylist[$_G['groupid']] = array('time' => dgmdate($groupterms['main']['time'], 'd'), 'type' => 'main');
}
$groupids = array();
foreach($_G['cache']['usergroups'] as $groupid => $usergroup) {
if(!empty($usergroup['pubtype'])) {
$groupids[] = $groupid;
}
}
$expiryids = array_keys($expirylist);
if(!$expiryids && $_G['member']['groupexpiry']) {
C::t('common_member')->update($_G['uid'], array('groupexpiry' => 0));
}
$groupids = array_merge($extgroupids, $expiryids, $groupids);
$usermoney = $space['extcredits'.$_G['setting']['creditstrans']];
if($groupids) {
foreach(C::t('common_usergroup')->fetch_all_usergroup($groupids) as $group) {
$isexp = in_array($group['groupid'], $expgrouparray);
if($_G['cache']['usergroups'][$group['groupid']]['pubtype'] == 'buy') {
list($dailyprice) = explode("\t", $group['system']);
$expirylist[$group['groupid']]['dailyprice'] = $dailyprice;
$expirylist[$group['groupid']]['usermaxdays'] = $dailyprice > 0 ? round($usermoney / $dailyprice) : 0;
} else {
$expirylist[$group['groupid']]['usermaxdays'] = 0;
}
$expirylist[$group['groupid']]['maingroup'] = $group['type'] != 'special' || $group['system'] == 'private' || $group['radminid'] > 0;
$expirylist[$group['groupid']]['grouptitle'] = $isexp ? '<s>'.$group['grouptitle'].'</s>' : $group['grouptitle'];
}
}
} else {
$language = lang('forum/misc');
require_once libfile('function/forumlist');
$permlang = $language;
unset($language);
$maingroup = $_G['group'];
$ptype = in_array(getgpc('ptype'), array(0, 1, 2)) ? intval(getgpc('ptype')) : 0;
foreach($_G['cache']['usergroups'] as $gid => $value) {
$cachekey[] = 'usergroup_'.$gid;
}
loadcache($cachekey);
$_G['group'] = $maingroup;
$sidegroup = $usergroups = $activegs = array();
$nextupgradeid = $nextexist = 0;
$memberfieldforum = C::t('common_member_field_forum')->fetch($_G['uid']);
$groupterms = dunserialize($memberfieldforum['groupterms']);
unset($memberfieldforum);
$switchmaingroup = $_G['group']['grouppublic'] || isset($groupterms['ext']) ? 1 : 0;
foreach($_G['cache']['usergroups'] as $gid => $group) {
$group['grouptitle'] = strip_tags($group['grouptitle']);
if($group['type'] == 'special') {
$type = $_G['cache']['usergroup_'.$gid]['radminid'] ? 'admin' : 'user';
} elseif($group['type'] == 'system') {
$type = $_G['cache']['usergroup_'.$gid]['radminid'] ? 'admin' : 'user';
} elseif($group['type'] == 'member') {
$type = 'upgrade';
}
if($nextupgradeid && $group['type'] == 'member') {
$_GET['gid'] = $gid;
$nextupgradeid = 0;
}
$g = '<a href="home.php?mod=spacecp&ac=usergroup&gid='.$gid.'"'.(!empty($_GET['gid']) && $_GET['gid'] == $gid ? ' class="xi1"' : '').'>'.$group['grouptitle'].'</a>';
if(in_array($gid, $extgroupids)) {
$usergroups['my'] .= $g;
}
$usergroups[$type] = (isset($usergroups[$type]) ? $usergroups[$type] : '').$g;
if(!empty($_GET['gid']) && $_GET['gid'] == $gid) {
$switchtype = $type;
if(!empty($_GET['gid'])) {
$activegs[$switchtype] = ' a';
}
$currentgrouptitle = $group['grouptitle'];
$sidegroup = $_G['cache']['usergroup_'.$gid];
if($_G['cache']['usergroup_'.$gid]['radminid']) {
$admingids[] = $gid;
}
} elseif(empty($_GET['gid']) && $_G['groupid'] == $gid && $group['type'] == 'member') {
$nextupgradeid = 1;
}
}
$usergroups['my'] = '<a href="home.php?mod=spacecp&ac=usergroup">'.$maingroup['grouptitle'].'</a>'.(isset($usergroups['my']) ? $usergroups['my'] : '');
if($activegs == array()) {
$activegs['my'] = ' a';
}
$bperms = array('allowvisit','readaccess','allowinvisible','allowsearch','allowcstatus','disablepostctrl', 'allowsendpm', 'allowfriend', 'allowstatdata');
if($_G['setting']['portalstatus']) {
$bperms[] = 'allowpostarticle';
}
$pperms = array('allowpost','allowreply','allowpostpoll','allowvote','allowpostreward','allowpostactivity','allowpostdebate','allowposttrade','allowat', 'allowreplycredit', 'allowposttag', 'allowcreatecollection','maxsigsize','allowsigbbcode','allowsigimgcode','allowrecommend','raterange','allowcommentpost','allowmediacode');
$aperms = array('allowgetattach', 'allowgetimage', 'allowpostattach', 'allowpostimage', 'allowsetattachperm', 'maxattachsize', 'maxsizeperday', 'maxattachnum', 'attachextensions');
$sperms = array('allowpoke', 'allowclick', 'allowcomment', 'maxspacesize', 'maximagesize');
if(helper_access::check_module('blog')) {$sperms[] = 'allowblog';}
if(helper_access::check_module('album')) {$sperms[] = 'allowupload';}
if(helper_access::check_module('share')) {$sperms[] = 'allowshare';}
if(helper_access::check_module('doing')) {$sperms[] = 'allowdoing';}
$allperms = array();
$allkey = array_merge($bperms, $pperms, $aperms, $sperms);
if($sidegroup) {
foreach($allkey as $pkey) {
if(in_array($pkey, array('maxattachsize', 'maxsizeperday', 'maxspacesize', 'maximagesize'))) {
$sidegroup[$pkey] = $sidegroup[$pkey] ? sizecount($sidegroup[$pkey]) : 0;
}
$allperms[$pkey][$sidegroup['groupid']] = $sidegroup[$pkey];
}
}
foreach($maingroup as $pkey => $v) {
if(in_array($pkey, array('maxattachsize', 'maxsizeperday', 'maxspacesize', 'maximagesize'))) {
$maingroup[$pkey] = $maingroup[$pkey] ? sizecount($maingroup[$pkey]) : 0;
}
}
$publicgroup = array();
$extgroupids[] = $_G['groupid'];
foreach(C::t('common_usergroup')->fetch_all_switchable(array_unique($extgroupids)) as $group) {
$group['allowsetmain'] = in_array($group['groupid'], $extgroupids);
$publicgroup[$group['groupid']] = $group;
}
$group = isset($group[count($group)]) ? $group[count($group)] : NULL;
$_GET['perms'] = 'member';
if($sidegroup) {
$group = $sidegroup;
}
}
include_once template("home/spacecp_usergroup");
?>