On weakly firm commutative rings and their connection to the total and zero-divisor graphs