#[BOFN]###############################################################################
#
#
#Pagenews - a free script to publish news on websites
#Copyright (C) 2004,2005,2006,2007,2008 Philipp Kindt
#
#This file is part of Pagenews.
#
# 	 This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#[EOFN]###############################################################################


#this package contains the settings system - some funktions to retrive and store the settings

package dnsettings;

$settingsfile = "restricted/settings.cgi";
########################################################################
#loads the settings hash reference.
#it looks like this: $settings->{'key'} = "value"
#that's all !

#the format of the settings file is a donkvparser, where the data part conains one block.
#all fields of this block are included in the settings hash. 
#returns the settings hash reference
sub load_settings{
	my $dkvp = donkvparser->new();
	$dkvp->read($settingsfile);
	my $settings = $dkvp->{'data'}->[0];
	return $settings
};

########################################################################
#saves the settings hash reference wich must be in $_[0]
sub save_settings{
	my $dkvp = donkvparser->new();
	$dkvp->read($settingsfile);
	$dkvp->set_block(0,$_[0],"data");
	$dkvp->write();
};

1;

