function rul_submit_register($update_or_delete, $address) { global $wpdb, $rul_db_addresses; $address = trim($address); // Open the informational div $rul_process_submit = '<div id="message" class="updated fade">'; // Code for closing the informational div $rul_process_close = '</div>'; // ---------------------------------- // Process the rule changes // ---------------------------------- // Since we never actually remove the "register" entry, here we just make its value empty if ($update_or_delete == 'delete') { $update = $wpdb->update($rul_db_addresses, array('rul_url' => ''), array('rul_type' => 'register')); if ($update === false) { $rul_process_submit .= '<p><strong>****' . __('ERROR: Unknown database problem removing URL for "post-registration" ', 'peters-login-redirect') . '****</strong></p>'; } else { $rul_process_submit .= '<p>' . __('Successfully removed URL for "post-registration" ', 'peters-login-redirect') . '</p>'; } } elseif ($update_or_delete == 'update') { $address_safe = rul_safe_redirect($address); if ('' != $address && !$address_safe) { $rul_process_submit .= '<p><strong>****' . __('ERROR: Non-local or invalid URL submitted ', 'peters-login-redirect') . '****</strong></p>'; } else { $update = $wpdb->update($rul_db_addresses, array('rul_url' => $address_safe), array('rul_type' => 'register')); if ($update === false) { $rul_process_submit .= '<p><strong>****' . __('ERROR: Unknown database problem updating URL for "post-registration" ', 'peters-login-redirect') . '****</strong></p>'; } else { $rul_process_submit .= '<p>' . __('Successfully updated URL for "post-registration"', 'peters-login-redirect') . '</p>'; } } } // Close the informational div $rul_process_submit .= $rul_process_close; // We've made it this far, so success! return $rul_process_submit; }
function rul_submit_all($update_or_delete, $address) { global $wpdb, $rul_db_addresses; $rul_whitespace = ' '; // Open the informational div $rul_process_submit = '<div id="message" class="updated fade">' . "\n"; // Code for closing the informational div $rul_process_close = $rul_whitespace . '</div>' . "\n"; // ---------------------------------- // Process the rule changes // ---------------------------------- // Since we never actually, remove the "all" entry, here we just make its value empty if ($update_or_delete == 'Delete' || $address == '') { $update = $wpdb->update($rul_db_addresses, array('rul_url' => ''), array('rul_type' => 'all')); if ($update === false) { $rul_process_submit .= '<p><strong>****' . __('ERROR: Unknown database problem removing URL for "all other users" ', 'peterloginrd') . '****</strong></p>' . "\n"; } else { $rul_process_submit .= '<p>' . __('Successfully removed URL for "all other users" ', 'peterloginrd') . '</p>' . "\n"; } } elseif ($update_or_delete == 'Update') { $address = rul_safe_redirect($address); if (!$address) { $rul_process_submit .= '<p><strong>****' . __('ERROR: Non-local or invalid URL submitted ', 'peterloginrd') . '****</strong></p>' . "\n"; } else { $update = $wpdb->update($rul_db_addresses, array('rul_url' => $address), array('rul_type' => 'all')); if ($update === false) { $rul_process_submit .= '<p><strong>****' . __('ERROR: Unknown database problem updating URL for "all other users" ', 'peterloginrd') . '****</strong></p>' . "\n"; } else { $rul_process_submit .= '<p>' . __('Successfully updated URL for "all other users"', 'peterloginrd') . '</p>' . "\n"; } } } // Close the informational div $rul_process_submit .= $rul_process_close; // We've made it this far, so success! return $rul_process_submit; }