diff -u -r -N yasuck-0.0.9/docs/ChangeLog yasuck-0.1.0/docs/ChangeLog --- yasuck-0.0.9/docs/ChangeLog 2005-07-17 15:08:33.000000000 -0500 +++ yasuck-0.1.0/docs/ChangeLog 2005-10-08 01:19:25.000000000 -0500 @@ -2,8 +2,21 @@ # Copyright (c)2004 badpenguins.com; Distributed under the GPL v2 # +*yasuck-0.1.0 (08 Oct 2005) + *yasuck-0.0.9 (17 Jul 2005) + 08 Oct 2005; Mike Green docs/ChangeLog, + docs/README, includes/app.functions.php, includes/globals.php, yasuck, + patch-0.0.9-01: + + Added quoting to all define() statements. Added --exporthtml function that + will dump html copies of posts to a spool directory for spidering. + Converted nntpSpoolLog() and nntpSpoolUnlock to generic spoolLock() and + spoolUnlock() functions. Fixed bug in runUpgrades(), was not returning + false if checkDatabase() failed. Probably need to fix this elsewhere. + Bumped version to 0.1.0. + *yasuck-0.0.8 (5 Jan 2005) 17 Jul 2005: Mike Green docs/ChangeLog, diff -u -r -N yasuck-0.0.9/docs/README yasuck-0.1.0/docs/README --- yasuck-0.0.9/docs/README 2005-01-06 23:34:26.000000000 -0600 +++ yasuck-0.1.0/docs/README 2005-10-08 02:24:19.000000000 -0500 @@ -50,3 +50,30 @@ If using newsd, set define(NNTP_USE_NEWSD,true) to automatically create .config and update .info files in spool directories so that updates will be reflected to the client. + +NOTES ON HTML EXPORT FUNCTIONALITY + +yasuck --exporthtml board_name will dump all messages from the +database that do not already exist in the spool directory. If messages +are present in the spool directory, --exportthml will start where the +existing messages left off. The export will be done in chunks of +10000 messages to account for machines with low resources. + +The spool directory is set by defining HTML_EXPORT_DIR in globals.php. +If HTML_EXPORT_DIR is not defined the message will be dumped into the +current working directory. + +The messages will be created in a simple html format that is more +intended for spiders than humans. + +If LICENSE_TEXT is defined in globals.php, a licensing blurb will be +appended to the dumped html messages. LICENSE_TEXT should short, such +as "Contact Author" or "CCL Non-Commercial Share-Alike". + +Limited meta tags (content and keywords) can be added on a per board +basis by editing the $META array in globals.php. + +Note that --exporthtml is not the same as --dumphtml. The --dumphtml +argument is for debugging purposes, it dumps the raw html copy of +posts as they are retrieved. + diff -u -r -N yasuck-0.0.9/includes/app.functions.php yasuck-0.1.0/includes/app.functions.php --- yasuck-0.0.9/includes/app.functions.php 2005-07-17 17:14:16.000000000 -0500 +++ yasuck-0.1.0/includes/app.functions.php 2005-10-08 02:31:29.000000000 -0500 @@ -19,7 +19,7 @@ $arg = $args[$j]; switch($arg) { case "--debug": - define(DEBUG,true); + define('DEBUG',true); break; case "--drop": if (defined('ACTION')) { return false; } @@ -28,18 +28,18 @@ $board = $args[$j]; if (empty($board)) { return false; } if (substr($board,0,2) == "--") { return false; } - define(ACTION,"drop"); - define(BOARD,$board); + define('ACTION',"drop"); + define('BOARD',$board); return true; break; case "--dryrun": - define(DRYRUN,true); + define('DRYRUN',true); break; case "--dumphtml": - define(DUMPHTML,true); + define('DUMPHTML',true); break; case "--dumpnntp": - define(DUMPNNTP,true); + define('DUMPNNTP',true); break; case "--end": if (defined('END')) { return false; } @@ -48,7 +48,17 @@ if (empty($end)) { return false; } if (substr($end,0,2) == "--") { return false; } if (!is_numeric($end)) { return false; } - define(END,$end); + define('END',$end); + break; + case "--exporthtml": + if (defined('ACTION')) { return false; } + if (defined('BOARD')) { return false; } + $j++; + $board = $args[$j]; + if (empty($board)) { return false; } + if (substr($board,0,2) == "--") { return false; } + define('ACTION',"exporthtml"); + define('BOARD',$board); break; case "--exportnntp": if (defined('ACTION')) { return false; } @@ -57,8 +67,8 @@ $board = $args[$j]; if (empty($board)) { return false; } if (substr($board,0,2) == "--") { return false; } - define(ACTION,"exportnntp"); - define(BOARD,$board); + define('ACTION',"exportnntp"); + define('BOARD',$board); break; case "--get": if (defined('ACTION')) { return false; } @@ -67,16 +77,16 @@ $board = $args[$j]; if (empty($board)) { return false; } if (substr($board,0,2) == "--") { return false; } - define(ACTION,"get"); - define(BOARD,$board); + define('ACTION',"get"); + define('BOARD',$board); break; case "--help": - define(ACTION,"help"); + define('ACTION',"help"); return true; break; case "--init": if (defined('ACTION')) { return false; } - define(ACTION,"init"); + define('ACTION',"init"); return true; break; case "--listmissing": @@ -86,8 +96,8 @@ $board = $args[$j]; if (empty($board)) { return false; } if (substr($board,0,2) == "--") { return false; } - define(ACTION,"listmissing"); - define(BOARD,$board); + define('ACTION',"listmissing"); + define('BOARD',$board); return true; break; case "--merge": @@ -101,9 +111,9 @@ $mergedb = $args[$j]; if (empty($mergedb)) { return false; } if (substr($mergedb,0,2) == "--") { return false; } - define(ACTION,"merge"); - define(BOARD,$board); - define(MERGEDB,$mergedb); + define('ACTION',"merge"); + define('BOARD',$board); + define('MERGEDB',$mergedb); break; case "--plugholes": if (defined('ACTION')) { return false; } @@ -112,19 +122,19 @@ $board = $args[$j]; if (empty($board)) { return false; } if (substr($board,0,2) == "--") { return false; } - define(ACTION,"resuck"); - define(BOARD,$board); + define('ACTION',"resuck"); + define('BOARD',$board); break; case "--poster": $j++; $text = $args[$j]; if (empty($text)) { return false; } if (substr($text,0,2) == "--") { return false; } - define(AUTHOR_SEARCH,true); - define(AUTHOR_TEXT,$text); + define('AUTHOR_SEARCH',true); + define('AUTHOR_TEXT',$text); break; case "--quiet": - define(QUIET,true); + define('QUIET',true); break; case "--recs": if (defined('ACTION')) { return false; } @@ -136,13 +146,13 @@ $j++; $text = $args[$j]; if ("$text" == "all") { - define(RECSALL,true); + define('RECSALL',true); } else { - define(RECSALL,false); + define('RECSALL',false); $j--; } - define(ACTION,"refreshrecs"); - define(BOARD,$board); + define('ACTION',"refreshrecs"); + define('BOARD',$board); break; case "--refresh": if (defined('ACTION')) { return false; } @@ -151,16 +161,16 @@ $board = $args[$j]; if (empty($board)) { return false; } if (substr($board,0,2) == "--") { return false; } - define(ACTION,"refreshstats"); - define(BOARD,$board); + define('ACTION',"refreshstats"); + define('BOARD',$board); break; case "--sanity": if (defined('ACTION')) { return false; } - define(ACTION,"sanity"); + define('ACTION',"sanity"); return true; break; case "--skipmsgs": - define(SKIPMSGS,true); + define('SKIPMSGS',true); break; case "--start": if (defined('START')) { return false; } @@ -169,7 +179,7 @@ if (empty($start)) { return false; } if (substr($start,0,2) == "--") { return false; } if (!is_numeric($start)) { return false; } - define(START,$start); + define('START',$start); break; case "--status": if (defined('ACTION')) { return false; } @@ -178,16 +188,16 @@ $board = $args[$j]; if (empty($board)) { return false; } if (substr($board,0,2) == "--") { return false; } - define(ACTION,"status"); - define(BOARD,$board); + define('ACTION',"status"); + define('BOARD',$board); break; case "--subject": $j++; $text = $args[$j]; if (empty($text)) { return false; } if (substr($text,0,2) == "--") { return false; } - define(SUBJECT_SEARCH,true); - define(SUBJECT_TEXT,$text); + define('SUBJECT_SEARCH',true); + define('SUBJECT_TEXT',$text); break; case "--unlock": if (defined('ACTION')) { return false; } @@ -196,13 +206,13 @@ $board = $args[$j]; if (empty($board)) { return false; } if (substr($board,0,2) == "--") { return false; } - define(ACTION,"unlock"); - define(BOARD,$board); + define('ACTION',"unlock"); + define('BOARD',$board); return true; break; case "--version": if (defined('ACTION')) { return false; } - define(ACTION,"version"); + define('ACTION',"version"); return true; break; default: @@ -341,7 +351,7 @@ echo $msg; return true; - + } /***************************************************************************** @@ -444,7 +454,13 @@ if (!is_array($page) or !is_numeric($message_id)) { return false; } -$file = "$message_id.html"; +if (defined('HTML_EXPORT_DIR') and is_dir(HTML_EXPORT_DIR) and + is_writable(HTML_EXPORT_DIR)) { + $file = HTML_EXPORT_DIR . "/$message_id.html"; + } else { + $file = "$message_id.html"; + } + if (!$fd = fopen($file,"w")) { echo "WARNING: cannot open file: $file\n"; return false; @@ -467,7 +483,6 @@ } - /***************************************************************************** * * *****************************************************************************/ @@ -561,11 +576,12 @@ $msg = "Usage: $fname action args [--start msg] [--end msg] --debug Turn on verbose debug messages - --drop BOARD Drop/Purge BOARD out of the database + --drop BOARD Drop/Purge BOARD out of the database --dryrun Fetch only, NO database message insert/updates - --dumphtml Dump copy of pages as they are retrieved (in CWD) + --dumphtml Dump raw copy of pages as they are retrieved (in CWD) --dumpnntp Dump copy of pages to nntp spool --end MSG End with message number MSG (optional) + --exporthtml BOARD Export BOARD messages from db to html --exportnntp BOARD Export BOARD messages from db to NNTP --get BOARD Retrieve messages from board BOARD --help Display this help message @@ -592,6 +608,353 @@ /***************************************************************************** * * *****************************************************************************/ +function htmlCreateMessage($msg_ar='') { + +if (defined('DRYRUN') and DRYRUN === true) { return true; } + +if (!is_array($msg_ar)) { + echo "ERROR: invalid array passed to htmlCreateMessage()\n"; + return false; + } + +global $META; + +$msg_id = $msg_ar['message_id']; +$msg_poster = stripslashes($msg_ar['poster_name']); +$board_id = $msg_ar['board_id']; +$board_name = $msg_ar['board_name']; +$ticker_id = $msg_ar['ticker_id']; +$parent_id = $msg_ar['parent_id']; +$thread_id = $msg_ar['thread_id']; +$msg_date = $msg_ar['message_date']; +$msg_subject = stripslashes($msg_ar['message_subject']); +$msg_recs = $msg_ar['message_recs']; +$msg_text = wordwrap(stripslashes($msg_ar['message_text']),70,"\n"); + +if (!is_numeric($msg_id)) { + echo "ERROR: invalid msg_id: $msg_id\n"; + return false; + } +if ($msg_poster == '') { + echo "ERROR: invalid msg_poster\n"; + return false; + } +if (!is_numeric($board_id)) { + echo "ERROR: invalid board_id: $board_id\n"; + return false; + } +if (!is_numeric($parent_id)) { + echo "ERROR: invalid parent_id: $parent_id\n"; + return false; + } +if ($msg_date == '') { + echo "ERROR: invalid msg_date\n"; + return false; + } +if (!is_numeric($msg_recs)) { + echo "ERROR: invalid msg_recs: $msg_recs\n"; + return false; + } +if ($board_name == '') { + echo "ERROR: no board name specified\n"; + return false; + } +if (!htmlSpoolCheck($board_name)) { + echo "ABORT: htmlSpoolCheck() failed\n"; + return false; + } +if (!$spool_dir = htmlSpoolDirName($board_name)) { + echo "ABORT: could not determine spool directory\n"; + return false; + } +$date_str = date("d M Y H:i:s -0600",strtotime($msg_date)); + +$outfile = "$spool_dir/$msg_id.html"; + +if (defined('LICENSE_TEXT') and LICENSE_TEXT !== '') { + $line = str_repeat("-",60); + $lic = "The text of this Yahoo Message Board post has been licensed"; + $lic .= " for copying and distribution by the Yahoo Message Board "; + $lic .= "user \"$msg_poster\" under the following license:"; + $msg_text .= "
\n
\n
\n$line
\n"; + $msg_text .= wordwrap($lic,70,"
"); + $msg_text .= "

License: " . LICENSE_TEXT; + $msg_text .= "
$line"; + } + +// set up meta tags if they exist. +$meta_desc = ''; +$meta_keys = ''; +if (is_array($META) and array_key_exists($board_name,$META)) { + if (array_key_exists('description',$META[$board_name])) { + $meta_desc = "\n"; + } + if (array_key_exists('keywords',$META[$board_name])) { + $meta_keys = "\n"; + } + } + +$output = "\n"; +$output .= "\n"; +$output .= "$board_name MSGID: $msg_id\n"; +$output .= $meta_desc; +$output .= $meta_keys; +$output .= "\n"; +$output .= "\n"; +$output .= "Message ID: $msg_id
\n"; +$output .= "Posted By: $msg_poster
\n"; +$output .= "Posted On: $msg_date
\n"; +$output .= "Subject: $msg_subject
\n"; +$output .= "Recs: $msg_recs
\n
\n"; +$msg_text = str_replace("
","
\n",$msg_text); +$output .= $msg_text; +$output .= "\n\n"; +$output .= ""; + +if (!$fd = fopen($outfile,'w')) { + echo "ERROR: cannot open file $outfile\n"; + return false; + } + +set_file_buffer($fd,0); +if (!fwrite($fd,$output)) { + echo "ERROR: failed to write message\n"; + fclose($fd); + return false; + } +fclose($fd); + +echo "created: $outfile\n"; + +return true; + +} + +/***************************************************************************** + * * + *****************************************************************************/ +function htmlExport($board_name='',$start='',$end='') { + +if (defined('DRYRUN') and DRYRUN === true) { return true; } + +if ($board_name == '') { + echo "What board do you want to export to html?\n"; + return false; + } +if (!checkDatabase()) { + echo "checkDatabase() failure\n"; + return false; + } +// create the board if it does not exist +$info_ar = queryBoardInfo($board_name,true); +if ($info_ar === false or !is_array($info_ar)) { + echo "queryBoardInfo() failed\n"; + return false; + } else { + $board_id = $info_ar['board_id']; + $ticker_id = $info_ar['ticker_id']; + } + +if (!htmlSpoolCheck($board_name)) { + echo "ABORT: htmlSpoolCheck() failed\n"; + return false; + } + +if (! $spool_dir = htmlSpoolDirName($board_name)) { + echo "ABORT: could not determine spool directory\n"; + return false; + } + +// determine start/stop +if (!is_numeric($start)) { + if (! $start = htmlGetLastMsgId($spool_dir)) { + echo "ABORT: could not determine last msg id\n"; + return false; + } + if (!is_numeric($start)) { + echo "ABORT: could not determine last msg id\n"; + return false; + } + echo "INFO: starting at $start\n"; + } + +$sql = "select count(message_id), min(message_id), max(message_id) "; +$sql .= "from message_ids where board_id=$board_id "; +if (is_numeric($start)) { + $sql .= "and message_id >= $start "; + } +if (is_numeric($end)) { + $sql .= "and message_id <= $end "; + } +$sql .= "order by message_id"; +if (!$qid = db_query($sql)) { + echo "ABORT: cannot retrieve message list: $sql\n"; + return false; + } + +$hits = db_result($qid,0,0); +$min = db_result($qid,0,1); +$max = db_result($qid,0,2); +db_free_result($qid); + +if ($hits < 1) { + echo "INFO: No messages to export\n"; + return true; + } + +if (!is_numeric($start)) { $start = $min; } +if (!is_numeric($end)) { $end = $max; } + +if ($hits > 10000) { + while($hits >= 1) { + $hits -= 10000; + $end = $start + 10000; + if (!htmlExport($board_name,$start,$end)) { + echo "ABORT: failed board: $board_name start: $start end: $end\n"; + return false; + } + $start += 10000; + } + return true; + } + +// Figure out where to start/end if it was not specified on command line. +$sql = "select message_id from message_ids "; +$sql .= "where board_id=$board_id "; +$sql .= "and message_id >= $start "; +$sql .= "and message_id <= $end "; +$sql .= "order by message_id "; +$sql .= "limit 10000"; + +if (!$qid = db_query($sql)) { + echo "ABORT: cannot retrieve message list: $sql\n"; + return false; + } +$num = db_num_rows($qid); +if ($num < 1) { + echo "INFO: No messages to export\n"; + return true; + } + +$LOCK = "$spool_dir/.LCK"; +if (!spoolLock($LOCK)) { return false; } + +$msg_ar = array(); +for($j=0; $j < $num; $j++) { + $msg_ar[] = db_result($qid,$j,0); + } +db_free_result($qid); + +$start = $msg_ar[0]; +$end = $msg_ar[(count($msg_ar) - 1)]; + +echo "Exporting messages to html: Board($board_name) Start($start) End($end)\n"; +foreach($msg_ar as $j) { + $sql = "select a.poster_name,b.message_id,b.board_id,b.parent_id,"; + $sql .= "b.thread_id,b.message_date,b.message_subject,b.message_recs "; + $sql .= ", b.message_text "; + $sql .= "from poster_ids as a, message_ids as b "; + $sql .= "where b.board_id=$board_id and b.message_id=$j and "; + $sql .= "b.poster_id=a.poster_id "; + $sql .= "limit 1"; + if (!$qid = db_query($sql)) { + echo "ABORT: query failure\n"; + spoolUnlock($LOCK); + return false; + } + $row_ar = db_fetch_array($qid); + $row_ar['board_name'] = $board_name; + $row_ar['ticker_id'] = $ticker_id; + if (!htmlCreateMessage($row_ar)) { + echo "ABORT: failed to export msgid $j\n"; + spoolUnlock($LOCK); + return false; + } + } + +if (!spoolUnlock($LOCK)) { return false; } + +return true; + +} + +/***************************************************************************** + * * + *****************************************************************************/ +function htmlGetLastMsgId($spool_dir='') { + +if (!is_dir($spool_dir)) { return false; } + +$max = 0; +if (!$dh = opendir($spool_dir)) { + echo "ERRROR: could not open spool: $spool_dir\n"; + return false; + } +while ( false !== ($file = readdir($dh))) { + $junk_ar = explode('.',$file); + if (is_numeric($junk_ar[0]) and ($junk_ar[0] > $max)) { + $max = $junk_ar[0]; + } + } +closedir($dh); + +return $max + 1; + +} + +/***************************************************************************** + * * + *****************************************************************************/ +function htmlSpoolCheck($board_name='') { + +if (! $spool_dir = htmlSpoolDirName($board_name)) { return false; } +if ($spool_dir == './') { return true; } + +$spool_dir = addslashes($spool_dir); + +if (!is_dir($spool_dir)) { + $tmp_ar = explode("/",$spool_dir); + $junk = array_shift($tmp_ar); + $dir_str = ''; + foreach($tmp_ar as $dir) { + $dir_str .= "/${dir}"; + if (!is_dir($dir_str)) { + if (!mkdir($dir_str,0755)) { + echo "ERROR: could not create dir: $dir_str\n"; + return false; + } + } + } + echo "INFO: created html spool directory: $spool_dir\n"; + } + +return true; + +} + +/***************************************************************************** + * * + *****************************************************************************/ +function htmlSpoolDirName($board_name='') { + +if ($board_name == '') { + echo "ERROR: no board name fed to htmlSpoolDirName()"; + return false; + } + +if (!defined('HTML_EXPORT_DIR') or HTML_EXPORT_DIR == '') { + return "./"; + } + +return HTML_EXPORT_DIR . "/" . "${board_name}"; + +} + +/***************************************************************************** + * * + *****************************************************************************/ function initializeBoard($board_name='') { if (defined(DRYRUN) and DRYRUN === true) { return true; } @@ -1319,7 +1682,8 @@ return true; } -if (!nntpSpoolLock($board_name)) { +$LOCK = "$spool_dir/.LCK"; +if (!spoolLock($LOCK)) { return false; } @@ -1345,7 +1709,7 @@ $sql .= "limit 1"; if (!$qid = db_query($sql)) { echo "ABORT: query failure\n"; - nntpSpoolUnlock($board_name); + spoolUnlock($LOCK); return false; } $row_ar = db_fetch_array($qid); @@ -1353,12 +1717,12 @@ $row_ar['ticker_id'] = $ticker_id; if (!nntpCreateMessage($row_ar)) { echo "ABORT: failed to export msgid $j\n"; - nntpSpoolUnlock($board_name); + spoolUnlock($LOCK); return false; } } -if (!nntpSpoolUnlock($board_name)) { return false; } +if (!spoolUnlock($LOCK)) { return false; } return true; @@ -1474,54 +1838,13 @@ /***************************************************************************** * * *****************************************************************************/ -function nntpSpoolLock($board_name='') { - -if (!$spool_dir = nntpSpoolDirName($board_name)) { - echo "ERROR: cannot locate spool dir to lock board $board_name\n"; - return false; - } - -$LOCK = "$spool_dir/.LCK"; -if (is_file($LOCK)) { - echo "ABORT: lock file exists: $LOCK\n"; - return false; - } - -if (!$fd = fopen($LOCK,'w')) { - echo "ABORT: could not create lock file: $LOCK\n"; - return false; - } else { - fclose($fd); - } - -return true; - -} - -/***************************************************************************** - * * - *****************************************************************************/ -function nntpSpoolUnlock($board_name='') { - -if (!$spool_dir = nntpSpoolDirName($board_name)) { - echo "ERROR: cannot locate spool dir to lock board $board_name\n"; - return false; - } -$LOCK = "$spool_dir/.LCK"; - -return unlink($LOCK); - -} - -/***************************************************************************** - * * - *****************************************************************************/ function nntpUpdateSpool($board_name='') { if ($board_name == '') { return false; } if (! $spool_dir = nntpSpoolDirName($board_name)) { return false; } -if (!nntpSpoolLock($board_name)) { return false; } +$LOCK = "$spool_dir/.LCK"; +if (!spoolLock($LOCK)) { return false; } $ctr = 0; $low = 99999999; @@ -1529,7 +1852,7 @@ if (!$dh = opendir($spool_dir)) { echo "INFO: could not update newsd spool directory: $spool_dir\n"; - nntpSpoolUnlock($board_name); + spoolUnlock($LOCK); return false; } while ( false !== ($file = readdir($dh))) { @@ -1547,18 +1870,18 @@ $info = "$spool_dir/.info"; if (!$fh = fopen($info,'w')) { echo "INFO: could not update $info\n"; - nntpSpoolUnlock($board_name); + spoolUnlock($LOCK); return false; } if (!fwrite($fh,$text)) { echo "ERROR: could not update $info\n"; fclose($fh); - nntpSpoolUnlock($board_name); + spoolUnlock($LOCK); return false; } fclose($fh); -nntpSpoolUnlock($board_name); +spoolUnlock($LOCK); return true; @@ -2408,7 +2731,7 @@ // verify message_recs column exists when upgrading from // 0.0.4 -checkDatabase(); +if (checkDatabase() === false) { return false; } $has_recs = false; $fields = db_list_fields(DBN,"message_ids"); $columns = db_num_fields($fields); @@ -2611,6 +2934,42 @@ /***************************************************************************** * * *****************************************************************************/ +function spoolLock($lock_file='') { + +if ($lock_file == '') { return false; } +$lock_file = addslashes($lock_file); + +if (is_file($lock_file)) { + echo "ABORT: lock file exists: $lock_file\n"; + return false; + } + +if (!$fd = fopen($lock_file,'w')) { + echo "ABORT: could not create lock file: $lock_file\n"; + return false; + } else { + fclose($fd); + } + +return true; + +} + +/***************************************************************************** + * * + *****************************************************************************/ +function spoolUnlock($lock_file='') { + +if ($lock_file == '') { return false; } +$lock_file = addslashes($lock_file); + +return unlink($lock_file); + +} + +/***************************************************************************** + * * + *****************************************************************************/ function suckMessages($board_name='',$start='',$end='') { if ($board_name == '') { diff -u -r -N yasuck-0.0.9/includes/globals.php yasuck-0.1.0/includes/globals.php --- yasuck-0.0.9/includes/globals.php 2005-07-17 15:00:24.000000000 -0500 +++ yasuck-0.1.0/includes/globals.php 2005-10-08 02:35:22.000000000 -0500 @@ -7,46 +7,59 @@ if (basename($PHP_SELF) == basename(__FILE__)) { die("Access Denied\n"); } // database settings -define(DBH,"localhost"); -define(DBN,"yasuck"); -define(DBU,"webuser"); -define(DBP,"webuser"); +define('DBH',"localhost"); +define('DBN',"yasuck"); +define('DBU',"webuser"); +define('DBP',"webuser"); // path settings -define(ROOTDIR,"/usr/local/yasuck"); -define(INCDIR,ROOTDIR . "/includes"); -define(DBINCLUDE,"mysql.functions.php"); +define('ROOTDIR',"/usr/local/yasuck"); +define('INCDIR',ROOTDIR . "/includes"); +define('DBINCLUDE',"mysql.functions.php"); // board settings -define(USER_AGENT,'Mozilla/5.0 (compatible; Konqueror/3.3; phpcli)'); -define(YAHOOHOST,'finance.messages.yahoo.com'); -define(YAHOO_RED_HOST,'us.rd.yahoo.com'); -define(YAHOO_POST_HOST,'post.messages.yahoo.com'); -define(SOCKTIMEOUT,10); -define(FETCHSLEEP,"1,4"); -//define(FETCHSLEEP,1); -define(RETRIES,5); +define('USER_AGENT','Mozilla/5.0 (compatible; Konqueror/3.3; phpcli)'); +define('YAHOOHOST','finance.messages.yahoo.com'); +define('YAHOO_RED_HOST','us.rd.yahoo.com'); +define('YAHOO_POST_HOST','post.messages.yahoo.com'); +define('SOCKTIMEOUT',10); +define('FETCHSLEEP',"1,4"); +//define('FETCHSLEEP',1); +define('RETRIES',5); // misc settings -define(RANDOM_UA,INCDIR . "/agents.txt"); -define(RANDOMIZE_UA,false); -define(MAXMISSES,50); -define(VERSION,"0.0.8"); -define(PATCHLEVEL,""); +define('RANDOM_UA',INCDIR . "/agents.txt"); +define('RANDOMIZE_UA',false); +define('MAXMISSES',50); +define('VERSION',"0.1.0"); +define('PATCHLEVEL',""); // // nntp export related settings // NNTP_COPY_TEXT if true will copy entire post, // false will provide links to article. // -define(NNTP_SPOOL_DIR,"/var/spool/newsd"); -define(NNTP_GROUP_PREFIX,"alt.yahoo"); -define(NNTP_COPY_TEXT,false); -define(NNTP_USE_NEWSD,false); +define('NNTP_SPOOL_DIR',"/var/spool/newsd"); +define('NNTP_GROUP_PREFIX',"alt.yahoo"); +define('NNTP_COPY_TEXT',false); +define('NNTP_USE_NEWSD',false); + +// +// html export related settings - see README for instructions +// +//define('HTML_EXPORT_DIR','/var/spool/yahoo_spider'); +define('LICENSE_TEXT','Contact Author'); +//$META = array(); +//$desc = 'Archive of Yahoo! SCOX Finance Message Board'; +//$keys = 'SCO, The SCO Group, SCO Group, Litigious Bastards, Thieves, Lying '; +//$keys .= 'Scumbags, Scam, Scam Artist, Intellectual Property, Lawsuit, '; +//$keys .= 'Linux, IBM, Open Source'; +//$META['scox']['description'] = $desc; +//$META['scox']['keywords'] = $keys; // debug settings -define(DEBUG,false); -define(DEBUGUA,false); +define('DEBUG',false); +define('DEBUGUA',false); // includes require_once(INCDIR . "/" . DBINCLUDE); diff -u -r -N yasuck-0.0.9/yasuck yasuck-0.1.0/yasuck --- yasuck-0.0.9/yasuck 2005-07-17 14:49:00.000000000 -0500 +++ yasuck-0.1.0/yasuck 2005-10-08 02:01:50.000000000 -0500 @@ -4,12 +4,12 @@ * yasuck - Copyright (c)2004 badpenguins.com * * Distributed under the terms of the GNU General Public License v2 * * Created 2004-09-09 Mike Green * - *****************************************************************************/ + *****************************************************************************/ require_once("includes/globals.php"); // process command line arguments $action = ''; -if (! checkArgs($argv) === true) { die(helpMessage()); } -if (!sanityCheck() === true) { die("ABORT: sanityCheck() failed\n"); } +if (!(checkArgs($argv) === true)) { die(helpMessage()); } +if (!(sanityCheck() === true)) { die("ABORT: sanityCheck() failed\n"); } switch(ACTION) { case "drop": @@ -22,6 +22,17 @@ echo $status; exit(); break; + case "exporthtml": + $rc = htmlExport(BOARD,START,END); + if ($rc === true) { + $status = "Done (success)\n"; + toggleLock(BOARD,0); + } else { + $status = "Done (failure)\n"; + } + echo $status; + exit(); + break; case "exportnntp": $rc = nntpExport(BOARD,START,END); if ($rc === true) {