[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/class.config.php, 1.1.2.1
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/class.config.php, 1.1.2.1 |
Date: |
Sun, 23 May 2004 01:10:47 -0000 |
Update of /property
Added Files:
Branch: proposal-branch
class.config.php
date: 2004/04/30 09:52:25; author: sigurdne; state: Exp; lines: +98 -0
Log Message:
no message
=====================================================================
<?php
/**************************************************************************\
* phpGroupWare API - Application configuration in a centralized
location *
* This file written by Joseph Engo <address@hidden> *
* Copyright (C) 2000, 2001 Joseph Engo
*
*
-------------------------------------------------------------------------*
* This library is part of the phpGroupWare API
*
* http://www.phpgroupware.org/api
*
*
------------------------------------------------------------------------ *
* This library is free software; you can redistribute it and/or modify
it *
* under the terms of the GNU Lesser General Public License as published
by *
* the Free Software Foundation; either version 2.1 of the License,
*
* or any later version.
*
* This library 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
License *
* along with this library; if not, write to the Free Software
Foundation, *
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
\**************************************************************************/
/* $Id: class.config.php,v 1.1.2.1 2004/04/30 09:52:25 sigurdne Exp $ */
class property_config
{
var $db;
var $appname;
var $config_data;
function property_config($appname = '')
{
if (! $appname)
{
$appname = 'property';
//$GLOBALS['phpgw_data']['flags']['req_app'];
}
$this->db = $GLOBALS['phpgw']->db;
$this->appname = $appname;
}
function read_repository()
{
$dbresult = $GLOBALS['phpgw']->db->Execute("select *
from fm_config where config_app='" . $this->appname . "'",__LINE__,__FILE__);
while (!$dbresult->EOF)
{
$test =
@unserialize($dbresult->fields['config_value']);
if($test)
{
$this->config_data[$dbresult->fields['config_name']] = $test;
}
else
{
$this->config_data[$dbresult->fields['config_name']] =
$dbresult->fields['config_value'];
}
$dbresult->MoveNext();
}
}
function save_repository()
{
$config_data = $this->config_data;
if ($config_data)
{
$GLOBALS['phpgw']->db->begintrans();
$GLOBALS['phpgw']->db->Execute("delete from
fm_config where config_app='" . $this->appname . "'",__LINE__,__FILE__);
if($this->appname == 'phpgwapi')
{
$GLOBALS['phpgw']->db->Execute("delete
from phpgw_app_sessions where sessionid = '0' and loginid = '0' and app =
'".$this->appname."' and location = 'config'",__LINE__,__FILE__);
}
while (list($name,$value) = each($config_data))
{
if(is_array($value))
{
$value = serialize($value);
}
$name = addslashes($name);
$value = addslashes($value);
$GLOBALS['phpgw']->db->Execute("delete
from fm_config where config_name='" . $name . "'",__LINE__,__FILE__);
$GLOBALS['phpgw']->db->Execute("insert
into fm_config (config_app,config_name,config_value) "
. "values ('" . $this->appname
. "','" . $name . "','" . $value . "')",__LINE__,__FILE__);
}
$GLOBALS['phpgw']->db->committrans();
}
}
function delete_repository()
{
$GLOBALS['phpgw']->db->Execute("delete from fm_config
where config_app='" . $this->appname . "'",__LINE__,__FILE__);
}
function value($variable_name,$variable_data)
{
$this->config_data[$variable_name] = $variable_data;
}
}
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/class.config.php, 1.1.2.1,
nomail <=