Minor - format code, remove unused function change_name()

pull/2458/head
jmontoyaa 8 years ago
parent 338161b1ac
commit a19c931c83
  1. 48
      main/document/edit_document.php

@ -194,7 +194,7 @@ if (!api_is_allowed_to_edit()) {
}
/* MAIN TOOL CODE */
/* Code to change the comment */
/* Code to change the comment */
if (isset($_POST['comment'])) {
// Fixing the path if it is wrong
$comment = trim($_POST['comment']);
@ -237,7 +237,7 @@ if (isset($_POST['comment'])) {
}
}
/* WYSIWYG HTML EDITOR - Program Logic */
/* WYSIWYG HTML EDITOR - Program Logic */
if ($is_allowed_to_edit) {
if (isset($_POST['formSent']) && $_POST['formSent'] == 1) {
$filename = stripslashes($_POST['filename']);
@ -263,11 +263,11 @@ if ($is_allowed_to_edit) {
if ($read_only_flag == 0) {
if (!empty($content)) {
if ($fp = @fopen($document_data['absolute_path'], 'w')) {
// For flv player, change absolute path temporarily to prevent from erasing it in the following lines
// For flv player, change absolute path temporarily to prevent
// from erasing it in the following lines
$content = str_replace(['flv=h', 'flv=/'], ['flv=h|', 'flv=/|'], $content);
fputs($fp, $content);
fclose($fp);
$filepath = $document_data['absolute_parent_path'];
// "WHAT'S NEW" notification: update table item_property
@ -401,9 +401,7 @@ if ($owner_id == api_get_user_id() ||
// Desactivation of IE proprietary commenting tags inside the text before loading it on the online editor.
// This fix has been proposed by Hubert Borderiou, see Bug #573, http://support.chamilo.org/issues/573
$defaults['content'] = str_replace('<!--[', '<!-- [', $content);
// HotPotatoes tests are html files, but they should not be edited in order their functionality to be preserved.
$showSystemFolders = api_get_course_setting('show_system_folders');
$condition = stripos($dir, '/HotPotatoes_files') === false;
if ($showSystemFolders == 1) {
@ -518,7 +516,9 @@ if ($owner_id == api_get_user_id() ||
);
}
if ($extension == 'svg' && !api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') {
if ($extension == 'svg' && !api_browser_support('svg') &&
api_get_setting('enabled_support_svg') == 'true'
) {
echo Display::return_message(get_lang('BrowserDontSupportsSVG'), 'warning');
}
if ($file_type != 'link') {
@ -551,43 +551,13 @@ if ($owner_id == api_get_user_id() ||
});
</script>';
echo $form->return_form();
echo $form->returnForm();
}
}
Display::display_footer();
/**
This function changes the name of a certain file.
It needs no global variables, it takes all info from parameters.
It returns nothing.
@todo check if this function is used
*/
function change_name($base_work_dir, $source_file, $rename_to, $dir, $doc)
{
$file_name_for_change = $base_work_dir.$dir.$source_file;
$rename_to = disable_dangerous_file($rename_to); // Avoid renaming to .htaccess file
$rename_to = my_rename($file_name_for_change, stripslashes($rename_to)); // fileManage API
if ($rename_to) {
if (isset($dir) && $dir != '') {
$source_file = $dir.$source_file;
$new_full_file_name = dirname($source_file).'/'.$rename_to;
} else {
$source_file = '/'.$source_file;
$new_full_file_name = '/'.$rename_to;
}
update_db_info('update', $source_file, $new_full_file_name); // fileManage API
Display::addFlash(Display::return_message(get_lang('fileModified')));
return true;
} else {
Display::addFlash(Display::return_message(get_lang('FileExists')));
}
}
//return button back to
// return button back to
function show_return($document_id, $path, $call_from_tool = '', $slide_id = 0, $is_certificate_mode = false)
{
$actionsLeft = null;

Loading…
Cancel
Save