<?php
|
|
/**
|
|
* @package uForum2
|
|
* @file inc/models/ConfigModel.php
|
|
* @copyright 2007-2015 (c) PioDer <[email protected]>
|
|
* @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);
|
|
}
|
|
}
|
|
?>
|