fix mynoxon login
[noxon-gateway.git] / www / index.php
index b3b2a7b4b59d821ac1f80f39fc024b5ce5036c4c..1ec3bf1de81f0341cbeb5110c6515edb133e376a 100644 (file)
@@ -2,7 +2,7 @@
 require_once __DIR__ . '/../src/header.php';
 
 if (strtolower($fullUri) == '/setupapp/radio567/asp/browsexpa/loginxml.asp?token=0'
-    || $fullUri == '/RadioNativeLogin.phpb'
+    || $fullUri == '/RadioNativeLogin.php'
 ) {
     //initial login for "internet radio", podcasts and "my noxon"
     header('Content-type: text/html');
@@ -81,6 +81,7 @@ function sendDir($path)
 
     $entries = glob(str_replace('//', '/', $varDir . rtrim($path, '/') . '/*'));
     $count = 0;
+    $noCache = false;
     foreach ($entries as $entry) {
         $urlPath = pathEncode(substr($entry, strlen($varDir)));
         $ext = pathinfo($entry, PATHINFO_EXTENSION);
@@ -104,12 +105,17 @@ function sendDir($path)
             //plain text file
             ++$count;
             $listItems[] = getDirItem(basename($titleBase, '.' . $ext), $urlPath);
+        } else  if (basename($entry) == 'nocache') {
+            $noCache = true;
         }
     }
     if (!$count) {
         $listItems[] = getMessageItem('No files or folders');
     }
-    sendListItems($listItems, buildPreviousItem($path), $enablePaging);
+    sendListItems(
+        $listItems, buildPreviousItem($path),
+        $enablePaging, $noCache
+    );
 }
 
 function sendScript($path)
@@ -233,8 +239,9 @@ function sendMessage($msg)
     sendListItems(array(getMessageItem($msg)));
 }
 
-function sendListItems($listItems, $previous = null, $enablePaging = true)
-{
+function sendListItems(
+    $listItems, $previous = null, $enablePaging = true, $noCache = false
+) {
     $startitems = 1;
     $enditems   = 100000;
     if (isset($_GET['startitems'])) {
@@ -256,6 +263,9 @@ function sendListItems($listItems, $previous = null, $enablePaging = true)
     $xml = '<?xml version="1.0" encoding="iso-8859-1"?>' . "\n";
     $xml .= '<?xml-stylesheet type="text/xsl" href="/html.xsl"?>' . "\n";
     $xml .= '<ListOfItems>' . "\n";
+    if ($noCache) {
+        $xml .= "<NoCache>1</NoCache>\n";
+    }
     $xml .= '<ItemCount>' . $itemCount . '</ItemCount>' . "\n";
     $xml .= $previous;