Add allow_my_files settting (in 1.10 it will work as always) see BT#10874

DB change should be included in 1.11:

INSERT INTO settings_current
(variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable)
VALUES
('allow_my_files',NULL,'radio','Platform','true','AllowMyFilesTitle','AllowMyFilesComment','',NULL, 1);

INSERT INTO settings_options (variable, value, display_text)
VALUES
('allow_my_files','true','Yes'),
('allow_my_files','false','No');
1.10.x
jmontoya 9 years ago
parent 05d217dba5
commit 5cbf1f064d
  1. 5
      main/document/document.php
  2. 5
      main/inc/lib/document.lib.php
  3. 17
      main/inc/lib/social.lib.php
  4. 8
      main/inc/lib/userportal.lib.php
  5. 6
      main/social/myfiles.php

@ -38,7 +38,6 @@ $lib_path = api_get_path(LIBRARY_PATH);
$actionsRight = ''; $actionsRight = '';
api_protect_course_script(true); api_protect_course_script(true);
api_protect_course_group(GroupManager::GROUP_TOOL_DOCUMENTS); api_protect_course_group(GroupManager::GROUP_TOOL_DOCUMENTS);
DocumentManager::removeGeneratedAudioTempFile(); DocumentManager::removeGeneratedAudioTempFile();
if ( if (
@ -376,6 +375,10 @@ switch ($action) {
'gidReq='.$gidReq.'&parent_id='.$parent_id 'gidReq='.$gidReq.'&parent_id='.$parent_id
); );
if (api_get_setting('allow_my_files') === 'false') {
$file_link = '';
}
if (file_exists($copyfile)) { if (file_exists($copyfile)) {
$message = get_lang('CopyAlreadyDone').'</p><p>'; $message = get_lang('CopyAlreadyDone').'</p><p>';
$message .= '<a class = "btn btn-default" '. $message .= '<a class = "btn btn-default" '.

@ -5244,8 +5244,13 @@ class DocumentManager
$copy_myfiles_link = ($filetype == 'file') ? api_get_self() . '?' . api_get_cidreq() . '&action=copytomyfiles&id=' . $document_data['id'] : api_get_self() . '?' . api_get_cidreq(); $copy_myfiles_link = ($filetype == 'file') ? api_get_self() . '?' . api_get_cidreq() . '&action=copytomyfiles&id=' . $document_data['id'] : api_get_self() . '?' . api_get_cidreq();
if ($filetype == 'file') { if ($filetype == 'file') {
$copy_to_myfiles = '<a href="' . $copy_myfiles_link . '" style="float:right"' . $prevent_multiple_click . '>' . $copy_to_myfiles = '<a href="' . $copy_myfiles_link . '" style="float:right"' . $prevent_multiple_click . '>' .
Display::return_icon('briefcase.png', get_lang('CopyToMyFiles'), array(), ICON_SIZE_SMALL) . '&nbsp;&nbsp;</a>'; Display::return_icon('briefcase.png', get_lang('CopyToMyFiles'), array(), ICON_SIZE_SMALL) . '&nbsp;&nbsp;</a>';
if (api_get_setting('allow_my_files') === 'false') {
$copy_to_myfiles = '';
}
} }
if ($filetype == 'file') { if ($filetype == 'file') {

@ -785,12 +785,19 @@ class SocialManager extends UserManager
//My files //My files
$active = $show == 'myfiles' ? 'active' : null; $active = $show == 'myfiles' ? 'active' : null;
$links .= '
$myFiles = '
<li class="myfiles-icon ' . $active . '"> <li class="myfiles-icon ' . $active . '">
<a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php"> <a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php">
' . $filesIcon . ' ' . get_lang('MyFiles') . ' ' . $filesIcon . ' ' . get_lang('MyFiles') . '
</a> </a>
</li>'; </li>';
if (api_get_setting('allow_my_files') === 'false') {
$myFiles = '';
}
$links .= $myFiles;
$links .='</ul>'; $links .='</ul>';
$html .= Display::panelCollapse( $html .= Display::panelCollapse(
@ -858,12 +865,18 @@ class SocialManager extends UserManager
</a> </a>
</li>'; </li>';
$active = $show == 'myfiles' ? 'active' : null; $active = $show == 'myfiles' ? 'active' : null;
$links .= '
$myFiles = '
<li class="myfiles-icon ' . $active . '"> <li class="myfiles-icon ' . $active . '">
<a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php"> <a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php">
' . $filesIcon . ' ' . get_lang('MyFiles') . ' ' . $filesIcon . ' ' . get_lang('MyFiles') . '
</a> </a>
</li>'; </li>';
if (api_get_setting('allow_my_files') === 'false') {
$myFiles = '';
}
$links .= $myFiles;
} }
// My friend profile. // My friend profile.

@ -857,7 +857,13 @@ class IndexManager
} }
if (isset($_configuration['allow_my_files_link_in_homepage']) && $_configuration['allow_my_files_link_in_homepage']) { if (isset($_configuration['allow_my_files_link_in_homepage']) && $_configuration['allow_my_files_link_in_homepage']) {
$profile_content .= '<li class="myfiles-social"><a href="'.api_get_path(WEB_PATH).'main/social/myfiles.php">'.get_lang('MyFiles').'</a></li>'; $myFiles = '<li class="myfiles-social"><a href="'.api_get_path(WEB_PATH).'main/social/myfiles.php">'.get_lang('MyFiles').'</a></li>';
if (api_get_setting('allow_my_files') === 'false') {
$myFiles = '';
}
$profile_content .= $myFiles;
} }
} }

@ -11,7 +11,11 @@ require_once '../inc/global.inc.php';
api_block_anonymous_users(); api_block_anonymous_users();
if (api_get_setting('allow_social_tool') != 'true') { if (api_get_setting('allow_social_tool') != 'true') {
api_not_allowed(); api_not_allowed(true);
}
if (api_get_setting('allow_my_files') === 'false') {
api_not_allowed(true);
} }
$this_section = SECTION_SOCIAL; $this_section = SECTION_SOCIAL;

Loading…
Cancel
Save