Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: coppermine & phpbb2 : login rediretion on subdomain  (Read 13130 times)

0 Members and 1 Guest are viewing this topic.

john degey

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 3
coppermine & phpbb2 : login rediretion on subdomain
« on: August 28, 2007, 07:55:56 pm »

hi all
i was using coppermine's integration with phpbb2 on the same domain.
now, i've changed my configuration with 2 subdomains.
i have little redirection problems that unsatisfied me, so i've made some change to coppermine's code and release a phpbb mod to integrate well with this changes.

the changes for coppermine are here http://www.johndegey.org/ressources/coppermine/mod/SubDomainRedirection.mod
it use the phpbb mod format.
it requires just to change 2 files: the bridge/phpbb2018.inc.php and teh base class file bridge/udb_base.inc.php

the php mod is here http://www.johndegey.org/ressources/phpbb2/mod/SubDomainRedirection.mod
it was submitted this afternoon to the phpbb mod team, but it works well for what it is design.

regards,
john
« Last Edit: September 04, 2007, 11:12:10 am by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: coppermine & phpbb2 : login rediretion on subdomain
« Reply #1 on: September 04, 2007, 11:11:54 am »

For ease of use I will provide the code changes here as well: edit bridge/phpbb2018.inc.php, find
Code: [Select]
function login_page()
{
global $CONFIG;

        $cpg = parse_url($CONFIG['site_url']);
        $bb = parse_url($this->boardurl);
        $levels = count(explode('/', $bb['path'])) - 1;
$redirect = str_repeat('../', $levels) . trim($cpg['path'], '/') . '/';
$this->redirect("/login.php?redirect=$redirect");
}
and replace with
Code: [Select]
//---------------------------------------------------------------------------------
// Subdomain Redirection For Log In - Begin Code Addition
//
function login_page()
{
global $CONFIG;

        if(!$this->redirecting_subdomain()) {
            $cpg = parse_url($CONFIG['site_url']);
    $bb = parse_url($this->boardurl);
            $levels = count(explode('/', $bb['path'])) - 1;
    $redirect = str_repeat('../', $levels) . trim($cpg['path'], '/') . '/';
    $this->redirect("/login.php?redirect=$redirect");
        }
}
//
// Subdomain Redirection For Log In - End Code Addition
//---------------------------------------------------------------------------------
Thanks for your contribution.

@others: please review the mod and report your results.
Logged

Nibbler

  • Guest
Re: coppermine & phpbb2 : login rediretion on subdomain
« Reply #2 on: September 04, 2007, 09:35:50 pm »

The mod also requires you to add this method:

Code: [Select]
    function redirecting_subdomain() {
global $CONFIG;

        $cpgHost = parse_url($CONFIG['site_url'],PHP_URL_HOST);
        $boardHost = parse_url($this->boardurl,PHP_URL_HOST);
        if($cpgHost == $boardHost) return FALSE;
        /*
          we check the subdomain a little bit
        */
        $cpgDomain = substr($cpgHost,strpos($cpgHost,'.')+1);
        $boardDomain = substr($boardHost,strpos($boardHost,'.')+1);
       
        if($cpgDomain != $boardDomain) return FALSE;

        $this->redirect("/login.php?redirect=${CONFIG['site_url']}&subdomain=1");
        return TRUE;
    }

Contrary to the instructions, this should go into phpbb2018.inc.php - it is cleaner this way,

Note this mod requires PHP >= 5.1.2, although you can code around this.
Logged
Pages: [1]   Go Up
 

Page created in 0.025 seconds with 16 queries.