--- /dev/null
+!CNF3.1
+/*
+This is the main configuration file for the LifeLog applications settings.
+<<OLD_PROJECT_GITHUB<https://github.com/wbudic/LifeLog>>
+<<PROJECT_GITHUB<https://lifelog.hopto.org/srv/git/LifeLog>>
+This is an Open Source License project -> https://choosealicense.com/licenses/isc/
+*/
+
+
+
+/**
+ These are modifiable anon application settings in this config file.
+ These aew not reflected to the database config settings.
+**/
+<<< APP_SETTINGS
+ // AUTO_LOGIN Credential format is:{alias}/{password} when set to zero it is disabled.
+ AUTO_LOGIN = 0
+ // BACKUP_ENABLED -> To Enable (1), disable (0) backups to be restored from config page.
+ BACKUP_ENABLED = 1
+ LOGOUT_IFRAME_ENABLED = true
+ FORCE_DEBUG_ON = 1
+ LOG_DATA_PATH = data
+ CURRENT_THEME = "default"
+>>>
+
+<<LOGOUT_RELOGIN_TXT<Log me In Again>>>
+<<LOGIN_NOTICE<CONST>
+ <span class="log">
+ <font color="red">NOTICE!</font>
+ The Alias entry is used for the database name here,
+ a new database will be created for you if it doesn't exist.
+ Make sure you note down your password.
+ </span>
+>>
+/**
+ These are constant defaults configuration settings, they can't be modified by the application,
+ once set here but will be reflected to the config database settings.
+ These database settings can be changed than in turn. Or all restored from here.
+ These used to be kept in the past in a Settings.pm package, now it is here in the configuartion.
+ Notice -> Deleting entries from here will most likely break the application.
+**/
+<<<CONST
+ RELEASE_VER : 2.7 #The application release version
+ TIME_ZONE : Australia/Sydney
+ LANGUAGE : English
+ PRC_WIDTH : 60
+ DATE_UNI : 0
+ AUTHORITY : ""
+ IMG_W_H : 210x120
+ REC_LIMIT : 25
+ AUTO_WRD_LMT : 1000
+ // Autocompletion word length limit. Internal.
+ AUTO_WRD_LEN : 17
+ AUTO_LOGOFF : 0
+ AUDIO_ENABLED : 1
+ VIEW_ALL_LMT : 1000
+ DISP_ALL : 1
+ FRAME_SIZE : 0
+ RTF_SIZE : 0
+ THEME : Standard
+ TRANSPARENCY : 1
+ TRANSIMAGE : "wsrc/images/std-log-lbl-bck.png"
+ TRACK_LOGINS : 1
+ KEEP_EXCS : 0
+ // HTTP Compressed encoding, should it be enabled.
+ COMPRESS_ENC : 0
+ SESSN_EXPR : +30m
+ DBI_SOURCE : "DBI:SQLite:"
+ DBI_LVAR_SZ : 1024
+ CURR_SYMBOL : "$"
+>>>
+
+<<@<@SCRIPTS_CSS>
+ wsrc/effects.css
+ wsrc/feeds.css
+ wsrc/jquery-ui.css
+ wsrc/jquery-ui.theme.css
+>>
+
+<<@<@SCRIPTS_JS>
+ wsrc/feeds.js
+>>
+
+<<THEMES<TREE>
+ css : wsrc/main.css
+ colBG : '#c8fff8'
+ colSHDW : '#9baec8'
+ [Sun[
+ css: 'wsrc/main_sun.css'
+ colBG: #FFD700
+ colSHDW:#FFD700
+ ]Sun]
+ [Moon[
+ css: 'wsrc/main_moon.css'
+ colBG: #000000
+ colSHDW:#DCDCDC
+ ]Moon]
+ [Earth[
+ css: 'wsrc/main_earth.css'
+ colBG: #228B22
+ colSHDW:#8FBC8F
+ ]Earth]
+>>
+
+
+#########################################################################
+ Note Remove -> '!' prefix to a tag name, to enable, set,
+ and override any previously set setting from now on,
+ it is from top to end file approach, in this type of configuration.
+#
+
+# Default database driver is SQLite, anyhow.
+# SQLite DB driver.
+<<!DBI_SOURCE<DBI:SQLite:>>>
+
+# ProgresSQL DB driver. Remove '!' to enable.
+<<!DBI_SOURCE<DBI:Pg:host=localhost;>>>
+
+
+# LOG actual variable size limit, - 8192 default, 128 minimum value.
+<<DBI_LOG_VAR_SIZE<8192>>>
+
+# Set the following to an database name, with external managed multiple users, that are to connect to a single database.
+# Users have to be externally set, and alias is then used for their userid to be able to login. (Add user roles to AUTH table).
+# By default this setting is disabled with 0, making alias name, its own log database, per user.
+#
+<<!DBI_MULTI_USER_DB<lifelog>>>
+
+# Timezoning, if set to 1, country locale setting for timezone in config page is ignored.
+<<AUTO_SET_TIMEZONE<0>>>
+
+# Public, enabled list of categories. Remove -> '!' prefix before tag name, to enable. Be careful what category you add/enable here.
+# Public records view feature only, it doesn't allow new log entries to be added and have pin point searching of all existing.
+<<!PUBLIC_CATS<03,06,09>>>#File,System log and Event.
+# Following is similar to AUTO_LOGIN setting above, and must be set.
+<<!PUBLIC_LOGIN</>>>
+<<TIME_ZONE_MAP<
+Australia/Marsfield=Australia/Sydney
+Australia/Bondi=Australia/Sydney
+America/Austin=America/Chicago
+America/Texas=America/Chicago
+>>>
+<<CURRENCY_SYMBOLS<DATA>
+$`$`$`$`Dollar Sign~
+€`€`€`€`Euro Sign~
+£`£`£`£`Pound Sign~
+¤`¤`¤`¤`Currency Sign~
+₽`₽`₽`Ruble Sign~
+¥`¥`¥`¥`Yen Sign~
+₨`₨`₨`Rupee Sign~
+৳`৳`৳`Bengali Rupee Sign~
+฿`฿`฿`Thai Currency Symbol Baht~
+>>
+
+<<PLUGINS<
+HelpPlugin->help.pl
+BankingPlugin->banking.pl
+>>
+
+# @See help at bottom of config for all the following.
+
+<<!PAGE_VIEW_EXCLUDES<0=88,6,69>>> <- (Diary,System Log,Poetry) category id's only, does set in the config page also work.
+<<!VIEW_OVERRIDE_SYSLOGS<0>>>
+<<!VIEW_OVERRIDE_WHERE<ID_CAT>=6 AND >>>
+
+#For internal use only.
+<<^CONFIG_META<200>The reserved id range for config table is from 200, upwards.>>
+
+
+
+#
+# The following are initial setup and data using above declared constance's in places. We use this data instead of hardcoding a lot in the app.
+# Modifying here after the fact of having run tje application is futile, a limp biscuit.
+# Only during migration this file might be changed by the developer.
+# The migration synchronisation might occure overwriting some values in this data placed settings.
+#
+<<CONFIG<DATA>
+ID` _PROPERTY_ `Description~
+00`$RELEASE_VER `LifeLog Application Version.~
+01`$REC_LIMIT `Records shown per page.~
+03`$TIME_ZONE `Australia/Sydney`Time zone of your country and city.
+05`$PRC_WIDTH `Default presentation width for pages.
+08`$LOG_PATH `Path to folder containing data.
+10`$SESSN_EXPR `Login session expiration time setting, can be seconds, minutes or hours.
+12`$DATE_UNI `Setting of how dates are displayed, universal yyyy-mm-dd or local dd-mm-yyyy.
+14`$LANGUAGE `English`Default language locale.
+18`$IMG_W_H `Default embedded image width.
+20`$AUTO_WRD_LMT `Autocomplete word gathering limit.
+22`$AUTO_LOGIN `Autologin option, that expires only if login out. Enter Credentials in main.cnf.
+23`$AUTO_LOGOFF `Auto logoff on session expires, default is false.
+24`$FRAME_SIZE `Youtube frame size settings, 0 - Large, 1 - Medium, 2- Small.
+26`$RTF_SIZE `RTF Document height, 0 - Large, 1 - Medium, 2- Small.
+28`$THEME `Standard`Theme to apply, Standard, Sun, Moon, Earth.
+30`$DEBUG `Development page additional debug output, off (default) or on.
+32`$KEEP_EXCS `Cache excludes between sessions, off (default) or on.
+34`$VIEW_ALL_LMT `Limit of all records displayed for large logs. Set to 0, for unlimited.
+36`$TRACK_LOGINS `Create system logs on login/logout of Life Log.
+38`$COMPRESS_ENC `Compress Encode pages, default -> 0=false, 1=true.
+40`$SUBPAGEDIR `Directory to scan for subpages like documents.
+42`$DISP_ALL `Display whole log entry, default -> 1=true, 0=false for display single line only.
+44`$TRANSPARENCY `Should log panel be transparent, default is yes or on.
+50`$CURR_SYMBOL `Currency symbol.
+52`$AUDIO_ENABLED`Enable/Disable audio on some events and actions.
+>>
+<<CAT<3>
+01|Unspecified `For quick uncategorized entries.
+03|File System `Operating file system/Application short log.
+06|System Log `Operating system important log.
+09|Event `Event that occurred, meeting, historically important.
+28|Personal `Personal log of historical importance, diary type.
+32|Expense `Significant yearly expense.
+35|Income `Significant yearly income.
+40|Work `Work related entry, worth monitoring.
+45|Food `Quick reference to recipes, observations.
+50|Music `Music reference of interest. Youtube embedded.
+52|Sport/Club `Sport or Social related entry.
+55|Cars `Car(s) related entry.
+60|Online `Online purchases (ebay, or received/ordered from online source).
+88|Diary `Diary specific log and entry. Your daily yaddi-yadda that have decided to place here.
+90|Fitness `Fitness steps, news, info, and useful links. Amount is steps.
+>>
+<<MIG<>
+NOTES|DROP TABLE NOTES;' ver. 1.5 fts4 virtual tables have been scratched as they require special SQLite compilation.
+LOG<5>|Run Query ' ver. 1.5
+
+## HELP SECTION ON OPTIONS
+
+
+ Global view overrides. These get generated in the db if set on logon. And used instead of the normal data view.
+ Overrides must always show todays log entries, regardless of criteria.
+ Overrides don't affect category and keywords desired searches and views. They are mainly useful to filter out
+ the not required to see on the main pages.
+ NOTE - These settings AND on VW_LOG_WITH_EXCLUDES if they are set. VW_ prefix signifies, database view,
+ meaning this will be created. Based on the settings bellow you make. An interesting concept, don't you think?
+
+### PAGE_VIEW_EXCLUDES
+
+ Setting to modify the page view to exclude older log entries by a list of categories from today minus days back.
+ This is to avoid and page only list relevant logs on logon. Searching by category will list them and still make visible.
+ value: {days=}{category id},.. days default to zero, if you don't want from yesterday to the past category entries listed.
+
+<<!PAGE_VIEW_EXCLUDES<0=88,6,69> <- (Diary,System Log,Poetry) category id's only, does set in the config page also work.
+
+
+### VIEW_OVERRIDE_SYSLOGS overrides not to show system logs that are older than today. Same to CAT!=6 by default,
+# Default is 0, disabled.
+
+### VIEW_OVERRIDE_WHERE
+
+ This option overrides what log entries to filter out from the page view, in more detail.
+ It translated via keywords to appropriate required SQL. This filter by default is
+ not active on 24 hours old entries. PAGE_VIEW_EXCLUDES option entries are included.
+
+#### CAT is the ID_CAT column, keyword.
+* i.e VIEW_OVERRIDE_WHERE<CAT >= 6>, selects all categories from and category id 6.
+PAGE_VIEW_EXCLUDES and VIEW_OVERRIDE_SYSLOGS don't have to be set. But preside if set.
+
+#### AND/OR keyword, logically joins the instructions.
+* i.e VIEW_OVERRIDE_WHERE< CAT > 6 AND CAT != 'Personal' >, selects all categories from
+category id 6, excluding resolved category entries.
+
+#### OLDER_THAN keyword translates to date column older than from today up to an specified date in the past.
+* This is assigned by either months, days, hours.
+** i.e VIEW_OVERRIDE_WHERE<CAT !=6 AND OLDER_THAN=2 months>, this instructs skip older then to months logs and all sys logs.
+
+#### FROM/TO in either months, days, hours.
+* Selects only FROM or TO an specified date only log entries.
+** i.e VIEW_OVERRIDE_WHERE<FROM=12 hours AND NOT OLDER_THAN=1 year>
+
+#### NOT keyword, logically negates.
+** i.e VIEW_OVERRIDE_WHERE<RTF>, select only log entries that contain attached RTF documents, if they
+are older than 24 hours. Remember, the default filtering is on 24 hour and older log entries.
+** i.e VIEW_OVERRIDE_WHERE<NOT RTF>, don't select log entries that contain attached RTF documents.
+** i.e VIEW_OVERRIDE_WHERE<CAT NOT 'Diary' AND CAT NOT 'System Log' AND DATE FROM=24 days AND NOT OLDER_THAN=1 year>,
+category is not (!=), resolved category id by name. And also exclude all logs older than an year.
+All is FROM to OLDER_THAN, affected. So from today (now) to FROM 'will' be paged, visible.
--- /dev/null
+#!/usr/bin/env perl
+#
+use strict;
+use warnings;
+use experimental qw( switch );
+use Exception::Class ('LifeLogException');
+use Syntax::Keyword::Try;
+use CGI::Tiny;
+no warnings qw(experimental::signatures);
+use feature qw(signatures);
+use utf8;
+#use lib "/home/will/dev_new/LifeLog/htdocs/cgi-bin/system/modules";
+use lib "system/modules";
+use bignum qw/hex/;
+
+use Gzip::Faster;
+
+require CNFParser;
+sub get_data_path($path){
+ $path = "data" unless $path; # The default is data dir.
+ $path = "../../$path" unless (-e $path); #cgi executing path is not same to this project local one, so we try resolve.
+ mkdir $path unless -e $path;
+return $path;
+}
+sub get_config_file_path {
+ my $file = 'app_lifelog_settings.cnf';
+ $file = "../../$file" unless(-e $file);
+return $file;
+}
+sub setup_with_last_used_theme($config, $path){
+ $path = $path.'/current_theme';
+ my $themes = $config -> getTree('THEMES');
+ our $THEME = '/';
+ if(-e $path){
+ open my $fh, '<', $path or return $THEME;
+ $THEME = <$fh>;chomp($THEME);
+ close($fh);
+ }
+ my $ret = $$themes -> node($THEME);
+ return $$themes if(!$ret);
+ return $ret;
+}
+
+
+
+#use CGI::Session '-ip_match';
+# use Data::Section::Simple 'get_data_section';
+
+# cgi {
+# my $cgi = $_;
+
+# # from templates/
+# my $tx = Text::Xslate->new(path => ['templates']);
+
+# # or from __DATA__
+# my $tx = Text::Xslate->new(path => [get_data_section]);
+
+# my $foo = $cgi->query_param('foo');
+# $cgi->render(html => $tx->render('index.tx', {foo => $foo}));
+# };
+
+
+use CGI;
+my $cgi = CGI->new();
+
+
+ # $cgi->set_error_handler(
+ # sub {
+ # my ($cgi, $error, $rendered) = @_;
+ # chomp $error;
+ # $cgi->render(text=>qq(<html><body><font style="color:crimson; font-weight:bold">You have unfortunately hit an cgi-bin::CNFHTMLServiceError</font>
+ # <div class='content-debug_output'><pre style="background:transparent">$error</pre><br> </div>
+ # </body></html>
+ # )
+ # );
+ # }
+ # );
+
+my $page = qq(
+<html><body>
+
+ <div class='content-debug_output'>
+ <pre style="background:transparent">
+ <h1> DEMO!</h1>
+ </pre><br> </div>
+</body></html>
+);
+ # $cgi-> add_response_header('Expires', '1s');
+ # $cgi-> add_response_header('Cache-Control', 'no-cache');
+ # $cgi->reset_response_headers();
+ # $cgi-> add_response_header('Content-Encoding', 'gzip');
+ # $cgi-> add_response_header('Accept-Encoding','Vary');
+ # $cgi-> render(text=>gzip($page));
+
+
+print $cgi->header(-expires => "1s", -charset => "UTF-8", -Content_Encoding => 'gzip');
+print gzip($page);
+
+ exit 0;
+
+1;
+
+=begin copyright
+Programed by : Will Budic
+EContactHash : 990MWWLWM8C2MI8K (https://github.com/wbudic/EContactHash.md)
+Source : https://github.com/wbudic/LifeLog
+Open Source Code License -> https://github.com/wbudic/PerlCNF/blob/master/ISC_License.md
+=cut copyright