예제 #1
0
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     if (!empty($data['temp_hash']) && empty($data['content_id'])) {
         $extraParams['temp_hash'] = $data['temp_hash'];
     }
     return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'attachment_id', 'filename');
 }
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     $actions = explode('/', $action);
     switch ($actions[0]) {
         case 'top-owned-games':
             $intParams = 'owned_id';
             $strParams = '';
             break;
         case 'top-played-games':
             $intParams = 'played_id';
             $strParams = '';
             break;
         case 'top-recently-played-games':
             $intParams = 'recent_id';
             $strParams = '';
             break;
         default:
             $intParams = '';
             $strParams = '';
             break;
     }
     $action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
     if ($intParams) {
         return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, $intParams, $strParams);
     } else {
         return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, $strParams);
     }
 }
예제 #3
0
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     if (preg_match('#^auto/(.*)$#i', $action, $match)) {
         return XenForo_Link::buildBasicLinkWithIntegerParam("{$outputPrefix}/auto", $match[1], $extension, $data, 'auto_warning_id');
     }
     return parent::buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, $extraParams);
 }
예제 #4
0
 /**
  * @param $originalPrefix
  * @param $outputPrefix
  * @param $action
  * @param $extension
  * @param $data
  * @param array $extraParams
  * @return false|string
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     $parts = explode('/', $action, 2);
     $subComponentName = strtolower($parts[0]);
     if ($subComponentName === 'photos') {
         if (isset($data['photo_id']) && !isset($data['content_id'])) {
             $data['content_id'] = $data['photo_id'];
         }
         if (isset($data['title']) && $data['title'] == $data['content_id']) {
             $data['title'] = '';
         }
     }
     if ($subComponentName === 'videos') {
         if (isset($data['title']) && $data['title'] == $data['content_id']) {
             $data['title'] = '';
         }
     }
     if ($subComponentName === 'locations' && isset($data['location_url'])) {
         $data['location_url'] = sonnb_XenGallery_Model_Gallery::getTitleForUrl($data['location_url']);
     }
     if ($subComponentName === 'cameras' && isset($data['camera_url'])) {
         $data['camera_url'] = sonnb_XenGallery_Model_Gallery::getTitleForUrl($data['camera_url']);
     }
     $link = XenForo_Link::buildSubComponentLink($this->_subComponents, $outputPrefix, $action, $extension, $data);
     if (!$link) {
         $link = XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, '');
     }
     return $link;
 }
예제 #5
0
파일: Wiki.php 프로젝트: Sywooch/forums
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     $components = explode('/', $action);
     $subPrefix = strtolower(array_shift($components));
     $intParams = '';
     $strParams = '';
     $title = '';
     $slice = false;
     switch ($subPrefix) {
         case 'special':
             $subPrefix = strtolower(array_shift($components));
             if ($subPrefix == 'edit-template' || $subPrefix == 'delete-template') {
                 $outputPrefix .= '/special';
                 $strParams = 'template_name';
             }
             $slice = true;
             break;
         case 'archive':
             $intParams = 'history_id';
             $slice = true;
             break;
         default:
             $strParams = 'page_slug';
     }
     if ($slice) {
         $outputPrefix .= '/' . $subPrefix;
         $action = implode('/', $components);
     }
     $action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
     if ($strParams) {
         return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, $strParams);
     } else {
         return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, $intParams, $title);
     }
 }
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     if (is_numeric($data)) {
         $data = array('field_attachment_id' => $data);
     }
     return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'field_attachment_id');
 }
예제 #7
0
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     if (!empty($data['ip_id'])) {
         $extraParams['ip_id'] = $data['ip_id'];
     }
     return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'user_id', 'username');
 }
예제 #8
0
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     if (preg_match('#^action/(.*)$#i', $action, $match)) {
         return XenForo_Link::buildBasicLinkWithIntegerParam("{$outputPrefix}/action", $match[1], $extension, $data, 'warning_action_id');
     } else {
         return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'warning_definition_id', 'title');
     }
 }
예제 #9
0
 /**
  * @param $originalPrefix
  * @param $outputPrefix
  * @param $action
  * @param $extension
  * @param $data
  * @param array $extraParams
  * @return false|string
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     $link = XenForo_Link::buildSubComponentLink($this->_subComponents, $outputPrefix, $action, $extension, $data);
     if (!$link) {
         $link = XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, '');
     }
     return $link;
 }
예제 #10
0
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     if (is_array($data)) {
         return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'subscription_id');
     } else {
         return XenForo_Link::buildBasicLink($outputPrefix, $action, $extension);
     }
 }
예제 #11
0
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     // for situations such as an array with thread and node info
     if (isset($data['node_title'])) {
         $data['title'] = $data['node_title'];
     }
     return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'node_id', 'title');
 }
예제 #12
0
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     if (is_null($this->_getKey())) {
         return null;
         //return XenForo_Link::buildLink($action); // TODO: test this?
     }
     return \XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, $this->_getKey(), $this->_title);
 }
예제 #13
0
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     if ($action === self::PREFIX_COMMENTS and isset($extraParams[self::PARAM_COMMENT_ID])) {
         $action .= sprintf('/%d', $extraParams[self::PARAM_COMMENT_ID]);
         unset($extraParams[self::PARAM_COMMENT_ID]);
     }
     return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'profile_post_id');
 }
예제 #14
0
파일: Members.php 프로젝트: Sywooch/forums
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     if (isset($extraParams['page'])) {
         if (strval($extraParams['page']) !== XenForo_Application::$integerSentinel && $extraParams['page'] <= 1) {
             unset($extraParams['page']);
         }
     }
     return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'user_id', 'username');
 }
예제 #15
0
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     if (is_array($data) && !empty($data['url_portion'])) {
         return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, 'url_portion');
     } else {
         if (isset($data['social_forum_title'])) {
             $data['title'] = $data['social_forum_title'];
         }
         return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'social_forum_id', 'title');
     }
 }
예제 #16
0
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     /* @var $classModel ThemeHouse_Objects_Model_Class */
     $classModel = XenForo_Model::create('ThemeHouse_Objects_Model_Class');
     $classes = $classModel->getAllClasses();
     $classId = str_replace("-", "_", $originalPrefix);
     if (array_key_exists($classId, $classes)) {
         return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, $classId . '_id', 'title');
     }
     return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'object_id', 'title');
 }
예제 #17
0
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     $action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
     if (is_array($data) && !empty($data['node_name'])) {
         return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, 'node_name');
     } else {
         // for situations such as an array with thread and node info
         if (isset($data['node_title'])) {
             $data['title'] = $data['node_title'];
         }
         return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'node_id', 'title');
     }
 }
예제 #18
0
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     // for situations such as an array with thread and node info
     if (isset($data['node_title'])) {
         $data['title'] = $data['node_title'];
     }
     if ($data && isset($data['node_id']) && $data['depth'] === 0) {
         if (!XenForo_Application::get('options')->categoryOwnPage) {
             return new XenForo_Link('#' . XenForo_Link::buildIntegerAndTitleUrlComponent($data['node_id'], $data['title'], true));
         }
     }
     return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'node_id', 'title');
 }
예제 #19
0
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     $link = XenForo_Link::buildSubComponentLink($this->_subComponents, $outputPrefix, $action, $extension, $data);
     if (!$link) {
         if ($data && isset($data['resource_title'])) {
             $data['title'] = $data['resource_title'];
         }
         if (isset($extraParams['review']) && is_array($extraParams['review'])) {
             $extraParams['resource_rating_id'] = $extraParams['review']['resource_rating_id'];
             unset($extraParams['review']);
         }
         $link = XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'resource_id', 'title');
     }
     return $link;
 }
예제 #20
0
파일: Banning.php 프로젝트: Sywooch/forums
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     $parts = explode('/', $action, 2);
     if (count($parts) == 1) {
         $parts[1] = '';
     }
     switch ($parts[0]) {
         case 'users':
             $output = XenForo_Link::buildBasicLinkWithIntegerParam($parts[0], $parts[1], $extension, $data, 'user_id', 'username');
             break;
         default:
             return false;
     }
     return $outputPrefix . '/' . $output;
 }
예제 #21
0
 /**
  *
  * @see XenForo_Route_PrefixAdmin_AddOns::buildLink()
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     $parts = explode('/', $action, 2);
     if (count($parts) > 1) {
         if ($parts[0] == 'languages') {
             if (empty($data['addon_id'])) {
                 $link = $outputPrefix . '/';
             } else {
                 $link = XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, '', $extension, $data, 'addon_id');
             }
             $link = $link . XenForo_Link::buildBasicLinkWithIntegerParam('languages', $parts[1], $extension, $extraParams, 'language_id', 'title');
             unset($extraParams['language_id'], $extraParams['title']);
             return $link;
         }
     }
     return parent::buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, $extraParams);
 }
예제 #22
0
파일: Threads.php 프로젝트: Sywooch/forums
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     $postHash = '';
     if ($action == 'post-permalink' && !empty($extraParams['post'])) {
         $post = $extraParams['post'];
         unset($extraParams['post']);
         if (!empty($post['post_id']) && isset($post['position'])) {
             if ($post['position'] > 0) {
                 $postHash = '#post-' . intval($post['post_id']);
                 $extraParams['page'] = floor($post['position'] / XenForo_Application::get('options')->messagesPerPage) + 1;
             }
         }
         $action = '';
     }
     $action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
     return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'thread_id', 'title') . $postHash;
 }
예제 #23
0
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     if (is_array($data)) {
         $actionParts = explode('/', $action, 2);
         if (count($actionParts) == 2) {
             $outputPrefix .= '/' . $actionParts[0];
             $action = $actionParts[1];
         }
         if (isset($data['moderator_id'])) {
             return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'moderator_id', 'username');
         } else {
             if (isset($data['user_id'])) {
                 return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'user_id', 'username');
             }
         }
     }
     return false;
 }
예제 #24
0
파일: Teams.php 프로젝트: Sywooch/forums
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     $csrf = false;
     if (isset($extraParams['t'])) {
         $csrf = true;
         unset($extraParams['t']);
     }
     // special params to banning
     if (!empty($data[Nobita_Teams_Banning::BANNING_ID_KEY])) {
         $banData = Nobita_Teams_Banning::getBanningParamsFromData($data);
         if ($banData) {
             $extraParams['team_id'] = $banData[0];
             $extraParams['type'] = $banData[1];
             $extraParams['user_id'] = $banData[2];
         }
         unset($data[Nobita_Teams_Banning::BANNING_ID_KEY]);
     }
     // comment extraData
     if (!empty($data['comment_type']) && !empty($data['team_id'])) {
         $extraParams['comment_type'] = $data['comment_type'];
         $extraParams['team_id'] = $data['team_id'];
         $extraParams[$data['comment_type'] . '_id'] = $data['post_id'];
     }
     if ($csrf) {
         // set csrf token into last params
         $extraParams['t'] = XenForo_Visitor::getInstance()->csrf_token_page;
     }
     $link = XenForo_Link::buildSubComponentLink($this->_subComponents, $outputPrefix, $action, $extension, $data);
     if (!$link) {
         $action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
         if (is_array($data) && !empty($data['custom_url'])) {
             $link = XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, 'custom_url');
         } else {
             if ($data && isset($data['team_title'])) {
                 $data['title'] = $data['team_title'];
             }
             $link = XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'team_id', 'title');
         }
     }
     return $link;
 }
예제 #25
0
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     // add items to allow search to be repeated; query is checked to ensure user can view
     if ($data && !empty($data['search_query'])) {
         if (!empty($data['search_query'])) {
             $extraParams['q'] = $data['search_query'];
         }
         if (!empty($data['search_type'])) {
             $extraParams['t'] = $data['search_type'];
         }
         if (!empty($data['search_order'])) {
             $extraParams['o'] = $data['search_order'];
         }
         if (!empty($data['search_grouping'])) {
             $extraParams['g'] = $data['search_grouping'];
         }
         if (!empty($data['search_constraints'])) {
             $extraParams['c'] = json_decode($data['search_constraints'], true);
         }
     }
     return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'search_id');
 }
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'id', 'title');
 }
예제 #27
0
파일: Events.php 프로젝트: Sywooch/forums
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     $components = explode('/', $action);
     $subPrefix = strtolower(array_shift($components));
     $intParams = '';
     $strParams = '';
     $title = '';
     $slice = false;
     switch ($subPrefix) {
         case 'monthly':
             $strParams = 'strParam';
             $title = 'month';
             $slice = true;
             $data['strParam'] = $data['month'] . '.' . $data['year'];
             break;
         case 'weekly':
             $strParams = 'strParam';
             $title = 'week';
             $slice = true;
             $data['strParam'] = $data['week'] . '.' . $data['wYear'];
             break;
         case 'daily':
             $strParams = 'strParam';
             $title = 'daynum';
             $slice = true;
             $data['strParam'] = $data['daynum'] . '.' . $data['year'];
             break;
         case 'birthdays':
             $strParams = 'strParam';
             $title = 'day';
             $slice = true;
             $data['strParam'] = $data['day'] . '.' . $data['month'];
             break;
         default:
             $intParams = 'event_id';
             $title = 'event_title';
     }
     if ($slice) {
         $outputPrefix .= '/' . $subPrefix;
         $action = implode('/', $components);
     }
     $action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
     if ($strParams) {
         return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, $strParams);
     } else {
         return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, $intParams, $title);
     }
 }
예제 #28
0
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     $intParams = 'id';
     $strParams = '';
     return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, $intParams, $strParams);
 }
예제 #29
0
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     $action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
     return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'conversation_id', 'title');
 }
 /**
  * Method to build a link to the specified page/action with the provided
  * data and params.
  *
  * @see XenForo_Route_BuilderInterface
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     $extraParams['form_id'] = $data['form_id'];
     return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'form_destination_id');
 }