diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index f6495396253f..3c7b057e4915 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -62,13 +62,17 @@ class AccountController extends \BaseController { } public function enableProPlan() - { - $account = Auth::user()->account; - dd(Request::all()); - if ($account->pro_plan) + { + if (Auth::user()->isPro()) { return Redirect::to('/dashboard'); } + + $account = Auth::user()->account; + + $client = new Client; + + } public function setTrashVisible($entityType, $visible) diff --git a/app/database/migrations/2014_04_03_191105_add_pro_plan.php b/app/database/migrations/2014_04_03_191105_add_pro_plan.php index afde3759bc35..6cfc4dc96de4 100644 --- a/app/database/migrations/2014_04_03_191105_add_pro_plan.php +++ b/app/database/migrations/2014_04_03_191105_add_pro_plan.php @@ -14,7 +14,7 @@ class AddProPlan extends Migration { { Schema::table('accounts', function($table) { - $table->boolean('pro_plan'); + $table->timestamp('pro_plan_paid'); }); } @@ -27,7 +27,7 @@ class AddProPlan extends Migration { { Schema::table('accounts', function($table) { - $table->dropColumn('pro_plan'); + $table->dropColumn('pro_plan_paid'); }); } diff --git a/app/lang/de/texts.php b/app/lang/de/texts.php index 8d452ea97477..230c93a9118a 100644 --- a/app/lang/de/texts.php +++ b/app/lang/de/texts.php @@ -287,5 +287,11 @@ return array( 'password_reset' => 'Dein Passwort wurde erfolgreich geändert.', 'wrong_password_reset' => 'Ungültiges Passwort. Versuche es erneut', ), + + // Pro Plan + 'pro_plan' => [ + 'remove_logo' => ':link to remove the Invoice Ninja logo by joining the pro plan', + 'remove_logo_link' => 'Click here', + ], ); diff --git a/app/lang/en/texts.php b/app/lang/en/texts.php index 558dbc15ec42..f8614863490e 100644 --- a/app/lang/en/texts.php +++ b/app/lang/en/texts.php @@ -278,7 +278,7 @@ return array( 'cvv' => 'CVV', // Security alerts - 'confide' => array( + 'confide' => [ 'too_many_attempts' => 'Too many attempts. Try again in few minutes.', 'wrong_credentials' => 'Incorrect email or password.', 'confirmation' => 'Your account has been confirmed!', @@ -286,7 +286,12 @@ return array( 'password_forgot' => 'The information regarding password reset was sent to your email.', 'password_reset' => 'Your password has been changed successfully.', 'wrong_password_reset' => 'Invalid password. Try again', - ), + ], + // Pro Plan + 'pro_plan' => [ + 'remove_logo' => ':link to remove the Invoice Ninja logo by joining the pro plan', + 'remove_logo_link' => 'Click here', + ], ); \ No newline at end of file diff --git a/app/lang/es/texts.php b/app/lang/es/texts.php index c27be2db0810..728286f3bd3c 100644 --- a/app/lang/es/texts.php +++ b/app/lang/es/texts.php @@ -286,6 +286,12 @@ return array( 'password_reset' => 'Your password has been changed successfully.', 'wrong_password_reset' => 'Invalid password. Try again', ), + + // Pro Plan + 'pro_plan' => [ + 'remove_logo' => ':link to remove the Invoice Ninja logo by joining the pro plan', + 'remove_logo_link' => 'Click here', + ], ); diff --git a/app/lang/fr/texts.php b/app/lang/fr/texts.php index aad1c86e3e59..0c0d220181d6 100644 --- a/app/lang/fr/texts.php +++ b/app/lang/fr/texts.php @@ -287,6 +287,12 @@ return array( 'password_reset' => 'Your password has been changed successfully.', 'wrong_password_reset' => 'Invalid password. Try again', ), + + // Pro Plan + 'pro_plan' => [ + 'remove_logo' => ':link to remove the Invoice Ninja logo by joining the pro plan', + 'remove_logo_link' => 'Click here', + ], ); diff --git a/app/lang/it/texts.php b/app/lang/it/texts.php index 591243a23837..e8ed6ee7c3e8 100644 --- a/app/lang/it/texts.php +++ b/app/lang/it/texts.php @@ -288,6 +288,12 @@ return array( 'wrong_password_reset' => 'Invalid password. Try again', ), + // Pro Plan + 'pro_plan' => [ + 'remove_logo' => ':link to remove the Invoice Ninja logo by joining the pro plan', + 'remove_logo_link' => 'Click here', + ], + ); \ No newline at end of file diff --git a/app/lang/pt_BR/texts.php b/app/lang/pt_BR/texts.php index c137a656a1c6..880480d7d669 100644 --- a/app/lang/pt_BR/texts.php +++ b/app/lang/pt_BR/texts.php @@ -276,4 +276,11 @@ return array( 'expiration_year' => 'Ano de expiração', 'cvv' => 'CVV', + // Pro Plan + 'pro_plan' => [ + 'remove_logo' => ':link to remove the Invoice Ninja logo by joining the pro plan', + 'remove_logo_link' => 'Click here', + ], + + ); diff --git a/app/libraries/utils.php b/app/libraries/utils.php index 865b6ffc7d5c..1ea423a8db84 100755 --- a/app/libraries/utils.php +++ b/app/libraries/utils.php @@ -5,6 +5,11 @@ class Utils public static function isProd() { return App::environment() == ENV_PRODUCTION; + } + + public static function isNinjaProd() + { + return $_SERVER['SERVER_NAME'] == 'www.invoiceninja.com'; } public static function basePath() diff --git a/app/models/User.php b/app/models/User.php index ace29f474533..0d1bf7d153a5 100755 --- a/app/models/User.php +++ b/app/models/User.php @@ -104,6 +104,16 @@ class User extends ConfideUser implements UserInterface, RemindableInterface } } + public function isPro() + { + if (!Auth::check()) + { + return false; + } + + return $this->account->pro_plan; + } + public function showGreyBackground() { return !$this->theme_id || in_array($this->theme_id, [2, 3, 5, 6, 7, 8, 10, 11, 12]); diff --git a/app/views/header.blade.php b/app/views/header.blade.php index d989f20b1a3e..16d3744be515 100755 --- a/app/views/header.blade.php +++ b/app/views/header.blade.php @@ -318,7 +318,7 @@ Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice @endif -@if ($_SERVER['SERVER_NAME'] != 'www.invoiceninja.com') +@if (!Utils::isNinjaProd())
{{ trans('texts.powered_by') }} InvoiceNinja.com
@endif diff --git a/app/views/invoices/edit.blade.php b/app/views/invoices/edit.blade.php index 9bb9c13a6f61..871cc4b8512e 100755 --- a/app/views/invoices/edit.blade.php +++ b/app/views/invoices/edit.blade.php @@ -274,8 +274,8 @@ - @if (!Auth::user()->account->pro_plan) - Enable the pro plan by {{ link_to('account/enable_pro_plan', 'clicking here') }} to remove the Invoice Ninja logo + @if (!Auth::user()->isPro()) + {{ trans('texts.pro_plan.remove_logo', ['link'=>link_to('account/enable_pro_plan', trans('texts.pro_plan.remove_logo_link'))]) }} @endif