1###############################################################################
2# Settings_Advanced.pm                                                        #
3# $Date: 12.02.14 $                                                           #
4###############################################################################
5# YaBB: Yet another Bulletin Board                                            #
6# Open-Source Community Software for Webmasters                               #
7# Version:        YaBB 2.6.11                                                 #
8# Packaged:       December 2, 2014                                            #
9# Distributed by: http://www.yabbforum.com                                    #
10# =========================================================================== #
11# Copyright (c) 2000-2014 YaBB (www.yabbforum.com) - All Rights Reserved.     #
12# Software by:  The YaBB Development Team                                     #
13#               with assistance from the YaBB community.                      #
14###############################################################################
15use CGI::Carp qw(fatalsToBrowser);
16use English '-no_match_vars';
17our $VERSION = '2.6.11';
18
19$settings_advancedpmver = 'YaBB 2.6.11 $Revision: 1611 $';
20if ( $action eq 'detailedversion' ) { return 1; }
21
22my $uploaddiriscorrect = qq~<span class="important">$admin_txt{'164'}</span>~;
23if ( -w $uploaddir && -d $uploaddir ) {
24    $uploaddiriscorrect =
25      qq~<span class="good">$admin_txt{'163'}</span>~;
26}
27
28my $pmUploadDirIsCorrect = qq~<span class="important">$admin_txt{'164'}</span>~;
29if ( -w $pmuploaddir && -d $pmuploaddir ) {
30    $pmUploadDirIsCorrect =
31      qq~<span class="good">$admin_txt{'163'}</span>~;
32}
33
34require Admin::ManageBoards;
35# Needed for attachment settings
36
37# Setting for gzip, if it is available
38my $compressgzip =
39  ( -e "$backupprogbin/gzip" && open GZIP, '| gzip -f' )
40  ? qq~\n  <option value="1" ${isselected($gzcomp == 1)}>$gztxt{'4'}</option>~
41  : q{};
42
43# Setting for Compress::Zlib, if it's available
44my $compresszlib;
45eval { require Compress::Zlib; Compress::Zlib::memGzip('test'); };
46if ( !$@ ) {
47    $compresszlib =
48qq~\n  <option value="2" ${isselected($gzcomp == 2)}>$gztxt{'5'}</option>~;
49}
50
51# RSS Defaults
52if ( $rss_disabled eq q{} ) { $rss_disabled = 0; }
53if ( $rss_limit    eq q{} ) { $rss_limit    = 10; }
54if ( $rss_message  eq q{} ) { $rss_message  = 1; }
55
56if ( ischecked2($checkspace) == 1) {
57   $checklabel = qq~$admin_txt{'checkspace'} <b><a href="$adminurl?action=checkspace">Disk Space Functions</a></b> $admin_txt{'checkspace2'}~;
58}
59else { $checklabel = qq~$admin_txt{'checkspace'}~ ;
60}
61
62# List of settings
63@settings = (
64    {
65        name  => $settings_txt{'permarss'},
66        id    => 'permarss',
67        items => [
68
69            # Permalinks
70            { header => $admin_txt{'24'}, },
71            {
72                description =>
73                  qq~<label for="accept_permalink">$admin_txt{'22'}</label>~,
74                input_html =>
75qq~<input type="checkbox" name="accept_permalink" id="accept_permalink" value="1" ${ischecked($accept_permalink)}/>~,
76                name     => 'accept_permalink',
77                validate => 'boolean',
78            },
79            {
80                description =>
81qq~<label for="symlink">$admin_txt{'25'}<br /><span class="small">$admin_txt{'26'}</span></label>~,
82                input_html =>
83qq~<input type="text" size="30" name="symlink" id="symlink" value="$symlink" />~,
84                name       => 'symlink',
85                validate   => 'text,null',
86                depends_on => ['accept_permalink'],
87            },
88            {
89                description =>
90                  qq~<label for="perm_domain">$admin_txt{'23'}</label>~,
91                input_html =>
92qq~<input type="text" size="30" name="perm_domain" id="perm_domain" value="$perm_domain" />~,
93                name       => 'perm_domain',
94                validate   => 'text,null',
95                depends_on => ['accept_permalink'],
96            },
97
98            # RSS
99            { header => $settings_txt{'rss'}, },
100            {
101                description =>
102                  qq~<label for="rss_disabled">$rss_txt{'1'}</label>~,
103                input_html =>
104qq~<input type="checkbox" name="rss_disabled" id="rss_disabled" value="1"${ischecked($rss_disabled)} />~,
105                name     => 'rss_disabled',
106                validate => 'boolean',
107            },
108            {
109                description => qq~<label for="rss_limit">$rss_txt{'2'}</label>~,
110                input_html =>
111qq~<input type="text" name="rss_limit" id="rss_limit" size="5" value="$rss_limit" />~,
112                name       => 'rss_limit',
113                validate   => 'number',
114                depends_on => ['!rss_disabled'],
115            },
116
117            {
118                description =>
119                  qq~<label for="showauthor">$rss_txt{'7'}</label>~,
120                input_html =>
121qq~<input type="checkbox" name="showauthor" id="showauthor"${ischecked($showauthor)} />~,
122                name       => 'showauthor',
123                validate   => 'boolean',
124                depends_on => ['!rss_disabled'],
125            },
126
127            {
128                description =>
129                  qq~<label for="rssemail">$rss_txt{'email'}</label>~,
130                input_html =>
131qq~<input type="text" size="30" name="rssemail" id="rssemail" value="$rssemail" />~,
132                name       => 'rssemail',
133                validate   => 'text,null',
134                depends_on => ['showauthor'],
135            },
136
137            {
138                description => qq~<label for="showdate">$rss_txt{'8'}</label>~,
139                input_html =>
140qq~<input type="checkbox" name="showdate" id="showdate"${ischecked($showdate)} />~,
141                name       => 'showdate',
142                validate   => 'boolean',
143                depends_on => ['!rss_disabled'],
144            },
145            {
146                description =>
147                  qq~<label for="rss_message">$rss_txt{'3'}</label>~,
148                input_html => qq~
149<select name="rss_message" id="rss_message" size="1">
150  <option value="0" ${isselected($rss_message == 0)}>$rss_txt{'4'}</option>
151  <option value="1" ${isselected($rss_message == 1)}>$rss_txt{'5'}</option>
152  <option value="2" ${isselected($rss_message == 2)}>$rss_txt{'6'}</option>
153</select>~,
154                name       => 'rss_message',
155                validate   => 'number',
156                depends_on => ['!rss_disabled'],
157            },
158        ],
159    },
160    {
161        name  => $settings_txt{'email'},
162        id    => 'email',
163        items => [
164
165            # Email
166            { header => $settings_txt{'email'}, },
167            {
168                description =>
169                  qq~<label for="mailtype">$admin_txt{'404'}</label>~,
170                input_html => qq~
171<select name="mailtype" id="mailtype" size="1">
172  <option value="0" ${isselected($mailtype == 0)}>$smtp_txt{'sendmail'}</option>
173  <option value="1" ${isselected($mailtype == 1)}>$smtp_txt{'smtp'}</option>
174  <option value="2" ${isselected($mailtype == 2)}>$smtp_txt{'net'}</option>
175  <option value="3" ${isselected($mailtype == 3)}>$smtp_txt{'tslnet'}</option>
176</select>~,
177                name     => 'mailtype',
178                validate => 'number',
179            },
180            {
181                description =>
182                  qq~<label for="mailprog">$admin_txt{'354'}</label>~,
183                input_html =>
184qq~<input type="text" name="mailprog" id="mailprog" size="20" value="$mailprog" />~,
185                name     => 'mailprog',
186                validate => 'text,null',
187            },
188            {
189                description =>
190                  qq~<label for="smtp_server">$admin_txt{'407'}</label>~,
191                input_html =>
192qq~<input type="text" name="smtp_server" id="smtp_server" size="20" value="$smtp_server" />~,
193                name     => 'smtp_server',
194                validate => 'text,null',
195            },
196            {
197                description =>
198                  qq~<label for="smtp_auth_required">$smtp_txt{'1'}</label>~,
199                input_html => qq~
200<select name="smtp_auth_required" id="smtp_auth_required" size="1">
201  <option value="4" ${isselected($smtp_auth_required == 4)}>$smtp_txt{'auto'}</option>
202  <option value="3" ${isselected($smtp_auth_required == 3)}>$smtp_txt{'cram'}</option>
203  <option value="2" ${isselected($smtp_auth_required == 2)}>$smtp_txt{'login'}</option>
204  <option value="1" ${isselected($smtp_auth_required == 1)}>$smtp_txt{'plain'}</option>
205  <option value="0" ${isselected($smtp_auth_required == 0)}>$smtp_txt{'off'}</option>
206</select>~,
207                name     => 'smtp_auth_required',
208                validate => 'number',
209            },
210            {
211                description => qq~<label for="authuser">$smtp_txt{'3'}</label>~,
212                input_html =>
213qq~<input type="text" name="authuser" id="authuser" size="20" value="$authuser" />~,
214                name     => 'authuser',
215                validate => 'text,null',
216            },
217            {
218                description => qq~<label for="authpass">$smtp_txt{'4'}</label>~,
219                input_html =>
220qq~<input type="password" name="authpass" id="authpass" size="20" value="$authpass" />~,
221                name     => 'authpass',
222                validate => 'text,null',
223            },
224            {
225                description =>
226                  qq~<label for="webmaster_email">$admin_txt{'355'}</label>~,
227                input_html =>
228qq~<input type="text" name="webmaster_email" id="webmaster_email" size="35" value="$webmaster_email" />~,
229                name     => 'webmaster_email',
230                validate => 'text',
231            },
232
233            # New Member Notification
234            { header => $admin_txt{'366'}, },
235            {
236                description =>
237qq~<label for="new_member_notification">$admin_txt{'367'}</label>~,
238                input_html =>
239qq~<input type="checkbox" name="new_member_notification" id="new_member_notification" value="1"${ischecked($new_member_notification)} />~,
240                name     => 'new_member_notification',
241                validate => 'boolean',
242            },
243            {
244                description =>
245qq~<label for="new_member_notification_mail">$admin_txt{'368'}</label>~,
246                input_html =>
247qq~<input type="text" name="new_member_notification_mail" id="new_member_notification_mail" size="35" value="$new_member_notification_mail" />~,
248                name       => 'new_member_notification_mail',
249                validate   => 'text,null',
250                depends_on => ['new_member_notification']
251            },
252
253            # New Member Notification
254            { header => $admin_txt{'600'}, },
255            {
256                description =>
257                  qq~<label for="sendtopicmail">$admin_txt{'601'}</label>~,
258                input_html =>
259                  qq~<select name="sendtopicmail" id="sendtopicmail">
260                <option value="0"${isselected($sendtopicmail == 0)}>$admin_txt{'602'}</option>
261                <option value="1"${isselected($sendtopicmail == 1)}>$admin_txt{'603'}</option>
262                <option value="2"${isselected($sendtopicmail == 2)}>$admin_txt{'604'}</option>
263                <option value="3"${isselected($sendtopicmail == 3)}>$admin_txt{'605'}</option>
264            </select>~,
265                name     => 'sendtopicmail',
266                validate => 'number',
267            },
268        ],
269    },
270    {
271        name  => $settings_txt{'attachments'},
272        id    => 'attachments',
273        items => [
274            { header => $settings_txt{'post_attachments'}, },
275            {
276                description =>
277                  qq~$edit_paths_txt{'20'}<br />$settings_txt{'changeinpaths'}~,
278                input_html => $uploaddir,    # Non-changable setting
279            },
280            {
281                description => $settings_txt{'uploaddircorrect'},
282                input_html  => $uploaddiriscorrect
283                ,  # This is tested to see if it's valid at the top of the file.
284            },
285            {
286                description => $fatxt{'17'},
287                input_html =>
288qq~<input type="text" name="allowattach" id="allowattach" size="5" value="$allowattach" /> ~,
289                name     => 'allowattach',
290                validate => 'number',
291            },
292            {
293                description =>
294                  qq~<label for="allowguestattach">$fatxt{'18'}</label>~,
295                input_html =>
296qq~<input type="checkbox" name="allowguestattach" id="allowguestattach" value="1" ${ischecked($allowguestattach)}/>~,
297                name       => 'allowguestattach',
298                validate   => 'boolean',
299                depends_on => ['allowattach!=0'],
300            },
301            {
302                description =>
303                  qq~<label for="amdisplaypics">$fatxt{'16'}</label>~,
304                input_html =>
305qq~<input type="checkbox" name="amdisplaypics" id="amdisplaypics" value="1" ${ischecked($amdisplaypics)}/>~,
306                name       => 'amdisplaypics',
307                validate   => 'boolean',
308                depends_on => ['allowattach!=0'],
309            },
310            {
311                description => qq~<label for="checkext">$fatxt{'15'}</label>~,
312                input_html =>
313qq~<input type="checkbox" name="checkext" id="checkext" value="1" ${ischecked($checkext)}/>~,
314                name       => 'checkext',
315                validate   => 'boolean',
316                depends_on => ['allowattach!=0'],
317            },
318            {
319                description => qq~<label for="extensions">$fatxt{'14'}</label>~,
320                input_html =>
321q~<input type="text" name="extensions" id="extensions" size="35" value="~
322                  . join( q{ }, @ext ) . q~" />~,
323                name       => 'extensions',
324                validate   => 'text',
325                depends_on => [ 'allowattach!=0', 'checkext' ],
326            },
327            {
328                description => qq~<label for="limit">$fatxt{'12'}</label>~,
329                input_html =>
330qq~<input type="text" name="limit" id="limit" size="5" value="$limit" /> KB~,
331                name       => 'limit',
332                validate   => 'number',
333                depends_on => ['allowattach!=0'],
334            },
335            {
336                description => qq~<label for="dirlimit">$fatxt{'13'}</label>~,
337                input_html =>
338qq~<input type="text" name="dirlimit" id="dirlimit" size="5" value="$dirlimit" /> KB~,
339                name       => 'dirlimit',
340                validate   => 'number',
341                depends_on => ['allowattach!=0'],
342            },
343            {
344                description => qq~<label for="overwrite">$fatxt{'53'}</label>~,
345                input_html  => qq~
346            <select name="overwrite" id="overwrite" size="1">
347            <option value="0"${isselected($overwrite == 0)}>$fatxt{'54r'}</option>
348            <option value="1"${isselected($overwrite == 1)}>$fatxt{'54o'}</option>
349            <option value="2"${isselected($overwrite == 2)}>$fatxt{'54n'}</option>
350            </select>~,
351                name       => 'overwrite',
352                validate   => 'number',
353                depends_on => ['allowattach!=0'],
354            },
355            { header => $settings_txt{'pm_attachments'}, },
356            {
357                description =>
358                  qq~$edit_paths_txt{'20a'}<br />$settings_txt{'changeinpaths'}~,
359                input_html => $pmuploaddir,    # Non-changable setting
360            },
361            {
362                description => $settings_txt{'pmuploaddircorrect'},
363                input_html  => $pmUploadDirIsCorrect
364                ,  # This is tested to see if it's valid at the top of the file.
365            },
366            {
367                description => qq~<label for="allow_attach_im">$fatxt{'17a'}</label>~,
368                input_html =>
369qq~<input type="text" name="allowAttachIM" id="allow_attach_im" size="5" value="$allowAttachIM" /> ~,
370                name     => 'allowAttachIM',
371                validate => 'number',
372            },
373            {
374                description => qq~<label for="pm_attach_groups">$fatxt{'17b'}</label>~,
375                input_html => q~<select multiple="multiple" name="pmAttachGroups" id="pm_attach_groups" size="8">~ . DrawPerms($pmAttachGroups, 0) . q~</select>~,
376                name => 'pmAttachGroups',
377                validate => 'text,null',
378                depends_on => ['allowAttachIM!=0'],
379            },
380            {
381                description =>
382                  qq~<label for="pmdisplaypics">$fatxt{'16a'}</label>~,
383                input_html =>
384qq~<input type="checkbox" name="pmDisplayPics" id="pmdisplaypics" value="1" ${ischecked($pmDisplayPics)}/>~,
385                name       => 'pmDisplayPics',
386                validate   => 'boolean',
387                depends_on => ['allowAttachIM!=0'],
388            },
389            {
390                description => qq~<label for="pmcheckext">$fatxt{'15'}</label>~,
391                input_html =>
392qq~<input type="checkbox" name="pmCheckExt" id="pmcheckext" value="1" ${ischecked($pmCheckExt)}/>~,
393                name       => 'pmCheckExt',
394                validate   => 'boolean',
395                depends_on => ['allowAttachIM!=0'],
396            },
397            {
398                description => qq~<label for="pmextensions">$fatxt{'14a'}</label>~,
399                input_html =>
400q~<input type="text" name="pmAttachExt" id="pmextensions" size="35" value="~
401                  . join( q{ }, @pmAttachExt ) . q~" />~,
402                name       => 'pmAttachExt',
403                validate   => 'text',
404                depends_on => [ 'allowAttachIM!=0', 'pmCheckExt' ],
405            },
406            {
407                description => qq~<label for="pmfilelimit">$fatxt{'12a'}</label>~,
408                input_html =>
409qq~<input type="text" name="pmFileLimit" id="pmfilelimit" size="5" value="$pmFileLimit" /> KB~,
410                name       => 'pmFileLimit',
411                validate   => 'number',
412                depends_on => ['allowAttachIM!=0'],
413            },
414            {
415                description => qq~<label for="pmdirlimit">$fatxt{'13a'}</label>~,
416                input_html =>
417qq~<input type="text" name="pmDirLimit" id="pmdirlimit" size="5" value="$pmDirLimit" /> KB~,
418                name       => 'pmDirLimit',
419                validate   => 'number',
420                depends_on => ['allowAttachIM!=0'],
421            },
422            {
423                description => qq~<label for="pmfileoverwrite">$fatxt{'53'}</label>~,
424                input_html  => qq~
425            <select name="pmFileOverwrite" id="pmfileoverwrite" size="1">
426            <option value="0"${isselected($pmFileOverwrite == 0)}>$fatxt{'54r'}</option>
427            <option value="1"${isselected($pmFileOverwrite == 1)}>$fatxt{'54o'}</option>
428            <option value="2"${isselected($pmFileOverwrite == 2)}>$fatxt{'54n'}</option>
429            </select>~,
430                name       => 'pmFileOverwrite',
431                validate   => 'number',
432                depends_on => ['allowAttachIM!=0'],
433            },
434        ],
435    },
436    {
437        name  => $settings_txt{'images'},
438        id    => 'images',
439        items => [
440            { header => $admin_txt{'471'}, },
441            {
442                description =>
443                  qq~<label for="max_avatar_width">$admin_txt{'472'}</label>~,
444                input_html =>
445qq~<input type="text" name="max_avatar_width" id="max_avatar_width" size="5" value="$max_avatar_width" /> pixel~,
446                name     => 'max_avatar_width',
447                validate => 'number',
448            },
449            {
450                description =>
451                  qq~<label for="max_avatar_height">$admin_txt{'473'}</label>~,
452                input_html =>
453qq~<input type="text" name="max_avatar_height" id="max_avatar_height" size="5" value="$max_avatar_height" /> pixel~,
454                name     => 'max_avatar_height',
455                validate => 'number',
456            },
457            {
458                description =>
459qq~<label for="fix_avatar_img_size">$admin_txt{'473x'}</label>~,
460                input_html =>
461qq~<input type="checkbox" name="fix_avatar_img_size" id="fix_avatar_img_size" value="1"${ischecked($fix_avatar_img_size)} />~,
462                name     => 'fix_avatar_img_size',
463                validate => 'boolean',
464            },
465            {
466                description => qq~<label for="max_avatarml_width">$admin_txt{'473a'}</label>~,
467                input_html => qq~<input type="text" name="max_avatarml_width" id="max_avatarml_width" size="5" value="$max_avatarml_width" /> pixel~,
468                name => 'max_avatarml_width',
469                validate => 'number',
470            },
471            {
472                description => qq~<label for="max_avatarml_height">$admin_txt{'473b'}</label>~,
473                input_html => qq~<input type="text" name="max_avatarml_height" id="max_avatarml_height" size="5" value="$max_avatarml_height" /> pixel~,
474                name => 'max_avatarml_height',
475                validate => 'number',
476            },
477            {
478                description => qq~<label for="fix_avatarml_img_size">$admin_txt{'473c'}</label>~,
479                input_html => qq~<input type="checkbox" name="fix_avatarml_img_size" id="fix_avatarml_img_size" value="1"${ischecked($fix_avatarml_img_size)} />~,
480                name => 'fix_avatarml_img_size',
481                validate => 'boolean',
482            },
483            {
484                description =>
485                  qq~<label for="max_post_img_width">$admin_txt{'474'}</label>~,
486                input_html =>
487qq~<input type="text" name="max_post_img_width" id="max_post_img_width" size="5" value="$max_post_img_width" /> pixel~,
488                name     => 'max_post_img_width',
489                validate => 'number',
490            },
491            {
492                description =>
493qq~<label for="max_post_img_height">$admin_txt{'475'}</label>~,
494                input_html =>
495qq~<input type="text" name="max_post_img_height" id="max_post_img_height" size="5" value="$max_post_img_height" /> pixel~,
496                name     => 'max_post_img_height',
497                validate => 'number',
498            },
499            {
500                description =>
501                  qq~<label for="fix_post_img_size">$admin_txt{'475x'}</label>~,
502                input_html =>
503qq~<input type="checkbox" name="fix_post_img_size" id="fix_post_img_size" value="1"${ischecked($fix_post_img_size)} />~,
504                name     => 'fix_post_img_size',
505                validate => 'boolean',
506            },
507            {
508                description =>
509qq~<label for="max_signat_img_width">$admin_txt{'476'}</label>~,
510                input_html =>
511qq~<input type="text" name="max_signat_img_width" id="max_signat_img_width" size="5" value="$max_signat_img_width" /> pixel~,
512                name     => 'max_signat_img_width',
513                validate => 'number',
514            },
515            {
516                description =>
517qq~<label for="max_signat_img_height">$admin_txt{'477'}</label>~,
518                input_html =>
519qq~<input type="text" name="max_signat_img_height" id="max_signat_img_height" size="5" value="$max_signat_img_height" /> pixel~,
520                name     => 'max_signat_img_height',
521                validate => 'number',
522            },
523            {
524                description =>
525qq~<label for="fix_signat_img_size">$admin_txt{'477x'}</label>~,
526                input_html =>
527qq~<input type="checkbox" name="fix_signat_img_size" id="fix_signat_img_size" value="1"${ischecked($fix_signat_img_size)} />~,
528                name     => 'fix_signat_img_size',
529                validate => 'boolean',
530            },
531            {
532                description =>
533qq~<label for="max_attach_img_width">$admin_txt{'478'}</label>~,
534                input_html =>
535qq~<input type="text" name="max_attach_img_width" id="max_attach_img_width" size="5" value="$max_attach_img_width" /> pixel~,
536                name     => 'max_attach_img_width',
537                validate => 'number',
538            },
539            {
540                description =>
541qq~<label for="max_attach_img_height">$admin_txt{'479'}</label>~,
542                input_html =>
543qq~<input type="text" name="max_attach_img_height" id="max_attach_img_height" size="5" value="$max_attach_img_height" /> pixel~,
544                name     => 'max_attach_img_height',
545                validate => 'number',
546            },
547            {
548                description =>
549qq~<label for="fix_attach_img_size">$admin_txt{'479x'}</label>~,
550                input_html =>
551qq~<input type="checkbox" name="fix_attach_img_size" id="fix_attach_img_size" value="1"${ischecked($fix_attach_img_size)} />~,
552                name     => 'fix_attach_img_size',
553                validate => 'boolean',
554            },
555            {
556                description =>
557qq~<label for="max_brd_img_width">$admin_txt{'brd_pic_w'}</label>~,
558                input_html =>
559qq~<input type="text" name="max_brd_img_width" id="max_brd_img_width" size="5" value="$max_brd_img_width" /> pixel~,
560                name     => 'max_brd_img_width',
561                validate => 'number',
562            },
563            {
564                description =>
565qq~<label for="max_brd_img_height">$admin_txt{'brd_pic_h'}</label>~,
566                input_html =>
567qq~<input type="text" name="max_brd_img_height" id="max_brd_img_height" size="5" value="$max_brd_img_height" /> pixel~,
568                name     => 'max_brd_img_height',
569                validate => 'number',
570            },
571            {
572                description =>
573qq~<label for="fix_brd_img_size">$admin_txt{'brd_pic'}</label>~,
574                input_html =>
575qq~<input type="checkbox" name="fix_brd_img_size" id="fix_brd_img_size" value="1"${ischecked($fix_brd_img_size)} />~,
576                name     => 'fix_brd_img_size',
577                validate => 'boolean',
578            },
579            {
580                description =>
581                  qq~<label for="img_greybox">$admin_txt{'479a'}</label>~,
582                input_html => qq~
583                <select name="img_greybox" id="img_greybox">
584                    <option value="0"${isselected(!$img_greybox)}>$admin_txt{'479b'}</option>
585                    <option value="1"${isselected($img_greybox == 1)}>$admin_txt{'479c'}</option>
586                    <option value="2"${isselected($img_greybox == 2)}>$admin_txt{'479d'}</option>
587                </select>~,
588                name     => 'img_greybox',
589                validate => 'number',
590            },
591        ]
592    },
593    {
594        name  => $settings_txt{'advanced'},
595        id    => 'advanced',
596        items => [
597            { header => $settop_txt{'5'}, },
598            {
599                description => qq~<label for="gzcomp">$gztxt{'1'}</label>~,
600                input_html  => qq~
601<select name="gzcomp" id="gzcomp" size="1">
602  <option value="0" ${isselected($gzcomp == 0)}>$gztxt{'3'}</option>$compressgzip$compresszlib
603</select>~,
604                name     => 'gzcomp',
605                validate => 'number',
606            },
607            {
608                description => qq~<label for="gzforce">$gztxt{'2'}</label>~,
609                input_html =>
610qq~<input type="checkbox" name="gzforce" id="gzforce" value="1" ${ischecked($gzforce)}/>~,
611                name       => 'gzforce',
612                validate   => 'boolean',
613                depends_on => ['gzcomp!=0'],
614            },
615            {
616                description =>
617                  qq~<label for="cachebehaviour">$admin_txt{'802'}</label>~,
618                input_html =>
619qq~<input type="checkbox" name="cachebehaviour" id="cachebehaviour" value="1" ${ischecked($cachebehaviour)}/>~,
620                name     => 'cachebehaviour',
621                validate => 'boolean',
622            },
623            {
624                description =>
625                  qq~<label for="enableclicklog">$admin_txt{'803'}</label>~,
626                input_html =>
627qq~<input type="checkbox" name="enableclicklog" id="enableclicklog" value="1" ${ischecked($enableclicklog)}/>~,
628                name     => 'enableclicklog',
629                validate => 'boolean',
630            },
631            {
632                description =>
633                  qq~<label for="ClickLogTime">$admin_txt{'690'}</label>~,
634                input_html =>
635qq~<input type="text" name="ClickLogTime" id="ClickLogTime" size="5" value="$ClickLogTime" />~,
636                name       => 'ClickLogTime',
637                validate   => 'number',
638                depends_on => ['enableclicklog'],
639            },
640            {
641                description =>
642                  qq~<label for="max_log_days_old">$admin_txt{'376'}</label>~,
643                input_html =>
644qq~<input type="text" name="max_log_days_old" id="max_log_days_old" size="5" value="$max_log_days_old" />~,
645                name     => 'max_log_days_old',
646                validate => 'number',
647            },
648            {
649                description =>
650                  qq~<label for="maxrecentdisplay">$floodtxt{'5'}</label>~,
651                input_html =>
652qq~<input type="text" name="maxrecentdisplay" id="maxrecentdisplay" size="5" value="$maxrecentdisplay" />~,
653                name     => 'maxrecentdisplay',
654                validate => 'fullnumber',
655            },
656            {
657                description =>
658                  qq~<label for="maxrecentdisplay_t">$floodtxt{'5a'}</label>~,
659                input_html =>
660qq~<input type="text" name="maxrecentdisplay_t" id="maxrecentdisplay_t" size="5" value="$maxrecentdisplay_t" />~,
661                name     => 'maxrecentdisplay_t',
662                validate => 'fullnumber',
663            },
664            {
665                description =>
666                  qq~<label for="maxsearchdisplay">$floodtxt{'6'}</label>~,
667                input_html =>
668qq~<input type="text" name="maxsearchdisplay" id="maxsearchdisplay" size="5" value="$maxsearchdisplay" />~,
669                name     => 'maxsearchdisplay',
670                validate => 'fullnumber',
671            },
672            {
673                description =>
674                  qq~<label for="OnlineLogTime">$amv_txt{'13'}</label>~,
675                input_html =>
676qq~<input type="text" name="OnlineLogTime" id="OnlineLogTime" size="5" value="$OnlineLogTime" />~,
677                name     => 'OnlineLogTime',
678                validate => 'number',
679            },
680            {
681                description =>
682                  qq~<label for="lastonlineinlink">$amv_txt{'25'}</label>~,
683                input_html =>
684qq~<input type="checkbox" name="lastonlineinlink" id="lastonlineinlink" value="1" ${ischecked($lastonlineinlink)}/>~,
685                name     => 'lastonlineinlink',
686                validate => 'boolean',
687            },
688            { header => $errorlog{'25'}, },
689            {
690                description =>
691                  qq~<label for="elenable">$errorlog{'22'}</label>~,
692                input_html =>
693qq~<input type="checkbox" name="elenable" id="elenable" value="1" ${ischecked($elenable)}/>~,
694                name     => 'elenable',
695                validate => 'boolean',
696            },
697            {
698                description =>
699                  qq~<label for="elrotate">$errorlog{'23'}</label>~,
700                input_html =>
701qq~<input type="checkbox" name="elrotate" id="elrotate" value="1" ${ischecked($elrotate)}/>~,
702                name       => 'elrotate',
703                validate   => 'boolean',
704                depends_on => ['elenable'],
705            },
706            {
707                description => qq~<label for="elmax">$errorlog{'24'}</label>~,
708                input_html =>
709qq~<input type="text" name="elmax" id="elmax" size="5" value="$elmax" />~,
710                name       => 'elmax',
711                validate   => 'number',
712                depends_on => [ 'elenable', 'elrotate' ],
713            },
714            { header => $settings_txt{'debug'}, },
715            {
716                description =>
717qq~<label for="debug">$admin_txt{'999'}<br /><span class="small">$admin_txt{'999a'}</span></label>~,
718                input_html => qq~
719<select name="debug" id="debug" size="1">
720  <option value="0" ${isselected($debug == 0)}>$admin_txt{'nodebug'}</option>
721  <option value="1" ${isselected($debug == 1)}>$admin_txt{'alldebug'}</option>
722  <option value="2" ${isselected($debug == 2)}>$admin_txt{'admindebug'}</option>
723  <option value="3" ${isselected($debug == 3)}>$admin_txt{'loadtime'}</option>
724</select>~,
725                name     => 'debug',
726                validate => 'number',
727            },
728            { header => $settings_txt{'files'}, },
729            {
730                description =>
731                  qq~<label for="use_flock">$admin_txt{'391'}</label>~,
732                input_html => qq~
733<select name="use_flock" id="use_flock" size="1">
734  <option value="0" ${isselected($use_flock == 0)}>$admin_txt{'401'}</option>
735  <option value="1" ${isselected($use_flock == 1)}>$admin_txt{'402'}</option>
736  <option value="2" ${isselected($use_flock == 2)}>$admin_txt{'403'}</option>
737</select>~,
738                name     => 'use_flock',
739                validate => 'boolean',
740            },
741            {
742                description =>
743                  qq~<label for="faketruncation">$admin_txt{'630'}</label>~,
744                input_html =>
745qq~<input type="checkbox" name="faketruncation" id="faketruncation" value="1" ${ischecked($faketruncation)}/>~,
746                name     => 'faketruncation',
747                validate => 'boolean',
748            },
749            { header => $settings_txt{'freedisk2'}, },
750            {
751                description =>
752                  qq~<label for="checkspace">$checklabel</label>~,
753                input_html =>
754qq~<input type="checkbox" name="checkspace" id="checkspace" value="1" ${ischecked($checkspace)}/>~,
755                name       => 'checkspace',
756                validate   => 'boolean',
757            },
758        ],
759    },
760);
761
762# Routine to save them
763sub SaveSettings {
764    my %settings = @_;
765    $settings{'extensions'} =~ s/[^\ A-Za-z0-9_]//gsm;
766    @ext = split /\s+/xsm, $settings{'extensions'};
767    $settings{'pmAttachExt'} =~ s/[^\ A-Za-z0-9_]//gsm;
768    @pmAttachExt = split /\s+/xsm, $settings{'pmAttachExt'};
769
770    SaveSettingsTo('Settings.pm', %settings);
771    return;
772}
773
774sub ischecked2 {
775    my ($inp) = @_;
776
777    # Return a ref so we can be used like ${ischecked($var)} inside a string
778    if ($inp == 1 ) { return 1 ;}
779    return;
780}
781
7821;
783