coppermine-gallery.com/forum

Support => cpg1.3.x Support => Older/other versions => cpg1.3 (BBS) Integration / Bridging => Topic started by: ConteMario on November 03, 2005, 11:34:55 AM

Title: MP integration with Invision Power Board/Coppermine
Post by: ConteMario on November 03, 2005, 11:34:55 AM
Hey there!

I've installed and bridged Coppermine fotogallery vers 1.3.5 and invision power board vers 1.3, and it works fine.

Now I'd like to integrate the private messaging betwen the two.

I wonder, how can I use the following script in coppermine fotogallery?




script:


<?

// Variables
$members = "ibf_members";         
$groups =    "ibf_groups";               
$url =           "http://www.site.it/forum/index.php";
$short =       "forum/admin.php";
$db_host =  "";                 
$db_user =   "";                     
$db_pass =  "";                     
$database =  "";         

// langugage variables
$yourcp = "Tuo Pannello";
$gobyebye = "Scollegati";
$loggedin = "Collegato come: ";
$login = "Login";
$register = "Registrati";

// ---------------
// Cookies...
// ---------------

$ibf_member_id = $_COOKIE['member_id']; // member name from the cookie.
$ibf_pass_hash = $_COOKIE['pass_hash']; // password encripted from the cookie. using md5();
$ibf_session_id = $_COOKIE['session_id']; // session id for links and what not.

// connect to the database
$link = mysql_connect("$db_host","$db_user","$db_pass") or die("cannot connect");
mysql_select_db("$database");

function show_mlist() {

global $ibf_member_id, $ibf_pass_hash, $ibf_session_id, $members, $groups, $url, $short, $yourcp, $gobyebye, $loggedin, $login, $register, $pm;

// Selecting members from the database
$query = "SELECT m.id AS id, m.password AS password, m.name AS name, m.mgroup AS mgroup, m.new_msg AS new_msg, m.show_popup AS show_popup, g.g_id AS g_id, g.g_is_supmod AS g_is_supmod, g.g_access_cp AS g_access_cp FROM ".$members." m LEFT JOIN ".$groups." g ON ( g.g_id = m.mgroup) WHERE id='$ibf_member_id'";
$result = mysql_query($query) or die("A fatal MySQL error occured. <br />\nQuery: " . $query . "<br />\nError: " . mysql_error());

$pm = mysql_fetch_array($result);

$show_popup = $pm['show_popup'];

if( $show_popup > 0 ) {

$query = "UPDATE ibf_members SET show_popup=0 WHERE id=$ibf_member_id";
$result = mysql_query($query) or die("A fatal MySQL error occured. <br />\nQuery: " . $query . "<br />\nError: " . mysql_error());

$kaboom ="
<script language='JavaScript'>
              <!--
              window.open('$url?act=Msg&CODE=99&s=$ibf_session_id','NewPM','width=500,height=250,resizable=yes,scrollbars=yes');
              //-->
              </script>";
}

$rendered .= $kaboom;


if( isset( $ibf_member_id ) && ( $ibf_pass_hash == "$pm[password]" ) ){




if( $pm[g_is_supmod] == 1 ) {

$rendered .="
<td class=\"mario\">
          <img alt src=\"$immagine\" border=\"0\">&nbsp;<a href=\"{$url}?s=$ibf_session_id&amp;act=Msg&amp;CODE=01\">{$pm['new_msg']} Nuovi MP</a>&nbsp;&nbsp;&nbsp;
                                        </td>     

";

return $rendered;
}







$rendered .=  "
<a href=\"{$url}?s=$ibf_session_id&amp;act=Msg&amp;CODE=01\">{$pm['new_msg']} Nuovi MP</a>

<a href='javascript:buddy_pop();'>Assistente</a>

<a href=\"{$url}?act=Search&amp;CODE=getnew\">visualizza nuovi messaggi</a>

";

} else {


$rendered = "Welcome <strong>Visitor</strong> <a href='".$url."?act=Login&amp;CODE=00'>Login</a> | <a href='".$url."?&amp;act=Reg&amp;CODE=00'>Register</a>";
}

return $rendered;
}

$show_left = show_mlist();
echo $show_left;

?>

<html>

<script language='JavaScript'>
<!--
function buddy_pop()
{
window.open('http://www.motogatti.it/forum/index.php?act=buddy&','BrowserBuddy','width=200,height=450,resizable=yes,scrollbars=yes');
}
//-->
</script>
</html>



Thanks
Conte
Title: Re: MP integration with Invision Power Board/Coppermine
Post by: ConteMario on November 04, 2005, 05:03:47 PM
help me please ...  :\'(
Title: Re: MP integration with Invision Power Board/Coppermine
Post by: Joachim Müller on November 04, 2005, 08:30:41 PM
we don't know IPB code, but the code you posted certainly won't work. If you need it that badly, why don't you hire someone to code this for you?
Title: Re: MP integration with Invision Power Board/Coppermine
Post by: ConteMario on November 05, 2005, 05:10:33 PM
Thanks for replying.

If You do not know how IPB works I wonder how can you be so sure that my script won't work.
I wrote and tested the script myself and I know that it works.
It is basically a query that checks the variable 'show_popup' and, depending on it writes a java script.

I wrote the message just to know in which part of the coppermine code I can insert the script.
Title: Re: MP integration with Invision Power Board/Coppermine
Post by: Joachim Müller on November 06, 2005, 02:44:53 PM
well, if you're sure that the script does what it's suppossed to do, edit themes/yourtheme/theme.php and add a custom header (http://forum.coppermine-gallery.net/index.php?action=search2;search=custom%20header) or footer with your script as an include file. However, the <html>-tags don't belong where you put them, I'm pretty sure. The script will definitely produce some overhead as well, and you might run into issues with open db connections.
Title: Re: MP integration with Invision Power Board/Coppermine
Post by: ConteMario on November 07, 2005, 09:52:48 AM
This is the reason why I needed Your help! I noticed that the script gives a conflict with the coppermine DB connections, and I'd like to integrate them, if possible.
When the script queries the invision DB could I use the bridge variables to avoid the conflicts? Is there any other solutions to avoid conflicts?

thanks ones more
Conte.
Title: Re: MP integration with Invision Power Board/Coppermine
Post by: Nibbler on November 07, 2005, 12:42:35 PM
Simplest solution is to place them both in the same database. If you want to use the bridge's db connection though, that connection is stored in $UDB_DB_LINK_ID.