• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ Contributions (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Multiple configurations with the same server id

Post a bug fix, a new feature, a theme ...

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
3 posts • Page 1 of 1

Postby jmdoren » Tue Dec 11, 2007 9:58 pm

I wanted to call phpfreechat with different configurations depending on a parameter
for example
http://...../index.php?custom_conf=21
http://...../index.php?custom_conf=22

the index.php looks like this


require_once "src/phpfreechat.class.php"; // adjust to your own path
$params["serverid"] = md5(__FILE__); // used to identify the chat
if ( array_key_exists( 'custom_conf', $_REQUEST ) )
{
$cust = $_REQUEST[ 'custom_conf' ];
}else{
$cust = '-1';
}


switch( $cust )
{
case ( 1 ):
{
$params['title'] = 'Chile Lindo';
$params["channels"][] = "Chile";
break;
}
case ( 22 ):
{
$params['title'] = 'Viva México';
$params["channels"][] = "México";
break;
}
default:
{
$params['title'] = 'me gusta el tango';
$params["channels"][] = "Tangueras";
break;
}
}

$params["channels"][] = "Amigos";
$params["channels"][] = "Amigas";
$params["channels"][] = "El Bar";
$params["channels"][] = "La Playa";
$params["channels"][] = "Mayorcitos";



so i needed to support different configuration files on the cache directory

then i modify the method _GetCacheFile on the class file pfcglobalconfig.class.php

the new code now looks like this

function _GetCacheFile($serverid = "", $data_private_path = "")
{
if ($data_private_path == '')
{
$data_private_path = $this->data_private_path;
}
if ($serverid == '')
{
$serverid = $this->getId();
}
if ( array_key_exists( 'custom_conf', $_REQUEST ) )
{
return( $data_private_path.'/cache/cust_'.$serverid.'_'.md5($_REQUEST['custom_conf']).'.php' );
}


return $data_private_path.'/cache/'.$serverid.'.php';
}


please check it and consider to add it or some similar feature to the next releases of phpfreechat
jmdoren
New member
 
Posts: 3
Joined: Tue Dec 11, 2007 9:40 pm
Top

Postby certifiedgeek05 » Sun Sep 07, 2008 7:18 pm

jmdoren,
I think they forgot about you

:(
certifiedgeek05
Member
 
Posts: 10
Joined: Sun Jul 27, 2008 8:04 pm
Top

Postby OldWolf » Mon Sep 08, 2008 3:51 am

Hey certifiedgeek05, I appreciate your attempt to help people here, but could you please start checking the dates of threads you're replying to. You're hashing up a lot of dead threads.

Thanks,
OldWolf
Signature:
Read before Posting: Forum Rules
Note: I am unable to offer support through PM/e-mail at this time.
OldWolf
Site Admin
 
Posts: 1918
Joined: Sun Sep 23, 2007 5:48 am
Top


Post a reply
3 posts • Page 1 of 1

Return to Contributions (v1.x)

Who is online

Users browsing this forum: No registered users and 8 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub