Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases

Reply
 
Thread Tools
Details »»

Version: , by Dave# Dave# is offline
Developer Last Online: Jan 2017 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 09-24-2001 Last Update: Never Installs: 2
 
No support by the author.

Synopsis

This hack allows webmaster to provide syndicated VB content to other webmasters such as Latest topics, Latest Polls or calendar entries to other webmasters for inclusion on their websites. The webmasters using the feeds do NOT need PHP, PERL, MYSQL, ASP just a javascript enabled browser.

Requirements

* Crontab
* The ability to run PHP via the command line

Example

http://cpfc.org/news/newsfeed.html

Please note the documentation is sketchy and if your aren't savvy with hacking code yourself then maybe you should wait until the documentation is up to speed.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #32  
Old 10-06-2001, 10:23 PM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
<?php

//Offer somewhere on your site for users to get the following code
//<script language="JavaScript" src="http://yourdomain/forums/latest_topics.js"></script>
//Crontab? i recommend using lynx as it will always work
//10 * * * * /usr/bin/lynx -dump [url]http://urltoyourboard/newsfeed.php[/url]
//Based on hack by Dave Campbell ([url]www.cpfc.org[/url])
//Modified by Scott MacVicar (software@pp-network.com)
//
//Note you made need to create a latest_topics.js file in your forums directory and chmod to 666.

$bburl="http://url.com/to/forums";

//load config
require("./admin/config.php");

// init db **********************
// load db class
$dbclassname="./admin/db_$dbservertype.php";
require(
$dbclassname);

$DB_site=new DB_Sql_vb;

$DB_site->appname="vBulletin Control Panel";
$DB_site->appshortname="vBulletin (cp)";
$DB_site->database=$dbname;
$DB_site->server=$servername;
$DB_site->user=$dbusername;
$DB_site->password=$dbpassword;

$DB_site->connect();
// end init db
//below is the variable for number of topics to show
$num_active 10;

//Get forums which normal users can view
$forums=$DB_site->query("SELECT forumid FROM forum");
while (
$forum=$DB_site->fetch_array($forums)) {
  
$fperms=$DB_site->fetch_array($DB_site->query("SELECT canview,forumid FROM forumpermission WHERE usergroupid='1' AND forumid='$forum[forumid]'"));
  if(
$fperms["canview"] == 1) {
    
//can view forum
    
$forumperms[]=$forum["forumid"];
  }
  elseif(!isset(
$fperms["canview"])) {
    
$forumperms[]=$forum["forumid"];
    
//forumpermission doesn't exist for this forum
  
}
}
$DB_site->free_result($forums);
unset(
$forum);
unset(
$fperms);

if(!empty(
$forumperms)) {
  
$forumperms='AND forumid='.implode(' OR forumid=',$forumperms);
}

//Get the latest threads which are open
$query=$DB_site->query("SELECT * FROM thread WHERE open='1' $forumperms ORDER BY lastpost DESC LIMIT $num_active");

$fp fopen("latest_topics.js""w");
@
flock($fp2);
while (
$latest=$DB_site->fetch_array($query)) {
  
$threadid=$latest["threadid"];
  
$title=$latest["title"];
  
$date=date("h:i A"$latest["lastpost"]);
  
$replys=$latest["replycount"];
  if (
$replys==1) {
    
$replytext "reply \\?";
  }
  else {
    
$replytext "replies \\?";
  }
  
fputs($fp"document.write(\"<font face='Verdana, arial' size='1'><B><font color='#FF0000'>\\?</FONT><a href='$bburl/showthread.php?threadid=$threadid'>$title</B><br></a>$replys $replytext <a href='$bburl/showthread.php?threadid=$threadid'>Read more</a><BR>Last Updated: $date<br></font>\");\n");
}
@
fclose($fp);

?>
the above code is working fine on the version of vBulletin i administor. It was taken straight from the file couple minutes ago and we're using it without problems.
Reply With Quote
  #33  
Old 10-06-2001, 10:37 PM
Steve Machol's Avatar
Steve Machol Steve Machol is offline
 
Join Date: Nov 2001
Posts: 1,896
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks but I'm still having the same problem. The latest_topics.js file is messed up. After running this, the first line always begins with:

ument.write

...instead of:

document.write

I'm going to check the code again.

[Edit: I checked but can't find any reason for this to happen. Again it's the first line only. All subsequent lines print out fine.]
Reply With Quote
  #34  
Old 10-07-2001, 01:45 AM
YourHostSucks
Guest
 
Posts: n/a
Default

I tried to use: /usr/bin/php -q /path/to/htdocs/newsfeed.cgi

It seems to execute the file now, but I get a parse error...
---------
<br>
<b>Parse error</b>: parse error in <b>/home/********/********/******/newsfeed.cgi</b> on line <b>73</b><br>
---------

Line 72, 73, 74:
}
else {
$replytext = "replies \\?;

----------

Thanks for your help.
Reply With Quote
  #35  
Old 10-07-2001, 01:53 AM
Steve Machol's Avatar
Steve Machol Steve Machol is offline
 
Join Date: Nov 2001
Posts: 1,896
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why did you change this from newsfeed.php to newsfeed.cgi? Does your PHP parse CGI files?
Reply With Quote
  #36  
Old 10-07-2001, 02:08 AM
YourHostSucks
Guest
 
Posts: n/a
Default

I changed it because of what PPN said..

Quote:
if you can't use lynx use this

change newsfeed.php to newsfeed.cgi and at the top add #!/usr/bin/php

this is my presuming the path to your PHP

then add the following cronjob

/usr/bin/php -q /path/to/htdocs/newsfeed.cgi


Quote:
Does your PHP parse CGI files?
I hope it does.. It does not have a problem until line 73..
*shrug*


<- feeling sad, finally get cron to do something.. now this error(hehe)


Thanks for your fast reply..
Reply With Quote
  #37  
Old 10-07-2001, 02:17 AM
Steve Machol's Avatar
Steve Machol Steve Machol is offline
 
Join Date: Nov 2001
Posts: 1,896
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah, ok. I didn't see that. Doesn't your server have lynx installed?
Reply With Quote
  #38  
Old 10-07-2001, 02:21 AM
YourHostSucks
Guest
 
Posts: n/a
Default

Yes it does, but when I use it.. (lynx - dump or lynx)
I get this error:

Your terminal lacks the ability to clear the screen or position the cursor.


Reply With Quote
  #39  
Old 10-08-2001, 06:35 PM
Dave# Dave# is offline
 
Join Date: Nov 2001
Posts: 82
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by YourHostSucks
Yes it does, but when I use it.. (lynx - dump or lynx)
I get this error:

Your terminal lacks the ability to clear the screen or position the cursor.


You might have to run it as root

PPN - Good work
Reply With Quote
  #40  
Old 10-08-2001, 11:51 PM
YourHostSucks
Guest
 
Posts: n/a
Default

I have tried:

--------------------------------------------------------------------------------

root /home/********/*******l/******/newsfeed.php

error:

/bin/sh: root: command not found

-------------------------------------------------------------------------------

I have no clue why but I tried:

GET http://forums.yourhostsucks.com/newsfeed.php

Error:

<br>
<b>Parse error</b>: parse error in <b>/home/yourhost/public_html/forums/newsfeed.php</b> on line <b>72</b><br>

-------------------------------------------------------------------------------

/usr/bin/php -q /home/******/*********/*******/newsfeed.cgi

Error:

<br>
<b>Parse error</b>: parse error in <b>/home/********/********/******/newsfeed.cgi</b> on line <b>73</b><br>

Note: it is line 73 because I added #!/usr/bin/php at the top.

---------------------------------------------------------------------------------

I tried a couple others with no luck as well..

EX: GET http://forums.yourhostsucks.com/newsfeed.php > /dev/null

Tried to use nice, etc..




Any Ideas?

Thanks!
Reply With Quote
  #41  
Old 10-09-2001, 12:45 AM
Steve Machol's Avatar
Steve Machol Steve Machol is offline
 
Join Date: Nov 2001
Posts: 1,896
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

[QUOTE]Originally posted by YourHostSucks
I have tried:

--------------------------------------------------------------------------------

root /home/********/*******l/******/newsfeed.php

error:

/bin/sh: root: command not found
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:17 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06693 seconds
  • Memory Usage 2,319KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (7)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete