So your optical out/headphone jack isn't working, along with the speakers.
You buy the speakers for $20, then what?
If you were capable of opening and repairing yourself you wouldn't have asked here, so lets assume you have to pay somebody.
Western countries = western wages. Assuming you find a kid on craigs list, it's not going to be less that $50 to install your new speakers.
Best case scenario that fixes half your problem. That still leaves the 3.5mm jack broken.
Worst case, the actual speakers are fine, but maybe some wiring has come loose or the audio chip on the board has died.
Speakers themselves hardly ever die completely. For both to die is highly unusual.
For 2 separate speakers, optical out, and the 3.5mm jack and the ability to detect headphones plugged in to all be dead at the same time... yeah, I'm thinking it's something really simple.
Back to the best case scenario, the 3.5mm jack is still dead. How do you fix that?
Has the jack itself died, or the solder come loose? The jack itself costs nothing, but it's so tricky to solder.
After all that, given the fact that ALL audio has died, it's likely a chip on the logic board has gone.
A quick search for a 2007ish logic board tells me it will cost you ~$200. Add at least $100 for labour as you need to pretty much gut the laptop to replace it.