Well, I am not about to struggle through all that code when you don't even bother to say where the error is reported.
Generally, this error come from trying to modify the response header information or redirecting after the initial bufferload has been sent. The headers having already been sent, you can't change them. Thats what "response has been comitted" means.
The cure is to make all decisions about redirection or setting headers before you start writing to the response output stream.