Skip to content

Commit

Permalink
添付ファイルへの参照時に basename 関数を利用していなかった件を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
dounokouno committed Jan 11, 2016
1 parent 9f25b86 commit 46ca7ee
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/TransmitMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -694,10 +694,9 @@ public function checkInput()
if (isset($this->post['file_remove'])) {
foreach ($this->post['file_remove'] as $value) {
$tmp_name = $this->post['file'][$value]['tmp_name'];
$file_path = $this->config['tmp_dir'] . basename($tmp_name);

if (is_file($this->config['tmp_dir'] . $tmp_name) &&
(unlink($this->config['tmp_dir'] . $tmp_name)))
{
if (is_file($file_path) && unlink($file_path)) {
$this->post['file'][$value]['tmp_name'] = '';
$this->post['file'][$value]['name'] = '';
} else {
Expand All @@ -711,7 +710,7 @@ public function checkInput()
foreach ($this->post['file'] as $key => $value) {
if (isset($value['tmp_name'])) {
// single の場合
if (is_file($this->config['tmp_dir'] . $value['tmp_name'])) {
if (is_file($this->config['tmp_dir'] . basename($value['tmp_name']))) {
$this->tpl->set("$key.tmp_name", $this->h($value['tmp_name']));
$this->tpl->set("$key.name", $this->h($value['name']));
$this->files[$key] = array(
Expand Down

0 comments on commit 46ca7ee

Please sign in to comment.