West Ham have confirmed the signing of former Fulham striker Mladen Petric on a deal until the end of the season.