}
     $networks = polycomphones_get_networks_list();
     require 'modules/polycomphones/views/polycomphones_networks.php';
     break;
 case 'networks_edit':
     if (isset($_POST['action']) && $_POST['action'] == 'edit') {
         $network['name'] = $_POST['name'];
         $network['cidr'] = $_POST['cidr'];
         $fields = array('prov_ssl', 'prov_username', 'prov_password', 'prov_uploads', 'address', 'port', 'nat_keepalive_interval', 'tcpIpApp_sntp_address', 'tcpIpApp_sntp_address_overrideDHCP', 'tcpIpApp_sntp_gmtOffset', 'voice_codecPref_G711_Mu', 'voice_codecPref_G711_A', 'voice_codecPref_G722', 'voice_codecPref_G729_AB');
         foreach ($fields as $field) {
             $network['settings'][$field] = $_POST[$field];
         }
         polycomphones_save_networks_edit($_GET['edit'], $network);
         redirect('config.php?type=setup&display=polycomphones&polycomphones_form=networks_list');
     }
     $network = polycomphones_get_networks_edit($_GET['edit']);
     if (empty($_GET['edit'])) {
         $network['settings']['prov_uploads'] = '1';
         $network['settings']['port'] = '5060';
         $network['settings']['voice_codecPref_G711_Mu'] = '6';
         $network['settings']['voice_codecPref_G711_A'] = '7';
         $network['settings']['voice_codecPref_G722'] = '4';
         $network['settings']['voice_codecPref_G729_AB'] = '8';
     }
     require 'modules/polycomphones/views/polycomphones_networks_edit.php';
     break;
 case 'corporate_edit':
     if (isset($_POST['action']) && $_POST['action'] == 'edit') {
         $fields = array('dir_corp_address', 'dir_corp_port', 'dir_corp_baseDN', 'dir_corp_user', 'dir_corp_password', 'exchange_server_url', 'feature_corporateDirectory_enabled', 'feature_exchangeCalendar_enabled');
         foreach ($fields as $field) {
             $settings[$field] = $_POST[$field];
function polycomphones_get_networks_ip($ip)
{
    global $db;
    $results = sql("SELECT id, cidr FROM polycom_networks ORDER BY cidr DESC", 'getAll', DB_FETCHMODE_ASSOC);
    foreach ($results as $result) {
        if (polycomphones_cidr_ip_check($ip, $result['cidr'])) {
            return polycomphones_get_networks_edit($result['id']);
        }
    }
}