** is it a case of just replacing the template file? **
If the template has been corrupted, yes.
** the certain 777 files were changed? **
Is that a question?
** can you help me make this more secure pls? **
Only the files that end in .pl (or .cgi) would likely need to be chmod to 755 (or on some servers 775). All the rest should at the most need permissions of 666 but 644 would likely do as well.
You can also change the permissions of the whole /calendarscript/ directory to not allow any access and that way no one can even read any of the files there.
BTW. What CalendarScript version are you using? If not 3.21, I strongly suggest you upgrade!
JMO
Dan O.
------------------