From 53757f7bfeaf311e41ad3306e0a56cce7e7d8e08 Mon Sep 17 00:00:00 2001 From: ashu555 Date: Mon, 8 Jul 2019 15:08:00 +0530 Subject: [PATCH 1/6] bugs fixed --- app/Http/Controllers/Api/ApiController.php | 11 ++--- .../Controllers/License/LicenseController.php | 45 +++++++++++++++---- .../Controllers/Order/InvoiceController.php | 2 +- .../front/auth/login-register.blade.php | 4 +- storage/installed | 1 + 5 files changed, 46 insertions(+), 17 deletions(-) diff --git a/app/Http/Controllers/Api/ApiController.php b/app/Http/Controllers/Api/ApiController.php index ab655c887a..55a88bbb34 100644 --- a/app/Http/Controllers/Api/ApiController.php +++ b/app/Http/Controllers/Api/ApiController.php @@ -15,6 +15,7 @@ public function checkDomain(Request $request) try { $result = 'fails'; $url = $request->input('url'); + $url2 = preg_replace('#^https?://#', '', $url); // if (ends_with($domain, '/')) { // $domain = substr_replace($domain,"", -1, 1); @@ -22,17 +23,17 @@ public function checkDomain(Request $request) $url_info = parse_url($url); $domain1 = $url_info['host']; - $url = preg_replace('#^www\.(.+\.)#i', '$1', $url_info['host']); //remove www from domain - $domain2 = 'www.'.$url; - $domain1check = $url.','.$domain2; + $url1 = preg_replace('#^www\.(.+\.)#i', '$1', $url_info['host']); //remove www from domain + $domain2 = 'www.'.$url1; + $domain1check = $url1.','.$domain2; $orders = new Order(); - $order = $orders->where('domain', $domain1check)->orWhere('domain', $url)->orWhere('domain', $domain2)->first(); + $order = $orders->where('domain', $domain1check)->orWhere('domain', $url1)->orWhere('domain', $domain2)->orWhere('domain', $url2)->first(); if ($order) { $product = Product::where('id', $order->product)->pluck('name')->first(); $result = 'success'; } - return response()->json(compact('result', 'product')); + return response()->json(compact('result')); } catch (Exception $ex) { $error = $ex->getMessage(); diff --git a/app/Http/Controllers/License/LicenseController.php b/app/Http/Controllers/License/LicenseController.php index 55c1c8c702..ded65b70c3 100644 --- a/app/Http/Controllers/License/LicenseController.php +++ b/app/Http/Controllers/License/LicenseController.php @@ -153,9 +153,13 @@ public function createNewLicene($orderid, $product, $user_id, $order = Order::where('id', $orderid)->first(); $orderNo = $order->number; $domain = $order->domain; + $ipAndDomain = $this->getIpAndDomain($domain); + $ip = $ipAndDomain['ip']; + $domain = $ipAndDomain['domain']; + $requiredomain = $ipAndDomain['requiredomain']; $productId = $this->searchProductId($sku); - $addLicense = $this->postCurl($url, "api_key_secret=$api_key_secret&api_function=licenses_add&product_id=$productId&license_code=$serial_key&license_require_domain=1&license_status=1&license_order_number=$orderNo&license_domain=$domain&license_limit=6&license_expire_date=$licenseExpiry&license_updates_date=$updatesExpiry&license_support_date=$supportExpiry&license_disable_ip_verification=0"); - } + $addLicense = $this->postCurl($url, "api_key_secret=$api_key_secret&api_function=licenses_add&product_id=$productId&license_code=$serial_key&license_require_domain=1&license_status=1&license_order_number=$orderNo&license_domain=$domain&&license_ip=$ip&license_require_domain=$requiredomain&license_limit=6&license_expire_date=$licenseExpiry&license_updates_date=$updatesExpiry&license_support_date=$supportExpiry&license_disable_ip_verification=0&license_limit=2"); + } /* * Edit Existing License @@ -175,8 +179,35 @@ public function updateLicensedDomain($licenseCode, $domain, $productId, $license $s_expiry = date('Y-m-d', strtotime($supportExpiry)); } $url = $this->url; + + $ipAndDomain = $this->getIpAndDomain($domain); + $ip = $ipAndDomain['ip']; + $domain = $ipAndDomain['domain']; + $requiredomain = $ipAndDomain['requiredomain']; + + $api_key_secret = $this->api_key_secret; + $searchLicense = $this->searchLicenseId($licenseCode, $productId); + $licenseId = $searchLicense['licenseId']; + $productId = $searchLicense['productId']; + $licenseCode = $searchLicense['code']; + $updateLicense = $this->postCurl($url, "api_key_secret=$api_key_secret&api_function=licenses_edit&product_id=$productId&license_code=$licenseCode&license_id=$licenseId&license_order_number=$orderNo&license_require_domain=$requiredomain&license_status=1&license_expire_date=$l_expiry&license_updates_date=$u_expiry&license_support_date=$s_expiry&license_domain=$domain&license_ip=$ip&license_limit=2"); + } + + /** + * Get the Ip and domain that is to be entered in License Manager + * + * @author Ashutosh Pathak + * + * @date 2019-05-11T11:31:07+0530 + * + * @param string $domain + * + * @return array + */ + protected function getIpAndDomain($domain) + { $isIP = (bool) ip2long($domain); - if ($isIP == true) { + if ($isIP == true) { $requiredomain = 0; $ip = $domain; $domain = ''; @@ -185,12 +216,8 @@ public function updateLicensedDomain($licenseCode, $domain, $productId, $license $domain = $domain; $ip = ''; } - $api_key_secret = $this->api_key_secret; - $searchLicense = $this->searchLicenseId($licenseCode, $productId); - $licenseId = $searchLicense['licenseId']; - $productId = $searchLicense['productId']; - $licenseCode = $searchLicense['code']; - $updateLicense = $this->postCurl($url, "api_key_secret=$api_key_secret&api_function=licenses_edit&product_id=$productId&license_code=$licenseCode&license_id=$licenseId&license_order_number=$orderNo&license_require_domain=$requiredomain&license_status=1&license_expire_date=$l_expiry&license_updates_date=$u_expiry&license_support_date=$s_expiry&license_domain=$domain&license_ip=$ip&license_limit=2"); + + return ['ip'=>$ip , 'domain'=>$domain, 'requiredomain'=>$requiredomain]; } public function searchLicenseId($licenseCode, $productId) diff --git a/app/Http/Controllers/Order/InvoiceController.php b/app/Http/Controllers/Order/InvoiceController.php index dc98629415..a7f49f9ea9 100755 --- a/app/Http/Controllers/Order/InvoiceController.php +++ b/app/Http/Controllers/Order/InvoiceController.php @@ -247,7 +247,7 @@ public function generateById(Request $request) } else { $user = ''; } - $products = $this->product->where('id', '!=', 1)->pluck('name', 'id')->toArray(); + $products = $this->product->pluck('name', 'id')->toArray(); $currency = $this->currency->pluck('name', 'code')->toArray(); return view('themes.default1.invoice.generate', compact('user', 'products', 'currency')); diff --git a/resources/views/themes/default1/front/auth/login-register.blade.php b/resources/views/themes/default1/front/auth/login-register.blade.php index 1eeb7eaddf..6dbbcf8868 100644 --- a/resources/views/themes/default1/front/auth/login-register.blade.php +++ b/resources/views/themes/default1/front/auth/login-register.blade.php @@ -1017,7 +1017,7 @@ function sendOTP() { type: 'GET', data: data, success: function (response) { - window.history.replaceState(response.type, "TitleTest", "login"); + // window.history.replaceState(response.type, "TitleTest", "login"); $("#sendOtp").attr('disabled',false); var result = '
Almost there! '+response.message+'
'; if (($("#checkOtpStatus").val()) == 1 ) { @@ -1644,7 +1644,7 @@ function registerUser() { "_token": "{!! csrf_token() !!}", }, success: function (response) { - window.history.pushState(response.type, "TitleTest", "thankyou"); + // window.history.pushState(response.type, "TitleTest", "thankyou"); $("#register").attr('disabled',false); if(response.type == 'success'){ diff --git a/storage/installed b/storage/installed index 2a2294f60e..9ba8e01f09 100644 --- a/storage/installed +++ b/storage/installed @@ -15,3 +15,4 @@ Agora Invoicing Installer successfully UPDATED on 2019/04/16 12:29:51pm Agora Invoicing Installer successfully UPDATED on 2019/04/16 12:42:54pm Agora Invoicing Installer successfully UPDATED on 2019/04/16 12:54:26pm Agora Invoicing Installer successfully UPDATED on 2019/04/16 01:40:00pm +Agora Invoicing Installer successfully UPDATED on 2019/05/15 10:00:08am From 27f696bdcc8f1fd9c53df7ff9d29c32514744ffc Mon Sep 17 00:00:00 2001 From: Ashutosh pathak Date: Mon, 8 Jul 2019 09:39:47 +0000 Subject: [PATCH 2/6] Apply fixes from StyleCI --- .../Controllers/Common/SettingsController.php | 1 - .../Controllers/Front/BaseClientController.php | 1 - .../Controllers/Front/CheckoutController.php | 1 - app/Http/Controllers/Front/ClientController.php | 1 - .../Controllers/License/LicenseController.php | 16 ++++++++-------- .../Controllers/Order/BaseInvoiceController.php | 1 - .../Order/ExtendedBaseInvoiceController.php | 1 - app/Http/Controllers/Order/InvoiceController.php | 1 - .../Payment/BasePromotionController.php | 1 - app/Http/Controllers/User/ClientController.php | 1 - app/Model/Common/Website.php | 1 - app/Plugins/Paypal/config.php | 1 - database/seeds/DatabaseSeeder.php | 2 -- .../views/themes/default1/front/clients/copy.php | 2 +- tests/DBTestCase.php | 6 +++--- tests/Unit/Client/Account/InvoiceTest.php | 1 - 16 files changed, 12 insertions(+), 26 deletions(-) diff --git a/app/Http/Controllers/Common/SettingsController.php b/app/Http/Controllers/Common/SettingsController.php index 8a9893aa66..0cc3ced1c7 100755 --- a/app/Http/Controllers/Common/SettingsController.php +++ b/app/Http/Controllers/Common/SettingsController.php @@ -13,7 +13,6 @@ use Bugsnag; use GrahamCampbell\Markdown\Facades\Markdown; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Input; use Spatie\Activitylog\Models\Activity; class SettingsController extends BaseSettingsController diff --git a/app/Http/Controllers/Front/BaseClientController.php b/app/Http/Controllers/Front/BaseClientController.php index 05d0180d08..1662ed65ba 100644 --- a/app/Http/Controllers/Front/BaseClientController.php +++ b/app/Http/Controllers/Front/BaseClientController.php @@ -8,7 +8,6 @@ use App\Model\Order\Invoice; use App\Model\Order\Order; use App\Model\Product\Product; -use App\Model\Product\Subscription; use Bugsnag; use DateTime; use DateTimeZone; diff --git a/app/Http/Controllers/Front/CheckoutController.php b/app/Http/Controllers/Front/CheckoutController.php index f5d1daddaf..77c46667e3 100755 --- a/app/Http/Controllers/Front/CheckoutController.php +++ b/app/Http/Controllers/Front/CheckoutController.php @@ -6,7 +6,6 @@ use App\Http\Controllers\Common\MailChimpController; use App\Http\Controllers\Common\TemplateController; use App\Model\Common\Setting; -use App\Model\Common\State; use App\Model\Common\Template; use App\Model\Order\Invoice; use App\Model\Order\InvoiceItem; diff --git a/app/Http/Controllers/Front/ClientController.php b/app/Http/Controllers/Front/ClientController.php index 3df4cab759..c16b22553d 100644 --- a/app/Http/Controllers/Front/ClientController.php +++ b/app/Http/Controllers/Front/ClientController.php @@ -13,7 +13,6 @@ use App\Model\Product\ProductUpload; use App\Model\Product\Subscription; use App\User; -use Auth; use Bugsnag; use DateTime; use DateTimeZone; diff --git a/app/Http/Controllers/License/LicenseController.php b/app/Http/Controllers/License/LicenseController.php index ded65b70c3..49472a1a19 100644 --- a/app/Http/Controllers/License/LicenseController.php +++ b/app/Http/Controllers/License/LicenseController.php @@ -156,10 +156,10 @@ public function createNewLicene($orderid, $product, $user_id, $ipAndDomain = $this->getIpAndDomain($domain); $ip = $ipAndDomain['ip']; $domain = $ipAndDomain['domain']; - $requiredomain = $ipAndDomain['requiredomain']; + $requiredomain = $ipAndDomain['requiredomain']; $productId = $this->searchProductId($sku); $addLicense = $this->postCurl($url, "api_key_secret=$api_key_secret&api_function=licenses_add&product_id=$productId&license_code=$serial_key&license_require_domain=1&license_status=1&license_order_number=$orderNo&license_domain=$domain&&license_ip=$ip&license_require_domain=$requiredomain&license_limit=6&license_expire_date=$licenseExpiry&license_updates_date=$updatesExpiry&license_support_date=$supportExpiry&license_disable_ip_verification=0&license_limit=2"); - } + } /* * Edit Existing License @@ -179,12 +179,12 @@ public function updateLicensedDomain($licenseCode, $domain, $productId, $license $s_expiry = date('Y-m-d', strtotime($supportExpiry)); } $url = $this->url; - + $ipAndDomain = $this->getIpAndDomain($domain); $ip = $ipAndDomain['ip']; $domain = $ipAndDomain['domain']; $requiredomain = $ipAndDomain['requiredomain']; - + $api_key_secret = $this->api_key_secret; $searchLicense = $this->searchLicenseId($licenseCode, $productId); $licenseId = $searchLicense['licenseId']; @@ -194,20 +194,20 @@ public function updateLicensedDomain($licenseCode, $domain, $productId, $license } /** - * Get the Ip and domain that is to be entered in License Manager + * Get the Ip and domain that is to be entered in License Manager. * * @author Ashutosh Pathak * * @date 2019-05-11T11:31:07+0530 * - * @param string $domain + * @param string $domain * * @return array */ protected function getIpAndDomain($domain) { $isIP = (bool) ip2long($domain); - if ($isIP == true) { + if ($isIP == true) { $requiredomain = 0; $ip = $domain; $domain = ''; @@ -217,7 +217,7 @@ protected function getIpAndDomain($domain) $ip = ''; } - return ['ip'=>$ip , 'domain'=>$domain, 'requiredomain'=>$requiredomain]; + return ['ip'=>$ip, 'domain'=>$domain, 'requiredomain'=>$requiredomain]; } public function searchLicenseId($licenseCode, $productId) diff --git a/app/Http/Controllers/Order/BaseInvoiceController.php b/app/Http/Controllers/Order/BaseInvoiceController.php index 57dd826d0f..204fcc767a 100644 --- a/app/Http/Controllers/Order/BaseInvoiceController.php +++ b/app/Http/Controllers/Order/BaseInvoiceController.php @@ -5,7 +5,6 @@ use App\Http\Controllers\Front\CartController; use App\Model\Order\Invoice; use App\Model\Order\InvoiceItem; -use App\Model\Order\Payment; use App\Model\Payment\Promotion; use App\Model\Payment\Tax; use App\Model\Payment\TaxClass; diff --git a/app/Http/Controllers/Order/ExtendedBaseInvoiceController.php b/app/Http/Controllers/Order/ExtendedBaseInvoiceController.php index c0851cc32b..5a68ac448a 100644 --- a/app/Http/Controllers/Order/ExtendedBaseInvoiceController.php +++ b/app/Http/Controllers/Order/ExtendedBaseInvoiceController.php @@ -10,7 +10,6 @@ use Bugsnag; use Exception; use Illuminate\Http\Request; -use Log; class ExtendedBaseInvoiceController extends Controller { diff --git a/app/Http/Controllers/Order/InvoiceController.php b/app/Http/Controllers/Order/InvoiceController.php index a7f49f9ea9..7d6ca505c3 100755 --- a/app/Http/Controllers/Order/InvoiceController.php +++ b/app/Http/Controllers/Order/InvoiceController.php @@ -24,7 +24,6 @@ use Bugsnag; use Illuminate\Http\Request; use Input; -use Log; class InvoiceController extends TaxRatesAndCodeExpiryController { diff --git a/app/Http/Controllers/Payment/BasePromotionController.php b/app/Http/Controllers/Payment/BasePromotionController.php index 4be28e806d..2e45dcf02b 100644 --- a/app/Http/Controllers/Payment/BasePromotionController.php +++ b/app/Http/Controllers/Payment/BasePromotionController.php @@ -3,7 +3,6 @@ namespace App\Http\Controllers\Payment; use App\Http\Controllers\Controller; -use App\Model\Payment\Plan; use App\Model\Payment\Promotion; use App\Model\Product\Product; diff --git a/app/Http/Controllers/User/ClientController.php b/app/Http/Controllers/User/ClientController.php index f5e3bcfb43..67a39ea6f0 100755 --- a/app/Http/Controllers/User/ClientController.php +++ b/app/Http/Controllers/User/ClientController.php @@ -16,7 +16,6 @@ use DateTime; use DateTimeZone; use Illuminate\Http\Request; -use Log; class ClientController extends AdvanceSearchController { diff --git a/app/Model/Common/Website.php b/app/Model/Common/Website.php index cbc5afd3a2..d59b344f16 100755 --- a/app/Model/Common/Website.php +++ b/app/Model/Common/Website.php @@ -3,7 +3,6 @@ namespace App\Model\Common; use App\BaseModel; -use App\User; use LinkThrow\Billing\SubscriptionBillableTrait; class Website extends BaseModel diff --git a/app/Plugins/Paypal/config.php b/app/Plugins/Paypal/config.php index 5aee7e53cc..1f2329f287 100644 --- a/app/Plugins/Paypal/config.php +++ b/app/Plugins/Paypal/config.php @@ -1,6 +1,5 @@ 'Paypal', diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index c1aedc86cd..c92ff3b2a8 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -11,14 +11,12 @@ use App\Model\License\LicensePermission; use App\Model\Mailjob\ActivityLogDay; use App\Model\Mailjob\Condition; -use App\Model\Payment\Currency; use App\Model\Payment\Period; use App\Model\Payment\Plan; use App\Model\Payment\Promotion; use App\Model\Payment\PromotionType; use App\Model\Payment\TaxOption; use App\Model\Product\Product; -use App\Model\Product\Type; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Seeder; diff --git a/resources/views/themes/default1/front/clients/copy.php b/resources/views/themes/default1/front/clients/copy.php index c999d7d051..a3bd433cfe 100644 --- a/resources/views/themes/default1/front/clients/copy.php +++ b/resources/views/themes/default1/front/clients/copy.php @@ -11,7 +11,7 @@