PDA

View Full Version : [Release] - BFC Weblog System


07-17-2000, 10:31 AM
Basically the BFC Weblog System is active topics with some extra (IMO usefull) features. One of your forums is converted to a news forum, and the script parses that forum for headlines. The result is a Slashdot-esqe output that runs off of vB. I have been running it on my site for a week while developing it and not had any major problems.

BFC Weblog System in Action -- http://www.eternityproductions.com

BFC Weblog System Readme -- see zip file below

BFC Weblog System Source Files --http://www.eternityproductions.com/downloadable/bfc_ws.zip

Following is a paste from the readme for the install, which would probably be a wise place to visit before you attempt any upgades ;)

The BFC Weblog system is a script that works with the vBulletin forum program. It is a bit like active topics in that it extends the use of vB to other portions of a website; in this case, the front page, but it takes things a step further. When I decided to write the program it was because I already knew that I was going to be using vB, was comforatable in PHP4 and mySQL, and wanted to have a news submission program that the users of the site could easily adapt to. In addition, the BFC Weblog allows EP to do away with seperate user authentication issues -- as they are all handled by vB. I wanted something ala Slash or Scoop, but I already had the message board, and didn't need that kind of weight. The program is still in very early development and will continue to be for some time, but I believe that by realeasing it on the public that maybe someone else will find some use for it, be able to add to it, or be able to fix bugs, etc. So, we move on to the program itself...

As you just read, the BFC Weblog needs vBulletin (vB) to work. So if you don't have vB, anything beyond this point probably would not be of much use to you. It works like this: One of your vB forums becomes a "news forum," from which the BFC system grabs headlines, et cetra. You can customize the news forum just like any other vB forum, including who can start new threads (I would suggest you limit the news forum only to Moderators), who can reply, who can read, and so on. In my emulation of Slashdot, I added the column "dept" (department), so that the poster could make a funny, ficticious (sp) dept. that the story came from. I also added the column "category" to help classify the story ("science","computers","linux"). The news script determines the name of the picture via the name of the category. For example, the category science looks for "science.gif." This makes adding categories later as easy as editing the templates to include them as options and uploading a .gif file of the same name to your BFC icons folder. I would recommend not using spaces in category names. You can download the package here. The only version of vB that I have tested this in FYI is my own, ver 1.1.2.

To implement the BFC System, you must edit 3 vB files, add 2 new templates, alter 1 mySQL table and setup the BFC files (2). Before you do ANYTHING, backup your files and consider a database back as well. Messing with mySQL is pretty routine, but you can never be too safe. Here are instructions, as best as I can explain them :) Be cautious about cutting and pasting as lines wrap here that don't wrap in code. Double check your spaces.

1) Use telnet or PHPmyAdmin to edit the "post" table in your vB database. I believe that by default vB chooses the database name "forum" but you should check your self. Here are abreviated instructions for connecting to your mySQL server upon telnetting into your box:

At the prompt, type mysql -u root -pyourpassword forum

you will be presented with a mysql> prompt

type ALTER TABLE post ADD COLUMN dept VARCHAR(255);

you will be presented with a mysql> prompt again

type ALTER TABLE post ADD COLUMN category VARCHAR(50);

type quit

your post table is now edited... congrats, that was probably the hardest part.

2) Fire up your vB control panel (log on as Admin) and add the following 2 templates. You can simply cut-n-paste from your browser window. Name them newnews and editnews (right click, save target as).

newnews template

editnews template

3a)Use your favorite text editor and open newthread.php. Scroll to approx line 4, where it says require ("global.php");. Directly underneath that line, type

require("bfc.php");

Next goto approx line 125. Look for $message=censortext($message);. Directly underneath that, add:

$dept=censortext($dept);

Next goto approx line 133. Look for $DB_site->query("UPDATE post ... (continued). The next line with text should say // redirect. REPLACE the DB_site line with the following:

$DB_site->query("UPDATE post SET dept='".addslashes($dept)."',category='$category',title='".addslashes($subject)."',pagetext='".addslashes($message)."',allowsmilie=$allowsmilie,email=$email,signature= $signature,iconid=$iconid WHERE postid=$posts[minpost]");

Next goto approx line 154. Look for $DB_site->query("INSERT INTO post ... (continued). The next line with text should say indexthread($threadid);. REPLACE the DB_site line with the following:

$DB_site->query("INSERT INTO post (dept,category,postid,threadid,title,username,user id,dateline,pagetext,allowsmilie,email,signature,i paddress,iconid,visible) VALUES ('".addslashes($dept)."','$category',NULL,$threadid,'','".addslashes($postusername)."',$userid,".time().",'".addslashes($message)."',$allowsmilie,$email,$signature,'$ipaddress',$ico nid,1)");

Finally, goto approx line 227. Look for

if ($foruminfo[newthreadtemplate]!="") {
$usetemplate=$foruminfo[newthreadtemplate];
} else {
$usetemplate="newthread";
}

BETWEEN the } and the else, insert the following:

if ($forumid == $newsforum) {
$usetemplate="newnews";

The result will look like this:


if ($foruminfo[newthreadtemplate]!="") {
$usetemplate=$foruminfo[newthreadtemplate];
}
if ($forumid == $newsforum) {
$usetemplate="newnews";
} else {
$usetemplate="newthread";
}

you are now done with newthread.php. You can save and close it.

3b) Open editpost.php. Scroll to approx line 4. Where it says require ("global.php");. Directly underneath that line, type

require("bfc.php");

Next, goto approx line 54. Look for

if ($foruminfo[edittemplate]!="") {
$usetemplate=$foruminfo[edittemplate];
} else {
$usetemplate="editpost";
}

BETWEEN the } and the else, insert the following:

if ($forumid == $newsforum) {
$usetemplate="editnews";

The result will look like this:

if ($foruminfo[edittemplate]!="") {
$usetemplate=$foruminfo[edittemplate];
}
if ($forumid == $newsforum) {
$usetemplate="editnews";
} else {
$usetemplate="editpost";
}

Next goto approx line 77. Look for $postinfo=$DB_site->query_first("SELECT ... (continued). The next line with text should say $message=htmlspecialchars($postinfo[pagetext]); REPLACE the $postinfo=$DB_site line with the following:

$postinfo=$DB_site->query_first("SELECT dept,category,userid,dateline,title,pagetext,allow smilie,signature,email,iconid FROM post WHERE postid=$postid");

Next goto approx line 81. Look for $posttitle=htmlspecialchars($postinfo[title]);. Directly underneath that line, paste the following 2 lines:

$dept=$postinfo[dept];
$category=$postinfo[category];

Next goto approx line 332. Look for $message=censortext($message);. Directly underneath that line, paste the following line:

$dept=censortext($dept);

Finally, goto approx line 334. Look for $DB_site->query("UPDATE post SET ... (continued). The next line with text should say indexthread($threadid);. REPLACE the $DB_site line with the following:

$DB_site->query("UPDATE post SET dept='".addslashes($dept)."',category='$category',title='".addslashes($title)."',pagetext='".addslashes($message)."',allowsmilie=$allowsmilie,email=$email,signature= $signature,iconid=$iconid WHERE postid=$postid");

You are now done with editpost.php. You can safely save and close it.

3c) Open global.php (the one in the root of your forum, not the one in /admin). Scroll to approx line 682. Look for if ($bbuserid==0) {. Directly ABOVE that line, paste the following:

if(isset($isnews)) {

Then goto approx line 701. Look for if ($displayloggedin==1) {. Directly ABOVE that line, add a }.

You are now done editing global.php. You can safely save and close it. That is all the editing of existing vB files that you will need to do.

4) You should have already downloaded and unpacked the BFC Weblog zip file. If not, please do so now. Open bfc.php in your favorite text editor. You will see several options you can set that will affect the operation of the script. These are mostly self explanitory, but I'll run down them here as well.

The first options you will see are the database connection options. The syntax for the first line is:

$db = mysql_connect("localhost", "username", "password");

If your SQL server is on the same box as your web server you probably will not have to change localhost. Username depends on what you or your provider has set up for you to access mySQL. You may or may not be using passwords, if you do not know, you administrator probably does, contact him or her.

The next line is:

mysql_select_db("forum",$db);

The only thing you might need to change on this line would be the word forum to whatever the name of your vB database is, but forum should be correct by default.

The next line is:

$newsforum = 4;

This one is really important. This is the forum that the script will parse for news. It doesn't matter which forum you choose so long as you reflect the number here. You may also want to consider some access control measures on that forum (as in only Moderators on up can start threads). Otherwise any user will be able to post news which will show up wherever you call the news script...

The next line is:

$timeoffset = 3;

I couldn't really find where vB gets this info from so reflect your timezone offset here. It's the same number so there shouldn't be any problems. I will remove this in a future release.

The next line is:

$forum_url = "http://www.eternityproductions.com/forums";

Put the URL to your forums in the quotes.

The next line is:

$icon_url = "http://www.eternityproductions.com/images/icons";

Put the URL to your BFC icons.

The next line is:

$bfc_newslimit = 15;

The newslimit determines how many stores are diplayed by the news script. This number is totally up to you but I would say err on the side of lower because there could be a great deal of scrolling for larger numbers. Experiment and decide what is best for you!

The next line is:

$bfc_hborder = "#000049";

The headerborder is the color of the border around the table containing the title of each story. You can use a HEX or a named colour, like "red".

The next line is:

$bfc_hshade = "#CCCCCC";

The headershade is the color inside the table containing the title of each story. You can use a HEX or a named colour, like "red".

The next line is:

$bfc_htext = "#000049";

The headertext is the color of the text of the title of each story. You can use a HEX or a named colour, like "red".

Once you have set all these options you can save and close bfc.php.

5) You might want to open news.php to check it out but it should be fine by default. The section that generates the story is very obvious, so you can easily edit it if you need to change any look or feel of the news.

6) Upload the BFC icons to the URL you specified in bfc.php.

7) Upload bfc.php & news.php to your vB directory, or a directory in your php_include path.

8) Upload global.php, newthread.php, & editpost.php.

9) Verify that everything still works ;) then incorporate news.php into another .php page to observe it's output. You can find a simple file to do that in your zip file called callnews.php.

10) (totally optional) Send me an email!. I get a kick out of seeing other people use stuff I've written, that's what keeps me going. So if you like what you're using, or not, let me know.

Right now this is in version 1.0. I still consider it beta thou, so be aware of bugs, lack of features, whatnot. I wrote this in about a week in my spare time and will probably continue to develop it that way since I can't pay the bills with it :). Anyway I hope you like it and that my instructions were clear enough to understand. Feel free to drop me a line.

Credits

I examined Krucifyx's active threads hack extensivly before writing this, and adapted some of that code to this script. The reply counter was especially useful.

If you feel you should be listed here and are not, please email me and we will clear it up.

[Edited by AC-3 on 09-17-2000 at 03:19 PM]

07-20-2000, 08:35 PM
I forgot to add -- you should place news.php and bfc.php in the root of your forum directory to make it work properly.

If you have any questions or suggestions, please feel free to email me (macross@mail.utexas.edu)

[Edited by AC-3 on 07-20-2000 at 05:36 PM]

07-24-2000, 12:05 AM
WOW!

Excellent job AC-3. I've been waiting for a hack like this and I can't wait until I get time to implement it on my forum.

Cameron

08-18-2000, 01:33 AM
have this hack, I tried the link and get a 404 error to the download. Would really like to check it out.

08-27-2000, 04:59 PM
I can't get into the site

09-17-2000, 05:19 AM
Ok what am I missing here. I followed the instruction to the t and I am getting problems. When I post a message to the board it does not truncate anything. The output on the webpage is the full news article. Any help is appreciated.

Yes I did do the

At the prompt, type mysql -u root -pyourpassword forum

you will be presented with a mysql> prompt

type ALTER TABLE post ADD COLUMN dept VARCHAR(255);

you will be presented with a mysql> prompt again

type ALTER TABLE post ADD COLUMN category VARCHAR(50);

type quit

09-17-2000, 06:17 PM
truncated subjects aren't in this release :( I'll probably re do it again with that support in mind.

09-17-2000, 06:29 PM
Excelletn Job!

09-20-2000, 06:31 PM
I see that on your site you added the categories, and the reply, do you think you can post this addon for the hack?
Or anyone know how to do this?
I think the file I need is called category.php andit wasn't included on the hack 1.0 version!
btw here's what I'm talking about:
http://www.eternityproductions.com/category.php

Thanks in Advance

[Edited by conan on 09-20-2000 at 03:34 PM]

09-21-2000, 03:26 PM
Anyone? I would really appreciate anyone's help on this, I cannot get a hold of Paul (the author)
Thanks

09-22-2000, 05:54 AM
sorry, I've been away! I don't really have time to check this site very often...I was kinda suprised to see that anyone had noticed I added categories since I just did it a few days ago.

I'll package it all together in a new release as soon as I have time to clean it and put it together. I'm also gonna rewrite the BFC to use the preexisting vB database stuff to avoid redundancy and hopefully improve performance (although I don't consider it slow now).

Conan, I'll email you the categories file since you seem to be in dire need :)

and I'll try to check this site a little more often :)

Paul

09-22-2000, 05:29 PM
Thanks Paul I appreciate your help, please send it to conan26@onebox.com

01-19-2001, 01:44 PM
Hi there,

I can't access the sample implementation of this hack, can anyone please help? I want to see it in action before I even attempt to install it.

Thanks.

01-19-2001, 03:28 PM
Crude Sample at:

http://sitepointforums.com/news.php

I have also re-written this hack to make it a little more streamlined and customizable.

01-19-2001, 04:04 PM
Are you pulling from just one forum? or all of them?

Does it also work the same when making a news post.

If so can you please let us get your hack.

Thanks

02-02-2001, 10:51 PM
I still can't find it, anyone know a working link, or can sent it to me if they have it?

Thankz!

02-03-2001, 12:37 PM
Here's the link:
http://www.vbulletin.org/hacks/hacks.php?action=gethack&id=41