mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-02-21 18:36:31 +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:
@@ -5,11 +5,16 @@
|
||||
*/
|
||||
class email_queue {
|
||||
|
||||
/**
|
||||
* declare constant variables
|
||||
*/
|
||||
const app_name = 'email_queue';
|
||||
const app_uuid = '5befdf60-a242-445f-91b3-2e9ee3e0ddf7';
|
||||
|
||||
/**
|
||||
* declare the variables
|
||||
*/
|
||||
private $app_name;
|
||||
private $app_uuid;
|
||||
private $database;
|
||||
private $name;
|
||||
private $table;
|
||||
private $toggle_field;
|
||||
@@ -21,13 +26,16 @@
|
||||
*/
|
||||
public function __construct() {
|
||||
//assign the variables
|
||||
$this->app_name = 'email_queue';
|
||||
$this->app_uuid = '5befdf60-a242-445f-91b3-2e9ee3e0ddf7';
|
||||
$this->name = 'email_queue';
|
||||
$this->table = 'email_queue';
|
||||
$this->toggle_field = '';
|
||||
$this->toggle_values = ['true','false'];
|
||||
$this->location = 'email_queue.php';
|
||||
$this->name = 'email_queue';
|
||||
$this->table = 'email_queue';
|
||||
$this->toggle_field = '';
|
||||
$this->toggle_values = ['true','false'];
|
||||
$this->location = 'email_queue.php';
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,10 +75,7 @@
|
||||
//delete the checked rows
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
//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);
|
||||
|
||||
//set message
|
||||
@@ -118,10 +123,8 @@
|
||||
//save the changes
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
//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);
|
||||
|
||||
//set message
|
||||
@@ -163,8 +166,7 @@
|
||||
$sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") ";
|
||||
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$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) {
|
||||
$states[$row['uuid']] = $row['toggle'];
|
||||
@@ -187,10 +189,8 @@
|
||||
//save the changes
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
//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);
|
||||
|
||||
//set message
|
||||
@@ -235,8 +235,7 @@
|
||||
$sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") ";
|
||||
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$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) {
|
||||
$x = 0;
|
||||
foreach ($rows as $row) {
|
||||
@@ -256,10 +255,8 @@
|
||||
//save the changes and set the message
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
//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);
|
||||
|
||||
//set message
|
||||
|
||||
Reference in New Issue
Block a user