[svn r16447] Fix missing validation on filename (uncommenting validation probably commented by mistake) - see FS#2763

skala
Yannick Warnier 17 years ago
parent f22fc71245
commit d4e6087100
  1. 5
      main/document/create_document.php

@ -1,5 +1,5 @@
<?php <?php
// $Id: create_document.php 15984 2008-08-13 17:24:24Z juliomontoya $ // $Id: create_document.php 16447 2008-10-08 00:47:01Z yannoo $
/* /*
============================================================================== ==============================================================================
Dokeos - elearning and course management software Dokeos - elearning and course management software
@ -286,6 +286,7 @@ function document_exists($filename)
$filename = replace_dangerous_char($filename); $filename = replace_dangerous_char($filename);
return !file_exists($filepath.$filename.'.html'); return !file_exists($filepath.$filename.'.html');
} }
// Change the default renderer for the filename-field to display the dir and extension // Change the default renderer for the filename-field to display the dir and extension
$renderer = & $form->defaultRenderer(); $renderer = & $form->defaultRenderer();
//$filename_template = str_replace('{element}', "<tt>$display_dir</tt> {element} <tt>.html</tt>", $renderer->_elementTemplate); //$filename_template = str_replace('{element}', "<tt>$display_dir</tt> {element} <tt>.html</tt>", $renderer->_elementTemplate);
@ -309,7 +310,7 @@ else
//$form->add_textfield('filename', get_lang('FileName'),true,'class="input_titles" id="filename" onblur="check_if_still_empty()"'); //$form->add_textfield('filename', get_lang('FileName'),true,'class="input_titles" id="filename" onblur="check_if_still_empty()"');
// replace the add_textfield with this // replace the add_textfield with this
$group[]=$form->createElement('text','filename',get_lang('FileName'),'class="input_titles" id="filename" onblur="check_if_still_empty()"'); $group[]=$form->createElement('text','filename',get_lang('FileName'),'class="input_titles" id="filename" onblur="check_if_still_empty()"');
//$form->applyFilter('filename','trim'); $form->applyFilter('filename','trim');
//$form->addRule('filename', get_lang('ThisFieldIsRequired'), 'required'); //$form->addRule('filename', get_lang('ThisFieldIsRequired'), 'required');
//$form->addRule('filename', get_lang('FileExists'), 'callback', 'document_exists'); //$form->addRule('filename', get_lang('FileExists'), 'callback', 'document_exists');
} }

Loading…
Cancel
Save