03|$TIME_ZONE = Australia/Sydney`Time zone of your country and city.
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.
+10|$SESSN_EXPR = +30m`Login session expiration time setting, can be seconds, 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.
when ("RELEASE_VER") {$RELEASE_VER = $r[2]}
when ("TIME_ZONE") {$TIME_ZONE = $r[2]}
when ("PRC_WIDTH") {$PRC_WIDTH = $r[2]}
- when ("SESSN_EXPR") {$SESSN_EXPR = timeFormatValue($r[2])}
+ when ("SESSN_EXPR") {$SESSN_EXPR = timeFormatSessionValue($r[2])}
when ("DATE_UNI") {$DATE_UNI = $r[2]}
when ("LANGUAGE") {$LANGUAGE = $r[2]}
when ("LOG_PATH") {} # Ommited and code static can't change for now.
};
}
-sub timeFormatValue {
+sub timeFormatSessionValue {
my $v = shift;
- if(!$v || $v==0){$v="+2m"}
- if($v !~ /^\+/){$v='+'.$v.'m'}
- return $v;
+ my $ret = "+2m";
+ if(!$v){$v=$ret}
+ if($v !~ /^\+/){$v='+'.$v.'m'}# Must be positive added time
+ # Find first match in whatever passed.
+ my @a = $v =~ m/(\+\d+[shm])/gis;
+ if(scalar(@a)>0){$v=$a[0]}
+ # Test acceptable setting, which is any number from 2, having any s,m or h.
+ if($v =~ m/(\+[2-9]\d*[smh])|(\+[1-9]+\d+[smh])/){
+ # Next is actually, the dry booger in the nose. Let's pick it out!
+ # Someone might try to set in seconds value to be under two minutes.
+ @a = $v =~ m/(\d[2-9]\d+)/gs;
+ if(scalar(@a)>0 && int($a[0])<120){return $ret}else{return $v}
+ }
+ elsif($v =~ m/\+\d+/){# is passedstill without time unit? Minutetise!
+ $ret=$v."m"
+ }
+ return $ret;
}
-
sub getTheme {
given ($THEME){
when ("Sun") { $BGCOL = '#D4AF37'; $TH_CSS = "main_sun.css"; }
# $`=DBI
# $&=:
# $'=Pg:host=elite;name=androi
+print $v2.'->'.$`,"\n";
+$v1 ="";
+
+print "[$v1]->".timeFormatValue($v1),"\n";
+$v1 ="1";
+print "[$v1]->".timeFormatValue($v1),"\n";
+$v1 ="+1m";
+print "[$v1]->".timeFormatValue($v1),"\n";
+$v1 ="+10minutes";
+print "[$v1]->".timeFormatValue($v1),"\n";
+#default
+$v1 ="+30m";
+print "[$v1]->".timeFormatValue($v1),"\n";
+
+#Let's try sneak in garbage.
+$v1 ="+20bitcons";
+print "[$v1]->".timeFormatValue($v1),"\n";
+$v1 ="+20hitcons";
+print "[$v1]->".timeFormatValue($v1),"\n";
+$v1 ="+30hr";
+print "[$v1]->".timeFormatValue($v1),"\n";
+$v1 ="+1hr";
+print "[$v1]->".timeFormatValue($v1),"\n";
+$v1 ="+8.2severe";
+print "[$v1]->".timeFormatValue($v1),"\n";
+$v1 ="+8severe";
+print "[$v1]->".timeFormatValue($v1),"\n";
+$v1 ="+2severe";
+print "[$v1]->".timeFormatValue($v1),"\n";
+$v1 ="+120severe";
+print "[$v1]->".timeFormatValue($v1),"\n";
+$v1 ="+119severe";
+print "[$v1]->".timeFormatValue($v1),"\n";
+$v1 ="+121severe";
+print "[$v1]->".timeFormatValue($v1),"\n";
+$v1 ="+280severe";
+print "[$v1]->".timeFormatValue($v1),"\n";
+$v1 ="+120";
+print "[$v1]->".timeFormatValue($v1),"\n";
+
+
+sub timeFormatValue {
+ my $v = shift;
+ my $ret = "+2m";
+ if(!$v){$v=$ret}
+ if($v !~ /^\+/){$v='+'.$v.'m'}# Must be positive added time
+ # Find first match in whatever passed.
+ my @a = $v =~ m/(\+\d+[shm])/gis;
+ if(scalar(@a)>0){$v=$a[0]}
+ # Test acceptable setting, which is any number from 2, having any s,m or h.
+ if($v =~ m/(\+[2-9]\d*[smh])|(\+[1-9]+\d+[smh])/){
+ # Next is actually, the dry booger in the nose. Let's pick it out!
+ # Someone might try to set in seconds value to be under two minutes.
+ @a = $v =~ m/(\d[2-9]\d+)/gs;
+ if(scalar(@a)>0 && int($a[0])<120){return $ret}else{return $v}
+ }
+ elsif($v =~ m/\+\d+/){# is passedstill without time unit? Minutetise!
+ $ret=$v."m"
+ }
+ return $ret;
+}
-print $v2.'->'.$`,"\n";
1;
\ No newline at end of file