+++ /dev/null
-
-!CNF1.1
-This is the main configuration file for the LifeLog applications settings.
-https://github.com/wbudic/LifeLog
-This is an Open Source License project -> https://choosealicense.com/licenses/isc/
-The credential format:<<AUTO_LOGIN <{alias}/{password}> , dont enable here using AUTO_LOGIN option bellow, use config in app.
-<<AUTO_LOGIN<Value>>>
-# List command anon with the name of 'list_cmd'.
-<<list_cmd<
-ls -lh $$$1$$$|sort
->>>
-<<<CONST
-$RELEASE_VER = 1.8
-$SYS_1 = 10
-$SYS_2 = 20
-$SYS_3 = " Some Nice Text! "
->>
-<<CONST<$SYS_HELP
-Multiple lines
-in this txt
-is placed as a const.
->>>
-
-
-
-<<LOG<TABLE
- ID_CAT TINY NOT NULL,
- DATE DATETIME NOT NULL,
- LOG VCHAR(128) NOT NULL,
- AMOUNT INTEGER DEFAULT 0,
- AFLAG TINY DEFAULT 0,
- RTF BOOL DEFAULT 0,
- STICKY BOOL DEFAULT 0
->>
-<<LOG<DATA
-01`@2014-11-13 13:48:05`Test Entry\nmulti\nlined
->>
-<<CONFIG<TABLE
- ID TINY PRIMARY KEY NOT NULL,
- NAME VCHAR(16),
- VALUE VCHAR(28),
- DESCRIPTION VCHAR(128)
- >>
-<<CONFIG<INDEX
- idx_config_name ON CONFIG (NAME);
->>
-<<CONFIG<DATA
-00`$RELEASE_VER `$RELEASE_VER$`LifeLog Application Version.
-01`$REC_LIMIT `25`Records shown per page.
-03`$TIME_ZONE `Australia/Sydney`Time zone of your country.
-05`$PRC_WIDTH `80`Default presentation width for pages.
-08`$LOG_PATH `../../dbLifeLog/`Path to folder containing data.
-10`$SESSN_EXPR `+30m`Login session expiration time setting, can be minutes or hours.
-12`$DATE_UNI `0`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 `210x120`Default embedded image width.
-20`$AUTO_WRD_LMT`200`Autocomplete word gathering limit.
-22`$AUTO_LOGIN `0`Autologin option, that expires only if login out. Enter Credentials in main.cnf.
-24`$FRAME_SIZE `0`Youtube frame size settings, 0 - Large, 1 - Medium, 2- Small.
-26`$RTF_SIZE `2`RTF Document height, 0 - Large, 1 - Medium, 2- Small.
-28`$THEME `Standard`Theme to applay, Standard, Sun, Moon, Earth.
-30`$DEBUG `0`Development page additional debug output, off (default) or on.
-32`$KEEP_EXCS `0`Cache excludes between sessions, off (default) or on.
->>
-
-<<CAT<DATA
-01`Unspecified`For quick uncategorised 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 embbed.
-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).
->>
-
+++ /dev/null
-!CNF1.1
-<<list_cmd<ls -lh $$$1$$$|sort>>>
-<<LS<
-ls -l
->>>
-<<prop_test1<dir>>>
-<<not_prop-test2<dir>>>
-<<not_prop-test3<dir>>>
-<<not_prop-closed1<
-ls -l
->>
-<<not_prop-closed2<dir>>
-
-<<proper1< have a nice day! >>>
-<<proper2<
-very much too!
->>>
-<<<CONST $DEF_PHONE_LINE=1800 800 xxx>>>
-
-<<$HELP<CONST
-Multiple lines
-in this text.
->>>
-
-
-<<MyTemplate<
-
-Dear $$$SALUTATION$$$ $$$NAME$$$,
-
-We are writting to you to unfortunatelly advise you.
-That your application for an loan of $$$AMOUNT$$$, has been declined.
-
-Our assesment has made you not satify the $$$CRITERIA$$$ criteria.
-As outlined in our approval policy.
-
-Please find enclosed, our approval criteria booklet.
-Giving you a more precise and accurate requirments and information.
-
-Looking forward, in future business with you.
-
-Sincerely your Mike Dolittle
-Policy Approval Manager
-Head Office Acme Bank Corporation Holdings Global
-(p.h. $$$DEF_PHONE_LINE$$$)
-
-
->>>
-
-<<GET_SUB_URL<https://www.$$$1$$$.acme.com/$$$2$$$>>>
\ No newline at end of file
+++ /dev/null
-!CNF1.1
-Sample database and data. Presentnting a Inventory database of itmes. Having multiple categories.
-<<<CONST
-$LOGIN_USER=admin
-$LOGIN_PASS=admin
-$DATABASE=data_inventory.db
-$RELEASE_VER = 1.0
-$AUTOLOAD_DATA_FILES = 1 `Auto loads included data holding config files.
->>
-
-<<CATS<TABLE
- ID TINY PRIMARY KEY NOT NULL,
- NAME VCHAR(16),
- DESCRIPTION VCHAR(128)
->>
-
-<<ITEMS<TABLE
- DATE DATETIME NOT NULL,
- NAME VCHAR(64) NOT NULL,
- CATS VCHAR(24) DEFAULT '01',
- AMOUNT DOUBLE DEFAULT 0
->>
-
-
-<<CATS<DATA
-01`Unspecified`For quick uncategorised 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 embbed.~
-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).~
-62`Utility`Bill, house utility type expense.~
-64`Goverment`Goverment event of all events.
-Be a wise voter.~
->>
-
-<<ITEMS<DATA
-01-01-2020 12:30:00`Gas Bottle.`39.0`32,62~
-01-02-2020 13:00:00`Car rego \`service, new 2 tires.`513.0`32,55~
->>
-
-/**
- * Following file contains rest of data for ITEMS table.
- */
-<<DATA<FILE
-databaseInventoryDATA.cnf
->>>
-
-
+++ /dev/null
-!CNF1.1
-Sample database data tagged properties.
-See databaseInventory.cnf for data structure.
-<<ITEMS<DATA
-13-02-2020 11:50:50`First file base entry.`0`0~
-01-02-2020 13:00:00`Car rego \`service, new 2 tires.`513.0`32,55~
-false`false`0`0~
->>
+++ /dev/null
-ID_CAT,DATE,LOG,AMMOUNT\r
-3,2018-08-21T18:13:55,"DB Created!",\r
-28,"2018-08-21 20:06:29","Noisy Radio -> https://www.youtube.com/watch?v=fhq7mrl6Ub8 ",\r
-28,"2018-08-21 20:51:00","The band - The Weight",\r
-28,"2018-08-22 19:12:36","Maria Kurak Friends.",\r
-1,"2018-08-24 22:27:10","Search 1927 - If I Could (1988)",\r
-28,"2018-08-26 19:12:18","It works! ",\r
-28,"2018-08-27 12:36:20","Working from Wed this week.",\r
-28,"2018-07-31 18:59:23","Cant find Iva? Where is she gone?",\r
-28,"2018-09-07 15:52:05","Spring Cleaning 2018. Fridge Pantry. It is true, the longer in a kitchen Chef. More, and more tasks attached.",\r
-28,"2018-09-14 05:00:00","Was allowed day off. Hand injury! Got [A] classified, day before.",\r
-28,"2018-09-15 07:00:00","Zoran, my father died.",\r
-28,"2018-09-20 11:00:00",Funeral,\r
-28,"2018-10-19 16:49:35","Taking a week of holiday. Starts on 22, Monday.",""\r
-28,"2018-10-19 21:20:56","Lost mobile and wallet today. Returned!",""\r
-35,"2018-10-20 08:17:32","test Income",20000.5\r
-32,"2018-10-20 08:18:05","test expense",35690.65\r
-35,"2018-10-20 08:18:37",Income,22334422.89\r
-9,"2018-10-22 16:44:29","Toyota Airbag Recall done.",""\r
-28,"2018-10-30 05:30:00","Went to work, sick Alcohol poisoning. End of holiday. Never again, drink whiskey.",""\r
-28,"2018-11-02 18:09:06","Today, finally good. So much it takes to recover.\r
-Think have low level tolerance to it over 30% in bottle, as my liver alarms me.",""\r
-32,"2016-07-08 00:00:00","Gas Bottle Purchase",24\r
-32,"2017-02-13 00:00:00","Gas Bottle Purchase",24\r
-32,"2018-04-16 00:00:00","Gas Bottle Purchase",27\r
-32,"2018-04-16 00:00:00","PHFZR → Locket\r
-",15\r
-9,"2018-11-04 08:00:00","Bondi - Event Sculpture By The Sea. Last day Sunday. Full of people this early, hard to find parking.",2\r
-28,"2018-11-06 04:45:00","Hardly woke up, feeling bad again.",""\r
-9,"2018-11-09 16:26:27","Outage of Internet. Reported!\r
-I am TT1-1763730224201\r
-Call 1800117969 operator 4.",""\r
-32,"2018-11-22 14:15:00","Gas Bottle",29\r
-9,"2018-12-12 14:00:00","Dawn farewell party. (work)",""\r
-32,"2018-12-15 12:55:28","Electricity Bill ",260.8\r
-1,"2018-12-17 10:57:59","https://en.wikipedia.org/wiki/Longjing_tea\r
-\r
-Destination Flavour China",""\r
-9,"2018-12-20 14:45:23","Outage of Internet again.\r
-Since yesterday. After loud Thunder.",""\r
-28,"2018-12-21 18:36:1","Banned! To post. To old for anything! ",""\r
-9,"2014-11-13 13:48:05","TED - What your doctor won’t disclose\r
-https://youtu.be/oxYU5GNngnk",""\r
+++ /dev/null
-#!/usr/bin/perl -w
-#
-# Programed by: Will Budic
-# Open Source License -> https://choosealicense.com/licenses/isc/
-#
-use strict;
-use warnings;
-use Try::Tiny;
-
-use DateTime;
-use DateTime::Format::SQLite;
-use DateTime::Duration;
-use DBI;
-
-#DEFAULT SETTINGS HERE!
-use lib "system/modules";
-use lib $ENV{'PWD'}.'/htdocs/cgi-bin/system/modules';
-require CNFParser;
-require Settings;
-
-
-my ($dsn, $db,$res,$stm,$dbver,$st,$cnf);
-my $today = DateTime->now;
- $today->set_time_zone( &Settings::timezone );
-
-
-&testSettingsForStatementsInLifeLogDB;
-
-
-sub testSettingsForStatementsInLifeLogDB {
-
- $cnf = CNFParser->new();
- $dsn= "DBI:SQLite:dbname=".$ENV{'PWD'}.'/dbLifeLog/data_admin_log.db';
- $db = DBI->connect($dsn, 'admin', 'admin', { RaiseError => 1 }) or die "Error->". &DBI::errstri;
-
-
- print "Log records count:",Settings::selectRecords($db, 'select count(*)from LOG;')->fetchrow_array(),"\n";
- print "--Sample--\n",
-
- my $pst1 = Settings::selectRecords($db, 'select rowid, date, log from LOG order by date desc limit 10;');
- my $st = $db->prepare('select rowid, date, log from LOG order by date desc;');
- $st->execute() or die "<p>ERROR with->$_</p>";
-
-
- foreach (my @r = $pst1->fetchrow_array()) {
- my $lid = $r[0];
- my $dat = $r[1];
- my $log = $r[2];
- if(length($log)>60){
- print sprintf("%4d %s %.60s...\n", $lid, $dat, $log);
- }else{
- print sprintf("%4d %s %0s\n", $lid, $dat, $log);
- }
-
- }
-
- my $pst = Settings::selectRecords($db,"SELECT name FROM sqlite_master WHERE type='table';");
- my %curr_tables = ();
- while(my @r = $pst->fetchrow_array()){
- $curr_tables{$r[0]} = 1;
- }
- my $check; if ($curr_tables{"LOG"}){$check = 'yes'} else{ $check = 'no'};
- print "Has Log table? ->", $check, "\n";
- if ($curr_tables{"DOODLE"}){$check = 'yes'} else{ $check = 'no'};
- print "DOODLE table? ->", $check, "\n";
-
- $check = Settings::selectRecords($db,"SELECT ID FROM CAT WHERE name == 'System Log';")->fetchrow_array();
- $check = 0 if not $check;
- print "0==$check\n";
- $db->disconnect();
-
-exit;
-}
-
-$cnf = CNFParser->new();
-
-$cnf->parse($ENV{'PWD'}."/dbLifeLog/databaseInventory.cnf");
-
-
-
-$dsn = "DBI:SQLite:dbname=".$ENV{'PWD'}.'/dbLifeLog/'.$cnf->constant('$DATABASE');
-
- $db = DBI->connect($dsn, $cnf->constant('$LOGIN_USER'), $cnf->constant('$LOGIN_PASS'), { RaiseError => 1 })
- or die "Error->". &DBI::errstri ;
-$dbver = $cnf->initiDatabase($db);
-
-
-$dsn= "DBI:SQLite:dbname=".$ENV{'PWD'}.'/dbLifeLog/'.$cnf->constant('$DATABASE');
-
-print "Acessing: $dsn\n";
-
-## We have all the table statments, so let's check issue them first.
-foreach my $tbl ($cnf->tables()){
-
- if($cnf->tableExists($db, $tbl)){
- print "Table -> $tbl found existing.\n";
- }
- else{
- $stm = $cnf->tableSQL($tbl);
-
- if($db->do($stm)){
- print "Created table: $tbl \n";
- }
- else{
- print "Failed -> \n$stm \n";
- }
- }
-
-}
-
-
-
-foreach my $tbl ($cnf->dataKeys()){
- my ($sel,$ins, $seu, $upd, @prm, @arr);#locals
- try{
- print "Processing table data for ->", $tbl , "\n";
- $stm = $cnf->tableSQL($tbl);
-
- if(!$stm){
- print "Failed to obtain table statment for table data -> $tbl\n";
- }else{
- @arr = getStatements($tbl, $stm);
- $sel = $db->prepare($arr[0]);
- $ins = $db->prepare($arr[1]);
- $seu = $db->prepare($arr[2]);
- $upd = $db->prepare($arr[3]);
- foreach my $ln ($cnf->data($tbl)){
- #print "dataln-> $ln\n";
- @prm = ();
- foreach my $p (split(/','/,$ln)){
- $p =~ s/^'|'$//g;
- push @prm, $p;
- }
- $sel->execute(@prm);
- my @ret = $sel -> fetchrow_array();
- if(@ret){
- print "Exists -> ".delim(@prm)," <- UID: $ret[0]", "\n";
- }
- else{
- my $uid = shift @prm;
- $seu->execute($uid);
- @ret = $seu -> fetchrow_array();
- if(@ret){
- push @prm, $uid;
- @ret = $upd->execute(@prm);
- print "Updated -> ".delim(@prm), "\n";
- }else{
- unshift @prm, $uid;
- $ins->execute(@prm);
- print "Added -> ".delim(@prm), "\n";
- }
- }
- }
- }
-
- }catch{
- print "Error:$_\n";
- print "Error on->$tbl exeprms[",delim(@prm),"]\n";
- foreach my $ln ($cnf->data($tbl)){
- print "dataln-> $ln\n";
- }
- }
-
-}
-
-sub delim {
- my $r;
- foreach(@_){$r.=$_.'`'}
- $r=~s/`$//;
- return $r;
-}
-
-sub getStatements {
-
- my ($tbl, $stm) = @_;
- my @ret = ();
- my ($sel,$ins, $seu, $upd, $upe);
-
- $sel = "SELECT * FROM $tbl WHERE ";
- $ins = "INSERT INTO $tbl VALUES(";
- $upd = "UPDATE $tbl SET ";
-
- $stm =~ s/^.*\(\s+//g;
- $stm =~ s/\n\s*|\n\);/\n/g;
- $stm =~ s/\);//g;
-
- # print "<<$stm>>\n";
-
- foreach my $n (split(/,\s*/,$stm)){
- $n =~ /(^\w+)/;
- #print $1, "\n";
- $sel .= "$1=? AND ";
- $seu .= "SELECT * FROM $tbl WHERE $1=?;" if !$seu;
- $ins .= "?,";
- if (!$upe){
- $upe = " WHERE $1=?";
- }else{
- $upd .= "$1=?,";
- }
- }
- $sel =~ s/\sAND\s$/;/g;
- $ins =~ s/,$/);/g;
- $upd =~ s/,$/$upe/g;
-
- push @ret, $sel;
- push @ret, $ins;
- push @ret, $seu;
- push @ret, $upd;
-
- # print delim(@ret)."\n";
-
- return @ret;
-}
-
-
-1;
+++ /dev/null
-#!/usr/bin/perl -w
-#
-# Programed by: Will Budic
-# Open Source License -> https://choosealicense.com/licenses/isc/
-#
-use strict;
-use warnings;
-use DBI;
-use Exception::Class;
-
-
-use lib "system/modules";
-use lib $ENV{'PWD'}.'/htdocs/cgi-bin/system/modules';
-
-require Settings;
-
-
-my $dsn = "DBI:SQLite:dbname=/home/will/dev/LifeLog/dbLifeLog/data_admin_log.db";
-my $db = DBI->connect( $dsn, "admin", "admin", { PrintError => 0, RaiseError => 1 } )
- or Exception->throw("Connect failed [$_]");
-
-Settings::getConfiguration($db,{backup_enabled=>1});
-print "backup_enabled1:[".Settings::anon('backup_enabled')."]\n";
-my @r = Settings::anons();
-print "anon_size:[".@r."]@r\n";
-
-
-Settings::getConfiguration($db);#in file set to 0
-print "backup_enabled2:[".Settings::anon('backup_enabled')."]\n";
-Settings::getConfiguration($db,{backup_enabled=>1});#this is later, code set.
-print "backup_enabled3:[".Settings::anon('backup_enabled')."]\n";
-Settings::getConfiguration($db);#Murky waters, can't update an anon later through code. Config initially set.
-print "backup_enabled4:[".Settings::anon('backup_enabled')."]\n";
-
-# my $s1 ="`1`2`3`te\\`s\\`t`the best`";
-
-# $s1 =~ s/\\`/\\f/g;
-# #print $s1,"\n";
-# foreach ( split ( /`/, $s1) ){
-# $_ =~ s/\\f/`/g;
-# print $_,"\n";
-# }
-# print "Home:".$ENV{'PWD'}.$ENV{'NL'};
-
-
-
-1;
+++ /dev/null
-#!/usr/bin/perl -w
-#
-# Programed by: Will Budic
-# Open Source License -> https://choosealicense.com/licenses/isc/
-#
-use strict;
-use warnings;
-use Try::Tiny;
-
-use DateTime;
-use DateTime::Format::SQLite;
-use DateTime::Duration;
-
-
-#DEFAULT SETTINGS HERE!
-use lib "system/modules";
-
-use lib $ENV{'PWD'}.'/htdocs/cgi-bin/system/modules';
-require CNFParser;
-
-testAnons();
-
-
-
-sub testAnons {
-
-my $cnf = CNFParser->new($ENV{'PWD'}."/dbLifeLog/databaseAnonsTest.cnf");
-
-my $exe = $cnf->anons('list_cmd', $ENV{'PWD'});
-print "Exe is:$exe\n";
-$exe = `$exe`;
-print "Error failed system command!" if !$exe;
-#print "Listing:\n$exe\n";
-
-print "--LIST OF ALL ANONS ENCOUNTERED---\n";
-my %anons = $cnf->anons();
-foreach my $k (keys %anons){
- print "Key->$k=", $anons{$k},"]\n";
-}
-eval((keys %anons) == 7) or die "Error annons count mismatch!";
-
-eval(length($cnf->constant('$HELP'))>0) or die 'Error missing multi-line valued constant property $HELP';
-
-my $template = $cnf -> template( 'MyTemplate', (
- 'SALUTATION'=>'Mr',
- 'NAME'=>'Prince Clington',
- 'AMOUNT'=>"1,000,000\$",
- 'CRITERIA'=>"Section 2.2 (Eligibility Chapter)"
- )
- );
-
-print "\n--- TEMPLATE ---\n".$template;
-
-### From the specs.
-my $url = $cnf->anons('GET_SUB_URL',('tech','main.cgi'));
-# $url now should be: https://www.tech.acme.com/main.cgi
-eval ($url =~ m/https:\.*/)
-or warn "Failed to obtain expected URL when querying anon -> GET_SUB_URL";
-eval ($url eq 'https://www.tech.acme.com/main.cgi') or die "Error with: $url";
-}
-
-
-1;
+++ /dev/null
-#!/usr/bin/perl -w
-#
-# Programed by: Will Budic
-# Open Source License -> https://choosealicense.com/licenses/isc/
-#
-use strict;
-use warnings;
-use Try::Tiny;
-
-use DateTime;
-use DateTime::Format::SQLite;
-use DateTime::Duration;
-use Text::CSV;
-
-#DEFAULT SETTINGS HERE!
-use lib "system/modules";
-use lib $ENV{'PWD'}.'/htdocs/cgi-bin/system/modules';
-require Settings;
-
-my $today = DateTime->now;
-$today->set_time_zone( &Settings::timezone );
-print $today;
-
-# use lib $ENV{'PWD'}.'/htdocs/cgi-bin/system/modules';
-# require CNFParser;
-
-# my $cnf = CNFParser->new();
-# $cnf->parse($ENV{'PWD'}."/dbLifeLog/database.cnf");
-
-# foreach ($cnf->SQLStatments()){
-# print "$_\n";
-# }
-# foreach my $p ($cnf->constants()){
-
-# print "$p=", $cnf->constant($p),"\n";
-# }
-# print "\n---ANNONS---\n";
-# my %anons = $cnf->anons();
-# foreach my $k (%anons){
-# print "$k=", $anons{$k},"\n" if $k;
-# }
-# foreach (sort keys %ENV) {
-# print "$_= $ENV{$_}\n";
-# }
-
-### CGI END
-1;