Well I'm not a lawyer.
It seems like a site has no authority to assert that donated code is public domain or any other license, unless the copyright holder (almost always the original author or in some cases her employer) has explicitly assigned the copyright to the site. It certainly could not do that retroactively, but it could make terms of use for the site which include some stipulation about the licensing of posted code. I think most sites are unwilling to do that since it's much harder legally than just saying "we have no control over what you choose to post, but copyright violations are forbidden to be posted".
Another consideration is that the USA has the "Fair Use" doctrine, which is legally vague, but which could be used to defend against using copyrighted work which was posted with the intent of it being reused.
Another consideration of copyright law is that the penalty for infringement is related to the economic damages, and I think it would be difficult for the copyright holder to claim damages if the code were posted by the author on a public web site.