If you need to check whether you are in admin area or in customer one, use the following method:

static::isAdminZone();

It is particularly useful, if you need to perform this check in a model class or any other zone-independent one. The method is defined in \XLite class and it will return true if admin.php script was called, or false is cart.php one was.