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.
+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.
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_EXECS = 0`Cache excludes between sessions, off (default) or on.
<<CAT<3>
01|Unspecified `For quick uncategorised entries.
03|File System `Operating file system/Application short log.
our $FRAME_SIZE = 0;
our $RTF_SIZE = 0;
our $THEME = 'Standard';
+our $KEEP_EXCS = 0;
### Page specific settings Here
our $TH_CSS = 'main.css';
#END OF SETTINGS
+### Private Settings sofar (id -> name : def.value):
+#200 -> '^REL_RENUM' : this.$RELEASE_VER (Used in login_ctr.cgi)
+#201 -> '^EXCLUDES' : 0 (Used in main.cgi)
+
+
+
sub new {
return bless {}, shift;
sub universalDate {return $DATE_UNI;}
sub autoWordLimit {return $AUTO_WRD_LMT;}
sub windowRTFSize {return $RTF_SIZE;}
-
-
-sub bgcol {return $BGCOL;}
-sub css {return $TH_CSS;}
-sub debug {my $ret =shift; if($ret){$DEBUG = $ret;}; return $DEBUG;}
+sub keepExcludes {return $KEEP_EXCS;}
+sub bgcol {return $BGCOL;}
+sub css {return $TH_CSS;}
+sub debug {my $ret=shift; if($ret){$DEBUG = $ret;}; return $DEBUG;}
case "RTF_SIZE" { $RTF_SIZE = $r[2] }
case "THEME" { $THEME = $r[2] }
case "DEBUG" { $DEBUG = $r[2] }
+ case "KEEP_EXCS" { $KEEP_EXCS = $r[2] }
}
}
# try {
#Apostrophe in the log value is doubled to avoid SQL errors.
$log =~ s/'/''/g;
- $db->do("INSERT INTO LOG (ID_CAT, DATE, LOG) VALUES(6,'$stamp', \"$log\");");
+ $db->do("INSERT INTO LOG (ID_CAT, DATE, LOG) VALUES(6,'$stamp', \"$log\");");
# }
# catch {
# print "<font color=red><b>SERVER ERROR toLog(6,$stamp,$log)</b></font>:" . $_;
# }
}
-sub removeOldSessions {
+sub removeOldSessions {
opendir(DIR, $LOG_PATH);
my @files = grep(/cgisess_*/,readdir(DIR));
closedir(DIR);
}
}
+
+#TODO move this subroutine to settings.
+sub obtainProperty {
+ my($db, $name) = @_;
+ die "Invalid use of subroutine obtainProperty($db, $name)" if(!$db || !$name);
+ my $dbs = Settings::dbExecute($db, "SELECT ID, VALUE FROM CONFIG WHERE NAME IS '$name';");
+ my @row = $dbs->fetchrow_array();
+ if(scalar @row > 0){
+ return $row[1];
+ }
+ else{
+ return 0;
+ }
+}
+#TODO move this subroutine to settings.
+sub configProperty {
+ my($db, $id, $name, $value) = @_;
+ die "Invalid use of subroutine configProperty($db,$name,$value)" if(!$db || !$name|| !$value);
+
+ my $dbs = Settings::dbExecute($db, "SELECT ID, NAME FROM CONFIG WHERE NAME IS '$name';");
+ if($dbs->fetchrow_array()){
+ Settings::dbExecute($db, "UPDATE CONFIG SET VALUE = '$value' WHERE NAME IS '$name';");
+ }
+ else{
+ Settings::dbExecute($db,"INSERT INTO CONFIG (ID, NAME, VALUE) VALUES ($id, '$name', '$value');");
+ }
+}
+
1;
\ No newline at end of file