Changeset 11010

Show
Ignore:
Timestamp:
01/18/11 15:53:25 (2 years ago)
Author:
p_lindheimer
Message:

get rid of UINT, adds validation and method to check results of last update re #4740, this checking may momentarily break stuff as it has not been tested with setting values, about to do that so fixes to come shortly

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/htdocs/admin/libraries/freepbx_conf.class.php

    r11008 r11010  
    44define("CONF_TYPE_DIR",    'dir'); 
    55define("CONF_TYPE_INT",    'int'); 
    6 define("CONF_TYPE_UINT",   'uint'); 
    76define("CONF_TYPE_SELECT", 'select'); 
    87 
     
    2524  'AMPDBNAME'      => array(CONF_TYPE_TEXT, 'asterisk'), 
    2625  'AMPENGINE'      => array(CONF_TYPE_SELECT, 'asterisk'), 
    27   'ASTMANAGERPORT' => array(CONF_TYPE_UINT, '5038'), 
     26  'ASTMANAGERPORT' => array(CONF_TYPE_INT, '5038'), 
    2827  'ASTMANAGERHOST' => array(CONF_TYPE_TEXT, 'localhost'), 
    2928  'AMPDBHOST'      => array(CONF_TYPE_TEXT, 'localhost'), 
     
    3433  'FOPPASSWORD'    => array(CONF_TYPE_TEXT, 'passw0rd'), 
    3534  'FOPSORT'        => array(CONF_TYPE_SELECT, 'extension'), 
    36   'AMPSYSLOGLEVEL '=> array(CONF_TYPE_UINT, 'LOG_ERR'), 
    37   'NOOPTRACE'      => array(CONF_TYPE_UINT, '1'), 
     35  'AMPSYSLOGLEVEL '=> array(CONF_TYPE_INT, 'LOG_ERR'), 
     36  'NOOPTRACE'      => array(CONF_TYPE_INT, '1'), 
    3837  'ARI_ADMIN_PASSWORD' => array(CONF_TYPE_TEXT, 'ari_password'), 
    3938  'CFRINGTIMERDEFAULT' => array(CONF_TYPE_SELECT, '0'), 
     
    7776 
    7877  // Time Conditions (2.9 New) 
    79   'TCINTERVAL'     => array(CONF_TYPE_UINT, '60'), 
     78  'TCINTERVAL'     => array(CONF_TYPE_INT, '60'), 
    8079  'TCMAINT'        => array(CONF_TYPE_BOOL, true), 
    8180 
     
    9897  var $parsed_from_db = false; 
    9998  var $amportal_canwrite; 
     99 
     100  // This will be set with any update/define to provide feedback that can be optionally used inside or outside of 
     101  // the class. The structure should be: 
     102  // $last_update_status[$keyword]['validated']   true/false 
     103  // $last_update_status[$keyword]['saved']       true/false 
     104  // $last_update_status[$keyword]['orig_value']  value submitted 
     105  // $last_update_status[$keyword]['saved_value'] value submitted 
     106  // $last_update_status[$keyword]['msg']         error message 
     107  var $last_update_status; 
     108 
     109  // Internal reference pointer to the internal $last_update_status[$keyword] 
     110  // e.g. $this->_last_update_status =& $last_update_status[$keyword]; 
     111  // 
     112  var $_last_update_status; 
     113 
    100114 
    101115  // access should always be through create so only one copy is ever running 
     
    123137      die_freepbx(_('fatal error reading freepbx_settings'));  
    124138    } 
     139    unset($this->last_update_status); 
    125140    foreach($db_raw as $setting) { 
     141      $this->last_update_status[$setting['keyword']]['validated'] = false; 
     142      $this->last_update_status[$setting['keyword']]['saved'] = false; 
     143      $this->last_update_status[$setting['keyword']]['orig_value'] = $setting['value']; 
     144      $this->last_update_status[$setting['keyword']]['saved_value'] = $setting['value']; 
     145      $this->last_update_status[$setting['keyword']]['msg'] = ''; 
     146      $this->_last_update_status =& $this->last_update_status[$setting['keyword']]; 
     147 
    126148      $this->db_conf_store[$setting['keyword']] = $setting; 
    127149      $this->db_conf_store[$setting['keyword']]['modified'] = false; 
     
    129151      // note the reference assignment, if it's actually the authoritative source 
    130152      $this->conf[$setting['keyword']] =& $this->db_conf_store[$setting['keyword']]['value']; 
     153 
     154      // The assumption is that the database settings were validated on input. We are not going to throw errors when 
     155      // reading them back but the last_update_status array is available for debugging purposes to review. 
     156      // 
    131157      if (!$setting['emptyok'] && $setting['value'] == '') { 
    132         $this->db_conf_store[$setting['keyword']]['value'] = $this->_prepare_conf_value($setting['value'], $setting['type'], $setting['defaultval']); 
     158        $this->db_conf_store[$setting['keyword']]['value'] = $this->_prepare_conf_value($setting['defaultval'], $setting['type'], $setting['emptyok'], $setting['options']); 
    133159      } else { 
    134         $this->db_conf_store[$setting['keyword']]['value'] = $this->_prepare_conf_value($setting['value'], $setting['type'], $setting['emptyok']); 
     160        $this->db_conf_store[$setting['keyword']]['value'] = $this->_prepare_conf_value($setting['value'], $setting['type'], $setting['emptyok'], $setting['options']); 
    135161      } 
    136162    } 
     
    301327  } 
    302328 
     329  function get_last_update_status() { 
     330    return $this->last_update_status; 
     331  } 
     332 
    303333  // used to insert or update an existing setting such as in an install 
    304334  // script. $vars will include some required fields and we are strict 
     
    311341  //        different then the initial value??? 
    312342  // 
     343 
    313344  function define_conf_setting($keyword,$vars,$commit=false) { 
    314345    global $amp_conf; 
     346 
     347    unset($this->last_update_status); 
     348    $this->last_update_status[$keyword]['validated'] = false; 
     349    $this->last_update_status[$keyword]['saved'] = false; 
     350    $this->last_update_status[$keyword]['orig_value'] = $vars['value']; 
     351    $this->last_update_status[$keyword]['saved_value'] = $vars['value']; 
     352    $this->last_update_status[$keyword]['msg'] = ''; 
     353 
     354    $this->_last_update_status =& $this->last_update_status[$keyword]; 
     355 
    315356    $attributes = array( 
    316357      'keyword' => '', 
     
    336377      die_freepbx(sprintf(_("missing value and/or defaultval required for [%s]"),$keyword)); 
    337378    } else { 
    338       // validate even if already set, catches coding errors early even though we don't use it 
    339       $value = $this->_prepare_conf_value($vars['value'], $vars['type'] ,$vars['emptyok']); 
    340       $attributes['value'] = $new_setting ? $value : $this->db_conf_store[$keyword]; 
    341       $attributes['defaultval'] = $this->_prepare_conf_value($vars['defaultval'], $vars['type'] ,$vars['emptyok']); 
    342379      $attributes['keyword'] = $keyword; 
    343380      $attributes['type'] = $vars['type']; 
    344381    } 
    345     if ($vars['type'] == CONF_TYPE_SELECT) { 
     382    switch ($vars['type']) {  
     383    case CONF_TYPE_SELECT: 
    346384      if (!isset($vars['options']) || $vars['options'] == '') {  
    347385        die_freepbx(sprintf(_("missing options for keyword [%] required if type is select"),$keyword)); 
    348386      } else { 
    349         $attributes['options'] = is_array($vars['options']) ? implode(',',$vars['options']) : $vars['options']; 
    350       } 
    351     } 
     387        $opt_array =  is_array($vars['options']) ? $vars['options'] : explode(',',$vars['options']); 
     388        foreach($opt_array as $av) { 
     389          $trim_options[] = trim($av); 
     390        } 
     391        $attributes['options'] = implode(',',$trim_options); 
     392        unset($opt_array); 
     393        unset($trim_options); 
     394      } 
     395    break; 
     396    case CONF_TYPE_INT: 
     397      if (isset($vars['options']) && $vars['options'] != '') {  
     398        $validate_options = !is_array($vars['options']) ? explode(',',$vars['options']) : $vars['options']; 
     399        if (count($validate_options) != 2 || !is_numeric($validate_options[0]) || !is_numeric($validate_options[1])) { 
     400          die_freepbx(sprintf(_("invalid validation options provided for keyword %s: %s"),$keyword,implode(',',$validate_options))); 
     401        } else { 
     402          $attributes['options'] = (int) $validate_options[0] . ',' . (int) $validate_options[1]; 
     403        } 
     404      } 
     405    break; 
     406    case CONF_TYPE_TEXT: 
     407    case CONF_TYPE_DIR: 
     408      if (isset($vars['options'])) {  
     409        $attributes['options'] = $vars['options']; 
     410      } 
     411    break; 
     412    } 
     413 
    352414    if (isset($vars['level'])) { 
    353415      $attributes['level'] = (int) $vars['level'] > 0 ? ((int) $vars['level'] < 10 ? (int) $vars['level'] : 10) : 0; 
     
    368430      } 
    369431    } 
     432 
     433    // validate even if already set, catches coding errors early even though we don't use it 
     434    $value = $this->_prepare_conf_value($vars['value'], $vars['type'] ,$attributes['emptyok'], $attributes['options']); 
     435    $attributes['value'] = $new_setting ? $value : $this->db_conf_store[$keyword]; 
     436    $attributes['defaultval'] = $this->_prepare_conf_value($vars['defaultval'], $vars['type'] ,$attributes['emptyok'], $attributes['options']); 
     437 
     438    // Let's be really stict here, if anything violated validation, we fail! 
     439    // This method is only called to define new settings, this catches programming errors early on. 
     440    //  
     441    if (!$this->_last_update_status['validated']) { 
     442      die_freepbx( 
     443        sprintf(_("method define_conf_setting() failed to pass validation for keyword [%s] setting value [%s], error msg if supplied [%s]"), 
     444        $keyword, $vars['value'], $this->_last_update_status['msg']) 
     445      ); 
     446    } 
     447 
    370448    if ($new_setting || $attributes != $this->db_conf_store[$keyword]) { 
    371449      if (!$new_setting) { 
     
    395473      die_freepbx(_("called set_conf_values with a non-array")); 
    396474    } 
     475    unset($this->last_update_status); 
    397476    foreach($update_arr as $keyword => $value) { 
    398477      if (!isset($this->db_conf_store[$keyword])) { 
    399478        die_freepbx(sprintf(_("trying to set keyword [%s] to [%s] on unitialized setting"),$keyword, $value)); 
    400479      }  
    401       $prep_value = $this->_prepare_conf_value($value, $this->db_conf_store[$keyword]['type'] ,$this->db_conf_store[$keyword]['emptyok']); 
    402       if ($prep_value != $this->db_conf_store[$keyword]['value'] && ($prep_value !== '' || $this->db_conf_store[$keyword]['emptyok']) && ($override_readonly || !$this->db_conf_store[$keyword]['readonly'])) { 
     480      $this->last_update_status[$keyword]['validated'] = false; 
     481      $this->last_update_status[$keyword]['saved'] = false; 
     482      $this->last_update_status[$keyword]['orig_value'] = $value; 
     483      $this->last_update_status[$keyword]['saved_value'] = $value; 
     484      $this->last_update_status[$keyword]['msg'] = ''; 
     485      $this->_last_update_status =& $this->last_update_status[$keyword]; 
     486 
     487      $prep_value = $this->_prepare_conf_value($value, $this->db_conf_store[$keyword]['type'], $this->db_conf_store[$keyword]['emptyok'], $this->db_conf_store[$keyword]['options']); 
     488 
     489      // If we reported saved then even if we didn't validate, we still were able to rectify 
     490      // it into something and therefore will use it. For example, if we set an integer out of 
     491      // range then we will still save the value. If the calling function wants to be strict 
     492      // they can not supply the commit flag and check the validation status and not save/commit 
     493      // the value based on their own decision criteria. 
     494      // 
     495      if ($this->_last_update_status['saved']  
     496        && $prep_value != $this->db_conf_store[$keyword]['value']  
     497        && ($prep_value !== '' || $this->db_conf_store[$keyword]['emptyok'])  
     498        && ($override_readonly || !$this->db_conf_store[$keyword]['readonly'])) { 
     499 
    403500        $this->db_conf_store[$keyword]['value'] = $prep_value; 
    404501        $this->db_conf_store[$keyword]['modified'] = true; 
     
    412509  } 
    413510 
    414   function _prepare_conf_value($value, $type, $emptyok) { 
     511  function _prepare_conf_value($value, $type, $emptyok, $options = false) { 
    415512    switch ($type) { 
     513 
    416514    case CONF_TYPE_BOOL: 
    417515      $ret = $value ? 1 : 0; 
     516      $this->_last_update_status['validated'] = true; 
    418517      break; 
     518 
     519    case CONF_TYPE_SELECT: 
     520      $val_arr = explode(',',$options); 
     521      if (in_array($value,$val_arr)) { 
     522        $ret = $value; 
     523        $this->_last_update_status['validated'] = true; 
     524      } else { 
     525        $ret = null; 
     526        $this->_last_update_status['validated'] = false; 
     527        $this->_last_update_status['msg'] = _("Invalid value supplied to select"); 
     528        $this->_last_update_status['saved_value'] = $ret; 
     529        $this->_last_update_status['saved'] = false; 
     530  file_put_contents("/tmp/freepbx_debug.log","SELECT failed: [$value] ".print_r($val_arr,true),FILE_APPEND); 
     531        dbug($value); 
     532        dbug($val_arr); 
     533        // 
     534        // NOTE: returning from function early! 
     535        return $ret; 
     536      } 
     537      break; 
     538 
     539    case CONF_TYPE_DIR: 
     540      // we don't consider trailing '/' in a directory an error for validation purposes 
     541      $value = rtrim($value,'/'); 
     542      // NOTE: fallthrough to CONF_TYPE_TEXT, NO break on purpose! 
     543      //       | 
     544      //       | 
     545      //       V 
    419546    case CONF_TYPE_TEXT: 
    420     case CONF_TYPE_SELECT: 
    421       $ret = $value; 
     547      if ($value == '' && !$emptyok) { 
     548        $this->_last_update_status['validated'] = false; 
     549        $this->_last_update_status['msg'] = _("Empty value not allowed for this field"); 
     550      } else if ($options != '' && $value != '') { 
     551        if (preg_match($options,$value)) { 
     552          $ret = $value; 
     553          $this->_last_update_status['validated'] = true; 
     554        } else { 
     555          $ret = null; 
     556          $this->_last_update_status['validated'] = false; 
     557          $this->_last_update_status['msg'] = sprintf(_("Invalid value supplied violates the validation regex: %s"),$options); 
     558          $this->_last_update_status['saved_value'] = $ret; 
     559          $this->_last_update_status['saved'] = false; 
     560          // 
     561          // NOTE: returning from function early! 
     562          return $ret; 
     563        } 
     564      } else { 
     565        $ret = $value; 
     566        $this->_last_update_status['validated'] = true; 
     567      } 
    422568      break; 
    423     case CONF_TYPE_DIR: 
    424       $ret = rtrim($value,'/'); 
    425       break; 
     569 
    426570    case CONF_TYPE_INT: 
    427571      $ret = $emptyok && $value == '' ? '' : (int) $value; 
     572 
     573      if ($options != '' && $ret != '') { 
     574        $range = is_array($options) ? $options : explode(',',$options); 
     575        switch ($ret) { 
     576        case $ret < $range[0]: 
     577          $ret = $range[0]; 
     578          $this->_last_update_status['validated'] = false; 
     579          $this->_last_update_status['msg'] = sprintf(_("Value [%s] out of range, changed to [%s]"),$value,$ret); 
     580        break; 
     581        case $ret > $range[1]: 
     582          $ret = $range[1]; 
     583          $this->_last_update_status['validated'] = false; 
     584          $this->_last_update_status['msg'] = sprintf(_("Value [%s] out of range, changed to [%s]"),$value,$ret); 
     585        break; 
     586        default: 
     587          $this->_last_update_status['validated'] = (string) $ret === (string) $value; 
     588        break; 
     589        } 
     590      } else { 
     591        $this->_last_update_status['validated'] = (string) $ret === (string) $value; 
     592      } 
    428593      break; 
    429     case CONF_TYPE_UINT: 
    430       $ret = $emptyok && $value == '' ? '' : ((int) $value < 0 ? 0 : (int) $value); 
    431       break; 
     594 
    432595    default: 
    433596      die_freepbx(sprintf(_("unknown type: [%s]"),$type)); 
    434597      break; 
    435598    } 
     599    $this->_last_update_status['saved_value'] = $ret; 
     600    $this->_last_update_status['saved'] = true; 
    436601    return $ret; 
    437602  } 
  • freepbx/trunk/amp_conf/htdocs/admin/views/freepbx.php

    r10998 r11010  
    7373$version = $version ? $version : getversion(); 
    7474$version_tag = '?load_version='.urlencode($version); 
    75  
    76 // TODO: append ?load_version=$version (and for module specific $load_version=$view_module_version) to end of images, js, etc. 
    77 //       to get these to load, per moshe's suggestion 
    7875 
    7976if ($amp_conf['BRAND_IMAGE_HIDE_NAV_BACKGROUND']) { 
  • freepbx/trunk/libfreepbx.install.php

    r11005 r11010  
    413413  $set['options'] = '0,1,2,3,4,5,6,7,8,9,10'; 
    414414  $set['description'] = 'This will filter which settings that are displayed on this Advanced Settings page. The higher the level, the more obscure settings will be shown. Settings at higher levels are unlikely to be of interest to most users and could be more volatile to breaking your system if set wrong.'; 
     415  $set['emptyok'] = 0; 
    415416  $set['level'] = 0; 
    416417  $set['readonly'] = 0; 
     
    423424  $set['value'] = false; 
    424425  $set['description'] = 'This will display settings that are normally hidden by the system. These settings are often internally used settings that are not of interest to most users.'; 
     426  $set['emptyok'] = 0; 
    425427  $set['level'] = 0; 
    426428  $set['readonly'] = 0; 
     
    433435  $set['value'] = false; 
    434436  $set['description'] = 'This will display settings that are readonly. These settings are often internally used settings that are not of interest to most users. Since they are readonly they can only be viewed.'; 
     437  $set['emptyok'] = 0; 
    435438  $set['level'] = 0; 
    436439  $set['readonly'] = 0; 
     
    449452  $set['options'] = 'asterisk'; 
    450453  $set['description'] = 'The telephony backend engine being used, asterisk is the only option currently.'; 
     454  $set['emptyok'] = 0; 
    451455  $set['level'] = 3; 
    452456  $set['readonly'] = 1; 
     
    460464  $set['options'] = 'database,none,webserver'; 
    461465  $set['description'] = 'Authentication type to use for web admin. If type set to <b>database</b>, the primary AMP admin credentials will be the AMPDBUSER/AMPDBPASS above. When using database you can create users that are restricted to only certain module pages. When set to none, you should make sure you have provided security at the apache level. When set to webserver, FreePBX will expect authentication to happen at the apache level, but will take the user credentials and apply any restrictions as if it were in database mode.'; 
     466  $set['emptyok'] = 0; 
    462467  $set['level'] = 3; 
    463468  $set['type'] = CONF_TYPE_SELECT; 
     
    469474  $set['options'] = 'extensions,deviceanduser'; 
    470475  $set['description'] = 'Sets the extension behavior in FreePBX.  If set to <b>extensions</b>, Devices and Users are administered together as a unified Extension, and appear on a single page. If set to <b>deviceanduser</b>, Devices and Users will be administered seperately. Devices (e.g. each individual line on a SIP phone) and Users (e.g. <b>101</b>) will be configured independent of each other, allowing association of one User to many Devices, or allowing Users to login and logout of Devices.'; 
     476  $set['emptyok'] = 0; 
    471477  $set['type'] = CONF_TYPE_SELECT; 
    472478  $freepbx_conf->define_conf_setting('AMPEXTENSIONS',$set); 
     
    475481  $set['value'] = '007'; 
    476482  $set['description'] = 'Defaults to 077 allowing only the asterisk user to have any permission on VM files. If set to something like 007, it would allow the group to have permissions. This can be used if setting apache to a different user then asterisk, so that the apache user (and thus ARI) can have access to read/write/delete the voicemail files. If changed, some of the voicemail directory structures may have to be manually changed.'; 
     483  $set['emptyok'] = 0; 
    477484  $set['type'] = CONF_TYPE_TEXT; 
    478485  $set['level'] = 4; 
     
    488495  $freepbx_conf->define_conf_setting('AMPWEBADDRESS',$set); 
    489496  $set['level'] = 0; 
    490   $set['emptyok'] = 0; 
    491497 
    492498  // ARI_ADMIN_USERNAME 
     
    496502  $set['type'] = CONF_TYPE_TEXT; 
    497503  $freepbx_conf->define_conf_setting('ARI_ADMIN_USERNAME',$set); 
    498   $set['emptyok'] = 0; 
    499504 
    500505  // ARI_ADMIN_PASSWORD 
    501506  $set['value'] = 'ari_password'; 
    502507  $set['description'] = 'This is the default admin password to allow an administrator to login to ARI bypassing all security. Change this to a secure password.Default = not set'; 
     508  $set['emptyok'] = 0; 
    503509  $set['type'] = CONF_TYPE_TEXT; 
    504510  $freepbx_conf->define_conf_setting('ARI_ADMIN_PASSWORD',$set); 
     
    507513  $set['value'] = 'asterisk'; 
    508514  $set['description'] = 'The user Asterisk should be running as, used by freepbx_engine. Most systems should not change this.'; 
     515  $set['emptyok'] = 0; 
    509516  $set['type'] = CONF_TYPE_TEXT; 
    510517  $set['level'] = 4; 
     
    515522  $set['value'] = 'asterisk'; 
    516523  $set['description'] = 'The user group Asterisk should be running as, used by freepbx_engine. Most systems should not change this.'; 
     524  $set['emptyok'] = 0; 
    517525  $set['type'] = CONF_TYPE_TEXT; 
    518526  $set['level'] = 4; 
     
    523531  $set['value'] = 'asterisk'; 
    524532  $set['description'] = 'The user your httpd should be running as, used by freepbx_engine. Most systems should not change this.'; 
     533  $set['emptyok'] = 0; 
    525534  $set['type'] = CONF_TYPE_TEXT; 
    526535  $set['level'] = 4; 
     
    531540  $set['value'] = 'asterisk'; 
    532541  $set['description'] = 'The user group your httpd should be running as, used by freepbx_engine. Most systems should not change this.'; 
     542  $set['emptyok'] = 0; 
    533543  $set['type'] = CONF_TYPE_TEXT; 
    534544  $set['level'] = 4; 
     
    539549  $set['value'] = 'asterisk'; 
    540550  $set['description'] = 'The user that various device directories should be set to, used by freepbx_engine. Examples include /dev/zap, /dev/dahdi, /dev/misdn, /dev/mISDN and /dev/dsp. Most systems should not change this.'; 
     551  $set['emptyok'] = 0; 
    541552  $set['type'] = CONF_TYPE_TEXT; 
    542553  $set['level'] = 4; 
     
    547558  $set['value'] = 'asterisk'; 
    548559  $set['description'] = 'The user group that various device directories should be set to, used by freepbx_engine. Examples include /dev/zap, /dev/dahdi, /dev/misdn, /dev/mISDN and /dev/dsp. Most systems should not change this.'; 
     560  $set['emptyok'] = 0; 
    549561  $set['type'] = CONF_TYPE_TEXT; 
    550562  $set['level'] = 4; 
     
    561573  $set['value'] = true; 
    562574  $set['description'] = 'Generate the bad-number context which traps any bogus number or feature code and plays a message to the effect. If you use the Early Dial feature on some Grandstream phones, you will want to set this to false.'; 
     575  $set['emptyok'] = 0; 
    563576  $set['type'] = CONF_TYPE_BOOL; 
    564577  $set['level'] = 2; 
     
    569582  $set['value'] = true; 
    570583  $set['description'] = 'For extensions that have CW enabled, report unanswered CW calls as <b>busy</b> (resulting in busy voicemail greeting). If set to no, unanswered CW calls simply report as <b>no-answer</b>.'; 
     584  $set['emptyok'] = 0; 
    571585  $set['type'] = CONF_TYPE_BOOL; 
    572586  $freepbx_conf->define_conf_setting('CWINUSEBUSY',$set); 
     
    575589  $set['value'] = false; 
    576590  $set['description'] = 'If set to true, FreePBX will check if you have chan_dadhi installed. If so, it will automatically use all your ZAP configuration settings (devices and trunks) and silently convert them, under the covers, to DAHDI so no changes are needed. The GUI will continue to refer to these as ZAP but it will use the proper DAHDI channels. This will also keep Zap Channel DIDs working.'; 
     591  $set['emptyok'] = 0; 
    577592  $set['type'] = CONF_TYPE_BOOL; 
    578593  $freepbx_conf->define_conf_setting('ZAP2DAHDICOMPAT',$set); 
     
    581596  $set['value'] = false; 
    582597  $set['description'] = 'If true, Core will not statically generate hints, but instead make a call to the AMPBIN php script, and generate_hints.php through an Asterisk #exec call. This requires Asterisk.conf to be configured with <b>execincludes=yes<b> set in the [options] section.'; 
     598  $set['emptyok'] = 0; 
    583599  $set['type'] = CONF_TYPE_BOOL; 
    584600  $freepbx_conf->define_conf_setting('DYNAMICHINTS',$set); 
     
    587603  $set['value'] = true; 
    588604  $set['description'] = 'Enable call waiting by default when an extension is created (Default is yes). Set to <b>no</b> to if you dont want phones to be commissioned with call waiting already enabled. The user would then be required to dial the CW feature code (*70 default) to enable their phone. Most installations should leave this alone. It allows multi-line phones to receive multiple calls on their line appearances.'; 
     605  $set['emptyok'] = 0; 
    589606  $set['type'] = CONF_TYPE_BOOL; 
    590607  $freepbx_conf->define_conf_setting('ENABLECW',$set); 
     
    593610  $set['value'] = false; 
    594611  $set['description'] = 'When set to true, a beep is played instead of confirmation message when activating/de-activating: CallForward, CallWaiting, DayNight, DoNotDisturb and FindMeFollow.'; 
     612  $set['emptyok'] = 0; 
    595613  $set['type'] = CONF_TYPE_BOOL; 
    596614  $freepbx_conf->define_conf_setting('FCBEEPONLY',$set); 
     
    599617  $set['value'] = false; 
    600618  $set['description'] = 'If this is set, it assumes that you are running Asterisk 1.4 or higher and want to take advantage of the func_devstate.c backport available from Asterisk 1.6. This allows custom hints to be created to support BLF for server side feature codes such as daynight, followme, etc'; 
     619  $set['emptyok'] = 0; 
    601620  $set['type'] = CONF_TYPE_BOOL; 
    602621  $freepbx_conf->define_conf_setting('USEDEVSTATE',$set); 
     
    605624  $set['value'] = false; 
    606625  $set['description'] = 'Setting this flag will generate the required global variable so that enumlookup.agi will use Google DNS 8.8.8.8 when performing an ENUM lookup. Not all DNS deals with NAPTR record, but Google does. There is a drawback to this as Google tracks every lookup. If you are not comfortable with this, do not enable this setting. Please read Google FAQ about this: <b>http://code.google.com/speed/public-dns/faq.html#privacy</b>.'; 
     626  $set['emptyok'] = 0; 
    607627  $set['type'] = CONF_TYPE_BOOL; 
    608628  $set['level'] = 2; 
     
    613633  $set['value'] = false; 
    614634  $set['description'] = 'Normally FreePBX auto-generates a custom context that may be usable for adding custom dialplan to modify the normal behavior of FreePBX. It takes a good understanding of how Asterisk processes these includes to use this and in many of the cases, there is no useful application. All includes will result in a WARNING in the Asterisk log if there is no context found to include though it results in no errors. If you know that you want the includes, you can set this to true. If you comment it out FreePBX will revert to legacy behavior and include the contexts.'; 
     635  $set['emptyok'] = 0; 
    615636  $set['type'] = CONF_TYPE_BOOL; 
    616637  $set['level'] = 2; 
     
    623644  $set['options'] = '0,1,2,3,4,5,6,7,8,9,10'; 
    624645  $set['description'] = 'Some modules will generate lots of Noop() commands proceeded by a [TRACE](trace_level) that can be used during development or while trying to trace call flows. These Noop() commands serve no other purpose so if you do not want to see excessive Noop()s in your dialplan you can set this to 0. The higher the number the more detailed level of trace Noop()s will be generated'; 
     646  $set['emptyok'] = 0; 
    625647  $set['type'] = CONF_TYPE_SELECT; 
    626648  $freepbx_conf->define_conf_setting('NOOPTRACE',$set); 
     
    629651  $set['value'] = false; 
    630652  $set['description'] = 'If this value is set to true, then calls going out your outbound routes that originate from outside your PBX and were subsequently forwarded through a call forward, ring group, follow-me or other means, will have a SIP diversion header added to the call with the original incoming DID assuming there is a DID available. This is useful with some carriers that may require this under certain circumstances.'; 
     653  $set['emptyok'] = 0; 
    631654  $set['type'] = CONF_TYPE_BOOL; 
    632655  $freepbx_conf->define_conf_setting('DIVERSIONHEADER',$set); 
     
    640663  $set['options'] = $opts; 
    641664  $set['description'] = 'This is the default time in seconds to try and connect a call that has been call forwaded by the server side CF, CFU and CFB options. (If your phones use client side CF such as SIP redirects, this will not have any affect) If set to the default of 0, it will use the standard ring timer. If set to -1 it will ring the forwarded number with no limit which is consistent with the behavior of some existing PBX systems. If set to any other value, it will ring for that duration before diverting the call to the users voicemail if they have one. This can be overriden for each extension.'; 
     665  $set['emptyok'] = 0; 
    642666  $set['type'] = CONF_TYPE_SELECT; 
    643667  $freepbx_conf->define_conf_setting('CFRINGTIMERDEFAULT',$set); 
     
    652676  $set['value'] = '/var/lib/asterisk/bin'; 
    653677  $set['description'] = 'Location of the FreePBX command line scripts.'; 
     678  $set['emptyok'] = 0; 
    654679  $set['type'] = CONF_TYPE_DIR; 
    655680  $set['level'] = 4; 
     
    659684  $set['value'] = '/usr/sbin'; 
    660685  $set['description'] = 'Where (root) command line scripts are located.'; 
     686  $set['emptyok'] = 0; 
    661687  $set['type'] = CONF_TYPE_DIR; 
    662688  $set['level'] = 4; 
     
    666692  $set['value'] = '/var/www/html'; 
    667693  $set['description'] = 'The path to Apache webroot (leave off trailing slash).'; 
     694  $set['emptyok'] = 0; 
    668695  $set['type'] = CONF_TYPE_DIR; 
    669696  $set['level'] = 4; 
     
    673700  $set['value'] = '/var/lib/asterisk/agi-bin'; 
    674701  $set['description'] = 'This is the default directory for Asterisks agi files.'; 
     702  $set['emptyok'] = 0; 
    675703  $set['type'] = CONF_TYPE_DIR; 
    676704  $set['level'] = 4; 
     
    680708  $set['value'] = '/etc/asterisk'; 
    681709  $set['description'] = 'This is the default directory for Asterisks configuration files.'; 
     710  $set['emptyok'] = 0; 
    682711  $set['type'] = CONF_TYPE_DIR; 
    683712  $set['level'] = 4; 
     
    687716  $set['value'] = '/var/log/asterisk'; 
    688717  $set['description'] = 'This is the default directory for Asterisks log files.'; 
     718  $set['emptyok'] = 0; 
    689719  $set['type'] = CONF_TYPE_DIR; 
    690720  $set['level'] = 4; 
     
    694724  $set['value'] = '/usr/lib/asterisk/modules'; 
    695725  $set['description'] = 'This is the default directory for Asterisks modules.'; 
     726  $set['emptyok'] = 0; 
    696727  $set['type'] = CONF_TYPE_DIR; 
    697728  $set['level'] = 4; 
     
    701732  $set['value'] = '/var/spool/asterisk'; 
    702733  $set['description'] = 'This is the default directory for Asterisks spool directory.'; 
     734  $set['emptyok'] = 0; 
    703735  $set['type'] = CONF_TYPE_DIR; 
    704736  $set['level'] = 4; 
     
    708740  $set['value'] = '/var/run/asterisk'; 
    709741  $set['description'] = 'This is the default directory for Asterisks run files.'; 
     742  $set['emptyok'] = 0; 
    710743  $set['type'] = CONF_TYPE_DIR; 
    711744  $set['level'] = 4; 
     
    715748  $set['value'] = '/var/lib/asterisk'; 
    716749  $set['description'] = 'This is the default directory for Asterisks lib files.'; 
     750  $set['emptyok'] = 0; 
    717751  $set['type'] = CONF_TYPE_DIR; 
    718752  $set['level'] = 4; 
     
    722756  $set['value'] = '/var/www/cgi-bin '; 
    723757  $set['description'] = 'The path to Apache cgi-bin dir (leave off trailing slash).'; 
     758  $set['emptyok'] = 0; 
    724759  $set['type'] = CONF_TYPE_DIR; 
    725760  $set['level'] = 4; 
     
    729764  $set['value'] = 'moh'; 
    730765  $set['description'] = 'This is the subdirectory for the MoH files/directories which is located in ASTVARLIBDIR if not specified it will default to mohmp3 for backward compatibility.'; 
     766  $set['emptyok'] = 0; 
    731767  $set['type'] = CONF_TYPE_DIR; 
    732768  $set['level'] = 4; 
     
    743779  $set['value'] = true; 
    744780  $set['description'] = 'When set to the default value of true, all requests into FreePBX that might possibly add/edit/delete settings will be validated to assure the request is coming from the server. This will protect the system from CSRF (cross site request forgery) attacks. It will have the effect of preventing legitimately entering URLs that could modify settings which can be allowed by changing this field to false.'; 
     781  $set['emptyok'] = 0; 
    745782  $set['type'] = CONF_TYPE_BOOL; 
    746783  $freepbx_conf->define_conf_setting('CHECKREFERER',$set); 
     
    749786  $set['value'] = false; 
    750787  $set['description'] = 'Module Admin normally tries to get its online information through direct file open type calls to URLs that go back to the freepbx.org server. If it fails, typically because of content filters in firewalls that dont like the way PHP formats the requests, the code will fall back and try a wget to pull the information. This will often solve the problem. However, in such environment there can be a significant timeout before the failed file open calls to the URLs return and there are often 2-3 of these that occur. Setting this value will force FreePBX to avoid the attempt to open the URL and go straight to the wget calls.'; 
     788  $set['emptyok'] = 0; 
    751789  $set['type'] = CONF_TYPE_BOOL; 
    752790  $freepbx_conf->define_conf_setting('MODULEADMINWGET',$set); 
     
    755793  $set['value'] = true; 
    756794  $set['description'] = 'Controls if the menu items in the admin interface are sorted by category (true) or sorted alphebetically with no categories shown (false). Defaults = true'; 
     795  $set['emptyok'] = 0; 
    757796  $set['type'] = CONF_TYPE_BOOL; 
    758797  $freepbx_conf->define_conf_setting('USECATEGORIES',$set); 
     
    761800  $set['value'] = false; 
    762801  $set['description'] = 'Precede browser title with the server name.'; 
     802  $set['emptyok'] = 0; 
    763803  $set['type'] = CONF_TYPE_BOOL; 
    764804  $freepbx_conf->define_conf_setting('SERVERINTITLE',$set); 
     
    767807  $set['value'] = true; 
    768808  $set['description'] = 'When set to false, will bypass the confirm on Reload Box.'; 
     809  $set['emptyok'] = 0; 
    769810  $set['type'] = CONF_TYPE_BOOL; 
    770811  $freepbx_conf->define_conf_setting('RELOADCONFIRM',$set); 
     
    773814  $set['value'] = false; 
    774815  $set['description'] = 'Setting either of these to true will result in retrieve_conf aborting during a reload if an extension conflict is detected or a destination is detected. It is usually better to allow the reload to go through and then correct the problem but these can be set if a more strict behavior is desired.'; 
     816  $set['emptyok'] = 0; 
    775817  $set['level'] = 3; 
    776818  $set['type'] = CONF_TYPE_BOOL; 
     
    781823  $set['value'] = false; 
    782824  $set['description'] = 'Setting either of these to true will result in retrieve_conf aborting during a reload if an extension conflict is detected or a destination is detected. It is usually better to allow the reload to go through and then correct the problem but these can be set if a more strict behavior is desired.'; 
     825  $set['emptyok'] = 0; 
    783826  $set['level'] = 3; 
    784827  $set['type'] = CONF_TYPE_BOOL; 
     
    789832  $set['value'] = true; 
    790833  $set['description'] = 'If false, then the Destination Registry will not report unknown destinations as errors. This should be left to the default true and custom destinations should be moved into the new custom apps registry.'; 
     834  $set['emptyok'] = 0; 
    791835  $set['level'] = 2; 
    792836  $set['type'] = CONF_TYPE_BOOL; 
     
    803847  $set['value'] = 'amp111'; 
    804848  $set['description'] = 'Password for accessing the Asterisk Manager Interface (AMI), you must change this in manager.conf if changed here.'; 
     849  $set['emptyok'] = 0; 
    805850  $set['type'] = CONF_TYPE_TEXT; 
    806851  $set['level'] = 2; 
     
    811856  $set['value'] = 'admin'; 
    812857  $set['description'] = 'Username for accessing the Asterisk Manager Interface (AMI), you must change this in manager.conf if changed here.'; 
     858  $set['emptyok'] = 0; 
    813859  $set['type'] = CONF_TYPE_TEXT; 
    814860  $set['level'] = 2; 
     
    819865  $set['value'] = 'localhost'; 
    820866  $set['description'] = 'Hostname for the Asterisk Manager'; 
     867  $set['emptyok'] = 0; 
    821868  $set['type'] = CONF_TYPE_TEXT; 
    822869  $set['level'] = 2; 
    823870  $freepbx_conf->define_conf_setting('ASTMANAGERHOST',$set); 
    824871  $set['level'] = 0; 
    825  
    826   $set['type'] = CONF_TYPE_UINT; 
    827872 
    828873  // ASTMANAGERPORT 
    829874  $set['value'] = '5038'; 
    830875  $set['description'] = 'Port for the Asterisk Manager'; 
    831   $set['type'] = CONF_TYPE_UINT; 
     876  $set['emptyok'] = 0; 
     877  $set['type'] = CONF_TYPE_INT; 
     878  $set['options'] = array(1024,65535); 
    832879  $set['level'] = 2; 
    833880  $freepbx_conf->define_conf_setting('ASTMANAGERPORT',$set); 
     
    837884  $set['value'] = ''; 
    838885  $set['description'] = 'Optional port for an Asterisk Manager Proxy'; 
    839   $set['type'] = CONF_TYPE_UINT; 
    840   $set['emptyok'] = 1; 
     886  $set['type'] = CONF_TYPE_INT; 
     887  $set['emptyok'] = 1; 
     888  $set['options'] = array(1024,65535); 
    841889  $set['level'] = 2; 
    842890  $freepbx_conf->define_conf_setting('ASTMANAGERPROXYPORT',$set); 
    843891  $set['level'] = 0; 
    844   $set['emptyok'] = 0; 
    845892 
    846893 
     
    854901  $set['value'] = '/tmp/freepbx_debug.log'; 
    855902  $set['description'] = 'Full path and name of FreePBX debug file. Used by the dbug() funciton by developers.'; 
     903  $set['emptyok'] = 0; 
    856904  $set['type'] = CONF_TYPE_TEXT; 
    857905  $freepbx_conf->define_conf_setting('FPBXDBUGFILE',$set); 
     
    860908  $set['value'] = false; 
    861909  $set['description'] = 'This enables several debug features geared towards developers, including some page load timing information, some debug information in Module Admin, use of original CSS files and other future capabilities will be enabled.'; 
     910  $set['emptyok'] = 0; 
    862911  $set['type'] = CONF_TYPE_BOOL; 
    863912  $freepbx_conf->define_conf_setting('DEVEL',$set); 
     
    866915  $set['value'] = false; 
    867916  $set['description'] = 'Forces the "Apply Configuration Changes" reload bar to always be present even when not necessary.'; 
     917  $set['emptyok'] = 0; 
    868918  $set['type'] = CONF_TYPE_BOOL; 
    869919  $freepbx_conf->define_conf_setting('DEVELRELOAD',$set); 
     
    875925  $set['type'] = CONF_TYPE_TEXT; 
    876926  $freepbx_conf->define_conf_setting('PRE_RELOAD',$set); 
    877   $set['emptyok'] = 0; 
    878927 
    879928  // POST_RELOAD 
     
    883932  $set['type'] = CONF_TYPE_TEXT; 
    884933  $freepbx_conf->define_conf_setting('POST_RELOAD',$set); 
    885   $set['emptyok'] = 0; 
    886934 
    887935  // POST_RELOAD_DEBUG 
    888936  $set['value'] = false; 
    889937  $set['description'] = 'Display debug output for script used if POST_RELOAD is used.'; 
     938  $set['emptyok'] = 0; 
    890939  $set['type'] = CONF_TYPE_BOOL; 
    891940  $freepbx_conf->define_conf_setting('POST_RELOAD_DEBUG',$set); 
     
    894943  $set['value'] = ''; 
    895944  $set['description'] = 'If this directory is defined, retrieve_conf will check for a file called <i>retrieve_conf_post_custom</i> and if that file exists, it will be included after other processing thus having full access to the current environment for addtional customization.'; 
     945  $set['emptyok'] = 1; 
    896946  $set['type'] = CONF_TYPE_DIR; 
    897947  $freepbx_conf->define_conf_setting('AMPLOCALBIN',$set); 
     
    900950  $set['value'] = true; 
    901951  $set['description'] = 'Whether or not to invoke the FreePBX log facility.'; 
     952  $set['emptyok'] = 0; 
    902953  $set['type'] = CONF_TYPE_BOOL; 
    903954  $freepbx_conf->define_conf_setting('AMPDISABLELOG',$set); 
     
    906957  $set['value'] = false; 
    907958  $set['description'] = 'Whether or not to include log messages marked as <b>devel-debug</b> in the log system.'; 
     959  $set['emptyok'] = 0; 
    908960  $set['type'] = CONF_TYPE_BOOL; 
    909961  $freepbx_conf->define_conf_setting('AMPENABLEDEVELDEBUG',$set); 
     
    913965  $set['options'] = 'LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG, LOG_SQL,SQL'; 
    914966  $set['description'] = 'Where to log if enabled, SQL, LOG_SQL logs to old MySQL table, others are passed to syslog system to determine where to log.'; 
     967  $set['emptyok'] = 0; 
    915968  $set['type'] = CONF_TYPE_SELECT; 
    916969  $freepbx_conf->define_conf_setting('AMPSYSLOGLEVEL',$set); 
     
    919972  $set['value'] = false; 
    920973  $set['description'] = 'Stops the automatic generation of a stripped CSS file that replaces the primary sheet, usually mainstyle.css.'; 
     974  $set['emptyok'] = 0; 
    921975  $set['type'] = CONF_TYPE_BOOL; 
    922976  $freepbx_conf->define_conf_setting('DISABLE_CSS_AUTOGEN',$set); 
     
    933987  $set['options'] = 'extension,lastname'; 
    934988  $set['description'] = 'How FOP sort extensions. By Last Name [lastname] or by Extension [extension].'; 
     989  $set['emptyok'] = 0; 
    935990  $set['type'] = CONF_TYPE_SELECT; 
    936991  $freepbx_conf->define_conf_setting('FOPSORT',$set); 
     
    939994  $set['value'] = '/var/www/html/panel'; 
    940995  $set['description'] = 'Path to the Flash Operator Panel webroot (leave off trailing slash).'; 
     996  $set['emptyok'] = 0; 
    941997  $set['type'] = CONF_TYPE_DIR; 
    942998  $set['level'] = 4; 
     
    9471003  $set['value'] = 'passw0rd'; 
    9481004  $set['description'] = 'Password for performing transfers and hangups in the Flash Operator Panel (FOP).'; 
     1005  $set['emptyok'] = 0; 
    9491006  $set['type'] = CONF_TYPE_TEXT; 
    9501007  $freepbx_conf->define_conf_setting('FOPPASSWORD',$set); 
     
    9531010  $set['value'] = false; 
    9541011  $set['description'] = 'Set to true to disable FOP in interface and retrieve_conf.  Useful for sqlite3 or if you do not want FOP.'; 
     1012  $set['emptyok'] = 0; 
    9551013  $set['type'] = CONF_TYPE_BOOL; 
    9561014  $freepbx_conf->define_conf_setting('FOPDISABLE',$set); 
     
    9591017  $set['value'] = true; 
    9601018  $set['description'] = 'Set to true if you want FOP started by freepbx_engine (amportal_start), false otherwise.'; 
     1019  $set['emptyok'] = 0; 
    9611020  $set['type'] = CONF_TYPE_BOOL; 
    9621021  $freepbx_conf->define_conf_setting('FOPRUN',$set); 
     
    9681027  $set['category'] = 'Remote CDR Database'; 
    9691028  $set['level'] = 3; 
    970   $set['emptyok'] = 1; 
    9711029 
    9721030  // CDRDBHOST 
    9731031  $set['value'] = ''; 
    9741032  $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you dont use the default values provided by FreePBX.<br>Hostname of db server if not the same as AMPDBHOST.'; 
     1033  $set['emptyok'] = 1; 
    9751034  $set['type'] = CONF_TYPE_TEXT; 
    9761035  $freepbx_conf->define_conf_setting('CDRDBHOST',$set); 
     
    9791038  $set['value'] = ''; 
    9801039  $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you dont use the default values provided by FreePBX.<br>Name of database used for cdr records.'; 
     1040  $set['emptyok'] = 1; 
    9811041  $set['type'] = CONF_TYPE_TEXT; 
    9821042  $freepbx_conf->define_conf_setting('CDRDBNAME',$set); 
     
    9851045  $set['value'] = ''; 
    9861046  $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you dont use the default values provided by FreePBX.<br>Password for connecting to db if its not the same as AMPDBPASS.'; 
     1047  $set['emptyok'] = 1; 
    9871048  $set['type'] = CONF_TYPE_TEXT; 
    9881049  $freepbx_conf->define_conf_setting('CDRDBPASS',$set); 
     
    9911052  $set['value'] = ''; 
    9921053  $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you dont use the default values provided by FreePBX.<br>Port number for db host.'; 
     1054  $set['emptyok'] = 1; 
    9931055  $set['type'] = CONF_TYPE_TEXT; 
    9941056  $freepbx_conf->define_conf_setting('CDRDBPORT',$set); 
     
    9971059  $set['value'] = ''; 
    9981060  $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you dont use the default values provided by FreePBX. Name of the table in the db where the cdr is stored. cdr is default.'; 
     1061  $set['emptyok'] = 1; 
    9991062  $set['type'] = CONF_TYPE_TEXT; 
    10001063  $freepbx_conf->define_conf_setting('CDRDBTABLENAME',$set); 
     
    10031066  $set['value'] = ''; 
    10041067  $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you dont use the default values provided by FreePBX. Defaults to your configured AMDBENGINE.'; 
     1068  $set['emptyok'] = 1; 
    10051069  $set['options'] = ',mysql,postgres'; 
    10061070  $set['type'] = CONF_TYPE_SELECT; 
     
    10101074  $set['value'] = ''; 
    10111075  $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you dont use the default values provided by FreePBX. Username to connect to db with if it is not the same as AMPDBUSER.'; 
     1076  $set['emptyok'] = 1; 
    10121077  $set['type'] = CONF_TYPE_TEXT; 
    10131078  $freepbx_conf->define_conf_setting('CDRDBUSER',$set); 
     
    10191084  $set['category'] = 'Styling and Logos'; 
    10201085  $set['level'] = 1; 
    1021   $set['emptyok'] = 0; 
    10221086 
    10231087  // AMPADMINLOGO 
     
    11581222  $module_migrate['AMPBACKUPSUDO'] = CONF_TYPE_BOOL; 
    11591223  $module_migrate['USEQUEUESTATE'] = CONF_TYPE_BOOL; 
    1160   $module_migrate['DASHBOARD_INFO_UPDATE_TIME'] = CONF_TYPE_UINT; 
    1161   $module_migrate['DASHBOARD_STATS_UPDATE_TIME'] = CONF_TYPE_UINT; 
    1162   $module_migrate['SSHPORT'] = CONF_TYPE_UINT; 
    1163   $module_migrate['MAXCALLS'] = CONF_TYPE_UINT; 
     1224  $module_migrate['DASHBOARD_INFO_UPDATE_TIME'] = CONF_TYPE_INT; 
     1225  $module_migrate['DASHBOARD_STATS_UPDATE_TIME'] = CONF_TYPE_INT; 
     1226  $module_migrate['SSHPORT'] = CONF_TYPE_INT; 
     1227  $module_migrate['MAXCALLS'] = CONF_TYPE_INT; 
    11641228  $module_migrate['AMPMPG123'] = CONF_TYPE_BOOL; 
    11651229  $module_migrate['PARKINGPATCH'] = CONF_TYPE_BOOL; 
  • modules/branches/2.9/core/advancedsettings.js

    r11009 r11010  
    3535        mythis.attr({src: 'images/accept.png'}); 
    3636        if (data != 'ok') { 
    37           alert('ERROR: When saving key ' + mykey); 
     37          alert('ERROR: When saving key ' + mykey + 'Error Info:' + data); 
    3838        } else { 
    3939          mythis.parent().delay(500).fadeOut(); 
  • modules/branches/2.9/core/page.advancedsettings.php

    r11009 r11010  
    11<?php /* $Id */ 
    2 // TODO: Get rid of undefined in http log. Sigh 
    32 
    4 $getvars = array('level', 'action', 'keyword', 'value'); 
    5 foreach ($getvars as $v){ 
    6   $var[$v] = isset($_REQUEST[$v]) ? $_REQUEST[$v] : 0; 
    7 
     3  $getvars = array('action', 'keyword', 'value'); 
     4  foreach ($getvars as $v){ 
     5    $var[$v] = isset($_POST[$v]) ? $_POST[$v] : 0; 
     6 
    87 
    9 if($var['action'] === 'setkey') { 
    10   if ($freepbx_conf->conf_setting_exists($var['keyword'])) { 
    11     $freepbx_conf->set_conf_values(array($var['keyword'] => $var['value']),true); 
    12     if ($freepbx_conf->get_conf_setting($var['keyword']) == $var['value']) { 
    13       echo 'ok'; 
    14     } 
    15       dbug($freepbx_conf->db_conf_store[$var['keyword']]); 
     8  // TODO: provide error info if errors were detected 
     9  //       change to json so we can send back info like what it was updated to 
     10  //       and other useful stuff 
     11  // 
     12  if($var['action'] === 'setkey') { 
     13    if ($freepbx_conf->conf_setting_exists($var['keyword'])) { 
     14      $freepbx_conf->set_conf_values(array($var['keyword'] => $var['value']),true); 
     15      if ($freepbx_conf->get_conf_setting($var['keyword']) == $var['value']) { 
     16        echo 'ok'; 
     17      } 
     18      dbug($freepbx_conf->get_last_update_status()); 
     19    } 
     20    exit; 
    1621  } 
    17   exit; 
    18 } 
    1922  echo '<script type="text/javascript">'; 
    2023  echo 'can_write_amportalconf = "'.$amp_conf['amportal_canwrite'] .'"; '; 
     
    7780      case CONF_TYPE_DIR: 
    7881      case CONF_TYPE_INT: 
    79       case CONF_TYPE_UINT: 
    8082        $readonly = $c['readonly'] ? 'readonly="readonly"' : ''; 
    8183        echo '<input class="valueinput" id="'.$c['keyword'].'" type="text" size="60" value="'.$amp_conf[$c['keyword']].'" data-valueinput-orig="'.$amp_conf[$c['keyword']].'" '.$readonly.'/>'; 
  • modules/branches/2.9/dashboard/install.php

    r11003 r11010  
    2424  $set['value'] = 6; 
    2525  $set['defaultval'] =& $set['value']; 
     26  $set['options'] = array(6,10,20,30,45,60,120,300,600); 
    2627  $set['readonly'] = 0; 
    2728  $set['hidden'] = 0; 
     
    2930  $set['module'] = 'dashboard'; 
    3031  $set['category'] = 'GUI Behavior'; 
    31   $set['emptyok'] = 1
     32  $set['emptyok'] = 0
    3233  $set['description'] = 'Update rate in seconds of all sections of the System Status panel except the Info box.'; 
    33   $set['type'] = CONF_TYPE_UINT; 
     34  $set['type'] = CONF_TYPE_SELECT; 
    3435  $freepbx_conf->define_conf_setting('DASHBOARD_STATS_UPDATE_TIME',$set); 
    3536 
     
    3839  $set['value'] = 30; 
    3940  $set['defaultval'] =& $set['value']; 
     41  $set['options'] = array(15,30,60,120,300,600); 
    4042  $set['readonly'] = 0; 
    4143  $set['hidden'] = 0; 
     
    4345  $set['module'] = 'dashboard'; 
    4446  $set['category'] = 'GUI Behavior'; 
    45   $set['emptyok'] = 1
     47  $set['emptyok'] = 0
    4648  $set['description'] = 'Update rate in seconds of the Info section of the System Status panel.'; 
    47   $set['type'] = CONF_TYPE_UINT; 
     49  $set['type'] = CONF_TYPE_SELECT; 
    4850  $freepbx_conf->define_conf_setting('DASHBOARD_INFO_UPDATE_TIME',$set); 
    4951 
     
    5254  $set['value'] = ''; 
    5355  $set['defaultval'] =& $set['value']; 
     56  $set['options'] = array(1,65535); 
    5457  $set['readonly'] = 0; 
    5558  $set['hidden'] = 0; 
     
    5962  $set['emptyok'] = 1; 
    6063  $set['description'] = 'SSH port number configured on your system if not using the default port 22, this allows the dashboard monitoring to watch the poper port.'; 
    61   $set['type'] = CONF_TYPE_UINT; 
     64  $set['type'] = CONF_TYPE_INT; 
    6265  $freepbx_conf->define_conf_setting('SSHPORT',$set); 
    6366 
     
    6669  $set['value'] = ''; 
    6770  $set['defaultval'] =& $set['value']; 
     71  $set['options'] = array(0,3000); 
    6872  $set['readonly'] = 0; 
    6973  $set['hidden'] = 0; 
     
    7377  $set['emptyok'] = 1; 
    7478  $set['description'] = 'Use this to pre-set the scale for maximum calls on the Dashboard display. If not set, the the scale is dynamically sized based on the active calls on the system.'; 
    75   $set['type'] = CONF_TYPE_UINT; 
     79  $set['type'] = CONF_TYPE_INT; 
    7680  $freepbx_conf->define_conf_setting('MAXCALLS',$set); 
    7781