I am still pretty new to Magento, and I was wondering how Magento is checking if a user is logged in in the magento/index.php/sales/order/view/order_id/102/
page.
For example if a user who is not related to this order try to go there, he will be redirected to his own order history page. But I can't see this function neither in info.php nor in info.phtml in the sales/order directories (template and block).
I am asking this because I would like to use this feature as well.