mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-03-17 14:02:11 +00:00
Misc Classes: Database class integration.
This commit is contained in:
@@ -10,20 +10,13 @@ class sounds {
|
||||
/**
|
||||
* Called when the object is created
|
||||
*/
|
||||
public $db;
|
||||
public $domain_uuid;
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
//connect to the database if not connected
|
||||
if (!$this->db) {
|
||||
require_once "resources/classes/database.php";
|
||||
$database = new database;
|
||||
$database->connect();
|
||||
$this->db = $database->db;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,7 +37,7 @@ class sounds {
|
||||
public function get() {
|
||||
|
||||
//miscellaneous
|
||||
$x=0;
|
||||
$x = 0;
|
||||
if (if_group("superadmin")) {
|
||||
$array['miscellaneous'][$x]['name'] = "say";
|
||||
$array['miscellaneous'][$x]['value'] = "say:";
|
||||
@@ -55,12 +48,12 @@ class sounds {
|
||||
//recordings
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/phrases/app_config.php")) {
|
||||
$sql = "select recording_name, recording_filename from v_recordings ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION["domain_uuid"]."' ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "order by recording_name asc ";
|
||||
$prep_statement = $this->db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$recordings = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
if (is_array($recordings) > 0) {
|
||||
$parameters['domain_uuid'] = $_SESSION["domain_uuid"];
|
||||
$database = new database;
|
||||
$recordings = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($recordings) && @sizeof($recordings) != 0) {
|
||||
foreach ($recordings as &$row) {
|
||||
$recording_name = $row["recording_name"];
|
||||
$recording_filename = $row["recording_filename"];
|
||||
@@ -69,27 +62,29 @@ class sounds {
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters, $recordings, $row);
|
||||
}
|
||||
//phrases
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/phrases/app_config.php")) {
|
||||
$sql = "select * from v_phrases where domain_uuid = '".$_SESSION["domain_uuid"]."' ";
|
||||
$prep_statement = $this->db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
if (count($result) > 0) {
|
||||
foreach ($result as &$row) {
|
||||
$sql = "select * from v_phrases ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $_SESSION["domain_uuid"];
|
||||
$database = new database;
|
||||
$phrases = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($phrases) && @sizeof($phrases) != 0) {
|
||||
foreach ($phrases as &$row) {
|
||||
$array['phrases'][$x]['name'] = "phrase:".$row["phrase_name"];
|
||||
$array['phrases'][$x]['value'] = "phrase:".$row["phrase_uuid"];
|
||||
$x++;
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
unset($sql, $parameters, $phrases, $row);
|
||||
}
|
||||
//sounds
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/phrases/app_config.php")) {
|
||||
$file = new file;
|
||||
$sound_files = $file->sounds();
|
||||
if (is_array($sound_files)) {
|
||||
if (is_array($sound_files) && @sizeof($sound_files) != 0) {
|
||||
foreach ($sound_files as $value) {
|
||||
if (substr($value, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") {
|
||||
$value = substr($var, 71);
|
||||
@@ -102,8 +97,9 @@ class sounds {
|
||||
}
|
||||
//send the results
|
||||
return $array;
|
||||
//print_r($array);
|
||||
} // get method
|
||||
} //end class
|
||||
|
||||
?>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user