-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.php
171 lines (105 loc) · 4.32 KB
/
settings.php
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<?php
include_once("includes/inc.global.php");
$p->site_section = ADMINISTRATION;
$p->page_title = "Site Settings";
$cUser->MustBeLevel(2);
global $cDB, $site_settings;
$output = "";
// PROCESS Save Settings
if ($_REQUEST["process"]==true) {
$output .= $site_settings->update();
$output .= "<p>";
}
// DISPLAY Settings form
$output .= "<form method=POST><input type=hidden name=process value=true>";
$output .= "<table width=100%>";
// Sort settings into sections
$sections = array(1 => array(),2 => array(),7 => array(), 3 => array(),4 => array(),5 => array(),6 => array());
$section_names = array(1 => "General Settings", 2 => "Site Features", 7 => "Display Options", 3 => "Account Restrictions", 4=>"Social Networking",5=>"Manage Expire",6=>"Admin Settings");
foreach($site_settings->theSettings as $key) {
if (!$key->section)
$key->section = 1; // default to section 1 if no section specified
$sections[$key->section][] = $key;
}
$aSectionDone = false;
$output .= "<a name='top'></a><font color=red>PLEASE NOTE: The following are <em>General</em> Settings intended for use by the LETS Administrator.
<p>More <em>Advanced</em> configuration settings for the Webmaster are located in the file 'includes/inc.config.php'.</font><p>";
$output .= "<p>";
$aSecNameDone = false;
foreach($section_names as $id => $name) {
if ($aSecNameDone==true)
$output .= " | ";
else
$aSecNameDone = true;
$output .= "<a href=#sec".$id.">".$name."</a>";
}
$output .= "<p>";
foreach($sections as $a => $b) {
$output .= "</table>";
if ($aSectionDone==true)
$output .= "<a href=#top>Back to top</a><hr>";
else
$aSectionDone = true;
$output .= "<a name='sec".$a."'></a><table width=100%><tr valign=top><td><STRONG><I>".$section_names[$a]."</STRONG></I></td></tr></table>
<p><table width=100%>";
foreach($b as $key) {
$output .= "<tr valign=top>";
$output .= "<td width=70%>".stripslashes($key->display_name)."</td>";
$output .= "<td width=30%>";
// What type of form element?
// smalltext, longtext, multiple, radio, bool
switch($key->typ) {
case("bool"):
$output .= "<select name='".$key->name."'>";
$selectedT = '';
$selectedF = '';
//echo $key->name." = ".$key->current_value."<br>";
if ($key->current_value==1 || $key->current_value=='TRUE')
$selectedT = 'selected';
else
$selectedF = 'selected';
$output .= "<option value='TRUE' $selectedT>Yes</option>";
$output .= "<option value='FALSE' $selectedF>No</option>";
$output .= "</select>";
break;
case("radio"):
$options = cSettings::split_options($key->options);
foreach($options as $o) {
$selected = "";
if ($o==$key->current_value)
$selected = "checked";
$output .= "<input type=radio name=".$key->name." value='".$o."' $selected> ".stripslashes(ucfirst($o))." ";
}
break;
case("multiple"):
$output .= "<select name='".$key->name."'>";
$options = cSettings::split_options($key->options);
foreach ($options as $o) {
$selected = "";
if ($o==$key->current_value)
$selected = " selected";
$output .= "<option name='".$o."' value='".$o."' $selected>".stripslashes(ucfirst(strtolower($o)))."</option>";
}
$output .= "</select>";
break;
case("longtext"):
$output .= "<textarea rows=5 cols=30 name='".$key->name."'>".stripslashes($key->current_value)."</textarea>";
break;
case("int"):
$output .= "<input type=text size=5 value='".stripslashes($key->current_value)."' name='".$key->name."'>";
break;
default: // Assume smalltext
$output .= "<input type=text maxlength='".$key->max_length."' value='".stripslashes($key->current_value)."' name='".$key->name."'>";
break;
}
$output .= "</td>";
$output .= "</tr>";
if ($key->descrip) {
$output .= "</table>
<table width=100%><tr valign=top><td><font color=green>".$key->descrip."</font></td></tr></table>
<p><table width=100%>";
}
}
}
$output .= "</table><p><input type=submit value='Save Settings'></form>";
$p->DisplayPage($output);