/** * @param Event $event */ public function injectThemeHeader(data $event) { // @todo Overwrite Header $data = $event->get_data(); //$data['page_header_override'] = true; //$data['page_title'] = "xxx"; $event->set_data($data); }
/** * Update the contao password if a new one was set via phpbb password forgotten function * * @param data $event */ public function resetPassword(data $event) { $data = $event->get_data(); $phpbbuser = $data['user_row']; // new password was activated, time to update contao if ($data['message'] == 'PASSWORD_ACTIVATED') { $user = $this->contaoConnector->getContaoUser($phpbbuser['username']); // We set a new password to the contao user, so the old one does not work parallel to the new one // We do not have the plain new password here, so we just set a hash based on the activation key // on next login via contao side the credential check will fail and contao will ask phpbb if the check works there // and if so update the contao password accordingly $updateUser = array('password' => md5($phpbbuser['user_actkey']), 'tstamp' => time()); if ($user !== false && isset($user['id'])) { $sql = 'UPDATE tl_member SET ' . $this->contaoConnector->getContaoDbConnection()->sql_build_array('UPDATE', $updateUser) . ' WHERE id = ' . $user['id']; $this->contaoConnector->getContaoDbConnection()->sql_query($sql); } } }
/** * Event: rfd.api.pre_update_topic * * Validate trader_type being passed in * * @param phpbbEvent $event */ public function rfd_api_pre_update_topic(phpbbEvent $event) { $data = $event->get_data(); $topic_id = $data['topic_id']; $forum_id = $data['forum_id']; $errors = $data['errors']; $type = $this->request->variable('trader_type', '', false, \phpbb\request\request_interface::POST); // if trader_type is not set, set it to the current trader_type if (!isset($type)) { $type = $this->manager->getTopicType($topic_id); $type = $this->manager->validateForumType($forum_id, $type, false); } else { if ($this->manager->getForumStatus($forum_id)) { $type = $this->manager->validateForumType($forum_id, $type, true); } } // Expose error if trader_type is not supported by the forum if (is_null($type)) { $errors[] = 'This forum does not support that trader type'; $data['errors'] = $errors; $event->set_data($data); } else { // Overwrite the request so that submit_post_end listener can handle trader_type $this->request->overwrite('prefixfield', $type, \phpbb\request\request_interface::POST); } }