/** * Request-Handler * @return boolean */ public function request() { if ($this->session->exists()) { $this->redirect('system/dashboard'); } if (!$this->maintenanceMode(false)) { return false; } $this->pageTokenOk = $this->checkPageToken(); session_start(); $this->loginLocked(); if ($this->buttonClicked('login') && !is_null($this->getRequestVar('login')) && !$this->loginLocked && $this->pageTokenOk) { $data = $this->getRequestVar('login'); $data = $this->events->runEvent('loginBefore', $data); $session = new \fpcm\model\system\session(); $loginRes = $session->checkUser($data['username'], $data['password']); if ($loginRes === \fpcm\model\users\author::AUTHOR_ERROR_DISABLED) { $this->currentAttempts = $this->config->system_loginfailed_locked; $this->view->addErrorMessage('LOGIN_FAILED_DISABLED'); if ($this->currentAttempts == $this->config->system_loginfailed_locked) { $this->loginLocked(); } } elseif ($loginRes === true && $session->save() && $session->setCookie()) { session_destroy(); $this->redirect('system/dashboard'); } else { $this->currentAttempts++; \fpcm\classes\http::setSessionVar('loginAttempts', $this->currentAttempts); $this->view->addErrorMessage('LOGIN_FAILED'); if ($this->currentAttempts == $this->config->system_loginfailed_locked) { $this->loginLocked(); } } } if ($this->buttonClicked('reset') && !is_null($this->getRequestVar('username')) && !is_null($this->getRequestVar('email')) && !$this->loginLocked && $this->pageTokenOk) { $userList = new \fpcm\model\users\userList(); $id = $userList->getUserIdByUsername($this->getRequestVar('username')); if (!$id) { $this->redirect(); } $user = new \fpcm\model\users\author($id); if ($user->getEmail() == $this->getRequestVar('email') && $user->resetPassword()) { $this->view->addNoticeMessage('LOGIN_PASSWORD_RESET'); } else { \fpcm\classes\logs::syslogWrite("Passwort reset for user id {$user->getUsername()} failed."); $this->view->addErrorMessage('LOGIN_PASSWORD_RESET_FAILED'); } } if (!is_null($this->getRequestVar('nologin'))) { $this->view->addErrorMessage('LOGIN_REQUIRED'); } $reset = !is_null($this->getRequestVar('reset')) ? true : false; $this->view->assign('resetPasswort', $reset); $this->view->assign('noFullWrapper', true); return true; }
/** * Kommentar-Formular initialisieren * @return string */ protected function assignCommentFormData() { if (!$this->config->system_comments_enabled || !$this->article->getComments()) { return ''; } $id = $this->session->exists() ? $this->session->getUserId() : null; $author = new \fpcm\model\users\author($id); if (!$this->buttonClicked('sendComment') && is_null($this->getRequestVar('newcomment')) && $this->session->exists()) { $this->newComment->setName($author->getDisplayname()); $this->newComment->setEmail($author->getEmail()); $this->newComment->setWebsite(\fpcm\classes\http::getHttpHost()); } $replacementTags = array('{{formHeadline}}' => $this->lang->translate('COMMENTS_PUBLIC_FORMHEADLINE'), '{{submitUrl}}' => $this->article->getArticleLink(), '{{nameDescription}}' => $this->lang->translate('COMMMENT_AUTHOR'), '{{nameField}}' => '<input type="text" class="fpcm-pub-textinput" name="newcomment[name]" value="' . $this->newComment->getName() . '">', '{{emailDescription}}' => $this->lang->translate('GLOBAL_EMAIL'), '{{emailField}}' => '<input type="text" class="fpcm-pub-textinput" name="newcomment[email]" value="' . $this->newComment->getEmail() . '">', '{{websiteDescription}}' => $this->lang->translate('COMMMENT_WEBSITE'), '{{websiteField}}' => '<input type="text" class="fpcm-pub-textinput" name="newcomment[website]" value="' . $this->newComment->getWebsite() . '">', '{{textfield}}' => '<textarea class="fpcm-pub-textarea" id="newcommenttext" name="newcomment[text]">' . $this->newComment->getText() . '</textarea>', '{{smileysDescription}}' => $this->lang->translate('HL_OPTIONS_SMILEYS'), '{{smileys}}' => $this->getSmileyList(), '{{tags}}' => htmlentities(\fpcm\model\comments\comment::COMMENT_TEXT_HTMLTAGS_FORM), '{{spampluginQuestion}}' => $this->captcha->createPluginText(), '{{spampluginField}}' => $this->captcha->createPluginInput(), '{{privateCheckbox}}' => '<input type="checkbox" class="fpcm-pub-checkboxinput" name="newcomment[private]" value="1">', '{{submitButton}}' => '<button type="submit" name="btnSendComment">' . $this->lang->translate('GLOBAL_SUBMIT') . '</button>', '{{resetButton}}' => '<button type="reset">' . $this->lang->translate('GLOBAL_RESET') . '</button>'); $this->commentFormTemplate->setReplacementTags($replacementTags); $parsed = $this->commentFormTemplate->parse(); if (!$this->isUtf8) { $parsed = utf8_decode($parsed); } return $parsed; }