Files
fusionpbx/app/tftp/app_defaults.php
minotaur01 94b7b98f8e TFTP Service v1.0.3 (#1858)
* Added functionality to show when a devices was last provisioned

Added functionality to show when a devices was last provisioned

Need addition to database: v_devices table:
device_provisioned_on -> datetime
device_provisioned_by -> char(10)

* Revert "Added functionality to show when a devices was last provisioned"

This reverts commit c3e40d68fa.

* Revert "Revert "Added functionality to show when a devices was last provisioned""

This reverts commit 8c27a46565.

* Changed field names as requested

Changed field names as requested for last provisioned data

* Added database fields for device provisoned functionality

Added provisioned_date, provisioned_method, provisioned_ip

* Added ability to search device provisioned info

* Added ip tracking to device provisoned functionality

Added ip tracking to device provisoned functionality and moved the code
to before rendering to register the contact even on unseccessful render

* Added IP address to status column

* TFTP Service v1

TFTP Service  v1

* Update app_config.php

* TFTP Service v1.0.1

TFTP Service v1.0.1

* TFTP Service v1.0.2

* TFTP Service v1.0.2-1

Renamed file

* TFTP Service 1.0.3

Bug fixes

* Modified to ignore IDE files
2016-08-26 13:04:49 -06:00

90 lines
3.1 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
Sebastian Krupinski <sebastian@ksacorp.com>
Portions created by the Initial Developer are Copyright (C) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Sebastian Krupinski <sebastian@ksacorp.com>
*/
//process this code online once
if ($domains_processed == 1) {
//define array of settings
$x = 0;
$array[$x]['default_setting_category'] = 'provision';
$array[$x]['default_setting_subcategory'] = 'tftp_service_address';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = '0.0.0.0';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'the address for the TFTP service to listen for connection on';
$x++;
$array[$x]['default_setting_category'] = 'provision';
$array[$x]['default_setting_subcategory'] = 'tftp_service_port';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '69';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'the port for the TFTP service to listen for connection on';
$x++;
$array[$x]['default_setting_category'] = 'provision';
$array[$x]['default_setting_subcategory'] = 'tftp_service_fileslocation';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '/tmp';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'the location for static files e.g. firmware';
//get an array of the default settings
$sql = "SELECT * FROM v_default_settings ";
$sql .= "WHERE default_setting_category = 'provision' AND default_setting_subcategory = 'tftp_service_%'";
$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++;
}
//add the missing default settings
if (count($missing) > 0) foreach ($missing as $row) {
//add the default settings
$orm = new orm;
$orm->name('default_settings');
$orm->save($row);
$message = $orm->message;
unset($orm);
//print_r($message);
}
unset($missing);
}
?>