<%flags> inherit => undef <%once> use JSON::XS; use RTK::ThInternational::Database qw/commit/; use RTK::ThInternational::Locale qw/locale_string/; use RTK::Util::ApacheTools qw( is_dev ); use Aliases qw( RTK::ThInternational::Controllers::login RTK::ThInternational::HTML::MasonHandler RTK::Util::DateTime ); my $can_access_beta = 1; my $display_notification = sub { my $filename = shift; open my $fh, '<', $filename or return ""; local $/; my $notification_message = <$fh>; close $fh; my ($message, $type); my @messages; eval { my $info = decode_json($notification_message); $info = [ $info ] unless ref($info) eq 'ARRAY'; @messages = map { [ locale_string($_->{message}), $_->{type} ] } grep { $can_access_beta || ($_->{message} ne 'LS_WELCOME_TO_BETA') } @$info; }; @messages = [ locale_string($notification_message), 'danger' ] if $@; return join "\n", map { my $message = $_->[0]; my $type = $_->[1]; $message =~ s/\n//g; "
$message
" } @messages; }; my $does_notification_exist = sub { my $filename = shift; return $filename if -f $filename; }; <%init> my $request = $m->comp('/get_request', params => \%ARGS, require_user => 0) or return; my $controller = login->new($request); commit(); my $expired_error = locale_string('L_LOGIN_ERR_MSG__EXPIRED_PASSWORD'); if ( $controller->errors_count >= 1 && (grep { /$expired_error/i } @{$controller->errors})) { my $locale_id = $controller->locale_id; $request->redirect("/change_password.html?locale_id=$locale_id"); } return unless $controller->should_continue; my @errors = $controller->errors; if ($controller->is_redirected_from_beta) { unshift @errors, locale_string('LS_NO_BETA_ACCESS'); $can_access_beta = 0; } my $notification_file_name = $does_notification_exist->("$ENV{DOCUMENT_ROOT}/notification.txt") || $does_notification_exist->(MasonHandler->data_dir() . "/notification.txt"); <% locale_string('The Worldwide Box Office Authority') |h %>
% if ($can_access_beta) { % } <& 'layout/modal.html', %ARGS, id => 'requirements', page => '/shared/layout5/requirements.html', title => locale_string('Site Requirements'), &> <& 'layout/modal.html', %ARGS, id => 'tos', page => '/copyright.html', title => locale_string('Terms of Service'), &> <& 'layout/modal.html', %ARGS, id => 'privacy', page => '/privacy.html', title => locale_string('Privacy Policy'), &> <% is_dev ? "" : '' %>