summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-03-16 03:46:18 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-03-16 03:46:18 +0000
commit119f418d6627eb0939778a5a9bcd6a64223ab225 (patch)
treeb28eaacff551f610cb270a9437d1451830104d98
parentadf7a8506dc2f670b54a60eaaa7abf5caa2cdaf0 (diff)
Added LedgerSMB::is_run_mode
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@914 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-xLedgerSMB.pm28
1 files changed, 24 insertions, 4 deletions
diff --git a/LedgerSMB.pm b/LedgerSMB.pm
index a894727b..6a11706d 100755
--- a/LedgerSMB.pm
+++ b/LedgerSMB.pm
@@ -47,6 +47,10 @@ HTML/SGML/XML or LaTeX.
This function returns true if $self->{$string} only consists of whitespace
characters or is an empty string.
+=item is_run_mode ('(cli|cgi|mod_perl)')
+This function returns 1 if the run mode is what is specified. Otherwise
+returns 0.
+
=item num_text_rows (string => $string, cols => $number, max => $number);
This function determines the likely number of rows needed to hold text in a
@@ -201,6 +205,21 @@ sub is_blank {
$rc;
}
+sub is_run_mode {
+ my $self = shift @_;
+ my $mode = lc shift @_;
+ my $rc = 0;
+ if ($mode eq 'cgi' && $ENV{GATEWAY_INTERFACE}){
+ $rc = 1;
+ }
+ elsif ($mode eq 'cli' && ! ($ENV{GATEWAY_INTERFACE} || $ENV{MOD_PERL})){
+ $rc = 1;
+ } elsif ($mode eq 'mod_perl' && $ENV{MOD_PERL}){
+ $rc = 1;
+ }
+ $rc;
+}
+
sub num_text_rows {
my $self = shift @_;
my %args = @_;
@@ -546,10 +565,10 @@ sub db_init {
sub redo_rows {
- $self = shift @_;
- %args = @_;
- @flds = @{$args{fields}};
- $count = $args{count};
+ my $self = shift @_;
+ my %args = @_;
+ my @flds = @{$args{fields}};
+ my $count = $args{count};
}
@@ -566,6 +585,7 @@ sub merge {
@keys = keys %{$src};
}
for my $arg (keys %$src){
+ my $dst_arg;
if ($index){
$dst_arg = $arg . "_$index";
} else {