From 04123643da499bac9eed8e8d1198a4c69148075f Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 21 May 2014 18:41:25 +0200 Subject: Server Setup page --- inc/property.inc.php | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 inc/property.inc.php (limited to 'inc/property.inc.php') diff --git a/inc/property.inc.php b/inc/property.inc.php new file mode 100644 index 00000000..a1c252a5 --- /dev/null +++ b/inc/property.inc.php @@ -0,0 +1,58 @@ +fetch(PDO::FETCH_ASSOC)) { + self::$cache[$row['name']] = $row['value']; + } + } + if (!isset(self::$cache[$key])) return $default; + return self::$cache[$key]; + } + + /** + * Set value in property store. + * + * @param string $key key of value to set + * @param type $value the value to store for $key + */ + private static function set($key, $value) + { + Database::exec("INSERT INTO property (name, value) VALUES (:key, :value)" + . " ON DUPLICATE KEY UPDATE value = VALUES(value)", array( + 'key' => $key, + 'value' => $value + )); + if (self::$cache !== false) { + self::$cache[$key] = $value; + } + } + + public static function getServerIp() + { + return self::get('server-ip', 'none'); + } + + public static function setServerIp($value) + { + self::set('server-ip', $value); + } + +} \ No newline at end of file -- cgit v1.2.3-55-g7522