<?php
							 | 
						|
								
							 | 
						|
								require_once('./inc/model.class.php');
							 | 
						|
								
							 | 
						|
								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);
							 | 
						|
									}	
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								?>
							 |