diff --git a/app/controllers/InvoiceController.php b/app/controllers/InvoiceController.php index da4b361d1be8..7ae56acdf99b 100755 --- a/app/controllers/InvoiceController.php +++ b/app/controllers/InvoiceController.php @@ -43,6 +43,7 @@ class InvoiceController extends \BaseController { { $data = [ 'showClientHeader' => true, + 'hideLogo' => Session::get('white_label'), 'title' => trans('texts.invoices'), 'entityType'=>ENTITY_INVOICE, 'columns'=>Utils::trans(['invoice_number', 'invoice_date', 'invoice_total', 'balance_due', 'due_date']) @@ -155,7 +156,8 @@ class InvoiceController extends \BaseController { Session::set($invitationKey, true); Session::set('invitation_key', $invitationKey); - + Session::set('white_label', $client->account->isWhiteLabel()); + $client->account->loadLocalizationSettings(); $invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date); @@ -163,8 +165,9 @@ class InvoiceController extends \BaseController { $invoice->is_pro = $client->account->isPro(); $data = array( - 'showClientHeader' => true, + 'showClientHeader' => true, 'showBreadcrumbs' => false, + 'hideLogo' => $client->account->isWhiteLabel(), 'invoice' => $invoice->hidePrivateFields(), 'invitation' => $invitation, 'invoiceLabels' => $client->account->getInvoiceLabels(), diff --git a/app/controllers/PaymentController.php b/app/controllers/PaymentController.php index 21d16340f80b..5c705ad2242e 100755 --- a/app/controllers/PaymentController.php +++ b/app/controllers/PaymentController.php @@ -32,6 +32,7 @@ class PaymentController extends \BaseController { return View::make('public_list', array( 'showClientHeader' => true, + 'hideLogo' => Session::get('white_label'), 'entityType'=>ENTITY_PAYMENT, 'title' => trans('texts.payments'), 'columns'=>Utils::trans(['invoice', 'transaction_reference', 'method', 'payment_amount', 'payment_date']) @@ -506,7 +507,7 @@ class PaymentController extends \BaseController $license->save(); } - return $productId == PRODUCT_ONE_CLICK_INSTALL ? 'valid' : $_ENV['INVOICE_DESIGNS']; + return $productId == PRODUCT_INVOICE_DESIGNS ? $_ENV['INVOICE_DESIGNS'] : 'valid'; } else { diff --git a/app/controllers/QuoteController.php b/app/controllers/QuoteController.php index e7634429db17..e9330dffcae8 100644 --- a/app/controllers/QuoteController.php +++ b/app/controllers/QuoteController.php @@ -51,6 +51,7 @@ class QuoteController extends \BaseController { { $data = [ 'showClientHeader' => true, + 'hideLogo' => Session::get('white_label'), 'title' => trans('texts.quotes'), 'entityType'=>ENTITY_QUOTE, 'columns'=>Utils::trans(['quote_number', 'quote_date', 'quote_total', 'due_date']) diff --git a/app/filters.php b/app/filters.php index 1fc113a940b7..9ce4e265acae 100755 --- a/app/filters.php +++ b/app/filters.php @@ -32,7 +32,7 @@ App::before(function($request) if (Utils::isNinja()) { $data = Utils::getNewsFeedResponse(); } else { - $file = @file_get_contents(NINJA_URL . '/news_feed/' . Utils::getUserType() . '/' . NINJA_VERSION); + $file = @file_get_contents(NINJA_APP_URL . '/news_feed/' . Utils::getUserType() . '/' . NINJA_VERSION); $data = @json_decode($file); } if ($data) { @@ -84,10 +84,10 @@ App::before(function($request) $licenseKey = Input::get('license_key'); $productId = Input::get('product_id'); + $data = trim(file_get_contents((Utils::isNinjaDev() ? 'http://ninja.dev' : NINJA_APP_URL) . "/claim_license?license_key={$licenseKey}&product_id={$productId}")); + if ($productId == PRODUCT_INVOICE_DESIGNS) { - $data = file_get_contents((Utils::isNinjaDev() ? 'http://ninja.dev' : NINJA_URL) . "/claim_license?license_key={$licenseKey}&product_id={$productId}"); - if ($data = json_decode($data)) { foreach ($data as $item) @@ -99,13 +99,24 @@ App::before(function($request) $design->save(); } - if (!Utils::isNinja()) { + if (!Utils::isNinjaProd()) { Cache::forget('invoice_designs_cache_' . Auth::user()->maxInvoiceDesignId()); } Session::flash('message', trans('texts.bought_designs')); } } + else if ($productId == PRODUCT_WHITE_LABEL) + { + if ($data == 'valid') + { + $account = Auth::user()->account; + $account->pro_plan_paid = NINJA_DATE; + $account->save(); + + Session::flash('message', trans('texts.bought_white_label')); + } + } } }); diff --git a/app/lang/en/texts.php b/app/lang/en/texts.php index 775414d0633d..4a9884d31def 100644 --- a/app/lang/en/texts.php +++ b/app/lang/en/texts.php @@ -468,6 +468,11 @@ return array( 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', 'payment_footer1' => '*Billing address must match address accociated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', - 'vat_number' => 'Vat Number', + 'white_label_link' => 'Purchase white label license', + 'white_label_text' => 'Purchase a white label license for $10.00 to remove the Invoice Ninja branding from the top of the client pages.', + 'white_label_header' => 'White Label', + 'bought_white_label' => 'Successfully enabled white label license', + 'white_labeled' => 'White labeled' + ); diff --git a/app/models/Account.php b/app/models/Account.php index cf80925b018b..8c26021012ba 100755 --- a/app/models/Account.php +++ b/app/models/Account.php @@ -234,7 +234,7 @@ class Account extends Eloquent { return false; } - else if ($datePaid == '2000-01-01') + else if ($datePaid == NINJA_DATE) { return true; } @@ -246,6 +246,16 @@ class Account extends Eloquent return $interval->y == 0; } + public function isWhiteLabel() + { + if (Utils::isNinjaProd()) + { + return false; + } + + return $this->pro_plan_paid == NINJA_DATE; + } + public function getSubscription($eventId) { return Subscription::where('account_id', '=', $this->id)->where('event_id', '=', $eventId)->first(); diff --git a/app/models/Invitation.php b/app/models/Invitation.php index e5b36f886553..883092c05223 100755 --- a/app/models/Invitation.php +++ b/app/models/Invitation.php @@ -19,6 +19,6 @@ class Invitation extends EntityModel public function getLink() { - return URL::to('view') . '/' . $this->invitation_key; + return SITE_URL . '/view/' . $this->invitation_key; } } \ No newline at end of file diff --git a/app/ninja/mailers/ContactMailer.php b/app/ninja/mailers/ContactMailer.php index 00eaaba836fd..7b29d3a46753 100755 --- a/app/ninja/mailers/ContactMailer.php +++ b/app/ninja/mailers/ContactMailer.php @@ -83,6 +83,8 @@ class ContactMailer extends Mailer { $message = "Softaculous install license: $license"; } else if ($productId == PRODUCT_INVOICE_DESIGNS) { $message = "Invoice designs license: $license"; + } else if ($productId == PRODUCT_WHITE_LABEL) { + $message = "White label license: $license"; } $data = [ diff --git a/app/routes.php b/app/routes.php index f8b70dcb2777..13cc1c72c357 100755 --- a/app/routes.php +++ b/app/routes.php @@ -253,8 +253,10 @@ define('DEMO_ACCOUNT_ID', 'DEMO_ACCOUNT_ID'); define('NINJA_ACCOUNT_KEY', 'zg4ylmzDkdkPOT8yoKQw9LTWaoZJx79h'); define('NINJA_GATEWAY_ID', GATEWAY_AUTHORIZE_NET); define('NINJA_GATEWAY_CONFIG', '{"apiLoginId":"626vWcD5","transactionKey":"4bn26TgL9r4Br4qJ","testMode":"","developerMode":""}'); -define('NINJA_URL', 'https://www.invoiceninja.com'); +define('NINJA_WEB_URL', 'https://www.invoiceninja.com'); +define('NINJA_APP_URL', 'https://www.invoiceninja.com'); define('NINJA_VERSION', '1.5.1'); +define('NINJA_DATE', '2000-01-01'); define('NINJA_FROM_EMAIL', 'maildelivery@invoiceninja.com'); define('RELEASES_URL', 'https://github.com/hillelcoren/invoice-ninja/releases/'); @@ -262,7 +264,9 @@ define('COUNT_FREE_DESIGNS', 4); define('PRO_PLAN_PRICE', 50); define('PRODUCT_ONE_CLICK_INSTALL', 1); define('PRODUCT_INVOICE_DESIGNS', 2); +define('PRODUCT_WHITE_LABEL', 3); define('DESIGNS_AFFILIATE_KEY', 'T3RS74'); +define('WHITE_LABEL_AFFILIATE_KEY', '92D2J5'); define('USER_TYPE_SELF_HOST', 'SELF_HOST'); define('USER_TYPE_CLOUD_HOST', 'CLOUD_HOST'); diff --git a/app/views/emails/invoice_html.blade.php b/app/views/emails/invoice_html.blade.php index 2db78c6e72cb..3fedc29030ca 100755 --- a/app/views/emails/invoice_html.blade.php +++ b/app/views/emails/invoice_html.blade.php @@ -19,7 +19,7 @@ @if ($showNinjaFooter)

- {{ trans('texts.ninja_email_footer', ['site' => 'Invoice Ninja']) }} + {{ trans('texts.ninja_email_footer', ['site' => 'Invoice Ninja']) }} @endif diff --git a/app/views/emails/invoice_text.blade.php b/app/views/emails/invoice_text.blade.php index 4797df81badc..4dee6b3c8bfd 100755 --- a/app/views/emails/invoice_text.blade.php +++ b/app/views/emails/invoice_text.blade.php @@ -12,5 +12,5 @@ @if ($showNinjaFooter) {{ trans('texts.ninja_email_footer', ['site' => 'Invoice Ninja']) }} -{{ NINJA_URL }} +{{ NINJA_WEB_URL }} @endif diff --git a/app/views/emails/payment_confirmation_html.blade.php b/app/views/emails/payment_confirmation_html.blade.php index 115478c45e56..cf860e2bdcf0 100644 --- a/app/views/emails/payment_confirmation_html.blade.php +++ b/app/views/emails/payment_confirmation_html.blade.php @@ -22,7 +22,7 @@ @if ($showNinjaFooter)

- {{ trans('texts.ninja_email_footer', ['site' => 'Invoice Ninja']) }} + {{ trans('texts.ninja_email_footer', ['site' => 'Invoice Ninja']) }} @endif diff --git a/app/views/emails/payment_confirmation_text.blade.php b/app/views/emails/payment_confirmation_text.blade.php index 15f94c3b8bf9..414ca30e8ab7 100644 --- a/app/views/emails/payment_confirmation_text.blade.php +++ b/app/views/emails/payment_confirmation_text.blade.php @@ -15,5 +15,5 @@ @if ($showNinjaFooter) {{ trans('texts.ninja_email_footer', ['site' => 'Invoice Ninja']) }} -{{ NINJA_URL }} +{{ NINJA_WEB_URL }} @endif diff --git a/app/views/header.blade.php b/app/views/header.blade.php index b1609d603592..85381d1bcca7 100755 --- a/app/views/header.blade.php +++ b/app/views/header.blade.php @@ -343,8 +343,35 @@ Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice @endif {{-- Per our license, please do not remove or modify this link. --}} -@if (!Utils::isNinja()) -

{{ trans('texts.powered_by') }} InvoiceNinja.com
+@if (Utils::isNinjaDev() || !Utils::isNinja()) +
+ {{ trans('texts.powered_by') }} InvoiceNinja.com - + @if (Auth::user()->account->isWhiteLabel()) + {{ trans('texts.white_labeled') }} + @else + {{ trans('texts.white_label_link') }} + + + @endif +
@endif

 

@@ -467,6 +494,10 @@ Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice $('#signUpModal').modal('show'); } + function buyProduct(affiliateKey, productId) { + window.open('{{ Utils::isNinjaDev() ? '' : NINJA_APP_URL }}/license?affiliate_key=' + affiliateKey + '&product_id=' + productId + '&return_url=' + window.location); + } + @if (Auth::check() && !Auth::user()->isPro()) var proPlanFeature = false; function showProPlan(feature) { diff --git a/app/views/invoices/pdf.blade.php b/app/views/invoices/pdf.blade.php index c0e08a7214cd..01fce95094c7 100644 --- a/app/views/invoices/pdf.blade.php +++ b/app/views/invoices/pdf.blade.php @@ -37,7 +37,7 @@ @if (Utils::isNinjaProd()) @else - + @endif @@ -120,8 +120,4 @@ $('#moreDesignsModal').modal('show'); } - function buyDesigns() { - window.open('{{ Utils::isNinjaDev() ? '' : NINJA_URL }}/license?return_url=' + window.location + '&affiliate_key={{ DESIGNS_AFFILIATE_KEY }}&product_id={{ PRODUCT_INVOICE_DESIGNS }}'); - } - \ No newline at end of file diff --git a/app/views/master.blade.php b/app/views/master.blade.php index e04a38d9c7c6..c5564486067d 100755 --- a/app/views/master.blade.php +++ b/app/views/master.blade.php @@ -42,7 +42,7 @@ } catch(err) {} return false; } - + /* Set the defaults for DataTables initialisation */ $.extend( true, $.fn.dataTable.defaults, { "bSortClasses": false, diff --git a/app/views/public/header.blade.php b/app/views/public/header.blade.php index abdf58d0289b..012f793af333 100644 --- a/app/views/public/header.blade.php +++ b/app/views/public/header.blade.php @@ -106,8 +106,10 @@