+ /**
+ * check if we are logged in
+ *
+ * @return boolean
+ */
+ public function checkLogin () {
+ if (empty($this->challenge) && empty($this->session)) {
+ return false;
+ }
+
+ $path = 'data/SecureStatus.json';
+ $fields = array();
+ $data = $this->sentRequest($path, $fields, true);
+
+ if (empty($data['body'])) {
+ throw new Exception('unable to get SecureStatus data');
+ }
+
+ $json = json_decode($data['body'], true);
+ $json = $this->getValues($json);
+
+ if ($json['loginstate'] != 1) {
+ return false;
+ }
+
+ return true;
+ }
+