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 01:30:29.150000000 -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,72 @@ |
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 |
+<subroutine src="print_options('Indexes')" /> |
216 |
+ |
217 |
<field type="text" id="phpbasedir" size="80" > |
218 |
<label>PHPBASEDIR</label> |
219 |
</field> |
220 |
- <field |
221 |
- type="literal" |
222 |
- id="phpbasedirdesc" |
223 |
- value=""> |
224 |
- <description>DESC_PHPBASEDIR</description> |
225 |
- </field> |
226 |
+ <subroutine src="print_phpbasedir" /> |
227 |
<subroutine src="print_save_or_add_button()" /> |
228 |
</page> |
229 |
|
230 |
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 |
231 |
--- 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 |
232 |
+++ smeserver-webhosting-0.0.9/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/webhosting.pm 2021-03-13 01:30:28.919000000 -0500 |
233 |
@@ -17,6 +17,7 @@ |
234 |
use File::Basename; |
235 |
use Exporter; |
236 |
use Carp; |
237 |
+use esmith::php; |
238 |
|
239 |
our @ISA = qw(esmith::FormMagick Exporter); |
240 |
|
241 |
@@ -36,6 +37,67 @@ |
242 |
our $accountdb = esmith::AccountsDB->open(); |
243 |
our $configdb = esmith::ConfigDB->open(); |
244 |
|
245 |
+#TODO those 3 variables should be exported from esmith::php |
246 |
+our $defaultdisabledfunc='system,show_source,' . |
247 |
+ 'symlink,exec,dl,shell_exec,' . |
248 |
+ 'passthru,phpinfo,' . |
249 |
+ 'escapeshellarg,escapeshellcmd'; |
250 |
+our $BASEPHP = 54; |
251 |
+our %defaultproperties = ( |
252 |
+ MemoryLimit => '128M', |
253 |
+ MaxExecutionTime => '30', |
254 |
+ MaxInputTime => '60', |
255 |
+ AllowUrlFopen => 'disabled', |
256 |
+ PostMaxSize => '20M', |
257 |
+ UploadMaxFilesize => '10M', |
258 |
+ FileUpload => 'enabled', |
259 |
+ PHPBaseDir => '/home/e-smith/files/ibays/$key:/var/lib/php/$key', |
260 |
+ DisabledFunctions => $defaultdisabledfunc, |
261 |
+ MailForceSender => "admin@".$configdb->get_value('DomainName'), |
262 |
+ AllowPHTML => 'disabled', |
263 |
+ |
264 |
+ ModDav => "disabled", |
265 |
+ AllowOverride => "None", |
266 |
+ FollowSymLinks => "disabled", |
267 |
+ Indexes => "enabled", |
268 |
+ ); |
269 |
+ |
270 |
+ |
271 |
+# those are ok to be defined here and not in core. |
272 |
+our %sizehash = ('20M' => 'S0020MB', '30M' => 'S0030MB', '40M' => 'S0040MB', '50M' => 'S0050MB', |
273 |
+ '75M' => 'S0075MB', '100M' => 'S0100MB', '125M' => 'S0125MB', '150M' => 'S0150MB', '175M' => 'S0175MB', |
274 |
+ '200M' => 'S0200MB', '300M' => 'S0300MB','400M' => 'S0400MB', '500M' => 'S0500MB', '600M' => 'S0600MB', |
275 |
+ '700M' => 'S0700MB', '800M' => 'S0800MB', '900M' => 'S0900MB', '1000M' => 'S1000MB', '1250M' => 'S1250MB', |
276 |
+ '1500M' => 'S1500MB', '1750M' => 'S1750MB', '1999M' => 'S2000MB'); |
277 |
+our %binary = ('disabled' => 'DISABLED', 'enabled' => 'ENABLED'); |
278 |
+our %timehash = ( '60' => 'T001m', '120' => 'T002m', '180' => 'T003m', '240' => 'T004m', '300' => 'T005m', |
279 |
+ '360' => 'T006m', '420' => 'T007m', '480' => 'T008m', '540' => 'T009m', '600' => 'T010m', '900' => 'T015m', |
280 |
+ '1800' => 'T030m', '2700' => 'T045m', '3600' => 'T060m', '7200' => 'T120m', 'unlimited' => 'UNLIMITED'); |
281 |
+our %optionsproperties =( |
282 |
+ MemoryLimit => {'64M' => 'M0064MB', '128M' => 'M0128MB', |
283 |
+ '256M' => 'M0256MB', '512M' => 'M0512MB', '768M' => 'M0768MB','1024M' => 'M1024MB'}, |
284 |
+ MaxExecutionTime => {%timehash}, |
285 |
+ MaxInputTime => {%timehash}, |
286 |
+ AllowUrlFopen => {%binary}, |
287 |
+ PostMaxSize => {%sizehash}, |
288 |
+ UploadMaxFilesize => {%sizehash}, |
289 |
+ FileUpload => {%binary}, |
290 |
+ DisabledFunctions => $defaultdisabledfunc, |
291 |
+ AllowPHTML => {%binary}, |
292 |
+ |
293 |
+ ModDav => {%binary}, |
294 |
+ AllowOverride => { None =>'None' , |
295 |
+ All => 'All', |
296 |
+ AuthConfig => 'AuthConfig', |
297 |
+ FileInfo => 'FileInfo', |
298 |
+ Indexes => 'Indexes', |
299 |
+ Limit => 'Limit', |
300 |
+ 'FileInfo Indexes' => 'FileInfo Indexes', |
301 |
+ }, |
302 |
+ FollowSymLinks => {%binary}, |
303 |
+ Indexes => {%binary}, |
304 |
+); |
305 |
+ |
306 |
=pod |
307 |
|
308 |
=head1 NAME |
309 |
@@ -205,27 +267,39 @@ |
310 |
if ($rec) |
311 |
{ |
312 |
$q->param(-name=>'description',-value=> |
313 |
- $rec->prop('Name')); |
314 |
+ $rec->prop('Name')); # yes we keep this one simple |
315 |
$q->param(-name=>'indexes',-value=> |
316 |
- ($rec->prop('Indexes'))); |
317 |
+ (get_current_value($self,'Indexes'))); |
318 |
$q->param(-name=>'followSymLinks',-value=> |
319 |
- ($rec->prop('FollowSymLinks'))); |
320 |
+ (get_current_value($self,'FollowSymLinks'))); |
321 |
$q->param(-name=>'allowOverride',-value=> |
322 |
- ($rec->prop('AllowOverride'))); |
323 |
+ (get_current_value($self,'AllowOverride'))); |
324 |
$q->param(-name=>'allowUrlfOpen',-value=> |
325 |
- ($rec->prop('AllowUrlfOpen'))); |
326 |
+ (get_current_value($self,'AllowUrlfOpen'))); |
327 |
$q->param(-name=>'memorylimit',-value=> |
328 |
- ($rec->prop('MemoryLimit'))); |
329 |
+ (get_current_value($self,'MemoryLimit'))); |
330 |
$q->param(-name=>'uploadmaxfilesize',-value=> |
331 |
- ($rec->prop('UpMaxFileSize'))); |
332 |
+ (get_current_value($self,'UploadMaxFilesize'))); |
333 |
$q->param(-name=>'postmaxsize',-value=> |
334 |
- ($rec->prop('PostMaxSize'))); |
335 |
+ (get_current_value($self,'PostMaxSize'))); |
336 |
$q->param(-name=>'maxexecutiontime',-value=> |
337 |
- ($rec->prop('MaxExecTime'))); |
338 |
+ (get_current_value($self,'MaxExecTime'))); |
339 |
+ $q->param(-name=>'maxinputtime',-value=> |
340 |
+ (get_current_value($self,'MaxInputTime'))); |
341 |
+ $q->param(-name=>'fileupload',-value=> |
342 |
+ (get_current_value($self,'FileUpload'))); |
343 |
+ $q->param(-name=>'allowphtml',-value=> |
344 |
+ (get_current_value($self,'AllowPHTML'))); |
345 |
+ $q->param(-name=>'mailforcesender',-value=> |
346 |
+ ($rec->prop('MailForceSender'))); # yes we keep this one simple |
347 |
+ my $df = ($rec->prop('DisabledFunctions'))? $rec->prop('DisabledFunctions') : $defaultdisabledfunc; |
348 |
+ $q->param(-name=>'disabledfunctions',-value=> |
349 |
+ ($df)); # yes we want todo this one this way. |
350 |
$q->param(-name=>'phpbasedir',-value=> |
351 |
- ($rec->prop('PHPBaseDir'))); |
352 |
+ ($rec->prop('PHPBaseDir'))); # yes we keep this one simple |
353 |
$q->param(-name=>'modDav',-value=> |
354 |
- ($rec->prop('ModDav'))); |
355 |
+ (get_current_value($self,'ModDav'))); |
356 |
+ # we set phpversion using function called by cgi file |
357 |
} |
358 |
} else { |
359 |
print qq( |
360 |
@@ -272,21 +346,6 @@ |
361 |
return undef; |
362 |
} |
363 |
|
364 |
-=head2 group_list() |
365 |
- |
366 |
-Returns a hash of groups for the Create/Modify screen's group field's |
367 |
-drop down list. |
368 |
- |
369 |
-=for testing |
370 |
-can_ok('main', 'group_list'); |
371 |
-my $g = group_list(); |
372 |
-is(ref($g), 'HASH', "group_list returns a hashref"); |
373 |
-is($g->{simpsons}, "Simpsons Family (simpsons)", |
374 |
- "Found names and descriptions"); |
375 |
- |
376 |
-=cut |
377 |
- |
378 |
- |
379 |
=head1 THE ROUTINES THAT ACTUALLY DO THE WORK |
380 |
|
381 |
=for testing |
382 |
@@ -326,18 +385,52 @@ |
383 |
my $name = $self->cgi->param('name'); |
384 |
if (my $acct = $accountdb->get($name)) { |
385 |
if ($acct->prop('type') eq 'ibay') { |
386 |
- $acct->merge_props( |
387 |
- Indexes => $self->cgi->param('indexes'), |
388 |
- FollowSymLinks => $self->cgi->param('followSymLinks'), |
389 |
- AllowOverride => $self->cgi->param('allowOverride'), |
390 |
- AllowUrlfOpen => $self->cgi->param('allowUrlfOpen'), |
391 |
- MemoryLimit => $self->cgi->param('memorylimit'), |
392 |
- UpMaxFileSize => $self->cgi->param('uploadmaxfilesize'), |
393 |
- PostMaxSize => $self->cgi->param('postmaxsize'), |
394 |
- MaxExecTime => $self->cgi->param('maxexecutiontime'), |
395 |
- PHPBaseDir => $self->cgi->param('phpbasedir'), |
396 |
- ModDav => $self->cgi->param('modDav'), |
397 |
- ); |
398 |
+ |
399 |
+ my %doing=( Indexes => 'indexes', |
400 |
+ FollowSymLinks => 'followSymLinks', |
401 |
+ AllowOverride => 'allowOverride', |
402 |
+ ModDav => 'modDav', |
403 |
+ PHPVersion => 'PHPVersion', |
404 |
+ AllowUrlfOpen => 'allowUrlfOpen', |
405 |
+ MemoryLimit => 'memorylimit', |
406 |
+ FileUpload => 'fileupload', |
407 |
+ UploadMaxFilesize => 'uploadmaxfilesize', |
408 |
+ PostMaxSize => 'postmaxsize', |
409 |
+ MaxExecTime => 'maxexecutiontime', |
410 |
+ MaxInputTime => 'maxinputtime', |
411 |
+ AllowPHTML => 'allowphtml', |
412 |
+ MailForceSender => 'mailforcesender', |
413 |
+ DisabledFunctions => 'disabledfunctions', |
414 |
+ PHPBaseDir => 'phpbasedir', |
415 |
+ ); |
416 |
+ foreach my $prop (keys %doing) { |
417 |
+ my $value = $self->cgi->param($doing{$prop}); |
418 |
+ $value = "" if ( $value eq "$BASEPHP" && $prop eq 'PHPVersion'); |
419 |
+ my $default = $defaultproperties{$prop} || ""; |
420 |
+ # exceptions to handle |
421 |
+ # DisabledFunctions if equal def delprop |
422 |
+ if ($prop eq 'DisabledFunctions' && $value eq $default) { |
423 |
+ $acct->delete_prop($prop) ; |
424 |
+ next; |
425 |
+ } |
426 |
+ # MailForceSender if empty delprop |
427 |
+ if ($prop eq 'MailForceSender' && $value eq "" ) { |
428 |
+ $acct->delete_prop($prop) ; |
429 |
+ next |
430 |
+ } |
431 |
+ # PHPBaseDir if empty delprop |
432 |
+ if ($prop eq 'PHPBaseDir' && $value eq "" ) { |
433 |
+ $acct->delete_prop($prop) ; |
434 |
+ next |
435 |
+ } |
436 |
+ # others if == default delprop |
437 |
+ if ($value eq "default") { |
438 |
+ $acct->delete_prop($prop) ; |
439 |
+ next; |
440 |
+ } |
441 |
+ $acct->merge_props($prop => $value); |
442 |
+ #TODO store them in a hash and call merge_props once |
443 |
+ } |
444 |
|
445 |
# Untaint $name before use in system() |
446 |
$name =~ /(.+)/; $name = $1; |
447 |
@@ -368,7 +461,9 @@ |
448 |
my $postmaxsizeform = $self->cgi->param('postmaxsize'); |
449 |
##set value to "0M" if disabled in order to compare uploadmaxfilesize and postmaxsize |
450 |
$upmaxfilesize = "0M" if $upmaxfilesize eq 'disabled'; |
451 |
+ $upmaxfilesize = $defaultproperties{'UploadMaxFilesize'} if $upmaxfilesize eq 'default'; |
452 |
$postmaxsizeform = "0M" if $postmaxsizeform eq 'disabled'; |
453 |
+ $postmaxsizeform =$defaultproperties{'PostMaxSize'} if $postmaxsizeform eq 'default'; |
454 |
##remove the 'M' unit |
455 |
my $upmaxfilesizechop = chop($upmaxfilesize); |
456 |
my $postmaxsizeformchop = chop($postmaxsizeform); |
457 |
@@ -382,6 +477,86 @@ |
458 |
return "OK"; |
459 |
} |
460 |
} |
461 |
+ |
462 |
+=head2 get_current_php_value |
463 |
+ |
464 |
+=cut |
465 |
+sub get_current_php_value{ |
466 |
+ my ($self) = @_; |
467 |
+ my $name = $self->cgi->param('name'); |
468 |
+ my $ibay= $accountdb->get($name); |
469 |
+ return "default" unless defined $ibay->prop('PHPVersion'); |
470 |
+ return VersionToUse($accountdb->get($name)); |
471 |
+} |
472 |
+ |
473 |
+ |
474 |
+=head2 get_current_php_value |
475 |
+ |
476 |
+=cut |
477 |
+sub get_php_options{ |
478 |
+ my ($self) = @_; |
479 |
+ my $translate = $self->localise('DEFAULT'); |
480 |
+ my %options= listPHPVersionHash(); |
481 |
+ $options{"default"}="$translate: ".PHPdefault(); |
482 |
+ return \%options; |
483 |
+} |
484 |
+ |
485 |
+=head2 get_current_value ($self, $property) |
486 |
+ |
487 |
+ |
488 |
+=cut |
489 |
+sub get_current_value{ |
490 |
+ my ($self, $property) = @_; |
491 |
+ my $name = $self->cgi->param('name'); |
492 |
+ my $ibay = $accountdb->get($name); |
493 |
+ my $key = $ibay->key; |
494 |
+ my $default = $defaultproperties{$property} || ""; |
495 |
+ $default =~ s/\$key/$key/g if $property eq "PHPBaseDir"; |
496 |
+ my $value = ($ibay->prop($property))? $ibay->prop($property) : "default" ; |
497 |
+ return $value; |
498 |
+ |
499 |
+} |
500 |
+ |
501 |
+sub print_options{ |
502 |
+ my ($self, $property) = @_; |
503 |
+ my $translate = $self->localise('DEFAULT'); |
504 |
+ my $name = $self->cgi->param('name'); |
505 |
+ my $ibay = $accountdb->get($name); |
506 |
+ my $key = $ibay->key; |
507 |
+ my $default = $defaultproperties{$property} || ""; |
508 |
+ $default =~ s/\$key/$key/g if $property eq "PHPBaseDir"; |
509 |
+ my %opts=%{$optionsproperties{$property}}; |
510 |
+ $default=$self->localise(uc($default)) unless ($property eq 'AllowOverride'); |
511 |
+ $opts{"default"} = "$translate: ".$default; |
512 |
+ return \%opts |
513 |
+ |
514 |
+} |
515 |
+ |
516 |
+sub print_disabledfunctions{ |
517 |
+ my ($self) = @_; |
518 |
+ my $translate = $self->localise('DESC_DISABLEDFUNCTIONS'); |
519 |
+ my $name = $self->cgi->param('name'); |
520 |
+ my $ibay= $accountdb->get($name); |
521 |
+ return "$translate : ". $defaultdisabledfunc ; |
522 |
+ |
523 |
+ |
524 |
+} |
525 |
+ |
526 |
+sub print_phpbasedir{ |
527 |
+ my ($self) = @_; |
528 |
+ my $translate = $self->localise('DESC_PHPBASEDIR'); |
529 |
+ my $name = $self->cgi->param('name'); |
530 |
+ my $ibay= $accountdb->get($name); |
531 |
+ my $key = $ibay->key; |
532 |
+ my $default = $defaultproperties{'PHPBaseDir'} ||''; |
533 |
+ $default =~ s/\$key/$key/g; |
534 |
+ my $basedir = ($ibay->prop('PHPBaseDir')) ? $ibay->prop('PHPBaseDir') : $defaultproperties{'PHPBaseDir'}; |
535 |
+ return "$translate : ". $default ; |
536 |
+ |
537 |
+ |
538 |
+} |
539 |
+ |
540 |
+ |
541 |
1; |
542 |
|
543 |
|