Custom block: How to know you're in an admin context?
Looks like I just need to call path_is_admin

if (!path_is_admin(current_path())) {
  drupal_not_found();
  drupal_exit(); // This is needed if we call drupal_not_found() from hook_block_view()
}