function Aastra_update_HDconfig_file($config, $extension, $header = NULL) { # Read config file $array = Aastra_read_HDconfig_file($config); # Update value if ($header) { $array[$extension] = $header; $array[$extension]['time'] = time(); } else { unset($array[$extension]); } # Update config file $handle = @fopen($config, 'w'); if ($handle) { foreach ($array as $key => $value) { fputs($handle, '[' . $key . ']' . "\n"); foreach ($value as $key2 => $value2) { if ($key2 != 'module') { fputs($handle, $key2 . '=' . $value2 . "\n"); } else { fputs($handle, $key2 . '=' . implode(',', $value2) . "\n"); } } } fclose($handle); @chmod($config, 0777); } else { Aastra_debug('Cannot open ' . $config . ' in write mode'); } }
$object->addEntry(Aastra_get_label('Next Page', $language), $XML_SERVER . '&action=input&step=3&extension=' . $extension . '&password='******'&page=' . ($page + 1)); } } } else { # Skip this phase $object = new AastraIPPhoneExecute(); $object->addEntry($XML_SERVER . '&action=submit&extension=' . $extension . '&password='******'submit': case 'override': # Read config file $ext_array = Aastra_read_HDconfig_file(AASTRA_PATH_CACHE . 'startup_asterisk.cfg'); # Test MAC address if ($ext_array[$extension]['mac'] != '' and $action != 'override') { if ($nb_softkeys) { # Display error as a TextScreen $object = new AastraIPPhoneTextScreen(); $object->setDestroyOnExit(); $object->setTitle(Aastra_get_label('Warning', $language)); if (!Aastra_is_user_registered_Asterisk($extension) and time() - $ext_array[$extension]['time'] < 180) { $object->setText(sprintf(Aastra_get_label('Extension already in use on a %s at %s but not registered yet. Please try again later.', $language), $ext_array[$extension]['model'], $ext_array[$extension]['ip'])); if ($nb_softkeys == 6) { $object->addSoftkey('6', Aastra_get_label('Close', $language), $XML_SERVER); } else { $object->addSoftkey('10', Aastra_get_label('Close', $language), $XML_SERVER); $object->setCancelAction($XML_SERVER); }