• Welcome to Simple Machines Community Forum. Please login or sign up.
January 23, 2022, 10:41:05 AM

News:

Wondering if this will always be free?  See why free is better.


Installation of Bridge 3.19a

Started by Kindred, April 11, 2006, 09:59:17 AM

Previous topic - Next topic

Kindred

April 11, 2006, 09:59:17 AM Last Edit: October 04, 2006, 11:27:31 AM by Kindred
Instructions for v3.19a of the Bridge:  (for use with SMF 1.0.x and SMF 1.1RC1 or prior)
For SMF1.1 RC2 and SMF1.1RC3, please use the bridge v1.1.6 and see the instructions higher in this thread.


It should be noted, before you start with this bridge...
Everything in these instructions assumes that you already have Mambo (4.5.2.3 through 4.5.4) or Joomla v1.0.x installed
and SMF (1.0.x or 1.1beta3, 1.1beta4 or 1.1RC1) installed and both are working as stand-alone utilities.

For simplicity, if you don't know exactly what you are doing:
- SMF should be installed in a "top level" directory. (i.e. www.yoursite.com/forum or
something like that)
- Mambo can be installed in a "top level" directory or at the top level itself.

This readme includes a step by step instruction on how to install the bridge.
It addresses the most common questions in slightly more detail than Orstio's separate files and it basically puts a description of everything in one place.

Of course, the first rule of software applies to the bridge, as everything else...   RTFM!

PLEASE NOTE:  There are now TWO versions of the bridge.
The one MOS_SMF_BRIDGEv3.19a_stable.zip is for use with SMF 1.0.x.
The one titled MOS_SMF_BRIDGEv3.19a_SMF1.1b3.zip is for use with SMF 1.1 beta3, beta 4 and RC1.
These bridges will NOT work with the other version! Please make sure you are using the correct bridge before attempting an installation!


This one is for SMF 1.0.x:

http://mamboforge.net/frs/download.php/6472/MOS_SMF_BRIDGEv3.19a_stable.zip

This one is for SMF 1.1 beta 3, beta 4 and RC1:

http://mamboforge.net/frs/download.php/6471/MOS_SMF_BRIDGEv3.19a_SMF1.1b3.zip

Be aware that you can not have more than one menu link directly to the component smf- forums.
If you create more than one menu link (to the component) , it will cause mambo to create multiple ItemIDs that point to the same function. This will cause the bridge to have Multiple Personality Disorder...  and will mean that login/logout (among other things) will not work!

If you want to have the forum listed in multiple menus (like main and top, for example) then create ONE Component menu item (I suggest in Main) and then the other menu itmes should be LINK - URLs pointing to index.php?option=com_smf&Itemid=** (where ** is the actual ItemID on your system).


START:

First, unzip the Bridge ZIP file

This will extract to create a number of subdirectories and files.
step-by-step install
misc modules
mosbot

It should be noted that these instructions assume that you have never had the bridge
installed before. If you have had the bridge previously installed, some steps may
already have been done, or may fail with the automatic installs, since the code they
are looking to modfy has already been modified. For upgrade details, I have made a
separate section of these instructions.

INSTALLATION INSTRUCTIONS:

Now that you have all the files unzipped and ready to load, you can log in to your
server and start installation.

This README has a detailed instructions, but the new step-by-step design makes things
fairly easy and straight-forward. Make sure you read all the README files in each of
the directories.


1) Install the package in SMF.
     1a) Using your (standalone) SMF, go to the package manager
     1b) Choose Download a new Package
     1c) From the the "step-by-step install/step 1" directory, upload
            "smf_mambo3.1.tar.gz" and apply the mod.

2) Install the Simple Machines Forum component.
     2a) Using Mambo Admin > Components > Install/Uninstall Component
     2b) Choose Upload File Package and Browse to the "step-by-step install/step 2"
           directory and choose the file called "com_smf.zip"

3) Install the Simple Machine Forum Registration component.
     3a) Using Mambo Admin > Components > Install/Uninstall Component
     3b) Choose Upload File Package and Browse to the "step-by-step install/step 3"
           directory and choose the file called "com_smf_registration.zip"
 
           This uses the registration options in your Mambo Admin > Global Configuration,
           just like the Mambo default registration.

4) Install the smf_login Module.
     4a) Using Mambo Admin > Modules > Install/Uninstall Module
     4b) Choose Upload File Package and Browse to the "step-by-step install/step 4"
           directory and choose the file called "mod_smf_login.zip"
 
5) Modify the index.php of your Mambo Template.
     5a) Go to directory MAMBO/templates/NAME (where MAMBO is your mambo directory and
           NAME is the name of the template.)
     5b) Open index.php
     5c) Add the following code just before the </HEAD> tag in index.php


<?php 
global $sc$context;

if (!
defined('SMF')){
  require (
"administrator/components/com_smf/config.smf.php");
  require (
$smf_path."/SSI.php");
}

$sc = &$context['session_id'];
$_SESSION['USER_AGENT'] = $_SERVER['HTTP_USER_AGENT'];

mysql_select_db($mosConfig_db);
?>


AND add the following just above the </body> tag:

<?php mysql_select_db($db_name); ?>


6) Configure the SMF component in Mambo Admin.
     6a) Using the Mambo Admin, choose Components> Simple Machines Forum > Edit Config
     6b) Set the Path to SMF. This is NOT a URL! This is the absolute path to your SMF
           Installation. (Usually this will be something similar to /home/username/public_html/forum)
     6c) Choose if you want your Forum wrapped or unwrapped.
 
           It should be noted that there are essentially three formats to display your
           Mambo/Forum integration:
     Wrapped:     You are using SMF through the Mambo bridge. The Forum appears
                        "wrapped" in the Mambo tables.
     Unwrapped:  You are still using SMF through Mambo, but it doesn't have the
                         look of a wrapped forum. It looks stand-alone, but it is actually
                         loading through Mambo.
           This is set in the Mambo config for the component.
           (No changes to MOS_SMF.php are required in this case.)
     Stand-alone:  You don't want your forum URL to change.
                         This would be if you already have a large SMF userbase, and you
                         don't want them to have to change the URL that they probably have
                         bookmarked.  In that case, make the changes in MOS_SMF.php as noted.
     6d) Choose if you want to use the bridge registration or the standard SMF registration.
           The bridge registration looks like mambo's registration method...
           but both options will still result in the users being added to both databases (eventually).

7 ) Other Configuration notes
     7a) You will probably want to start SMF off with default settings...
     7b) If you make the Mambo menu item (for the SMF component) available to registered
          users only, the login and registration may not function correctly.
     7c) Activation emails should be handled by Mambo.

8) in Mambo Admin > Modules > Site Modules: Unpublish the (default Mambo) mod_login module.

9) in Mambo Admin > Modules > Site Modules: Edit the mod_smf_login module.
    It is a known issue in Mambo that modules must be "saved" at least once in order to
    be fully activated.
     9a) Choose what options you want displayed in your Login box...

10) In Mambo Admin > Menu > User Menu Remove the link for the User Profile.
     (You will not want Mambo to handle the user information any more)

11) In Mambo Admin > Site > Trash Manager: Click on the Menu Items tab and delete all
     the trashed items... (this cleans up the ItemID stuff. If you ever uninstall your smf
     bridge, you will want to delete the old menu item and remove the trash before adding
     a new version of the bridge. Otherwise Mambo may get confused as to which ItemID the
     real bridge is using.)

UPGRADING THE BRIDGE

If you are upgrading, and just want to over-write the files, the new version (3.1)
adds a number of files that did not exist pre-3.0.

These go into administrator/components/com_smf/:

admin.smf.php
config.smf.php
install.smf.php
smf.xml
toolbar.smf.html.php
toolbar.smf.php
uninstall.smf.php

These goes in components/com_smf/:

smf.php
the entire language/ directory and all files in it

These goes in administrator/components/com_smf_registration/:

admin.smf_registration.php
config.smf_registration.php
install.smf_registration.php
smf_registration.xml
toolbar.smf_registration.html.php
toolbar.smf_registration.php
uninstall.smf_registration.php

These goes into components/com_smf_registration/:

smf_registration.php
smf_registration.html.php

This goes into your SMF /Sources/:

MOS_SMF.php

==================================================================================================

From Gianni_T, this will add the dynamic page titles to v3.19a of the bridge...
Add the following command into "components/com_smf/smf.php" at line 36
$mainframe->SetPageTitle( $context['page_title'] );

==================================================================================================

USING THE BRDIGE WITH NO GUEST ACCESS TO YOUR FORUM

To get the best functionality, you should have your forum available to guests (one section is all that is required).
If, for some reason, you feel that guest viewing of your forum should not be allowed, at all, then you can try the following fix.

In SMF's index.php, find the guest access "whitelist" (things guests are allowed to do) and add mambo_login, as suggested below. (NOTE: This hack only applies to v3.19a of the bridge!)


// If guest access is off, a guest can only do one of the very few following actions.
elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('login', 'login2', 'mambo_login', 'register', 'register2', 'reminder', 'activate', 'help', '.xml'))))
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Kindred

April 11, 2006, 10:02:08 AM #1 Last Edit: October 04, 2006, 11:28:25 AM by Kindred
Instructions for v3.19a of the Bridge:  (for use with SMF 1.0.x and SMF 1.1RC1 or prior)
For SMF1.1 RC2, please use the bridge v1.1.5 and see the instructions higher in this thread.



=================================================================================================
JOOMLA 1.0.x and Mambo 4.5.3 UPDATE

Joomla and Mambo have added a sessioncookiename...  this will prevent you from using the bridge and logging into both joomla and SMF.
Thanks to Elephants Gerald for figuring this out...
If you applied the original HACK from Elephants Gerald, you will want to add the line back into joomla.php and do the following code change from Orstio in MOS_SMF.php instead.

In MOS_SMF.php, we need to end the old Joomla session.  Because the name of the session cookie changed in Joomla, we need to change the code a bit:

Find (for login and logout functions...):

setcookie ("sessioncookie","",-3600, "/" );

Replace with:

    $sessionCookieName = md5( 'site'.$GLOBALS['mosConfig_live_site'] );
setcookie ($sessionCookieName,"",-3600, "/" );


==================================================================================================
JOOMLA 1.0.8, 1.0.9, 1.0.10 and 1.0.11 UPDATE

ElephantsGerald, Predator and Orstio have come up with a a fix for version 3.19a of the bridge to allow it to continue working/login/logout with Joomla 1.0.8, 1.0.9, 1.0.10 and 1.0.11.

The file you need to update is: /forum/Sources/MOS_SMF.php (where 'forum' is the directory you've installed SMF to).

Find the first instance of the following line (somewhere aound line 320):

$sessionCookieName = md5( 'site'.$GLOBALS['mosConfig_live_site'] );
setcookie ($sessionCookieName,"",-3600, "/" );

NOTE: If you HAVE NOT already applied the above fix - you may need to look for (and change) the original version of the above code, which looked like this:
setcookie ("sessioncookie","",-3600,"/");


Add the following code afterwards

// For Joomla 1.0.8 compatibility
global $_VERSION;

if (isset($_VERSION) && $_VERSION->DEV_LEVEL >= '8'){
$remCookieName = mosMainFrame::remCookieName_User();
//Joomla 1.0.9 compatibility
                        if ($_VERSION->DEV_LEVEL>='9')
$remCookieValue = mosMainFrame::remCookieValue_User( $username ) . mosMainFrame::remCookieValue_Pass( $passwd ) . $row['id'];
                        else
$remCookieValue = mosMainFrame::remCookieValue_User( $username ) . mosMainFrame::remCookieValue_Pass( $passwd );
setcookie( $remCookieName, $remCookieValue, $lifetime, '/' );
}



Now find the second instance of the following line (somewhere aound line 380):

$sessionCookieName = md5( 'site'.$GLOBALS['mosConfig_live_site'] );
setcookie ($sessionCookieName,"",-3600, "/" );


Add the following code after:
if (isset($_VERSION) && $_VERSION->DEV_LEVEL >= '8'){
         $lifetime = time() - 86400;
         $remCookieName = mosMainFrame::remCookieName_User();
         setcookie( $remCookieName, ' ', $lifetime, '/' );
}

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Kindred

April 11, 2006, 11:49:30 AM #2 Last Edit: April 11, 2006, 12:03:02 PM by Kindred
Attached to this message are versions of the modules & bots that will work with v3.19a of the bridge.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Kindred

ADDITIONAL FUNCTIONS:




REDIRECT USERS FROM ACCESSING THE FORUM DIRECT URL

Inserting the code below into smf's index.php will redirect any users who access the forum URL directly into the joomla/mambo wrapped forum URL.
Orstio made the original hack and exrace modified it...


// Redirect users who try to access /forum directly
if (strpos($_SERVER['QUERY_STRING'], 'dlattach') === false && strpos($_SERVER['QUERY_STRING'], 'verificationcode') === false)
{
        if(!defined('_VALID_MOS')){ header("Location: /index.php?option=com_smf&Itemid=yourItemidNum&".$_SERVER['QUERY_STRING']);}}
}





MULTIPLE FORUMS!

GooseMoose has come up with another amazing hack.
This one allows you to run multiple forums (with completely separate message boards) sharing the same mambo/Joomla login. In other words, access to the site gives you access to all the separate forums.
CODE HACK AND DISCUSSION




SEARCH SMF, COPPERMINE and MAMBO/JOOMLA

To add a search function of SMF (and Coppermine) to your mambo/joomla search box, check out
THIS thread by bmwheaven
(This is different from the searchbot!)




ADD COPPERMINE LINK TO THE USER DATA DISPLAYED IN POSTS

to add the coppermine link to your user's posts (or anywhere else) and still open it
wrapped in mambo/joomla, Goosemoose has come up with the following modification:

First, insert the following code before the words "// auto height control" in wrapper.php in your wrapper components folder.

// pass all except Mambo specific parameters to the wrapper
    $allparams = '?';
             
    if (isset( $_GET['option'] ))
      $workarray = $_GET;
    if (isset( $_POST['option'] ))
      $workarray = $_POST;
             
    reset($workarray);

    while (list($key, $val) = each($workarray)) {
    if (($key != 'option') && ($key != 'Itemid'))
        $allparams = $allparams . $key . '=' . $val . '&';
    }
    $row->url = $row->url . $allparams;


Now open your display.template.php in your SMF theme and add the following code after where you want the gallery link to occur, I placed mine below the personal text which you can find by searching for:
// Show their personal text?


// Add for personal gallery
      echo '
', '<a href="' . $mosConfig_live_site . 'index.php?option=com_wrapper&Itemid=66&cat=', $message['member']['id']+10000, '"/><img border="0" src="' . $settings['images_url'] . '/gallery.gif" width="75" height="35" alt="" /></a><br />';


and finally, the code to make coppermine's wrapped page return to the top when you click on a link.
In mambo/joomla's file, wrapper.html.php, insert the following twice into the function iFrameHeight:
parent.scrollTo(0,0);

so your function looks like this:

function iFrameHeight() {
var h = 0;
if ( !document.all ) {
h = document.getElementById('blockrandom').contentDocument.height;
document.getElementById('blockrandom').style.height = h + 60 + 'px';
parent.scrollTo(0,0);
} else if( document.all ) {
h = document.frames('blockrandom').document.body.scrollHeight;
document.all.blockrandom.style.height = h + 20 + 'px';
parent.scrollTo(0,0);
}
}


How this is going to work (this is for the info of those who want to use this elsewhere):
Now anytime you call a wrapper from smf or anywhere else anything that you add to the end of the link with &putparamatershere will get added on to the actual wrapped page. For example if you want to link to a user gallery the address is usually http://www.yoursite.com/coppermine/index.php?cat=15031 but your coppermine wrapper is actually something like http://www.yoursite.com/index.php?option=com_wrapper&Itemid=66, and it wraps http://www.yoursite.com/coppermine/index.php. Now that we have edited wrapper.php if you call the wrapped item by saying http://www.yoursite.com/index.php?option=com_wrapper&Itemid=66&cat=10001 the &cat=10001 will become ?cat=10001 and get appended to the http://www.yoursite.com/coppermine/index.php and become a link to that users gallery, http://www.yoursite.com/coppermine/index.php?cat=10001.




FIXING LINKS IN SMF MESSAGES FROM PRE-BRIDGED FORUMS

(thanks to Goosemoose for this)
If you were running a forum prior to bridging it with mambo/joomla, there will be links in
messages that point to the unbridged forum location. You can change these by going
into phpMyAdmin and running a simple SQL command on the smf_messages table.

The format is:


UPDATE smf_messages SET `body` = replace(`body`,"http://www.yoursite.com/forum/index.php?","http://www.yoursite.com/mambo/index.php?option=com_smf&Itemid=##&")


where smf_messages is your actual table (change the smf_ if you are using a different
prefix, obviously)
where http://www.yoursite.com/forum/index.php is the actual URL of your previous
(unbridged) SMF index.php.
where http://www.yoursite.com/mambo/index.php is the actual location of your MAMBO/JOOMLA
index.php
where Itemid=## is your actual SMF component Itemid

so, an example, (as provided by Goosemoose)


UPDATE rfc_messages SET `body` = replace(`body`,"http://www.goosemoose.com/rfc/index.php?topic=","http://www.goosemoose.com/index.php?option=com_smf&Itemid=70&topic=")


He used rfc_ as his SMF database table prefix and rfc was the SMF directory.
note that his mambo is installed in the root directory...




DYNAMIC PAGE TITLES

From Goosemoose, if you add this line into the code that you added in your mambo/joomla template file (just after the switch to the mosConfig_db for the v3.19a bridge), it will add dynamic page titles for your forum pages.


if(!empty($context['page_title']))
     $mainframe->setPageTitle($context['page_title']);





DYNAMIC PAGE TITLES

Dynamic page titles in your wrapped forum, and your Mambo content items, can also (theoretically) be accomplished like this:
(If your mambo/joomla template does not have a title tag, that is because it is being called in the mos_header code... and this hack may not work)

1)  For the v3.19a bridge Move the bridge include code above the <title> tag in your Mambo template. (Just cut and paste).

2)  Change the code from <title> to </title> (inclusive) to this:

<title><?php 

  
if ($_REQUEST['id']) {
  
// load the content item name and category
    
$database->setQuery"SELECT title, catid FROM #__content WHERE id=$id);
    
$row null;
    
$database->loadObject$row );
  }

echo 
$context['page_title'] ? $context['page_title'] : ($row->title $row->title $mosConfig_site_name); ?>
</title>






PATHWAY HACK for 3.19a

This hack from RJPrince should work with version 3.19a of the bridge....

Adding this code to components/com_smf/smf.php just above the function declaration for function ob_mambofix($buffer) seems to work to add the SMF location into the "pathway" line-item in the mambo template:


/************************Below Added to use Mambo Pathway *********************/
global $context, $mainframe;

// Get last item.
end($context['linktree']);
$last_link_key = key($context['linktree']);

foreach ($context['linktree'] as $link_num => $tree)
{
if ($link_num > 0) { // Don't show first linktree element, because forum menu item will already be in Mambo Pathway.
//If there is a url and this is not the last link item, show as a link. Otherwise just show.
$mainframe->appendPathWay(((isset($tree['url']) && ($last_link_key != $link_num)) ?
ob_mambofix('<a href="' . $tree['url'] . '" class="pathway">') . $tree['name'] . '</a>' : $tree['name']) . ' ');
}
}
/************************Above Added to use Mambo Pathway *********************/





Audible alert on new PM
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: