@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public function update($id, Request $request) |
| 31 | 31 | {
|
| 32 | - $this->validate($request, [ 'value' => 'required' ]); |
|
| 32 | + $this->validate($request, ['value' => 'required']); |
|
| 33 | 33 | |
| 34 | 34 | $move = Base::getSettingsRepository()->findOrFail($id); |
| 35 | 35 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $after = $move->value; |
| 41 | 41 | |
| 42 | - Base::Log('Website settings changed. Changed "' . $move->friendly_name . '" value from "' . $before . '" to "' . $after . '"');
|
|
| 42 | + Base::Log('Website settings changed. Changed "'.$move->friendly_name.'" value from "'.$before.'" to "'.$after.'"');
|
|
| 43 | 43 | |
| 44 | 44 | return redirect('admin/settings');
|
| 45 | 45 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | public function getForgotPasswordConfirm($userId, $passwordResetCode) |
| 95 | 95 | {
|
| 96 | 96 | // Find the user using the password reset code |
| 97 | - if(!$user = Sentinel::findById($userId)) |
|
| 97 | + if (!$user = Sentinel::findById($userId)) |
|
| 98 | 98 | {
|
| 99 | 99 | // Redirect to the forgot password page |
| 100 | 100 | return Redirect::route('forgot-password')->with('error', Lang::get('base.auth.forgot_password_confirm.error'));
|
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | // Find the user using the password reset code |
| 136 | - if(!$user = Sentinel::findById($userId)) |
|
| 136 | + if (!$user = Sentinel::findById($userId)) |
|
| 137 | 137 | {
|
| 138 | 138 | // Redirect to the forgot password page |
| 139 | 139 | return Redirect::route('login')->with('error', Lang::get('base.auth.activate.error'));
|
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | return back()->withInput()->withErrors($validator); |
| 186 | 186 | } |
| 187 | 187 | try {
|
| 188 | - foreach(Sentinel::createModel()->getLoginNames() as $loginName) |
|
| 188 | + foreach (Sentinel::createModel()->getLoginNames() as $loginName) |
|
| 189 | 189 | {
|
| 190 | 190 | $data = array( |
| 191 | 191 | $loginName => Input::only('email')["email"],
|
@@ -193,11 +193,11 @@ discard block |
||
| 193 | 193 | ); |
| 194 | 194 | |
| 195 | 195 | // Try to log the user in |
| 196 | - if(Sentinel::authenticate($data, Input::get('remember-me', false)))
|
|
| 196 | + if (Sentinel::authenticate($data, Input::get('remember-me', false)))
|
|
| 197 | 197 | {
|
| 198 | 198 | $user = Sentinel::check(); |
| 199 | 199 | $user->update(['ip' => Request::ip()]); |
| 200 | - Base::Log($user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') logged in with IP ' . Request::ip() );
|
|
| 200 | + Base::Log($user->username.' ('.$user->first_name.' '.$user->last_name.') logged in with IP '.Request::ip());
|
|
| 201 | 201 | |
| 202 | 202 | // Redirect to the dashboard page |
| 203 | 203 | return Redirect::route("home")->with('success', Lang::get('base.auth.signin.success'));
|
@@ -209,9 +209,9 @@ discard block |
||
| 209 | 209 | $this->messageBag->add('email', Lang::get('base.auth.account.not_activated'));
|
| 210 | 210 | } catch (ThrottlingException $e) {
|
| 211 | 211 | $delay = $e->getDelay(); |
| 212 | - $this->messageBag->add('email', Lang::get('base.auth.account.suspended', compact('delay' )));
|
|
| 212 | + $this->messageBag->add('email', Lang::get('base.auth.account.suspended', compact('delay')));
|
|
| 213 | 213 | } |
| 214 | - Base::Log('Login attempt registred for ' . Input::only('email')["email"] . ' from IP ' . Request::ip() );
|
|
| 214 | + Base::Log('Login attempt registred for '.Input::only('email')["email"].' from IP '.Request::ip());
|
|
| 215 | 215 | |
| 216 | 216 | // Ooops.. something went wrong |
| 217 | 217 | return back()->withInput()->withErrors($this->messageBag); |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $rules = array(); |
| 246 | 246 | |
| 247 | 247 | // Declare the rules for the form validation |
| 248 | - foreach(Sentinel::createModel()->getRegisterFields() as $fieldid => $field) |
|
| 248 | + foreach (Sentinel::createModel()->getRegisterFields() as $fieldid => $field) |
|
| 249 | 249 | $rules[$fieldid] = $field['validator']; |
| 250 | 250 | |
| 251 | 251 | $rules['g-recaptcha-response'] = 'required'; |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | $data = array(); |
| 269 | 269 | |
| 270 | 270 | // Set the data to the user from the User class |
| 271 | - foreach(Sentinel::createModel()->getRegisterFields() as $fieldid => $field) |
|
| 271 | + foreach (Sentinel::createModel()->getRegisterFields() as $fieldid => $field) |
|
| 272 | 272 | $data[$fieldid] = Input::get($fieldid); |
| 273 | 273 | |
| 274 | 274 | // Set the standard data to the user |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | $testing = Sentinel::createModel()->getRegisterFields(); |
| 289 | 289 | $user = Sentinel::findById($user->id); |
| 290 | 290 | |
| 291 | - foreach($data as $fieldid => $field) |
|
| 291 | + foreach ($data as $fieldid => $field) |
|
| 292 | 292 | if (!isset($testing[$fieldid]) || $testing[$fieldid]['save'] == true) |
| 293 | 293 | $user[$fieldid] = $field; |
| 294 | 294 | |
@@ -314,18 +314,18 @@ discard block |
||
| 314 | 314 | ); |
| 315 | 315 | |
| 316 | 316 | // Send the activation code through email |
| 317 | - Mail::queue('emails.auth.register-activate', $data, function ($m) use ($user) {
|
|
| 318 | - $m->to($user->email, $user->first_name . ' ' . $user->last_name); |
|
| 319 | - $m->subject(Lang::get('base.mails.welcome') . ' ' . $user->first_name);
|
|
| 317 | + Mail::queue('emails.auth.register-activate', $data, function($m) use ($user) {
|
|
| 318 | + $m->to($user->email, $user->first_name.' '.$user->last_name); |
|
| 319 | + $m->subject(Lang::get('base.mails.welcome').' '.$user->first_name);
|
|
| 320 | 320 | }); |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | // If the administrator needs to activate the account send the user a warning saying that |
| 324 | 324 | if ($adminActivation) |
| 325 | 325 | {
|
| 326 | - Mail::queue('emails.auth.register-admin-activate', ['user' => $user], function ($m) use ($user) {
|
|
| 327 | - $m->to($user->email, $user->first_name . ' ' . $user->last_name); |
|
| 328 | - $m->subject(Lang::get('base.mails.welcome') . ' ' . $user->first_name);
|
|
| 326 | + Mail::queue('emails.auth.register-admin-activate', ['user' => $user], function($m) use ($user) {
|
|
| 327 | + $m->to($user->email, $user->first_name.' '.$user->last_name); |
|
| 328 | + $m->subject(Lang::get('base.mails.welcome').' '.$user->first_name);
|
|
| 329 | 329 | }); |
| 330 | 330 | } |
| 331 | 331 | |
@@ -337,22 +337,22 @@ discard block |
||
| 337 | 337 | if (Activation::complete($user, $activation->code)) {
|
| 338 | 338 | Sentinel::login($user, false); |
| 339 | 339 | |
| 340 | - Mail::queue('emails.auth.activated', ['user' => $user], function ($m) use ($user) {
|
|
| 341 | - $m->to($user->email, $user->first_name . ' ' . $user->last_name); |
|
| 342 | - $m->subject(Lang::get('base.mails.welcome') . ' ' . $user->first_name);
|
|
| 340 | + Mail::queue('emails.auth.activated', ['user' => $user], function($m) use ($user) {
|
|
| 341 | + $m->to($user->email, $user->first_name.' '.$user->last_name); |
|
| 342 | + $m->subject(Lang::get('base.mails.welcome').' '.$user->first_name);
|
|
| 343 | 343 | }); |
| 344 | 344 | } |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - Base::Log('New account registred for ' . $user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') from IP ' . Request::ip() );
|
|
| 347 | + Base::Log('New account registred for '.$user->username.' ('.$user->first_name.' '.$user->last_name.') from IP '.Request::ip());
|
|
| 348 | 348 | |
| 349 | 349 | // Redirect to the home page with success menu |
| 350 | - return Redirect::to("login")->with('success', Lang::get('base.auth.signup.success') . $adminActivation ? Lang::get('base.auth.signup.admin') : $userActivation ? Lang::get('base.auth.signup.self') : Lang::get('base.auth.signup.ready'));
|
|
| 350 | + return Redirect::to("login")->with('success', Lang::get('base.auth.signup.success').$adminActivation ? Lang::get('base.auth.signup.admin') : $userActivation ? Lang::get('base.auth.signup.self') : Lang::get('base.auth.signup.ready'));
|
|
| 351 | 351 | } catch (UserExistsException $e) {
|
| 352 | 352 | $this->messageBag->add('email', Lang::get('base.auth.account.already_exists'));
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - Base::Log('New account registration attempt from IP ' . Request::ip() );
|
|
| 355 | + Base::Log('New account registration attempt from IP '.Request::ip());
|
|
| 356 | 356 | |
| 357 | 357 | // Ooops.. something went wrong |
| 358 | 358 | return Redirect::back()->withInput()->withErrors($this->messageBag); |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | // Get the user password recovery code |
| 383 | 383 | $user = Sentinel::findByCredentials(['email' => Input::get('email')]);
|
| 384 | 384 | |
| 385 | - if($user) |
|
| 385 | + if ($user) |
|
| 386 | 386 | {
|
| 387 | 387 | //get reminder for user |
| 388 | 388 | $reminder = Reminder::exists($user) ?: Reminder::create($user); |
@@ -390,14 +390,14 @@ discard block |
||
| 390 | 390 | // Data to be used on the email view |
| 391 | 391 | $data = array( |
| 392 | 392 | 'user' => $user, |
| 393 | - 'forgotPasswordUrl' => URL::route('forgot-password-confirm',[$user->id, $reminder->code]),
|
|
| 393 | + 'forgotPasswordUrl' => URL::route('forgot-password-confirm', [$user->id, $reminder->code]),
|
|
| 394 | 394 | ); |
| 395 | 395 | |
| 396 | - Base::Log('Forgot password request for ' . $user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') from IP ' . Request::ip() );
|
|
| 396 | + Base::Log('Forgot password request for '.$user->username.' ('.$user->first_name.' '.$user->last_name.') from IP '.Request::ip());
|
|
| 397 | 397 | |
| 398 | 398 | // Send the activation code through email |
| 399 | - Mail::queue('emails.auth.forgot-password', $data, function ($m) use ($user) {
|
|
| 400 | - $m->to($user->email, $user->first_name . ' ' . $user->last_name); |
|
| 399 | + Mail::queue('emails.auth.forgot-password', $data, function($m) use ($user) {
|
|
| 400 | + $m->to($user->email, $user->first_name.' '.$user->last_name); |
|
| 401 | 401 | $m->subject(Lang::get('base.mails.recovery'));
|
| 402 | 402 | }); |
| 403 | 403 | } |
@@ -427,26 +427,26 @@ discard block |
||
| 427 | 427 | // If validation fails, we'll exit the operation now. |
| 428 | 428 | if ($validator->fails()) {
|
| 429 | 429 | // Ooops.. something went wrong |
| 430 | - return Redirect::route('forgot-password-confirm', compact(['userId','passwordResetCode']))->withInput()->withErrors($validator);
|
|
| 430 | + return Redirect::route('forgot-password-confirm', compact(['userId', 'passwordResetCode']))->withInput()->withErrors($validator);
|
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | // Find the user using the password reset code |
| 434 | 434 | $user = Sentinel::findById($userId); |
| 435 | - if(!$reminder = Reminder::complete($user, $passwordResetCode, Input::get('password')))
|
|
| 435 | + if (!$reminder = Reminder::complete($user, $passwordResetCode, Input::get('password')))
|
|
| 436 | 436 | {
|
| 437 | - Base::Log('Forgot password confirm failed for ' . $user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') from IP ' . Request::ip() );
|
|
| 437 | + Base::Log('Forgot password confirm failed for '.$user->username.' ('.$user->first_name.' '.$user->last_name.') from IP '.Request::ip());
|
|
| 438 | 438 | |
| 439 | 439 | // Ooops.. something went wrong |
| 440 | 440 | return Redirect::route('login')->with('error', Lang::get('base.auth.forgot_password_confirm.error'));
|
| 441 | 441 | } else {
|
| 442 | 442 | // Send the activation code through email |
| 443 | - Mail::queue('emails.auth.password-changed', [ 'user' => $user], function ($m) use ($user) {
|
|
| 444 | - $m->to($user->email, $user->first_name . ' ' . $user->last_name); |
|
| 443 | + Mail::queue('emails.auth.password-changed', ['user' => $user], function($m) use ($user) {
|
|
| 444 | + $m->to($user->email, $user->first_name.' '.$user->last_name); |
|
| 445 | 445 | $m->subject(Lang::get('base.mails.password_changed'));
|
| 446 | 446 | }); |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | - Base::Log('Forgot password confirmed for ' . $user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') from IP ' . Request::ip() );
|
|
| 449 | + Base::Log('Forgot password confirmed for '.$user->username.' ('.$user->first_name.' '.$user->last_name.') from IP '.Request::ip());
|
|
| 450 | 450 | |
| 451 | 451 | // Password successfully reseted |
| 452 | 452 | return Redirect::route('login')->with('success', Lang::get('base.auth.forgot_password_confirm.success'));
|
@@ -179,7 +179,7 @@ |
||
| 179 | 179 | 'BlogPost.contents' => 1, |
| 180 | 180 | ], |
| 181 | 181 | 'joins' => [ |
| 182 | - 'BlogPost' => [ 'User.id', 'BlogPost.author' ], |
|
| 182 | + 'BlogPost' => ['User.id', 'BlogPost.author'], |
|
| 183 | 183 | ], |
| 184 | 184 | ]; |
| 185 | 185 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | if ($value > 0) |
| 39 | 39 | if ($user = Sentinel::findUserById($value)) |
| 40 | 40 | if ($user != null) |
| 41 | - return $user->first_name . ' ' . $user->last_name . ' (ID: ' . $user->id . ')'; |
|
| 41 | + return $user->first_name.' '.$user->last_name.' (ID: '.$user->id.')'; |
|
| 42 | 42 | |
| 43 | 43 | return $value; |
| 44 | 44 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | if ($value > 0) |
| 55 | 55 | if ($user = Sentinel::findUserById($value)) |
| 56 | 56 | if ($user != null) |
| 57 | - return $user->first_name . ' ' . $user->last_name . ' (ID: ' . $user->id . ')'; |
|
| 57 | + return $user->first_name.' '.$user->last_name.' (ID: '.$user->id.')'; |
|
| 58 | 58 | |
| 59 | 59 | return $value; |
| 60 | 60 | } |
@@ -28,13 +28,13 @@ |
||
| 28 | 28 | $str = explode("* ", $this->description); |
| 29 | 29 | $choices = array(); |
| 30 | 30 | |
| 31 | - foreach($str as $st) |
|
| 31 | + foreach ($str as $st) |
|
| 32 | 32 | { |
| 33 | 33 | preg_match('/(?P<digit>\d+) - (?P<name>\w+)/', $st, $matches); |
| 34 | 34 | if (sizeof($matches) > 0) { |
| 35 | - $st = str_replace("*/","",$st); |
|
| 36 | - $st = str_replace("/*","",$st); |
|
| 37 | - $choices[$matches[1]] = explode($matches[1] . ' - ', $st)[1]; |
|
| 35 | + $st = str_replace("*/", "", $st); |
|
| 36 | + $st = str_replace("/*", "", $st); |
|
| 37 | + $choices[$matches[1]] = explode($matches[1].' - ', $st)[1]; |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
@@ -253,7 +253,7 @@ |
||
| 253 | 253 | $platform = $agent->platform(); |
| 254 | 254 | $pversion = $agent->version($platform); |
| 255 | 255 | |
| 256 | - $browserString = $browser . ' version ' . $version . ' | ' . $platform . ' version ' . $pversion; |
|
| 256 | + $browserString = $browser.' version '.$version.' | '.$platform.' version '.$pversion; |
|
| 257 | 257 | |
| 258 | 258 | |
| 259 | 259 | $visit = $this->getVisitsRepository()->create(['url' => Request::url(), 'ip' => Request::ip(), 'browser' => $browserString]); |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * All the "restricted area" routes |
| 7 | 7 | * are defined here. |
| 8 | 8 | */ |
| 9 | -Route::group(array('prefix' => '/', 'middleware' => 'webPublic'), function ()
|
|
| 9 | +Route::group(array('prefix' => '/', 'middleware' => 'webPublic'), function()
|
|
| 10 | 10 | {
|
| 11 | 11 | |
| 12 | 12 | /** |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | /* POST */ Route::post('login', 'jlourenco\base\Controllers\AuthController@postSignin');
|
| 39 | 39 | |
| 40 | 40 | /* GET */ Route::get('register', array('as' => 'register', 'uses' => 'jlourenco\base\Controllers\AuthController@getSignup'));
|
| 41 | - /* POST */ Route::post('register', array('as' => 'register','uses' => 'jlourenco\base\Controllers\AuthController@postSignup'));
|
|
| 41 | + /* POST */ Route::post('register', array('as' => 'register', 'uses' => 'jlourenco\base\Controllers\AuthController@postSignup'));
|
|
| 42 | 42 | |
| 43 | 43 | /* GET */ Route::get('forgot-password', array('as' => 'forgot-password', 'uses' => 'jlourenco\base\Controllers\AuthController@getLostPassword'));
|
| 44 | - /* POST */ Route::post('forgot-password', array('as' => 'forgot-password','uses' => 'jlourenco\base\Controllers\AuthController@postForgotPassword'));
|
|
| 44 | + /* POST */ Route::post('forgot-password', array('as' => 'forgot-password', 'uses' => 'jlourenco\base\Controllers\AuthController@postForgotPassword'));
|
|
| 45 | 45 | |
| 46 | 46 | # Forgot Password Confirmation |
| 47 | 47 | Route::get('forgot-password/{userId}/{passwordResetCode}', array('as' => 'forgot-password-confirm', 'uses' => 'jlourenco\base\Controllers\AuthController@getForgotPasswordConfirm'));
|
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | Route::get('activate/{userId}/{activationCode}', array('as' => 'activate', 'uses' => 'jlourenco\base\Controllers\AuthController@getActivate'));
|
| 55 | 55 | |
| 56 | 56 | # User account |
| 57 | - Route::group(array('middleware' => 'auth'), function () {
|
|
| 57 | + Route::group(array('middleware' => 'auth'), function() {
|
|
| 58 | 58 | Route::get('profile', array('as' => 'profile', 'uses' => 'jlourenco\base\Controllers\UsersController@myAccount'));
|
| 59 | 59 | Route::post('profile', 'jlourenco\base\Controllers\UsersController@updateAccount');
|
| 60 | 60 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * All the "restricted area" routes |
| 71 | 71 | * are defined here. |
| 72 | 72 | */ |
| 73 | -Route::group(array('prefix' => '/admin', 'middleware' => ['webAdmin', 'auth']), function ()
|
|
| 73 | +Route::group(array('prefix' => '/admin', 'middleware' => ['webAdmin', 'auth']), function()
|
|
| 74 | 74 | {
|
| 75 | 75 | |
| 76 | 76 | # Dashboard |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | /* POST */ Route::post('settings/{id}/edit', array('as' => 'settings.update', 'uses' => 'jlourenco\base\Controllers\SettingsController@update'));
|
| 90 | 90 | |
| 91 | 91 | # User Management |
| 92 | - Route::group(array('prefix' => 'users'), function () {
|
|
| 92 | + Route::group(array('prefix' => 'users'), function() {
|
|
| 93 | 93 | Route::get('/list', array('as' => 'users', 'uses' => 'jlourenco\base\Controllers\UsersController@getAdminIndex'));
|
| 94 | 94 | Route::get('/pending', array('as' => 'users.pending', 'uses' => 'jlourenco\base\Controllers\UsersController@getAdminPending'));
|
| 95 | 95 | Route::get('/blocked', array('as' => 'users.blocked', 'uses' => 'jlourenco\base\Controllers\UsersController@getAdminBlocked'));
|
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | Route::get('/list/{userId}/delete', array('as' => 'delete/user', 'uses' => 'jlourenco\base\Controllers\UsersController@getAdminDelete'));
|
| 103 | 103 | Route::get('/list/{userId}/confirm-delete', array('as' => 'confirm-delete/user', 'uses' => 'jlourenco\base\Controllers\UsersController@getAdminModalDelete'));
|
| 104 | 104 | Route::get('/list/{userId}/restore', array('as' => 'restore/user', 'uses' => 'jlourenco\base\Controllers\UsersController@getAdminRestore'));
|
| 105 | - Route::get('deleted',array('as' => 'users.deleted', 'uses' => 'jlourenco\base\Controllers\UsersController@getAdminDeletedUsers'));
|
|
| 105 | + Route::get('deleted', array('as' => 'users.deleted', 'uses' => 'jlourenco\base\Controllers\UsersController@getAdminDeletedUsers'));
|
|
| 106 | 106 | Route::get('/list/{userId}', array('as' => 'users.show', 'uses' => 'jlourenco\base\Controllers\UsersController@adminShow'));
|
| 107 | 107 | |
| 108 | 108 | Route::get('/list/{userId}/confirm-remove/{groupId}', array('as' => 'confirm-remove/group', 'uses' => 'jlourenco\base\Controllers\UsersController@getAdminModalRemoveGroup'));
|
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | }); |
| 113 | 113 | |
| 114 | 114 | # Groups Management |
| 115 | - Route::group(array('prefix' => 'groups'), function () {
|
|
| 115 | + Route::group(array('prefix' => 'groups'), function() {
|
|
| 116 | 116 | Route::get('/list', array('as' => 'groups', 'uses' => 'jlourenco\base\Controllers\GroupsController@index'));
|
| 117 | 117 | Route::get('/create', array('as' => 'create.group', 'uses' => 'jlourenco\base\Controllers\GroupsController@getCreate'));
|
| 118 | 118 | Route::post('/create', 'jlourenco\base\Controllers\GroupsController@postCreate');
|
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $group = Sentinel::getRoleRepository()->find($id); |
| 64 | 64 | |
| 65 | 65 | // Get the group's information |
| 66 | - if($group == null) |
|
| 66 | + if ($group == null) |
|
| 67 | 67 | { |
| 68 | 68 | // Prepare the error message |
| 69 | 69 | $error = Lang::get('base.groups.not_found'); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | // Was the post updated? |
| 129 | 129 | if ($group->save()) |
| 130 | 130 | { |
| 131 | - Base::Log('Group (' . $group->id . ' - ' . $group->name . ') was edited.'); |
|
| 131 | + Base::Log('Group ('.$group->id.' - '.$group->name.') was edited.'); |
|
| 132 | 132 | |
| 133 | 133 | // Prepare the success message |
| 134 | 134 | $success = Lang::get('base.groups.changed'); |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | $group->save(); |
| 197 | 197 | |
| 198 | - Base::Log('A new group (' . $group->id . ' - ' . $group->name . ') was created.'); |
|
| 198 | + Base::Log('A new group ('.$group->id.' - '.$group->name.') was created.'); |
|
| 199 | 199 | |
| 200 | 200 | // Redirect to the home page with success menu |
| 201 | 201 | return Redirect::route("groups")->with('success', Lang::get('base.groups.created')); |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | return Redirect::route('groups')->with('error', $error); |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | - Base::Log('Group (' . $group->id . ' - ' . $group->name . ') was deleted.'); |
|
| 251 | + Base::Log('Group ('.$group->id.' - '.$group->name.') was deleted.'); |
|
| 252 | 252 | |
| 253 | 253 | // Delete the group |
| 254 | 254 | $group->delete(); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | // Do we want to update the user password? |
| 139 | 139 | if ($password = Input::get('password'))
|
| 140 | 140 | {
|
| 141 | - if (Sentinel::validateCredentials($user, [ 'email' => $email, 'password' => Input::get('old-password')]))
|
|
| 141 | + if (Sentinel::validateCredentials($user, ['email' => $email, 'password' => Input::get('old-password')]))
|
|
| 142 | 142 | {
|
| 143 | 143 | $passwordChanged = true; |
| 144 | 144 | $user->password = Hash::make($password); |
@@ -157,18 +157,18 @@ discard block |
||
| 157 | 157 | if ($file = Input::file('pic')) {
|
| 158 | 158 | $extension = $file->getClientOriginalExtension() ?: 'png'; |
| 159 | 159 | $folderName = '/uploads/users/'; |
| 160 | - $destinationPath = public_path() . $folderName; |
|
| 161 | - $safeName = str_random(10) . '.' . $extension; |
|
| 160 | + $destinationPath = public_path().$folderName; |
|
| 161 | + $safeName = str_random(10).'.'.$extension; |
|
| 162 | 162 | $file->move($destinationPath, $safeName); |
| 163 | 163 | |
| 164 | 164 | //delete old pic if exists |
| 165 | - if (File::exists(public_path() . $folderName . $user->pic)) |
|
| 166 | - File::delete(public_path() . $folderName . $user->pic); |
|
| 165 | + if (File::exists(public_path().$folderName.$user->pic)) |
|
| 166 | + File::delete(public_path().$folderName.$user->pic); |
|
| 167 | 167 | |
| 168 | 168 | //save new file path into db |
| 169 | 169 | $user->pic = $safeName; |
| 170 | 170 | |
| 171 | - Base::Log($user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') changed its profile photo. ');
|
|
| 171 | + Base::Log($user->username.' ('.$user->first_name.' '.$user->last_name.') changed its profile photo. ');
|
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // Was the user updated? |
@@ -178,14 +178,14 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | if ($passwordChanged) |
| 180 | 180 | {
|
| 181 | - Base::Log($user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') changed its password. ');
|
|
| 182 | - Mail::queue('emails.account.password-changed', [ 'user' => $user ], function ($m) use ($user) {
|
|
| 183 | - $m->to($user->email, $user->first_name . ' ' . $user->last_name); |
|
| 181 | + Base::Log($user->username.' ('.$user->first_name.' '.$user->last_name.') changed its password. ');
|
|
| 182 | + Mail::queue('emails.account.password-changed', ['user' => $user], function($m) use ($user) {
|
|
| 183 | + $m->to($user->email, $user->first_name.' '.$user->last_name); |
|
| 184 | 184 | $m->subject(Lang::get('base.mails.password_changed'));
|
| 185 | 185 | }); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - Base::Log($user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') updated the profile. ');
|
|
| 188 | + Base::Log($user->username.' ('.$user->first_name.' '.$user->last_name.') updated the profile. ');
|
|
| 189 | 189 | |
| 190 | 190 | // Redirect to the user page |
| 191 | 191 | return Redirect::route('profile')->with('success', $success);
|
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | // Do we want to update the user password? |
| 235 | 235 | $password = Input::get('password');
|
| 236 | 236 | |
| 237 | - if (Sentinel::validateCredentials($user, [ 'email' => $user->email, 'password' => Input::get('old-password')]))
|
|
| 237 | + if (Sentinel::validateCredentials($user, ['email' => $user->email, 'password' => Input::get('old-password')]))
|
|
| 238 | 238 | {
|
| 239 | 239 | $user->password = Hash::make($password); |
| 240 | 240 | $redirect = 'change-password'; |
@@ -251,12 +251,12 @@ discard block |
||
| 251 | 251 | // Prepare the success message |
| 252 | 252 | $success = Lang::get('base.auth.account.changed');
|
| 253 | 253 | |
| 254 | - Mail::queue('emails.account.password-changed', [ 'user' => $user ], function ($m) use ($user) {
|
|
| 255 | - $m->to($user->email, $user->first_name . ' ' . $user->last_name); |
|
| 254 | + Mail::queue('emails.account.password-changed', ['user' => $user], function($m) use ($user) {
|
|
| 255 | + $m->to($user->email, $user->first_name.' '.$user->last_name); |
|
| 256 | 256 | $m->subject(Lang::get('base.mails.password_changed'));
|
| 257 | 257 | }); |
| 258 | 258 | |
| 259 | - Base::Log($user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') changed its password account. ');
|
|
| 259 | + Base::Log($user->username.' ('.$user->first_name.' '.$user->last_name.') changed its password account. ');
|
|
| 260 | 260 | |
| 261 | 261 | // Redirect to the user page |
| 262 | 262 | return Redirect::route($redirect)->with('success', $success);
|
@@ -353,13 +353,13 @@ discard block |
||
| 353 | 353 | $activation = Activation::exists($user); |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - if($activation) |
|
| 356 | + if ($activation) |
|
| 357 | 357 | Activation::complete($user, $activation->code); |
| 358 | 358 | |
| 359 | - Base::TargettedLog($user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') account was accepted. ', $user->id);
|
|
| 359 | + Base::TargettedLog($user->username.' ('.$user->first_name.' '.$user->last_name.') account was accepted. ', $user->id);
|
|
| 360 | 360 | |
| 361 | - Mail::queue('emails.account.accepted-by-admin', [ 'user' => $user ], function ($m) use ($user) {
|
|
| 362 | - $m->to($user->email, $user->first_name . ' ' . $user->last_name); |
|
| 361 | + Mail::queue('emails.account.accepted-by-admin', ['user' => $user], function($m) use ($user) {
|
|
| 362 | + $m->to($user->email, $user->first_name.' '.$user->last_name); |
|
| 363 | 363 | $m->subject(Lang::get('base.mails.account_accepted'));
|
| 364 | 364 | }); |
| 365 | 365 | |
@@ -399,11 +399,11 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | if ($user->save()) |
| 401 | 401 | {
|
| 402 | - Base::TargettedLog($user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') account was refused. ', $user->id);
|
|
| 402 | + Base::TargettedLog($user->username.' ('.$user->first_name.' '.$user->last_name.') account was refused. ', $user->id);
|
|
| 403 | 403 | |
| 404 | 404 | if (Base::getSetting('SEND_EMAIL_ON_REFUSE'))
|
| 405 | - Mail::queue('emails.account.refused-by-admin', [ 'user' => $user ], function ($m) use ($user) {
|
|
| 406 | - $m->to($user->email, $user->first_name . ' ' . $user->last_name); |
|
| 405 | + Mail::queue('emails.account.refused-by-admin', ['user' => $user], function($m) use ($user) {
|
|
| 406 | + $m->to($user->email, $user->first_name.' '.$user->last_name); |
|
| 407 | 407 | $m->subject(Lang::get('base.mails.account_accepted'));
|
| 408 | 408 | }); |
| 409 | 409 | |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | // Check if we are not trying to delete ourselves |
| 489 | - if ($user->id === Sentinel::getUser()->id) {
|
|
| 489 | + if ($user->id === Sentinel::getUser()->id) {
|
|
| 490 | 490 | // Prepare the error message |
| 491 | 491 | $error = Lang::get('base.base.error');
|
| 492 | 492 | |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | public function getAdminEdit($id = null) |
| 578 | 578 | {
|
| 579 | 579 | // Get the user information |
| 580 | - if($user = Sentinel::findById($id)) |
|
| 580 | + if ($user = Sentinel::findById($id)) |
|
| 581 | 581 | {
|
| 582 | 582 | // Get this user groups |
| 583 | 583 | $userRoles = $user->getRoles()->lists('name', 'id')->all();
|
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | |
| 657 | 657 | try {
|
| 658 | 658 | // Update the user |
| 659 | - $user->gender = Input::get('gender');
|
|
| 659 | + $user->gender = Input::get('gender');
|
|
| 660 | 660 | $user->first_name = Input::get('first_name');
|
| 661 | 661 | $user->last_name = Input::get('last_name');
|
| 662 | 662 | $user->username = Input::get('username');
|
@@ -689,16 +689,16 @@ discard block |
||
| 689 | 689 | if ($extension == 'png' || $extension == 'PNG' || $extension == 'JGP' || $extension == 'jpg' || $extension == 'gif') |
| 690 | 690 | {
|
| 691 | 691 | $folderName = '/uploads/users/'; |
| 692 | - $destinationPath = public_path() . $folderName; |
|
| 692 | + $destinationPath = public_path().$folderName; |
|
| 693 | 693 | $safeName = str_random(10).'.'.$extension; |
| 694 | 694 | $file->move($destinationPath, $safeName); |
| 695 | 695 | |
| 696 | 696 | //delete old pic if exists |
| 697 | - if(File::exists(public_path() . $folderName . $user->pic)) |
|
| 698 | - File::delete(public_path() . $folderName . $user->pic); |
|
| 697 | + if (File::exists(public_path().$folderName.$user->pic)) |
|
| 698 | + File::delete(public_path().$folderName.$user->pic); |
|
| 699 | 699 | |
| 700 | 700 | //save new file path into db |
| 701 | - $user->pic = $safeName; |
|
| 701 | + $user->pic = $safeName; |
|
| 702 | 702 | } |
| 703 | 703 | } |
| 704 | 704 | |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | $status = $activation = Activation::completed($user); |
| 734 | 734 | $currentStatus = Input::get('status');
|
| 735 | 735 | |
| 736 | - if($currentStatus != $status) |
|
| 736 | + if ($currentStatus != $status) |
|
| 737 | 737 | {
|
| 738 | 738 | if ($currentStatus == 0) |
| 739 | 739 | // Remove existing activation record |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | $activation = Activation::exists($user); |
| 750 | 750 | } |
| 751 | 751 | |
| 752 | - if($activation) |
|
| 752 | + if ($activation) |
|
| 753 | 753 | Activation::complete($user, $activation->code); |
| 754 | 754 | } |
| 755 | 755 | |
@@ -763,16 +763,16 @@ discard block |
||
| 763 | 763 | {
|
| 764 | 764 | if ($password_changed && Input::get('send_new_password_email'))
|
| 765 | 765 | {
|
| 766 | - Mail::queue('emails.account.password-changed-by-admin', [ 'user' => $user, 'new_password' => $password ], function ($m) use ($user) {
|
|
| 767 | - $m->to($user->email, $user->first_name . ' ' . $user->last_name); |
|
| 766 | + Mail::queue('emails.account.password-changed-by-admin', ['user' => $user, 'new_password' => $password], function($m) use ($user) {
|
|
| 767 | + $m->to($user->email, $user->first_name.' '.$user->last_name); |
|
| 768 | 768 | $m->subject(Lang::get('base.mails.password_changed'));
|
| 769 | 769 | }); |
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | if ($password_changed) |
| 773 | - Base::TargettedLog($user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') password was changed by an admin. ', $user->id);
|
|
| 773 | + Base::TargettedLog($user->username.' ('.$user->first_name.' '.$user->last_name.') password was changed by an admin. ', $user->id);
|
|
| 774 | 774 | |
| 775 | - Base::TargettedLog($user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') profile was changed by an admin. ', $user->id);
|
|
| 775 | + Base::TargettedLog($user->username.' ('.$user->first_name.' '.$user->last_name.') profile was changed by an admin. ', $user->id);
|
|
| 776 | 776 | |
| 777 | 777 | // Prepare the success message |
| 778 | 778 | $success = Lang::get('base.auth.user_changed');
|
@@ -864,36 +864,36 @@ discard block |
||
| 864 | 864 | if ($extension == 'png' || $extension == 'PNG' || $extension == 'JGP' || $extension == 'jpg' || $extension == 'gif') |
| 865 | 865 | {
|
| 866 | 866 | $folderName = '/uploads/users/'; |
| 867 | - $destinationPath = public_path() . $folderName; |
|
| 867 | + $destinationPath = public_path().$folderName; |
|
| 868 | 868 | $safeName = str_random(10).'.'.$extension; |
| 869 | 869 | $file->move($destinationPath, $safeName); |
| 870 | 870 | |
| 871 | 871 | //delete old pic if exists |
| 872 | - if(File::exists(public_path() . $folderName . $user->pic)) |
|
| 873 | - File::delete(public_path() . $folderName . $user->pic); |
|
| 872 | + if (File::exists(public_path().$folderName.$user->pic)) |
|
| 873 | + File::delete(public_path().$folderName.$user->pic); |
|
| 874 | 874 | |
| 875 | 875 | //save new file path into db |
| 876 | - $user->pic = $safeName; |
|
| 876 | + $user->pic = $safeName; |
|
| 877 | 877 | } |
| 878 | 878 | } |
| 879 | 879 | |
| 880 | 880 | $user->save(); |
| 881 | 881 | |
| 882 | - Base::TargettedLog($user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') account was created by an admin. ', $user->id);
|
|
| 882 | + Base::TargettedLog($user->username.' ('.$user->first_name.' '.$user->last_name.') account was created by an admin. ', $user->id);
|
|
| 883 | 883 | |
| 884 | 884 | if (Input::get('send_new_password_email'))
|
| 885 | 885 | {
|
| 886 | 886 | if ($activate) |
| 887 | 887 | {
|
| 888 | - Mail::queue('emails.account.account-created-by-admin', [ 'user' => $user, 'new_password' => Input::get('password') ], function ($m) use ($user) {
|
|
| 889 | - $m->to($user->email, $user->first_name . ' ' . $user->last_name); |
|
| 888 | + Mail::queue('emails.account.account-created-by-admin', ['user' => $user, 'new_password' => Input::get('password')], function($m) use ($user) {
|
|
| 889 | + $m->to($user->email, $user->first_name.' '.$user->last_name); |
|
| 890 | 890 | $m->subject(Lang::get('base.mails.account_created'));
|
| 891 | 891 | }); |
| 892 | 892 | } |
| 893 | 893 | else |
| 894 | 894 | {
|
| 895 | - Mail::queue('emails.account.account-created-by-admin-inactive', [ 'user' => $user, 'new_password' => Input::get('password') ], function ($m2) use ($user) {
|
|
| 896 | - $m2->to($user->email, $user->first_name . ' ' . $user->last_name); |
|
| 895 | + Mail::queue('emails.account.account-created-by-admin-inactive', ['user' => $user, 'new_password' => Input::get('password')], function($m2) use ($user) {
|
|
| 896 | + $m2->to($user->email, $user->first_name.' '.$user->last_name); |
|
| 897 | 897 | $m2->subject(Lang::get('base.mails.account_created'));
|
| 898 | 898 | }); |
| 899 | 899 | |
@@ -906,9 +906,9 @@ discard block |
||
| 906 | 906 | ); |
| 907 | 907 | |
| 908 | 908 | // Send the activation code through email |
| 909 | - Mail::queue('emails.auth.register-activate', $data, function ($m) use ($user) {
|
|
| 910 | - $m->to($user->email, $user->first_name . ' ' . $user->last_name); |
|
| 911 | - $m->subject(Lang::get('base.mails.welcome') . ' ' . $user->first_name);
|
|
| 909 | + Mail::queue('emails.auth.register-activate', $data, function($m) use ($user) {
|
|
| 910 | + $m->to($user->email, $user->first_name.' '.$user->last_name); |
|
| 911 | + $m->subject(Lang::get('base.mails.welcome').' '.$user->first_name);
|
|
| 912 | 912 | }); |
| 913 | 913 | |
| 914 | 914 | } |
@@ -969,7 +969,7 @@ discard block |
||
| 969 | 969 | } |
| 970 | 970 | |
| 971 | 971 | // Check if we are not trying to delete ourselves |
| 972 | - if ($user->id === Sentinel::getUser()->id + 1) {
|
|
| 972 | + if ($user->id === Sentinel::getUser()->id + 1) {
|
|
| 973 | 973 | // Prepare the error message |
| 974 | 974 | $error = Lang::get('base.base.yourself');
|
| 975 | 975 | |
@@ -1010,7 +1010,7 @@ discard block |
||
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | 1012 | // Check if we are not trying to delete ourselves |
| 1013 | - if ($user->id === Sentinel::getUser()->id + 1) {
|
|
| 1013 | + if ($user->id === Sentinel::getUser()->id + 1) {
|
|
| 1014 | 1014 | // Prepare the error message |
| 1015 | 1015 | $error = Lang::get('base.base.yourself');
|
| 1016 | 1016 | |