Ejemplo n.º 1
0
function dispatch()
{
	global $xoopsUser;
	if($this->isGuest()){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	$uid_from = $xoopsUser->getVar('uid');
	$uid_to = $this->getIntRequest('uid', XSNS_REQUEST_GET);
	$user_handler =& XsnsUserHandler::getInstance();
	$user_to =& $user_handler->get($uid_to);
	if(!is_object($user_to) || !$user_to->isFriend($uid_from)){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	$criteria = new CriteriaCompo(new Criteria('uid_to', $uid_to));
	$criteria->add(new Criteria('uid_from', $uid_from));
	$intro_handler =& XsnsIntroductionHandler::getInstance();
	$intro_obj_list =& $intro_handler->getObjects($criteria);
	if(is_array($intro_obj_list) && count($intro_obj_list)>0){
		$body = $intro_obj_list[0]->getVar('body', 'e');
	}
	else{
		$body = "";
	}
	
	$this->context->setAttribute('uid_to', $uid_to);
	$this->context->setAttribute('body', $body);
	$this->context->setAttribute('user_menu', $user_to->getMypageMenu());
	$this->context->setAttribute('user_name', $user_to->getVar('uname'));
}
Ejemplo n.º 2
0
	function XsnsUser()
	{
		$this->XoopsUser();
		
		$this->ts =& XsnsTextSanitizer::getInstance();
		
		$this->handler = array(
			'community' => XsnsCommunityHandler::getInstance(),
			'member' => XsnsMemberHandler::getInstance(),
			'user' => XsnsUserHandler::getInstance(),
			'friend' => XsnsFriendHandler::getInstance(),
			'confirm' => XsnsConfirmHandler::getInstance(),
			'module_config' => XsnsModuleConfigHandler::getInstance(),
			'intro' => XsnsIntroductionHandler::getInstance(),
		);
	}
Ejemplo n.º 3
0
function dispatch()
{
	global $xoopsUser;
	
	if($this->isGuest() || !$this->validateToken('FRIEND_DELETE')){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	$own_uid = $xoopsUser->getVar('uid');
	
	$uid = $this->getIntRequest('uid');
	if(!$uid){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	$user_handler =& XsnsUserHandler::getInstance();
	$user =& $user_handler->get($own_uid);
	$friend =& $user_handler->get($uid);
	$friend_name = is_object($friend) ? $friend->getVar('uname') : "";
	
	if(is_object($user) && is_object($friend) && $user->unsetFriend($uid)){
		
		// 削除した旨を送信
		$confirm_handler =& XsnsConfirmHandler::getInstance();
		$new_confirm =& $confirm_handler->create();
		$new_confirm->setVars(array(
			'uid_from' => $own_uid,
			'uid_to' => $uid,
			'mode' => 4,
			'r_datetime' => date('Y-m-d H:i:s'),
		));
		$confirm_handler->insert($new_confirm);
		
		// 互いの紹介文を削除
		$intro_handler =& XsnsIntroductionHandler::getInstance();
		$criteria1 = new CriteriaCompo(new Criteria('uid_to', $own_uid));
		$criteria1->add(new Criteria('uid_from', $uid));
		$criteria2 = new CriteriaCompo(new Criteria('uid_to', $uid));
		$criteria2->add(new Criteria('uid_from', $own_uid));
		$criteria1->add($criteria2, 'OR');
		$intro_handler->deleteObjects($criteria1);
		
		redirect_header(XSNS_URL_MYPAGE, 2, sprintf(_MD_XSNS_FRIEND_DELETE_OK, $friend_name));
	}
	redirect_header(XSNS_URL_MYPAGE, 2, _MD_XSNS_FRIEND_DELETE_NG);
}
Ejemplo n.º 4
0
function dispatch()
{
	global $xoopsUser, $xoopsUserIsAdmin;
	if($this->isGuest()){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	$own_uid = $xoopsUser->getVar('uid');
	$uid_to = $this->getIntRequest('uid_to', XSNS_REQUEST_GET);
	$uid_from = $this->getIntRequest('uid_from', XSNS_REQUEST_GET);
	
	if(!$uid_to || !$uid_from){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	if(!$xoopsUserIsAdmin && $own_uid!=$uid_to && $own_uid!=$uid_from){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	$user_handler =& XsnsUserHandler::getInstance();
	$user_to =& $user_handler->get($uid_to);
	$user_from =& $user_handler->get($uid_from);
	if(!is_object($user_to) || !is_object($user_from)){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	$criteria = new CriteriaCompo(new Criteria('uid_to', $uid_to));
	$criteria->add(new Criteria('uid_from', $uid_from));
	$intro_handler =& XsnsIntroductionHandler::getInstance();
	$intro_obj_list =& $intro_handler->getObjects($criteria);
	if(!is_array($intro_obj_list) || count($intro_obj_list)!=1){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	$intro = array(
		'user_from' => $user_from->getInfo(),
		'body' => $intro_obj_list[0]->getVar('body'),
	);
	
	$this->context->setAttribute('intro', $intro);
	$this->context->setAttribute('user_menu', $user_to->getMypageMenu());
	$this->context->setAttribute('uid_to', $uid_to);
	$this->context->setAttribute('uid_from', $uid_from);
}
Ejemplo n.º 5
0
function dispatch()
{
	global $xoopsUser;
	if($this->isGuest() || !$this->validateToken('INTRO_ADD')){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	$uid_from = $xoopsUser->getVar('uid');
	$uid_to = $this->getIntRequest('uid_to');
	$body = $this->getTextRequest('body');
	
	if(!$body){
		redirect_header(XSNS_URL_MYPAGE.'&'.XSNS_ACTION_ARG.'=intro_add&uid='.$uid_to, 2, _MD_XSNS_MYPAGE_INTRO_ADD_BODY_NG);
	}
	
	$user_handler =& XsnsUserHandler::getInstance();
	$user_to =& $user_handler->get($uid_to);
	if(!is_object($user_to) || !$user_to->isFriend($uid_from)){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	$criteria = new CriteriaCompo(new Criteria('uid_to', $uid_to));
	$criteria->add(new Criteria('uid_from', $uid_from));
	$intro_handler =& XsnsIntroductionHandler::getInstance();
	$intro_obj_list =& $intro_handler->getObjects($criteria);
	if(is_array($intro_obj_list) && count($intro_obj_list)>0){
		$intro =& $intro_obj_list[0];
	}
	else{
		$intro =& $intro_handler->create();
	}
	
	$intro->setVars(array(
		'uid_to' => $uid_to,
		'uid_from' => $uid_from,
		'body' => $body,
		'r_datetime' => date("Y-m-d H:i:s"),
	));
	if($intro_handler->insert($intro)){
		redirect_header(XSNS_URL_MYPAGE.'&uid='.$uid_to, 2, _MD_XSNS_MYPAGE_INTRO_ADD_OK);
	}
	redirect_header(XSNS_URL_MYPAGE.'&uid='.$uid_to, 2, _MD_XSNS_MYPAGE_INTRO_ADD_NG);
}
Ejemplo n.º 6
0
function dispatch()
{
	global $xoopsUser, $xoopsUserIsAdmin;
	if($this->isGuest() || !$this->validateToken('INTRO_DELETE')){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	$own_uid = $xoopsUser->getVar('uid');
	$uid_to = $this->getIntRequest('uid_to');
	$uid_from = $this->getIntRequest('uid_from');
	
	if(!$uid_to || !$uid_from){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	if(!$xoopsUserIsAdmin && $own_uid!=$uid_to && $own_uid!=$uid_from){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	$user_handler =& XsnsUserHandler::getInstance();
	$user_to =& $user_handler->get($uid_to);
	$user_from =& $user_handler->get($uid_from);
	if(!is_object($user_to) || !is_object($user_from)){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	$criteria = new CriteriaCompo(new Criteria('uid_to', $uid_to));
	$criteria->add(new Criteria('uid_from', $uid_from));
	$intro_handler =& XsnsIntroductionHandler::getInstance();
	$intro_obj_list =& $intro_handler->getObjects($criteria);
	if(!is_array($intro_obj_list) || count($intro_obj_list)!=1){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	if($intro_handler->delete($intro_obj_list[0])){
		redirect_header(XSNS_URL_MYPAGE, 2, _MD_XSNS_MYPAGE_INTRO_DEL_OK);
	}
	redirect_header(XSNS_URL_MYPAGE, 2, _MD_XSNS_MYPAGE_INTRO_DEL_NG);
}