1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
<?php
// $Header$
// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See below for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
// Handle Update
$processForm = set_tab();
if( $processForm ) {
$pref_toggles = [
"site_hidden",
"site_closed",
"site_use_load_threshold",
"site_use_proxy",
"site_store_session_db",
];
foreach( $pref_toggles as $item ) {
simple_set_toggle( $item, KERNEL_PKG_NAME );
}
$pref_simple_values = [
"kernel_server_name",
"site_sender_email",
"site_proxy_host",
"site_proxy_port",
"site_session_lifetime",
"site_load_threshold",
"site_busy_msg",
"site_closed_msg",
"storage_host",
];
foreach( $pref_simple_values as $item ) {
simple_set_value( $item, KERNEL_PKG_NAME );
}
$pref_byref_values = [
"site_title",
"site_slogan",
"site_description",
"site_notice",
"site_error_title",
];
foreach( $pref_byref_values as $item ) {
$_REQUEST['site_description'] = substr( $_REQUEST['site_description'], 0, 180 );
byref_set_value( $item );
}
if( !empty( $_REQUEST['site_keywords'] )) {
$_REQUEST['site_keywords'] = substr( $_REQUEST['site_keywords'], 0, 900 );
$keywords = str_split( $_REQUEST['site_keywords'], 250 );
// we need to make sure we remove all settings for site_keywords first in case the new value is considerably shorter than the previous one
$gBitSystem->storeConfig( 'site_keywords_1', null );
$gBitSystem->storeConfig( 'site_keywords_2', null );
$gBitSystem->storeConfig( 'site_keywords_3', null );
foreach( $keywords as $key => $chunk ) {
$gBitSystem->storeConfig( "site_keywords".( !empty( $key ) ? '_'.$key : '' ), $chunk, KERNEL_PKG_NAME );
}
// join keywords back together
$gBitSystem->setConfig( 'site_keywords',
$gBitSystem->getConfig( 'site_keywords' ).
$gBitSystem->getConfig( 'site_keywords_1' ).
$gBitSystem->getConfig( 'site_keywords_2' ).
$gBitSystem->getConfig( 'site_keywords_3' ),
);
}
// Special handling for site_temp_dir, which has a default value
if( isset( $_REQUEST["site_temp_dir"] ) && $_REQUEST["site_temp_dir"] != TEMP_PKG_PATH ) {
$gBitSystem->storeConfig( "site_temp_dir", $_REQUEST["site_temp_dir"], KERNEL_PKG_NAME );
$gBitSmarty->assign( "site_temp_dir", $_REQUEST["site_temp_dir"] );
}
// Special handling for centralissed_upload_dir, which has a default value
$centralDir = !empty( $_REQUEST["site_upload_dir"] ) ? $_REQUEST["site_upload_dir"] : null;
$gBitSystem->storeConfig( "site_upload_dir", $centralDir , KERNEL_PKG_NAME );
$gBitSmarty->assign( "site_upload_dir", $centralDir );
}
|