Joomla, SMF, Bridged, with OpenSEF

Started by SlammedDime, March 01, 2007, 09:33:06 PM

Previous topic - Next topic

SlammedDime

I know this has been discussed before, as I've read over numerous posts, however this is a different sort of question, mainly aimed at Kindred and Orstio, but anyone as well that may have some input.

Over the last few days, I've been extensively working on a sef_ext.php file for Orstio's Bridge to work with OpenSEF 2.0 RC5 SP2 and I think I pretty much have everything hammered out and I have a working version on a local test site.  Is there anything special about SMF that I may not know about that would cause some issues that I haven't found yet?

And before anyone asks, I don't feel comfortable distributing this, at least not yet, because it is not a simple plug and play operation, as I have hardcoded quite a few things into the file that wouldn't work on other's installations, and its an english only version, nor do I have time to support it.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

Orstio

It should be possible to create a sef_ext.php for the bridge.  Things you may need to watch out for are the use of semi-colons in some URLs instead of ampersands, and SMF's use of non-variable values in the query string.

I think that most of that should be parsed out in bridge 1.1.7 already, but it might be unpredictable with a third party SEF engine.

Testing should be fairly simple.  The SMF admin panel is full of links that can be problematic for converting to Joomla URLs.  Try out a few buttons and links there.

SlammedDime

Quote from: Orstio on March 01, 2007, 09:39:54 PM
It should be possible to create a sef_ext.php for the bridge.  Things you may need to watch out for are the use of semi-colons in some URLs instead of ampersands, and SMF's use of non-variable values in the query string.

I think that most of that should be parsed out in bridge 1.1.7 already, but it might be unpredictable with a third party SEF engine.

Testing should be fairly simple.  The SMF admin panel is full of links that can be problematic for converting to Joomla URLs.  Try out a few buttons and links there.
Yea, I discovered that with the admin panel when I clicked links that needed the sesc value that I forgot to throw into the sef_ext.php file.

The other thing that was challenging was getting a list of all of the subactions used by SMF.  I think I got them all, but if I missed one, it will show when someone does find it.  I just did a search through all of the SMF files looking for "sa=", and used some regular expressions with some replacement expressions to narrow down all of the subactions.  There wouldn't happen to be a complete list of this somewhere around these boards, would there, just in case I did miss one?
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

SlammedDime

Well, I went live with it after a little more testing.  QuickMod gave me a few issues when trying to parse the url, but I got that worked out, and creating new topics gave me an issue as well.  I parsed the board value incorrectly, but that is fixed too.  Everything seems to be workin okay.  If anyone wants to check it out, feel free: http://www.airridetalk.com/forum
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

Orstio

Nice work.  :)

You didn't have to make any mods to the bridge?  If you did, I can look at including them in the next release.

c2h5oh

If you decide to distribute it I'd be interested :-) I'm pretty sure I can handle the hardcoded parts and promise not to bug you with support requests :P
"The day Microsoft makes something that does not suck is probably the day they start making vacuum cleaners"

SlammedDime

#6
I don't believe I made any changes to the bridge, not that I can think of anyway.  I've made changes to the bridge to make it flow with my site a little better, like getting ride of the collapse/expand code for the header that doesn't exist on my smf template, but I believe thats all I've really messed with it. 

I did have to modify a core Joomla file, frontend.php.  It made the robots metatag always "index, follow", but with SMF wrapped, that isn't a good thing, since pages will be indexed that shouldn't be, so I put a conditional in my template similar to what is used in the smf code so that the robots tag would print properly based on the page (index,follow for all joomla pages as it normally would, but with the same functionality that smf would have unwrapped or standalone).  And I had to comment out a line in sef.php in the OpenSEF component directory so that it would allow for com_smf in the parsing.

As for releasing it out, I may consider it in a few weeks when I have more time to tweak it and see how it performs on my live site.  I will try to clean up the code a bit as well.  I'll also install a stock version off all of the components and outline any changes made to see what is needed and what isn't.  I've tweaked and turned so many things on my install that I"m really not sure 100% of what I've modified and what I haven't.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

SlammedDime

I'm very happy to report that on a clean install of Joomla 1.0.12, SMF 1.1.2, Bridge 1.1.7, and OpenSEF 2.0.0-RC5_SP2, my sef_ext.php file works in wrapped, and unwrapped mode.  Now I just need to clean up the code in the file and I'll be set to release it to those who want to give it a shot.  No files needed to be changed if running unwrapped, but when running wrapped, some Joomla! core file changes are needed to adjust the robots meta tag as I mentioned before, but otherwise, no files need to be modified to make it work.  I have found a few very minor bugs that I'm going to work through next week, so we'll see how it goes. :)
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

Benson

That sounds very promising - thanks for your effort! I will definitely check your sef_ext.php as soon as you release it! :)

cheers,
Benson

an52

This is to report a cosmetic bug. I have OpenSEF 2.0.0-RC5_SP2 and SMF Bridge 1.1.7

When I try to edit the Forum menu item, Joomla sees it as:
Component: OpenSEF
URL: index.php?option=com_smf&Itemid=41


SlammedDime

Quote from: an52 on March 10, 2007, 10:30:51 PM
This is to report a cosmetic bug. I have OpenSEF 2.0.0-RC5_SP2 and SMF Bridge 1.1.7

When I try to edit the Forum menu item, Joomla sees it as:
Component: OpenSEF
URL: index.php?option=com_smf&Itemid=41


Unless I'm missing something, this thread has nothing to do with what you're talking about.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

SlammedDime

Ok, I have made this file more user friendly, and setup a configuration function inside the class in the file.  I'm pretty sure I have 99% of the bugs worked out of it.  I wasn't able to find any, but who knows.

I'm looking for a few testers who have anything from PHP 4 and 5 to MySQL 4 and 5 and wrapped and unwrapped forums.

Just to clarify what this was created on for those interested: Joomla! 1.0.12, SMF 1.1.2, Bridge 1.1.7, OpenSEF 2.0.0RC5-SP2 however it should work on any Joomla! 1.0.x install, and any SMF 1.1.x install.

I have tested this on PHP5, with MySQL 4.1.22, with the above software versions, running in wrapped, and unwrapped mode on a virgin install of the above softwares.  While this should work regardless of mods that you have installed (if custom mods required addition of 'actions' in SMF's index.php file, see the readme in the extension), I cannot guarantee that it will work on non-modified softwares.

So, as I stated, I'm simply looking for a few testers for now, and may release it later this week depending on the feedback I get.  Simply shoot me an email at [email protected] with 'SEF Tester' in the subject, and in the body, please include your Joomla!, SMF, PHP and SQL versions, and if you are running wrapped or unwrapped and I'll send you back an email with all the info and the file.  I DO NOT recommend that anyone test this on any production site.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

SlammedDime

#12
Quote from: Orstio on March 02, 2007, 06:58:01 AM
Nice work.  :)

You didn't have to make any mods to the bridge?  If you did, I can look at including them in the next release.
Ok, after many strenuous hours figuring this stuff out, and playing around, I've finally got a 99% functional version.  Possibly 100%.  Because of the javascript in the smf templates and the way it was written and changed by the bridge file in ob_mambofix(), it took a lil extra effort and an addition to the bridge file.

At the end of ob_mambofix(), I added the following lines right before the return statement:
// Fix Javascript if sef_ext.php file is present (well, the one from AirRideTalk anyway)
if(class_exists("sef_smf"))
sef_fix($buffer);

return $buffer;


And then right after the function, although it could go anywhere in the file, I added this sef_fix() function...
function sef_fix(&$input) {
global $db_prefix, $mosConfig_db, $db_name, $Itemid, $mosConfig_live_site;

// Declare our SEF class (useful below)
$sef_smf = new sef_smf;

// If we're not enabled, we don't want to do this stuff
if(!$sef_smf->config['enabled'])
return;

$myurl = $mosConfig_live_site . '/' . basename($_SERVER['PHP_SELF']) . '?option=com_smf&Itemid=' . $Itemid . '&';

$sef_url = sefReltoAbs('index.php?option=com_smf&Itemid=' . $Itemid . '&');

// First the scripturl variable (needs to be in non-sef format, or joomla style sef, and non-sef is easier to code :) )
$input = preg_replace('/var smf_scripturl =.*/', 'var smf_scripturl = "'. un_htmlspecialchars(substr($myurl, 0, -5)) . '";', $input);

// Sorta fix quick mod for inline editing of thread titles...
$quickmod_start = 'cur_subject_div, \'<a href="' . $sef_url . '/-\\\'   cur_topic_id   \\\'.0';
$quickmod_end = 'cur_subject_div, \'<a href="' . $sef_url . 'board/topic' . $sef_smf->config['space'] . '\' + cur_topic_id + \'.0';
$input = str_replace($quickmod_start, $quickmod_end, $input);

// Next some of the javascript for stats...
$stats_expand_replace = $sef_url . 'stats/expand/';
$stats_collapse_replace = $sef_url . 'stats/collapse/';
$input = str_replace('smf_scripturl + "/action,stats;expand=', '"' . $stats_expand_replace, $input);
$input = str_replace('smf_scripturl + "/action,stats;collapse=', '"' . $stats_collapse_replace, $input);

// And now the "Jump To:" box (Why can't this stuff be easy??)
if((preg_match_all('|"/(board,([0-9]*.)0)"|', $input, $jumptoboards) > 0)) {
$form_stuff = 'smf_scripturl + this.options[this.selectedIndex].value.substr(smf_scripturl';
$form_stuff_replace = '\''. $sef_url. '\' + this.options[this.selectedIndex].value.substr(\''. $sef_url. '\'';
$input = str_replace($form_stuff, $form_stuff_replace, $input);
$input = str_replace('window.location.href = \'' . $myurl . '\'', 'window.location.href = \'' . $sef_url . '\'', $input);

// Now run through all of the found entries
// If we have simple urls, this is easy
if($sef_smf->config['simple']) {
for($i=0; $i <= count($jumptoboards);  $i++)
$input = str_replace($jumptoboards[0][$i], '"' . str_replace(',', $sef_smf->config['space'],$jumptoboards[1][$i]) . '/"' , $input);
}
else {
$boardArray = array();
mysql_select_db($db_name);
$query = "SELECT `ID_BOARD`, `name` FROM {$db_prefix}boards";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result))
$boardArray = array_merge($boardArray,array( $row['ID_BOARD']."." => $row['name'] ));
mysql_select_db($mosConfig_db);

for($i=0; $i < count($jumptoboards[0]);  $i++)
$input = str_replace($jumptoboards[0][$i], '"' . $sef_smf->encode($boardArray[$jumptoboards[2][$i]]) . '"', $input);
}
}

// This fixes some code in the Post template for preview, and any other javascript
// that relies on it.
$input = str_replace('"/action,', '"?action=', $input);

return;
}


It pretty much just runs through and fixes all of the javascript in the template being output to be sef friendly with my extension file and only adds one db query (to get board names for the jump to, only if a jump to is present on a page).  It may not be necessary for you to include this in future releases, as I could simply include it with the install instructions, but thats up to you.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

Aravot

AirRideTalk, I can test it on the following setup

Joomla 1.0.12
SMF 1.1.2
Orstio's Bridge 1.1.7 +SVN
OpenSEF 2 RC5 SP2
Database Version: 5.0.24a-standard-log
PHP Version: 4.4.4
Web Server: Apache/2.0.54

SlammedDime

Quote from: Aravot on March 18, 2007, 02:39:15 PM
AirRideTalk, I can test it on the following setup

Joomla 1.0.12
SMF 1.1.2
Orstio's Bridge 1.1.7 +SVN
OpenSEF 2 RC5 SP2
Database Version: 5.0.24a-standard-log
PHP Version: 4.4.4
Web Server: Apache/2.0.54
I'm gonna do a tad more self testing tomorrow, and if I like what I see, and my Bridge add-on function doesn't mess anything else up, I'll make a new thread here releasing it.  Quite a few people have expressed interest in having this, so I figure, why not. :)
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

RebeldeLatino

#15
HI all, sorry for my "machine english" i not talk english as native language.

I'm have installed the "SEF Extension for SMF/Joomla! Bridge and OpenSEF 1.4.5":

Joomla! 1.0.11 Stable
OpenSEF 2.0.0-RC5_SP2
SMF Bridge (Official) 1.1.7
SMF 1.1 RC3

Bug: When i'm activate the "sef_ext" (forum alias in OpenSEF) the "Quote Button" and Edit in line they are broken

Advertisement: