From ba77850d36800f3e35b740612e85fbd3ed2f9236 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 5 May 2011 17:40:41 +0200 Subject: [PATCH 1/2] Blocking social network is feature is not enabled by the admin --- main/social/friends.php | 3 +++ main/social/group_add.php | 8 ++++++-- main/social/group_edit.php | 8 +++++++- main/social/group_members.php | 7 ++++++- main/social/group_waiting_list.php | 8 +++++++- main/social/groups.php | 7 ++++++- main/social/home.php | 5 ++++- main/social/invitations.php | 6 ++++++ main/social/message_for_group_form.inc.php | 14 ++++++-------- main/social/myfiles.php | 10 ++++++++-- main/social/profile.php | 5 +++++ main/social/profile_friends_and_groups.inc.php | 3 +++ main/social/search.php | 3 +++ 13 files changed, 70 insertions(+), 17 deletions(-) diff --git a/main/social/friends.php b/main/social/friends.php index 450d840d63..47ee5875a4 100755 --- a/main/social/friends.php +++ b/main/social/friends.php @@ -16,6 +16,9 @@ require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; require_once api_get_path(LIBRARY_PATH).'social.lib.php'; api_block_anonymous_users(); +if (api_get_setting('allow_social_tool') !='true') { + api_not_allowed(); +} $this_section = SECTION_SOCIAL; diff --git a/main/social/group_add.php b/main/social/group_add.php index ac0ab9736b..48708821bc 100755 --- a/main/social/group_add.php +++ b/main/social/group_add.php @@ -8,12 +8,16 @@ $language_file= 'userInfo'; $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).'formvalidator/FormValidator.class.php'; require_once api_get_path(LIBRARY_PATH).'social.lib.php'; require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php'; -api_block_anonymous_users(); - if (api_get_setting('allow_students_to_create_groups_in_social') == 'false' && !api_is_allowed_to_edit()) { api_not_allowed(); } diff --git a/main/social/group_edit.php b/main/social/group_edit.php index a017ea6b3f..5f66dd00b7 100755 --- a/main/social/group_edit.php +++ b/main/social/group_edit.php @@ -8,7 +8,13 @@ // Language files that should be included $language_file = array('userInfo'); $cidReset = true; -include '../inc/global.inc.php'; +require_once '../inc/global.inc.php'; + +api_block_anonymous_users(); +if (api_get_setting('allow_social_tool') !='true') { + api_not_allowed(); +} + $this_section = SECTION_SOCIAL; $libpath = api_get_path(LIBRARY_PATH); diff --git a/main/social/group_members.php b/main/social/group_members.php index 25c38ae951..da31b99c6e 100755 --- a/main/social/group_members.php +++ b/main/social/group_members.php @@ -8,6 +8,12 @@ $language_file = array('userInfo'); $cidReset = true; require '../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'; require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; require_once api_get_path(LIBRARY_PATH).'social.lib.php'; @@ -16,7 +22,6 @@ $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('MemberList')); -api_block_anonymous_users(); $group_id = intval($_GET['id']); diff --git a/main/social/group_waiting_list.php b/main/social/group_waiting_list.php index 78613f2a82..b4057f3294 100755 --- a/main/social/group_waiting_list.php +++ b/main/social/group_waiting_list.php @@ -7,6 +7,12 @@ $cidReset = true; $language_file = array('userInfo'); require '../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'; require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; require_once api_get_path(LIBRARY_PATH).'social.lib.php'; @@ -15,7 +21,7 @@ $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('WaitingList')); -api_block_anonymous_users(); + $group_id = intval($_GET['id']); diff --git a/main/social/groups.php b/main/social/groups.php index 7f36237646..a6097cc5ef 100755 --- a/main/social/groups.php +++ b/main/social/groups.php @@ -7,13 +7,18 @@ $cidReset=true; $language_file = array('userInfo'); 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).'usermanager.lib.php'; require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php'; require_once api_get_path(LIBRARY_PATH).'social.lib.php'; require_once api_get_path(LIBRARY_PATH).'message.lib.php'; require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php'; -api_block_anonymous_users(); $this_section = SECTION_SOCIAL; diff --git a/main/social/home.php b/main/social/home.php index 4ddef1f34d..4e83fa6b7d 100755 --- a/main/social/home.php +++ b/main/social/home.php @@ -21,7 +21,10 @@ $this_section = SECTION_SOCIAL; unset($_SESSION['this_section']);//for hmtl editor repository api_block_anonymous_users(); -//jquery thickbox already called from main/inc/header.inc.php + +if (api_get_setting('allow_social_tool') !='true' ){ + api_not_allowed(); +} $htmlHeadXtra[] = ''; -api_block_anonymous_users(); + Display :: display_header($tool_name, 'Groups'); diff --git a/main/social/profile.php b/main/social/profile.php index 4c10f3000f..e2e2b66a29 100755 --- a/main/social/profile.php +++ b/main/social/profile.php @@ -15,6 +15,11 @@ require_once api_get_path(LIBRARY_PATH).'social.lib.php'; require_once api_get_path(LIBRARY_PATH).'array.lib.php'; require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php'; +if (api_get_setting('allow_social_tool') !='true') { + api_not_allowed(); +} + + $user_id = api_get_user_id(); $show_full_profile = true; diff --git a/main/social/profile_friends_and_groups.inc.php b/main/social/profile_friends_and_groups.inc.php index 239408f16d..cb0ae90710 100755 --- a/main/social/profile_friends_and_groups.inc.php +++ b/main/social/profile_friends_and_groups.inc.php @@ -5,6 +5,9 @@ $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).'usermanager.lib.php'; require_once api_get_path(LIBRARY_PATH).'message.lib.php'; diff --git a/main/social/search.php b/main/social/search.php index 18081dc7d4..78694ad2ba 100755 --- a/main/social/search.php +++ b/main/social/search.php @@ -14,6 +14,9 @@ require_once api_get_path(LIBRARY_PATH).'social.lib.php'; require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php'; api_block_anonymous_users(); +if (api_get_setting('allow_social_tool') !='true') { + api_not_allowed(); +} $this_section = SECTION_SOCIAL; $tool_name = get_lang('Search'); From 6452057d56a8186de72447e2ef042db58ef4fafd Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 5 May 2011 17:41:08 +0200 Subject: [PATCH 2/2] Fixing message tool if social network is not enabled --- index.php | 56 ++++++++++++++++++---------------- main/auth/profile.php | 10 +----- main/messages/inbox.php | 37 ++++++++++------------ main/messages/new_message.php | 20 ++++++------ main/messages/outbox.php | 14 ++++++--- main/messages/view_message.php | 20 +++++++----- user_portal.php | 17 ++++++----- 7 files changed, 88 insertions(+), 86 deletions(-) diff --git a/index.php b/index.php index 71956fe843..f22f40a6ee 100755 --- a/index.php +++ b/index.php @@ -226,30 +226,31 @@ echo ''; echo ''; - - } echo '
'; $id_content_right = ''; //LEFT CONTENT if (api_get_setting('allow_social_tool') != 'true') { - $id_content_right = 'inbox'; - echo ''; + $id_content_right = 'inbox'; } else { require_once api_get_path(LIBRARY_PATH).'social.lib.php'; $id_content_right = 'social-content-right'; @@ -160,10 +157,8 @@ echo '
'; echo '
'; } - echo '
'; - - if (api_get_setting('allow_social_tool') == 'true') { - + echo '
'; + if (api_get_setting('allow_social_tool') == 'true') { echo ''; // @todo Add a platform setting to add the user image. -if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') { +if (api_get_setting('allow_message_tool') == 'true') { require_once api_get_path(LIBRARY_PATH).'message.lib.php'; require_once api_get_path(LIBRARY_PATH).'social.lib.php'; @@ -583,19 +583,20 @@ if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_mes $profile_content .= '
'; $profile_content .= '
'; $profile_content .= '
'; }