/** * Retrieves text of this object with all protect-tags beeing * encrypted before. * @param userName a name of a current user * @return Text with encrypted tags. */ public function getEncrypted($userName) { require_once "ProtectTag.php"; $text = $this->mParsedText; foreach ($this->mContent as $rand => $cnt) { $ary_users = null; $ary_groups = null; if (array_key_exists('users', $cnt[2])) { $ary_users = $cnt[2]['users']; } if (array_key_exists('groups', $cnt[2])) { $ary_groups = $cnt[2]['groups']; } $access = new AccessList($ary_users, $ary_groups); $access->AddUser($userName); $tag = new ProtectTag(); $tag->setAccessList($access); if (array_key_exists('show', $cnt[2])) { $tag->setShow($cnt[2]['show']); } if (array_key_exists('cipher', $cnt[2])) { $tag->setCipher($cnt[2]['cipher']); } if (array_key_exists('errorpage', $cnt[2])) { $tag->setErrorPage($cnt[2]['errorpage']); } $text = str_replace($rand, $tag->getStart() . "\n" . $this->mEnc->Encrypt($cnt[1], $tag->mCipher) . "\n" . $tag->getEnd(), $text); } return $text; }