Praise be to Allah.
There is nothing wrong with a Muslim stretching out his feet or one foot towards the qiblah, whether in a mosque or elsewhere, and there is nothing wrong with him eating in a mosque or sleeping there if he needs to do that. But he should preserve the cleanliness of the mosque, and if he has a wet dream while asleep therein, he must hasten to leave when he wakes up to do ghusl because of janaabah.
And Allaah is the source of strength. May Allaah send blessings and peace upon our Prophet Muhammad and his family and companions. End quote.
Standing Committee for Academic Research and Issuing Fatwas