Second commit of version
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
<?php namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
// use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Bugsnag\BugsnagLaravel\BugsnagExceptionHandler as ExceptionHandler;
|
||||
|
||||
class Handler extends ExceptionHandler {
|
||||
|
||||
/**
|
||||
* A list of the exception types that should not be reported.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
'Symfony\Component\HttpKernel\Exception\HttpException',
|
||||
];
|
||||
|
||||
/**
|
||||
* Report or log an exception.
|
||||
*
|
||||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @return void
|
||||
*/
|
||||
public function report(Exception $e) {
|
||||
return parent::report($e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $e
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function render($request, Exception $e) {
|
||||
if ($e instanceof \Symfony\Component\HttpKernel\Exception\HttpException) {
|
||||
return redirect('404');
|
||||
} elseif ($e instanceof \Illuminate\View\Engines\handleViewException) {
|
||||
return redirect('404');
|
||||
} elseif ($e instanceof \Illuminate\Database\QueryException) {
|
||||
return redirect('404');
|
||||
} elseif ($e) {
|
||||
return redirect('404');
|
||||
}
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
|
||||
}
|
@@ -1,413 +0,0 @@
|
||||
<?php namespace App\Http\Controllers\Agent;
|
||||
use App;
|
||||
use App\Http\Controllers\Agent\TicketController;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Model\Email\Emails;
|
||||
use App\Model\Ticket\Ticket_attachments;
|
||||
use App\Model\Ticket\Ticket_Thread;
|
||||
|
||||
/**
|
||||
* MailController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class MailController extends Controller {
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $email = "";
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $stream = "";
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* Create a new controller instance.
|
||||
* @param type TicketController $TicketController
|
||||
*/
|
||||
public function __construct(TicketController $TicketController) {
|
||||
$this->TicketController = $TicketController;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode Imap text
|
||||
* @param type $str
|
||||
* @return type string
|
||||
*/
|
||||
function decode_imap_text($str) {
|
||||
$result = '';
|
||||
$decode_header = imap_mime_header_decode($str);
|
||||
foreach ($decode_header AS $obj) {
|
||||
$result .= htmlspecialchars(rtrim($obj->text, "\t"));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* get Imap data
|
||||
*/
|
||||
function getdata() {
|
||||
/**
|
||||
* fetching all the emails allowed to
|
||||
* check for mails to read tickets
|
||||
*/
|
||||
$email = new Emails;
|
||||
$mailboxes = $email->get();
|
||||
|
||||
//check for any value in $mailbox
|
||||
if (count($mailboxes) >= 0) {
|
||||
foreach ($mailboxes as $current_mailbox) {
|
||||
//checking for fetching status of the emails
|
||||
if ($current_mailbox['fetching_status']) {
|
||||
/**
|
||||
*@imap_open requres three arguments for
|
||||
* reading mails in each emails
|
||||
*
|
||||
* 1. Host
|
||||
* 2. email address
|
||||
* 3. password
|
||||
*/
|
||||
$stream = @imap_open($current_mailbox['fetching_host'], $current_mailbox['email_address'], $current_mailbox['password']);
|
||||
/**
|
||||
* @var $testvar type string
|
||||
*/
|
||||
$testvar = "";
|
||||
// checking for any result in imap_open with value
|
||||
if ($stream >= 0) {
|
||||
/**
|
||||
* @imap_search requires two arguments to check
|
||||
* from when to check for mails
|
||||
*
|
||||
* 1. result of @imap_open $stream
|
||||
* 2. date in negative
|
||||
*/
|
||||
$emails = imap_search($stream, 'SINCE ' . date('d-M-Y', strtotime("-1 day")));
|
||||
// checking if $emails has received any value
|
||||
if ($emails != false) {
|
||||
// count for mails
|
||||
if (count($emails) >= 0) {
|
||||
rsort($emails);
|
||||
foreach ($emails as $email_id) {
|
||||
/**
|
||||
* @imap_fetch_overview requires three arguments to check
|
||||
* the overview of each mails
|
||||
*
|
||||
* 1. result of @imap_open $stream
|
||||
* 2. emails numbers $emails_id
|
||||
* 3. and a 0 value
|
||||
*/
|
||||
$overview = imap_fetch_overview($stream, $email_id, 0);
|
||||
$var = $overview[0]->seen ? 'read' : 'unread';
|
||||
// check for unread messages
|
||||
if ($var == 'read') {
|
||||
$testvar = 'set';
|
||||
/**
|
||||
* fetching overview details fo each mails
|
||||
*
|
||||
* 1. from address
|
||||
* 2. subject
|
||||
* 3. date and time
|
||||
*/
|
||||
$from = $this->decode_imap_text($overview[0]->from);
|
||||
$subject = $this->decode_imap_text($overview[0]->subject);
|
||||
$datetime = $overview[0]->date;
|
||||
// separate date and time
|
||||
$date_time = explode(" ", $datetime);
|
||||
$date = $date_time[1] . "-" . $date_time[2] . "-" . $date_time[3] . " " . $date_time[4];
|
||||
|
||||
//=======================================================================
|
||||
// check user
|
||||
//=======================================================================
|
||||
// $subject = $subject;
|
||||
// $match = '/^[[A-Z]{4}-[0-9]{4}-[0-9]{7}]][A-z0-9]$/';
|
||||
// if(preg_match($match, $subject))
|
||||
// {
|
||||
// echo "success";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// echo "fail";
|
||||
// }
|
||||
$emailadd = explode('&', $from);
|
||||
$username = $emailadd[0];
|
||||
$emailadd = substr($emailadd[1], 3);
|
||||
$date = date('Y-m-d H:i:s', strtotime($date));
|
||||
$system = "Email";
|
||||
$phone = "";
|
||||
$helptopic = $this->TicketController->default_helptopic();
|
||||
$sla = $this->TicketController->default_sla();
|
||||
$structure = imap_fetchstructure($stream, $email_id);
|
||||
// $image1 = $structure->parts[0]->parts[1]->parameters[0]->value;
|
||||
// $image = $structure->parts[1]->parameters[0]->value;
|
||||
// echo '<img src="'.$image1.'">';
|
||||
// echo '<img src="'.$image.'">';
|
||||
// dd($structure);
|
||||
|
||||
/**
|
||||
* There are 5 types of mail readable formats
|
||||
*
|
||||
* 1. Html
|
||||
* 2. Alternative
|
||||
* 3. Related
|
||||
* 4. Mixed
|
||||
*/
|
||||
|
||||
// checking if the format is Html
|
||||
if ($structure->subtype == 'HTML') {
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1);
|
||||
if ($body2 == null) {
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1);
|
||||
}
|
||||
$body = quoted_printable_decode($body2);
|
||||
// $body = explode("---Reply above this line---", $body);
|
||||
// echo $body;
|
||||
// echo "0";
|
||||
}
|
||||
// checking if the format is Alternative
|
||||
if ($structure->subtype == 'ALTERNATIVE') {
|
||||
if (isset($structure->parts)) {
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1.2);
|
||||
if ($body2 == null) {
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1);
|
||||
}
|
||||
$body = quoted_printable_decode($body2);
|
||||
// $body = explode("---Reply above this line---", $body);
|
||||
// echo $body[0];
|
||||
}
|
||||
}
|
||||
// checking if the format is related
|
||||
if ($structure->subtype == 'RELATED') {
|
||||
if (isset($structure->parts)) {
|
||||
$parts = $structure->parts;
|
||||
$i = 0;
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1.2);
|
||||
if ($body2 == null) {
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1);
|
||||
}
|
||||
$body = quoted_printable_decode($body2);
|
||||
foreach ($parts as $part) {
|
||||
if ($parts[$i]) {
|
||||
}
|
||||
$i++;
|
||||
if (isset($parts[$i])) {
|
||||
if ($parts[$i]->ifid == 1) {
|
||||
$id = $parts[$i]->id;
|
||||
$imageid = substr($id, 1, -1);
|
||||
$imageid = "cid:" . $imageid;
|
||||
if ($parts[$i]->ifdparameters == 1) {
|
||||
foreach ($parts[$i]->dparameters as $object) {
|
||||
if (strtolower($object->attribute) == 'filename') {
|
||||
$filename = $object->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($parts[$i]->ifparameters == 1) {
|
||||
foreach ($parts[$i]->parameters as $object) {
|
||||
if (strtolower($object->attribute) == 'name') {
|
||||
$name = $object->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
$body = str_replace($imageid, $filename, $body);
|
||||
|
||||
// $ticket_Thread = new Ticket_attachments;
|
||||
// // $ticket_Thread->thread_id = $thread_id;
|
||||
// $ticket_Thread->name = $filename;
|
||||
// // $ticket_Thread->size = $filesize;
|
||||
// // $ticket_Thread->type = $ext;
|
||||
// $ticket_Thread->content = '<img src="'.$name.'">';
|
||||
// $ticket_Thread->save();
|
||||
// // $body = explode("---Reply above this line---", $body);
|
||||
// echo $body[0];
|
||||
// echo "2";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//checking if the format is mixed
|
||||
elseif ($structure->subtype == 'MIXED') {
|
||||
if (isset($structure->parts)) {
|
||||
$parts = $structure->parts;
|
||||
|
||||
// subtype = ALTERNATIVE
|
||||
if ($parts[0]->subtype == 'ALTERNATIVE') {
|
||||
if (isset($structure->parts)) {
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1.2);
|
||||
if ($body2 == null) {
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1);
|
||||
}
|
||||
$body = quoted_printable_decode($body2);
|
||||
}
|
||||
}
|
||||
// subtype = RELATED
|
||||
if ($parts[0]->subtype == 'RELATED') {
|
||||
if (isset($parts[0]->parts)) {
|
||||
$parts = $parts[0]->parts;
|
||||
$i = 0;
|
||||
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1.1);
|
||||
if ($body2 == null) {
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1);
|
||||
}
|
||||
$body = quoted_printable_decode($body2);
|
||||
$name = "";
|
||||
foreach ($parts as $part) {
|
||||
if ($parts[0]) {
|
||||
}
|
||||
$i++;
|
||||
if (isset($parts[$i])) {
|
||||
if ($parts[$i]->ifid == 1) {
|
||||
$id = $parts[$i]->id;
|
||||
$imageid = substr($id, 1, -1);
|
||||
$imageid = "cid:" . $imageid;
|
||||
if ($parts[$i]->ifdparameters == 1) {
|
||||
foreach ($parts[$i]->dparameters as $object) {
|
||||
if (strtolower($object->attribute) == 'filename') {
|
||||
$filename = $object->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($parts[$i]->ifparameters == 1) {
|
||||
foreach ($parts[$i]->parameters as $object) {
|
||||
if (strtolower($object->attribute) == 'name') {
|
||||
$name = $object->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$body = str_replace($imageid, $name, $body);
|
||||
// $body = explode("---Reply above this line---", $body);
|
||||
// echo $body[0];
|
||||
// echo '3'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// dd($structure);
|
||||
}
|
||||
// $ticket = new Tickets;
|
||||
// $ticket->name = $from;
|
||||
// $ticket->subject = $subject;
|
||||
// $ticket->body = $body2;
|
||||
// $ticket->date = $datetime;
|
||||
// $ticket->save();
|
||||
// $ticket = new Ticket_Thread;
|
||||
// $ticket->name = $from;
|
||||
// $ticket->subject = $subject;
|
||||
// $ticket->body = $body2;
|
||||
// $ticket->date = $datetime;
|
||||
// $ticket->save();
|
||||
$priority = '1';
|
||||
if ($this->TicketController->create_user($emailadd, $username, $subject, $body, $phone, $helptopic, $sla, $priority, $system) == true) {
|
||||
$thread_id = Ticket_Thread::whereRaw('id = (select max(`id`) from ticket_thread)')->first();
|
||||
$thread_id = $thread_id->id;
|
||||
if ($this->get_attachment($structure, $stream, $email_id, $thread_id) == true) {
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
imap_close($stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get attachments data from mail
|
||||
* @param type $structure
|
||||
* @param type $stream
|
||||
* @param type $email_id
|
||||
* @param type $thread_id
|
||||
* @return type bool
|
||||
*/
|
||||
public function get_attachment($structure, $stream, $email_id, $thread_id) {
|
||||
// checking if the mails has attachments
|
||||
if (isset($structure->parts) && count($structure->parts)) {
|
||||
for ($i = 0; $i < count($structure->parts); $i++) {
|
||||
$attachments[$i] = array(
|
||||
'is_attachment' => false,
|
||||
'filename' => '',
|
||||
'name' => '',
|
||||
'attachment' => '');
|
||||
// checking for files
|
||||
if ($structure->parts[$i]->ifdparameters) {
|
||||
foreach ($structure->parts[$i]->dparameters as $object) {
|
||||
if (strtolower($object->attribute) == 'filename') {
|
||||
$attachments[$i]['is_attachment'] = true;
|
||||
$attachments[$i]['filename'] = $object->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
// checking for files
|
||||
if ($structure->parts[$i]->ifparameters) {
|
||||
foreach ($structure->parts[$i]->parameters as $object) {
|
||||
if (strtolower($object->attribute) == 'name') {
|
||||
$attachments[$i]['is_attachment'] = true;
|
||||
$attachments[$i]['name'] = $object->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* All over again checking for the availability of attachment
|
||||
*/
|
||||
if ($attachments[$i]['is_attachment']) {
|
||||
$attachments[$i]['attachment'] = imap_fetchbody($stream, $email_id, $i + 1);
|
||||
// decoding if encoded in base64_encode format else quoted_printable_encode
|
||||
if ($structure->parts[$i]->encoding == 3) {
|
||||
$attachments[$i]['attachment'] = base64_decode($attachments[$i]['attachment']);
|
||||
} elseif ($structure->parts[$i]->encoding == 4) {
|
||||
$attachments[$i]['attachment'] = quoted_printable_decode($attachments[$i]['attachment']);
|
||||
}
|
||||
}
|
||||
}
|
||||
// calling the save method to save each attachments
|
||||
if ($this->save_attcahments($attachments, $thread_id) == true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to save attachments
|
||||
* @param type $attachments
|
||||
* @param type $thread_id
|
||||
* @return type bool
|
||||
*/
|
||||
public function save_attcahments($attachments, $thread_id) {
|
||||
if (count($attachments) != 0) {
|
||||
foreach ($attachments as $at) {
|
||||
if ($at['is_attachment'] == 1) {
|
||||
$str = str_shuffle('abcdefghijjklmopqrstuvwxyz');
|
||||
$filename = $at['filename'];
|
||||
$ext = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
$tmpName = $at['filename'];
|
||||
$fp = fopen($tmpName, 'r');
|
||||
$content = fread($fp, filesize($tmpName));
|
||||
$content2 = file_put_contents($at['filename'], $at['attachment']);
|
||||
$filesize = $content2;
|
||||
$ticket_Thread = new Ticket_attachments;
|
||||
$ticket_Thread->thread_id = $thread_id;
|
||||
$ticket_Thread->name = $filename;
|
||||
$ticket_Thread->size = $filesize;
|
||||
$ticket_Thread->type = $ext;
|
||||
$ticket_Thread->content = $fp;
|
||||
$ticket_Thread->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -1,578 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Agent;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\CreateTicketRequest;
|
||||
use App\Http\Requests\TicketRequest;
|
||||
use App\Model\Email\Banlist;
|
||||
use App\Model\Ticket\Tickets;
|
||||
use App\Model\Ticket\Ticket_Thread;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Mail;
|
||||
use PDF;
|
||||
|
||||
/**
|
||||
* TicketController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class TicketController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type response
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the ticket list page
|
||||
* @return type response
|
||||
*/
|
||||
public function ticket_list() {
|
||||
return view('themes.default1.agent.ticket.ticket');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Open ticket list page
|
||||
* @return type response
|
||||
*/
|
||||
public function open_ticket_list() {
|
||||
return view('themes.default1.agent.ticket.open');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the answered ticket list page
|
||||
* @return type response
|
||||
*/
|
||||
public function answered_ticket_list() {
|
||||
return view('themes.default1.agent.ticket.answered');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Myticket list page
|
||||
* @return type response
|
||||
*/
|
||||
public function myticket_ticket_list() {
|
||||
return view('themes.default1.agent.ticket.myticket');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Overdue ticket list page
|
||||
* @return type response
|
||||
*/
|
||||
public function overdue_ticket_list() {
|
||||
return view('themes.default1.agent.ticket.overdue');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Closed ticket list page
|
||||
* @return type response
|
||||
*/
|
||||
public function closed_ticket_list() {
|
||||
return view('themes.default1.agent.ticket.closed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the New ticket page
|
||||
* @return type response
|
||||
*/
|
||||
public function newticket() {
|
||||
return view('themes.default1.agent.ticket.new');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the data of new ticket and show the New ticket page with result
|
||||
* @param type CreateTicketRequest $request
|
||||
* @return type response
|
||||
*/
|
||||
public function post_newticket(CreateTicketRequest $request) {
|
||||
$email = $request->input('email');
|
||||
$fullname = $request->input('fullname');
|
||||
$notice = $request->input('notice');
|
||||
$helptopic = $request->input('helptopic');
|
||||
$dept = $request->input('dept');
|
||||
$sla = $request->input('sla');
|
||||
$duedate = $request->input('duedate');
|
||||
$assignto = $request->input('assignto');
|
||||
$subject = $request->input('subject');
|
||||
$body = $request->input('body');
|
||||
$priority = $request->input('priority');
|
||||
$phone = "";
|
||||
$system = "";
|
||||
//create user
|
||||
if ($this->create_user($email, $fullname, $subject, $body, $phone, $helptopic, $sla, $priority, $system)) {
|
||||
return Redirect('newticket')->with('success', 'success');
|
||||
} else {
|
||||
return Redirect('newticket')->with('fails', 'fails');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the ticket thread details
|
||||
* @param type $id
|
||||
* @return type response
|
||||
*/
|
||||
public function thread($id) {
|
||||
$tickets = Tickets::where('id', '=', $id)->first();
|
||||
$thread = Ticket_Thread::where('ticket_id', '=', $id)->first();
|
||||
return view('themes.default1.agent.ticket.timeline', compact('tickets'), compact('thread'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Replying a ticket
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type TicketRequest $request
|
||||
* @return type bool
|
||||
*/
|
||||
public function reply(Ticket_Thread $thread, TicketRequest $request) {
|
||||
$thread->ticket_id = $request->input('ticket_ID');
|
||||
$thread->poster = 'support';
|
||||
$thread->body = $request->input('ReplyContent');
|
||||
$thread->save();
|
||||
$ticket_id = $request->input('ticket_ID');
|
||||
$tickets = Tickets::where('id', '=', $ticket_id)->first();
|
||||
$thread = Ticket_Thread::where('ticket_id', '=', $ticket_id)->first();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ticket edit and save ticket data
|
||||
* @param type $ticket_id
|
||||
* @param type Ticket_Thread $thread
|
||||
* @return type bool
|
||||
*/
|
||||
public function ticket_edit_post($ticket_id, Ticket_Thread $thread) {
|
||||
$threads = $thread->where('ticket_id', '=', $ticket_id)->first();
|
||||
if (Input::get('subject') != null && Input::get('body') != null) {
|
||||
$threads->title = Input::get('subject');
|
||||
$threads->body = Input::get('body');
|
||||
if ($threads->save()) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print Ticket Details
|
||||
* @param type $id
|
||||
* @return type respponse
|
||||
*/
|
||||
public function ticket_print($id) {
|
||||
$tickets = Tickets::where('id', '=', $id)->first();
|
||||
$thread = Ticket_Thread::where('ticket_id', '=', $id)->first();
|
||||
$html = view('themes.default1.agent.ticket.pdf', compact('id', 'tickets', 'thread'))->render();
|
||||
return PDF::load($html)->show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates Ticket Number
|
||||
* @param type $ticket_number
|
||||
* @return type integer
|
||||
*/
|
||||
public function ticket_number($ticket_number) {
|
||||
$number = $ticket_number;
|
||||
$number = explode('-', $number);
|
||||
$number1 = $number[0];
|
||||
if ($number1 == 'ZZZZ') {
|
||||
$number1 = 'AAAA';
|
||||
}
|
||||
$number2 = $number[1];
|
||||
if ($number2 == '9999') {
|
||||
$number2 = '0000';
|
||||
}
|
||||
$number3 = $number[2];
|
||||
if ($number3 == '9999999') {
|
||||
$number3 = '0000000';
|
||||
}
|
||||
$number1++;
|
||||
$number2++;
|
||||
$number3++;
|
||||
$number2 = sprintf('%04s', $number2);
|
||||
$number3 = sprintf('%07s', $number3);
|
||||
$array = array($number1, $number2, $number3);
|
||||
$number = implode('-', $array);
|
||||
return $number;
|
||||
}
|
||||
|
||||
/**
|
||||
* check email for dublicate entry
|
||||
* @param type $email
|
||||
* @return type bool
|
||||
*/
|
||||
public function check_email($email) {
|
||||
$check = User::where('email', '=', $email)->first();
|
||||
if ($check == true) {
|
||||
return $check;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create User while creating ticket
|
||||
* @param type $emailadd
|
||||
* @param type $username
|
||||
* @param type $subject
|
||||
* @param type $body
|
||||
* @param type $phone
|
||||
* @param type $helptopic
|
||||
* @param type $sla
|
||||
* @param type $priority
|
||||
* @param type $system
|
||||
* @return type bool
|
||||
*/
|
||||
public function create_user($emailadd, $username, $subject, $body, $phone, $helptopic, $sla, $priority, $system) {
|
||||
// define global variables
|
||||
$email;
|
||||
$username;
|
||||
// check emails
|
||||
$checkemail = $this->check_email($emailadd);
|
||||
|
||||
if ($checkemail == false) {
|
||||
// Generate password
|
||||
$password = $this->generateRandomString();
|
||||
// create user
|
||||
$user = new User;
|
||||
$user->user_name = $username;
|
||||
$user->email = $emailadd;
|
||||
$user->password = Hash::make($password);
|
||||
// mail user his/her password
|
||||
if ($user->save()) {
|
||||
$user_id = $user->id;
|
||||
if (Mail::send('emails.pass', ['password' => $password, 'name' => $username], function ($message) use ($emailadd, $username) {
|
||||
$message->to($emailadd, $username)->subject('password');
|
||||
})) {
|
||||
// need to do something here....
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$username = $checkemail->username;
|
||||
$user_id = $checkemail->id;
|
||||
}
|
||||
$ticket_number = $this->check_ticket($user_id, $subject, $body, $helptopic, $sla, $priority);
|
||||
// send ticket create details to user
|
||||
if (Mail::send('emails.Ticket_Create', ['name' => $username, 'ticket_number' => $ticket_number], function ($message) use ($emailadd, $username, $ticket_number) {
|
||||
$message->to($emailadd, $username)->subject('[~' . $ticket_number . ']');
|
||||
})) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Default helptopic
|
||||
* @return type string
|
||||
*/
|
||||
public function default_helptopic() {
|
||||
$helptopic = "1";
|
||||
return $helptopic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default SLA plan
|
||||
* @return type string
|
||||
*/
|
||||
public function default_sla() {
|
||||
$sla = "1";
|
||||
return $sla;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Priority
|
||||
* @return type string
|
||||
*/
|
||||
public function default_priority() {
|
||||
$priority = "1";
|
||||
return $prioirty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the response of the ticket
|
||||
* @param type $user_id
|
||||
* @param type $subject
|
||||
* @param type $body
|
||||
* @param type $helptopic
|
||||
* @param type $sla
|
||||
* @param type $priority
|
||||
* @return type string
|
||||
*/
|
||||
public function check_ticket($user_id, $subject, $body, $helptopic, $sla, $priority) {
|
||||
$read_ticket_number = substr($subject, 0, 6);
|
||||
if ($read_ticket_number == 'Re: [~') {
|
||||
$separate = explode("]", $subject);
|
||||
$new_subject = substr($separate[0], 6, 20);
|
||||
$find_number = Tickets::where('ticket_number', '=', $new_subject)->first();
|
||||
$thread_body = explode("---Reply above this line---", $body);
|
||||
$body = $thread_body[0];
|
||||
if (count($find_number) > 0) {
|
||||
$id = $find_number->id;
|
||||
$ticket_number = $find_number->ticket_number;
|
||||
if (isset($id)) {
|
||||
if ($this->ticket_thread($subject, $body, $id, $user_id)) {
|
||||
return $ticket_number;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$ticket_number = $this->create_ticket($user_id, $subject, $body, $helptopic, $sla, $priority);
|
||||
return $ticket_number;
|
||||
}
|
||||
} else {
|
||||
$ticket_number = $this->create_ticket($user_id, $subject, $body, $helptopic, $sla, $priority);
|
||||
return $ticket_number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Ticket
|
||||
* @param type $user_id
|
||||
* @param type $subject
|
||||
* @param type $body
|
||||
* @param type $helptopic
|
||||
* @param type $sla
|
||||
* @param type $priority
|
||||
* @return type string
|
||||
*/
|
||||
public function create_ticket($user_id, $subject, $body, $helptopic, $sla, $priority) {
|
||||
$max_number = Tickets::whereRaw('id = (select max(`id`) from tickets)')->get();
|
||||
foreach ($max_number as $number) {
|
||||
$ticket_number = $number->ticket_number;
|
||||
}
|
||||
$ticket = new Tickets;
|
||||
$ticket->ticket_number = $this->ticket_number($ticket_number);
|
||||
$ticket->user_id = $user_id;
|
||||
$ticket->help_topic_id = $helptopic;
|
||||
$ticket->sla = $sla;
|
||||
$ticket->status = '1';
|
||||
$ticket->priority_id = $priority;
|
||||
$ticket->save();
|
||||
$ticket_number = $ticket->ticket_number;
|
||||
$id = $ticket->id;
|
||||
if ($this->ticket_thread($subject, $body, $id, $user_id) == true) {
|
||||
return $ticket_number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Ticket Thread
|
||||
* @param type $subject
|
||||
* @param type $body
|
||||
* @param type $id
|
||||
* @param type $user_id
|
||||
* @return type
|
||||
*/
|
||||
public function ticket_thread($subject, $body, $id, $user_id) {
|
||||
$thread = new Ticket_Thread;
|
||||
$thread->user_id = $user_id;
|
||||
$thread->ticket_id = $id;
|
||||
$thread->poster = 'client';
|
||||
$thread->title = $subject;
|
||||
$thread->body = $body;
|
||||
if ($thread->save()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a random string for password
|
||||
* @param type $length
|
||||
* @return type string
|
||||
*/
|
||||
public function generateRandomString($length = 10) {
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
return $randomString;
|
||||
}
|
||||
|
||||
/**
|
||||
* function to Ticket Close
|
||||
* @param type $id
|
||||
* @param type Tickets $ticket
|
||||
* @return type string
|
||||
*/
|
||||
public function close($id, Tickets $ticket) {
|
||||
$ticket_status = $ticket->where('id', '=', $id)->first();
|
||||
$ticket_status->status = 3;
|
||||
$ticket_status->save();
|
||||
return "your ticket" . $ticket_status->ticket_number . " has been closed";
|
||||
}
|
||||
|
||||
/**
|
||||
* function to Ticket resolved
|
||||
* @param type $id
|
||||
* @param type Tickets $ticket
|
||||
* @return type string
|
||||
*/
|
||||
public function resolve($id, Tickets $ticket) {
|
||||
$ticket_status = $ticket->where('id', '=', $id)->first();
|
||||
$ticket_status->status = 2;
|
||||
$ticket_status->save();
|
||||
return "your ticket" . $ticket_status->ticket_number . " has been resolved";
|
||||
}
|
||||
|
||||
/**
|
||||
* function to Open Ticket
|
||||
* @param type $id
|
||||
* @param type Tickets $ticket
|
||||
* @return type
|
||||
*/
|
||||
public function open($id, Tickets $ticket) {
|
||||
$ticket_status = $ticket->where('id', '=', $id)->first();
|
||||
$ticket_status->status = 1;
|
||||
$ticket_status->save();
|
||||
return "your ticket" . $ticket_status->ticket_number . " has been opened";
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to delete ticket
|
||||
* @param type $id
|
||||
* @param type Tickets $ticket
|
||||
* @return type string
|
||||
*/
|
||||
public function delete($id, Tickets $ticket) {
|
||||
$ticket_delete = $ticket->where('id', '=', $id)->first();
|
||||
$ticket_delete->is_deleted = 0;
|
||||
$ticket_delete->status = 5;
|
||||
$ticket_delete->save();
|
||||
return "your ticket" . $ticket_delete->ticket_number . " has been delete";
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to ban an email
|
||||
* @param type $id
|
||||
* @param type Tickets $ticket
|
||||
* @return type string
|
||||
*/
|
||||
public function ban($id, Tickets $ticket) {
|
||||
$ticket_ban = $ticket->where('id', '=', $id)->first();
|
||||
$ban_email = $ticket_ban->user_id;
|
||||
$user = User::where('id', '=', $ban_email)->first();
|
||||
$user->is_ban = 1;
|
||||
$user->save();
|
||||
$Email = $user->email;
|
||||
$ban = Banlist::where('email_address', '=', $Email)->first();
|
||||
if ($ban == null) {
|
||||
$banlist = new Banlist;
|
||||
$banlist->ban_status = 1;
|
||||
$banlist->email_address = $user->email;
|
||||
$banlist->save();
|
||||
}
|
||||
return "the user has been banned";
|
||||
}
|
||||
|
||||
/**
|
||||
* function to assign ticket
|
||||
* @param type $id
|
||||
* @return type bool
|
||||
*/
|
||||
public function assign($id) {
|
||||
$UserEmail = Input::get('user');
|
||||
// $UserEmail = 'sujitprasad12@yahoo.in';
|
||||
$user = User::where('email', '=', $UserEmail)->first();
|
||||
$user_id = $user->id;
|
||||
$ticket = Tickets::where('id', '=', $id)->first();
|
||||
$ticket->assigned_to = $user_id;
|
||||
$ticket->save();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to post internal note
|
||||
* @param type $id
|
||||
* @return type bool
|
||||
*/
|
||||
public function InternalNote($id) {
|
||||
$InternalContent = Input::get('InternalContent');
|
||||
$thread = Ticket_Thread::where('ticket_id', '=', $id)->first();
|
||||
$NewThread = new Ticket_Thread;
|
||||
$NewThread->ticket_id = $thread->ticket_id;
|
||||
$NewThread->user_id = Auth::user()->id;
|
||||
$NewThread->thread_type = 'M';
|
||||
$NewThread->poster = Auth::user()->role;
|
||||
$NewThread->title = $thread->title;
|
||||
$NewThread->body = $InternalContent;
|
||||
$NewThread->save();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to surrender a ticket
|
||||
* @param type $id
|
||||
* @return type bool
|
||||
*/
|
||||
public function surrender($id) {
|
||||
$ticket = Tickets::where('id', '=', $id)->first();
|
||||
$ticket->assigned_to = 0;
|
||||
$ticket->save();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* function to search
|
||||
* @return type
|
||||
*/
|
||||
// public function search() {
|
||||
// $product = Input::get('type');
|
||||
// $word = Input::get('name_startsWith');
|
||||
|
||||
// if ($product == 'product') {
|
||||
// $starts_with = strtoupper($word);
|
||||
// $rows = DB::table('users')->select('user_name')->where('name', 'LIKE', $starts_with . '%')->get();
|
||||
// $data = array();
|
||||
// foreach ($rows as $row) {
|
||||
// array_push($data, $row->name);
|
||||
// }
|
||||
// print_r(json_encode($data));
|
||||
// }
|
||||
|
||||
// if ($product == 'product_table') {
|
||||
// $row_num = Input::get('row_num');
|
||||
// $starts_with = strtoupper($word);
|
||||
// $rows = DB::table('product')->select('name', 'description', 'cost_price')->where('name', 'LIKE', $starts_with . '%')->get();
|
||||
// $data = array();
|
||||
// foreach ($rows as $row) {
|
||||
// $name = $row->name . '|' . $row->description . '|' . $row->cost_price . '|' . $row_num;
|
||||
// array_push($data, $name);
|
||||
// }
|
||||
// print_r(json_encode($data));
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* shows trashed tickets
|
||||
* @return type response
|
||||
*/
|
||||
public function trash() {
|
||||
return view('themes.default1.agent.ticket.trash');
|
||||
}
|
||||
|
||||
/**
|
||||
* shows unassigned tickets
|
||||
* @return type
|
||||
*/
|
||||
public function unassigned() {
|
||||
return view('themes.default1.agent.ticket.unassigned');
|
||||
}
|
||||
|
||||
/**
|
||||
* shows tickets assigned to Auth::user()
|
||||
* @return type
|
||||
*/
|
||||
public function myticket() {
|
||||
return view('themes.default1.agent.ticket.myticket');
|
||||
}
|
||||
|
||||
}
|
@@ -1,102 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Guest;
|
||||
use App\Http\Controllers\Controller;
|
||||
/* include help topic model */
|
||||
use App\Model\Form\Form_details;
|
||||
/* Include form_name model */
|
||||
use App\Model\Form\Form_name;
|
||||
/* include form_detals model */
|
||||
/* Include form_value model */
|
||||
use App\Model\Manage\Help_topic;
|
||||
use App\User;
|
||||
use Form;
|
||||
use Illuminate\Http\Request;
|
||||
/* Validate form TicketForm using */
|
||||
use Input;
|
||||
|
||||
/**
|
||||
* FormController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class FormController extends Controller {
|
||||
|
||||
/**
|
||||
* This Function to get the form for the ticket
|
||||
* @param type Form_name $name
|
||||
* @param type Form_details $details
|
||||
* @param type Help_topic $topics
|
||||
* @return type Response
|
||||
*/
|
||||
public function getForm(Form_name $name, Form_details $details, Help_topic $topics) {
|
||||
// name of the form where status==1
|
||||
$name = $name->where('status', 1)->get();
|
||||
//get label and the type from form_detail table where form_name_id of form_detail
|
||||
// equal to form_name table's id
|
||||
$ids = $name->where('id', 2);
|
||||
foreach ($ids as $i) {
|
||||
$id = $i->id;
|
||||
}
|
||||
//get form_name_id from form_detail and save to detail_form_name_id
|
||||
$detail_form_name_id = $details->where('form_name_id', $id)->get();
|
||||
$count = count($detail_form_name_id);
|
||||
// foreach($detail_form_name_id as $details)
|
||||
// {
|
||||
// echo $details->label;
|
||||
// }
|
||||
return view('themes.default1.client.guest-user.form', compact('name', 'detail_form_name_id', 'topics'));
|
||||
}
|
||||
|
||||
/**
|
||||
* This Function to post the form for the ticket
|
||||
* @param type Form_name $name
|
||||
* @param type Form_details $details
|
||||
* @return type string
|
||||
*/
|
||||
public function postForm(Form_name $name, Form_details $details) {
|
||||
$name = $name->where('status', 1)->get();
|
||||
$ids = $name->where('id', 2);
|
||||
foreach ($ids as $i) {
|
||||
$id = $i->id;
|
||||
//echo $id;
|
||||
}
|
||||
$field = $details->where('form_name_id', $id)->get();
|
||||
$var = " ";
|
||||
foreach ($field as $key) {
|
||||
$type = $key->type;
|
||||
$label = $key->label;
|
||||
$var .= "," . $type . "-" . $label;
|
||||
}
|
||||
return $var;
|
||||
// foreach($outs as $out)
|
||||
// {
|
||||
// return $out;
|
||||
// }
|
||||
// $var=" ";
|
||||
// foreach ($field as $key) {
|
||||
// $field=$key->field_name;
|
||||
// $id=$key->form_id;
|
||||
// $var.=",".$field;
|
||||
// }
|
||||
// return $var;
|
||||
// // $var=$field.$id;
|
||||
// // return
|
||||
// // return Response::json(array(
|
||||
// // 'field' => $field,
|
||||
// // 'id' => $id
|
||||
// // ));
|
||||
}
|
||||
|
||||
/**
|
||||
* Posted form
|
||||
* @param type Request $request
|
||||
* @param type User $user
|
||||
*/
|
||||
public function postedForm(Request $request, User $user) {
|
||||
$user->name = $request->input('Name');
|
||||
$user->email = $request->input('Email');
|
||||
$user->save();
|
||||
}
|
||||
}
|
@@ -1,392 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Installer;
|
||||
|
||||
// /**
|
||||
// * |=======================================================================
|
||||
// * |Class: InstallController
|
||||
// * |=======================================================================
|
||||
// *
|
||||
// * Class to perform the first install operation without this the database
|
||||
// * settings could not be started
|
||||
// *
|
||||
// * @package epaper-pdf
|
||||
// * @subpackage Controller
|
||||
// * @author Ladybird <info@ladybirdweb.com>
|
||||
// *
|
||||
// */
|
||||
class InstallController extends Controller {
|
||||
|
||||
// /**
|
||||
// * Get Licence (step 1)
|
||||
// *
|
||||
// * validating licence agreement
|
||||
// */
|
||||
// public function licence(){
|
||||
// if(Config::get('database.install')=='%0%')
|
||||
// {
|
||||
// return View::make('themes/ep-install/default1/display/view1');
|
||||
// }
|
||||
// else{
|
||||
// return Redirect::route('account-sign-In');
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Post Licencecheck
|
||||
// *
|
||||
// * Validating licence agreement
|
||||
// */
|
||||
// public function licencecheck() {
|
||||
// $accept = (Input::has('accept1')) ? true : false;
|
||||
// if ($accept == 'accept') {
|
||||
// Session::put('step1','step1');
|
||||
// return Redirect::route('prerequisites');
|
||||
// } else {
|
||||
// return Redirect::route('licence')->with('fails', 'Failed! first accept the licence agreeement');
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Get prerequisites (step 2)
|
||||
// *
|
||||
// * Checking the extensions enabled required for installing the e-paper pdf
|
||||
// * without which the project cannot be executed properly
|
||||
// *
|
||||
// */
|
||||
// public function prerequisites() {
|
||||
// if(Config::get('database.install')=='%0%')
|
||||
// {
|
||||
// if(Session::get('step1')=='step1'){
|
||||
// return View::make('themes/ep-install/default1/display/view2');
|
||||
// } else {
|
||||
// return Redirect::route('licence');
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return Redirect::route('account-sign-In');
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Post Prerequisitescheck
|
||||
// *
|
||||
// * checking prerequisites
|
||||
// */
|
||||
// public function prerequisitescheck() {
|
||||
// Session::put('step2','step2');
|
||||
// return Redirect::route('localization');
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Get Localization (step 3)
|
||||
// *
|
||||
// * Requesting user recomended settings for installation
|
||||
// */
|
||||
// public function localization() {
|
||||
// if(Config::get('database.install')=='%0%')
|
||||
// {
|
||||
// if(Session::get('step2')=='step2'){
|
||||
// return View::make('themes/ep-install/default1/display/view3');
|
||||
// } else {
|
||||
// return Redirect::route('prerequisites');
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// return Redirect::route('account-sign-In');
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Post localizationcheck
|
||||
// *
|
||||
// * checking prerequisites
|
||||
// */
|
||||
// public function localizationcheck() {
|
||||
|
||||
// Session::put('step3','step3');
|
||||
|
||||
// Session::put('language', Input::get('language'));
|
||||
// Session::put('timezone', Input::get('timezone'));
|
||||
// Session::put('date', Input::get('date'));
|
||||
// Session::put('datetime', Input::get('datetime'));
|
||||
|
||||
// return Redirect::route('configuration');
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Get Configuration (step 4)
|
||||
// *
|
||||
// * checking prerequisites
|
||||
// */
|
||||
// public function configuration() {
|
||||
// if(Config::get('database.install')=='%0%')
|
||||
// {
|
||||
// if(Session::get('step3')=='step3'){
|
||||
// return View::make('themes/ep-install/default1/display/view4');
|
||||
// } else {
|
||||
// return Redirect::route('localization');
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// return Redirect::route('account-sign-In');
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Post configurationcheck
|
||||
// *
|
||||
// * checking prerequisites
|
||||
// */
|
||||
// public function configurationcheck() {
|
||||
|
||||
// Session::put('step4','step4');
|
||||
|
||||
// Session::put('default', Input::get('default'));
|
||||
// Session::put('host', Input::get('host'));
|
||||
// Session::put('databasename', Input::get('databasename'));
|
||||
// Session::put('username', Input::get('username'));
|
||||
// Session::put('password', Input::get('password'));
|
||||
|
||||
// return Redirect::route('database');
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Get database
|
||||
// *
|
||||
// * checking prerequisites
|
||||
// */
|
||||
// public function database() {
|
||||
// if(Config::get('database.install')=='%0%')
|
||||
// {
|
||||
// if(Session::get('step4')=='step4'){
|
||||
// return View::make('themes/ep-install/default1/display/view5');
|
||||
// } else {
|
||||
// return Redirect::route('configuration');
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// return Redirect::route('account-sign-In');
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Get account
|
||||
// *
|
||||
// * checking prerequisites
|
||||
// */
|
||||
// public function account() {
|
||||
// if(Config::get('database.install')=='%0%')
|
||||
// {
|
||||
// if(Session::get('step4')=='step4'){
|
||||
// return View::make('themes/ep-install/default1/display/view6');
|
||||
// } else {
|
||||
// return Redirect::route('configuration');
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// return Redirect::route('account-sign-In');
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Post accountcheck
|
||||
// *
|
||||
// * checking prerequisites
|
||||
// */
|
||||
// public function accountcheck() {
|
||||
// // validation check
|
||||
// $validator = Validator::make(Input::all(), array(
|
||||
// 'firstname' => 'required|max:20',
|
||||
// 'Lastname' => 'required|max:20',
|
||||
// 'email' => 'required|max:50|email',
|
||||
// 'username' => 'required|max:50|min:3',
|
||||
// 'password' => 'required|min:6',
|
||||
// 'confirmpassword' => 'required|same:password'
|
||||
// ));
|
||||
// if ($validator->fails()) {
|
||||
// return Redirect::route('account')
|
||||
// ->withErrors($validator);
|
||||
// } else {
|
||||
|
||||
// // config/database.php management
|
||||
// $default = Input::get('default');
|
||||
// $host = Input::get('host');
|
||||
// $database = Input::get('databasename');
|
||||
// $dbusername = Input::get('dbusername');
|
||||
// $dbpassword = Input::get('dbpassword');
|
||||
|
||||
// // set default value
|
||||
// $path0 = app_path('config/database.php');
|
||||
// $content0 = File::get($path0);
|
||||
// $content0 = str_replace('%default%', $default, $content0);
|
||||
// File::put($path0, $content0);
|
||||
|
||||
// // set host,databasename,username,password
|
||||
// if($default=='mysql')
|
||||
// {
|
||||
// $path = app_path('config/database.php');
|
||||
// $content = File::get($path);
|
||||
// $content = str_replace('%host%', $host, $content);
|
||||
// File::put($path, $content);
|
||||
|
||||
// $path1 = app_path('config/database.php');
|
||||
// $content1 = File::get($path1);
|
||||
// $content1 = str_replace('%database%', $database, $content1);
|
||||
// File::put($path1, $content1);
|
||||
|
||||
// $path2 = app_path('config/database.php');
|
||||
// $content2 = File::get($path2);
|
||||
// $content2 = str_replace('%username%', $dbusername, $content2);
|
||||
// File::put($path2, $content2);
|
||||
|
||||
// $path3 = app_path('config/database.php');
|
||||
// $content3 = File::get($path3);
|
||||
// $content3 = str_replace('%password%', $dbpassword, $content3);
|
||||
// File::put($path3, $content3);
|
||||
// }
|
||||
// elseif($default=='pgsql')
|
||||
// {
|
||||
// $path = app_path('config/database.php');
|
||||
// $content = File::get($path);
|
||||
// $content = str_replace('%host1%', $host, $content);
|
||||
// File::put($path, $content);
|
||||
|
||||
// $path1 = app_path('config/database.php');
|
||||
// $content1 = File::get($path1);
|
||||
// $content1 = str_replace('%database1%', $database, $content1);
|
||||
// File::put($path1, $content1);
|
||||
|
||||
// $path2 = app_path('config/database.php');
|
||||
// $content2 = File::get($path2);
|
||||
// $content2 = str_replace('%username1%', $username, $content2);
|
||||
// File::put($path2, $content2);
|
||||
|
||||
// $path3 = app_path('config/database.php');
|
||||
// $content3 = File::get($path3);
|
||||
// $content3 = str_replace('%password1%', $password, $content3);
|
||||
// File::put($path3, $content3);
|
||||
// }
|
||||
// elseif($default=='sqlsrv')
|
||||
// {
|
||||
// $path = app_path('config/database.php');
|
||||
// $content = File::get($path);
|
||||
// $content = str_replace('%host2%', $host, $content);
|
||||
// File::put($path, $content);
|
||||
|
||||
// $path1 = app_path('config/database.php');
|
||||
// $content1 = File::get($path1);
|
||||
// $content1 = str_replace('%database2%', $database, $content1);
|
||||
// File::put($path1, $content1);
|
||||
|
||||
// $path2 = app_path('config/database.php');
|
||||
// $content2 = File::get($path2);
|
||||
// $content2 = str_replace('%username2%', $username, $content2);
|
||||
// File::put($path2, $content2);
|
||||
|
||||
// $path3 = app_path('config/database.php');
|
||||
// $content3 = File::get($path3);
|
||||
// $content3 = str_replace('%password2%', $password, $content3);
|
||||
// File::put($path3, $content3);
|
||||
// }
|
||||
|
||||
// // migrate database
|
||||
// Artisan::call('migrate', array('--force' => true));
|
||||
// Artisan::call('db:seed', array('--force' => true));
|
||||
|
||||
// // create user
|
||||
// $firstname = Input::get('firstname');
|
||||
// $lastname = Input::get('lastname');
|
||||
// $email = Input::get('email');
|
||||
// $username = Input::get('username');
|
||||
// $password = Input::get('password');
|
||||
|
||||
// $language = Input::get('language');
|
||||
// $timezone = Input::get('timezone');
|
||||
// $date = Input::get('date');
|
||||
// $datetime = Input::get('datetime');
|
||||
|
||||
// $user = User::create(array(
|
||||
// 'firstname' => $firstname,
|
||||
// 'lastname' => $lastname,
|
||||
// 'email' => $email,
|
||||
// 'username' => $username,
|
||||
// 'password' => Hash::make($password),
|
||||
// 'authority' => 'admin',
|
||||
// 'active' => 1
|
||||
// ));
|
||||
|
||||
// // set option values
|
||||
// $dateformat = Option::where('option_name','=','date_format')->first();
|
||||
// $dateformat->option_value = $date;
|
||||
// $dateformat->save();
|
||||
|
||||
// $datetimeformat = Option::where('option_name','=','date_time_format')->first();
|
||||
// $datetimeformat->option_value = $datetime;
|
||||
// $datetimeformat->save();
|
||||
|
||||
// $timezonestring = Option::where('option_name','=','timezone_string')->first();
|
||||
// $timezonestring->option_value = $timezone;
|
||||
// $timezonestring->save();
|
||||
|
||||
// $language1 = Option::where('option_name','=','language')->first();
|
||||
// $language1->option_value = $language;
|
||||
// $language1->save();
|
||||
|
||||
// if ($user) {
|
||||
|
||||
// Session::put('step6','step6');
|
||||
|
||||
// return Redirect::route('final');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Get finalize
|
||||
// *
|
||||
// * checking prerequisites
|
||||
// */
|
||||
// public function finalize() {
|
||||
// if(Session::get('step6')=='step6'){
|
||||
|
||||
// $var = "http://".$_SERVER['HTTP_HOST']."/epeper-pdf";
|
||||
|
||||
// $siteurl = Option::where('option_name','=','siteurl')->first();
|
||||
// $siteurl->option_value = $var ;
|
||||
// $siteurl->save();
|
||||
|
||||
// $value='1';
|
||||
// $install = app_path('config/database.php');
|
||||
// $datacontent = File::get($install);
|
||||
// $datacontent = str_replace('%0%', $value, $datacontent);
|
||||
// File::put($install, $datacontent);
|
||||
// try {
|
||||
// return View::make('themes/ep-install/default1/display/view7');
|
||||
// } catch (Exception $e) {
|
||||
// return Redirect::route('npl');
|
||||
// }
|
||||
// } else {
|
||||
// return Redirect::route('account');
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Post finalcheck
|
||||
// *
|
||||
// * checking prerequisites
|
||||
// */
|
||||
// public function finalcheck() {
|
||||
// try
|
||||
// {
|
||||
// return Redirect::route('account-sign-In');
|
||||
// }
|
||||
// catch (Exception $e) {
|
||||
// return Redirect::Route('account-sign-out');
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
<?php namespace App\Model\Ticket;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Ticket_Priority extends Model
|
||||
{
|
||||
protected $table = 'ticket_priority';
|
||||
protected $fillable = [
|
||||
'priority_id','priority','priority_desc','priority_color','priority_urgency','ispublic'
|
||||
];
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
<?php namespace App\Model\Utility;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class time_format extends Model {
|
||||
|
||||
protected $table = 'time_format';
|
||||
|
||||
protected $fillable = ['id','format'];
|
||||
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
<?php namespace App\Model\Utility;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Timezones extends Model
|
||||
{
|
||||
protected $table = 'timezones';
|
||||
protected $fillable = [
|
||||
|
||||
];
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user