[vhffs-dev] [847] Cleaned Conf.pm |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 847
Author: gradator
Date: 2007-08-31 00:57:34 +0000 (Fri, 31 Aug 2007)
Log Message:
-----------
Cleaned Conf.pm
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Conf.pm
trunk/vhffs-api/src/Vhffs/Main.pm
trunk/vhffs-tests/src/Vhffs/Tests/Main.pm
Modified: trunk/vhffs-api/src/Vhffs/Conf.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Conf.pm 2007-08-31 00:38:32 UTC (rev 846)
+++ trunk/vhffs-api/src/Vhffs/Conf.pm 2007-08-31 00:57:34 UTC (rev 847)
@@ -45,26 +45,20 @@
sub new
{
- my $class;
- my $self;
-
-
my ( $this , $param ) = @_;
- $class = ref($this) || $this;
+ my $class = ref($this) || $this;
- $self={
+ my $self={
filename => $param,
};
$filename = $param;
bless($self , $class );
-
return $self;
}
-
#Parse the main Vhffs Configuration file
sub parse
{
@@ -82,7 +76,7 @@
}
-#return a reference to a hash with the configuration of the backend
+#return a reference to a hash with the specified configuration
sub get_global
{
return $Config{'global'};
@@ -93,11 +87,6 @@
return $Config{'panel'};
}
-sub get_backend
-{
- return $Config{'backend'};
-}
-
sub get_database
{
return $Config{'database'};
@@ -113,17 +102,6 @@
return $Config{'groups'};
}
-sub get_listengine
-{
- return $Config{'listengine'};
-}
-
-sub get_robots
-{
- return $Config{'robots'};
-}
-
-
# get a service configuration
# if a parameter is given, the configuration of the service will be returned
# if not, it returns the whole configuration for all services
@@ -143,125 +121,85 @@
return Vhffs::Functions::strtoboolean( $Config{'services'}{$service}{'activate'} );
}
+sub get_listengine
+{
+ return $Config{'listengine'};
+}
-sub get_allow_subscribe
+sub get_robots
{
- return -1 if( ! defined $Config{"global"}{"allow_subscribe"} );
- return 1 if( ( $Config{"global"}{"allow_subscribe"} eq "yes") );
- return 0;
+ return $Config{'robots'};
}
-sub get_alert_mail
+# -- global parameters ---
+
+sub get_host_name
{
- if( defined $Config{"global"}{"alert_mail"} )
- {
- return $Config{"global"}{"alert_mail"};
- }
- else
- {
- return "nobody\@nobody.com";
- }
+ return $Config{'global'}{'host_name'};
}
+sub get_host_website
+{
+ return $Config{'global'}{'host_website'};
+}
sub get_datadir
{
- return $Config{"global"}{"datadir"};
+ return $Config{'global'}{'datadir'};
}
sub get_templatedir
{
- return $Config{"global"}{"templatedir"};
+ return $Config{'global'}{'templatedir'};
}
-
sub get_intldir
{
- return $Config{"global"}{"intldir"};
+ return $Config{'global'}{'intldir'};
}
-
sub get_default_language
{
- return $Config{"global"}{"default_language"};
+ return $Config{'global'}{'default_language'};
}
-
-sub get_mailtag
-{
-
- if( defined $Config{"global"}{"mailtag"} )
- {
- return $Config{"global"}{"mailtag"};
- }
- else
- {
- return undef;
- }
-}
-
-
sub get_master_mail
{
-
- if( defined $Config{"global"}{"vhffs_master"} )
- {
- return $Config{"global"}{"vhffs_master"};
- }
- else
- {
- return undef;
- }
+ return $Config{'global'}{'vhffs_master'};
}
-
sub get_moderator_mail
{
+ return $Config{'global'}{'vhffs_moderator'};
+}
- if( defined $Config{"global"}{"vhffs_moderator"} )
- {
- return $Config{"global"}{"vhffs_moderator"};
- }
- else
- {
- return undef;
- }
+sub get_mailtag
+{
+ return $Config{'global'}{'mailtag'};
}
-
-sub get_host_name
+sub get_allow_subscribe
{
- if( defined $Config{"global"}{host_name} )
- {
- return $Config{"global"}{host_name};
- }
- else
- {
- return "host";
- }
+ use Vhffs::Functions;
+ return Vhffs::Functions::strtoboolean( $Config{'global'}{'allow_subscribe'} );
}
-
-sub get_host_website
+sub get_alert_mail
{
- return $Config{'global'}{'host_website'};
+ return $Config{'global'}{'alert_mail'};
}
-
sub get_moderation
{
- if( ( defined $Config{"global"}{"moderation"} ) && ( $Config{"global"}{"moderation"} eq 'yes' ) )
- {
- return( 1 );
- }
- return( 0 );
+ use Vhffs::Functions;
+ return Vhffs::Functions::strtoboolean( $Config{'global'}{'moderation'} );
}
sub use_vhffsfs
{
- return 1 if( ( defined $Config{'global'}{'use_vhffsfs'} ) && ( $Config{'global'}{'use_vhffsfs'} eq 'yes' ) );
- return 0;
+ use Vhffs::Functions;
+ return Vhffs::Functions::strtoboolean( $Config{'global'}{'use_vhffsfs'} );
}
1;
Modified: trunk/vhffs-api/src/Vhffs/Main.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Main.pm 2007-08-31 00:38:32 UTC (rev 846)
+++ trunk/vhffs-api/src/Vhffs/Main.pm 2007-08-31 00:57:34 UTC (rev 847)
@@ -140,7 +140,6 @@
use Vhffs::Main;
my $vhffs = init Vhffs::Main;
my $conf = $vhffs->get_config;
- my $backend = $vhffs->get_backend;
=head1 DESCRIPTION
Modified: trunk/vhffs-tests/src/Vhffs/Tests/Main.pm
===================================================================
--- trunk/vhffs-tests/src/Vhffs/Tests/Main.pm 2007-08-31 00:38:32 UTC (rev 846)
+++ trunk/vhffs-tests/src/Vhffs/Tests/Main.pm 2007-08-31 00:57:34 UTC (rev 847)
@@ -132,7 +132,6 @@
use Vhffs::Main;
my $vhffs = init Vhffs::Main;
my $conf = $vhffs->get_config;
- my $backend = $vhffs->get_backend;
=head1 DESCRIPTION