function ymind_blocks_delete() { $deleted = 0; $id = htmlspecialchars($_POST['delete']); $d = ymind_block_delete($id); if ($d) { $deleted++; } if ($deleted) { ymind_display_error(__('Deleted blocks: ' . $deleted, 'ymind')); } else { ymind_display_error(__('No blocks deleted.', 'ymind')); } }
function ymind_admin_update() { $return = false; if (isset($_GET['unlock'])) { update_usermeta($_GET['unlock'], 'ymind_locked_out', 0); delete_usermeta($_GET['unlock'], 'ymind_activation_key'); $msg = '' . __('User has now been unlocked', 'ymind') . '.'; ymind_display_message($msg); } if (isset($_POST['submit'])) { $error = array(); $numerical_fields = array('timeout_logins' => '' . __('Lockout Login Count', 'ymind') . '', 'timeout_minutes' => '' . __('Lockout Login Minutes', 'ymind') . '', 'lockout_minutes' => '' . __('Lockout Minutes', 'ymind') . ''); $textual_fields = array('new_url' => '' . __('Redirect URL', 'ymind') . '', 'mail_subject' => '' . __('Email Subject', 'ymind') . '', 'mail_message' => '' . __('Email Message', 'ymind') . '', 'login_error' => '' . __('Login Error', 'ymind') . '', 'activate_redirect' => '' . __('Activation Redirect', 'ymind') . ''); if ($_POST['email_offender'] == 0 && $_POST['timeout_minutes'] > $_POST['lockout_minutes']) { $error[] = '' . __('Locked out minutes must be greater than the number of minutes it takes to lock someone out.', 'ymind') . ''; } foreach ($numerical_fields as $key => $label) { if (!is_numeric($_POST[$key])) { $error[] = '' . __('Expecting a number for', 'ymind') . ' ' . $label; } } foreach ($textual_fields as $key => $label) { if (is_numeric($_POST[$key])) { $error[] = '' . __('Expecting a string for', 'ymind') . ' ' . $label; } } if (!count($error)) { update_option('ymind_redirect_url', $_POST['new_url']); update_option('ymind_email_offender', $_POST['email_offender']); update_option('ymind_mail_subject', $_POST['mail_subject']); update_option('ymind_mail_message', $_POST['mail_message']); update_option('ymind_lockout_minutes', $_POST['lockout_minutes']); update_option('ymind_timeout_minutes', $_POST['timeout_minutes']); update_option('ymind_timeout_logins', $_POST['timeout_logins']); update_option('ymind_lockout_option', $_POST['lockout_option']); update_option('ymind_locked_out_error', $_POST['login_error']); update_option('ymind_activate_redirect', $_POST['activate_redirect']); $msg = '' . __('Options have been successfully updated.', 'ymind') . ''; ymind_display_feedback($msg); } else { $msg = '<ul style="margin:5px; padding-left: 10px;">'; foreach ($error as $err) { $msg .= '<li>' . $err . '</li>'; } $msg .= '</ul>'; ymind_display_error($msg); } } }