Solved it and thought everything was OK, eeeeeep, wrong.
Another piece of code the same company have produced is essentially non-portable PHP, semi-hardcoded, "everything-is-Register-Globals" and spans over 350-400 separate files. I've spent the better part of two days banging it with blunt force, cursing, tearing my hair... it barely works. If a part is modified, something else breaks. M'f'cking piece of shite. I've got a promise of rewriting the whole package, from scratch, as it's used on three news paper sites that we host... maybe we could sell it to the company that originally wrote the piece.
The importer script(s) will also be completely rewritten, in Perl.