Fix code related to from main/default_course_document/

pull/2818/head
Julio Montoya 6 years ago
parent 0386281cb7
commit 86ae289083
  1. 1
      .php_cs.dist
  2. 63
      main/inc/lib/add_course.lib.inc.php
  3. 1
      main/inc/lib/api.lib.php
  4. 4
      main/install/data.sql
  5. 10
      main/install/install.lib.php
  6. 8
      src/CoreBundle/Migrations/Schema/V111/Version20160804174600.php

@ -44,7 +44,6 @@ $finder = PhpCsFixer\Finder::create()
->exclude('main/auth/cas/lib')
->exclude('main/auth/shibboleth')
->exclude('main/auth/openid')
->exclude('main/default_course_document')
->exclude('main/fonts')
->exclude('main/inc/lib/browser')
->exclude('main/inc/lib/internationalization_database')

@ -319,65 +319,6 @@ class AddCourse
}
}
/**
* Returns a list of all files in the given course directory. The requested
* directory will be checked against a "checker" directory to avoid access to
* protected/unauthorized files.
*
* @param string Complete path to directory we want to list
* @param array A list of files to which we want to add the files found
* @param string Type of base directory from which we want to recover the files
* @param string $path
* @param string $media
*
* @return array
* @assert (null,null,null) === false
* @assert ('abc',array(),'') === array()
*/
public static function browse_folders($path, $files, $media)
{
if ($media == 'images') {
$code_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/';
}
if ($media == 'audio') {
$code_path = api_get_path(SYS_CODE_PATH).'default_course_document/audio/';
}
if ($media == 'flash') {
$code_path = api_get_path(SYS_CODE_PATH).'default_course_document/flash/';
}
if ($media == 'video') {
$code_path = api_get_path(SYS_CODE_PATH).'default_course_document/video/';
}
if ($media == 'certificates') {
$code_path = api_get_path(SYS_CODE_PATH).'default_course_document/certificates/';
}
if (is_dir($path)) {
$handle = opendir($path);
while (false !== ($file = readdir($handle))) {
if (is_dir($path.$file) && strpos($file, '.') !== 0) {
$files[]['dir'] = str_replace(
$code_path,
'',
$path.$file.'/'
);
$files = self::browse_folders(
$path.$file.'/',
$files,
$media
);
} elseif (is_file($path.$file) && strpos($file, '.') !== 0) {
$files[]['file'] = str_replace(
$code_path,
'',
$path.$file
);
}
}
}
return $files;
}
/**
* Sorts pictures by type (used?).
*
@ -539,7 +480,7 @@ class AddCourse
}
$finder = new Symfony\Component\Finder\Finder();
$defaultPath = api_get_path(SYS_CODE_PATH).'default_course_document';
$defaultPath = api_get_path(SYS_PUBLIC_PATH).'img/document';
$finder->in($defaultPath);
/** @var SplFileInfo $file */
foreach ($finder as $file) {
@ -682,7 +623,7 @@ class AddCourse
$html = '<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="220" valign="top" align="left">
<img src="'.api_get_path(WEB_CODE_PATH).'default_course_document/images/mr_chamilo/doubts.png">
<img src="'.api_get_path(WEB_PUBLIC_PATH).'img/document/images/mr_chamilo/doubts.png">
</td>
<td valign="top" align="left">'.get_lang('Antique').'</td></tr>
</table>';

@ -848,7 +848,6 @@ function api_get_path($path = '', $configuration = [])
}
$isInitialized = [];
//$root_rel = $configuration['url_append'] ?? '';
$root_rel = $_SERVER['APP_URL_APPEND'] ?? '';
if (!empty($root_rel)) {

@ -704,7 +704,7 @@ INSERT INTO system_template (title, comment, image, content) VALUES
<div id="player810625">
<div id="player810625-config"
style="overflow: hidden; display: none; visibility: hidden; width: 0px; height: 0px;">
url={REL_PATH}main/default_course_document/video/flv/example.flv width=320 height=240
url={COURSE_DIR}video/flv/example.flv width=320 height=240
loop=false play=false downloadable=false fullscreen=true displayNavigation=true
displayDigits=true align=left dispPlaylist=none playlistThumbs=false
</div>
@ -718,7 +718,7 @@ INSERT INTO system_template (title, comment, image, content) VALUES
name="single"
quality="high"
allowfullscreen="true"
flashvars="width=320&height=240&autostart=false&file={REL_PATH}main/default_course_document/video/flv/example.flv&repeat=false&image=&showdownload=false&link={REL_PATH}main/default_course_document/video/flv/example.flv&showdigits=true&shownavigation=true&logo="
flashvars="width=320&height=240&autostart=false&file={COURSE_DIR}video/flv/example.flv&repeat=false&image=&showdownload=false&link={COURSE_DIR}video/flv/example.flv&showdigits=true&shownavigation=true&logo="
/>
</div>
</div>

@ -1076,12 +1076,6 @@ function display_requirements(
@chmod($checked_writable, $perm);
}
$checked_writable = api_get_path(SYS_CODE_PATH).'default_course_document/images/';
if (!is_writable($checked_writable)) {
$notWritable[] = $checked_writable;
@chmod($checked_writable, $perm);
}
if ($course_test_was_created == false) {
$error = true;
}
@ -1699,11 +1693,9 @@ function display_configuration_settings_form(
$languageForm = $_SESSION['install_language'];
}
echo '<div class="RequirementHeading">';
echo "<h2>".display_step_sequence().get_lang("CfgSetting")."</h2>";
echo "<h2>".display_step_sequence().get_lang("Configuration settings")."</h2>";
echo '</div>';
echo '<p>'.get_lang('ConfigSettingsInfo').' <strong>app/config/configuration.php</strong></p>';
// Parameter 1: administrator's login
$html = '';
$html .= display_configuration_parameter(

@ -562,7 +562,7 @@ class Version20160804174600 extends AbstractMigrationChamilo
<div id="player810625">
<div id="player810625-config"
style="overflow: hidden; display: none; visibility: hidden; width: 0px; height: 0px;">
url={REL_PATH}main/default_course_document/video/flv/example.flv width=320 height=240
url={COURSE_DIR}video/flv/example.flv width=320 height=240
loop=false play=false downloadable=false fullscreen=true displayNavigation=true
displayDigits=true align=left dispPlaylist=none playlistThumbs=false
</div>
@ -576,7 +576,7 @@ class Version20160804174600 extends AbstractMigrationChamilo
name="single"
quality="high"
allowfullscreen="true"
flashvars="width=320&height=240&autostart=false&file={REL_PATH}main/default_course_document/video/flv/example.flv&repeat=false&image=&showdownload=false&link={REL_PATH}main/default_course_document/video/flv/example.flv&showdigits=true&shownavigation=true&logo="
flashvars="width=320&height=240&autostart=false&file={COURSE_DIR}video/flv/example.flv&repeat=false&image=&showdownload=false&link={COURSE_DIR}video/flv/example.flv&showdigits=true&shownavigation=true&logo="
/>
</div>
</div>
@ -1130,7 +1130,7 @@ class Version20160804174600 extends AbstractMigrationChamilo
<div style="text-align: center;" id="player810625-parent">
<div style="border-style: none; overflow: hidden; width: 320px; height: 240px; background-color: rgb(220, 220, 220);">
<div id="player810625">
<div id="player810625-config" style="overflow: hidden; display: none; visibility: hidden; width: 0px; height: 0px;">url={REL_PATH}main/default_course_document/video/flv/example.flv width=320 height=240 loop=false play=false downloadable=false fullscreen=true displayNavigation=true displayDigits=true align=left dispPlaylist=none playlistThumbs=false</div>
<div id="player810625-config" style="overflow: hidden; display: none; visibility: hidden; width: 0px; height: 0px;">url={COURSE_DIR}video/flv/example.flv width=320 height=240 loop=false play=false downloadable=false fullscreen=true displayNavigation=true displayDigits=true align=left dispPlaylist=none playlistThumbs=false</div>
</div>
<embed
type="application/x-shockwave-flash"
@ -1141,7 +1141,7 @@ class Version20160804174600 extends AbstractMigrationChamilo
name="single"
quality="high"
allowfullscreen="true"
flashvars="width=320&height=240&autostart=false&file={REL_PATH}main/default_course_document/video/flv/example.flv&repeat=false&image=&showdownload=false&link={REL_PATH}main/default_course_document/video/flv/example.flv&showdigits=true&shownavigation=true&logo="
flashvars="width=320&height=240&autostart=false&file={COURSE_DIR}video/flv/example.flv&repeat=false&image=&showdownload=false&link={COURSE_DIR}video/flv/example.flv&showdigits=true&shownavigation=true&logo="
/>
</div>
</div>

Loading…
Cancel
Save