You are here

function skinr_import_form_validate in Skinr 6

Validation handler for Skinr settings import form.

File

./skinr.admin.inc, line 141

Code

function skinr_import_form_validate(&$form, &$form_state) {
  $skinr = '';
  ob_start();
  eval($form_state['values']['skinr_settings']);
  ob_end_clean();
  foreach ($skinr as $module => $setting) {
    if (!is_array($setting)) {

      // Error.
      form_error($form['skinr_settings'], t('These are not valid Skinr settings.'));
    }
    foreach ($setting as $key => $value) {
      if (!is_array($value)) {

        // Error.
        form_error($form['skinr_settings'], t('These are not valid Skinr settings.'));
      }
    }
  }
  if (!empty($form_state['values']['theme']) && preg_match('/[^a-zA-Z0-9_]/', $form_state['values']['theme'])) {
    form_error($form['theme'], t('The theme name must be alphanumeric and can contain underscores only.'));
  }
  $form_state['skinr'] =& $skinr;
}