<?php function c_alert(string $html_message, string $type, ?string $icon = null): void { $type_colors = [ "warning" => ["olive","yellow"], "success" => ["green","lime"], "info" => ["teal","aqua"], "danger" => ["maroon","pink"], ][$type] ?? ["gray","white"]; if ($icon !== null) $icon = [ "warning-sign" => "warn16", "info-sign" => "info16", ][$icon] ?? $icon; ?> <center> <table bgcolor="<?= htmlentities($type_colors[0]) ?>" cellspacing="0" cellpadding="2"><tr><td> <table bgcolor="<?= htmlentities($type_colors[1]) ?>" cellspacing="0" cellpadding="12"><tr><td> <?php if ($icon !== null): ?> <table bgcolor="<?= htmlentities($type_colors[1]) ?>" cellspacing="0" cellpadding="0"><tr><td> <nobr><img src="../images/<?= htmlentities(rawurlencode($icon)) ?>.gif"> </nobr> </td><td width="100%"> <?php endif; ?> <font color="black"><?= $html_message ?></font> <?php if ($icon !== null): ?> </td></tr></table> <?php endif; ?> </td></tr></table> </td></tr></table> </center> <?php }