diff --git a/app/phrases/app_config.php b/app/phrases/app_config.php
index 162f9f1017..deba972fb4 100644
--- a/app/phrases/app_config.php
+++ b/app/phrases/app_config.php
@@ -2,7 +2,6 @@
//application details
$apps[$x]['name'] = "Phrases";
- //5c6f597c-9b78-11e4-89d3-123b93f75cba
$apps[$x]['uuid'] = "5c6f597c-9b78-11e4-89d3-123b93f75cba";
$apps[$x]['category'] = "Switch";;
$apps[$x]['subcategory'] = "";
diff --git a/app/phrases/app_defaults.php b/app/phrases/app_defaults.php
index ef8ef6292e..a88a52cb37 100644
--- a/app/phrases/app_defaults.php
+++ b/app/phrases/app_defaults.php
@@ -68,11 +68,10 @@ if ($domains_processed == 1) {
if ($_SESSION['recordings']['storage_type']['text'] == 'base64') {
$sql = "select phrase_detail_uuid, phrase_detail_data ";
$sql .= "from v_phrase_details where phrase_detail_function = 'play-file' ";
- $prep_statement = $db->prepare(check_sql($sql));
- $prep_statement->execute();
- $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
- if (count($result) > 0) {
- foreach ($result as &$row) {
+ $database = new database;
+ $result = $database->select($sql, null, 'all');
+ if (is_array($result) && @sizeof($result) != 0) {
+ foreach ($result as $index => &$row) {
$phrase_detail_uuid = $row['phrase_detail_uuid'];
$phrase_detail_data = $row['phrase_detail_data'];
if (substr_count($phrase_detail_data, $_SESSION['switch']['recordings']['dir'].'/'.$domain_name) > 0) {
@@ -80,15 +79,24 @@ if ($domains_processed == 1) {
}
//update function and data to be base64 compatible
$phrase_detail_data = "lua(streamfile.lua ".$phrase_detail_data.")";
- $sql = "update v_phrase_details set ";
- $sql .= "phrase_detail_function = 'execute', ";
- $sql .= "phrase_detail_data = '".$phrase_detail_data."' ";
- $sql .= "where phrase_detail_uuid = '".$phrase_detail_uuid."' ";
- $db->exec(check_sql($sql));
- unset($sql);
+ $array['phrase_details'][$index]['phrase_detail_uuid'] = $phrase_detail_uuid;
+ $array['phrase_details'][$index]['phrase_detail_function'] = 'execute';
+ $array['phrase_details'][$index]['phrase_detail_data'] = $phrase_detail_data;
+ }
+ if (is_array($array) && @sizeof($array) != 0) {
+ $p = new permissions;
+ $p->add('phrase_detail_edit', 'temp');
+
+ $database = new database;
+ $database->app_name = 'phrases';
+ $database->app_uuid = '5c6f597c-9b78-11e4-89d3-123b93f75cba';
+ $database->save($array);
+ unset($array);
+
+ $p->delete('phrase_detail_edit', 'temp');
}
}
- unset($sql, $prep_statement, $result, $row);
+ unset($sql, $result, $row);
}
//if not base64, revert base64 phrases to standard method
@@ -97,11 +105,10 @@ if ($domains_processed == 1) {
$sql .= "from v_phrase_details where ";
$sql .= "phrase_detail_function = 'execute' ";
$sql .= "and phrase_detail_data like 'lua(streamfile.lua %)' ";
- $prep_statement = $db->prepare(check_sql($sql));
- $prep_statement->execute();
- $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
- if (count($result) > 0) {
- foreach ($result as &$row) {
+ $database = new database;
+ $result = $database->select($sql, null, 'all');
+ if (is_array($result) && @sizeof($result) != 0) {
+ foreach ($result as $index => &$row) {
$phrase_detail_uuid = $row['phrase_detail_uuid'];
$phrase_detail_data = $row['phrase_detail_data'];
//update function and data to use standard method
@@ -110,15 +117,24 @@ if ($domains_processed == 1) {
if (substr_count($phrase_detail_data, '/') === 0) {
$phrase_detail_data = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name.'/'.$phrase_detail_data;
}
- $sql = "update v_phrase_details set ";
- $sql .= "phrase_detail_function = 'play-file', ";
- $sql .= "phrase_detail_data = '".$phrase_detail_data."' ";
- $sql .= "where phrase_detail_uuid = '".$phrase_detail_uuid."' ";
- $db->exec(check_sql($sql));
- unset($sql);
+ $array['phrase_details'][$index]['phrase_detail_uuid'] = $phrase_detail_uuid;
+ $array['phrase_details'][$index]['phrase_detail_function'] = 'play-file';
+ $array['phrase_details'][$index]['phrase_detail_data'] = $phrase_detail_data;
+ }
+ if (is_array($array) && @sizeof($array) != 0) {
+ $p = new permissions;
+ $p->add('phrase_detail_edit', 'temp');
+
+ $database = new database;
+ $database->app_name = 'phrases';
+ $database->app_uuid = '5c6f597c-9b78-11e4-89d3-123b93f75cba';
+ $database->save($array);
+ unset($array);
+
+ $p->delete('phrase_detail_edit', 'temp');
}
}
- unset($sql, $prep_statement, $result, $row);
+ unset($sql, $result, $row);
}
//save the xml to the file system if the phrase directory is set
@@ -130,16 +146,17 @@ if ($domains_processed == 1) {
if ($fp) {
//get phrase languages
$sql = "select distinct phrase_language from v_phrases order by phrase_language asc ";
- $prep_statement = $db->prepare(check_sql($sql));
- $prep_statement->execute();
- $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
+ $database = new database;
+ $result = $database->select($sql, null, 'all');
//delete memcache var
- foreach ($result as $row) {
- //clear the cache
- $cache = new cache;
- $cache->delete("languages:".$row['phrase_language']);
+ if (is_array($result) && @sizeof($result) != 0) {
+ foreach ($result as $row) {
+ //clear the cache
+ $cache = new cache;
+ $cache->delete("languages:".$row['phrase_language']);
+ }
}
- unset($sql, $prep_statement, $result, $row);
+ unset($sql, $result, $row);
}
unset($fp);
diff --git a/app/phrases/phrase_delete.php b/app/phrases/phrase_delete.php
index 1686afaac2..20e50caa3e 100644
--- a/app/phrases/phrase_delete.php
+++ b/app/phrases/phrase_delete.php
@@ -48,32 +48,38 @@
//delete the data
if (is_uuid($phrase_uuid)) {
//delete phrase details
- $sql = "delete from v_phrase_details ";
- $sql .= "where phrase_uuid = '".$phrase_uuid."' ";
- $sql .= "and domain_uuid = '".$domain_uuid."' ";
- $prep_statement = $db->prepare(check_sql($sql));
- $prep_statement->execute();
- unset($sql);
+ $array['phrase_details'][0]['phrase_uuid'] = $phrase_uuid;
+ $array['phrase_details'][0]['domain_uuid'] = $domain_uuid;
//delete phrase
- $sql = "delete from v_phrases ";
- $sql .= "where phrase_uuid = '".$phrase_uuid."' ";
- $sql .= "and domain_uuid = '".$domain_uuid."' ";
- $prep_statement = $db->prepare(check_sql($sql));
- $prep_statement->execute();
- $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
- unset ($prep_statement);
+ $array['phrases'][0]['phrase_uuid'] = $phrase_uuid;
+ $array['phrases'][0]['domain_uuid'] = $domain_uuid;
+
+ //execute
+ $p = new permissions;
+ $p->add('phrase_detail_delete', 'temp');
+
+ $database = new database;
+ $database->app_name = 'phrases';
+ $database->app_uuid = '5c6f597c-9b78-11e4-89d3-123b93f75cba';
+ $database->delete($array);
+ unset($array);
+
+ $p->delete('phrase_detail_delete', 'temp');
+
+ //save the xml
+ save_phrases_xml();
+
+ //clear the cache
+ $cache = new cache;
+ $cache->delete("languages:".$phrase_language);
+
+ //set message
+ message::add($text['message-delete']);
}
-//save the xml
- save_phrases_xml();
-
-//clear the cache
- $cache = new cache;
- $cache->delete("languages:".$phrase_language);
-
//redirect the user
- message::add($text['message-delete']);
header("Location: phrases.php");
+ exit;
?>
diff --git a/app/phrases/phrase_detail_delete.php b/app/phrases/phrase_detail_delete.php
index 0c6039cf90..e244990bab 100644
--- a/app/phrases/phrase_detail_delete.php
+++ b/app/phrases/phrase_detail_delete.php
@@ -43,29 +43,44 @@
$text = $language->get();
//get values
- $phrase_detail_uuid = check_str($_GET["pdid"]);
- $phrase_uuid = check_str($_GET["pid"]);
- $phrase_language = check_str($_GET["lang"]);
+ $phrase_detail_uuid = $_GET["pdid"];
+ $phrase_uuid = $_GET["pid"];
+ $phrase_language = $_GET["lang"];
//delete the detail entry
- if ($phrase_detail_uuid != '' && $phrase_uuid != '') {
- $sql = "delete from v_phrase_details ";
- $sql .= " where phrase_detail_uuid = '".$phrase_detail_uuid."'";
- $sql .= " and phrase_uuid = '".$phrase_uuid."' ";
- $sql .= " and domain_uuid = '".$domain_uuid."' ";
- $db->exec(check_sql($sql));
- unset($sql);
+ if (is_uuid($phrase_detail_uuid) && is_uuid($phrase_uuid)) {
+ //build array
+ $array['phrase_details'][0]['phrase_detail_uuid'] = $phrase_detail_uuid;
+ $array['phrase_details'][0]['phrase_uuid'] = $phrase_uuid;
+ $array['phrase_details'][0]['domain_uuid'] = $domain_uuid;
+
+ //grant temporary permissions
+ $p = new permissions;
+ $p->add('phrase_detail_delete', 'temp');
+
+ //execute delete
+ $database = new database;
+ $database->app_name = 'phrases';
+ $database->app_uuid = '5c6f597c-9b78-11e4-89d3-123b93f75cba';
+ $database->delete($array);
+ unset($array);
+
+ //revoke temporary permissions
+ $p->delete('phrase_detail_delete', 'temp');
+
+ //save the xml to the file system if the phrase directory is set
+ save_phrases_xml();
+
+ //clear the cache
+ $cache = new cache;
+ $cache->delete("languages:".$phrase_language);
+
+ //set message
+ message::add($text['message-delete']);
}
-//save the xml to the file system if the phrase directory is set
- save_phrases_xml();
-
-//clear the cache
- $cache = new cache;
- $cache->delete("languages:".$phrase_language);
-
//redirect the user
- message::add($text['message-delete']);
header('Location: phrase_edit.php?id='.$phrase_uuid);
+ exit;
?>
diff --git a/app/phrases/phrase_edit.php b/app/phrases/phrase_edit.php
index 23fd3feba3..8d62410133 100644
--- a/app/phrases/phrase_edit.php
+++ b/app/phrases/phrase_edit.php
@@ -44,9 +44,9 @@
$text = $language->get();
//set the action as an add or an update
- if (isset($_REQUEST["id"])) {
+ if (is_uuid($_REQUEST["id"])) {
$action = "update";
- $phrase_uuid = check_str($_REQUEST["id"]);
+ $phrase_uuid = $_REQUEST["id"];
}
else {
$action = "add";
@@ -55,12 +55,12 @@
//get the form value and set to php variables
if (count($_POST) > 0) {
if (permission_exists('phrase_domain')) {
- $domain_uuid = check_str($_POST["domain_uuid"]);
+ $domain_uuid = $_POST["domain_uuid"];
}
- $phrase_name = check_str($_POST["phrase_name"]);
- $phrase_language = check_str($_POST["phrase_language"]);
- $phrase_enabled = check_str($_POST["phrase_enabled"]);
- $phrase_description = check_str($_POST["phrase_description"]);
+ $phrase_name = $_POST["phrase_name"];
+ $phrase_language = $_POST["phrase_language"];
+ $phrase_enabled = $_POST["phrase_enabled"];
+ $phrase_description = $_POST["phrase_description"];
//clean the name
$phrase_name = str_replace(" ", "_", $phrase_name);
@@ -72,7 +72,7 @@
//get the uuid
if ($action == "update") {
- $phrase_uuid = check_str($_POST["phrase_uuid"]);
+ $phrase_uuid = $_POST["phrase_uuid"];
}
//check for all required data
@@ -95,29 +95,14 @@
//add the phrase
if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('phrase_add')) {
- //add the phrase to the database
+ //build data array
$phrase_uuid = uuid();
- $sql = "insert into v_phrases ";
- $sql .= "( ";
- $sql .= "domain_uuid, ";
- $sql .= "phrase_uuid, ";
- $sql .= "phrase_name, ";
- $sql .= "phrase_language, ";
- $sql .= "phrase_enabled, ";
- $sql .= "phrase_description ";
- $sql .= ") ";
- $sql .= "values ";
- $sql .= "( ";
- $sql .= "'".$domain_uuid."', ";
- $sql .= "'".$phrase_uuid."', ";
- $sql .= "'".$phrase_name."', ";
- $sql .= "'".$phrase_language."', ";
- $sql .= "'".$phrase_enabled."', ";
- $sql .= "'".$phrase_description."' ";
- $sql .= ") ";
- //echo $sql."
";
- $db->exec(check_sql($sql));
- unset($sql);
+ $array['phrases'][0]['domain_uuid'] = $domain_uuid;
+ $array['phrases'][0]['phrase_uuid'] = $phrase_uuid;
+ $array['phrases'][0]['phrase_name'] = $phrase_name;
+ $array['phrases'][0]['phrase_language'] = $phrase_language;
+ $array['phrases'][0]['phrase_enabled'] = $phrase_enabled;
+ $array['phrases'][0]['phrase_description'] = $phrase_description;
if ($_POST['phrase_detail_function'] != '') {
$_POST['phrase_detail_tag'] = 'action'; // default, for now
@@ -125,40 +110,32 @@
if ($_POST['phrase_detail_data'] != '') {
$phrase_detail_uuid = uuid();
- $sql = "insert into v_phrase_details ";
- $sql .= "( ";
- $sql .= "phrase_detail_uuid, ";
- $sql .= "phrase_uuid, ";
- $sql .= "domain_uuid, ";
- $sql .= "phrase_detail_order, ";
- $sql .= "phrase_detail_tag, ";
- $sql .= "phrase_detail_pattern, ";
- $sql .= "phrase_detail_function, ";
- $sql .= "phrase_detail_data, ";
- $sql .= "phrase_detail_method, ";
- $sql .= "phrase_detail_type, ";
- $sql .= "phrase_detail_group ";
- $sql .= " ) ";
- $sql .= "values ";
- $sql .= "( ";
- $sql .= "'".$phrase_detail_uuid."', ";
- $sql .= "'".$phrase_uuid."', ";
- $sql .= "'".$domain_uuid."', ";
- $sql .= "'".check_str($_POST['phrase_detail_order'])."', ";
- $sql .= "'".check_str($_POST['phrase_detail_tag'])."', ";
- $sql .= "'".check_str($_POST['phrase_detail_pattern'])."', ";
- $sql .= "'".check_str($_POST['phrase_detail_function'])."', ";
- $sql .= "'".check_str($_POST['phrase_detail_data'])."', ";
- $sql .= "'".check_str($_POST['phrase_detail_method'])."', ";
- $sql .= "'".check_str($_POST['phrase_detail_type'])."', ";
- $sql .= "'".check_str($_POST['phrase_detail_group'])."' ";
- $sql .= ") ";
- //echo $sql."
";
- $db->exec(check_sql($sql));
- unset($sql);
+ $array['phrase_details'][0]['phrase_detail_uuid'] = $phrase_detail_uuid;
+ $array['phrase_details'][0]['phrase_uuid'] = $phrase_uuid;
+ $array['phrase_details'][0]['domain_uuid'] = $domain_uuid;
+ $array['phrase_details'][0]['phrase_detail_order'] = $_POST['phrase_detail_order'];
+ $array['phrase_details'][0]['phrase_detail_tag'] = $_POST['phrase_detail_tag'];
+ $array['phrase_details'][0]['phrase_detail_pattern'] = $_POST['phrase_detail_pattern'];
+ $array['phrase_details'][0]['phrase_detail_function'] = $_POST['phrase_detail_function'];
+ $array['phrase_details'][0]['phrase_detail_data'] = $_POST['phrase_detail_data'];
+ $array['phrase_details'][0]['phrase_detail_method'] = $_POST['phrase_detail_method'];
+ $array['phrase_details'][0]['phrase_detail_type'] = $_POST['phrase_detail_type'];
+ $array['phrase_details'][0]['phrase_detail_group'] = $_POST['phrase_detail_group'];
}
}
+ //execute insert
+ $p = new permissions;
+ $p->add('phrase_detail_add', 'temp');
+
+ $database = new database;
+ $database->app_name = 'phrases';
+ $database->app_uuid = '5c6f597c-9b78-11e4-89d3-123b93f75cba';
+ $database->save($array);
+ unset($array);
+
+ $p->delete('phrase_detail_add', 'temp');
+
//save the xml to the file system if the phrase directory is set
//save_phrases_xml();
@@ -169,21 +146,18 @@
//send a redirect
message::add($text['message-add']);
header("Location: phrase_edit.php?id=".$phrase_uuid);
- return;
- } //if ($action == "add")
+ exit;
+ }
//update the phrase
if ($action == "update" && permission_exists('phrase_edit')) {
- //update the database with the new data
- $sql = "update v_phrases set ";
- $sql .= "phrase_name = '".$phrase_name."', ";
- $sql .= "phrase_language = '".$phrase_language."', ";
- $sql .= "phrase_enabled = '".$phrase_enabled."', ";
- $sql .= "phrase_description = '".$phrase_description."' ";
- $sql .= "where domain_uuid = '".$domain_uuid."' ";
- $sql .= "and phrase_uuid = '".$phrase_uuid."' ";
- $db->exec(check_sql($sql));
- unset($sql);
+ //build data array
+ $array['phrases'][0]['domain_uuid'] = $domain_uuid;
+ $array['phrases'][0]['phrase_uuid'] = $phrase_uuid;
+ $array['phrases'][0]['phrase_name'] = $phrase_name;
+ $array['phrases'][0]['phrase_language'] = $phrase_language;
+ $array['phrases'][0]['phrase_enabled'] = $phrase_enabled;
+ $array['phrases'][0]['phrase_description'] = $phrase_description;
if ($_POST['phrase_detail_function'] != '') {
$_POST['phrase_detail_tag'] = 'action'; // default, for now
@@ -191,40 +165,32 @@
if ($_POST['phrase_detail_data'] != '') {
$phrase_detail_uuid = uuid();
- $sql = "insert into v_phrase_details ";
- $sql .= "( ";
- $sql .= "phrase_detail_uuid, ";
- $sql .= "phrase_uuid, ";
- $sql .= "domain_uuid, ";
- $sql .= "phrase_detail_order, ";
- $sql .= "phrase_detail_tag, ";
- $sql .= "phrase_detail_pattern, ";
- $sql .= "phrase_detail_function, ";
- $sql .= "phrase_detail_data, ";
- $sql .= "phrase_detail_method, ";
- $sql .= "phrase_detail_type, ";
- $sql .= "phrase_detail_group ";
- $sql .= ") ";
- $sql .= "values ";
- $sql .= "( ";
- $sql .= "'".$phrase_detail_uuid."', ";
- $sql .= "'".$phrase_uuid."', ";
- $sql .= "'".$domain_uuid."', ";
- $sql .= "'".check_str($_POST['phrase_detail_order'])."', ";
- $sql .= "'".check_str($_POST['phrase_detail_tag'])."', ";
- $sql .= "'".check_str($_POST['phrase_detail_pattern'])."', ";
- $sql .= "'".check_str($_POST['phrase_detail_function'])."', ";
- $sql .= "'".check_str($_POST['phrase_detail_data'])."', ";
- $sql .= "'".check_str($_POST['phrase_detail_method'])."', ";
- $sql .= "'".check_str($_POST['phrase_detail_type'])."', ";
- $sql .= "'".check_str($_POST['phrase_detail_group'])."' ";
- $sql .= ") ";
- //echo $sql."
";
- $db->exec(check_sql($sql));
- unset($sql);
+ $array['phrase_details'][0]['phrase_detail_uuid'] = $phrase_detail_uuid;
+ $array['phrase_details'][0]['phrase_uuid'] = $phrase_uuid;
+ $array['phrase_details'][0]['domain_uuid'] = $domain_uuid;
+ $array['phrase_details'][0]['phrase_detail_order'] = $_POST['phrase_detail_order'];
+ $array['phrase_details'][0]['phrase_detail_tag'] = $_POST['phrase_detail_tag'];
+ $array['phrase_details'][0]['phrase_detail_pattern'] = $_POST['phrase_detail_pattern'];
+ $array['phrase_details'][0]['phrase_detail_function'] = $_POST['phrase_detail_function'];
+ $array['phrase_details'][0]['phrase_detail_data'] = $_POST['phrase_detail_data'];
+ $array['phrase_details'][0]['phrase_detail_method'] = $_POST['phrase_detail_method'];
+ $array['phrase_details'][0]['phrase_detail_type'] = $_POST['phrase_detail_type'];
+ $array['phrase_details'][0]['phrase_detail_group'] = $_POST['phrase_detail_group'];
}
}
+ //execute update/insert
+ $p = new permissions;
+ $p->add('phrase_detail_add', 'temp');
+
+ $database = new database;
+ $database->app_name = 'phrases';
+ $database->app_uuid = '5c6f597c-9b78-11e4-89d3-123b93f75cba';
+ $database->save($array);
+ unset($array);
+
+ $p->delete('phrase_detail_add', 'temp');
+
//save the xml to the file system if the phrase directory is set
save_phrases_xml();
@@ -235,56 +201,57 @@
//send a redirect
message::add($text['message-update']);
header("Location: phrase_edit.php?id=".$phrase_uuid);
- return;
+ exit;;
- } //if ($action == "update")
+ }
- } //if ($_POST["persistformvar"] != "true")
+ }
- } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
+ }
//pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
- $phrase_uuid = check_str($_GET["id"]);
+ $phrase_uuid = $_GET["id"];
$sql = "select * from v_phrases ";
$sql .= "where ( ";
- $sql .= " domain_uuid = '".$domain_uuid."' or ";
+ $sql .= " domain_uuid = :domain_uuid or ";
$sql .= " domain_uuid is null ";
$sql .= ") ";
- $sql .= "and phrase_uuid = '".$phrase_uuid."' ";
- $prep_statement = $db->prepare(check_sql($sql));
- $prep_statement->execute();
- $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
- foreach ($result as &$row) {
+ $sql .= "and phrase_uuid = :phrase_uuid ";
+ $parameters['domain_uuid'] = $domain_uuid;
+ $parameters['phrase_uuid'] = $phrase_uuid;
+ $database = new database;
+ $row = $database->select($sql, $parameters, 'row');
+ if (is_array($row) && @sizeof($row) != 0) {
$phrase_name = $row["phrase_name"];
$phrase_language = $row["phrase_language"];
$phrase_enabled = $row["phrase_enabled"];
$phrase_description = $row["phrase_description"];
- break; //limit to 1 row
}
- unset ($prep_statement);
+ unset($sql, $parameters, $row);
}
//get the phrase details
- if (strlen($phrase_uuid) > 0) {
+ if (is_uuid($phrase_uuid)) {
$sql = "select * from v_phrase_details ";
- $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
- $sql .= "and phrase_uuid = '".$phrase_uuid."' ";
+ $sql .= "where domain_uuid = :domain_uuid ";
+ $sql .= "and phrase_uuid = :phrase_uuid ";
$sql .= "order by phrase_detail_order asc ";
- $prep_statement = $db->prepare(check_sql($sql));
- $prep_statement->execute();
- $phrase_details = $prep_statement->fetchAll(PDO::FETCH_NAMED);
- unset($sql, $prep_statement);
+ $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
+ $parameters['phrase_uuid'] = $phrase_uuid;
+ $database = new database;
+ $phrase_details = $database->select($sql, $parameters, 'all');
+ unset($sql, $parameters);
}
//get the recordings
$sql = "select * from v_recordings ";
- $sql .= "where domain_uuid = '".$_SESSION["domain_uuid"]."' ";
+ $sql .= "where domain_uuid = :domain_uuid ";
$sql .= "order by recording_name asc ";
- $prep_statement = $db->prepare(check_sql($sql));
- $prep_statement->execute();
- $recordings = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
- unset($sql, $prep_statement);
+ $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
+ $database = new database;
+ $recordings = $database->select($sql, $parameters, 'all');
+ unset($sql, $parameters);
//show the header
require_once "resources/header.php";
@@ -316,7 +283,7 @@
echo " obj_action.options[obj_action.options.length] = new Option('', '');\n"; //blank option
//recordings
$tmp_selected = false;
- if (count($recordings) > 0) {
+ if (is_array($recordings) && @sizeof($recordings) != 0) {
echo "var opt_group = document.createElement('optgroup');\n";
echo "opt_group.label = \"".$text['label-recordings']."\";\n";
foreach ($recordings as &$row) {
@@ -329,25 +296,26 @@
}
echo "obj_action.appendChild(opt_group);\n";
}
- unset($sql, $prep_statement, $recordings);
+ unset($recordings, $row);
//sounds
$file = new file;
$sound_files = $file->sounds();
- if (is_array($sound_files)) {
+ if (is_array($sound_files) && @sizeof($sound_files) != 0) {
echo "var opt_group = document.createElement('optgroup');\n";
echo "opt_group.label = \"".$text['label-sounds']."\";\n";
foreach ($sound_files as $value) {
if (strlen($value) > 0) {
- echo "opt_group.appendChild(new Option(\"".escape($value)."\", \"".escape($value)."\"));\n";
+ echo "opt_group.appendChild(new Option(\"".$value."\", \"".$value."\"));\n";
}
}
echo "obj_action.appendChild(opt_group);\n";
}
+ unset($sound_files, $row);
echo " }\n";
echo " else if (selected_index == 1) {\n"; //pause
echo " obj_action.options[obj_action.options.length] = new Option('', '');\n"; //blank option
for ($s = 0.1; $s <= 5; $s = $s + 0.1) {
- echo " obj_action.options[obj_action.options.length] = new Option('".$s."s', 'sleep(".($s * 1000).")');\n";
+ echo " obj_action.options[obj_action.options.length] = new Option('".number_format($s, 1)."s', 'sleep(".($s * 1000).")');\n";
}
echo " }\n";
if (if_group("superadmin")) {
@@ -458,7 +426,7 @@
echo "