A new, object-oriented, better vesion of μForum
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

42 lines
768 B

<?php
/**
* @package uForum2
* @file inc/models/ConfigModel.php
* @copyright 2007-2015 (c) PioDer
* @link http://www.pioder.pl/
* @license see LICENSE.txt
**/
class ConfigModel extends Model
{
private $confList = array();
public function __construct(&$db)
{
$this->db = $db;
$result = $this->select (CONFIG_TABLE);
for ($i=0; $i<count($result); $i++)
$this->confList[$result[$i]['name']] = $result[$i]['value'];
}
public function getConf($name)
{
if (isset($this->confList[$name]))
return $this->confList[$name];
else
return null;
}
public function updateConf($name, $value)
{
$query = 'UPDATE '.CONFIG_TABLE.'
SET `value`=\''.$value.'\'
WHERE `name`=\''.$name.'\'';
$this->db->query($query);
}
}
?>