|
|
@@ -5,7 +5,7 @@ trait UnifiHomepageItem
|
|
|
public function unifiSettingsArray()
|
|
|
{
|
|
|
return array(
|
|
|
- 'name' => 'Unifi',
|
|
|
+ 'name' => 'UniFi',
|
|
|
'enabled' => true,
|
|
|
'image' => 'plugins/images/tabs/ubnt.png',
|
|
|
'category' => 'Monitor',
|
|
|
@@ -92,7 +92,7 @@ trait UnifiHomepageItem
|
|
|
)
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function unifiHomepagePermissions($key = null)
|
|
|
{
|
|
|
$permissions = [
|
|
|
@@ -118,7 +118,7 @@ trait UnifiHomepageItem
|
|
|
return [];
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function homepageOrderunifi()
|
|
|
{
|
|
|
if ($this->homepageItemPermissions($this->unifiHomepagePermissions('main'))) {
|
|
|
@@ -134,7 +134,7 @@ trait UnifiHomepageItem
|
|
|
';
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function getUnifiSiteName()
|
|
|
{
|
|
|
if (empty($this->config['unifiURL'])) {
|
|
|
@@ -183,9 +183,9 @@ trait UnifiHomepageItem
|
|
|
$this->setAPIResponse('error', $e->getMessage(), 500);
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function testConnectionUnifi()
|
|
|
{
|
|
|
if (empty($this->config['unifiURL'])) {
|
|
|
@@ -227,7 +227,7 @@ trait UnifiHomepageItem
|
|
|
$cookie['csrf_token'] = ($response->cookies['csrf_token']->value) ?? false;
|
|
|
$cookie['Token'] = ($response->cookies['Token']->value) ?? false;
|
|
|
$options['cookies'] = $response->cookies;
|
|
|
-
|
|
|
+
|
|
|
} else {
|
|
|
$this->setAPIResponse('error', 'Unifi response error - Check Credentials', 409);
|
|
|
return false;
|
|
|
@@ -251,7 +251,7 @@ trait UnifiHomepageItem
|
|
|
$this->setAPIResponse('success', 'API Connection succeeded', 200);
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function getUnifiHomepageData()
|
|
|
{
|
|
|
if (!$this->homepageItemPermissions($this->unifiHomepagePermissions('main'), true)) {
|
|
|
@@ -284,7 +284,7 @@ trait UnifiHomepageItem
|
|
|
$cookie['csrf_token'] = ($response->cookies['csrf_token']->value) ?? false;
|
|
|
$cookie['Token'] = ($response->cookies['Token']->value) ?? false;
|
|
|
$options['cookies'] = $response->cookies;
|
|
|
-
|
|
|
+
|
|
|
} else {
|
|
|
$this->setAPIResponse('error', 'Unifi response error - Check Credentials', 409);
|
|
|
return false;
|