mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge branch 'develop' of github.com:invoiceninja/invoiceninja into develop
This commit is contained in:
commit
f8032f04b2
@ -184,12 +184,10 @@ class AccountApiController extends BaseAPIController
|
|||||||
|
|
||||||
$devices = json_decode($account->devices, true);
|
$devices = json_decode($account->devices, true);
|
||||||
|
|
||||||
foreach($devices as $key => $value)
|
for($x=0; $x<count($devices); $x++)
|
||||||
{
|
{
|
||||||
|
if($request->token == $devices[$x]['token'])
|
||||||
if($request->token == $value['token'])
|
unset($devices[$x]);
|
||||||
unset($devices[$key]);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$account->devices = json_encode(array_values($devices));
|
$account->devices = json_encode(array_values($devices));
|
||||||
|
@ -13,21 +13,24 @@ class Cloudflare
|
|||||||
$zones = json_decode(env('CLOUDFLARE_ZONE_IDS',''), true);
|
$zones = json_decode(env('CLOUDFLARE_ZONE_IDS',''), true);
|
||||||
|
|
||||||
foreach($zones as $zone)
|
foreach($zones as $zone)
|
||||||
|
{
|
||||||
|
|
||||||
|
if($account->subdomain != "")
|
||||||
{
|
{
|
||||||
|
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
$jsonEncodedData = json_encode(['type'=>'A', 'name'=>$account->subdomain, 'content'=>env('CLOUDFLARE_TARGET_IP_ADDRESS',''),'proxied'=>true]);
|
$jsonEncodedData = json_encode(['type' => 'A', 'name' => $account->subdomain, 'content' => env('CLOUDFLARE_TARGET_IP_ADDRESS', ''), 'proxied' => true]);
|
||||||
|
|
||||||
$opts = [
|
$opts = [
|
||||||
CURLOPT_URL => 'https://api.cloudflare.com/client/v4/zones/'.$zone.'/dns_records',
|
CURLOPT_URL => 'https://api.cloudflare.com/client/v4/zones/' . $zone . '/dns_records',
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||||
CURLOPT_POST => 1,
|
CURLOPT_POST => 1,
|
||||||
CURLOPT_POSTFIELDS => $jsonEncodedData,
|
CURLOPT_POSTFIELDS => $jsonEncodedData,
|
||||||
CURLOPT_HTTPHEADER => [ 'Content-Type: application/json',
|
CURLOPT_HTTPHEADER => ['Content-Type: application/json',
|
||||||
'Content-Length: '.strlen($jsonEncodedData),
|
'Content-Length: ' . strlen($jsonEncodedData),
|
||||||
'X-Auth-Email: '.env('CLOUDFLARE_EMAIL', ''),
|
'X-Auth-Email: ' . env('CLOUDFLARE_EMAIL', ''),
|
||||||
'X-Auth-Key: '.env('CLOUDFLARE_API_KEY', '')
|
'X-Auth-Key: ' . env('CLOUDFLARE_API_KEY', '')
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -39,7 +42,9 @@ class Cloudflare
|
|||||||
curl_close($curl);
|
curl_close($curl);
|
||||||
|
|
||||||
if ($status != 200)
|
if ($status != 200)
|
||||||
Utils::logError('unable to update subdomain ' . $account->subdomain . ' @ Cloudflare - '.$result);
|
Utils::logError('unable to update subdomain ' . $account->subdomain . ' @ Cloudflare - ' . $result);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user