Skip to content

Commit d7edc60

Browse files
author
Rafael Grigorian
committed
Fixed #61 & Closes #64
1 parent 1641bd2 commit d7edc60

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

Controller/Adminhtml/Api/Caching/PurgeCache/Everything.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Everything extends Action {
2323
*/
2424
public function execute () {
2525
$response = $this->_api->purgeEverything ();
26-
if ( isset ( $response->success ) && $response->success ) {
26+
if ( is_object ( $response ) && isset ( $response->success ) && $response->success ) {
2727
$response->messages = array_merge (
2828
array (
2929
"Successfully purged all assets. Please allow up to " .

Controller/Adminhtml/Api/Caching/PurgeCache/Hostname.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Hostname extends Action {
2323
public function execute () {
2424
$items = $this->_request->getParam ("items");
2525
$response = $this->_api->purgeHosts ( $items );
26-
if ( isset ( $response->success ) && $response->success ) {
26+
if ( is_object ( $response ) && isset ( $response->success ) && $response->success ) {
2727
$response->messages = array_merge (
2828
array (
2929
"Successfully purged assets. Please allow up to 30 " .

Controller/Adminhtml/Api/Caching/PurgeCache/Prefix.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Prefix extends Action {
2323
public function execute () {
2424
$items = $this->_request->getParam ("items");
2525
$response = $this->_api->purgePrefixes ( $items );
26-
if ( isset ( $response->success ) && $response->success ) {
26+
if ( is_object ( $response ) && isset ( $response->success ) && $response->success ) {
2727
$response->messages = array_merge (
2828
array (
2929
"Successfully purged assets. Please allow up to 30 " .

Controller/Adminhtml/Api/Caching/PurgeCache/Tag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Tag extends Action {
2323
public function execute () {
2424
$items = $this->_request->getParam ("items");
2525
$response = $this->_api->purgeTags ( $items );
26-
if ( isset ( $response->success ) && $response->success ) {
26+
if ( is_object ( $response ) && isset ( $response->success ) && $response->success ) {
2727
$response->messages = array_merge (
2828
array (
2929
"Successfully purged assets. Please allow up to 30 " .

Controller/Adminhtml/Api/Caching/PurgeCache/Url.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Url extends Action {
2323
public function execute () {
2424
$items = $this->_request->getParam ("items");
2525
$response = $this->_api->purgeUrls ( $items );
26-
if ( isset ( $response->success ) && $response->success ) {
26+
if ( is_object ( $response ) && isset ( $response->success ) && $response->success ) {
2727
$response->messages = array_merge (
2828
array (
2929
"Successfully purged assets. Please allow up to 30 " .

Model/Adminhtml/Api/Dns/CloudflareNameservers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class CloudflareNameservers extends Getter {
3232
*/
3333
public function getValue () {
3434
$response = parent::getValue ();
35-
if ( isset ( $response->success ) && $response->success ) {
35+
if ( is_object ( $response ) && isset ( $response->success ) && $response->success ) {
3636
$response->result = $response->result->name_servers;
3737
}
3838
return $response;

Model/Adminhtml/Api/Overview/Configuration.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ public function __construct (
4040
public function validateAuth () {
4141
$this->_request->setType ( Request::REQUEST_GET );
4242
$response = $this->_request->resolve ("user/tokens/verify");
43-
if ( !isset ( $response->success ) && $response->success ) {
44-
return false;
43+
if ( is_object ( $response ) && isset ( $response->success ) && $response->success ) {
44+
$zone = $this->getZoneId ();
45+
$response = $this->_request->resolve ("zones/$zone");
46+
return is_object ( $response ) && isset ( $response->success ) && $response->success;
4547
}
46-
$zone = $this->getZoneId ();
47-
$response = $this->_request->resolve ("zones/$zone");
48-
return isset ( $response->success ) && $response->success;
48+
return false;
4949
}
5050

5151
/**

Model/Adminhtml/Api/Speed/Polish.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function change ( $value, $webp ) {
6060
$this->_requestModel->setData ( array ( "value" => $value ) );
6161
$response = $this->_requestModel->resolve ( $endpoint );
6262
$zoneId = $this->_configurationModel->getZoneId ();
63-
if ( isset ( $response->success ) && $response->success && $value != "off" ) {
63+
if ( is_object ( $response ) && isset ( $response->success ) && $response->success && $value != "off" ) {
6464
$endpoint = sprintf ( "zones/%s/settings/webp", $zoneId );
6565
$this->_requestModel->setType ( Request::REQUEST_PATCH );
6666
$this->_requestModel->setData ( array (

0 commit comments

Comments
 (0)