File: /home/httpd/html/xdudes.com/admin/template_editor.php
<?php
require "db.php";
require("template_editor_allowed_ips.php");
entities_walk($_POST);
?>
<? require "header.php"; ?>
<div class="content-page">
<div class="header-area">
<div class="breadcrumbs">
<a href="index.php">Admin Home</a>
<span><a href="template_editor.php">Template Editor</a></span>
</div>
</div>
<div class="content-outer">
<h2>Template<strong>Editor</strong></h2>
<div class="content-inner">
<?
$showEditorFrame = false;
if(!is_array($templateEditorAllowedIPs)) {
echo "<div class='notification error'>Due to the inherant security risk of editing php files via a web interface, we require that you enter your ip address via ftp into \"{SCRIPT_ROOT}/admin/template_editor_allowed_ips.php\". In the event that your admin area is somehow compromised due to an easy or leaked password, this will prevent an intruder from editing files and potentially causing damage to your site or server.</div>";
} else {
if(!in_array($_SERVER['REMOTE_ADDR'],$templateEditorAllowedIPs)) {
echo "<div class='notification error'>Your IP (".$_SERVER['REMOTE_ADDR'].") is not on the template editor whitelist. Due to the inherant security risk of editing php files via a web interface, we require that you enter your ip address via ftp into \"{SCRIPT_ROOT}/admin/template_editor_allowed_ips.php\". In the event that your admin area is somehow compromised due to an easy or leaked password, this will prevent an intruder from editing files and potentially causing damage to your site or server.</div>";
} else {
$showEditorFrame = true;
echo "<div class='notification info'> Please be careful when editing these files as it is possible for your site to stop working if you create a PHP error. Your IP (".$_SERVER['REMOTE_ADDR'].") is on the template editor whitelist. If you need to add additional IP addresses to this whitelist, you may do so in \"{SCRIPT_ROOT}/admin/template_editor_allowed_ips.php\". You may need to set file permissions via FTP or SSH to 775 or 777 in order to edit template files in this editor.</div>";
}
}
?>
<br>
<? if($showEditorFrame) { ?>
<iframe src="template_editor_frame.php" style="width:100%;height:800px;background:#fafafa;padding:10px"></iframe>
<? } ?>
</div>
</div>
</div>
<? require "footer.php"; ?>