mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-01 08:12:17 +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 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