@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | /* Config.*/ |
| 44 | -$basedir = dirname(__FILE__) . '/../../upnpdata'; /* File system path. */ |
|
| 45 | -$baseurl = '/upnpdata'; /* WEB URL path. */ |
|
| 44 | +$basedir = dirname(__FILE__).'/../../upnpdata'; /* File system path. */ |
|
| 45 | +$baseurl = '/upnpdata'; /* WEB URL path. */ |
|
| 46 | 46 | |
| 47 | 47 | date_default_timezone_set('UTC'); |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | /* File types. */ |
| 51 | -$file_class = array ( |
|
| 51 | +$file_class = array( |
|
| 52 | 52 | 'm3u' => 'object.container.storageFolder', |
| 53 | 53 | 'xspf' => 'object.container.storageFolder', |
| 54 | 54 | 'xml' => 'object.container.storageFolder', |
@@ -118,12 +118,12 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | |
| 120 | 120 | if (substr($basedir, -1, 1) !== '/') { |
| 121 | - $basedir = $basedir . '/'; |
|
| 121 | + $basedir = $basedir.'/'; |
|
| 122 | 122 | } |
| 123 | 123 | $baseurl = implode('/', array_map('rawurlencode', explode('/', $baseurl))); |
| 124 | -$baseurlpatch = 'http://' . $_SERVER['HTTP_HOST'] . $baseurl; |
|
| 124 | +$baseurlpatch = 'http://'.$_SERVER['HTTP_HOST'].$baseurl; |
|
| 125 | 125 | if ('/' !== substr($baseurlpatch, -1, 1)) { |
| 126 | - $baseurlpatch = $baseurlpatch . '/'; |
|
| 126 | + $baseurlpatch = $baseurlpatch.'/'; |
|
| 127 | 127 | } |
| 128 | 128 | /** |
| 129 | 129 | * Apply workaround for the libxml PHP bugs: |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | # $server = new SoapServer(null, array('uri' => "urn:schemas-upnp-org:service:ContentDirectory:3")); |
| 138 | 138 | $server = new SoapServer(dirname(__FILE__)."/../descr/ContentDirectory.wdsl", |
| 139 | - array( 'cache_wsdl' => WSDL_CACHE_MEMORY, |
|
| 139 | + array('cache_wsdl' => WSDL_CACHE_MEMORY, |
|
| 140 | 140 | 'soap_version' => SOAP_1_2, |
| 141 | 141 | 'trace' => true |
| 142 | 142 | )); |
@@ -145,16 +145,16 @@ discard block |
||
| 145 | 145 | function xml_encode($string) { |
| 146 | 146 | |
| 147 | 147 | return (str_replace( |
| 148 | - array("&", "<", ">", /*'"',*/ "'"), |
|
| 149 | - array("&", "<", ">", /*""",*/ "'"), |
|
| 148 | + array("&", "<", ">", /*'"',*/ "'"), |
|
| 149 | + array("&", "<", ">", /*""",*/ "'"), |
|
| 150 | 150 | $string)); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | function xml_decode($string) { |
| 154 | 154 | |
| 155 | 155 | return (str_replace( |
| 156 | - array("&", "<", ">", """, "'"), |
|
| 157 | - array("&", "<", ">", '"', "'"), |
|
| 156 | + array("&", "<", ">", """, "'"), |
|
| 157 | + array("&", "<", ">", '"', "'"), |
|
| 158 | 158 | $string)); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | //return (xml_encode($url)); |
| 169 | 169 | //return ('<![CDATA[' . xml_encode($url) . ']]'); |
| 170 | 170 | |
| 171 | - return (substr($url, 0, $url_path_off) . implode('/', array_map('rawurlencode', explode('/', substr($url, $url_path_off))))); |
|
| 171 | + return (substr($url, 0, $url_path_off).implode('/', array_map('rawurlencode', explode('/', substr($url, $url_path_off))))); |
|
| 172 | 172 | //return (substr($url, 0, $url_path_off) . xml_encode(implode('/', array_map('rawurlencode', explode('/', substr($url, $url_path_off)))))); |
| 173 | 173 | //return (substr($url, 0, $url_path_off) . xml_encode(substr($url, $url_path_off))); |
| 174 | 174 | //return ('<![CDATA[$url]]'); |
@@ -221,9 +221,9 @@ discard block |
||
| 221 | 221 | $entry = trim(fgets($fd)); |
| 222 | 222 | if (false === strpos($entry, '://')) |
| 223 | 223 | continue; |
| 224 | - $items_count ++; |
|
| 224 | + $items_count++; |
|
| 225 | 225 | } |
| 226 | - fclose ($fd); |
|
| 226 | + fclose($fd); |
|
| 227 | 227 | |
| 228 | 228 | return ($items_count); |
| 229 | 229 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $res = date('Y-m-d', $timedate); |
| 304 | 304 | |
| 305 | 305 | if (1 === $format) { |
| 306 | - $res = $res . 'T' . date('H:i:s', $timedate); |
|
| 306 | + $res = $res.'T'.date('H:i:s', $timedate); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | return ($res); |
@@ -364,14 +364,14 @@ discard block |
||
| 364 | 364 | function Browse($ObjectID, $BrowseFlag, $Filter, $StartingIndex, |
| 365 | 365 | $RequestedCount, $SortCriteria) { |
| 366 | 366 | global $basedir, $baseurl, $baseurlpatch; |
| 367 | - $Result = '<DIDL-Lite' . |
|
| 368 | - ' xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"' . |
|
| 369 | - ' xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/"' . |
|
| 370 | - ' xmlns:dc="http://purl.org/dc/elements/1.1/"' . |
|
| 371 | - ' xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/"' . |
|
| 372 | - ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . |
|
| 373 | - ' xsi:schemaLocation="' . |
|
| 374 | - 'urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/ http://www.upnp.org/schemas/av/didl-lite.xsd ' . |
|
| 367 | + $Result = '<DIDL-Lite'. |
|
| 368 | + ' xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"'. |
|
| 369 | + ' xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/"'. |
|
| 370 | + ' xmlns:dc="http://purl.org/dc/elements/1.1/"'. |
|
| 371 | + ' xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/"'. |
|
| 372 | + ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'. |
|
| 373 | + ' xsi:schemaLocation="'. |
|
| 374 | + 'urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/ http://www.upnp.org/schemas/av/didl-lite.xsd '. |
|
| 375 | 375 | 'urn:schemas-upnp-org:metadata-1-0/upnp/ http://www.upnp.org/schemas/av/upnp.xsd">'; |
| 376 | 376 | $ParentID = '-1'; |
| 377 | 377 | $NumberReturned = 0; |
@@ -395,12 +395,12 @@ discard block |
||
| 395 | 395 | } else { |
| 396 | 396 | $dir = rawurldecode(xml_decode($ObjectID)); |
| 397 | 397 | if ('/' !== substr($dir, -1, 1)) { |
| 398 | - $dir = $dir . '/'; |
|
| 398 | + $dir = $dir.'/'; |
|
| 399 | 399 | } |
| 400 | 400 | /* Sec check: .. in path */ |
| 401 | 401 | $dotdotdir = ''; |
| 402 | 402 | $dirnames = explode('/', $dir); |
| 403 | - for ($di = 0; $di < sizeof($dirnames); $di ++) { |
|
| 403 | + for ($di = 0; $di < sizeof($dirnames); $di++) { |
|
| 404 | 404 | if ('.' === $dirnames[$di]) |
| 405 | 405 | continue; |
| 406 | 406 | if ('..' === $dirnames[$di]) { |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | break; |
| 409 | 409 | } |
| 410 | 410 | if ((sizeof($dirnames) - 1) > $di) { |
| 411 | - $dotdotdir = $dotdotdir . $dirnames[$di] . '/'; |
|
| 411 | + $dotdotdir = $dotdotdir.$dirnames[$di].'/'; |
|
| 412 | 412 | } |
| 413 | 413 | } |
| 414 | 414 | $dir = $dotdotdir; |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | /* Is file/dir exist? */ |
| 432 | 432 | $stat = stat($filename); |
| 433 | 433 | if (false === $stat) { /* No such file/dir. */ |
| 434 | - return (array( 'Result' => '', |
|
| 434 | + return (array('Result' => '', |
|
| 435 | 435 | 'NumberReturned' => 0, |
| 436 | 436 | 'TotalMatches' => 0, |
| 437 | 437 | 'UpdateID' => $UpdateID)); |
@@ -459,45 +459,45 @@ discard block |
||
| 459 | 459 | $StorageFree = disk_free_space($filename); |
| 460 | 460 | $StorageUsed = ($StorageTotal - $StorageFree); |
| 461 | 461 | $ChildCount = (count(scandir($filename)) - 2); |
| 462 | - $Result = $Result . |
|
| 463 | - "<container id=\"$ObjectID\" parentID=\"$ParentID\" restricted=\"$Restricted\" searchable=\"1\" childCount=\"$ChildCount\">" . |
|
| 464 | - "<dc:title>$title</dc:title>" . |
|
| 465 | - '<upnp:class>object.container.storageFolder</upnp:class>' . |
|
| 466 | - "<upnp:storageTotal>$StorageTotal</upnp:storageTotal>" . |
|
| 467 | - "<upnp:storageFree>$StorageFree</upnp:storageFree>" . |
|
| 468 | - "<upnp:storageUsed>$StorageUsed</upnp:storageUsed>" . |
|
| 462 | + $Result = $Result. |
|
| 463 | + "<container id=\"$ObjectID\" parentID=\"$ParentID\" restricted=\"$Restricted\" searchable=\"1\" childCount=\"$ChildCount\">". |
|
| 464 | + "<dc:title>$title</dc:title>". |
|
| 465 | + '<upnp:class>object.container.storageFolder</upnp:class>'. |
|
| 466 | + "<upnp:storageTotal>$StorageTotal</upnp:storageTotal>". |
|
| 467 | + "<upnp:storageFree>$StorageFree</upnp:storageFree>". |
|
| 468 | + "<upnp:storageUsed>$StorageUsed</upnp:storageUsed>". |
|
| 469 | 469 | "<upnp:writeStatus>$WriteStatus</upnp:writeStatus>"; |
| 470 | 470 | if ('0' === $ObjectID) { |
| 471 | - $Result = $Result . |
|
| 472 | - '<upnp:searchClass includeDerived="1">object.item.audioItem</upnp:searchClass>' . |
|
| 473 | - '<upnp:searchClass includeDerived="1">object.item.imageItem</upnp:searchClass>' . |
|
| 471 | + $Result = $Result. |
|
| 472 | + '<upnp:searchClass includeDerived="1">object.item.audioItem</upnp:searchClass>'. |
|
| 473 | + '<upnp:searchClass includeDerived="1">object.item.imageItem</upnp:searchClass>'. |
|
| 474 | 474 | '<upnp:searchClass includeDerived="1">object.item.videoItem</upnp:searchClass>'; |
| 475 | 475 | } |
| 476 | - $Result = $Result . '</container>'; |
|
| 476 | + $Result = $Result.'</container>'; |
|
| 477 | 477 | } else { /* File or playlist. */ |
| 478 | 478 | $iclass = upnp_get_class($basefilename, 'object.item.videoItem'); |
| 479 | 479 | if ('object.container.storageFolder' === $iclass) { /* Play list as folder! */ |
| 480 | 480 | $ChildCount = m3u_calc_items_count($filename); |
| 481 | - $Result = $Result . |
|
| 482 | - "<container id=\"$ObjectID\" parentID=\"$ParentID\" restricted=\"$Restricted\" searchable=\"1\" childCount=\"$ChildCount\">" . |
|
| 483 | - "<dc:title>$title</dc:title>" . |
|
| 484 | - '<upnp:class>object.container.storageFolder</upnp:class>' . |
|
| 481 | + $Result = $Result. |
|
| 482 | + "<container id=\"$ObjectID\" parentID=\"$ParentID\" restricted=\"$Restricted\" searchable=\"1\" childCount=\"$ChildCount\">". |
|
| 483 | + "<dc:title>$title</dc:title>". |
|
| 484 | + '<upnp:class>object.container.storageFolder</upnp:class>'. |
|
| 485 | 485 | '</container>'; |
| 486 | 486 | } else { |
| 487 | 487 | $date = upnp_date(filectime($filename), 1); |
| 488 | 488 | $size = filesize($filename); |
| 489 | 489 | $mimetype = upnp_mime_content_type($filename); |
| 490 | - $Result = $Result . |
|
| 491 | - "<item id=\"$ObjectID\" parentID=\"$ParentID\" restricted=\"$Restricted\">" . |
|
| 492 | - "<dc:title>$title</dc:title>" . |
|
| 493 | - "<dc:date>$date</dc:date>" . |
|
| 494 | - "<upnp:class>$iclass</upnp:class>" . |
|
| 495 | - "<res size=\"$size\" protocolInfo=\"http-get:*:$mimetype:*\">$ObjectID</res>" . |
|
| 490 | + $Result = $Result. |
|
| 491 | + "<item id=\"$ObjectID\" parentID=\"$ParentID\" restricted=\"$Restricted\">". |
|
| 492 | + "<dc:title>$title</dc:title>". |
|
| 493 | + "<dc:date>$date</dc:date>". |
|
| 494 | + "<upnp:class>$iclass</upnp:class>". |
|
| 495 | + "<res size=\"$size\" protocolInfo=\"http-get:*:$mimetype:*\">$ObjectID</res>". |
|
| 496 | 496 | '</item>'; |
| 497 | 497 | } |
| 498 | 498 | } |
| 499 | - $Result = $Result . '</DIDL-Lite>'; |
|
| 500 | - return (array( 'Result' => $Result, |
|
| 499 | + $Result = $Result.'</DIDL-Lite>'; |
|
| 500 | + return (array('Result' => $Result, |
|
| 501 | 501 | 'NumberReturned' => 1, |
| 502 | 502 | 'TotalMatches' => 1, |
| 503 | 503 | 'UpdateID' => $UpdateID)); |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | $filename = $basedir.$dir; |
| 516 | 516 | $fd = fopen($filename, 'r'); |
| 517 | 517 | if (false === $fd) { |
| 518 | - return (array( 'Result' => '', |
|
| 518 | + return (array('Result' => '', |
|
| 519 | 519 | 'NumberReturned' => 0, |
| 520 | 520 | 'TotalMatches' => 0, |
| 521 | 521 | 'UpdateID' => $UpdateID)); |
@@ -550,14 +550,14 @@ discard block |
||
| 550 | 550 | if (false === strpos($entry, '://')) |
| 551 | 551 | continue; |
| 552 | 552 | /* Ok, item matched and may be returned. */ |
| 553 | - $TotalMatches ++; |
|
| 553 | + $TotalMatches++; |
|
| 554 | 554 | if (0 < $StartingIndex && |
| 555 | 555 | $TotalMatches < $StartingIndex) |
| 556 | 556 | continue; /* Skip first items. */ |
| 557 | 557 | if (0 < $RequestedCount && |
| 558 | 558 | $NumberReturned >= $RequestedCount) |
| 559 | 559 | continue; /* Do not add more than requested. */ |
| 560 | - $NumberReturned ++; |
|
| 560 | + $NumberReturned++; |
|
| 561 | 561 | /* Add item to result. */ |
| 562 | 562 | $title = xml_encode(trim(substr($buffer, (strpos($buffer, ',') + 1)))); |
| 563 | 563 | //$en_entry = upnp_url_encode($entry); |
@@ -565,10 +565,10 @@ discard block |
||
| 565 | 565 | $iclass = upnp_get_class($entry, 'object.item.videoItem.videoBroadcast'); |
| 566 | 566 | $mimetype = 'video/mpeg'; |
| 567 | 567 | if ('object.container.storageFolder' === $iclass) { /* Play list as folder! */ |
| 568 | - $Result = $Result . |
|
| 569 | - "<container id=\"$en_entry\" parentID=\"$ObjectID\" restricted=\"$Restricted\">" . |
|
| 570 | - "<dc:title>$title</dc:title>" . |
|
| 571 | - '<upnp:class>object.container.storageFolder</upnp:class>' . |
|
| 568 | + $Result = $Result. |
|
| 569 | + "<container id=\"$en_entry\" parentID=\"$ObjectID\" restricted=\"$Restricted\">". |
|
| 570 | + "<dc:title>$title</dc:title>". |
|
| 571 | + '<upnp:class>object.container.storageFolder</upnp:class>'. |
|
| 572 | 572 | '</container>'; |
| 573 | 573 | } else { |
| 574 | 574 | //$logo = get_named_val("tvg-logo", $buffer); |
@@ -576,21 +576,21 @@ discard block |
||
| 576 | 576 | // $logo = trim(substr($buffer, (strpos($buffer, ',') + 1))); |
| 577 | 577 | //} |
| 578 | 578 | //$icon_url = upnp_url_encode($logo_url_path . mb_convert_case($logo, MB_CASE_LOWER, "UTF-8") . '.png'); |
| 579 | - $Result = $Result . |
|
| 580 | - "<item id=\"$en_entry\" parentID=\"$ObjectID\" restricted=\"$Restricted\">" . |
|
| 581 | - "<dc:title>$title</dc:title>" . |
|
| 582 | - "<dc:date>$date</dc:date>" . |
|
| 579 | + $Result = $Result. |
|
| 580 | + "<item id=\"$en_entry\" parentID=\"$ObjectID\" restricted=\"$Restricted\">". |
|
| 581 | + "<dc:title>$title</dc:title>". |
|
| 582 | + "<dc:date>$date</dc:date>". |
|
| 583 | 583 | //"<upnp:albumArtURI dlna:profileID=\"JPEG_TN\" xmlns:dlna=\"urn:schemas-dlna-org:metadata-1-0\">$icon_url</upnp:albumArtURI>" . |
| 584 | 584 | //"<upnp:icon>$icon_url</upnp:icon>" . |
| 585 | - "<upnp:class>$iclass</upnp:class>" . |
|
| 586 | - "<res protocolInfo=\"http-get:*:$mimetype:*\">$en_entry</res>" . |
|
| 585 | + "<upnp:class>$iclass</upnp:class>". |
|
| 586 | + "<res protocolInfo=\"http-get:*:$mimetype:*\">$en_entry</res>". |
|
| 587 | 587 | '</item>'; |
| 588 | 588 | } |
| 589 | 589 | } |
| 590 | - fclose ($fd); |
|
| 590 | + fclose($fd); |
|
| 591 | 591 | |
| 592 | - $Result = $Result . '</DIDL-Lite>'; |
|
| 593 | - return (array( 'Result' => $Result, |
|
| 592 | + $Result = $Result.'</DIDL-Lite>'; |
|
| 593 | + return (array('Result' => $Result, |
|
| 594 | 594 | 'NumberReturned' => $NumberReturned, |
| 595 | 595 | 'TotalMatches' => $TotalMatches, |
| 596 | 596 | 'UpdateID' => $UpdateID)); |
@@ -605,14 +605,14 @@ discard block |
||
| 605 | 605 | !is_dir($filename)) /* Skip files. */ |
| 606 | 606 | continue; |
| 607 | 607 | /* Ok, item matched and may be returned. */ |
| 608 | - $TotalMatches ++; |
|
| 608 | + $TotalMatches++; |
|
| 609 | 609 | if (0 < $StartingIndex && |
| 610 | 610 | $TotalMatches < $StartingIndex) |
| 611 | 611 | continue; /* Skip first items. */ |
| 612 | 612 | if (0 < $RequestedCount && |
| 613 | 613 | $NumberReturned >= $RequestedCount) |
| 614 | 614 | continue; /* Do not add more than requested. */ |
| 615 | - $NumberReturned ++; |
|
| 615 | + $NumberReturned++; |
|
| 616 | 616 | /* Add item to result. */ |
| 617 | 617 | if (is_writable($filename)) { |
| 618 | 618 | $Restricted = '0'; |
@@ -622,10 +622,10 @@ discard block |
||
| 622 | 622 | $title = xml_encode($entry); |
| 623 | 623 | $en_entry = upnp_url_encode($dir.$entry); |
| 624 | 624 | $ChildCount = (count(scandir($filename)) - 2); |
| 625 | - $Result = $Result . |
|
| 626 | - "<container id=\"$en_entry\" parentID=\"$ObjectID\" restricted=\"$Restricted\" searchable=\"1\" childCount=\"$ChildCount\">" . |
|
| 627 | - "<dc:title>$title</dc:title>" . |
|
| 628 | - '<upnp:class>object.container.storageFolder</upnp:class>' . |
|
| 625 | + $Result = $Result. |
|
| 626 | + "<container id=\"$en_entry\" parentID=\"$ObjectID\" restricted=\"$Restricted\" searchable=\"1\" childCount=\"$ChildCount\">". |
|
| 627 | + "<dc:title>$title</dc:title>". |
|
| 628 | + '<upnp:class>object.container.storageFolder</upnp:class>'. |
|
| 629 | 629 | '</container>'; |
| 630 | 630 | } |
| 631 | 631 | /* Add files to play list. */ |
@@ -637,14 +637,14 @@ discard block |
||
| 637 | 637 | if (null === $iclass) /* Skip unsupported file type. */ |
| 638 | 638 | continue; |
| 639 | 639 | /* Ok, item matched and may be returned. */ |
| 640 | - $TotalMatches ++; |
|
| 640 | + $TotalMatches++; |
|
| 641 | 641 | if (0 < $StartingIndex && |
| 642 | 642 | $TotalMatches < $StartingIndex) |
| 643 | 643 | continue; /* Skip first items. */ |
| 644 | 644 | if (0 < $RequestedCount && |
| 645 | 645 | $NumberReturned >= $RequestedCount) |
| 646 | 646 | continue; /* Do not add more than requested. */ |
| 647 | - $NumberReturned ++; |
|
| 647 | + $NumberReturned++; |
|
| 648 | 648 | /* Add item to result. */ |
| 649 | 649 | if (is_writable($filename)) { |
| 650 | 650 | $Restricted = '0'; |
@@ -655,38 +655,38 @@ discard block |
||
| 655 | 655 | $en_entry = upnp_url_encode($dir.$entry); |
| 656 | 656 | if ('object.container.storageFolder' === $iclass) { /* Play list as folder! */ |
| 657 | 657 | $ChildCount = m3u_calc_items_count($filename); |
| 658 | - $Result = $Result . |
|
| 659 | - "<container id=\"$en_entry\" parentID=\"$ObjectID\" restricted=\"$Restricted\" searchable=\"1\" childCount=\"$ChildCount\">" . |
|
| 660 | - "<dc:title>$title</dc:title>" . |
|
| 661 | - '<upnp:class>object.container.storageFolder</upnp:class>' . |
|
| 658 | + $Result = $Result. |
|
| 659 | + "<container id=\"$en_entry\" parentID=\"$ObjectID\" restricted=\"$Restricted\" searchable=\"1\" childCount=\"$ChildCount\">". |
|
| 660 | + "<dc:title>$title</dc:title>". |
|
| 661 | + '<upnp:class>object.container.storageFolder</upnp:class>'. |
|
| 662 | 662 | '</container>'; |
| 663 | 663 | } else { |
| 664 | 664 | $date = upnp_date(filectime($filename), 1); |
| 665 | 665 | $size = filesize($filename); |
| 666 | 666 | $mimetype = upnp_mime_content_type($filename); |
| 667 | 667 | $res_info_ex = ''; |
| 668 | - $Result = $Result . |
|
| 669 | - "<item id=\"$en_entry\" parentID=\"$ObjectID\" restricted=\"$Restricted\">" . |
|
| 670 | - "<dc:title>$title</dc:title>" . |
|
| 671 | - "<dc:date>$date</dc:date>" . |
|
| 668 | + $Result = $Result. |
|
| 669 | + "<item id=\"$en_entry\" parentID=\"$ObjectID\" restricted=\"$Restricted\">". |
|
| 670 | + "<dc:title>$title</dc:title>". |
|
| 671 | + "<dc:date>$date</dc:date>". |
|
| 672 | 672 | "<upnp:class>$iclass</upnp:class>"; |
| 673 | 673 | if ('object.item.imageItem' === substr($iclass, 0, 21)) { |
| 674 | - $Result = $Result . |
|
| 675 | - "<upnp:albumArtURI>$baseurlpatch$en_entry</upnp:albumArtURI>" . |
|
| 674 | + $Result = $Result. |
|
| 675 | + "<upnp:albumArtURI>$baseurlpatch$en_entry</upnp:albumArtURI>". |
|
| 676 | 676 | "<upnp:icon>$baseurlpatch$en_entry</upnp:icon>"; |
| 677 | 677 | $img_info = getimagesize($filename); |
| 678 | 678 | if (false !== $img_info) { |
| 679 | - $res_info_ex = ' resolution="' . $img_info[0] . 'x' . $img_info[1] . '"'; |
|
| 679 | + $res_info_ex = ' resolution="'.$img_info[0].'x'.$img_info[1].'"'; |
|
| 680 | 680 | } |
| 681 | 681 | } |
| 682 | - $Result = $Result . |
|
| 683 | - "<res size=\"$size\"$res_info_ex protocolInfo=\"http-get:*:$mimetype:*\">$baseurlpatch$en_entry</res>" . |
|
| 682 | + $Result = $Result. |
|
| 683 | + "<res size=\"$size\"$res_info_ex protocolInfo=\"http-get:*:$mimetype:*\">$baseurlpatch$en_entry</res>". |
|
| 684 | 684 | '</item>'; |
| 685 | 685 | } |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | - $Result = $Result . '</DIDL-Lite>'; |
|
| 689 | - return (array( 'Result' => $Result, |
|
| 688 | + $Result = $Result.'</DIDL-Lite>'; |
|
| 689 | + return (array('Result' => $Result, |
|
| 690 | 690 | 'NumberReturned' => $NumberReturned, |
| 691 | 691 | 'TotalMatches' => $TotalMatches, |
| 692 | 692 | 'UpdateID' => $UpdateID)); |
@@ -696,22 +696,22 @@ discard block |
||
| 696 | 696 | function Search($ContainerID, $SearchCriteria, $Filter, $StartingIndex, |
| 697 | 697 | $RequestedCount, $SortCriteria) { |
| 698 | 698 | global $basedir, $baseurl, $baseurlpatch; |
| 699 | - $Result = '<DIDL-Lite' . |
|
| 700 | - ' xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"' . |
|
| 701 | - ' xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/"' . |
|
| 702 | - ' xmlns:dc="http://purl.org/dc/elements/1.1/"' . |
|
| 703 | - ' xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/"' . |
|
| 704 | - ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . |
|
| 705 | - ' xsi:schemaLocation="' . |
|
| 706 | - 'urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/ http://www.upnp.org/schemas/av/didl-lite.xsd ' . |
|
| 699 | + $Result = '<DIDL-Lite'. |
|
| 700 | + ' xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"'. |
|
| 701 | + ' xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/"'. |
|
| 702 | + ' xmlns:dc="http://purl.org/dc/elements/1.1/"'. |
|
| 703 | + ' xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/"'. |
|
| 704 | + ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'. |
|
| 705 | + ' xsi:schemaLocation="'. |
|
| 706 | + 'urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/ http://www.upnp.org/schemas/av/didl-lite.xsd '. |
|
| 707 | 707 | 'urn:schemas-upnp-org:metadata-1-0/upnp/ http://www.upnp.org/schemas/av/upnp.xsd">'; |
| 708 | 708 | $NumberReturned = 0; |
| 709 | 709 | $TotalMatches = 0; |
| 710 | 710 | $UpdateID = 1; |
| 711 | 711 | |
| 712 | - $Result = $Result . '</DIDL-Lite>'; |
|
| 712 | + $Result = $Result.'</DIDL-Lite>'; |
|
| 713 | 713 | |
| 714 | - return (array( 'Result' => $Result, |
|
| 714 | + return (array('Result' => $Result, |
|
| 715 | 715 | 'NumberReturned' => $NumberReturned, |
| 716 | 716 | 'TotalMatches' => $TotalMatches, |
| 717 | 717 | 'UpdateID' => $UpdateID)); |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | $ObjectID = ''; |
| 723 | 723 | $Result = ''; |
| 724 | 724 | |
| 725 | - return (array( 'ObjectID' => $ObjectID, |
|
| 725 | + return (array('ObjectID' => $ObjectID, |
|
| 726 | 726 | 'Result' => $Result)); |
| 727 | 727 | } |
| 728 | 728 | |
@@ -742,19 +742,19 @@ discard block |
||
| 742 | 742 | /* Samsung private. */ |
| 743 | 743 | function X_GetFeatureList() { |
| 744 | 744 | $FeatureList = |
| 745 | - '<?xml version="1.0" encoding="UTF-8"?>' . |
|
| 746 | - '<Features' . |
|
| 747 | - ' xmlns="urn:schemas-upnp-org:av:avs"' . |
|
| 748 | - ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . |
|
| 749 | - ' xmlns:sec="http://www.sec.co.kr/dlna"' . |
|
| 750 | - ' xsi:schemaLocation="urn:schemas-upnp-org:av:avs http://www.upnp.org/schemas/av/avs.xsd">' . |
|
| 751 | - '<Feature name="samsung.com_BASICVIEW" version="1">' . |
|
| 752 | - '<container id="A" type="object.item.audioItem"/>' . |
|
| 753 | - '<container id="I" type="object.item.imageItem"/>' . |
|
| 754 | - '<container id="V" type="object.item.videoItem"/>' . |
|
| 755 | - '<container id="P" type="object.item.playlistItem"/>' . |
|
| 756 | - '<container id="T" type="object.item.textItem"/>' . |
|
| 757 | - '</Feature>' . |
|
| 745 | + '<?xml version="1.0" encoding="UTF-8"?>'. |
|
| 746 | + '<Features'. |
|
| 747 | + ' xmlns="urn:schemas-upnp-org:av:avs"'. |
|
| 748 | + ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'. |
|
| 749 | + ' xmlns:sec="http://www.sec.co.kr/dlna"'. |
|
| 750 | + ' xsi:schemaLocation="urn:schemas-upnp-org:av:avs http://www.upnp.org/schemas/av/avs.xsd">'. |
|
| 751 | + '<Feature name="samsung.com_BASICVIEW" version="1">'. |
|
| 752 | + '<container id="A" type="object.item.audioItem"/>'. |
|
| 753 | + '<container id="I" type="object.item.imageItem"/>'. |
|
| 754 | + '<container id="V" type="object.item.videoItem"/>'. |
|
| 755 | + '<container id="P" type="object.item.playlistItem"/>'. |
|
| 756 | + '<container id="T" type="object.item.textItem"/>'. |
|
| 757 | + '</Feature>'. |
|
| 758 | 758 | '</Features>'; |
| 759 | 759 | |
| 760 | 760 | return ($FeatureList); |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | |
| 774 | 774 | $request_body = @file_get_contents('php://input'); |
| 775 | 775 | try { |
| 776 | - $server->addFunction(array( 'GetSearchCapabilities', |
|
| 776 | + $server->addFunction(array('GetSearchCapabilities', |
|
| 777 | 777 | 'GetSortCapabilities', |
| 778 | 778 | 'GetSortExtensionCapabilities', |
| 779 | 779 | 'GetFeatureList', |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | return (strrev(substr($rreq, $ns_st, ($ns_end - $ns_st)))); |
| 824 | 824 | } |
| 825 | 825 | |
| 826 | -function tag_ns_replace($req, $sxml, $tag, $ns=false) { |
|
| 826 | +function tag_ns_replace($req, $sxml, $tag, $ns = false) { |
|
| 827 | 827 | if (false === $tag) |
| 828 | 828 | return ($sxml); |
| 829 | 829 | if (false === $ns) |
@@ -855,7 +855,7 @@ discard block |
||
| 855 | 855 | $soapXml = tag_ns_replace($request_body, $soapXml, $soap_act_resp_tag, get_tag_ns($request_body, $soap_service_func)); |
| 856 | 856 | |
| 857 | 857 | $length = strlen($soapXml); |
| 858 | -header('Content-Length: ' . $length); |
|
| 858 | +header('Content-Length: '.$length); |
|
| 859 | 859 | echo $soapXml; |
| 860 | 860 | |
| 861 | 861 | ?> |