replace_tags(3, $site, $tags);
        if (isset($licenserx)) {
            $licenserx = '1';
        } else {
            $licenserx = '0';
        }
        // update site
        if ($active == 'true') {
            $activeStr = 'true';
        } else {
            $activeStr = 'false';
        }
        $sql = "UPDATE `{$dbSites}` SET name='{$name}', department='{$department}', address1='{$address1}', address2='{$address2}', city='{$city}', ";
        $sql .= "county='{$county}', postcode='{$postcode}', country='{$country}', telephone='{$telephone}', fax='{$fax}', email='{$email}', ";
        $sql .= "websiteurl='{$websiteurl}', notes='{$notes}', typeid='{$typeid}', owner='{$owner}', freesupport='{$incident_quantity}', active='{$activeStr}' WHERE id='{$site}' LIMIT 1";
        // licenserx='$licenserx'
        $result = mysql_query($sql);
        if (mysql_error()) {
            trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
        } else {
            plugin_do('edit_site_save');
            journal(CFG_LOGGING_NORMAL, $strSiteEdited, sprintf($strSiteXEdited, $site), CFG_JOURNAL_SITES, $site);
            html_redirect($_SERVER['PHP_SELF']);
            exit;
        }
    } else {
        echo $errors_string;
    }
}
echo show_edit_site($site, 'external');
include APPLICATION_INCPATH . 'htmlfooter.inc.php';
include APPLICATION_INCPATH . 'htmlheader.inc.php';
// Show select site form
if (empty($action) or $action == "showform" or empty($site)) {
    echo "<h3>{$title}</h3>";
    echo "<form action='{$_SERVER['PHP_SELF']}?action=edit' method='post'>";
    echo "<table class='vertical'>";
    echo "<tr><th>{$strSite}:</th><td>" . site_drop_down("site", 0) . "</td></tr>\n";
    echo "</table>\n";
    echo "<p><input name='submit' type='submit' value=\"{$strContinue}\" /></p>\n";
    echo "</form>\n";
} elseif ($action == "edit") {
    if ($site == 0) {
        user_alert(sprintf($strFieldMustNotBeBlank, "'{$strSite}'"), E_USER_ERROR);
    } else {
        //  Show edit site form
        echo show_edit_site($site);
    }
} elseif ($action == "update") {
    // External Variables
    $incident_pools = explode(',', "0,{$CONFIG['incident_pools']}");
    $incident_quantity = $incident_pools[$_POST['incident_poolid']];
    $name = cleanvar($_POST['name']);
    $department = cleanvar($_POST['department']);
    $address1 = cleanvar($_POST['address1']);
    $address2 = cleanvar($_POST['address2']);
    $city = cleanvar($_POST['city']);
    $county = cleanvar($_POST['county']);
    $postcode = cleanvar($_POST['postcode']);
    $country = cleanvar($_POST['country']);
    $telephone = cleanvar($_POST['telephone']);
    $fax = cleanvar($_POST['fax']);