Merge pull request #23 from ladybirdweb/analysis-qrdwWQ

Applied fixes from StyleCI
This commit is contained in:
Sujit Prasad
2016-02-24 20:49:51 +05:30
4 changed files with 23 additions and 100 deletions

View File

@@ -4,7 +4,6 @@ namespace App\Exceptions;
// controller // controller
use App\Http\Controllers\Common\PhpMailController; use App\Http\Controllers\Common\PhpMailController;
use Exception; use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
@@ -19,11 +18,11 @@ class Handler extends ExceptionHandler
'Symfony\Component\HttpKernel\Exception\HttpException', 'Symfony\Component\HttpKernel\Exception\HttpException',
]; ];
/** /**
* Create a new controller instance. * Create a new controller instance.
* constructor to check * constructor to check
* 1. php mailer * 1. php mailer.
*
* @return void * @return void
*/ */
public function __construct(PhpMailController $PhpMailController) public function __construct(PhpMailController $PhpMailController)
@@ -31,7 +30,6 @@ class Handler extends ExceptionHandler
$this->PhpMailController = $PhpMailController; $this->PhpMailController = $PhpMailController;
} }
/** /**
* Report or log an exception. * Report or log an exception.
* *
@@ -50,7 +48,7 @@ class Handler extends ExceptionHandler
* Render an exception into an HTTP response. * Render an exception into an HTTP response.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Exception $e * @param \Exception $e
* *
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
@@ -58,7 +56,6 @@ class Handler extends ExceptionHandler
{ {
if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) { if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) {
return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]); return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
} elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) { } elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) {
return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]); return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
} }
@@ -71,10 +68,11 @@ class Handler extends ExceptionHandler
// checking if the application is installed // checking if the application is installed
if (\Config::get('database.install') == 1) { if (\Config::get('database.install') == 1) {
// checking if the error log send to Ladybirdweb is enabled or not // checking if the error log send to Ladybirdweb is enabled or not
if(\Config::get('app.ErrorLog') == '%1%') { if (\Config::get('app.ErrorLog') == '%1%') {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => 'faveo logger', 'email' => 'faveoerrorlogger@gmail.com'], $message = ['subject' => 'Faveo downloaded from github has occured error', 'scenario'=>'error-report'], $template_variables = ['e' => $e]); $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => 'faveo logger', 'email' => 'faveoerrorlogger@gmail.com'], $message = ['subject' => 'Faveo downloaded from github has occured error', 'scenario' => 'error-report'], $template_variables = ['e' => $e]);
} }
} }
return response()->view('errors.500', []); return response()->view('errors.500', []);
} }
} }
@@ -95,8 +93,10 @@ class Handler extends ExceptionHandler
} }
/** /**
* function to generate oops error page * function to generate oops error page.
*
* @param \Exception $e * @param \Exception $e
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
protected function renderExceptionWithWhoops(Exception $e) protected function renderExceptionWithWhoops(Exception $e)

View File

@@ -32,14 +32,14 @@ use App\Model\helpdesk\Utility\Timezones;
use App\User; use App\User;
use Auth; use Auth;
use DB; use DB;
use UTC;
// classes
use Exception; use Exception;
// classes
use Hash; use Hash;
use Illuminate\support\Collection; use Illuminate\support\Collection;
use Input; use Input;
use Mail; use Mail;
use PDF; use PDF;
use UTC;
/** /**
* TicketController. * TicketController.
@@ -91,7 +91,7 @@ class TicketController extends Controller
$string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...'; $string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...';
} }
} else { } else {
$string = "(no subject)"; $string = '(no subject)';
} }
//collabrations //collabrations
$collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get(); $collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get();
@@ -191,6 +191,7 @@ class TicketController extends Controller
$dept = Department::where('id', '=', Auth::user()->primary_dpt)->first(); $dept = Department::where('id', '=', Auth::user()->primary_dpt)->first();
$tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', 0)->where('dept_id', '=', $dept->id)->get(); $tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', 0)->where('dept_id', '=', $dept->id)->get();
} }
return \Datatable::collection(new Collection($tickets)) return \Datatable::collection(new Collection($tickets))
->addColumn('id', function ($ticket) { ->addColumn('id', function ($ticket) {
return "<input type='checkbox' name='select_all[]' class='icheckbox_flat-blue' value='".$ticket->id."'></input>"; return "<input type='checkbox' name='select_all[]' class='icheckbox_flat-blue' value='".$ticket->id."'></input>";
@@ -204,7 +205,7 @@ class TicketController extends Controller
$string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...'; $string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...';
} }
} else { } else {
$string = "(no subject)"; $string = '(no subject)';
} }
//collabrations //collabrations
$collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get(); $collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get();
@@ -316,7 +317,7 @@ class TicketController extends Controller
$string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...'; $string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...';
} }
} else { } else {
$string = "(no subject)"; $string = '(no subject)';
} }
//collabrations //collabrations
$collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get(); $collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get();
@@ -423,7 +424,7 @@ class TicketController extends Controller
$string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...'; $string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...';
} }
} else { } else {
$string = "(no subject)"; $string = '(no subject)';
} }
//collabrations //collabrations
$collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get(); $collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get();
@@ -540,7 +541,7 @@ class TicketController extends Controller
$string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...'; $string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...';
} }
} else { } else {
$string = "(no subject)"; $string = '(no subject)';
} }
//collabrations //collabrations
$collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get(); $collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get();
@@ -646,7 +647,7 @@ class TicketController extends Controller
$string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...'; $string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...';
} }
} else { } else {
$string = "(no subject)"; $string = '(no subject)';
} }
//collabrations //collabrations
$collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get(); $collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get();
@@ -1036,8 +1037,6 @@ class TicketController extends Controller
* @param type $emailadd * @param type $emailadd
* @param type $username * @param type $username
* @param type $subject * @param type $subject
*
@param type $body
* @param type $phone * @param type $phone
* @param type $helptopic * @param type $helptopic
* @param type $sla * @param type $sla
@@ -1921,7 +1920,7 @@ class TicketController extends Controller
$string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...'; $string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...';
} }
} else { } else {
$string = "(no subject)"; $string = '(no subject)';
} }
//collabrations //collabrations
$collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get(); $collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get();
@@ -2033,7 +2032,7 @@ class TicketController extends Controller
$string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...'; $string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...';
} }
} else { } else {
$string = "(no subject)"; $string = '(no subject)';
} }
//collabrations //collabrations
$collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get(); $collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get();

View File

@@ -281,14 +281,12 @@ class InstallController extends Controller
// checking is the installation was done previously // checking is the installation was done previously
try { try {
$check_for_pre_installation = System::all(); $check_for_pre_installation = System::all();
if($check_for_pre_installation) { if ($check_for_pre_installation) {
return redirect()->back()->with('fails', 'The data in database already exist. Please provide fresh database'); return redirect()->back()->with('fails', 'The data in database already exist. Please provide fresh database');
} }
} catch (Exception $e) { } catch (Exception $e) {
} }
// migrate database // migrate database
Artisan::call('migrate', ['--force' => true]); Artisan::call('migrate', ['--force' => true]);
Artisan::call('db:seed', ['--force' => true]); Artisan::call('db:seed', ['--force' => true]);

View File

@@ -143,80 +143,6 @@ return [
// //
/* /*
* Laravel Framework Service Providers... * Laravel Framework Service Providers...
*/ */
@@ -319,7 +245,7 @@ return [
'SMTPS' => 'App\Http\Controllers\HomeController', 'SMTPS' => 'App\Http\Controllers\HomeController',
'Datatable' => 'Chumper\Datatable\Facades\DatatableFacade', 'Datatable' => 'Chumper\Datatable\Facades\DatatableFacade',
'Zipper' => 'Chumper\Zipper\Zipper', 'Zipper' => 'Chumper\Zipper\Zipper',
'Image' => Intervention\Image\Facades\Image::class, 'Image' => Intervention\Image\Facades\Image::class,
'JWTAuth' => 'Tymon\JWTAuth\Facades\JWTAuth', 'JWTAuth' => 'Tymon\JWTAuth\Facades\JWTAuth',
'JWTFactory' => 'Tymon\JWTAuth\Facades\JWTFactory', 'JWTFactory' => 'Tymon\JWTAuth\Facades\JWTFactory',