Firefox PHP

phorum_db_post_message() API

Posted by gurufocus 
phorum_db_post_message() API
January 31, 2007 10:08PM
Where can I find more information about phorum_db_post_message() API? how to use it?

thanks!

-------
[www.gurufocus.com]
Stock Picks of Warren Buffett Gurus
Re: phorum_db_post_message() API
January 31, 2007 11:34PM
How about the source? There's no API documentation outside the source code. If you're looking for an example use, check out ./include/posting/action_post.php


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: phorum_db_post_message() API
January 31, 2007 11:40PM
Unfortunately I am using Phorum 5.0.13, which uses post.php.

If I want to use this API, which functions do I need to include in my php code?

Thanks!
Re: phorum_db_post_message() API
January 31, 2007 11:50PM
Well, then read the example code from post.php. The function is called from that file in 5.0.13. Did anybody ever mention that you should upgrade? ;-)

If you want to use the API, then you need at least:
<?php
# doesn't really matter what this is exactly, as long as you use a name
# that isn't already the name of a Phorum phorum_page name.
define('phorum_page', 'yourscript');

# Change directory to the Phorum install dir (required, because all Phorum
# code asumes that it's run from a script in the Phorum install dir).
chdir("/path/to/your/phorum/installdir/");

# Load common code and setup database connection.
include_once("common.php");
?>


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: phorum_db_post_message() API
February 01, 2007 12:00AM
Thank you!

I apologize for the post on another thread. I did that before I saw your first reply.

I cannot upgrade, although I would like to. I added a lot of new fields to database table to category the messages, so that other non-Phorum pages can use them in different ways. I also added a lot of new fields to distinguish the users. I dare not to make any changes to the database.
Re: phorum_db_post_message() API
February 01, 2007 12:06AM
Still, now and then consider doing an upgrade and maybe document changes and write modules as much as possible, to be able to get along with future upgrades. Now you might be running a version with security problems and bugs. Also, the new features in 5.1 are worth the upgrade IMO. But as long as it's your fingers that are cut, I have no problem with you staying at the 5.0 tree =)


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: phorum_db_post_message() API
May 31, 2007 05:08PM
I am trying to use phorum_db_post_message() API. However, I got this error:

Warning: main(./include/db/.php) [function.main]: failed to open stream: No such file or directory in /public_html/forum/common.php on line 114

When I look at line 114 in common.php, it is:

include_once( "./include/db/{$PHORUM['DBCONFIG']['type']}.php" );

It seems that it cannot find the DB file. Can someone help?

I have done all of these:


Quote
mmakaay
Well, then read the example code from post.php. The function is called from that file in 5.0.13. Did anybody ever mention that you should upgrade? ;-)

If you want to use the API, then you need at least:
<?php
# doesn't really matter what this is exactly, as long as you use a name
# that isn't already the name of a Phorum phorum_page name.
define('phorum_page', 'yourscript');

# Change directory to the Phorum install dir (required, because all Phorum
# code asumes that it's run from a script in the Phorum install dir).
chdir("/path/to/your/phorum/installdir/");

# Load common code and setup database connection.
include_once("common.php");
?>



Edited 1 time(s). Last edit at 05/31/2007 06:14PM by gurufocus.
Re: phorum_db_post_message() API
May 31, 2007 05:34PM
common.php should load include/db/config.php which should define $PHORUM["DBCONFIG"],which should set the $PHORUM["DBCONFIG"]["type"] which appears to be empty. Debug this chain to see where it's broken.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: phorum_db_post_message() API
May 31, 2007 06:01PM
Thank you. It seem that PHORUM is not defined even there is "define( "PHORUM", "5.0.13a" );"

any ideas?
Re: phorum_db_post_message() API
May 31, 2007 06:08PM
That sounds like common.php is not included at all. So check if you have the chdir() correct. Also check if the common.php is readable. Maybe add a simple die("OK") statement or so to the start of common.php. If you see the die(), then common is loaded, otherwise not.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: phorum_db_post_message() API
May 31, 2007 06:19PM
common.php is included. chdir() is correct. If I disable chdir(). The error message becomes:

Warning: main(./common.php) [function.main]: failed to open stream: No such file or directory in [filename] on line 243

If I enable chdir(), it can find common.php, but it seems that it included /include/db/config.php. but it does not recognize "define( "PHORUM", "5.0.13a" );"
Re: phorum_db_post_message() API
May 31, 2007 06:20PM
It's right there in the code of common.php, so if that is really included, the PHORUM constant should be available.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: phorum_db_post_message() API
May 31, 2007 06:27PM
$PHORUM != PHORUM

PHORUM is a constant
$PHORUM is an array


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: phorum_db_post_message() API
May 31, 2007 10:01PM
Found the problem. It is because we have included /db/config.php somewhere before. Therefore in common.php it does not include it again with "include_once".
Sorry, only registered users may post in this forum.

Click here to login