update bb online list while using gallery update bb online list while using gallery
 

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]

Main Menu

update bb online list while using gallery

Started by nickfzx, April 02, 2007, 11:07:50 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

nickfzx

Ok so I am running CPG bridged with PunBB.  I noticed that if someone goes directly to coppermine, logs in and browses the gallery then they are not added to the list of online users in punbb until they actually go to the forum.

Now this is hardly surprising I know. Coppermine and PunBB are totally different aplications and sharing a user table does not mean that they share any of the same functions.

The punbb function in question is set_default_user which is called whenever someone does anything in punbb.

So what I would like to do is call this function when anyone does anything in coppermine.  I have tried doing this with a custom header in the theme file that is placed in the template and will therefor be called on every page load.

But I am having trouble...I include the punbb file common.php (which calls upon functions.php which contains the set_default_user function) but I am getting the very helpful error: call to a member function on a non-object on line 122 of punbb/include/functions.php

Below is line 122 which is in the set_default_user function in the functions.php file :
// Fetch guest user
$result = $db->query('SELECT u.*, g.*, o.logged FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON u.group_id=g.g_id LEFT JOIN '.$db->prefix.'online AS o ON o.ident=\''.$remote_addr.'\' WHERE u.id=1') or error('Unable to fetch guest information', __FILE__, __LINE__, $db->error());


Could anyone tell me why am unable to run this line...does it conflict with something in coppermine or am I just missing something.

below is the beginning of the code of my custom header for coppermine:

if(empty($custom_header)){

define('PUN_ROOT', '../forums/');
include '../forums/include/common.php';

global $pun_user;

if ($pun_user['is_guest']) {


as it stands it is not getting past the common.php include line.

nickfzx

#1
ok so i figured out how to include punbb's common.php in the custom header block.

All I needed to do was make some punbb variables global:

function pageheader($section, $meta = '')
{
   global $CONFIG, $THEME_DIR;
   global $template_header, $lang_charset, $lang_text_dir;
global $db, $pun_config, $cookie_name, $cookie_seed;
   if(empty($custom_header)){

   
define('PUN_ROOT', '../forums/');
include '../forums/include/common.php';


now it works fine and i can do things like:

if ($pun_user['is_guest']) {

and it will give the correct response inside of coppermine....but is it really inside of coppermine???

anything I put in the custom header is now exectued first and placed at the top of the page no matter where I put the {CUSTOM_HEADER} tag in the template.html file.

This is a bit odd...I even try and put the tag at the bottom of the template and it still puts any output first at the top of the page and loads it before everything else...makes for some odd loading behavior.

any thoughts as to why this might be happening?

nickfzx

fixed it

forgot to include this stuff:

static $custom_header;
       $custom_header = ob_get_contents();
     ob_clean();


had me stumped for a while :)