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.

41 lines
768 B

  1. <?php
  2. /**
  3. * @package uForum2
  4. * @file inc/models/ConfigModel.php
  5. * @copyright 2007-2015 (c) PioDer
  6. * @link http://www.pioder.pl/
  7. * @license see LICENSE.txt
  8. **/
  9. class ConfigModel extends Model
  10. {
  11. private $confList = array();
  12. public function __construct(&$db)
  13. {
  14. $this->db = $db;
  15. $result = $this->select (CONFIG_TABLE);
  16. for ($i=0; $i<count($result); $i++)
  17. $this->confList[$result[$i]['name']] = $result[$i]['value'];
  18. }
  19. public function getConf($name)
  20. {
  21. if (isset($this->confList[$name]))
  22. return $this->confList[$name];
  23. else
  24. return null;
  25. }
  26. public function updateConf($name, $value)
  27. {
  28. $query = 'UPDATE '.CONFIG_TABLE.'
  29. SET `value`=\''.$value.'\'
  30. WHERE `name`=\''.$name.'\'';
  31. $this->db->query($query);
  32. }
  33. }
  34. ?>