*/ $language_file = array('userInfo', 'forum'); $cidReset = true; require_once '../inc/global.inc.php'; api_block_anonymous_users(); if (api_get_setting('allow_social_tool') !='true') { api_not_allowed(); } require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php'; $group_id = intval($_GET['id']); $topic_id = intval($_GET['topic_id']); $message_id = intval($_GET['msg_id']); //todo @this validation could be in a function in group_portal_manager if (empty($group_id)) { api_not_allowed(true); } else { $group_info = GroupPortalManager::get_group_data($group_id); if (empty($group_info)) { api_not_allowed(true); } $is_member = GroupPortalManager::is_group_member($group_id); if ($group_info['visibility'] == GROUP_PERMISSION_CLOSED && !$is_member ) { api_not_allowed(true); } } // save message group if (isset($_POST['token']) && $_POST['token'] === $_SESSION['sec_token']) { if (isset($_POST['action'])) { $title = isset($_POST['title']) ? $_POST['title'] : null; $content = $_POST['content']; $group_id = intval($_POST['group_id']); $parent_id = intval($_POST['parent_id']); if ($_POST['action'] == 'reply_message_group') { $title = cut($content, 50); } if ($_POST['action'] == 'edit_message_group') { $edit_message_id = intval($_POST['message_id']); $res = MessageManager::send_message(0, $title, $content, $_FILES, '', $group_id, $parent_id, $edit_message_id, 0, $topic_id); } else { if ($_POST['action'] == 'add_message_group' && !$is_member) { api_not_allowed(); } $res = MessageManager::send_message(0, $title, $content, $_FILES, '', $group_id, $parent_id, 0, $topic_id); } // display error messages if (!$res) { $social_right_content .= Display::return_message(get_lang('Error'),'error'); } $topic_id = intval($_GET['topic_id']); if ($_POST['action'] == 'add_message_group') { $topic_id = $res; } $message_id = $res; } } $htmlHeadXtra[] = api_get_jquery_ui_js(); $htmlHeadXtra[] = ''; $this_section = SECTION_SOCIAL; $interbreadcrumb[] = array ('url' =>'home.php', 'name' => get_lang('Social')); $interbreadcrumb[] = array('url' => 'groups.php', 'name' => get_lang('Groups')); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Thread')); $social_left_content = SocialManager::show_social_menu('member_list', $group_id); $social_right_content .= '