SMF_header include and smf.php multiple?

Started by cferd, March 29, 2007, 10:34:01 AM

Previous topic - Next topic

cferd

Using Joomla 1.0.12, SMF 2.2, and Bridge 1.17.

While trying to streamline my site, I noticed that much of what's in SMF_header include is also in smf.php. I removed a lot of the code from the mambot and all seems fine. Index.template.php is already conditional [if (!defined('_VALID_MOS'))] to keep that file from duplicating the header while wrapped. Could there be a problem I'm not seeing yet? Or is there more I can safely remove? Thanks

This is what SMF_header_include.php currently looks like, minus the comments:
// no direct access
if (!defined('_VALID_MOS'))
die('Direct Access to this location is not allowed.');

global $db_name;

$_MAMBOTS->registerFunction( 'onAfterStart', 'SMF_header_include' );

function SMF_header_include( ) {

global $mainframe, $database, $scripturl, $db_connection, $db_passwd, $maintenance, $db_server, $options;
global $db_name, $db_user, $db_prefix, $db_persist, $db_error_send, $db_last_error, $sc, $context, $modSettings;
global $settings, $mosConfig_db, $sourcedir, $mosConfig_live_site, $mosConfig_sef, $mosConfig_dbprefix;

//Gallery2 bridge+SEF compatibility (Damage control)
if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'com_gallery2' && $mosConfig_sef == 1)
$_SERVER['QUERY_STRING'] = strtr($_SERVER['QUERY_STRING'],array('?'=>'','&'=>'/','&'=>'/','='=>','));

if (!defined('SMF') && $_REQUEST['option'] != 'com_smf'){
// Get the configuration. This will tell Mambo where SMF is, and some integration settings
$database->setQuery("
SELECT `variable`, `value1`
FROM #__smf_config
");
$variables = $database->loadAssocList();

foreach ($variables as $variable){
$variable_name = $variable['variable'];
$$variable_name = $variable['value1'];
}

$item_result = mysql_query("
SELECT id
FROM {$mosConfig_dbprefix}menu
WHERE link = 'index.php?option=com_smf'");

if ($item_result !== false)
list($menu_item) = mysql_fetch_row($item_result);
else
$menu_item = 1;

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

$requestSave = $_REQUEST;
require_once ($smf_path."/SSI.php");
$_REQUEST = $requestSave;

if ($smf_css == 'true'){
$mainframe->addCustomHeadTag( '<link rel="stylesheet" type="text/css" href="'. $settings['theme_url']. '/style.css?fin11" />' );
$mainframe->addCustomHeadTag( '<link rel="stylesheet" type="text/css" href="'. $settings['default_theme_url']. '/print.css?fin11" media="print" />' );
}

}

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

mysql_select_db($mosConfig_db);

return true;
}


Orstio

Since the SMF_header_include bot functions only on every page that is not the bridge, the code that is duplicated still needs to be there.

cferd

Sorry, I'm not sure I follow, maybe because under the settings I use (bridge registration and SMF wrapped), every page is the bridge...I think.

So far, the codes for Topics, RSS, and shrinkheader have been taken care of by either smf.php when wrapped, or index.template.php when not.

Orstio

Go to your Joomla homepage.

That is where the SMF_header_include bot is working.

Go to your bridge component (wrapped/unwrapped forum).  That is where smf.php is working.  SMF_Header_include is not.

cferd

Ok. So I guess I'm ok with the bot modified as aforementioned, since there's no need for the shrinkheader, topic, rss codes in the frontpage or any other page not related to the forum.

Advertisement: