ASNMTAP
view release on metacpan or search on metacpan
applications/htmlroot/cgi-bin/moderator/comments.pl view on Meta::CPAN
my $pageset = (defined $cgi->param('pageset')) ? $cgi->param('pageset') : 'moderator'; $pageset =~ s/\+/ /g;
my $debug = (defined $cgi->param('debug')) ? $cgi->param('debug') : 'F';
my $pageNo = (defined $cgi->param('pageNo')) ? $cgi->param('pageNo') : 1;
my $pageOffset = (defined $cgi->param('pageOffset')) ? $cgi->param('pageOffset') : 0;
my $action = (defined $cgi->param('action')) ? $cgi->param('action') : 'insertView';
my $CcatalogID = (defined $cgi->param('catalogID')) ? $cgi->param('catalogID') : $CATALOGID;
my $CcatalogIDreload = (defined $cgi->param('catalogIDreload')) ? $cgi->param('catalogIDreload') : 0;
my $Cenvironment = (defined $cgi->param('environment')) ? $cgi->param('environment') : 'P';
my $CenvironIDreload = (defined $cgi->param('environIDreload')) ? $cgi->param('environIDreload') : 0;
my @CatalogIDuKeyList = $cgi->param('selected');
my $Cid = (defined $cgi->param('id')) ? $cgi->param('id') : '';
my $CuKey = (defined $cgi->param('uKey')) ? $cgi->param('uKey') : 'none';
my $Ctitle = (defined $cgi->param('title')) ? $cgi->param('title') : '';
my $Cinstability = (defined $cgi->param('instability')) ? $cgi->param('instability') : 'off';
my $Cpersistent = (defined $cgi->param('persistent')) ? $cgi->param('persistent') : 'off';
my $Cdowntime = (defined $cgi->param('downtime')) ? $cgi->param('downtime') : 'off';
my $CactivationDate = (defined $cgi->param('activationDate')) ? $cgi->param('activationDate') : '';
my $CactivationTime = (defined $cgi->param('activationTime')) ? $cgi->param('activationTime') : '';
my $CsuspentionDate = (defined $cgi->param('suspentionDate')) ? $cgi->param('suspentionDate') : '';
my $CsuspentionTime = (defined $cgi->param('suspentionTime')) ? $cgi->param('suspentionTime') : '';
my $CproblemSolved = (defined $cgi->param('problemSolved')) ? $cgi->param('problemSolved') : 0;
my $CremoteUser = (defined $cgi->param('remoteUser')) ? $cgi->param('remoteUser') : 'none';
my $CcommentData = (defined $cgi->param('commentData')) ? $cgi->param('commentData') : '';
$CcommentData =~ s/"/'/g;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $htmlTitle = $APPLICATION;
# Init parameters
my ($rv, $dbh, $sth, $sql, $catalogID_uKey, $nextAction, $catalogIDSelect, $environmentSelect, $unselected_id, $remoteUsersSelect, $CatalogIDuKeyListStatus);
# User Session and Access Control
my ($sessionID, undef, undef, undef, undef, undef, undef, $errorUserAccessControl, $remoteUserLoggedOn, undef, undef, $givenNameLoggedOn, $familyNameLoggedOn, undef, undef, $userType, undef, undef, undef, $subTitle) = user_session_and_access_control ...
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&action=$action&catalogID=$CcatalogID&catalogIDreload=$CcatalogIDreload&environment=$Cenvironment&environIDreload=$Cen...
# Debug information
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>catalog ID : $CcatalogID<br>cat.ID rel...
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 {
$action = 'insertView' if ( $CcatalogIDreload or $CenvironIDreload );
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' ) {
$sql = "select catalogID, catalogName from $SERVERTABLCATALOG where not catalogID = '$CATALOGID' and activated = '1' order by catalogName asc";
($rv, $catalogIDSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, '', $CcatalogID, 'catalogID', $CATALOGID, '-Parent-', '', 'onChange="javascript:catalogIDsubmitForm();"', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $d...
$environmentSelect = '<select name="environment" size="1" onChange="javascript:environIDsubmitForm();"><option value="P"'. ($Cenvironment eq 'P' ? ' selected' : '') .'>Production</option><option value="A"'. ($Cenvironment eq 'A' ? ' selected'...
$sql = "select uKey, concat( LTRIM(SUBSTRING_INDEX(title, ']', -1)), ' (', $SERVERTABLENVIRONMENT.label, ')' ) as optionValueTitle from $SERVERTABLPLUGINS, $SERVERTABLENVIRONMENT where catalogID = '$CcatalogID' and $SERVERTABLPLUGINS.environm...
($rv, $unselected_id) = create_combobox_multiple_from_DBI ($rv, $dbh, $sql, $action, $CuKey, 'unselected', 'uKey', 10, 64, 0, '', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
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 );
( run in 0.625 second using v1.01-cache-2.11-cpan-39bf76dae61 )