diff --git a/modules/communication/communication.admin.controller.php b/modules/communication/communication.admin.controller.php
index 75900a8ac..43ad84679 100644
--- a/modules/communication/communication.admin.controller.php
+++ b/modules/communication/communication.admin.controller.php
@@ -1,4 +1,5 @@
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 */
diff --git a/modules/communication/communication.admin.model.php b/modules/communication/communication.admin.model.php
index 2f3681534..38d318cdf 100644
--- a/modules/communication/communication.admin.model.php
+++ b/modules/communication/communication.admin.model.php
@@ -1,4 +1,5 @@
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);
diff --git a/modules/communication/communication.admin.view.php b/modules/communication/communication.admin.view.php
index b0fddfa43..d34c8eb6e 100644
--- a/modules/communication/communication.admin.view.php
+++ b/modules/communication/communication.admin.view.php
@@ -1,4 +1,5 @@
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 */
diff --git a/modules/communication/communication.class.php b/modules/communication/communication.class.php
index d274996f8..d9438d6c8 100644
--- a/modules/communication/communication.class.php
+++ b/modules/communication/communication.class.php
@@ -1,4 +1,5 @@
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 */
diff --git a/modules/communication/communication.controller.php b/modules/communication/communication.controller.php
index 4dea4706c..d72c8252b 100644
--- a/modules/communication/communication.controller.php
+++ b/modules/communication/communication.controller.php
@@ -1,4 +1,5 @@
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
From : %s",$content, $view_url, $view_url);
+ $content = sprintf("%s
From : %s", $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);
diff --git a/modules/communication/communication.mobile.php b/modules/communication/communication.mobile.php
index 3085310f8..c7337234d 100644
--- a/modules/communication/communication.mobile.php
+++ b/modules/communication/communication.mobile.php
@@ -1,5 +1,6 @@
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
\r\n