Permalink
Browse files

Merge pull request #254 from tarasfrompir/master

Исправлен переход на страницу модуля
  • Loading branch information...
T-REX-XP committed Aug 23, 2018
2 parents f6d4408 + 3fcb722 commit d793281e2691452da50abdb0938a59db2c1c784f
Showing with 40 additions and 2 deletions.
  1. +8 −2 modules/ssdp_finder/ssdp_devices_edit.inc.php
  2. +32 −0 modules/ssdp_finder/update_methods.inc.php
@@ -7,6 +7,8 @@
}
$table_name='ssdp_devices';
$rec=SQLSelectOne("SELECT * FROM $table_name WHERE ID='$id'");
// режим сохранения устройств
if ($this->mode=='update') {
$ok=1;
//updating '<%LANG_TITLE%>' (varchar, required)
@@ -96,7 +98,11 @@
} else {
$out['ERR']=1;
}
// после сохранения устройства переходим на основную страницу
$this->redirect("?");
}
// режим добваления устройств
if ($this->mode=='add') {
$ok=0;
//updating '<%LANG_TITLE%>' (varchar, required)
@@ -108,8 +114,7 @@
//$out["LOGO"] =
$ok=0;
}
session_start();
session_start();
global $create_sd;
global $create_od;
global $create_term;
@@ -186,6 +191,7 @@
} else {
$out['ERR']=1;
}
}
@@ -1 +1,33 @@
<?php
/*
* @version 0.1 (wizard)
*/
// delete all SSDP devices from majordomo
$rec=SQLSelect("SELECT ID FROM ssdp_devices");
foreach ($rec as $id) {
$rec_type=SQLSelectOne("SELECT * FROM ssdp_devices WHERE ID='".$id['ID']."'");
$device_type = $rec_type['TYPE'];
// записываем шаблон для устройства
$current = file_get_contents('https://raw.githubusercontent.com/tarasfrompir/SSDPDrivers/master/templates/classes/views/S'.$device_type.'.html');
file_put_contents(ROOT.'/templates/classes/views/S'.$device_type.'.html', $current);
// записываем methods для устройства
$device = SQLSelectOne("SELECT * FROM classes WHERE TITLE LIKE 'S".$device_type."'");
$methods = SQLSelect("SELECT * FROM methods WHERE CLASS_ID='".$device['ID']."'");
foreach ($methods as $method) {
$current = file_get_contents('https://raw.githubusercontent.com/tarasfrompir/SSDPDrivers/master/modules/devices/S'.$device_type.'_'.$method['TITLE'].'.php');
file_put_contents(ROOT.'/modules/devices/S'.$device_type.'_'.$method['TITLE'].'.php', $current);
};
// записываем управляющий класс для устройства
$current = file_get_contents('https://raw.githubusercontent.com/tarasfrompir/SSDPDrivers/master/modules/ssdp_finder/upnp/vendor/jalder/upnp/src/'.$device_type.'.php');
file_put_contents(ROOT.'/modules/ssdp_finder/upnp/vendor/jalder/upnp/src/'.$device_type.'.php', $current);
if (!file_exists(ROOT.'/modules/ssdp_finder/upnp/vendor/jalder/upnp/src/'.$device_type)){
mkdir(ROOT.'/modules/ssdp_finder/upnp/vendor/jalder/upnp/src/'.$device_type, 0777);
}
$current = file_get_contents('https://raw.githubusercontent.com/tarasfrompir/SSDPDrivers/master/modules/ssdp_finder/upnp/vendor/jalder/upnp/src/'.$device_type.'/Remote.php');
file_put_contents(ROOT.'/modules/ssdp_finder/upnp/vendor/jalder/upnp/src/'.$device_type.'/Remote.php', $current);
}

0 comments on commit d793281

Please sign in to comment.