Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

delete.php 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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: delete.php 1733 2014-11-02 23:06:13Z christian_boltz $
  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']) die('Invalid token!');
  21. $username = authentication_get_username(); # enforce login
  22. $id = safeget('delete');
  23. $table = safeget('table');
  24. $handlerclass = ucfirst($table) . 'Handler';
  25. if ( !preg_match('/^[a-z]+$/', $table) || !file_exists("model/$handlerclass.php")) { # validate $table
  26. die ("Invalid table name given!");
  27. }
  28. $is_admin = authentication_has_role('admin');
  29. $handler = new $handlerclass(0, $username, $is_admin);
  30. $formconf = $handler->webformConfig();
  31. if ($is_admin) {
  32. authentication_require_role($formconf['required_role']);
  33. } else {
  34. if (empty($formconf['user_hardcoded_field'])) {
  35. die($handlerclass . ' is not available for users');
  36. }
  37. }
  38. if ($handler->init($id)) { # errors will be displayed as last step anyway, no need for duplicated code ;-)
  39. $handler->delete();
  40. }
  41. flash_error($handler->errormsg);
  42. flash_info($handler->infomsg);
  43. header ("Location: " . $formconf['listview']);
  44. exit;
  45. /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
  46. ?>