[ Index ]
 

Code source de Horde 3.1.3

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/admin/perms/ -> delete.php (source)

   1  <?php
   2  /**
   3   * $Horde: horde/admin/perms/delete.php,v 1.19.8.4 2006/01/01 21:28:05 jan Exp $
   4   *
   5   * Copyright 1999-2006 Chuck Hagenbuch <chuck@horde.org>
   6   * Copyright 2005-2006 Jan Schneider <jan@horde.org>
   7   *
   8   * See the enclosed file COPYING for license information (LGPL). If you did
   9   * not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  10   */
  11  
  12  @define('HORDE_BASE', dirname(__FILE__) . '/../..');
  13  require_once  HORDE_BASE . '/lib/base.php';
  14  require_once  'Horde/Menu.php';
  15  
  16  if (!Auth::isAdmin()) {
  17      Horde::authenticationFailureRedirect();
  18  }
  19  
  20  /* Set up the form variables. */
  21  require_once 'Horde/Variables.php';
  22  $vars = &Variables::getDefaultVariables();
  23  $perm_id = $vars->get('perm_id');
  24  $category = $vars->get('category');
  25  $permission = &$perms->getPermissionById($perm_id);
  26  
  27  /* If the permission fetched is an error return to permissions list. */
  28  if (is_a($permission, 'PEAR_Error')) {
  29      $notification->push(_("Attempt to delete a non-existent permission."), 'horde.error');
  30      $url = Horde::applicationUrl('admin/perms/index.php', true);
  31      header('Location: ' . $url);
  32      exit;
  33  }
  34  
  35  /* Set up form. */
  36  require_once 'Horde/Perms/UI.php';
  37  $ui = &new Perms_UI($perms);
  38  $ui->setVars($vars);
  39  $ui->setupDeleteForm($permission);
  40  
  41  if ($confirmed = $ui->validateDeleteForm($info)) {
  42      $result = $perms->removePermission($permission, true);
  43      if (is_a($result, 'PEAR_Error')) {
  44          $notification->push(sprintf(_("Unable to delete \"%s\": %s."), $perms->getTitle($permission->getName()), $result->getMessage()), 'horde.error');
  45      } else {
  46          $notification->push(sprintf(_("Successfully deleted \"%s\"."), $perms->getTitle($permission->getName())), 'horde.success');
  47          $url = Horde::applicationUrl('admin/perms/index.php', true);
  48          header('Location: ' . $url);
  49          exit;
  50      }
  51  } elseif ($confirmed === false) {
  52      $notification->push(sprintf(_("Permission \"%s\" not deleted."), $perms->getTitle($permission->getName())), 'horde.success');
  53      $url = Horde::applicationUrl('admin/perms/index.php', true);
  54      header('Location: ' . $url);
  55      exit;
  56  }
  57  
  58  $title = _("Permissions Administration");
  59  require  HORDE_TEMPLATES . '/common-header.inc';
  60  require  HORDE_TEMPLATES . '/admin/common-header.inc';
  61  $notification->notify(array('listeners' => 'status'));
  62  
  63  /* Render the form and tree. */
  64  $ui->renderForm('delete.php');
  65  echo '<br />';
  66  $ui->renderTree($perm_id);
  67  
  68  require  HORDE_TEMPLATES . '/common-footer.inc';


Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7