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.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: editactive.php 1782 2015-04-06 23:09:58Z 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('id');
  23. $table = safeget('table');
  24. $active = safeget('active');
  25. $handlerclass = ucfirst($table) . 'Handler';
  26. if ( !preg_match('/^[a-z]+$/', $table) || !file_exists("model/$handlerclass.php")) { # validate $table
  27. die ("Invalid table name given!");
  28. }
  29. $handler = new $handlerclass(0, $username);
  30. $formconf = $handler->webformConfig();
  31. authentication_require_role($formconf['required_role']);
  32. if ($handler->init($id)) { # errors will be displayed as last step anyway, no need for duplicated code ;-)
  33. if ($active != '0' && $active != '1') {
  34. die(Config::Lang('invalid_parameter'));
  35. }
  36. if ( $handler->set(array('active' => $active)) ) {
  37. $handler->store();
  38. }
  39. }
  40. flash_error($handler->errormsg);
  41. flash_info($handler->infomsg);
  42. header ("Location: " . $formconf['listview']);
  43. exit;
  44. /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
  45. ?>