|  | @@ -65,15 +65,15 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 65 | 65 |    */ | 
                                                                                                            
                                                            | 66 | 66 |  function boincwork_admin_prefs_upload_form_validate($form, &$form_state) { | 
                                                                                                            
                                                            | 67 | 67 |     | 
                                                                                                            
                                                            | 68 |  | -  $xsd = './' . drupal_get_path('module', 'boincwork') . '/includes/projectprefs.xsd'; | 
                                                                                                            
                                                            |  | 68 | +  $xsd = './'.drupal_get_path('module', 'boincwork').'/includes/projectprefs.xsd'; | 
                                                                                                            
                                                            | 69 | 69 |    libxml_use_internal_errors(true); | 
                                                                                                            
                                                            | 70 | 70 |    $xml = new DomDocument(); | 
                                                                                                            
                                                            | 71 | 71 |    $xml->loadXML($form_state['values']['prefs_xml'], LIBXML_NOBLANKS); | 
                                                                                                            
                                                            | 72 | 72 |    if (!$xml->schemaValidate($xsd)) { | 
                                                                                                            
                                                            | 73 | 73 |      $errors = libxml_get_errors(); | 
                                                                                                            
                                                            | 74 | 74 |      $lines = explode("\r", $form_state['values']['prefs_xml']); | 
                                                                                                            
                                                            | 75 |  | -    drupal_set_message("{$errors[0]->message} at line {$errors[0]->line}" . | 
                                                                                                            
                                                            | 76 |  | -      ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), 'error'); | 
                                                                                                            
                                                            |  | 75 | +    drupal_set_message("{$errors[0]->message} at line {$errors[0]->line}". | 
                                                                                                            
                                                            |  | 76 | +      ': <br/>'.htmlentities($lines[$errors[0]->line - 1]), 'error'); | 
                                                                                                            
                                                            | 77 | 77 |      form_set_error('upload', t('XML file failed validation')); | 
                                                                                                            
                                                            | 78 | 78 |    } | 
                                                                                                            
                                                            | 79 | 79 |  } | 
                                                                                                                                                        
                                                        |  | @@ -101,7 +101,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 101 | 101 |        "{$path}/minimum" => t('Minimum') | 
                                                                                                            
                                                            | 102 | 102 |      ); | 
                                                                                                            
                                                            | 103 | 103 |      variable_set('jump_use_js_presets-Array', 1); | 
                                                                                                            
                                                            | 104 |  | -    drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); | 
                                                                                                            
                                                            |  | 104 | +    drupal_add_js(drupal_get_path('module', 'jump').'/jump.js'); | 
                                                                                                            
                                                            | 105 | 105 |      $output .= '<div class="simple-form-controls"><div class="form-item venue">'; | 
                                                                                                            
                                                            | 106 | 106 |      $output .= '<label>Preset:</label>'; | 
                                                                                                            
                                                            | 107 | 107 |      $output .= jump_quickly($preset_options, 'presets'); | 
                                                                                                                                                        
                                                        |  | @@ -150,7 +150,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 150 | 150 |      '#type' => 'submit', | 
                                                                                                            
                                                            | 151 | 151 |      '#value' => t('Save configuration') | 
                                                                                                            
                                                            | 152 | 152 |    ); | 
                                                                                                            
                                                            | 153 |  | -  $form['saveuseconfigxml'] = array ( | 
                                                                                                            
                                                            |  | 153 | +  $form['saveuseconfigxml'] = array( | 
                                                                                                            
                                                            | 154 | 154 |        '#type' => 'submit', | 
                                                                                                            
                                                            | 155 | 155 |        '#value' => t('Save configuration with disk usage settings from config.xml'), | 
                                                                                                            
                                                            | 156 | 156 |        '#validate' => array('boincwork_admin_prefs_preset_saveuseconfigxml'), | 
                                                                                                                                                        
                                                        |  | @@ -175,33 +175,33 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 175 | 175 |    // Verify all non-boolean user input values and notify form API of failures | 
                                                                                                            
                                                            | 176 | 176 |     | 
                                                                                                            
                                                            | 177 | 177 |    // Processing preferences | 
                                                                                                            
                                                            | 178 |  | -  if (!verify_numeric($values['processor']['idle_time_to_run'], 1, 9999)) form_set_error('idle_time_to_run', t('Invalid setting for') . " \"{$form['processor']['idle_time_to_run']['#title']} [x] {$form['processor']['idle_time_to_run']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 179 |  | -  if (!verify_numeric($values['processor']['suspend_if_no_recent_input'], 0, 9999)) form_set_error('suspend_if_no_recent_input', t('Invalid setting for') . " \"{$form['processor']['suspend_if_no_recent_input']['#title']} [x] {$form['processor']['suspend_if_no_recent_input']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 180 |  | -  if (!verify_numeric($values['processor']['suspend_cpu_usage'], 0, 100)) form_set_error('suspend_cpu_usage', t('Invalid setting for') . " \"{$form['processor']['suspend_cpu_usage']['#title']} [x] {$form['processor']['suspend_cpu_usage']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 181 |  | -  if (!verify_numeric($values['processor']['start_hour'], 0, 23)) form_set_error('start_hour', t('Invalid setting for') . " \"{$form['processor']['start_hour']['#title']} [x] {$form['processor']['start_hour']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 182 |  | -  if (!verify_numeric($values['processor']['end_hour'], 0, 23)) form_set_error('end_hour', t('Invalid setting for') . " \"{$form['processor']['end_hour']['#title']} [x] {$form['processor']['end_hour']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 183 |  | -  if (!verify_numeric($values['processor']['cpu_scheduling_period_minutes'], 1, 9999)) form_set_error('cpu_scheduling_period_minutes', t('Invalid setting for') . " \"{$form['processor']['cpu_scheduling_period_minutes']['#title']} [x] {$form['processor']['cpu_scheduling_period_minutes']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 184 |  | -  if (!verify_numeric($values['processor']['max_ncpus_pct'], 0, 100)) form_set_error('max_ncpus_pct', t('Invalid setting for') . " \"{$form['processor']['max_ncpus_pct']['#title']} [x] {$form['processor']['max_ncpus_pct']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 185 |  | -  if (!verify_numeric($values['processor']['cpu_usage_limit'], 0, 100)) form_set_error('cpu_usage_limit', t('Invalid setting for') . " \"{$form['processor']['cpu_usage_limit']['#title']} [x] {$form['processor']['cpu_usage_limit']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 178 | +  if (!verify_numeric($values['processor']['idle_time_to_run'], 1, 9999)) form_set_error('idle_time_to_run', t('Invalid setting for')." \"{$form['processor']['idle_time_to_run']['#title']} [x] {$form['processor']['idle_time_to_run']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 179 | +  if (!verify_numeric($values['processor']['suspend_if_no_recent_input'], 0, 9999)) form_set_error('suspend_if_no_recent_input', t('Invalid setting for')." \"{$form['processor']['suspend_if_no_recent_input']['#title']} [x] {$form['processor']['suspend_if_no_recent_input']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 180 | +  if (!verify_numeric($values['processor']['suspend_cpu_usage'], 0, 100)) form_set_error('suspend_cpu_usage', t('Invalid setting for')." \"{$form['processor']['suspend_cpu_usage']['#title']} [x] {$form['processor']['suspend_cpu_usage']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 181 | +  if (!verify_numeric($values['processor']['start_hour'], 0, 23)) form_set_error('start_hour', t('Invalid setting for')." \"{$form['processor']['start_hour']['#title']} [x] {$form['processor']['start_hour']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 182 | +  if (!verify_numeric($values['processor']['end_hour'], 0, 23)) form_set_error('end_hour', t('Invalid setting for')." \"{$form['processor']['end_hour']['#title']} [x] {$form['processor']['end_hour']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 183 | +  if (!verify_numeric($values['processor']['cpu_scheduling_period_minutes'], 1, 9999)) form_set_error('cpu_scheduling_period_minutes', t('Invalid setting for')." \"{$form['processor']['cpu_scheduling_period_minutes']['#title']} [x] {$form['processor']['cpu_scheduling_period_minutes']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 184 | +  if (!verify_numeric($values['processor']['max_ncpus_pct'], 0, 100)) form_set_error('max_ncpus_pct', t('Invalid setting for')." \"{$form['processor']['max_ncpus_pct']['#title']} [x] {$form['processor']['max_ncpus_pct']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 185 | +  if (!verify_numeric($values['processor']['cpu_usage_limit'], 0, 100)) form_set_error('cpu_usage_limit', t('Invalid setting for')." \"{$form['processor']['cpu_usage_limit']['#title']} [x] {$form['processor']['cpu_usage_limit']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 186 | 186 |   | 
                                                                                                            
                                                            | 187 | 187 |    // Storage preferences | 
                                                                                                            
                                                            | 188 |  | -  if (!verify_numeric($values['storage']['disk_max_used_gb'], 0, 9999999)) form_set_error('disk_max_used_gb', t('Invalid setting for') . " \"{$form['storage']['disk_max_used_gb']['#title']} [x] {$form['storage']['disk_max_used_gb']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 189 |  | -  if (!verify_numeric($values['storage']['disk_min_free_gb'], 0.001, 9999999)) form_set_error('disk_min_free_gb', t('Invalid setting for') . " \"{$form['storage']['disk_min_free_gb']['#title']} [x] {$form['storage']['disk_min_free_gb']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 190 |  | -  if (!verify_numeric($values['storage']['disk_max_used_pct'], 0, 100)) form_set_error('disk_max_used_pct', t('Invalid setting for') . " \"{$form['storage']['disk_max_used_pct']['#title']} [x] {$form['storage']['disk_max_used_pct']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 191 |  | -  if (!verify_numeric($values['storage']['disk_interval'], 0, 9999999)) form_set_error('disk_interval', t('Invalid setting for') . " \"{$form['storage']['disk_interval']['#title']} [x] {$form['storage']['disk_interval']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 192 |  | -  if (!verify_numeric($values['storage']['vm_max_used_pct'], 0, 100)) form_set_error('vm_max_used_pct', t('Invalid setting for') . " \"{$form['storage']['vm_max_used_pct']['#title']} [x] {$form['storage']['vm_max_used_pct']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 193 |  | -  if (!verify_numeric($values['storage']['ram_max_used_busy_pct'], 0, 100)) form_set_error('ram_max_used_busy_pct', t('Invalid setting for') . " \"{$form['storage']['ram_max_used_busy_pct']['#title']} [x] {$form['storage']['ram_max_used_busy_pct']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 194 |  | -  if (!verify_numeric($values['storage']['ram_max_used_idle_pct'], 0, 100)) form_set_error('ram_max_used_idle_pct', t('Invalid setting for') . " \"{$form['storage']['ram_max_used_idle_pct']['#title']} [x] {$form['storage']['ram_max_used_idle_pct']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 188 | +  if (!verify_numeric($values['storage']['disk_max_used_gb'], 0, 9999999)) form_set_error('disk_max_used_gb', t('Invalid setting for')." \"{$form['storage']['disk_max_used_gb']['#title']} [x] {$form['storage']['disk_max_used_gb']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 189 | +  if (!verify_numeric($values['storage']['disk_min_free_gb'], 0.001, 9999999)) form_set_error('disk_min_free_gb', t('Invalid setting for')." \"{$form['storage']['disk_min_free_gb']['#title']} [x] {$form['storage']['disk_min_free_gb']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 190 | +  if (!verify_numeric($values['storage']['disk_max_used_pct'], 0, 100)) form_set_error('disk_max_used_pct', t('Invalid setting for')." \"{$form['storage']['disk_max_used_pct']['#title']} [x] {$form['storage']['disk_max_used_pct']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 191 | +  if (!verify_numeric($values['storage']['disk_interval'], 0, 9999999)) form_set_error('disk_interval', t('Invalid setting for')." \"{$form['storage']['disk_interval']['#title']} [x] {$form['storage']['disk_interval']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 192 | +  if (!verify_numeric($values['storage']['vm_max_used_pct'], 0, 100)) form_set_error('vm_max_used_pct', t('Invalid setting for')." \"{$form['storage']['vm_max_used_pct']['#title']} [x] {$form['storage']['vm_max_used_pct']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 193 | +  if (!verify_numeric($values['storage']['ram_max_used_busy_pct'], 0, 100)) form_set_error('ram_max_used_busy_pct', t('Invalid setting for')." \"{$form['storage']['ram_max_used_busy_pct']['#title']} [x] {$form['storage']['ram_max_used_busy_pct']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 194 | +  if (!verify_numeric($values['storage']['ram_max_used_idle_pct'], 0, 100)) form_set_error('ram_max_used_idle_pct', t('Invalid setting for')." \"{$form['storage']['ram_max_used_idle_pct']['#title']} [x] {$form['storage']['ram_max_used_idle_pct']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 195 | 195 |   | 
                                                                                                            
                                                            | 196 | 196 |    // Network preferences | 
                                                                                                            
                                                            | 197 |  | -  if (!verify_numeric($values['network']['work_buf_min_days'], 0, 10)) form_set_error('work_buf_min_days', t('Invalid setting for') . " \"{$form['network']['work_buf_min_days']['#title']} [x] {$form['network']['work_buf_min_days']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 198 |  | -  if (!verify_numeric($values['network']['work_buf_additional_days'], 0, 10)) form_set_error('work_buf_additional_days', t('Invalid setting for') . " \"{$form['network']['work_buf_additional_days']['#title']} [x] {$form['network']['work_buf_additional_days']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 199 |  | -  if (!verify_numeric($values['network']['max_bytes_sec_down'], 0, 9999.999)) form_set_error('max_bytes_sec_down', t('Invalid setting for') . " \"{$form['network']['max_bytes_sec_down']['#title']} [x] {$form['network']['max_bytes_sec_down']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 200 |  | -  if (!verify_numeric($values['network']['max_bytes_sec_up'], 0, 9999.999)) form_set_error('max_bytes_sec_up', t('Invalid setting for') . " \"{$form['network']['max_bytes_sec_up']['#title']} [x] {$form['network']['max_bytes_sec_up']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 201 |  | -  if (!verify_numeric($values['network']['net_start_hour'], 0, 23)) form_set_error('net_start_hour', t('Invalid setting for') . " \"{$form['network']['net_start_hour']['#title']} [x] {$form['network']['net_start_hour']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 202 |  | -  if (!verify_numeric($values['network']['net_end_hour'], 0, 23)) form_set_error('net_end_hour', t('Invalid setting for') . " \"{$form['network']['net_end_hour']['#title']} [x] {$form['network']['net_end_hour']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 203 |  | -  if (!verify_numeric($values['network']['daily_xfer_limit_mb'], 0, 9999999)) form_set_error('daily_xfer_limit_mb', t('Invalid setting for') . " \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 204 |  | -  if (!verify_numeric($values['network']['daily_xfer_period_days'], 0, 9999999)) form_set_error('daily_xfer_period_days', t('Invalid setting for') . " \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 197 | +  if (!verify_numeric($values['network']['work_buf_min_days'], 0, 10)) form_set_error('work_buf_min_days', t('Invalid setting for')." \"{$form['network']['work_buf_min_days']['#title']} [x] {$form['network']['work_buf_min_days']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 198 | +  if (!verify_numeric($values['network']['work_buf_additional_days'], 0, 10)) form_set_error('work_buf_additional_days', t('Invalid setting for')." \"{$form['network']['work_buf_additional_days']['#title']} [x] {$form['network']['work_buf_additional_days']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 199 | +  if (!verify_numeric($values['network']['max_bytes_sec_down'], 0, 9999.999)) form_set_error('max_bytes_sec_down', t('Invalid setting for')." \"{$form['network']['max_bytes_sec_down']['#title']} [x] {$form['network']['max_bytes_sec_down']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 200 | +  if (!verify_numeric($values['network']['max_bytes_sec_up'], 0, 9999.999)) form_set_error('max_bytes_sec_up', t('Invalid setting for')." \"{$form['network']['max_bytes_sec_up']['#title']} [x] {$form['network']['max_bytes_sec_up']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 201 | +  if (!verify_numeric($values['network']['net_start_hour'], 0, 23)) form_set_error('net_start_hour', t('Invalid setting for')." \"{$form['network']['net_start_hour']['#title']} [x] {$form['network']['net_start_hour']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 202 | +  if (!verify_numeric($values['network']['net_end_hour'], 0, 23)) form_set_error('net_end_hour', t('Invalid setting for')." \"{$form['network']['net_end_hour']['#title']} [x] {$form['network']['net_end_hour']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 203 | +  if (!verify_numeric($values['network']['daily_xfer_limit_mb'], 0, 9999999)) form_set_error('daily_xfer_limit_mb', t('Invalid setting for')." \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\""); | 
                                                                                                            
                                                            |  | 204 | +  if (!verify_numeric($values['network']['daily_xfer_period_days'], 0, 9999999)) form_set_error('daily_xfer_period_days', t('Invalid setting for')." \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\""); | 
                                                                                                            
                                                            | 205 | 205 |  } | 
                                                                                                            
                                                            | 206 | 206 |   | 
                                                                                                            
                                                            | 207 | 207 |  /** | 
                                                                                                                                                        
                                                        |  | @@ -217,7 +217,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 217 | 217 |    // Processing preferences | 
                                                                                                            
                                                            | 218 | 218 |    $prefs['run_on_batteries'] = ($values['processor']['run_on_batteries']) ? 0 : 1; | 
                                                                                                            
                                                            | 219 | 219 |    $prefs['run_if_user_active'] = ($values['processor']['run_if_user_active']) ? 0 : 1; | 
                                                                                                            
                                                            | 220 |  | -  $prefs['run_gpu_if_user_active'] = ($values['processor']['run_gpu_if_user_active']) ? 0: 1; | 
                                                                                                            
                                                            |  | 220 | +  $prefs['run_gpu_if_user_active'] = ($values['processor']['run_gpu_if_user_active']) ? 0 : 1; | 
                                                                                                            
                                                            | 221 | 221 |    $prefs['idle_time_to_run'] = $values['processor']['idle_time_to_run']; | 
                                                                                                            
                                                            | 222 | 222 |    $prefs['suspend_if_no_recent_input'] = $values['processor']['suspend_if_no_recent_input']; | 
                                                                                                            
                                                            | 223 | 223 |    $prefs['suspend_cpu_usage'] = $values['processor']['suspend_cpu_usage']; | 
                                                                                                                                                        
                                                        |  | @@ -267,7 +267,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 267 | 267 |     | 
                                                                                                            
                                                            | 268 | 268 |    // Get the full configuration | 
                                                                                                            
                                                            | 269 | 269 |    $all_presets = boincwork_get_preset_prefs(); | 
                                                                                                            
                                                            | 270 |  | -  $all_presets = (array) $all_presets['general_preferences']; | 
                                                                                                            
                                                            |  | 270 | +  $all_presets = (array)$all_presets['general_preferences']; | 
                                                                                                            
                                                            | 271 | 271 |     | 
                                                                                                            
                                                            | 272 | 272 |    // Check for sane config | 
                                                                                                            
                                                            | 273 | 273 |    if (isset($all_presets['preset'])) { |