mirror of
https://github.com/ZeJMaN/LBCAlerte_ynh.git
synced 2025-07-26 05:10:49 +02:00
Upgrade LBCAlerte to version 3.3
Add upgrade script
This commit is contained in:
@ -7,6 +7,7 @@ class User
|
||||
protected $_id;
|
||||
protected $_username;
|
||||
protected $_password;
|
||||
protected $_api_key;
|
||||
protected $_options = array();
|
||||
protected $_optionsLoaded = false;
|
||||
|
||||
@ -21,6 +22,9 @@ class User
|
||||
if (isset($options["password"])) {
|
||||
$this->setPassword($options["password"]);
|
||||
}
|
||||
if (isset($options["api_key"])) {
|
||||
$this->setApiKey($options["api_key"]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,6 +66,24 @@ class User
|
||||
return $this->_username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @return User
|
||||
*/
|
||||
public function setApiKey($key)
|
||||
{
|
||||
$this->_api_key = $key;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getApiKey()
|
||||
{
|
||||
return $this->_api_key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $password
|
||||
* @return User
|
||||
@ -81,48 +103,58 @@ class User
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne vrai si la notification SMS Free Mobile est activée.
|
||||
* Indique si au moins un service de notification est activé.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasSMSFreeMobile()
|
||||
public function hasNotification()
|
||||
{
|
||||
return false != $this->getOption("notification.freeMobile");
|
||||
$notifications = $this->getOption("notification");
|
||||
if (!$notifications || !is_array($notifications)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($notifications AS $name => $params) {
|
||||
if (is_array($params) && !empty($params["active"])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne vrai si la notification SMS OVH est activée.
|
||||
* @return boolean
|
||||
* Retourne les systèmes d'alerte activés.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function hasSMSOvh()
|
||||
public function getNotificationsEnabled()
|
||||
{
|
||||
return false != $this->getOption("notification.ovh");
|
||||
$notifications = $this->getOption("notification");
|
||||
if (!$notifications || !is_array($notifications)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$notifications_enabled = array();
|
||||
foreach ($notifications AS $name => $params) {
|
||||
if (is_array($params) && !empty($params["active"])) {
|
||||
$notifications_enabled[$name] = $params;
|
||||
}
|
||||
}
|
||||
|
||||
return $notifications_enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne vrai si la notification Pushbullet est activée.
|
||||
* Indique si un système d'alerte est actif ou non.
|
||||
*
|
||||
* @param string $name
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasPushbullet()
|
||||
public function notificationEnabled($name)
|
||||
{
|
||||
return false != $this->getOption("notification.pushbullet");
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne vrai si la notification NotifyMyAndroid est activée.
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasNotifyMyAndroid()
|
||||
{
|
||||
return false != $this->getOption("notification.notifymyandroid");
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne vrai si la notification Pushover est activée.
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasPushover()
|
||||
{
|
||||
return false != $this->getOption("notification.pushover");
|
||||
$params = $this->getOption("notification.".$name);
|
||||
return is_array($params) && !empty($params["active"]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user