Philadelphia judges, citing security lapses, order sheriff to implement a new safety plan