News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

New tools to help integrating SMF with something else

Started by Andre N, September 19, 2011, 01:35:36 PM

Previous topic - Next topic

BigOHenry

I am using czech framework Nette with MVP architecture. I tried included into bootstrap.php and SignPresenter.php.
Nette app is on hxxp:www.myweb.com [nonactive] and SMF is on hxxp:forum.myweb.com [nonactive].

Kindred

Ugh...   Using bootstrap with smf is fraught with issues, iirc...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

Different Bootstrap.

Though I have no idea how this is trying to be used or what code is involved at this point because telling me that doesn't actually help me any :(

BigOHenry

I have SMF on hxxp:forum.myweb.com [nonactive]. My application in Nette framework (similar like Symfony 2) is on hxxp:www.myweb.com [nonactive].

Only thing i need is Single-sign-on betwen SMF and my application. So there will be 1 SMF session on subdomain and 1 Nette session on domain. Only communication i need is when login and logout.

My app using smf_members table (so only 1 user table for both).

Its possible?

Arantor

It's possible but you have to understand that no-one here knows Nette... I never even heard of it until you mentioned it. More details would seriously be useful, because from what's been described, Nette is doing something that's even breaking the API.

BigOHenry

I dont know what you need to know to help me :(

Nette has MVP (Model-View-Presenter) architecture like Symfony 2.

my index.php:


$container = require __DIR__ . '/../app/bootstrap.php';

require_once __DIR__ . '/../www/integration/smf_2_api.php';

$container->getService('application')->run();



Bootstrap:



require __DIR__ . '/../vendor/autoload.php'; //load classes

$configurator = new Nette\Configurator;

//$configurator->setDebugMode('23.75.345.200'); // enable for your remote IP
$configurator->enableDebugger(__DIR__ . '/../log');

$configurator->setTempDirectory(__DIR__ . '/../temp');

$configurator->createRobotLoader()
->addDirectory(__DIR__)
->register();

$configurator->addConfig(__DIR__ . '/config/config.neon');
$configurator->addConfig(__DIR__ . '/config/config.local.neon');

$container = $configurator->createContainer();

return $container;


When i include the SMF API into bootstrap, getting this error:


Nette\InvalidStateException

Unable to set 'session.gc_maxlifetime' to value '1209600' when session has been started by session.auto_start or session_start(). search►


So, integration file in bootstrap.php should work, but that SMF API already started the session..... Is there any way how to start session on subdomain not domain from integration API?


rameleu

Hello everyone,

I'm actually trying to make register working by doing this :

$regOptions = array();
   $regOptions['member_name'] = $username;
   $regOptions['password'] = $password;
   $regOptions['email'] = $email;
   $email='[email protected]';
   $password='testPassword';
   $username='testRegister';
   smfapi_registerMember($regOptions);


But when I go on the page, nothing happens (there's no registration)

If someone knows what my problem is :)

nearlyepic

Hi, I seem to be having the same problem that BigOHenry was having. Even a simple bit of code, such as:

<?php
require_once "/var/www/smfapi/smf_2_api.php";
smfapi_loadSession();
smfapi_loadUserSettings();
var_dump($user_info);
?>



Produces:

Notice: Undefined variable: cookieData in /var/www/smfapi/smf_2_api.php on line 1909

Notice: Undefined variable: cookieData in /var/www/smfapi/smf_2_api.php on line 1909
array(27) { ["groups"]=> array(1) { [0]=> int(-1) } ["possibly_robot"]=> bool(false) ["id"]=> int(0) ["username"]=> string(0) "" ["name"]=> string(0) "" ["email"]=> string(0) "" ["passwd"]=> string(0) "" ["language"]=> string(7) "english" ["is_guest"]=> bool(true) ["is_admin"]=> bool(false) ["theme"]=> int(0) ["last_login"]=> int(0) ["ip"]=> string(11) "68.32.30.25" ["ip2"]=> string(11) "68.32.30.25" ["posts"]=> int(0) ["time_format"]=> string(22) "%B %d, %Y, %I:%M:%S %p" ["time_offset"]=> int(0) ["avatar"]=> array(4) { ["url"]=> string(0) "" ["filename"]=> string(0) "" ["custom_dir"]=> bool(false) ["id_attach"]=> int(0) } ["smiley_set"]=> string(0) "" ["messages"]=> int(0) ["unread_messages"]=> int(0) ["total_time_logged_in"]=> int(0) ["buddies"]=> array(0) { } ["ignoreboards"]=> array(0) { } ["ignoreusers"]=> array(0) { } ["warning"]=> int(0) ["permissions"]=> array(0) { } }


It appears that it only happens when I am logged out from SMF.

rpandassociates

I am using
adultvideoscript which is smartyPHP
with the social login mod from neuvo labs

I am using SMF as my forum at hxxp:domainname.co/forums [nonactive]

I want to hire someone to do some work
I want it so if a user registers or logs in at my primary site the AVS site, wether it be via social login or via standard registration login that their account will be created in SMF and logged in at SMF at the same time.

Is this API the way to do it?
Would some one want to make some money doing this for me?

If so let me know how much and how long it will take

Shambles

Quote from: rpandassociates
I want to hire someone to do some work

If so let me know how much and how long it will take

This isn't really the right thread to request paid work, but to jump in before anyone else does, I can do what you require within 2 weeks, at a cost of just £168,000 guaranteed to work first time.

Rdejong

The following code returns 'True' but doesn't create a cookie (regular login to the forum creates and cookie);

// include the api file
require_once ('smf_2_api.php');

$email = htmlspecialchars($_POST["email"]);

echo smfapi_login($email);

I know that the rest of the API is working because the following code does create an user account;

$name = "Rdejong";
$email = "[email protected]";
$password = "xxxx";

$regOptions = array('member_name' => $name, 'email' => $email, 'password' => $password);

smfapi_registerMember($regOptions);

I have changed and played with the 'Use subdomain independent cookies' and 'Enable local storage of cookies' but it doesn't seem to make any different, no cookies are actually being created.



anonymous001

I currently use SMF 2.0.10  is this API script or any other from "Andre N" compatiby with this version? If yes which one? If no, which smf version did I need to be working with the API scripts?

margarett

Yes it is compatible. You should use the files attached to the first post ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

anonymous001

Thanks, for the fast answer.
My problem using the api: http://www.simplemachines.org/community/index.php?topic=538976.msg3830402#new
-I just did not use the REST api because I just need to interact on one server, so no need for the function of the REST api.

Nic_G

Hi guys!

Nice work!

Can someone explain me what I should do with the Settings.php?

When I require_once the API file, it goes wrong. And It looks like there is something missing with the settings (file?)

How am I supposed to create the settings file?

Thanks!

PS: the Captcha is really hard!

Kindred

Settings.php is ALWAYS present with any successful installation of SMF. It is in the root smf folder (and can not be moved)

Nor should it be edited...  AFAIK, the API works correctly with Settings.php as generated by SMF
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Nic_G

Thank you for replying so quickly!

I actually saw Settings.php a few minutes after postings and figured out that my issues were with include paths. I sorted it out now.

On a side note, it looks to me that the initial post of this thread should be edited to reflect the current state of the API. I have a strong feeling that it is now misleading. (for example, smfapi_logout($email); is used in the first lines but does not apply any more).

I have now run into a new issue and it is a bit weird.

While trying to register an user, I got this error:  Undefined index: default_personalText

Looing at the content of the $smf_settings array, I found default_personal_text instead!

Of course, it is easy to fix for me, I can just correct the API file accordingly. But I wonder how this error is possible (how can the API file be wrong on that?) and how many people's code it broke. Has SMF been updated recently leading to this issue? That would be the only sensible explanation I think.

Thanks!


Kindred

well, the API was written by someone (not on the SMF team) in 2011.

SMF stopped using camel case with the 2.0 release, I believe...  So no... not recently changed
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Nic_G

OK. So it means the API will be broken in many places? If it has not been updated since SMF2 has been released?

Illori

there have not been major changes in SMF 2.0 has been released, so it should work without issue.

Advertisement: