Unread criteria, iframe reload issue, attachment issue and replace example email with username
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -11,3 +11,5 @@ Homestead.json
|
|||||||
/public/uploads
|
/public/uploads
|
||||||
/public/photos/
|
/public/photos/
|
||||||
/app/FaveoJob
|
/app/FaveoJob
|
||||||
|
|
||||||
|
.env
|
||||||
|
@@ -252,12 +252,10 @@ class EmailsController extends Controller
|
|||||||
$this->emailService($driver, $service_request);
|
$this->emailService($driver, $service_request);
|
||||||
$this->setMailConfig($driver, $username, $name, $password, $enc, $host, $port);
|
$this->setMailConfig($driver, $username, $name, $password, $enc, $host, $port);
|
||||||
$controller = new \App\Http\Controllers\Common\PhpMailController();
|
$controller = new \App\Http\Controllers\Common\PhpMailController();
|
||||||
$to = 'example@ladybirdweb.com';
|
|
||||||
$toname = 'test';
|
|
||||||
$subject = 'test';
|
$subject = 'test';
|
||||||
$data = 'test';
|
$data = 'test';
|
||||||
//dd(\Config::get('mail'),\Config::get('services'));
|
//dd(\Config::get('mail'),\Config::get('services'));
|
||||||
$send = $controller->laravelMail($to, $toname, $subject, $data, [], []);
|
$send = $controller->laravelMail($username, $name, $subject, $data, [], []);
|
||||||
|
|
||||||
return $send;
|
return $send;
|
||||||
}
|
}
|
||||||
|
@@ -172,7 +172,8 @@ class MailController extends Controller
|
|||||||
}
|
}
|
||||||
$server->setFlag($cert);
|
$server->setFlag($cert);
|
||||||
$server->setAuthentication($username, $password);
|
$server->setAuthentication($username, $password);
|
||||||
$messages = $server->search('UNSEEN', 10);
|
$date = date("d M Y", strToTime("-1 days"));
|
||||||
|
$messages = $server->search("SINCE \"$date\" UNSEEN");
|
||||||
$this->message($messages, $email);
|
$this->message($messages, $email);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -257,7 +258,7 @@ class MailController extends Controller
|
|||||||
public function manageAttachment($data, $filename, $type, $size, $disposition, $thread_id)
|
public function manageAttachment($data, $filename, $type, $size, $disposition, $thread_id)
|
||||||
{
|
{
|
||||||
$upload = new Ticket_attachments();
|
$upload = new Ticket_attachments();
|
||||||
$upload->file = $data;
|
$upload->file = base64_encode($data);
|
||||||
$upload->thread_id = $thread_id;
|
$upload->thread_id = $thread_id;
|
||||||
$upload->name = $filename;
|
$upload->name = $filename;
|
||||||
$upload->type = $type;
|
$upload->type = $type;
|
||||||
@@ -337,24 +338,20 @@ 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();
|
||||||
$attachments = \App\Model\helpdesk\Ticket\Ticket_attachments::where('id', '=', $id)->get();
|
if (mime($attachment->type) == true) {
|
||||||
foreach ($attachments as $attachment) {
|
echo "<img src=data:$attachment->type;base64," . $attachment->file . ">";
|
||||||
header('Content-type: application/'.$attachment->type.'');
|
} else {
|
||||||
header('Content-Disposition: inline; filename='.$attachment->name.'');
|
$file = base64_decode($attachment->file);
|
||||||
header('Content-Transfer-Encoding: binary');
|
return response($file)
|
||||||
$headers = [
|
->header('Cache-Control', 'no-cache private')
|
||||||
'Content-type: application/'.$attachment->type.'',
|
->header('Content-Description', 'File Transfer')
|
||||||
'Content-Disposition: inline; filename='.$attachment->name.'',
|
->header('Content-Type', $attachment->type)
|
||||||
'Content-Transfer-Encoding: binary',
|
->header('Content-length', strlen($file))
|
||||||
];
|
->header('Content-Disposition', 'attachment; filename=' . $attachment->name)
|
||||||
$file = $attachment->file;
|
->header('Content-Transfer-Encoding', 'binary');
|
||||||
echo $file;
|
|
||||||
// return response($file)
|
|
||||||
// ->header('Content-Type', $attachment->type)
|
|
||||||
// ->header('Content-Disposition', 'inline; filename='.$attachment->name.'')
|
|
||||||
// ->header('Content-Transfer-Encoding', 'binary');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -118,7 +118,7 @@ class Ticket_Thread extends Model
|
|||||||
if ($this->attach()->where('poster', 'INLINE')->get()->count() > 0) {
|
if ($this->attach()->where('poster', 'INLINE')->get()->count() > 0) {
|
||||||
$search = $this->attach()->where('poster', 'INLINE')->lists('name')->toArray();
|
$search = $this->attach()->where('poster', 'INLINE')->lists('name')->toArray();
|
||||||
foreach ($this->attach()->where('poster', 'INLINE')->get() as $key => $attach) {
|
foreach ($this->attach()->where('poster', 'INLINE')->get() as $key => $attach) {
|
||||||
$replace[$key] = "data:$attach->type;base64,".base64_encode($attach->file);
|
$replace[$key] = "data:$attach->type;base64,".$attach->file;
|
||||||
}
|
}
|
||||||
$body = str_replace($search, $replace, $body);
|
$body = str_replace($search, $replace, $body);
|
||||||
}
|
}
|
||||||
|
@@ -10,4 +10,21 @@ 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() {
|
||||||
|
$size = $this->size;
|
||||||
|
$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
|
||||||
|
$power = $size > 0 ? floor(log($size, 1024)) : 0;
|
||||||
|
$value = number_format($size / pow(1024, $power), 2, '.', ',') . ' ' . $units[$power];
|
||||||
|
if ($this->poster == 'ATTACHMENT') {
|
||||||
|
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>';
|
||||||
|
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 {
|
||||||
|
//$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>';
|
||||||
|
return '<li style="background-color:#f4f4f4;">' . $var . '</li>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -566,65 +566,7 @@ if ($thread->title != "") {
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$attachment = App\Model\helpdesk\Ticket\Ticket_attachments::where('thread_id', '=', $conversation->id)->first();
|
|
||||||
if ($attachment == null) {
|
|
||||||
$body = $conversation->body;
|
|
||||||
$body = $conversation->thread($body);
|
|
||||||
} else {
|
|
||||||
// dd($attachment->file);
|
|
||||||
// print $attachment->file;
|
|
||||||
// header("Content-type: image/jpeg");
|
|
||||||
// echo "<img src='".base64_decode($attachment->file)."' style='width:128px;height:128px'/> ";
|
|
||||||
$body = $conversation->body;
|
|
||||||
$body = $conversation->thread($body);
|
|
||||||
$attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('thread_id', '=', $conversation->id)->orderBy('id', 'DESC')->get();
|
|
||||||
// $i = 0;
|
|
||||||
foreach ($attachments as $attachment) {
|
|
||||||
// $i++;
|
|
||||||
if (mime($attachment->type)==true) {
|
|
||||||
$image = @imagecreatefromstring($attachment->file);
|
|
||||||
ob_start();
|
|
||||||
imagejpeg($image, null, 80);
|
|
||||||
$data = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
$var = '<img style="max-width:200px;max-height:200px;" src="data:image/' . $attachment->type . ';base64,' . base64_encode($data) . '" />';
|
|
||||||
// echo $var;
|
|
||||||
// echo $attachment->name;
|
|
||||||
// $body = explode($attachment->name, $body);
|
|
||||||
$body = str_replace($attachment->name, "data:image/" . $attachment->type . ";base64," . base64_encode($data), $body);
|
|
||||||
|
|
||||||
$string = $body;
|
|
||||||
$start = "<head>";
|
|
||||||
$end = "</head>";
|
|
||||||
if (strpos($string, $start) == false || strpos($string, $start) == false) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$ini = strpos($string, $start);
|
|
||||||
$ini += strlen($start);
|
|
||||||
$len = strpos($string, $end, $ini) - $ini;
|
|
||||||
$parsed = substr($string, $ini, $len);
|
|
||||||
$body2 = $parsed;
|
|
||||||
$body = str_replace($body2, " ", $body);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// echo $body;
|
|
||||||
// $body = explode($attachment->file, $body);
|
|
||||||
// $body = $body[0];
|
|
||||||
}
|
|
||||||
$string = $body;
|
|
||||||
$start = "<head>";
|
|
||||||
$end = "</head>";
|
|
||||||
if (strpos($string, $start) == false || strpos($string, $start) == false) {
|
|
||||||
} else {
|
|
||||||
$ini = strpos($string, $start);
|
|
||||||
$ini += strlen($start);
|
|
||||||
$len = strpos($string, $end, $ini) - $ini;
|
|
||||||
$parsed = substr($string, $ini, $len);
|
|
||||||
$body2 = $parsed;
|
|
||||||
$body = str_replace($body2, " ", $body);
|
|
||||||
}
|
|
||||||
if($conversation->user_id != null) {
|
if($conversation->user_id != null) {
|
||||||
if ($conversation->is_internal) {
|
if ($conversation->is_internal) {
|
||||||
$color = '#A19CFF';
|
$color = '#A19CFF';
|
||||||
@@ -713,7 +655,7 @@ if ($thread->title != "") {
|
|||||||
$('#loader_frame{{$conversation->id}}')[0].contentDocument.body.innerHTML = '{!!$conversation->purify()!!}';
|
$('#loader_frame{{$conversation->id}}')[0].contentDocument.body.innerHTML = '{!!$conversation->purify()!!}';
|
||||||
</script>
|
</script>
|
||||||
@else
|
@else
|
||||||
{!! $body !!}
|
{!! $conversation->body !!}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if($conversation->id == $ij->id)
|
@if($conversation->id == $ij->id)
|
||||||
@@ -755,29 +697,11 @@ if ($thread->title != "") {
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<ul class='mailbox-attachments clearfix'>
|
<ul class='mailbox-attachments clearfix'>
|
||||||
<?php
|
@forelse($attachments as $attachment)
|
||||||
foreach ($attachments as $attachment) {
|
{!! $attachment->getFile() !!}
|
||||||
$size = $attachment->size;
|
@empty
|
||||||
$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
|
|
||||||
$power = $size > 0 ? floor(log($size, 1024)) : 0;
|
@endforelse
|
||||||
$value = number_format($size / pow(1024, $power), 2, '.', ',') . ' ' . $units[$power];
|
|
||||||
if ($attachment->poster == 'ATTACHMENT') {
|
|
||||||
if (mime($attachment->type)==true) {
|
|
||||||
$image = @imagecreatefromstring($attachment->file);
|
|
||||||
ob_start();
|
|
||||||
imagejpeg($image, null, 80);
|
|
||||||
$data = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
$var = '<a href="' . URL::route('image', array('image_id' => $attachment->id)) . '" target="_blank"><img style="max-width:200px;height:133px;" src="data:image/jpg;base64,' . base64_encode($data) . '"/></a>';
|
|
||||||
echo '<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;">' . $attachment->name . '</b><br/><p>' . $value . '</p></div></li>';
|
|
||||||
} 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 style="max-width:200px;height:133px;color:#666;" href="' . URL::route('image', array('image_id' => $attachment->id)) . '" target="_blank"><span class="mailbox-attachment-icon" style="background-color:#fff; font-size:18px;">' . strtoupper($attachment->type) . '</span><div class="mailbox-attachment-info"><span ><b style="word-wrap: break-word;">' . $attachment->name . '</b><br/><p>' . $value . '</p></span></div></a>';
|
|
||||||
echo '<li style="background-color:#f4f4f4;">' . $var . '</li>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1891,28 +1815,30 @@ if ($thread->title != "") {
|
|||||||
}
|
}
|
||||||
if (response == 1)
|
if (response == 1)
|
||||||
{
|
{
|
||||||
$("#refresh1").load("../thread/{{$tickets->id}} #refresh1");
|
location.reload();
|
||||||
var message = "{{ Lang::get('lang.you_have_successfully_replied_to_your_ticket') }}";
|
// $("#refresh1").load("../thread/{{$tickets->id}} #refresh1");
|
||||||
$("#alert21").show();
|
// var message = "{{ Lang::get('lang.you_have_successfully_replied_to_your_ticket') }}";
|
||||||
$('#message-success2').html(message);
|
// $("#alert21").show();
|
||||||
setInterval(function(){$("#alert21").hide(); }, 4000);
|
// $('#message-success2').html(message);
|
||||||
$("#newtextarea").empty();
|
// setInterval(function(){$("#alert21").hide(); }, 4000);
|
||||||
var div = document.getElementById('newtextarea');
|
// $("#newtextarea").empty();
|
||||||
div.innerHTML = div.innerHTML + '<textarea style="width:98%;height:200px;" name="reply_content" class="form-control" id="reply_content"/></textarea>';
|
// var div = document.getElementById('newtextarea');
|
||||||
$("#newtextarea1").empty();
|
// div.innerHTML = div.innerHTML + '<textarea style="width:98%;height:200px;" name="reply_content" class="form-control" id="reply_content"/></textarea>';
|
||||||
var div1 = document.getElementById('newtextarea1');
|
// $("#newtextarea1").empty();
|
||||||
div1.innerHTML = div1.innerHTML + '<textarea style="width:98%;height:200px;" name="InternalContent" class="form-control" id="InternalContent"/></textarea>';
|
// var div1 = document.getElementById('newtextarea1');
|
||||||
var wysihtml5Editor = $('textarea').wysihtml5().data("wysihtml5").editor;
|
// div1.innerHTML = div1.innerHTML + '<textarea style="width:98%;height:200px;" name="InternalContent" class="form-control" id="InternalContent"/></textarea>';
|
||||||
setInterval(function(){
|
// var wysihtml5Editor = $('textarea').wysihtml5().data("wysihtml5").editor;
|
||||||
var head= document.getElementsByTagName('head')[0];
|
// setInterval(function(){
|
||||||
var script= document.createElement('script');
|
// var head= document.getElementsByTagName('head')[0];
|
||||||
script.type= 'text/javascript';
|
// var script= document.createElement('script');
|
||||||
script.src= '{{asset("lb-faveo/js/jquery.rating.pack.js")}}';
|
// script.type= 'text/javascript';
|
||||||
head.appendChild(script);
|
// script.src= '{{asset("lb-faveo/js/jquery.rating.pack.js")}}';
|
||||||
// $('.rating-cancel').hide();
|
// head.appendChild(script);
|
||||||
// $(".star-rating-control").attr("disabled", "disabled").off('hover');
|
//// $('.rating-cancel').hide();
|
||||||
// $(".star-rating-control").addClass("disabled")
|
//// $(".star-rating-control").attr("disabled", "disabled").off('hover');
|
||||||
}, 4000);
|
//// $(".star-rating-control").addClass("disabled")
|
||||||
|
// }, 4000);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// alert('fail');
|
// alert('fail');
|
||||||
// $( "#dismis4" ).trigger( "click" );
|
// $( "#dismis4" ).trigger( "click" );
|
||||||
|
Reference in New Issue
Block a user