MP integration with Invision Power Board/Coppermine MP integration with Invision Power Board/Coppermine
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

MP integration with Invision Power Board/Coppermine

Started by ConteMario, November 03, 2005, 11:34:55 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ConteMario

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
Hello World :-P

ConteMario

Hello World :-P

Joachim Müller

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?

ConteMario

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.
Hello World :-P

Joachim Müller

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 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.

ConteMario

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.
Hello World :-P

Nibbler

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.