You are here

function imce_admin in IMCE 6.2

Same name and namespace in other branches
  1. 6 inc/admin.inc \imce_admin()
  2. 7 inc/imce.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
Implementation of 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(
      $profile['name'],
      l(t('Edit'), 'admin/settings/imce/profile/edit/' . $pid),
      $pid == 1 ? '' : l(t('Delete'), 'admin/settings/imce/profile/delete/' . $pid),
    );
  }
  $rows[] = array(
    '',
    array(
      'data' => l(t('Add new profile'), 'admin/settings/imce/profile'),
      'colspan' => 2,
    ),
  );
  $output = '<h2 class="title">' . t('Configuration profiles') . '</h2>';
  $output .= theme('table', $header, $rows);
  $output .= 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]['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;
}