public function actionPromote()
 {
     $handler = SimplePortal_Static::getItemModel()->getPortalItemHandlerClass('thread');
     if ($handler && $handler->canPromote()) {
         if ($this->isConfirmedPost()) {
             $itemIds = $this->getInlineModIds(false);
             $categoryId = $this->_input->filterSingle('category_id', XenForo_Input::UINT);
             $additionalData = array();
             if ($categoryId) {
                 $additionalData = array(SimplePortal_Helper_Content::CATEGORY_ID => $categoryId);
             }
             foreach ($itemIds as $threadId) {
                 if (!$handler->isAlreadyPromoted('thread', $threadId)) {
                     SimplePortal_Helper_Content::promote('thread', $threadId, $additionalData);
                     $this->getModelFromCache('SimplePortal_Model_PortalItem')->logModerationAction('thread', $threadId, SimplePortal_Static::MOD_ACTION_PROMOTE);
                 }
             }
             $this->clearCookie();
             return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $this->getDynamicRedirect());
         } else {
             $threadIds = $this->getInlineModIds();
             $redirect = $this->getDynamicRedirect();
             if (!$threadIds) {
                 return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $redirect);
             }
             $conditions = array('content_type' => 'thread', 'content_id' => $threadIds);
             $alreadyPromoted = SimplePortal_Static::getItemModel()->getPortalItems($conditions, array(), 'content_id');
             $threadIds = array_diff($threadIds, array_keys($alreadyPromoted));
             $redirect = $this->getDynamicRedirect();
             if (!$threadIds) {
                 return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $redirect);
             }
             $viewParams = array('threadIds' => $threadIds, 'threadCount' => count($threadIds), 'redirect' => $redirect, 'categories' => $this->getModelFromCache('SimplePortal_Model_Category')->getAllCategories(), 'contentType' => new XenForo_Phrase('threads'), 'alreadyPromoted' => count($alreadyPromoted));
             return $this->responseView('SimplePortal_ViewPublic_InlineMod_Thread', 'el_portal_inline_mod_thread_promote', $viewParams);
         }
     }
     return $this->responseNoPermission();
 }
 protected function _promote()
 {
     $threadId = $this->get('thread_id');
     if (XenForo_Application::isRegistered('extraportal.promoteThread')) {
         $input = XenForo_Application::get('extraportal.promoteThread');
     } else {
         // autopromotion
         $input = array();
     }
     $data = array();
     if (isset($input['category_id'])) {
         $data[SimplePortal_Helper_Content::CATEGORY_ID] = $input['category_id'];
     }
     if (isset($input['display_order'])) {
         $data[SimplePortal_Helper_Content::DISPLAY_ORDER] = $input['display_order'];
     }
     if ($this->getOption(self::OPTION_ATTACH_ATTACHMENT_TO_PORTAL)) {
         $attachment = SimplePortal_Helper_Content::findInlineAttachment($this->getFirstMessageDw()->get('message'));
         $attachmentId = $attachment['attachment_id'];
         $data[SimplePortal_Helper_Content::ATTACHMENT_ID] = $attachmentId;
     }
     SimplePortal_Helper_Content::promote('thread', $threadId, $data);
 }