1#!/usr/local/bin/perl --
2# $Id: YaBB Setup $
3# $HeadURL: YaBB $
4# $Source: /Setup.pl $
5###############################################################################
6# Setup.pl                                                                    #
7# $Date: 12.02.14 $                                                           #
8###############################################################################
9# YaBB: Yet another Bulletin Board                                            #
10# Open-Source Community Software for Webmasters                               #
11# Version:        YaBB 2.6.11                                                 #
12# Packaged:       December 2, 2014                                            #
13# Distributed by: http://www.yabbforum.com                                    #
14# =========================================================================== #
15# Copyright (c) 2000-2014 YaBB (www.yabbforum.com) - All Rights Reserved.     #
16# Software by:  The YaBB Development Team                                     #
17#               with assistance from the YaBB community.                      #
18###############################################################################
19# use strict;
20# use warnings;
21no warnings qw(uninitialized once redefine);
22use CGI::Carp qw(fatalsToBrowser);
23use English qw(-no_match_vars);
24our $VERSION = '2.6.11';
25
26$setupplver = 'YaBB 2.6.11 $Revision: 1619 $';
27$yymycharset  = 'UTF-8';
28
29# conversion will stop after $max_process_time
30# in seconds, than the browser will call the script
31# again until all is done. Don't put it too high
32# or you will run into server or browser timeout
33$max_process_time = 20;
34$time_to_jump     = time() + $max_process_time;
35
36if ( $ENV{'SERVER_SOFTWARE'} =~ /IIS/sm ) {
37    $yyIIS = 1;
38    $PROGRAM_NAME =~ m{(.*)(\\|/)}xsm;
39    $yypath = $1;
40    $yypath =~ s/\\/\//gxsm;
41    chdir $yypath;
42    push @INC, $yypath;
43}
44
45### Requirements and Errors ###
46my $script_root = $ENV{'SCRIPT_FILENAME'};
47if( ! $script_root ) {
48        $script_root = $ENV{'PATH_TRANSLATED'};
49}
50$script_root =~ s/\\/\//gxsm;
51$script_root =~ s/\/Setup\.(pl|cgi)//igxsm;
52
53if    ( -e './Paths.pm' )            { require Paths; }
54elsif ( -e "$script_root/Paths.pm" ) { require "$script_root/Paths.pm"; }
55elsif ( -e "$script_root/Variables/Paths.pm" ) {
56    require "$script_root/Variables/Paths.pm";
57}
58
59# Check if it's blank Paths.pm or filled in one
60if ( !$lastsaved ) {
61    $boardsdir = './Boards';
62    $sourcedir = './Sources';
63    $memberdir = './Members';
64    $vardir    = './Variables';
65}
66
67if   ( -e 'YaBB.cgi' ) { $yyext = 'cgi'; }
68else                   { $yyext = 'pl'; }
69if   ($boardurl) { $set_cgi = "$boardurl/Setup.$yyext"; }
70else             { $set_cgi = "Setup.$yyext"; }
71
72# Make sure the module path is present
73push @INC, './Modules';
74
75require Sources::Subs;
76require Sources::System;
77require Sources::Load;
78require Sources::DateTime;
79
80$windowbg    = '#dee4ec';
81$windowbg2   = '#edeff4';
82$header      = '#3673b3';
83$catbg       = '#195392';
84$maintext_23 = 'Unable to open';
85
86$yymenu    = q{};
87$yytabmenu = q~ ~;
88
89if ( -e "$vardir/Setup.lock" ) {
90    FoundSetupLock();
91        }
92#############################################
93# Setup starts here                         #
94#############################################
95
96if ( !$action ) {
97    $rand_integer   = int rand 99_999;
98    $rand_cook_user = "Y2User-$rand_integer";
99    $rand_cook_pass = "Y2Pass-$rand_integer";
100    $rand_cook_sess = "Y2Sess-$rand_integer";
101    $rand_cook_sort = "Y2tsort-$rand_integer";
102    $rand_cook_view = "Y2view-$rand_integer";
103
104    fopen( COOKFILE, ">$vardir/cook.txt" )
105      || setup_fatal_error( "$maintext_23 $vardir/cook.txt: ", 1 );
106    print {COOKFILE} "$rand_cook_user\n" or croak 'cannot print cook.txt';
107    print {COOKFILE} "$rand_cook_pass\n" or croak 'cannot print cook.txt';
108    print {COOKFILE} "$rand_cook_sess\n" or croak 'cannot print cook.txt';
109    print {COOKFILE} "$rand_cook_sort\n" or croak 'cannot print cook.txt';
110    print {COOKFILE} "$rand_cook_view\n" or croak 'cannot print cook.txt';
111    fclose(COOKFILE);
112
113    adminlogin();
114}
115
116fopen( COOKFILE, "$vardir/cook.txt" )
117  || setup_fatal_error( "$maintext_23 $vardir/cook.txt: ", 1 );
118@cookinfo = <COOKFILE>;
119fclose(COOKFILE);
120chomp @cookinfo;
121
122$cookieusername     = "$cookinfo[0]";
123$cookiepassword     = "$cookinfo[1]";
124$cookiesession_name = "$cookinfo[2]";
125$cookietsort        = "$cookinfo[3]";
126$cookieview         = "$cookinfo[4]";
127if    ( $action eq 'adminlogin2' ) { adminlogin2(); }
128elsif ( $action eq 'setup1' )      { autoconfig(); }
129elsif ( $action eq 'setup2' ) {
130    BrdInstall();
131    MemInstall();
132    MesInstall();
133    VarInstall();
134    save_paths();
135}
136elsif ( $action eq 'checkmodules' ) { SetInstall2(); checkmodules(); }
137elsif ( $action eq 'setinstall' )   { SetInstall(); }
138elsif ( $action eq 'setinstall2' )  { SetInstall2(); }
139elsif ( $action eq 'setup3' )       { CheckInstall(); }
140elsif ( $action eq 'ready' )        { ready(); }
141
142$yymain = qq~End of script reached without action: $action~;
143SimpleOutput();
144
145#############################################
146# setup subroutines start here              #
147#############################################
148
149sub adminlogin {
150    open LICENSE, '< license.txt' or croak 'cannot load License.';
151    my $license = do { local $/; <LICENSE>; };
152    close LICENSE or croak 'cannot close License';
153
154    $yymain .= qq~
155    <div id="license" style="width:50em; height:40em; overflow:auto; margin:2em auto 0 auto; border:thin #000 solid; padding:1em; background-color:#fff">$license</div>
156    <form action="$set_cgi?action=adminlogin2" method="post" name="loginform">
157    <div style="width:25em; border: thin #000 solid; margin:2em auto; padding:1em; text-align:center; background-color:#fff">
158        <label for="password">Enter the password for user <b>admin</b> to acknowledge acceptance of the above license and to gain access to the Setup Utility</label>
159        <p><input type="password" name="password" id="password" size="30" />
160         <input type="hidden" name="username" value="admin" />
161         <input type="hidden" name="cookielength" value="1500" /></p>
162        <p><input type="submit" value="Submit" /></p>
163    </div>
164    </form>
165    <script type="text/javascript">
166        document.loginform.password.focus();
167    </script>
168      ~;
169
170    return SimpleOutput();
171}
172
173sub adminlogin2 {
174    if ( $FORM{'password'} eq q{} ) {
175        setup_fatal_error('Setup Error: You should fill in your password!');
176    }
177
178    # No need to pass a form variable setup is only used by user: admin
179    $username = 'admin';
180
181    if ( -e "$memberdir/$username.vars" ) {
182        $Group{'Administrator'} =
183          'Forum Administrator|5|staradmin.png|red|0|0|0|0|0|0';
184        LoadUser($username);
185        my $spass = ${ $uid . $username }{'password'};
186        $cryptpass = encode_password( $FORM{'password'} );
187        if ( $spass ne $cryptpass && $spass ne $FORM{'password'} ) {
188            setup_fatal_error('Setup Error: Login Failed!');
189        }
190    }
191    else {
192        setup_fatal_error(
193qq~Setup Error: Could not find the admin data file in $memberdir! Please check your access rights.~
194        );
195    }
196
197    if ( $FORM{'cookielength'} < 1 || $FORM{'cookielength'} > 9999 ) {
198        $FORM{'cookielength'} = $Cookie_Length;
199    }
200    if ( !$FORM{'cookieneverexp'} ) { $ck{'len'} = "\+$FORM{'cookielength'}m"; }
201    else { $ck{'len'} = 'Sunday, 17-Jan-2038 00:00:00 GMT'; }
202    $password = encode_password("$FORM{'password'}");
203    ${ $uid . $username }{'session'} = encode_password($user_ip);
204    chomp ${ $uid . $username }{'session'};
205
206# check if forum.control can be open (needed in &LoadBoardControl used by &LoadUserSettings)
207    fopen( FORUMCONTROL, "$boardsdir/forum.control" )
208      || setup_fatal_error( "$maintext_23 $boardsdir/forum.control: ", 1 );
209    fclose(FORUMCONTROL);
210
211    UpdateCookie(
212        'write',     "$username",
213        "$password", "${$uid.$username}{'session'}",
214        q{/},        "$ck{'len'}"
215    );
216    LoadUserSettings();
217    $yymain .= qq~
218    <form action="$set_cgi?action=setup1" method="post">
219    <div style="width:50em; border: thin #000 solid; margin:2em auto; padding:1em; text-align:center; background-color:#fff">
220        You are now logged in, <i>${$uid.$username}{'realname'}</i>!<br />Click 'Continue Set Up' to proceed with the Setup.
221        <p><input type="submit" value="Continue Set Up" /></p>
222    </div>
223    </form>
224~;
225
226    return SimpleOutput();
227}
228
229sub autoconfig {
230    LoadCookie();    # Load the user's cookie (or set to guest)
231    LoadUserSettings();
232    if ( !$iamadmin ) {
233        setup_fatal_error(
234q~Setup Error: You have no access rights to this function. Only user "admin" has if logged in!~
235        );
236    }
237
238    # do some fancy auto sensing
239    $template = 'default';
240
241    $yabbfiles = 'yabbfiles';
242
243    # find the script url
244    # Getting the last known url one way or another
245    if ( $ENV{HTTP_REFERER} ) {
246        $tempboardurl = $ENV{HTTP_REFERER};
247    }
248    elsif ( $ENV{HTTP_HOST} && $ENV{REQUEST_URI} ) {
249        $tempboardurl = qq~http://$ENV{HTTP_HOST}$ENV{REQUEST_URI}~;
250    }
251    $lastslash = rindex $tempboardurl, q{/};
252    $foundboardurl = substr $tempboardurl, 0, $lastslash;
253
254    ## find the webroot ##
255    if ( $ENV{'SERVER_SOFTWARE'} =~ /IIS/sm ) {
256        $this_script = "$ENV{'SCRIPT_NAME'}";
257        $_           = $PROGRAM_NAME;
258        s/\\/\//gxsm;
259        s/$this_script//xsm;
260        $searchroot = $_ . q{/};
261    }
262    else {
263        $searchroot = $ENV{'DOCUMENT_ROOT'};
264        s/\\/\//gxsm;
265    }
266    $firstslash = index $tempboardurl, q{/}, 8;
267    $html_baseurl = substr $tempboardurl, 0, $firstslash;
268
269    # try to find the yabb html basedir directly
270    if ( -d "$searchroot/$yabbfiles" ) {
271        $fnd_html_root = "$html_baseurl/$yabbfiles";
272        $fnd_htmldir   = "$searchroot/$yabbfiles";
273        $fnd_htmldir =~ s/\/\//\//gxsm;
274        opendir HTMLDIR, $fnd_htmldir;
275        @contents = readdir HTMLDIR;
276        closedir HTMLDIR;
277        foreach my $name (@contents) {
278            if ( lc($name) eq 'avatars' && -d "$fnd_htmldir/$name" ) {
279                $fnd_facesdir = "$fnd_htmldir/$name";
280                $fnd_facesurl = "$fnd_html_root/$name";
281            }
282
283            if ( lc($name) eq 'attachments' && -d "$fnd_htmldir/$name" ) {
284                $fnd_uploaddir = "$fnd_htmldir/$name";
285                $fnd_uploadurl = "$fnd_html_root/$name";
286            }
287
288            if ( lc($name) eq 'pmattachments' && -d "$fnd_htmldir/$name" ) {
289                $fnd_pmuploaddir = "$fnd_htmldir/$name";
290                $fnd_pmuploadurl = "$fnd_html_root/$name";
291            }
292            if ( lc($name) eq 'modimages' && -d "$fnd_htmldir/$name" ) {
293                $fnd_modimgdir = "$fnd_htmldir/$name";
294                $fnd_modimgurl = "$fnd_html_root/$name";
295            }
296        }
297    }
298    else {
299        opendir HTMLDIR, $searchroot;
300        @contents = readdir HTMLDIR;
301        closedir HTMLDIR;
302        foreach my $name (@contents) {
303            if ( -d "$searchroot/$name" ) {
304                opendir HTMLDIR, "$searchroot/$name";
305                @subcontents = readdir HTMLDIR;
306                closedir HTMLDIR;
307                foreach my $subname (@subcontents) {
308                    if ( lc($subname) eq lc($yabbfiles)
309                        && ( -d "$searchroot/$name/$subname" ) )
310                    {
311                        $fnd_htmldir = "$searchroot/$name/$subname";
312                        $fnd_htmldir =~ s/\/\//\//gxsm;
313                        $fnd_html_root = "$html_baseurl/$name/$subname";
314                    }
315                }
316            }
317        }
318        opendir HTMLDIR, $fnd_htmldir;
319        @tcontents = readdir HTMLDIR;
320        closedir HTMLDIR;
321        foreach my $tname (@tcontents) {
322            if ( lc($tname) eq 'avatars' && -d "$fnd_htmldir/$tname" ) {
323                $fnd_facesdir = "$fnd_htmldir/$tname";
324                $fnd_facesurl = "$fnd_html_root/$tname";
325            }
326
327            if ( lc($tname) eq 'attachments' && -d "$fnd_htmldir/$tname" ) {
328                $fnd_uploaddir = "$fnd_htmldir/$tname";
329                $fnd_uploadurl = "$fnd_html_root/$tname";
330            }
331            if ( lc($tname) eq 'pmattachments' && -d "$fnd_htmldir/$tname" ) {
332                $fnd_pmuploaddir = "$fnd_htmldir/$tname";
333                $fnd_pmuploadurl = "$fnd_html_root/$tname";
334            }
335            if ( lc($tname) eq 'modimages' && -d "$fnd_htmldir/$tname" ) {
336                $fnd_modimgdir = "$fnd_htmldir/$tname";
337                $fnd_modimgurl = "$fnd_html_root/$tname";
338            }
339        }
340    }
341    $fnd_boardurl = $foundboardurl;
342    $fnd_boarddir = q{.};
343    if ( -d "$fnd_boarddir/Boards" ) {
344        $fnd_boardsdir = "$fnd_boarddir/Boards";
345    }
346    if ( -d "$fnd_boarddir/Messages" ) {
347        $fnd_datadir = "$fnd_boarddir/Messages";
348    }
349    if ( -d "$fnd_boarddir/Members" ) {
350        $fnd_memberdir = "$fnd_boarddir/Members";
351    }
352    if ( -d "$fnd_boarddir/Sources" ) {
353        $fnd_sourcedir = "$fnd_boarddir/Sources";
354    }
355    if ( -d "$fnd_boarddir/Admin" ) { $fnd_admindir = "$fnd_boarddir/Admin"; }
356    if ( -d "$fnd_boarddir/Variables" ) {
357        $fnd_vardir = "$fnd_boarddir/Variables";
358    }
359    if ( -d "$fnd_boarddir/Languages" ) {
360        $fnd_langdir = "$fnd_boarddir/Languages";
361    }
362    if ( -d "$fnd_boarddir/Help" ) { $fnd_helpfile = "$fnd_boarddir/Help"; }
363    if ( -d "$fnd_boarddir/Templates" ) {
364        $fnd_templatesdir = "$fnd_boarddir/Templates";
365    }
366
367    if ( !$lastsaved ) {
368        $boardurl     = $fnd_boardurl;
369        $boarddir     = $fnd_boarddir;
370        $htmldir      = $fnd_htmldir;
371        $uploaddir    = $fnd_uploaddir;
372        $uploadurl    = $fnd_uploadurl;
373        $pmuploaddir    = $fnd_pmuploaddir;
374        $pmuploadurl    = $fnd_pmuploadurl;
375        $yyhtml_root  = $fnd_html_root;
376        $datadir      = $fnd_datadir;
377        $boardsdir    = $fnd_boardsdir;
378        $memberdir    = $fnd_memberdir;
379        $sourcedir    = $fnd_sourcedir;
380        $admindir     = $fnd_admindir;
381        $vardir       = $fnd_vardir;
382        $langdir      = $fnd_langdir;
383        $helpfile     = $fnd_helpfile;
384        $templatesdir = $fnd_templatesdir;
385
386        $facesdir = $fnd_facesdir;
387        $facesurl = $fnd_facesurl;
388        $modimgdir = $fnd_modimgdir;
389        $modimgurl = $fnd_modimgurl;
390    }
391
392    # Simple output of env variables, for troubleshooting
393    if ( $ENV{'SCRIPT_FILENAME'} ne q{} ) {
394        $support_env_path = $ENV{'SCRIPT_FILENAME'};
395    }
396    elsif ( $ENV{'PATH_TRANSLATED'} ne q{} ) {
397        $support_env_path = $ENV{'PATH_TRANSLATED'};
398    }
399
400    # Remove Setupl.pl and cgi - and also nph- for buggy IIS.
401    $support_env_path =~ s/(nph-)?Setup.(pl|cgi)//igsm;
402    $support_env_path =~ s/\/\Z//xsm;
403
404    # replace \'s with /'s for Windows Servers
405    $support_env_path =~ s/\\/\//gxsm;
406
407    # Generate Screen
408    if ( -e "$langdir/$language/Main.lng" ) {
409        require "$langdir/$use_lang/Main.lng";
410    }
411    elsif ( -e "$langdir/$lang/Main.lng" ) {
412        require "$langdir/$lang/Main.lng";
413    }
414    elsif ( -e "$langdir/English/Main.lng" ) {
415        require "$langdir/English/Main.lng";
416    }
417
418    $mylastdate = timeformat($lastdate);
419
420    $yymain .= qq~
421<form action="$set_cgi?action=setup2" method="post" name="auto_settings" style="display: inline;">
422<script type="text/javascript">
423function abspathfill(brddir) {
424      document.auto_settings.preboarddir.value = brddir;
425}
426function autofill() {
427      var boardurl = document.auto_settings.preboardurl.value || "$boardurl";
428      var boarddir = document.auto_settings.preboarddir.value || ".";
429      var htmldir = document.auto_settings.prehtmldir.value || "";
430      var htmlurl = document.auto_settings.prehtml_root.value || "";
431      if(!htmldir) {return 0;}
432      if(!htmlurl) {return 0;}
433      var confirmvalue = confirm("Do autofill the forms in the right column below (Saved:) with the basic values in here?");
434      if(!confirmvalue) {return 0;}
435      else {
436            // Board URL
437            document.auto_settings.boardurl.value = boardurl;
438
439            // cgi Directories
440            document.auto_settings.boarddir.value = boarddir;
441            document.auto_settings.boardsdir.value = boarddir + "/Boards";
442            document.auto_settings.datadir.value = boarddir + "/Messages";
443            document.auto_settings.vardir.value = boarddir + "/Variables";
444            document.auto_settings.memberdir.value = boarddir + "/Members";
445            document.auto_settings.sourcedir.value = boarddir + "/Sources";
446            document.auto_settings.admindir.value = boarddir + "/Admin";
447            document.auto_settings.langdir.value = boarddir + "/Languages";
448            document.auto_settings.templatesdir.value = boarddir + "/Templates";
449            document.auto_settings.helpfile.value = boarddir + "/Help";
450
451            // HTML URLs
452            document.auto_settings.html_root.value = htmlurl;
453            document.auto_settings.uploadurl.value = htmlurl + "/Attachments";
454            document.auto_settings.pmuploadurl.value = htmlurl + "/PMAttachments";
455            document.auto_settings.facesurl.value = htmlurl + "/avatars";
456            document.auto_settings.modimgurl.value = htmlurl + "/ModImages";
457
458            // HTML Directories
459            document.auto_settings.htmldir.value = htmldir;
460            document.auto_settings.uploaddir.value = htmldir + "/Attachments";
461            document.auto_settings.pmuploaddir.value = htmldir + "/PMAttachments";
462            document.auto_settings.facesdir.value = htmldir + "/avatars";
463            document.auto_settings.modimgdir.value = htmldir + "/ModImages";
464      }
465}
466</script>
467<div id="folderfind">
468    <table>
469        <col style="width:43%" />
470        <col style="width:57%" />
471      <tr>
472            <td class="header" colspan="2">
473                <span style="color: #fefefe;">&nbsp;<b>Absolute Path to the main script directory</b></span>
474            </td>
475        </tr><tr>
476            <td class="windowbg2">
477                <div style="float: left; width: 80%; text-align: left; font-size: 11px;">Only click on the insert button if your server needs the absolute path to the YaBB main script</div>
478                  <div style="float: left; width: 20%; text-align: right;"><input type="button" onclick="abspathfill('$support_env_path')" value="Insert" style="font-size: 11px;" /></div>
479            </td>
480            <td class="windowbg2">$support_env_path</td>
481        </tr><tr>
482            <td class="header" colspan="2">
483                <span style="color: #fefefe;">&nbsp;<b>Change this form if changes are necessary.</b></span>
484            </td>
485        </tr><tr>
486            <td class="windowbg2">
487                <label for="preboarddir">
488                  Main Script Directory:
489                <br />
490                <span style="font-size: 11px;">
491                    The server path to the board&#39;s folder (usually can be left as '.')
492                </span>
493                </label>
494            </td>
495            <td class="windowbg2">
496                  <input type="text" size="60" name ="preboarddir" id ="preboarddir" value="$boarddir" />
497            </td>
498        </tr><tr>
499            <td class="windowbg2">
500                <label for="preboardurl">Board URL:
501                <br />
502                <span style="font-size: 11px;">
503                URL of your board&#39;s folder (without trailing '/')
504                  </span></label>
505            </td>
506            <td class="windowbg2">
507                  <input type="text" size="60" name ="preboardurl" id ="preboardurl" value="$boardurl" />
508            </td>
509        </tr><tr>
510            <td class="windowbg2">
511                <label for="prehtmldir">HTML Root Directory:
512                <br />
513                <span style="font-size: 11px;">
514                  Base Path for all /html/css files and folders
515                  </span></label>
516            </td>
517            <td class="windowbg2">
518                  <input type="text" size="60" name ="prehtmldir" id ="prehtmldir" value="$htmldir" />
519            </td>
520        </tr><tr>
521            <td class="windowbg2">
522                <label for="prehtml_root">
523                  HTML Root URL:
524                <br />
525                <span style="font-size: 11px;">
526                  Base URL for all /html/css files and folders
527                  </span></label>
528            </td>
529            <td class="windowbg2">
530                  <input type="text" size="60" name ="prehtml_root" id ="prehtml_root" value="$yyhtml_root" />
531            </td>
532        </tr><tr>
533            <td style="background-color:$catbg; text-align:center; padding:15px 3px 30px 3px" colspan="2">
534                  <input type="button" onclick="autofill()" value="Autofill the forms below" style="width: 200px;" />
535            </td>
536      </tr>
537</table>
538    <table style="margin-top:1em">
539        <col style="width:20%" />
540        <col style="width:35%" />
541        <col style="width:10%" />
542        <col style="width:35%" />
543      <tr>
544            <td class="header" colspan="4">
545            <input type="hidden" name="lastsaved" value="${$uid.$username}{'realname'}" />
546            <input type="hidden" name="lastdate" value="$date" />
547                <span style="color: #fefefe;">&nbsp;<b>These are the settings detected on your server and the last saved settings.</b></span>
548            </td>
549        </tr><tr>
550            <td class="catbg">&nbsp;</td>
551            <td class="catbg"><b>Detected Values</b></td>
552            <td class="catbg"><b>Transfer</b></td>
553            <td class="catbg"><b>Saved: $mylastdate</b></td>
554        </tr><tr>
555            <td class="header" colspan="4">
556            <span style="color: #fefefe;">&nbsp; <b>CGI-BIN Settings</b></span>
557            </td>
558        </tr><tr>
559            <td class="windowbg2">Board URL:</td>
560            <td class="windowbg">$fnd_boardurl</td>
561            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.boardurl.value = '$fnd_boardurl';return false;" value="->" /></td>
562            <td class="windowbg"><input type="text" size="60" name ="boardurl" value="$boardurl" /></td>
563        </tr><tr>
564            <td class="windowbg2">Main Script Dir.:</td>
565            <td class="windowbg">$fnd_boarddir</td>
566            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.boarddir.value = '$fnd_boarddir';return false;" value="->" /></td>
567            <td class="windowbg"><input type="text" size="60" name ="boarddir" value="$boarddir" /></td>
568        </tr><tr>
569            <td class="windowbg2">Admin Dir.:</td>
570            <td class="windowbg">$fnd_admindir</td>
571            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.admindir.value = '$fnd_admindir';return false;" value="->" /></td>
572            <td class="windowbg"><input type="text" size="60" name ="admindir" value="$admindir" /></td>
573        </tr><tr>
574            <td class="windowbg2">Boards Dir.:</td>
575            <td class="windowbg">$fnd_boardsdir</td>
576            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.boardsdir.value = '$fnd_boardsdir';return false;" value="->" /></td>
577            <td class="windowbg"><input type="text" size="60" name ="boardsdir" value="$boardsdir" /></td>
578        </tr><tr>
579            <td class="windowbg2">Help Dir.:</td>
580            <td class="windowbg">$fnd_helpfile</td>
581            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.helpfile.value = '$fnd_helpfile';return false;" value="->" /></td>
582            <td class="windowbg"><input type="text" size="60" name ="helpfile" value="$helpfile" /></td>
583        </tr><tr>
584            <td class="windowbg2">Languages Dir.:</td>
585            <td class="windowbg">$fnd_langdir</td>
586            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.langdir.value = '$fnd_langdir';return false;" value="->" /></td>
587            <td class="windowbg"><input type="text" size="60" name ="langdir" value="$langdir" /></td>
588        </tr><tr>
589            <td class="windowbg2">Member Dir.:</td>
590            <td class="windowbg">$fnd_memberdir</td>
591            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.memberdir.value = '$fnd_memberdir';return false;" value="->" /></td>
592            <td class="windowbg"><input type="text" size="60" name ="memberdir" value="$memberdir" /></td>
593        </tr><tr>
594            <td class="windowbg2">Message Dir.:</td>
595            <td class="windowbg">$fnd_datadir</td>
596            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.datadir.value = '$fnd_datadir';return false;" value="->" /></td>
597            <td class="windowbg"><input type="text" size="60" name ="datadir" value="$datadir" /></td>
598        </tr><tr>
599            <td class="windowbg2">Sources Dir.:</td>
600            <td class="windowbg">$fnd_sourcedir</td>
601            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.sourcedir.value = '$fnd_sourcedir';return false;" value="->" /></td>
602            <td class="windowbg"><input type="text" size="60" name ="sourcedir" value="$sourcedir" /></td>
603        </tr><tr>
604            <td class="windowbg2">Template Dir.:</td>
605            <td class="windowbg">$fnd_templatesdir</td>
606            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.templatesdir.value = '$fnd_templatesdir';return false;" value="->" /></td>
607            <td class="windowbg"><input type="text" size="60" name ="templatesdir" value="$templatesdir" /></td>
608        </tr><tr>
609            <td class="windowbg2">Variables Dir.:</td>
610            <td class="windowbg">$fnd_vardir</td>
611            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.vardir.value = '$fnd_vardir';return false;" value="->" /></td>
612            <td class="windowbg"><input type="text" size="60" name ="vardir" value="$vardir" /></td>
613        </tr><tr>
614            <td class="header" style="color: #fefefe;" colspan="4">&nbsp; <b>HTML Settings</b></td>
615        </tr><tr>
616            <td class="windowbg2">HTML Root Dir.:</td>
617            <td class="windowbg">$fnd_htmldir</td>
618            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.htmldir.value = '$fnd_htmldir';return false;" value="->" /></td>
619            <td class="windowbg"><input type="text" size="60" name ="htmldir" value="$htmldir" /></td>
620        </tr><tr>
621            <td class="windowbg2">HTML Root URL:</td>
622            <td class="windowbg">$fnd_html_root</td>
623            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.html_root.value = '$fnd_html_root';return false;" value="->" /></td>
624            <td class="windowbg"><input type="text" size="60" name ="html_root" value="$yyhtml_root" /></td>
625        </tr><tr>
626            <td class="windowbg2">Attachment Dir.:</td>
627            <td class="windowbg">$fnd_uploaddir</td>
628            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.uploaddir.value = '$fnd_uploaddir';return false;" value="->" /></td>
629            <td class="windowbg"><input type="text" size="60" name ="uploaddir" value="$uploaddir" /></td>
630        </tr><tr>
631            <td class="windowbg2">Attachment URL:</td>
632            <td class="windowbg">$fnd_uploadurl</td>
633            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.uploadurl.value = '$fnd_uploadurl';return false;" value="->" /></td>
634            <td class="windowbg"><input type="text" size="60" name ="uploadurl" value="$uploadurl" /></td>
635        </tr><tr>
636            <td class="windowbg2">PMAttachment Dir.:</td>
637            <td class="windowbg">$fnd_pmuploaddir</td>
638            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.pmuploaddir.value = '$fnd_pmuploaddir';return false;" value="->" /></td>
639            <td class="windowbg"><input type="text" size="60" name ="pmuploaddir" value="$pmuploaddir" /></td>
640        </tr><tr>
641            <td class="windowbg2">PMAttachment URL:</td>
642            <td class="windowbg">$fnd_pmuploadurl</td>
643            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.pmuploadurl.value = '$fnd_pmuploadurl';return false;" value="->" /></td>
644            <td class="windowbg"><input type="text" size="60" name ="pmuploadurl" value="$pmuploadurl" /></td>
645        </tr><tr>
646            <td class="windowbg2">Avatar Dir.:</td>
647            <td class="windowbg">$fnd_facesdir</td>
648            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.facesdir.value = '$fnd_facesdir';return false;" value="->" /></td>
649            <td class="windowbg"><input type="text" size="60" name ="facesdir" value="$facesdir" /></td>
650        </tr><tr>
651            <td class="windowbg2">Avatar URL:</td>
652            <td class="windowbg">$fnd_facesurl</td>
653            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.facesurl.value = '$fnd_facesurl';return false;" value="->" /></td>
654            <td class="windowbg"><input type="text" size="60" name ="facesurl" value="$facesurl" /></td>
655        </tr><tr>
656            <td class="windowbg2">Mod Images Dir.:</td>
657            <td class="windowbg">$fnd_modimgdir</td>
658            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.modimgdir.value = '$fnd_modimgdir';return false;" value="->" /></td>
659            <td class="windowbg"><input type="text" size="60" name ="modimgdir" value="$modimgdir" /></td>
660        </tr><tr>
661            <td class="windowbg2">Mod Images URL:</td>
662            <td class="windowbg">$fnd_modimgurl</td>
663            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.modimgurl.value = '$fnd_modimgurl';return false;" value="->" /></td>
664            <td class="windowbg"><input type="text" size="60" name ="modimgurl" value="$modimgurl" /></td>
665        </tr><tr>
666            <td class="catbg" style="margin-top:.5em; margin-bottom:1em;" colspan="4"><input type="submit" value="Save Settings" /></td>
667        </tr>
668    </table>
669</div>
670</form>
671      ~;
672    $yytitle = 'Results of Auto-Sensing';
673    SimpleOutput();
674    return;
675}
676
677sub save_paths {
678    LoadCookie();    # Load the user's cookie (or set to guest)
679    LoadUserSettings();
680    if ( !$iamadmin ) {
681        setup_fatal_error(
682q~Setup Error: You have no access rights to this function. Only user "admin" has if logged in!~
683        );
684    }
685
686    $lastsaved    = $FORM{'lastsaved'};
687    $lastdate     = $FORM{'lastdate'};
688    $boardurl     = $FORM{'boardurl'};
689    $boarddir     = $FORM{'boarddir'};
690    $htmldir      = $FORM{'htmldir'};
691    $uploaddir    = $FORM{'uploaddir'};
692    $uploadurl    = $FORM{'uploadurl'};
693    $pmuploaddir    = $FORM{'pmuploaddir'};
694    $pmuploadurl    = $FORM{'pmuploadurl'};
695    $yyhtml_root  = $FORM{'html_root'};
696    $datadir      = $FORM{'datadir'};
697    $boardsdir    = $FORM{'boardsdir'};
698    $memberdir    = $FORM{'memberdir'};
699    $sourcedir    = $FORM{'sourcedir'};
700    $admindir     = $FORM{'admindir'};
701    $vardir       = $FORM{'vardir'};
702    $langdir      = $FORM{'langdir'};
703    $helpfile     = $FORM{'helpfile'};
704    $templatesdir = $FORM{'templatesdir'};
705
706    $facesdir = $FORM{'facesdir'};
707    $facesurl = $FORM{'facesurl'};
708    $modimgdir    = $FORM{'modimgdir'};
709    $modimgurl    = $FORM{'modimgurl'};
710
711    my $setfile = << "EOF";
712###############################################################################
713# Paths.pm                                                                    #
714###############################################################################
715# YaBB: Yet another Bulletin Board                                            #
716# Open-Source Community Software for Webmasters                               #
717# Version:        YaBB 2.6.11                                                 #
718# Packaged:       December 2, 2014                                            #
719# Distributed by: http://www.yabbforum.com                                    #
720# =========================================================================== #
721# Copyright (c) 2000-2014  YaBB (www.yabbforum.com) - All Rights Reserved.    #
722# Software by:  The YaBB Development Team                                     #
723#               with assistance from the YaBB community.                      #
724###############################################################################
725
726\$lastsaved = "$lastsaved";
727\$lastdate = "$lastdate";
728
729########## Directories ##########
730
731\$boardurl = "$boardurl";                                         # URL of your board's folder (without trailing '/')
732\$boarddir = "$boarddir";                                         # The server path to the board's folder (usually can be left as '.')
733\$boardsdir = "$boardsdir";                                       # Directory with board data files
734\$datadir = "$datadir";                                           # Directory with messages
735\$memberdir = "$memberdir";                                       # Directory with member files
736\$sourcedir = "$sourcedir";                                       # Directory with YaBB source files
737\$admindir = "$admindir";                                         # Directory with YaBB admin source files
738\$vardir = "$vardir";                                             # Directory with variable files
739\$langdir = "$langdir";                                           # Directory with Language files and folders
740\$helpfile = "$helpfile";                                         # Directory with Help files and folders
741\$templatesdir = "$templatesdir";                                 # Directory with template files and folders
742\$htmldir = "$htmldir";                                           # Base Path for all public-html files and folders
743\$facesdir = "$facesdir";                                         # Base Path for all avatar files
744\$uploaddir = "$uploaddir";                                       # Base Path for all attachment files
745\$pmuploaddir = "$pmuploaddir";                                   # Base Path for all PM attachment files
746\$modimgdir = "$modimgdir";                                       # Base Path for all mod images
747
748########## URLs ##########
749
750\$yyhtml_root = "$yyhtml_root";                                   # Base URL for all html/css files and folders
751\$facesurl = "$facesurl";                                         # Base URL for all avatar files
752\$uploadurl = "$uploadurl";                                       # Base URL for all attachment files
753\$pmuploadurl = "$pmuploadurl";                                   # Base URL for all PM attachment files
754\$modimgurl = "$modimgurl";                                       # Base URL for all mod images
755
7561;
757EOF
758
759    fopen( FILE, '>./Paths.pm' )
760      || setup_fatal_error( "$maintext_23 ./Paths.pm: ", 1 );
761    print {FILE} nicely_aligned_file($setfile)
762      or croak 'cannot print nicely aligned Paths.pm';
763    fclose(FILE);
764
765    if ( -e "$vardir/Paths.pm" ) { unlink "$vardir/Paths.pm"; }
766
767    $yySetLocation = qq~$set_cgi?action=checkmodules~;
768    redirectexit();
769    return;
770}
771
772sub BrdInstall {
773    $no_brddir = 0;
774    if ( !-d "$boardsdir" ) { $no_brddir = 1; return 1; }
775}
776
777sub MesInstall {
778    $no_mesdir = 0;
779    if ( !-d "$datadir" ) { $no_mesdir = 1; return 1; }
780}
781
782sub MemInstall {
783    $no_memdir = 0;
784    if ( !-d "$memberdir" ) { $no_memdir = 1; return 1; }
785}
786
787sub VarInstall {
788    my $varsdir = "$vardir";
789    $no_vardir = 0;
790
791    if ( !-d "$varsdir" ) { $no_vardir = 1; return 1; }
792
793    if ( !-e "$varsdir/adminlog.txt" ) {
794        fopen( ADMLOGFILE, ">$varsdir/adminlog.txt" )
795          || setup_fatal_error( "$maintext_23 $varsdir/adminlog.txt: ", 1 );
796        print {ADMLOGFILE} q{} or croak 'cannot print ADMLOGFILE';
797        fclose(ADMLOGFILE);
798    }
799
800    if ( !-e "$varsdir/allowed.txt" ) {
801        fopen( ALLOWFILE, ">$varsdir/allowed.txt" )
802          || setup_fatal_error( "$maintext_23 $varsdir/allowed.txt: ", 1 );
803        print {ALLOWFILE} "login\n"        or croak 'cannot print ALLOWFILE';
804        print {ALLOWFILE} "logout\n"       or croak 'cannot print ALLOWFILE';
805        print {ALLOWFILE} "display\n"      or croak 'cannot print ALLOWFILE';
806        print {ALLOWFILE} "messageindex\n" or croak 'cannot print ALLOWFILE';
807        print {ALLOWFILE} "pages\n"        or croak 'cannot print ALLOWFILE';
808        print {ALLOWFILE} "profile\n"      or croak 'cannot print ALLOWFILE';
809        print {ALLOWFILE} "register\n"     or croak 'cannot print ALLOWFILE';
810        print {ALLOWFILE} "resetpass\n"    or croak 'cannot print ALLOWFILE';
811        print {ALLOWFILE} 'viewprofile'    or croak 'cannot print ALLOWFILE';
812        fclose(ALLOWFILE);
813    }
814
815    if ( !-e "$varsdir/attachments.txt" ) {
816        fopen( ATTFILE, ">$varsdir/attachments.txt" )
817          || setup_fatal_error( "$maintext_23 $varsdir/attachments.txt: ", 1 );
818        print {ATTFILE} q{} or croak 'cannot print ATTFILE';
819        fclose(ATTFILE);
820    }
821    if ( !-e "$varsdir/pm.attachments" ) {
822        fopen( PMATTFILE, ">$varsdir/pm.attachments" )
823          || setup_fatal_error( "$maintext_23 $varsdir/pm.attachments: ", 1 );
824        print {PMATTFILE} q{} or croak 'cannot print PMATTFILE';
825        fclose(PMATTFILE);
826    }
827
828    if ( !-e "$varsdir/ban_log.txt" ) {
829        fopen( BANFILE, ">$varsdir/ban_log.txt" )
830          || setup_fatal_error( "$maintext_23 $varsdir/ban_log.txt: ", 1 );
831        print {BANFILE} q{} or croak 'cannot print ban_log.txt';
832        fclose(BANFILE);
833    }
834
835    if ( !-e "$varsdir/banlist.txt" ) {
836        fopen( BANLIST, ">$varsdir/banlist.txt" )
837          || setup_fatal_error( "$maintext_23 $varsdir/banlist.txt: ", 1 );
838        print {BANLIST} q{} or croak 'cannot print banlist.txt';
839        fclose(BANLIST);
840    }
841    if ( !-e "$varsdir/clicklog.txt" ) {
842        fopen( CLICKFILE, ">$varsdir/clicklog.txt" )
843          || setup_fatal_error( "$maintext_23 $varsdir/clicklog.txt: ", 1 );
844        print {CLICKFILE} q{} or croak 'cannot print clicklog.txt';
845        fclose(CLICKFILE);
846    }
847
848    if ( !-e "$varsdir/errorlog.txt" ) {
849        fopen( ERRORFILE, ">$varsdir/errorlog.txt" )
850          || setup_fatal_error( "$maintext_23 $varsdir/errorlog.txt: ", 1 );
851        print {ERRORFILE} q{} or croak 'cannot print errorlog.txt';
852        fclose(ERRORFILE);
853    }
854
855    if ( !-e "$varsdir/flood.txt" ) {
856        fopen( FLOODFILE, ">$varsdir/flood.txt" )
857          || setup_fatal_error( "$maintext_23 $varsdir/flood.txt: ", 1 );
858        print {FLOODFILE} '255.255.255.255|1119313741'
859          or croak 'cannot print flood.txt';
860        fclose(FLOODFILE);
861    }
862
863    if ( !-e "$varsdir/gmodsettings.txt" ) {
864        my $setfile = << "EOF";
865### Gmod Related Setttings ###
866
867\$allow_gmod_admin = "on"; #
868\$gmod_newfile = "on"; #
869
870### Areas Gmods can Access ###
871
872\%gmod_access = (
873'ext_admin',"",
874
875'newsettings;page=main',"",
876'newsettings;page=advanced',"on",
877'editbots', "",
878
879'newsettings;page=news',"on",
880'smilies',"on",
881'setcensor',"on",
882'modagreement',"on",
883'eventcal_set',"",
884'bookmarks',"",
885
886'referer_control',"",
887'newsettings;page=security',"",
888'setup_guardian',"",
889'newsettings;page=antispam',"",
890'spam_questions',"",
891'honeypot',"",
892
893'managecats',"",
894'manageboards',"",
895'helpadmin',"on",
896'editemailtemplates',"",
897
898'addmember',"",
899'viewmembers',"on",
900'modmemgr',"",
901'mailing',"on",
902'ipban',"on",
903'setreserve',"on",
904
905'modskin',"",
906'modcss',"",
907'modtemp',"",
908
909'clean_log',"on",
910'boardrecount',"",
911'rebuildmesindex',"",
912'membershiprecount',"",
913'rebuildmemlist',"",
914'rebuildmemhist',"",
915'deleteoldthreads',"",
916'manageattachments',"on",
917'backupsettings',"",
918
919'detailedversion',"on",
920'stats',"on",
921'showclicks',"on",
922'errorlog',"on",
923'view_reglog',"on",
924
925'modlist',"",
926);
927
928\%gmod_access2 = (
929admin => "on",
930
931newsettings => "on",
932newsettings2 => "on",
933
934eventcal_set2 => "",
935eventcal_set3 => "",
936bookmarks2 => "",
937bookmarks_add => "",
938bookmarks_add2 => "",
939bookmarks_edit => "",
940bookmarks_edit2 => "",
941bookmarks_delete => "",
942bookmarks_delete2 => "",
943spam_questions2 => "",
944spam_questions_add => "",
945spam_questions_add2 => "",
946spam_questions_edit => "",
947spam_questions_edit2 => "",
948spam_questions_delete => "",
949spam_questions_delete2 => "",
950honeypot2 => "",
951honeypot_add => "",
952honeypot_add2 => "",
953honeypot_edit => "",
954honeypot_edit2 => "",
955honeypot_delete => "",
956honeypot_delete2 => "",
957
958deleteattachment => "on",
959manageattachments2 => "on",
960removeoldattachments => "on",
961removebigattachments => "on",
962rebuildattach => "on",
963remghostattach => "on",
964
965profile => "",
966profile2 => "",
967profileAdmin => "",
968profileAdmin2 => "",
969profileContacts => "",
970profileContacts2 => "",
971profileIM => "",
972profileIM2 => "",
973profileOptions => "",
974profileOptions2 => "",
975
976ext_edit => "",
977ext_edit2 => "",
978ext_create => "",
979ext_reorder => "",
980ext_convert => "",
981
982myprofileAdmin => "",
983myprofileAdmin2 => "",
984
985delgroup => "",
986editgroup => "",
987editAddGroup2 => "",
988modmemgr2 => "",
989assigned => "",
990assigned2 => "",
991
992reordercats => "",
993modifycatorder => "",
994modifycat => "",
995createcat => "",
996catscreen => "",
997reordercats2 => "",
998addcat => "",
999addcat2 => "",
1000
1001modtemplate2 => "",
1002modtemp2 => "",
1003modstyle => "",
1004modstyle2 => "",
1005modcss => "",
1006modcss2 => "",
1007
1008modifyboard => "",
1009addboard => "",
1010addboard2 => "",
1011reorderboards2 => "",
1012boardscreen => "",
1013
1014smilieput => "on",
1015smilieindex => "on",
1016smiliemove => "on",
1017addsmilies => "on",
1018
1019addmember => "on",
1020addmember2 => "on",
1021deletemultimembers => "on",
1022ml => "on",
1023
1024mailmultimembers => "on",
1025mailing2 => "on",
1026
1027activate => "on",
1028admin_descision => "on",
1029apr_regentry => "on",
1030del_regentry => "on",
1031rej_regentry => "on",
1032view_regentry => "on",
1033clean_reglog => "on",
1034
1035cleanerrorlog => "on",
1036deleteerror => "on",
1037
1038modagreement2 => "on",
1039modsettings2 => "on",
1040advsettings2 => "on",
1041referer_control2 => "",
1042removeoldthreads => "",
1043ipban2 => "on",
1044ipban3 => "on",
1045setcensor2 => "on",
1046setreserve2 => "on",
1047
1048editbots2 => "",
1049);
1050
10511;
1052EOF
1053
1054        fopen( SETTING, ">$varsdir/gmodsettings.txt" )
1055          || setup_fatal_error( "$maintext_23 $varsdir/gmodsettings.txt: ", 1 );
1056        print {SETTING} nicely_aligned_file($setfile)
1057          or croak 'cannot print gmodsetting.txt';
1058        fclose(SETTING);
1059    }
1060
1061    if ( !-e "$varsdir/log.txt" ) {
1062        fopen( LOGFILE, ">$varsdir/log.txt" )
1063          || setup_fatal_error( "$maintext_23 $varsdir/log.txt: ", 1 );
1064        print {LOGFILE} 'admin|1105634411|127.0.0.1|'
1065          or croak 'cannot print log.txt';
1066        fclose(LOGFILE);
1067    }
1068
1069    if ( !-e "$varsdir/modlist.txt" ) {
1070        fopen( MODSFILE, ">$varsdir/modlist.txt" )
1071          || setup_fatal_error( "$maintext_23 $varsdir/modlist.txt: ", 1 );
1072        print {MODSFILE} "admin\n" or croak 'cannot print modlist.txt';
1073        fclose(MODSFILE);
1074    }
1075
1076    if ( !-e "$varsdir/news.txt" ) {
1077        fopen( NEWSFILE, ">$varsdir/news.txt" )
1078          || setup_fatal_error( "$maintext_23 $varsdir/news.txt: ", 1 );
1079        print {NEWSFILE} "Welcome to our forum.\n"
1080          or croak 'cannot print news.txt';
1081        print {NEWSFILE} "We've upgraded to YaBB 2.6.11!\n"
1082          or croak 'cannot print news.txt';
1083        print {NEWSFILE}
1084          "Visit [url=http://www.yabbforum.com]YaBB[/url] today \;\)\n"
1085          or croak 'cannot print news.txt';
1086        print {NEWSFILE}
1087          "Signup for free on our forum and benefit from new features!\n"
1088          or croak 'cannot print news.txt';
1089        print {NEWSFILE}
1090"Latest info can be found on the [url=http://www.yabbforum.com/community/]YaBB Chat and Support Community[/url].\n"
1091          or croak 'cannot print news.txt';
1092        fclose(NEWSFILE);
1093    }
1094
1095    if ( !-e "$varsdir/oldestmes.txt" ) {
1096        fopen( OLDFILE, ">$varsdir/oldestmes.txt" )
1097          || setup_fatal_error( "$maintext_23 $varsdir/oldestmes.txt: ", 1 );
1098        print {OLDFILE} "1\n" or croak 'cannot print oldestmes.txt';
1099        fclose(OLDFILE);
1100    }
1101
1102    if ( !-e "$varsdir/registration.log" ) {
1103        fopen( REGLOG, ">$varsdir/registration.log" )
1104          || setup_fatal_error( "$maintext_23 $varsdir/registration.log: ", 1 );
1105        print {REGLOG} q{} or croak 'cannot print registration.log';
1106        fclose(REGLOG);
1107    }
1108
1109    if ( !-e "$varsdir/reserve.txt" ) {
1110        fopen( RESERVEFILE, ">$varsdir/reserve.txt" )
1111          || setup_fatal_error( "$maintext_23 $varsdir/reserve.txt: ", 1 );
1112        print {RESERVEFILE} "yabb\n"      or croak 'cannot print reserve.txt';
1113        print {RESERVEFILE} "YaBBadmin\n" or croak 'cannot print reserve.txt';
1114        print {RESERVEFILE} "administrator\n"
1115          or croak 'cannot print reserve.txt';
1116        print {RESERVEFILE} "admin\n"     or croak 'cannot print reserve.txt';
1117        print {RESERVEFILE} "y2\n"        or croak 'cannot print reserve.txt';
1118        print {RESERVEFILE} "yabb2\n"     or croak 'cannot print reserve.txt';
1119        print {RESERVEFILE} "yabbforum\n" or croak 'cannot print reserve.txt';
1120        fclose(RESERVEFILE);
1121    }
1122
1123    if ( !-e "$varsdir/reservecfg.txt" ) {
1124        fopen( RESERVEFILE, ">$varsdir/reservecfg.txt" )
1125          || setup_fatal_error( "$maintext_23 $varsdir/reservecfg.txt: ", 1 );
1126        print {RESERVEFILE} "checked\n" or croak 'cannot print reservecfg.txt';
1127        print {RESERVEFILE} "\n"        or croak 'cannot print reservecfg.txt';
1128        print {RESERVEFILE} "checked\n" or croak 'cannot print reservecfg.txt';
1129        print {RESERVEFILE} "checked\n" or croak 'cannot print reservecfg.txt';
1130        fclose(RESERVEFILE);
1131    }
1132    return;
1133}
1134
1135sub checkmodules {
1136    LoadLanguage('Admin');
1137    tempstarter();
1138
1139    $yymain .= qq~
1140<form action="$set_cgi?action=setinstall" method="post">~;
1141
1142    require Admin::ModuleChecker;
1143    $yymain =~ s/float: left; |<\/div>$//gsm;
1144
1145    if ($dont_continue_setup) {
1146        $yymain .= q~
1147    <table class="border-space pad-cell">
1148        <tr>
1149            <td class="windowbg2 center" style="margin-top:.5em; margin-bottom:1em; color:red; font-size:large;">
1150                Sorry, you cannot continue until you have installed at least the "Digest::MD5" module.
1151            </td>
1152      </tr>
1153      </table>~;
1154    }
1155    else {
1156        $yymain .= q~
1157    <table class="border-space pad-cell">
1158        <tr >
1159            <td class="catbg center" style="margin-top:.5em; margin-bottom:1em">
1160                  You can always see the above information on the start page of your AdminCenter.<br />
1161                  Therefore you can continue now and install missing modules later if you really need them.<br />
1162                  <br />
1163                <input type="submit" value="Continue" />
1164            </td>
1165      </tr>
1166      </table>~;
1167    }
1168
1169    $yymain .= q~
1170</div>
1171</form>
1172~;
1173
1174    $yyim    = 'You are running YaBB 2.6.11 Setup.';
1175    $yytitle = 'YaBB 2.6.11 Setup';
1176    SetupTemplate();
1177    return;
1178}
1179
1180sub SetInstall {
1181    LoadLanguage('Admin');
1182    tempstarter();
1183
1184    # show available languages
1185    opendir DIR, $langdir
1186      || setup_fatal_error( "Directory: $langdir: ", 1 );
1187    my @lfilesanddirs = readdir DIR;
1188    closedir DIR;
1189    my $drawnldirs;
1190    foreach my $fld ( sort { lc($a) cmp lc $b } @lfilesanddirs ) {
1191        if (   -d "$langdir/$fld"
1192            && -e "$langdir/$fld/Main.lng"
1193            && $fld =~ m{\A[0-9a-zA-Z_\#\%\-\:\+\?\$\&\~\,\@/]+\Z}sm )
1194        {
1195            if ( 'English' eq $fld ) {
1196                $drawnldirs .=
1197                  qq~<option value="$fld" selected="selected">$fld</option>\n~;
1198            }
1199            else { $drawnldirs .= qq~<option value="$fld">$fld</option>\n~; }
1200        }
1201    }
1202
1203    $yymain .= qq~
1204<form action="$set_cgi?action=setinstall2" method="post">
1205<div class="bordercolor borderbox">
1206    <table class="tabtitle">
1207        <tr>
1208            <td style="padding-left:1%">System Setup</td>
1209        </tr>
1210    </table>
1211    <table class="border-space pad-cell">
1212        <tr>
1213            <td class="windowbg">
1214                Here you can set some of the default settings for your new YaBB 2.6.11 forum.<br />
1215                After finishing the setup procedure, you should login to your forum and go to your 'Admin Center' -&gt; 'Forum Settings' where you can modify this and other settings.
1216            </td>
1217        </tr><tr>
1218            <td class="windowbg2">
1219                <div class="div45">
1220                    <label for="mbname">Message Board Name</label>
1221                </div>
1222                <div class="div55">
1223                    <input type="text" name="mbname" id="mbname" size="35" value="My Perl YaBB Forum" />
1224                </div>
1225                <br style="clear:both" />
1226                <div class="div45">
1227                    <label for="webmaster_email">Webmaster E-mail Address</label>
1228                </div>
1229                <div class="div55">
1230                    <input type="text" name="webmaster_email" id="webmaster_email" size="35" value="webmaster\@mysite.com" />
1231                </div>
1232                <br style="clear:both" />
1233                <div class="div45">
1234                    <label for="defaultlanguage">Admin Language / Forum Default Language</label>
1235                </div>
1236                <div class="div55">
1237                    <select name="defaultlanguage" id="defaultlanguage">$drawnldirs</select>
1238                </div>
1239                <br style="clear:both" />
1240                <div class="div45">
1241                    <label for="defaultencoding">Default Forum Character Encoding
1242                    <br /><span class="small"><b>Note</b>: If you are going to import an older English Language forum choose 'ISO-8859-1'.</span></label>
1243                </div>
1244                <div class="div55">
1245                    <select name="defaultencoding" id="defaultencoding" size="1">
1246                        <option value="UTF-8">UTF-8</option>
1247                        <option value="ISO-8859-1">ISO-8859-1</option>
1248                    </select>
1249                </div>
1250                <br style="clear:both" />
1251                <div class="div45">
1252                    <label for="timeselect">Default Time Format</label>
1253                </div>
1254                <div class="div55">
1255                    <select name="timeselect" id="timeselect" size="1">
1256                        <option value="1">01/31/01 at 13:15:17</option>
1257                        <option value="5">01/31/01 at 1:15pm</option>
1258                        <option value="4" selected="selected">Jan 12th, 2001 at 1:15pm</option>
1259                        <option value="8"> 12th Jan, 2001 at 1:15pm</option>
1260                        <option value="2">31.01.01 at 13:15:17</option>
1261                        <option value="3">31.01.2001 at 13:15:17</option>
1262                        <option value="6">31. Jan at 13:15</option>
1263                    </select>
1264                </div>
1265                <br style="clear:both" />
1266                <div class="div45">
1267                    Forum Time: (Your actual displayed UTC time). The Forum Time Zone can be changed in the Admin Center.
1268                </div>
1269                <div class="div55">
1270                    <b>~
1271      . timeformat( $date, 4 ) . q~</b>
1272            </div>
1273            </td>
1274    </tr><tr>
1275        <td class="catbg center">
1276            <input type="submit" value="Continue" />
1277            </td>
1278      </tr>
1279      </table>
1280</div>
1281</form>
1282~;
1283
1284    $yyim    = 'You are running YaBB 2.6.11 Setup.';
1285    $yytitle = 'YaBB 2.6.11 Setup';
1286    SetupTemplate();
1287    return;
1288}
1289
1290sub SetInstall2 {
1291    if ( $action eq 'checkmodules' || $action eq 'setinstall2' ) {
1292        $settings_file_version = 'YaBB 2.6.11';
1293        $yymycharset             = $FORM{'defaultencoding'} || 'UTF-8' ;
1294        $maintenance           = 1;
1295        $rememberbackup        = 0;
1296        $guestaccess           = 1;
1297        $mbname                = $FORM{'mbname'} || 'My Perl YaBB Forum';
1298        $mbname =~ s/\"/\'/gxsm;
1299        $forumstart            = timetostring( int time );
1300        $Cookie_Length         = 1;
1301        $regtype               = 3;
1302        $RegAgree              = 1;
1303        $RegReasonSymbols      = 500;
1304        $preregspan            = 24;
1305        $emailpassword         = 0;
1306        $emailnewpass          = 0;
1307        $emailwelcome          = 0;
1308        $name_cannot_be_userid = 1;
1309        $gender_on_reg         = 0;
1310        $lang                  = $FORM{'defaultlanguage'} || 'English';
1311        $default_template      = 'Forum default';
1312        $mailprog              = '/usr/sbin/sendmail';
1313        $smtp_server           = '127.0.0.1';
1314        $smtp_auth_required    = 1;
1315        $authuser              = q~admin~;
1316        $authpass              = q~admin~;
1317        $webmaster_email = $FORM{'webmaster_email'} || 'webmaster@mysite.com';
1318        $mailtype        = 0;
1319        $maintenancetext =
1320'We are currently upgrading our forum again. Please check back shortly!';
1321        $MenuType               = 2;
1322        $profilebutton          = 1;
1323        $allow_hide_email       = 1;
1324        $showlatestmember       = 1;
1325        $shownewsfader          = 0;
1326        $Show_RecentBar         = 1;
1327        $showmodify             = 1;
1328        $ShowBDescrip           = 1;
1329        $showuserpic            = 1;
1330        $showusertext           = 1;
1331        $showtopicviewers       = 1;
1332        $showtopicrepliers      = 1;
1333        $showgenderimage        = 1;
1334        $showyabbcbutt          = 1;
1335        $nestedquotes           = 1;
1336        $parseflash             = 0;
1337        $enableclicklog         = 0;
1338        $showimageinquote       = 0;
1339        $enable_ubbc            = 1;
1340        $enable_news            = 1;
1341        $allowpics              = 1;
1342        $upload_useravatar      = 0;
1343        $upload_avatargroup     = q{};
1344        $avatar_limit           = 100;
1345        $avatar_dirlimit        = 10_000;
1346        $enable_guestposting    = 0;
1347        $ML_Allowed             = 1;
1348        $enable_quickpost       = 0;
1349        $enable_quickreply      = 0;
1350        $enable_quickjump       = 0;
1351        $enable_markquote       = 0;
1352        $quick_quotelength      = 1000;
1353        $enable_quoteuser       = 0;
1354        $quoteuser_color        = '#0033cc';
1355        $guest_media_disallowed = 0;
1356        $enable_guestlanguage   = 1;
1357        $enable_notifications   = 0;
1358        $NewNotificationAlert   = 0;
1359        $autolinkurls           = 1;
1360        $forumnumberformat      = $FORM{'forumnumberformat'} || 1;
1361        $timeselected           = $FORM{'timeselect'} || 0;
1362        $timecorrection         = 0;
1363        $enabletz               = 0;
1364        $default_tz             = 'UTC';
1365        $dynamic_clock          = 1;
1366        $TopAmmount             = 15;
1367        $maxdisplay             = 20;
1368        $maxfavs                = 20;
1369        $maxrecentdisplay       = 25;
1370        $maxrecentdisplay_t     = 25;
1371        $maxsearchdisplay       = 15;
1372        $maxmessagedisplay      = 15;
1373        $MaxMessLen             = 5000;
1374        $AdMaxMessLen           = 5000;
1375        $MaxIMMessLen           = 2000;
1376        $AdMaxIMMessLen         = 3000;
1377        $MaxCalMessLen          = 200;
1378        $AdMaxCalMessLen        = 300;
1379        $fontsizemin            = 6;
1380        $fontsizemax            = 32;
1381        $MaxSigLen              = 200;
1382        $MaxAwayLen             = 200;
1383        $ClickLogTime           = 100;
1384        $max_log_days_old       = 90;
1385        $fadertime              = 1000;
1386        $defaultusertxt         = 'I Love YaBB 2.6.11!';
1387        $timeout                = 5;
1388        $HotTopic               = 10;
1389        $VeryHotTopic           = 25;
1390        $barmaxdepend           = 0;
1391        $barmaxnumb             = 500;
1392        $defaultml              = 'regdate';
1393        $max_avatar_width       = 65;
1394        $max_avatar_height      = 65;
1395        $fix_avatar_img_size    = 0;
1396        $max_avatarml_width     = 65;
1397        $max_avatarml_height    = 65;
1398        $fix_avatarml_img_size  = 0;
1399        $max_post_img_width     = 400;
1400        $max_post_img_height    = 0;
1401        $fix_post_img_size      = 0;
1402        $max_signat_img_width   = 300;
1403        $max_signat_img_height  = 0;
1404        $fix_signat_img_size    = 0;
1405        $max_attach_img_width   = 200;
1406        $max_attach_img_height  = 0;
1407        $fix_attach_img_size    = 0;
1408        $max_brd_img_width   = 50;
1409        $max_brd_img_height  = 50;
1410        $fix_brd_img_size    = 0;
1411        $img_greybox            = 1;
1412        $extendedprofiles       = 0;
1413        $enable_freespace_check = 0;
1414        $enableguestsearch      = 1;
1415        $enableguestquicksearch = 1;
1416        $showregdate            = 1;
1417        $addtab_on              = 1;
1418        $bm_subcut              = 50;
1419        $maxadminlog            = 5;
1420
1421        if ( -e '/bin/gzip' && open GZIP, '|, gzip -f' ) {
1422            $gzcomp = 1;
1423        }
1424        else {
1425            eval { require Compress::Zlib; Compress::Zlib::memGzip('test'); };
1426            $gzcomp = $@ ? 0 : 2;
1427        }
1428        $gzforce        = 0;
1429        $cachebehaviour = 0;
1430        $use_flock      = 0;
1431        $faketruncation = 0;
1432        $debug          = 0;
1433
1434        $checkallcaps         = 0;
1435        $set_subjectMaxLength = 50;
1436        $honeypot             = 1;
1437        $speedpostdetection   = 1;
1438        $spd_detention_time   = 300;
1439        $min_post_speed       = 2;
1440        $post_speed_count     = 3;
1441        $minlinkpost          = 0;
1442        $minlinksig           = 0;
1443        $minlinkweb           = 0;
1444        $showsearchboxnum     = 31;
1445        $showregdate          = 1;
1446        $enableguestsearch    = 1;
1447        $enableguestquicksearch = 1;
1448        $maxsteps             = 40;
1449        $stepdelay            = 75;
1450        $fadelinks            = 0;
1451        $cookieviewtime = 525_600;
1452
1453        # Let's generate a masterkey at setup time.
1454        my @chars = ( 'A' .. 'Z', 'a' .. 'z', 0 .. 9 );
1455        for ( 1 .. 24 ) { $masterkey .= $chars[ rand @chars ]; }
1456
1457    }
1458    else {
1459        $forumstart = timetostring( $INFO{'firstforum'} );
1460        $MaxSigLen  = $siglength || 200;
1461        $fadertime  = 1000;
1462    }
1463
1464    my $setfile = << "EOF";
1465###############################################################################
1466# Settings.pm                                                                 #
1467###############################################################################
1468# YaBB: Yet another Bulletin Board                                            #
1469# Open-Source Community Software for Webmasters                               #
1470# Version:        YaBB 2.6.11                                                 #
1471# Packaged:       December 2, 2014                                            #
1472# Distributed by: http://www.yabbforum.com                                    #
1473# =========================================================================== #
1474# Copyright (c) 2000-2014  YaBB (www.yabbforum.com) - All Rights Reserved.    #
1475# Software by:  The YaBB Development Team                                     #
1476#               with assistance from the YaBB community.                      #
1477###############################################################################
1478
1479########## Board Info ##########
1480# Note: these settings must be properly changed for YaBB to work
1481
1482\$settings_file_version = "$settings_file_version"; # If not equal actual YaBBversion then the updating process is run through
1483\$yymycharset = "$yymycharset";                        # character encoding (usually ISO-8859-1 for older forums)
1484                                            # or 'UTF-8';
1485\%templateset = (
1486'Forum default' => "default|default|default|default|default|default|default|",
1487);                                                  # Forum templates settings
1488
1489\$maintenance = $maintenance;                       # Set to 1 to enable Maintenance mode
1490\$rememberbackup = $rememberbackup;                 # seconds past since last backup until alert is displayed
1491\$guestaccess = $guestaccess;                       # Set to 0 to disallow guests from doing anything but login or register
1492
1493\$mbname = q^$mbname^;                              # The name of your YaBB forum
1494\$forumstart = "$forumstart";                       # The start date of your YaBB Forum
1495\$Cookie_Length = $Cookie_Length;                   # Default to set login cookies to stay for
1496\$cookieusername = "$cookieusername";               # Name of the username cookie
1497\$cookiepassword = "$cookiepassword";               # Name of the password cookie
1498\$cookiesession_name = "$cookiesession_name";       # Name of the Session cookie
1499\$cookietsort = "$cookietsort";                     # Name of the Topic Sort
1500\$cookieview = "$cookieview";                       # Name of the Guest Message Limit cookie
1501\$cookieviewtime = "$cookieviewtime";
1502\$screenlogin = $screenlogin;                # allow members to login using their screen name.
1503
1504\$regtype = $regtype;                               # 0 = registration closed (only admin can register),
1505                                                    # 1 = pre registration with admin approval,
1506                                                    # 2 = pre registration and email activation, 3 = open registration
1507
1508\$RegAgree = $RegAgree;                             # Set to 1 to display the registration agreement when registering
1509\$RegReasonSymbols = $RegReasonSymbols;             # Maximum allowed symbols in User reason(s) for registering
1510\$preregspan = $preregspan;                         # Time span in hours for users to account activation before cleanup.
1511\$pwstrengthmeter_scores = "10,15,30,40";           # Password-Strength-Meter Scores
1512\$pwstrengthmeter_common = qq~"123","123456"~;      # Password-Strength-Meter common words
1513\$pwstrengthmeter_minchar = 5;                      # Password-Strength-Meter minimum characters
1514\$emailpassword = $emailpassword;                   # 0 - instant registration. 1 - password emailed to new members
1515\$emailnewpass = $emailnewpass;                     # Set to 1 to email a new password to members if
1516                                                    # they change their email address
1517\$emailwelcome = $emailwelcome;                     # Set to 1 to email a welcome message to users even
1518                                                    # when you have mail password turned off
1519\$name_cannot_be_userid = $name_cannot_be_userid;   # Set to 1 to require users to have different usernames and display names
1520
1521\$gender_on_reg = $gender_on_reg;                   # 0: do not ask for gender on registration
1522                                                    # 1: ask for gender, no input required
1523                                                    # 2: ask for gender, input required
1524\$lang = "$lang";                                   # Default Forum Language
1525\$default_template = "$default_template";           # Default Forum Template
1526
1527\$mailprog = "$mailprog";                           # Location of your sendmail program
1528\$smtp_server = "$smtp_server";                     # Address of your SMTP-Server (for Net::SMTP::TLS, specify the port number with a ":<portnumber>" at the end)
1529\$smtp_auth_required = $smtp_auth_required;         # Set to 1 if the SMTP server requires Authorisation
1530\$authuser = q^$authuser^;                          # Username for SMTP authorisation
1531\$authpass = q^$authpass^;                          # Password for SMTP authorisation
1532\$webmaster_email = q^$webmaster_email^;            # Your email address. (eg: \$webmaster_email = q^admin\@host.com^;)
1533\$mailtype = $mailtype;                             # Mail program to use: 0 = sendmail, 1 = SMTP, 2 = Net::SMTP, 3 = Net::SMTP::TLS
1534
1535\$UseHelp_Perms = 1;                                # Help Center: 1 == use permissions, 0 == do not use permissions
1536
1537########## MemberGroups ##########
1538
1539\$Group{'Administrator'} = 'Forum Administrator|5|staradmin.png|#FF0000|0|0|0|0|0|0|0';
1540\$Group{'Global Moderator'} = 'Global Moderator|5|stargmod.png|#0000FF|0|0|0|0|0|0|0';
1541\$Group{'Mid Moderator'} = 'Forum Moderator|5|starfmod.png|#008080|0|0|0|0|0|0|0';
1542\$Group{'Moderator'} = 'Board Moderator|5|starmod.png|#008000|0|0|0|0|0|0|0';
1543\$Post{'500'} = "God Member|5|starsilver.png||0|0|0|0|0|0";
1544\$Post{'250'} = "Senior Member|4|stargold.png||0|0|0|0|0|0";
1545\$Post{'100'} = "Full Member|3|starblue.png||0|0|0|0|0|0";
1546\$Post{'50'} = "Junior Member|2|stargold.png||0|0|0|0|0|0";
1547\$Post{'-1'} = "New Member|1|stargold.png||0|0|0|0|0|0";
1548
1549########## Layout ##########
1550
1551\$maintenancetext = "$maintenancetext";             # User-defined text for Maintenance mode (leave blank for default text)
1552\$MenuType = $MenuType;                             # 1 for text menu or anything else for images menu
1553\$profilebutton = $profilebutton;                   # 1 to show view profile button under post, or 0 for blank
1554\$allow_hide_email = $allow_hide_email;             # Allow users to hide their email from public. Set 0 to disable
1555\$showlatestmember = $showlatestmember;             # Set to 1 to display "Welcome Newest Member" on the Board Index
1556\$shownewsfader = $shownewsfader;                   # 1 to allow or 0 to disallow NewsFader javascript on the Board Index
1557                                                    # If 0, you'll have no news at all unless you put in a {yabb news} tag
1558                                                    # back into template.html!!!
1559\$Show_RecentBar = $Show_RecentBar;                 # Set to 1 to display the Recent Post on Board Index
1560\$showmodify = $showmodify;                         # Set to 1 to display "Last modified: Realname - Date" under each message
1561\$ShowBDescrip = $ShowBDescrip;                     # Set to 1 to display board descriptions on the topic (message) index for each board
1562\$showuserpic = $showuserpic;                       # Set to 1 to display each member's picture in the
1563                                                    # message view (by the ICQ.. etc.)
1564\$showusertext = $showusertext;                     # Set to 1 to display each member's personal text
1565                                                    # in the message view (by the ICQ.. etc.)
1566\$showtopicviewers = $showtopicviewers;             # Set to 1 to display members viewing a topic
1567\$showtopicrepliers = $showtopicrepliers;           # Set to 1 to display members replying to a topic
1568\$showgenderimage = $showgenderimage;               # Set to 1 to display each member's gender in the
1569                                                    # message view (by the ICQ.. etc.)
1570\$showyabbcbutt = $showyabbcbutt;                   # Set to 1 to display the yabbc buttons on Posting and IM Send Pages
1571\$nestedquotes = $nestedquotes;                     # Set to 1 to allow quotes within quotes
1572                                                    # (0 will filter out quotes within a quoted message)
1573\$parseflash = $parseflash;                         # Set to 1 to parse the flash tag
1574\$enableclicklog = $enableclicklog;                 # Set to 1 to track stats in Clicklog (this may slow your board down)
1575\$showimageinquote = $showimageinquote;             # Set to 1 to shows images in quotes, 0 displays a link to the image
1576\$showregdate = $showregdate;                       # Set to 1 to show date of registration.
1577\@pallist = ("#ff0000","#00ff00","#0000ff","#00ffff","#ff00ff","#ffff00"); # color settings of the palette
1578
1579########## Feature Settings ##########
1580
1581\$enable_ubbc = $enable_ubbc;                       # Set to 1 if you want to enable UBBC (Uniform Bulletin Board Code)
1582\$enable_news = $enable_news;                       # Set to 1 to turn news on, or 0 to set news off
1583\$allowpics = $allowpics;                           # set to 1 to allow members to choose avatars in their profile
1584\$upload_useravatar = $upload_useravatar;           # set to 1 to allow members to upload avatars for their profile
1585\$upload_avatargroup = '$upload_avatargroup';       # membergroups allowed to upload avatars for their profile, '' == all members
1586\$avatar_limit = $avatar_limit;                     # set to the maximum size of the uploaded avatar, 0 == no limit
1587\$avatar_dirlimit = $avatar_dirlimit;               # set to the maximum size of the upload avatar directory, 0 == no limit
1588\$default_avatar = $default_avatar;                 # Set to 1 to show a default avatar if the member hasn't added a picture
1589\$default_userpic = "\Q$default_userpic\E";         # Set the file name for the default avatar
1590
1591\$enable_guestposting = $enable_guestposting;       # Set to 0 if do not allow 1 is allow.
1592\$guest_media_disallowed = $guest_media_disallowed; # disallow browsing guests to see media files or
1593                                                    # have clickable auto linked urls in messages.
1594\$enable_guestlanguage = $enable_guestlanguage;     # allow browsing guests to select their language
1595                                                    # - requires more than one language pack!
1596                                                    # - Set to 0 if do not allow 1 is allow.
1597
1598\$enable_notifications = $enable_notifications;     # - Allow e-mail notification for boards/threads
1599                                                    #   listed in "My Notifications" => value == 1
1600                                                    # - Allow e-mail notification when new PM comes in
1601                                                    #   => value == 2
1602                                                    # - value == 0 => both disabled | value == 3 => both enabled
1603
1604\$NewNotificationAlert = $NewNotificationAlert;     # enable notification alerts (popup) for new notifications
1605\$autolinkurls = $autolinkurls;                     # Set to 1 to turn URLs into links, or 0 for no auto-linking.
1606
1607\$forumnumberformat = $forumnumberformat;           # Select your preferred output Format for Numbers
1608\$timeselected = $timeselected;                     # Select your preferred output Format of Time and Date
1609\$timecorrection = $timecorrection;                 # Set time correction for server time in seconds
1610\$enabletz = $enabletz;                             # Allow for timezone selection
1611\$default_tz = "$default_tz";                       # default forum timezone
1612\$dynamic_clock = $dynamic_clock;                   # Set to a value enables the dynamic clock at the top of the page
1613\$TopAmmount = $TopAmmount;                         # No. of top posters to display on the top members list
1614\$maxdisplay = $maxdisplay;                         # Maximum of topics to display
1615\$maxfavs = $maxfavs;                               # Maximum of favorite topics to save in a profile
1616\$maxrecentdisplay = $maxrecentdisplay;             # Maximum of topics to display on recent posts by a user (-1 to disable)
1617\$maxrecentdisplay_t = $maxrecentdisplay_t;         # Maximum of topics to display on recent topics (-1 to disable)
1618\$maxsearchdisplay = $maxsearchdisplay;             # Maximum of messages to display in a search query  (-1 to disable search)
1619\$maxmessagedisplay = $maxmessagedisplay;           # Maximum of messages to display
1620\$MaxMessLen = $MaxMessLen;                         # Maximum Allowed Characters in a Posts
1621\$AdMaxMessLen = $AdMaxMessLen;                     # Maximum Allowed Characters in a Posts for Admins
1622\$MaxIMMessLen = $MaxIMMessLen;                     # Maximum Allowed Characters in a PM
1623\$AdMaxIMMessLen = $AdMaxIMMessLen;                 # Maximum Allowed Characters in a PM for Admins
1624\$MaxCalMessLen = $MaxCalMessLen;                   # Maximum Allowed Characters in a Cal event
1625\$AdMaxCalMessLen = $AdMaxCalMessLen;               # Maximum Allowed Characters in a Cal Event for Admins
1626\$fontsizemin = $fontsizemin;                       # Minimum Allowed Font height in pixels
1627\$fontsizemax = $fontsizemax;                       # Maximum Allowed Font height in pixels
1628\$checkallcaps = $checkallcaps;                     # Set to 0 to allow ALL CAPS in posts (subject and message) or set to a value > 0 to open a JS-alert if more characters in ALL CAPS were there.
1629\$set_subjectMaxLength = $set_subjectMaxLength;     # Maximum Allowed Characters in a Posts Subject
1630\$honeypot = $honeypot;                                            # Set to 1 to activate Honeypot spam deterrent
1631\$speedpostdetection = $speedpostdetection;         # Set to 1 to detect speedposters and delay their spam actions
1632\$spd_detention_time = $spd_detention_time;         # Time in seconds before a speedposting ban is lifted again
1633\$min_post_speed = $min_post_speed;                 # Minimum time in seconds between entering a post form and submitting a post
1634\$minlinkpost = $minlinkpost;                       # Minimum amount of posts a member needs to post links and images
1635\$minlinksig = $minlinksig;                         # Minimum amount of posts a member needs to create links and images in signature
1636\$minlinkweb = $minlinkweb;
1637\$post_speed_count = $post_speed_count;             # Maximum amount of abuses befor a user gets banned
1638\$MaxSigLen = $MaxSigLen;                           # Maximum Allowed Characters in Signatures
1639\$MaxAwayLen = $MaxAwayLen;                         # Maximum Allowed Characters in Away message
1640\$ClickLogTime = $ClickLogTime;                     # Time in minutes to log every click to your forum
1641                                                    # (longer time means larger log file size)
1642\$max_log_days_old = $max_log_days_old;             # If an entry in the user's log is older than ... days remove it
1643
1644\$maxsteps = $maxsteps;                             # Number of steps to take to change from start color to endcolor
1645\$stepdelay = $stepdelay;                           # Time in miliseconds of a single step
1646\$fadelinks = $fadelinks;                           # Fade links as well as text?
1647
1648\$defaultusertxt = qq~$defaultusertxt~;             # The dafault usertext visible in users posts
1649\$timeout = $timeout;                               # Minimum time between 2 postings from the same IP
1650\$HotTopic = $HotTopic;                             # Number of posts needed in a topic for it to be classed as "Hot"
1651\$VeryHotTopic = $VeryHotTopic;                     # Number of posts needed in a topic for it to be classed as "Very Hot"
1652\$barmaxdepend = $barmaxdepend;                     # Set to 1 to let bar-max-length depend on top poster
1653                                                    # or 0 to depend on a number of your choise
1654\$barmaxnumb = $barmaxnumb;                         # Select number of post for max. bar-length in memberlist
1655\$defaultml = "$defaultml";
1656
1657\$ML_Allowed = $ML_Allowed;                         # allow browse MemberList
1658
1659########## Quick Reply configuration ##########
1660\$enable_quickpost = $enable_quickpost;             # Set to 1 if you want to enable the quick post box
1661\$enable_quickreply = $enable_quickreply;           # Set to 1 if you want to enable the quick reply box
1662\$enable_quickjump = $enable_quickjump;             # Set to 1 if you want to enable the jump to quick reply box
1663\$enable_markquote = $enable_markquote;             # Set to 1 if you want to enable the mark&quote feature
1664\$quick_quotelength = $quick_quotelength;           # Set the max length for Quick Quotes
1665\$enable_quoteuser = $enable_quoteuser;             # Set to 1 if you want to enable userquote
1666\$quoteuser_color = "$quoteuser_color";             # Set the default color of @ in userquote
1667
1668########## MemberPic Settings ##########
1669
1670\$max_avatar_width = $max_avatar_width;             # Set maximum pixel width to which the selfselected userpics are resized,
1671                                                    # 0 disables this limit
1672\$max_avatar_height = $max_avatar_height;           # Set maximum pixel height to which the selfselected userpics are resized,
1673                                                    # 0 disables this limit
1674\$fix_avatar_img_size = $fix_avatar_img_size;       # Set to 1 disable the image resize feature and sets the image size to the
1675                                                    # max_... values. If one of the max_... values is 0 the image is shown in its
1676                                                    # proportions to the other value. If both are 0 the image is shown at its original size.
1677\$max_avatarml_width = $max_avatarml_width;         # Set maximum pixel width to which the selfselected userpics in member list are resized, 0 disables
1678                                                    #  this limit
1679\$max_avatarml_height = $max_avatarml_height;       #Set maximum pixel height to which the selfselected userpics in member list are resized, 0 disables
1680                                                    #  this limit
1681\$fix_avatarml_img_size = $fix_avatarml_img_size;                       # Set to 1 disable the image resize feature and sets the image size to the max_... values. If one of
1682                                                    #  the max_... values is 0 the image is shown in its proportions to the other value. If both are 0 the image is shown at its original size.
1683\$max_post_img_width = $max_post_img_width;         # Set maximum pixel width for images, 0 disables this limit
1684\$max_post_img_height = $max_post_img_height;       # Set maximum pixel height for images, 0 disables this limit
1685\$fix_post_img_size = $fix_post_img_size;           # Set to 1 disable the image resize feature and sets the image size to the
1686                                                    # max_... values. If one of the max_... values is 0 the image is shown in its
1687                                                    # proportions to the other value. If both are 0 the image is shown at its original size.
1688\$max_signat_img_width = $max_signat_img_width;     # Set maximum pixel width for images in the signature, 0 disables this limit
1689\$max_signat_img_height = $max_signat_img_height;   # Set maximum pixel height for images in the signature, 0 disables this limit
1690\$fix_signat_img_size = $fix_signat_img_size;       # Set to 1 disable the image resize feature and sets the image size to the
1691                                                    # max_... values. If one of the max_... values is 0 the image is shown in its
1692                                                    # proportions to the other value. If both are 0 the image is shown at its original size.
1693\$max_attach_img_width = $max_attach_img_width;     # Set maximum pixel width for attached images, 0 disables this limit
1694\$max_attach_img_height = $max_attach_img_height;   # Set maximum pixel height for attached images, 0 disables this limit
1695\$fix_attach_img_size = $fix_attach_img_size;       # Set to 1 disable the image resize feature and sets the image size to the
1696                                                    # max_... values. If one of the max_... values is 0 the image is shown in its
1697                                                    # proportions to the other value. If both are 0 the image is shown at its original size.
1698\$max_brd_img_width = $max_brd_img_width;                           # Set maximum pixel width to which the Board Images are resized, 0 disables this limit
1699\$max_brd_img_height = $max_brd_img_height;                          # Set maximum pixel height to which the Board Images are resized, 0 disables this limit
1700\$fix_brd_img_size = $max_brd_img_size;
1701\$img_greybox = $img_greybox;                       # Set to 0 to disable "greybox" (each image is shown in a new window)
1702                                                    # Set to 1 to enable the attachment and post image "greybox" (one image/page)
1703                                                    # Set to 2 to enable the attachment and post image "greybox" =>
1704                                                    # attachment images: (all images/page), post images: (one image/page)
1705
1706########## Extended Profiles ##########
1707\$extendedprofiles = $extendedprofiles;             # Set to 1 to enabled 'Extended Profiles'. Turn it off (0) to save server load.
1708
1709########## Event Calendar ##########
1710
1711# Standard Calendar Setting
1712\$Show_EventCal = 0;
1713\$Event_TodayColor = '#ff0000';
1714\$DisplayEvents = 0;
1715\$CalShortEvent = 0;
1716\$bm_subcut = $bm_subcut;
1717########## File Locking ##########
1718\$checkspace = 0;                                                # Set to 1 to enable any freespace checking (should remain disabled on Windows/IIS servers)
1719\$enable_freespace_check = $enable_freespace_check; # Enable the free disk space check on every pageview?
1720\$gzcomp = $gzcomp;                                 # GZip compression: 0 = No Compression,
1721                                                    # 1 = External gzip, 2 = Zlib::Compress
1722\$gzforce = $gzforce;                               # Do not try to check whether browser supports GZip
1723\$cachebehaviour = $cachebehaviour;                 # Browser Cache Control: 0 = No Cache must revalidate, 1 = Allow Caching
1724\$use_flock = $use_flock;                           # Set to 0 if your server doesn't support file locking,
1725                                                    # 1 for Unix/Linux and WinNT, and 2 for Windows 95/98/ME
1726\$faketruncation = $faketruncation;                 # Enable this option only if YaBB fails with the error:
1727                                                    # "truncate() function not supported on this platform."
1728                                                    # 0 to disable, 1 to enable.
1729\$debug = $debug;                                   # If set to 1 debug info is added to the template
1730                                                    # tags are <yabb fileactions> and <yabb filenames>
1731
1732########## Search Settings ##########
1733\$enableguestsearch = $enableguestsearch;       # Set to 1 to enable guests access to advanced search.
1734\$enableguestquicksearch = $enableguestquicksearch; # Set to 1 to enable guests access to quick search.
1735\$mgqcksearch = "\Q$mgqcksearch\E";
1736\$mgadvsearch = "\Q$mgadvsearch\E";
1737\$qcksearchtype = "\Q$qcksearchtype\E";
1738\$qckage = "\Q$qckage\E";
1739
1740###############################################################################
1741# Advanced Settings                                                           #
1742###############################################################################
1743
1744########## RSS Settings ##########
1745
1746\$rss_disabled = $rss_disabled;         # Set to 1 to disable the RSS feed
1747\$rss_limit = $rss_limit;           # Maximum number of topics in the feed
1748\$rss_message = $rss_message;           # Message to display in the feed
1749                            # 0: None
1750                            # 1: Latest Post
1751                            # 2: Original Post in the topic
1752\$showauthor = $showauthor;         # Show author name
1753\$rssemail = '$rssemail';             # default email if author email not shown
1754\$showdate = $showdate;             # Show post date
1755
1756########## New Member Notification Settings ##########
1757\$new_member_notification = 0;                    # Set to 1 to enable the new member notification
1758\$new_member_notification_mail = "\Q$new_member_notification_mail\E";   # Your "New Member Notification"-email address.
1759
1760\$sendtopicmail = 2;                              # Set to 0 for send NO topic email to friend
1761                                                  # Set to 1 to send topic email to friend via YaBB
1762                                                  # Set to 2 to send topic email to friend via user program
1763                                                  # Set to 3 to let user decide between 1 and 2
1764
1765########## In-Thread Multi Delete ##########
1766
1767\$mdadmin = 1;
1768\$mdglobal = 1;
1769\$mdfmod = 1;
1770\$mdmod = 1;
1771\$adminbin = 0;                                   # Skip recycle bin step for admins and delete directly
1772
1773########## Moderation Update ##########
1774
1775\$adminview = 2;                                  # Multi-admin settings for Administrators:
1776                                                  # 0=none, 1=icons 2=single checkbox 3=multiple checkboxes
1777\$gmodview = 2;                                   # Multi-admin settings for Global Moderators:
1778                                                  # 0=none, 1=icons 2=single checkbox 3=multiple checkboxes
1779\$fmodview = 2;                                   # Multi-admin settings for Forum Moderators:
1780                                                  # 0=none, 1=icons 2=single checkbox 3=multiple checkboxes
1781\$modview = 2;                                    # Multi-admin settings for Board Moderators:
1782                                                  # 0=none, 1=icons 2=single checkbox 3=multiple checkboxes
1783
1784\$maxadminlog = $maxadminlog;                                #Maximum number of entries stored in adminlog.txt (oldest entries are deleted).
1785########## Memberview ##########
1786
1787\$showallgroups = 1;
1788\$OnlineLogTime = 15;                             # Time in minutes before Users are removed from the Online Log
1789\$lastonlineinlink = 0;                           # Show "Last online X days and XX:XX:XX hours ago." to all members == 1
1790
1791########## Polls ##########
1792
1793\$numpolloptions = 8;                             # Number of poll options
1794\$maxpq = 60;                                     # Maximum Allowed Characters in a Poll Qestion?
1795\$maxpo = 50;                                     # Maximum Allowed Characters in a Poll Option?
1796\$maxpc = 0;                                      # Maximum Allowed Characters in a Poll Comment?
1797\$useraddpoll = 1;                                # Allow users to add polls to existing threads? (1 = yes)
1798\$ubbcpolls = 1;                                  # Allow UBBC tags and smilies in polls? (1 = yes)
1799
1800########## Instant Message ##########
1801
1802\$PM_level = 1;
1803\$numposts = 1;                                   # Number of posts required to send Instant Messages
1804\$imspam = 0;                                     # Percent of Users a user is a allowed to send a message at once
1805\$numibox = 20;                                   # Number of maximum Messages in the IM-Inbox
1806\$numobox = 20;                                   # Number of maximum Messages in the IM-Outbox
1807\$numstore = 20;                                  # Number of maximum Messages in the Storage box
1808\$numdraft = 20;                                  # Number of maximum Messages in the Draft box
1809\$enable_imlimit = 0;                             # Set to 1 to enable limitation of incoming and outgoing im messages
1810\$enable_storefolders = 0;                        # enable additonal store folders - in/out are default for all
1811                                                  # 0=no > 1 = number, max 25
1812\$imtext = qq~Welcome to my boards~;
1813\$sendname = admin;
1814\$imsubject = "Hey Hey :)";
1815\$send_welcomeim = 1;
1816\$PMenableBm_level = 3;                            # minimum level to send? 0 = off, 1 = mods, 2 = gmod, 3 = admin
1817
1818########## Topic Summary Cutter ##########
1819
1820\$cutamount  = "15";                              # Number of posts to list in topic summary
1821\$ttsreverse = 0;                                 # Reverse Topic Summaries in Topic (most recent becomes first)
1822\$ttsureverse = 0;                                # Reverse Topic Summaries in Topic (most recent becomes first) allowed as user wishes? Yes == 1
1823\$tsreverse = 1;                                  # Reverse Topic Summaries (So most recent is first
1824
1825########## Time Lock ##########
1826
1827\$tlnomodflag = 1;                                # Set to 1 limit time users may modify posts
1828\$tlnomodtime = 1;                                # Time limit on modifying posts (days)
1829\$tlnodelflag = 1;                                # Set to 1 limit time users may delete posts
1830\$tlnodeltime = 5;                                # Time limit on deleting posts (days)
1831\$tllastmodflag = 1;                              # Set to 1 allow users to modify posts up to
1832                                                  # the specified time limit w/o showing "last Edit" message
1833\$tllastmodtime = 60;                             # Time limit to modify posts w/o triggering "last Edit" message (in minutes)
1834
1835########## File Attachment Settings ##########
1836
1837\$limit = 250;                                    # Set to the maximum number of kilobytes an attachment can be.
1838                                                  # Set to 0 to disable the file size check.
1839\$dirlimit = 10000;                               # Set to the maximum number of kilobytes the attachment directory can hold.
1840                                                  # Set to 0 to disable the directory size check.
1841\$overwrite = 0;                                  # Set to 0 to auto rename attachments if they exist,
1842                                                  # 1 to overwrite them or 2 to generate an error if the file exists already.
1843\@ext = qw(txt doc docx psd pdf bmp jpe jpg jpeg gif png swf zip rar tar); # The allowed file extensions for file attachements.
1844                                                  # The variable should be set in the form of "jpg bmp gif" and so on.
1845\$checkext = 1;                                   # Set to 1 to enable file extension checking,
1846                                                  # set to 0 to allow all file types to be uploaded
1847\$amdisplaypics = 1;                              # Set to 1 to display attached pictures in posts,
1848                                                  # set to 0 to only show a link to them.
1849\$allowattach = 1;                                # Set to the number of maximum files attaching a post,
1850                                                  # set to 0 to disable file attaching.
1851\$allowguestattach = 0;                           # Set to 1 to allow guests to upload attachments, 0 to disable guest attachment uploading.
1852
1853\$allowAttachIM = 0;                            # Set the maximum number of file attachments allowed in personal messages, set to 0 to disable file attachments in personal messages.
1854
1855\@pmAttachExt = qw(txt doc docx psd pdf bmp jpe jpg jpeg gif png swf zip rar tar); # The allowed file extensions for pm file attachments. Variable should be set in the form of "jpg bmp gif" and so on.
1856\$pmFileLimit = 250;                # Set to the maximum number of kilobytes a pm attachment can be. Set to 0 to disable the file size check.
1857\$pmDirLimit = 10000;               # Set to the maximum number of kilobytes the pm attachment directory can hold. Set to 0 to disable the directory size check.
1858\$pmFileOverwrite = 0;              # Set to 0 to auto rename pm attachments if they exist, 1 to overwrite them or 2 to generate an error if the file exists already.
1859
1860########## Error Logger ##########
1861
1862\$elmax  = "50";                                  # Max number of log entries before rotation
1863\$elenable = 1;                                   # allow for error logging
1864\$elrotate = 1;                                   # Allow for log rotation
1865
1866########## Advanced Tabs ##########
1867
1868\$addtab_on = $addtab_on;                         # show advanced tabs on Forum (For admin only.)
1869\@AdvancedTabs = qw(home help search ml admin revalidatesession login register guestpm mycenter logout eventcal birthdaylist ); # Advanced Tabs order and infos
1870
1871########## Smilies ##########
1872
1873\@SmilieURL = ("exclamation.png","question.png"); # Additional Smilies URL
1874\@SmilieCode = (":exclamation",":question");      # Additional Smilies Code
1875\@SmilieDescription = ("Exclaim","Questioning");  # Additional Smilies Description
1876\@SmilieLinebreak = ("","");                      # Additional Smilies Linebreak
1877
1878\$smiliestyle = "2";                              # smiliestyle
1879\$showadded = "2";                                # showadded
1880\$showsmdir = "2";                                # showsmdir
1881\$detachblock = "1";                              # detachblock
1882\$winwidth = "400";                               # winwidth
1883\$winheight = "400";                              # winheight
1884\$popback = "FFFFFF";                             # popback
1885\$poptext = "000000";                             # poptext
1886
1887
1888
1889###############################################################################
1890# Security Settings (old SecSettings.txt)                                     #
1891###############################################################################
1892
1893\$regcheck = 0;                             # Set to 1 if you want to enable automatic flood protection enabled
1894\$codemaxchars = 6;                         # Set max length of validation code (15 is max)
1895\$rgb_foreground = "\#0000EE";              # Set hex RGB value for validation image foreground color
1896\$rgb_shade = "\#999999";                   # Set hex RGB value for validation image shade color
1897\$rgb_background = "\#FFFFFF";              # Set hex RGB value for validation image background color
1898\$translayer = 0;                           # Set to 1 background for validation image should be transparent
1899\$randomizer = 0;                           # Set 0 to 3 to create background random noise
1900                                            # based on foreground or shade color or both
1901\$stealthurl = 0;                           # Set to 1 to mask referer url to hosts if a hyperlink is clicked.
1902\$referersecurity = 0;                      # Set to 1 to activate referer security checking.
1903\$do_scramble_id = 1;                       # Set to 1 scambles all visible links containing user ID's
1904\$sessions = 1;                             # Set to 1 to activate session id protection.
1905\$show_online_ip_admin = 1;                 # Set to 1 to show online IP's to admins.
1906\$show_online_ip_gmod = 1;                  # Set to 1 to show online IP's to global moderators.
1907\$show_online_ip_fmod = 1;                  # Set to 1 to show online IP's to forum moderators.
1908\$masterkey = '$masterkey';                 # Seed for encryption of captcha's
1909\$ipLookup = 1;                             # Set to 1 to enable IP Lookup.
1910
1911
1912###############################################################################
1913# Guardian Settings (old Guardian.banned and Guardian.settings)               #
1914###############################################################################
1915
1916\$banned_harvesters = qq~alexibot|asterias|backdoorbot|black.hole|blackwidow|blowfish|botalot|builtbottough|bullseye|bunnyslippers|cegbfeieh|cheesebot|cherrypicker|chinaclaw|copyrightcheck|cosmos |crescent|custo|disco|dittospyder|download demon|ecatch|eirgrabber|emailcollector|emailsiphon|emailwolf|erocrawler|eseek-larbin|express webpictures|extractorpro|eyenetie|fast|flashget|foobot|frontpage|fscrawler|getright|getweb|go!zilla|go-ahead-got-it|grabnet|grafula|gsa-crawler|harvest|hloader|hmview|httplib|httrack|humanlinks|ia_archiver|image stripper|image sucker|indy library|infonavirobot|interget|internet ninja|jennybot|jetcar|joc web spider|kenjin.spider|keyword.density|larbin|leechftp|lexibot|libweb/clshttp|linkextractorpro|linkscan/8.1a.unix|linkwalker|lwp-trivial|mass downloader|mata.hari|microsoft.url|midown tool|miixpc|mister pix|moget|mozilla.*newt|mozilla/3.mozilla/2.01|navroad|nearsite|net vampire|netants|netmechanic|netspider|netzip|nicerspro|npbot|octopus|offline explorer|offline navigator|openfind|pagegrabber|papa foto|pavuk|pcbrowser|propowerbot/2.14|prowebwalker|queryn.metasearch|realdownload|reget|repomonkey|sitesnagger|slysearch|smartdownload|spankbot|spanner |spiderzilla|steeler|superbot|superhttp|surfbot|suzuran|szukacz|takeout|teleport pro|telesoft|the.intraformant|thenomad|tighttwatbot|titan|tocrawl/urldispatcher|true_robot|turingos|turnitinbot|urly.warning|vci|voideye|web image collector|web sucker|web.image.collector|webauto|webbandit|webbandit|webcopier|webemailextrac.*|webenhancer|webfetch|webgo is|webleacher|webmasterworldforumbot|webreaper|websauger|website extractor|website quester|webster.pro|webstripper|webwhacker|webzip|wget|widow|www-collector-e|wwwoffle|xaldon webspider|xenu link sleuth|zeus~;
1917\$banned_referers = qq~hotsex.com|porn.com~;
1918\$banned_requests = qq~~;
1919\$banned_strings = qq~pussy|cunt~;
1920\$whitelist = qq~~;
1921
1922\$use_guardian = 1;
1923\$use_htaccess = 0;
1924
1925\$disallow_proxy_on = 0;
1926\$referer_on = 1;
1927\$harvester_on = 0;
1928\$request_on = 0;
1929\$string_on = 1;
1930\$union_on = 1;
1931\$clike_on = 1;
1932\$script_on = 1;
1933
1934\$disallow_proxy_notify = 1;
1935\$referer_notify = 0;
1936\$harvester_notify = 1;
1937\$request_notify = 0;
1938\$string_notify = 1;
1939\$union_notify = 1;
1940\$clike_notify = 1;
1941\$script_notify = 1;
1942
1943###############################################################################
1944# Banning Settings  Moved to banlist.txt New timed ban settings              #
1945###############################################################################
1946\@timeban = qw( d w m p );
1947\@bandays = ( 1, 7, 30,  365 );
1948###############################################################################
1949# Backup Settings                                                             #
1950###############################################################################
1951
1952\@backup_paths = qw();
1953\$backupmethod = '';
1954\$compressmethod = '';
1955\$backupprogusr = '';
1956\$backupprogbin = '';
1957\$backupdir = '';
1958\$lastbackup = 0;
1959\$backupsettingsloaded = 0;
1960
19611;
1962EOF
1963
1964    fopen( SETTING, ">$vardir/Settings.pm" )
1965      || setup_fatal_error( "$maintext_23 $vardir/Settings.pm: ", 1 );
1966    print {SETTING} nicely_aligned_file($setfile)
1967      or croak 'cannot print Settings.pm';
1968    fclose(SETTING);
1969    if ( $action eq 'setinstall2' ) {
1970        LoadUser('admin');
1971        ${ $uid . 'admin' }{'email'} = $webmaster_email;
1972        ${ $uid . 'admin' }{'regdate'}    = timetostring($date);
1973        ${ $uid . 'admin' }{'regtime'}    = $date;
1974        ${ $uid . 'admin' }{'timeselect'} = $timeselected;
1975        ${ $uid . 'admin' }{'language'}   = $lang;
1976        UserAccount( 'admin', 'update' );
1977        ManageMemberinfo( 'update', 'admin', 'Administrator', $webmaster_email,'Forum Administrator' );
1978        $yySetLocation = qq~$set_cgi?action=setup3~;
1979        redirectexit();
1980    }
1981    return;
1982}
1983
1984sub tempstarter {
1985    return if !-e "$vardir/Settings.pm";
1986
1987    $YaBBversion = 'YaBB 2.6.11';
1988
1989    # Make sure the module path is present
1990    push @INC, './Modules';
1991
1992    if ( $ENV{'SERVER_SOFTWARE'} =~ /IIS/sm ) {
1993        $yyIIS = 1;
1994        $PROGRAM_NAME =~ m{(.*)(\\|/)}sm;
1995        $yypath = $1;
1996        $yypath =~ s/\\/\//gxsm;
1997        chdir $yypath;
1998        push @INC, $yypath;
1999    }
2000
2001    # Requirements and Errors
2002    require Variables::Settings;
2003    LoadCookie();    # Load the user's cookie (or set to guest)
2004    LoadUserSettings();
2005    WhatTemplate();
2006    WhatLanguage();
2007    require Sources::Security;
2008    WriteLog();
2009    return;
2010}
2011
2012sub CheckInstall {
2013    tempstarter();
2014    my $install_error;
2015    my $firstmstime = time();
2016    $windowbg = '#fafafa';
2017    $header   = '#5488ba';
2018    $catbg    = '#ddd';
2019
2020    $set_missing = q{};
2021    $set_created = q{};
2022    if   ( !-e "$vardir/Settings.pm" ) { $set_missing = q~Settings.pm~; }
2023    else                               { $set_created = q~Settings.pm~; }
2024
2025    $brd_missing = q{};
2026    $brd_created = q{};
2027    if ( !-e "$boardsdir/forum.control" ) {
2028        $brd_missing .= q~forum.control, ~;
2029    }
2030    else { $brd_created .= q~forum.control, ~; }
2031    if ( !-e "$boardsdir/forum.master" ) { $brd_missing .= q~forum.master, ~; }
2032    else                                 { $brd_created .= q~forum.master, ~; }
2033    if ( !-e "$boardsdir/forum.totals" ) { $brd_missing .= q~forum.totals, ~; }
2034    else {
2035        $brd_created .= q~forum.totals, ~;
2036        fopen( FORUMTOT, "$boardsdir/forum.totals" )
2037          || setup_fatal_error( "$maintext_23 $boardsdir/forum.totals: ", 1 );
2038        @totboards = <FORUMTOT>;
2039        fclose(FORUMTOT);
2040    }
2041    foreach my $boardstot (@totboards) {
2042        chomp $boardstot;
2043        ( $brdname, undef, undef, undef, undef, $msgname, undef ) =
2044          split /\|/xsm, $boardstot, 7;
2045        if ( !-e "$boardsdir/$brdname.txt" ) {
2046            $brd_missing .= qq~$brdname.txt, ~;
2047        }
2048        else { $brd_created .= qq~$brdname.txt, ~; }
2049
2050    }
2051    $brd_missing =~ s/, $//sm;
2052    $brd_created =~ s/, $//sm;
2053    fopen( FORUMTOTALS, ">$boardsdir/forum.totals" ) || setup_fatal_error( "$maintext_23 $boardsdir/forum.totals: ", 1 );
2054    for my $boardstot (@totboards) {
2055        chomp $boardstot;
2056        ( $brdname, undef, undef, undef, undef, $msgname, undef ) =
2057          split /\|/xsm, $boardstot;
2058        if ( $brdname eq 'general') {
2059            print {FORUMTOTALS} "general|1|1|$firstmstime|admin|$firstmstime|0|Welcome to your new YaBB 2.6.11 forum!|xx|0|\n" or croak 'cannot print FORUMTOTALS';
2060        }
2061        else { print {FORUMTOTALS} qq~$boardstot\n~; }
2062    }
2063    fclose(FORUMTOTALS);
2064    fopen ( FIRSTMS, ">$datadir/$firstmstime.txt");
2065    print {FIRSTMS} qq~Welcome to your New YaBB 2.6.11 Forum!|Administrator|webmaster@mysite.com|$firstmstime|admin|xx|0|127.0.0.1|Welcome to your new YaBB 2.6.11 forum.<br /><br />The YaBB team would like to thank you for choosing Yet another Bulletin Board for your forum needs. We pride ourselves on the cost (FREE), the features, and the security. Visit http://www.yabbforum.com to view the latest development information, read YaBB news, and participate in community discussions.<br /><br />Make sure you login to your new forum as an administrator and visit the Admin Center. From there, you can maintain your forum. You'll want to look at all of the settings, membergroups, categories/boards, and security options to make sure they are set properly according to your needs.||||\n~;
2066    fclose(FIRSTMS);
2067    require Sources::DateTime;
2068    fopen (FIRSTMSC, ">$datadir/$firstmstime.ctb");
2069    $msgdat = timeformat( $firstmstime, 1, 'rfc' );
2070    print {FIRSTMSC} qq~### ThreadID: $firstmstime, LastModified: $msgdat  ###
2071
2072'board',"general"
2073'replies',"0"
2074'views',"1"
2075'lastposter',"admin"
2076'lastpostdate',"$firstmstime"
2077'threadstatus',"0"
2078'repliers',"$firstmstime|admin|0"~;
2079    fclose (FIRSTMSC);
2080    fopen ( FIRSTBRD, ">>$boardsdir/general.txt");
2081    print {FIRSTBRD} qq~$firstmstime|Welcome to your New YaBB 2.6 Forum!|Administrator|$webmaster_email|$firstmstime|0|admin|xx|0\n~;
2082    fclose (FIRSTBRD);
2083
2084    $mem_missing = q{};
2085    $mem_created = q{};
2086    if ( !-e "$memberdir/admin.outbox" ) { $mem_missing .= q~admin.outbox, ~; }
2087    else                                 { $mem_created .= q~admin.outbox, ~; }
2088    if   ( !-e "$memberdir/admin.vars" ) { $mem_missing .= q~admin.vars, ~; }
2089    else                                 { $mem_created .= q~admin.vars, ~; }
2090    if ( !-e "$memberdir/memberlist.txt" ) {
2091        $mem_missing .= q~memberlist.txt, ~;
2092    }
2093    else { $mem_created .= q~memberlist.txt, ~; }
2094    if ( !-e "$memberdir/memberinfo.txt" ) {
2095        $mem_missing .= q~memberinfo.txt, ~;
2096    }
2097    else { $mem_created .= q~memberinfo.txt, ~; }
2098    if   ( !-e "$memberdir/members.ttl" ) { $mem_missing .= q~members.ttl~; }
2099    else                                  { $mem_created .= q~members.ttl~; }
2100    $mem_missing =~ s/, $//sm;
2101    $mem_created =~ s/, $//sm;
2102
2103    $msg_missing = q{};
2104    $msg_created = q{};
2105
2106    if ( -e "$boardsdir/forum.totals" ) {
2107        fopen( FORUMTOT, "$boardsdir/forum.totals" )
2108          || setup_fatal_error( "$maintext_23 $boardsdir/forum.totals: ", 1 );
2109        @totboards = <FORUMTOT>;
2110        fclose(FORUMTOT);
2111    }
2112    foreach my $boardstot (@totboards) {
2113        chomp $boardstot;
2114        ( $brdname, undef, undef, undef, undef, $msgname, undef ) =
2115          split /\|/xsm, $boardstot, 7;
2116        next if !$msgname;
2117        if ( !-e "$datadir/$msgname.ctb" ) {
2118            $msg_missing .= qq~$msgname.ctb, ~;
2119        }
2120        else { $msg_created .= qq~$msgname.ctb, ~; }
2121        if ( !-e "$datadir/$msgname.txt" ) {
2122            $msg_missing .= qq~$msgname.txt, ~;
2123        }
2124        else { $msg_created .= qq~$msgname.txt~; }
2125    }
2126    $msg_missing =~ s/, $//sm;
2127    $msg_created =~ s/, $//sm;
2128
2129    $var_missing = q{};
2130    $var_created = q{};
2131    if   ( !-e "$vardir/adminlog.txt" ) { $var_missing .= q~adminlog.txt, ~; }
2132    else                                { $var_created .= q~adminlog.txt, ~; }
2133    if   ( !-e "$vardir/allowed.txt" ) { $var_missing .= q~allowed.txt, ~; }
2134    else                               { $var_created .= q~allowed.txt, ~; }
2135    if   ( !-e "$vardir/attachments.txt" ) { $var_missing .= q~attachments.txt, ~; }
2136    else                                   { $var_created .= q~attachments.txt, ~; }
2137    if   ( !-e "$vardir/pm.attachments" ) { $var_missing .= q~pm.attachments, ~; }
2138    else                                  { $var_created .= q~attachments.txt, ~; }
2139    if   ( !-e "$vardir/ban_log.txt" ) { $var_missing .= q~ban_log.txt, ~; }
2140    else                               { $var_created .= q~ban_log.txt, ~; }
2141    if   ( !-e "$vardir/banlist.txt" ) { $var_missing .= q~banlist.txt, ~; }
2142    else                               { $var_created .= q~banlist.txt, ~; }
2143    if   ( !-e "$vardir/clicklog.txt" ) { $var_missing .= q~clicklog.txt, ~; }
2144    else                                { $var_created .= q~clicklog.txt, ~; }
2145    if   ( !-e "$vardir/errorlog.txt" ) { $var_missing .= q~errorlog.txt, ~; }
2146    else                                { $var_created .= q~errorlog.txt, ~; }
2147    if   ( !-e "$vardir/flood.txt" ) { $var_missing .= q~flood.txt, ~; }
2148    else                             { $var_created .= q~flood.txt, ~; }
2149
2150    if ( !-e "$vardir/gmodsettings.txt" ) {
2151        $var_missing .= q~gmodsettings.txt, ~;
2152    }
2153    else { $var_created .= q~gmodsettings.txt, ~; }
2154    if   ( !-e "$vardir/log.txt" ) { $var_missing .= q~log.txt, ~; }
2155    else                           { $var_created .= q~log.txt, ~; }
2156    if   ( !-e "$vardir/modlist.txt" ) { $var_missing .= q~modlist.txt, ~; }
2157    else                               { $var_created .= q~modlist.txt, ~; }
2158    if   ( !-e "$vardir/news.txt" ) { $var_missing .= q~news.txt, ~; }
2159    else                            { $var_created .= q~news.txt, ~; }
2160    if   ( !-e "$vardir/oldestmes.txt" ) { $var_missing .= q~oldestmes.txt, ~; }
2161    else                                 { $var_created .= q~oldestmes.txt, ~; }
2162
2163    if ( !-e "$vardir/registration.log" ) {
2164        $var_missing .= q~registration.log, ~;
2165    }
2166    else { $var_created .= q~registration.log, ~; }
2167    if   ( !-e "$vardir/reserve.txt" ) { $var_missing .= q~reserve.txt, ~; }
2168    else                               { $var_created .= q~reserve.txt, ~; }
2169    if ( !-e "$vardir/reservecfg.txt" ) {
2170        $var_missing .= q~reservecfg.txt, ~;
2171    }
2172    else { $var_created .= q~reservecfg.txt, ~; }
2173    $var_missing =~ s/, $//sm;
2174    $var_created =~ s/, $//sm;
2175
2176    $yymain .= q~
2177    <table class="tabtitle">
2178        <tr>
2179             <td class="shadow" style="padding-left:1%">Checking System Files</td>
2180        </tr>
2181    </table>
2182<div class="boardcontainer">
2183    <table class="border-space pad-cell">
2184        <col style="width:6%" />
2185        <col style="width:94%" />
2186        <tr>
2187            <td class="catbg" colspan="2">
2188      ~;
2189    if ($no_brddir) {
2190        $install_error = 1;
2191        $yymain .= qq~
2192      A problem has occurred in the /Boards folder!
2193            </td>
2194        </tr><tr>
2195            <td class="windowbg center"><img src="$imagesdir/cross.png" alt="" /></td>
2196            <td class="windowbg2">No /Boards folder available!</td>
2197        </tr>~;
2198    }
2199    else {
2200        if ($brd_missing) {
2201            $install_error = 1;
2202            $yymain .= qq~
2203      A problem has occurred in the /Boards folder!
2204            </td>
2205        </tr><tr>
2206            <td class="windowbg center"><img src="$imagesdir/cross.png" alt="" /></td>
2207            <td class="windowbg2">
2208                <b>Missing: </b>
2209                <br />$brd_missing
2210            </td>
2211        </tr>~;
2212        }
2213        if ($brd_created) {
2214            if ( !$brd_missing ) {
2215                $yymain .= q~
2216      Successfully checked the /Boards folder!
2217            </td>
2218        </tr>~;
2219            }
2220            $yymain .= qq~<tr>
2221            <td class="windowbg center">
2222      <img src="$imagesdir/check.png" alt="" />
2223            </td>
2224            <td class="windowbg2">
2225                <b>Installed: </b>
2226                <br />$brd_created
2227            </td>
2228        </tr>~;
2229        }
2230    }
2231    $yymain .= q~<tr>
2232            <td class="catbg" colspan="2">
2233      ~;
2234
2235    if ($no_memdir) {
2236        $install_error = 1;
2237        $yymain .= qq~
2238      A Problem has occurred in the /Members folder!
2239            </td>
2240        </tr><tr>
2241            <td class="windowbg center"><img src="$imagesdir/cross.png" alt="" /></td>
2242            <td class="windowbg2">
2243      No /Members folder available!
2244            </td>
2245        </tr>~;
2246    }
2247    else {
2248        if ($mem_missing) {
2249            $install_error = 1;
2250            $yymain .= qq~
2251      A problem has occurred in the /Members folder!
2252            </td>
2253        </tr><tr>
2254            <td class="windowbg center"><img src="$imagesdir/cross.png" alt="" /></td>
2255            <td class="windowbg2">
2256                <b>Missing: </b>
2257                <br />$mem_missing
2258            </td>
2259        </tr>~;
2260        }
2261        if ($mem_created) {
2262            if ( !$mem_missing ) {
2263                $yymain .= q~
2264      Successfully checked the /Members folder!
2265            </td>
2266        </tr>~;
2267            }
2268            $yymain .= qq~<tr>
2269            <td class="windowbg center"><img src="$imagesdir/check.png" alt="" /></td>
2270            <td class="windowbg2">
2271                <b>Installed: </b>
2272                <br />$mem_created
2273            </td>
2274        </tr>~;
2275        }
2276    }
2277    $yymain .= q~<tr>
2278            <td class="catbg" colspan="2">~;
2279
2280    if ($no_mesdir) {
2281        $install_error = 1;
2282        $yymain .= qq~
2283      A problem has occurred in the /Messages folder!
2284            </td>
2285        </tr><tr>
2286            <td class="windowbg center"><img src="$imagesdir/cross.png" alt="" /></td>
2287            <td class="windowbg2">
2288      No /Messages folder available!
2289            </td>
2290        </tr>~;
2291    }
2292    else {
2293        if ($msg_missing) {
2294            $install_error = 1;
2295            $yymain .= qq~
2296      A problem has occurred in the /Messages folder!
2297            </td>
2298        </tr><tr>
2299            <td class="windowbg center"><img src="$imagesdir/cross.png" alt="" /></td>
2300            <td class="windowbg2">
2301                <b>Missing: </b>
2302                <br />$msg_missing
2303            </td>
2304        </tr>~;
2305        }
2306        if ($msg_created) {
2307            if ( !$msg_missing ) {
2308                $yymain .= q~
2309      Successfully checked the /Messages folder!
2310            </td>
2311        </tr>~;
2312            }
2313            $yymain .= qq~<tr>
2314            <td class="windowbg center"><img src="$imagesdir/check.png" alt="" /></td>
2315            <td class="windowbg2">
2316                <b>Installed: </b>
2317                <br />$msg_created
2318            </td>
2319        </tr>~;
2320        }
2321    }
2322    $yymain .= q~<tr>
2323            <td class="catbg" colspan="2">
2324      ~;
2325    if ($no_vardir) {
2326        $install_error = 1;
2327        $yymain .= qq~
2328      A problem has occurred in the /Variables folder!
2329            </td>
2330        </tr><tr>
2331            <td class="windowbg center"><img src="$imagesdir/cross.png" alt="" /></td>
2332            <td class="windowbg2">
2333      No /Variables folder available!
2334           </td>
2335        </tr>~;
2336    }
2337    else {
2338        if ($var_missing) {
2339            $install_error = 1;
2340            $yymain .= qq~
2341      A problem has occurred in the /Variables folder!
2342            </td>
2343        </tr><tr>
2344            <td class="windowbg center"><img src="$imagesdir/cross.png" alt="" /></td>
2345            <td class="windowbg2">
2346                <b>Missing: </b>
2347                <br />$var_missing
2348            </td>
2349        </tr>~;
2350        }
2351        if ($var_created) {
2352            if ( !$var_missing ) {
2353                $yymain .= q~
2354      Successfully checked the /Variables folder!
2355            </td>
2356        </tr>~;
2357            }
2358            $yymain .= qq~<tr>
2359            <td class="windowbg center"><img src="$imagesdir/check.png" alt="" /></td>
2360            <td class="windowbg2">
2361                <b>Installed: </b>
2362                <br />$var_created
2363            </td>
2364        </tr>~;
2365        }
2366    }
2367
2368    $yymain .= q~<tr>
2369            <td class="catbg" colspan="2">
2370                ~;
2371
2372    if ($set_missing) {
2373        $install_error = 1;
2374        $yymain .= q~A problem has occurred while creating Settings.pm!
2375            </td>
2376        </tr>~;
2377    }
2378    if ($set_created) {
2379        $yymain .= qq~Successfully checked Settings.pm!
2380            </td>
2381        </tr><tr>
2382            <td class="windowbg center"><img src="$imagesdir/check.png" alt="" /></td>
2383            <td class="windowbg2">
2384      Click on 'Continue' and go to your <i>Admin Center - Forum Settings</i> to set the options for your YaBB 2.6.11 forum.<br />Or to convert a 1x or 2x Forum to 2.6.11
2385            </td>
2386        </tr>~;
2387    }
2388
2389    if ( !$install_error ) {
2390
2391        $yymain .= qq~<tr>
2392            <td class="catbg center" colspan="2">
2393      <form action="$set_cgi?action=ready;nextstep=YaBB" method="post" style="display: inline;">
2394            <input type="submit" value="Continue" />
2395      </form>
2396            <p class="center">You can access the 1x and 2x Conversion Utilities through the Admin Center</p>
2397            </td>
2398        </tr>~;
2399    }
2400    else {
2401        $yymain .= q~<tr>
2402            <td class="titlebg" colspan="2">
2403                <div class="div98"><b>One or more errors occurred while checking the system files. The problems must be solved before you may continue.</b></div>
2404            </td>
2405        </tr>~;
2406    }
2407    $yymain .= q~
2408      </table>
2409</div>
2410      ~;
2411    $yyim    = 'You are running YaBB 2.6.11 Setup.';
2412    $yytitle = 'YaBB 2.6.11 Setup';
2413    SetupTemplate();
2414    return;
2415}
2416
2417sub ready {
2418    if ( -e "$INFO{'nextstep'}.$yyext" ) {
2419        UpdateCookie('delete');
2420        $yySetLocation = qq~$INFO{'nextstep'}.$yyext?action=revalidatesession~;
2421    }
2422
2423    CreateSetupLock();
2424    unlink "$vardir/cook.txt";
2425    redirectexit();
2426    return;
2427}
2428
2429sub CreateSetupLock {
2430    fopen( 'LOCKFILE', ">$vardir/Setup.lock" )
2431      || setup_fatal_error( "$maintext_23 $vardir/Setup.lock: ", 1 );
2432    print {LOCKFILE} qq~This is a lockfile for the Setup Utility.\n~
2433      or croak 'cannot print to Setup.lock';
2434    print {LOCKFILE}
2435      qq~It prevents it being run again after it has been run once.\n~
2436      or croak 'cannot print to Setup.lock';
2437    print {LOCKFILE}
2438      q~Delete this file if you want to run the Setup Utility again.~
2439      or croak 'cannot print to Setup.lock';
2440    fclose('LOCKFILE');
2441    return;
2442}
2443
2444sub SetupImgLoc {
2445    if ( !-e "$htmldir/Templates/Forum/$useimages/$_[0]" ) {
2446        $thisimgloc = qq~img src="$yyhtml_root/Templates/Forum/default/$_[0]"~;
2447    }
2448    else { $thisimgloc = qq~img src="$imagesdir/$_[0]"~; }
2449    return $thisimgloc;
2450}
2451
2452sub setup_fatal_error {
2453      my $e = $_[0];
2454      my $v = $_[1];
2455      $e .= "\n";
2456      if ($v) { $e .= $! . "\n"; }
2457
2458      $yymenu = qq~Boards & Categories | ~;
2459      $yymenu .= qq~Members | ~;
2460      $yymenu .= qq~Messages | ~;
2461      $yymenu .= qq~Date & Time | ~;
2462      $yymenu .= qq~Clean Up | ~;
2463      $yymenu .= qq~Login~;
2464
2465      $yymain .= qq~
2466<table class="bordercolor center border-space pad-cell" width="80%" >
2467    <tr>
2468        <td class="titlebg text1"><b>An Error Has Occurred!</b></td>
2469  </tr><tr>
2470        <td class="windowbg text1" style="padding:1em 1em 2em 1em">$e</td>
2471    </tr>
2472</table>
2473<p style="text-align:center"><a href="javascript:history.go(-1)">Back</a></p>
2474~;
2475      $yyim    = "YaBB 2.6.11 Setup Error.";
2476      $yytitle = "YaBB 2.6.11 Setup Error.";
2477
2478      if (!-e "$vardir/Settings.pm") { SimpleOutput(); }
2479
2480      tempstarter();
2481      SetupTemplate();
2482}
2483
2484sub SimpleOutput {
2485    $gzcomp = 0;
2486    print_output_header();
2487
2488    print qq~
2489<!DOCTYPE html>
2490<html lang='en-US'>
2491<head>
2492    <meta charset="utf-8">
2493    <title>YaBB 2.6.11 Setup</title>
2494    <style type="text/css">
2495        html, body {color:#000; font-family:Verdana, Helvetica, Arial, Sans-Serif; font-size:13px; background-color:#eee}
2496        div#folderfind { margin:1em auto; padding:0 1em}
2497        #folderfind table {width:100%; background-color:#DDE3EB; margin:0 auto; border-collapse:collapse;}
2498        #folderfind td {text-align:left; padding:3px; border:thin #000 solid;}
2499        #folderfind .txt_a {font-size:11px;}
2500        #folderfind .windowbg {background-color: $windowbg;}
2501        #folderfind .windowbg2 {background-color: $windowbg2;}
2502        #folderfind .header {background-color:$header;}
2503        #folderfind .catbg {background-color:$catbg; text-align:center; color:#fff; }
2504    </style>
2505</head>
2506<body>
2507<!-- Main Content -->
2508$yymain
2509</body>
2510</html>
2511    ~ or croak 'cannot print page to screen';
2512    exit;
2513}
2514
2515sub SetupTemplate {
2516    $gzcomp = fileno GZIP ? 1 : 0;
2517    print_output_header();
2518
2519    $yyposition = $yytitle;
2520    $yytitle    = "$mbname - $yytitle";
2521
2522    $yyimages        = $imagesdir;
2523    $yydefaultimages = $defaultimagesdir;
2524    $yystyle =
2525qq~<link rel="stylesheet" href="$yyhtml_root/Templates/Forum/$usestyle.css" type="text/css" />\n<link rel="stylesheet" href="$yyhtml_root/Templates/Forum/setup.css" type="text/css" />\n~;
2526    $yystyle =~ s/$usestyle\///gxsm;
2527
2528    $yytemplate = "$templatesdir/$usehead/$usehead.html";
2529    fopen( TEMPLATE, "$yytemplate" )
2530      || setup_fatal_error( "$maintext_23 $yytemplate: ", 1 );
2531    @yytemplate = <TEMPLATE>;
2532    fclose(TEMPLATE);
2533
2534    my $output = q{};
2535    $yyboardname = $mbname;
2536    $yytime = timeformat( $date, 1 );
2537    $yyuname =
2538      $iamguest ? q{} : qq~$maintxt{'247'} ${$uid.$username}{'realname'}, ~;
2539
2540    if ($enable_news) {
2541        fopen( NEWS, "$vardir/news.txt" );
2542        @newsmessages = <NEWS>;
2543        fclose(NEWS);
2544    }
2545    for my $i ( 0 .. ( @yytemplate - 1 ) ) {
2546        $curline = $yytemplate[$i];
2547        if ( !$yycopyin && $curline =~ m/{yabb copyright}/sm )
2548        {
2549            $yycopyin = 1;
2550        }
2551        if ( $curline =~ m/{yabb newstitle}/sm && $enable_news ) {
2552            $yynewstitle = qq~<b>$maintxt{'102'}:</b> ~;
2553        }
2554        if ( $curline =~ m/{yabb news}/sm && $enable_news ) {
2555            srand;
2556            if ( $shownewsfader == 1 ) {
2557
2558                $fadedelay = ( $maxsteps * $stepdelay );
2559                $yynews .= qq~
2560                        <script type="text/javascript">
2561                                    var maxsteps = "$maxsteps";
2562                                    var stepdelay = "$stepdelay";
2563                                    var fadelinks = $fadelinks;
2564                                    var delay = "$fadedelay";
2565                                    var bcolor = "$color{'faderbg'}";
2566                                    var tcolor = "$color{'fadertext'}";
2567                                    var fcontent = new Array();
2568                                    var begintag = "";
2569                        ~;
2570                fopen( NEWS, "$vardir/news.txt" );
2571                @newsmessages = <NEWS>;
2572                fclose(NEWS);
2573                for my $j ( 0 .. ( @newsmessages - 1 ) ) {
2574                    $newsmessages[$j] =~ s/\n|\r//gsm;
2575                    if ( $newsmessages[$j] eq q{} ) { next; }
2576                    if ( $i != 0 ) { $yymain .= qq~\n~; }
2577                    $message = $newsmessages[$j];
2578                    if ($enable_ubbc) {
2579                        enable_yabbc();
2580                        DoUBBC();
2581                        }
2582                    $message =~ s/"/\\"/gsm;
2583                    $yynews .= qq~
2584                                    fcontent[$j] = "$message";\n
2585                              ~;
2586                }
2587                $yynews .= q~
2588                                    var closetag = '';
2589                        </script>
2590                        ~;
2591            }
2592            else {
2593                $message = $newsmessages[ int rand @newsmessages ];
2594                if ($enable_ubbc) {
2595                    enable_yabbc();
2596                    DoUBBC();
2597                }
2598                $message =~ s/\'/&#39;/xsm;
2599                $yynews = qq~
2600            <script type="text/javascript">
2601                if (ie4 || DOM2) var news = '$message';
2602                var div = document.getElementById("newsdiv");
2603                div.innerHTML = news;
2604            </script>~;
2605           }
2606        }
2607        $yyurl = $scripturl;
2608        $curline =~ s/{yabb\s+(\w+)}/${"yy$1"}/gxsm;
2609        $curline =~ s/<yabb\s+(\w+)>/${"yy$1"}/gxsm;
2610        $curline =~ s/img src\=\"$imagesdir\/(.+?)\"/SetupImgLoc($1)/eigxsm;
2611        $output .= $curline;
2612    }
2613    if ( $yycopyin == 0 ) {
2614        $output =
2615q~<h1 style="text-align:center"><b>Sorry, the copyright tag &#123;yabb copyright&#125; must be in the template.<br />Please notify this forum&#39;s administrator that this site is using an ILLEGAL copy of YaBB!</b></h1>~;
2616    }
2617    if ( fileno GZIP ) {
2618        $OUTPUT_AUTOFLUSH = 1;
2619        print {GZIP} $output or croak 'cannot print gzip';
2620        close GZIP or croak 'cannot close GZIP';
2621    }
2622    else {
2623        print $output or croak 'cannot print output';
2624    }
2625    exit;
2626}
2627
2628sub nicely_aligned_file {
2629    $filler = q{ } x 50;
2630
2631    # Make files look nicely aligned. The comment starts after 50 Col
2632
2633    my $setfile = shift;
2634    $setfile =~ s/=\s+;/= 0;/gsm;
2635    $setfile =~
2636s/(.+;)[ \t]+(#.+$)/ $1 . substr($filler,(length $1 < 50 ? length $1 : 49)) . $2 /gem;
2637    $setfile =~ s/\t+(#.+$)/$filler$1/gsm;
2638
2639
2640    *cut_comment = sub {    # line break of too long comments
2641        my @x = @_;
2642        my ( $comment, $length ) =
2643          ( q{}, 120 );    # 120 Col is the max width of page
2644        my $var_length = length $x[0];
2645        while ( $length < $var_length ) { $length += 120; }
2646        foreach ( split / +/sm, $x[1] ) {
2647            if ( ( $var_length + length($comment) + length $_ ) > $length ) {
2648                $comment =~ s/ $//sm;
2649                $comment .= "\n$filler#  $_ ";
2650                $length += 120;
2651            }
2652            else { $comment .= "$_ "; }
2653        }
2654        $comment =~ s/ $//sm;
2655        return $comment;
2656    };
2657    $setfile =~ s/(.+)(#.+$)/ $1 . cut_comment($1,$2) /gem;
2658    return $setfile;
2659}
2660
2661sub FoundSetupLock {
2662    tempstarter();
2663    $scripturl = "$boardurl/YaBB.$yyext";
2664    require Sources::TabMenu;
2665
2666    #    $formsession = cloak("$mbname$username");
2667    if ( -e "$vardir/Converter.lock" ) {
2668        $conv = q{};
2669        $conv2 =
2670qq~The 1x to 2.6.11 Converter has already been run.<br />To run the Converter again, remove the file "$vardir/Converter.lock," then re-visit this page.~;
2671
2672    }
2673    else {
2674        $conv =
2675          qq~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2676                <form action="Convert.$yyext" method="post" style="display: inline;">
2677                    <input type="submit" value="Convert 1x files" />
2678                </form>~;
2679    }
2680    if ( -e "$vardir/FixFile.lock" ) {
2681        $fixa = q{};
2682        $fixa2 =
2683qq~The 2x Conversion Utility has already been run.<br />To run Utility again, remove the file "$vardir/Convert2x.lock," then re-visit this page.~;
2684
2685    }
2686    else {
2687        $fixa =
2688          qq~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2689                <form action="Convert2x.$yyext" method="post" style="display: inline;">
2690                    <input type="submit" value="Convert 2x files" />
2691                </form>~;
2692}
2693
2694    $yymain = qq~
2695<div class="bordercolor borderbox">
2696    <table class="tabtitle">
2697        <tr>
2698            <td style="padding-left:1%; text-shadow: 1px 1px 1px #2d2d2d;">
2699                YaBB 2.6.11 Setup
2700            </td>
2701        </tr>
2702    </table>
2703    <table>
2704        <col style="width:5%" />
2705        <col style="width:95%" />
2706        <tr>
2707            <td class="windowbg2 center" style="padding: 4px">
2708                <img src="$imagesdir/info.png" alt="" />
2709            </td>
2710            <td class="windowbg2 center" style="padding: 4px">
2711                Setup has already been run.
2712                <br />
2713                To run Setup again, remove the file "$vardir/Setup.lock" then re-visit this page.<br />
2714                $conv2
2715                $fixa2
2716            </td>
2717        </tr><tr>
2718            <td class="catbg center"  style="padding: 4px" colspan="2">
2719                <form action="$boardurl/YaBB.$yyext" method="post" style="display: inline;">
2720                    <input type="submit" value="Go to your Forum" />
2721<!--                  <input type="hidden" name="formsession" value="$formsession" />-->
2722                </form>
2723                $conv
2724                $fixa
2725            </td>
2726        </tr>
2727    </table>
2728</div>
2729      ~;
2730
2731    $yyim    = 'YaBB 2.6.11 Setup has already been run.';
2732    $yytitle = 'YaBB 2.6.11 Setup';
2733    template();
2734    return;
2735}
27361;