/** * Write to the database for whatever was written in the form */ public function actionAddThread() { // get parent $parent = parent::actionAddThread(); $userId = XenForo_Visitor::getUserId(); $visitor = XenForo_Visitor::getInstance(); $styleId = $visitor->style_id; // print_r($styleId); // get all necessary inputs from this form $dbtc_thread_id = XenForo_Application::get('last_thread'); $dbtc_donor_id = $userId; $dbtc_date = $this->_input->filterSingle('dbtc_date', XenForo_Input::DATE_TIME); $dbtc_type_id = $this->_input->filterSingle('dbtc_type_id', XenForo_Input::UINT); $dbtc_description = $this->_input->filterSingle('dbtc_description', XenForo_Input::STRING); # make sure we've got dbtc data # TEMP WE NEED BETTER CHECK. MAKE SURE WE ARE SUBMITTING FROM DBTC STYLE if (empty($dbtc_description)) { return $parent; } //Create a instance of our DataWriter for the catalog $dwDBTCcatalog = XenForo_DataWriter::create('DBTC_DataWriter_DBTCCatalogEntry'); $dwDBTCtrans = XenForo_DataWriter::create('DBTC_DataWriter_DBTCNodeEntry'); $dataCatalog = array('dbtc_thread_id' => $dbtc_thread_id, 'dbtc_donor_id' => $dbtc_donor_id, 'dbtc_type_id' => $dbtc_type_id, 'dbtc_description' => $dbtc_description, 'dbtc_date' => $dbtc_date); $dataTrans = array('dbtc_thread_id' => $dbtc_thread_id, 'dbtc_receiver_id' => $dbtc_donor_id, 'dbtc_status_id' => "0", 'dbtc_donor_id' => "0", 'dbtc_date' => $dbtc_date, 'dbtc_parent_transaction_id' => 0); $dwDBTCcatalog->bulkSet($dataCatalog); $dwDBTCcatalog->save(); $dwDBTCtrans->bulkSet($dataTrans); $dwDBTCtrans->save(); return $parent; }
/** * * @param XenForo_ControllerPublic_Forum $controller */ protected function _processJokePollCreate(XenForo_ControllerPublic_Forum $controller) { $jokePollInput = ThemeHouse_JokePoll_DataWriter_Helper_JokePoll::getJokePollInput($controller->getInput()); $jokePollIds = ThemeHouse_JokePoll_DataWriter_Helper_JokePoll::getCurrentJokePollIds(); if (isset($GLOBALS['XenForo_DataWriter_Discussion_Thread'])) { /* @var $threadWriter XenForo_DataWriter_Discussion_Thread */ $threadWriter = $GLOBALS['XenForo_DataWriter_Discussion_Thread']; $forum = $threadWriter->getExtraData(XenForo_DataWriter_Discussion_Thread::DATA_FORUM); } else { $forumId = $controller->getInput()->filterSingle('node_id', XenForo_Input::UINT); $forumName = $controller->getInput()->filterSingle('node_name', XenForo_Input::STRING); $ftpHelper = $controller->getHelper('ForumThreadPost'); // TODO: probably should cache $forum $forum = $ftpHelper->assertForumValidAndViewable($forumId ? $forumId : $forumName); } if ($this->getModelFromCache('XenForo_Model_Forum')->canMakeJokePollInForum($forum)) { if (isset($jokePollInput['first_choice']) && $jokePollInput['first_choice']) { $jokePollIds['first_choice'][] = $this->get('poll_id'); } ThemeHouse_JokePoll_DataWriter_Helper_JokePoll::updateJokePollIdOptions($jokePollIds); } }
/** * Creates the specified helper class. * If no underscore is present in the class * name, "XenForo_ControllerHelper_" is prefixed. Otherwise, a full class * name * is assumed. * * @param string $class Full class name, or partial suffix (if no * underscore) * * @return XenForo_ControllerHelper_Abstract */ public function getHelper($class) { if ($class == "ForumThreadPost") { $class = 'ThemeHouse_SocialGroups_ControllerHelper_SocialCategory'; } return parent::getHelper($class); }
public function actionThreadsCreate() { list($team, $category) = $this->_getTeamHelper()->assertTeamValidAndViewable(); if (!$this->_getTeamModel()->canViewTabAndContainer('threads', $team, $category, $error)) { throw $this->getErrorOrNoPermissionResponseException($error); } if (!$this->getModelFromCache('Nobita_Teams_Model_Thread')->canAddThread($team, $category, $error)) { throw $this->getErrorOrNoPermissionResponseException($error); } $controllerRequest = new Zend_Controller_Request_Http(); $controllerRequest->setParam('node_id', $category['discussion_node_id']); $routeMatch = new XenForo_RouteMatch(); $controllerResponse = new Zend_Controller_Response_Http(); $forumController = new XenForo_ControllerPublic_Forum($controllerRequest, $controllerResponse, $routeMatch); $forumController->preDispatch('createThread', get_class($forumController)); $controllerResponse = $forumController->{'actionCreateThread'}(); $forumParams = $controllerResponse->params; $viewParams = array_merge($forumParams, array('team' => $team, 'category' => $category, '_teamThreadCreate' => true, 'teamId' => $team['team_id'])); return $this->_getTeamViewWrapper('threads', $team, $category, $this->responseView('XenForo_ViewPublic_Thread_Create', 'thread_create', $viewParams)); }