fixed the bug of miscalculating the total file count in the file home view

disallowed a slash in a file name to be uploaded
This commit is contained in:
hyung-hwan 2015-09-07 00:48:14 +00:00
parent 3e23b914d6
commit fbbecb6162
3 changed files with 10 additions and 5 deletions

View File

@ -157,7 +157,7 @@ class File extends Controller
redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); redirect ("main/signin/" . $this->converter->AsciiTohex(current_url()));
} }
$file = $this->files->fetch_file ($login['id'], $project, $name); $file = $this->files->fetchFile ($login['id'], $project, $name);
if ($file === FALSE) if ($file === FALSE)
{ {
$data['project'] = $project; $data['project'] = $project;
@ -612,10 +612,11 @@ class File extends Controller
break; break;
} }
if (strpos($_FILES[$fid]['name'], ':') !== FALSE) if (strpos($_FILES[$fid]['name'], ':') !== FALSE ||
strpos($_FILES[$fid]['name'], '/') !== FALSE)
{ {
/* for wiki */ /* for wiki */
$status = "error - colon not allowed - {$_FILES[$fid]['name']}"; $status = "error - colon or slash not allowed - {$_FILES[$fid]['name']}";
break; break;
} }

View File

@ -56,7 +56,7 @@ class FileModel extends Model
return $file; return $file;
} }
function fetch_file ($userid, $project, $name) function fetchFile ($userid, $project, $name)
{ {
$this->db->trans_start (); $this->db->trans_start ();
$this->db->where ('projectid', $project->id); $this->db->where ('projectid', $project->id);

View File

@ -260,7 +260,11 @@ $this->load->view (
<div class="title"><?php print $this->lang->line('Files')?></div> <div class="title"><?php print $this->lang->line('Files')?></div>
<div class="infostrip"> <div class="infostrip">
<?php printf ($this->lang->line('FILE_FMT_TOTAL_X_FILES'), count($files)); ?> <?php
$total_file_count = 0;
foreach ($files as $f) $total_file_count += count($f->file_list);
printf ($this->lang->line('FILE_FMT_TOTAL_X_FILES'), $total_file_count);
?>
<?php if (isset($login['id']) && $login['id'] != ''): ?> <?php if (isset($login['id']) && $login['id'] != ''): ?>
| |