fusionpbx/app/provision/app_defaults.php

70 lines
2.2 KiB
PHP
Raw Normal View History

<?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>
*/
2017-01-13 07:47:44 +01:00
//process this code online once
if ($domains_processed == 1) {
2017-11-14 07:41:02 +01:00
2017-01-13 07:47:44 +01:00
//normalize the mac address
$sql = "select device_uuid, device_mac_address ";
$sql .= "from v_devices ";
2017-01-13 07:47:44 +01:00
$sql .= "where (device_mac_address like '%-%' or device_mac_address like '%:%') ";
$prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) {
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
2017-01-13 07:38:58 +01:00
if (is_array($result)) {
2017-01-10 09:03:27 +01:00
foreach($result as $row) {
$device_uuid = $row["device_uuid"];
$device_mac_address = $row["device_mac_address"];
$device_mac_address = strtolower($device_mac_address);
$device_mac_address = preg_replace('#[^a-fA-F0-9./]#', '', $device_mac_address);
$sql = "update v_devices set ";
$sql .= "device_mac_address = '".$device_mac_address."' ";
$sql .= "where device_uuid = '".$device_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
}
}
unset($prep_statement, $result);
}
2017-11-14 07:41:02 +01:00
//update the default settings
$sql = "update v_default_settings set ";
$sql .= "default_setting_value = 'true', ";
$sql .= "default_setting_name = 'boolean', ";
$sql .= "default_setting_enabled = 'true' ";
$sql .= "where default_setting_subcategory = 'http_domain_filter' ";
$sql .= "and default_setting_name = 'text' ";
$sql .= "and default_setting_value = 'false' ";
$sql .= "and default_setting_enabled = 'false' ";
$db->exec($sql);
unset($sql);
2017-01-12 23:46:33 +01:00
}
2016-10-23 01:20:24 +02:00
?>