You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

editactive.php 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * Postfix Admin
  4. *
  5. * LICENSE
  6. * This source file is subject to the GPL license that is bundled with
  7. * this package in the file LICENSE.TXT
  8. *
  9. * Further details on the project are available at http://postfixadmin.sf.net
  10. *
  11. * @version $Id$
  12. * @license GNU GPL v2 or later.
  13. *
  14. * File: delete.php
  15. * Used to delete admins, domains, mailboxes, aliases etc.
  16. *
  17. * Template File: none
  18. */
  19. require_once('common.php');
  20. if (safeget('token') != $_SESSION['PFA_token']) {
  21. die('Invalid token!');
  22. }
  23. $username = authentication_get_username(); # enforce login
  24. $id = safeget('id');
  25. $table = safeget('table');
  26. $active = safeget('active');
  27. $handlerclass = ucfirst($table) . 'Handler';
  28. if (!preg_match('/^[a-z]+$/', $table) || !file_exists(dirname(__FILE__) . "/../model/$handlerclass.php")) { # validate $table
  29. die("Invalid table name given!");
  30. }
  31. $handler = new $handlerclass(0, $username);
  32. $formconf = $handler->webformConfig();
  33. authentication_require_role($formconf['required_role']);
  34. if ($handler->init($id)) { # errors will be displayed as last step anyway, no need for duplicated code ;-)
  35. if ($active != '0' && $active != '1') {
  36. die(Config::Lang('invalid_parameter'));
  37. }
  38. if ($handler->set(array('active' => $active))) {
  39. $handler->store();
  40. }
  41. }
  42. flash_error($handler->errormsg);
  43. flash_info($handler->infomsg);
  44. header("Location: " . $formconf['listview']);
  45. exit;
  46. /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */