skala
Juan Carlos Raña 15 years ago
commit 76b2c303c2
  1. 3
      documentation/changelog.html
  2. 10
      main/admin/configure_inscription.php
  3. 44
      main/document/document.inc.php
  4. BIN
      main/img/open_in_new_window.png
  5. BIN
      main/img/open_in_new_window_small.png

@ -89,6 +89,9 @@
<li>Wiki: Fixed links with accents and special characters do not work well in utf-8 #2286</li> <li>Wiki: Fixed links with accents and special characters do not work well in utf-8 #2286</li>
<li>A student can edit a file through url into documents tool after visit his/her group #2485</li> <li>A student can edit a file through url into documents tool after visit his/her group #2485</li>
<li>Social network to run from 1024x768 #1958</li> <li>Social network to run from 1024x768 #1958</li>
<li>Irrelevant check has been removed, it prevented the page "Administration &gt; Setting the registration page" to be accessed
in the case of assigned value "No" to the setting "Administration &gt; Configuration settings &gt; Portal &gt; Registration".
This bug has been reported by Wolfgang in the forum and by Oliver Corre in the Chamilo support site (Bug #1846)</li>
</ul> </ul>
<h3>Security</h3> <h3>Security</h3>

@ -163,10 +163,12 @@ echo '<div class="actions-title">';
echo $tool_name; echo $tool_name;
echo '</div>'; echo '</div>';
// Forbidden to self-register // The following security condition has been removed, because it makes no sense here. See Bug #1846.
if (get_setting('allow_registration') == 'false') { //// Forbidden to self-register
api_not_allowed(); //if (get_setting('allow_registration') == 'false') {
} // api_not_allowed();
//}
//api_display_tool_title($tool_name); //api_display_tool_title($tool_name);
if (get_setting('allow_registration') == 'approval') { if (get_setting('allow_registration') == 'approval') {
Display::display_normal_message(get_lang('YourAccountHasToBeApproved')); Display::display_normal_message(get_lang('YourAccountHasToBeApproved'));

@ -124,18 +124,20 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility
$ext = explode('.', $path); $ext = explode('.', $path);
$ext = strtolower($ext[sizeof($ext) - 1]); $ext = strtolower($ext[sizeof($ext) - 1]);
// "htmlfiles" are shown in a frameset // HTML-files an some other types are shown in a frameset by default.
if ($ext == 'htm' || $ext == 'html' || $ext == 'gif' || $ext == 'jpg' || $ext == 'jpeg' || $ext == 'png' || $ext == 'pdf' || $ext == 'swf' || $ext == 'mp3' || $ext == 'mp4' ||(($ext== 'ogg' || $ext== 'ogx' || $ext== 'oga' || $ext== 'ogv') && api_browser_support('ogg')) ||($ext == 'svg' && api_browser_support('svg'))) { $is_browser_viewable_file = is_browser_viewable($ext);
if ($is_browser_viewable_file) {
$url = 'showinframes.php?'.api_get_cidreq().'&amp;file='.$url_path.$req_gid; $url = 'showinframes.php?'.api_get_cidreq().'&amp;file='.$url_path.$req_gid;
} else { } else {
// url-encode for problematic characters (we may not call them dangerous characters...) // url-encode for problematic characters (we may not call them dangerous characters...)
$path = str_replace('%2F', '/',$url_path).'?'.api_get_cidreq(); $path = str_replace('%2F', '/',$url_path).'?'.api_get_cidreq();
$url = $www.$path; $url = $www.$path;
} }
// Files that we want opened in a new window // Disabled fragment of code, there is a special icon for opening in a new window.
if ($ext == 'txt' || $ext == 'log' || $ext == 'css' || $ext == 'js') { // Add here //// Files that we want opened in a new window
$target = '_blank'; //if ($ext == 'txt' || $ext == 'log' || $ext == 'css' || $ext == 'js') { // Add here
} // $target = '_blank';
//}
} else { } else {
$url = api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$url_path.$req_gid; $url = api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$url_path.$req_gid;
} }
@ -203,7 +205,12 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility
$copy_to_myfiles='<a href="'.$copy_myfiles_link.'" style="float:right"'.$prevent_multiple_click.'>'.Display::return_icon('briefcase_small.png', get_lang('CopyToMyFiles'), array('height'=>'16', 'width' => '16')).'&nbsp;&nbsp;</a>'; $copy_to_myfiles='<a href="'.$copy_myfiles_link.'" style="float:right"'.$prevent_multiple_click.'>'.Display::return_icon('briefcase_small.png', get_lang('CopyToMyFiles'), array('height'=>'16', 'width' => '16')).'&nbsp;&nbsp;</a>';
} }
} }
return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'.$title.'</a>'.$force_download_html.$copy_to_myfiles;
if ($is_browser_viewable_file) {
$open_in_new_window_link = '<a href="'.$www.str_replace('%2F', '/',$url_path).'?'.api_get_cidreq().'" style="float:right"'.$prevent_multiple_click.' target="_blank">'.Display::return_icon('open_in_new_window_small.png', get_lang('OpenInANewWindow'), array('height'=>'16', 'width' => '16')).'&nbsp;&nbsp;</a>';
}
return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'.$title.'</a>'.$force_download_html.$copy_to_myfiles.$open_in_new_window_link;
//end copy files to users myfiles //end copy files to users myfiles
} }
else{ else{
@ -669,4 +676,27 @@ function search_keyword($document_name, $keyword) {
} }
} }
/**
* Checks whether a document can be previewed by using the browser.
* @param string $file_extension The filename extension of the document (it must be in lower case).
* @return bool Returns TRUE or FALSE.
*/
function is_browser_viewable($file_extension) {
static $allowed_extensions = array(
'htm', 'html', 'xhtml', 'gif', 'jpg', 'jpeg', 'png', 'pdf', 'swf', 'mp3', 'mp4', 'ogg', 'ogx', 'oga', 'ogv', 'svg',
'txt', 'log', 'css', 'js',
'mpg', 'mpeg'
);
if (!($result = in_array($file_extension, $allowed_extensions))) { // Assignment + a logical check.
return false;
}
switch ($file_extension) {
case 'ogg':
return api_browser_support('ogg');
case 'svg':
return api_browser_support('svg');
}
return $result;
}
?> ?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Loading…
Cancel
Save