PageRenderTime 67ms CodeModel.GetById 22ms RepoModel.GetById 2ms app.codeStats 0ms

/gforge/www/include/exit.php

https://github.com/neymanna/fusionforge
PHP | 84 lines | 35 code | 9 blank | 40 comment | 3 complexity | e3a8d8dce21d2a6b7c73572d0e305458 MD5 | raw file
Possible License(s): GPL-2.0, MPL-2.0-no-copyleft-exception
  1. <?php
  2. /**
  3. * Exit functions
  4. *
  5. * SourceForge: Breaking Down the Barriers to Open Source Development
  6. * Copyright 1999-2001 (c) VA Linux Systems
  7. * http://sourceforge.net
  8. *
  9. * @version $Id$
  10. */
  11. /**
  12. * exit_error() - Exit PHP with error
  13. *
  14. * @param string Error title
  15. * @param string Error text
  16. */
  17. function exit_error($title,$text="", $toptab='') {
  18. global $HTML,$group_id;
  19. $HTML->header(array('title'=>_('Exiting with error'), 'group'=>$group_id, 'toptab'=>$toptab));
  20. print '<span class="error">'.$title.'</span><p>'.htmlspecialchars($text) .'</p>';
  21. $HTML->footer(array());
  22. exit;
  23. }
  24. /**
  25. * exit_permission_denied() - Exit with permission denied error
  26. *
  27. * @param string $reason_descr
  28. */
  29. function exit_permission_denied($reason_descr='') {
  30. if(!session_loggedin()) {
  31. exit_not_logged_in();
  32. } else {
  33. if (!$reason_descr) {
  34. $reason_descr=_('This project\'s administrator will have to grant you permission to view this page.');
  35. }
  36. exit_error(_('Permission denied.'),$reason_descr);
  37. }
  38. }
  39. /**
  40. * exit_not_logged_in() - Exit with not logged in error
  41. */
  42. function exit_not_logged_in() {
  43. //instead of a simple error page, now take them to the login page
  44. header ("Location: ".util_make_url ("/account/login.php?return_to=".urlencode(getStringFromServer('REQUEST_URI'))));
  45. exit;
  46. }
  47. /**
  48. * exit_no_group() - Exit with no group chosen error
  49. */
  50. function exit_no_group() {
  51. exit_error(_('ERROR - No group was chosen or you can\'t access it'),_('No group was chosen or you can\'t access it'));
  52. }
  53. /**
  54. * exit_missing_param() - Exit with missing required parameters error
  55. */
  56. function exit_missing_param() {
  57. exit_error(_('Error - missing parameters'),_('Error - missing required parameters'));
  58. }
  59. /**
  60. * exit_disabled() - Exit with disabled feature error.
  61. */
  62. function exit_disabled() {
  63. exit_error(_('Error - disabled feature.'),_('The Site Administrator has turned off this feature.'));
  64. }
  65. /**
  66. * exit_form_double_submit() - Exit with double submit error.
  67. */
  68. function exit_form_double_submit() {
  69. exit_error(_('Error - double submit'),_('You Attempted To Double-submit this item. Please avoid double-clicking.'));
  70. }
  71. // Local Variables:
  72. // mode: php
  73. // c-file-style: "bsd"
  74. // End:
  75. ?>