diff --git a/admin/admin_attachments.php b/admin/admin_attachments.php index 5ae88e5db..e7f938269 100644 --- a/admin/admin_attachments.php +++ b/admin/admin_attachments.php @@ -248,13 +248,6 @@ if ($submit && $mode == 'manage') { } if ($mode == 'manage') { - $yes_no_switches = array('disable_mod', 'allow_pm_attach', 'display_order'); - - for ($i = 0; $i < sizeof($yes_no_switches); $i++) { - eval("\$" . $yes_no_switches[$i] . "_yes = ( \$new_attach['" . $yes_no_switches[$i] . "'] != '0' ) ? 'checked=\"checked\"' : '';"); - eval("\$" . $yes_no_switches[$i] . "_no = ( \$new_attach['" . $yes_no_switches[$i] . "'] == '0' ) ? 'checked=\"checked\"' : '';"); - } - $template->assign_vars(array( 'TPL_ATTACH_MANAGE' => true, 'S_ATTACH_ACTION' => 'admin_attachments.php?mode=manage', @@ -272,12 +265,12 @@ if ($mode == 'manage') { 'MAX_FILESIZE_PM' => $new_attach['max_filesize_pm'], 'MAX_ATTACHMENTS' => $new_attach['max_attachments'], 'MAX_ATTACHMENTS_PM' => $new_attach['max_attachments_pm'], - 'DISABLE_MOD_YES' => $disable_mod_yes, - 'DISABLE_MOD_NO' => $disable_mod_no, - 'PM_ATTACH_YES' => $allow_pm_attach_yes, - 'PM_ATTACH_NO' => $allow_pm_attach_no, - 'DISPLAY_ORDER_ASC' => $display_order_yes, - 'DISPLAY_ORDER_DESC' => $display_order_no, + 'DISABLE_MOD_YES' => $new_attach['disable_mod'] !== '0' ? 'checked="checked"' : '', + 'DISABLE_MOD_NO' => $new_attach['disable_mod'] === '0' ? 'checked="checked"' : '', + 'PM_ATTACH_YES' => $new_attach['allow_pm_attach'] !== '0' ? 'checked="checked"' : '', + 'PM_ATTACH_NO' => $new_attach['allow_pm_attach'] === '0' ? 'checked="checked"' : '', + 'DISPLAY_ORDER_ASC' => $new_attach['display_order'] !== '0' ? 'checked="checked"' : '', + 'DISPLAY_ORDER_DESC' => $new_attach['display_order'] === '0' ? 'checked="checked"' : '', )); } diff --git a/library/includes/classes/emailer.php b/library/includes/classes/emailer.php index dc75409a6..45c8a4dfd 100644 --- a/library/includes/classes/emailer.php +++ b/library/includes/classes/emailer.php @@ -164,16 +164,8 @@ class emailer // Set vars reset($this->vars); - while (list($key, $val) = each($this->vars)) { - $$key = $val; - } - - eval("\$this->msg = '$this->msg';"); - - // Clear vars - reset($this->vars); - while (list($key, $val) = each($this->vars)) { - unset($$key); + foreach ($this->vars as $key => $val) { + $this->msg = preg_replace(sprintf('/\$\{?%s\}?/', $key), $val, $this->msg); } // We now try and pull a subject from the email body ... if it exists,