[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/audio/contrib/import/ -> audio_import.admin.inc (source)

   1  <?php
   2  
   3  // $Id: audio_import.admin.inc,v 1.3 2009/05/10 19:15:23 drewish Exp $
   4  
   5  function audio_import_admin_settings() {
   6    $form['audio_import_path'] = array(
   7      '#type' => 'textfield',
   8      '#title' => t('Import path'),
   9      '#default_value' => variable_get('audio_import_path', file_directory_temp() .'/audio/'),
  10      '#after_build' => array('_audio_import_settings_check_directory'),
  11      '#description' => t("The directory to import audio nodes from. Drupal will need to have write access to this directory so we can move the file.") .'<br />'
  12        . t("<strong>Note:</strong> a path begining with a <kbd>/</kbd> indicates the path is relative to the server's root, one starting without specifies a path relative to Drupal's root. I.e. <kbd>/tmp/audio</kbd> would be the temp directory off the root while <kbd>tmp/audio</kbd> would be inside Drupal's directory."),
  13      '#required' => TRUE,
  14    );
  15    return system_settings_form($form);
  16  }
  17  
  18  /**
  19   * Checks the existence of the directory specified in $form_element.
  20   *
  21   * @param $form_element
  22   *   The form element containing the name of the directory to check.
  23   * @see system_check_directory()
  24   */
  25  function _audio_import_settings_check_directory($form_element) {
  26    $import_dir = $form_element['#value'];
  27    file_check_directory($import_dir, 0, $form_element['#parents'][0]);
  28    $audio_dir = variable_get('audio_file_path', file_directory_path() .'/audio');
  29    if (realpath($import_dir) == realpath($audio_dir)) {
  30      form_set_error($form_element['#parents'][0], t("You can't import from the audio module's directory. The import deletes the original files so you would just be asking for trouble."));
  31    }
  32    else {
  33      drupal_set_message(t("Your settings are configured correctly, you can import audio <a href='!audio_import_page'>here</a>.", array('!audio_import_page' => url('admin/content/audio_import'))));
  34    }
  35  
  36    return $form_element;
  37  }


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7