Guest User

bugzilla

a guest
Mar 6th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. #!/usr/bin/perl -wT
  2. # This Source Code Form is subject to the terms of the Mozilla Public
  3. # License, v. 2.0. If a copy of the MPL was not distributed with this
  4. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  5. #
  6. # This Source Code Form is "Incompatible With Secondary Licenses", as
  7. # defined by the Mozilla Public License, v. 2.0.
  8.  
  9. ###############################################################################
  10. # Script Initialization
  11. ###############################################################################
  12.  
  13. # Make it harder for us to do dangerous things in Perl.
  14. use strict;
  15.  
  16. # Include the Bugzilla CGI and general utility library.
  17. use lib qw(. lib);
  18.  
  19. use Bugzilla;
  20. use Bugzilla::Constants;
  21. use Bugzilla::Error;
  22. use Bugzilla::Update;
  23.  
  24. # Check whether or not the user is logged in
  25. my $user = Bugzilla->login(LOGIN_OPTIONAL);
  26. my $cgi = Bugzilla->cgi;
  27. my $template = Bugzilla->template;
  28. my $vars = {};
  29.  
  30. # And log out the user if requested. We do this first so that nothing
  31. # else accidentally relies on the current login.
  32. if ($cgi->param('logout')) {
  33. Bugzilla->logout();
  34. $user = Bugzilla->user;
  35. $vars->{'message'} = "logged_out";
  36. # Make sure that templates or other code doesn't get confused about this.
  37. $cgi->delete('logout');
  38. }
  39.  
  40. ###############################################################################
  41. # Main Body Execution
  42. ###############################################################################
  43.  
  44. # Return the appropriate HTTP response headers.
  45. print $cgi->header();
  46.  
  47. if ($user->in_group('admin')) {
  48. # If 'urlbase' is not set, display the Welcome page.
  49. unless (Bugzilla->params->{'urlbase'}) {
  50. $template->process('welcome-admin.html.tmpl')
  51. || ThrowTemplateError($template->error());
  52. exit;
  53. }
  54. # Inform the administrator about new releases, if any.
  55. $vars->{'release'} = Bugzilla::Update::get_notifications();
  56. }
  57.  
  58. # Generate and return the UI (HTML page) from the appropriate template.
  59. $template->process("index.html.tmpl", $vars)
  60. || ThrowTemplateError($template->error());
Add Comment
Please, Sign In to add comment