2019-07-17 20:08:50 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2019-07-17 20:31:04 +00:00
|
|
|
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
2019-07-17 20:08:50 +00:00
|
|
|
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
|
|
|
* @author Keyboard Monkey Ltd
|
|
|
|
* @since CommunityID 0.9
|
|
|
|
* @package CommunityID
|
|
|
|
* @packager Keyboard Monkeys
|
|
|
|
*/
|
|
|
|
|
2019-07-17 20:16:19 +00:00
|
|
|
class Model_Settings extends Monkeys_Db_Table_Gateway
|
2019-07-17 20:08:50 +00:00
|
|
|
{
|
|
|
|
protected $_name = 'settings';
|
|
|
|
protected $_primary = 'name';
|
|
|
|
|
|
|
|
const MAINTENANCE_MODE = 'maintenance_mode';
|
2019-07-17 20:16:19 +00:00
|
|
|
const VERSION = 'version';
|
2019-07-17 20:08:50 +00:00
|
|
|
|
|
|
|
public function get($name)
|
|
|
|
{
|
|
|
|
$select = $this->select()
|
|
|
|
->where('name=?', $name);
|
|
|
|
|
|
|
|
$row = $this->fetchRow($select);
|
|
|
|
|
2019-07-17 20:16:19 +00:00
|
|
|
if (!$row) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2019-07-17 20:08:50 +00:00
|
|
|
return $row->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function set($name, $value)
|
|
|
|
{
|
|
|
|
$this->update(array('value' => $value), $this->getAdapter()->quoteInto('name=?', $name));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isMaintenanceMode()
|
|
|
|
{
|
|
|
|
return $this->get(self::MAINTENANCE_MODE);
|
|
|
|
}
|
2019-07-17 20:16:19 +00:00
|
|
|
|
|
|
|
public function getVersion()
|
|
|
|
{
|
|
|
|
return $this->get(self::VERSION);
|
|
|
|
}
|
2019-07-17 20:08:50 +00:00
|
|
|
}
|