Jump to content
TNG Community
glendo

Mambo and TNG

Recommended Posts

glendo

Yes, I follwed as close as I could, I installed the tng in the Mambo root and changed the settings in the config.php to reflect what you did but I cant figure out where the index_mambo.php file goes. And how the mambo and Tng menus interact.

Share this post


Link to post
Share on other sites
treedood

Yes, I follwed as close as I could, I installed the tng in the Mambo root and changed the settings in the config.php to reflect what you did but I cant figure out where the index_mambo.php file goes. And how the mambo and Tng menus interact.

Sounds like we need to start from scratch.

If you haven't done so already, install TNG in a subdirectory of your Mambo installation. i.e. If Mambo is in /mambo then put TNG in something like mambo/tng.

Verify that TNG is working standalone. If the Mambo url is http://www.mysite.com then TNG would be TNG would be http://www.mysite.com/tng.

After you have that working take the index_mambo.php file from the Cas Nuy bridge and change:

$adding= "INSERT INTO $users_table VALUES ('','$f_username', '$f_username', '$newpwd', '$f_username', 0, 0, 0, 0, 0, 1, '', '$f_username', '', '$f_usermail', '', '') ";

to:

$adding = "INSERT INTO $users_table VALUES ('', '$f_username', '$f_username', '$newpwd', '', 0, 0, 0, 1, 0, 0, 1, 0, '', '$f_username', '', '$f_usermail', '', '', '', '', '', '', '', '') ";

find:

session_register('allow_add_db');

and below it add:

session_register('tentative_edit_db');

find:

$allow_add_db = $HTTP_SESSION_VARS[allow_add_db] = $row[allow_add];

and below it add:

$tentative_edit_db = $HTTP_SESSION_VARS[tentative_edit_db] = $row[tentative_edit];

Save your changes and put index_mambo.php in the /mambo/tng directory.

Take the com_tng.zip (from Cas' package) and install as a component from the Mambo administration area.

Go to the "Edit Configuration" for "TNG Genealogy" and put in the appropriate settings.

Go to the "Menu Manager" and add an entry for the "TNG Genealogy" component.

This should get you to the point where you are running TNG embedded but in iframe mode.....meaning you'll get an extra set of scrollbars on the large reports. Once you get working to here, get back to me and we can make the additional changes to get rid of those.

Share this post


Link to post
Share on other sites
glendo

That was easy, everything is working fine. What next? Ok, I edited the index file and everything works except when I create a test member the Login works for mambo but when I try to acce ss the TNG link I get this error: problemColumn count doesn't match value count at row 1

And this doesn't occur for existing members only those created. They aren,t created in TNG

Share this post


Link to post
Share on other sites
glendo

OK, New registers are not being passed to TNG. What have I done wrong?

Share this post


Link to post
Share on other sites
treedood

That was easy, everything is working fine. What next? Ok, I edited the index file and everything works except when I create a test member the Login works for mambo but when I try to acce  ss the TNG link I get this error: problemColumn count doesn't match value count at row 1  

And this doesn't occur for existing members only those created. They aren,t created in TNG

That's one I haven't seen so I'll have to think about that one. When you said first, everything was working fine, what did that mean......fine until you tried to register a user?

A key point here (the devil is in the details), is that all registration and logins need to go through the Mambo interface. You'll note that on mine, I've removed the registration link in TNG (and need to remove the login link). TNG's passwords are apparently encrypted differently than Mambo's so you can't just copy the encrypted password from the Mambo users table to the one for TNG. Once you integrate the two, you never touch the one in the TNG tables. Also, your users don't actually get added to the TNG tables until the first time they log in through Mambo.

In my setup, I was moving from a Postnuke/TNG integration so I had already cleared the password difference hurdle. If you have an existing base of TNG users in a standalone setup then your migration will be more tricky.

I have to run some Saturday errands. I'll be back later.

Share this post


Link to post
Share on other sites
treedood

OK, New registers are not being passed to TNG. What have I done wrong?

Are you sure you got the "table change" line in index_mambo.php done correctly? That happened to me before I realized that there was a TNG user table change between the time that Cas released his integration component and v5 of TNG.

Share this post


Link to post
Share on other sites
glendo

Yes, I am reasonably sure<?php

include("config.php");

$form_vars = ${"HTTP_".$HTTP_SERVER_VARS["REQUEST_METHOD"]."_VARS"};

$parm = $form_vars['parm'] ;

$url = explode("|", $parm);

$f_username = $url[0];

$f_usermail = $url[1];

$link = @mysql_pconnect($database_host, $database_username, $database_password);

mysql_select_db($database_name);

$resulttng = mysql_query("SELECT password FROM $users_table WHERE username = '$f_username' ") or die("problem". mysql_error()) ;

$found = mysql_num_rows( $resulttng );

if ( $found == 0 ) {

if ($f_username !=""){

$newpwd= ranpass();

$newpwd1= base64_encode( $newpwd );

$adding = "INSERT INTO $users_table VALUES ('', '$f_username', '$f_username', '$newpwd', '', 0, 0, 0, 1, 0, 0, 1, 0, '', '$f_username', '', '$f_usermail', '', '', '', '', '', '', '', '') ";

$added = mysql_query($adding) or die("problem". mysql_error()) ;

$tekst="Your password for this TNG site ( ";

$tekst .= $tngdomain;

$tekst .= " ) is : ";

$tekst .= $newpwd ;

$subject = "Password for the TNG site, user ";

$subject .= $f_username ;

mail($f_usermail, $subject, $tekst);

$tngquery = "SELECT password FROM $users_table WHERE username = '$f_username'";

$resulttng = mysql_query($tngquery) ;

$found = mysql_num_rows( $resulttng );

}

}

$row = mysql_fetch_row( $resulttng );

$pwd= $row[0] ;

include("begin.php");

include($cms[tngpath] . "getlang.php");

include($cms[tngpath] . "genlib.php");

$query = "SELECT * FROM $users_table WHERE username = '$f_username' AND password='$pwd'";

$result = mysql_query($query) or die ("Cannot execute query: $query");

$found = mysql_num_rows( $result );

if( $found == 1 ) {

$row = mysql_fetch_assoc( $result );

$check = strcmp( $pwd, $row[password] ) || ( $row[allow_living] == -1 );

}

mysql_free_result($result);

if( $found == 1 && !$check ) {

session_register('logged_in');

session_register('allow_admin_db');

session_register('allow_edit_db');

session_register('allow_add_db');

session_register('tentative_edit_db');

session_register('allow_delete_db');

session_register('allow_living_db');

session_register('allow_ged_db');

session_register('allow_lds_db');

session_register('assignedtree');

session_register('assignedbranch');

session_register('currentuser');

session_register('currentuserdesc');

session_register('session_rp');

$logged_in = $HTTP_SESSION_VARS[logged_in] = 1;

$allow_edit_db = $HTTP_SESSION_VARS[allow_edit_db] = $row[allow_edit];

$allow_add_db = $HTTP_SESSION_VARS[allow_add_db] = $row[allow_add];

$tentative_edit_db = $HTTP_SESSION_VARS[tentative_edit_db] = $row[tentative_edit];

$allow_delete_db = $HTTP_SESSION_VARS[allow_delete_db] = $row[allow_delete];

if( $allow_edit_db || $allow_add_db || $allow_delete_db )

$allow_admin_db = $HTTP_SESSION_VARS[allow_admin_db] = 1;

else

$allow_admin_db = $HTTP_SESSION_VARS[allow_admin_db] = 0;

$allow_living_db = $HTTP_SESSION_VARS[allow_living_db] = $row[allow_living];

$allow_ged_db = $HTTP_SESSION_VARS[allow_ged_db] = $row[allow_ged];

if( !$ldsdefault ) //always do lds

$allow_lds_db = $HTTP_SESSION_VARS[allow_lds_db] = 1;

elseif( $ldsdefault == 2 ) //depends on permissions

$allow_lds_db = $HTTP_SESSION_VARS[allow_lds_db] = $row[allow_lds];

else //never do lds

$allow_lds_db = $HTTP_SESSION_VARS[allow_lds_db] = 0;

$assignedtree = $HTTP_SESSION_VARS[assignedtree] = $row[gedcom];

$assignedbranch = $HTTP_SESSION_VARS[assignedbranch] = $row[branch];

$currentuser = $HTTP_SESSION_VARS[currentuser] = $row[username];

$currentuserdesc = $HTTP_SESSION_VARS[currentuserdesc] = $row[description];

$session_rp = $HTTP_SESSION_VARS[session_rp] = $rootpath;

header( "Location: " . $homepage );

exit;

} else {

if ($f_username !=""){

$login_url = getURL( "login", 1 );

header( "Location: " . "$login_url" . "message=loginfailed" );

} else {

header( "Location: " . $homepage );

exit;

}

}

function ranpass($len = "8"){

$pass = NULL;

for($i=0; $i<$len; $i++) {

$char = chr(rand(48,122));

while (!ereg("[a-zA-Z0-9]", $char)){

if($char == $lchar) continue;

$char = chr(rand(48,90));

}

$pass .= $char;

$lchar = $char;

}

return $pass;

}

?>

Share this post


Link to post
Share on other sites
Mark.Fleeson

Hi

The problem is in the $adding line, there's only 24 columns in the tng users table not 25, you need the line to read:

$adding = "INSERT INTO $users_table VALUES ('', '$f_username', '$f_username', '$newpwd', '', 0, 0, 1, 0, 0, 1, 0, '', '$f_username', '', '$f_usermail', '', '', '', '', '', '', '', '');";

This fixed the problem for my installation. I followed the previous instructions for a clean install and hit the same error which basically said that we were trying to add too many or too few columns in the insert statement. After a few tests I realised that the above fixed the fault.

Good luck.

Mark

Share this post


Link to post
Share on other sites
glendo

Thank you Mark, that did the trick. There is another issue now though, I have Require Login selected but when in the public area the script is still accessible. I've checked everything i can think of, any suggestions? By the way this is the site what do you think?

http://www.our-families.org

Share this post


Link to post
Share on other sites
glendo

Ok, The script is requiring Login. Only when the user logs out through Mambo they remain logged in to TNG.

Share this post


Link to post
Share on other sites
Mark.Fleeson

Hi Glendo

I haven't hit that yet, prob will later today. I'll let you have the coding mods once I work them out.

Cheers

Mark

I'm working on a local linux server whilst I integrate everything so can't show you my site yet. smile.gif

Share this post


Link to post
Share on other sites
Tophe

G'day folks,

I've been travelling this road too.

To make TNG get (also) logged out from Mambo side, I did this:

at around line 138 of mambo.root.folder/index.php...

} else if ($option == "logout") {

//***cwm tweak to logout TNG user

require_once("tng/logout.php");

//***

I was wondering about tweaking the Mambo registration process too... but I think the login process sorts the issue out.

Cheers,

Chris(topher)

Share this post


Link to post
Share on other sites
Mark.Fleeson

Wow... How elegant!

I've been hacking files and got the following:

change components/com_tng/tng.php to:

<?php

/*

* This is the TNG component for Mambo Open Source

* Based on code by Cas Nuy February 2005

*/



if (!defined('TNG')){

  global $mosConfig_absolute_path;



  require ($mosConfig_absolute_path."/administrator/components/com_tng/config.tng.php");

}



if (!defined("_MOS_ALLOWHTML")){

  define( "_MOS_ALLOWHTML", 0x0002 );

}

if ( $my->id ) {

//Logged in

	$my_id = $my->id;

	$sql = "SELECT username,email FROM ".$mos_prefix."users WHERE id=$my_id";

	$result = mysql_query ($sql);

	$row = mysql_fetch_row( $result );

	$name= $row[0];

	$mail= $row[1];

	

	$check = $name;

	$check .= "|";

	$check .= $mail;

}

else

{

//Logged out

	$check = "";

}





$scripturl = $tng_path;

$scripturl .= "/index_mambo.php?parm=";

$scripturl .= $check;

header("Location: ". $scripturl,true);

//echo "<iframe src='$scripturl' align='center' width='100%' height='1024' space=0 vspace=0 marginwidth=0 marginheight=0 frameborder=0 scrolling=auto name='pnTNG' onload='parent.scrollTo(0,0);' ></iframe>";



?>



and index_mambo.php to:

<?php



include("config.php");



$form_vars = ${"HTTP_".$HTTP_SERVER_VARS["REQUEST_METHOD"]."_VARS"};

$parm = $form_vars['parm'];

	

if($parm=="") 

{

//Therefore user has logged out.

	include("begin.php");

	include($cms[tngpath] . "getlang.php");

	include($cms[tngpath] . "genlib.php");

	session_unregister('logged_in');

	session_unregister('allow_admin_db');

	session_unregister('allow_edit_db');

	session_unregister('allow_add_db');

	session_unregister('tentative_edit_db'); 

	session_unregister('allow_delete_db');

	session_unregister('allow_living_db');

	session_unregister('allow_ged_db');

	session_unregister('allow_lds_db');

	session_unregister('assignedtree');

	session_unregister('assignedbranch');

	session_unregister('currentuser');

	session_unregister('currentuserdesc');

	session_unregister('session_rp');

	

	header( "Location: " . $homepage );

	exit;

}

else

{

	$url = explode("|", $parm);

	

	$f_username = $url[0];

	$f_usermail = $url[1];

	

	$link = @mysql_pconnect($database_host, $database_username, $database_password);

	mysql_select_db($database_name);

	

	$resulttng = mysql_query("SELECT password FROM $users_table WHERE username = '$f_username' ") or die("problem". mysql_error());

	$found = mysql_num_rows( $resulttng );

	if ( $found == 0 ) 

	{

  if ($f_username !="")

  {

  	$newpwd= ranpass();

  	$newpwd1= base64_encode( $newpwd );

  //$adding=  "INSERT INTO $users_table (description, username,password,realname,email,lastlogin) VALUES ('$f_username', '$f_username', '$newpwd1', '$f_username',  '$f_usermail', NOW()) ";

  	$adding = "INSERT INTO $users_table VALUES ('', '$f_username', '$f_username', '$newpwd', '',  0, 0, 1, 0, 0, 1, 0, '', '$f_username', '', '$f_usermail', '', '', '', '', '', '', '', '');"; 

	

  	$added = mysql_query($adding)  or die("problem". mysql_error());

	

  	$tekst="Your password for this TNG site ( ";

  	$tekst .= $tngdomain;

  	$tekst .= " ) is : ";

  	$tekst .= $newpwd;

  	$subject = "Password for the TNG site, user ";

  	$subject .= $f_username;

  // We don't need this as we only use logins from mambo

  //	mail($f_usermail, $subject, $tekst);

	

  	$tngquery = "SELECT password FROM $users_table WHERE username = '$f_username'";

  	$resulttng = mysql_query($tngquery);

  	$found = mysql_num_rows( $resulttng );

  }

	}

	$row = mysql_fetch_row( $resulttng );

	$pwd= $row[0];

	

	include("begin.php");

	include($cms[tngpath] . "getlang.php");

	include($cms[tngpath] . "genlib.php");

	$query = "SELECT * FROM $users_table WHERE username = '$f_username' AND password='$pwd'";

	$result = mysql_query($query) or die ("Cannot execute query: $query");

	$found = mysql_num_rows( $result );

	if( $found == 1 ) 

	{

  $row = mysql_fetch_assoc( $result );

  $check = strcmp( $pwd, $row[password] ) || ( $row[allow_living] == -1 );

	}

	mysql_free_result($result);

	

	if( $found == 1 && !$check ) 

	{

  session_register('logged_in');

  session_register('allow_admin_db');

  session_register('allow_edit_db');

  session_register('allow_add_db');

  session_register('tentative_edit_db'); 

  session_register('allow_delete_db');

  session_register('allow_living_db');

  session_register('allow_ged_db');

  session_register('allow_lds_db');

  session_register('assignedtree');

  session_register('assignedbranch');

  session_register('currentuser');

  session_register('currentuserdesc');

  session_register('session_rp');

  $logged_in = $HTTP_SESSION_VARS[logged_in] = 1;

  $allow_edit_db = $HTTP_SESSION_VARS[allow_edit_db] = $row[allow_edit];

  $allow_add_db = $HTTP_SESSION_VARS[allow_add_db] = $row[allow_add];

  $tentative_edit_db = $HTTP_SESSION_VARS[tentative_edit_db] = $row[tentative_edit]; 

  $allow_delete_db = $HTTP_SESSION_VARS[allow_delete_db] = $row[allow_delete];

  if( $allow_edit_db || $allow_add_db || $allow_delete_db )

  	$allow_admin_db = $HTTP_SESSION_VARS[allow_admin_db] = 1;

  else

  	$allow_admin_db = $HTTP_SESSION_VARS[allow_admin_db] = 0;

  $allow_living_db = $HTTP_SESSION_VARS[allow_living_db] = $row[allow_living];

  $allow_ged_db = $HTTP_SESSION_VARS[allow_ged_db] = $row[allow_ged];

  if( !$ldsdefault ) //always do lds

  	$allow_lds_db = $HTTP_SESSION_VARS[allow_lds_db] = 1;

  elseif( $ldsdefault == 2 )  //depends on permissions

  	$allow_lds_db = $HTTP_SESSION_VARS[allow_lds_db] = $row[allow_lds];

  else  //never do lds

  	$allow_lds_db = $HTTP_SESSION_VARS[allow_lds_db] = 0;

  $assignedtree = $HTTP_SESSION_VARS[assignedtree] = $row[gedcom];

  $assignedbranch = $HTTP_SESSION_VARS[assignedbranch] = $row[branch];

  $currentuser = $HTTP_SESSION_VARS[currentuser] = $row[username];

  $currentuserdesc = $HTTP_SESSION_VARS[currentuserdesc] = $row[description];

  $session_rp = $HTTP_SESSION_VARS[session_rp] = $rootpath;



  header( "Location: " . $homepage );

  exit;

	} else 

	{

  if ($f_username !="")

  {

  	$login_url = getURL( "login", 1 );

  	header( "Location: " . "$login_url" . "message=loginfailed" );

  } else 

  {

  	header( "Location: " . $homepage );

  	exit;

  }

	}

}









function ranpass($len = "8")

{

	$pass = NULL;

	for($i=0; $i<$len; $i++) 

	{

    	$char = chr(rand(48,122));

    	while (!ereg("[a-zA-Z0-9]", $char))

  {

      	if($char == $lchar) continue;

      	$char = chr(rand(48,90));

    	}

    	$pass .= $char;

    	$lchar = $char;

	}

	return $pass;

}





?>

If this is of use to anyone then please feel free to use it. It means not changing the base mambo installation, just Cas's scripts.

Cheers

Mark

Share this post


Link to post
Share on other sites
Mark.Fleeson

Thank you Mark, that did the trick. There is another issue now though, I have Require Login selected but when in the public area the script is still accessible. I've checked everything i can think of, any suggestions? By the way this is the site what do you think?http://www.our-families.org

Hi

The site looks really great, I was wondering I could nick your privacy policy for my site as its says everything I need to say as well. smile.gif

BTW, on your mambo menu you've spelt Genealogy as Geneaolgy, you might want to swop the o and the l. smile.gif

Cheers

Mark

Share this post


Link to post
Share on other sites
glendo

WOW!! Great, Art! I like your site, but the art work is great.

Yes, Mark feel free, and thanks for the heads up on the menu.

Share this post


Link to post
Share on other sites
tlfeet

Hi Mark,

Sort of lost in trying to follow this thread (not least of which is cause Cas changed his files between these set of posts and when I got them wink.gif )

Anyway, you worte the following.

OK, you changed those files, why?

What is this related to? What integration between Mambo-TNG is this doing?

I assume something to do with log in/log out issues ... but, well, er, uhm, assuming something could get me into trouble. wink.gif

Thanks for any help.

PS Trying to pull it together in this thread:

Mambo + TNG - totally dazed & confused

I've been hacking files and got the following:

change components/com_tng/tng.php to:

<?php

/*

* This is the TNG component for Mambo Open Source

* Based on code by Cas Nuy February 2005

*/



if (!defined('TNG')){

  global $mosConfig_absolute_path;



  require ($mosConfig_absolute_path."/administrator/components/com_tng/config.tng.php");

}



if (!defined("_MOS_ALLOWHTML")){

  define( "_MOS_ALLOWHTML", 0x0002 );

}

if ( $my->id ) {

//Logged in

	$my_id = $my->id;

	$sql = "SELECT username,email FROM ".$mos_prefix."users WHERE id=$my_id";

	$result = mysql_query ($sql);

	$row = mysql_fetch_row( $result );

	$name= $row[0];

	$mail= $row[1];

	

	$check = $name;

	$check .= "|";

	$check .= $mail;

}

else

{

//Logged out

	$check = "";

}





$scripturl = $tng_path;

$scripturl .= "/index_mambo.php?parm=";

$scripturl .= $check;

header("Location: ". $scripturl,true);

//echo "<iframe src='$scripturl' align='center' width='100%' height='1024' space=0 vspace=0 marginwidth=0 marginheight=0 frameborder=0 scrolling=auto name='pnTNG' onload='parent.scrollTo(0,0);' ></iframe>";



?>



and index_mambo.php to:

<?php



include("config.php");



$form_vars = ${"HTTP_".$HTTP_SERVER_VARS["REQUEST_METHOD"]."_VARS"};

$parm = $form_vars['parm'];

	

if($parm=="") 

{

//Therefore user has logged out.

	include("begin.php");

	include($cms[tngpath] . "getlang.php");

	include($cms[tngpath] . "genlib.php");

	session_unregister('logged_in');

	session_unregister('allow_admin_db');

	session_unregister('allow_edit_db');

	session_unregister('allow_add_db');

	session_unregister('tentative_edit_db'); 

	session_unregister('allow_delete_db');

	session_unregister('allow_living_db');

	session_unregister('allow_ged_db');

	session_unregister('allow_lds_db');

	session_unregister('assignedtree');

	session_unregister('assignedbranch');

	session_unregister('currentuser');

	session_unregister('currentuserdesc');

	session_unregister('session_rp');

	

	header( "Location: " . $homepage );

	exit;

}

else

{

	$url = explode("|", $parm);

	

	$f_username = $url[0];

	$f_usermail = $url[1];

	

	$link = @mysql_pconnect($database_host, $database_username, $database_password);

	mysql_select_db($database_name);

	

	$resulttng = mysql_query("SELECT password FROM $users_table WHERE username = '$f_username' ") or die("problem". mysql_error());

	$found = mysql_num_rows( $resulttng );

	if ( $found == 0 ) 

	{

  if ($f_username !="")

  {

  	$newpwd= ranpass();

  	$newpwd1= base64_encode( $newpwd );

  //$adding=  "INSERT INTO $users_table (description, username,password,realname,email,lastlogin) VALUES ('$f_username', '$f_username', '$newpwd1', '$f_username',  '$f_usermail', NOW()) ";

  	$adding = "INSERT INTO $users_table VALUES ('', '$f_username', '$f_username', '$newpwd', '',  0, 0, 1, 0, 0, 1, 0, '', '$f_username', '', '$f_usermail', '', '', '', '', '', '', '', '');"; 

	

  	$added = mysql_query($adding)  or die("problem". mysql_error());

	

  	$tekst="Your password for this TNG site ( ";

  	$tekst .= $tngdomain;

  	$tekst .= " ) is : ";

  	$tekst .= $newpwd;

  	$subject = "Password for the TNG site, user ";

  	$subject .= $f_username;

  // We don't need this as we only use logins from mambo

  //	mail($f_usermail, $subject, $tekst);

	

  	$tngquery = "SELECT password FROM $users_table WHERE username = '$f_username'";

  	$resulttng = mysql_query($tngquery);

  	$found = mysql_num_rows( $resulttng );

  }

	}

	$row = mysql_fetch_row( $resulttng );

	$pwd= $row[0];

	

	include("begin.php");

	include($cms[tngpath] . "getlang.php");

	include($cms[tngpath] . "genlib.php");

	$query = "SELECT * FROM $users_table WHERE username = '$f_username' AND password='$pwd'";

	$result = mysql_query($query) or die ("Cannot execute query: $query");

	$found = mysql_num_rows( $result );

	if( $found == 1 ) 

	{

  $row = mysql_fetch_assoc( $result );

  $check = strcmp( $pwd, $row[password] ) || ( $row[allow_living] == -1 );

	}

	mysql_free_result($result);

	

	if( $found == 1 && !$check ) 

	{

  session_register('logged_in');

  session_register('allow_admin_db');

  session_register('allow_edit_db');

  session_register('allow_add_db');

  session_register('tentative_edit_db'); 

  session_register('allow_delete_db');

  session_register('allow_living_db');

  session_register('allow_ged_db');

  session_register('allow_lds_db');

  session_register('assignedtree');

  session_register('assignedbranch');

  session_register('currentuser');

  session_register('currentuserdesc');

  session_register('session_rp');

  $logged_in = $HTTP_SESSION_VARS[logged_in] = 1;

  $allow_edit_db = $HTTP_SESSION_VARS[allow_edit_db] = $row[allow_edit];

  $allow_add_db = $HTTP_SESSION_VARS[allow_add_db] = $row[allow_add];

  $tentative_edit_db = $HTTP_SESSION_VARS[tentative_edit_db] = $row[tentative_edit]; 

  $allow_delete_db = $HTTP_SESSION_VARS[allow_delete_db] = $row[allow_delete];

  if( $allow_edit_db || $allow_add_db || $allow_delete_db )

  	$allow_admin_db = $HTTP_SESSION_VARS[allow_admin_db] = 1;

  else

  	$allow_admin_db = $HTTP_SESSION_VARS[allow_admin_db] = 0;

  $allow_living_db = $HTTP_SESSION_VARS[allow_living_db] = $row[allow_living];

  $allow_ged_db = $HTTP_SESSION_VARS[allow_ged_db] = $row[allow_ged];

  if( !$ldsdefault ) //always do lds

  	$allow_lds_db = $HTTP_SESSION_VARS[allow_lds_db] = 1;

  elseif( $ldsdefault == 2 )  //depends on permissions

  	$allow_lds_db = $HTTP_SESSION_VARS[allow_lds_db] = $row[allow_lds];

  else  //never do lds

  	$allow_lds_db = $HTTP_SESSION_VARS[allow_lds_db] = 0;

  $assignedtree = $HTTP_SESSION_VARS[assignedtree] = $row[gedcom];

  $assignedbranch = $HTTP_SESSION_VARS[assignedbranch] = $row[branch];

  $currentuser = $HTTP_SESSION_VARS[currentuser] = $row[username];

  $currentuserdesc = $HTTP_SESSION_VARS[currentuserdesc] = $row[description];

  $session_rp = $HTTP_SESSION_VARS[session_rp] = $rootpath;



  header( "Location: " . $homepage );

  exit;

	} else 

	{

  if ($f_username !="")

  {

  	$login_url = getURL( "login", 1 );

  	header( "Location: " . "$login_url" . "message=loginfailed" );

  } else 

  {

  	header( "Location: " . $homepage );

  	exit;

  }

	}

}









function ranpass($len = "8")

{

	$pass = NULL;

	for($i=0; $i<$len; $i++) 

	{

    	$char = chr(rand(48,122));

    	while (!ereg("[a-zA-Z0-9]", $char))

  {

      	if($char == $lchar) continue;

      	$char = chr(rand(48,90));

    	}

    	$pass .= $char;

    	$lchar = $char;

	}

	return $pass;

}





?>

If this is of use to anyone then please feel free to use it. It means not changing the base mambo installation, just Cas's scripts.

Cheers

Mark

Share this post


Link to post
Share on other sites
BrianH

This should get you to the point where you are running TNG embedded but in iframe mode.....meaning you'll get an extra set of scrollbars on the large reports.  Once you get working to here, get back to me and we can make the additional changes to get rid of those.

If you could, please explain more. I have TNG working awesome on Mambo and the only way I found to get rid of it is to set the height in the tng.php file for the component to about '1000px', but this is a problem because once I start adding a lot of content to my site, I'm going to need to start cranking up the height and pages that are short are going to be excessively long.

I have however found several solutions to this problem, but don't understand how to apply them.

1. Use the Auto Height option:

http://help.mamboserver.com/index.php?opti...=680&Itemid=124

The problem: what's the syntax? I tried width='100%' autoheight=yes, and it didn't work.

2. http://www.dyn-web.com/dhtml/iframes/height1.html

I haven't yet tried this option.

Any recomendations?

http://www.bchynds.com

Share this post


Link to post
Share on other sites
BrianH

Nevermind, I got it working. I posted the solution in the mailing list, but I could probably post it here too. Here's a copy of the e-mail:

I have gotten so far on getting TNG to completely intergrate into Mambo now. Here's the solution to getting rid if those inside scroll bars.

First, replace your code in /components/com_tng/tng.php with this:

<script type="text/javascript">

function adjustIFrameSize (iframeWindow) {

  if (iframeWindow.document.height) {

    var iframeElement = document.getElementById

(iframeWindow.name);

    iframeElement.style.height = iframeWindow.document.height + 'px';

    iframeElement.style.width = iframeWindow.document.width + 'px';

  }

  else if (document.all) {

    var iframeElement = document.all[iframeWindow.name];

    if (iframeWindow.document.compatMode &&

        iframeWindow.document.compatMode != 'BackCompat')

    {

      iframeElement.style.height =

iframeWindow.document.documentElement.scrollHeight + 5 + 'px';

      iframeElement.style.width =

iframeWindow.document.documentElement.scrollWidth + 5 + 'px';

    }

    else {

      iframeElement.style.height =

iframeWindow.document.body.scrollHeight + 5 + 'px';

      iframeElement.style.width =

iframeWindow.document.body.scrollWidth + 5 + 'px';

    }

  }

}

</script>



<?php

/*

* This is the TNG bridge component for Mambo Open Source

* Created by Cas Nuy February 2005

*/



if (!defined('TNG')){

  global $mosConfig_absolute_path;



  require ($mosConfig_absolute_path."/administrator/components/com_tng/config.tng.php");

}



if (!defined("_MOS_ALLOWHTML")){

  define( "_MOS_ALLOWHTML", 0x0002 );

}



$my_id = $my->id;

$sql = "SELECT username,email FROM ".$mos_prefix."users WHERE id=$my_id";

$result = mysql_query ($sql);

$row = mysql_fetch_row( $result );

$name= $row[0];

$mail= $row[1];



$check = $name;

$check .= "|";

$check .= $mail;



$scripturl = $tng_path;

$scripturl .= "/index_mambo.php?parm=";

$scripturl .= $check;



echo "<iframe src='$scripturl' align='center' width='100%' space=0 vspace=0 marginwidth=0 marginheight=0 frameborder=0 scrolling=auto name='pnTNG' id='    pnTNG' onload='parent.scrollTo(0,0);' ></iframe>";



?>
NEXT: In the <body> tag of index.php file of your TNG install, include:
onload="if (parent.adjustIFrameSize) parent.adjustIFrameSize(window);"

Mine looks like this:

<body bgcolor="#D1DEE1" onload="if (parent.adjustIFrameSize) parent.adjustIFrameSize(window);">

Now you need to include the same code into <body> tag of your topmenu.html in your main TNG directory.

In laymans terms, what you have done is enabled your TNG documents to tell Mambo (the parent frame of the iframe that's used in the component) to resize the height of the iframe to match the height of the document. I have found 1 problem with this technique. After the first document, any links within the iframe will use the height information from the previous frame until you press refresh on your browser. I am looking for a way to fix this. As for width problems, I am currently recoding areas to show information in popup windows, i.e. Pedigree charts, etc., so stay tuned for more updates. Until then, I hope this helps everybody.

Regards,

Brian C. Hynds

http://www.bchynds.com

Share this post


Link to post
Share on other sites
mipalmers

I found this thread about integrating TNG with Mambo, Thanks for all the work.

I'm a little confused with some of this though.

The post on Aug 09, 2005 by Mark Fleeson says at the end "If this is of use to anyone then please feel free to use it. It means not changing the base mambo installation, just cas's scripts."

Does this mean that I install TNG and then follow Cas's instructions, but change the scripts with the code in Mark's code.

Then Do I change the code discussed in the Oct, 09, 2005 post by Brian H. regarding the inside scroll bars?

Am I missing something? Thanks!

John

Share this post


Link to post
Share on other sites
BrianH

You don't have to change anything at all to any code if you like. If you follow the instructions for the TNG component install, you will see that you need to install TNG anyways before continuing with the component install. The code that I posted is only if you want to improve the intergration to allow the iframe to automatically adjust to the TNG page that its loading. The component should work just fine after installing. Create a menu item in your main menu and link it to the TNG component to include it onto your site.

Share this post


Link to post
Share on other sites
John Paul

Hi Mark,

Sort of lost in trying to follow this thread (not least of which is cause Cas changed his files between these set of posts and when I got them ;) )

Anyway, you worte the following.

OK, you changed those files, why?

What is this related to? What integration between Mambo-TNG is this doing?

I assume something to do with log in/log out issues ... but, well, er, uhm, assuming something could get me into trouble. ;)

Thanks for any help.

PS Trying to pull it together in this thread:

Mambo + TNG - totally dazed & confused

I modded my files per these iunstructions (for my test site). The login issue is cleared up now, BUT, now TNG comes up in full page made, bot 'wrapped' in joomla. I tried the suggestions further down in the thread, but there was no change. Any ideas? thanks.

Share this post


Link to post
Share on other sites
BMR789

John Paul,

Based on Brian C. Hynds http://www.bchynds.com mod for the Iframe it works with Internet Explorer but not with Firefox.

Have not found a solution for the dbl scroll bar for Firefox as yet.

Blair

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×