Version 2.3.6
This commit is contained in:
1 parent
a3bb603c96
commit
19b38c7c74
764 files changed
+143731
-118164
No files matched your search
@@ -0,0 +1,266 @@
|
||||
<?
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2004 Invision Power Services, Inc
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
| Web: http://www.invisionpower.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > IP Chat => IPB Bridge Script
|
||||
| > Script written by Matt Mecham
|
||||
| > Date started: 17th February 2003 (Updated: 1 July 2004)
|
||||
| > Updated for 2.1.x: Thu 6th October 2005
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* SIGMACHAT auth file.
|
||||
*
|
||||
* Set-up and load module to run
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @author Matt Mecham
|
||||
* @version 2.1
|
||||
*/
|
||||
|
||||
/**
|
||||
* Script type
|
||||
*
|
||||
*/
|
||||
define( 'IPB_THIS_SCRIPT', 'public' );
|
||||
define( 'IPB_LOAD_SQL' , 'queries' );
|
||||
|
||||
require_once( './init.php' );
|
||||
|
||||
//===========================================================================
|
||||
// MAIN PROGRAM
|
||||
//===========================================================================
|
||||
|
||||
$INFO = array();
|
||||
|
||||
//--------------------------------
|
||||
// Load our classes
|
||||
//--------------------------------
|
||||
|
||||
require_once ROOT_PATH . "sources/ipsclass.php";
|
||||
require_once KERNEL_PATH . "class_converge.php";
|
||||
require_once ROOT_PATH . "conf_global.php";
|
||||
|
||||
# Initiate super-class
|
||||
$ipsclass = new ipsclass();
|
||||
$ipsclass->vars = $INFO;
|
||||
|
||||
//--------------------------------
|
||||
// The clocks a' tickin'
|
||||
//--------------------------------
|
||||
|
||||
$Debug = new Debug;
|
||||
$Debug->startTimer();
|
||||
|
||||
//--------------------------------
|
||||
// Load the DB driver and such
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->init_db_connection();
|
||||
|
||||
//--------------------------------
|
||||
// Set up our vars
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->parse_incoming();
|
||||
|
||||
//--------------------------------
|
||||
// Set converge
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->converge = new class_converge( $ipsclass->DB );
|
||||
|
||||
//--------------------------------
|
||||
// Start off the cache array
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->cache_array = array('rss_calendar', 'rss_export','components','banfilters', 'settings', 'group_cache', 'systemvars', 'skin_id_cache', 'forum_cache', 'moderators', 'stats', 'languages');
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// Get cache...
|
||||
//===========================================================================
|
||||
|
||||
$ipsclass->init_load_cache( $ipsclass->cache_array );
|
||||
|
||||
//--------------------------------
|
||||
// Initialize the FUNC
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->initiate_ipsclass();
|
||||
|
||||
//===========================================================================
|
||||
// AUTHORIZE...
|
||||
//===========================================================================
|
||||
|
||||
define( 'DENIED', 0 );
|
||||
define( 'ACCESS', 1 );
|
||||
define( 'ADMIN' , 2 );
|
||||
|
||||
$allowed_groups = $ipsclass->vars['chat_admin_groups'];
|
||||
$access_groups = $ipsclass->vars['chat_access_groups'];
|
||||
$autologin = 0;
|
||||
$allow_guest_access = $ipsclass->vars['chat_allow_guest'] == 1 ? ACCESS : DENIED;
|
||||
|
||||
// Stupid PHP changing it's mind on HTTP args
|
||||
|
||||
$username = $_GET['username'] != "" ? $_GET['username'] : $HTTP_GET_VARS['username'];
|
||||
$password = $_GET['password'] != "" ? $_GET['password'] : $HTTP_GET_VARS['password'];
|
||||
$ip = $_GET['ip'] != "" ? $_GET['ip'] : $HTTP_GET_VARS['ip'];
|
||||
|
||||
//----------------------------------------------
|
||||
// Test for autologin.
|
||||
//----------------------------------------------
|
||||
|
||||
if ( preg_match( "/^(?:[0-9a-z]){32}$/", $password ) )
|
||||
{
|
||||
$autologin = 1;
|
||||
}
|
||||
|
||||
//----------------------------------------------
|
||||
// Remove URL encoding (%20, etc)
|
||||
//----------------------------------------------
|
||||
|
||||
$username = $ipsclass->parse_clean_value(urldecode(trim($username)));
|
||||
$password = $ipsclass->parse_clean_value(urldecode(trim($password)));
|
||||
$ip = $ipsclass->parse_clean_value(urldecode(trim($ip)));
|
||||
|
||||
//----------------------------------------------
|
||||
// Main code
|
||||
//----------------------------------------------
|
||||
|
||||
// Start off with the lowest accessibility
|
||||
|
||||
$output_int = $allow_guest_access;
|
||||
$output_name = "";
|
||||
|
||||
//------------------------------
|
||||
// Attempt to find the user
|
||||
//------------------------------
|
||||
|
||||
$ipsclass->DB->build_query( array( 'select' => 'm.mgroup, m.name, m.members_display_name, m.id, c.*',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.members_l_display_name='".$ipsclass->DB->add_slashes(strtolower($username))."'",
|
||||
'limit' => array( 0, 1 ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'from' => array( 'members_converge' => 'c' ),
|
||||
'where' => 'c.converge_email=m.email',
|
||||
) )
|
||||
) );
|
||||
$ipsclass->DB->exec_query();
|
||||
|
||||
|
||||
if ( ! $member = $ipsclass->DB->fetch_row() )
|
||||
{
|
||||
die_nice();
|
||||
|
||||
//-- script exits --//
|
||||
}
|
||||
|
||||
|
||||
if ( ! $member['id'] )
|
||||
{
|
||||
// No member found - allow guest access?
|
||||
|
||||
die_nice($allow_guest_access);
|
||||
|
||||
//-- script exits --//
|
||||
}
|
||||
|
||||
//------------------------------
|
||||
// Update passy
|
||||
//------------------------------
|
||||
|
||||
if ( ! $autologin )
|
||||
{
|
||||
$md5_password = md5( md5( $member['converge_pass_salt'] ) . md5($password) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$md5_password = $password;
|
||||
}
|
||||
|
||||
//------------------------------
|
||||
// Check password - member exists
|
||||
//------------------------------
|
||||
|
||||
if ( $password != "" )
|
||||
{
|
||||
// Password was entered..
|
||||
|
||||
if ( $md5_password != $member['converge_pass_hash'] )
|
||||
{
|
||||
// Password incorrect..
|
||||
|
||||
die_nice();
|
||||
|
||||
//-- script exits --//
|
||||
}
|
||||
else
|
||||
{
|
||||
$output_int = ACCESS;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// No password entered - die!
|
||||
// Do not allow guest access on reg. name
|
||||
|
||||
die_nice();
|
||||
|
||||
//-- script exits --//
|
||||
}
|
||||
|
||||
|
||||
//------------------------------
|
||||
// Do we have any access?
|
||||
//------------------------------
|
||||
|
||||
|
||||
if ( ! preg_match( "/(^|,)".$member['mgroup']."(,|$)/", $access_groups ) )
|
||||
{
|
||||
die_nice();
|
||||
}
|
||||
|
||||
//------------------------------
|
||||
// Do we have admin access?
|
||||
//------------------------------
|
||||
|
||||
if ( preg_match( "/(^|,)".$member['mgroup']."(,|$)/", $allowed_groups ) )
|
||||
{
|
||||
$output_int = ADMIN;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------
|
||||
// Spill the beans
|
||||
//------------------------------
|
||||
|
||||
print "SCRAS^1.1\nAUTH^".$output_int."\nUID^".intval($member['id'])."\n";
|
||||
|
||||
exit();
|
||||
|
||||
|
||||
function die_nice( $access=0 )
|
||||
{
|
||||
global $ipsclass;
|
||||
|
||||
// Simply error out silently, showing guest access only for the user
|
||||
$ipsclass->DB->close_db();
|
||||
print $access;
|
||||
exit();
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,18 @@
|
||||
-----------------------------------------------------
|
||||
IP.Board 2.3.0+ Rebuild Post Tool
|
||||
(c) Invision Power Services, Inc. 2007
|
||||
@author: Matt - June 2007
|
||||
-----------------------------------------------------
|
||||
OVERVIEW:
|
||||
This tool is run via command line to prevent the usual PHP timeout errors. It is also
|
||||
significantly quicker to run as it's capable of parsing up to 10,000 posts a minute.
|
||||
|
||||
USAGE:
|
||||
Simply upload the file 'rebuildposts.php' into your root IP.Board folder. This is the folder
|
||||
that contains your 'index.php' and 'init.php' files.
|
||||
|
||||
Log into your server via SSH, then Change Directory to your root IP.Board folder. Run the tool
|
||||
by typing: "php rebuildposts.php" (without the quotes).
|
||||
|
||||
Follow the onscreen prompts to select which type of post you wish to rebuild along with the
|
||||
starting ID you wish to use and how many posts you wish to rebuild.
|
||||
@@ -0,0 +1,654 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Email: matt@invisionpower.com
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE SOFTWARE!
|
||||
| http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2007-05-11 22:54:34 +0100 (Fri, 11 May 2007) $
|
||||
| > $Revision: 994 $
|
||||
| > $Author: bfarber $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > SHELL SCRIPT: Rebuild Posts
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Script type
|
||||
*
|
||||
*/
|
||||
define( 'IPB_THIS_SCRIPT', 'public' );
|
||||
define( 'IPB_LOAD_SQL' , 'queries' );
|
||||
|
||||
if ( ! file_exists( './init.php' ) )
|
||||
{
|
||||
myprint( "ERROR: This script MUST be placed in your forum's root directory.\n" );
|
||||
exit(0);
|
||||
}
|
||||
|
||||
require_once( './init.php' );
|
||||
|
||||
//===========================================================================
|
||||
// MAIN PROGRAM
|
||||
//===========================================================================
|
||||
|
||||
$INFO = array();
|
||||
|
||||
//--------------------------------
|
||||
// Load our classes
|
||||
//--------------------------------
|
||||
|
||||
require_once ROOT_PATH . "sources/ipsclass.php";
|
||||
require_once ROOT_PATH . "sources/classes/class_display.php";
|
||||
require_once ROOT_PATH . "sources/classes/class_session.php";
|
||||
require_once ROOT_PATH . "sources/classes/class_forums.php";
|
||||
require_once KERNEL_PATH . "class_converge.php";
|
||||
|
||||
if ( file_exists( ROOT_PATH . "conf_global.php" ) )
|
||||
{
|
||||
require_once ROOT_PATH . "conf_global.php";
|
||||
}
|
||||
|
||||
# Initiate super-class
|
||||
$ipsclass = new ipsclass();
|
||||
$ipsclass->vars = $INFO;
|
||||
|
||||
//--------------------------------
|
||||
// The clocks a' tickin'
|
||||
//--------------------------------
|
||||
|
||||
$Debug = new Debug;
|
||||
$Debug->startTimer();
|
||||
|
||||
//--------------------------------
|
||||
// Load the DB driver and such
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->init_db_connection();
|
||||
|
||||
//--------------------------------
|
||||
// Set debug mode
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->DB->set_debug_mode( 0 );
|
||||
|
||||
$ipsclass->forums = new forum_functions();
|
||||
$ipsclass->forums->ipsclass =& $ipsclass;
|
||||
|
||||
//--------------------------------
|
||||
// Set up our vars
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->parse_incoming();
|
||||
|
||||
//--------------------------------
|
||||
// Set converge
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->converge = new class_converge( $ipsclass->DB );
|
||||
|
||||
//--------------------------------
|
||||
// Start off the cache array
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->cache_array = array_merge( array('badwords','emoticons','attachtypes','bbcode', 'multimod','ranks','profilefields','skin_remap', 'rss_calendar', 'rss_export', 'components', 'banfilters', 'settings', 'group_cache', 'systemvars', 'skin_id_cache', 'forum_cache', 'moderators', 'stats', 'languages') );
|
||||
|
||||
//===========================================================================
|
||||
// Get cache...
|
||||
//===========================================================================
|
||||
|
||||
$ipsclass->init_cache_setup();
|
||||
$ipsclass->init_load_cache( $ipsclass->cache_array );
|
||||
|
||||
//--------------------------------
|
||||
// Initialize the FUNC
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->initiate_ipsclass();
|
||||
|
||||
//--------------------------------
|
||||
// Initialize the forums
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->forums->strip_invisible = 1;
|
||||
$ipsclass->forums->forums_init();
|
||||
|
||||
//--------------------------------
|
||||
// Load the skin
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->load_skin();
|
||||
|
||||
$ppu = 0;
|
||||
$tpu = 0;
|
||||
|
||||
if( isset($ipsclass->member['view_prefs']) )
|
||||
{
|
||||
list($ppu,$tpu) = explode( "&", $ipsclass->member['view_prefs'] );
|
||||
}
|
||||
|
||||
$ipsclass->vars['display_max_topics'] = ($tpu > 0) ? $tpu : $ipsclass->vars['display_max_topics'];
|
||||
$ipsclass->vars['display_max_posts'] = ($ppu > 0) ? $ppu : $ipsclass->vars['display_max_posts'];
|
||||
|
||||
//===========================================================================
|
||||
// Set up the session ID stuff
|
||||
//===========================================================================
|
||||
|
||||
if ( $ipsclass->session_type == 'cookie' )
|
||||
{
|
||||
$ipsclass->session_id = "";
|
||||
$ipsclass->base_url = $ipsclass->vars['board_url'].'/index.'.$ipsclass->vars['php_ext'].'?';
|
||||
}
|
||||
else
|
||||
{
|
||||
$ipsclass->base_url = $ipsclass->vars['board_url'].'/index.'.$ipsclass->vars['php_ext'].'?s='.$ipsclass->session_id.'&';
|
||||
}
|
||||
|
||||
$ipsclass->js_base_url = $ipsclass->vars['board_url'].'/index.'.$ipsclass->vars['php_ext'].'?s='.$ipsclass->session_id.'&';
|
||||
|
||||
//--------------------------------
|
||||
// Set up the forum_read cookie
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->hdl_forum_read_cookie();
|
||||
|
||||
//===========================================================================
|
||||
// Set up defaults
|
||||
//===========================================================================
|
||||
|
||||
$ipsclass->skin_id = $ipsclass->skin['_setid'];
|
||||
|
||||
$ipsclass->vars['img_url'] = $ipsclass->vars['ipb_img_url'] ? $ipsclass->vars['ipb_img_url'] . 'style_images/' . $ipsclass->skin['_imagedir'] : 'style_images/' . $ipsclass->skin['_imagedir'];
|
||||
$ipsclass->vars['AVATARS_URL'] = $ipsclass->vars['ipb_img_url'] ? $ipsclass->vars['ipb_img_url'] . 'style_avatars' : 'style_avatars';
|
||||
$ipsclass->vars['EMOTICONS_URL'] = $ipsclass->vars['ipb_img_url'] ? $ipsclass->vars['ipb_img_url'] . 'style_emoticons/<#EMO_DIR#>' : 'style_emoticons/<#EMO_DIR#>';
|
||||
$ipsclass->vars['mime_img'] = $ipsclass->vars['ipb_img_url'] ? $ipsclass->vars['ipb_img_url'] . 'style_images/<#IMG_DIR#>' : 'style_images/<#IMG_DIR#>';
|
||||
|
||||
//--------------------------------
|
||||
// Set up our language choice
|
||||
//--------------------------------
|
||||
|
||||
if ( !isset($ipsclass->vars['default_language']) OR $ipsclass->vars['default_language'] == "")
|
||||
{
|
||||
$ipsclass->vars['default_language'] = 'en';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Load language
|
||||
//-----------------------------------------
|
||||
|
||||
$ipsclass->load_language('lang_global');
|
||||
|
||||
//-----------------------------------------
|
||||
// Continue
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( ROOT_PATH."sources/handlers/han_parse_bbcode.php" );
|
||||
$parser = new parse_bbcode();
|
||||
$parser->ipsclass =& $ipsclass;
|
||||
$parser->allow_update_caches = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Get input stream
|
||||
//-----------------------------------------
|
||||
|
||||
$stdin = fopen('php://stdin', 'r');
|
||||
|
||||
//-----------------------------------------
|
||||
// Ask what we're doing...
|
||||
//-----------------------------------------
|
||||
|
||||
myprint( "--------------------------------------------\nWelcome to the IP.Board Shell Post Rebuilder\n--------------------------------------------\nWhat do you wish to rebuild? [p=Posts, c=Calendar Events, m=Personal Messages, a=Announcements, s=Signatures]\nEnter: " );
|
||||
|
||||
$option = getoption();
|
||||
|
||||
//-----------------------------------------
|
||||
// What did we choose?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $option != 'p' AND $option != 'c' AND $option != 'm' AND $option != 'a' AND $option != 's' )
|
||||
{
|
||||
myprint( "Incorrect option chosen\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$type = '';
|
||||
|
||||
switch( $option )
|
||||
{
|
||||
case 'p':
|
||||
$type = 'posts';
|
||||
$human = 'Posts';
|
||||
break;
|
||||
case 'c':
|
||||
$type = 'cal';
|
||||
$human = 'Calendar Events';
|
||||
break;
|
||||
case 'm':
|
||||
$type = 'pms';
|
||||
$human = 'Personal Messages';
|
||||
break;
|
||||
case 's':
|
||||
$type = 'sigs';
|
||||
$human = 'Signatures';
|
||||
break;
|
||||
case 'a':
|
||||
$type = 'announce';
|
||||
$human = 'Announcements';
|
||||
break;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// CHOICE: Days or ID
|
||||
//-----------------------------------------
|
||||
|
||||
myprint( "You have selected to rebuild: " . $human . "\n--------------------------------------------\nDo you want to rebuild from the last X days items or start from a specific ID? [0=Rebuild from the beginning, d=Rebuild from last X days, n=Rebuild from an ID]\nEnter: " );
|
||||
|
||||
$option = getoption();
|
||||
|
||||
if ( $option == 'd' )
|
||||
{
|
||||
# DAYS
|
||||
myprint( "Enter the number of days to rebuild from [Entering 30 will rebuild all items from the past 30 days]:\nEnter: " );
|
||||
|
||||
$option = intval( getoption() );
|
||||
$date = 86400 * $option;
|
||||
$time = time() - $date;
|
||||
|
||||
# Find starting ID
|
||||
switch( $type )
|
||||
{
|
||||
case 'cal':
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'event_id', 'from' => 'cal_events', 'where' => 'event_unixstamp >= ' . $time, 'limit' => array(1) ) );
|
||||
$max = intval( $tmp['event_id'] );
|
||||
break;
|
||||
|
||||
case 'announce':
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'announce_id', 'from' => 'announcements', 'where' => 'announce_start >= ' . $time, 'limit' => array(1) ) );
|
||||
$max = intval( $tmp['announce_id'] );
|
||||
break;
|
||||
|
||||
case 'pms':
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'msg_id', 'from' => 'message_text', 'where' => 'msg_date >= ' . $time, 'limit' => array(1) ) );
|
||||
$max = intval( $tmp['msg_id'] );
|
||||
break;
|
||||
|
||||
case 'sigs':
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'id', 'from' => 'member_extra', 'where' => "signature != '' AND joined >= " . $time, 'limit' => array(1) ) );
|
||||
$max = intval( $tmp['id'] );
|
||||
break;
|
||||
|
||||
case 'posts':
|
||||
default:
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'pid', 'from' => 'posts', 'where' => 'post_date >= ' . $time, 'limit' => array(1) ) );
|
||||
$max = intval( $tmp['pid'] );
|
||||
break;
|
||||
}
|
||||
|
||||
$start = $max;
|
||||
}
|
||||
else if ( $option == 'n' )
|
||||
{
|
||||
# Number
|
||||
myprint( "Enter the ID to start from:\nEnter: " );
|
||||
|
||||
$option = getoption();
|
||||
$start = intval( $option );
|
||||
}
|
||||
else
|
||||
{
|
||||
# All
|
||||
$start = 0;
|
||||
}
|
||||
|
||||
myprint( "Rebuilding {$human}, starting at ID " . $start . "\nRebuild how many? [Enter how many you'd like to rebuild. Hit enter to rebuild all]:\nEnter: " );
|
||||
|
||||
$option = getoption();
|
||||
|
||||
$end = ( $end > 0 ) ? intval( $end ) : 0;
|
||||
$done = 0;
|
||||
$_BATCH = 500;
|
||||
$_LAST_ID = intval( $start );
|
||||
$time_start = time();
|
||||
$COMPLETE = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Start the loop...
|
||||
//-----------------------------------------
|
||||
|
||||
while( $COMPLETE == 0 )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Got any more?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $type )
|
||||
{
|
||||
case 'cal':
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'MAX(event_id) as max', 'from' => 'cal_events', 'where' => 'event_id > ' . $_LAST_ID ) );
|
||||
$max = intval( $tmp['max'] );
|
||||
break;
|
||||
|
||||
case 'announce':
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'MAX(announce_id) as max', 'from' => 'announcements', 'where' => 'announce_id > ' . $_LAST_ID ) );
|
||||
$max = intval( $tmp['max'] );
|
||||
break;
|
||||
|
||||
case 'pms':
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'MAX(msg_id) as max', 'from' => 'message_text', 'where' => 'msg_id > ' . $_LAST_ID ) );
|
||||
$max = intval( $tmp['max'] );
|
||||
break;
|
||||
|
||||
case 'sigs':
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'MAX(id) as max', 'from' => 'member_extra', 'where' => "signature != '' AND id > " . $_LAST_ID ) );
|
||||
$max = intval( $tmp['max'] );
|
||||
break;
|
||||
|
||||
case 'posts':
|
||||
default:
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'MAX(pid) as max', 'from' => 'posts', 'where' => 'pid > ' . $_LAST_ID ) );
|
||||
$max = intval( $tmp['max'] );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( ! $max OR $_LAST_ID > $max )
|
||||
{
|
||||
$COMPLETE = 1;
|
||||
}
|
||||
|
||||
myprint( "\nStarting batch: Last ID=" . $_LAST_ID . " Max ID=" . $max );
|
||||
|
||||
//-----------------------------------------
|
||||
// Avoid limit...
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $type )
|
||||
{
|
||||
case 'cal':
|
||||
$ipsclass->DB->build_query( array( 'select' => 'e.*',
|
||||
'from' => array( 'cal_events' => 'e' ),
|
||||
'order' => 'e.event_id ASC',
|
||||
'where' => 'e.event_id > ' . $_LAST_ID,
|
||||
'limit' => array( $_BATCH ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'select' => 'm.mgroup',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.id=e.event_member_id"
|
||||
) )
|
||||
) );
|
||||
break;
|
||||
|
||||
case 'announce':
|
||||
$ipsclass->DB->build_query( array( 'select' => 'a.*',
|
||||
'from' => array( 'announcements' => 'a' ),
|
||||
'order' => 'a.announce_id ASC',
|
||||
'where' => 'a.announce_id > ' . $_LAST_ID,
|
||||
'limit' => array( $_BATCH ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'select' => 'm.mgroup',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.id=a.announce_member_id"
|
||||
) )
|
||||
) );
|
||||
break;
|
||||
|
||||
case 'pms':
|
||||
$ipsclass->DB->build_query( array( 'select' => 'p.*',
|
||||
'from' => array( 'message_text' => 'p' ),
|
||||
'order' => 'p.msg_id ASC',
|
||||
'where' => 'p.msg_id > ' . $_LAST_ID,
|
||||
'limit' => array( $_BATCH ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'select' => 'm.mgroup',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.id=p.msg_author_id"
|
||||
) )
|
||||
) );
|
||||
break;
|
||||
|
||||
case 'sigs':
|
||||
$ipsclass->DB->build_query( array( 'select' => 'me.signature, me.id',
|
||||
'from' => array( 'member_extra' => 'me' ),
|
||||
'order' => 'me.id ASC',
|
||||
'where' => "me.signature != '' AND me.id > " . $_LAST_ID,
|
||||
'limit' => array( $_BATCH ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'select' => 'm.mgroup',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.id=me.id"
|
||||
) )
|
||||
) );
|
||||
break;
|
||||
|
||||
case 'posts':
|
||||
default:
|
||||
$ipsclass->DB->build_query( array( 'select' => 'p.*',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.pid > ' . $_LAST_ID,
|
||||
'limit' => array( $_BATCH ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'select' => 't.forum_id',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => "t.tid=p.topic_id"
|
||||
),
|
||||
2 => array( 'type' => 'left',
|
||||
'select' => 'm.mgroup',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.id=p.author_id"
|
||||
) )
|
||||
) );
|
||||
break;
|
||||
}
|
||||
|
||||
$outer = $ipsclass->DB->exec_query();
|
||||
|
||||
//-----------------------------------------
|
||||
// Process...
|
||||
//-----------------------------------------
|
||||
|
||||
while( $r = $ipsclass->DB->fetch_row( $outer ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Reset time limit
|
||||
//-----------------------------------------
|
||||
|
||||
@set_time_limit( 0 );
|
||||
|
||||
$parser->quote_open = 0;
|
||||
$parser->quote_closed = 0;
|
||||
$parser->quote_error = 0;
|
||||
$parser->error = '';
|
||||
$parser->image_count = 0;
|
||||
|
||||
$ipsclass->member['g_bypass_badwords'] = $ipsclass->cache['group_cache'][ $r['mgroup'] ]['g_bypass_badwords'];
|
||||
|
||||
switch( $type )
|
||||
{
|
||||
case 'cal':
|
||||
$parser->parse_smilies = $r['event_smilies'];
|
||||
$parser->parse_html = 0;
|
||||
$parser->parse_bbcode = 1;
|
||||
|
||||
$rawpost = $parser->pre_edit_parse( $r['event_content'] );
|
||||
break;
|
||||
|
||||
case 'announce':
|
||||
$parser->parse_smilies = 1;
|
||||
$parser->parse_html = $r['announce_html_enabled'];
|
||||
$parser->parse_nl2br = 1;
|
||||
$parser->parse_bbcode = 1;
|
||||
|
||||
$rawpost = $parser->pre_edit_parse( $r['announce_post'] );
|
||||
break;
|
||||
|
||||
case 'pms':
|
||||
$parser->parse_smilies = 1;
|
||||
$parser->parse_nl2br = 1;
|
||||
$parser->parse_html = $ipsclass->vars['msg_allow_html'];
|
||||
$parser->parse_bbcode = $ipsclass->vars['msg_allow_code'];
|
||||
|
||||
$rawpost = $parser->pre_edit_parse( $r['msg_post'] );
|
||||
break;
|
||||
|
||||
case 'sigs':
|
||||
$parser->parse_smilies = 0;
|
||||
$parser->parsing_signature = 1;
|
||||
$parser->parse_html = $ipsclass->vars['sig_allow_html'];
|
||||
$parser->parse_bbcode = $ipsclass->vars['sig_allow_ibc'];
|
||||
|
||||
$rawpost = $parser->pre_edit_parse( $r['signature'] );
|
||||
break;
|
||||
|
||||
case 'posts':
|
||||
default:
|
||||
$parser->parse_smilies = $r['use_emo'];
|
||||
$parser->parse_html = ( $ipsclass->cache['forum_cache'][ $r['forum_id'] ]['use_html'] AND
|
||||
$ipsclass->cache['group_cache'][ $r['mgroup'] ]['g_dohtml'] ) ? 1 : 0;
|
||||
$parser->parse_bbcode = $ipsclass->cache['forum_cache'][ $r['forum_id'] ]['use_ibc'];
|
||||
|
||||
$rawpost = $parser->pre_edit_parse( $r['post'] );
|
||||
break;
|
||||
}
|
||||
|
||||
$newpost = $parser->pre_db_parse( $rawpost );
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove old \' escaping
|
||||
//-----------------------------------------
|
||||
|
||||
$newpost = str_replace( "\\'", "'", $newpost );
|
||||
|
||||
//-----------------------------------------
|
||||
// Convert old dohtml?
|
||||
//-----------------------------------------
|
||||
|
||||
$htmlstate = 0;
|
||||
|
||||
if ( strstr( strtolower($newpost), '[dohtml]' ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Can we use HTML?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $type == 'posts' AND $ipsclass->cache['forum_cache'][ $r['forum_id'] ]['use_html'] )
|
||||
{
|
||||
$htmlstate = 2;
|
||||
}
|
||||
|
||||
$newpost = preg_replace( "#\[dohtml\]#i" , "", $newpost );
|
||||
$newpost = preg_replace( "#\[/dohtml\]#i", "", $newpost );
|
||||
}
|
||||
else
|
||||
{
|
||||
$htmlstate = intval( $r['post_htmlstate'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Convert old attachment tags
|
||||
//-----------------------------------------
|
||||
|
||||
$newpost = preg_replace( "#\[attachmentid=(\d+?)\]#is", "[attachment=\\1:attachment]", $newpost );
|
||||
|
||||
$newpost = $parser->pre_display_parse( $newpost );
|
||||
|
||||
if ( $newpost OR $type == 'sigs' )
|
||||
{
|
||||
switch( $type )
|
||||
{
|
||||
case 'posts':
|
||||
$ipsclass->DB->do_update( 'posts', array( 'post' => $newpost, 'post_htmlstate' => $htmlstate ), 'pid='.$r['pid'] );
|
||||
$string = substr( $r['post'], 0, 30 ) . '...';
|
||||
$last = $r['pid'];
|
||||
break;
|
||||
|
||||
case 'pms':
|
||||
$ipsclass->DB->do_update( 'message_text', array( 'msg_post' => $newpost ), 'msg_id='.$r['msg_id'] );
|
||||
$string = substr( $r['msg_post'], 0, 30 ) . '...';
|
||||
$last = $r['msg_id'];
|
||||
break;
|
||||
|
||||
case 'sigs':
|
||||
$ipsclass->DB->do_update( 'member_extra', array( 'signature' => $newpost ), 'id='.$r['id'] );
|
||||
$string = $r['members_display_name'];
|
||||
$last = $r['id'];
|
||||
break;
|
||||
|
||||
case 'cal':
|
||||
$ipsclass->DB->do_update( 'cal_events', array( 'event_content' => $newpost ), 'event_id='.$r['event_id'] );
|
||||
$string = substr( $r['event_content'], 0, 30 ) . '...';
|
||||
$last = $r['event_id'];
|
||||
break;
|
||||
|
||||
case 'announce':
|
||||
$ipsclass->DB->do_update( 'announcements', array( 'announce_post' => $newpost ), 'announce_id='.$r['announce_id'] );
|
||||
$string = substr( $r['announce_post'], 0, 30 ) . '...';
|
||||
$last = $r['announce_id'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Clear out DB cached queries
|
||||
//-----------------------------------------
|
||||
|
||||
$ipsclass->DB->obj['cached_queries'] = array();
|
||||
|
||||
$done++;
|
||||
$_LAST_ID = $last;
|
||||
|
||||
myprint( "[ID:" . $last . '] ' . $string );
|
||||
|
||||
if ( $end > 0 AND $done > $end )
|
||||
{
|
||||
$COMPLETE = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$time_end = time();
|
||||
|
||||
$time_taken = ( $time_end - $time_start) / 60;
|
||||
|
||||
myprint( "\nALL DONE! ($done rebuilt)" );
|
||||
myprint( "Time Taken: $time_taken minutes" );
|
||||
|
||||
@fclose( $stdin );
|
||||
exit(0);
|
||||
|
||||
//-----------------------------------------
|
||||
// My get
|
||||
//-----------------------------------------
|
||||
|
||||
function getoption()
|
||||
{
|
||||
global $stdin;
|
||||
//$stdin = fopen('php://stdin', 'r');
|
||||
$option = trim( fgets( $stdin ) );
|
||||
//fclose( $stdin );
|
||||
|
||||
return $option;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// FUNC: Write out
|
||||
//-----------------------------------------
|
||||
|
||||
function myprint( $message, $newline="\n" )
|
||||
{
|
||||
$stdout = fopen('php://stdout', 'w');
|
||||
fwrite( $stdout, $message . $newline );
|
||||
fclose( $stdout );
|
||||
}
|
||||
|
||||
?>
|
||||
+782
@@ -0,0 +1,782 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2004 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Email: matt@invisionpower.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > SSI script
|
||||
| > Script written by Matt Mecham
|
||||
| > Date started: 29th April 2002
|
||||
| > UPDATED for 2.0: 1st July 2004
|
||||
| > UPDATED for 2.1: 13th Sept 2005
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
|
||||
+--------------------------------------------------------------------------
|
||||
| USAGE:
|
||||
+--------------------------------------------------------------------------
|
||||
|
||||
Simply call this script via PHP includes, or SSI .shtml tags to generate content
|
||||
on the fly, streamed into your own webpage.
|
||||
|
||||
+--------------------------------------------------------------------------
|
||||
| To show the last 10 topics and posts in the news forums...
|
||||
+--------------------------------------------------------------------------
|
||||
|
||||
include("http://domain.com/forums/ssi.php?a=news&show=10");
|
||||
|
||||
You can adjust the "show" attribute to display a different amount of topics.
|
||||
|
||||
+--------------------------------------------------------------------------
|
||||
| To show the board statistics
|
||||
+--------------------------------------------------------------------------
|
||||
|
||||
include("http://domain.com/forums/ssi.php?a=stats");
|
||||
|
||||
+--------------------------------------------------------------------------
|
||||
| To show the active users stats (x Members, X Guests, etc)
|
||||
+--------------------------------------------------------------------------
|
||||
|
||||
include("http://domain.com/forums/ssi.php?a=active");
|
||||
|
||||
+--------------------------------------------------------------------------
|
||||
| RSS / XML Syndication..
|
||||
+--------------------------------------------------------------------------
|
||||
|
||||
RSS: http://domain.com/forums/ssi.php?a=out&f=1,2,3,4,5&show=10&type=rss
|
||||
XML: http://domain.com/forums/ssi.php?a=out&f=1,2,3,4,5&show=10&type=xml
|
||||
|
||||
Will show last 10 topics in reverse chronological last post date order from
|
||||
all the forums in the comma separated list
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Main executable wrapper.
|
||||
*
|
||||
* Set-up and load module to run
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @author Matt Mecham
|
||||
* @version 2.1
|
||||
*/
|
||||
|
||||
/**
|
||||
* Script type
|
||||
*
|
||||
*/
|
||||
define( 'IPB_THIS_SCRIPT', 'public' );
|
||||
define( 'IPB_LOAD_SQL' , 'queries' );
|
||||
|
||||
require_once( './init.php' );
|
||||
|
||||
//--------------------------------
|
||||
// Other set up
|
||||
//--------------------------------
|
||||
|
||||
/**
|
||||
* Path to SSI templates directory
|
||||
*
|
||||
*/
|
||||
define( 'SSI_TEMPLATES_DIR', ROOT_PATH."ssi_templates" );
|
||||
/**
|
||||
* Maximum number of topics to show
|
||||
*
|
||||
*/
|
||||
define( 'SSI_MAX_SHOW' , 100 );
|
||||
|
||||
/**
|
||||
* Allow SSI export. Enter "0" to turn off.
|
||||
*
|
||||
*/
|
||||
define( 'SSI_ALLOW_SYND' , 1 );
|
||||
|
||||
//===========================================================================
|
||||
// MAIN PROGRAM
|
||||
//===========================================================================
|
||||
|
||||
$INFO = array();
|
||||
|
||||
//--------------------------------
|
||||
// Load our classes
|
||||
//--------------------------------
|
||||
|
||||
require_once ROOT_PATH . "sources/ipsclass.php";
|
||||
require_once ROOT_PATH . "sources/classes/class_forums.php";
|
||||
require_once ROOT_PATH . "sources/classes/class_session.php";
|
||||
require_once KERNEL_PATH . "class_converge.php";
|
||||
require_once ROOT_PATH . "conf_global.php";
|
||||
|
||||
# Initiate super-class
|
||||
$ipsclass = new ipsclass();
|
||||
$ipsclass->vars = $INFO;
|
||||
|
||||
//--------------------------------
|
||||
// The clocks a' tickin'
|
||||
//--------------------------------
|
||||
|
||||
$Debug = new Debug;
|
||||
$Debug->startTimer();
|
||||
|
||||
//--------------------------------
|
||||
// Load the DB driver and such
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->init_db_connection();
|
||||
|
||||
//--------------------------------
|
||||
// INIT other classes
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->sess = new session();
|
||||
$ipsclass->sess->ipsclass =& $ipsclass;
|
||||
|
||||
$ipsclass->forums = new forum_functions();
|
||||
$ipsclass->forums->ipsclass =& $ipsclass;
|
||||
|
||||
//--------------------------------
|
||||
// Set up our vars
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->parse_incoming();
|
||||
|
||||
//--------------------------------
|
||||
// Set converge
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->converge = new class_converge( $ipsclass->DB );
|
||||
|
||||
//--------------------------------
|
||||
// Start off the cache array
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->cache_array = array_merge( array('attachtypes','bbcode', 'multimod','ranks','profilefields'), array('rss_calendar', 'rss_export','components','banfilters', 'settings', 'group_cache', 'systemvars', 'skin_id_cache', 'forum_cache', 'moderators', 'stats', 'languages') );
|
||||
|
||||
//===========================================================================
|
||||
// Get cache...
|
||||
//===========================================================================
|
||||
|
||||
$ipsclass->init_cache_setup();
|
||||
$ipsclass->init_load_cache( $ipsclass->cache_array );
|
||||
|
||||
//--------------------------------
|
||||
// Set debug mode
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->DB->set_debug_mode( $ipsclass->vars['sql_debug'] == 1 ? intval($_GET['debug']) : 0 );
|
||||
|
||||
//--------------------------------
|
||||
// Initialize the FUNC
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->initiate_ipsclass();
|
||||
|
||||
//--------------------------------
|
||||
// Initialize the member info
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->member = $ipsclass->sess->authorise();
|
||||
|
||||
//-----------------------------------------
|
||||
// Cache md5 check
|
||||
//-----------------------------------------
|
||||
|
||||
$ipsclass->md5_check = $ipsclass->return_md5_check();
|
||||
|
||||
//--------------------------------
|
||||
// Initialize the forums
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->forums->strip_invisible = 1;
|
||||
$ipsclass->forums->forums_init();
|
||||
|
||||
//--------------------------------
|
||||
// Load the skin
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->load_skin();
|
||||
|
||||
//--------------------------------
|
||||
// Set the base URL
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->base_url = $ipsclass->vars['board_url'].'/index.'.$ipsclass->vars['php_ext'];
|
||||
|
||||
//--------------------------------
|
||||
// INIT class and pass...
|
||||
//--------------------------------
|
||||
|
||||
$runme = new ssi_autorun();
|
||||
$runme->ipsclass =& $ipsclass;
|
||||
$runme->auto_run();
|
||||
|
||||
|
||||
/**
|
||||
* Auto run class
|
||||
*/
|
||||
class ssi_autorun
|
||||
{
|
||||
/**
|
||||
* Auto run function
|
||||
*/
|
||||
function auto_run()
|
||||
{
|
||||
//--------------------------------
|
||||
// What to do?
|
||||
//--------------------------------
|
||||
|
||||
switch ($this->ipsclass->input['a'])
|
||||
{
|
||||
case 'news':
|
||||
$this->do_news();
|
||||
break;
|
||||
|
||||
case 'active':
|
||||
$this->do_active();
|
||||
break;
|
||||
|
||||
case 'stats':
|
||||
$this->do_stats();
|
||||
break;
|
||||
|
||||
case 'out':
|
||||
if ( SSI_ALLOW_SYND == 1 )
|
||||
{
|
||||
$this->do_syndication();
|
||||
}
|
||||
else
|
||||
{
|
||||
exit();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
echo("An error occured whilst processing this directive");
|
||||
exit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Do Syndication
|
||||
*
|
||||
* Export topics / titles from selected forums
|
||||
*/
|
||||
function do_syndication()
|
||||
{
|
||||
//----------------------------------------
|
||||
// Sort out the forum ids
|
||||
//----------------------------------------
|
||||
|
||||
$tmp_forums = array();
|
||||
$forums = array();
|
||||
|
||||
if ( $this->ipsclass->input['f'] )
|
||||
{
|
||||
$tmp_forums = explode( ",", $this->ipsclass->input['f'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
fatal_error("Fatal error: no forum id specified");
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
// Intval the IDs
|
||||
//----------------------------------------
|
||||
|
||||
foreach ($tmp_forums as $f )
|
||||
{
|
||||
$f = intval($f);
|
||||
|
||||
if ( $f )
|
||||
{
|
||||
$forums[] = $f;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
// Check...
|
||||
//----------------------------------------
|
||||
|
||||
if ( count($forums) < 1 )
|
||||
{
|
||||
fatal_error("Fatal error: no forum id specified");
|
||||
}
|
||||
|
||||
$sql_fields = implode( ",", $forums );
|
||||
|
||||
//----------------------------------------
|
||||
// Number of topics to return?
|
||||
//----------------------------------------
|
||||
|
||||
$perpage = intval($this->ipsclass->input['show']) ? intval($this->ipsclass->input['show']) : 10;
|
||||
|
||||
$perpage = ( $perpage > SSI_MAX_SHOW ) ? SSI_MAX_SHOW : $perpage;
|
||||
|
||||
//----------------------------------------
|
||||
// Load the template...
|
||||
//----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->input['type'] == 'xml' )
|
||||
{
|
||||
$template = $this->load_template("syndicate_xml.html");
|
||||
}
|
||||
else
|
||||
{
|
||||
$template = $this->load_template("syndicate_rss.html");
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
// parse..
|
||||
//----------------------------------------
|
||||
|
||||
$to_echo = "";
|
||||
$top = "";
|
||||
$row = "";
|
||||
$bottom = "";
|
||||
|
||||
preg_match( "#\[TOP\](.+?)\[/TOP\]#is", $template, $match );
|
||||
|
||||
$top = trim($match[1]);
|
||||
|
||||
preg_match( "#\[ROW\](.+?)\[/ROW\]#is", $template, $match );
|
||||
|
||||
$row = trim($match[1]);
|
||||
|
||||
preg_match( "#\[BOTTOM\](.+?)\[/BOTTOM\]#is", $template, $match );
|
||||
|
||||
$bottom = trim($match[1]);
|
||||
|
||||
//----------------------------------------
|
||||
// Header parse...
|
||||
//----------------------------------------
|
||||
|
||||
@header("Content-Type: text/xml;charset={$this->ipsclass->vars['gb_char_set']}");
|
||||
@header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
@header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
@header('Pragma: public');
|
||||
|
||||
$to_echo .= $this->parse_template( $top, array (
|
||||
'board_url' => $this->ipsclass->base_url ,
|
||||
'board_name' => $this->ipsclass->vars['board_name'],
|
||||
) );
|
||||
|
||||
//----------------------------------------
|
||||
// Fix up
|
||||
//----------------------------------------
|
||||
|
||||
$group = $this->ipsclass->cache['group_cache'][ $this->ipsclass->vars['guest_group'] ];
|
||||
|
||||
$this->ipsclass->perm_id_array = explode( ",", $group['g_perm_id'] );
|
||||
|
||||
//----------------------------------------
|
||||
// Get the topics, member info and other stuff
|
||||
//----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*',
|
||||
'from' => 'topics',
|
||||
'where' => "forum_id IN ($sql_fields) AND approved=1",
|
||||
'order' => 'last_post DESC',
|
||||
'limit' => array( 0, $perpage ) ) );
|
||||
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
if ( ! $this->ipsclass->DB->get_num_rows() )
|
||||
{
|
||||
fatal_error("Could not get the information from the database");
|
||||
}
|
||||
|
||||
while ( $i = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$forum = $this->ipsclass->forums->forum_by_id[ $i['forum_id'] ];
|
||||
|
||||
if ( $this->ipsclass->check_perms( $forum['read_perms'] ) != TRUE )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($forum['password'] != "" )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$to_echo .= $this->parse_template( $row, array (
|
||||
'topic_title' => str_replace( '&#', '&#', $i['title'] ),
|
||||
'topic_id' => $i['tid'],
|
||||
'topic_link' => $this->ipsclass->base_url."?showtopic=".$i['tid'],
|
||||
'forum_title' => htmlspecialchars($forum['name']),
|
||||
'forum_id' => $i['forum_id'],
|
||||
'last_poster_id' => $i['last_poster_id'],
|
||||
'last_post_name' => $i['last_poster_name'],
|
||||
'last_post_time' => $this->ipsclass->get_date( $i['last_post'] , 'LONG', 1 ),
|
||||
'timestamp' => $i['last_post'],
|
||||
'starter_id' => $i['starter_id'],
|
||||
'starter_name' => $i['starter_name'],
|
||||
'board_url' => $this->ipsclass->base_url ,
|
||||
'board_name' => $this->ipsclass->vars['board_name'],
|
||||
'rfc_date' => date( 'r', $i['last_post'] ),
|
||||
) ) . "\r\n";
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
// Print bottom...
|
||||
//----------------------------------------
|
||||
|
||||
echo $to_echo."\r\n".$bottom;
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Do Stats
|
||||
*
|
||||
* Show totals
|
||||
*/
|
||||
function do_stats()
|
||||
{
|
||||
//----------------------------------------
|
||||
// Load the template...
|
||||
//----------------------------------------
|
||||
|
||||
$template = $this->load_template("stats.html");
|
||||
|
||||
//----------------------------------------
|
||||
// INIT
|
||||
//----------------------------------------
|
||||
|
||||
$to_echo = "";
|
||||
$time = time() - 900;
|
||||
|
||||
//----------------------------------------
|
||||
// Make sure we've got something
|
||||
//----------------------------------------
|
||||
|
||||
if ( ! is_array( $this->ipsclass->cache['stats'] ) )
|
||||
{
|
||||
$this->ipsclass->cache['stats'] = array();
|
||||
|
||||
$this->ipsclass->update_cache( array( 'name' => 'stats', 'array' => 1, 'deletefirst' => 1 ) );
|
||||
}
|
||||
|
||||
$stats = $this->ipsclass->cache['stats'];
|
||||
$total_posts = $stats['total_replies']+$stats['total_topics'];
|
||||
$to_echo = $this->parse_template( $template,
|
||||
array (
|
||||
'total_posts' => $total_posts,
|
||||
'topics' => $stats['total_topics'],
|
||||
'replies' => $stats['total_replies'],
|
||||
'members' => $stats['mem_count']
|
||||
)
|
||||
);
|
||||
echo $to_echo;
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Do News
|
||||
*
|
||||
* Show news text
|
||||
*/
|
||||
function do_news()
|
||||
{
|
||||
//----------------------------------------
|
||||
// Check
|
||||
//----------------------------------------
|
||||
|
||||
if ( (! $this->ipsclass->vars['news_forum_id']) or ($this->ipsclass->vars['news_forum_id'] == "" ) )
|
||||
{
|
||||
fatal_error("No news forum assigned");
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
// INIT
|
||||
//----------------------------------------
|
||||
|
||||
$perpage = intval($this->ipsclass->input['show']) > 0 ? intval($this->ipsclass->input['show']) : 10;
|
||||
$perpage = ( $perpage > SSI_MAX_SHOW ) ? SSI_MAX_SHOW : $perpage;
|
||||
$to_echo = "";
|
||||
|
||||
//-----------------------------------------
|
||||
// Load the template...
|
||||
//-----------------------------------------
|
||||
|
||||
$template = $this->load_template("news.html");
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the topics, member info and other stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 't.*',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => "t.forum_id={$this->ipsclass->vars['news_forum_id']} AND t.approved=1",
|
||||
'order' => 't.tid DESC',
|
||||
'limit' => array( 0, $perpage ),
|
||||
'add_join' => array( 0 => array( 'select' => 'm.members_display_name as member_name, m.mgroup, m.id as member_id,m.title as member_title',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.id=t.starter_id",
|
||||
'type' => 'left' ),
|
||||
1 => array( 'select' => 'p.*',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => "t.topic_firstpost=p.pid",
|
||||
'type' => 'left' ) )
|
||||
) );
|
||||
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
while ( $row = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$row['member_name'] = $row['member_name'] ? $row['member_name'] : $row['author_name'];
|
||||
|
||||
$to_echo .= $this->parse_template( $template,
|
||||
array (
|
||||
'profile_link' => $this->ipsclass->base_url."?showuser=".intval($row['member_id']),
|
||||
'member_name' => $row['member_name'],
|
||||
'post_date' => $this->ipsclass->get_date( $row['post_date'], 'LONG', 1 ),
|
||||
'topic_title' => $row['title'],
|
||||
'post' => $row['post'],
|
||||
'comments' => $row['posts'],
|
||||
'view_all_link' => $this->ipsclass->base_url."?showtopic={$row['tid']}"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the macros and replace them
|
||||
//-----------------------------------------
|
||||
|
||||
if ( is_array( $this->ipsclass->skin['_macros'] ) )
|
||||
{
|
||||
foreach( $this->ipsclass->skin['_macros'] as $row )
|
||||
{
|
||||
if ( $row['macro_value'] != "" )
|
||||
{
|
||||
$to_echo = str_replace( "<{".$row['macro_value']."}>", $row['macro_replace'], $to_echo );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$to_echo = preg_replace( "#([^/])style_images/(<\#IMG_DIR\#>|".preg_quote($this->ipsclass->skin['_imagedir'], '/').")#is", "\\1".$this->ipsclass->vars['board_url']."/style_images/\\2", $to_echo );
|
||||
$to_echo = preg_replace( "#([^/])style_emoticons#is", "\\1".$this->ipsclass->vars['board_url']."/style_emoticons", $to_echo );
|
||||
$to_echo = preg_replace( "#([^/])style_avatars#is" , "\\1".$this->ipsclass->vars['board_url']."/style_avatars", $to_echo );
|
||||
$to_echo = preg_replace( "#([^/])jscripts#is" , "\\1".$this->ipsclass->vars['board_url']."/jscripts", $to_echo );
|
||||
|
||||
$to_echo = str_replace( "<#IMG_DIR#>", $this->ipsclass->skin['_imagedir'], $to_echo );
|
||||
$to_echo = str_replace( "<#EMO_DIR#>", $this->ipsclass->skin['_emodir'] , $to_echo );
|
||||
|
||||
echo $to_echo;
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Do Active
|
||||
*
|
||||
* Show active users
|
||||
*/
|
||||
function do_active()
|
||||
{
|
||||
//--------------------------------
|
||||
// Load the template...
|
||||
//--------------------------------
|
||||
|
||||
$template = $this->load_template("active.html");
|
||||
|
||||
//--------------------------------
|
||||
// INIT
|
||||
//--------------------------------
|
||||
|
||||
$to_echo = "";
|
||||
|
||||
//--------------------------------
|
||||
// Make sure we have a cut off...
|
||||
//--------------------------------
|
||||
|
||||
if ($this->ipsclass->vars['au_cutoff'] == "")
|
||||
{
|
||||
$this->ipsclass->vars['au_cutoff'] = 15;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the users from the DB
|
||||
//-----------------------------------------
|
||||
|
||||
$cut_off = $this->ipsclass->vars['au_cutoff'] * 60;
|
||||
$time = time() - $cut_off;
|
||||
$rows = array();
|
||||
$ar_time = time();
|
||||
|
||||
if ( $this->ipsclass->member['id'] )
|
||||
{
|
||||
$rows = array( $ar_time => array( 'login_type' => substr($this->ipsclass->member['login_anonymous'],0, 1),
|
||||
'running_time' => $ar_time,
|
||||
'member_id' => $this->ipsclass->member['id'],
|
||||
'member_name' => $this->ipsclass->member['members_display_name'],
|
||||
'member_group' => $this->ipsclass->member['mgroup'] ) );
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => 'id, member_id, member_name, login_type, running_time, member_group',
|
||||
'from' => 'sessions',
|
||||
'where' => "running_time > $time",
|
||||
//'order' => "running_time DESC" // Sort in PHP to avoid filesort in SQL
|
||||
) );
|
||||
|
||||
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
//-----------------------------------------
|
||||
// FETCH...
|
||||
//-----------------------------------------
|
||||
|
||||
while ( $r = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$rows[ $r['running_time'].'.'.$r['id'] ] = $r;
|
||||
}
|
||||
|
||||
krsort( $rows );
|
||||
|
||||
//--------------------------------
|
||||
// cache all printed members so we
|
||||
// don't double print them
|
||||
//--------------------------------
|
||||
|
||||
$cached = array();
|
||||
$active = array();
|
||||
|
||||
foreach( $rows as $result )
|
||||
{
|
||||
$last_date = $this->ipsclass->get_time( $result['running_time'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Bot?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( strstr( $result['id'], '_session' ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Seen bot of this type yet?
|
||||
//-----------------------------------------
|
||||
|
||||
$botname = preg_replace( '/^(.+?)=/', "\\1", $result['id'] );
|
||||
|
||||
if ( ! $cached[ $result['member_name'] ] )
|
||||
{
|
||||
$cached[ $result['member_name'] ] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Yup, count others as guest
|
||||
//-----------------------------------------
|
||||
|
||||
$active['GUESTS']++;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Guest?
|
||||
//-----------------------------------------
|
||||
|
||||
else if ( ! $result['member_id'] )
|
||||
{
|
||||
$active['GUESTS']++;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Member?
|
||||
//-----------------------------------------
|
||||
|
||||
else
|
||||
{
|
||||
if ( empty( $cached[ $result['member_id'] ] ) )
|
||||
{
|
||||
$cached[ $result['member_id'] ] = 1;
|
||||
|
||||
if ($result['login_type'])
|
||||
{
|
||||
$active['ANON']++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$active['MEMBERS']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$active['TOTAL'] = $active['MEMBERS'] + $active['GUESTS'] + $active['ANON'];
|
||||
|
||||
|
||||
$to_echo = $this->parse_template( $template,
|
||||
array (
|
||||
'total' => $active['TOTAL'] ? $active['TOTAL'] : 0 ,
|
||||
'members' => $active['MEMBERS'] ? $active['MEMBERS'] : 0,
|
||||
'guests' => $active['GUESTS'] ? $active['GUESTS'] : 0,
|
||||
'anon' => $active['ANON'] ? $active['ANON'] : 0,
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
echo $to_echo;
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse template
|
||||
*
|
||||
* Parses the template. Duh.
|
||||
*/
|
||||
function parse_template( $template, $assigned=array() )
|
||||
{
|
||||
foreach( $assigned as $word => $replace)
|
||||
{
|
||||
$template = preg_replace( "/\{$word\}/i", "$replace", $template );
|
||||
}
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load template
|
||||
*
|
||||
* Loads the template
|
||||
*/
|
||||
function load_template($template="")
|
||||
{
|
||||
$filename = SSI_TEMPLATES_DIR."/".$template;
|
||||
|
||||
if ( file_exists($filename) )
|
||||
{
|
||||
if ( $FH = fopen($filename, 'r') )
|
||||
{
|
||||
$template = fread( $FH, filesize($filename) );
|
||||
fclose($FH);
|
||||
}
|
||||
else
|
||||
{
|
||||
fatal_error("Couldn't open the template file");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fatal_error("Template file does not exist");
|
||||
}
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
<table cellpadding='4' cellspacing='1' border='0' width='100%' bgcolor='#000000' style='font-family:Verdana;font-size:11px'>␍<tr>␍ <td align='left' bgcolor='#CCCCCC'><b>Users browsing the forums: {total}</b></td>␍</tr>␍<tr>␍ <td align='left'bgcolor='#FEFEFE'>␍ <table style='border:1px dotted gray;width:100%;font-family:Verdana;font-size:10px'>␍ <tr>␍ <td>Active members: {members}<br>Active Guests: {guests}<br>Active Anonymous: {anon}␍ </td>␍ </tr>␍ </table>␍ </td>␍</tr>␍</table>␍<br>
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>Invision Power Board - Bulletin Board System</title></head>␍<body>␍<h1>403: Invision Power Board -> Forbidden</h1>␍<hr>␍You have reached this Page in error, please use␍your back button to return to Invision Board.␍<hr>␍<a href="http://anonym.to/http://www.invisionboard.com/">Invision Power Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1 @@
|
||||
<table cellpadding='4' cellspacing='1' border='0' width='100%' bgcolor='#000000' style='font-family:Verdana;font-size:11px'>␍<tr>␍ <td align='left' bgcolor='#CCCCCC'>Posted By: <a href='{profile_link}'>{member_name}</a><br>Posted On: {post_date}</td>␍</tr>␍<tr>␍ <td align='left' bgcolor='#FEFEFE'>␍ <b>Title: {topic_title}</b>␍ <br><br>␍ <table style='border:1px dotted gray;width:100%;font-family:Verdana;font-size:10px'><tr><td>{post}</td></tr></table><br>Comments: {comments} :: <a href='{view_all_link}'>View Comments</a>␍ </td>␍</tr>␍</table>␍<br>
|
||||
@@ -0,0 +1 @@
|
||||
<table cellpadding='4' cellspacing='1' border='0' width='100%' bgcolor='#000000' style='font-family:Verdana;font-size:11px'>␍<tr>␍ <td align='left' bgcolor='#CCCCCC'><b>Board Statistics</b></td>␍</tr>␍<tr>␍ <td align='left'bgcolor='#FEFEFE'>␍ <table style='border:1px dotted gray;width:100%;font-family:Verdana;font-size:10px'>␍ <tr>␍ <td>Total Posts: {total_posts} ( Topics: {topics}, Replies {replies} )<br>␍ Registered Members: {members}␍ </td>␍ </tr>␍ </table>␍ </td>␍</tr>␍</table>␍<br>
|
||||
@@ -0,0 +1,27 @@
|
||||
[TOP]
|
||||
<?xml version="1.0"?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
<title>{board_name}</title>
|
||||
<link>{board_url}</link>
|
||||
<description>{board_name} Syndication</description>
|
||||
<language>en-us</language>
|
||||
<generator>Invision Power Board</generator>
|
||||
<ttl>30</ttl>
|
||||
[/TOP]
|
||||
|
||||
[ROW]
|
||||
<item>
|
||||
<title>{topic_title}</title>
|
||||
<link>{topic_link}</link>
|
||||
<comments>{topic_link}</comments>
|
||||
<category>{forum_title}</category>
|
||||
<description><![CDATA[Forum: <a href="{board_url}?showforum={forum_id}">{forum_title}</a><br />Last Poster: <a href="{board_url}?showuser={last_poster_id}" target="_blank">{last_post_name}</a><br />Last Post: {last_post_time}]]></description>
|
||||
<pubDate>{rfc_date}</pubDate>
|
||||
</item>
|
||||
[/ROW]
|
||||
|
||||
[BOTTOM]
|
||||
</channel>
|
||||
</rss>
|
||||
[/BOTTOM]
|
||||
@@ -0,0 +1 @@
|
||||
[TOP]␍<?xml version="1.0" encoding="ISO-8859-1"?>␍<!DOCTYPE ipbsource␍[␍ <!-- CUSTOM IPB INLINE DOCTYPE -->␍ <!ELEMENT ipbsource (topic+) >␍ <!ELEMENT topic (title,lastposter,starter,forum,date) >␍ <!ATTLIST topic id CDATA #REQUIRED >␍ ␍ <!ELEMENT title (#PCDATA) >␍ ␍ <!ELEMENT lastposter (#PCDATA) >␍ <!ATTLIST lastposter id CDATA #REQUIRED >␍ ␍ <!ELEMENT starter (#PCDATA) >␍ <!ATTLIST starter id CDATA #REQUIRED >␍ ␍ <!ELEMENT forum (#PCDATA) >␍ <!ATTLIST forum id CDATA #REQUIRED >␍ ␍ <!ELEMENT date (#PCDATA) >␍ <!ATTLIST date timestamp CDATA #REQUIRED >␍]>␍<ipbsource>␍[/TOP]␍␍[ROW]␍ <topic id="{topic_id}">␍ <title>{topic_title}</title>␍ <lastposter id="{last_poster_id}">{last_post_name}</lastposter>␍ <starter id="{starter_id}">{starter_name}</starter>␍ <forum id="{forum_id}">{forum_title}</forum>␍ <date timestamp="{timestamp}">{last_post_time}</date>␍ </topic>␍[/ROW]␍␍[BOTTOM]␍</ipbsource>␍[/BOTTOM]
|
||||
Reference in new issue
Block a user