ASNMTAP
view release on metacpan or search on metacpan
applications/htmlroot/cgi-bin/moderator/downtimes.pl view on Meta::CPAN
print "<pre>pagedir : $pagedir<br>pageset : $pageset<br>debug : $debug<br>CGISESSID : $sessionID<br>page no : $pageNo<br>page offset : $pageOffset<br>action : $action<br>id : $Cid<br>uploadFilename: $...
if ( defined $sessionID and ! defined $errorUserAccessControl ) {
unless ( defined $userType ) {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print "<br>\n<table WIDTH=\"100%\" border=0><tr><td class=\"HelpPluginFilename\">\n<font size=\"+1\">$errorUserAccessControl</font>\n</td></tr></table>\n<br>\n";
} else {
if ( $action eq 'insert' ) {
if ( $CuploadFilename eq '' or $CuploadFilename eq '<NIHIL>' ) {
$CatalogIDuKeyListStatus = 'ERROR: No applications CatalogID & uKey list selected!';
} else {
if ( $cgi->param('uploadFilename') eq '' ) {
$CatalogIDuKeyListStatus = 'ERROR: No applications CatalogID & uKey list uploaded!';
} else {
$CuploadFilename =~ s/^.*(?:\/|\\)//;
$Ctitle = 'Applications CatalogID & uKey List: '. $CuploadFilename;
my $type = $cgi->uploadInfo( $cgi->param('uploadFilename') )->{'Content-Type'};
if ( $type eq 'text/plain' ) {
my $fh = $cgi->upload('uploadFilename');
if ( defined $fh ) {
my $uploadFilenameBoolean = 0;
while (<$fh>) {
s/(^\s*|\r*|\n*|\s*$)//g;
if ( /^#/ ) {
$uploadFilenameBoolean = 1 if ( /^# ASNMTAP DOWNTIMES$/ );
} elsif ( $uploadFilenameBoolean ) {
push (@CatalogIDuKeyList, $_) if ( $_ );
}
}
my $uploadStatus = ( $uploadFilenameBoolean ? 'OK' : 'NOT OK' );
$CatalogIDuKeyListStatus = "$Ctitle: Uploaded and imported file $uploadStatus!";
} else {
$CatalogIDuKeyListStatus = "ERROR: $Ctitle, Cannot upload TXT file!";
}
} else {
$CatalogIDuKeyListStatus = "ERROR: $Ctitle, TXT files only!";
}
$CatalogIDuKeyListStatus .= "</td></tr><tr><td colspan=\"2\"> ";
}
}
}
my $urlWithAccessParameters = $ENV{SCRIPT_NAME} ."?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID";
my $localYear = sprintf ("%04d", (localtime)[5] );
my $localMonth = sprintf ("%02d", (localtime)[4] );
my $currentYear = sprintf ("%04d", (localtime)[5] + 1900 );
my $currentMonth = sprintf ("%02d", (localtime)[4] + 1 );
my $currentDay = sprintf ("%02d", (localtime)[3] );
my $currentHour = sprintf ("%02d", (localtime)[2] );
my $currentMin = sprintf ("%02d", (localtime)[1] );
my $currentSec = sprintf ("%02d", (localtime)[0] );
my ($CactivationTimeslot, $CsuspentionTimeslot, $tsec, $tmin, $thour, $tday, $tmonth, $tyear);
if ($CactivationDate ne '' and $CactivationTime ne '') {
($tyear, $tmonth, $tday) = split(/\-/, $CactivationDate);
$tyear -= 1900; $tmonth--;
($thour, $tmin, $tsec) = split(/:/, $CactivationTime);
$CactivationTimeslot = timelocal($tsec, $tmin, $thour, $tday, $tmonth, $tyear);
} else {
$CactivationTimeslot = '';
}
if ($CsuspentionDate ne '' and $CsuspentionTime ne '') {
($tyear, $tmonth, $tday) = split(/\-/, $CsuspentionDate);
$tyear -= 1900; $tmonth--;
($thour, $tmin, $tsec) = split(/:/, $CsuspentionTime);
$CsuspentionTimeslot = timelocal($tsec, $tmin, $thour, $tday, $tmonth, $tyear);
} else {
$CsuspentionTimeslot = '';
}
$nextAction = ($action eq 'insertView' ? 'insert' : 'insertView');
# open connection to database and query data
$rv = 1;
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subT...
if ($dbh) {
if ( $action eq 'insertView' ) {
if ( defined $remoteUserLoggedOn ) {
$CremoteUser = $remoteUserLoggedOn;
$sql = "select remoteUser, email from $SERVERTABLUSERS where catalogID = '$CcatalogID' and remoteUser = '$CremoteUser'";
} else {
my $andActivated = ($action eq 'insertView') ? 'and activated = 1' : '';
$sql = "select remoteUser, email from $SERVERTABLUSERS where catalogID = '$CcatalogID' and pagedir REGEXP '/$pagedir/' and remoteUser <> 'admin' and remoteUser <> 'sadmin' $andActivated order by email";
}
($rv, $remoteUsersSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 0, '', $CremoteUser, 'remoteUser', 'none', '-Select-', '', '', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
} else {
my $CentryDate = "$currentYear-$currentMonth-$currentDay";
my $CentryTime = "$currentHour:$currentMin:$currentSec";
my $CentryTimeslot = timelocal($currentSec, $currentMin, $currentHour, $currentDay, $localMonth, $localYear);
if ($CactivationDate eq '' or $CactivationTime eq '') {
$CactivationDate = $CentryDate;
$CactivationTime = $CentryTime;
$CactivationTimeslot = $CentryTimeslot;
}
if ($CsuspentionDate eq '' or $CsuspentionTime eq '') {
$CsuspentionDate = "0000-00-00";
$CsuspentionTime = "00:00:00";
$CsuspentionTimeslot = "9999999999";
}
my $dummyInstability = ($Cinstability eq 'on') ? 1 : 0;
my $dummyPersistent = ($Cpersistent eq 'on') ? 1 : 0;
my $dummyDowntime = ($Cdowntime eq 'on') ? 1 : 0;
foreach $catalogID_uKey (@CatalogIDuKeyList) {
my ($catalogID, $uKey) = split(/_/, $catalogID_uKey);
unless ( defined $uKey ) {
$uKey = $catalogID;
$catalogID = $CcatalogID;
}
($rv, $Ctitle) = get_title( $dbh, $rv, $catalogID, $uKey, $debug, -1, $sessionID );
$CatalogIDuKeyListStatus .= "<tr><td>$uKey from $catalogID</td>";
if ($rv and defined $Ctitle) {
$sql = 'INSERT INTO ' .$SERVERTABLCOMMENTS. ' SET catalogID="' .$catalogID. '", uKey="' .$uKey. '", replicationStatus="I", title="' .$Ctitle. '", entryDate="' .$CentryDate. '", entryTime="' .$CentryTime.'", entryTimeslot="' .$CentryTimesl...
$CatalogIDuKeyListStatus .= "<td>$Ctitle</td></tr>";
if ( $debug eq 'F' ) {
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
( run in 0.617 second using v1.01-cache-2.11-cpan-39bf76dae61 )