84 lines
2.5 KiB
PHP
84 lines
2.5 KiB
PHP
<?php
|
|
/*
|
|
FusionPBX
|
|
Version: MPL 1.1
|
|
|
|
The contents of this file are subject to the Mozilla Public License Version
|
|
1.1 (the "License"); you may not use this file except in compliance with
|
|
the License. You may obtain a copy of the License at
|
|
http://www.mozilla.org/MPL/
|
|
|
|
Software distributed under the License is distributed on an "AS IS" basis,
|
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
for the specific language governing rights and limitations under the
|
|
License.
|
|
|
|
The Original Code is FusionPBX
|
|
|
|
The Initial Developer of the Original Code is
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2016
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
Contributor(s):
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
*/
|
|
|
|
//proccess this only one time
|
|
if ($domains_processed == 1) {
|
|
|
|
//define array of settings
|
|
$x = 0;
|
|
$array[$x]['default_setting_uuid'] = 'e34b276a-1b64-4d11-9470-ae3ea977c47e';
|
|
$array[$x]['default_setting_category'] = 'adminer';
|
|
$array[$x]['default_setting_subcategory'] = 'auto_login';
|
|
$array[$x]['default_setting_name'] = 'boolean';
|
|
$array[$x]['default_setting_value'] = 'true';
|
|
$array[$x]['default_setting_enabled'] = 'false';
|
|
$array[$x]['default_setting_description'] = 'Set whether to auto-login to Adminer, or require a username and password.';
|
|
$x++;
|
|
|
|
//get an array of the default settings
|
|
$sql = "select * from v_default_settings ";
|
|
$sql .= "where default_setting_category = 'adminer' ";
|
|
$prep_statement = $db->prepare($sql);
|
|
$prep_statement->execute();
|
|
$default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
|
unset ($prep_statement, $sql);
|
|
|
|
//find the missing default settings
|
|
$x = 0;
|
|
foreach ($array as $setting) {
|
|
$found = false;
|
|
$missing[$x] = $setting;
|
|
foreach ($default_settings as $row) {
|
|
if (trim($row['default_setting_subcategory']) == trim($setting['default_setting_subcategory'])) {
|
|
$found = true;
|
|
//remove items from the array that were found
|
|
unset($missing[$x]);
|
|
}
|
|
}
|
|
$x++;
|
|
}
|
|
unset($array);
|
|
|
|
//update the array structure
|
|
if (is_array($missing)) {
|
|
$array['default_settings'] = $missing;
|
|
unset($missing);
|
|
}
|
|
|
|
//add the default settings
|
|
if (is_array($array)) {
|
|
$database = new database;
|
|
$database->app_name = 'default_settings';
|
|
$database->app_uuid = '2c2453c0-1bea-4475-9f44-4d969650de09';
|
|
$database->save($array);
|
|
$message = $database->message;
|
|
unset($database);
|
|
}
|
|
|
|
}
|
|
|
|
?>
|