#!/usr/bin/perl ############################################################# # # >>>>>> SET UP ASSISTANT # # # Ikonboard v2.1 # Copyright 2000 Ikondiscussion.com - All Rights Reserved # Ikondiscussion is a trademark of Ikondiscussion.com # # Software Distributed by: Ikondiscussion.com # Visit us online at http://www.ikondiscussion.com # Email us on boards@ikondiscussion.com # # All files written by Matthew Mecham ############################################################# use CGI::Carp "fatalsToBrowser"; use CGI qw(:standard); $query = new CGI; @params = $query->param; foreach $param(@params) { $theparam = $query->param($param); $theparam =~ s/\@/\\\@/g; ${$param} = $theparam; if ($param ne "action") { $printme .= "\$" . "$param = \"$theparam\"\;\n"; } } $stylesheet =<<__end_of_sheet__; __end_of_sheet__ $thisprog = "install.cgi"; $|=1; if ($action ne "final_step" || !$action) { print header(); print start_html(-title=>"Ikonboard Installation Assistant", -bgcolor=>"#EEEEEE", -style=>{-code=>$stylesheet}); } if ($action eq "step_two") { $endprint = "1\;\n"; $errorflag = 0; $filetomake = "$ikondir" . "data/boardinfo.cgi"; open(FILE,">$filetomake"); flock(FILE,2); print FILE "$printme"; print FILE $endprint; close(FILE); if (-e $filetomake && -w $filetomake) { $saved_variables = qq(All the entered information has been saved successfully to $ikondir data/boardinfo.cgi.); } else { $saved_variables = qq(I'm sorry. I couldn't save the information. You entered $ikondir/data as the path to the data folder. Is this correct? If it is, please check the CHMOD value of the 'data' folder and use your back button to return to the form and re-submit); $errorflag = "1"; } $filetocheck = "$ikondir" . "ikonboard.cgi"; if (-e $filetocheck) { $found_cgi = qq(Correct - found $filetocheck); } else { $errorflag = "1"; $found_cgi = qq(Incorrect - could not find $filetocheck, please use the back button and correct.); } $dirtocheck = "$ikondir" . "data"; if (-d "$dirtocheck") { $datadir = "found"; $makefile = "$ikondir" . "data/test.txt"; open (TEST, ">$makefile") or $datawritable = "The data directory is not writable, please check the chmod"; print TEST "-"; close (TEST); $datawritable = "The data dir is writable" if (!$datawritable); unlink "$makefile"; } else { $errorflag = "1"; $datadir = "NOT FOUND"; } $dirtocheck = "$ikondir" . "help"; if (-d "$dirtocheck") { $helpdir = "found"; $makefile = "$ikondir" . "help/test.txt"; open (TEST, ">$makefile") or $helpwritable = "The help directory is not writable, please check the chmod"; print TEST "-"; close (TEST); $helpwritable = "The help dir is writable" if (!$helpwritable); unlink "$makefile"; } else { $helpdir = "NOT FOUND"; } $dirtocheck = "$ikondir" . "members"; if (-d "$dirtocheck") { $membersdir = "found"; $makefile = "$ikondir" . "members/test.txt"; open (TEST, ">$makefile") or $memberswritable = "The members directory is not writable, please check the chmod"; print TEST "-"; close (TEST); $memberswritable = "The members dir is writable" if (!$memberswritable); unlink "$makefile"; } else { $errorflag = "1"; $membersdir = "NOT FOUND"; } $dirtocheck = "$ikondir" . "messages"; if (-d "$dirtocheck") { $messagesdir = "found"; $makefile = "$ikondir" . "messages/test.txt"; open (TEST, ">$makefile") or $messageswritable = "The messages directory is not writable, please check the chmod"; print TEST "-"; close (TEST); $messageswritable = "The messages dir is writable" if (!$messageswritable); unlink "$makefile"; } else { $errorflag = "1"; $messagesdir = "NOT FOUND"; } $filetocheck = "$imagesdir" . "images/logo.gif"; if (-e $filetocheck) { $found_image = qq(Correct); } else { $errorflag = "1"; $found_image = qq(Incorrect, please use the back button and correct.); } $dirtocheck = "$imagesdir" . "images"; if (-d "$dirtocheck") { $images_dir = "found"; } else { $errorflag = "1"; $images_dir = "NOT FOUND"; } $dirtocheck = "$imagesdir" . "emoticons"; if (-d "$dirtocheck") { $emoticonsdir = "found"; } else { $errorflag = "1"; $emoticonsdir = "NOT FOUND"; } $dirtocheck = "$imagesdir" . "avatars"; if (-d "$dirtocheck") { $avatarsdir = "found"; } else { $errorflag = "1"; $avatarsdir = "NOT FOUND"; } @progs_to_search = ('admincenter.cgi', 'announcements.cgi', 'checkboard.cgi', 'forumoptions.cgi', 'forums.cgi', 'help.cgi', 'ikon.lib', 'ikonadmin.lib', 'ikonboard.cgi', 'ikonfriend.cgi', 'ikonmail.lib', 'loginout.cgi', 'messanger.cgi', 'misc.cgi', 'newposts.cgi', 'post.cgi', 'postings.cgi', 'printpage.cgi', 'profile.cgi', 'privacy.cgi', 'register.cgi', 'search.cgi', 'setbadwords.cgi', 'setforums.cgi', 'setmembers.cgi', 'setmembertitles.cgi', 'setstyles.cgi', 'settemplate.cgi', 'setvariables.cgi', 'topic.cgi', 'viewip.cgi', 'data/progs.cgi', 'data/styles.cgi'); print qq(

Ikonboard Set-up Assistant



Welcome to the Ikonboard set-up assistant.

Step two: Thank you for entering the information. Here is the result of the installation attempt.
If you get any error's please ensure that the proper directories were created on your server, and that the files have been uploaded and chmod'ded.


Did the entered information get saved correctly?
$saved_variables

Path Review
The scripts (*.cgi) path you chose is: $ikondir - $found_cgi

-- Looking for $ikondir data - $datadir - $datawritable
-- Looking for $ikondir help - $helpdir - $helpwritable
-- Looking for $ikondir messages - $messagesdir - $messageswritable
-- Looking for $ikondir members - $membersdir - $memberswritable


The non-cgi (images) path you chose is: $imagesdir - $found_image

-- Looking for $imagesdir images - $images_dir
-- Looking for $imagesdir emoticons - $emoticonsdir
-- Looking for $imagesdir avatars - $avatarsdir

URL Review
The images URL you chose is: $imagesurl

-- Looking for $imagesurl/images/announce.gif -
-- Looking for $imagesurl/emoticons/smile.gif -
-- Looking for $imagesurl/avatars/noavatar.gif -

If you got any broken images, please check the $html_url URL to ensure that it's correct, also check to make sure that the images are uploaded in BINARY. ); if ($errorflag eq "1") { print qq(

The Ikonboard Set-up assistant has found errors and cannot continue. Please go back and recheck all the information.); print end_html; exit; } print qq(
File validity check

The Ikonboard set-up assistant will now go through your *.cgi files to ensure that they are uploaded in ASCII

); foreach (@progs_to_search) { $filetotest = "$ikondir" . "$_"; if (-e $filetotest) { open (TEST, "$filetotest"); @testfile = ; close (TEST); if (grep(/\r/, @testfile) && $^O ne "MSWin32") { print "Found $_ but it looks like it's been uploaded in BINARY. Please reupload in ASCII
"; } else { print "Found $_ - Uploaded okay
"; } } else { print "Could not find $_ ! - is it uploaded?
"; } } # end foreach print qq(


End of results

The Ikonboard set-up assistant has finished it's report. If you have any errors, please go back and re-check the information.
You can choose to change this information at any time from you Ikonboard Administration center.

If you are unsure of anything, please post in out Support Forums

End of Report


What Next?

If you are just upgrading from an earlier version of Ikonboard, GO TO YOUR ADMIN CENTER NOW!.
As a security measure this file will be removed from your web space as soon as you enter the admin center.
The admin center will NOT run if it is still on your server! If the automatic removal fails, please delete it via FTP.

If this is a first time install PROCEED TO STEP THREE!




); } elsif ($action eq "step_three") { print qq(

Ikonboard Set-up Assistant



Are you meant to be here?

If you are just upgrading from an earlier version of Ikonboard, GO TO YOUR ADMIN CENTER NOW!.

If you carry on with the set-up you WILL lose your board statistics!


Step three:
Final set-up section. This section will complete the set-up, and you'll be able to go to the administration center to set up your colours and styles.


Register yourself as an administrator.

You will now need to register yourself as an administrator. This will allow you access to the administration center.

Please enter a username for yourself


Please enter a password


Please re-type your password




Please double check all information.

); } # end step 3 elsif ($action eq "final_step") { $namecookie = cookie(-name => "adminname", -value => "$membername", -expires => "+1d"); $passcookie = cookie(-name => "adminpass", -value => "$password_one", -expires => "+1d"); print header(-cookie=>[$namecookie, $passcookie]); print start_html(-title=>"Ikonboard Installation Assistant", -bgcolor=>"#EEEEEE", -style=>{-code=>$stylesheet}); print qq(

Ikonboard Set-up Assistant



Welcome to the Ikonboard set-up assistant.

Final Step:
The Ikonboard Set-up Assistant will now create your administration account.


); eval { ($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); ($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); require "data/boardinfo.cgi"; }; if ($@) { print header(); print start_html(-title=>"Ikonboard Error!"); print "Could not find these files: $@\nIf you are running NT you may need to enter the full path in each require statement in each script"; print end_html; exit; } $currenttime = time; $blanks = "yes" if (!$membername); $blanks = "yes" if (!$password_one); $blanks = "yes" if (!$password_two); if ($blanks) { print qq(

Please fill in the form completely, Use the back button to correct this step.); print end_html; exit; } if ($password_one ne $password_two) { print qq(

The passwords you entered did not match Please go back to correct this error.); print end_html; exit; } $memberfilename = $membername; $memberfilename =~ y/ /_/; $membersdir = "$ikondir" . "members"; $filetomake = "$ikondir" . "members/$memberfilename.cgi"; open (ADMIN, ">$filetomake") or die "Cannot open file $filetomake, please check the paths!"; print ADMIN "$membername|$password_one|Administrator|ad|0|$adminemail_in|no|private||||||$currenttime||"; close (ADMIN); if (-e $filetomake) { print qq( Congratulations, your Ikonboard is now set up!.

Now you can Go to your admincenter and set up your styles and forums
This installation assistant will be removed upon entering the admin center. Leaving it on your server is a HUGE risk!
); } else { print qq( Error!, I could not create the admin file!

Please check to make sure the members directory is here: $membersdir ); } $filetomake = "$ikondir" . "data/boardstats.cgi"; open(FILE, ">$filetomake"); flock(FILE, 2); print FILE "\$lastregisteredmember = \"$membername\"\;\n"; print FILE "\$totalmembers = \"1\"\;\n"; print FILE "\$totalthreads = \"0\"\;\n"; print FILE "\$totalposts = \"0\"\;\n"; print FILE "\n1\;"; close (FILE); print qq(


Thank you for using Ikonboard!

We hope that using this Set-up Assistant has been helpful
If you have any questions, please visit our Support Forums

Regards,
The Ikonboard Team

); } # end final step else { eval '$home = (getpwuid($<))[7];'; if (!-e "C:/") { $pwd = `pwd`; chop $pwd; } if (!eval 'use Cwd;') { eval '$cwd = cwd();'; } else { $cwd = ""; } $prog = $0; if ($prog =~ m|install\.(\w+)|) { $prog = "install.$1"; $cgi_extension = $1; } $b4 = $`; $b4 =~ s/\/$//; $b4 =~ s/\\$//; $document_root = $ENV{'DOCUMENT_ROOT'}; $document_root =~ s/\/$//; $document_root =~ s/\\$//; $filename = $ENV{'SCRIPT_FILENAME'}; $filename =~ s/\/$prog//; $filename =~ s/\\$prog//; $path = $ENV{'PATH_TRANSLATED'}; $path =~ s/\/$//; $path =~ s/\\$//; &check($pwd); &check($b4); &check($home); &check($document_root); &check($filename); &check($path); &check($cwd); opendir(CURDIR, ".."); while ($q = readdir(CURDIR)) { push (@founddir, $q); } closedir(CURDIR); $true_path =~ s%\\%/%g; $true_path =~ s%//%/%g; if ($true_path =~ m|(.*)/(.+)|) { $base = $1; $cgi = $2; } else { $base = $true_path; $cgi = "cgi-bin"; } $poss_html_dir = "public_html htdocs"; $unsure_html_dir = "htdoc html www wwwdoc wwwdocs wwwroot httpd doc docs"; @poss = split(/\s/, $poss_html_dir); @founddir = grep(!/\./, @founddir); $checker = 0; foreach $test_dir (@poss) { if (grep(/^$test_dir$/, @founddir)) { $html_dir = "$base/$test_dir/ikonboard"; $checker = 1; last; } } if ($checker == 0) { @poss = split(/\s/, $unsure_html_dir); foreach $test_dir (@poss) { if (grep(/^$test_dir$/, @founddir)) { if (-e "$base/$test_dir/index.html" || -e "$base/$test_dir/index.htm" || -e "$base/$test_dir/index.php" || -e "$base/$test_dir/index.php3") { $html_dir = "$base/$test_dir/ikonboard"; if (-e "$base/$test_dir/index.html" || -e "$base/$test_dir/index.htm" || -e "$base/$test_dir/index.php" || -e "$base/$test_dir/index.php3") { $checker = 2; $test_dir_me = $test_dir; last; } else { $checker = 1; last; } } else { if (-e "$base/$test_dir/index.html" || -e "$base/$test_dir/index.htm" || -e "$base/$test_dir/index.php" || -e "$base/$test_dir/index.php3") { $html_dir = "$base/$test_dir/ikonboard"; $checker = 2; $test_dir_me = $test_dir; last; } else { $checker = 1; last; } } } } } if ($html_dir eq "") { $html_dir = "$base/ikonboard"; } $script_dir = "$true_path/ikonboard"; $test_ss = ""; if ($ENV{'SCRIPT_URI'} ne "") { $test_ss = $ENV{'SCRIPT_URI'}; } elsif ($ENV{'SCRIPT_URL'} ne "") { $test_ss = $ENV{'SCRIPT_URL'}; } elsif ($ENV{'REQUEST_URI'}) { $test_ss = $ENV{'REQUEST_URI'}; } elsif ($ENV{'SCRIPT_NAME'} ne "") { $test_ss = $ENV{'SCRIPT_NAME'}; } if ($test_ss ne "") { if ($test_ss =~ m|^http://([^/]+)|) { $test_ss = $'; } if ($test_ss =~ m|/$prog|) { $test_ss = $`; } if ($test_ss ne "") { $script_url = "http://$ENV{'HTTP_HOST'}$test_ss/ikonboard"; } } else { $script_url = "http://$ENV{'HTTP_HOST'}/$cgi/ikonboard"; } if ($script_url =~ m|^http://([^/]+)/~([^/]+)/|) { $uinfo = "~" . $2 . "/"; } $html_url = "http://$ENV{'HTTP_HOST'}/$uinfo" . "ikonboard"; $html_dir =~ s%/%\\%g if $html_dir =~ m|^(\w+):|; $script_dir =~ s%/%\\%g if $script_dir =~ m|^(\w+):|; $bdcgi = "$base/$cgi"; $html_dir =~ s%\\\\%\\%g; $script_dir =~ s%\\\\%\\%g; $bdcgi =~ s%\\\\%\\%g; if (-e "C:/" || $^O eq "MSWin32") { $OS_USED = 'NT'; } $adminemail_in = "incoming\@yourdomain.com"; $adminemail_out = "outgoing\@yourdomain.com"; $timezone_choice = ""; $time_is_now = localtime; $website_url = "http://$ENV{'HTTP_HOST'}"; print qq~

Ikonboard Set-up Assistant



Welcome to the Ikonboard set-up assistant.

Step one: Please take a few minutes to read through the instructions and check the information you provide very carefully before submitting the form.
After you have submitted the form, the set-up assistant will check all the information and let you know if the information you entered was correct.

Before running this program, please ensure that all of the files are uploaded correctly, and CHMODded to the correct value.

All of the information entered here can be edited in the admincenter. As a security function, this script will delete itself upon a successful set-up. If you wish you can re-upload and set-up again.



What Operating System are you running?

Please choose between the following options





Where are the files on your server?

The following settings are our best guess only.
Please double check all your settings and if you are in any doubt, ask your web host.


If you are on an NT server, please use double backslashes! ('this is wrong: c:\\path\\to\\ikonboard\\')
DO put a trailing '/' (slash) on the end of ALL of paths

Where abouts are the *.cgi scripts installed?
This would be a 'path', not a URL. It must not start with 'http://'.
This location would contain all the *.cgi scripts that came with Ikonboard. The following directories must already be created and the files uploaded into them.
  • data
  • messages
  • messages
  • help



Where abouts are the images installed?
This would be a 'path', not a URL. It must not start with 'http://'.
This location would contain all the images that came with Ikonboard. The following directories must already be created and the files uploaded into them.
Do not add '/images/' on to the end of this directory!
  • images
  • emoticons
  • avatars




What are the URL's for your website?

The following settings are our best guess only.
Please double check all your settings and if you are in any doubt, ask your web host.


Do NOT put a trailing '/' (slash) on the end of ANY of the URL's

What's the location of the images?
This would be a 'URL'. It must start with 'http://'.
This location would contain all images that came with Ikonboard.




What's the location of your website?
This would be a 'URL'. It must start with 'http://'.
This would be what you'd type into a web browser to access your website.



What's the location of your Ikonboard?
This would be a 'URL'. It must start with 'http://'.
Please do NOT add 'ikonboard.cgi' to the end. This is the URL to the directory, not the file.



Avatars and emoticons

Avatar's are 'face' images that your users can choose to use under their username when they post.
Emoticons are graphical smilies. ':)' will be converted into a graphic (for example)

Do you wish to enable avatars?
Choose an option from the drop down box



Do you wish to enable Emoticons?
Choose an option from the drop down box



Email Functions

The following settings are our best guess only. Please double check all your settings and if you are in any doubt, ask your web host.

Do you wish to enable email functions on your board?
If you don't choose to enable email functions, simply toggle the drop down box to 'off' and you may skip this section.



Which type of email protocol do you wish to use?
Choose a protocol from the drop down box, and enter the path in the relevant box



SMTP Server (if chosen)



Sendmail Path (if chosen)



Incoming email address



Outgoing email address



Do you want to make users get their password via an email sent from the board?




Your board details

This section will ask you to fill in a few details about your Ikonboard.

Your Ikonboard Name


Your Ikonboard Description


Your copyright information
There is no need to add '©\;' as the scripts will generate this.
©\;


Your Website Name


Do you want to enable flood control?
Flood control will force your users to wait until the time limit you specify has passed before they can post again. This will not affect Administrators or users you promote to Moderator status.



Number of seconds for the floodcontrol to use (if floodcontrol is chosen)
  seconds

Set the base timezone
Your server time is currently $time_is_now. If this is wrong, use the drop box to 'correct' the base server time.

$timezone_choice

What timezone are you in?



Do you want an announcements forum?
An announcements forum allows you as the administrator to make announcements for your communtiy to read.




Please double check all the information


~; } print end_html; exit(0); sub check { local ($dr) = @_; return 0 if $dr eq ""; if (-e "$dr/$prog") { $true_path = $dr; return 1; } }