[ Index ]
 

Code source de Horde 3.1.3

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

title

Body

[fermer]

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

   1  <?php
   2  /**
   3   * $Horde: horde/admin/perms/addchild.php,v 1.27.2.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  
  25  $permission = &$perms->getPermissionById($perm_id);
  26  if (is_a($permission, 'PEAR_Error')) {
  27      $notification->push(_("Invalid parent permission."), 'horde.error');
  28      $url = Horde::applicationUrl('admin/perms/index.php', true);
  29      header('Location: ' . $url);
  30      exit;
  31  }
  32  
  33  /* Set up form. */
  34  require_once 'Horde/Perms/UI.php';
  35  $ui = &new Perms_UI($perms);
  36  $ui->setVars($vars);
  37  $ui->setupAddForm($permission);
  38  
  39  if ($ui->validateAddForm($info)) {
  40      if ($info['perm_id'] == DATATREE_ROOT) {
  41          $child = &$perms->newPermission($info['child']);
  42          $result = $perms->addPermission($child);
  43      } else {
  44          $pOb = &$perms->getPermissionById($info['perm_id']);
  45          $name = $pOb->getName() . ':' . DataTree::encodeName($info['child']);
  46          $child = &$perms->newPermission($name);
  47          $result = $perms->addPermission($child);
  48      }
  49      if (is_a($result, 'PEAR_Error')) {
  50          $notification->push(sprintf(_("\"%s\" was not created: %s."), $perms->getTitle($child->getName()), $result->getMessage()), 'horde.error');
  51      } else {
  52          $notification->push(sprintf(_("\"%s\" was added to the permissions system."), $perms->getTitle($child->getName())), 'horde.success');
  53          $url = Horde::applicationUrl('admin/perms/edit.php', true);
  54          $url = Util::addParameter($url, 'perm_id', $child->getId(), false);
  55          header('Location: ' . $url);
  56          exit;
  57      }
  58  }
  59  
  60  $title = _("Permissions Administration");
  61  require  HORDE_TEMPLATES . '/common-header.inc';
  62  require  HORDE_TEMPLATES . '/admin/common-header.inc';
  63  $notification->notify(array('listeners' => 'status'));
  64  
  65  /* Render the form and tree. */
  66  $ui->renderForm('addchild.php');
  67  echo '<br />';
  68  $ui->renderTree($perm_id);
  69  
  70  require  HORDE_TEMPLATES . '/common-footer.inc';


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