Permalink
Browse files

Merge pull request #194 from tarasfrompir/master

Исправлена функция для создания Хост Онлайн.
  • Loading branch information...
T-REX-XP committed Jul 9, 2018
2 parents 5a98a8c + d79a29a commit e27668f87d2ad8753e2919053d3423be68ce44b5
Showing with 7 additions and 8 deletions.
  1. +2 −6 modules/ssdp_finder/ssdp_devices_search.inc.php
  2. +5 −2 modules/ssdp_finder/ssdp_finder.class.php
@@ -28,13 +28,9 @@
for($i=0;$i<$total;$i++) {
// some action for every record if required
$ip = $res[$i]['ADDRESS'];
$ip = $res[$i]['CONTROLADDRESS'];
if($ip){
$ip = parse_url($ip)['host'];
$table_name='pinghosts';
$pingHostExist=SQLSelectOne("SELECT * FROM $table_name WHERE HOSTNAME='$ip'");
$pingHostExist=SQLSelectOne("SELECT * FROM pinghosts WHERE HOSTNAME LIKE '".$ip."'");
if($pingHostExist && $pingHostExist['ID']){
$res[$i]['DEVICE_ONLINE_ID'] = $pingHostExist['ID'];
}
@@ -390,10 +390,11 @@ function add_to_pinghost($id) {
$ssdpdevice=SQLSelectOne("SELECT * FROM ssdp_devices WHERE ID='".$id."'");
$pinghosts=array(); // опции добавления
$pinghosts['TITLE'] = $ssdpdevice['TITLE'];
$pinghosts['TYPE'] = '0';
$pinghosts['TYPE'] = '1';
$pinghosts['SEARCH_WORD'] = $ssdpdevice['UUID'];
$pinghosts['OFFLINE_INTERVAL'] = '600';
$pinghosts['ONLINE_INTERVAL'] = '600';
$pinghosts['HOSTNAME'] = $this->getIp($ssdpdevice['ADDRESS'],false);
$pinghosts['HOSTNAME'] = $ssdpdevice['CONTROLADDRESS'];;
$pinghosts['CODE_OFFLINE'] = 'say("Устройство ".$host[\'TITLE\']." пропало из сети, возможно его отключили" ,2);';
$pinghosts['CODE_ONLINE'] = 'say("Устройство ".$host[\'TITLE\']." появилось в сети." ,2);';
$pinghosts['LINKED_OBJECT'] = $ssdpdevice['LINKED_OBJECT'];
@@ -503,6 +504,7 @@ function processSubscription($event, $details='') {
*/
function install($data='') {
// подписки на события
subscribeToEvent($this->name, 'SAYREPLY','',20);
subscribeToEvent($this->name, 'SAYTO','',20);
subscribeToEvent($this->name, 'ASK','',20);
subscribeToEvent($this->name, 'SAY','',20);
@@ -532,6 +534,7 @@ function uninstall() {
unsubscribeFromEvent($this->name, 'SAY');
unsubscribeFromEvent($this->name, 'SAYTO');
unsubscribeFromEvent($this->name, 'ASK');
unsubscribeFromEvent($this->name, 'SAYREPLY');
//delete ssdp_finder module
parent::uninstall();

0 comments on commit e27668f

Please sign in to comment.