Skip to content

Commit

Permalink
Merge pull request #277 from tarasfrompir/master
Browse files Browse the repository at this point in the history
исправлена функция получения лого
  • Loading branch information
T-REX-XP committed Sep 13, 2018
2 parents 4ec77a0 + 84a75e8 commit a0a2e4d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions modules/ssdp_finder/ssdp_devices_scan.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ function startsWith($haystack, $needle){
function getServices($device){
$result = array();
if(isset($device["serviceList"]["service"]["serviceType"])){
$name = explode(":", $device["serviceList"]["service"]["serviceType"])[3];
$name = explode(":", $device["serviceList"]["service"]["serviceType"])[3].':'.explode(":", $device["serviceList"]["service"]["serviceType"])[4];
array_push($result,$name);
}
else{
foreach($device["serviceList"]["service"] as $type)
{
$name = explode(":", $type["serviceType"])[3];
$name = explode(":", $type["serviceType"])[3].':'.explode(":", $type["serviceType"])[4];
array_push($result,$name);
}
}
Expand Down Expand Up @@ -270,7 +270,12 @@ function getDefImg($control_url,$device) {
$mimetype = isset($arrImg[0]["mimetype"]) ? $arrImg[0]["mimetype"]: $icons[0]["mimetype"];
}
}
$path = $baseUrl . $url;
//иногда ссылка дается полностью с всем адресом
if (substr($url, 0, 4) == "http") {
$path = $url;
} else {
$path = $baseUrl . $url;
};
$current =get_web_page($path);
$type = pathinfo($path, PATHINFO_EXTENSION);
// иногда в ссылке на лого отсутствует расширение файла поэтому пробуем взять его из типа в XML файле
Expand Down
4 changes: 2 additions & 2 deletions modules/ssdp_finder/upnp/vendor/jalder/upnp/src/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function sendRequestToDevice($method, $arguments, $url, $type, $hostIp =
$body ='<?xml version="1.0" encoding="utf-8"?>' . "\r\n";
$body .='<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">';
$body .='<s:Body>';
$body .='<u:'.$method.' xmlns:u="urn:schemas-upnp-org:service:'.$type.':1">';
$body .='<u:'.$method.' xmlns:u="urn:schemas-upnp-org:service:'.$type.'">';
foreach( $arguments as $arg=>$value ) {
$body .='<'.$arg.'>'.$value.'</'.$arg.'>';
}
Expand All @@ -162,7 +162,7 @@ public function sendRequestToDevice($method, $arguments, $url, $type, $hostIp =
'Content-Length: ' . strlen($body),
'Connection: close',
'Content-Type: text/xml; charset="utf-8"',
'SOAPAction: "urn:schemas-upnp-org:service:'.$type.':1#'.$method.'"',
'SOAPAction: "urn:schemas-upnp-org:service:'.$type.'#'.$method.'"',
);

$ch = curl_init();
Expand Down

0 comments on commit a0a2e4d

Please sign in to comment.