$wdir = str_replace($searcher, '', $wdir); if ($wdir == '') { $wdir = "/"; } if ($wdir[0] != '/') { $wdir = "/" . $wdir; } //prefix the filepath if ($qid == -1) { webwork_make_tmp_dir(); $wdir = webwork_get_tmp_path() . $wdir; } else { if (!($question = get_record('question_webwork', 'id', $qid))) { print_error("That's an invalid question id."); } $wdir = webwork_get_wwquestion_path($qid) . $wdir; } if (!is_dir($basedir . $wdir)) { //html_header($course, $wdir); print_error("Requested directory does not exist."); } print_header(); switch ($action) { case "upload": //html_header($course, $wdir); require_once $CFG->dirroot . '/lib/uploadlib.php'; 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}";
/** * @desc Makes a directory for a wwquestion. * @param integer $wwquestionid The wwquestion id. * @return bool directory creation. */ function webwork_make_wwquestion_dir($wwquestionid) { return make_upload_directory(webwork_get_wwquestion_path($wwquestionid)); }