/** * @see Page::assignVariables(), */ public function assignVariables() { parent::assignVariables(); WCF::getTPL()->assign(array('user' => $this->user, 'gbData' => $this->gbData, 'cntEntries' => $this->cntEntries, 'cntViews' => $this->cntViews, 'userID' => $this->userID, 'lastVisitor' => $this->lastVisitor, 'visitorLastVisit' => $this->visitorLastVisit, 'locked' => UserGuestbookData::getLockInfo($this->userID))); }
/** * @see Page::readParameters() */ public function readParameters() { MessageForm::readParameters(); if (isset($_REQUEST['userID'])) { $this->userID = intval($_REQUEST['userID']); } require_once WCF_DIR . 'lib/data/user/UserProfile.class.php'; $this->user = new UserProfile($this->userID, null, null, null); if (!$this->user->userID) { require_once WCF_DIR . 'lib/system/exception/IllegalLinkException.class.php'; $this->exception = true; throw new IllegalLinkException(); } // Schreibzugriff deaktiviert? if (!$this->user->userGuestbook_enable_posting || !$this->user->userGuestbook_enable || !WCF::getUser()->getPermission('user.guestbook.canWrite') || !WCF::getUser()->getPermission('user.guestbook.canUseOwn') && $this->userID == WCF::getUser()->userID) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; $this->exception = true; throw new PermissionDeniedException(); } $this->locked = UserGuestbookData::getLockInfo($this->user->userID); // Gästebuch gesperrt? if (!empty($this->locked['locked']) && ($this->user->userID != WCF::getUser()->userID || !WCF::getUser()->getPermission('mod.guestbook.canLock'))) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; $this->exception = true; throw new PermissionDeniedException(); } if (!$this->exception && isset($_REQUEST['action']) && !empty($_REQUEST['id']) && ($_REQUEST['action'] == 'edit' || $_REQUEST['action'] == 'comment')) { $entry = UserGuestbookData::getEntry(intval($_REQUEST['id'])); if (!empty($entry['id'])) { $this->action = $_REQUEST['action']; $this->id = $entry['id']; $editTime = intval(WCF::getUser()->getPermission('user.guestbook.canEditOwnEntries')); if ($this->action == 'edit') { if (!WCF::getUser()->getPermission('mod.guestbook.canEditAll') && !(WCF::getUser()->getPermission('user.guestbook.canEditOwnGuestbook') && $entry['userID'] == WCF::getUser()->userID) && !($editTime != 0 && $entry['fromUserID'] == WCF::getUser()->userID && ($editTime == -1 || $entry['entryTime'] > TIME_NOW - $editTime))) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; $this->exception = true; $this->action = ''; throw new PermissionDeniedException(); } else { if (count($_POST)) { $this->text = isset($_POST['text']) ? $_POST['text'] : ''; } else { $this->text = $entry['text']; } } } else { if ($this->action == 'comment') { if ($entry['userID'] != WCF::getUser()->userID || !WCF::getUser()->getPermission('user.guestbook.canComment')) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; $this->exception = true; $this->action = ''; throw new PermissionDeniedException(); } else { $this->text = $entry['comment']; $this->maxTextLength = 2000; $this->entryTxt = MessageParser::getInstance()->parse($entry['text'], $entry['enableSmilies'], $entry['enableHtml'], $entry['enableBBCodes']); } } } } } }