92 lines
2.3 KiB
Perl
92 lines
2.3 KiB
Perl
#!/usr/bin/perl
|
|
|
|
BEGIN { use lib '/usr/home/cfg' ; require push_inc ; }
|
|
|
|
use CGI qw( :standard );
|
|
use CGI::Carp qw(fatalsToBrowser);
|
|
use Mail::POP3Client;
|
|
use MIME::Parser;
|
|
use Fcntl qw(:flock) ;
|
|
use MIME::Lite;
|
|
use Mail::Sendmail;
|
|
|
|
require cfg ;
|
|
|
|
print header; # CGI.pm method
|
|
|
|
# unless ($useropts{admin}{$userid} eq $username) { require '401.pm' ; exit ; }
|
|
|
|
# https://itvadmin.co.za/cgi-bin/scripts/dialog/getmail.pl?debug=1
|
|
|
|
#---------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
&today;
|
|
|
|
#---------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
@ARGV = split(/\\*\&/, $ENV{'QUERY_STRING'});
|
|
$action = $ARGV[0] ;
|
|
|
|
our ($q) = CGI -> new() ;
|
|
our $iaction = $q -> param('iaction') || $action ;
|
|
our $isaved = $q -> param('isaved') || '' ;
|
|
our $debug = $q -> param('debug') || '' ;
|
|
|
|
#---------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
&start_html ;
|
|
|
|
&getmail_fetch;
|
|
|
|
&reload_parent ;
|
|
|
|
exit;
|
|
|
|
#------------------------------------------------------------------------------------------
|
|
|
|
sub start_html {
|
|
|
|
print <<ENDOFTEXT;
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>$useropts{title}</title>
|
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
|
</head>
|
|
<body>
|
|
"Fetching tickets..."
|
|
|
|
ENDOFTEXT
|
|
#
|
|
|
|
} #------------------------------------------------------------------------------------------
|
|
|
|
sub reload_parent {
|
|
|
|
my $jquery_raw = qq~parent.location.reload();
|
|
parent.\$("#alertbar").html("<div class='alert alert-success' id='alertmsg' role='alert'><i class='glyphicon glyphicon-ok'></i> <b>$nummsgs</b> new tickets!</div>");
|
|
parent.BootstrapDialog.closeAll() ;~;
|
|
|
|
if ($debug) { $jquery_raw = '' ; }
|
|
|
|
print <<ENDOFTEXT;
|
|
<script>
|
|
|
|
\$(function () {
|
|
$jquery_raw
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|
|
ENDOFTEXT
|
|
#
|
|
|
|
} #------------------------------------------------------------------------------------------
|
|
|
|
use db ;
|
|
use common ;
|
|
use today ;
|
|
use getmail ;
|
|
|
|
1; |