by Davo Smith.
As long as you call $PAGE->set_context(context_system::instance()); early enough on the page (mostly before you use any language strings) you should be fine with that - assuming of course, that the page really is meant to be part of the 'system' context.
If you want the page to be part of a different context (e.g. the course that the block is on, or the user context if the block is installed on a user page), then you need to pass a parameter to the page to tell it where it is being displayed (e.g. blocks/myblock/mypage.php?courseid=XX, where XX can be inserted into the link via $PAGE->course->id on the original location, or possibly discovered via $PAGE->context->instance if you are looking for the userid instead and are on the 'my' page).