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: How to import phpbb custom header into coppermine theme  (Read 5619 times)

0 Members and 1 Guest are viewing this topic.

pszone

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
How to import phpbb custom header into coppermine theme
« on: November 27, 2006, 09:55:42 pm »

Hi, I have phpbb and coppermine integrated. For my other pages I make this code (the code at bottom) to load my custom header that I make. That header have login box for my forums and when the user is logged in, it have links to profile and logout. I want my gallery to have the same header, but the template.html can't load php. I try to make header.php file with my header code and load it from admin menu, but then it show's me errors. Here is my header.php code:

Code: [Select]
<?php
define
('IN_PHPBB'true);
$phpbb_root_path '../forums/';
include(
$phpbb_root_path 'extension.inc');
include(
$phpbb_root_path 'common.'.$phpEx);
//
// Start session management
//
$userdata session_pagestart($user_ipPAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//



if( $userdata['session_logged_in'] ) 
   { 
      
// they're logged in, welcome them, check to see if they're admin, grab their info
{
$u_login_logout 'forums/login.'.$phpEx.'?logout=true&amp;sid=' $userdata['session_id'];
$l_login_logout $lang['Logout'] . ' [ ' $userdata['username'] . ' ]';

}


if ( (
$userdata['session_logged_in']) && (empty($gen_simple_header)) )
{
if ( $userdata['user_new_privmsg'] )
{
$l_message_new = ( $userdata['user_new_privmsg'] == ) ? $lang['New_pm'] : $lang['New_pms'];
$l_privmsgs_text sprintf($l_message_new$userdata['user_new_privmsg']);

if ( $userdata['user_last_privmsg'] > $userdata['user_lastvisit'] )
{
$sql "UPDATE " USERS_TABLE "
SET user_last_privmsg = " 
$userdata['user_lastvisit'] . "
WHERE user_id = " 
$userdata['user_id'];
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR'Could not update private message new/read time for user'''__LINE____FILE__$sql);
}

$s_privmsg_new 1;
$icon_pm $images['pm_new_msg'];
}
else
{
$s_privmsg_new 0;
$icon_pm $images['pm_new_msg'];
}
}
else
{
$l_privmsgs_text $lang['No_new_pm'];

$s_privmsg_new 0;
$icon_pm $images['pm_no_new_msg'];
}

if ( $userdata['user_unread_privmsg'] )
{
$l_message_unread = ( $userdata['user_unread_privmsg'] == ) ? $lang['Unread_pm'] : $lang['Unread_pms'];
$l_privmsgs_text_unread sprintf($l_message_unread$userdata['user_unread_privmsg']);
}
else
{
$l_privmsgs_text_unread $lang['No_unread_pm'];
}
}
else
{
$icon_pm $images['pm_no_new_msg'];
$l_privmsgs_text $lang['Login_check_pm'];
$l_privmsgs_text_unread '';
$s_privmsg_new 0;
}

$template->assign_vars(array(
'L_LOGIN_LOGOUT' => $l_login_logout,
'L_PRIVATEMSGS' => $lang['Private_Messages'],
'L_PROFILE' => $lang['Profile'],
'PRIVATE_MESSAGE_INFO' => $l_privmsgs_text,
'PRIVATE_MESSAGE_INFO_UNREAD' => $l_privmsgs_text_unread,
'U_PRIVATEMSGS' => append_sid('privmsg.'.$phpEx.'?folder=inbox'),
'U_LOGIN_LOGOUT' => append_sid($u_login_logout),
'U_PROFILE' => append_sid('profile.'.$phpEx.'?mode=editprofile'),
)
);

$template->set_filenames(array(
"body" => "gn_logged_in.tpl")
);

$template->pparse("body"); 
   } 
else 
       { 
   
   if (!isset($board_config['allow_autologin']) || $board_config['allow_autologin'] )
{
$template->assign_block_vars('switch_allow_autologin', array());
$template->assign_block_vars('switch_user_logged_out.switch_allow_autologin', array());
}
   
   $template->assign_vars(array(
'S_LOGIN_ACTION' => append_sid('forums/login.'.$phpEx),
)
);

               
// they're logged in, welcome them, check to see if they're admin, grab their info
$template->set_filenames(array(
"body" => "gn_login.tpl")
);

$template->pparse("body"); 
   } 
 

//That's It! 
?>

I hope, there is a way to make the header work. Thaks in advance!
Logged

dereksurfs

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 29
Re: How to import phpbb custom header into coppermine theme
« Reply #1 on: November 27, 2006, 11:47:56 pm »

Well,

That is a lot of code you are dropping in.  Here is what I suggest after just using custom headers myself. 

1. Create a *basic* custom header (ie - Hello World!).
2. Then see try and add it somewhere in your template.
3.  If you get past that step start adding in some your functionality.
4. ** Read the error messages you are getting and work on resolving those.

- Derek
Logged

pszone

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: How to import phpbb custom header into coppermine theme
« Reply #2 on: November 28, 2006, 07:49:18 am »

When I try to include the header.php it show's me this error:

Code: [Select]
Fatal error: Cannot redeclare get_username() (previously declared in /home/hosting/gonzo/web/gallery375/include/functions.inc.php:1352) in /home/hosting/gonzo/web/forums/includes/functions.php on line 324
I think it's messing up with the two databases - the coppermine and phpbb. I hope someone know how to fix that.
Logged

dereksurfs

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 29
Re: How to import phpbb custom header into coppermine theme
« Reply #3 on: November 28, 2006, 06:48:43 pm »

Based on this error I would say that this going to take some work on your part to resolve.  As far as how much I don't know.  But I don't think there will be an easy fix for it.

Error: Cannot redeclare get_username()  does not indicate a database error.  Rather it is saying you are redecaring in your custom header a function that already exsits in coppermine.  You can't do that here. 

The greater question I think is one of website design.  Does phpbb sit inside Coppermine or are you placing Coppermine inside phpbb?  It sounds like you are trying to do both in this case (put part of phpbb inside of CPM when CPM is really inside phpbb).  Either way you cannot have duplicate definitions of these functions.

If you want to try and fix the error you could change the name of the function and all of its references in the header and see what happens.  But there is no guarantee that your approach will work.

- Derek
Logged

dereksurfs

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 29
Re: How to import phpbb custom header into coppermine theme
« Reply #4 on: November 28, 2006, 08:43:53 pm »

One more thing I noticed after looking at your code briefly.

The get_username() function is delcared somewhere outside this block of code.  So what might be happening is that you are including it twice.

Try removing some of your includes and see what happens:
// include($phpbb_root_path . 'extension.inc');
// include($phpbb_root_path . 'common.'.$phpEx);

- Derek
Logged

khazad

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: How to import phpbb custom header into coppermine theme
« Reply #5 on: June 22, 2007, 06:25:31 pm »

Hi all,

I'm stuck with the same problem...

Could you please tell me how you managed with that issue ?

Thanks a lot
(and excuse me for my poor english)

Khazad.
Logged
Pages: [1]   Go Up
 

Page created in 0.03 seconds with 15 queries.