Specifications

PA-001011-03-04 Aastra July 2014
309
#####################################################################
# update_config_file(extension)
# Update the config file deleting the current extension
#
# Parameters
# extension user extension
#####################################################################
function update_config_file($extension)
{
# Config file
$config="startup.cfg";
# Read config file
$array = @parse_ini_file($config, true);
if($array==NULL) $array=array();
# Update config file
$handle = @fopen($config, "w");
if($handle)
{
foreach($array as $key=>$value)
{
if($key!=$extension)
{
fputs($handle,"[".$key."]"."\n");
fputs($handle,"mac=".$value['mac']."\n");
fputs($handle,"ip=".$value['ip']."\n");
fputs($handle,"model=".$value['model']."\n\n");
}
}
fclose($handle);
}
}
#####################################################################
# delete_mac(mac)
# Deletes the MAC.cfg file for the user.
#
# Parameters
# mac MAC address of the phone
#
#####################################################################
function delete_mac($mac)
{
# Delete MAC.cfg
@unlink("/tftpboot/".$mac.".cfg");
}
#####################################################################
# Main code
#####################################################################
# GLOBAL VARIABLES
$XML_SERVER = "http://".$_SERVER['SERVER_ADDR'].$_SERVER['SCRIPT_NAME'];
# Retrieve parameters
$extension=$_GET["extension"];
$password=$_GET["password"];
$action=$_GET["action"];
# Set content type
header("Content-Type: text/xml");
# Process action
switch($action)
{
case 'display':
# Reboot
$output = "<AastraIPPhoneTextScreen LockIn=\"yes\"
destroyOnExit=\"yes\">\n";
$output .= "<Title>REBOOT</Title>\n";