Also force communication and ncenterlite views to share member mid

This commit is contained in:
Kijin Sung 2023-06-20 00:50:36 +09:00
parent 2a570e7737
commit 52a7d47a49
4 changed files with 106 additions and 20 deletions

View file

@ -51,6 +51,14 @@ class communicationMobile extends communicationView
*/ */
function dispCommunicationMessageBoxList() function dispCommunicationMessageBoxList()
{ {
// Check member mid
$oMemberView = MemberView::getInstance();
if (!$oMemberView->checkMidAndRedirect())
{
$this->setRedirectUrl($oMemberView->getRedirectUrl());
return;
}
$this->setTemplateFile('message_box'); $this->setTemplateFile('message_box');
} }
} }

View file

@ -61,6 +61,14 @@ class communicationView extends communication
throw new Rhymix\Framework\Exceptions\MustLogin; throw new Rhymix\Framework\Exceptions\MustLogin;
} }
// Check member mid
$oMemberView = MemberView::getInstance();
if (!$oMemberView->checkMidAndRedirect())
{
$this->setRedirectUrl($oMemberView->getRedirectUrl());
return;
}
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
// Set the variables // Set the variables
@ -177,11 +185,17 @@ class communicationView extends communication
throw new Rhymix\Framework\Exceptions\MustLogin; throw new Rhymix\Framework\Exceptions\MustLogin;
} }
$oCommunicationModel = getModel('communication'); // Check member mid
$oMemberView = MemberView::getInstance();
if (!$oMemberView->checkMidAndRedirect())
{
$this->setRedirectUrl($oMemberView->getRedirectUrl());
return;
}
// get a new message // get a new message
$columnList = array('message_srl', 'member_srl', 'nick_name', 'title', 'content', 'sender_srl'); $columnList = array('message_srl', 'member_srl', 'nick_name', 'title', 'content', 'sender_srl');
$message = $oCommunicationModel->getNewMessage($columnList); $message = CommunicationModel::getInstance()->getNewMessage($columnList);
if($message) if($message)
{ {
stripEmbedTagForAdmin($message->content, $message->sender_srl); stripEmbedTagForAdmin($message->content, $message->sender_srl);
@ -207,23 +221,33 @@ class communicationView extends communication
{ {
throw new Rhymix\Framework\Exceptions\InvalidRequest; throw new Rhymix\Framework\Exceptions\InvalidRequest;
} }
// Error appears if not logged-in
if(!Context::get('is_logged'))
{
throw new Rhymix\Framework\Exceptions\MustLogin;
}
// Check permission
if(!getModel('communication')->checkGrant($this->config->grant_send)) if(!getModel('communication')->checkGrant($this->config->grant_send))
{ {
throw new Rhymix\Framework\Exceptions\NotPermitted; throw new Rhymix\Framework\Exceptions\NotPermitted;
} }
// Check member mid
$oMemberView = MemberView::getInstance();
if (!$oMemberView->checkMidAndRedirect())
{
$this->setRedirectUrl($oMemberView->getRedirectUrl());
return;
}
// Fix missing mid (it causes errors when uploading) // Fix missing mid (it causes errors when uploading)
if(!Context::get('mid')) if(!Context::get('mid'))
{ {
Context::set('mid', Context::get('site_module_info')->mid); Context::set('mid', Context::get('site_module_info')->mid);
} }
// Error appears if not logged-in
if(!Context::get('is_logged'))
{
throw new Rhymix\Framework\Exceptions\MustLogin;
}
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
// get receipient's information // get receipient's information
@ -310,6 +334,14 @@ class communicationView extends communication
throw new Rhymix\Framework\Exceptions\MustLogin; throw new Rhymix\Framework\Exceptions\MustLogin;
} }
// Check member mid
$oMemberView = MemberView::getInstance();
if (!$oMemberView->checkMidAndRedirect())
{
$this->setRedirectUrl($oMemberView->getRedirectUrl());
return;
}
$oCommunicationModel = getModel('communication'); $oCommunicationModel = getModel('communication');
// get a group list // get a group list
@ -369,6 +401,14 @@ class communicationView extends communication
throw new Rhymix\Framework\Exceptions\MustLogin; throw new Rhymix\Framework\Exceptions\MustLogin;
} }
// Check member mid
$oMemberView = MemberView::getInstance();
if (!$oMemberView->checkMidAndRedirect())
{
$this->setRedirectUrl($oMemberView->getRedirectUrl());
return;
}
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
$target_srl = Context::get('target_srl'); $target_srl = Context::get('target_srl');
@ -419,7 +459,13 @@ class communicationView extends communication
throw new Rhymix\Framework\Exceptions\MustLogin; throw new Rhymix\Framework\Exceptions\MustLogin;
} }
$logged_info = Context::get('logged_info'); // Check member mid
$oMemberView = MemberView::getInstance();
if (!$oMemberView->checkMidAndRedirect())
{
$this->setRedirectUrl($oMemberView->getRedirectUrl());
return;
}
// change to edit mode when getting the group_srl // change to edit mode when getting the group_srl
$friend_group_srl = Context::get('friend_group_srl'); $friend_group_srl = Context::get('friend_group_srl');

View file

@ -7,9 +7,8 @@
*/ */
class MemberView extends Member class MemberView extends Member
{ {
var $group_list = NULL; // /< Group list information public $member_config;
var $member_info = NULL; // /< Member information of the user public $member_info;
var $skin = 'default';
/** /**
* @brief Initialization * @brief Initialization
@ -48,6 +47,10 @@ class MemberView extends Member
*/ */
public function checkMidAndRedirect() public function checkMidAndRedirect()
{ {
if (!$this->member_config)
{
$this->member_config = MemberModel::getMemberConfig();
}
if (!$this->member_config->mid) if (!$this->member_config->mid)
{ {
return true; return true;
@ -56,7 +59,7 @@ class MemberView extends Member
{ {
return true; return true;
} }
if (isset($this->mid) && $this->mid === $this->member_config->mid) if (Context::get('mid') === $this->member_config->mid)
{ {
return true; return true;
} }

View file

@ -4,7 +4,7 @@ class ncenterliteView extends ncenterlite
{ {
function init() function init()
{ {
$oNcenterliteModel = getModel('ncenterlite'); $oNcenterliteModel = ncenterliteModel::getInstance();
$config = $oNcenterliteModel->getConfig(); $config = $oNcenterliteModel->getConfig();
$template_path = sprintf("%sskins/%s/",$this->module_path, $config->skin); $template_path = sprintf("%sskins/%s/",$this->module_path, $config->skin);
if(!is_dir($template_path)||!$config->skin) if(!is_dir($template_path)||!$config->skin)
@ -28,8 +28,15 @@ class ncenterliteView extends ncenterlite
function dispNcenterliteNotifyList() function dispNcenterliteNotifyList()
{ {
$oNcenterliteModel = getModel('ncenterlite'); // Check member mid
$oMemberView = MemberView::getInstance();
if (!$oMemberView->checkMidAndRedirect())
{
$this->setRedirectUrl($oMemberView->getRedirectUrl());
return;
}
$oNcenterliteModel = ncenterliteModel::getInstance();
$output = $oNcenterliteModel->getMyNotifyList($this->user->member_srl, 1, null, true); $output = $oNcenterliteModel->getMyNotifyList($this->user->member_srl, 1, null, true);
Context::set('total_count', $output->page_navigation->total_count); Context::set('total_count', $output->page_navigation->total_count);
@ -43,7 +50,15 @@ class ncenterliteView extends ncenterlite
function dispNcenterliteUserConfig() function dispNcenterliteUserConfig()
{ {
$oNcenterliteModel = getModel('ncenterlite'); // Check member mid
$oMemberView = MemberView::getInstance();
if (!$oMemberView->checkMidAndRedirect())
{
$this->setRedirectUrl($oMemberView->getRedirectUrl());
return;
}
$oNcenterliteModel = ncenterliteModel::getInstance();
$config = $oNcenterliteModel->getConfig(); $config = $oNcenterliteModel->getConfig();
if($config->user_notify_setting != 'Y') if($config->user_notify_setting != 'Y')
{ {
@ -102,8 +117,15 @@ class ncenterliteView extends ncenterlite
*/ */
function dispNcenterliteUnsubscribeList() function dispNcenterliteUnsubscribeList()
{ {
/** @var ncenterliteModel $oNcenterliteModel */ // Check member mid
$oNcenterliteModel = getModel('ncenterlite'); $oMemberView = MemberView::getInstance();
if (!$oMemberView->checkMidAndRedirect())
{
$this->setRedirectUrl($oMemberView->getRedirectUrl());
return;
}
$oNcenterliteModel = ncenterliteModel::getInstance();
$config = $oNcenterliteModel->getConfig(); $config = $oNcenterliteModel->getConfig();
if($config->unsubscribe !== 'Y') if($config->unsubscribe !== 'Y')
@ -147,8 +169,15 @@ class ncenterliteView extends ncenterlite
$this->setLayoutPath('./common/tpl'); $this->setLayoutPath('./common/tpl');
$this->setLayoutFile('popup_layout'); $this->setLayoutFile('popup_layout');
/** @var ncenterliteModel $oNcenterliteModel */ // Check member mid
$oNcenterliteModel = getModel('ncenterlite'); $oMemberView = MemberView::getInstance();
if (!$oMemberView->checkMidAndRedirect())
{
$this->setRedirectUrl($oMemberView->getRedirectUrl());
return;
}
$oNcenterliteModel = ncenterliteModel::getInstance();
$target_srl = Context::get('target_srl'); $target_srl = Context::get('target_srl');
$unsubscribe_srl = Context::get('unsubscribe_srl'); $unsubscribe_srl = Context::get('unsubscribe_srl');
$unsubscribe_type = Context::get('unsubscribe_type'); $unsubscribe_type = Context::get('unsubscribe_type');