Advanced search  

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

Pages: [1]   Go Down

Author Topic: HOW TO Integrate Coppermine 1.3.5 with Fantastatico install of SMF 1.0.5  (Read 13350 times)

0 Members and 1 Guest are viewing this topic.

Dominic Filteau

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 1

First, It is a long post, excuse me, but it's pretty complete!
Second, please excuse any bad typing/sentences, english is a second language to me.

Since it took me a lot of time to look for the right infos on how to integrate Coppermine Into SMF,
I decided i'd share it, so other people might avoid the process of looking at 8 different places :D

It's not that hard to integrate, even if it does not look like it.

I don't take credit for it, i added my 2 cents to  this Post and  this One on SMF Forums. But i will add some informations that are particular to Fantastico setup of SMF.

This is for SMF 1.0.5 and Coppermine 1.3.5

Lets Begin
 :yey:

First, Install SMF from Fantastico.
Make sure it runs correctly as Standalone,
and change the cookie name to something other than the default(in the admin panel/server params of SMF), This is to prevent other SMF site you are browsing to clear the cookie if the all use the default.
I'll take it you installed SMF into folder /smf


Second Step: Installing and Integrating Coppermine into SMF
Do not install Coppermine from Fantastico, or it will create it's own MySQL DataBase! And this integration requires Both Coppermine And SMF to share the same DB[/i]

To start, you'll need to download Coppermine on your computer.

Once downloaded, rename the unzipped coppermine folder named
cpg135
to
gallery or anything you'd like, (remember the name you will give it)
then follow these instructions to properly integrate Coppermine with your SMF forum.

In /include/init.inc.php, find:
Code: [Select]
// define('UDB_INTEGRATION', 'smf');
Replace with:
Code: [Select]
define('UDB_INTEGRATION', 'smf');
In /bridge/smf.inc.php, find:
Code: [Select]
$path = '../smf';
Replace /smf with the directory you have your SMF forum installed in, without the public_html

Once all necessary changes have been made, upload Coppermine to its own directory (examples: /public_html/gallery). 

Since SMF is installed via fantastico, you'll need to "steal" the SMF MySql database informations from the settings.php file in the forum root folder to put in the Coppermine setup:

Ftp to your main web Account, go in /public_html/smf/ (replace /smf with the folder name of the forum.
Open the file settings.php and look for the following:
Code: [Select]
########## Database Info ##########
$db_server = 'localhost';
$db_name = 'Something';
$db_user = 'Something';
$db_passwd = 'some password';

Note those, you will need them soon.

Now,from you web Browser run Coppermine's install.php.
(h**p://yoursite.com/gallery/install.php).
When asked about the database settings, Make sure you install Coppermine on the same database as that of your SMF forum. (use what you noted from the above 4 lines) Once installed, your new Coppermine gallery will be up and ready for use sharing the users and groups with your SMF forum :).

Creating the Navigation button for SMF to link to the Gallery
Create yourself a Gallery button, name it gallery.gif, place it into the proper theme folder you are using in SMF. ex:
/SMF/Themes/default/images/english/
if you are using the default theme or
/SMF/Themes/ThemeName/images/english
for a custom theme.
There is a SMF button Generator here

Now you have 2 options, either Open the Gallery in a new Window, or have it display inside the forum body, choose the one that best suits you..
If you decide to have the gallery open in a new browser window, do the following:

Edit the SMF index.template.php file on the theme you are using with BBedit(MAC) or Notepad(PC)
look for the following lines:(at the end)

Code: [Select]
// Otherwise, they might want to [logout]...
else {
echo '<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'],
    '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url']
    . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108]
    . '" style="margin: 2px 0;" border="0" />' : $txt[108]),'</a>';

insert the following code between the else{ and echo '<a href="', $scripturl, '?action=logout;(...)

(change the "../gallery" on the  first line to match the name of the coppermine folder)

Code: [Select]
   echo '<a href="../gallery" >',
    ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url']
    . '/' . $context['user']['language'] . '/gallery.gif" alt="Photo Gallery" style="margin: 2px 0;"
    border="0" />' : "Photo Gallery"),'</a>', $context['menu_separator'];

Placing the code there will make the Gallery button display only when users are logged in into the forum, at the end of the button row, just before the logout button.
If you did add the above code, skip the following section

If you want to make coppermine display into the forum page itself do the following:
1. open /smf/index.php
2. find this line:

Code: [Select]
'boardrecount' => array('Admin.php', 'AdminBoardRecount'),and after that code add this code:
Code: [Select]
'coppermine' => array('Coppermine.php', 'Coppermine'),
3. create a file called Coppermine.php with your text-only editor such as NotePad (PC) or BBEdit (Mac) and add this code inside it:
Code: [Select]
<?php
if (!defined('SMF'))
die('Hacking attempt...');

function 
Coppermine() {
// This is gonna be needed...
loadTemplate('Coppermine');
}
?>
4. save this file inside /smf/Sources

5. create a file called Coppermine.template.php with your text-only editor such as NotePad (PC) or BBEdit (Mac) and add this code inside it:
Code: [Select]
<?php

function template_main()
{
     global 
$context$settings$options$txt$scripturl;

        echo 
'
        <script language="JavaScript" type="text/javascript"><!--
                function checkAll(onOff)
                {
                        for (var i = 0; i < document.searchform.elements.length; i++)
                        {
                                if (document.searchform.elements[i].name.substr(0, 3) == "brd")
                                        document.searchform.elements[i].checked = onOff;
                        }
                }
        // --></script>
        <form action="'
$scripturl'?action=search2" method="post" name="searchform" id="searchform">
                <table width="80%" border="0" cellspacing="0" cellpadding="3" align="center">
                        <tr>
                                <td>'
theme_linktree(), '</td>
                        </tr>
                </table>

                <table width="100%"  border="0" cellspacing="0" cellpadding="4" align="center" class="tborder">
                        <tr class="titlebg">
                                <td>Coppermine Photo Gallery</td>
                        </tr><tr>
                                <td class="windowbg">'
;

                                        
// load coppermine
        
echo '<iframe width="100%" height="450"
src="http://YourSite.com/gallery"></iframe>'
;

        echo 
'
                                </td>
                        </tr>
                </table>
        </form>'
;
}

?>

Note the address in the above code, change this to reflect your Coppermine folder name and make sure to leave out the www so as to keep compatability with firefox and IE

The original help i found adds /index.php at the end of the URL, don't put it there, since it will disable the automatic user login from the forum and makes the gallery display as unregistered user.

6. save this file inside /smf/Themes/default/

7. in that same folder open /smf/Themes/default/index.template.php (or /smf/Themes/ThemeName/index.template.php) and at the end of the file find this bit of code:
The original post have you look for the calendar section to add the code, i'm changing it in order to have the Gallery button display only when the user is Logged-in
Code: [Select]
// Otherwise, they might want to [logout]...
else {
echo '<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'],
    '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url']
    . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108]
    . '" style="margin: 2px 0;" border="0" />' : $txt[108]),'</a>';

insert the following code between the else{ and echo '<a href="', $scripturl, '?action=logout;(...)
Code: [Select]
//begin gallery code
                echo '
                                <a href="', $scripturl, '?action=coppermine"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/gallery.gif" alt="' . "Gallery" . '" style="margin: 2px 0;" border="0" /></a>', $context['menu_separator'];
//end gallery code

Now, Preventing navigation Errors
This step has to be done depending on what type of display you choosed above!
In order to prevent coppermine Logout errors and the forum displaying in a loop insde the iframe if integrated into the forum display, we have to edit the Coppermine theme file you are using.

if If you have the Photo gallery open in a blank page, do the following;
Open the coppermine theme.php file you are using (ex:/gallery/theme/classic/theme.php
and replace everything that is between the
<!-- BEGIN logout -->
<!-- END logout -->

to have it look like this:
Code: [Select]
<!-- BEGIN logout -->
                                               <a href="../forum/index.php">Back to forum</a> |
<!-- END logout -->
So this will close the Coppermine page and send the user back to the forum index, using the cookie to remember the login and password of the user.

If you did include the Gallery Into the iframe of the forum ,Do the following:
It's better to disable the profile and logout buttons of coppermine so as the register button(since registration is handled by the forum...
to do so, Open the coppermine theme.php file you are using (ex:/gallery/theme/classic/theme.php
and clear the lines between the register, login and logout tags, so that it looks like this:
Code: [Select]
define('THEME_HAS_RATING_GRAPHICS', 1);
// HTML template for main menu
$template_main_menu1 = <<<EOT
                                                |
<!-- BEGIN my_gallery -->
                                                <a href="{MY_GAL_TGT}" title="{MY_GAL_TITLE}">{MY_GAL_LNK}</a> |
<!-- END my_gallery -->
<!-- BEGIN allow_memberlist -->
                                                <a href="{MEMBERLIST_TGT}" title="{MEMBERLIST_TITLE}">{MEMBERLIST_LNK}</a> |
<!-- END allow_memberlist -->
<!-- BEGIN my_profile -->
                                         
<!-- END my_profile -->
<!-- BEGIN faq -->
                        <a href="{FAQ_TGT}" title="{FAQ_TITLE}">{FAQ_LNK}</a> |
<!-- END faq -->
<!-- BEGIN enter_admin_mode -->
                                                <a href="{ADM_MODE_TGT}" title="{ADM_MODE_TITLE}">{ADM_MODE_LNK}</a> |
<!-- END enter_admin_mode -->
<!-- BEGIN leave_admin_mode -->
                                                <a href="{USR_MODE_TGT}" title="{USR_MODE_TITLE}">{USR_MODE_LNK}</a> |
<!-- END leave_admin_mode -->
<!-- BEGIN upload_pic -->
                                                <a href="{UPL_PIC_TGT}" title="{UPL_PIC_TITLE}">{UPL_PIC_LNK}</a> |
<!-- END upload_pic -->
<!-- BEGIN register -->
                                               
<!-- END register -->
<!-- BEGIN login -->
                                             
<!-- END login -->

<!-- BEGIN logout -->
                                             
<!-- END logout -->
EOT;

And that's it! :thumb:

Below are some optionals steps you can do, for functionality:
1-If you want to prevent unregistered users to see the Gallery by typing direct url like h**p://yoursite.com/gallery, simply add the following code to the file /gallery/index.php

Look for
Code: [Select]
require('include/init.inc.php');
And add this on a new line after the semicolon
Code: [Select]
//Prevent Unregistered users
if (USER_ID){

} else {
{
  $redirect = $redirect . "../forum/index.php";
      header("Location: $redirect");

  exit();
}}
//end Prevent Unregistered users
This will forward all non-logged/unregistered users to the login/subscribe page of SMF

2-You could also give the possibility to your users to open the gallery in a new window even if integrated into the forum, easy way is to edit the coppermine.template.php file and adding a href in the title bar of the forum section, still protected by forum logins...
Changing
Code: [Select]
<table width="100%"  border="0" cellspacing="0" cellpadding="4" align="center" class="tborder">
                        <tr class="titlebg">
                                <td>Coppermine Photo Gallery</td>
                        </tr><tr>
                                <td class="windowbg">';
to
Code: [Select]
<table width="100%"  border="0" cellspacing="0" cellpadding="4" align="center" class="tborder">
                        <tr class="titlebg">
                                <td>Coppermine Photo Gallery  Open the photo gallery on a new page by clicking <a href="http://yoursite.com/gallery"target="_blank">here</a></td>
                        </tr><tr>
                                <td class="windowbg">';


I hope this helps, and that you will like the integration possibilty as much as I do

Dominic
 ;)
« Last Edit: October 18, 2005, 05:52:39 pm by Nibbler »
Logged

scarcer

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: HOW TO Integrate Coppermine 1.3.5 with Fantastatico install of SMF 1.0.5
« Reply #1 on: September 06, 2006, 04:07:51 am »

i did it and it works, BUT only with internet explorer, any way to get the bridging to work with firefox, it wont log  me into the gallery
Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: HOW TO Integrate Coppermine 1.3.5 with Fantastatico install of SMF 1.0.5
« Reply #2 on: September 06, 2006, 06:22:44 am »

- This is Sticky Tutorial Thread , Do Not post your issue here , instead create a new one on a proper board
- Bridging is not related (depend) to your browser at all , you have issue some where else
- Do not use out dated 1.3.x CPG (as you post on 1.3x board) install most recent version (Currently 1.4.9)
Locking
Logged
‍I don't answer to PM with support question
Please post your issue to related board
Pages: [1]   Go Up
 

Page created in 0.028 seconds with 19 queries.