#!/usr/bin/perl
use strict;
use FindBin qw($Bin);
use lib $Bin;
use onserver;

setup();

undef $/;
open(FILE, "contemp.php");
my $a = <FILE>;
close(FILE);
$a =~ s/adminpass/$admin_password/g;
$a =~ s|\$timezone\s*= '';|\$timezone = 'US/Eastern';|g;
$a =~ s/\$phpicalendar_publishing/\/\/ WARNING: The scripts.mit.edu maintainers have had to disable this feature on scripts.mit.edu because it contains a serious security vulnerability that has not been addressed by the software\'s authors.  Please do not try to enable this feature\n\$phpicalendar_publishing/;
open(FILE, ">config.inc.php");
print FILE $a;
close(FILE);

#system('cp', '/mit/scripts/deploy/phpical/MIT Academic Calendar.ics', 'calendars/');

unlink('contemp.php');
unlink('calendars/publish.ical.php');

print <<END;
Your $sname Admin Panel is at
http://$server/~$USER/$addrend/admin
You can use this admin panel to upload calendars for display.
END
press_enter();
