Skip to content

Commit

Permalink
Merge pull request #848 from ladybirdweb/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Ashutosh pathak authored Jul 15, 2019
2 parents f10d448 + 925ff0c commit 0b2a8ff
Show file tree
Hide file tree
Showing 34 changed files with 307 additions and 97 deletions.
11 changes: 6 additions & 5 deletions app/Http/Controllers/Api/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,25 @@ 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);
// }

$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();

Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Common/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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());
}
Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/Front/BaseClientController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/Front/CheckoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Front/ClientController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
41 changes: 34 additions & 7 deletions app/Http/Controllers/License/LicenseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

/*
Expand All @@ -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 <[email protected]>
*
* @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;
Expand All @@ -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)
Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/Order/BaseInvoiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Bugsnag;
use Exception;
use Illuminate\Http\Request;
use Log;

class ExtendedBaseInvoiceController extends Controller
{
Expand Down
20 changes: 20 additions & 0 deletions app/Http/Controllers/Order/ExtendedOrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/Order/InvoiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
use Bugsnag;
use Illuminate\Http\Request;
use Input;
use Log;

class InvoiceController extends TaxRatesAndCodeExpiryController
{
Expand Down Expand Up @@ -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'));
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Controllers/Order/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/Payment/BasePromotionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/User/ClientController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use DateTime;
use DateTimeZone;
use Illuminate\Http\Request;
use Log;

class ClientController extends AdvanceSearchController
{
Expand Down
2 changes: 1 addition & 1 deletion app/Model/Common/StatusSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
}
1 change: 0 additions & 1 deletion app/Model/Common/Website.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Model\Common;

use App\BaseModel;
use App\User;
use LinkThrow\Billing\SubscriptionBillableTrait;

class Website extends BaseModel
Expand Down
1 change: 0 additions & 1 deletion app/Plugins/Paypal/config.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php


return [

'name' => 'Paypal',
Expand Down
11 changes: 11 additions & 0 deletions app/Traits/ApiKeySettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

'name' => env('APP_NAME', 'Laravel'),

'version' => 'v1.0.27',
'version' => 'v1.0.28',

/*
|--------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddAllowDomainCheckToStatusSettings extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('status_settings', function (Blueprint $table) {
$table->boolean('domain_check')->default(0);
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('status_settings');
}
}
2 changes: 0 additions & 2 deletions database/seeds/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
21 changes: 0 additions & 21 deletions package.json

This file was deleted.

Loading

0 comments on commit 0b2a8ff

Please sign in to comment.