function add_address_to_wb_list($user_id, $addr, $wb) { global $dbh; $matches = array(); # look for an email address of the form <user@domain> if (preg_match('/<(\\S+\\@\\S+\\.\\S+)>/', $addr, $matches) > 0) { $addr = $matches[1]; } elseif (preg_match("/(\\S+\\@\\S+\\.\\S+)/", $addr, $matches) > 0) { $addr = $matches[1]; } $addr = fix_address($addr); $addr_id = get_address_id($addr); if (substr($addr, 0, 1) == '@') { $addr = "*" . $addr; } if ($addr_id == 0) { $addr_id = add_address($addr); add_wb_entry($user_id, $addr_id, $wb); return 'text_wb_address_added'; } else { $wb_stat = get_wb_status($user_id, $addr_id); if ($wb_stat == '') { add_wb_entry($user_id, $addr_id, $wb); return 'text_wb_address_added'; } else { if ($wb_stat != $wb) { set_wb_status($user_id, $addr_id, $wb); } return 'text_wb_address_changed'; } } }
require_once "./locale/{$display_language}/db.php"; require_once "./locale/{$display_language}/wblist.php"; if ($_SERVER['REQUEST_METHOD'] == 'POST') { switch ($_REQUEST['action']) { case 'addallow': $result = add_address_to_wb_list($euid, $_REQUEST['newaddr'], 'W'); break; case 'addblock': $result = add_address_to_wb_list($euid, $_REQUEST['newaddr'], 'B'); break; case 'block': $result = set_wb_status($euid, $_REQUEST['id'], 'B'); $actiontext = $lang['text_allow_address']; break; case 'allow': $result = set_wb_status($euid, $_REQUEST['id'], 'W'); $actiontext = $lang['text_block_address']; break; case 'remove': $result = delete_wb_entry($euid, $_REQUEST['id']); $actiontext = $lang['text_remove_rule']; break; } if ($_REQUEST['ajax'] == 'true') { ?> $('#viewmessage').html('<div class="messagebox"><?php echo htmlspecialchars($lang[$result]); ?> </div>'); $('#viewmessage div').effect("highlight", { color: "#FFD324"