Joomla Forum

Joomla Hacks => Mambo-SMF 1.2.x => Topic started by: aravot on March 30, 2005, 04:57:08 PM



Title: SMF database incorrect prefix
Post by: aravot on March 30, 2005, 04:57:08 PM
Mambo-SMF Integration 1.2b it seems that a different prefix other than smf_ cannot be used.

(http://webpages.charter.net/osipof/mambo/mambosmfprefix.JPG)


Title: Re: SMF database incorrect prefix
Post by: Editor (cowboy) on March 30, 2005, 06:37:00 PM
SMFMamboMod is tested w/ 1.0.2 and 1.0.3.

Your smf version is 1.1beta.
I don't know if MamboSMFMod is even compatible with that version.

So I cannot help you on this particular issue until I try SMF 1.1 beta.


Title: Re: SMF database incorrect prefix
Post by: aravot on March 30, 2005, 10:05:00 PM
The problem is not the SMF1.1 but the database prefix I tried it with SMF 1.0.3 same result, your mod requires the SMF database prefix to be "smf_" I use different prefix for my SMF database example: 'forum_'


Title: Re: SMF database incorrect prefix
Post by: Goosemoose on March 31, 2005, 12:26:12 AM
It works for me and I use rfc_ , there must be something else going on.


Title: Re: SMF database incorrect prefix
Post by: aravot on March 31, 2005, 01:42:57 PM
I double checked everything seems OK.

I have both Mambo and SMF installed in a subdomain, DIR structure

mysite.com
------------->mambo (subdomain)
------------------------>mambo
------------------------>smf

I don't know but maybe cause I have two installation of SMF one in the main domain using smf_ prefix and one in the subdamin for testing purpose using smf103_

The website for testing (http://www.mambo.peterosipof.com/mambo/)

username: test
password: pastest

admin if you want PM me and I'll send you database/website login info.


Title: Re: SMF database incorrect prefix
Post by: firewired on April 01, 2005, 08:48:04 PM
I'm having the same problem. Mambo seems blind to the yabbse_ prefix of my existing board. I'm on SMF 1.02 and Integration 1.3, and aside from that issue, everything else installed properly.

What exactly are the consequences of the database prefix not being recognized the bridge?
Website: PinoyDVD (http://pinoydvd.com)


Title: Re: SMF database incorrect prefix
Post by: tFF on April 06, 2005, 04:13:17 PM
Has anybody of you tried to get inside of the code to solve the prob?
look at /administrator/components/com_smf/
functions.smf.php
Code:
function isSMFInstalled()
{
global $database, $mosConfig_absolute_path, $mosConfig_db, $smf_prefix;
include_once( $mosConfig_absolute_path . '/administrator/components/com_smf/config.smf.php' );
$result = mysql_list_tables($mosConfig_db);
while ($row = mysql_fetch_row($result)) {
        if (substr($row[0],0,4) == $smf_prefix) {
      return true;
      }
    }
    return false;
}

And what do you think of it? Look here:
if (substr($row[0],0,4) == $smf_prefix) {

It's written here that prefix should be no longer than 4 symbols.
What's that? That's a glitch and a cosiquence of author is not trying to cover all the angles.

Here's a 5 minute hack for me i've made. It's not universal and doesn't prevent user from entering incorrect data (simply change the above mentioned line to this one shown below):
Code:
if ((strpos($row[0],$smf_prefix)!==false)&&(strpos($row[0],$smf_prefix)==0)) {

So, finally u should get this:
Code:
function isSMFInstalled()
{
global $database, $mosConfig_absolute_path, $mosConfig_db, $smf_prefix;
include_once( $mosConfig_absolute_path . '/administrator/components/com_smf/config.smf.php' );
$result = mysql_list_tables($mosConfig_db);
while ($row = mysql_fetch_row($result)) {
if ((strpos($row[0],$smf_prefix)!==false)&&(strpos($row[0],$smf_prefix)==0)) {
      return true;
      }
    }
    return false;
}

What has been changed:
1. here we check whether the prefix could be found in table's name
2. then if it is found we check whether the found string is at the very beginning of the name

Some side-effects here:
suppose i have prefix "msu_smf_"
so if i enter...
..."msu_smf_" - match => correct prefix
..."msu_smf" - match => component thinks the prefix is correct
..."msu_sdf" - no match => incorrect prefix

As u may see the hack doesn't prevent admin from making easy mistakes.
But it works. The purpose was to make one-line hack without any extra sub-routines.


Title: Re: SMF database incorrect prefix
Post by: Editor (cowboy) on April 06, 2005, 04:26:03 PM
Nice work aravot. You actually fixed it  :D.

I will have this added on the final release.


Title: Re: SMF database incorrect prefix
Post by: tFF on April 06, 2005, 04:31:55 PM
Whom are you talking to? Aravot or me (tFF)?
What fix do you mean aravot has made?


Title: Re: SMF database incorrect prefix
Post by: Editor (cowboy) on April 06, 2005, 04:36:29 PM
Ooopsss... haha

Nice work tFF. That's actually a fix  ;D.
I will have this added on the final release.


Title: Re: SMF database incorrect prefix
Post by: aravot on April 06, 2005, 04:59:38 PM
Thanks for the complement but it was tFF


Joomla Forum | Powered by SMF 1.1 RC1.
© 2001-2005, Lewis Media. All Rights Reserved.
Joomla Bridge by JoomlaHacks.com