Esempio n. 1
0
 public function getUrl()
 {
     // the regex contains the url
     $url = '/' . $this->prefix . '/' . $this->arguments['tab'];
     if (strtolower(vB_String::getCharset()) != 'utf-8') {
         $url = vB_String::encodeUtf8Url($url);
     }
     return $url;
 }
Esempio n. 2
0
 public function getUrl()
 {
     $bburl = vB::getDatastore()->getOption('bburl');
     $url = $bburl . '/' . $this->prefix . '/' . $this->arguments['file'] . '.php';
     if (strtolower(vB_String::getCharset()) != 'utf-8') {
         $url = vB_String::encodeUtf8Url($url);
     }
     return $url;
 }
Esempio n. 3
0
 public function getUrl()
 {
     //bburl isn't correct as it will create a link to core rather than admincp.  This happens to work
     //for admincp for the time being, but is the wrong url.
     //		$bburl = vB::getDatastore()->getOption('bburl');
     //		return $bburl . '/' . $this->prefix . '/' . $this->arguments['file'] . '.php';
     //user the header hack instead.
     $url = vB::getDatastore()->getOption('frontendurl') . '/' . $this->prefix . '/' . $this->arguments['file'] . '.php';
     if (strtolower(vB_String::getCharset()) != 'utf-8') {
         $url = vB_String::encodeUtf8Url($url);
     }
     return $url;
 }
Esempio n. 4
0
 public function getUrl()
 {
     if (empty($this->arguments['username'])) {
         $userInfo = vB_Api::instanceInternal('user')->fetchProfileInfo($this->arguments['userid']);
         $this->arguments['username'] = $userInfo['username'];
     }
     // the regex contains the url
     $url = '/' . $this->prefix . '/' . $this->arguments['userid'] . '-' . vB_String::getUrlIdent($this->arguments['username']) . '/' . $this->arguments['tab'];
     if (isset($this->arguments['pagenum']) and is_numeric($this->arguments['pagenum']) and $this->arguments['pagenum'] > 1) {
         $url .= '/page' . intval($this->arguments['pagenum']);
     }
     if (strtolower(vB_String::getCharset()) != 'utf-8') {
         $url = vB_String::encodeUtf8Url($url);
     }
     return $url;
 }
Esempio n. 5
0
 public function getUrl()
 {
     $cache = vB_Cache::instance(vB_Cache::CACHE_FAST);
     $hashKey = 'vbRouteURLIndent_' . $this->arguments['nodeid'];
     $urlident = $cache->read($hashKey);
     if (empty($urlident)) {
         $node = vB_Library::instance('node')->getNodeBare($this->arguments['nodeid']);
         $urlident = $node['urlident'];
         $cache->write($hashKey, $urlident);
     } elseif (is_array($urlident) and !empty($urlident['urlident'])) {
         $urlident = $urlident['urlident'];
     }
     $url = '/album/' . $this->arguments['nodeid'] . '-' . $urlident;
     if (strtolower(vB_String::getCharset()) != 'utf-8') {
         $url = vB_String::encodeUtf8Url($url);
     }
     return $url;
 }
 public function getUrl()
 {
     $url = "/{$this->prefix}/" . $this->actionInternal . $this->actionClass->getUrlParameters();
     if (strtolower(vB_String::getCharset()) != 'utf-8') {
         $url = vB_String::encodeUtf8Url($url);
     }
     return $url;
 }
 public function getUrl()
 {
     if (empty($this->arguments['title'])) {
         $node = vB_Library::instance('node')->getNodeBare($this->arguments['nodeid']);
         if (empty($node) or !empty($node['errors'])) {
             return FALSE;
         }
         if ($node['urlident']) {
             $this->arguments['title'] = $node['urlident'];
         } else {
             $this->arguments['title'] = vB_String::getUrlIdent($node['title']);
         }
     }
     if (empty($this->arguments['userid'])) {
         if (!isset($node['nodeid'])) {
             $node = vB_Library::instance('node')->getNodeBare($this->arguments['nodeid']);
         }
         if ($node['setfor']) {
             $user = vB_User::fetchUserinfo($node['setfor']);
             $this->arguments['userid'] = $user['userid'];
             $this->arguments['username'] = $user['username'];
         }
     }
     $url = '/member/' . $this->arguments['userid'] . '-' . vB_String::getUrlIdent($this->arguments['username']) . '/visitormessage/' . $this->arguments['nodeid'] . '-' . vB_String::vBStrToLower(vB_String::htmlSpecialCharsUni(str_replace(' ', '-', $this->arguments['title'])));
     if (strtolower(vB_String::getCharset()) != 'utf-8') {
         $url = vB_String::encodeUtf8Url($url);
     }
     return $url;
 }
Esempio n. 8
0
 public function getUrl()
 {
     // do not append '/' if prefix is empty string (happens for home page)
     $url = $this->prefix === '' ? '' : '/' . $this->prefix;
     if (isset($this->arguments['pagenum']) and is_numeric($this->arguments['pagenum']) and $this->arguments['pagenum'] > 1) {
         $url .= '/page' . intval($this->arguments['pagenum']);
     }
     if (strtolower(vB_String::getCharset()) != 'utf-8') {
         $url = vB_String::encodeUtf8Url($url);
     }
     return $url;
 }
Esempio n. 9
0
 public function getUrl()
 {
     if (!empty($this->arguments['userid']) and !empty($this->arguments['username'])) {
         $result = '/' . $this->prefix . '/' . $this->arguments['userid'] . '-' . vB_String::getUrlIdent($this->arguments['username']);
     } else {
         return false;
     }
     // append the tab to URL only if it's a valid tab.
     if (isset($this->arguments['tab'])) {
         if (isset(self::$availableTabs[$this->arguments['tab']])) {
             $result .= '/' . $this->arguments['tab'];
             if (isset(self::$doNotIndexTabs[$this->arguments['tab']])) {
                 $this->arguments['noindex'] = true;
             }
             // append the page number if pagenum argument is set & if a tab with pagination is set
             if (isset($this->arguments['pagenum']) and is_numeric($this->arguments['pagenum']) and $this->arguments['pagenum'] > 1 and isset(self::$tabsWithPagination[$this->arguments['tab']])) {
                 $result .= '/page' . intval($this->arguments['pagenum']);
             }
         } else {
             // invalid tab, unset it
             unset($this->arguments['tab']);
         }
     }
     if (strtolower(vB_String::getCharset()) != 'utf-8') {
         $result = vB_String::encodeUtf8Url($result);
     }
     return $result;
 }
Esempio n. 10
0
 public function getUrl()
 {
     $url = '/' . $this->prefix;
     if (isset($this->arguments['pagenum']) and is_numeric($this->arguments['pagenum']) and $this->arguments['pagenum'] > 1) {
         $url .= '/page' . intval($this->arguments['pagenum']);
     }
     if (strtolower(vB_String::getCharset()) != 'utf-8') {
         $url = vB_String::encodeUtf8Url($url);
     }
     return $url;
 }
Esempio n. 11
0
 /**
  * Adds the URLs to $this->content
  *
  * @param 	int		forumdid to start at
  * @param 	int		perpage limit defaults to 30000
  */
 public function generate_sitemap($startat = 0, $perpage = 30000)
 {
     $tempFilename = $this->sitemap_path . '/' . $this->tempfile;
     $fp = @fopen($tempFilename, 'a');
     if ($fp === false) {
         $this->errors[] = 'Error opening temporary file : ' . $tempFilename;
         return false;
     }
     $startersQry = vB::getDbAssertor()->assertQuery('vBAdminCP:getGuestVisibleNodes', array('startat' => $startat, 'perpage' => $perpage + 1));
     // todo: why did we need the below loop? Do we have duplicate rows in the query or something?
     $starters = array();
     foreach ($startersQry as $node) {
         $args = unserialize($node['arguments']);
         $starters[$node['nodeid']] = array('routeid' => $node['routeid'], 'nodeid' => $node['nodeid'], 'lastpost' => $node['lastcontent'], 'urlident' => $node['urlident'], 'prefix' => $node['prefix'], 'customUrl' => !empty($args['customUrl']));
     }
     $this->has_more = false;
     foreach ($starters as $node) {
         // is this one part of the next batch?
         if ($this->pagecount + 1 > $perpage) {
             $this->has_more = true;
             break;
         }
         $this->pagecount++;
         $this->lastid = $node['nodeid'];
         /*
          *	vB5_Route::buildUrl was having some memory issues, probably due to hundreds of route instances being
          *	created etc. So below is a cheap way to generate the full URL. This has no concept of query strings
          *	or anchor tags, but that's okay since we're only dealing with topic STARTERS here (so no page# needed.)
          *	In short this is an extremely simplified version of vB5_Route_Conversation's buildUrl()
          */
         if ($node['customUrl']) {
             $url = vB::getDatastore()->getOption('frontendurl') . '/' . trim($node['prefix'], '/');
         } else {
             $url = vB::getDatastore()->getOption('frontendurl') . '/' . trim($node['prefix'], '/') . '/' . $node['nodeid'] . '-' . $node['urlident'];
         }
         if (strtolower(vB_String::getCharset()) != 'utf-8') {
             $url = vB_String::encodeUtf8Url($url);
         }
         $content = $this->url_block($url, $node['lastpost'], $this->get_effective_priority('node', $node['nodeid']));
         fwrite($fp, $content);
     }
     fclose($fp);
     // Return the amout done
     return $this->pagecount;
 }
Esempio n. 12
0
 public function getUrl($node = false)
 {
     if (isset($this->arguments['customUrl']) and $this->arguments['customUrl']) {
         $result = '/' . $this->prefix;
     } else {
         $cache = vB_Cache::instance(vB_Cache::CACHE_FAST);
         // looking up cache for the node
         $hashKey = 'vbRouteURLIndent_' . $this->arguments['nodeid'];
         $urlident = $cache->read($hashKey);
         if (empty($urlident) or !is_array($urlident)) {
             $urlident = array();
             if (!empty($this->matches['starter']) && isset($node['urlident'])) {
                 $node['starter'] = $this->matches['starter'];
                 $node['urlident'] = $this->matches['urlident'];
             } else {
                 $node = vB_Library::instance('node')->getNodeBare($this->arguments['nodeid']);
             }
             $mainConversationId = $node['starter'];
             if ($mainConversationId and $mainConversationId != $this->arguments['nodeid']) {
                 $mainConversation = vB_Library::instance('node')->getNodeBare($mainConversationId);
                 $urlident['urlident'] = $mainConversation['urlident'];
                 $urlident['nodeid'] = $mainConversationId;
             } else {
                 $urlident['urlident'] = $node['urlident'];
                 $urlident['nodeid'] = $this->arguments['nodeid'];
             }
             $cache->write($hashKey, $urlident, 1440, array('routeChg_' . $this->arguments['nodeid'], 'nodeChg_' . $this->arguments['nodeid']));
         }
         $channelUrl = $this->getChannelURL($this->arguments['channelid'], $this->matches);
         // remove trailing / (special case, non-default home page with a conversation route)
         $channelUrl = rtrim($channelUrl, '/');
         $result = $channelUrl . '/' . $urlident['nodeid'] . '-' . $urlident['urlident'];
     }
     // putting /contentpageX before /pageX
     if (isset($this->arguments['contentpagenum']) and is_numeric($this->arguments['contentpagenum']) and $this->arguments['contentpagenum'] > 1) {
         $result .= '/contentpage' . intval($this->arguments['contentpagenum']);
     }
     if (isset($this->arguments['pagenum']) and is_numeric($this->arguments['pagenum']) and $this->arguments['pagenum'] > 1) {
         $result .= '/page' . intval($this->arguments['pagenum']);
     }
     if (strtolower(vB_String::getCharset()) != 'utf-8') {
         $result = vB_String::encodeUtf8Url($result);
     }
     return $result;
 }
Esempio n. 13
0
 /** Returns the canonical url
  *
  *
  **/
 public function getCanonicalUrl()
 {
     $url = '/' . self::DEFAULT_PREFIX;
     if (!empty($this->arguments['nodeid'])) {
         if (empty($this->title)) {
             $node = vB_Library::instance('node')->getNodeBare($this->arguments['nodeid']);
             $this->title = self::prepareTitle($node['title']);
         }
         $url .= '/' . $this->arguments['nodeid'] . '-' . $this->title;
     }
     $url .= '/' . $this->arguments[self::$actionKey] . '/' . $this->arguments['action2'];
     if (strtolower(vB_String::getCharset()) != 'utf-8') {
         $url = vB_String::encodeUtf8Url($url);
     }
     return $url;
 }
Esempio n. 14
0
 public function getUrl()
 {
     $url = $this->getCanonicalUrl();
     if (strtolower(vB_String::getCharset()) != 'utf-8') {
         $url = vB_String::encodeUtf8Url($url);
     }
     return $url;
 }