/**
  * Checks if user is allowed to access the page
  * @param $hint
  * @param $show
  */
 function checkforGuest(&$hint = NULL, &$show = NULL)
 {
     if (!parent::checkForGuest()) {
         return false;
     }
     $pageobj = $this;
     $hash = $pageobj->getPassword();
     while (empty($hash) && !is_null($pageobj)) {
         $parentID = $pageobj->getParentID();
         if (empty($parentID)) {
             $pageobj = NULL;
         } else {
             $sql = 'SELECT `titlelink` FROM ' . prefix('pages') . ' WHERE `id`=' . $parentID;
             $result = query_single_row($sql);
             $pageobj = new ZenpagePage($result['titlelink']);
             $hash = $pageobj->getPassword();
         }
     }
     if (empty($hash)) {
         // no password required
         return 'zp_public_access';
     } else {
         $authType = "zp_page_auth_" . $pageobj->get('id');
         $saved_auth = zp_getCookie($authType);
         if ($saved_auth == $hash) {
             return $authType;
         } else {
             $user = $pageobj->getUser();
             $show = !empty($user);
             $hint = $pageobj->getPasswordHint();
             return false;
         }
     }
 }