Commit b127ac61 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

and subdirectory names with quotes

parent 0a5db944
......@@ -55,7 +55,7 @@ function formatname(r) {
if (r.artefacttype == 'folder') {
var dir = cwd + r.name + '/';
pathids[dir] = r.id;
var link = A({'href':'', 'onclick':"return changedir('" + dir.replace("'","\\\'") + "')"},r.name);
var link = A({'href':'', 'onclick':"return changedir('" + dir.replace(escre,"\\\'") + "')"},r.name);
var cell = link;
}
return TD(null, cell);
......@@ -78,7 +78,7 @@ function linked_path() {
for (i=0; i<dirs.length; i++) {
if (dirs[i] != '') {
sofar = sofar + dirs[i] + '/';
var dir = A({'href':'', 'onclick':"return changedir('" + sofar.replace("'","\\\'") + "')"}, dirs[i]);
var dir = A({'href':'', 'onclick':"return changedir('" + sofar.replace(escre,"\\\'") + "')"}, dirs[i]);
folders.push(' / ');
folders.push(dir);
}
......@@ -92,6 +92,7 @@ filelist.statevars.push('folder');
pathids = {'/':null};
cwd = '/';
escre = /\'/g;
var uploader = new FileUploader('uploader', 'upload.json.php', filelist.doupdate);
addLoadEvent(function () { changedir(cwd); });
......
......@@ -44,7 +44,8 @@ $filedata = get_records_sql_array('SELECT a.id, a.artefacttype, a.mtime, f.name,
FROM ' . $prefix . 'artefact_file_files f
INNER JOIN ' . $prefix . 'artefact a ON f.artefact = a.id
WHERE a.owner = ' . $userid . '
AND a.parent' . $infolder, '');
AND a.parent' . $infolder . '
ORDER BY a.artefacttype DESC, f.name ASC', '');
if (!$filedata) {
$filedata = array();
......@@ -64,7 +65,7 @@ $result = array(
'message' => get_string('filelistloaded'),
);
//log_debug($result);
log_debug($result);
json_headers();
print json_encode($result);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment