コード例 #1
0
ファイル: Core.php プロジェクト: Sywooch/forums
 public static function routePrefix($full = false)
 {
     if ($full) {
         return 'full:' . Nobita_Teams_Model_Team::routePrefix();
     }
     return Nobita_Teams_Model_Team::routePrefix();
 }
コード例 #2
0
ファイル: Team.php プロジェクト: Sywooch/forums
 protected function _log(array $logUser, array $content, $action, array $actionParams = array(), $parentContent = null)
 {
     if (isset($content['title'])) {
         $title = $content['title'];
     } else {
         if (is_array($parentContent) && isset($parentContent['title'])) {
             $title = $parentContent['title'];
         } else {
             $team = XenForo_Model::create('Nobita_Teams_Model_Team')->getTeamById($content['team_id']);
             $title = $team ? $team['title'] : '';
         }
     }
     $dw = XenForo_DataWriter::create('XenForo_DataWriter_ModeratorLog');
     $dw->bulkSet(array('user_id' => $logUser['user_id'], 'content_type' => 'team', 'content_id' => $content['team_id'], 'content_user_id' => $content['user_id'], 'content_username' => $content['username'], 'content_title' => $title, 'content_url' => XenForo_Link::buildPublicLink(Nobita_Teams_Model_Team::routePrefix(), $content), 'discussion_content_type' => '', 'discussion_content_id' => 0, 'action' => $action, 'action_params' => $actionParams));
     $dw->save();
     return $dw->get('moderator_log_id');
 }
コード例 #3
0
ファイル: Team.php プロジェクト: Sywooch/forums
 public function getVisibleModerationQueueEntriesForUser(array $contentIds, array $viewingUser)
 {
     /* @var $teamModel Nobita_Teams_Model_Team */
     $teamModel = XenForo_Model::create('Nobita_Teams_Model_Team');
     $teams = $teamModel->getTeamsByIds($contentIds, array('join' => Nobita_Teams_Model_Team::FETCH_PROFILE | Nobita_Teams_Model_Team::FETCH_PRIVACY | Nobita_Teams_Model_Team::FETCH_CATEGORY));
     $output = array();
     foreach ($teams as $team) {
         $canManage = true;
         if (!$teamModel->canViewTeamAndContainer($team, $team, $key)) {
             $canManage = false;
         } else {
             if (!XenForo_Permission::hasPermission($viewingUser['permissions'], 'Teams', 'editAny') || !XenForo_Permission::hasPermission($viewingUser['permissions'], 'Teams', 'deleteAny')) {
                 $canManage = false;
             }
         }
         if ($canManage) {
             $output[$team['team_id']] = array('message' => $team['tag_line'], 'user' => array('user_id' => $team['user_id'], 'username' => $team['username']), 'title' => $team['title'], 'link' => XenForo_Link::buildPublicLink(Nobita_Teams_Model_Team::routePrefix(), $team), 'contentTypeTitle' => new XenForo_Phrase('Teams_teams'), 'titleEdit' => false);
         }
     }
     return $output;
 }
コード例 #4
0
ファイル: Team.php プロジェクト: Sywooch/forums
 public function getContentUrl(array $content, $canonical = false)
 {
     return XenForo_Link::buildPublicLink(($canonical ? 'canonical:' : '') . Nobita_Teams_Model_Team::routePrefix(), $content);
 }
コード例 #5
0
ファイル: Team.php プロジェクト: Sywooch/forums
 protected function _insertDiscussionThread($nodeId, $prefixId = 0)
 {
     if (!$nodeId) {
         return false;
     }
     $forum = $this->getModelFromCache('XenForo_Model_Forum')->getForumById($nodeId);
     if (!$forum) {
         return false;
     }
     $threadDw = XenForo_DataWriter::create('XenForo_DataWriter_Discussion_Thread', XenForo_DataWriter::ERROR_SILENT);
     $threadDw->setExtraData(XenForo_DataWriter_Discussion_Thread::DATA_FORUM, $forum);
     $threadDw->bulkSet(array('node_id' => $nodeId, 'title' => $this->_getThreadTitle(), 'user_id' => $this->get('user_id'), 'username' => $this->get('username'), 'discussion_type' => 'team', 'prefix_id' => $prefixId));
     $threadDw->set('discussion_state', $this->getModelFromCache('XenForo_Model_Post')->getPostInsertMessageState(array(), $forum));
     $threadDw->setOption(XenForo_DataWriter_Discussion::OPTION_PUBLISH_FEED, false);
     $messageText = $this->get('about');
     // note: this doesn't actually strip the BB code - it will fix the BB code in the snippet though
     $parser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_BbCode_AutoLink', false));
     $snippet = $parser->render(XenForo_Helper_String::wholeWordTrim($messageText, 500));
     $message = new XenForo_Phrase('Teams_message_create_team', array('title' => $this->get('title'), 'tagLine' => $this->get('tag_line'), 'username' => $this->get('username'), 'userId' => $this->get('user_id'), 'snippet' => $snippet, 'teamLink' => XenForo_Link::buildPublicLink('canonical:' . Nobita_Teams_Model_Team::routePrefix(), $this->getMergedData())), false);
     $postWriter = $threadDw->getFirstMessageDw();
     $postWriter->set('message', $message->render());
     $postWriter->setExtraData(XenForo_DataWriter_DiscussionMessage_Post::DATA_FORUM, $forum);
     $postWriter->setOption(XenForo_DataWriter_DiscussionMessage::OPTION_PUBLISH_FEED, false);
     if (!$threadDw->save()) {
         return false;
     }
     $this->set('discussion_thread_id', $threadDw->get('thread_id'), '', array('setAfterPreSave' => true));
     $postSaveChanges['discussion_thread_id'] = $threadDw->get('thread_id');
     $this->getModelFromCache('XenForo_Model_Thread')->markThreadRead($threadDw->getMergedData(), $forum, \XenForo_Application::$time);
     $this->getModelFromCache('XenForo_Model_ThreadWatch')->setThreadWatchStateWithUserDefault($this->get('user_id'), $threadDw->get('thread_id'), $this->getExtraData(self::DATA_THREAD_WATCH_DEFAULT));
     return $threadDw->get('thread_id');
 }
コード例 #6
0
ファイル: Post.php プロジェクト: Sywooch/forums
 /**
  * @see XenForo_AttachmentHandler_Abstract::_getContentRoute()
  */
 protected function _getContentRoute()
 {
     return Nobita_Teams_Model_Team::routePrefix() . '/posts';
 }
コード例 #7
0
ファイル: Post.php プロジェクト: Sywooch/forums
 public function getContentLink(array $report, array $contentInfo)
 {
     return XenForo_Link::buildPublicLink(Nobita_Teams_Model_Team::routePrefix(), $contentInfo);
 }