Skip to content

Commit

Permalink
Misc. changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kksidd committed Aug 13, 2019
1 parent 5ef1cfc commit 0a21dd2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion couch/auth/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function __construct( $required_access_level=0, $prompt=1 ){
$this->hasher = new PasswordHash(8, TRUE);

$cookie_path = '/';
if( ($pos = strpos(K_SITE_URL, $_SERVER['HTTP_HOST'])) !==false ){
if( !empty($_SERVER['HTTP_HOST']) && (($pos = strpos(K_SITE_URL, $_SERVER['HTTP_HOST'])) !==false) ){
$given_site_dir = substr( K_SITE_URL, $pos + strlen($_SERVER['HTTP_HOST']) );
if( substr(K_SITE_DIR, -(strlen($given_site_dir))) == $given_site_dir ){
$cookie_path = $given_site_dir;
Expand Down
2 changes: 1 addition & 1 deletion couch/folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,7 @@ function __construct( $row, &$root ){
if( !is_array($this->route['params']) )$this->route['params'] = array();

if( strlen($this->route['masterpage']) && strlen($this->route['name']) ){
$this->href = $FUNCS->generate_route( $this->route['masterpage'], $this->route['name'], $this->route['params'] );
$this->href = $FUNCS->generate_route( $this->route['masterpage'], $this->route['name'], $this->route['params'], $this->route['qs'] );
$this->is_internal_link = 1;
}
}
Expand Down
3 changes: 2 additions & 1 deletion couch/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4037,7 +4037,7 @@ function process_route( $masterpage, $path ){

}

function generate_route( $masterpage, $name, $values=array() ){
function generate_route( $masterpage, $name, $values=array(), $qs='' ){
$masterpage = trim( $masterpage );
$name = trim( $name );

Expand All @@ -4052,6 +4052,7 @@ function generate_route( $masterpage, $name, $values=array() ){
$q = $route->generate( $values );
$link = K_ADMIN_URL . K_ADMIN_PAGE . "?o=".urlencode($masterpage);
if( strlen($q) ){ $link .= '&q=' . $q; }
if( strlen($qs) ){ $link .= '&' . $qs; }

return $link;
}
Expand Down

0 comments on commit 0a21dd2

Please sign in to comment.