Firefox PHP

System for embedding Phorum in other applications (early preview)

Posted by Maurice Makaay 
Re: System for embedding Phorum in other applications (early preview)
February 06, 2006 08:25PM
I walked step by step through the code and I have found a possible spot where the code could get into a loop. Could you please try if replacing include/templates.php with the attached templates.php script does fix the problems on your system?

Edit: Almost forgot: please delete all tpl-* files from your cache-directory after installing the new templates.php script.

Issue was fixed, templates.php replacement is removed from this message


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 2 time(s). Last edit at 05/31/2007 07:12PM by mmakaay.
Re: System for embedding Phorum in other applications (early preview)
February 07, 2006 01:35AM
Again a new release of the Phorum embedding module (or "system" might almost be more appropriate by now). Check the first post for a download link. Here's the changelog for this release:
0.0.4 2006-02-06

    - Removed PHP5 specific OO code from connector base and descendant
      classes.

    - Connector init() method was renamed to hook_common_pre() for clarity.

    - Moved functionality for url rewriting and query parsing to methods in
      the PhorumConnector class, so connectors can handle application
      specific rewriting/parsing in case the functionality in the base
      connector class isn't sufficient.

    - Created a first implementation of a Mambo connector. The connector
      supports user synchronization and Mambo specific URL rewriting.
      Super Administrator users in Mambo will get the "admin" flag set
      for the Phorum account. The passwords for these admin users are
      also transferred to Phorum. After a Super Administrator has
      visited the embedded Phorum once, he can login to admin.php too.

    - The syncuser script now also understands passwords prefixed with
      the string $MD5$. When this string is set, embed_phorum_syncuser()
      will store the password as an already encrypted MD5 password. This
      way it is possible to synchronize passwords that are stored only
      MD5 encrypted in the master application.

    - The syncuser.php script now keeps passwords for administrators intact,
      so they can login to Phorum's admin interface.

    - In the templates the [mod_embed_phorum <elementname] dividers are
      renamed to [element <elementname>] for clarity.

    - Moved creating the $PHORUM_CONNECTOR object to the glue code, so the
      glue code has ultimate freedom in setting up the connector object.

    - Finished method documentation of PhorumConnectorBase.php.

    - The email settings panel in the control center will no longer spawn an
      error about the email address not being filled in, in case Phorum is
      not allowed to change the email address (in which case that field is
      not available in the control center).

    - The file.php script output was always printed in raw mode. Now,
      that is only done if a file really is downloaded (so error messages
      are displayed correctly).


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: System for embedding Phorum in other applications (early preview)
February 07, 2006 01:47AM
Hemm.. Did that, and everything works allright. Does it matter if I'm running PHP as CGI module? But so far, if I'm using the embed phorum code from default package release, I'm able to fetch the phorum template just fine.

I'll try to look the problem that I might did on the embed_phorum mod.

Thanks Maurice.
Re: System for embedding Phorum in other applications (early preview)
February 07, 2006 03:18AM
Sorry Maurice,

I just realize the mistake that I did. After struggling with this for a few days, then I just realize that the name of the template folder is embed_forum, instead of embed_phorum. Heheheheeeee :D

I feels kinda silly now, but anyway, I'll try the new connector. Hope I'm not doing any silly thing anymore.

Thanks Maurice.
Re: System for embedding Phorum in other applications (early preview)
February 07, 2006 03:47AM
Quote
mmakaay
I walked step by step through the code and I have found a possible spot where the code could get into a loop. Could you please try if replacing include/templates.php with the attached templates.php script does fix the problems on your system?

Edit: Almost forgot: please delete all tpl-* files from your cache-directory after installing the new templates.php script.

I replace my template.php with your and the error is gone!

Good job!

PS: I will check out your new mods! Thanks

[opensourceCMS.com]
[ongetc.com]
Chanh Ong
Re: System for embedding Phorum in other applications (early preview)
February 07, 2006 03:55AM
Quote
mmakaay
Again a new release of the Phorum embedding module (or "system" might almost be more appropriate by now). Check the first post for a download link. Here's the changelog for this release:
0.0.4 2006-02-06

    - Removed PHP5 specific OO code from connector base and descendant
      classes.

    - Connector init() method was renamed to hook_common_pre() for clarity.

    - Moved functionality for url rewriting and query parsing to methods in
      the PhorumConnector class, so connectors can handle application
      specific rewriting/parsing in case the functionality in the base
      connector class isn't sufficient.

    - Created a first implementation of a Mambo connector. The connector
      supports user synchronization and Mambo specific URL rewriting.
      Super Administrator users in Mambo will get the "admin" flag set
      for the Phorum account. The passwords for these admin users are
      also transferred to Phorum. After a Super Administrator has
      visited the embedded Phorum once, he can login to admin.php too.

    - The syncuser script now also understands passwords prefixed with
      the string $MD5$. When this string is set, embed_phorum_syncuser()
      will store the password as an already encrypted MD5 password. This
      way it is possible to synchronize passwords that are stored only
      MD5 encrypted in the master application.

    - The syncuser.php script now keeps passwords for administrators intact,
      so they can login to Phorum's admin interface.

    - In the templates the [mod_embed_phorum <elementname] dividers are
      renamed to [element <elementname>] for clarity.

    - Moved creating the $PHORUM_CONNECTOR object to the glue code, so the
      glue code has ultimate freedom in setting up the connector object.

    - Finished method documentation of PhorumConnectorBase.php.

    - The email settings panel in the control center will no longer spawn an
      error about the email address not being filled in, in case Phorum is
      not allowed to change the email address (in which case that field is
      not available in the control center).

    - The file.php script output was always printed in raw mode. Now,
      that is only done if a file really is downloaded (so error messages
      are displayed correctly).


This is great but how do I hook this up with Mambo?

Thanks

[opensourceCMS.com]
[ongetc.com]
Chanh Ong
Re: System for embedding Phorum in other applications (early preview)
February 07, 2006 04:25AM
Hi Maurice, got everythings added to MODx, but I didn't implement the get_user_id function yet on my modx connector, so I just commented them out.

There is one thing that seems weird to me, it might be my php, but '' or empty string is counted as NULL, so I have to add && on the run_phorum.php file.

    // Check for missing elements in the template.
    foreach ($elements as $key => $val) {
        if ($val == NULL && $val != '') {
            die("embed_phorum module error: page element \"$key\" " .
                "is missing in the templates");
        }
    }

Another qeirdness that I found, the $elements being passed to process_page_elements function on connector file, when extending the phorumConnector class, all the array key is taken from this correct?
    $elements = array(
        'style'         => '',
        'base_href'     => '',
        'http_path'     => $GLOBALS["PHORUM"]["http_path"],
        'rss_link'      => '',
        'rss_url'       => '',
        'redirect_meta' => '',
        'redirect_url'  => '',
        'redirect_time' => '',
        'lang_meta'     => '',
        'title'         => NULL,
        'head_data'     => '',
        'body_onload'   => '',
        'body_data'     => NULL,
    );

But I notice there is one more element addition to the array, with the key name contains the whole output which include html and body tag as well.

Check this out
[test.djamoer.net]

Basically, what I add this line of code for extending process_page_elements function.
print_r($elements);

You can see from the source code from the link above, that the connector is being called inside MODx page in between those horizontal line.

I'll try to check my template, in case if I did something wrong.
Re: System for embedding Phorum in other applications (early preview)
February 07, 2006 04:33AM
I'll take back all my questions from above. I just figure out I set back the template back to default.

But the problem with detecting elements as null, even though they were set to '' is still happening, so I'm still using this additional
 && $val != ''
for checking template validity.
Re: System for embedding Phorum in other applications (early preview)
February 07, 2006 04:43AM
I think I still encounter the same problem, there is one more additional element to the array with the key name containing the whole output, except without the html and body tag on it, because I use the embed_phorum template now.

Quote

But I notice there is one more element addition to the array, with the key name contains the whole output which include html and body tag as well.

Any though on this? You can still check the link above, for more clear picture of what's happening.

Sincerely,
Re: System for embedding Phorum in other applications (early preview)
February 07, 2006 09:52AM
Quote
wendy
I just realize the mistake that I did. After struggling with this for a few days, then I just realize that the name of the template folder is embed_forum, instead of embed_phorum. Heheheheeeee :D

Read back the thread. I already told you that a while ago ;-) I'll take a look at your output later today.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Sorry, only registered users may post in this forum.

Click here to login