diff --git a/app/streams/stream_edit.php b/app/streams/stream_edit.php index c6ff9682fc..639d81fce9 100644 --- a/app/streams/stream_edit.php +++ b/app/streams/stream_edit.php @@ -98,11 +98,6 @@ return; } - //set the domain_uuid - if (!permission_exists('stream_all')) { - $domain_uuid = $_SESSION["domain_uuid"]; - } - //add the stream_uuid if (strlen($_POST["stream_uuid"]) == 0) { $stream_uuid = uuid(); @@ -110,7 +105,12 @@ //prepare the array $array['streams'][0]['stream_uuid'] = $stream_uuid; - $array['streams'][0]['domain_uuid'] = $domain_uuid; + if (permission_exists('stream_all')) { + $array['streams'][0]['domain_uuid'] = $domain_uuid; + } + elseif ($action == 'add') { + $array['streams'][0]['domain_uuid'] = $_SESSION["domain_uuid"]; + } $array['streams'][0]['stream_name'] = $stream_name; $array['streams'][0]['stream_location'] = $stream_location; $array['streams'][0]['stream_enabled'] = $stream_enabled; @@ -131,7 +131,7 @@ if ($action == "update") { $_SESSION["message"] = $text['message-update']; } - header('Location: stream_edit.php?id='.$stream_uuid); + header('Location: stream_edit.php?id='.urlencode($stream_uuid)); return; } } @@ -154,6 +154,12 @@ unset($sql, $parameters, $row); } +//need stream_all permission to edit a global stream + if (!permission_exists('stream_all') && $domain_uuid == null) { + header('Location: streams.php'); + return; + } + //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -222,31 +228,33 @@ echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; - echo " ".$text['label-domain_uuid']."\n"; - echo "\n"; - echo "\n"; - echo " \n"; + if (strlen($domain_uuid) == 0) { + echo " \n"; } else { - echo " \n"; + echo " \n"; } + foreach ($_SESSION['domains'] as $row) { + if ($row['domain_uuid'] == $domain_uuid) { + echo " \n"; + } + else { + echo " \n"; + } + } + echo " \n"; + echo "
\n"; + echo $text['description-domain_uuid']."\n"; + echo "\n"; + echo "\n"; } - echo " \n"; - echo "
\n"; - echo $text['description-domain_uuid']."\n"; - echo "\n"; - echo "\n"; echo "\n"; echo "\n"; @@ -270,4 +278,4 @@ //include the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?>