#no warnings 'uninitialized';
use CGI;
-use CGI::Pretty ":standard"; #Influde style subroutine for inline CSS
use CGI::Session '-ip_match';
use CGI::Carp qw ( fatalsToBrowser );
+use CGI::Pretty ":standard"; #Includes style subroutine for inline CSS
use DBI;
use DateTime::Format::SQLite;
use Number::Bytes::Human qw(format_bytes);
$hardware_status =~ s/\t+/<br>/gm; #TODO: This temp. resolves the regex needs to be adjusted so we join with <br>
$hardware_status =~ s/Memory:/<br><b>Memory: <\/b>/g;
$hardware_status =~ s/up\s/<b>Server is up: <\/b>/g;
-
my $prc = 'ps -eo size,pid,user,command --sort -size | awk \'{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }\'';
my $processes = `$prc | sort -u -r -`;
</div>);
print $cgi->end_html;
-my $syslog = "<span>$hardware_status</span>"."<pre>\n".`df -h -l -x tmpfs`."</pre>";
-&Settings::toLog($db, $syslog);
+
+$hardware_status = "<span>$hardware_status</span>"."<pre>\n".`df -h -l -x tmpfs`."</pre>";
+Settings::toLog($db, $$hardware_status);
+
+
$db->disconnect();
}
$alias = $sss->param('alias');
$pass = $sss->param('passw');
$pub = $cgi->param('pub');
+
+ ##From here we have data source set, currently Progress DB SQL and SQLite SQL compatible.
+ dbSrc($sss->param('db_source'));
+
+
if($pub){#we override session to obtain pub(alias)/pass from file main config.
open(my $fh, '<', logPath().'main.cnf' ) or LifeLogException->throw("Can't open main.cnf: $!");
while (my $line = <$fh>) {
chomp $line;
- my $v = Settings::parseAutonom('PUBLIC_LOGIN',$line);
+ my $v = parseAutonom('PUBLIC_LOGIN',$line);
if($v){my @cre = split '/', $v;
$alias = $cre[0];
$pass = uc crypt $cre[1], hex Settings->CIPHER_KEY;
}
- $v = Settings::parseAutonom('PUBLIC_CATS',$line);
+ $v = parseAutonom('PUBLIC_CATS',$line);
if($v){my @cats= split(',',$v);
foreach(@cats){
$SQL_PUB .= "ID_CAT=".trim($_)." OR ";
}
$SQL_PUB =~ s/\s+OR\s+$//;
}
- last if Settings::parseAutonom('CONFIG',$line);
+ last if parseAutonom('CONFIG',$line);
}
close $fh;
if(!$SQL_PUB){$alias=undef}
}
if(!$alias){
- print $cgi->redirect("login_ctr.cgi?CGISESSID=$sid");
- exit;
+ $alias = "admin"; $pass = $alias; dbSrc('dbi:Pg:host=localhost;');
}
- ##From here we have data source set, currently Progress DB SQL and SQLite SQL compatible.
- dbSrc($sss->param('db_source'));
my $ret = connectDB($alias, $pass);
getConfiguration($ret);
ID_CAT INT NOT NULL,
ID_RTF INTEGER DEFAULT 0,
DATE TIMESTAMP NOT NULL,
- LOG VARCHAR (128) NOT NULL,
+ LOG VARCHAR (1024) NOT NULL,
AMOUNT INTEGER,
AFLAG INT DEFAULT 0,
STICKY BOOL DEFAULT FALSE,
sub toLog {
my ($db,$log,$cat) = @_;
+ if(!$db){SettingsException->throw("Database handle not passed!")}
my $stamp = getCurrentSQLTimeStamp();
if(!$cat){
my @arr = selectRecords($db,"SELECT ID FROM CAT WHERE NAME LIKE 'System Log' or NAME LIKE 'System';")->fetchrow_array();