/** * Changes the current user's password * @version 12.03.2010 * * @param string $password the new entered password * @param string $passwordRepeat repeated password * @param string $oldPassword old password * @return string HTML output */ function changePassword($password, $passwordRepeat, $oldPassword) { $messages = array(); // Old password is not set if (empty($oldPassword)) { $messages[] = $this->pi_getLL('errorInsertOldPw'); } // New password is not set if (empty($password)) { $messages[] = $this->pi_getLL('errorInsertNewPw'); } // New password is not repeated if (empty($passwordRepeat)) { $messages[] = $this->pi_getLL('errorInsertNewPw2'); } // New password is not repeated correctly if (!empty($password) && !empty($passwordRepeat) && $password != $passwordRepeat) { $messages[] = $this->pi_getLL('errorNewPwRepeat'); } else { if (count($messages) == 0) { if (!$this->user->checkPassword($oldPassword)) { $messages[] = $this->pi_getLL('errorOldPw'); } } } // Password too short if ($password == $passwordRepeat && strlen($password) < $this->conf['minPasswordLength']) { $messages[] = sprintf($this->pi_getLL('errorPwLength'), $this->conf['minPasswordLength']); } // Save new password to database if (count($messages) == 0) { $this->user->setPassword($password); $this->user->updateDatabase(); $messages[] = $this->pi_getLL('pwChanged'); } $template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['template']), '###ERROR###'); $content = $this->cObj->substituteMarker($template, '###ERROR_MSG###', implode('', (array) $messages)); return $content; }
/** * Creates the mm_forum page title. * This function generates the title of the mm_forum using the rootline * locallang names. */ function createPageTitle() { if ($this->conf['removeOriginalPagetitle']) { $GLOBALS['TSFE']->page['title'] = ''; } switch ($this->piVars['action']) { // List post view, new post form, post alert form // Sets a title like "mm_forum page -> Category -> Board -> Topic (-> New post/Report post)" case 'list_post': case 'new_post': case 'post_alert': $res = $this->databaseHandle->exec_SELECTquery('topic_title, f.forum_name, c.forum_name', 'tx_mmforum_topics t, tx_mmforum_forums f, tx_mmforum_forums c', 't.uid="' . intval($this->piVars['tid']) . '" AND f.uid=t.forum_id AND c.uid=f.parentID'); list($topicTitle, $forumTitle, $catTitle) = $this->databaseHandle->sql_fetch_row($res); $topicTitle = stripslashes($topicTitle); $topicTitle = str_replace('<', '<', $topicTitle); $topicTitle = str_replace('>', '>', $topicTitle); if ($this->piVars['action'] == 'new_post') { $pageTitle = $this->pi_getLL('rootline.reply'); } elseif ($this->piVars['action'] == 'post_alert') { $pageTitle = $this->pi_getLL('rootline.post_alert'); } break; // New topic form, topic listing view // Sets a title like "mm_forum page -> Category -> Board (-> New topic)" // New topic form, topic listing view // Sets a title like "mm_forum page -> Category -> Board (-> New topic)" case 'new_topic': case 'list_topic': $res = $this->databaseHandle->exec_SELECTquery('f.forum_name, c.forum_name', 'tx_mmforum_forums f, tx_mmforum_forums c', 'f.uid="' . intval($this->piVars['fid']) . '" AND c.uid=f.parentID'); list($forumTitle, $catTitle) = $this->databaseHandle->sql_fetch_row($res); if ($this->piVars['action'] == 'new_topic') { $pageTitle = $this->pi_getLL('rootline.new_topic'); } break; // Post editing form // Sets a title like "mm_forum page -> Category -> Board -> Topic -> Edit post" // Post editing form // Sets a title like "mm_forum page -> Category -> Board -> Topic -> Edit post" case 'post_edit': $res = $this->databaseHandle->exec_SELECTquery('topic_title,f.forum_name,c.forum_name', 'tx_mmforum_posts p, tx_mmforum_topics t, tx_mmforum_forums f, tx_mmforum_forums c', 'p.uid="' . intval($this->piVars['pid']) . '" AND t.uid=p.topic_id AND f.uid=p.forum_id AND c.uid=f.parentID'); list($topicTitle, $forumTitle, $catTitle) = $this->databaseHandle->sql_fetch_row($res); $topicTitle = stripslashes($topicTitle); $topicTitle = str_replace('<', '<', $topicTitle); $topicTitle = str_replace('>', '>', $topicTitle); $pageTitle = $this->pi_getLL('rootline.edit_post'); break; // User profile // Sets a title like "mm_forum page -> User profile: Username" // User profile // Sets a title like "mm_forum page -> User profile: Username" case 'forum_view_profil': if ($this->useRealUrl() && $this->piVars['fid']) { $user = tx_mmforum_FeUser::getByUsername($this->piVars['fid']); } else { $user = tx_mmforum_FeUser::getByUID($this->piVars['user_id']); } $pageTitle = sprintf($this->pi_getLL('rootline.userprofile'), (bool) $user ? $this->escape($user->gD($this->getUserNameField())) : ''); break; // List unread or unanswered topics // Sets a title like "mm_forum page -> List unread/unanswered topics" // List unread or unanswered topics // Sets a title like "mm_forum page -> List unread/unanswered topics" case 'list_unread': case 'list_unans': $pageTitle = $this->pi_getLL('rootline.' . $this->piVars['action']); break; } if ($this->conf['pagetitleLastForumPageTitleOnly']) { if (isset($topicTitle)) { if ($GLOBALS['TSFE']->page['title'] == '') { $GLOBALS['TSFE']->page['title'] = $topicTitle; } else { $GLOBALS['TSFE']->page['title'] .= $this->conf['display.']['pageTitle.']['separator'] . $topicTitle; } } elseif (isset($forumTitle)) { if ($GLOBALS['TSFE']->page['title'] == '') { $GLOBALS['TSFE']->page['title'] = $forumTitle; } else { $GLOBALS['TSFE']->page['title'] .= $this->conf['display.']['pageTitle.']['separator'] . $forumTitle; } } elseif (isset($catTitle)) { if ($GLOBALS['TSFE']->page['title'] == '') { $GLOBALS['TSFE']->page['title'] = $catTitle; } else { $GLOBALS['TSFE']->page['title'] .= $this->conf['display.']['pageTitle.']['separator'] . $catTitle; } } } else { if (isset($catTitle)) { if ($GLOBALS['TSFE']->page['title'] == '') { $GLOBALS['TSFE']->page['title'] = $catTitle; } else { $GLOBALS['TSFE']->page['title'] .= $this->conf['display.']['pageTitle.']['separator'] . $catTitle; } } if (isset($forumTitle)) { if ($GLOBALS['TSFE']->page['title'] == '') { $GLOBALS['TSFE']->page['title'] = $forumTitle; } else { $GLOBALS['TSFE']->page['title'] .= $this->conf['display.']['pageTitle.']['separator'] . $forumTitle; } } if (isset($topicTitle)) { if ($GLOBALS['TSFE']->page['title'] == '') { $GLOBALS['TSFE']->page['title'] = $topicTitle; } else { $GLOBALS['TSFE']->page['title'] .= $this->conf['display.']['pageTitle.']['separator'] . $topicTitle; } } } if (isset($pageTitle)) { $GLOBALS['TSFE']->page['title'] .= $this->conf['display.']['pageTitle.']['separator'] . $pageTitle; } //wrap the page title $GLOBALS['TSFE']->page['title'] = $this->cObj->wrap($GLOBALS['TSFE']->page['title'], $this->conf['pagetitleWrap']); // set page title for indexed search $GLOBALS['TSFE']->indexedDocTitle = $GLOBALS['TSFE']->page['title']; //get to know if it is a USER_INT extension if ($this->pi_USER_INT_obj == true) { //$GLOBALS['TSFE']->page['title'] is already written, so the change does //not have any effect $GLOBALS['TSFE']->content = preg_replace('/<title>.+<\\/title>/', '<title>' . $GLOBALS['TSFE']->page['title'] . '</title>', $GLOBALS['TSFE']->content, 1); } }