From 33a4c8519602a156d4992ffb21947631a055e5e2 Mon Sep 17 00:00:00 2001 From: Will Budicm Date: Sun, 1 Nov 2020 03:58:51 +1100 Subject: [PATCH] CGI, DB session moved into settings. DBName. --- Current Development Check List.md | 5 +- htdocs/cgi-bin/config.cgi | 113 ++++++++++------------ htdocs/cgi-bin/login_ctr.cgi | 27 +++--- htdocs/cgi-bin/main.cgi | 34 +++---- htdocs/cgi-bin/stats.cgi | 27 ++---- htdocs/cgi-bin/system/modules/Settings.pm | 44 ++++++++- 6 files changed, 128 insertions(+), 122 deletions(-) diff --git a/Current Development Check List.md b/Current Development Check List.md index 7bdde88..810f6a0 100644 --- a/Current Development Check List.md +++ b/Current Development Check List.md @@ -6,7 +6,7 @@ ### v.2.1 SUN STABLE New Features in Works -* Make the dbname uniform across all source types with Settings, as backups use the file format, not the database name. +* ✔ Make the dbname uniform across all source types with Settings, as backups use the file format, not the database name. * Static pages setting for the pages directory. * Search on multiwords should rank by encounter of words specified and display first. (That one is difficult) * Provide markdown text functionality to html pages. For quick vanila plain documentation. @@ -18,8 +18,9 @@ ### v.2.0 SUN RC2 Encountered -* Multiple search views and their settings, should be preserved as last preset. Maybe even have named multiple ones in a dropdown or part of the page menu. * Sub users list with passwords in config to be provided, with access and category, permissions settings. Default enabled permission is Event view category. +* [Scrapt] Multiple search views and their settings, should be preserved as last preset. Maybe even have named multiple ones in a dropdown or part of the page menu. + * Scrapt -> as view display is different to actual time based normal page display of records. Maybe in the future. * [Scrapt] Multiple category assignment to be enabled, where the first selected is the primary, others put in a separate cross reference table, parseed as hashtags maybe. * Scrapt -> as many categories per log complex and not necessary as many categories per view is already there. * ✔ Export to CVS button on selected logs. diff --git a/htdocs/cgi-bin/config.cgi b/htdocs/cgi-bin/config.cgi index 0fbae05..29e7db8 100755 --- a/htdocs/cgi-bin/config.cgi +++ b/htdocs/cgi-bin/config.cgi @@ -8,7 +8,6 @@ use warnings; use Switch; use CGI; -use CGI::Session '-ip_match'; use CGI::Carp qw ( fatalsToBrowser ); use DBI; use Exception::Class ('LifeLogException'); @@ -30,35 +29,19 @@ require Settings; #15mg data post limit $CGI::POST_MAX = 1024 * 15000; my ($LOGOUT,$ERROR) = (0,""); -my $cgi = CGI->new; -my $sss = new CGI::Session("driver:File", $cgi, {Directory=>&Settings::logPath}); -my $sid = $sss->id(); -my $dbname = $sss->param('database'); -my $userid = $sss->param('alias'); -my $pass = $sss->param('passw'); +my $cgi = CGI->new(); my $sys = `uname -n`; -#my $acumululator=""; - -if(!$userid||!$dbname){ - print $cgi->redirect("login_ctr.cgi?CGISESSID=$sid"); - exit; -} - -Settings::dbSrc( $sss->param('db_source')); -Settings::dbFile($sss->param('database')); -### Fetch settings - my $db = Settings::connectDB($userid, $pass); - Settings::getConfiguration($db); - Settings::getTheme(); -### - +my $db = Settings::fetchDBSettings($cgi); +my $sid = Settings::sid(); +my $dbname = Settings::dbname(); +my $alias = Settings::alias(); my $rv; my $dbs; -my $lang = Date::Language->new(&Settings::language); -my $today = DateTime->now; +my $lang = Date::Language->new(&Settings::language); +my $today = DateTime->now; $today->set_time_zone( &Settings::timezone ); -my $tz = $cgi->param('tz'); -my $csvp = $cgi->param('csv'); +my $tz = $cgi->param('tz'); +my $csvp = $cgi->param('csv'); &exportToCSV if ($csvp); @@ -74,15 +57,14 @@ my $stmtCat = 'SELECT * FROM CAT ORDER BY ID;'; my $status = "Ready for change!"; my $cats; my %hshCats = {}; -&cats; +cats(); ############### -&processSubmit; +processSubmit(); ############### Settings::getTheme(); -$sss->param("theme", &Settings::css); -$sss->param("bgcolor", &Settings::bgcol); - -&getHeader; +Settings::session()->param("theme", Settings::css()); +Settings::session()->param("bgcolor", Settings::bgcol()); +getHeader(); if ($ERROR){&error;}else{ print qq(