1 |
diff -Nur --no-dereference smeserver-webhosting-0.0.9.old/createlinks smeserver-webhosting-0.0.9/createlinks |
2 |
--- smeserver-webhosting-0.0.9.old/createlinks 2014-06-18 12:27:47.000000000 -0400 |
3 |
+++ smeserver-webhosting-0.0.9/createlinks 2021-03-12 15:14:23.419000000 -0500 |
4 |
@@ -5,10 +5,15 @@ |
5 |
panel_link("webhosting", "manager"); |
6 |
|
7 |
for my $event (qw( |
8 |
- webhosting-modify |
9 |
+ webhosting-modify smeserver-webhosting-update |
10 |
)) |
11 |
{ |
12 |
- templates2events("/etc/httpd/conf/httpd.conf", $event); |
13 |
- safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith"); |
14 |
+ #we can avoid those 2 as we are tricking ourself as ibay-modify and it will do those and php |
15 |
+ #templates2events("/etc/httpd/conf/httpd.conf", $event); |
16 |
+ #safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith"); |
17 |
+ event_link("webhosting-php-expand", $event, "05"); |
18 |
+ event_link("webhosting-php-adjust", $event, "90"); |
19 |
} |
20 |
+$event="smeserver-webhosting-update"; |
21 |
+event_link("navigation-conf", $event, "70"); |
22 |
|
23 |
diff -Nur --no-dereference smeserver-webhosting-0.0.9.old/root/etc/e-smith/events/actions/webhosting-php-adjust smeserver-webhosting-0.0.9/root/etc/e-smith/events/actions/webhosting-php-adjust |
24 |
--- smeserver-webhosting-0.0.9.old/root/etc/e-smith/events/actions/webhosting-php-adjust 1969-12-31 19:00:00.000000000 -0500 |
25 |
+++ smeserver-webhosting-0.0.9/root/etc/e-smith/events/actions/webhosting-php-adjust 2021-03-13 01:30:28.439000000 -0500 |
26 |
@@ -0,0 +1,10 @@ |
27 |
+#!/usr/bin/perl -w |
28 |
+package esmith; |
29 |
+ |
30 |
+use strict; |
31 |
+use Errno; |
32 |
+ |
33 |
+# here we trick ourself into ibay-modify in order to have all php versions offered by smeserver-php |
34 |
+# not ideal as we would like to only have php and we also do samba .... but we are working on ibays. |
35 |
+my $event ="ibay-modify"; |
36 |
+system('/etc/e-smith/events/actions/adjust-services',$event); |
37 |
diff -Nur --no-dereference smeserver-webhosting-0.0.9.old/root/etc/e-smith/events/actions/webhosting-php-expand smeserver-webhosting-0.0.9/root/etc/e-smith/events/actions/webhosting-php-expand |
38 |
--- smeserver-webhosting-0.0.9.old/root/etc/e-smith/events/actions/webhosting-php-expand 1969-12-31 19:00:00.000000000 -0500 |
39 |
+++ smeserver-webhosting-0.0.9/root/etc/e-smith/events/actions/webhosting-php-expand 2021-03-13 01:30:28.669000000 -0500 |
40 |
@@ -0,0 +1,10 @@ |
41 |
+#!/usr/bin/perl -w |
42 |
+package esmith; |
43 |
+ |
44 |
+use strict; |
45 |
+use Errno; |
46 |
+ |
47 |
+# here we trick ourself into ibay-modify in order to have all php versions offered by smeserver-php |
48 |
+# not ideal as we would like to only have php and we also do samba .... but we are working on ibays. |
49 |
+my $event ="ibay-modify"; |
50 |
+system('/etc/e-smith/events/actions/generic_template_expand',$event); |
51 |
diff -Nur --no-dereference smeserver-webhosting-0.0.9.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/webhosting smeserver-webhosting-0.0.9/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/webhosting |
52 |
--- smeserver-webhosting-0.0.9.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/webhosting 2021-03-12 01:47:03.229000000 -0500 |
53 |
+++ smeserver-webhosting-0.0.9/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/webhosting 2021-03-13 01:30:29.392000000 -0500 |
54 |
@@ -425,7 +425,7 @@ |
55 |
<entry> |
56 |
<base>DESC_PHPBASEDIR</base> |
57 |
<trans> |
58 |
- You must specify the full path to the I-bay or remove the content to get back to default values : /home/e-smith/files/ibays/ibay_name/:/new/path:/other/path |
59 |
+ You must specify the full path to the I-bay or remove the content to get back to default value |
60 |
</trans> |
61 |
</entry> |
62 |
<entry> |
63 |
@@ -440,5 +440,48 @@ |
64 |
Allow WebDav |
65 |
</trans> |
66 |
</entry> |
67 |
+ <entry> |
68 |
+ <base>PHPVERSION</base> |
69 |
+ <trans> |
70 |
+ Select the php-fpm version you want to use with this I-bay |
71 |
+ </trans> |
72 |
+ </entry> |
73 |
+ <entry> |
74 |
+ <base>FILEUPLOAD</base> |
75 |
+ <trans> |
76 |
+ Whether or not to allow HTTP file uploads (file_upload) |
77 |
+ </trans> |
78 |
+ </entry> |
79 |
+ <entry> |
80 |
+ <base>MAXINPUTTIME</base> |
81 |
+ <trans> |
82 |
+ Maximum time in seconds a script is allowed to parse input data (max_input_time) |
83 |
+ </trans> |
84 |
+ </entry> |
85 |
+ <entry> |
86 |
+ <base>ALLOWPHTML</base> |
87 |
+ <trans> |
88 |
+ Allow parsing php code inside html, phtml, htm and xml files. |
89 |
+ </trans> |
90 |
+ </entry> |
91 |
+ <entry> |
92 |
+ <base>MAILFORCESENDER</base> |
93 |
+ <trans> |
94 |
+ Force an email sender address for the script in this I-bay. |
95 |
+ </trans> |
96 |
+ </entry> |
97 |
+ <entry> |
98 |
+ <base>DISABLEDFUNCTIONS</base> |
99 |
+ <trans> |
100 |
+ List of php disabled functions (disable_functions) |
101 |
+ </trans> |
102 |
+ </entry> |
103 |
+ <entry> |
104 |
+ <base>DESC_DISABLEDFUNCTIONS</base> |
105 |
+ <trans> |
106 |
+ Leave empty or with a random string to disable. Copy and paste the following default list to reset to default |
107 |
+ </trans> |
108 |
+ </entry> |
109 |
+ |
110 |
</lexicon> |
111 |
|
112 |
diff -Nur --no-dereference smeserver-webhosting-0.0.9.old/root/etc/e-smith/web/functions/webhosting smeserver-webhosting-0.0.9/root/etc/e-smith/web/functions/webhosting |
113 |
--- smeserver-webhosting-0.0.9.old/root/etc/e-smith/web/functions/webhosting 2014-06-18 12:27:47.000000000 -0400 |
114 |
+++ smeserver-webhosting-0.0.9/root/etc/e-smith/web/functions/webhosting 2021-03-13 02:10:04.978000000 -0500 |
115 |
@@ -105,13 +105,13 @@ |
116 |
<title>ADD_TITLE</title> |
117 |
<subroutine src="print_ibay_name_field()" /> |
118 |
|
119 |
- <field type="select" id="indexes" value="enabled" options="'disabled' => 'DISABLED', 'enabled' => 'ENABLED'"> |
120 |
+ <field type="select" id="indexes" value="get_current_value('Indexes')" options="print_options('Indexes')"> |
121 |
<label>INDEXES</label> |
122 |
</field> |
123 |
- <field type="select" id="followSymLinks" options="'disabled' => 'DISABLED', 'enabled' => 'ENABLED'"> |
124 |
+ <field type="select" id="followSymLinks" value="get_current_value('FollowSymLinks')" options="print_options('FollowSymLinks')"> |
125 |
<label>FOLLOWSYMLINKS</label> |
126 |
</field> |
127 |
- <field type="select" id="allowOverride" value="None" options="'None' => 'DISABLED', 'All' => 'ENABLED'"> |
128 |
+ <field type="select" id="allowOverride" value="get_current_value('AllowOverride')" options="print_options('AllowOverride')"> |
129 |
<label>ALLOWOVERRIDE</label> |
130 |
</field> |
131 |
|
132 |
@@ -122,60 +122,71 @@ |
133 |
<description>DESC_DAV_SETTINGS</description> |
134 |
</field> |
135 |
|
136 |
- <field type="select" id="modDav" options="'disabled' => 'DISABLED', 'enabled' => 'ENABLED'"> |
137 |
+ <field type="select" id="modDav" options="print_options('ModDav')"> |
138 |
<label>ENABLE_MOD_DAV</label> |
139 |
</field> |
140 |
|
141 |
- <field |
142 |
+ <field |
143 |
type="literal" |
144 |
id="phpdesc" |
145 |
value=""> |
146 |
<description>DESC_PHP_SETTINGS</description> |
147 |
</field> |
148 |
- <field type="select" id="allowUrlfOpen" options="'disabled' => 'DISABLED', 'enabled' => 'ENABLED'"> |
149 |
+ <field type="select" |
150 |
+ id="PHPVersion" |
151 |
+ options="get_php_options()" |
152 |
+ value="get_current_php_value()"> |
153 |
+ <label>PHPVERSION</label> |
154 |
+ </field> |
155 |
+ |
156 |
+ <field type="select" id="allowUrlfOpen" options="print_options('AllowUrlFopen')"> |
157 |
<label>ALLOWURLFOPEN</label> |
158 |
</field> |
159 |
<field type="select" |
160 |
id="memorylimit" |
161 |
- options="'disabled' => 'DEFAULT', '64M' => 'M0064MB', '128M' => 'M0128MB', |
162 |
- '256M' => 'M0256MB', '512M' => 'M0512MB', '768M' => 'M0768MB','1024M' => 'M1024MB'"> |
163 |
+ options="print_options('MemoryLimit')"> |
164 |
<label>MEMORYLIMIT</label> |
165 |
</field> |
166 |
- <field type="select" |
167 |
+ <field type="select" id="fileupload" options="print_options('FileUpload')" value="enabled"> |
168 |
+ <label>FILEUPLOAD</label> |
169 |
+ </field> |
170 |
+ <field type="select" |
171 |
id="uploadmaxfilesize" |
172 |
- options="'disabled' => 'DEFAULT','20M' => 'S0020MB', '30M' => 'S0030MB', '40M' => 'S0040MB', '50M' => 'S0050MB', |
173 |
- '75M' => 'S0075MB', '100M' => 'S0100MB', '125M' => 'S0125MB', '150M' => 'S0150MB', '175M' => 'S0175MB', |
174 |
- '200M' => 'S0200MB', '300M' => 'S0300MB','400M' => 'S0400MB', '500M' => 'S0500MB', '600M' => 'S0600MB', |
175 |
- '700M' => 'S0700MB', '800M' => 'S0800MB', '900M' => 'S0900MB', '1000M' => 'S1000MB', '1250M' => 'S1250MB', |
176 |
- '1500M' => 'S1500MB', '1750M' => 'S1750MB', '1999M' => 'S2000MB'"> |
177 |
+ options="print_options('UploadMaxFilesize')"> |
178 |
|
179 |
<label>UPLOADMAXFILESIZE</label> |
180 |
</field> |
181 |
<field type="select" validation="validate_up_post" |
182 |
id="postmaxsize" |
183 |
- options="'disabled' => 'DEFAULT','20M' => 'S0020MB', '30M' => 'S0030MB', '40M' => 'S0040MB', '50M' => 'S0050MB', |
184 |
- '75M' => 'S0075MB', '100M' => 'S0100MB', '125M' => 'S0125MB', '150M' => 'S0150MB', '175M' => 'S0175MB', |
185 |
- '200M' => 'S0200MB', '300M' => 'S0300MB','400M' => 'S0400MB', '500M' => 'S0500MB', '600M' => 'S0600MB', |
186 |
- '700M' => 'S0700MB', '800M' => 'S0800MB', '900M' => 'S0900MB', '1000M' => 'S1000MB', '1250M' => 'S1250MB', |
187 |
- '1500M' => 'S1500MB', '1750M' => 'S1750MB', '1999M' => 'S2000MB'"> |
188 |
+ options="print_options('PostMaxSize')"> |
189 |
<label>POSTMAXSIZE</label> |
190 |
</field> |
191 |
<field type="select" |
192 |
id="maxexecutiontime" |
193 |
- options="'disabled' => 'DEFAULT', '60' => 'T001m', '120' => 'T002m', '180' => 'T003m', '240' => 'T004m', '300' => 'T005m', |
194 |
- '360' => 'T006m', '420' => 'T007m', '480' => 'T008m', '540' => 'T009m', '600' => 'T010m', '900' => 'T015m', |
195 |
- '1800' => 'T030m', '2700' => 'T045m', '3600' => 'T060m', '7200' => 'T120m', 'unlimited' => 'UNLIMITED'"> |
196 |
+ options="print_options('MaxExecutionTime')"> |
197 |
<label>MAXEXECUTIONTIME</label> |
198 |
</field> |
199 |
+ <field type="select" |
200 |
+ id="maxinputtime" |
201 |
+ options="print_options('MaxInputTime')"> |
202 |
+ <label>MAXINPUTTIME</label> |
203 |
+ </field> |
204 |
+ <field type="select" id="allowphtml" options="print_options('AllowPHTML')"> |
205 |
+ <label>ALLOWPHTML</label> |
206 |
+ </field> |
207 |
+ <field type="text" id="mailforcesender" size="80" > |
208 |
+ <label>MAILFORCESENDER</label> |
209 |
+ </field> |
210 |
+ <field type="text" id="disabledfunctions" size="80" > |
211 |
+ <label>DISABLEDFUNCTIONS</label> |
212 |
+ </field> |
213 |
+ <subroutine src="print_disabledfunctions" /> |
214 |
+ <subroutine src="get_current_value('Indexes')" /> |
215 |
+ |
216 |
<field type="text" id="phpbasedir" size="80" > |
217 |
<label>PHPBASEDIR</label> |
218 |
</field> |
219 |
- <field |
220 |
- type="literal" |
221 |
- id="phpbasedirdesc" |
222 |
- value=""> |
223 |
- <description>DESC_PHPBASEDIR</description> |
224 |
- </field> |
225 |
+ <subroutine src="print_phpbasedir" /> |
226 |
<subroutine src="print_save_or_add_button()" /> |
227 |
</page> |
228 |
|
229 |
diff -Nur --no-dereference smeserver-webhosting-0.0.9.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/webhosting.pm smeserver-webhosting-0.0.9/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/webhosting.pm |
230 |
--- smeserver-webhosting-0.0.9.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/webhosting.pm 2014-06-18 12:27:47.000000000 -0400 |
231 |
+++ smeserver-webhosting-0.0.9/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/webhosting.pm 2021-03-13 01:30:28.919000000 -0500 |
232 |
@@ -17,6 +17,7 @@ |
233 |
use File::Basename; |
234 |
use Exporter; |
235 |
use Carp; |
236 |
+use esmith::php; |
237 |
|
238 |
our @ISA = qw(esmith::FormMagick Exporter); |
239 |
|
240 |
@@ -36,6 +37,67 @@ |
241 |
our $accountdb = esmith::AccountsDB->open(); |
242 |
our $configdb = esmith::ConfigDB->open(); |
243 |
|
244 |
+#TODO those 3 variables should be exported from esmith::php |
245 |
+our $defaultdisabledfunc='system,show_source,' . |
246 |
+ 'symlink,exec,dl,shell_exec,' . |
247 |
+ 'passthru,phpinfo,' . |
248 |
+ 'escapeshellarg,escapeshellcmd'; |
249 |
+our $BASEPHP = 54; |
250 |
+our %defaultproperties = ( |
251 |
+ MemoryLimit => '128M', |
252 |
+ MaxExecutionTime => '30', |
253 |
+ MaxInputTime => '60', |
254 |
+ AllowUrlFopen => 'disabled', |
255 |
+ PostMaxSize => '20M', |
256 |
+ UploadMaxFilesize => '10M', |
257 |
+ FileUpload => 'enabled', |
258 |
+ PHPBaseDir => '/home/e-smith/files/ibays/$key:/var/lib/php/$key', |
259 |
+ DisabledFunctions => $defaultdisabledfunc, |
260 |
+ MailForceSender => "admin@".$configdb->get_value('DomainName'), |
261 |
+ AllowPHTML => 'disabled', |
262 |
+ |
263 |
+ ModDav => "disabled", |
264 |
+ AllowOverride => "None", |
265 |
+ FollowSymLinks => "disabled", |
266 |
+ Indexes => "enabled", |
267 |
+ ); |
268 |
+ |
269 |
+ |
270 |
+# those are ok to be defined here and not in core. |
271 |
+our %sizehash = ('20M' => 'S0020MB', '30M' => 'S0030MB', '40M' => 'S0040MB', '50M' => 'S0050MB', |
272 |
+ '75M' => 'S0075MB', '100M' => 'S0100MB', '125M' => 'S0125MB', '150M' => 'S0150MB', '175M' => 'S0175MB', |
273 |
+ '200M' => 'S0200MB', '300M' => 'S0300MB','400M' => 'S0400MB', '500M' => 'S0500MB', '600M' => 'S0600MB', |
274 |
+ '700M' => 'S0700MB', '800M' => 'S0800MB', '900M' => 'S0900MB', '1000M' => 'S1000MB', '1250M' => 'S1250MB', |
275 |
+ '1500M' => 'S1500MB', '1750M' => 'S1750MB', '1999M' => 'S2000MB'); |
276 |
+our %binary = ('disabled' => 'DISABLED', 'enabled' => 'ENABLED'); |
277 |
+our %timehash = ( '60' => 'T001m', '120' => 'T002m', '180' => 'T003m', '240' => 'T004m', '300' => 'T005m', |
278 |
+ '360' => 'T006m', '420' => 'T007m', '480' => 'T008m', '540' => 'T009m', '600' => 'T010m', '900' => 'T015m', |
279 |
+ '1800' => 'T030m', '2700' => 'T045m', '3600' => 'T060m', '7200' => 'T120m', 'unlimited' => 'UNLIMITED'); |
280 |
+our %optionsproperties =( |
281 |
+ MemoryLimit => {'64M' => 'M0064MB', '128M' => 'M0128MB', |
282 |
+ '256M' => 'M0256MB', '512M' => 'M0512MB', '768M' => 'M0768MB','1024M' => 'M1024MB'}, |
283 |
+ MaxExecutionTime => {%timehash}, |
284 |
+ MaxInputTime => {%timehash}, |
285 |
+ AllowUrlFopen => {%binary}, |
286 |
+ PostMaxSize => {%sizehash}, |
287 |
+ UploadMaxFilesize => {%sizehash}, |
288 |
+ FileUpload => {%binary}, |
289 |
+ DisabledFunctions => $defaultdisabledfunc, |
290 |
+ AllowPHTML => {%binary}, |
291 |
+ |
292 |
+ ModDav => {%binary}, |
293 |
+ AllowOverride => { None =>'None' , |
294 |
+ All => 'All', |
295 |
+ AuthConfig => 'AuthConfig', |
296 |
+ FileInfo => 'FileInfo', |
297 |
+ Indexes => 'Indexes', |
298 |
+ Limit => 'Limit', |
299 |
+ 'FileInfo Indexes' => 'FileInfo Indexes', |
300 |
+ }, |
301 |
+ FollowSymLinks => {%binary}, |
302 |
+ Indexes => {%binary}, |
303 |
+); |
304 |
+ |
305 |
=pod |
306 |
|
307 |
=head1 NAME |
308 |
@@ -205,27 +267,39 @@ |
309 |
if ($rec) |
310 |
{ |
311 |
$q->param(-name=>'description',-value=> |
312 |
- $rec->prop('Name')); |
313 |
+ $rec->prop('Name')); # yes we keep this one simple |
314 |
$q->param(-name=>'indexes',-value=> |
315 |
- ($rec->prop('Indexes'))); |
316 |
+ (get_current_value($self,'Indexes'))); |
317 |
$q->param(-name=>'followSymLinks',-value=> |
318 |
- ($rec->prop('FollowSymLinks'))); |
319 |
+ (get_current_value($self,'FollowSymLinks'))); |
320 |
$q->param(-name=>'allowOverride',-value=> |
321 |
- ($rec->prop('AllowOverride'))); |
322 |
+ (get_current_value($self,'AllowOverride'))); |
323 |
$q->param(-name=>'allowUrlfOpen',-value=> |
324 |
- ($rec->prop('AllowUrlfOpen'))); |
325 |
+ (get_current_value($self,'AllowUrlfOpen'))); |
326 |
$q->param(-name=>'memorylimit',-value=> |
327 |
- ($rec->prop('MemoryLimit'))); |
328 |
+ (get_current_value($self,'MemoryLimit'))); |
329 |
$q->param(-name=>'uploadmaxfilesize',-value=> |
330 |
- ($rec->prop('UpMaxFileSize'))); |
331 |
+ (get_current_value($self,'UploadMaxFilesize'))); |
332 |
$q->param(-name=>'postmaxsize',-value=> |
333 |
- ($rec->prop('PostMaxSize'))); |
334 |
+ (get_current_value($self,'PostMaxSize'))); |
335 |
$q->param(-name=>'maxexecutiontime',-value=> |
336 |
- ($rec->prop('MaxExecTime'))); |
337 |
+ (get_current_value($self,'MaxExecTime'))); |
338 |
+ $q->param(-name=>'maxinputtime',-value=> |
339 |
+ (get_current_value($self,'MaxInputTime'))); |
340 |
+ $q->param(-name=>'fileupload',-value=> |
341 |
+ (get_current_value($self,'FileUpload'))); |
342 |
+ $q->param(-name=>'allowphtml',-value=> |
343 |
+ (get_current_value($self,'AllowPHTML'))); |
344 |
+ $q->param(-name=>'mailforcesender',-value=> |
345 |
+ ($rec->prop('MailForceSender'))); # yes we keep this one simple |
346 |
+ my $df = ($rec->prop('DisabledFunctions'))? $rec->prop('DisabledFunctions') : $defaultdisabledfunc; |
347 |
+ $q->param(-name=>'disabledfunctions',-value=> |
348 |
+ ($df)); # yes we want todo this one this way. |
349 |
$q->param(-name=>'phpbasedir',-value=> |
350 |
- ($rec->prop('PHPBaseDir'))); |
351 |
+ ($rec->prop('PHPBaseDir'))); # yes we keep this one simple |
352 |
$q->param(-name=>'modDav',-value=> |
353 |
- ($rec->prop('ModDav'))); |
354 |
+ (get_current_value($self,'ModDav'))); |
355 |
+ # we set phpversion using function called by cgi file |
356 |
} |
357 |
} else { |
358 |
print qq( |
359 |
@@ -272,21 +346,6 @@ |
360 |
return undef; |
361 |
} |
362 |
|
363 |
-=head2 group_list() |
364 |
- |
365 |
-Returns a hash of groups for the Create/Modify screen's group field's |
366 |
-drop down list. |
367 |
- |
368 |
-=for testing |
369 |
-can_ok('main', 'group_list'); |
370 |
-my $g = group_list(); |
371 |
-is(ref($g), 'HASH', "group_list returns a hashref"); |
372 |
-is($g->{simpsons}, "Simpsons Family (simpsons)", |
373 |
- "Found names and descriptions"); |
374 |
- |
375 |
-=cut |
376 |
- |
377 |
- |
378 |
=head1 THE ROUTINES THAT ACTUALLY DO THE WORK |
379 |
|
380 |
=for testing |
381 |
@@ -326,18 +385,52 @@ |
382 |
my $name = $self->cgi->param('name'); |
383 |
if (my $acct = $accountdb->get($name)) { |
384 |
if ($acct->prop('type') eq 'ibay') { |
385 |
- $acct->merge_props( |
386 |
- Indexes => $self->cgi->param('indexes'), |
387 |
- FollowSymLinks => $self->cgi->param('followSymLinks'), |
388 |
- AllowOverride => $self->cgi->param('allowOverride'), |
389 |
- AllowUrlfOpen => $self->cgi->param('allowUrlfOpen'), |
390 |
- MemoryLimit => $self->cgi->param('memorylimit'), |
391 |
- UpMaxFileSize => $self->cgi->param('uploadmaxfilesize'), |
392 |
- PostMaxSize => $self->cgi->param('postmaxsize'), |
393 |
- MaxExecTime => $self->cgi->param('maxexecutiontime'), |
394 |
- PHPBaseDir => $self->cgi->param('phpbasedir'), |
395 |
- ModDav => $self->cgi->param('modDav'), |
396 |
- ); |
397 |
+ |
398 |
+ my %doing=( Indexes => 'indexes', |
399 |
+ FollowSymLinks => 'followSymLinks', |
400 |
+ AllowOverride => 'allowOverride', |
401 |
+ ModDav => 'modDav', |
402 |
+ PHPVersion => 'PHPVersion', |
403 |
+ AllowUrlfOpen => 'allowUrlfOpen', |
404 |
+ MemoryLimit => 'memorylimit', |
405 |
+ FileUpload => 'fileupload', |
406 |
+ UploadMaxFilesize => 'uploadmaxfilesize', |
407 |
+ PostMaxSize => 'postmaxsize', |
408 |
+ MaxExecTime => 'maxexecutiontime', |
409 |
+ MaxInputTime => 'maxinputtime', |
410 |
+ AllowPHTML => 'allowphtml', |
411 |
+ MailForceSender => 'mailforcesender', |
412 |
+ DisabledFunctions => 'disabledfunctions', |
413 |
+ PHPBaseDir => 'phpbasedir', |
414 |
+ ); |
415 |
+ foreach my $prop (keys %doing) { |
416 |
+ my $value = $self->cgi->param($doing{$prop}); |
417 |
+ $value = "" if ( $value eq "$BASEPHP" && $prop eq 'PHPVersion'); |
418 |
+ my $default = $defaultproperties{$prop} || ""; |
419 |
+ # exceptions to handle |
420 |
+ # DisabledFunctions if equal def delprop |
421 |
+ if ($prop eq 'DisabledFunctions' && $value eq $default) { |
422 |
+ $acct->delete_prop($prop) ; |
423 |
+ next; |
424 |
+ } |
425 |
+ # MailForceSender if empty delprop |
426 |
+ if ($prop eq 'MailForceSender' && $value eq "" ) { |
427 |
+ $acct->delete_prop($prop) ; |
428 |
+ next |
429 |
+ } |
430 |
+ # PHPBaseDir if empty delprop |
431 |
+ if ($prop eq 'PHPBaseDir' && $value eq "" ) { |
432 |
+ $acct->delete_prop($prop) ; |
433 |
+ next |
434 |
+ } |
435 |
+ # others if == default delprop |
436 |
+ if ($value eq "default") { |
437 |
+ $acct->delete_prop($prop) ; |
438 |
+ next; |
439 |
+ } |
440 |
+ $acct->merge_props($prop => $value); |
441 |
+ #TODO store them in a hash and call merge_props once |
442 |
+ } |
443 |
|
444 |
# Untaint $name before use in system() |
445 |
$name =~ /(.+)/; $name = $1; |
446 |
@@ -368,7 +461,9 @@ |
447 |
my $postmaxsizeform = $self->cgi->param('postmaxsize'); |
448 |
##set value to "0M" if disabled in order to compare uploadmaxfilesize and postmaxsize |
449 |
$upmaxfilesize = "0M" if $upmaxfilesize eq 'disabled'; |
450 |
+ $upmaxfilesize = $defaultproperties{'UploadMaxFilesize'} if $upmaxfilesize eq 'default'; |
451 |
$postmaxsizeform = "0M" if $postmaxsizeform eq 'disabled'; |
452 |
+ $postmaxsizeform =$defaultproperties{'PostMaxSize'} if $postmaxsizeform eq 'default'; |
453 |
##remove the 'M' unit |
454 |
my $upmaxfilesizechop = chop($upmaxfilesize); |
455 |
my $postmaxsizeformchop = chop($postmaxsizeform); |
456 |
@@ -382,6 +477,86 @@ |
457 |
return "OK"; |
458 |
} |
459 |
} |
460 |
+ |
461 |
+=head2 get_current_php_value |
462 |
+ |
463 |
+=cut |
464 |
+sub get_current_php_value{ |
465 |
+ my ($self) = @_; |
466 |
+ my $name = $self->cgi->param('name'); |
467 |
+ my $ibay= $accountdb->get($name); |
468 |
+ return "default" unless defined $ibay->prop('PHPVersion'); |
469 |
+ return VersionToUse($accountdb->get($name)); |
470 |
+} |
471 |
+ |
472 |
+ |
473 |
+=head2 get_current_php_value |
474 |
+ |
475 |
+=cut |
476 |
+sub get_php_options{ |
477 |
+ my ($self) = @_; |
478 |
+ my $translate = $self->localise('DEFAULT'); |
479 |
+ my %options= listPHPVersionHash(); |
480 |
+ $options{"default"}="$translate: ".PHPdefault(); |
481 |
+ return \%options; |
482 |
+} |
483 |
+ |
484 |
+=head2 get_current_value ($self, $property) |
485 |
+ |
486 |
+ |
487 |
+=cut |
488 |
+sub get_current_value{ |
489 |
+ my ($self, $property) = @_; |
490 |
+ my $name = $self->cgi->param('name'); |
491 |
+ my $ibay = $accountdb->get($name); |
492 |
+ my $key = $ibay->key; |
493 |
+ my $default = $defaultproperties{$property} || ""; |
494 |
+ $default =~ s/\$key/$key/g if $property eq "PHPBaseDir"; |
495 |
+ my $value = ($ibay->prop($property))? $ibay->prop($property) : "default" ; |
496 |
+ return $value; |
497 |
+ |
498 |
+} |
499 |
+ |
500 |
+sub print_options{ |
501 |
+ my ($self, $property) = @_; |
502 |
+ my $translate = $self->localise('DEFAULT'); |
503 |
+ my $name = $self->cgi->param('name'); |
504 |
+ my $ibay = $accountdb->get($name); |
505 |
+ my $key = $ibay->key; |
506 |
+ my $default = $defaultproperties{$property} || ""; |
507 |
+ $default =~ s/\$key/$key/g if $property eq "PHPBaseDir"; |
508 |
+ my %opts=%{$optionsproperties{$property}}; |
509 |
+ $default=$self->localise(uc($default)) unless ($property eq 'AllowOverride'); |
510 |
+ $opts{"default"} = "$translate: ".$default; |
511 |
+ return \%opts |
512 |
+ |
513 |
+} |
514 |
+ |
515 |
+sub print_disabledfunctions{ |
516 |
+ my ($self) = @_; |
517 |
+ my $translate = $self->localise('DESC_DISABLEDFUNCTIONS'); |
518 |
+ my $name = $self->cgi->param('name'); |
519 |
+ my $ibay= $accountdb->get($name); |
520 |
+ return "$translate : ". $defaultdisabledfunc ; |
521 |
+ |
522 |
+ |
523 |
+} |
524 |
+ |
525 |
+sub print_phpbasedir{ |
526 |
+ my ($self) = @_; |
527 |
+ my $translate = $self->localise('DESC_PHPBASEDIR'); |
528 |
+ my $name = $self->cgi->param('name'); |
529 |
+ my $ibay= $accountdb->get($name); |
530 |
+ my $key = $ibay->key; |
531 |
+ my $default = $defaultproperties{'PHPBaseDir'} ||''; |
532 |
+ $default =~ s/\$key/$key/g; |
533 |
+ my $basedir = ($ibay->prop('PHPBaseDir')) ? $ibay->prop('PHPBaseDir') : $defaultproperties{'PHPBaseDir'}; |
534 |
+ return "$translate : ". $default ; |
535 |
+ |
536 |
+ |
537 |
+} |
538 |
+ |
539 |
+ |
540 |
1; |
541 |
|
542 |
|