Can a landlord be held liable for unsafe conditions in San Francisco or Oakland?

Yes, landlords are required to provide a home that complies with all local building and housing codes. The courts in California have held that implied in all leases, regardless of what the paper says, have an implied warranty of habitability, which requires your landlord to provide you a safe and comfortable home.