Error with synch Joomla 1.0.9 with SMF bridge

Started by matjazz, August 12, 2006, 04:06:02 PM

Previous topic - Next topic

matjazz

I get on all 3 options for sync this error

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/matjaz/public_html/forumcek/Sources/Subs.php on line 288

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/matjaz/public_html/forumcek/Sources/Load.php on line 40

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/matjaz/public_html/forumcek/Sources/Load.php on line 42

Notice: Undefined index: time_format in /home/matjaz/public_html/forumcek/Sources/Load.php on line 176

Notice: Undefined index: theme_guests in /home/matjaz/public_html/forumcek/Sources/Load.php on line 657

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/matjaz/public_html/forumcek/Sources/Subs.php on line 288

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/matjaz/public_html/forumcek/Sources/Load.php on line 683

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/matjaz/public_html/forumcek/Sources/Load.php on line 693

Notice: Undefined index: theme_url in /home/matjaz/public_html/forumcek/Sources/Load.php on line 700

Notice: Undefined index: images_url in /home/matjaz/public_html/forumcek/Sources/Load.php on line 701

Notice: Undefined index: theme_dir in /home/matjaz/public_html/forumcek/Sources/Load.php on line 702

Notice: Undefined index: smiley_sets_known in /home/matjaz/public_html/forumcek/Sources/Load.php on line 721

Notice: Undefined index: smiley_sets_default in /home/matjaz/public_html/forumcek/Sources/Load.php on line 721

Warning: array_unshift(): The first argument should be an array in /home/matjaz/public_html/forumcek/Sources/Load.php on line 762

Notice: Undefined index: theme_dir in /home/matjaz/public_html/forumcek/Sources/Load.php on line 822

Notice: Undefined index: default_theme_dir in /home/matjaz/public_html/forumcek/Sources/Load.php on line 824

Notice: Undefined index: default_theme_dir in /home/matjaz/public_html/forumcek/Sources/Load.php on line 831
index


I put sources on 777
and i can see my user groups...

Any idea?


matjazz


Orstio

Your problem begins in the topic from which you downloaded bridge 1.1.5.  Please read it again, and pay particular attention to the big bold text.

matjazz

I am using joomla 1.0.9 and SMF 1.0.7

So, which version is the right one?


matjazz

It is working perfectly now  8)

tnx man

I download files from joomla community and I just installed before, now I read your text  :D

Orstio

QuoteI download files from joomla community and I just installed before, now I read your text 

This bridge is not available for download anywhere else.  If it is, I would like to know about it, because that is a violation of the SMF license.

matjazz

Here is the list of all smf downloads on joomla portal...

http://extensions.joomla.org/component/option,com_mtree/task,search/Itemid,35/searchword,smf/cat_id,0/

One more question, how can I bridge connection with Community Builder?

Orstio

I'm well aware of the entry on the Joomla extensions site.

The bridge files are not available for download there.  The extensions site links to the topic here at SMF, so that people actually need to see the first post in order to download the bridge. 

QuoteOne more question, how can I bridge connection with Community Builder?

You've already done that....

matjazz

#10
yes, but I can't login to the CB component using SMF bridge login

http://www.simplemachines.org/community/index.php?topic=81152.msg541423#msg541423 Here is file missing for module which is discribet here: http://www.simplemachines.org/community/index.php?topic=103775.msg671062

Iam using module login who comes with smf and mambo bridge package.

In the SMF configuration is written: Also register into Community Builder? (You must have Community Builder already installed, and be using Bridge Registration)

It seems that this bidge registration it isn't in the package which comes with smf and mambo bridge. I try to find and I can't. Please help!



Orstio

#11
First, let's make sure not to confuse login and registration.  They are two very different things.  The checkbox for "Also register in CB" has nothing at all to do with logging in.  That has to do with registration, not login.

What registration type did you choose?

QuoteIt seems that this bidge registration it isn't in the package which comes with smf and mambo bridge. I try to find and I can't. Please help!

Your bridge registration is here, and it's fine:

http://www.eumoto.net/index.php?option=com_smf_registration&task=register


matjazz

Tnx for info..

The problem is when you try to logon to the site with SMF bridge logon module it only logon you to the SMF and JOOMLA not to CB. You must logon again in diferent field to do that.

Orstio

QuoteThe problem is when you try to logon to the site with SMF bridge logon module it only logon you to the SMF and JOOMLA not to CB. You must logon again in diferent field to do that.

Huh?

If it logs you into Joomla, you are logged into CB.  CB does not have its own session/cookie system -- it uses Joomla's.

matjazz

no wait I check again and It dosen't even logon to joomla

I can't see me in admin panel...

I am logged just in to the SMF when I am logging in from SMF module. Why dosen't logon me also in joomla?


matjazz

Tnx for all answers, it is working well now.

Countinue great work  ;D

matjazz

I was to qiuck, when i log out from joomla I am still log on in forum...

matjazz

Quote from: Orstio on August 13, 2006, 08:25:47 AM
http://www.simplemachines.org/community/index.php?topic=81152.msg541337#msg541337
<?php
// MOS_SMF.php
// by Theodore Hildebrandt
// version 3.19
// This is all the scripting that handles the logging in and out of both Mambo and SMF together


global $txt$db_prefix$scripturl$user_info$database;
global $cookiename$maintenance$ID_MEMBER$db_name;
global $modSettings$scripturl$context$sc$sourcedir;
    global 
$acl$mosConfig_live_site$mosConfig_db$mosConfig_dbprefix;


if (!
defined('SMF')){
  
//Change this next line to the absolute path if you are using SMF outside of Mambo (stand alone)
  //I know it looks right, but not if you're using a stand-alone forum
  
require ("administrator/components/com_smf/config.smf.php");
  require (
$smf_path."/SSI.php");
}


// Uncomment the following lines if you wish to use SMF outside of Mambo, but you still want the single login
// You will, of course, have to set the paths and database/table names according to your own installation
// if (!defined('_VALID_MOS')){
//  define( '_VALID_MOS', 1 );
//  include_once( '/home/.../globals.php' );
//  require_once( '/home/.../configuration.php' );
//  require ("/home/.../includes/mambo.php");
//  }

function MOS_Login($username=null,$passwd=null)
{
    global 
$txt$db_prefix$scripturl$user_info$database;
global $cookiename$maintenance$ID_MEMBER$db_name;
global $modSettings$scripturl$context$sc$sourcedir;
    global 
$acl$mosConfig_live_site$mosConfig_db$mosConfig_dbprefix;

   
// Load cookie authentication stuff.
require_once($sourcedir '/Subs-Auth.php');

mysql_select_db($mosConfig_db);

$sql=mysql_query ("SELECT params FROM {$mosConfig_dbprefix}modules WHERE module='mod_smf_login'");
    
$result mysql_fetch_array($sql);
$paramlist $result[0];
    
$paramslogin mosParseParams($paramlist);
    
$returncheck $paramslogin->login;

    if (empty(
$_SESSION['return']) && empty($returncheck))
  $returncheck="1";

switch ($returncheck){
  case "0";
  $_SESSION['login_url'] = $GLOBALS['mosConfig_live_site'];
  break;
  
  case "1";
  $_SESSION['login_url'] = $scripturl;
  break;
  
  case "2";
  $_SESSION['login_url'] = $_SESSION['return'];
  break;
  
  case "";
  $_SESSION['login_url'] = $GLOBALS['mosConfig_live_site'];
  break;

 }

mysql_select_db($db_name);
 
// Double check the cookie...
if (isset($_GET['sa']) && $_GET['sa'] == 'check')
{
// Strike!  You're outta there!
if ($_GET['id'] != $ID_MEMBER)
fatal_lang_error('login_cookie_error'false);

// Some whitelisting for login_url...
if (empty($_SESSION['login_url']))
redirectexit();
else
{
// Best not to clutter the session data too much...
$temp $_SESSION['login_url'];
unset($_SESSION['login_url']);

redirectexit($tempfalse);
}
}

//Cookie stuff for Mambo, later
    $usercookie mosGetParam$_COOKIE'usercookie''' );
$sessioncookie mosGetParam$_COOKIE'sessioncookie''' );
if ($usercookie){
   $username $usercookie['username'];
   $passwd $usercookie['password'];
  }
// Are you guessing with a script that doesn't keep the session id?
spamProtection('login');

// Been guessing a lot, haven't we?
if (isset($_SESSION['failed_login']) && $_SESSION['failed_login'] >= $modSettings['failed_login_threshold'] * 3)
fatal_lang_error('login_threshold_fail');

// Set up the cookie length.  (if it's invlaid, just fall through and use the default.)
if (isset($_POST['cookieneverexp']) || (!empty($_POST['cookielength']) && $_POST['cookielength'] == -1))
$modSettings['cookieTime'] = 525600;// !!! 525600;
elseif (!empty($_POST['cookielength']) && ($_POST['cookielength'] >= || $_POST['cookielength'] <= 525600))
$modSettings['cookieTime'] = $_POST['cookielength'];

// Set things up incase an error occurs.
if (!empty($maintenance) || empty($modSettings['allow_guestAccess']))
$context['sub_template'] = 'kick_guest';

// Load the template stuff - wireless or normal.
if (WIRELESS)
$context['sub_template'] = WIRELESS_PROTOCOL '_login';
else
{
loadTemplate('Login');
$context['sub_template'] = 'login';
}
loadLanguage('Login');

// Set up the default/fallback stuff.
$context['default_username'] = &$_REQUEST['user'];
$context['default_password'] = '';
$context['never_expire'] = $modSettings['cookieTime'] == 525600;
$context['login_error'] = &$txt[106];
$context['page_title'] = $txt[34];

// You forgot to type your username, dummy!
if (!isset($_REQUEST['user']) || $_REQUEST['user'] == '')
{
$context['login_error'] = &$txt[37];
return;
}

// Hmm... maybe 'admin' will login with no password. Uhh... NO!
if (!isset($_REQUEST['passwrd']) || $_REQUEST['passwrd'] == '')
{
$context['login_error'] = &$txt[38];
return;
}

// No funky symbols either.
if (preg_match('~[<>&"\'=\\\]~'$_REQUEST['user']) != 0)
{
$context['login_error'] = &$txt[240];
return;
}

// Load the data up!
$user=$_REQUEST['user'];
mysql_select_db($db_name);

$request mysql_query("SELECT * FROM {$db_prefix}members WHERE memberName = '$user' LIMIT 1");
// Probably mistyped or their email, try it as an email address. (memberName first, though!)
if (mysql_num_rows($request) == 0)
{
$request mysql_query("SELECT * FROM {$db_prefix}members WHERE emailAddress = '$user' LIMIT 1");
// Let them try again, it didn't match anything...
if (mysql_num_rows($request) == 0)
{
$context['login_error'] = &$txt[40];
return;
}
}

// Figure out the password, and load the settings.
$user_settings mysql_fetch_assoc($request);
if ($passwd == "" || !isset($passwd)){$passwd md5($_REQUEST['passwrd']);} // this is for Mambo, later
$md5_passwrd md5_hmac($_REQUEST['passwrd'], strtolower($user_settings['memberName']));

// Check if the account is activated
if (empty($user_settings['is_activated']))
{
$context['login_error'] = $txt['activate_not_completed1'] . ' <a href="' $scripturl '?action=activate;sa=resend;u=' $user_settings['ID_MEMBER'] . '">' $txt['activate_not_completed2'] . '</a>';
log_error($txt['activate_not_completed1'] . ' - ' $user_settings['memberName'], false);
return;
}

// Old style encryption... now's the only time to fix it.
if ($user_settings['passwd'] == crypt($_REQUEST['passwrd'], substr($_REQUEST['passwrd'], 02)) || $user_settings['passwd'] == md5($_REQUEST['passwrd']))
{
updateMemberData($user_settings['ID_MEMBER'], array('passwd' => '\'' $md5_passwrd '\''));
$user_settings['passwd'] = $md5_passwrd;
}
// What about if the user has come from vBulletin or Invision?  Let's welcome them with open arms \o/.
elseif ($user_settings['passwordSalt'] != '' && ($user_settings['passwd'] == md5(md5($_REQUEST['passwrd']) . $user_settings['passwordSalt']) || $user_settings['passwd'] == md5(md5($user_settings['passwordSalt']) . md5($_REQUEST['passwrd']))))
{
// Get our new encryption in!
updateMemberData($user_settings['ID_MEMBER'], array('passwd' => '\'' $md5_passwrd '\'''passwordSalt' => '\'\''));
$user_settings['passwd'] = $md5_passwrd;
}
// Bad password!  Thought you could fool the database?!
elseif ($user_settings['passwd'] != $md5_passwrd)
{
// They've messed up again - keep a count to see if they need a hand.
if (isset($_SESSION['failed_login']))
$_SESSION['failed_login']++;
else
$_SESSION['failed_login'] = 1;

// Hmm... don't remember it, do you?  Here, try the password reminder ;).
if ($_SESSION['failed_login'] >= $modSettings['failed_login_threshold'])
redirectexit('action=reminder');
// We'll give you another chance...
else
{
$context['login_error'] = &$txt[39];
log_error($txt[39] . ' - ' $user_settings['memberName']);
return;
}
}

mysql_select_db($mosConfig_db);

// Let's see if the user already exists in Mambo
$mos_sql "SELECT username, block FROM {$mosConfig_dbprefix}users WHERE username='".$_REQUEST['user']."';";
    
$mos_result mysql_query($mos_sql);
    
$mos_array mysql_fetch_array($mos_result);
    
$mos_user $mos_array[0];

//if the user doesn't exist in Mambo, they've already been verified by SMF, so register them into Mambo as well
   if (!isset($mos_user)){
   $mos_write mysql_query"INSERT INTO ".$mosConfig_dbprefix."users (name,username,email,password,gid) VALUES ('".$_REQUEST['user']."','".$_REQUEST['user']."','".$user_settings['emailAddress']."','".$passwd."','18');");
   $mos_find_id mysql_query"SELECT `id` FROM {$mosConfig_dbprefix}users WHERE name='".$_REQUEST['user']."' LIMIT 1");
   $mos_id_array mysql_fetch_array($mos_find_id);
   $mos_id $mos_id_array[0];
   $mos_write mysql_query"INSERT INTO {$mosConfig_dbprefix}core_acl_aro ( `section_value` , `value` , `order_value` , `name` , `hidden` ) VALUES ('users', '".$mos_id."', '0', '".$_REQUEST['user']."', '0');");
   $mos_map_sql mysql_query("SELECT `aro_id` FROM {$mosConfig_dbprefix}core_acl_aro WHERE name='".$_REQUEST['user']."' LIMIT 1");
   $mos_map_array mysql_fetch_array($mos_map_sql);
   $aro_id $mos_map_array[0];
   $mos_write mysql_query ("INSERT INTO {$mosConfig_dbprefix}core_acl_groups_aro_map ( `group_id` , `section_value` , `aro_id` ) VALUES ('18', '', '".$aro_id."');");

 //maybe this user exists, but has not yet activated their account?

} else if ($mos_array[1] == 1){
echo "<script>alert(\""._LOGIN_BLOCKED."\"); window.history.go(-1); </script>\n";
exit();
        }


// Get ready to set the cookie...
$username $user_settings['memberName'];
$ID_MEMBER $user_settings['ID_MEMBER'];
$lifetime time() + (365*24*60*60);
// Bam!  Cookie set.  A session too, just incase.
setLoginCookie(60 $modSettings['cookieTime'], $user_settings['ID_MEMBER'], $md5_passwrd);

// Reset the login threshold.
if (isset($_SESSION['failed_login']))
unset($_SESSION['failed_login']);

$user_info['is_guest'] = false;
$user_settings['additionalGroups'] = explode(','$user_settings['additionalGroups']);
$user_info['is_admin'] = $user_settings['ID_GROUP'] == || in_array(1$user_settings['additionalGroups']);
    
mysql_select_db($db_name);

// Are you banned?

is_not_banned();

// An administrator, set up the login so they don't have to type it again.
if ($user_info['is_admin'])
$_SESSION['admin_time'] = time();

// You've logged in, haven't you?
updateMemberData($ID_MEMBER, array('lastLogin' => time(), 'memberIP' => '\'' $user_info['ip'] . '\''));

mysql_query("
DELETE FROM 
{$db_prefix}log_online
WHERE session = 'ip
$user_info[ip]'
LIMIT 1"
);
$_SESSION['log_time'] = 0;

//Everything from this point on deals with Mambo's db, so let's make sure it is the default.
mysql_select_db($mosConfig_db);


// Have you changed your SMF password?  Now that you have confirmed your SMF password, let's make sure they match.
$mos_write mysql_query("UPDATE {$mosConfig_dbprefix}users SET password='$passwd' where username='$username'");


$currentDate date("Y-m-d\TH:i:s");
mysql_query("UPDATE {$mosConfig_dbprefix}users SET lastvisitDate='$currentDate' where username='$username'");

// Get rid of the online entry for that old guest....

// log into Mambo now.....

$remember "yes";

if (!$username || !$passwd) {
echo "<script> alert(\""._LOGIN_INCOMPLETE."\"); window.history.go(-1); </script>\n";
exit();
} else {
$request mysql_query"SELECT id, gid, block, usertype FROM {$mosConfig_dbprefix}users WHERE username='$username' AND password='$passwd'");
$row mysql_fetch_array($request);
// fudge the group stuff

$session =& $this['_session'];
$session['guest'] = 0;
$session['username'] = $username;
$session['userid'] = intval$row['id'] );
$session['usertype'] = $row['usertype'];
$session['gid'] = intval$row['gid'] );


$currentDate date("Y-m-d\TH:i:s");
mysql_query("UPDATE {$mosConfig_dbprefix}users SET lastvisitDate='$currentDate' where id='$session[userid]'");

if ($remember=="yes") {
$lifetime time() + 32536000;
setcookie"usercookie[username]"$username$lifetime"/" );
setcookie"usercookie[password]"$passwd$lifetime"/" );
$sessionCookieName md5'site'.$GLOBALS['mosConfig_live_site'] );
setcookie ($sessionCookieName,"",-3600"/" );
// 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'/' );
}
}
//mosCache::cleanCache('com_content');

}

mysql_select_db($db_name);

// Just log you back out if it's in maintenace mode and you AREN'T an admin.
if (empty($maintenance) || allowedTo('admin_forum')){
$_SESSION['ID'] = $ID_MEMBER;
redirectexit('action=mambo_login;sa=check;id=' $ID_MEMBER);
}
else
redirectexit('action=logout;sesc=' $sc);

}

function 
MOS_Login2($username=NULL,$passwd=NULL)
{



}

function 
MOS_Logout()
{
global $db_prefix$sourcedir$ID_MEMBER$context$db_name$scripturl;
    global 
$acl$mosConfig_live_site$database$mosConfig_db$mosConfig_dbprefix;

// Make sure they aren't being auto-logged out.

require_once($sourcedir '/Subs-Auth.php');
mysql_select_db($db_name);

// If you log out, you aren't online anymore :P.
db_query("
DELETE FROM 
{$db_prefix}log_online
WHERE ID_MEMBER = 
$ID_MEMBER
LIMIT 1"
__FILE____LINE__);
$_SESSION['log_time'] = 0;

// Empty the cookie! (set it in the past, and for ID_MEMBER = 0)
setLoginCookie(-36000);
setcookie"usercookie[username]""", -3600"/" );
setcookie"usercookie[password]""", -3600"/" );
$sessionCookieName md5'site'.$GLOBALS['mosConfig_live_site'] );
setcookie ($sessionCookieName,"",-3600"/" );
if (isset(
$_VERSION) && $_VERSION->DEV_LEVEL >= '8'){
         
$lifetime  time() - 86400;
         
$remCookieName  mosMainFrame::remCookieName_User();
         
setcookie$remCookieName' '$lifetime'/' );
}

mysql_select_db($mosConfig_db);

if (!isset($_REQUEST['returnurl'])){
$sqlmysql_query("SELECT params FROM {$mosConfig_dbprefix}modules WHERE module='mod_smf_login'");
$result mysql_fetch_array($sql);
    
$paramlist $result[0];
    
$paramslogin mosParseParams($paramlist);
    
$returncheck $paramslogin->logout;
} else { 
$returncheck $_REQUEST['returnurl']; }

   if (empty(
$_SESSION['return']) && empty($returncheck))
  $returncheck="1";


switch ($returncheck){
  case "0";
  $_SESSION['logout_url'] = $GLOBALS['mosConfig_live_site'];
  break;

  case "1";
  $_SESSION['logout_url'] = $scripturl;
  break;

  case "2";
  $_SESSION['logout_url'] = $_SESSION['return'];
  break;
 }

mysql_select_db($db_name);

// Off to the merry board index we go!
if (empty($_SESSION['logout_url']))
redirectexit(''true$context['server']['needs_login_fix']);
else
{
$temp $_SESSION['logout_url'];
unset($_SESSION['logout_url']);

redirectexit($tempfalse$context['server']['needs_login_fix']);
}
}


?>


still doesn't work...

Orstio

In your includes folder is a file named version.php.

In that file, what are the values for $_VERSION->DEV_LEVEL and $_VERSION->PRODUCT ?

Advertisement: