2 /********************************************************************
6 Copyright 2008-2009 Radosław Pietruszewski
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 version 2 as published by the Free Software Foundation.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 ********************************************************************/
25 public static $siteName;
26 public static $siteSlogan;
27 public static $hashAlgo;
28 public static $defaultHashAlgo;
29 public static $defaultController;
31 private static $superusers = null;
32 private static $dbconfig = array();
33 private static $dbconfigLoaded = false;
36 * public static void setSuperusers(string[] $superusers)
38 * ustawia listę administratorów na $superusers
41 public static function setSuperusers(array $superusers)
43 if(self
::$superusers === NULL)
45 self
::$superusers = $superusers;
50 * public static string[] getSuperusers()
52 * zwraca listę administratorów
55 public static function getSuperusers()
57 return self
::$superusers;
61 * public static mixed getConf(string $fieldname)
63 * pobiera z bazy danych wartość konfiguracji $fieldname i zwraca ją
66 public static function getConf($fieldname)
68 if(!self
::$dbconfigLoaded)
70 $data = DB
::query("SELECT * FROM `__config`");
72 while($field = $data->to_obj())
74 self
::$dbconfig[$field->field
] = $field->value
;
77 self
::$dbconfigLoaded = true;
80 return self
::$dbconfig[$fieldname];
84 * public static void setConf(string $fieldname, string $fieldvalue)
86 * ustawia w bazie danych wartość pola $fieldname na $fieldvalue
89 public static function setConf($fieldname, $fieldvalue)
91 self
::$dbconfig[$fieldname] = $fieldvalue;
93 DB
::query("INSERT INTO `__config` (`field`, `value`) VALUES ('%1', '%2') ON DUPLICATE KEY UPDATE `value` = '%2'", $fieldname, $fieldvalue);