mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 02:01:40 +09:00
issue 2119. supporting php 5.4. communication module.
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12722 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
78b90cb3cd
commit
687fe8683b
8 changed files with 643 additions and 200 deletions
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @class communicationAdminController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
|
|
@ -6,11 +7,13 @@
|
|||
*/
|
||||
class communicationAdminController extends communication
|
||||
{
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -20,23 +23,44 @@ class communicationAdminController extends communication
|
|||
function procCommunicationAdminInsertConfig()
|
||||
{
|
||||
// get the default information
|
||||
$args = Context::gets('skin','colorset','editor_skin','sel_editor_colorset', 'mskin', 'mcolorset', 'layout_srl', 'mlayout_srl');
|
||||
$args = Context::gets('skin', 'colorset', 'editor_skin', 'sel_editor_colorset', 'mskin', 'mcolorset', 'layout_srl', 'mlayout_srl');
|
||||
$args->editor_colorset = $args->sel_editor_colorset;
|
||||
unset($args->sel_editor_colorset);
|
||||
|
||||
if(!$args->skin) $args->skin = 'default';
|
||||
if(!$args->colorset) $args->colorset = 'white';
|
||||
if(!$args->editor_skin) $args->editor_skin = 'default';
|
||||
if(!$args->mskin) $args->mskin = 'default';
|
||||
if(!$args->layout_srl) $args->layout_srl = null;
|
||||
if(!$args->skin)
|
||||
{
|
||||
$args->skin = 'default';
|
||||
}
|
||||
|
||||
if(!$args->colorset)
|
||||
{
|
||||
$args->colorset = 'white';
|
||||
}
|
||||
|
||||
if(!$args->editor_skin)
|
||||
{
|
||||
$args->editor_skin = 'default';
|
||||
}
|
||||
|
||||
if(!$args->mskin)
|
||||
{
|
||||
$args->mskin = 'default';
|
||||
}
|
||||
|
||||
if(!$args->layout_srl)
|
||||
{
|
||||
$args->layout_srl = NULL;
|
||||
}
|
||||
|
||||
// create the module module Controller object
|
||||
$oModuleController = &getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('communication',$args);
|
||||
$oModuleController = getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('communication', $args);
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispCommunicationAdminConfig');
|
||||
|
||||
return $this->setRedirectUrl($returnUrl, $output);
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file communication.admin.controller.php */
|
||||
/* Location: ./modules/comment/communication.admin.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @class communicationAdminModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
|
|
@ -6,11 +7,13 @@
|
|||
*/
|
||||
class communicationAdminModel extends communication
|
||||
{
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -32,24 +35,30 @@ class communicationAdminModel extends communication
|
|||
$dir = 'm.skins';
|
||||
}
|
||||
|
||||
if(!$skin) $tpl = "";
|
||||
if(!$skin)
|
||||
{
|
||||
$tpl = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleModel = getModel('module');
|
||||
$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $skin, $dir);
|
||||
Context::set('skin_info', $skin_info);
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleModel = getModel('module');
|
||||
$communication_config = $oModuleModel->getModuleConfig('communication');
|
||||
if(!$communication_config->colorset) $communication_config->colorset = "white";
|
||||
if(!$communication_config->colorset)
|
||||
{
|
||||
$communication_config->colorset = "white";
|
||||
}
|
||||
Context::set('communication_config', $communication_config);
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('skin_info.colorset..title','skin_info.colorset..name');
|
||||
$security->encodeHTML('skin_info.colorset..title', 'skin_info.colorset..name');
|
||||
$security->encodeHTML('skin_info.colorset..name');
|
||||
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$tpl = $oTemplate->compile($this->module_path.'tpl', 'colorset_list');
|
||||
$oTemplate = TemplateHandler::getInstance();
|
||||
$tpl = $oTemplate->compile($this->module_path . 'tpl', 'colorset_list');
|
||||
}
|
||||
|
||||
$this->add('tpl', $tpl);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @class communicationAdminView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
|
|
@ -6,34 +7,41 @@
|
|||
*/
|
||||
class communicationAdminView extends communication
|
||||
{
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* configuration to manage messages and friends
|
||||
* @return void
|
||||
*/
|
||||
function dispCommunicationAdminConfig()
|
||||
function dispCommunicationAdminConfig()
|
||||
{
|
||||
// Creating an object
|
||||
$oEditorModel = &getModel('editor');
|
||||
$oModuleModel = &getModel('module');
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$oCommunicationModel = &getModel('communication');
|
||||
$oEditorModel = getModel('editor');
|
||||
$oModuleModel = getModel('module');
|
||||
$oLayoutModel = getModel('layout');
|
||||
$oCommunicationModel = getModel('communication');
|
||||
|
||||
// get the configurations of communication module
|
||||
Context::set('communication_config', $oCommunicationModel->getConfig() );
|
||||
Context::set('communication_config', $oCommunicationModel->getConfig());
|
||||
|
||||
// get a list of layout
|
||||
Context::set('layout_list', $oLayoutModel->getLayoutList() );
|
||||
Context::set('layout_list', $oLayoutModel->getLayoutList());
|
||||
|
||||
// get a list of editor skins
|
||||
Context::set('editor_skin_list', $oEditorModel->getEditorSkinList() );
|
||||
Context::set('editor_skin_list', $oEditorModel->getEditorSkinList());
|
||||
|
||||
// get a list of communication skins
|
||||
Context::set('communication_skin_list', $oModuleModel->getSkins($this->module_path) );
|
||||
Context::set('communication_skin_list', $oModuleModel->getSkins($this->module_path));
|
||||
|
||||
// get a list of communication skins
|
||||
Context::set('communication_mobile_skin_list', $oModuleModel->getSkins($this->module_path, 'm.skins') );
|
||||
Context::set('communication_mobile_skin_list', $oModuleModel->getSkins($this->module_path, 'm.skins'));
|
||||
|
||||
// Get a layout list
|
||||
$layout_list = $oLayoutModel->getLayoutList();
|
||||
|
|
@ -42,7 +50,7 @@ class communicationAdminView extends communication
|
|||
$mlayout_list = $oLayoutModel->getLayoutList(0, 'M');
|
||||
Context::set('mlayout_list', $mlayout_list);
|
||||
|
||||
$security = new Security();
|
||||
$security = new Security();
|
||||
$security->encodeHTML('communication_config..');
|
||||
$security->encodeHTML('layout_list..');
|
||||
$security->encodeHTML('editor_skin_list..');
|
||||
|
|
@ -50,9 +58,10 @@ class communicationAdminView extends communication
|
|||
$security->encodeHTML('communication_mobile_skin_list..title');
|
||||
|
||||
// specify a template
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplatePath($this->module_path . 'tpl');
|
||||
$this->setTemplateFile('index');
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file communication.admin.view.php */
|
||||
/* Location: ./modules/comment/communication.admin.view.php */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @class communication
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
|
|
@ -6,6 +7,7 @@
|
|||
*/
|
||||
class communication extends ModuleObject
|
||||
{
|
||||
|
||||
/**
|
||||
* Implement if additional tasks are necessary when installing
|
||||
* @return Object
|
||||
|
|
@ -23,21 +25,27 @@ class communication extends ModuleObject
|
|||
*/
|
||||
function checkUpdate()
|
||||
{
|
||||
if(!is_dir("./files/member_extra_info/new_message_flags")) return true;
|
||||
if(!is_dir("./files/member_extra_info/new_message_flags"))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleModel = getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('message');
|
||||
|
||||
if($config->skin)
|
||||
{
|
||||
$config_parse = explode('.', $config->skin);
|
||||
if (count($config_parse) > 1)
|
||||
if(count($config_parse) > 1)
|
||||
{
|
||||
$template_path = sprintf('./themes/%s/modules/communication/', $config_parse[0]);
|
||||
if(is_dir($template_path)) return true;
|
||||
if(is_dir($template_path))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -46,26 +54,33 @@ class communication extends ModuleObject
|
|||
*/
|
||||
function moduleUpdate()
|
||||
{
|
||||
if(!is_dir("./files/member_extra_info/new_message_flags"))
|
||||
if(!is_dir("./files/member_extra_info/new_message_flags"))
|
||||
{
|
||||
FileHandler::makeDir('./files/member_extra_info/new_message_flags');
|
||||
}
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleModel = getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('message');
|
||||
if(!is_object($config))
|
||||
{
|
||||
$config = new stdClass();
|
||||
}
|
||||
|
||||
if($config->skin)
|
||||
{
|
||||
$config_parse = explode('.', $config->skin);
|
||||
if (count($config_parse) > 1)
|
||||
if(count($config_parse) > 1)
|
||||
{
|
||||
$template_path = sprintf('./themes/%s/modules/communication/', $config_parse[0]);
|
||||
if(is_dir($template_path))
|
||||
{
|
||||
$config->skin = implode('|@|', $config_parse);
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController = getController('module');
|
||||
$oModuleController->updateModuleConfig('communication', $config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Object(0, 'success_updated');
|
||||
}
|
||||
|
||||
|
|
@ -75,7 +90,9 @@ class communication extends ModuleObject
|
|||
*/
|
||||
function recompileCache()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file communication.class.php */
|
||||
/* Location: ./modules/comment/communication.class.php */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @class communicationController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
|
|
@ -6,11 +7,13 @@
|
|||
*/
|
||||
class communicationController extends communication
|
||||
{
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -19,10 +22,18 @@ class communicationController extends communication
|
|||
*/
|
||||
function procCommunicationUpdateAllowMessage()
|
||||
{
|
||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return new Object(-1, 'msg_not_logged');
|
||||
}
|
||||
|
||||
$args = new stdClass();
|
||||
$args->allow_message = Context::get('allow_message');
|
||||
if(!in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y';
|
||||
|
||||
if(!in_array($args->allow_message, array('Y', 'N', 'F')))
|
||||
{
|
||||
$args->allow_message = 'Y';
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
|
|
@ -30,6 +41,7 @@ class communicationController extends communication
|
|||
$output = executeQuery('communication.updateAllowMessage', $args);
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispCommunicationMessages', 'message_type', Context::get('message_type'));
|
||||
|
||||
return $this->setRedirectUrl($returnUrl, $output);
|
||||
}
|
||||
|
||||
|
|
@ -40,44 +52,72 @@ class communicationController extends communication
|
|||
function procCommunicationSendMessage()
|
||||
{
|
||||
// Check login information
|
||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return new Object(-1, 'msg_not_logged');
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
// Check variables
|
||||
$receiver_srl = Context::get('receiver_srl');
|
||||
if(!$receiver_srl) return new Object(-1, 'msg_not_exists_member');
|
||||
if(!$receiver_srl)
|
||||
{
|
||||
return new Object(-1, 'msg_not_exists_member');
|
||||
}
|
||||
|
||||
$title = trim(Context::get('title'));
|
||||
if(!$title) return new Object(-1, 'msg_title_is_null');
|
||||
if(!$title)
|
||||
{
|
||||
return new Object(-1, 'msg_title_is_null');
|
||||
}
|
||||
|
||||
$content = trim(Context::get('content'));
|
||||
if(!$content) return new Object(-1, 'msg_content_is_null');
|
||||
if(!$content)
|
||||
{
|
||||
return new Object(-1, 'msg_content_is_null');
|
||||
}
|
||||
|
||||
$send_mail = Context::get('send_mail');
|
||||
if($send_mail != 'Y') $send_mail = 'N';
|
||||
if($send_mail != 'Y')
|
||||
{
|
||||
$send_mail = 'N';
|
||||
}
|
||||
|
||||
// Check if there is a member to receive a message
|
||||
$oMemberModel = &getModel('member');
|
||||
$oCommunicationModel = &getModel('communication');
|
||||
$oMemberModel = getModel('member');
|
||||
$oCommunicationModel = getModel('communication');
|
||||
|
||||
$receiver_member_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
|
||||
if($receiver_member_info->member_srl != $receiver_srl) return new Object(-1, 'msg_not_exists_member');
|
||||
if($receiver_member_info->member_srl != $receiver_srl)
|
||||
{
|
||||
return new Object(-1, 'msg_not_exists_member');
|
||||
}
|
||||
|
||||
// check whether to allow to receive the message(pass if a top-administrator)
|
||||
if($logged_info->is_admin != 'Y')
|
||||
{
|
||||
if($receiver_member_info->allow_message == 'F')
|
||||
{
|
||||
if(!$oCommunicationModel->isFriend($receiver_member_info->member_srl)) return new object(-1, 'msg_allow_message_to_friend');
|
||||
if(!$oCommunicationModel->isFriend($receiver_member_info->member_srl))
|
||||
{
|
||||
return new object(-1, 'msg_allow_message_to_friend');
|
||||
}
|
||||
}
|
||||
else if($receiver_member_info->allow_message == 'N')
|
||||
{
|
||||
return new object(-1, 'msg_disallow_message');
|
||||
}
|
||||
}
|
||||
|
||||
// send a message
|
||||
$output = $this->sendMessage($logged_info->member_srl, $receiver_srl, $title, $content);
|
||||
|
||||
// send an e-mail
|
||||
if($output->toBool() && $send_mail == 'Y')
|
||||
{
|
||||
$view_url = Context::getRequestUri();
|
||||
$content = sprintf("%s<br /><br />From : <a href=\"%s\" target=\"_blank\">%s</a>",$content, $view_url, $view_url);
|
||||
$content = sprintf("%s<br /><br />From : <a href=\"%s\" target=\"_blank\">%s</a>", $content, $view_url, $view_url);
|
||||
$oMail = new Mail();
|
||||
$oMail->setTitle($title);
|
||||
$oMail->setContent($content);
|
||||
|
|
@ -86,7 +126,7 @@ class communicationController extends communication
|
|||
$oMail->send();
|
||||
}
|
||||
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
|
||||
if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
|
||||
{
|
||||
if(Context::get('is_popup') != 'Y')
|
||||
{
|
||||
|
|
@ -101,10 +141,11 @@ class communicationController extends communication
|
|||
else
|
||||
{
|
||||
$this->setMessage('success_sended');
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('act','dispCommunicationMessages','message_type','S','receiver_srl',$receiver_srl,'message_srl','');
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('act', 'dispCommunicationMessages', 'message_type', 'S', 'receiver_srl', $receiver_srl, 'message_srl', '');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
@ -117,10 +158,11 @@ class communicationController extends communication
|
|||
* @param boolean $sender_log (default true)
|
||||
* @return Object
|
||||
*/
|
||||
function sendMessage($sender_srl, $receiver_srl, $title, $content, $sender_log = true)
|
||||
function sendMessage($sender_srl, $receiver_srl, $title, $content, $sender_log = TRUE)
|
||||
{
|
||||
$content = removeHackTag($content);
|
||||
$content = removeHackTag($content);
|
||||
$title = htmlspecialchars($title);
|
||||
|
||||
// messages to save in the sendor's message box
|
||||
$sender_args = new stdClass();
|
||||
$sender_args->sender_srl = $sender_srl;
|
||||
|
|
@ -132,14 +174,18 @@ class communicationController extends communication
|
|||
$sender_args->regdate = date("YmdHis");
|
||||
$sender_args->related_srl = getNextSequence();
|
||||
$sender_args->message_srl = getNextSequence();
|
||||
$sender_args->list_order = getNextSequence()*-1;
|
||||
$sender_args->list_order = getNextSequence() * -1;
|
||||
|
||||
// messages to save in the receiver's message box
|
||||
$receiver_args = new stdClass();
|
||||
$receiver_args->message_srl = $sender_args->related_srl;
|
||||
$receiver_args->related_srl = 0;
|
||||
$receiver_args->list_order = $sender_args->related_srl*-1;
|
||||
$receiver_args->list_order = $sender_args->related_srl * -1;
|
||||
$receiver_args->sender_srl = $sender_srl;
|
||||
if(!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl;
|
||||
if(!$receiver_args->sender_srl)
|
||||
{
|
||||
$receiver_args->sender_srl = $receiver_srl;
|
||||
}
|
||||
$receiver_args->receiver_srl = $receiver_srl;
|
||||
$receiver_args->message_type = 'R';
|
||||
$receiver_args->title = $title;
|
||||
|
|
@ -147,8 +193,9 @@ class communicationController extends communication
|
|||
$receiver_args->readed = 'N';
|
||||
$receiver_args->regdate = date("YmdHis");
|
||||
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB = DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
// messages to save in the sendor's message box
|
||||
if($sender_srl && $sender_log)
|
||||
{
|
||||
|
|
@ -159,6 +206,7 @@ class communicationController extends communication
|
|||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
// messages to save in the receiver's message box
|
||||
$output = executeQuery('communication.sendMessage', $receiver_args);
|
||||
if(!$output->toBool())
|
||||
|
|
@ -166,8 +214,9 @@ class communicationController extends communication
|
|||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
// create a flag that message is sent (in file format)
|
||||
$flag_path = './files/member_extra_info/new_message_flags/'.getNumberingPath($receiver_srl);
|
||||
$flag_path = './files/member_extra_info/new_message_flags/' . getNumberingPath($receiver_srl);
|
||||
FileHandler::makeDir($flag_path);
|
||||
$flag_file = sprintf('%s%s', $flag_path, $receiver_srl);
|
||||
$flag_count = FileHandler::readFile($flag_file);
|
||||
|
|
@ -175,7 +224,7 @@ class communicationController extends communication
|
|||
|
||||
$oDB->commit();
|
||||
|
||||
return new Object(0,'success_sended');
|
||||
return new Object(0, 'success_sended');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -185,20 +234,35 @@ class communicationController extends communication
|
|||
function procCommunicationStoreMessage()
|
||||
{
|
||||
// Check login information
|
||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return new Object(-1, 'msg_not_logged');
|
||||
}
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
// Check variable
|
||||
$message_srl = Context::get('message_srl');
|
||||
if(!$message_srl) return new Object(-1,'msg_invalid_request');
|
||||
// get the message
|
||||
$oCommunicationModel = &getModel('communication');
|
||||
$message = $oCommunicationModel->getSelectedMessage($message_srl);
|
||||
if(!$message || $message->message_type != 'R') return new Object(-1,'msg_invalid_request');
|
||||
if(!$message_srl)
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
// get the message
|
||||
$oCommunicationModel = getModel('communication');
|
||||
$message = $oCommunicationModel->getSelectedMessage($message_srl);
|
||||
if(!$message || $message->message_type != 'R')
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
$args = new stdClass();
|
||||
$args->message_srl = $message_srl;
|
||||
$args->receiver_srl = $logged_info->member_srl;
|
||||
$output = executeQuery('communication.setMessageStored', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$this->setMessage('success_registed');
|
||||
}
|
||||
|
|
@ -210,30 +274,55 @@ class communicationController extends communication
|
|||
function procCommunicationDeleteMessage()
|
||||
{
|
||||
// Check login information
|
||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return new Object(-1, 'msg_not_logged');
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
$member_srl = $logged_info->member_srl;
|
||||
|
||||
// Check the variable
|
||||
$message_srl = Context::get('message_srl');
|
||||
if(!$message_srl) return new Object(-1,'msg_invalid_request');
|
||||
if(!$message_srl)
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
// Get the message
|
||||
$oCommunicationModel = &getModel('communication');
|
||||
$oCommunicationModel = getModel('communication');
|
||||
$message = $oCommunicationModel->getSelectedMessage($message_srl);
|
||||
if(!$message) return new Object(-1,'msg_invalid_request');
|
||||
if(!$message)
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
// Check the grant
|
||||
switch($message->message_type)
|
||||
{
|
||||
case 'S':
|
||||
if($message->sender_srl != $member_srl) return new Object(-1, 'msg_invalid_request');
|
||||
if($message->sender_srl != $member_srl)
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
if($message->receiver_srl != $member_srl) return new Object(-1, 'msg_invalid_request');
|
||||
if($message->receiver_srl != $member_srl)
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Delete
|
||||
$args = new stdClass();
|
||||
$args->message_srl = $message_srl;
|
||||
$output = executeQuery('communication.deleteMessage', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$this->setMessage('success_deleted');
|
||||
}
|
||||
|
|
@ -245,37 +334,73 @@ class communicationController extends communication
|
|||
function procCommunicationDeleteMessages()
|
||||
{
|
||||
// Check login information
|
||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return new Object(-1, 'msg_not_logged');
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
$member_srl = $logged_info->member_srl;
|
||||
|
||||
// check variables
|
||||
if(!Context::get('message_srl_list')) return new Object(-1, 'msg_cart_is_null');
|
||||
if(!Context::get('message_srl_list'))
|
||||
{
|
||||
return new Object(-1, 'msg_cart_is_null');
|
||||
}
|
||||
|
||||
$message_srl_list = Context::get('message_srl_list');
|
||||
if(!is_array($message_srl_list)) $message_srl_list = explode('|@|', trim($message_srl_list));
|
||||
if(!count($message_srl_list)) return new Object(-1, 'msg_cart_is_null');
|
||||
if(!is_array($message_srl_list))
|
||||
{
|
||||
$message_srl_list = explode('|@|', trim($message_srl_list));
|
||||
}
|
||||
|
||||
if(!count($message_srl_list))
|
||||
{
|
||||
return new Object(-1, 'msg_cart_is_null');
|
||||
}
|
||||
|
||||
$message_type = Context::get('message_type');
|
||||
if(!$message_type || !in_array($message_type, array('R','S','T'))) return new Object(-1, 'msg_invalid_request');
|
||||
if(!$message_type || !in_array($message_type, array('R', 'S', 'T')))
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
$message_count = count($message_srl_list);
|
||||
$target = array();
|
||||
for($i=0;$i<$message_count;$i++)
|
||||
for($i = 0; $i < $message_count; $i++)
|
||||
{
|
||||
$message_srl = (int)trim($message_srl_list[$i]);
|
||||
if(!$message_srl) continue;
|
||||
$message_srl = (int) trim($message_srl_list[$i]);
|
||||
if(!$message_srl)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$target[] = $message_srl;
|
||||
}
|
||||
if(!count($target)) return new Object(-1,'msg_cart_is_null');
|
||||
if(!count($target))
|
||||
{
|
||||
return new Object(-1, 'msg_cart_is_null');
|
||||
}
|
||||
|
||||
// Delete
|
||||
$args->message_srls = implode(',',$target);
|
||||
$args = new stdClass();
|
||||
$args->message_srls = implode(',', $target);
|
||||
$args->message_type = $message_type;
|
||||
|
||||
if($message_type == 'S') $args->sender_srl = $member_srl;
|
||||
else $args->receiver_srl = $member_srl;
|
||||
if($message_type == 'S')
|
||||
{
|
||||
$args->sender_srl = $member_srl;
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->receiver_srl = $member_srl;
|
||||
}
|
||||
|
||||
$output = executeQuery('communication.deleteMessages', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$this->setMessage('success_deleted');
|
||||
|
||||
|
|
@ -290,24 +415,36 @@ class communicationController extends communication
|
|||
function procCommunicationAddFriend()
|
||||
{
|
||||
// Check login information
|
||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return new Object(-1, 'msg_not_logged');
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
$target_srl = (int)trim(Context::get('target_srl'));
|
||||
if(!$target_srl) return new Object(-1,'msg_invalid_request');
|
||||
$target_srl = (int) trim(Context::get('target_srl'));
|
||||
if(!$target_srl)
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
// Variable
|
||||
$args = new stdClass();
|
||||
$args->friend_srl = getNextSequence();
|
||||
$args->list_order = $args->friend_srl * -1;
|
||||
$args->friend_group_srl = Context::get('friend_group_srl');
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
$args->target_srl = $target_srl;
|
||||
$output = executeQuery('communication.addFriend', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$this->add('member_srl', $target_srl);
|
||||
$this->setMessage('success_registed');
|
||||
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
|
||||
if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
|
||||
{
|
||||
global $lang;
|
||||
htmlHeader();
|
||||
|
|
@ -323,15 +460,16 @@ class communicationController extends communication
|
|||
* Move a group of the friend
|
||||
* @return void|Object (success : void, fail : Object)
|
||||
*/
|
||||
function procCommunicationMoveFriend()
|
||||
function procCommunicationMoveFriend()
|
||||
{
|
||||
// Check login information
|
||||
if(!Context::get('is_logged'))
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return new Object(-1, 'msg_not_logged');
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
// Check variables
|
||||
$friend_srl_list = Context::get('friend_srl_list');
|
||||
if(!$friend_srl_list)
|
||||
|
|
@ -344,24 +482,40 @@ class communicationController extends communication
|
|||
$friend_srl_list = explode('|@|', $friend_srl_list);
|
||||
}
|
||||
|
||||
if(!count($friend_srl_list)) return new Object(-1, 'msg_cart_is_null');
|
||||
if(!count($friend_srl_list))
|
||||
{
|
||||
return new Object(-1, 'msg_cart_is_null');
|
||||
}
|
||||
|
||||
$friend_count = count($friend_srl_list);
|
||||
$target = array();
|
||||
for($i=0;$i<$friend_count;$i++)
|
||||
for($i = 0; $i < $friend_count; $i++)
|
||||
{
|
||||
$friend_srl = (int)trim($friend_srl_list[$i]);
|
||||
if(!$friend_srl) continue;
|
||||
$friend_srl = (int) trim($friend_srl_list[$i]);
|
||||
if(!$friend_srl)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$target[] = $friend_srl;
|
||||
}
|
||||
if(!count($target)) return new Object(-1,'msg_cart_is_null');
|
||||
|
||||
if(!count($target))
|
||||
{
|
||||
return new Object(-1, 'msg_cart_is_null');
|
||||
}
|
||||
|
||||
// Variables
|
||||
$args->friend_srls = implode(',',$target);
|
||||
$args = new stdClass();
|
||||
$args->friend_srls = implode(',', $target);
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
$args->friend_group_srl = Context::get('target_friend_group_srl');
|
||||
|
||||
$output = executeQuery('communication.moveFriend', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$this->setMessage('success_moved');
|
||||
|
||||
|
|
@ -376,9 +530,14 @@ class communicationController extends communication
|
|||
function procCommunicationDeleteFriend()
|
||||
{
|
||||
// Check login information
|
||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return new Object(-1, 'msg_not_logged');
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
$member_srl = $logged_info->member_srl;
|
||||
|
||||
// Check variables
|
||||
$friend_srl_list = Context::get('friend_srl_list');
|
||||
|
||||
|
|
@ -386,22 +545,40 @@ class communicationController extends communication
|
|||
{
|
||||
$friend_srl_list = explode('|@|', $friend_srl_list);
|
||||
}
|
||||
if(!count($friend_srl_list)) return new Object(-1, 'msg_cart_is_null');
|
||||
|
||||
if(!count($friend_srl_list))
|
||||
{
|
||||
return new Object(-1, 'msg_cart_is_null');
|
||||
}
|
||||
|
||||
$friend_count = count($friend_srl_list);
|
||||
$target = array();
|
||||
for($i=0;$i<$friend_count;$i++)
|
||||
|
||||
for($i = 0; $i < $friend_count; $i++)
|
||||
{
|
||||
$friend_srl = (int)trim($friend_srl_list[$i]);
|
||||
if(!$friend_srl) continue;
|
||||
$friend_srl = (int) trim($friend_srl_list[$i]);
|
||||
if(!$friend_srl)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$target[] = $friend_srl;
|
||||
}
|
||||
if(!count($target)) return new Object(-1,'msg_cart_is_null');
|
||||
|
||||
if(!count($target))
|
||||
{
|
||||
return new Object(-1, 'msg_cart_is_null');
|
||||
}
|
||||
|
||||
// Delete
|
||||
$args->friend_srls = implode(',',$target);
|
||||
$args = new stdClass();
|
||||
$args->friend_srls = implode(',', $target);
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
$output = executeQuery('communication.deleteFriend', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$this->setMessage('success_deleted');
|
||||
|
||||
|
|
@ -416,14 +593,25 @@ class communicationController extends communication
|
|||
function procCommunicationAddFriendGroup()
|
||||
{
|
||||
// Check login information
|
||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return new Object(-1, 'msg_not_logged');
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
// Variables
|
||||
$args = new stdClass();
|
||||
$args->friend_group_srl = trim(Context::get('friend_group_srl'));
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
$args->title = Context::get('title');
|
||||
$args->title = Context::get('title');
|
||||
$args->title = htmlspecialchars($args->title);
|
||||
if(!$args->title) return new Object(-1, 'msg_invalid_request');
|
||||
|
||||
if(!$args->title)
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
// modify if friend_group_srl exists.
|
||||
if($args->friend_group_srl)
|
||||
{
|
||||
|
|
@ -439,7 +627,7 @@ class communicationController extends communication
|
|||
|
||||
if(!$output->toBool())
|
||||
{
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
|
||||
if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
|
||||
{
|
||||
global $lang;
|
||||
htmlHeader();
|
||||
|
|
@ -449,11 +637,14 @@ class communicationController extends communication
|
|||
Context::close();
|
||||
exit;
|
||||
}
|
||||
else return $output;
|
||||
else
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
|
||||
if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
|
||||
{
|
||||
global $lang;
|
||||
htmlHeader();
|
||||
|
|
@ -464,7 +655,10 @@ class communicationController extends communication
|
|||
Context::close();
|
||||
exit;
|
||||
}
|
||||
else $this->setMessage($msg_code);
|
||||
else
|
||||
{
|
||||
$this->setMessage($msg_code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -475,17 +669,30 @@ class communicationController extends communication
|
|||
function procCommunicationRenameFriendGroup()
|
||||
{
|
||||
// Check login information
|
||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return new Object(-1, 'msg_not_logged');
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
// Variables
|
||||
$args->friend_group_srl= Context::get('friend_group_srl');
|
||||
$args = new stdClass();
|
||||
$args->friend_group_srl = Context::get('friend_group_srl');
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
$args->title = Context::get('title');
|
||||
$args->title = Context::get('title');
|
||||
$args->title = htmlspecialchars($args->title);
|
||||
if(!$args->title) return new Object(-1, 'msg_invalid_request');
|
||||
|
||||
if(!$args->title)
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
$output = executeQuery('communication.renameFriendGroup', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$this->setMessage('success_updated');
|
||||
}
|
||||
|
|
@ -497,13 +704,22 @@ class communicationController extends communication
|
|||
function procCommunicationDeleteFriendGroup()
|
||||
{
|
||||
// Check login information
|
||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return new Object(-1, 'msg_not_logged');
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
// Variables
|
||||
$args = new stdClass();
|
||||
$args->friend_group_srl = Context::get('friend_group_srl');
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
$output = executeQuery('communication.deleteFriendGroup', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$this->setMessage('success_deleted');
|
||||
}
|
||||
|
|
@ -515,6 +731,7 @@ class communicationController extends communication
|
|||
*/
|
||||
function setMessageReaded($message_srl)
|
||||
{
|
||||
$args = new stdClass();
|
||||
$args->message_srl = $message_srl;
|
||||
$args->related_srl = $message_srl;
|
||||
return executeQuery('communication.setMessageReaded', $args);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
require_once(_XE_PATH_.'modules/communication/communication.view.php');
|
||||
|
||||
require_once(_XE_PATH_ . 'modules/communication/communication.view.php');
|
||||
|
||||
/**
|
||||
* @class communicationMobile
|
||||
|
|
@ -8,9 +9,10 @@ require_once(_XE_PATH_.'modules/communication/communication.view.php');
|
|||
*/
|
||||
class communicationMobile extends communicationView
|
||||
{
|
||||
|
||||
function init()
|
||||
{
|
||||
$oCommunicationModel = &getModel('communication');
|
||||
$oCommunicationModel = getModel('communication');
|
||||
|
||||
$this->communication_config = $oCommunicationModel->getConfig();
|
||||
$skin = $this->communication_config->mskin;
|
||||
|
|
@ -20,7 +22,7 @@ class communicationMobile extends communicationView
|
|||
$tpl_path = sprintf('%sm.skins/%s', $this->module_path, $skin);
|
||||
$this->setTemplatePath($tpl_path);
|
||||
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$oLayoutModel = getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayout($this->communication_config->mlayout_srl);
|
||||
if($layout_info)
|
||||
{
|
||||
|
|
@ -50,18 +52,20 @@ class communicationMobile extends communicationView
|
|||
// Set the variables
|
||||
$message_srl = Context::get('message_srl');
|
||||
$message_type = Context::get('message_type');
|
||||
if(!in_array($message_type, array('R','S','T')))
|
||||
if(!in_array($message_type, array('R', 'S', 'T')))
|
||||
{
|
||||
$message_type = 'R';
|
||||
Context::set('message_type', $message_type);
|
||||
}
|
||||
$oCommunicationModel = &getModel('communication');
|
||||
$oCommunicationModel = getModel('communication');
|
||||
|
||||
// extract contents if message_srl exists
|
||||
if($message_srl)
|
||||
if($message_srl)
|
||||
{
|
||||
$templateFile = 'read_message';
|
||||
$columnList = array('message_srl', 'sender_srl', 'receiver_srl', 'message_type', 'title', 'content', 'readed', 'regdate');
|
||||
$message = $oCommunicationModel->getSelectedMessage($message_srl, $columnList);
|
||||
|
||||
switch($message->message_type)
|
||||
{
|
||||
case 'R':
|
||||
|
|
@ -70,12 +74,14 @@ class communicationMobile extends communicationView
|
|||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
if($message->sender_srl != $logged_info->member_srl)
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
if($message->receiver_srl != $logged_info->member_srl && $message->sender_srl != $logged_info->member_srl)
|
||||
{
|
||||
|
|
@ -83,7 +89,8 @@ class communicationMobile extends communicationView
|
|||
}
|
||||
break;
|
||||
}
|
||||
if($message->message_srl == $message_srl && ($message->receiver_srl == $logged_info->member_srl || $message->sender_srl == $logged_info->member_srl) )
|
||||
|
||||
if($message->message_srl == $message_srl && ($message->receiver_srl == $logged_info->member_srl || $message->sender_srl == $logged_info->member_srl))
|
||||
{
|
||||
stripEmbedTagForAdmin($message->content, $message->sender_srl);
|
||||
Context::set('message', $message);
|
||||
|
|
@ -93,6 +100,7 @@ class communicationMobile extends communicationView
|
|||
{
|
||||
$templateFile = 'messages';
|
||||
}
|
||||
|
||||
// Extract a list
|
||||
$columnList = array('message_srl', 'readed', 'title', 'member.member_srl', 'member.nick_name', 'message.regdate', 'readed_date');
|
||||
$output = $oCommunicationModel->getMessages($message_type, $columnList);
|
||||
|
|
@ -125,19 +133,31 @@ class communicationMobile extends communicationView
|
|||
*/
|
||||
function dispCommunicationSendMessage()
|
||||
{
|
||||
$oCommunicationModel = &getModel('communication');
|
||||
$oMemberModel = &getModel('member');
|
||||
// Error appears if not logged-in
|
||||
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
||||
$logged_info = Context::get('logged_info');
|
||||
// get receipient's information
|
||||
$oCommunicationModel = getModel('communication');
|
||||
$oMemberModel = getModel('member');
|
||||
|
||||
// Error appears if not logged-in
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return $this->stop('msg_not_logged');
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
// get receipient's information
|
||||
// check inalid request
|
||||
$receiver_srl = Context::get('receiver_srl');
|
||||
if(!$receiver_srl) return $this->stop('msg_invalid_request');
|
||||
if(!$receiver_srl)
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
// check receiver and sender are same
|
||||
if($logged_info->member_srl == $receiver_srl) return $this->stop('msg_cannot_send_to_yourself');
|
||||
if($logged_info->member_srl == $receiver_srl)
|
||||
{
|
||||
return $this->stop('msg_cannot_send_to_yourself');
|
||||
}
|
||||
|
||||
// get message_srl of the original message if it is a reply
|
||||
$message_srl = Context::get('message_srl');
|
||||
if($message_srl)
|
||||
|
|
@ -145,8 +165,8 @@ class communicationMobile extends communicationView
|
|||
$source_message = $oCommunicationModel->getSelectedMessage($message_srl);
|
||||
if($source_message->message_srl == $message_srl && $source_message->sender_srl == $receiver_srl)
|
||||
{
|
||||
$source_message->title = "[re] ".$source_message->title;
|
||||
$source_message->content = "\r\n<br />\r\n<br /><div style=\"padding-left:5px; border-left:5px solid #DDDDDD;\">".trim($source_message->content)."</div>";
|
||||
$source_message->title = "[re] " . $source_message->title;
|
||||
$source_message->content = "\r\n<br />\r\n<br /><div style=\"padding-left:5px; border-left:5px solid #DDDDDD;\">" . trim($source_message->content) . "</div>";
|
||||
Context::set('source_message', $source_message);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @class communicationModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
|
|
@ -6,12 +7,14 @@
|
|||
*/
|
||||
class communicationModel extends communication
|
||||
{
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -20,18 +23,33 @@ class communicationModel extends communication
|
|||
*/
|
||||
function getConfig()
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleModel = getModel('module');
|
||||
$communication_config = $oModuleModel->getModuleConfig('communication');
|
||||
|
||||
if(!$communication_config)
|
||||
if(!is_object($communication_config))
|
||||
{
|
||||
$communication_config = new stdClass();
|
||||
}
|
||||
|
||||
if(!$communication_config->skin) $communication_config->skin = 'default';
|
||||
if(!$communication_config->colorset) $communication_config->colorset = 'white';
|
||||
if(!$communication_config->editor_skin) $communication_config->editor_skin = 'default';
|
||||
if(!$communication_config->mskin) $communication_config->mskin = 'default';
|
||||
if(!$communication_config->skin)
|
||||
{
|
||||
$communication_config->skin = 'default';
|
||||
}
|
||||
|
||||
if(!$communication_config->colorset)
|
||||
{
|
||||
$communication_config->colorset = 'white';
|
||||
}
|
||||
|
||||
if(!$communication_config->editor_skin)
|
||||
{
|
||||
$communication_config->editor_skin = 'default';
|
||||
}
|
||||
|
||||
if(!$communication_config->mskin)
|
||||
{
|
||||
$communication_config->mskin = 'default';
|
||||
}
|
||||
|
||||
return $communication_config;
|
||||
}
|
||||
|
|
@ -46,27 +64,44 @@ class communicationModel extends communication
|
|||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
$args = new stdClass();
|
||||
$args->message_srl = $message_srl;
|
||||
$output = executeQuery('communication.getMessage',$args, $columnList);
|
||||
$output = executeQuery('communication.getMessage', $args, $columnList);
|
||||
|
||||
$message = $output->data;
|
||||
if(!$message) return ;
|
||||
if(!$message)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// get recipient's information if it is a sent message
|
||||
$oMemberModel = &getModel('member');
|
||||
if($message->sender_srl == $logged_info->member_srl && $message->message_type == 'S') $member_info = $oMemberModel->getMemberInfoByMemberSrl($message->receiver_srl);
|
||||
$oMemberModel = getModel('member');
|
||||
|
||||
if($message->sender_srl == $logged_info->member_srl && $message->message_type == 'S')
|
||||
{
|
||||
$member_info = $oMemberModel->getMemberInfoByMemberSrl($message->receiver_srl);
|
||||
}
|
||||
// get sendor's information if it is a received/archived message
|
||||
else $member_info = $oMemberModel->getMemberInfoByMemberSrl($message->sender_srl);
|
||||
else
|
||||
{
|
||||
$member_info = $oMemberModel->getMemberInfoByMemberSrl($message->sender_srl);
|
||||
}
|
||||
|
||||
if($member_info)
|
||||
{
|
||||
foreach($member_info as $key => $val)
|
||||
{
|
||||
if($key != 'regdate') $message->{$key} = $val;
|
||||
if($key != 'regdate')
|
||||
{
|
||||
$message->{$key} = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// change the status if is a received and not yet read message
|
||||
if($message->message_type == 'R' && $message->readed != 'Y')
|
||||
{
|
||||
$oCommunicationController = &getController('communication');
|
||||
$oCommunicationController = getController('communication');
|
||||
$oCommunicationController->setMessageReaded($message_srl);
|
||||
}
|
||||
|
||||
|
|
@ -81,14 +116,20 @@ class communicationModel extends communication
|
|||
function getNewMessage($columnList = array())
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
$args = new stdClass();
|
||||
$args->receiver_srl = $logged_info->member_srl;
|
||||
$args->readed = 'N';
|
||||
|
||||
$output = executeQuery('communication.getNewMessage', $args, $columnList);
|
||||
if(!count($output->data)) return;
|
||||
if(!count($output->data))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$message = array_pop($output->data);
|
||||
|
||||
$oCommunicationController = &getController('communication');
|
||||
$oCommunicationController = getController('communication');
|
||||
$oCommunicationController->setMessageReaded($message->message_srl);
|
||||
|
||||
return $message;
|
||||
|
|
@ -112,22 +153,26 @@ class communicationModel extends communication
|
|||
$args->message_type = 'R';
|
||||
$query_id = 'communication.getReceivedMessages';
|
||||
break;
|
||||
|
||||
case 'T' :
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
$args->message_type = 'T';
|
||||
$query_id = 'communication.getStoredMessages';
|
||||
break;
|
||||
|
||||
default :
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
$args->message_type = 'S';
|
||||
$query_id = 'communication.getSendedMessages';
|
||||
break;
|
||||
}
|
||||
|
||||
// Other variables
|
||||
$args->sort_index = 'message.list_order';
|
||||
$args->page = Context::get('page');
|
||||
$args->list_count = 20;
|
||||
$args->page_count = 10;
|
||||
|
||||
return executeQuery($query_id, $args, $columnList);
|
||||
}
|
||||
|
||||
|
|
@ -141,15 +186,18 @@ class communicationModel extends communication
|
|||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
$args =new stdClass();
|
||||
$args = new stdClass();
|
||||
$args->friend_group_srl = $friend_group_srl;
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
|
||||
// Other variables
|
||||
$args->page = Context::get('page');
|
||||
$args->sort_index = 'friend.list_order';
|
||||
$args->list_count = 10;
|
||||
$args->page_count = 10;
|
||||
|
||||
$output = executeQuery('communication.getFriends', $args, $columnList);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
@ -162,9 +210,12 @@ class communicationModel extends communication
|
|||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
$args = new stdClass();
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
$args->target_srl = $member_srl;
|
||||
|
||||
$output = executeQuery('communication.isAddedFriend', $args);
|
||||
|
||||
return $output->data->count;
|
||||
}
|
||||
|
||||
|
|
@ -177,10 +228,12 @@ class communicationModel extends communication
|
|||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
$args = new stdClass();
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
$args->friend_group_srl = $friend_group_srl;
|
||||
|
||||
$output = executeQuery('communication.getFriendGroup', $args);
|
||||
|
||||
return $output->data;
|
||||
}
|
||||
|
||||
|
|
@ -191,12 +244,18 @@ class communicationModel extends communication
|
|||
function getFriendGroups()
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
$args =new stdClass();
|
||||
|
||||
$args = new stdClass();
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
|
||||
$output = executeQueryArray('communication.getFriendGroups', $args);
|
||||
|
||||
$group_list = $output->data;
|
||||
if(!$group_list) return;
|
||||
if(!$group_list)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
return $group_list;
|
||||
}
|
||||
|
||||
|
|
@ -209,12 +268,20 @@ class communicationModel extends communication
|
|||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
$args = new stdClass();
|
||||
$args->member_srl = $target_srl;
|
||||
$args->target_srl = $logged_info->member_srl;
|
||||
|
||||
$output = executeQuery('communication.isAddedFriend', $args);
|
||||
if($output->data->count) return true;
|
||||
return false;
|
||||
|
||||
if($output->data->count)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file communication.model.php */
|
||||
/* Location: ./modules/comment/communication.model.php */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @class communicationView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
|
|
@ -6,13 +7,14 @@
|
|||
*/
|
||||
class communicationView extends communication
|
||||
{
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
$oCommunicationModel = &getModel('communication');
|
||||
$oCommunicationModel = getModel('communication');
|
||||
|
||||
$this->communication_config = $oCommunicationModel->getConfig();
|
||||
$skin = $this->communication_config->skin;
|
||||
|
|
@ -20,7 +22,8 @@ class communicationView extends communication
|
|||
Context::set('communication_config', $this->communication_config);
|
||||
|
||||
$config_parse = explode('|@|', $skin);
|
||||
if (count($config_parse) > 1)
|
||||
|
||||
if(count($config_parse) > 1)
|
||||
{
|
||||
$tpl_path = sprintf('./themes/%s/modules/communication/', $config_parse[0]);
|
||||
}
|
||||
|
|
@ -28,9 +31,10 @@ class communicationView extends communication
|
|||
{
|
||||
$tpl_path = sprintf('%sskins/%s', $this->module_path, $skin);
|
||||
}
|
||||
|
||||
$this->setTemplatePath($tpl_path);
|
||||
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$oLayoutModel = getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayout($this->communication_config->layout_srl);
|
||||
if($layout_info)
|
||||
{
|
||||
|
|
@ -46,8 +50,13 @@ class communicationView extends communication
|
|||
function dispCommunicationMessages()
|
||||
{
|
||||
// Error appears if not logged-in
|
||||
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return $this->stop('msg_not_logged');
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
if(!array_key_exists('dispCommunicationMessages', $logged_info->menu_list))
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
|
|
@ -56,18 +65,21 @@ class communicationView extends communication
|
|||
// Set the variables
|
||||
$message_srl = Context::get('message_srl');
|
||||
$message_type = Context::get('message_type');
|
||||
if(!in_array($message_type, array('R','S','T')))
|
||||
|
||||
if(!in_array($message_type, array('R', 'S', 'T')))
|
||||
{
|
||||
$message_type = 'R';
|
||||
Context::set('message_type', $message_type);
|
||||
}
|
||||
|
||||
$oCommunicationModel = &getModel('communication');
|
||||
$oCommunicationModel = getModel('communication');
|
||||
|
||||
// extract contents if message_srl exists
|
||||
if($message_srl)
|
||||
{
|
||||
$columnList = array('message_srl', 'sender_srl', 'receiver_srl', 'message_type', 'title', 'content', 'readed', 'regdate');
|
||||
$message = $oCommunicationModel->getSelectedMessage($message_srl, $columnList);
|
||||
|
||||
switch($message->message_type)
|
||||
{
|
||||
case 'R':
|
||||
|
|
@ -76,12 +88,14 @@ class communicationView extends communication
|
|||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
if($message->sender_srl != $logged_info->member_srl)
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
if($message->receiver_srl != $logged_info->member_srl && $message->sender_srl != $logged_info->member_srl)
|
||||
{
|
||||
|
|
@ -89,12 +103,14 @@ class communicationView extends communication
|
|||
}
|
||||
break;
|
||||
}
|
||||
if($message->message_srl == $message_srl && ($message->receiver_srl == $logged_info->member_srl || $message->sender_srl == $logged_info->member_srl) )
|
||||
|
||||
if($message->message_srl == $message_srl && ($message->receiver_srl == $logged_info->member_srl || $message->sender_srl == $logged_info->member_srl))
|
||||
{
|
||||
stripEmbedTagForAdmin($message->content, $message->sender_srl);
|
||||
Context::set('message', $message);
|
||||
}
|
||||
}
|
||||
|
||||
// Extract a list
|
||||
$columnList = array('message_srl', 'readed', 'title', 'member.member_srl', 'member.nick_name', 'message.regdate', 'readed_date');
|
||||
$output = $oCommunicationModel->getMessages($message_type, $columnList);
|
||||
|
|
@ -120,11 +136,17 @@ class communicationView extends communication
|
|||
{
|
||||
$this->setLayoutPath('./common/tpl/');
|
||||
$this->setLayoutFile('popup_layout');
|
||||
|
||||
// Error appears if not logged-in
|
||||
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return $this->stop('msg_not_logged');
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
$oCommunicationModel = &getModel('communication');
|
||||
$oCommunicationModel = getModel('communication');
|
||||
|
||||
// get a new message
|
||||
$columnList = array('message_srl', 'member_srl', 'nick_name', 'title', 'content', 'sender_srl');
|
||||
$message = $oCommunicationModel->getNewMessage($columnList);
|
||||
|
|
@ -135,7 +157,7 @@ class communicationView extends communication
|
|||
}
|
||||
|
||||
// Delete a flag
|
||||
$flag_path = './files/communication_extra_info/new_message_flags/'.getNumberingPath($logged_info->member_srl);
|
||||
$flag_path = './files/communication_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl);
|
||||
$flag_file = sprintf('%s%s', $flag_path, $logged_info->member_srl);
|
||||
FileHandler::removeFile($flag_file);
|
||||
|
||||
|
|
@ -150,19 +172,32 @@ class communicationView extends communication
|
|||
{
|
||||
$this->setLayoutPath('./common/tpl/');
|
||||
$this->setLayoutFile("popup_layout");
|
||||
$oCommunicationModel = &getModel('communication');
|
||||
$oMemberModel = &getModel('member');
|
||||
// Error appears if not logged-in
|
||||
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
||||
$logged_info = Context::get('logged_info');
|
||||
// get receipient's information
|
||||
|
||||
$oCommunicationModel = getModel('communication');
|
||||
$oMemberModel = getModel('member');
|
||||
|
||||
// Error appears if not logged-in
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return $this->stop('msg_not_logged');
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
// get receipient's information
|
||||
// check inalid request
|
||||
$receiver_srl = Context::get('receiver_srl');
|
||||
if(!$receiver_srl) return $this->stop('msg_invalid_request');
|
||||
if(!$receiver_srl)
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
// check receiver and sender are same
|
||||
if($logged_info->member_srl == $receiver_srl) return $this->stop('msg_cannot_send_to_yourself');
|
||||
if($logged_info->member_srl == $receiver_srl)
|
||||
{
|
||||
return $this->stop('msg_cannot_send_to_yourself');
|
||||
}
|
||||
|
||||
// get message_srl of the original message if it is a reply
|
||||
$message_srl = Context::get('message_srl');
|
||||
if($message_srl)
|
||||
|
|
@ -170,8 +205,8 @@ class communicationView extends communication
|
|||
$source_message = $oCommunicationModel->getSelectedMessage($message_srl);
|
||||
if($source_message->message_srl == $message_srl && $source_message->sender_srl == $receiver_srl)
|
||||
{
|
||||
$source_message->title = "[re] ".$source_message->title;
|
||||
$source_message->content = "\r\n<br />\r\n<br /><div style=\"padding-left:5px; border-left:5px solid #DDDDDD;\">".trim($source_message->content)."</div>";
|
||||
$source_message->title = "[re] " . $source_message->title;
|
||||
$source_message->content = "\r\n<br />\r\n<br /><div style=\"padding-left:5px; border-left:5px solid #DDDDDD;\">" . trim($source_message->content) . "</div>";
|
||||
Context::set('source_message', $source_message);
|
||||
}
|
||||
}
|
||||
|
|
@ -183,16 +218,18 @@ class communicationView extends communication
|
|||
}
|
||||
|
||||
Context::set('receiver_info', $receiver_info);
|
||||
|
||||
// set a signiture by calling getEditor of the editor module
|
||||
$oEditorModel = &getModel('editor');
|
||||
$oEditorModel = getModel('editor');
|
||||
$option = new stdClass();
|
||||
$option->primary_key_name = 'receiver_srl';
|
||||
$option->content_key_name = 'content';
|
||||
$option->allow_fileupload = false;
|
||||
$option->enable_autosave = false;
|
||||
$option->enable_default_component = true;// false;
|
||||
$option->enable_component = false;
|
||||
$option->resizable = false;
|
||||
$option->disable_html = true;
|
||||
$option->allow_fileupload = FALSE;
|
||||
$option->enable_autosave = FALSE;
|
||||
$option->enable_default_component = TRUE; // FALSE;
|
||||
$option->enable_component = FALSE;
|
||||
$option->resizable = FALSE;
|
||||
$option->disable_html = TRUE;
|
||||
$option->height = 300;
|
||||
$option->skin = $this->communication_config->editor_skin;
|
||||
$option->colorset = $this->communication_config->editor_colorset;
|
||||
|
|
@ -206,31 +243,48 @@ class communicationView extends communication
|
|||
* display a list of friends
|
||||
* @return void|Object (void : success, Object : fail)
|
||||
*/
|
||||
function dispCommunicationFriend() {
|
||||
function dispCommunicationFriend()
|
||||
{
|
||||
// Error appears if not logged-in
|
||||
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return $this->stop('msg_not_logged');
|
||||
}
|
||||
|
||||
$oCommunicationModel = getModel('communication');
|
||||
|
||||
$oCommunicationModel = &getModel('communication');
|
||||
// get a group list
|
||||
$tmp_group_list = $oCommunicationModel->getFriendGroups();
|
||||
$group_count = count($tmp_group_list);
|
||||
for($i=0;$i<$group_count;$i++) $friend_group_list[$tmp_group_list[$i]->friend_group_srl] = $tmp_group_list[$i];
|
||||
|
||||
for($i = 0; $i < $group_count; $i++)
|
||||
{
|
||||
$friend_group_list[$tmp_group_list[$i]->friend_group_srl] = $tmp_group_list[$i];
|
||||
}
|
||||
|
||||
Context::set('friend_group_list', $friend_group_list);
|
||||
|
||||
// get a list of friends
|
||||
$friend_group_srl = Context::get('friend_group_srl');
|
||||
$columnList = array('friend_srl', 'friend_group_srl', 'target_srl', 'member.nick_name', 'friend.regdate');
|
||||
|
||||
$output = $oCommunicationModel->getFriends($friend_group_srl, $columnList);
|
||||
$friend_count = count($output->data);
|
||||
|
||||
if($friend_count)
|
||||
{
|
||||
foreach($output->data as $key => $val)
|
||||
{
|
||||
$group_srl = $val->friend_group_srl;
|
||||
$group_title = $friend_group_list[$group_srl]->title;
|
||||
if(!$group_title) $group_title = Context::get('default_friend_group');
|
||||
if(!$group_title)
|
||||
{
|
||||
$group_title = Context::get('default_friend_group');
|
||||
}
|
||||
$output->data[$key]->group_title = $group_title;
|
||||
}
|
||||
}
|
||||
|
||||
// set a template file
|
||||
Context::set('total_count', $output->total_count);
|
||||
Context::set('total_page', $output->total_page);
|
||||
|
|
@ -249,18 +303,33 @@ class communicationView extends communication
|
|||
{
|
||||
$this->setLayoutPath('./common/tpl/');
|
||||
$this->setLayoutFile("popup_layout");
|
||||
// error appears if not logged-in
|
||||
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
// error appears if not logged-in
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return $this->stop('msg_not_logged');
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
$target_srl = Context::get('target_srl');
|
||||
if(!$target_srl) return $this->stop('msg_invalid_request');
|
||||
|
||||
if(!$target_srl)
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
// get information of the member
|
||||
$oMemberModel = &getModel('member');
|
||||
$oCommunicationModel = &getModel('communication');
|
||||
$oMemberModel = getModel('member');
|
||||
$oCommunicationModel = getModel('communication');
|
||||
$communication_info = $oMemberModel->getMemberInfoByMemberSrl($target_srl);
|
||||
if($communication_info->member_srl != $target_srl) return $this->stop('msg_invalid_request');
|
||||
|
||||
if($communication_info->member_srl != $target_srl)
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
Context::set('target_info', $communication_info);
|
||||
|
||||
// get a group list
|
||||
$friend_group_list = $oCommunicationModel->getFriendGroups();
|
||||
Context::set('friend_group_list', $friend_group_list);
|
||||
|
|
@ -276,19 +345,30 @@ class communicationView extends communication
|
|||
{
|
||||
$this->setLayoutPath('./common/tpl/');
|
||||
$this->setLayoutFile("popup_layout");
|
||||
|
||||
// error apprears if not logged-in
|
||||
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return $this->stop('msg_not_logged');
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
// change to edit mode when getting the group_srl
|
||||
$friend_group_srl = Context::get('friend_group_srl');
|
||||
if($friend_group_srl)
|
||||
{
|
||||
$oCommunicationModel = &getModel('communication');
|
||||
$oCommunicationModel = getModel('communication');
|
||||
$friend_group = $oCommunicationModel->getFriendGroupInfo($friend_group_srl);
|
||||
if($friend_group->friend_group_srl == $friend_group_srl) Context::set('friend_group', $friend_group);
|
||||
if($friend_group->friend_group_srl == $friend_group_srl)
|
||||
{
|
||||
Context::set('friend_group', $friend_group);
|
||||
}
|
||||
}
|
||||
|
||||
$this->setTemplateFile('add_friend_group');
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file communication.view.php */
|
||||
/* Location: ./modules/comment/communication.view.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue