diff --git a/modules/communication/communication.admin.controller.php b/modules/communication/communication.admin.controller.php index 0b52ad2b2..fd05dcb35 100644 --- a/modules/communication/communication.admin.controller.php +++ b/modules/communication/communication.admin.controller.php @@ -24,39 +24,14 @@ class communicationAdminController extends communication function procCommunicationAdminInsertConfig() { // get the default information - $args = Context::gets('enable_message', 'enable_friend', 'skin', 'colorset', 'editor_skin', 'sel_editor_colorset', 'mskin', 'mcolorset', 'layout_srl', 'mlayout_srl', 'grant_write_default','grant_write_group'); + $args = Context::gets('enable_message', 'enable_friend', 'skin', 'colorset', 'editor_skin', 'sel_editor_colorset', 'mskin', 'mcolorset', 'layout_srl', 'mlayout_srl', 'grant_send_default','grant_send_group'); $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; - } - $oCommunicationModel = getModel('communication'); - $args->grant_write = $oCommunicationModel->getGrantArray($args->grant_write_default, $args->grant_write_group); - unset($args->grant_write_default); - unset($args->grant_write_group); + $args->grant_send = $oCommunicationModel->getGrantArray($args->grant_send_default, $args->grant_send_group); + unset($args->grant_send_default); + unset($args->grant_send_group); // create the module module Controller object $oModuleController = getController('module'); diff --git a/modules/communication/communication.controller.php b/modules/communication/communication.controller.php index 65c4295cb..b45dd42e6 100644 --- a/modules/communication/communication.controller.php +++ b/modules/communication/communication.controller.php @@ -89,7 +89,7 @@ class communicationController extends communication $oCommunicationModel = getModel('communication'); $config = $oCommunicationModel->getConfig(); - if(!$oCommunicationModel->checkWriteGrant($config->grant_write)) + if(!$oCommunicationModel->checkGrant($config->grant_send)) { return new Object(-1, 'msg_not_permitted'); } diff --git a/modules/communication/communication.model.php b/modules/communication/communication.model.php index 0055b9421..b4bb6974c 100644 --- a/modules/communication/communication.model.php +++ b/modules/communication/communication.model.php @@ -46,10 +46,10 @@ class communicationModel extends communication { $config->mskin = 'default'; } - - if(!$config->grant_write) + + if(!$config->grant_send) { - $config->grant_write = array('default_grant' => 'member'); + $config->grant_send = array('default' => 'member'); } if(!$config->enable_message) @@ -76,62 +76,54 @@ class communicationModel extends communication $grant = array(); if($default) { - switch($default) - { - case "-2": - $grant = array("default_grant"=>"site"); - break; - case "-3": - $grant = array("default_grant"=>"manager"); - break; - default : - $grant = array("default_grant"=>"member"); - break; - } - } + $grant = array('default' => $default); + } else if(is_array($group)) { - $group_grant = array(); + $grant_group = array(); foreach($group as $group_srl) { - $group_grant[$group_srl] = true; + $grant_group[$group_srl] = true; } - $grant = array('group_grant' => $group_grant); + $grant = array('group' => $grant_group); } return $grant; } /** - * @brief Check Write Grant + * @brief Check Grant * @param array $arrGrant * @return boolean */ - function checkWriteGrant($arrGrant) + function checkGrant($arrGrant) { if(!$arrGrant) return false; $logged_info = Context::get('logged_info'); - if($logged_info->is_admin == "Y") return true; + if($logged_info->is_admin == 'Y') return true; - if($arrGrant['default_grant']) + if($arrGrant['default']) { - if($arrGrant['default_grant'] == "member" && Context::get('is_logged')) return true; - - if($arrGrant['default_grant'] == "site" && $this->site_srl == $logged_info->site_srl) return true; - - if($arrGrant['default_grant'] == "manager" && $logged_info->is_admin == "Y") return true; + if($arrGrant['default'] == 'member') + { + if(Context::get('is_logged')) return true; + } + else if($arrGrant['default'] == 'site') + { + if($this->site_srl == $logged_info->site_srl) return true; + } + else if($arrGrant['default'] == 'manager') + { + if($logged_info->is_admin == 'Y') return true; + } } - - if($arrGrant['group_grant']) + else if(is_array($arrGrant['group'])) { - $group_grant = $arrGrant['group_grant']; - if(!is_array($group_grant)) return false; - foreach($logged_info->group_list as $group_srl => $title) { - if($group_grant[$group_srl]) return true; + if(isset($arrGrant['group'][$group_srl])) return true; } } diff --git a/modules/communication/tpl/index.html b/modules/communication/tpl/index.html index c89cbd30d..4f3909820 100644 --- a/modules/communication/tpl/index.html +++ b/modules/communication/tpl/index.html @@ -101,18 +101,27 @@
- +
- + + + + -