mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Misc Classes: Database class integration.
This commit is contained in:
@@ -29,7 +29,6 @@ if (!class_exists('tones')) {
|
||||
class tones {
|
||||
|
||||
//define variables
|
||||
public $db;
|
||||
private $tones;
|
||||
private $music_list;
|
||||
private $recordings_list;
|
||||
@@ -37,14 +36,6 @@ if (!class_exists('tones')) {
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
@@ -53,11 +44,9 @@ if (!class_exists('tones')) {
|
||||
$sql = "select * from v_vars ";
|
||||
$sql .= "where var_category = 'Tones' ";
|
||||
$sql .= "order by var_name asc ";
|
||||
$prep_statement = $this->db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$tones = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset ($prep_statement, $sql);
|
||||
foreach($tones as $tone) {
|
||||
$database = new database;
|
||||
$tones = $database->select($sql, null, 'all');
|
||||
foreach ($tones as $tone) {
|
||||
$tone = $tone['var_name'];
|
||||
$label = $text['label-'.$tone];
|
||||
if ($label == "") {
|
||||
@@ -66,8 +55,7 @@ if (!class_exists('tones')) {
|
||||
$tone_list[$tone] = $label;
|
||||
}
|
||||
$this->tones = $tone_list;
|
||||
unset($tone_list);
|
||||
|
||||
unset($sql, $tones, $tone, $tone_list);
|
||||
}
|
||||
|
||||
public function tones_list() {
|
||||
@@ -76,4 +64,4 @@ if (!class_exists('tones')) {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user