Skip to content

Commit

Permalink
fixed missing xxx_param() and broken path
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Apr 22, 2006
1 parent 7ceed56 commit e77ea64
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 4 additions & 3 deletions files/index.php
Expand Up @@ -18,7 +18,8 @@
$oldname = optional_param('oldname', '', PARAM_FILE);
$choose = optional_param('choose', '', PARAM_CLEAN);
$userfile= optional_param('userfile','',PARAM_FILE);
$save = optional_param( 'save','' );
$save = optional_param('save', 0, PARAM_BOOL);
$confirm = optional_param('confirm', 0, PARAM_BOOL);

if ($choose) {
if (count(explode('.', $choose)) != 2) {
Expand Down Expand Up @@ -158,7 +159,7 @@ function set_value(txt) {
html_header($course, $wdir);
require_once($CFG->dirroot.'/lib/uploadlib.php');

if (!empty($save) and confirm_sesskey()) {
if ($save and confirm_sesskey()) {
$course->maxbytes = 0; // We are ignoring course limits
$um = new upload_manager('userfile',false,false,$course,false,0);
$dir = "$basedir$wdir";
Expand Down Expand Up @@ -202,7 +203,7 @@ function set_value(txt) {
break;

case "delete":
if (!empty($confirm) and confirm_sesskey()) {
if ($confirm and confirm_sesskey()) {
html_header($course, $wdir);
if (!empty($USER->filelist)) {
foreach ($USER->filelist as $file) {
Expand Down
8 changes: 5 additions & 3 deletions lib/editor/htmlarea/coursefiles.php
Expand Up @@ -21,6 +21,8 @@
$name = optional_param('name', '', PARAM_FILE);
$oldname = optional_param('oldname', '', PARAM_FILE);
$usecheckboxes = optional_param('usecheckboxes', 1, PARAM_INT);
$save = optional_param('save', 0, PARAM_BOOL);
$confirm = optional_param('confirm', 0, PARAM_BOOL);


if (! $course = get_record("course", "id", $id) ) {
Expand Down Expand Up @@ -207,7 +209,7 @@ function reset_value() {
html_header($course, $wdir);
require_once($CFG->dirroot.'/lib/uploadlib.php');

if (!empty($save) and confirm_sesskey()) {
if ($save and confirm_sesskey()) {
$um = new upload_manager('userfile',false,false,$course,false,0);
$dir = "$basedir$wdir";
if ($um->process_file_uploads($dir)) {
Expand Down Expand Up @@ -248,7 +250,7 @@ function reset_value() {
break;

case "delete":
if (!empty($confirm) and confirm_sesskey()) {
if ($confirm and confirm_sesskey()) {
html_header($course, $wdir);
foreach ($USER->filelist as $file) {
$fullfile = $basedir.$file;
Expand Down Expand Up @@ -525,7 +527,7 @@ function reset_value() {
echo "<p align=\"center\">$strlistfiles:</p>";
$file = basename($file);

include_once('../pclzip/pclzip.lib.php');
require_once($CFG->libdir.'/pclzip/pclzip.lib.php');
$archive = new PclZip("$basedir/$wdir/$file");
if (!$list = $archive->listContent("$basedir/$wdir")) {
notify($archive->errorInfo(true));
Expand Down

0 comments on commit e77ea64

Please sign in to comment.