diff --git a/app/streams/stream_delete.php b/app/streams/stream_delete.php index 29581205ef..f0054b577a 100644 --- a/app/streams/stream_delete.php +++ b/app/streams/stream_delete.php @@ -39,25 +39,30 @@ $language = new text; $text = $language->get(); -//delete the message - message::add($text['message-delete']); +//get id + $stream_uuid = $_GET["id"]; //delete the data - if (isset($_GET["id"]) && is_uuid($_GET["id"])) { + if (is_uuid($stream_uuid)) { - //get the id - $id = check_str($_GET["id"]); + //build array + $array['streams'][0]['stream_uuid'] = $stream_uuid; + $array['streams'][0]['domain_uuid'] = $domain_uuid; - //delete stream - $sql = "delete from v_streams "; - $sql .= "where stream_uuid = '$id' "; - $sql .= "and domain_uuid = '$domain_uuid' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - unset($sql); + //execute delete + $database = new database; + $database->app_name = 'streams'; + $database->app_uuid = 'ffde6287-aa18-41fc-9a38-076d292e0a38'; + $database->delete($array); + unset($array); + + //set message + message::add($text['message-delete']); - //redirect the user - header('Location: streams.php'); } -?> +//redirect + header('Location: streams.php'); + exit; + +?> \ No newline at end of file diff --git a/app/streams/stream_edit.php b/app/streams/stream_edit.php index eebac10162..c11324c9f2 100644 --- a/app/streams/stream_edit.php +++ b/app/streams/stream_edit.php @@ -40,10 +40,10 @@ $text = $language->get(); //action add or update - if (isset($_REQUEST["id"])) { + if (is_uuid($_REQUEST["id"])) { $action = "update"; - $stream_uuid = check_str($_REQUEST["id"]); - $id = check_str($_REQUEST["id"]); + $stream_uuid = $_REQUEST["id"]; + $id = $_REQUEST["id"]; } else { $action = "add"; @@ -51,11 +51,11 @@ //get http post variables and set them to php variables if (is_array($_POST)) { - $stream_uuid = check_str($_POST["stream_uuid"]); - $stream_name = check_str($_POST["stream_name"]); - $stream_location = check_str($_POST["stream_location"]); - $stream_enabled = check_str($_POST["stream_enabled"]); - $stream_description = check_str($_POST["stream_description"]); + $stream_uuid = $_POST["stream_uuid"]; + $stream_name = $_POST["stream_name"]; + $stream_location = $_POST["stream_location"]; + $stream_enabled = $_POST["stream_enabled"]; + $stream_description = $_POST["stream_description"]; } //process the user data and save it to the database @@ -63,7 +63,7 @@ //get the uuid from the POST if ($action == "update") { - $stream_uuid = check_str($_POST["stream_uuid"]); + $stream_uuid = $_POST["stream_uuid"]; } //check for all required data @@ -103,19 +103,10 @@ //save to the data $database = new database; $database->app_name = 'streams'; - $database->app_uuid = null; - if (strlen($stream_uuid) > 0) { - $database->uuid($stream_uuid); - } + $database->app_uuid = 'ffde6287-aa18-41fc-9a38-076d292e0a38'; $database->save($array); $message = $database->message; - //debug info - //echo "
";
-			//print_r($message);
-			//echo "
"; - //exit; - //redirect the user if (isset($action)) { if ($action == "add") { @@ -127,24 +118,24 @@ header('Location: stream_edit.php?id='.$stream_uuid); return; } - } //(is_array($_POST) && strlen($_POST["persistformvar"]) == 0) + } //pre-populate the form if (is_array($_GET) && $_POST["persistformvar"] != "true") { - $stream_uuid = check_str($_GET["id"]); + $stream_uuid = $_GET["id"]; $sql = "select * from v_streams "; - $sql .= "where stream_uuid = '".$stream_uuid."' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - foreach ($result as &$row) { + $sql .= "where stream_uuid = :stream_uuid "; + $parameters['stream_uuid'] = $stream_uuid; + $database = new database; + $row = $database->select($sql, $parameters, 'row'); + if (is_array($row) && @sizeof($row) != 0) { $domain_uuid = $row["domain_uuid"]; $stream_name = $row["stream_name"]; $stream_location = $row["stream_location"]; $stream_enabled = $row["stream_enabled"]; $stream_description = $row["stream_description"]; } - unset ($prep_statement); + unset($sql, $parameters, $row); } //show the header @@ -190,7 +181,6 @@ echo "\n"; echo "\n"; echo "