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.

37 lines
646 B

  1. <?php
  2. require_once('./inc/model.class.php');
  3. class ConfigModel extends Model
  4. {
  5. private $confList = array();
  6. public function __construct(&$db)
  7. {
  8. $this->db = $db;
  9. $result = $this->select (CONFIG_TABLE);
  10. for ($i=0; $i<count($result); $i++)
  11. $this->confList[$result[$i]['name']] = $result[$i]['value'];
  12. }
  13. public function getConf($name)
  14. {
  15. if (isset($this->confList[$name]))
  16. return $this->confList[$name];
  17. else
  18. return null;
  19. }
  20. public function updateConf($name, $value)
  21. {
  22. $query = 'UPDATE '.CONFIG_TABLE.'
  23. SET `value`=\''.$value.'\'
  24. WHERE `name`=\''.$name.'\'';
  25. $this->db->query($query);
  26. }
  27. }
  28. ?>