PDA

View Full Version : PHPNuke to vB Hack


01-02-2001, 05:20 AM
While waiting for 2.0, I've started hacking PHPNuke to integrate with vBulletin. You can look at it at http://www.911pc.com It is very raw and nothing is guaranteed to work. I don't even know PHP, this is just a project to try to learn it a little.

[Edited by wajones on 01-20-2001 at 09:27 AM]

01-02-2001, 11:42 AM
!!!!!!!!!!!!

How'd you get the vB login boxes on the front page??

01-02-2001, 11:46 AM
and the online users bit?

01-02-2001, 11:49 AM
The active users thing was posted before by Eva2k or TT ;)


<?
require("admin/config.php");

$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);

$action = mysql_query("SELECT s.userid, u.username FROM session s, user u WHERE u.userid=s.userid");

while (list($userid, $username) = mysql_fetch_row($action)) {
echo "<a href=\"member.php?getinfo&userid=$userid\">$username</a>";

}

?>

01-02-2001, 12:16 PM
Oh wait vBoard!

That code up there is only for showing logged in users.. not the total members & guests viewing.

Can you give us that code too wajones?

01-02-2001, 12:51 PM
thanks in advance wajones :)

01-02-2001, 01:18 PM
Basically I just started with the vB index.php and stripped out the show forum stuff and added the PHPNuke stuff, copied the login and activeuser templates, rearraged and renamed them, then called them by their new names from the new index page. It's all pretty sloppy right now, but thats all I basically did. Keep it in the same directory as your real vB index that you rename something like forum.php ...

Like I said I really don't know what I'm doing, but I'll be happy to share my misfortunes as I go. Even though the hackers here will probably laugh now and then!!!!

I'm just practicing trial and error until it works, I may buy a book some day????

The hard part is stripping out all the PHPNuke user stuff and putting in vB stuff, Nuke isn't put together very consistantly, every file seems to be different to some degree. It's basically a bunch of hacks by other people put together.

Of course it's easy to critique someone elses work, but I could never do it from scratch!!

01-02-2001, 01:58 PM
I will try to see if I can do something like this.

If you rename the board's index.php doesn't that affect anything?

01-02-2001, 02:08 PM
Originally posted by vBoard.co.uk
I will try to see if I can do something like this.

If you rename the board's index.php doesn't that affect anything?

Yes, you will have to either keep all the index calls such as the signup, login, showsmilies etc. in the new index or rename every call to index.php thru out vb to call the new forum.php.

It's easier to leave everything you can in the new index.php... and just replace the " if ($action=="showforums")" stuff with you own code and make new templates. Then when ever vB makes a call to index.php it's there for it.



[Edited by wajones on 01-02-2001 at 11:25 AM]

01-02-2001, 02:21 PM
okay thanks
I will see where I get to.

01-02-2001, 02:24 PM
You will have to redo most of templates to call forum.php instead of the index.php if you do it this way??? As I said this is a learning experience.

01-02-2001, 02:41 PM
Originally posted by wajones
You will have to redo most of templates to call forum.php instead of the index.php if you do it this way??? As I said this is a learning experience.



Well I am creating a second index and not renaming the board index file as I think creating a second index is easyer then renaming the board one.

But I will rename it after I storred the second index.

I'll look at PHP Nuke and see what I can do with that.

You are trying to remove all registering and loggin on PHP Nuke right?
and then replacing it with vBulletin Loggin code and registering?

If so then PHP Nuke will have to be based on the same dir and database right?

01-02-2001, 02:55 PM
Yes, I removed the Nuke user and Sessions tables from the database and then did a install of vB to the same database. Before I ran the Install Template script I did a replace on all instances of index.php with forum.php. Then put the Nuke files in with the vB files, everything is in the same directories for now so Nuke will use the vB cookies. I'll clean it up later.

BTW... Everyone is invited to chime in with suggestions, the blind is leading the blind here. ;)



[Edited by wajones on 01-02-2001 at 11:58 AM]

01-02-2001, 03:00 PM
Originally posted by wajones
Yes, I removed the Nuke user and Sessions tables from the database and then did a install of vB to the same database. Before I ran the Install Template script I did a replace on all instances of index.php with forum.php. Then put the Nuke files in with the vB files, everything is in the same directories for now so Nuke will use the vB cookies. I'll clean it up later.

BTW... Everyone is invited to chime in with suggestions, the blind is leading the blind here. ;)
[Edited by wajones on 01-02-2001 at 11:58 AM]

I will try to do this as well.
May take me a while.

How many PHP Nuke files did you edit?

01-02-2001, 03:11 PM
Originally posted by vBoard.co.uk
[QUOTE][i]How many PHP Nuke files did you edit?

Almost everyone will have to be edited, most call the user table and or use cookies. Not a small job! Just deleted the Nuke user.php file, not needed any longer.

01-02-2001, 04:00 PM
You said you ripped out if ($action=="showforums") {

How much of that did you rip out?
Can you post from "something" to "something"?
Should I also rip out the if call?: if ($action=="showforums") {

01-02-2001, 07:55 PM
Between the if ($action=="showforums") {
and the close if bracket }. Replace with what ever code you want on your front page. You'll have to play with it to get it the way you want.

01-02-2001, 08:16 PM
thanks :)

Suggestion:
When someone submits news it should make a new thread on the forum and when someone makes a comment it should make a reply to the existing thread.

01-02-2001, 08:36 PM
I have to pass on this one.
Its too hard and I dont get it. :(

01-02-2001, 08:36 PM
Originally posted by vBoard.co.uk
thanks :)

Suggestion:
When someone submits news it should make a new thread on the forum and when someone makes a comment it should make a reply to the existing thread.

That would be cool, but I want to keep the News for News Articles and the forum for discussions and completely separate. The News that I post may well point to a thread, but I'll just use a html link as I need it. I'll be putting the forum threads (Last 10) in one of the side boxes. Otherwise you could use the Weblog code that can be found here on the vB board. Beside's I wouldn't have a clue how to do it. Another way is to use the code that eva2000 uses on his board to display the last 10 postings from the forum.

01-02-2001, 08:39 PM
Originally posted by vBoard.co.uk
I have to pass on this one.
Its too hard and I dont get it. :(

Thats what I thought also, it may very well be for me to, but it's fun trying and learning!!! What can you lose, except a little time.

01-02-2001, 09:31 PM
If you could post info on installing it like others do (ed, freddie.etc) that would be helpful.

But since this isn't released what can I expect this is really a beta or test if you call it that.

I'll wait untill you or someone is 100% sure its ready for release.

Hope this didn't upset you but I do like what you have done but I cant get that far because I dont have the right step by step info.

But thanks anyhow you have showed a great deal of power in yourself doing something that no one else has ever showed us yet when we were promised.

I will try again when you are 100% sure and ready to release. :)

01-04-2001, 05:26 AM
My Nuke to vBulletin Integration is coming along good. I'm redoing it so that PHPNuke will be a drop-in, requiring only the addition of two new templates and adding Nuke globals into vB's header template. Then installing the Nuke tables into your vB database. I'll release a beta soon, when it looks workable (If anyone want's it!), I don't know how long it will take, maybe 2 or 3 weeks.

[Edited by wajones on 01-04-2001 at 02:32 AM]

01-04-2001, 04:44 PM
looks really good!

01-04-2001, 05:08 PM
WOW is this great news wajones and a lot easy! :D

01-08-2001, 06:41 PM
Vote me in! :D I am already using nuke and I am dying to the use the hacks that are on your test site! Those hacks would put the iceing on the cake!

01-08-2001, 07:21 PM
WOW...I'm new to PHP and MySQL and I'm impressed with this PHPNuke....I am a fast learner and can pick this up very quickly and would love to help out with tying this into the forum....
wajones>>> let me know when you are complete...nice site btw.....

01-09-2001, 12:56 PM
Nuke may have many functions but the code is sooooo crappy....

01-09-2001, 01:27 PM
damn....and I was getting excited....thx Menno...but after alot of research it appears alot of patches from 3rd parties have fixed alot of the coding and bugs and they are gonna be implemented in the next version 4.4. So we will see....I'm picking up a book today on PHP....can anyone recommend a decent one?

01-09-2001, 02:08 PM
Originally posted by Menno
Nuke may have many functions but the code is sooooo crappy....

Well, since I'm not a PHP programer and in fact not good at programming anything. soooo I'll never know the difference ;) Beside's if I can get the functionallity of the Nuke addon's and still be able to utilize vB for the important core then I'll be happy.

You are right about the Nuke code being crappy and inconsistant, that's what you get being the code has been pieced together by many different people. But if it works it's a starting point and I haven't seen many offer a front end portal with as much functionallity and ease of installation and use for the price yet.

01-09-2001, 05:27 PM
Yet the code makes it slower... exactly the reason I'm busy coding my own news manager... no messy stuff :)

01-09-2001, 07:50 PM
I just started playing with this and it works great for the purposes I need. I did modify it so it was more tightly integrated with vBulletin.

Full news system in a few lines of code.

<?php

require("global.php");

// Newsforum -- The forum that the script will pull news headlines from. Unless you want all
// your users to be able to update your news, you may want to consider limiting this forum to
// Moderators posting new threads...this is easily done via the vB control panel.

$newsforum = 11;

// News Limit -- How many stories should be displayed?

$bfc_newslimit = 2;

$isnews = 1;
$newsbits="";
$threads=$DB_site->query("SELECT * FROM thread WHERE forumid=$newsforum ORDER BY dateline DESC LIMIT $bfc_newslimit");
while ($thread=$DB_site->fetch_array($threads)) {
$postdate=date($dateformat,$myrow[dateline]+(($timeoffset+$bbtimezoneoffset)*3600));
$posttime=date($timeformat,$myrow[dateline]+(($timeoffset+$bbtimezoneoffset)*3600));
$replycount=$thread[replycount];
$username=$thread[postusername];
$newstitle=$thread[title];
$threadid=$thread["threadid"];
if ($replycount == "0") {
$replies = "";
}
elseif ($replycount == "1") {
$replies = "| (1 Comment)";
}
else {
$replies = "| ($replycount Comments)";
}
$posts=$DB_site->query("SELECT post.userid, pagetext,user.username as username
FROM post LEFT JOIN user ON (post.userid = user.userid)
WHERE threadid=$threadid ORDER BY postid LIMIT 1");
$postinfo=$DB_site->fetch_array($posts);
$userid=$postinfo[userid];
$username=$postinfo[username];
//$dept=$postinfo[dept],
//$category=$posts[category];
$message=bbcodeparse($postinfo[pagetext],$forumid,1);
eval("\$newsbits .= \"".gettemplate("newsbit")."\";");
}

eval("echo dovars(\"".gettemplate("news")."\");");



News Template

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD><TITLE>$bbtitle - $forumtitle</title>
$cssinclude
</head>
<body>
$header
<center>
<table border="0" width="98%" cellpadding="2">
<tr>
<td bgcolor="#FFFFFF">$newsbits</td>
</tr>
</table>
</center>
$footer
</body>
</html>


Newsbit Template:

<table width="{newswidth}" border="0" cellpadding="1" cellspacing="0" bgcolor="#6c6081">
<tr>
<td>
<table width="100%" border="0" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF">
<tr><td valign="middle"><font face="Tahoma, Verdana, Arial" color="#afa3c5"><b>$newstitle</b></font></td></tr>
</table>
</td>
</tr>
</table>
<table width="{newswidth}" border="0" cellpadding="0" cellspacing="0" bgcolor="#EFEFEF">
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td valign="top"><p><b>Posted by: [<a href="member.php?action=mailform&userid=$userid">$username</a>] on $postdate at $posttime</b></tr>
<tr><td valign="top"><p>$message<br><br><smallfont><a href="showthread.php?threadid=$threadid">Read More</a> $replies<br><br></td></tr>
</table>
</td>
</tr>
</table>


I am currently adding more portal like stuff to it but no previews. Of course I have a long way to go to catch up to PHP-Nuke but I like creating my own stuff. It is pretty sparse now but I will be adding to it over the day...

http://sitepointforums.com/news.php

[Edited by wluke on 01-09-2001 at 04:54 PM]

01-09-2001, 08:30 PM
I've played with bcf_weblog and it works really well, but the reason I'm playing with PHPNuke is that there were numerous requests for it and I thought it would be a fun project to try since I know nothing about PHP and want to learn.

Any of you that know PHP well enough to create a hack from scratch would be able to duplicate the functionality of PHPNuke, thats not me, but I haven't seen anything in it to damage the brain yet and there are some really good ideas to be had for any project anyone might be working on.

So I'll continue my project for now, at least till vB 2.0 comes out. ;)

01-09-2001, 08:42 PM
Originally posted by wajones
I've played with bcf_weblog and it works really well, but the reason I'm playing with PHPNuke is that there were numerous requests for it and I thought it would be a fun project to try since I know nothing about PHP and want to learn.

Any of you that know PHP well enough to create a hack from scratch would be able to duplicate the functionality of PHPNuke, thats not me, but I haven't seen anything in it to damage the brain yet and there are some really good ideas to be had for any project anyone might be working on.

So I'll continue my project for now, at least till vB 2.0 comes out. ;)


If it works for you, then go for it. I mainly posted that for those who said they were having a hard time getting things to work. This would be simpler for some people.

I realize you said this was a work in progress but from some comments, it looks like others are looking for polished integration with detailed instructions. It appears you haven't gotten that far yet from your own posts. :)

01-09-2001, 08:59 PM
I've been dying for some integration between the two. I understand that you're just experimenting, but it's something I've been hoping to do myself whenever I got the freetime.

I know there is the weblog hack, but the ability to change views, and other nuke features make it different IMHO. I've got quite a few ideas for Nuke myself, and would love to use Nuke with vB someday.

By the time vBulletin 2.0 comes out, hopefully there will be a PHP Nuke version that has no bugs, isn' soooo slow, and has clean code.

If you're looking for help, you may want to create a sourceforge project. I know there are already a number of Nuke forks, but if you were to post the project, you may be able to get a couple people to help out with a port.

Thanks for the work, keep it up,
-Cameron

[Edited by BassWriters on 01-09-2001 at 06:01 PM]

01-09-2001, 09:14 PM
Heya wluke

Is there a way to limit how much is shown on the news page?

Like limit it to 100 characters or 50 words.. like phpnuke I guess?

Thanks.

01-09-2001, 09:24 PM
Originally posted by wajones
Well, since I'm not a PHP programer and in fact not good at programming anything. soooo I'll never know the difference ;) Beside's if I can get the functionallity of the Nuke addon's and still be able to utilize vB for the important core then I'll be happy.

You are right about the Nuke code being crappy and inconsistant, that's what you get being the code has been pieced together by many different people. But if it works it's a starting point and I haven't seen many offer a front end portal with as much functionallity and ease of installation and use for the price yet. [/B]

I totally agree with you wajones. To me personally, the code is not that slow and have yet to see another portal with that type functionality. I was also planning on integrating vbulletin with nuke but as for now I don't know PHP. I am currently caught up in trying to study for my Cisco certification. After I got to a stopping point, I was planning to teach myself PHP. Nuke optimization was definately on the list also.

Currently I am satisfied with the "crappy code" in it's present state and with the upcomming optimations I would like it even more. By the way, the code is open source. If you don't like it. Change it or don't use it.

01-09-2001, 09:33 PM
BassWriters

Unfortunately the next version of PHPNuke will have PHPBB integrated making it harder to hack for vB, so we may be stuck with the present version.

The problem with the source forge idea, besides vB being a commercial product. I wouldn't have the time or know how to manage such a thingy. Plus I really don't want to make it a career.

So with that... I'll share what I've done as is, as soon as I can figure out "what I've done" and how to package it up with whom ever is interrested. If someone else wants to create and manage a full blown project I'll help as much as I can.

01-09-2001, 09:38 PM
Originally posted by _
Heya wluke

Is there a way to limit how much is shown on the news page?

Like limit it to 100 characters or 50 words.. like phpnuke I guess?

Thanks.

I'm was working on another project with weblog that does that but you have to modify the datadase as I did, or truncate what you show... wluke can probably show you that, I know you can, but don't know how right off.

This is the weblog I'm, or was working on http://www.oldamigos.com/forums/main.php

[Edited by wajones on 01-09-2001 at 06:50 PM]

01-09-2001, 09:56 PM
To limit the amount of characters shown you would do something like:

if (strlen($message) > 160) {
$snippet = substr($message,0,160) . " (<a href=\"".$lastposturl."\">more...</a>)<br>";
} else {
$snippet = $message;
}


Then reference $snippet in the template instead of $message.

01-09-2001, 10:11 PM
great stuff :)

works like a charm - http://animeboards.net/forums/news.php

one problem.. how come the time posted all says

by: [eva2000] on 01-01-1970 at 10:00 AM ?




[Edited by eva2000 on 01-09-2001 at 07:23 PM]

01-09-2001, 10:22 PM
Originally posted by wluke
To limit the amount of characters shown you would do something like:

if (strlen($message) > 160) {
$snippet = substr($message,0,160) . " (<a href=\"".$lastposturl."\">more...</a>)<br>";
} else {
$snippet = $message;
}


Then reference $snippet in the template instead of $message. where in news.php file would you put this ?

01-10-2001, 01:03 AM
Under:
$message=bbcodeparse($postinfo[pagetext],$forumid,1);

01-10-2001, 05:48 AM
Originally posted by wluke
I just started playing with this and it works great for the purposes I need. I did modify it so it was more tightly integrated with vBulletin.

Full news system in a few lines of code.


This is WAY cool! Just what I needed! But why does my news page (http://tournament.com/forums/news.php) and yours (http://sitepointforums.com/news.php) show the time/date as 12-31-1969 at 06:00 PM?

01-11-2001, 03:35 AM
Nathan,

I fixed the date/time problem at t.com.
for those who are interested, here's what i changed:
========
this:
$postdate=date($dateformat,$myrow[dateline]+(($timeoffset+$bbtimezoneoffset)*3600));
$posttime=date($timeformat,$myrow[dateline]+(($timeoffset+$bbtimezoneoffset)*3600));

into this:
$postdate=date($dateformat,$thread[dateline]+(($timeoffset+$bbtimezoneoffset)*3600));
$posttime=date($timeformat,$thread[dateline]+(($timeoffset+$bbtimezoneoffset)*3600));
========

mind you i really don't know php too well so this may not be the best way to do it, but it works.

[Edited by jklbruin on 01-11-2001 at 12:37 AM]

01-11-2001, 04:18 AM
Yeah that is the way it supposed to be done. I must have missed those two rows when I was changing the variable names from the original to more vB-Like names.

01-12-2001, 12:50 PM
I was going to attempt this with very little skill but looks like you guys have already done so with success and I like it! Is it possible for me to get in on this? I am already upgraded to v.1.1.5 so that should help. THanks again guys.

01-15-2001, 04:38 AM
i've seen quite a bit of website with the same layout as this one

http://www.purecrap.com/nuke2vb/

any idea on how the layout was made?? like all of them has this poll on the right, news in the middle, sitemap links on the left (the news are showed the same way, all with the readmore and comment function) a search, and a login command......

since i'm going to be a webamster soon too..i'm just wondering if anyone could share their 2 cents and tell me how this is made?

01-15-2001, 08:55 AM
any idea on how the layout was made??

Powered by http://www.phpnuke.org ;)

[Edited by PeF on 01-15-2001 at 05:57 AM]

01-15-2001, 10:06 PM
oh cool! thx :)