Commit de44c93cfe6e57095689fb92d48462e4ca4cd088

Authored by Jonathan Byrne
1 parent 2ff3e85d

KTS-3307

"The Config file data needs to be moved to the database and an admin page needs to be made to manage this data."
Fixed. Made changes to run config from DB.

KTS-3309
"Dmsdefaults has a lot of config functions in it, they need to be moved to the KTConfig class."
Fixed. Functions have been separated into the right classes.

KTS-3272
"Migration of configuration to database"
Fixed. Completed KTS-3276 and KTS-3278 associated with this issue.

Committed By: Jonathan Byrne
Reviewed By: Megan Watson

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8560 c91229c3-7414-0410-bfa2-8a42b809f60b
config/config.ini
@@ -73,33 +73,13 @@ useNewDashboard = default @@ -73,33 +73,13 @@ useNewDashboard = default
73 ; Defaults to /usr/share/file/magic 73 ; Defaults to /usr/share/file/magic
74 magicDatabase = default 74 magicDatabase = default
75 75
76 -; The interval in seconds between each iteration of the scheduler  
77 -schedulerInterval = 30  
78 -  
79 -[dashboard]  
80 -; Display the "Your Checked-out Documents" dashlet even when empty.  
81 -; Defaults to false  
82 -alwaysShowYCOD = default  
83 -  
84 [storage] 76 [storage]
85 ; By default uses KTOnDiskHashedStorageManager 77 ; By default uses KTOnDiskHashedStorageManager
86 ; manager = KTOnDiskHashedStorageManager 78 ; manager = KTOnDiskHashedStorageManager
87 manager = default 79 manager = default
88 80
89 [ui] 81 [ui]
90 -;OEM application name  
91 -;appName = ACME  
92 -; Enable Morph  
93 -;morphEnabled = 1  
94 -; Morph Theme  
95 -;morphTo = blue  
96 -; add the logo of your company to the site's appearance.  
97 -; this logo MUST be 50px tall, and on a white background.  
98 -companyLogo = ${rootUrl}/resources/companylogo.png  
99 -; the logo's width in pixels  
100 -companyLogoWidth = 313px  
101 -; ALT text - for accessibility purposes.  
102 -companyLogoTitle = ACME Corporation 82 +
103 ; Main logo 83 ; Main logo
104 ;mainLogo = ${rootUrl}/resources/oemlogo.png 84 ;mainLogo = ${rootUrl}/resources/oemlogo.png
105 ; the logo's width in pixels 85 ; the logo's width in pixels
@@ -119,75 +99,18 @@ companyLogoTitle = ACME Corporation @@ -119,75 +99,18 @@ companyLogoTitle = ACME Corporation
119 ; ieGIF = true 99 ; ieGIF = true
120 ieGIF = default 100 ieGIF = default
121 101
122 -; do not restrict to searches (e.g. always show_all) on users and groups pages.  
123 -; alwaysShowAll = false  
124 -alwaysShowAll = default  
125 -  
126 ; Set to true to automatically refresh the page after the session would 102 ; Set to true to automatically refresh the page after the session would
127 ; have expired. 103 ; have expired.
128 automaticRefresh = default 104 automaticRefresh = default
129 105
130 -; use a condensed admin ui  
131 -condensedAdminUI = default  
132 -  
133 -; allow "open" from downloads. Changing this to "true" will prevent (most)  
134 -; browsers from giving users the "open" option.  
135 -; fakeMimetype = false  
136 -fakeMimetype = default  
137 -  
138 ; "dot" command location 106 ; "dot" command location
139 dot = dot 107 dot = dot
140 108
141 -; sort the metadata fields alphabetically  
142 -metadata_sort = true  
143 -  
144 -[i18n]  
145 -; Default language for the interface  
146 -defaultLanguage = en  
147 -; If your language doesn't have distinguishable words (usually, doesn't  
148 -; have a space character), set useLike to true to use a search that can  
149 -; deal with this, but which is slower.  
150 -useLike = default  
151 -  
152 [tweaks] 109 [tweaks]
153 ; If you want to enable PHP error logging to the log/php_error_log 110 ; If you want to enable PHP error logging to the log/php_error_log
154 ; file, change the following to true 111 ; file, change the following to true
155 phpErrorLogFile = false 112 phpErrorLogFile = false
156 113
157 -; Whether to browse to the user's (first) unit when first going to the  
158 -; browse section  
159 -browseToUnitFolder = default  
160 -  
161 -; Whether bulk operations should generate a transaction notice on each  
162 -; item, or only on the folder. Default of "false" indicates that only  
163 -; the folder transaction should occur.  
164 -noisyBulkOperations = false  
165 -  
166 -[email]  
167 -; email settings  
168 -emailServer = none  
169 -emailPort = default  
170 -  
171 -; do you need auth to connect to SMTP?  
172 -emailAuthentication = false  
173 -emailUsername = username  
174 -emailPassword = password  
175 -  
176 -emailFrom = kt@example.org  
177 -emailFromName = KnowledgeTree Document Management System  
178 -; Set to true to allow users to send attachments from the document  
179 -; management system  
180 -allowAttachment = default  
181 -; Set to true to allow users to send to any email address, as opposed to  
182 -; only users of the system  
183 -allowEmailAddresses = default  
184 -; Set to true to always send email from the emailFrom address listed  
185 -; above, even if there is an identifiable sending user  
186 -sendAsSystem = default  
187 -; Set to true to only allow users to send emails to those in the same  
188 -; groups as them  
189 -onlyOwnGroups = default  
190 -  
191 [urls] 114 [urls]
192 ; directories 115 ; directories
193 varDirectory = ${fileSystemRoot}/var 116 varDirectory = ${fileSystemRoot}/var
@@ -196,11 +119,6 @@ documentRoot = ${varDirectory}/Documents @@ -196,11 +119,6 @@ documentRoot = ${varDirectory}/Documents
196 uiDirectory = ${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree 119 uiDirectory = ${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree
197 tmpDirectory = ${varDirectory}/tmp 120 tmpDirectory = ${varDirectory}/tmp
198 121
199 -  
200 -; urls  
201 -graphicsUrl = ${rootUrl}/graphics  
202 -uiUrl = ${rootUrl}/presentation/lookAndFeel/knowledgeTree  
203 -  
204 ;dedicated feed url 122 ;dedicated feed url
205 ;dedicatedrsstitle = RSS Feed Title 123 ;dedicatedrsstitle = RSS Feed Title
206 ;dedicatedrssurl = 124 ;dedicatedrssurl =
@@ -208,202 +126,22 @@ uiUrl = ${rootUrl}/presentation/lookAndFeel/knowledgeTree @@ -208,202 +126,22 @@ uiUrl = ${rootUrl}/presentation/lookAndFeel/knowledgeTree
208 ; files 126 ; files
209 stopwordsFile = ${fileSystemRoot}/config/stopwords.txt 127 stopwordsFile = ${fileSystemRoot}/config/stopwords.txt
210 128
211 -[webservice]  
212 -; Directory to which all uploads via webservices are persisted before moving into the repository  
213 -uploadDirectory = ${varDirectory}/uploads  
214 -  
215 -; Url which is sent to clients via web service calls so they can then download file via HTTP GET  
216 -downloadUrl = ${rootUrl}/ktwebservice/download.php  
217 -  
218 -; Period indicating how long a file should be retained in the uploads directory.  
219 -uploadExpiry = 30  
220 -  
221 -; Period indicating how long a download link will be available  
222 -downloadExpiry = 30  
223 -  
224 -; Random text used to construct a hash. This can be customised on installations so there is less chance of overlap between installations.  
225 -randomKeyText = bkdfjhg23yskjdhf2iu  
226 -  
227 -; Validating session counts can interfere with access. It is best to leave this disabled, unless very strict access is required.  
228 -validateSessionCount = false  
229 -  
230 -; If the document type is invalid when adding a document, we can be tollerant and just default to the Default document type.  
231 -useDefaultDocumentTypeIfInvalid = true  
232 -  
233 -; The web service debugging if the logLevel is set to DEBUG. We can set the value to 4 or 5 to get more verbose web service logging.  
234 -; Level 4 logs the name of functions being accessed. Level 5 logs the SOAP XML requests and responses.  
235 -debug = false  
236 -  
237 [session] 129 [session]
238 -; session timeout (in seconds)  
239 -sessionTimeout = 1200  
240 -  
241 -; by default, do not auto-login users as anonymous.  
242 -; set this to true if you UNDERSTAND the security system that KT  
243 -; uses, and have sensibly applied the roles "Everyone" and "Authenticated Users".  
244 -allowAnonymousLogin = false  
245 130
246 ; Set to true to force sessions to come from the same IP address 131 ; Set to true to force sessions to come from the same IP address
247 ; ipTracking = false 132 ; ipTracking = false
248 133
249 -[import]  
250 -; unzip command - will use execSearchPath to find if the path to the  
251 -; binary is not given  
252 -unzip = unzip  
253 -  
254 [export] 134 [export]
255 -; zip command - will use execSearchPath to find if the path to the  
256 -; binary is not given  
257 -zip = zip  
258 135
259 ; encoding to use in bulk export plugin 136 ; encoding to use in bulk export plugin
260 ; default is set to UTF-8 137 ; default is set to UTF-8
261 ; encoding = cp1252 138 ; encoding = cp1252
262 encoding = default 139 encoding = default
263 140
264 -[externalBinary]  
265 -; The following are external binaries that may be used by various parts of knowledgeTree.  
266 -xls2csv = xls2csv  
267 -pdftotext = pdftotext  
268 -catppt = catppt  
269 -pstotext = pstotext  
270 -catdoc = catdoc  
271 -antiword = antiword  
272 -python = python  
273 -java = java  
274 -php = php  
275 -df = df  
276 -  
277 -[search]  
278 -; The number of results per page  
279 -; defaults to 25  
280 -resultsPerPage = default  
281 -  
282 -; The format in which to display the results  
283 -; options are searchengine or browseview  
284 -; defaults to searchengine  
285 -resultsDisplayFormat = default  
286 -  
287 -; The date format used when making queries using widgets  
288 -; defaults to Y-m-d  
289 -dateFormat = default  
290 -  
291 -[browse]  
292 -; The document info box / preview is activated by mousing over or clicking on the icon  
293 -; Options: mouse-over (default); onclick  
294 -previewActivation = default  
295 -  
296 -[indexer]  
297 -; The core indexing class  
298 -;coreClass=PHPLuceneIndexer  
299 -coreClass=JavaXMLRPCLuceneIndexer  
300 -  
301 -; The number of documents to be indexed in a cron session  
302 -; defaults to 20  
303 -batchDocuments = default  
304 -  
305 -; The number of documents to be migrated in a cron session  
306 -; defaults to 500  
307 -batchMigrateDocuments = default  
308 -  
309 -; The location of the lucene indexes  
310 -luceneDirectory=${varDirectory}/indexes  
311 -  
312 -; The url for the Java Lucene Server. This should match up the the Lucene Server configuration.  
313 -; Defaults to http://127.0.0.1:8875  
314 -javaLuceneURL = default  
315 -  
316 -[openoffice]  
317 -; The host on which open office is installed  
318 -; defaults to 127.0.0.1  
319 -host = default  
320 -  
321 -; The port on which open office is listening  
322 -; defaults to 8100  
323 -port = default  
324 -  
325 -[user_prefs]  
326 -; minimum password length on password-setting  
327 -passwordLength = 6  
328 -  
329 -; apply the minimum password length to admin while creating / editing accounts?  
330 -; default is set to "false" meaning that admins can create users with shorter passwords.  
331 -restrictAdminPasswords = default  
332 -  
333 -; restrict users from accessing their preferences menus?  
334 -restrictPreferences = false  
335 -  
336 -  
337 -; This is configuration for the built-in authentication provider  
338 -[builtinauth]  
339 -;  
340 -; This would force users that use the built-in authentication provider  
341 -; to have to change their passwords every 30 days.  
342 -;  
343 -; password_change_interval = 30  
344 -  
345 [cache] 141 [cache]
346 ; 142 ;
347 ; enable/disable the cache and set the cache location 143 ; enable/disable the cache and set the cache location
348 ; 144 ;
349 cacheEnabled = true 145 cacheEnabled = true
350 cacheDirectory = ${varDirectory}/cache 146 cacheDirectory = ${varDirectory}/cache
351 -cachePlugins = true  
352 -  
353 -[KTWebDAVSettings]  
354 -; This section is for KTWebDAV only  
355 -; _LOTS_ of debug info will be logged if the following is "on"  
356 -debug = off  
357 -; To allow write access to WebDAV clients set safe mode to "off" below  
358 -safemode = on  
359 -  
360 -[BaobabSettings]  
361 -; This section is for Baobab only  
362 -; _LOTS_ of debug info will be logged if the following is "on"  
363 -debug = off  
364 -; To allow write access to WebDAV clients set safe mode to "off" below  
365 -safemode = on  
366 -  
367 -[backup]  
368 -; Identify location of kt-backup for database backups.  
369 -;backupDirectory=c:/kt-backups  
370 -;backupDirectory=/tmp/kt-backups  
371 -  
372 -; Identify the location of the mysql.exe and mysqldump.exe  
373 -;mysqlDirectory=c:/program files/ktdms/mysql/bin  
374 -  
375 -[clientToolPolicies]  
376 -;These two settings control whether or not the client is prompted for metadata when a  
377 -;document is added to knowledgetree via KTtools. They default to true.  
378 -explorerMetadataCapture = true  
379 -officeMetadataCapture = true  
380 -;These settings govern whether reasons are asked for in KTtools  
381 -captureReasonsDelete = true  
382 -captureReasonsCheckin = true  
383 -captureReasonsCheckout = true  
384 -captureReasonsCancelCheckout = true  
385 -captureReasonsCopyInKT = true  
386 -captureReasonsMoveInKT = true  
387 -;This setting governs whether the password can be stored on the client.  
388 -allowRememberPassword = true  
389 -  
390 -; settings for the Disk Usage dashlet  
391 -[DiskUsage]  
392 -; When free space in a mount point is less than this percentage,  
393 -; the disk usage dashlet will will highlight the mount in ORANGE  
394 -warningThreshold=10  
395 -  
396 -; When free space in a mount point is less than this percentage,  
397 -; the disk usage dashlet will will highlight the mount in RED  
398 -urgentThreshold=5  
399 -  
400 -[CustomErrorMessages]  
401 -;Turn custom error messages on or off here.  
402 -customerrormessages=on  
403 -;name or url of custom error page.  
404 -customerrorpagepath=customerrorpage.php  
405 -;Turn custom error handler on or off.  
406 -;The custom error handler will log any non php errors caught  
407 -;by the custom error handler if it is turned on.  
408 -;Php errors are always logged by php itself.  
409 -customerrorhandler=on 147 +cachePlugins = true
410 \ No newline at end of file 148 \ No newline at end of file
config/dmsDefaults.php
@@ -100,14 +100,39 @@ if (!defined('PATH_SEPARATOR')) { @@ -100,14 +100,39 @@ if (!defined('PATH_SEPARATOR')) {
100 require_once(KT_LIB_DIR . '/Log.inc'); 100 require_once(KT_LIB_DIR . '/Log.inc');
101 require_once(KT_LIB_DIR . '/validation/customerror.php'); 101 require_once(KT_LIB_DIR . '/validation/customerror.php');
102 102
  103 +
  104 +
  105 +// {{{ prependPath()
  106 +function prependPath ($path) {
  107 +
  108 + $include_path = ini_get('include_path');
  109 + ini_set('include_path', $path . PATH_SEPARATOR . $include_path);
  110 +}
  111 +// }}}
  112 +
  113 +prependPath(KT_DIR . '/thirdparty/ZendFramework/library');
  114 +prependPath(KT_DIR . '/thirdparty/pear');
  115 +prependPath(KT_DIR . '/thirdparty/Smarty');
  116 +prependPath(KT_DIR . '/thirdparty/simpletest');
  117 +prependPath(KT_DIR . '/thirdparty/xmlrpc-2.2/lib');
  118 +prependPath(KT_DIR . '/ktapi');
  119 +prependPath(KT_DIR . '/search2');
  120 +require_once('PEAR.php');
  121 +
  122 +// Give everyone access to legacy PHP functions
  123 +require_once(KT_LIB_DIR . '/util/legacy.inc');
  124 +
  125 +// Give everyone access to KTUtil utility functions
  126 +require_once(KT_LIB_DIR . '/util/ktutil.inc');
  127 +
  128 +require_once(KT_LIB_DIR . '/ktentity.inc');
  129 +
  130 +require_once(KT_LIB_DIR . '/config/config.inc.php');
  131 +require_once(KT_DIR . '/search2/indexing/indexerCore.inc.php');
  132 +
103 // {{{ KTInit 133 // {{{ KTInit
104 class KTInit { 134 class KTInit {
105 - // {{{ prependPath()  
106 - function prependPath ($path) {  
107 - $include_path = ini_get('include_path');  
108 - ini_set('include_path', $path . PATH_SEPARATOR . $include_path);  
109 - }  
110 - // }}} 135 +
111 // {{{ setupLogging() 136 // {{{ setupLogging()
112 function setupLogging () { 137 function setupLogging () {
113 global $default; 138 global $default;
@@ -177,51 +202,7 @@ class KTInit { @@ -177,51 +202,7 @@ class KTInit {
177 } 202 }
178 // }}} 203 // }}}
179 204
180 - // {{{ setupDB()  
181 - function setupDB () {  
182 - global $default;  
183 -  
184 - require_once('DB.php');  
185 -  
186 - // DBCompat allows phplib API compatibility  
187 - require_once(KT_LIB_DIR . '/database/dbcompat.inc');  
188 - $default->db = new DBCompat;  
189 -  
190 - // DBUtil is the preferred database abstraction  
191 - require_once(KT_LIB_DIR . '/database/dbutil.inc');  
192 -  
193 - // KTEntity is the database-backed base class  
194 - require_once(KT_LIB_DIR . '/ktentity.inc');  
195 -  
196 - $oKTConfig =& KTConfig::getSingleton();  
197 -  
198 - $prefix = defined('USE_DB_ADMIN_USER')?'Admin':'';  
199 -  
200 - $dsn = array(  
201 - 'phptype' => $oKTConfig->get('db/dbType'),  
202 - 'username' => $oKTConfig->get("db/db{$prefix}User"),  
203 - 'password' => $oKTConfig->get("db/db{$prefix}Pass"),  
204 - 'hostspec' => $oKTConfig->get('db/dbHost'),  
205 - 'database' => $oKTConfig->get('db/dbName'),  
206 - 'port' => $oKTConfig->get('db/dbPort'),  
207 - );  
208 -  
209 - $options = array(  
210 - 'debug' => 2,  
211 - 'portability' => DB_PORTABILITY_ERRORS,  
212 - 'seqname_format' => 'zseq_%s',  
213 - );  
214 -  
215 - $default->_db = &DB::connect($dsn, $options);  
216 - if (PEAR::isError($default->_db)) {  
217 - $this->handleInitError($default->_db);  
218 - // returns only in checkup  
219 - return $default->_db;  
220 - }  
221 - $default->_db->setFetchMode(DB_FETCHMODE_ASSOC);  
222 -  
223 - }  
224 - /// }}} 205 +
225 206
226 // {{{ cleanGlobals() 207 // {{{ cleanGlobals()
227 function cleanGlobals () { 208 function cleanGlobals () {
@@ -390,29 +371,29 @@ class KTInit { @@ -390,29 +371,29 @@ class KTInit {
390 371
391 // }}} 372 // }}}
392 373
393 -function catchFatalErrors()  
394 -{  
395 -  
396 - $CustomErrorPage = KTCustomErrorViewer::getCustomErrorRedirectPage();  
397 - if($CustomErrorPage != '0') 374 + function catchFatalErrors()
398 { 375 {
399 - ini_set('display_errors','On');  
400 - $phperror='><div id="phperror" style="display:none">';  
401 - ini_set('error_prepend_string',$phperror);  
402 -  
403 - $sUrl = KTInit::guessRootUrl();  
404 - global $default;  
405 - $sRootUrl = ($default->sslEnabled ? 'https' : 'http') .'://'.$_SERVER['HTTP_HOST'].$sUrl;  
406 -  
407 - $CustomErrorPage = basename($CustomErrorPage);  
408 -  
409 - $phperror='</div>><form name="catcher" action="'.$sRootUrl.'/'.$CustomErrorPage.'" method="post" ><input type="hidden" name="fatal" value=""></form>  
410 - <script> document.catcher.fatal.value = document.getElementById("phperror").innerHTML; document.catcher.submit();</script>';  
411 - ini_set('error_append_string',$phperror); 376 +
  377 + $CustomErrorPage = KTCustomErrorViewer::getCustomErrorRedirectPage();
  378 + if($CustomErrorPage != '0')
  379 + {
  380 + ini_set('display_errors','On');
  381 + $phperror='><div id="phperror" style="display:none">';
  382 + ini_set('error_prepend_string',$phperror);
  383 +
  384 + $sUrl = KTInit::guessRootUrl();
  385 + global $default;
  386 + $sRootUrl = ($default->sslEnabled ? 'https' : 'http') .'://'.$_SERVER['HTTP_HOST'].$sUrl;
  387 +
  388 + $CustomErrorPage = basename($CustomErrorPage);
  389 +
  390 + $phperror='</div>><form name="catcher" action="'.$sRootUrl.'/'.$CustomErrorPage.'" method="post" ><input type="hidden" name="fatal" value=""></form>
  391 + <script> document.catcher.fatal.value = document.getElementById("phperror").innerHTML; document.catcher.submit();</script>';
  392 + ini_set('error_append_string',$phperror);
  393 + }
  394 +
412 } 395 }
413 396
414 -}  
415 -  
416 397
417 398
418 // {{{ guessRootUrl() 399 // {{{ guessRootUrl()
@@ -446,6 +427,26 @@ function catchFatalErrors() @@ -446,6 +427,26 @@ function catchFatalErrors()
446 } 427 }
447 // }}} 428 // }}}
448 429
  430 + // {{{ getDynamicConfigSettings
  431 + //This function gets the intial config settings which can only be resolved by using php
  432 + function getDynamicConfigSettings()
  433 + {
  434 + $oKTConfig =& KTConfig::getSingleton();
  435 +
  436 + $oKTConfig->setdefaultns('KnowledgeTree', 'fileSystemRoot', KT_DIR);
  437 + $oKTConfig->setdefaultns('KnowledgeTree', 'serverName', KTUtil::arrayGet($_SERVER, 'HTTP_HOST', 'localhost'));
  438 + $oKTConfig->setdefaultns('KnowledgeTree', 'sslEnabled', 0);
  439 + if (array_key_exists('HTTPS', $_SERVER)) {
  440 + if (strtolower($_SERVER['HTTPS']) === 'on') {
  441 + $oKTConfig->setdefaultns('KnowledgeTree', 'sslEnabled', 1);
  442 + }
  443 + }
  444 + $oKTConfig->setdefaultns('KnowledgeTree', 'rootUrl', $this->guessRootUrl());
  445 + $oKTConfig->setdefaultns('KnowledgeTree', 'execSearchPath', $_SERVER['PATH']);
  446 + $oKTConfig->setdefaultns('KnowledgeTree', 'magicDatabase', KTInit::detectMagicFile());
  447 + }
  448 + // }}}
  449 +
449 // {{{ initConfig 450 // {{{ initConfig
450 function initConfig() { 451 function initConfig() {
451 global $default; 452 global $default;
@@ -477,166 +478,21 @@ function catchFatalErrors() @@ -477,166 +478,21 @@ function catchFatalErrors()
477 } 478 }
478 } 479 }
479 480
  481 +/*
480 if ($use_cache) { 482 if ($use_cache) {
481 $oKTConfig =& KTConfig::getSingleton(); 483 $oKTConfig =& KTConfig::getSingleton();
482 $oKTConfig->loadCache($cache_file); 484 $oKTConfig->loadCache($cache_file);
483 485
484 - // checking flatns as it should be more complete  
485 - if (empty($oKTConfig->flatns)) {  
486 - $use_cache = false; 486 + foreach ($oKTConfig->flat as $k => $v) {
  487 + $default->$k = $oKTConfig->get($k);
487 } 488 }
488 - else {  
489 - foreach ($oKTConfig->flat as $k => $v) {  
490 - $default->$k = $oKTConfig->get($k);  
491 - }  
492 - }  
493 - }  
494 -  
495 - if (!$use_cache) {  
496 - $oKTConfig =& KTConfig::getSingleton();  
497 -  
498 - $oKTConfig->setdefaultns('ui', 'appName', 'KnowledgeTree');  
499 - $oKTConfig->setdefaultns('KnowledgeTree', 'fileSystemRoot', KT_DIR);  
500 - $oKTConfig->setdefaultns('KnowledgeTree', 'serverName', KTUtil::arrayGet($_SERVER, 'HTTP_HOST', 'localhost'));  
501 - $oKTConfig->setdefaultns('KnowledgeTree', 'sslEnabled', false);  
502 - if (array_key_exists('HTTPS', $_SERVER)) {  
503 - if (strtolower($_SERVER['HTTPS']) === 'on') {  
504 - $oKTConfig->setdefaultns('KnowledgeTree', 'sslEnabled', true);  
505 - }  
506 - }  
507 - $oKTConfig->setdefaultns('KnowledgeTree', 'useNewDashboard', true);  
508 - $oKTConfig->setdefaultns('KnowledgeTree', 'rootUrl', $this->guessRootUrl());  
509 - $oKTConfig->setdefaultns('KnowledgeTree', 'execSearchPath', $_SERVER['PATH']);  
510 - $oKTConfig->setdefaultns('KnowledgeTree', 'pathInfoSupport', false);  
511 - $oKTConfig->setdefaultns('KnowledgeTree', 'magicDatabase', KTInit::detectMagicFile());  
512 - $oKTConfig->setdefaultns('KnowledgeTree', 'schedulerInterval', 30);  
513 -  
514 - $oKTConfig->setdefaultns('dashboard', 'alwaysShowYCOD', true);  
515 -  
516 - $oKTConfig->setdefaultns('storage', 'manager', 'KTOnDiskHashedStorageManager');  
517 - $oKTConfig->setdefaultns('config', 'useDatabaseConfiguration', false);  
518 -  
519 - $oKTConfig->setdefaultns('urls', 'varDirectory', '${fileSystemRoot}/var');  
520 - $oKTConfig->setdefaultns('urls', 'logDirectory', '${varDirectory}/log');  
521 - $oKTConfig->setdefaultns('urls', 'documentRoot', '${varDirectory}/Documents');  
522 - $oKTConfig->setdefaultns('urls', 'uiDirectory', '${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree');  
523 - $oKTConfig->setdefaultns('urls', 'tmpDirectory', '${varDirectory}/tmp');  
524 - $oKTConfig->setdefaultns('urls', 'graphicsUrl', '${rootUrl}/graphics');  
525 - $oKTConfig->setdefaultns('urls', 'uiUrl', '${rootUrl}/presentation/lookAndFeel/knowledgeTree');  
526 - $oKTConfig->setdefaultns('urls', 'stopwordsFile', '${fileSystemRoot}/config/stopwords.txt');  
527 -  
528 - $oKTConfig->setdefaultns('tweaks', 'browseToUnitFolder', false);  
529 - $oKTConfig->setdefaultns('tweaks', 'genericMetaDataRequired', true);  
530 - $oKTConfig->setdefaultns('tweaks', 'phpErrorLogFile', false);  
531 - $oKTConfig->setdefaultns('tweaks', 'developmentWindowLog', false);  
532 - $oKTConfig->setdefaultns('tweaks', 'noisyBulkOperations', false);  
533 -  
534 - $oKTConfig->setdefaultns('email', 'emailServer', 'none');  
535 - $oKTConfig->setdefaultns('email', 'emailPort', '');  
536 - $oKTConfig->setdefaultns('email', 'emailAuthentication', false);  
537 - $oKTConfig->setdefaultns('email', 'emailUsername', 'username');  
538 - $oKTConfig->setdefaultns('email', 'emailPassword', 'password');  
539 - $oKTConfig->setdefaultns('email', 'emailFrom', 'kt@example.org');  
540 - $oKTConfig->setdefaultns('email', 'emailFromName', 'KnowledgeTree Document Management System');  
541 - $oKTConfig->setdefaultns('email', 'allowAttachment', false);  
542 - $oKTConfig->setdefaultns('email', 'allowEmailAddresses', false);  
543 - $oKTConfig->setdefaultns('email', 'sendAsSystem', false);  
544 - $oKTConfig->setdefaultns('email', 'onlyOwnGroups', false);  
545 -  
546 - $oKTConfig->setdefaultns('user_prefs', 'passwordLength', 6);  
547 - $oKTConfig->setdefaultns('user_prefs', 'restrictAdminPasswords', false);  
548 - $oKTConfig->setdefaultns('user_prefs', 'restrictPreferences', false);  
549 -  
550 - $oKTConfig->setdefaultns('session', 'sessionTimeout', 1200);  
551 - $oKTConfig->setdefaultns('session', 'allowAnonymousLogin', false);  
552 -  
553 - $oKTConfig->setdefaultns('ui', 'companyLogo', '${rootUrl}/resources/companylogo.png');  
554 - $oKTConfig->setdefaultns('ui', 'companyLogoWidth', '313px');  
555 - $oKTConfig->setdefaultns('ui', 'companyLogoTitle', 'ACME Corporation');  
556 - $oKTConfig->setdefaultns('ui', 'ieGIF', true);  
557 - $oKTConfig->setdefaultns('ui', 'alwaysShowAll', false);  
558 - $oKTConfig->setdefaultns('ui', 'automaticRefresh', false);  
559 - $oKTConfig->setdefaultns('ui', 'condensedAdminUI', false);  
560 - $oKTConfig->setdefaultns('ui', 'fakeMimetype', false);  
561 - $oKTConfig->setdefaultns('ui', 'dot', 'dot');  
562 - $oKTConfig->setdefaultns('ui', 'metadata_sort', true);  
563 -  
564 - $oKTConfig->setdefaultns('i18n', 'useLike', false);  
565 -  
566 - $oKTConfig->setdefaultns(null, 'logLevel', 'INFO');  
567 - $oKTConfig->setdefaultns('import', 'unzip', 'unzip');  
568 - $oKTConfig->setdefaultns('export', 'zip', 'zip');  
569 - $oKTConfig->setdefaultns('export', 'encoding', 'UTF-8');  
570 -  
571 - $oKTConfig->setdefaultns('externalBinary', 'xls2csv', 'xls2csv');  
572 - $oKTConfig->setdefaultns('externalBinary', 'pdftotext', 'pdftotext');  
573 - $oKTConfig->setdefaultns('externalBinary', 'catppt', 'catppt');  
574 - $oKTConfig->setdefaultns('externalBinary', 'pstotext', 'pstotext');  
575 - $oKTConfig->setdefaultns('externalBinary', 'catdoc', 'catdoc');  
576 - $oKTConfig->setdefaultns('externalBinary', 'antiword', 'antiword');  
577 - $oKTConfig->setdefaultns('externalBinary', 'python', 'python');  
578 - $oKTConfig->setdefaultns('externalBinary', 'java', 'java');  
579 - $oKTConfig->setdefaultns('externalBinary', 'php', 'php');  
580 - $oKTConfig->setdefaultns('externalBinary', 'df', 'df');  
581 -  
582 - $oKTConfig->setdefaultns('cache', 'cacheDirectory', '${varDirectory}/cache');  
583 - $oKTConfig->setdefaultns('cache', 'cacheEnabled', 'false');  
584 - $oKTConfig->setdefaultns('cache', 'proxyCacheDirectory', '${varDirectory}/proxies');  
585 - $oKTConfig->setdefaultns('cache', 'proxyCacheEnabled', 'true');  
586 - $oKTConfig->setdefaultns('cache', 'cachePlugins', 'true');  
587 -  
588 - $oKTConfig->setdefaultns('KTWebDAVSettings', 'debug', 'off');  
589 - $oKTConfig->setdefaultns('KTWebDAVSettings', 'safemode', 'on');  
590 -  
591 - $oKTConfig->setdefaultns('BaobabSettings', 'debug', 'off');  
592 - $oKTConfig->setdefaultns('BaobabSettings', 'safemode', 'on');  
593 -  
594 - $oKTConfig->setdefaultns('search', 'searchBasePath', KT_DIR . '/search2');  
595 - $oKTConfig->setdefaultns('search', 'fieldsPath', '${searchBasePath}/search/fields');  
596 - $oKTConfig->setdefaultns('search', 'resultsDisplayFormat', 'searchengine');  
597 - $oKTConfig->setdefaultns('search', 'resultsPerPage', 25);  
598 - $oKTConfig->setdefaultns('search', 'dateFormat', 'Y-m-d');  
599 -  
600 - $oKTConfig->setdefaultns('browse', 'previewActivation', 'mouse-over');  
601 -  
602 - $oKTConfig->setdefaultns('indexer', 'coreClass', 'JavaXMLRPCLuceneIndexer');  
603 - $oKTConfig->setdefaultns('indexer', 'batchDocuments', 20);  
604 - $oKTConfig->setdefaultns('indexer', 'batchMigrateDocuments', 500);  
605 - $oKTConfig->setdefaultns('indexer', 'indexingBasePath', '${searchBasePath}/indexing');  
606 - $oKTConfig->setdefaultns('indexer', 'luceneDirectory', '${varDirectory}/indexes');  
607 - $oKTConfig->setdefaultns('indexer', 'extractorPath', '${indexingBasePath}/extractors');  
608 - $oKTConfig->setdefaultns('indexer', 'extractorHookPath', '${indexingBasePath}/extractorHooks');  
609 - $oKTConfig->setdefaultns('indexer', 'javaLuceneURL', 'http://127.0.0.1:8875');  
610 -  
611 - $oKTConfig->setdefaultns('openoffice', 'host', '127.0.0.1');  
612 - $oKTConfig->setdefaultns('openoffice', 'port', 8100);  
613 -  
614 - $oKTConfig->setdefaultns('webservice', 'uploadDirectory', '${varDirectory}/uploads');  
615 - $oKTConfig->setdefaultns('webservice', 'downloadUrl', '${rootUrl}/ktwebservice/download.php');  
616 - $oKTConfig->setdefaultns('webservice', 'uploadExpiry', '30');  
617 - $oKTConfig->setdefaultns('webservice', 'downloadExpiry', '30');  
618 - $oKTConfig->setdefaultns('webservice', 'randomKeyText', 'bkdfjhg23yskjdhf2iu');  
619 - $oKTConfig->setdefaultns('webservice', 'validateSessionCount', false);  
620 - $oKTConfig->setdefaultns('webservice', 'useDefaultDocumentTypeIfInvalid', true);  
621 - $oKTConfig->setdefaultns('webservice', 'debug', false);  
622 -  
623 - $oKTConfig->setdefaultns('clientToolPolicies', 'explorerMetadataCapture', true);  
624 - $oKTConfig->setdefaultns('clientToolPolicies', 'officeMetadataCapture', true);  
625 - $oKTConfig->setdefaultns('clientToolPolicies', 'captureReasonsDelete', true);  
626 - $oKTConfig->setdefaultns('clientToolPolicies', 'captureReasonsCheckin', true);  
627 - $oKTConfig->setdefaultns('clientToolPolicies', 'captureReasonsCheckout', true);  
628 - $oKTConfig->setdefaultns('clientToolPolicies', 'captureReasonsCancelCheckout', true);  
629 - $oKTConfig->setdefaultns('clientToolPolicies', 'captureReasonsCopyInKT', true);  
630 - $oKTConfig->setdefaultns('clientToolPolicies', 'captureReasonsMoveInKT', true);  
631 - $oKTConfig->setdefaultns('clientToolPolicies', 'allowRememberPassword', true);  
632 -  
633 - $oKTConfig->setdefaultns('DiskUsage', 'warningThreshold', 10);  
634 - $oKTConfig->setdefaultns('DiskUsage', 'urgentThreshold', 5);  
635 -  
636 - $res = $this->readConfig(); 489 + } else {
  490 + //fail safe will be put here
  491 +
  492 +
637 if (PEAR::isError($res)) { return $res; } 493 if (PEAR::isError($res)) { return $res; }
638 494
639 - $oKTConfig =& KTConfig::getSingleton(); 495 + //$oKTConfig =& KTConfig::getSingleton();
640 @touch($cache_file); 496 @touch($cache_file);
641 if ($store_cache && is_writable($cache_file)) { 497 if ($store_cache && is_writable($cache_file)) {
642 $oKTConfig->createCache($cache_file); 498 $oKTConfig->createCache($cache_file);
@@ -644,42 +500,11 @@ function catchFatalErrors() @@ -644,42 +500,11 @@ function catchFatalErrors()
644 500
645 501
646 } 502 }
  503 +*/
647 } 504 }
648 // }}} 505 // }}}
649 506
650 - // {{{ readConfig  
651 - function readConfig () {  
652 - global $default;  
653 - $oKTConfig =& KTConfig::getSingleton();  
654 - $sConfigFile = trim(file_get_contents(KT_DIR . '/config/config-path'));  
655 - if (KTUtil::isAbsolutePath($sConfigFile)) {  
656 - $res = $oKTConfig->loadFile($sConfigFile);  
657 - } else {  
658 - $res = $oKTConfig->loadFile(sprintf('%s/%s', KT_DIR, $sConfigFile));  
659 - }  
660 -  
661 - if (PEAR::isError($res)) {  
662 - $this->handleInitError($res);  
663 - // returns only in checkup  
664 - return $res;  
665 - }  
666 -  
667 - foreach (array_keys($oKTConfig->flat) as $k) {  
668 - $v = $oKTConfig->get($k);  
669 - if ($v === 'default') {  
670 - continue;  
671 - }  
672 - if ($v === 'false') {  
673 - $v = false;  
674 -  
675 - }  
676 - if ($v === 'true') {  
677 - $v = true;  
678 - }  
679 - $default->$k = $v;  
680 - }  
681 - }  
682 - // }}} 507 +
683 508
684 // {{{ initTesting 509 // {{{ initTesting
685 function initTesting() { 510 function initTesting() {
@@ -705,37 +530,41 @@ function catchFatalErrors() @@ -705,37 +530,41 @@ function catchFatalErrors()
705 } 530 }
706 // }}} 531 // }}}
707 532
708 -$KTInit = new KTInit();  
709 -$KTInit->prependPath(KT_DIR . '/thirdparty/ZendFramework/library');  
710 -$KTInit->prependPath(KT_DIR . '/thirdparty/pear');  
711 -$KTInit->prependPath(KT_DIR . '/thirdparty/Smarty');  
712 -$KTInit->prependPath(KT_DIR . '/thirdparty/simpletest');  
713 -$KTInit->prependPath(KT_DIR . '/thirdparty/xmlrpc-2.2/lib');  
714 -$KTInit->prependPath(KT_DIR . '/ktapi');  
715 -$KTInit->prependPath(KT_DIR . '/search2');  
716 -require_once('PEAR.php'); 533 +//Creating all the config settings
  534 +//====================================
  535 +$oKTConfig = KTConfig::getSingleton();
717 536
718 -// Give everyone access to legacy PHP functions  
719 -require_once(KT_LIB_DIR . '/util/legacy.inc'); 537 +//Read in DB specific config settings
  538 +$res = $oKTConfig->readDBConfig();
  539 +//Set up DB connection
  540 +$dbSetup = $oKTConfig->setupDB();
720 541
721 -// Give everyone access to KTUtil utility functions  
722 -require_once(KT_LIB_DIR . '/util/ktutil.inc'); 542 +$KTInit = new KTInit();
  543 +
  544 +if(PEAR::isError($dbSetup))
  545 +{
  546 + $KTInit->handleInitError($dbSetup);
  547 +}
723 548
724 -require_once(KT_LIB_DIR . '/ktentity.inc');  
725 549
726 -require_once(KT_LIB_DIR . '/config/config.inc.php');  
727 -require_once(KT_DIR . '/search2/indexing/indexerCore.inc.php');  
728 550
  551 +$KTInit->getDynamicConfigSettings();
729 $KTInit->initConfig(); 552 $KTInit->initConfig();
730 $KTInit->setupI18n(); 553 $KTInit->setupI18n();
731 554
  555 +//Create final flatns and $default arrays to finish config setup
  556 +$res = $oKTConfig->readConfig();
  557 +
  558 +//====================================
  559 +
732 define('KTLOG_CACHE',false); 560 define('KTLOG_CACHE',false);
733 561
734 if (isset($GLOBALS['kt_test'])) { 562 if (isset($GLOBALS['kt_test'])) {
735 $KTInit->initTesting(); 563 $KTInit->initTesting();
736 } 564 }
737 565
738 -$oKTConfig =& KTConfig::getSingleton(); 566 +
  567 +
739 568
740 if($oKTConfig->get('CustomErrorMessages/customerrormessages') == 'on') 569 if($oKTConfig->get('CustomErrorMessages/customerrormessages') == 'on')
741 { 570 {
@@ -762,7 +591,7 @@ $loggingSupport = $KTInit-&gt;setupLogging(); @@ -762,7 +591,7 @@ $loggingSupport = $KTInit-&gt;setupLogging();
762 // Send all PHP errors to a file (and maybe a window) 591 // Send all PHP errors to a file (and maybe a window)
763 set_error_handler(array('KTInit', 'handlePHPError')); 592 set_error_handler(array('KTInit', 'handlePHPError'));
764 593
765 -$dbSupport = $KTInit->setupDB(); 594 +
766 $KTInit->setupRandomSeed(); 595 $KTInit->setupRandomSeed();
767 596
768 $GLOBALS['KTRootUrl'] = $oKTConfig->get('KnowledgeTree/rootUrl'); 597 $GLOBALS['KTRootUrl'] = $oKTConfig->get('KnowledgeTree/rootUrl');
lib/config/config.inc.php
@@ -39,6 +39,7 @@ @@ -39,6 +39,7 @@
39 require_once("Config.php"); 39 require_once("Config.php");
40 40
41 require_once(KT_LIB_DIR . '/util/ktutil.inc'); 41 require_once(KT_LIB_DIR . '/util/ktutil.inc');
  42 +require_once (KT_LIB_DIR. '/database/dbutil.inc');
42 43
43 class KTConfig { 44 class KTConfig {
44 var $conf = array(); 45 var $conf = array();
@@ -46,6 +47,8 @@ class KTConfig { @@ -46,6 +47,8 @@ class KTConfig {
46 var $aFileRoot; 47 var $aFileRoot;
47 var $flat = array(); 48 var $flat = array();
48 var $flatns = array(); 49 var $flatns = array();
  50 + var $aDBConfig = array();
  51 + var $aConfFile = array();
49 52
50 // FIXME nbm: how do we cache errors here? 53 // FIXME nbm: how do we cache errors here?
51 function loadCache($filename) { 54 function loadCache($filename) {
@@ -66,21 +69,67 @@ class KTConfig { @@ -66,21 +69,67 @@ class KTConfig {
66 69
67 return true; 70 return true;
68 } 71 }
  72 +
  73 + // {{{ readConfig
  74 + function readConfig () {
  75 + global $default;
  76 +
  77 + //Load config data from the database
  78 + $sQuery = 'select group_name, item, value, default_value from config_settings';
  79 + $confResult = DBUtil::getResultArray($sQuery);
69 80
70 - function createCache($filename) {  
71 - $config_cache = array();  
72 - $config_cache['flat'] = $this->flat;  
73 - $config_cache['flatns'] = $this->flatns;  
74 - $config_cache['expanded'] = $this->expanded;  
75 - $config_cache['expanding'] = $this->expanding; 81 + foreach ($confResult as $confItem)
  82 + {
  83 +
  84 + //if $aConfFile doesn't contain the value already set the value
76 85
77 - file_put_contents($filename, serialize($config_cache)); 86 + if(!isset($this->aConfFile[$confItem['group_name']][$confItem['item']]) || $this->aConfFile[$confItem['group_name']][$confItem['item']] == 'default')
  87 + {
  88 + if($confItem['value'] != 'default')
  89 + {
  90 + $this->flatns[$confItem['group_name'].'/'.$confItem['item']] = $confItem['value'];
  91 + $this->flat[$confItem['item']] = $confItem['value'];
78 92
  93 + }
  94 + else
  95 + {
  96 + $this->flatns[$confItem['group_name'].'/'.$confItem['item']] = $confItem['default_value'];
  97 + $this->flat[$confItem['item']] = $confItem['default_value'];
79 98
80 - } 99 + }
  100 + }
  101 + else //if $aConfFile does have the value set $default and flatns with $aConfFile
  102 + {
  103 + $this->flatns[$confItem['group_name'].'/'.$confItem['item']] = $this->aConfFile[$confItem['group_name']][$confItem['item']];
  104 + $this->flat[$confItem['item']] = $this->aConfFile[$confItem['group_name']][$confItem['item']];
81 105
82 - function loadFile($filename, $bDefault = false) {  
83 - $c = new Config; 106 + }
  107 + }
  108 + foreach($this->flatns as $sGroupItem => $sValue)
  109 + {
  110 + $aGroupItemArray = explode('/', $sGroupItem);
  111 + $default->$aGroupItemArray[1] = $this->expand($this->flatns[$sGroupItem]);
  112 + }
  113 +
  114 + }
  115 + // }}}
  116 +
  117 + // {{{ readDBConfig()
  118 + function readDBConfig()
  119 + {
  120 + $sConfigFile = trim(file_get_contents(KT_DIR . '/config/config-path'));
  121 + if (KTUtil::isAbsolutePath($sConfigFile)) {
  122 + $res = $this->loadDBFile($sConfigFile);
  123 + } else {
  124 + $res = $this->loadDBFile(sprintf('%s/%s', KT_DIR, $sConfigFile));
  125 + }
  126 + }
  127 + // }}}
  128 +
  129 + // {{{ loadDBFile()
  130 + function loadDBFile($filename, $bDefault = false)
  131 + {
  132 + $c = new Config;
84 $root =& $c->parseConfig($filename, "IniCommented"); 133 $root =& $c->parseConfig($filename, "IniCommented");
85 134
86 if (PEAR::isError($root)) { 135 if (PEAR::isError($root)) {
@@ -90,17 +139,84 @@ class KTConfig { @@ -90,17 +139,84 @@ class KTConfig {
90 $this->aFileRoot[$filename] =& $root; 139 $this->aFileRoot[$filename] =& $root;
91 140
92 $conf =& $root->toArray(); 141 $conf =& $root->toArray();
93 - foreach ($conf["root"] as $seck => $secv) {  
94 - $aSectionFile[$seck] = $filename;  
95 - if (is_array($secv)) {  
96 - foreach ($secv as $k => $v) {  
97 - $this->setns($seck, $k, $v);  
98 - }  
99 - } else {  
100 - $this->setns(null, $seck, $secv);  
101 - } 142 +
  143 + //Set the database specific config details here
  144 + $this->aDBConfig = $conf['root']['db'];
  145 +
  146 + //load entire config file into $aConfFile array
  147 + //These values will override those given by the database
  148 + //This is in case the system fails and the user cannot get to the admin page
  149 + //all items given the value default will be poplulated either by the DB or
  150 + //by the setdefaultns function
  151 + foreach($conf['root'] as $sItem => $sValue)
  152 + {
  153 + $this->aConfFile[$sItem] = $sValue;
102 } 154 }
103 - $this->conf = kt_array_merge($this->conf, $conf["root"]); 155 +
  156 + }
  157 + // }}}
  158 +
  159 + function setupDB () {
  160 + global $default;
  161 +
  162 + require_once('DB.php');
  163 +
  164 + // DBCompat allows phplib API compatibility
  165 + require_once(KT_LIB_DIR . '/database/dbcompat.inc');
  166 + $default->db = new DBCompat;
  167 +
  168 + // DBUtil is the preferred database abstraction
  169 + require_once(KT_LIB_DIR . '/database/dbutil.inc');
  170 +
  171 + // KTEntity is the database-backed base class
  172 + require_once(KT_LIB_DIR . '/ktentity.inc');
  173 +
  174 +
  175 +
  176 + $prefix = defined('USE_DB_ADMIN_USER')?'Admin':'';
  177 +
  178 + $sUser = 'dbUser';
  179 + $sPass = 'dbPass';
  180 +
  181 + if ($prefix == 'Admin')
  182 + {
  183 + $sUser = 'dbAdminUser';
  184 + $sPass = 'dbAdminPass';
  185 + }
  186 + $dsn = array(
  187 + 'phptype' => $this->aDBConfig['dbType'],
  188 + 'username' => $this->aDBConfig[$sUser],
  189 + 'password' => $this->aDBConfig[$sPass],
  190 + 'hostspec' => $this->aDBConfig['dbHost'],
  191 + 'database' => $this->aDBConfig['dbName'],
  192 + 'port' => $this->aDBConfig['dbPort']
  193 + );
  194 +
  195 + $options = array(
  196 + 'debug' => 2,
  197 + 'portability' => DB_PORTABILITY_ERRORS,
  198 + 'seqname_format' => 'zseq_%s',
  199 + );
  200 +
  201 + $default->_db = &DB::connect($dsn, $options);
  202 + if (PEAR::isError($default->_db)) {
  203 + // return PEAR error
  204 + return $default->_db;
  205 + }
  206 + $default->_db->setFetchMode(DB_FETCHMODE_ASSOC);
  207 +
  208 + }
  209 +
  210 + function createCache($filename) {
  211 + $config_cache = array();
  212 + $config_cache['flat'] = $this->flat;
  213 + $config_cache['flatns'] = $this->flatns;
  214 + $config_cache['expanded'] = $this->expanded;
  215 + $config_cache['expanding'] = $this->expanding;
  216 +
  217 + file_put_contents($filename, serialize($config_cache));
  218 +
  219 +
104 } 220 }
105 221
106 function setns($seck, $k, $v, $bDefault = false) { 222 function setns($seck, $k, $v, $bDefault = false) {
@@ -142,7 +258,9 @@ class KTConfig { @@ -142,7 +258,9 @@ class KTConfig {
142 } 258 }
143 259
144 function get($var, $oDefault = null) { 260 function get($var, $oDefault = null) {
145 - if (array_key_exists($var, $this->flatns)) { 261 +
  262 +
  263 + if (array_key_exists($var, $this->flatns)) {
146 return $this->expand($this->flatns[$var]); 264 return $this->expand($this->flatns[$var]);
147 } 265 }
148 if (array_key_exists($var, $this->flat)) { 266 if (array_key_exists($var, $this->flat)) {
plugins/ktcore/KTCorePlugin.php
@@ -237,6 +237,8 @@ class KTCorePlugin extends KTPlugin { @@ -237,6 +237,8 @@ class KTCorePlugin extends KTPlugin {
237 _kt('Configure the document metadata: Document Types, Document Fieldsets, Link Types and Workflows.')); 237 _kt('Configure the document metadata: Document Types, Document Fieldsets, Link Types and Workflows.'));
238 $this->registerAdminCategory('search', _kt('Search and Indexing'), 238 $this->registerAdminCategory('search', _kt('Search and Indexing'),
239 _kt('Search and Indexing Settings')); 239 _kt('Search and Indexing Settings'));
  240 + $this->registerAdminCategory('config', _kt('System Configuration'),
  241 + _kt('System Configuration Settings'));
240 $this->registerAdminCategory('misc', _kt('Miscellaneous'), 242 $this->registerAdminCategory('misc', _kt('Miscellaneous'),
241 _kt('Various settings which do not fit into the other categories, including managing help and saved searches.')); 243 _kt('Various settings which do not fit into the other categories, including managing help and saved searches.'));
242 244
@@ -314,7 +316,31 @@ class KTCorePlugin extends KTPlugin { @@ -314,7 +316,31 @@ class KTCorePlugin extends KTPlugin {
314 $this->registerAdminPage('reschedulealldocuments', 'RescheduleDocumentsDispatcher', 'search', 316 $this->registerAdminPage('reschedulealldocuments', 'RescheduleDocumentsDispatcher', 'search',
315 _kt('Reschedule all documents'), _kt('This function allows you to re-index your entire repository.'), 317 _kt('Reschedule all documents'), _kt('This function allows you to re-index your entire repository.'),
316 '../search2/reporting/RescheduleDocuments.php', null); 318 '../search2/reporting/RescheduleDocuments.php', null);
317 - 319 + //config
  320 + $this->registerAdminPage('emailconfigpage', 'EmailConfigPageDispatcher', 'config',
  321 + _kt('Email Settings'), _kt('Manage Email Settings'),
  322 + '/admin/configsettings.php', null);
  323 +
  324 + $this->registerAdminPage('uiconfigpage', 'UIConfigPageDispatcher', 'config',
  325 + _kt('User Interface Settings'), _kt('Manage User Interface Settings'),
  326 + '/admin/configsettings.php', null);
  327 +
  328 + $this->registerAdminPage('searchandindexingconfigpage', 'SearchAndIndexingConfigPageDispatcher', 'config',
  329 + _kt('Search and Indexing Settings'), _kt('Manage Search and Indexing Settings'),
  330 + '/admin/configsettings.php', null);
  331 +
  332 + $this->registerAdminPage('clientconfigpage', 'ClientSettingsConfigPageDispatcher', 'config',
  333 + _kt('Client Tools Settings'), _kt('Manage Client Tools Settings'),
  334 + '/admin/configsettings.php', null);
  335 +
  336 + $this->registerAdminPage('generalconfigpage', 'GeneralConfigPageDispatcher', 'config',
  337 + _kt('General Settings'), _kt('Manage General Settings'),
  338 + '/admin/configsettings.php', null);
  339 +
  340 + $this->registerAdminPage('i18nconfigpage', 'i18nConfigPageDispatcher', 'config',
  341 + _kt('Internationalisation Settings'), _kt('Manage Internationalisation Settings'),
  342 + '/admin/configsettings.php', null);
  343 +
318 // misc 344 // misc
319 $this->registerAdminPage('helpmanagement', 'ManageHelpDispatcher', 'misc', 345 $this->registerAdminPage('helpmanagement', 'ManageHelpDispatcher', 'misc',
320 _kt('Edit Help files'), _kt('Change the help files that are displayed to users.'), 346 _kt('Edit Help files'), _kt('Change the help files that are displayed to users.'),
plugins/ktcore/admin/configSettings.php 0 → 100644
  1 +<?php
  2 +/**
  3 + * $Id: KTCorePlugin.php 7954 2008-01-25 05:56:52Z megan_w $
  4 + *
  5 + * KnowledgeTree Open Source Edition
  6 + * Document Management Made Simple
  7 + * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify it under
  10 + * the terms of the GNU General Public License version 3 as published by the
  11 + * Free Software Foundation.
  12 + *
  13 + * This program is distributed in the hope that it will be useful, but WITHOUT
  14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  15 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  16 + * details.
  17 + *
  18 + * You should have received a copy of the GNU General Public License
  19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20 + *
  21 + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
  22 + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
  23 + *
  24 + * The interactive user interfaces in modified source and object code versions
  25 + * of this program must display Appropriate Legal Notices, as required under
  26 + * Section 5 of the GNU General Public License version 3.
  27 + *
  28 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  29 + * these Appropriate Legal Notices must retain the display of the "Powered by
  30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  31 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
  34 + * Contributor( s): ______________________________________
  35 + *
  36 + */
  37 +
  38 +require_once(KT_LIB_DIR . '/dispatcher.inc.php');
  39 +require_once(KT_LIB_DIR . '/templating/templating.inc.php');
  40 +
  41 +class BaseConfigDispatcher extends KTAdminDispatcher
  42 +{
  43 + function check() {
  44 + return parent::check();
  45 + }
  46 +
  47 + function do_main($sQuery)
  48 + {
  49 + if(empty($sQuery))
  50 + {
  51 + $sQuery = '';
  52 + }
  53 + $aResults = DBUtil::getResultArray($sQuery);
  54 +
  55 + //populating paths correctly
  56 + $oKTConfig =& KTConfig::getSingleton();
  57 +
  58 + for($i = 0; $i < count($aResults); $i++)
  59 + {
  60 + if(strstr($aResults[$i]['value'],'$') != false)
  61 + {
  62 + $aResults[$i]['value'] = $oKTConfig->get($aResults[$i]['group_name'].'/'.$aResults[$i]['item']);
  63 + }
  64 + }
  65 +
  66 + //If template has posted changes for config settings save all values to db.
  67 + if(isset($_POST['configArray']))
  68 + {
  69 +
  70 + foreach ($aResults as $values)
  71 + {
  72 +
  73 + //IF current db entries id is in the array sent back by the page AND
  74 + //the values for the db and the page are different, update the db.
  75 + if(isset($_POST['configArray'][$values['id']]) && $_POST['configArray'][$values['id']]
  76 + != $values['value'])
  77 + {
  78 + //update entry
  79 + $aFields = array();
  80 + if($values['type'] == 'boolean')
  81 + {
  82 + if($_POST['configArray'][$values['id']] == 'true')
  83 + {
  84 + $aFields['value'] = true;
  85 +
  86 + }
  87 + else
  88 + {
  89 + $aFields['value'] = false;
  90 + }
  91 + }
  92 + else
  93 + {
  94 + $aFields['value'] = $_POST['configArray'][$values['id']];
  95 + }
  96 + $oUpdateResult = DBUtil::autoUpdate('config_settings', $aFields, $values['id']);
  97 + }
  98 + }
  99 + }
  100 +
  101 + //Get new results after any db change above
  102 + if(isset($_POST['configArray']))
  103 + {
  104 + $aResults = DBUtil::getResultArray($sQuery);
  105 + for($i = 0; $i < count($aResults); $i++)
  106 + {
  107 + if(strstr($aResults[$i]['value'],'$') != false)
  108 + {
  109 + $aResults[$i]['value'] = $oKTConfig->get($aResults[$i]['group_name'].'/'.$aResults[$i]['item']);
  110 + }
  111 + }
  112 + }
  113 +
  114 + $oTemplating =& KTTemplating::getSingleton();
  115 +
  116 + $oTemplate =& $oTemplating->loadTemplate('ktcore/configsettings');
  117 +
  118 + //set db config data being sent to template
  119 + $oTemplate->setData(array(
  120 + 'results' => $aResults
  121 +
  122 + ));
  123 + return $oTemplate;
  124 + }
  125 +}
  126 +
  127 +class UIConfigPageDispatcher extends BaseConfigDispatcher
  128 +{
  129 + function check() {
  130 + $this->aBreadcrumbs[] = array(
  131 + 'url' => $_SERVER['PHP_SELF'],
  132 + 'name' => _kt('User Interface Settings'),
  133 + );
  134 + return parent::check();
  135 + }
  136 +
  137 + function do_main() {
  138 +
  139 + //get config settings from db
  140 + $sQuery = 'select id, group_name, item, type, value, helptext, default_value from config_settings where group_name = \'ui\'order by group_name';
  141 + return parent::do_main($sQuery);
  142 + }
  143 +}
  144 +
  145 +class ClientSettingsConfigPageDispatcher extends BaseConfigDispatcher
  146 +{
  147 + function check() {
  148 + $this->aBreadcrumbs[] = array(
  149 + 'url' => $_SERVER['PHP_SELF'],
  150 + 'name' => _kt('Client Tools Settings'),
  151 + );
  152 + return parent::check();
  153 + }
  154 +
  155 + function do_main() {
  156 +
  157 + //get config settings from db
  158 + $sQuery = 'select id, group_name, item, type, value, helptext, default_value from config_settings where
  159 + group_name = \'KTWebDAVSettings\' or group_name = \'BaobabSettings\' or
  160 + group_name = \'webservice\' or group_name = \'clientToolPolicies\' order by group_name';
  161 + return parent::do_main($sQuery);
  162 + }
  163 +}
  164 +
  165 +class EmailConfigPageDispatcher extends BaseConfigDispatcher
  166 +{
  167 + function check() {
  168 + $this->aBreadcrumbs[] = array(
  169 + 'url' => $_SERVER['PHP_SELF'],
  170 + 'name' => _kt('Email Settings'),
  171 + );
  172 + return parent::check();
  173 + }
  174 +
  175 + function do_main() {
  176 +
  177 + //get config settings from db
  178 + $sQuery = 'select id, group_name, item, type, value, helptext, default_value from config_settings where group_name = \'email\'order by group_name';
  179 + return parent::do_main($sQuery);
  180 + }
  181 +}
  182 +
  183 +class GeneralConfigPageDispatcher extends BaseConfigDispatcher
  184 +{
  185 + function check() {
  186 + $this->aBreadcrumbs[] = array(
  187 + 'url' => $_SERVER['PHP_SELF'],
  188 + 'name' => _kt('General Settings'),
  189 + );
  190 + return parent::check();
  191 + }
  192 +
  193 + function do_main() {
  194 +
  195 + //get config settings from db
  196 + $sQuery = 'select id, group_name, item, type, value, helptext, default_value from config_settings where
  197 + item = \'schedulerInterval\' or item = \'fakeMimetype\'
  198 + or item = \'browseToUnitFolder\' order by group_name';
  199 + return parent::do_main($sQuery);
  200 + }
  201 +}
  202 +
  203 +class i18nConfigPageDispatcher extends BaseConfigDispatcher
  204 +{
  205 + function check() {
  206 + $this->aBreadcrumbs[] = array(
  207 + 'url' => $_SERVER['PHP_SELF'],
  208 + 'name' => _kt('Internationalisation Settings'),
  209 + );
  210 + return parent::check();
  211 + }
  212 +
  213 + function do_main() {
  214 +
  215 + //get config settings from db
  216 + $sQuery = 'select id, group_name, item, type, value, helptext, default_value from config_settings where
  217 + group_name = \'i18n\' order by group_name';
  218 + return parent::do_main($sQuery);
  219 + }
  220 +}
  221 +
  222 +class SearchAndIndexingConfigPageDispatcher extends BaseConfigDispatcher
  223 +{
  224 + function check() {
  225 + $this->aBreadcrumbs[] = array(
  226 + 'url' => $_SERVER['PHP_SELF'],
  227 + 'name' => _kt('Search and Indexing Settings'),
  228 + );
  229 + return parent::check();
  230 + }
  231 +
  232 + function do_main() {
  233 +
  234 + //get config settings from db
  235 + $sQuery = 'select id, group_name, item, type, value, helptext, default_value from config_settings where
  236 + group_name = \'search\' or group_name = \'indexer\'order by group_name';
  237 + return parent::do_main($sQuery);
  238 + }
  239 +}
  240 +?>
resources/css/kt-framing.css
@@ -2138,4 +2138,24 @@ body #content #add_dashlet @@ -2138,4 +2138,24 @@ body #content #add_dashlet
2138 { 2138 {
2139 overflow:auto; 2139 overflow:auto;
2140 2140
  2141 +}
  2142 +
  2143 +.kt_config
  2144 +{
  2145 + width: 100%;
  2146 + border: 1px solid #ccc;
  2147 +}
  2148 +
  2149 +.kt_config td {
  2150 + padding: 0.25em 0.5em;
  2151 + overflow: hidden;
  2152 + vertical-align: top;
  2153 +}
  2154 +
  2155 +.kt_config th{
  2156 +
  2157 + border-bottom:1px solid #888888;
  2158 + padding: 0.5em 0.5em;
  2159 + overflow: hidden;
  2160 + vertical-align: top;
2141 } 2161 }
2142 \ No newline at end of file 2162 \ No newline at end of file
sql/mysql/install/data.sql
@@ -116,6 +116,22 @@ LOCK TABLES `comment_searchable_text` WRITE; @@ -116,6 +116,22 @@ LOCK TABLES `comment_searchable_text` WRITE;
116 UNLOCK TABLES; 116 UNLOCK TABLES;
117 117
118 -- 118 --
  119 +-- Dumping data for table `config_settings`
  120 +--
  121 +
  122 +LOCK TABLES `config_settings` WRITE;
  123 +/*!40000 ALTER TABLE `config_settings` DISABLE KEYS */;
  124 +INSERT INTO `config_settings`(`id`,`group_name`,`item`,`type`,`value`,`helptext`,`default_value`,`can_edit`) VALUES (1,'ui','appName','','KnowledgeTree','OEM application name','KnowledgeTree',1),(2,'KnowledgeTree','schedulerInterval','','30','','30',1),(3,'dashboard','alwaysShowYCOD','boolean','default','Display the \"Your Checked-out Documents\" dashlet even when empty.','0',1),(4,'urls','graphicsUrl','','${rootUrl}/graphics','','${rootUrl}/graphics',1),(5,'urls','uiUrl','','${rootUrl}/presentation/lookAndFeel/knowledgeTree','','${rootUrl}/presentation/lookAndFeel/knowledgeTree',1),(6,'tweaks','browseToUnitFolder','boolean','default','Whether to browse to the user\'s (first) unit when first going to the browse section.','0',1),(7,'tweaks','genericMetaDataRequired','boolean','1','','1',1),(8,'tweaks','developmentWindowLog','boolean','0','','0',1),(9,'tweaks','noisyBulkOperations','boolean','default','Whether bulk operations should generate a transaction notice on each ; item, or only on the folder. Default of \"false\" indicates that only the folder transaction should occur.','0',1),(10,'email','emailServer','','none','','none',1),(11,'email','emailPort','','default','','',1),(12,'email','emailAuthentication','boolean','0','Do you need auth to connect to SMTP?\r\n','0',1),(13,'email','emailUsername','','username','','username',1),(14,'email','emailPassword','','password','','password',1),(15,'email','emailFrom','','kt@example.org','','kt@example.org',1),(16,'email','emailFromName','','KnowledgeTree Document Management System','','KnowledgeTree Document Management System',1),(17,'email','allowAttachment','boolean','default','Set to true to allow users to send attachments from the document\r\n management system\r\n.','0',1),(18,'email','allowEmailAddresses','boolean','default','Set to true to allow users to send to any email address, as opposed to\r\n only users of the system\r\n.','0',1),(19,'email','sendAsSystem','boolean','default','Set to true to always send email from the emailFrom address listed above, even if there is an identifiable sending user\r\n.','0',1),(20,'email','onlyOwnGroups','boolean','default','Set to true to only allow users to send emails to those in the same\r\n groups as them\r\n.','0',1),(21,'user_prefs','passwordLength','','6','Minimum password length on password-setting\r\n','6',1),(22,'user_prefs','restrictAdminPasswords','boolean','default','Apply the minimum password length to admin while creating / editing accounts?\r\n default is set to \"false\" meaning that admins can create users with shorter passwords.\r\n','0',1),
  125 +(23,'user_prefs','restrictPreferences','boolean','0','Restrict users from accessing their preferences menus?\r\n','0',1),(24,'session','sessionTimeout','','1200','Session timeout (in seconds)\r\n','1200',1),(25,'session','allowAnonymousLogin','boolean','0','By default, do not auto-login users as anonymous.\r\n Set this to true if you UNDERSTAND the security system that KT\r\n uses, and have sensibly applied the roles \"Everyone\" and \"Authenticated Users\".\r\n','0',1),(26,'ui','companyLogo','','${rootUrl}/resources/companylogo.png','Add the logo of your company to the site\'s appearance. This logo MUST be 50px tall, and on a white background.\r\n','${rootUrl}/resources/companylogo.png',1),(27,'ui','companyLogoWidth','','313px','The logo\'s width in pixels\r\n','313px',1),(28,'ui','companyLogoTitle','','ACME Corporation','ALT text - for accessibility purposes.\r\n','ACME Corporation',1),(29,'ui','alwaysShowAll','boolean','0','Do not restrict to searches (e.g. always show_all) on users and groups pages.\r\n','0',1),(30,'ui','condensedAdminUI','boolean','0','Use a condensed admin ui\r\n?','0',1),(31,'ui','fakeMimetype','boolean','0','Allow \"open\" from downloads. Changing this to \"true\" will prevent (most)\r\n browsers from giving users the \"open\" option.\r\n','0',1),(32,'ui','metadata_sort','boolean','0','Sort the metadata fields alphabetically\r\n','1',1),(33,'i18n','useLike','boolean','default','If your language doesn\'t have distinguishable words (usually, doesn\'t\r\n have a space character), set useLike to true to use a search that can\r\n deal with this, but which is slower.\r\n','0',1),(34,'import','unzip','','unzip','Unzip command - will use execSearchPath to find if the path to the binary is not given\r\n.','unzip',1),(35,'export','zip','','zip','Zip command - will use execSearchPath to find if the path to the\r\n binary is not given\r\n.','zip',1),(36,'externalBinary','xls2csv','','xls2csv','','xls2csv',1),
  126 +(37,'externalBinary','pdftotext','','pdftotext','','pdftotext',1),(38,'externalBinary','catppt','','catppt','','catppt',1),(39,'externalBinary','pstotext','','pstotext','','pstotext',1),(40,'externalBinary','catdoc','','catdoc','','catdoc',1),(41,'externalBinary','antiword','','antiword','','antiword',1),(42,'externalBinary','python','','python','','python',1),(43,'externalBinary','java','','java','','java',1),(44,'externalBinary','php','','php','','php',1),(45,'externalBinary','df','','df','','df',1),(46,'cache','proxyCacheDirectory','','${varDirectory}/proxies','','${varDirectory}/proxies',1),(47,'cache','proxyCacheEnabled','boolean','1','','1',1),(48,'KTWebDAVSettings','debug','','off','This section is for KTWebDAV only, _LOTS_ of debug info will be logged if the following is \"on\"\r\n','off',1),(49,'KTWebDAVSettings','safemode','','on','To allow write access to WebDAV clients set safe mode to \"off\".','on',1),(50,'BaobabSettings','debug','','off','This section is for Baobab only\r\n, _LOTS_ of debug info will be logged if the following is \"on\"\r\n.','off',1),(51,'BaobabSettings','safemode','','on','To allow write access to WebDAV clients set safe mode to \"off\" below\r\n.','on',1),(52,'search','searchBasePath','','${fileSystemRoot}/search2','','${fileSystemRoot}/search2',1),(53,'search','fieldsPath','','${searchBasePath}/search/fields','','${searchBasePath}/search/fields',1),(54,'search','resultsDisplayFormat','','searchengine','The format in which to display the results\r\n options are searchengine or browseview defaults to searchengine\r\n.','searchengine',1),(55,'search','resultsPerPage','','50','The number of results per page\r\n, defaults to 25\r\n','25',1),(56,'search','dateFormat','','Y-m-d','The date format used when making queries using widgets\r\n, defaults to Y-m-d\r\n','Y-m-d',1),(57,'browse','previewActivation','','default','The document info box / preview is activated by mousing over or clicking on the icon\r\n. Options: mouse-over (default) or onclick\r\n.','mouse-over',1),
  127 +(58,'indexer','coreClass','','JavaXMLRPCLuceneIndexer','The core indexing class\r\n. Choices: JavaXMLRPCLuceneIndexer or PHPLuceneIndexer.','JavaXMLRPCLuceneIndexer',1),(59,'indexer','batchDocuments','','20','The number of documents to be indexed in a cron session, defaults to 20\r\n.','20',1),(60,'indexer','batchMigrateDocuments','','500','The number of documents to be migrated in a cron session, defaults to 500\r\n.','500',1),(61,'indexer','indexingBasePath','','${searchBasePath}/indexing','','${searchBasePath}/indexing',1),(62,'indexer','luceneDirectory','','${varDirectory}/indexes','The location of the lucene indexes\r\n.','${varDirectory}/indexes',1),(63,'indexer','extractorPath','','${indexingBasePath}/extractors','','${indexingBasePath}/extractors',1),(64,'indexer','extractorHookPath','','${indexingBasePath}/extractorHooks','','${indexingBasePath}/extractorHooks',1),(65,'indexer','javaLuceneURL','','http://127.0.0.1:8875','The url for the Java Lucene Server. This should match up the the Lucene Server configuration. Defaults to http://127.0.0.1:8875\r\n','http://127.0.0.1:8875',1),(66,'openoffice','host','','default','The host on which open office is installed\r\n. Defaults to 127.0.0.1\r\n','127.0.0.1',1),(67,'openoffice','port','','default','The port on which open office is listening. Defaults to 8100\r\n','8100',1),(68,'webservice','uploadDirectory','','${varDirectory}/uploads','Directory to which all uploads via webservices are persisted before moving into the repository\r\n.','${varDirectory}/uploads',1),
  128 +(69,'webservice','downloadUrl','','${rootUrl}/ktwebservice/download.php','Url which is sent to clients via web service calls so they can then download file via HTTP GET\r\n.','${rootUrl}/ktwebservice/download.php',1),(70,'webservice','uploadExpiry','','30','Period indicating how long a file should be retained in the uploads directory.\r\n','30',1),(71,'webservice','downloadExpiry','','30','Period indicating how long a download link will be available.','30',1),(72,'webservice','randomKeyText','','bkdfjhg23yskjdhf2iu','Random text used to construct a hash. This can be customised on installations so there is less chance of overlap between installations.\r\n','bkdfjhg23yskjdhf2iu',1),(73,'webservice','validateSessionCount','boolean','0','Validating session counts can interfere with access. It is best to leave this disabled, unless very strict access is required.\r\n','0',1),(74,'webservice','useDefaultDocumentTypeIfInvalid','boolean','1','If the document type is invalid when adding a document, we can be tollerant and just default to the Default document type.\r\n','1',1),(75,'webservice','debug','boolean','0','The web service debugging if the logLevel is set to DEBUG. We can set the value to 4 or 5 to get more verbose web service logging.\r\n Level 4 logs the name of functions being accessed. Level 5 logs the SOAP XML requests and responses.\r\n','0',1),(76,'clientToolPolicies','explorerMetadataCapture','boolean','1','This setting is one of two which control whether or not the client is prompted for metadata when a\r\n document is added to knowledgetree via KTtools. It defaults to true.\r\n','1',1),(77,'clientToolPolicies','officeMetadataCapture','boolean','1','This setting is one of two which control whether or not the client is prompted for metadata when a document is added to knowledgetree via KTtools. It defaults to true.','1',1),
  129 +(78,'clientToolPolicies','captureReasonsDelete','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(79,'clientToolPolicies','captureReasonsCheckin','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(80,'clientToolPolicies','captureReasonsCheckout','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(81,'clientToolPolicies','captureReasonsCancelCheckout','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(82,'clientToolPolicies','captureReasonsCopyInKT','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(83,'clientToolPolicies','captureReasonsMoveInKT','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),
  130 +(84,'clientToolPolicies','allowRememberPassword','boolean','1','This setting governs whether the password can be stored on the client or not.','1',1),(85,'DiskUsage','warningThreshold','','10','When free space in a mount point is less than this percentage, the disk usage dashlet will highlight the mount in ORANGE\r\n.','10',1),(86,'DiskUsage','urgentThreshold','','5','When free space in a mount point is less than this percentage, the disk usage dashlet will highlight the mount in RED\r\n.','5',1),(87,'KnowledgeTree','useNewDashboard','','default','','1',1),(88,'i18n','defaultLanguage','','en','Default language for the interface\r\n.','en',1),(89,'CustomErrorMessages','customerrormessages','','off','Turn custom error messages on or off here','on',1),(90,'CustomErrorMessages','customerrorpagepath','','customerrorpage.php','Name or url of custom error page\r\n.','customerrorpage.php',1),(91,'CustomErrorMessages','customerrorhandler','','off','Turn custom error handler on or off','on',1),(92,'ui','morphEnabled','boolean','0','Enable Morph','0',1),(93,'ui','morphTo','','blue','Morph Theme\r\n','blue',1),(94,'KnowledgeTree','logLevel','','default','Choice: INFO or DEBUG','INFO',1),(95,'storage','manager','','default','','KTOnDiskHashedStorageManager',1),(96,'ui','ieGIF','boolean','0','','1',1),(97,'ui','automaticRefresh','boolean','0','','0',1),(98,'ui','dot','','dot','','dot',1),(99,'tweaks','phpErrorLogFile','boolean','default','If you want to enable PHP error logging to the log/php_error_log file, change this setting to true\r\n.','0',1),(100,'urls','logDirectory','','default','','${varDirectory}/log',1),(101,'urls','uiDirectory','','default','','${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree',1),(102,'urls','tmpDirectory','','default','','${varDirectory}/tmp',1),(103,'urls','stopwordsFile','','default','','${fileSystemRoot}/config/stopwords.txt',1),(104,'cache','cacheEnabled','boolean','default','','0',1),(105,'cache','cacheDirectory','','default','','${varDirectory}/cache',1),(106,'cache','cachePlugins','boolean','default','','1',1),(107,'urls','varDirectory','','default','','${fileSystemRoot}/var',1);
  131 +/*!40000 ALTER TABLE `config_settings` ENABLE KEYS */;
  132 +UNLOCK TABLES;
  133 +
  134 +--
119 -- Dumping data for table `dashlet_disables` 135 -- Dumping data for table `dashlet_disables`
120 -- 136 --
121 137
sql/mysql/install/structure.sql
@@ -157,6 +157,22 @@ CREATE TABLE `comment_searchable_text` ( @@ -157,6 +157,22 @@ CREATE TABLE `comment_searchable_text` (
157 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 157 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
158 158
159 -- 159 --
  160 +-- Table structure for table `config_settings`
  161 +--
  162 +
  163 +CREATE TABLE `config_settings` (
  164 + `id` int(255) unsigned NOT NULL,
  165 + `group_name` varchar(255) NOT NULL default '0',
  166 + `item` varchar(255) NOT NULL default '0',
  167 + `type` varchar(255) NOT NULL default '0',
  168 + `value` varchar(255) NOT NULL default 'default',
  169 + `helptext` varchar(255) NOT NULL default '0',
  170 + `default_value` varchar(255) NOT NULL default 'default',
  171 + `can_edit` tinyint(1) NOT NULL default '1',
  172 + PRIMARY KEY (`id`)
  173 +) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  174 +
  175 +--
160 -- Table structure for table `dashlet_disables` 176 -- Table structure for table `dashlet_disables`
161 -- 177 --
162 178
@@ -1812,6 +1828,15 @@ CREATE TABLE `zseq_column_entries` ( @@ -1812,6 +1828,15 @@ CREATE TABLE `zseq_column_entries` (
1812 ) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=latin1; 1828 ) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;
1813 1829
1814 -- 1830 --
  1831 +-- Table structure for table `zseq_config_settings`
  1832 +--
  1833 +
  1834 +CREATE TABLE `zseq_config_settings` (
  1835 + `id` int(10) unsigned NOT NULL auto_increment,
  1836 + PRIMARY KEY (`id`)
  1837 +) ENGINE=MyISAM AUTO_INCREMENT=108 DEFAULT CHARSET=latin1;
  1838 +
  1839 +--
1815 -- Table structure for table `zseq_dashlet_disables` 1840 -- Table structure for table `zseq_dashlet_disables`
1816 -- 1841 --
1817 1842
sql/mysql/upgrade/3.5.3/config_settings.sql 0 → 100644
  1 +CREATE TABLE `config_settings` (
  2 + `id` int(255) unsigned NOT NULL,
  3 + `group_name` varchar(255) NOT NULL default '0',
  4 + `item` varchar(255) NOT NULL default '0',
  5 + `type` varchar(255) NOT NULL default '0',
  6 + `value` varchar(255) NOT NULL default 'default',
  7 + `helptext` varchar(255) NOT NULL default '0',
  8 + `default_value` varchar(255) NOT NULL default 'default',
  9 + `can_edit` tinyint(1) NOT NULL default '1',
  10 + PRIMARY KEY (`id`)
  11 +) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  12 +
  13 +LOCK TABLES `config_settings` WRITE;
  14 +/*!40000 ALTER TABLE `config_settings` DISABLE KEYS */;
  15 +INSERT INTO `config_settings`(`id`,`group_name`,`item`,`type`,`value`,`helptext`,`default_value`,`can_edit`) VALUES (1,'ui','appName','','KnowledgeTree','OEM application name','KnowledgeTree',1),(2,'KnowledgeTree','schedulerInterval','','30','','30',1),(3,'dashboard','alwaysShowYCOD','boolean','default','Display the \"Your Checked-out Documents\" dashlet even when empty.','0',1),(4,'urls','graphicsUrl','','${rootUrl}/graphics','','${rootUrl}/graphics',1),(5,'urls','uiUrl','','${rootUrl}/presentation/lookAndFeel/knowledgeTree','','${rootUrl}/presentation/lookAndFeel/knowledgeTree',1),(6,'tweaks','browseToUnitFolder','boolean','default','Whether to browse to the user\'s (first) unit when first going to the browse section.','0',1),(7,'tweaks','genericMetaDataRequired','boolean','1','','1',1),(8,'tweaks','developmentWindowLog','boolean','0','','0',1),(9,'tweaks','noisyBulkOperations','boolean','default','Whether bulk operations should generate a transaction notice on each ; item, or only on the folder. Default of \"false\" indicates that only the folder transaction should occur.','0',1),(10,'email','emailServer','','none','','none',1),(11,'email','emailPort','','default','','',1),(12,'email','emailAuthentication','boolean','0','Do you need auth to connect to SMTP?\r\n','0',1),(13,'email','emailUsername','','username','','username',1),(14,'email','emailPassword','','password','','password',1),(15,'email','emailFrom','','kt@example.org','','kt@example.org',1),(16,'email','emailFromName','','KnowledgeTree Document Management System','','KnowledgeTree Document Management System',1),(17,'email','allowAttachment','boolean','default','Set to true to allow users to send attachments from the document\r\n management system\r\n.','0',1),(18,'email','allowEmailAddresses','boolean','default','Set to true to allow users to send to any email address, as opposed to\r\n only users of the system\r\n.','0',1),(19,'email','sendAsSystem','boolean','default','Set to true to always send email from the emailFrom address listed above, even if there is an identifiable sending user\r\n.','0',1),(20,'email','onlyOwnGroups','boolean','default','Set to true to only allow users to send emails to those in the same\r\n groups as them\r\n.','0',1),(21,'user_prefs','passwordLength','','6','Minimum password length on password-setting\r\n','6',1),(22,'user_prefs','restrictAdminPasswords','boolean','default','Apply the minimum password length to admin while creating / editing accounts?\r\n default is set to \"false\" meaning that admins can create users with shorter passwords.\r\n','0',1),
  16 +(23,'user_prefs','restrictPreferences','boolean','0','Restrict users from accessing their preferences menus?\r\n','0',1),(24,'session','sessionTimeout','','1200','Session timeout (in seconds)\r\n','1200',1),(25,'session','allowAnonymousLogin','boolean','0','By default, do not auto-login users as anonymous.\r\n Set this to true if you UNDERSTAND the security system that KT\r\n uses, and have sensibly applied the roles \"Everyone\" and \"Authenticated Users\".\r\n','0',1),(26,'ui','companyLogo','','${rootUrl}/resources/companylogo.png','Add the logo of your company to the site\'s appearance. This logo MUST be 50px tall, and on a white background.\r\n','${rootUrl}/resources/companylogo.png',1),(27,'ui','companyLogoWidth','','313px','The logo\'s width in pixels\r\n','313px',1),(28,'ui','companyLogoTitle','','ACME Corporation','ALT text - for accessibility purposes.\r\n','ACME Corporation',1),(29,'ui','alwaysShowAll','boolean','0','Do not restrict to searches (e.g. always show_all) on users and groups pages.\r\n','0',1),(30,'ui','condensedAdminUI','boolean','0','Use a condensed admin ui\r\n?','0',1),(31,'ui','fakeMimetype','boolean','0','Allow \"open\" from downloads. Changing this to \"true\" will prevent (most)\r\n browsers from giving users the \"open\" option.\r\n','0',1),(32,'ui','metadata_sort','boolean','0','Sort the metadata fields alphabetically\r\n','1',1),(33,'i18n','useLike','boolean','default','If your language doesn\'t have distinguishable words (usually, doesn\'t\r\n have a space character), set useLike to true to use a search that can\r\n deal with this, but which is slower.\r\n','0',1),(34,'import','unzip','','unzip','Unzip command - will use execSearchPath to find if the path to the binary is not given\r\n.','unzip',1),(35,'export','zip','','zip','Zip command - will use execSearchPath to find if the path to the\r\n binary is not given\r\n.','zip',1),(36,'externalBinary','xls2csv','','xls2csv','','xls2csv',1),
  17 +(37,'externalBinary','pdftotext','','pdftotext','','pdftotext',1),(38,'externalBinary','catppt','','catppt','','catppt',1),(39,'externalBinary','pstotext','','pstotext','','pstotext',1),(40,'externalBinary','catdoc','','catdoc','','catdoc',1),(41,'externalBinary','antiword','','antiword','','antiword',1),(42,'externalBinary','python','','python','','python',1),(43,'externalBinary','java','','java','','java',1),(44,'externalBinary','php','','php','','php',1),(45,'externalBinary','df','','df','','df',1),(46,'cache','proxyCacheDirectory','','${varDirectory}/proxies','','${varDirectory}/proxies',1),(47,'cache','proxyCacheEnabled','boolean','1','','1',1),(48,'KTWebDAVSettings','debug','','off','This section is for KTWebDAV only, _LOTS_ of debug info will be logged if the following is \"on\"\r\n','off',1),(49,'KTWebDAVSettings','safemode','','on','To allow write access to WebDAV clients set safe mode to \"off\".','on',1),(50,'BaobabSettings','debug','','off','This section is for Baobab only\r\n, _LOTS_ of debug info will be logged if the following is \"on\"\r\n.','off',1),(51,'BaobabSettings','safemode','','on','To allow write access to WebDAV clients set safe mode to \"off\" below\r\n.','on',1),(52,'search','searchBasePath','','${fileSystemRoot}/search2','','${fileSystemRoot}/search2',1),(53,'search','fieldsPath','','${searchBasePath}/search/fields','','${searchBasePath}/search/fields',1),(54,'search','resultsDisplayFormat','','searchengine','The format in which to display the results\r\n options are searchengine or browseview defaults to searchengine\r\n.','searchengine',1),(55,'search','resultsPerPage','','50','The number of results per page\r\n, defaults to 25\r\n','25',1),(56,'search','dateFormat','','Y-m-d','The date format used when making queries using widgets\r\n, defaults to Y-m-d\r\n','Y-m-d',1),(57,'browse','previewActivation','','default','The document info box / preview is activated by mousing over or clicking on the icon\r\n. Options: mouse-over (default) or onclick\r\n.','mouse-over',1),
  18 +(58,'indexer','coreClass','','JavaXMLRPCLuceneIndexer','The core indexing class\r\n. Choices: JavaXMLRPCLuceneIndexer or PHPLuceneIndexer.','JavaXMLRPCLuceneIndexer',1),(59,'indexer','batchDocuments','','20','The number of documents to be indexed in a cron session, defaults to 20\r\n.','20',1),(60,'indexer','batchMigrateDocuments','','500','The number of documents to be migrated in a cron session, defaults to 500\r\n.','500',1),(61,'indexer','indexingBasePath','','${searchBasePath}/indexing','','${searchBasePath}/indexing',1),(62,'indexer','luceneDirectory','','${varDirectory}/indexes','The location of the lucene indexes\r\n.','${varDirectory}/indexes',1),(63,'indexer','extractorPath','','${indexingBasePath}/extractors','','${indexingBasePath}/extractors',1),(64,'indexer','extractorHookPath','','${indexingBasePath}/extractorHooks','','${indexingBasePath}/extractorHooks',1),(65,'indexer','javaLuceneURL','','http://127.0.0.1:8875','The url for the Java Lucene Server. This should match up the the Lucene Server configuration. Defaults to http://127.0.0.1:8875\r\n','http://127.0.0.1:8875',1),(66,'openoffice','host','','default','The host on which open office is installed\r\n. Defaults to 127.0.0.1\r\n','127.0.0.1',1),(67,'openoffice','port','','default','The port on which open office is listening. Defaults to 8100\r\n','8100',1),(68,'webservice','uploadDirectory','','${varDirectory}/uploads','Directory to which all uploads via webservices are persisted before moving into the repository\r\n.','${varDirectory}/uploads',1),
  19 +(69,'webservice','downloadUrl','','${rootUrl}/ktwebservice/download.php','Url which is sent to clients via web service calls so they can then download file via HTTP GET\r\n.','${rootUrl}/ktwebservice/download.php',1),(70,'webservice','uploadExpiry','','30','Period indicating how long a file should be retained in the uploads directory.\r\n','30',1),(71,'webservice','downloadExpiry','','30','Period indicating how long a download link will be available.','30',1),(72,'webservice','randomKeyText','','bkdfjhg23yskjdhf2iu','Random text used to construct a hash. This can be customised on installations so there is less chance of overlap between installations.\r\n','bkdfjhg23yskjdhf2iu',1),(73,'webservice','validateSessionCount','boolean','0','Validating session counts can interfere with access. It is best to leave this disabled, unless very strict access is required.\r\n','0',1),(74,'webservice','useDefaultDocumentTypeIfInvalid','boolean','1','If the document type is invalid when adding a document, we can be tollerant and just default to the Default document type.\r\n','1',1),(75,'webservice','debug','boolean','0','The web service debugging if the logLevel is set to DEBUG. We can set the value to 4 or 5 to get more verbose web service logging.\r\n Level 4 logs the name of functions being accessed. Level 5 logs the SOAP XML requests and responses.\r\n','0',1),(76,'clientToolPolicies','explorerMetadataCapture','boolean','1','This setting is one of two which control whether or not the client is prompted for metadata when a\r\n document is added to knowledgetree via KTtools. It defaults to true.\r\n','1',1),(77,'clientToolPolicies','officeMetadataCapture','boolean','1','This setting is one of two which control whether or not the client is prompted for metadata when a document is added to knowledgetree via KTtools. It defaults to true.','1',1),
  20 +(78,'clientToolPolicies','captureReasonsDelete','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(79,'clientToolPolicies','captureReasonsCheckin','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(80,'clientToolPolicies','captureReasonsCheckout','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(81,'clientToolPolicies','captureReasonsCancelCheckout','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(82,'clientToolPolicies','captureReasonsCopyInKT','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(83,'clientToolPolicies','captureReasonsMoveInKT','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),
  21 +(84,'clientToolPolicies','allowRememberPassword','boolean','1','This setting governs whether the password can be stored on the client or not.','1',1),(85,'DiskUsage','warningThreshold','','10','When free space in a mount point is less than this percentage, the disk usage dashlet will highlight the mount in ORANGE\r\n.','10',1),(86,'DiskUsage','urgentThreshold','','5','When free space in a mount point is less than this percentage, the disk usage dashlet will highlight the mount in RED\r\n.','5',1),(87,'KnowledgeTree','useNewDashboard','','default','','1',1),(88,'i18n','defaultLanguage','','en','Default language for the interface\r\n.','en',1),(89,'CustomErrorMessages','customerrormessages','','off','Turn custom error messages on or off here','on',1),(90,'CustomErrorMessages','customerrorpagepath','','customerrorpage.php','Name or url of custom error page\r\n.','customerrorpage.php',1),(91,'CustomErrorMessages','customerrorhandler','','off','Turn custom error handler on or off','on',1),(92,'ui','morphEnabled','boolean','0','Enable Morph','0',1),(93,'ui','morphTo','','blue','Morph Theme\r\n','blue',1),(94,'KnowledgeTree','logLevel','','default','Choice: INFO or DEBUG','INFO',1),(95,'storage','manager','','default','','KTOnDiskHashedStorageManager',1),(96,'ui','ieGIF','boolean','0','','1',1),(97,'ui','automaticRefresh','boolean','0','','0',1),(98,'ui','dot','','dot','','dot',1),(99,'tweaks','phpErrorLogFile','boolean','default','If you want to enable PHP error logging to the log/php_error_log file, change this setting to true\r\n.','0',1),(100,'urls','logDirectory','','default','','${varDirectory}/log',1),(101,'urls','uiDirectory','','default','','${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree',1),(102,'urls','tmpDirectory','','default','','${varDirectory}/tmp',1),(103,'urls','stopwordsFile','','default','','${fileSystemRoot}/config/stopwords.txt',1),(104,'cache','cacheEnabled','boolean','default','','0',1),(105,'cache','cacheDirectory','','default','','${varDirectory}/cache',1),(106,'cache','cachePlugins','boolean','default','','1',1),(107,'urls','varDirectory','','default','','${fileSystemRoot}/var',1);
  22 +/*!40000 ALTER TABLE `config_settings` ENABLE KEYS */;
  23 +UNLOCK TABLES;
0 \ No newline at end of file 24 \ No newline at end of file
templates/ktcore/configsettings.smarty 0 → 100644
  1 +<form name="manageConfigSettings" action="{$smarty.server.PHP_SELF}" method="POST">
  2 +
  3 +<table class="kt_config">
  4 + <tbody>
  5 + {foreach from=$results item=settings}
  6 + <tr>
  7 + <td>
  8 + <b>{$settings.group_name}</b> : {$settings.item}
  9 + </td>
  10 + <td>
  11 + {if ($settings.value != 'default')}
  12 + {if ($settings.type) == 'boolean'}
  13 + {if ($settings.value == '1')}
  14 + <input name="configArray[{$settings.id}]" value="true" size="40">
  15 + {else}
  16 + <input name="configArray[{$settings.id}]" value="false" size="40">
  17 + {/if}
  18 + {else}
  19 + <input name="configArray[{$settings.id}]" value="{$settings.value}" size="40">
  20 + {/if}
  21 + {else}
  22 + {if ($settings.type) == 'boolean'}
  23 + {if ($settings.default_value == '1')}
  24 + <input name="configArray[{$settings.id}]" value="true" size="40">
  25 + {else}
  26 + <input name="configArray[{$settings.id}]" value="false" size="40">
  27 + {/if}
  28 + {else}
  29 + <input name="configArray[{$settings.id}]" value="{$settings.default_value}" size="40">
  30 + {/if}
  31 + {/if}
  32 + </td>
  33 + </tr>
  34 + <tr>
  35 + <td class="descriptiveText" style="font-size:0.85em;">
  36 + {$settings.helptext}
  37 + </td>
  38 + </tr>
  39 + {/foreach}
  40 +
  41 + </tbody>
  42 +
  43 +</table>
  44 +
  45 +<br>
  46 +<input type="submit" name="AlterConfig" value="{i18n}Save Config Settings{/i18n}" />
  47 +
  48 +</form>
0 \ No newline at end of file 49 \ No newline at end of file