Admin: Add setting 'disable_slideshow_documents' BT#17404

pull/3308/head
Julio Montoya 5 years ago
parent d3c839ceb9
commit 5836af685e
  1. 12
      main/document/document.php
  2. 21
      main/document/slideshow.php
  3. 9
      main/document/slideshowoptions.php
  4. 3
      main/install/configuration.dist.php

@ -1759,11 +1759,15 @@ if ($isAllowedToEdit ||
); );
} }
} }
if (!isset($_GET['keyword']) && !$is_certificate_mode) { if (!isset($_GET['keyword']) && !$is_certificate_mode) {
$actionsLeft .= Display::url( $disable = api_get_configuration_value('disable_slideshow_documents');
Display::return_icon('slideshow.png', get_lang('ViewSlideshow'), '', ICON_SIZE_MEDIUM), if (false === $disable) {
api_get_path(WEB_CODE_PATH).'document/slideshow.php?'.api_get_cidreq().'&curdirpath='.$curdirpathurl.'&id='.$document_id $actionsLeft .= Display::url(
); Display::return_icon('slideshow.png', get_lang('ViewSlideshow'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH).'document/slideshow.php?'.api_get_cidreq().'&curdirpath='.$curdirpathurl.'&id='.$document_id
);
}
} }
if ($isAllowedToEdit && !$is_certificate_mode) { if ($isAllowedToEdit && !$is_certificate_mode) {

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
use ChamiloSession as Session; use ChamiloSession as Session;
@ -7,13 +8,15 @@ use ChamiloSession as Session;
* @author Patrick Cool patrick.cool@UGent.be Ghent University Mai 2004 * @author Patrick Cool patrick.cool@UGent.be Ghent University Mai 2004
* @author Julio Montoya Lots of improvements, cleaning, adding security * @author Julio Montoya Lots of improvements, cleaning, adding security
* @author Juan Carlos Raña Trabado herodoto@telefonica.net January 2008 * @author Juan Carlos Raña Trabado herodoto@telefonica.net January 2008
*
* @package chamilo.document
*/ */
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script(); api_protect_course_script();
if (api_get_configuration_value('disable_slideshow_documents')) {
api_not_allowed(true);
}
$curdirpath = $path = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null; $curdirpath = $path = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null;
$courseInfo = api_get_course_info(); $courseInfo = api_get_course_info();
$pathurl = urlencode($path); $pathurl = urlencode($path);
@ -342,9 +345,9 @@ if ($slide_id == 'all') {
} }
$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file; $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file;
$image_tag[] = '<img $image_tag[] = '<img
src="download.php?doc_url='.$doc_url.'" src="download.php?doc_url='.$doc_url.'"
border="0" border="0"
width="'.$image_width.'" height="'.$image_height.'" title="'.$one_image_file.'">'; width="'.$image_width.'" height="'.$image_height.'" title="'.$one_image_file.'">';
} }
} }
@ -404,8 +407,8 @@ if ($slide_id != 'all' && !empty($image_files_only)) {
$pathpart = $path.'/'; $pathpart = $path.'/';
} }
$sql = "SELECT * FROM $tbl_documents $sql = "SELECT * FROM $tbl_documents
WHERE WHERE
c_id = $course_id AND c_id = $course_id AND
path = '".Database::escape_string($pathpart.$image_files_only[$slide])."'"; path = '".Database::escape_string($pathpart.$image_files_only[$slide])."'";
$result = Database::query($sql); $result = Database::query($sql);
$row = Database::fetch_array($result); $row = Database::fetch_array($result);
@ -472,9 +475,9 @@ if ($slide_id != 'all' && !empty($image_files_only)) {
</script> </script>
<?php <?php
} else { } else {
echo "<img echo "<img
class=\"img-responsive\" class=\"img-responsive\"
src='download.php?doc_url=$path/".$image_files_only[$slide]."' alt='".$image_files_only[$slide]."' src='download.php?doc_url=$path/".$image_files_only[$slide]."' alt='".$image_files_only[$slide]."'
border='0'".$height_width_tags.'>'; border='0'".$height_width_tags.'>';
} }

@ -1,13 +1,10 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
use ChamiloSession as Session; use ChamiloSession as Session;
/** /**
* @author Patrick Cool
*
* @package chamilo.document
*
* @author Patrick Cool, patrick.cool@UGent.be, Ghent University, May 2004, http://icto.UGent.be * @author Patrick Cool, patrick.cool@UGent.be, Ghent University, May 2004, http://icto.UGent.be
* Please bear in mind that this is only an beta release. * Please bear in mind that this is only an beta release.
* I wrote this quite quick and didn't think too much about it in advance. * I wrote this quite quick and didn't think too much about it in advance.
@ -27,6 +24,10 @@ use ChamiloSession as Session;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script(); api_protect_course_script();
if (api_get_configuration_value('disable_slideshow_documents')) {
api_not_allowed(true);
}
$path = Security::remove_XSS($_GET['curdirpath']); $path = Security::remove_XSS($_GET['curdirpath']);
$pathurl = urlencode($path); $pathurl = urlencode($path);

@ -1554,6 +1554,9 @@ $_configuration['auth_password_links'] = [
// Allows prevent to the user before leaving a learning path // Allows prevent to the user before leaving a learning path
//$_configuration['lp_prevents_beforeunload'] = false; //$_configuration['lp_prevents_beforeunload'] = false;
// Disable slideshow documents
//$_configuration['disable_slideshow_documents'] = false;
// KEEP THIS AT THE END // KEEP THIS AT THE END
// -------- Custom DB changes // -------- Custom DB changes
// Add user activation by confirmation email // Add user activation by confirmation email

Loading…
Cancel
Save