[GH-ISSUE #51] [BUG?] wrong URLS to links are provided after logging in. #45

Closed
opened 2026-02-26 09:35:24 +03:00 by kerem · 2 comments
Owner

Originally created by @janusqa on GitHub (Sep 21, 2013).
Original GitHub issue: https://github.com/opensolutions/ViMbAdmin/issues/51

Hi,

I am logging into vimbadmin via a url that looks like this:
mydomain.com:port/admin

after logging in the urls are like this
mydomain.com/admin.
How can I get it to show/use the correct url:port I originally entered. It's lopping off the port part.

Thanks. :)

Originally created by @janusqa on GitHub (Sep 21, 2013). Original GitHub issue: https://github.com/opensolutions/ViMbAdmin/issues/51 Hi, I am logging into vimbadmin via a url that looks like this: mydomain.com:port/admin after logging in the urls are like this mydomain.com/admin. How can I get it to show/use the correct url:port I originally entered. It's lopping off the port part. Thanks. :)
kerem closed this issue 2026-02-26 09:35:24 +03:00
Author
Owner

@janusqa commented on GitHub (Sep 25, 2013):

Ok I tracked down my problem to library/ViMbAdmin/Controller/Action.php

in the createView function I see it is using $_SERVER['SERVER_NAME'] instead of $_SERVER['HTTP_HOST']
So I change createView to use the HTTP_HOST server variable and now the links reflect the actual url that I am accessing vimbadmin from

The adjusted createView function in Action.php:

public function createView()
{
    $view = $this->_bootstrap->getResource( 'smarty' );
    $view->pagebase = '';

    // are we using ssl?
    //if( ( isset( $_SERVER['HTTPS'] ) && !empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' )
    //        || ( isset( $_SERVER['SERVER_PORT'] ) && $_SERVER['SERVER_PORT'] == 443 ) )
    //    $ssl = 's';
    //else
    //    $ssl = '';

    //if( isset( $_SERVER['SERVER_NAME'] ) )
    //    $view->pagebase = "http{$ssl}://{$_SERVER['SERVER_NAME']}" . Zend_Controller_Front::getInstance()->getBaseUrl();

    if( isset( $_SERVER['HTTP_HOST'] ) )
      $view->pagebase = sprintf("%s://%s", isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', $_SERVER['HTTP_HOST']) . Zend_Controller_Front::getInstance()->getBaseUrl();

    $view->basepath = Zend_Controller_Front::getInstance()->getBaseUrl();

    return $view;
}
<!-- gh-comment-id:25089421 --> @janusqa commented on GitHub (Sep 25, 2013): Ok I tracked down my problem to library/ViMbAdmin/Controller/Action.php in the createView function I see it is using $_SERVER['SERVER_NAME'] instead of $_SERVER['HTTP_HOST'] So I change createView to use the HTTP_HOST server variable and now the links reflect the actual url that I am accessing vimbadmin from The adjusted createView function in Action.php: ``` public function createView() { $view = $this->_bootstrap->getResource( 'smarty' ); $view->pagebase = ''; // are we using ssl? //if( ( isset( $_SERVER['HTTPS'] ) && !empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' ) // || ( isset( $_SERVER['SERVER_PORT'] ) && $_SERVER['SERVER_PORT'] == 443 ) ) // $ssl = 's'; //else // $ssl = ''; //if( isset( $_SERVER['SERVER_NAME'] ) ) // $view->pagebase = "http{$ssl}://{$_SERVER['SERVER_NAME']}" . Zend_Controller_Front::getInstance()->getBaseUrl(); if( isset( $_SERVER['HTTP_HOST'] ) ) $view->pagebase = sprintf("%s://%s", isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', $_SERVER['HTTP_HOST']) . Zend_Controller_Front::getInstance()->getBaseUrl(); $view->basepath = Zend_Controller_Front::getInstance()->getBaseUrl(); return $view; } ```
Author
Owner

@barryo commented on GitHub (Feb 15, 2014):

This should be working fine in V3.

I'm generally doing a clean up of issues now that ViMbAdmin V3 has been released which
side-steps or fixes past issues or implements requested features,

Feel fee to open new issues relating to version 3 if your issue persists.

<!-- gh-comment-id:35150756 --> @barryo commented on GitHub (Feb 15, 2014): This should be working fine in V3. > I'm generally doing a clean up of issues now that ViMbAdmin V3 has been released which > side-steps or fixes past issues or implements requested features, > > Feel fee to open new issues relating to version 3 if your issue persists.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ViMbAdmin-opensolutions#45
No description provided.