Merge pull request #292 from ladybirdweb/analysis-8Qen4g
Applied fixes from StyleCI
This commit is contained in:
@@ -172,7 +172,7 @@ class MailController extends Controller
|
|||||||
}
|
}
|
||||||
$server->setFlag($cert);
|
$server->setFlag($cert);
|
||||||
$server->setAuthentication($username, $password);
|
$server->setAuthentication($username, $password);
|
||||||
$date = date("d M Y", strToTime("-1 days"));
|
$date = date('d M Y', strtotime('-1 days'));
|
||||||
$messages = $server->search("SINCE \"$date\" UNSEEN");
|
$messages = $server->search("SINCE \"$date\" UNSEEN");
|
||||||
$this->message($messages, $email);
|
$this->message($messages, $email);
|
||||||
}
|
}
|
||||||
@@ -338,20 +338,21 @@ class MailController extends Controller
|
|||||||
*
|
*
|
||||||
* @return type file
|
* @return type file
|
||||||
*/
|
*/
|
||||||
public function get_data($id) {
|
public function get_data($id)
|
||||||
|
{
|
||||||
$attachment = \App\Model\helpdesk\Ticket\Ticket_attachments::where('id', '=', $id)->first();
|
$attachment = \App\Model\helpdesk\Ticket\Ticket_attachments::where('id', '=', $id)->first();
|
||||||
if (mime($attachment->type) == true) {
|
if (mime($attachment->type) == true) {
|
||||||
echo "<img src=data:$attachment->type;base64," . $attachment->file . ">";
|
echo "<img src=data:$attachment->type;base64,".$attachment->file.'>';
|
||||||
} else {
|
} else {
|
||||||
$file = base64_decode($attachment->file);
|
$file = base64_decode($attachment->file);
|
||||||
|
|
||||||
return response($file)
|
return response($file)
|
||||||
->header('Cache-Control', 'no-cache private')
|
->header('Cache-Control', 'no-cache private')
|
||||||
->header('Content-Description', 'File Transfer')
|
->header('Content-Description', 'File Transfer')
|
||||||
->header('Content-Type', $attachment->type)
|
->header('Content-Type', $attachment->type)
|
||||||
->header('Content-length', strlen($file))
|
->header('Content-length', strlen($file))
|
||||||
->header('Content-Disposition', 'attachment; filename=' . $attachment->name)
|
->header('Content-Disposition', 'attachment; filename='.$attachment->name)
|
||||||
->header('Content-Transfer-Encoding', 'binary');
|
->header('Content-Transfer-Encoding', 'binary');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -10,20 +10,23 @@ class Ticket_attachments extends Model
|
|||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'id', 'thread_id', 'name', 'size', 'type', 'file', 'data', 'poster', 'updated_at', 'created_at',
|
'id', 'thread_id', 'name', 'size', 'type', 'file', 'data', 'poster', 'updated_at', 'created_at',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function getFile() {
|
public function getFile()
|
||||||
|
{
|
||||||
$size = $this->size;
|
$size = $this->size;
|
||||||
$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
|
$units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||||
$power = $size > 0 ? floor(log($size, 1024)) : 0;
|
$power = $size > 0 ? floor(log($size, 1024)) : 0;
|
||||||
$value = number_format($size / pow(1024, $power), 2, '.', ',') . ' ' . $units[$power];
|
$value = number_format($size / pow(1024, $power), 2, '.', ',').' '.$units[$power];
|
||||||
if ($this->poster == 'ATTACHMENT') {
|
if ($this->poster == 'ATTACHMENT') {
|
||||||
if (mime($this->type) == true) {
|
if (mime($this->type) == true) {
|
||||||
$var = '<a href="' . \URL::route('image', array('image_id' => $this->id)) . '" target="_blank"><img style="max-width:200px;height:133px;" src="data:image/jpg;base64,' . $this->file . '"/></a>';
|
$var = '<a href="'.\URL::route('image', ['image_id' => $this->id]).'" target="_blank"><img style="max-width:200px;height:133px;" src="data:image/jpg;base64,'.$this->file.'"/></a>';
|
||||||
return '<li style="background-color:#f4f4f4;"><span class="mailbox-attachment-icon has-img">' . $var . '</span><div class="mailbox-attachment-info"><b style="word-wrap: break-word;">' . $this->name . '</b><br/><p>' . $value . '</p></div></li>';
|
|
||||||
|
return '<li style="background-color:#f4f4f4;"><span class="mailbox-attachment-icon has-img">'.$var.'</span><div class="mailbox-attachment-info"><b style="word-wrap: break-word;">'.$this->name.'</b><br/><p>'.$value.'</p></div></li>';
|
||||||
} else {
|
} else {
|
||||||
//$var = '<a href="' . URL::route('image', array('image_id' => $attachment->id)) . '" target="_blank"><img style="max-width:200px;height:133px;" src="data:'.$attachment->type.';base64,' . base64_encode($data) . '"/></a>';
|
//$var = '<a href="' . URL::route('image', array('image_id' => $attachment->id)) . '" target="_blank"><img style="max-width:200px;height:133px;" src="data:'.$attachment->type.';base64,' . base64_encode($data) . '"/></a>';
|
||||||
$var = '<a style="max-width:200px;height:133px;color:#666;" href="' . \URL::route('image', array('image_id' => $this->id)) . '" target="_blank"><span class="mailbox-attachment-icon" style="background-color:#fff; font-size:18px;">' . strtoupper($this->type) . '</span><div class="mailbox-attachment-info"><span ><b style="word-wrap: break-word;">' . $this->name . '</b><br/><p>' . $value . '</p></span></div></a>';
|
$var = '<a style="max-width:200px;height:133px;color:#666;" href="'.\URL::route('image', ['image_id' => $this->id]).'" target="_blank"><span class="mailbox-attachment-icon" style="background-color:#fff; font-size:18px;">'.strtoupper($this->type).'</span><div class="mailbox-attachment-info"><span ><b style="word-wrap: break-word;">'.$this->name.'</b><br/><p>'.$value.'</p></span></div></a>';
|
||||||
return '<li style="background-color:#f4f4f4;">' . $var . '</li>';
|
|
||||||
|
return '<li style="background-color:#f4f4f4;">'.$var.'</li>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user