You are here

function imce_admin in IMCE 7

Same name and namespace in other branches
  1. 6.2 inc/imce.admin.inc \imce_admin()
  2. 6 inc/admin.inc \imce_admin()

Admin main page.

2 string references to 'imce_admin'
imce_admin_form in inc/imce.admin.inc
Admin form.
imce_menu in ./imce.module
Implements hook_menu().

File

inc/imce.admin.inc, line 11
Serves administration pages of IMCE.

Code

function imce_admin() {
  $profiles = variable_get('imce_profiles', array());
  $header = array(
    t('Profile name'),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  $rows = array();
  foreach ($profiles as $pid => $profile) {
    $rows[] = array(
      check_plain($profile['name']),
      l(t('Edit'), 'admin/config/media/imce/profile/edit/' . $pid),
      $pid == 1 ? '' : l(t('Delete'), 'admin/config/media/imce/profile/delete/' . $pid),
    );
  }
  $rows[] = array(
    '',
    array(
      'data' => l(t('Add new profile'), 'admin/config/media/imce/profile'),
      'colspan' => 2,
    ),
  );
  $output['title'] = array(
    '#markup' => '<h2 class="title">' . t('Configuration profiles') . '</h2>',
  );
  $output['table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#attributes' => array(
      'id' => 'imce-profiles-list',
    ),
  );
  $output['form'] = drupal_get_form('imce_admin_form');

  // Display security warnings.
  if (empty($_POST)) {
    $roles = variable_get('imce_roles_profiles', array());
    if (!empty($roles[DRUPAL_ANONYMOUS_RID]['public_pid']) || !empty($roles[DRUPAL_ANONYMOUS_RID]['private_pid'])) {
      drupal_set_message(t('Anonymous user role has access to IMCE.') . ' ' . t('Make sure this is not a misconfiguration.'), 'warning');
    }
    if (imce_admin_check_wildcard_upload(DRUPAL_AUTHENTICATED_RID, $roles)) {
      drupal_set_message(t('Authenticated user role is assigned a configuration profile with unrestricted file extensions.') . ' ' . t('Make sure this is not a misconfiguration.'), 'warning');
    }
  }
  return $output;
}