Magnetoelectric and optoelectric effects in ferroelectric tunnel junctions