You are here

function ga_stats_custom_form_submit in Google Analytics Statistics 7.2

Custom form submit callback.

1 string reference to 'ga_stats_custom_form_submit'
ga_stats_auth_settings in ./ga_stats.admin.inc
Callback for GA Stats authentication form.

File

./ga_stats.admin.inc, line 52

Code

function ga_stats_custom_form_submit($form, &$form_state) {
  $validators = array(
    'file_validate_extensions' => array(
      'p12',
    ),
  );
  if ($file = file_save_upload('private_key', $validators, 'private://')) {

    // Renaming the file, so that every uploaded key would override the existing key.
    $file = file_move($file, 'private://ga_stats_p12_key.p12', FILE_EXISTS_REPLACE);

    // Make the file permanent.
    $file->status = 1;
    file_save($file);

    // Save the file uri.
    variable_set('ga_stats_private_key_p12', $file->uri);
  }
}