update 1.0.8.0

Commits for version update
This commit is contained in:
Manish Verma
2016-10-17 12:02:27 +05:30
parent dec927987b
commit 76e85db070
9674 changed files with 495757 additions and 58922 deletions

View File

@@ -6,9 +6,10 @@ use App\BaseModel;
class Ticket_Priority extends BaseModel
{
protected $primaryKey = 'priority_id';
public $timestamps = false;
protected $table = 'ticket_priority';
protected $fillable = [
'priority_id', 'priority', 'priority_desc', 'priority_color', 'priority_urgency', 'ispublic',
'priority_id', 'priority', 'status', 'user_priority_status', 'priority_desc', 'priority_color', 'priority_urgency', 'ispublic', 'created_at', 'updated_at',
];
}

View File

@@ -3,6 +3,7 @@
namespace App\Model\helpdesk\Ticket;
//use App\BaseModel;
use File;
use Illuminate\Database\Eloquent\Model;
class Ticket_Thread extends Model
@@ -27,8 +28,117 @@ class Ticket_Thread extends Model
// $this->attributes['title'] = str_replace('"', "'", $value);
// }
public function getTitleAttribute($value)
{
return str_replace('"', "'", $value);
}
public function getTitleAttribute($value)
{
return str_replace('"', "'", $value);
}
public function thread($content)
{
// $porufi = $this->purify($content);
// dd($content,$porufi);
//return $content;
return $this->purify($content);
}
public function purifyOld($value)
{
require_once base_path('vendor'.DIRECTORY_SEPARATOR.'htmlpurifier'.DIRECTORY_SEPARATOR.'library'.DIRECTORY_SEPARATOR.'HTMLPurifier.auto.php');
$path = base_path('vendor'.DIRECTORY_SEPARATOR.'htmlpurifier'.DIRECTORY_SEPARATOR.'library'.DIRECTORY_SEPARATOR.'HTMLPurifier'.DIRECTORY_SEPARATOR.'DefinitionCache'.DIRECTORY_SEPARATOR.'Serializer');
if (!File::exists($path)) {
File::makeDirectory($path, $mode = 0777, true, true);
}
$config = \HTMLPurifier_Config::createDefault();
$config->set('HTML.Trusted', true);
$config->set('Filter.YouTube', true);
$purifier = new \HTMLPurifier($config);
if ($value != strip_tags($value)) {
$value = $purifier->purify($value);
}
return $value;
}
public function purify()
{
$value = $this->attributes['body'];
$str = str_replace("'", '"', $value);
$html = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $str);
$string = trim(preg_replace('/\s+/', ' ', $html));
$content = $this->inlineAttachment($string);
return $content;
}
public function setTitleAttribute($value)
{
if ($value == '') {
$this->attributes['title'] = 'No available';
} else {
$this->attributes['title'] = $value;
}
}
public function removeScript($html)
{
$doc = new \DOMDocument();
// load the HTML string we want to strip
$doc->loadHTML($html);
// get all the script tags
$script_tags = $doc->getElementsByTagName('script');
$length = $script_tags->length;
// for each tag, remove it from the DOM
for ($i = 0; $i < $length; $i++) {
$script_tags->item($i)->parentNode->removeChild($script_tags->item($i));
}
// get the HTML string back
$no_script_html_string = $doc->saveHTML();
return $no_script_html_string;
}
public function firstContent()
{
$poster = $this->attributes['poster'];
if ($poster == 'client') {
return 'yes';
}
return 'no';
}
public function inlineAttachment($body)
{
if ($this->attach()->where('poster', 'INLINE')->get()->count() > 0) {
$search = $this->attach()->where('poster', 'INLINE')->lists('name')->toArray();
foreach ($this->attach()->where('poster', 'INLINE')->get() as $key => $attach) {
$replace[$key] = "data:$attach->type;base64,".base64_encode($attach->file);
}
$body = str_replace($search, $replace, $body);
}
return $body;
}
public function getSubject()
{
$subject = $this->attributes['title'];
$array = imap_mime_header_decode($subject);
$title = '';
if (is_array($array) && count($array) > 0) {
foreach ($array as $text) {
$title .= $text->text;
}
return wordwrap($title, 70, "<br>\n");
}
return wordwrap($subject, 70, "<br>\n");
}
}

View File

@@ -9,6 +9,6 @@ class Ticket_source extends BaseModel
public $timestamps = false;
protected $table = 'ticket_source';
protected $fillable = [
'name', 'value',
'name', 'value', 'css_class',
];
}

View File

@@ -28,6 +28,34 @@ class Tickets extends BaseModel
return $this->hasMany('App\Model\helpdesk\Ticket\Ticket_Form_Data', 'ticket_id');
}
public function extraFields()
{
$id = $this->attributes['id'];
$ticket_form_datas = \App\Model\helpdesk\Ticket\Ticket_Form_Data::where('ticket_id', '=', $id)->get();
return $ticket_form_datas;
}
public function source()
{
$source_id = $this->attributes['source'];
$sources = new Ticket_source();
$source = $sources->find($source_id);
return $source;
}
public function sourceCss()
{
$css = 'fa fa-comment';
$source = $this->source();
if ($source) {
$css = $source->css_class;
}
return $css;
}
public function delete()
{
$this->thread()->delete();