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/Common/SettingsController.php b/app/Http/Controllers/Common/SettingsController.php index 8a9893aa66..45cb9e96e8 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 @@ -82,9 +81,10 @@ public function getKeys(ApiKey $apikeys) $termsUrl = $apikeys->pluck('terms_url')->first(); $pipedriveKey = $apikeys->pluck('pipedrive_api_key')->first(); $pipedriveStatus = StatusSetting::pluck('pipedrive_status')->first(); + $domainCheckStatus = StatusSetting::pluck('domain_check')->first(); $model = $apikeys->find(1); - return view('themes.default1.common.apikey', compact('model', 'status', 'licenseSecret', 'licenseUrl', 'siteKey', 'secretKey', 'captchaStatus', 'updateStatus', 'updateSecret', 'updateUrl', 'mobileStatus', 'mobileauthkey', 'msg91Sender', 'emailStatus', 'twitterStatus', 'twitterKeys', 'zohoStatus', 'zohoKey', 'rzpStatus', 'rzpKeys', 'mailchimpSetting', 'mailchimpKey', 'termsStatus', 'termsUrl', 'pipedriveKey', 'pipedriveStatus')); + return view('themes.default1.common.apikey', compact('model', 'status', 'licenseSecret', 'licenseUrl', 'siteKey', 'secretKey', 'captchaStatus', 'updateStatus', 'updateSecret', 'updateUrl', 'mobileStatus', 'mobileauthkey', 'msg91Sender', 'emailStatus', 'twitterStatus', 'twitterKeys', 'zohoStatus', 'zohoKey', 'rzpStatus', 'rzpKeys', 'mailchimpSetting', 'mailchimpKey', 'termsStatus', 'termsUrl', 'pipedriveKey', 'pipedriveStatus', 'domainCheckStatus')); } catch (\Exception $ex) { return redirect('/')->with('fails', $ex->getMessage()); } 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..e086fffb34 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; @@ -375,11 +374,12 @@ public function getOrder($id) $product = $order->product()->first(); $price = $product->price()->first(); $licenseStatus = StatusSetting::pluck('license_status')->first(); + $allowDomainStatus = StatusSetting::pluck('domain_check')->first(); $user = \Auth::user(); return view( 'themes.default1.front.clients.show-order', - compact('invoice', 'order', 'user', 'plan', 'product', 'subscription', 'licenseStatus', 'installationDetails') + compact('invoice', 'order', 'user', 'plan', 'product', 'subscription', 'licenseStatus', 'installationDetails', 'allowDomainStatus') ); } catch (Exception $ex) { Bugsnag::notifyException($ex); diff --git a/app/Http/Controllers/License/LicenseController.php b/app/Http/Controllers/License/LicenseController.php index 55c1c8c702..49472a1a19 100644 --- a/app/Http/Controllers/License/LicenseController.php +++ b/app/Http/Controllers/License/LicenseController.php @@ -153,8 +153,12 @@ 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"); } /* @@ -175,6 +179,33 @@ 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) { $requiredomain = 0; @@ -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/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/ExtendedOrderController.php b/app/Http/Controllers/Order/ExtendedOrderController.php index 485e53d00a..f022a46aad 100644 --- a/app/Http/Controllers/Order/ExtendedOrderController.php +++ b/app/Http/Controllers/Order/ExtendedOrderController.php @@ -332,6 +332,26 @@ public function changeDomain(Request $request) return ['message' => 'success', 'update'=>'Licensed Domain Updated']; } + public function reissueLicense(Request $request) + { + $order = Order::findorFail($request->input('id')); + $order->domain = ''; + $licenseCode = $order->serial_key; + $order->save(); + $licenseStatus = StatusSetting::pluck('license_status')->first(); + if ($licenseStatus == 1) { + $licenseExpiry = $order->subscription->ends_at; + $updatesExpiry = $order->subscription->update_ends_at; + $supportExpiry = $order->subscription->support_ends_at; + $cont = new \App\Http\Controllers\License\LicenseController(); + $updateLicensedDomain = $cont->updateLicensedDomain($licenseCode, $order->domain, $order->product, $licenseExpiry, $updatesExpiry, $supportExpiry, $order->number); + //Now make Installation status as inactive + $updateInstallStatus = $cont->updateInstalledDomain($licenseCode, $order->product); + } + + return ['message' => 'success', 'update'=>'License Reissued']; + } + public function getAllowedDomains($seperateDomains) { $needle = 'www'; diff --git a/app/Http/Controllers/Order/InvoiceController.php b/app/Http/Controllers/Order/InvoiceController.php index dc98629415..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 { @@ -247,7 +246,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/app/Http/Controllers/Order/OrderController.php b/app/Http/Controllers/Order/OrderController.php index 50f938fb26..365c1c57ef 100755 --- a/app/Http/Controllers/Order/OrderController.php +++ b/app/Http/Controllers/Order/OrderController.php @@ -229,9 +229,10 @@ public function show($id) $cont = new \App\Http\Controllers\License\LicenseController(); $installationDetails = $cont->searchInstallationPath($order->serial_key, $order->product); } + $allowDomainStatus = StatusSetting::pluck('domain_check')->first(); return view('themes.default1.order.show', - compact('invoiceItems', 'invoice', 'user', 'order', 'subscription', 'licenseStatus', 'installationDetails')); + compact('invoiceItems', 'invoice', 'user', 'order', 'subscription', 'licenseStatus', 'installationDetails', 'allowDomainStatus')); } catch (\Exception $ex) { Bugsnag::notifyException($ex); 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/StatusSetting.php b/app/Model/Common/StatusSetting.php index 7ec7553c7c..d0f4f8fcc9 100644 --- a/app/Model/Common/StatusSetting.php +++ b/app/Model/Common/StatusSetting.php @@ -8,5 +8,5 @@ class StatusSetting extends Model { protected $table = 'status_settings'; public $timestamps = false; - protected $fillable = ['expiry_mail', 'activity_log_delete', 'license_status', 'github_status', 'mailchimp_status', 'twitter_status', 'msg91_status', 'emailverification_status', 'recaptcha_status', 'update_status', 'zoho_status', 'rzp_status', 'mailchimp_product_status', 'mailchimp_ispaid_status', 'terms', 'pipedrive_status']; + protected $fillable = ['expiry_mail', 'activity_log_delete', 'license_status', 'github_status', 'mailchimp_status', 'twitter_status', 'msg91_status', 'emailverification_status', 'recaptcha_status', 'update_status', 'zoho_status', 'rzp_status', 'mailchimp_product_status', 'mailchimp_ispaid_status', 'terms', 'pipedrive_status', 'domain_check']; } 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/app/Traits/ApiKeySettings.php b/app/Traits/ApiKeySettings.php index a48d3eea58..74f439fd71 100644 --- a/app/Traits/ApiKeySettings.php +++ b/app/Traits/ApiKeySettings.php @@ -75,6 +75,17 @@ public function updateEmailDetails(Request $request) return ['message' => 'success', 'update'=>'Email Verification Status Updated']; } + /* + * Update Domain Check status In Database + */ + public function updatedomainCheckDetails(Request $request) + { + $status = $request->input('status'); + StatusSetting::find(1)->update(['domain_check'=>$status]); + + return ['message' => 'success', 'update'=>'Domain Check Status Updated']; + } + /* * Update Twitter Details In Database */ diff --git a/config/app.php b/config/app.php index 3ca147fc99..76918374c0 100644 --- a/config/app.php +++ b/config/app.php @@ -14,7 +14,7 @@ 'name' => env('APP_NAME', 'Laravel'), - 'version' => 'v1.0.27', + 'version' => 'v1.0.28', /* |-------------------------------------------------------------------------- diff --git a/database/migrations/2019_07_08_095503_add_allow_domain_check_to_status_settings.php b/database/migrations/2019_07_08_095503_add_allow_domain_check_to_status_settings.php new file mode 100644 index 0000000000..a3663355f7 --- /dev/null +++ b/database/migrations/2019_07_08_095503_add_allow_domain_check_to_status_settings.php @@ -0,0 +1,30 @@ +boolean('domain_check')->default(0); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('status_settings'); + } +} 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/package.json b/package.json deleted file mode 100644 index 630a2442cf..0000000000 --- a/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "private": true, - "scripts": { - "dev": "npm run development", - "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", - "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", - "watch-poll": "npm run watch -- --watch-poll", - "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", - "prod": "npm run production", - "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" - }, - "devDependencies": { - "axios": "^0.16.2", - "bootstrap-sass": "^3.3.7", - "cross-env": "^5.0.1", - "jquery": "^3.1.1", - "laravel-mix": "^1.0", - "lodash": "^4.17.4", - "vue": "^2.1.10" - } -} diff --git a/resources/views/themes/default1/common/apikey.blade.php b/resources/views/themes/default1/common/apikey.blade.php index bb63d4de5f..9fce2dcac3 100644 --- a/resources/views/themes/default1/common/apikey.blade.php +++ b/resources/views/themes/default1/common/apikey.blade.php @@ -138,6 +138,27 @@ class="checkbox" id="License"> + + + Don't Allow Domin/Ip based Restriction + + + + + + + Not Available + + + + + + @@ -1324,5 +1345,43 @@ function captchaDetails(){ }); + /* + * Domain Check Setting + */ + $(document).ready(function (){ + var domainstatus = $('.checkbox15').val(); + if(domainstatus ==1) + { + $('#domain').prop('checked',true); + } else if(domainstatus ==0){ + $('#domain').prop('checked',false); + } + }); + //Validate and pass value through ajax + $("#submit14").on('click',function (){ //When Submit button is checked + if ($('#domain').prop('checked')) {//if button is on + var domainstatus = 1; + } else { + var domainstatus = 0; + } + $("#submit14").html("Please Wait..."); + $.ajax ({ + url: '{{url("updatedomainCheckDetails")}}', + type : 'get', + data: { + "status": domainstatus, + }, + success: function (data) { + $('#alertMessage').show(); + var result = '
Success! '+data.update+'.
'; + $('#alertMessage').html(result+ "."); + $("#submit14").html("  Save"); + setInterval(function(){ + $('#alertMessage').slideUp(3000); + }, 1000); + }, + }); + }); + @stop \ No newline at end of file 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/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 @@