If I may....
After analyzing the code, I must warn you, you have malware infection on your site (!) and yes, it could damage the template code (!)
It is a classic example of a webshell (a malicious script) used for remote file management on your server. If you found this among your files, it means your website has been compromised (!)
Examples (there are 3000+ more):
plugins\system\helix3\ajax.php and plugins\ajax\ajax.php and root folder: ajax.php
This short script (from file) allows an attacker to upload any file to your server without logging into the admin panel or FTP. And if the attacker infected one site, and the whole rest of the sites are on the same server... he went from "door" to "door" (!) and knock-knock... that's why all sites are broken in the same way!
Michelle, Probably you didn't update Joomla with security updates, (I did it, a moment ago!, but it was your duty, any extension will not help if you don't update CMS or plugins.