Commit 6c16de640d1606d955c5b154168640a6d7b5d7db
1 parent
c931adce
Remove "system settings" until we have database-backed configuration
again. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4360 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
0 additions
and
104 deletions
lib/System.inc deleted
| 1 | -<?php | ||
| 2 | -/** | ||
| 3 | - * $Id$ | ||
| 4 | - * | ||
| 5 | - * Stores system settings. | ||
| 6 | - * | ||
| 7 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | ||
| 8 | - * | ||
| 9 | - * This program is free software; you can redistribute it and/or modify | ||
| 10 | - * it under the terms of the GNU General Public License as published by | ||
| 11 | - * the Free Software Foundation; either version 2 of the License, or | ||
| 12 | - * (at your option) any later version. | ||
| 13 | - * | ||
| 14 | - * This program is distributed in the hope that it will be useful, | ||
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | - * GNU General Public License for more details. | ||
| 18 | - * | ||
| 19 | - * You should have received a copy of the GNU General Public License | ||
| 20 | - * along with this program; if not, write to the Free Software | ||
| 21 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 22 | - * | ||
| 23 | - * @version $Revision$ | ||
| 24 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | ||
| 25 | - * @package lib | ||
| 26 | - */ | ||
| 27 | -class System { | ||
| 28 | - var $aSettings = array("ldapServer", "ldapRootDn", "ldapServerType", | ||
| 29 | - "ldapDomain", "ldapSearchUser", "ldapSearchPassword", | ||
| 30 | - "emailServer", "emailFrom", "emailFromName", "emailAdmin", "emailAdminName", | ||
| 31 | - "documentRoot", "uiDirectory", | ||
| 32 | - "rootUrl", "graphicsUrl", "uiUrl", | ||
| 33 | - "sessionTimeout", "contentPaneScrolling", "folderHidingFlag"); | ||
| 34 | - var $aLabels = array ("LDAP Server", "LDAP Root DN", "LDAP Server Type (iPlanet OR ActiveDirectory)", | ||
| 35 | - "LDAP Domain", "LDAP Search User (AD)", "LDAP Search Password", | ||
| 36 | - "Email Server", "Default Email Address", "Default Email Name", "Administrator Email Address", "Administrator Name", | ||
| 37 | - "Document Root", "User Interface Directory", | ||
| 38 | - "Root URL", "Graphics URL", "User Interface URL", | ||
| 39 | - "Session Timeout", "Content Pane Scrolling Enabled", "Hide Unreadable Folders?"); | ||
| 40 | - | ||
| 41 | - /** | ||
| 42 | - * Returns true if there are entries in the system_settings table | ||
| 43 | - */ | ||
| 44 | - function initialised() { | ||
| 45 | - global $default; | ||
| 46 | - | ||
| 47 | - if ($default->db->query("SELECT count(*) AS count FROM system_settings WHERE name<>'lastIndexUpdate' AND name<>'filesystemRoot' AND name<>'knowledgeTreeVersion' AND value<>''")) {/*ok*/ | ||
| 48 | - $default->db->next_record(); | ||
| 49 | - return ($default->db->f("count") > 0) ? true : false; | ||
| 50 | - } | ||
| 51 | - } | ||
| 52 | - | ||
| 53 | - /** | ||
| 54 | - * Retrieves a system setting | ||
| 55 | - * | ||
| 56 | - * @param string setting name | ||
| 57 | - * @return string the setting | ||
| 58 | - */ | ||
| 59 | - function get($sSettingName) { | ||
| 60 | - // select the value from the db | ||
| 61 | - $value = lookupField("system_settings", "value", "name", $sSettingName); | ||
| 62 | - // if there are semi-colon delimited values, return as an array | ||
| 63 | - if (strstr($value, ";")) { | ||
| 64 | - return explode(";", $value); | ||
| 65 | - } else { | ||
| 66 | - return $value; | ||
| 67 | - } | ||
| 68 | - } | ||
| 69 | - | ||
| 70 | - function getInt($sSettingName) { | ||
| 71 | - // select the value from the db | ||
| 72 | - return (integer)lookupField("system_settings", "value", "name", $sSettingName); | ||
| 73 | - } | ||
| 74 | - | ||
| 75 | - /** | ||
| 76 | - * Sets a setting, if $sSettingName exists then the value is overwritten | ||
| 77 | - * else a new setting is inserted. | ||
| 78 | - * | ||
| 79 | - * @param string the name of the system setting | ||
| 80 | - * @param string the value of the system setting | ||
| 81 | - */ | ||
| 82 | - function set($sSettingName, $sSettingValue) { | ||
| 83 | - global $default; | ||
| 84 | - if (lookupField($default->system_settings_table, "name", "name", $sSettingName)) { | ||
| 85 | - $res = &DBUtil::whereUpdate($default->system_settings_table, | ||
| 86 | - array('value' => $sSettingValue), array('name' => $sSettingName)); | ||
| 87 | - if (PEAR::isError($res)) { | ||
| 88 | - return false; | ||
| 89 | - } | ||
| 90 | - return true; | ||
| 91 | - } else { | ||
| 92 | - $aFieldValues = array( | ||
| 93 | - 'name' => $sSettingName, | ||
| 94 | - 'value' => $sSettingValue, | ||
| 95 | - ); | ||
| 96 | - $res = DBUtil::autoInsert($default->system_settings_table, $aFieldValues); | ||
| 97 | - if (PEAR::isError($res)) { | ||
| 98 | - return false; | ||
| 99 | - } | ||
| 100 | - return true; | ||
| 101 | - } | ||
| 102 | - } | ||
| 103 | -} | ||
| 104 | -?> |