mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Define app_name and app_uuid as constants (#7534)
* Set a constant on each class for app_name and app_uuid * Update the database class to use the app_uuid and app_name * Update the classes to use the database::new() * Remove the instances of 'new database'
This commit is contained in:
@@ -27,6 +27,12 @@
|
||||
//define the ivr_menu class
|
||||
class ivr_menu {
|
||||
|
||||
/**
|
||||
* declare constant variables
|
||||
*/
|
||||
const app_name = 'ivr_menus';
|
||||
const app_uuid = 'a5788e9b-58bc-bd1b-df59-fff5d51253ab';
|
||||
|
||||
/**
|
||||
* declare public variables
|
||||
*/
|
||||
@@ -36,8 +42,8 @@
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
private $app_name;
|
||||
private $app_uuid;
|
||||
|
||||
private $database;
|
||||
private $permission_prefix;
|
||||
private $list_page;
|
||||
private $table;
|
||||
@@ -51,10 +57,13 @@
|
||||
public function __construct() {
|
||||
|
||||
//assign private variables
|
||||
$this->app_name = 'ivr_menus';
|
||||
$this->app_uuid = 'a5788e9b-58bc-bd1b-df59-fff5d51253ab';
|
||||
$this->list_page = 'ivr_menus.php';
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function find() {
|
||||
@@ -68,8 +77,7 @@
|
||||
$sql .= $this->order_by;
|
||||
}
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$database = new database;
|
||||
return $database->select($sql, $parameters, 'all');
|
||||
return $this->database->select($sql, $parameters, 'all');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,8 +122,7 @@
|
||||
$sql .= "where (domain_uuid = :domain_uuid) ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$rows = $database->select($sql, $parameters, 'all');
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
$ivr_menus[$row['uuid']]['dialplan_uuid'] = $row['dialplan_uuid'];
|
||||
@@ -143,10 +150,7 @@
|
||||
$p->add('dialplan_delete', 'temp');
|
||||
|
||||
//execute delete
|
||||
$database = new database;
|
||||
$database->app_name = $this->app_name;
|
||||
$database->app_uuid = $this->app_uuid;
|
||||
$database->delete($array);
|
||||
$this->database->delete($array);
|
||||
unset($array);
|
||||
|
||||
//revoke temporary permissions
|
||||
@@ -218,8 +222,7 @@
|
||||
$sql .= "and ivr_menu_uuid = :ivr_menu_uuid ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['ivr_menu_uuid'] = $this->ivr_menu_uuid;
|
||||
$database = new database;
|
||||
$ivr_menu_context = $database->select($sql, $parameters, 'column');
|
||||
$ivr_menu_context = $this->database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
}
|
||||
|
||||
@@ -227,10 +230,7 @@
|
||||
if (!empty($array)) {
|
||||
|
||||
//execute delete
|
||||
$database = new database;
|
||||
$database->app_name = $this->app_name;
|
||||
$database->app_uuid = $this->app_uuid;
|
||||
$database->delete($array);
|
||||
$this->database->delete($array);
|
||||
unset($array);
|
||||
|
||||
//clear the cache
|
||||
@@ -286,8 +286,7 @@
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$rows = $database->select($sql, $parameters, 'all');
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
$ivr_menus[$row['uuid']]['state'] = $row['toggle'];
|
||||
@@ -315,10 +314,7 @@
|
||||
$p->add('dialplan_edit', 'temp');
|
||||
|
||||
//save the array
|
||||
$database = new database;
|
||||
$database->app_name = $this->app_name;
|
||||
$database->app_uuid = $this->app_uuid;
|
||||
$database->save($array);
|
||||
$this->database->save($array);
|
||||
unset($array);
|
||||
|
||||
//revoke temporary permissions
|
||||
@@ -388,8 +384,7 @@
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$rows = $database->select($sql, $parameters, 'all');
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (!empty($rows)) {
|
||||
$y = $z = 0;
|
||||
foreach ($rows as $x => $row) {
|
||||
@@ -407,8 +402,7 @@
|
||||
//ivr menu options sub table
|
||||
$sql_2 = "select * from v_ivr_menu_options where ivr_menu_uuid = :ivr_menu_uuid";
|
||||
$parameters_2['ivr_menu_uuid'] = $row['ivr_menu_uuid'];
|
||||
$database = new database;
|
||||
$rows_2 = $database->select($sql_2, $parameters_2, 'all');
|
||||
$rows_2 = $this->database->select($sql_2, $parameters_2, 'all');
|
||||
if (!empty($rows_2)) {
|
||||
foreach ($rows_2 as $row_2) {
|
||||
|
||||
@@ -429,8 +423,7 @@
|
||||
//ivr menu dialplan record
|
||||
$sql_3 = "select * from v_dialplans where dialplan_uuid = :dialplan_uuid";
|
||||
$parameters_3['dialplan_uuid'] = $row['dialplan_uuid'];
|
||||
$database = new database;
|
||||
$dialplan = $database->select($sql_3, $parameters_3, 'row');
|
||||
$dialplan = $this->database->select($sql_3, $parameters_3, 'row');
|
||||
if (!empty($dialplan)) {
|
||||
|
||||
//copy data
|
||||
@@ -463,10 +456,7 @@
|
||||
$p->add('dialplan_add', 'temp');
|
||||
|
||||
//save the array
|
||||
$database = new database;
|
||||
$database->app_name = $this->app_name;
|
||||
$database->app_uuid = $this->app_uuid;
|
||||
$database->save($array);
|
||||
$this->database->save($array);
|
||||
unset($array);
|
||||
|
||||
//revoke temporary permissions
|
||||
|
||||
Reference in New Issue
Block a user