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: update bb online list while using gallery  (Read 3012 times)

0 Members and 1 Guest are viewing this topic.

nickfzx

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 285
update bb online list while using gallery
« on: April 02, 2007, 11:07:50 pm »

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:
Code: [Select]
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 :
Code: [Select]
// 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:

Code: [Select]
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.
« Last Edit: April 20, 2007, 08:06:03 am by GauGau »
Logged

nickfzx

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 285
Re: update bb online list while using gallery
« Reply #1 on: April 19, 2007, 04:41:02 pm »

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:

Code: [Select]
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:
Code: [Select]
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?
« Last Edit: April 19, 2007, 04:58:46 pm by nickfzx »
Logged

nickfzx

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 285
Re: update bb online list while using gallery
« Reply #2 on: April 19, 2007, 05:42:46 pm »

fixed it

forgot to include this stuff:
Code: [Select]
static $custom_header;
       $custom_header = ob_get_contents();
     ob_clean();

had me stumped for a while :)
Logged
Pages: [1]   Go Up
 

Page created in 0.016 seconds with 15 queries.