Version 2.2.0 RC-1
This commit is contained in:
1 parent
f73f8bff6d
commit
22f1b963ee
1034 files changed
+178610
-70897
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,540 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+---------------------------------------------------------------------------
|
||||
| Invision Power Dynamic v1.0.0
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2004 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER DYNAMIC IS NOT FREE SOFTWARE!
|
||||
| http://www.invisionpower.com/dynamic/
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Id$
|
||||
| > $Revision: 4 $
|
||||
| > $Date: 2005-10-10 14:21:32 +0100 (Mon, 10 Oct 2005) $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > MSG PLUG-IN
|
||||
| > Script written by Matt Mecham
|
||||
| > Date started: Monday 19th December 2005 (11:29)
|
||||
|
|
||||
+---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class plugin_msg
|
||||
{
|
||||
/**
|
||||
* Global ipsclass
|
||||
* @var object
|
||||
*/
|
||||
var $ipsclass;
|
||||
|
||||
/**
|
||||
* Module type
|
||||
* @var string
|
||||
*/
|
||||
var $module = 'msg';
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// show_attachment_get_sql_data
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Checks the attachment and checks for download / show perms
|
||||
* Returns TRUE or FALSE
|
||||
* IT really does
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function show_attachment_get_sql_data( $attach_id )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$_ok = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Grab 'em
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'a.*',
|
||||
'from' => array( 'attachments' => 'a' ),
|
||||
'where' => "a.attach_rel_module='".$this->module."' AND a.attach_id=".$attach_id,
|
||||
'add_join' => array( 0 => array( 'select' => 'p.*',
|
||||
'from' => array( 'message_text' => 'p' ),
|
||||
'where' => "p.msg_id=a.attach_rel_id",
|
||||
'type' => 'left' ),
|
||||
1 => array( 'select' => 't.*',
|
||||
'from' => array( 'message_topics' => 't' ),
|
||||
'where' => "t.mt_msg_id=p.msg_id",
|
||||
'type' => 'left' ) )
|
||||
) );
|
||||
|
||||
$attach_sql = $this->ipsclass->DB->exec_query();
|
||||
|
||||
$attach = $this->ipsclass->DB->fetch_row( $attach_sql );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check..
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! isset( $attach['msg_id'] ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// TheWalrus inspired fix for previewing
|
||||
// the post and clicking the attachment...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $attach['mt_owner_id'] == $this->ipsclass->member['id'] )
|
||||
{
|
||||
$_ok = 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Ok?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $_ok )
|
||||
{
|
||||
return $attach;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// render_attachment_get_sql_data
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Check the attachment and make sure its OK to display
|
||||
* Returns TRUE or FALSE
|
||||
* IT really does
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function render_attachment_get_sql_data( $attach_ids, $rel_ids=array() )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$rows = array();
|
||||
$query = '';
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! is_array( $attach_ids ) OR ! count( $attach_ids ) )
|
||||
{
|
||||
$attach_ids = array( -2 );
|
||||
}
|
||||
|
||||
if ( is_array( $rel_ids ) and count( $rel_ids ) )
|
||||
{
|
||||
$query = " OR attach_rel_id IN (-1," . implode( ",", $rel_ids ) . ")";
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Grab 'em
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->build_query( array( 'select' => '*',
|
||||
'from' => 'attachments',
|
||||
'where' => "attach_rel_module='".$this->module."' AND ( attach_id IN(-1,". implode( ",", $attach_ids ) . ") " . $query . " )",
|
||||
) );
|
||||
|
||||
$attach_sql = $this->ipsclass->DB->exec_query();
|
||||
|
||||
//-----------------------------------------
|
||||
// Loop through and filter off naughty ids
|
||||
//-----------------------------------------
|
||||
|
||||
while( $db_row = $this->ipsclass->DB->fetch_row( $attach_sql ) )
|
||||
{
|
||||
$_ok = 1;
|
||||
|
||||
//-----------------------------------------
|
||||
// Ok?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $_ok )
|
||||
{
|
||||
$rows[ $db_row['attach_id'] ] = $db_row;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Return
|
||||
//-----------------------------------------
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Remove attachment clean up
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Recounts number of attachments for the articles row
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function post_process_upload( $post_key, $rel_id, $args=array() )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$cnt = array( 'cnt' => 0 );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check..
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $post_key )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( "select" => 'COUNT(*) as cnt',
|
||||
'from' => 'attachments',
|
||||
'where' => "attach_post_key='{$post_key}'") );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
$cnt = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
if ( $cnt['cnt'] )
|
||||
{
|
||||
$this->ipsclass->DB->build_and_exec_query( array( 'update' => 'message_topics',
|
||||
'set' => "mt_hasattach=mt_hasattach+" . $cnt['cnt'],
|
||||
'where' => "mt_msg_id=" . intval( $rel_id ) ) );
|
||||
}
|
||||
|
||||
return array( 'count' => $cnt['cnt'] );
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Remove attachment clean up
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Recounts number of attachments for the articles row
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function remove_attachment_clean_up( $attachment )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $attachment['attach_id'] )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'p.pid',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.pid='. intval( $attachment['attach_rel_id'] ),
|
||||
'add_join' => array( 0 => array( 'select' => 't.forum_id, t.tid',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id',
|
||||
'type' => 'inner' ) ) ) );
|
||||
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
$topic = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
if ( isset( $topic['tid'] ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// GET PIDS
|
||||
//-----------------------------------------
|
||||
|
||||
$pids = array();
|
||||
$count = 0;
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => 'pid',
|
||||
'from' => 'posts',
|
||||
'where' => "topic_id=". $topic['tid'] ) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
while ( $p = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$pids[] = $p['pid'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// GET ATTACHMENT COUNT
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count( $pids ) )
|
||||
{
|
||||
$this->ipsclass->DB->simple_construct( array( "select" => 'count(*) as cnt',
|
||||
'from' => 'attachments',
|
||||
'where' => "attach_rel_module='post' AND attach_rel_id IN(".implode(",",$pids).")") );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
$cnt = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
$count = intval( $cnt['cnt'] );
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'update' => 'topics', 'set' => "topic_hasattach=". $count , 'where' => "tid=".$topic['tid'] ) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Bulk remove attachment permissions check
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Returns TRUE or FALSE
|
||||
* IT really does
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function return_bulk_remove_permission( $attach_rel_ids=array() )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$ok_to_remove = FALSE;
|
||||
|
||||
//-----------------------------------------
|
||||
// Allowed to remove?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->member['group_access_cp'] )
|
||||
{
|
||||
$ok_to_remove = TRUE;
|
||||
}
|
||||
|
||||
return $ok_to_remove;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Remove attachment permissions check
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Returns TRUE or FALSE
|
||||
* IT really does
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function return_remove_permission( $attachment )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$ok_to_remove = FALSE;
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $attachment['attach_id'] )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Allowed to remove?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->member['id'] == $attachment['attach_member_id'] )
|
||||
{
|
||||
$ok_to_remove = TRUE;
|
||||
}
|
||||
else if ( $this->ipsclass->member['g_is_supmod'] )
|
||||
{
|
||||
$ok_to_remove = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Moderstor? Get forum ID
|
||||
//-----------------------------------------
|
||||
|
||||
if ( isset( $this->ipsclass->member['_moderator'] ) )
|
||||
{
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'p.pid',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.pid='. intval( $attach['attach_rel_id'] ),
|
||||
'add_join' => array( 0 => array( 'select' => 't.forum_id, t.tid',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id',
|
||||
'type' => 'inner' ) ) ) );
|
||||
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
$topic = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
if ( isset( $topic['forum_id'] ) )
|
||||
{
|
||||
if ( isset($this->ipsclass->member['_moderator'][ $topic['forum_id'] ]['edit_post']) and $this->ipsclass->member['_moderator'][ $topic['forum_id'] ]['edit_post'] )
|
||||
{
|
||||
$ok_to_remove = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $ok_to_remove;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Get allowed upload sizes
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* get_space_allowance
|
||||
*
|
||||
* Returns an array of the allowed upload sizes in bytes.
|
||||
* Return 'space_allowed' as -1 to not allow uploads.
|
||||
* Return 'space_allowed' as 0 to allow unlimited uploads
|
||||
* Return 'max_single_upload' as 0 to not set a limit
|
||||
*
|
||||
* @param id Member ID
|
||||
* @param string MD5 post key
|
||||
* @return array [ 'space_used', 'space_left', 'space_allowed', 'max_single_upload' ]
|
||||
*/
|
||||
function get_space_allowance( $post_key='', $member_id='' )
|
||||
{
|
||||
$max_php_size = intval( $this->ipsclass->math_get_post_max_size() );
|
||||
$member_id = intval( $member_id ? $member_id : $this->ipsclass->member['id'] );
|
||||
$space_left = 0;
|
||||
$space_used = 0;
|
||||
$space_allowed = 0;
|
||||
$max_single_upload = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Allowed to attach?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $member_id )
|
||||
{
|
||||
$space_allowed = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Generate total space allowed
|
||||
//-----------------------------------------
|
||||
|
||||
$total_space_allowed = ( $this->ipsclass->member['g_attach_per_post'] ? $this->ipsclass->member['g_attach_per_post'] : $this->ipsclass->member['g_attach_max'] ) * 1024;
|
||||
|
||||
//-----------------------------------------
|
||||
// Generate space allowed figure
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->member['g_attach_max'] > 0 )
|
||||
{
|
||||
if ( $this->ipsclass->member['g_attach_per_post'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Per post limit...
|
||||
//-----------------------------------------
|
||||
|
||||
$_space_used = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'SUM(attach_filesize) as figure',
|
||||
'from' => 'attachments',
|
||||
'where' => "attach_post_key='".$post_key."'" ) );
|
||||
|
||||
$space_used = intval( $_space_used['figure'] );
|
||||
$space_allowed = intval( ( $this->ipsclass->member['g_attach_per_post'] * 1024 ) - $space_used );
|
||||
$space_allowed = $space_allowed < 0 ? 0 : $space_allowed;
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Global limit...
|
||||
//-----------------------------------------
|
||||
|
||||
$_space_used = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'SUM(attach_filesize) as figure',
|
||||
'from' => 'attachments',
|
||||
'where' => 'attach_member_id='.$member_id ) );
|
||||
|
||||
$space_used = intval( $_space_used['figure'] );
|
||||
$space_allowed = intval( ( $this->ipsclass->member['g_attach_max'] * 1024 ) - $space_used );
|
||||
$space_allowed = $space_allowed < 0 ? 0 : $space_allowed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# Unlimited
|
||||
$space_allowed = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Generate space left figure
|
||||
//-----------------------------------------
|
||||
|
||||
$space_left = $space_allowed ? $space_allowed : 0;
|
||||
$space_left = ($space_left < 0) ? 0 : $space_left;
|
||||
|
||||
//-----------------------------------------
|
||||
// Generate max upload size
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $max_single_upload )
|
||||
{
|
||||
if ( $space_left > 0 AND $space_left < $max_php_size )
|
||||
{
|
||||
$max_single_upload = $space_left;
|
||||
}
|
||||
else if ( $max_php_size )
|
||||
{
|
||||
$max_single_upload = $max_php_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$return = array( 'space_used' => $space_used, 'space_left' => $space_left, 'space_allowed' => $space_allowed, 'max_single_upload' => $max_single_upload, 'total_space_allowed' => $total_space_allowed );
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Get settings
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* get_settings
|
||||
*
|
||||
* Returns an array of settings:
|
||||
* 'siu_thumb' = Allow thumbnail creation?
|
||||
* 'siu_height' = Height of the generated thumbnail in pixels
|
||||
* 'siu_width' = Width of the generated thumbnail in pixels
|
||||
* 'upload_dir' = Base upload directory (must be a full path)
|
||||
*
|
||||
* You can omit any of these settings and IPB will use the default
|
||||
* settings (which are the ones entered into the ACP for post thumbnails)
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function get_settings()
|
||||
{
|
||||
$this->settings = array();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,638 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+---------------------------------------------------------------------------
|
||||
| Invision Power Dynamic v1.0.0
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2004 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER DYNAMIC IS NOT FREE SOFTWARE!
|
||||
| http://www.invisionpower.com/dynamic/
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Id$
|
||||
| > $Revision: 4 $
|
||||
| > $Date: 2005-10-10 14:21:32 +0100 (Mon, 10 Oct 2005) $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > POST PLUG-IN
|
||||
| > Script written by Matt Mecham
|
||||
| > Date started: Monday 19th December 2005 (11:29)
|
||||
|
|
||||
+---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class plugin_post
|
||||
{
|
||||
/**
|
||||
* Global ipsclass
|
||||
* @var object
|
||||
*/
|
||||
var $ipsclass;
|
||||
|
||||
/**
|
||||
* Module type
|
||||
* @var string
|
||||
*/
|
||||
var $module = 'post';
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// show_attachment_get_sql_data
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Checks the attachment and checks for download / show perms
|
||||
* Returns TRUE or FALSE
|
||||
* IT really does
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function show_attachment_get_sql_data( $attach_id )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$_ok = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Grab 'em
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'a.*',
|
||||
'from' => array( 'attachments' => 'a' ),
|
||||
'where' => "a.attach_rel_module='".$this->module."' AND a.attach_id=".$attach_id,
|
||||
'add_join' => array( 0 => array( 'select' => 'p.pid, p.topic_id, p.queued',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => "p.pid=a.attach_rel_id",
|
||||
'type' => 'left' ),
|
||||
1 => array( 'select' => 't.forum_id',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => "t.tid=p.topic_id",
|
||||
'type' => 'left' ) )
|
||||
) );
|
||||
|
||||
$attach_sql = $this->ipsclass->DB->exec_query();
|
||||
|
||||
$attach = $this->ipsclass->DB->fetch_row( $attach_sql );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check..
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! isset( $attach['pid'] ) OR empty( $attach['pid'] ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Queued post?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $attach['queued'] )
|
||||
{
|
||||
if ( ! $this->ipsclass->can_queue_posts( $attach['forum_id'] ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// TheWalrus inspired fix for previewing
|
||||
// the post and clicking the attachment...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $attach['attach_rel_id'] == 0 AND $attach['attach_member_id'] == $this->ipsclass->member['id'] )
|
||||
{
|
||||
$_ok = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! $this->ipsclass->forums->forum_by_id[ $attach['forum_id'] ] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// TheWalrus inspired fix for previewing
|
||||
// the post and clicking the attachment...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $attach['attach_rel_id'] == 0 AND $attach['attach_member_id'] == $this->ipsclass->member['id'] )
|
||||
{
|
||||
# We're ok.
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $this->ipsclass->check_perms($this->ipsclass->forums->forum_by_id[ $attach['forum_id'] ]['read_perms']) === FALSE )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( $this->ipsclass->check_perms($this->ipsclass->forums->forum_by_id[ $attach['forum_id'] ]['download_perms']) === FALSE )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Still here?
|
||||
//-----------------------------------------
|
||||
|
||||
$_ok = 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Ok?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $_ok )
|
||||
{
|
||||
return $attach;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// render_attachment_get_sql_data
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Check the attachment and make sure its OK to display
|
||||
* Returns TRUE or FALSE
|
||||
* IT really does
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function render_attachment_get_sql_data( $attach_ids, $rel_ids=array(), $attach_post_key=0 )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$rows = array();
|
||||
$query = '';
|
||||
$match = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! is_array( $attach_ids ) OR ! count( $attach_ids ) )
|
||||
{
|
||||
$attach_ids = array( -2 );
|
||||
}
|
||||
|
||||
if ( is_array( $rel_ids ) and count( $rel_ids ) )
|
||||
{
|
||||
$query = " OR attach_rel_id IN (-1," . implode( ",", $rel_ids ) . ")";
|
||||
$match = 1;
|
||||
}
|
||||
|
||||
if ( $attach_post_key )
|
||||
{
|
||||
$query .= " OR attach_post_key='".$this->ipsclass->DB->add_slashes( $attach_post_key )."'";
|
||||
$match = 2;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Grab 'em
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->build_query( array( 'select' => '*',
|
||||
'from' => 'attachments',
|
||||
'where' => "attach_rel_module='".$this->module."' AND ( attach_id IN(-1,". implode( ",", $attach_ids ) . ") " . $query . " )",
|
||||
) );
|
||||
|
||||
$attach_sql = $this->ipsclass->DB->exec_query();
|
||||
|
||||
//-----------------------------------------
|
||||
// Loop through and filter off naughty ids
|
||||
//-----------------------------------------
|
||||
|
||||
while( $db_row = $this->ipsclass->DB->fetch_row( $attach_sql ) )
|
||||
{
|
||||
$_ok = 1;
|
||||
|
||||
if ( $match == 1 )
|
||||
{
|
||||
if ( ! in_array( $db_row['attach_rel_id'], $rel_ids ) )
|
||||
{
|
||||
$_ok = 0;
|
||||
}
|
||||
}
|
||||
else if ( $match == 2 )
|
||||
{
|
||||
if ( $db_row['attach_post_key'] != $attach_post_key )
|
||||
{
|
||||
$_ok = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Ok?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $_ok )
|
||||
{
|
||||
$rows[ $db_row['attach_id'] ] = $db_row;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Return
|
||||
//-----------------------------------------
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Remove attachment clean up
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Recounts number of attachments for the articles row
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function post_process_upload( $post_key, $rel_id, $args=array() )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$cnt = array( 'cnt' => 0 );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check..
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $post_key )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( "select" => 'COUNT(*) as cnt',
|
||||
'from' => 'attachments',
|
||||
'where' => "attach_post_key='{$post_key}'") );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
$cnt = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
if ( $cnt['cnt'] )
|
||||
{
|
||||
$this->ipsclass->DB->build_and_exec_query( array( 'update' => 'topics',
|
||||
'set' => "topic_hasattach=topic_hasattach+" . $cnt['cnt'],
|
||||
'where' => "tid=" . intval( $args['topic_id'] ) ) );
|
||||
}
|
||||
|
||||
return array( 'count' => $cnt['cnt'] );
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Remove attachment clean up
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Recounts number of attachments for the articles row
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function remove_attachment_clean_up( $attachment )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $attachment['attach_id'] )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'p.pid',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.pid='. intval( $attachment['attach_rel_id'] ),
|
||||
'add_join' => array( 0 => array( 'select' => 't.forum_id, t.tid',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id',
|
||||
'type' => 'inner' ) ) ) );
|
||||
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
$topic = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
if ( isset( $topic['tid'] ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// GET PIDS
|
||||
//-----------------------------------------
|
||||
|
||||
$pids = array();
|
||||
$count = 0;
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => 'pid',
|
||||
'from' => 'posts',
|
||||
'where' => "topic_id=". $topic['tid'] ) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
while ( $p = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$pids[] = $p['pid'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// GET ATTACHMENT COUNT
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count( $pids ) )
|
||||
{
|
||||
$this->ipsclass->DB->simple_construct( array( "select" => 'count(*) as cnt',
|
||||
'from' => 'attachments',
|
||||
'where' => "attach_rel_module='post' AND attach_rel_id IN(".implode(",",$pids).")") );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
$cnt = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
$count = intval( $cnt['cnt'] );
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'update' => 'topics', 'set' => "topic_hasattach=". $count , 'where' => "tid=".$topic['tid'] ) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Bulk remove attachment permissions check
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Returns TRUE or FALSE
|
||||
* IT really does
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function return_bulk_remove_permission( $attach_rel_ids=array() )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$ok_to_remove = FALSE;
|
||||
|
||||
//-----------------------------------------
|
||||
// Allowed to remove?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->member['group_access_cp'] )
|
||||
{
|
||||
$ok_to_remove = TRUE;
|
||||
}
|
||||
|
||||
return $ok_to_remove;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Remove attachment permissions check
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Returns TRUE or FALSE
|
||||
* IT really does
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function return_remove_permission( $attachment )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$ok_to_remove = FALSE;
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $attachment['attach_id'] )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Allowed to remove?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->member['id'] == $attachment['attach_member_id'] )
|
||||
{
|
||||
$ok_to_remove = TRUE;
|
||||
}
|
||||
else if ( $this->ipsclass->member['g_is_supmod'] )
|
||||
{
|
||||
$ok_to_remove = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Moderstor? Get forum ID
|
||||
//-----------------------------------------
|
||||
|
||||
if ( isset( $this->ipsclass->member['_moderator'] ) )
|
||||
{
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'p.pid',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.pid='. intval( $attach['attach_rel_id'] ),
|
||||
'add_join' => array( 0 => array( 'select' => 't.forum_id, t.tid',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id',
|
||||
'type' => 'inner' ) ) ) );
|
||||
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
$topic = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
if ( isset( $topic['forum_id'] ) )
|
||||
{
|
||||
if ( isset($this->ipsclass->member['_moderator'][ $topic['forum_id'] ]['edit_post']) and $this->ipsclass->member['_moderator'][ $topic['forum_id'] ]['edit_post'] )
|
||||
{
|
||||
$ok_to_remove = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $ok_to_remove;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Get allowed upload sizes
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* get_space_allowance
|
||||
*
|
||||
* Returns an array of the allowed upload sizes in bytes.
|
||||
* Return 'space_allowed' as -1 to not allow uploads.
|
||||
* Return 'space_allowed' as 0 to allow unlimited uploads
|
||||
* Return 'max_single_upload' as 0 to not set a limit
|
||||
*
|
||||
* @param id Member ID
|
||||
* @param string MD5 post key
|
||||
* @return array [ 'space_used', 'space_left', 'space_allowed', 'max_single_upload' ]
|
||||
*/
|
||||
function get_space_allowance( $post_key='', $member_id='' )
|
||||
{
|
||||
$max_php_size = intval( $this->ipsclass->math_get_post_max_size() );
|
||||
$member_id = intval( $member_id ? $member_id : $this->ipsclass->member['id'] );
|
||||
$forum_id = intval( $this->ipsclass->input['forum_id'] ? $this->ipsclass->input['forum_id'] : $this->ipsclass->input['f'] );
|
||||
$space_left = 0;
|
||||
$space_used = 0;
|
||||
$space_allowed = 0;
|
||||
$max_single_upload = 0;
|
||||
$space_calculated = 0;
|
||||
|
||||
if ( $post_key )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Check to make sure we're not attempting
|
||||
// to upload to another's post...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->ipsclass->member['g_is_supmod'] )
|
||||
{
|
||||
$post = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
'from' => 'posts',
|
||||
'where' => "post_key='".$post_key."'" ) );
|
||||
|
||||
if ( $post['post_key'] AND ( $post['author_id'] != $member_id ) )
|
||||
{
|
||||
$space_allowed = -1;
|
||||
$space_calculated = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Generate total space allowed
|
||||
//-----------------------------------------
|
||||
|
||||
$total_space_allowed = ( $this->ipsclass->member['g_attach_per_post'] ? $this->ipsclass->member['g_attach_per_post'] : $this->ipsclass->member['g_attach_max'] ) * 1024;
|
||||
|
||||
//-----------------------------------------
|
||||
// Allowed to attach?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $member_id OR ! $forum_id )
|
||||
{
|
||||
$space_allowed = -1;
|
||||
}
|
||||
if ( $this->ipsclass->check_perms( $this->ipsclass->cache['forum_cache'][ $forum_id ]['upload_perms'] ) !== TRUE )
|
||||
{
|
||||
$space_allowed = -1;
|
||||
}
|
||||
else if ( ! $space_calculated )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Generate space allowed figure
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->member['g_attach_max'] > 0 )
|
||||
{
|
||||
if ( $this->ipsclass->member['g_attach_per_post'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Per post limit...
|
||||
//-----------------------------------------
|
||||
|
||||
$_space_used = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'SUM(attach_filesize) as figure',
|
||||
'from' => 'attachments',
|
||||
'where' => "attach_post_key='".$post_key."'" ) );
|
||||
|
||||
$space_used = intval( $_space_used['figure'] );
|
||||
$space_allowed = intval( ( $this->ipsclass->member['g_attach_per_post'] * 1024 ) - $space_used );
|
||||
$space_allowed = $space_allowed < 0 ? 0 : $space_allowed;
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Global limit...
|
||||
//-----------------------------------------
|
||||
|
||||
$_space_used = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'SUM(attach_filesize) as figure',
|
||||
'from' => 'attachments',
|
||||
'where' => 'attach_member_id='.$member_id ) );
|
||||
|
||||
$space_used = intval( $_space_used['figure'] );
|
||||
$space_allowed = intval( ( $this->ipsclass->member['g_attach_max'] * 1024 ) - $space_used );
|
||||
$space_allowed = $space_allowed < 0 ? 0 : $space_allowed;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# Unlimited
|
||||
$space_allowed = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Generate space left figure
|
||||
//-----------------------------------------
|
||||
|
||||
$space_left = $space_allowed ? $space_allowed : 0;
|
||||
$space_left = ($space_left < 0) ? 0 : $space_left;
|
||||
|
||||
//-----------------------------------------
|
||||
// Generate max upload size
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $max_single_upload )
|
||||
{
|
||||
if ( $space_left > 0 AND $space_left < $max_php_size )
|
||||
{
|
||||
$max_single_upload = $space_left;
|
||||
}
|
||||
else if ( $max_php_size )
|
||||
{
|
||||
$max_single_upload = $max_php_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$return = array( 'space_used' => $space_used, 'space_left' => $space_left, 'space_allowed' => $space_allowed, 'max_single_upload' => $max_single_upload, 'total_space_allowed' => $total_space_allowed );
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Get settings
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* get_settings
|
||||
*
|
||||
* Returns an array of settings:
|
||||
* 'siu_thumb' = Allow thumbnail creation?
|
||||
* 'siu_height' = Height of the generated thumbnail in pixels
|
||||
* 'siu_width' = Width of the generated thumbnail in pixels
|
||||
* 'upload_dir' = Base upload directory (must be a full path)
|
||||
*
|
||||
* You can omit any of these settings and IPB will use the default
|
||||
* settings (which are the ones entered into the ACP for post thumbnails)
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function get_settings()
|
||||
{
|
||||
$this->settings = array();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -2,27 +2,17 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-03-06 14:58:13 +0000 (Mon, 06 Mar 2006) $
|
||||
| > $Revision: 161 $
|
||||
| > $Date: 2006-10-17 22:30:46 +0100 (Tue, 17 Oct 2006) $
|
||||
| > $Revision: 652 $
|
||||
| > $Author: bfarber $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
@@ -62,8 +52,25 @@
|
||||
* @version 2.1
|
||||
* @since 2.1.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class class_bbcode extends class_bbcode_core
|
||||
{
|
||||
var $parse_smilies = 0;
|
||||
var $parse_html = 0;
|
||||
var $parse_bbcode = 0;
|
||||
var $parse_wordwrap = 0;
|
||||
var $parse_nl2br = 1;
|
||||
var $parse_custombbcode = 1;
|
||||
|
||||
var $_image = '';
|
||||
var $_code = '';
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// CONSTRUCTOR
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -100,7 +107,7 @@ class class_bbcode extends class_bbcode_core
|
||||
// Remove session id's from any post
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#(\?|&|;|&)s=([0-9a-zA-Z]){32}(&|;|&|$)?#e", "\$this->regex_bash_session('\\1', '\\3')", $txt );
|
||||
$txt = preg_replace_callback( "#(\?|&|;|&)s=([0-9a-zA-Z]){32}(&|;|&|$)?#", array( $this, 'regex_bash_session' ), $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// convert <br> to \n
|
||||
@@ -113,15 +120,11 @@ class class_bbcode extends class_bbcode_core
|
||||
|
||||
$txt = preg_replace( "/<br>|<br \/>/", "\n", $txt );
|
||||
|
||||
# XSS Clean
|
||||
/*if( $this->strip_hex_entity )
|
||||
{
|
||||
while( preg_match( "/[&|&\;]#x(\w+?);/i", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "/[&|&\;]#x(\w+?);/ies" , "\$this->regex_bash_hex( '\\1' )" , $txt );
|
||||
}
|
||||
$txt = preg_replace( "#&(?!\;)#", "", $txt );
|
||||
}*/
|
||||
# First we did hex, now we do url encoded
|
||||
# <script
|
||||
$txt = str_replace( "%3C%73%63%72%69%70%74", "<script" , $txt );
|
||||
# document.cookie
|
||||
$txt = str_replace( "%64%6F%63%75%6D%65%6E%74%2E%63%6F%6F%6B%69%65", "document.cookie", $txt );
|
||||
|
||||
$txt = preg_replace( "#javascript\:#is" , "java script:", $txt );
|
||||
$txt = preg_replace( "#vb(.+?)?script\:#is", "vb script:" , $txt );
|
||||
@@ -139,14 +142,14 @@ class class_bbcode extends class_bbcode_core
|
||||
// Do [CODE] tag
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#\[code\](.+?)\[/code\]#ies", "\$this->regex_code_tag( '\\1' )", $txt );
|
||||
$txt = preg_replace_callback( "#\[code\](.+?)\[/code\]#is", array( $this, 'regex_code_tag' ), $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Do [QUOTE(name,date)] tags
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#(\[quote(.+?)?\].*\[/quote\])#ies" , "\$this->regex_parse_quotes('\\1')" , $txt );
|
||||
|
||||
$txt = preg_replace_callback( "#(\[quote(.+?)?\].*\[/quote\])#is" , array( $this, 'regex_parse_quotes' ), $txt );
|
||||
|
||||
// Quote changes \n to br
|
||||
$txt = preg_replace( "/<br>|<br \/>/", "\n", $txt );
|
||||
|
||||
@@ -154,15 +157,15 @@ class class_bbcode extends class_bbcode_core
|
||||
// Auto parse URLs
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#(^|\s|>)((http|https|news|ftp)://\w+[^\s\[\]\<]+)#ie" , "\$this->regex_build_url(array('html' => '\\2', 'show' => '\\2', 'st' => '\\1'))", $txt );
|
||||
$txt = preg_replace_callback( "#(^|\s|>)((http|https|news|ftp)://\w+[^\s\[\]\<]+)#i", array( $this, '_regex_build_url_manual' ), $txt );
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// If we are not parsing a siggie, lets have a bash
|
||||
// at the [PHP] [SQL] and [HTML] tags.
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
$txt = preg_replace( "#\[sql\](.+?)\[/sql\]#ies" , "\$this->regex_sql_tag('\\1')" , $txt );
|
||||
$txt = preg_replace( "#\[html\](.+?)\[/html\]#ies" , "\$this->regex_html_tag('\\1')" , $txt );
|
||||
$txt = preg_replace_callback( "#\[sql\](.+?)\[/sql\]#is" , array( $this, 'regex_sql_tag' ), $txt );
|
||||
$txt = preg_replace_callback( "#\[html\](.+?)\[/html\]#is" , array( $this, 'regex_html_tag' ), $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// left, right, center
|
||||
@@ -183,14 +186,14 @@ class class_bbcode extends class_bbcode_core
|
||||
// [LIST] [*] [/LIST]
|
||||
//-----------------------------------------
|
||||
|
||||
while( preg_match( "#\n?\[list\](.+?)\[/list\]\n?#ies" , $txt ) )
|
||||
while( preg_match( "#\n?\[list\](.+?)\[/list\]\n?#is" , $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\n?\[list\](.+?)\[/list\]\n?#ies", "\$this->regex_list('\\1')" , $txt );
|
||||
$txt = preg_replace_callback( "#\n?\[list\](.+?)\[/list\]\n?#is", array( $this, 'regex_list' ), $txt );
|
||||
}
|
||||
|
||||
while( preg_match( "#\n?\[list=(a|A|i|I|1)\](.+?)\[/list\]\n?#ies" , $txt ) )
|
||||
while( preg_match( "#\n?\[list=(a|A|i|I|1)\](.+?)\[/list\]\n?#is" , $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\n?\[list=(a|A|i|I|1)\](.+?)\[/list\]\n?#ies", "\$this->regex_list('\\2','\\1')" , $txt );
|
||||
$txt = preg_replace_callback( "#\n?\[list=(a|A|i|I|1)\](.+?)\[/list\]\n?#is", array( $this, 'regex_list' ), $txt );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -199,18 +202,20 @@ class class_bbcode extends class_bbcode_core
|
||||
|
||||
if ( $this->ipsclass->vars['allow_images'] )
|
||||
{
|
||||
$txt = preg_replace( "#\[img\](.+?)\[/img\]#ie" , "\$this->regex_check_image('\\1')" , $txt );
|
||||
$txt = preg_replace( "#(\[flash=)(\S+?)(\,)(\S+?)(\])(\S+?)(\[\/flash\])#ie", "\$this->regex_check_flash('\\2','\\4','\\6')", $txt );
|
||||
$txt = preg_replace_callback( "#\[img\](.+?)\[/img\]#i" , array( $this, 'regex_check_image' ), $txt );
|
||||
$txt = preg_replace_callback( "#(\[flash=)(\S+?)(\,)(\S+?)(\])(\S+?)(\[\/flash\])#i", array( $this, 'regex_check_flash' ), $txt );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Start off with the easy stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#\[b\](.+?)\[/b\]#is", "<b>\\1</b>", $txt );
|
||||
$txt = preg_replace( "#\[i\](.+?)\[/i\]#is", "<i>\\1</i>", $txt );
|
||||
$txt = preg_replace( "#\[u\](.+?)\[/u\]#is", "<u>\\1</u>", $txt );
|
||||
$txt = preg_replace( "#\[s\](.+?)\[/s\]#is", "<strike>\\1</strike>", $txt );
|
||||
$txt = $this->parse_simple_tag_recursively( 'b' , 'b' , 1, $txt );
|
||||
$txt = $this->parse_simple_tag_recursively( 'i' , 'i' , 1, $txt );
|
||||
$txt = $this->parse_simple_tag_recursively( 'u' , 'u' , 1, $txt );
|
||||
$txt = $this->parse_simple_tag_recursively( 's' , 'strike', 1, $txt );
|
||||
$txt = $this->parse_simple_tag_recursively( 'sub', 'sub' , 1, $txt );
|
||||
$txt = $this->parse_simple_tag_recursively( 'sup', 'sup' , 1, $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// (c) (r) and (tm)
|
||||
@@ -234,9 +239,9 @@ class class_bbcode extends class_bbcode_core
|
||||
// [url=http://www.index.com]ibforums![/url]
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#\[url\](\S+?)\[/url\]#ie" , "\$this->regex_build_url(array('html' => '\\1', 'show' => '\\1'))", $txt );
|
||||
$txt = preg_replace( "#\[url\s*=\s*\"\;\s*(\S+?)\s*\"\;\s*\](.*?)\[\/url\]#ie" , "\$this->regex_build_url(array('html' => '\\1', 'show' => '\\2'))", $txt );
|
||||
$txt = preg_replace( "#\[url\s*=\s*(\S+?)\s*\](.*?)\[\/url\]#ie" , "\$this->regex_build_url(array('html' => '\\1', 'show' => '\\2'))", $txt );
|
||||
$txt = preg_replace_callback( "#\[url\](.*?)\[/url\]#is" , array( $this, '_regex_build_url_tags'), $txt );
|
||||
$txt = preg_replace_callback( "#\[url\s*=\s*(?:\"\;|\")\s*(.*?)\s*(?:\"\;|\")\s*\](.*?)\[\/url\]#is", array( $this, '_regex_build_url_tags'), $txt );
|
||||
$txt = preg_replace_callback( "#\[url\s*=\s*(.*?)\s*\](.*?)\[\/url\]#is" , array( $this, '_regex_build_url_tags'), $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// font size, colour and font style
|
||||
@@ -246,24 +251,24 @@ class class_bbcode extends class_bbcode_core
|
||||
// [background=color]Text here[/background]
|
||||
//-----------------------------------------
|
||||
|
||||
while ( preg_match( "#\[background=([^\]]+)\](.+?)\[/background\]#ies", $txt ) )
|
||||
while ( preg_match( "#\[background=([^\]]+)\](.+?)\[/background\]#is", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\[background=([^\]]+)\](.+?)\[/background\]#ies", "\$this->regex_font_attr(array('s'=>'background','1'=>'\\1','2'=>'\\2'))", $txt );
|
||||
$txt = preg_replace_callback( "#\[background=([^\]]+)\](.+?)\[/background\]#is", array( $this, '_regex_font_attr_background' ), $txt );
|
||||
}
|
||||
|
||||
while ( preg_match( "#\[size=([^\]]+)\](.+?)\[/size\]#ies", $txt ) )
|
||||
while ( preg_match( "#\[size=([^\]]+)\](.+?)\[/size\]#is", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\[size=([^\]]+)\](.+?)\[/size\]#ies" , "\$this->regex_font_attr(array('s'=>'size','1'=>'\\1','2'=>'\\2'))", $txt );
|
||||
$txt = preg_replace_callback( "#\[size=([^\]]+)\](.+?)\[/size\]#is" , array( $this, '_regex_font_attr_size' ), $txt );
|
||||
}
|
||||
|
||||
while ( preg_match( "#\[font=([^\]]+)\](.+?)\[/font\]#ies", $txt ) )
|
||||
while ( preg_match( "#\[font=([^\]]+)\](.+?)\[/font\]#is", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\[font=([^\]]+)\](.+?)\[/font\]#ies" , "\$this->regex_font_attr(array('s'=>'font','1'=>'\\1','2'=>'\\2'))", $txt );
|
||||
$txt = preg_replace_callback( "#\[font=([^\]]+)\](.+?)\[/font\]#is" , array( $this, '_regex_font_attr_font' ), $txt );
|
||||
}
|
||||
|
||||
while( preg_match( "#\[color=([^\]]+)\](.+?)\[/color\]#ies", $txt ) )
|
||||
while( preg_match( "#\[color=([^\]]+)\](.+?)\[/color\]#is", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#\[color=([^\]]+)\](.+?)\[/color\]#ies" , "\$this->regex_font_attr(array('s'=>'col' ,'1'=>'\\1','2'=>'\\2'))", $txt );
|
||||
$txt = preg_replace_callback( "#\[color=([^\]]+)\](.+?)\[/color\]#is" , array( $this, '_regex_font_attr_color' ), $txt );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,8 +276,8 @@ class class_bbcode extends class_bbcode_core
|
||||
// Swap \n back to <br>
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "/\n/", "<br />", $txt );
|
||||
|
||||
$txt = str_replace( "\n", "<br />", $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Unicode?
|
||||
//-----------------------------------------
|
||||
@@ -290,27 +295,35 @@ class class_bbcode extends class_bbcode_core
|
||||
if ( $this->parse_smilies )
|
||||
{
|
||||
$txt = ' '.$txt.' ';
|
||||
|
||||
usort( $this->ipsclass->cache['emoticons'] , array( 'class_bbcode_core', 'smilie_length_sort' ) );
|
||||
|
||||
$codes_seen = array();
|
||||
|
||||
if ( count( $this->ipsclass->cache['emoticons'] ) > 0 )
|
||||
{
|
||||
foreach( $this->ipsclass->cache['emoticons'] as $a_id => $row)
|
||||
foreach( $this->ipsclass->cache['emoticons'] as $row)
|
||||
{
|
||||
if ( $row['emo_set'] != $this->ipsclass->skin['_emodir'] )
|
||||
if ( is_array($this->ipsclass->skin) AND $this->ipsclass->skin['_emodir'] AND $row['emo_set'] != $this->ipsclass->skin['_emodir'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$code = $row['typed'];
|
||||
$image = $row['image'];
|
||||
|
||||
if ( in_array( $code, $codes_seen ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$codes_seen[] = $code;
|
||||
|
||||
//-----------------------------------------
|
||||
// Make safe for regex
|
||||
//-----------------------------------------
|
||||
$code = preg_quote($code, "/");
|
||||
|
||||
$txt = preg_replace( "!(?<=[^\w&;/\"])$code(?=.\W|\"|\W.|\W$)!ei", "\$this->convert_emoticon('$code', '$image')", $txt );
|
||||
|
||||
$this->_code = preg_quote($code, "/");
|
||||
$this->_image = $row['image'];
|
||||
|
||||
$txt = preg_replace_callback( "!(?<=[^\w&;/\"])".$this->_code."(?=.\W|\"|\W.|\W$)!i", array( $this, 'convert_emoticon' ), $txt );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,7 +383,13 @@ class class_bbcode extends class_bbcode_core
|
||||
// Fix up <br /> in URLs
|
||||
//-----------------------------------------
|
||||
|
||||
$t = preg_replace( "#(<a href=[\"'])(.+?)([\"'])#ise", "\$this->_clean_long_url('\\1', '\\2', '\\3')", $t );
|
||||
$t = preg_replace_callback( "#(<a href=[\"'])(.+?)([\"'])#is", array( $this, '_clean_long_url' ), $t );
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up <br /> in IMGs
|
||||
//-----------------------------------------
|
||||
|
||||
$t = preg_replace_callback( "#(<img src=[\"'])(.+?)([\"'])#is", array( $this, '_clean_long_url' ), $t );
|
||||
|
||||
//-----------------------------------------
|
||||
// Custom BB code
|
||||
@@ -407,7 +426,7 @@ class class_bbcode extends class_bbcode_core
|
||||
$txt = str_replace( "<#EMO_DIR#>", "<#EMO_DIR>", $txt );
|
||||
|
||||
# New emo
|
||||
$txt = preg_replace( "#<([^>]+?)emoid=\"(.+?)\"([^>]+?)".">#is", "\\2", $txt );
|
||||
$txt = preg_replace( "#<([^>]+?)emoid=\"(.+?)\"([^>]*?)".">#is", "\\2", $txt );
|
||||
|
||||
# And convert it back again...
|
||||
$txt = str_replace( "<#EMO_DIR>", "<#EMO_DIR#>", $txt );
|
||||
@@ -428,20 +447,20 @@ class class_bbcode extends class_bbcode_core
|
||||
// SQL
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<!--sql-->(.+?)<!--sql1-->(.+?)<!--sql2-->(.+?)<!--sql3-->#eis", "\$this->unconvert_sql(\"\\2\")", $txt);
|
||||
$txt = preg_replace_callback( "#<!--sql-->(.+?)<!--sql1-->(.+?)<!--sql2-->(.+?)<!--sql3-->#is", array( $this, 'unconvert_sql'), $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// HTML
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<!--html-->(.+?)<!--html1-->(.+?)<!--html2-->(.+?)<!--html3-->#ise", "\$this->unconvert_htm(\"\\2\")", $txt);
|
||||
$txt = preg_replace_callback( "#<!--html-->(.+?)<!--html1-->(.+?)<!--html2-->(.+?)<!--html3-->#is", array( $this, 'unconvert_htm'), $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Images / Flash
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<!--Flash (.+?)-->.+?<!--End Flash-->#e", "\$this->unconvert_flash('\\1')", $txt );
|
||||
$txt = preg_replace( "#<img src=[\"'](\S+?)['\"].+?".">#" , "\[img\]\\1\[/img\]" , $txt );
|
||||
$txt = preg_replace_callback( "#<!--Flash (.+?)-->.+?<!--End Flash-->#", array( $this, 'unconvert_flash'), $txt );
|
||||
$txt = preg_replace( "#<img+?src=[\"'](\S+?)['\"].+?".">#" , "\[img\]\\1\[/img\]" , $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Email, URLs
|
||||
@@ -463,7 +482,7 @@ class class_bbcode extends class_bbcode_core
|
||||
// New quote
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<!--quoteo([^>]+?)?-->(.+?)<!--quotec-->#sie", "\$this->_parse_new_quote('\\1', '\\2' )" , $txt );
|
||||
$txt = preg_replace_callback( "#<!--quoteo([^>]+?)?-->(.+?)<!--quotec-->#si", array( $this, '_parse_new_quote'), $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// left, right, center
|
||||
@@ -488,20 +507,23 @@ class class_bbcode extends class_bbcode_core
|
||||
$txt = preg_replace( "#<!--c2-->(.+?)<!--ec2-->#", '[/code]', $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Easy peasy
|
||||
// Start off with the easy stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#<i>(.+?)</i>#is" , "\[i\]\\1\[/i\]" , $txt );
|
||||
$txt = preg_replace( "#<b>(.+?)</b>#is" , "\[b\]\\1\[/b\]" , $txt );
|
||||
$txt = preg_replace( "#<strike>(.+?)</strike>#is" , "\[s\]\\1\[/s\]" , $txt );
|
||||
$txt = preg_replace( "#<u>(.+?)</u>#is" , "\[u\]\\1\[/u\]" , $txt );
|
||||
$txt = $this->parse_simple_tag_recursively( 'b' , 'b' , 0, $txt );
|
||||
$txt = $this->parse_simple_tag_recursively( 'i' , 'i' , 0, $txt );
|
||||
$txt = $this->parse_simple_tag_recursively( 'u' , 'u' , 0, $txt );
|
||||
$txt = $this->parse_simple_tag_recursively( 'strike', 's' , 0, $txt );
|
||||
$txt = $this->parse_simple_tag_recursively( 'sub' , 'sub', 0, $txt );
|
||||
$txt = $this->parse_simple_tag_recursively( 'sup' , 'sup', 0, $txt );
|
||||
|
||||
//-----------------------------------------
|
||||
// List headache
|
||||
//-----------------------------------------
|
||||
|
||||
$txt = preg_replace( "#(\n){0,}<ul>#" , "\\1\[list\]" , $txt );
|
||||
$txt = preg_replace( "#(\n){0,}<ol type='(a|A|i|I|1)'>#" , "\\1\[list=\\2\]\n" , $txt );
|
||||
$txt = preg_replace( "#(\n){0,}<ol>#" , "\\1\[list=1\]" , $txt );
|
||||
$txt = preg_replace( "#(\n){0,}<ol type=[\"'](a|A|i|I|1)[\"']>#" , "\\1\[list=\\2\]\n" , $txt );
|
||||
$txt = preg_replace( "#(\n){0,}<li>#" , "\n\[*\]" , $txt );
|
||||
$txt = preg_replace( "#(\n){0,}</ul>(\n){0,}#", "\n\[/list\]\\2" , $txt );
|
||||
$txt = preg_replace( "#(\n){0,}</ol>(\n){0,}#", "\n\[/list\]\\2" , $txt );
|
||||
@@ -528,24 +550,33 @@ class class_bbcode extends class_bbcode_core
|
||||
// LEGACY SPAN TAGS
|
||||
//-----------------------------------------
|
||||
|
||||
while ( preg_match( "#<span style=['\"]font-size:(.+?)pt;line-height:100%['\"]>(.+?)</span>#is", $txt ) )
|
||||
//-----------------------------------------
|
||||
// WYSI-Weirdness #9923464: Opera span tags
|
||||
//-----------------------------------------
|
||||
|
||||
while ( preg_match( "#<span style='font-family: \"(.+?)\"'>(.+?)</span>#is", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#<span style=['\"]font-size:(.+?)pt;line-height:100%['\"]>(.+?)</span>#ise" , "\$this->unconvert_size('\\1', '\\2')", $txt );
|
||||
$txt = preg_replace( "#<span style='font-family: \"(.+?)\"'>(.+?)</span>#is", "\[font=\\1\]\\2\[/font\]", $txt );
|
||||
}
|
||||
|
||||
while ( preg_match( "#<span style=['\"]font-size:?\s+?(.+?)pt;?\s+?line-height:?\s+?100%['\"]>(.+?)</span>#is", $txt ) )
|
||||
{
|
||||
$txt = preg_replace_callback( "#<span style=['\"]font-size:?\s+?(.+?)pt;?\s+?line-height:?\s+?100%['\"]>(.+?)</span>#is" , array( $this, 'unconvert_size' ), $txt );
|
||||
}
|
||||
|
||||
while ( preg_match( "#<span style=['\"]color:(.+?)['\"]>(.+?)</span>#is", $txt ) )
|
||||
while ( preg_match( "#<span style=['\"]color:?\s+?(.+?)['\"]>(.+?)</span>#is", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#<span style=['\"]color:(.+?)['\"]>(.+?)</span>#is" , "\[color=\\1\]\\2\[/color\]", $txt );
|
||||
$txt = preg_replace( "#<span style=['\"]color:?\s+?(.+?)['\"]>(.+?)</span>#is" , "\[color=\\1\]\\2\[/color\]", $txt );
|
||||
}
|
||||
|
||||
while ( preg_match( "#<span style=['\"]font-family:(.+?)['\"]>(.+?)</span>#is", $txt ) )
|
||||
while ( preg_match( "#<span style=['\"]font-family:?\s+?(.+?)['\"]>(.+?)</span>#is", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#<span style=['\"]font-family:(.+?)['\"]>(.+?)</span>#is", "\[font=\\1\]\\2\[/font\]", $txt );
|
||||
$txt = preg_replace( "#<span style=['\"]font-family:?\s+?(.+?)['\"]>(.+?)</span>#is", "\[font=\\1\]\\2\[/font\]", $txt );
|
||||
}
|
||||
|
||||
while ( preg_match( "#<span style=['\"]background-color:(.+?)['\"]>(.+?)</span>#is", $txt ) )
|
||||
while ( preg_match( "#<span style=['\"]background-color:?\s+?(.+?)['\"]>(.+?)</span>#is", $txt ) )
|
||||
{
|
||||
$txt = preg_replace( "#<span style=['\"]background-color:(.+?)['\"]>(.+?)</span>#is", "\[background=\\1\]\\2\[/font\]", $txt );
|
||||
$txt = preg_replace( "#<span style=['\"]background-color:?\s+?(.+?)['\"]>(.+?)</span>#is", "\[background=\\1\]\\2\[/font\]", $txt );
|
||||
}
|
||||
|
||||
# Legacy <strike>
|
||||
@@ -587,8 +618,15 @@ class class_bbcode extends class_bbcode_core
|
||||
* @param string Emo Image URL
|
||||
* @return string Converted text
|
||||
*/
|
||||
function convert_emoticon($code="", $image="")
|
||||
function convert_emoticon( $matches=array() )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$code = $this->_code;
|
||||
$image = $this->_image;
|
||||
|
||||
if ( ! $code or ! $image )
|
||||
{
|
||||
return;
|
||||
@@ -635,6 +673,7 @@ class class_bbcode extends class_bbcode_core
|
||||
//-----------------------------------------
|
||||
|
||||
$style = str_replace( '"', '', $style );
|
||||
$style = str_replace( '"' , '', $style );
|
||||
|
||||
//-----------------------------------------
|
||||
// Make safe
|
||||
@@ -646,9 +685,9 @@ class class_bbcode extends class_bbcode_core
|
||||
// Size
|
||||
//-----------------------------------------
|
||||
|
||||
if ($type == 'size')
|
||||
if ( $type == 'size' )
|
||||
{
|
||||
$style = intval($style);
|
||||
$style = intval( stripslashes( $style ) );
|
||||
$real = $this->convert_bbsize_to_realsize( $style );
|
||||
|
||||
return "<!--sizeo:{$style}--><span style=\"font-size:".$real."pt;line-height:100%\"><!--/sizeo-->".$text."<!--sizec--></span><!--/sizec-->";
|
||||
@@ -681,7 +720,15 @@ class class_bbcode extends class_bbcode_core
|
||||
else if ($type == 'font')
|
||||
{
|
||||
$style = preg_replace( "/[^\d\w\#\-\_\s]/s", "", $style );
|
||||
return "<!--fonto:{$style}--><span style=\"font-family:".$style."\"><!--/fonto-->".$text."<!--fontc--></span><!--/fontc-->";
|
||||
|
||||
if( $this->ipsclass->browser['browser'] == 'opera' )
|
||||
{
|
||||
return "<!--fonto:{$style}--><span style='font-family: \"".$style."\"'><!--/fonto-->".$text."<!--fontc--></span><!--/fontc-->";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "<!--fonto:{$style}--><span style=\"font-family:".$style."\"><!--/fonto-->".$text."<!--fontc--></span><!--/fontc-->";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -697,11 +744,11 @@ class class_bbcode extends class_bbcode_core
|
||||
* @param string SANS URL
|
||||
* @return string Converted text
|
||||
*/
|
||||
function _clean_long_url( $before, $url, $after )
|
||||
function _clean_long_url( $matches=array() )
|
||||
{
|
||||
$before = stripslashes( $before );
|
||||
$url = stripslashes( $url );
|
||||
$after = stripslashes( $after );
|
||||
$before = stripslashes( $matches[1] );
|
||||
$url = stripslashes( $matches[2] );
|
||||
$after = stripslashes( $matches[3] );
|
||||
|
||||
return $before . str_replace( '<br />', '', str_replace( "? ", "?", $url ) ) . $after;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -2,28 +2,18 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2005-10-24 22:17:00 +0100 (Mon, 24 Oct 2005) $
|
||||
| > $Revision: 64 $
|
||||
| > $Author: bfarber $
|
||||
| > $Date: 2006-09-22 11:28:54 +0100 (Fri, 22 Sep 2006) $
|
||||
| > $Revision: 567 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > BB Code LEGACY Module
|
||||
@@ -60,8 +50,22 @@
|
||||
* @version 2.1
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class class_bbcode extends class_bbcode_core
|
||||
{
|
||||
var $parse_smilies = 0;
|
||||
var $parse_html = 0;
|
||||
var $parse_bbcode = 0;
|
||||
var $parse_wordwrap = 0;
|
||||
var $parse_nl2br = 1;
|
||||
var $parse_custombbcode = 1;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// CONSTRUCTOR
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -231,19 +235,26 @@ class class_bbcode extends class_bbcode_core
|
||||
if ( $this->parse_smilies )
|
||||
{
|
||||
$txt = ' '.$txt.' ';
|
||||
|
||||
usort( $this->ipsclass->cache['emoticons'] , array( 'post_parser', 'smilie_length_sort' ) );
|
||||
$codes_seen = array();
|
||||
|
||||
if ( count( $this->ipsclass->cache['emoticons'] ) > 0 )
|
||||
{
|
||||
foreach( $this->ipsclass->cache['emoticons'] as $a_id => $row)
|
||||
foreach( $this->ipsclass->cache['emoticons'] as $row)
|
||||
{
|
||||
if ( $row['emo_set'] != $this->ipsclass->skin['_emodir'] )
|
||||
if ( $this->ipsclass->skin['_emodir'] && $row['emo_set'] != $this->ipsclass->skin['_emodir'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$code = $row['typed'];
|
||||
|
||||
if( in_array( $code, $codes_seen ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$codes_seen[] = $code;
|
||||
|
||||
$image = $row['image'];
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
@@ -1,15 +1 @@
|
||||
<html>
|
||||
<head><title>Ошибка < Русская версия Invision Power Board</title></head>
|
||||
<body>
|
||||
<h1>Ошибка < Русская версия Invision Power Board</h1>
|
||||
<hr>
|
||||
Вы попали на несуществующую страницу!<br>Пожалуйста нажмите на кнопочку «<b>Назад</b>»
|
||||
в вашем браузере для возвращения на предыдущую страницу.
|
||||
<hr>
|
||||
<b>Invision Power Board:</b>
|
||||
<ul>
|
||||
<li><a href="http://www.bestwarez.ru" title="BestWarez.Ru - Только лучший Варез!">Русская версия</a></li>
|
||||
<li><a href="http://www.invisionboard.com" title="Official Site">English version</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
<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://www.invisionboard.com/">Invision Power Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,294 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-08-01 17:02:55 +0100 (Tue, 01 Aug 2006) $
|
||||
| > $Revision: 425 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > AJAX Functions
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: Wednesday 2nd August 2006
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class class_ajax
|
||||
{
|
||||
/**
|
||||
* Global IPS class
|
||||
*/
|
||||
var $ipsclass;
|
||||
|
||||
/**
|
||||
* XML output
|
||||
*/
|
||||
var $xml_output;
|
||||
|
||||
/**
|
||||
* XML Header
|
||||
*/
|
||||
var $xml_header;
|
||||
|
||||
/**
|
||||
* Character sets
|
||||
*/
|
||||
var $decode_charsets = array( 'iso-8859-1' => 'ISO-8859-1',
|
||||
'iso8859-1' => 'ISO-8859-1',
|
||||
'iso-8859-15' => 'ISO-8859-15',
|
||||
'iso8859-15' => 'ISO-8859-15',
|
||||
'utf-8' => 'UTF-8',
|
||||
'cp866' => 'cp866',
|
||||
'ibm866' => 'cp866',
|
||||
'cp1251' => 'windows-1251',
|
||||
'windows-1251' => 'windows-1251',
|
||||
'win-1251' => 'windows-1251',
|
||||
'cp1252' => 'windows-1252',
|
||||
'windows-1252' => 'windows-1252',
|
||||
'koi8-r' => 'KOI8-R',
|
||||
'koi8-ru' => 'KOI8-R',
|
||||
'koi8r' => 'KOI8-R',
|
||||
'big5' => 'BIG5',
|
||||
'gb2312' => 'GB2312',
|
||||
'big5-hkscs' => 'BIG5-HKSCS',
|
||||
'shift_jis' => 'Shift_JIS',
|
||||
'sjis' => 'Shift_JIS',
|
||||
'euc-jp' => 'EUC-JP',
|
||||
'eucjp' => 'EUC-JP' );
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Initialize the class
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* INIT the class
|
||||
*/
|
||||
function class_init()
|
||||
{
|
||||
$this->xml_header = "<?xml version=\"1.0\" encoding=\"{$this->ipsclass->vars['gb_char_set']}\"?".'>';
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// make string XML safe
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Make a string safe for XML transport
|
||||
*/
|
||||
function _make_safe_for_xml( $t )
|
||||
{
|
||||
return str_replace( '&#39;', ''', htmlspecialchars( $t ) );
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Error handler
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Print an error
|
||||
*/
|
||||
function error_handler()
|
||||
{
|
||||
@header( "Content-type: text/xml" );
|
||||
$this->print_nocache_headers();
|
||||
$this->xml_output = $this->xml_header."\r\n<errors>\r\n";
|
||||
$this->xml_output .= "<error><message>You must be logged in to access this feature</message></error>\r\n";
|
||||
$this->xml_output .= "</errors>";
|
||||
print $this->xml_output;
|
||||
exit();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Return NOTHING :o
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Return a NULL result
|
||||
*/
|
||||
function return_null($val=0)
|
||||
{
|
||||
@header( "Content-type: text/xml" );
|
||||
$this->print_nocache_headers();
|
||||
print $this->xml_header."\r\n<null>{$val}</null>";
|
||||
exit();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Return string
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Return a string
|
||||
*/
|
||||
function return_string($string)
|
||||
{
|
||||
@header( "Content-type: text/plain" );
|
||||
$this->print_nocache_headers();
|
||||
print $string;
|
||||
exit();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Return HTML
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Return a HTML
|
||||
*/
|
||||
function return_html($string)
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Stop one from removing cookie protection
|
||||
//-----------------------------------------
|
||||
|
||||
$string = ( $string ) ? $string : '<!--nothing-->';
|
||||
$string = preg_replace( "#htmldocument\.prototype#is", "HTMLDocument_prototype", $string );
|
||||
|
||||
// Fix IE bugs
|
||||
$string = str_replace( "§", "&sect", $string );
|
||||
$string = str_replace( "ì", "“", $string );
|
||||
$string = str_replace( "î", "”", $string );
|
||||
|
||||
// Other stuff
|
||||
$string = str_replace( "<#IMG_DIR#>", $this->ipsclass->skin['_imagedir'], $string );
|
||||
$string = str_replace( "<#EMO_DIR#>", $this->ipsclass->skin['_emodir'] , $string );
|
||||
|
||||
@header( "Content-type: text/html;charset=".$this->ipsclass->vars['gb_char_set'] );
|
||||
$this->print_nocache_headers();
|
||||
print $string;
|
||||
exit();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Print no cache headers
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Print nocache headers
|
||||
*/
|
||||
function print_nocache_headers()
|
||||
{
|
||||
header("HTTP/1.0 200 OK");
|
||||
header("HTTP/1.1 200 OK");
|
||||
header("Cache-Control: no-cache, must-revalidate, max-age=0");
|
||||
header("Expires: 0");
|
||||
header("Pragma: no-cache");
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Convert decimal character references to UTF-8
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Convert a decimal character to UTF-8
|
||||
*/
|
||||
function dec_char_ref_to_utf8($int=0)
|
||||
{
|
||||
$return = '';
|
||||
|
||||
if ( $int < 0 )
|
||||
{
|
||||
return chr(0);
|
||||
}
|
||||
else if ( $int <= 0x007f )
|
||||
{
|
||||
$return .= chr($int);
|
||||
}
|
||||
else if ( $int <= 0x07ff )
|
||||
{
|
||||
$return .= chr(0xc0 | ($int >> 6));
|
||||
$return .= chr(0x80 | ($int & 0x003f));
|
||||
}
|
||||
else if ( $int <= 0xffff )
|
||||
{
|
||||
$return .= chr(0xe0 | ($int >> 12));
|
||||
$return .= chr(0x80 | (($int >> 6) & 0x003f));
|
||||
$return .= chr(0x80 | ($int & 0x003f));
|
||||
}
|
||||
else if ( $int <= 0x10ffff )
|
||||
{
|
||||
$return .= chr(0xf0 | ($int >> 18));
|
||||
$return .= chr(0x80 | (($int >> 12) & 0x3f));
|
||||
$return .= chr(0x80 | (($int >> 6) & 0x3f));
|
||||
$return .= chr(0x80 | ($int & 0x3f));
|
||||
}
|
||||
else
|
||||
{
|
||||
return chr(0);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Helper function
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function dec_char_ref_to_utf8_hexdec( $matches )
|
||||
{
|
||||
return $this->dec_char_ref_to_utf8( hexdec( $matches[1] ) );
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Convert Ajax unicode
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function convert_unicode($t)
|
||||
{
|
||||
if ( strtolower($this->ipsclass->vars['gb_char_set']) == 'utf-8' )
|
||||
{
|
||||
return preg_replace_callback( '#%u([0-9A-F]{1,4})#i', array( $this, 'dec_char_ref_to_utf8_hexdec' ), utf8_encode($t) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return preg_replace_callback( '#%u([0-9A-F]{1,4})#i', create_function( '$matches', "return '&#' . hexdec(\$matches[1]) . ';';" ), $t );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert HTML entities and respect character sets
|
||||
*/
|
||||
function convert_html_entities($t)
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Try and fix up HTML entities with missing ;
|
||||
//-----------------------------------------
|
||||
|
||||
$t = preg_replace( "/&#(\d+?)([^\d;])/i", "&#\\1;\\2", $t );
|
||||
|
||||
//-----------------------------------------
|
||||
// Continue...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( strtolower($this->ipsclass->vars['gb_char_set']) != 'iso-8859-1' &&
|
||||
strtolower($this->ipsclass->vars['gb_char_set']) != 'utf-8' )
|
||||
{
|
||||
if ( array_key_exists( strtolower($this->ipsclass->vars['gb_char_set']), $this->decode_charsets ) )
|
||||
{
|
||||
$this->ipsclass->vars['gb_char_set'] = $this->decode_charsets[strtolower($this->ipsclass->vars['gb_char_set'])];
|
||||
$t = html_entity_decode( $t, ENT_NOQUOTES, $this->ipsclass->vars['gb_char_set'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Take a crack at entities in other character sets
|
||||
|
||||
$t = str_replace( "&#", "&#", $t );
|
||||
}
|
||||
}
|
||||
|
||||
return $t;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,695 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+---------------------------------------------------------------------------
|
||||
| Invision Power Dynamic v1.0.0
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2004 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER DYNAMIC IS NOT FREE SOFTWARE!
|
||||
| http://www.invisionpower.com/dynamic/
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Id$
|
||||
| > $Revision: 128 $
|
||||
| > $Date: 2006-01-20 12:46:26 +0000 (Fri, 20 Jan 2006) $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > CAPTCHA ANTI-SPAM CLASS
|
||||
| > Script written by Matt Mecham
|
||||
| > Date started: Thursday 2 February (11:08)
|
||||
|
|
||||
+---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* CAPTCHA CLASS
|
||||
* ipsclass dependent method of showing an anti-spam image
|
||||
*
|
||||
* This creates a unique MD5 hash and stores it in the DB with
|
||||
* an 8 character string of 0-9a-z
|
||||
*
|
||||
* <code>
|
||||
* CREATE TABLE captcha (
|
||||
* captcha_unique_id VARCHAR(32) NOT NULL default '',
|
||||
* captcha_string VARCHAR(100) NOT NULL default '',
|
||||
* captcha_ipaddress VARCHAR(16) NOT NULL default '',
|
||||
* captcha_date INT(10) NOT NULL default '',
|
||||
* PRIMARY KEY (captcha_unique_id )
|
||||
* );
|
||||
* </code>
|
||||
* @package IPDYNAMIC
|
||||
* @author Matt Mecham
|
||||
* @copyright Invision Power Services, Inc.
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
class class_captcha
|
||||
{
|
||||
/**
|
||||
* Global IPS class array
|
||||
* @var object
|
||||
*/
|
||||
var $ipsclass;
|
||||
|
||||
/**
|
||||
* GD version
|
||||
* @var integer
|
||||
*/
|
||||
var $gd_version = 0;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Initializes captcha session
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Initializes captcha session
|
||||
* Clears out "dead" entries, adds new row and returns
|
||||
* unique ID for use in an image
|
||||
*
|
||||
* @return string Captcha unique ID
|
||||
*/
|
||||
function captcha_create_session()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Clear old
|
||||
//-----------------------------------------
|
||||
|
||||
$this->captcha_clear_sessions( $this->ipsclass->ip_address );
|
||||
|
||||
//-----------------------------------------
|
||||
// Create new ID
|
||||
//-----------------------------------------
|
||||
|
||||
$captcha_unique_id = md5( uniqid( time() ) );
|
||||
$captcha_string = "";
|
||||
|
||||
//-----------------------------------------
|
||||
// Create new string
|
||||
//-----------------------------------------
|
||||
|
||||
mt_srand( (double) microtime() * 1000000 );
|
||||
$final_rand = md5( uniqid( mt_rand(), TRUE ) );
|
||||
mt_srand();
|
||||
|
||||
for( $i = 0; $i < 8; $i++ )
|
||||
{
|
||||
$captcha_string .= $final_rand{ mt_rand(0, 31) };
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add to the DB
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->do_insert( 'captcha', array( 'captcha_unique_id' => $captcha_unique_id,
|
||||
'captcha_string' => $captcha_string,
|
||||
'captcha_ipaddress' => $this->ipsclass->ip_address,
|
||||
'captcha_date' => time() ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Return ID
|
||||
//-----------------------------------------
|
||||
|
||||
return $captcha_unique_id;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Captcha validate
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Show the captcha bot image
|
||||
*
|
||||
* @param string captcha_unique_id The captcha DB row
|
||||
* @param string captcha_input The user entered data
|
||||
* @return void
|
||||
* @since 1.0
|
||||
*/
|
||||
function captcha_validate( $captcha_unique_id, $captcha_input )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$captcha_input = trim( strtolower($captcha_input) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the info from the DB
|
||||
//-----------------------------------------
|
||||
|
||||
$captcha = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
'from' => 'captcha',
|
||||
'where' => "captcha_unique_id='".$captcha_unique_id."'" ) );
|
||||
|
||||
if ( ! $captcha['captcha_unique_id'] )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $captcha['captcha_string'] != $captcha_input )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Captcha show image
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Show the captcha bot image
|
||||
*
|
||||
* @param string captcha_unique_id
|
||||
* @return void
|
||||
* @since 1.0
|
||||
*/
|
||||
function captcha_show_image( $captcha_unique_id )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// CHECK
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $captcha_unique_id )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the info from the DB
|
||||
//-----------------------------------------
|
||||
|
||||
$captcha = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
'from' => 'captcha',
|
||||
'where' => "captcha_unique_id='".$captcha_unique_id."'" ) );
|
||||
|
||||
if ( ! $captcha['captcha_unique_id'] )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Show it...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->captcha_show_gd_img( $captcha['captcha_string'] );
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Show GD created security image...
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Show anti-spam bot GD image numbers
|
||||
*
|
||||
* @param string Number string
|
||||
* @return void
|
||||
* @since 1.0
|
||||
*/
|
||||
function captcha_show_gd_img( $content="" )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$content = ' '. preg_replace( "/(\w)/", "\\1 ", $content ) .' ';
|
||||
$allow_fonts = 1;
|
||||
$use_fonts = 0;
|
||||
$tmp_x = 135;
|
||||
$tmp_y = 20;
|
||||
$image_x = 200;
|
||||
$image_y = 60;
|
||||
$circles = 3;
|
||||
$continue_loop = TRUE;
|
||||
$_started = FALSE;
|
||||
|
||||
//-----------------------------------------
|
||||
// Get backgrounds and fonts...
|
||||
//-----------------------------------------
|
||||
|
||||
$backgrounds = $this->_captcha_show_gd_img_get_backgrounds();
|
||||
$fonts = $this->_captcha_show_gd_img_get_fonts();
|
||||
|
||||
//-----------------------------------------
|
||||
// Seed rand functions for PHP versions that don't
|
||||
//-----------------------------------------
|
||||
|
||||
mt_srand( (double) microtime() * 1000000 );
|
||||
|
||||
//-----------------------------------------
|
||||
// Got a background?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->vars['gd_version'] > 1 )
|
||||
{
|
||||
while ( $continue_loop )
|
||||
{
|
||||
if ( is_array( $backgrounds ) AND count( $backgrounds ) )
|
||||
{
|
||||
$i = mt_rand(0, count( $backgrounds ) - 1 );
|
||||
|
||||
$background = $backgrounds[ $i ];
|
||||
$_file_extension = preg_replace( "#^.*\.(\w{2,4})$#is", "\\1", strtolower( $background ) );
|
||||
|
||||
switch( $_file_extension )
|
||||
{
|
||||
case 'jpg':
|
||||
case 'jpe':
|
||||
case 'jpeg':
|
||||
if ( ! function_exists('imagecreatefromjpeg') OR ! $im = @imagecreatefromjpeg($background) )
|
||||
{
|
||||
unset( $backgrounds[ $i ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$continue_loop = FALSE;
|
||||
$_started = TRUE;
|
||||
}
|
||||
break;
|
||||
case 'gif':
|
||||
if ( ! function_exists('imagecreatefromgif') OR ! $im = @imagecreatefromgif($background) )
|
||||
{
|
||||
unset( $backgrounds[ $i ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$continue_loop = FALSE;
|
||||
$_started = TRUE;
|
||||
}
|
||||
break;
|
||||
case 'png':
|
||||
if ( ! function_exists('imagecreatefrompng') OR ! $im = @imagecreatefrompng($background) )
|
||||
{
|
||||
unset( $backgrounds[ $i ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$continue_loop = FALSE;
|
||||
$_started = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$continue_loop = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Still not got one? DO OLD FASHIONED
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $_started !== TRUE )
|
||||
{
|
||||
if ( $this->ipsclass->vars['gd_version'] == 1 )
|
||||
{
|
||||
$im = imagecreate($image_x, $image_y);
|
||||
$tmp = imagecreate($tmp_x, $tmp_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
$im = imagecreatetruecolor($image_x, $image_y);
|
||||
$tmp = imagecreatetruecolor($tmp_x, $tmp_y);
|
||||
}
|
||||
|
||||
$white = ImageColorAllocate($tmp, 255, 255, 255);
|
||||
$black = ImageColorAllocate($tmp, 0, 0, 0);
|
||||
$grey = ImageColorAllocate($tmp, 200, 200, 200 );
|
||||
|
||||
imagefill($tmp, 0, 0, $white);
|
||||
|
||||
for ( $i = 1; $i <= $circles; $i++ )
|
||||
{
|
||||
$values = array(
|
||||
0 => rand(0, $tmp_x - 10),
|
||||
1 => rand(0, $tmp_y - 3),
|
||||
2 => rand(0, $tmp_x - 10),
|
||||
3 => rand(0, $tmp_y - 3),
|
||||
4 => rand(0, $tmp_x - 10),
|
||||
5 => rand(0, $tmp_y - 3),
|
||||
6 => rand(0, $tmp_x - 10),
|
||||
7 => rand(0, $tmp_y - 3),
|
||||
8 => rand(0, $tmp_x - 10),
|
||||
9 => rand(0, $tmp_y - 3),
|
||||
10 => rand(0, $tmp_x - 10),
|
||||
11 => rand(0, $tmp_y - 3),
|
||||
);
|
||||
|
||||
$randomcolor = imagecolorallocate( $tmp, rand(100,255), rand(100,255),rand(100,255) );
|
||||
imagefilledpolygon($tmp, $values, 6, $randomcolor );
|
||||
}
|
||||
|
||||
$num = strlen($content);
|
||||
$x_param = 0;
|
||||
$y_param = 0;
|
||||
|
||||
for( $i = 0; $i < $num; $i++ )
|
||||
{
|
||||
$x_param += rand(6,12);
|
||||
$y_param = rand(-3,8);
|
||||
|
||||
$randomcolor = imagecolorallocate( $tmp, rand(0,150), rand(0,150),rand(0,150) );
|
||||
|
||||
imagestring($tmp, 5, $x_param+1, $y_param+1, $content{$i}, $grey);
|
||||
imagestring($tmp, 5, $x_param, $y_param, $content{$i}, $randomcolor);
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Distort by resizing
|
||||
//-----------------------------------------
|
||||
|
||||
imagecopyresized($im, $tmp, 0, 0, 0, 0, $image_x, $image_y, $tmp_x, $tmp_y);
|
||||
|
||||
imagedestroy($tmp);
|
||||
|
||||
//-----------------------------------------
|
||||
// Background dots and lines
|
||||
//-----------------------------------------
|
||||
|
||||
$random_pixels = $image_x * $image_y / 10;
|
||||
|
||||
for ($i = 0; $i < $random_pixels; $i++)
|
||||
{
|
||||
$randomcolor = imagecolorallocate( $im, rand(0,150), rand(0,150),rand(0,150) );
|
||||
ImageSetPixel($im, rand(0, $image_x), rand(0, $image_y), $randomcolor);
|
||||
}
|
||||
|
||||
$no_x_lines = ($image_x - 1) / 5;
|
||||
|
||||
for ( $i = 0; $i <= $no_x_lines; $i++ )
|
||||
{
|
||||
ImageLine( $im, $i * $no_x_lines, 0, $i * $no_x_lines, $image_y, $grey );
|
||||
ImageLine( $im, $i * $no_x_lines, 0, ($i * $no_x_lines)+$no_x_lines, $image_y, $grey );
|
||||
}
|
||||
|
||||
$no_y_lines = ($image_y - 1) / 5;
|
||||
|
||||
for ( $i = 0; $i <= $no_y_lines; $i++ )
|
||||
{
|
||||
ImageLine( $im, 0, $i * $no_y_lines, $image_x, $i * $no_y_lines, $grey );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Can we use fonts?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $allow_fonts AND function_exists('imagettftext') AND is_array( $fonts ) AND count( $fonts ) )
|
||||
{
|
||||
imageantialias( $im, TRUE );
|
||||
|
||||
$num = strlen($content);
|
||||
$x_param = -18;
|
||||
$y_param = 0;
|
||||
$_font = $fonts[ mt_rand( 0, count( $fonts ) - 1 ) ];
|
||||
|
||||
for( $i = 0; $i < $num; $i++ )
|
||||
{
|
||||
$y_param = rand( 35, 48 );
|
||||
|
||||
# Main color
|
||||
$col_r = rand(50,200);
|
||||
$col_g = rand(0,150);
|
||||
$col_b = rand(50,200);
|
||||
# High light
|
||||
$col_r_l = ( $col_r + 50 > 255 ) ? 255 : $col_r + 50;
|
||||
$col_g_l = ( $col_g + 50 > 255 ) ? 255 : $col_g + 50;
|
||||
$col_b_l = ( $col_b + 50 > 255 ) ? 255 : $col_b + 50;
|
||||
# Low light
|
||||
$col_r_d = ( $col_r - 50 < 0 ) ? 0 : $col_r - 50;
|
||||
$col_g_d = ( $col_g - 50 < 0 ) ? 0 : $col_g - 50;
|
||||
$col_b_d = ( $col_b - 50 < 0 ) ? 0 : $col_b - 50;
|
||||
|
||||
$color_main = imagecolorallocate( $im, $col_r, $col_g, $col_b );
|
||||
$color_light = imagecolorallocate( $im, $col_r_l, $col_g_l, $col_b_l );
|
||||
$color_dark = imagecolorallocate( $im, $col_r_d, $col_g_d, $col_b_d );
|
||||
$_slant = mt_rand( -20, 40 );
|
||||
|
||||
if ( $i == 1 OR $i == 3 OR $i == 5 )
|
||||
{
|
||||
for( $ii = 0 ; $ii < 2 ; $ii++ )
|
||||
{
|
||||
$a = $x_param + 50;
|
||||
$b = mt_rand(0,100);
|
||||
$c = $a + 20;
|
||||
$d = $b + 20;
|
||||
$e = ( $i == 3 ) ? mt_rand( 280, 320 ) : mt_rand( -280, -320 );
|
||||
|
||||
imagearc( $im, $a , $b , $c, $d, 0, $e, $color_light );
|
||||
imagearc( $im, $a+1, $b+1, $c, $d, 0, $e, $color_main );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $_result = @imagettftext( $im, 24, $_slant, $x_param - 1, $y_param - 1, $color_light, $_font, $content{$i} ) )
|
||||
{
|
||||
$use_fonts = FALSE;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
@imagettftext( $im, 24, $_slant, $x_param + 1, $y_param + 1, $color_dark, $_font, $content{$i} );
|
||||
@imagettftext( $im, 24, $_slant, $x_param, $y_param, $color_main, $_font, $content{$i} );
|
||||
}
|
||||
|
||||
$x_param += rand( 15, 18 );
|
||||
}
|
||||
|
||||
$use_fonts = TRUE;
|
||||
}
|
||||
|
||||
if ( ! $use_fonts )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Continue with nice background image
|
||||
//-----------------------------------------
|
||||
|
||||
$tmp = imagecreatetruecolor($tmp_x , $tmp_y );
|
||||
$tmp2 = imagecreatetruecolor($image_x, $image_y);
|
||||
|
||||
$white = imagecolorallocate( $tmp, 255, 255, 255 );
|
||||
$black = imagecolorallocate( $tmp, 0, 0, 0 );
|
||||
$grey = imagecolorallocate( $tmp, 100, 100, 100 );
|
||||
$transparent = imagecolorallocate( $tmp2, 255, 255, 255 );
|
||||
$_white = imagecolorallocate( $tmp2, 255, 255, 255 );
|
||||
|
||||
imagefill($tmp , 0, 0, $white );
|
||||
imagefill($tmp2, 0, 0, $_white);
|
||||
|
||||
$num = strlen($content);
|
||||
$x_param = 0;
|
||||
$y_param = 0;
|
||||
|
||||
for( $i = 0; $i < $num; $i++ )
|
||||
{
|
||||
if ( $i > 0 )
|
||||
{
|
||||
$x_param += rand( 6, 12 );
|
||||
}
|
||||
|
||||
$y_param = rand( 0, 5 );
|
||||
|
||||
$randomcolor = imagecolorallocate( $tmp, rand(50,200), rand(50,200),rand(50,200) );
|
||||
|
||||
imagestring( $tmp, 5, $x_param + 1, $y_param + 1, $content{$i}, $grey );
|
||||
imagestring( $tmp, 5, $x_param , $y_param , $content{$i}, $randomcolor );
|
||||
}
|
||||
|
||||
imagecopyresized($tmp2, $tmp, 0, 0, 0, 0, $image_x, $image_y, $tmp_x, $tmp_y );
|
||||
|
||||
$tmp2 = $this->captcha_show_gd_img_wave( $tmp2, 8, true );
|
||||
|
||||
imagecolortransparent( $tmp2, $transparent );
|
||||
imagecopymerge( $im, $tmp2, 0, 0, 0, 0, $image_x, $image_y, 100 );
|
||||
|
||||
imagedestroy($tmp);
|
||||
imagedestroy($tmp2);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Blur?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( function_exists( 'imagefilter' ) )
|
||||
{
|
||||
@imagefilter( $im, IMG_FILTER_GAUSSIAN_BLUR );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Render a border
|
||||
//-----------------------------------------
|
||||
|
||||
$black = imagecolorallocate( $im, 0, 0, 0 );
|
||||
|
||||
imageline( $im, 0, 0, $image_x, 0, $black );
|
||||
imageline( $im, 0, 0, 0, $image_y, $black );
|
||||
imageline( $im, $image_x - 1, 0, $image_x - 1, $image_y, $black );
|
||||
imageline( $im, 0, $image_y - 1, $image_x, $image_y - 1, $black );
|
||||
|
||||
//-----------------------------------------
|
||||
// Show it!
|
||||
//-----------------------------------------
|
||||
|
||||
@header( "Content-Type: image/jpeg" );
|
||||
|
||||
imagejpeg( $im );
|
||||
imagedestroy( $im );
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Create wave effect for GD images...
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Create wave effect for GD images
|
||||
*
|
||||
* @param object Image resource
|
||||
* @return object Returned image resource
|
||||
* @since 1.0
|
||||
*/
|
||||
function captcha_show_gd_img_wave( $im, $wave=10 )
|
||||
{
|
||||
$_width = imagesx( $im );
|
||||
$_height = imagesy( $im );
|
||||
|
||||
$tmp = imagecreatetruecolor( $_width, $_height );
|
||||
|
||||
$_direction = ( time() % 0 ) ? TRUE : FALSE;
|
||||
|
||||
for ( $x = 0; $x < $_width; $x++ )
|
||||
{
|
||||
for ( $y = 0 ; $y < $_height ; $y++ )
|
||||
{
|
||||
$xo = $wave * sin( 2 * 3.1415 * $y / 128 );
|
||||
$yo = $wave * cos( 2 * 3.1415 * $x / 128 );
|
||||
|
||||
$_x = $x - $xo;
|
||||
$_y = $y - $yo;
|
||||
|
||||
if ( ($_x > 0 AND $_x < $_width) AND ($_y > 0 AND $_y < $_height) )
|
||||
{
|
||||
$index = imagecolorat($im, $_x, $_y);
|
||||
$colors = imagecolorsforindex($im, $index);
|
||||
$color = imagecolorresolve( $tmp, $colors['red'], $colors['green'], $colors['blue'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$color = imagecolorresolve( $tmp, 255, 255, 255 );
|
||||
}
|
||||
|
||||
imagesetpixel( $tmp, $x, $y, $color );
|
||||
}
|
||||
}
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Removes extinct captcha sessions
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Removes extinct captcha sessions
|
||||
* Clears out "dead" entries
|
||||
*
|
||||
* @param string Optional IP address to clear out on
|
||||
* @return string void
|
||||
*/
|
||||
|
||||
function captcha_clear_sessions( $ip_address='' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$time = time() - 60 * 3600;
|
||||
$extra = ( $ip_address ) ? ' OR captcha_ipaddress="'.$ip_address.'"' : '';
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->build_and_exec_query( array( 'delete' => 'captcha',
|
||||
'where' => 'captcha_date < ' . $time . $extra ) );
|
||||
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Load up the backgrounds
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Loads up the backgrounds.
|
||||
*
|
||||
* @return array backgrounds
|
||||
*/
|
||||
|
||||
function _captcha_show_gd_img_get_backgrounds()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$images = array();
|
||||
$_path = ROOT_PATH . 'style_captcha/captcha_backgrounds';
|
||||
|
||||
if ( $_dir = @opendir( $_path ) )
|
||||
{
|
||||
while( $_file = @readdir( $_dir ) )
|
||||
{
|
||||
if ( preg_match( "#\.(gif|jpeg|jpg|png)$#i", $_file ) )
|
||||
{
|
||||
$images[] = $_path . '/' . $_file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $images;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Load up the fonts
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Loads up the fonts.
|
||||
*
|
||||
* @return array fonts
|
||||
*/
|
||||
|
||||
function _captcha_show_gd_img_get_fonts()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$fonts = array();
|
||||
$_path = ROOT_PATH . 'style_captcha/captcha_fonts';
|
||||
|
||||
if ( $_dir = @opendir( $_path ) )
|
||||
{
|
||||
while( $_file = @readdir( $_dir ) )
|
||||
{
|
||||
if ( preg_match( "#\.(ttf)$#i", $_file ) )
|
||||
{
|
||||
$fonts[] = $_path . '/' . $_file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $fonts;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,28 +1,18 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2005-12-01 16:45:12 +0000 (Thu, 01 Dec 2005) $
|
||||
| > $Revision: 88 $
|
||||
| > $Author: bfarber $
|
||||
| > $Date: 2006-09-22 11:28:54 +0100 (Fri, 22 Sep 2006) $
|
||||
| > $Revision: 567 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > CUSTOM PROFILE FIELD CLASS
|
||||
@@ -42,12 +32,20 @@
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class custom_fields
|
||||
{
|
||||
var $member_id = 0;
|
||||
var $admin = 0;
|
||||
var $supmod = 0;
|
||||
var $mod = 0;
|
||||
var $mem_data_id = 0;
|
||||
var $mem_list = 0;
|
||||
var $init = 0;
|
||||
var $in_fields = array();
|
||||
var $out_fields = array();
|
||||
@@ -127,7 +125,7 @@ class custom_fields
|
||||
|
||||
if ( count( $this->member_data ) )
|
||||
{
|
||||
$this->mem_data_id = $this->member_data['id'];
|
||||
$this->mem_data_id = isset($this->member_data['member_id']) ? $this->member_data['member_id'] : 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -138,7 +136,7 @@ class custom_fields
|
||||
{
|
||||
foreach( $this->cache_data as $id => $data )
|
||||
{
|
||||
$this->in_fields[ $id ] = $this->member_data['field_'.$id];
|
||||
$this->in_fields[ $id ] = isset($this->member_data['field_'.$id]) ? $this->member_data['field_'.$id] : NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,7 +380,12 @@ class custom_fields
|
||||
}
|
||||
else if ( $this->member_id )
|
||||
{
|
||||
$pass = 1;
|
||||
// We don't want to search these fields in memberlist..
|
||||
|
||||
if( !$this->mem_list )
|
||||
{
|
||||
$pass = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $pass )
|
||||
@@ -511,7 +514,7 @@ class custom_fields
|
||||
$tmp = $this->cache_data[$i]['pf_topic_format'];
|
||||
|
||||
$tmp = str_replace( '{title}' , $this->field_names[$i], $tmp );
|
||||
$tmp = str_replace( '{key}' , $this->out_chosen[$i] , $tmp );
|
||||
$tmp = str_replace( '{key}' , isset($this->out_chosen[$i]) ? $this->out_chosen[$i]: '' , $tmp );
|
||||
$tmp = str_replace( '{content}', $out , $tmp );
|
||||
|
||||
return $tmp;
|
||||
@@ -549,6 +552,8 @@ class custom_fields
|
||||
$t = preg_replace("/&#([0-9]+);/s", "&#\\1;", $t );
|
||||
}
|
||||
|
||||
$t = nl2br( $t );
|
||||
|
||||
return $t;
|
||||
}
|
||||
|
||||
|
||||
+1230
-1152
File diff suppressed because it is too large.
Load diff
@@ -2,28 +2,18 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2005-12-08 16:32:40 +0000 (Thu, 08 Dec 2005) $
|
||||
| > $Revision: 96 $
|
||||
| > $Author: bfarber $
|
||||
| > $Date: 2006-09-22 11:28:54 +0100 (Fri, 22 Sep 2006) $
|
||||
| > $Revision: 567 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Sending email module
|
||||
@@ -45,6 +35,11 @@
|
||||
// This module is fairly basic, more functionality is expected in future
|
||||
// versions (such as MIME attachments, SMTP stuff, etc)
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class emailer {
|
||||
|
||||
@@ -54,6 +49,7 @@ class emailer {
|
||||
var $from = "";
|
||||
var $to = "";
|
||||
var $subject = "";
|
||||
var $lang_subject = "";
|
||||
var $message = "";
|
||||
var $header = "";
|
||||
var $footer = "";
|
||||
@@ -61,13 +57,15 @@ class emailer {
|
||||
var $error = "";
|
||||
var $parts = array();
|
||||
var $bcc = array();
|
||||
var $mail_headers = "";
|
||||
var $mail_headers = array();
|
||||
var $rfc_headers = "";
|
||||
var $multipart = "";
|
||||
var $boundry = "";
|
||||
var $extra_opts = "";
|
||||
|
||||
var $html_email = 0;
|
||||
var $char_set = 'windows-1251';
|
||||
var $char_set = 'iso-8859-1';
|
||||
var $header_eol = "\r\n"; //RFC specifies \r\n as eol
|
||||
|
||||
var $smtp_fp = FALSE;
|
||||
var $smtp_msg = "";
|
||||
@@ -126,7 +124,7 @@ class emailer {
|
||||
//-----------------------------------------
|
||||
|
||||
$this->from = $this->ipsclass->vars['email_out'];
|
||||
$this->temp_dump = $this->ipsclass->vars['fake_mail'];
|
||||
$this->temp_dump = isset($this->ipsclass->vars['fake_mail']) ? $this->ipsclass->vars['fake_mail'] : '';
|
||||
$this->wrap_brackets = $this->ipsclass->vars['mail_wrap_brackets'];
|
||||
$this->extra_opts = $this->ipsclass->vars['php_mail_extra'];
|
||||
|
||||
@@ -135,8 +133,8 @@ class emailer {
|
||||
// also
|
||||
//-----------------------------------------
|
||||
|
||||
$this->header = $this->ipsclass->vars['email_header'];
|
||||
$this->footer = $this->ipsclass->vars['email_footer'];
|
||||
$this->header = isset($this->ipsclass->vars['email_header']) ? $this->ipsclass->vars['email_header'] : '';
|
||||
$this->footer = isset($this->ipsclass->vars['email_footer']) ? $this->ipsclass->vars['email_footer'] : '';
|
||||
$this->boundry = "----=_NextPart_000_0022_01C1BD6C.D0C0F9F0"; //"b".md5(uniqid(time()));
|
||||
|
||||
$this->char_set = $this->ipsclass->vars['gb_char_set'];
|
||||
@@ -150,7 +148,6 @@ class emailer {
|
||||
|
||||
function add_attachment($data = "", $name = "", $ctype='application/octet-stream')
|
||||
{
|
||||
|
||||
$this->parts[] = array( 'ctype' => $ctype,
|
||||
'data' => $data,
|
||||
'encode' => 'base64',
|
||||
@@ -164,51 +161,41 @@ class emailer {
|
||||
|
||||
function build_headers()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// HTML (hitmuhl)
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->html_email )
|
||||
{
|
||||
$this->mail_headers .= "MIME-Version: 1.0\n";
|
||||
$this->mail_headers .= "Content-type: text/html; charset=\"".$this->char_set."\"\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->mail_headers .= "MIME-Version: 1.0\n";
|
||||
$this->mail_headers .= "Content-type: text/plain; charset=\"".$this->char_set."\"\n";
|
||||
}
|
||||
$extra_headers = array();
|
||||
$extra_header_rfc = "";
|
||||
|
||||
//-----------------------------------------
|
||||
// Start mail headers
|
||||
//-----------------------------------------
|
||||
|
||||
$this->mail_headers .= "From: \"".$this->ipsclass->vars['board_name']."\" <".$this->from.">\n";
|
||||
$this->mail_headers['MIME-Version'] = "1.0";
|
||||
|
||||
$this->mail_headers['From'] = '"'.$this->ipsclass->vars['board_name'].'" <'.$this->from.'>';
|
||||
|
||||
if ( $this->mail_method != 'smtp' )
|
||||
{
|
||||
if ( count( $this->bcc ) > 1 )
|
||||
{
|
||||
$this->mail_headers .= "Bcc: ".implode( "," , $this->bcc ) . "\n";
|
||||
$this->mail_headers['Bcc'] = implode( "," , $this->bcc );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $this->to )
|
||||
{
|
||||
$this->mail_headers .= "To: ".$this->to."\n";
|
||||
$this->mail_headers['To'] = $this->to;
|
||||
}
|
||||
$this->mail_headers .= "Subject: ".$this->subject."\n";
|
||||
|
||||
$this->mail_headers['Subject'] = $this->subject;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// we're not spam, really!
|
||||
//-----------------------------------------
|
||||
|
||||
$this->mail_headers .= "Return-Path: ".$this->from."\n";
|
||||
$this->mail_headers .= "X-Priority: 3\n";
|
||||
$this->mail_headers .= "X-Mailer: IPB PHP Mailer\n";
|
||||
$this->mail_headers .= "X-Unique-ID: 52f408a2_988b02f4_b5e6f4ba_af0ae\n";
|
||||
$this->mail_headers['Return-Path'] = $this->from;
|
||||
$this->mail_headers['X-Priority'] = "3";
|
||||
$this->mail_headers['X-Mailer'] = "IPB PHP Mailer";
|
||||
|
||||
//-----------------------------------------
|
||||
// Count.. oh you get the idea
|
||||
@@ -218,22 +205,81 @@ class emailer {
|
||||
{
|
||||
if ( ! $this->html )
|
||||
{
|
||||
$this->mail_headers .= "MIME-Version: 1.0\n";
|
||||
$this->mail_headers .= "Content-Type: multipart/mixed;\n\tboundary=\"".$this->boundry."\"\n\nThis is a MIME encoded message.\n\n--".$this->boundry;
|
||||
$this->mail_headers .= "\nContent-Type: text/plain;\n\tcharset=\"".$this->char_set."\"\nContent-Transfer-Encoding: quoted-printable\n\n".$this->message."\n\n--".$this->boundry;
|
||||
$extra_headers[0]['Content-Type'] = "multipart/mixed;\n\tboundary=\"".$this->boundry."\"";
|
||||
|
||||
$extra_headers[0]['notencode'] = "\n\nThis is a MIME encoded message.\n\n--".$this->boundry."\n";
|
||||
|
||||
$extra_headers[1]['Content-Type'] = "text/plain;\n\tcharset=\"".$this->char_set."\"";
|
||||
$extra_headers[1]['Content-Transfer-Encoding'] = "quoted-printable";
|
||||
|
||||
$extra_headers[1]['notencode'] = "\n\n".$this->message."\n\n--".$this->boundry;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->mail_headers .= "MIME-Version: 1.0\n";
|
||||
$this->mail_headers .= "Content-Type: multipart/mixed;\n\tboundary=\"".$this->boundry."\"\n\nThis is a MIME encoded message.\n\n--".$this->boundry;
|
||||
$this->mail_headers .= "\nContent-Type: text/html;\n\tcharset=\"".$this->char_set."\"\nContent-Transfer-Encoding: quoted-printable\n\n".$this->message."\n\n--".$this->boundry;
|
||||
$extra_headers[0]['Content-Type'] = "multipart/mixed;\n\tboundary=\"".$this->boundry."\"";
|
||||
|
||||
$extra_headers[0]['notencode'] = "\n\nThis is a MIME encoded message.\n\n--".$this->boundry."\n";
|
||||
|
||||
$extra_headers[1]['Content-Type'] = "text/html; charset=\"".$this->char_set."\"";
|
||||
$extra_headers[1]['Content-Transfer-Encoding'] = "quoted-printable";
|
||||
|
||||
$extra_headers[1]['notencode'] = "\n\n".$this->message."\n\n--".$this->boundry;
|
||||
}
|
||||
|
||||
$this->mail_headers .= $this->build_multipart();
|
||||
$extra_headers[2]['notencode'] = $this->build_multipart();
|
||||
|
||||
reset($extra_headers);
|
||||
|
||||
foreach( $extra_headers as $subset => $the_header )
|
||||
{
|
||||
foreach( $the_header as $k => $v )
|
||||
{
|
||||
if( $k == 'notencode' )
|
||||
{
|
||||
$extra_headers_rfc .= $v;
|
||||
}
|
||||
else
|
||||
{
|
||||
$v = $this->encode_headers( array( 'v' => $v ) );
|
||||
|
||||
$extra_headers_rfc .= $k.': '.$v['v'].$this->header_eol;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->message = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// HTML (hitmuhl) ?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->html_email )
|
||||
{
|
||||
$this->mail_headers['Content-type'] = 'text/html; charset="'.$this->char_set.'"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->mail_headers['Content-type'] = 'text/plain; charset="'.$this->char_set.'"';
|
||||
}
|
||||
}
|
||||
|
||||
$this->encode_headers();
|
||||
|
||||
foreach( $this->mail_headers as $k => $v )
|
||||
{
|
||||
$this->rfc_headers .= $k.": ".$v.$this->header_eol;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Attachments extra?
|
||||
//-----------------------------------------
|
||||
|
||||
if( $extra_headers_rfc )
|
||||
{
|
||||
$this->rfc_headers .= $extra_headers_rfc;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -242,26 +288,80 @@ class emailer {
|
||||
|
||||
function encode_attachment($part)
|
||||
{
|
||||
|
||||
$msg = chunk_split(base64_encode($part['data']));
|
||||
|
||||
return "Content-Type: ".$part['ctype']. ($part['name'] ? ";\n\tname =\"".$part['name']."\"" : "").
|
||||
"\nContent-Transfer-Encoding: ".$part['encode']."\nContent-Disposition: attachment;\n\tfilename=\"".$part['name']."\"\n\n".$msg."\n";
|
||||
$headers = array();
|
||||
$header_str = "";
|
||||
|
||||
$headers['Content-Type'] = $part['ctype']. ($part['name'] ? "; name =\"".$part['name']."\"" : "");
|
||||
$headers['Content-Transfer-Encoding'] = $part['encode'];
|
||||
$headers['Content-Disposition'] = "attachment; filename=\"".$part['name']."\"";
|
||||
|
||||
$headers = $this->encode_headers( $headers );
|
||||
|
||||
foreach( $headers as $k => $v )
|
||||
{
|
||||
$header_str .= $k.': '.$v.$this->header_eol;
|
||||
}
|
||||
|
||||
$header_str .= "\n\n".$msg."\n";
|
||||
|
||||
return $header_str;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// ENCODE HEADERS - RFC2047
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function encode_headers( $headers = array() )
|
||||
{
|
||||
$enc_headers = count($headers) ? $headers : $this->mail_headers;
|
||||
|
||||
foreach( $enc_headers as $header => $value)
|
||||
{
|
||||
preg_match_all( '/(\w*[\x80-\xFF]+\w*)/', $value, $matches );
|
||||
|
||||
foreach ($matches[1] as $value)
|
||||
{
|
||||
if( $header == 'From' )
|
||||
{
|
||||
// Either sendmail or the email servers don't like 'From' encoded...let's remove the board name
|
||||
// and just move along, as email address cannot contain nasty characters themselves
|
||||
|
||||
$this->mail_headers['From'] = $this->from;
|
||||
|
||||
continue 2;
|
||||
}
|
||||
|
||||
$replacement = preg_replace_callback( '/([\x80-\xFF])/', create_function( '$match', 'return "=" . strtoupper( dechex( ord( "$match[1]" ) ) );' ), $value );
|
||||
|
||||
$value = str_replace( $value, '=?' . $this->char_set . '?Q?' . $replacement . '?=', $value );
|
||||
}
|
||||
|
||||
if( !count($headers) )
|
||||
{
|
||||
$this->mail_headers[ $header ] = $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$enc_headers[ $header ] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $enc_headers;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// BUILD MULTIPART
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function build_multipart()
|
||||
{
|
||||
|
||||
$multipart = "";
|
||||
|
||||
for ($i = sizeof($this->parts) - 1 ; $i >= 0 ; $i--)
|
||||
{
|
||||
$multipart .= "\n".$this->encode_attachment($this->parts[$i]) . "--".$this->boundry;
|
||||
$multipart .= $this->header_eol.$this->encode_attachment($this->parts[$i]) . "--".$this->boundry;
|
||||
}
|
||||
|
||||
return $multipart . "--\n";
|
||||
@@ -297,13 +397,20 @@ class emailer {
|
||||
{
|
||||
$this->subject .= " ( ".$this->ipsclass->vars['board_name']." )";
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Build headers
|
||||
//-----------------------------------------
|
||||
|
||||
$this->build_headers();
|
||||
|
||||
if( $this->mail_method != 'smtp' )
|
||||
{
|
||||
$subject = $this->encode_headers( array( 'Subject' => $this->subject ) );
|
||||
|
||||
$this->subject = $subject['Subject'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Lets go..
|
||||
//-----------------------------------------
|
||||
@@ -316,7 +423,7 @@ class emailer {
|
||||
|
||||
if ($this->temp_dump == 1)
|
||||
{
|
||||
$blah = $this->subject."\n------------\n".$this->mail_headers."\n\n".$this->message;
|
||||
$blah = $this->subject."\n------------\n".$this->rfc_headers."\n\n".$this->message;
|
||||
|
||||
$pathy = $this->root_path.'_mail/'.date("M-j-Y,hi-A").str_replace( '@', '+', $this->to ).".txt";
|
||||
$fh = fopen ($pathy, 'w');
|
||||
@@ -331,10 +438,10 @@ class emailer {
|
||||
|
||||
if ($this->mail_method != 'smtp')
|
||||
{
|
||||
if ( ! @mail( $this->to, $this->subject, $this->message, $this->mail_headers, $this->extra_opts ) )
|
||||
if ( ! @mail( $this->to, $this->subject, $this->message, $this->rfc_headers, $this->extra_opts ) )
|
||||
{
|
||||
# Try without args for safe mode peeps
|
||||
if ( ! @mail( $this->to, $this->subject, $this->message, $this->mail_headers ) )
|
||||
if ( ! @mail( $this->to, $this->subject, $this->message, $this->rfc_headers ) )
|
||||
{
|
||||
$this->fatal_error("Could not send the email", "Failed at 'mail' command");
|
||||
}
|
||||
@@ -359,7 +466,8 @@ class emailer {
|
||||
$this->from = "";
|
||||
$this->message = "";
|
||||
$this->subject = "";
|
||||
$this->mail_headers = "";
|
||||
$this->mail_headers = array();
|
||||
$this->rfc_headers = "";
|
||||
|
||||
$this->email_init();
|
||||
}
|
||||
@@ -390,7 +498,7 @@ class emailer {
|
||||
|
||||
if ( $this->ipsclass->vars['default_language'] == "")
|
||||
{
|
||||
$this->ipsclass->vars['default_language'] = 'ru';
|
||||
$this->ipsclass->vars['default_language'] = 'en';
|
||||
}
|
||||
|
||||
if ($language == "")
|
||||
@@ -408,7 +516,7 @@ class emailer {
|
||||
{
|
||||
$lang = array();
|
||||
}
|
||||
|
||||
|
||||
require_once( $this->root_path."cache/lang_cache/".$this->ipsclass->vars['default_language']."/lang_email_content.php" );
|
||||
}
|
||||
else
|
||||
@@ -464,9 +572,9 @@ class emailer {
|
||||
// Also joins header and footer to message and cleans the message for sending
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function build_message($words)
|
||||
function build_message( $words )
|
||||
{
|
||||
if ($this->template == "")
|
||||
if ( $this->template == "" )
|
||||
{
|
||||
$this->error++;
|
||||
$this->fatal_error("Could not build the email message, no template assigned", "Make sure a template is assigned first.");
|
||||
@@ -474,21 +582,36 @@ class emailer {
|
||||
|
||||
$this->message = $this->template;
|
||||
|
||||
//-----------------------------------------
|
||||
// Add some default words
|
||||
//-----------------------------------------
|
||||
|
||||
$words['BOARD_ADDRESS'] = $this->ipsclass->vars['board_url'] . '/index.' . $this->ipsclass->vars['php_ext'];
|
||||
$words['WEB_ADDRESS'] = $this->ipsclass->vars['home_url'];
|
||||
$words['BOARD_NAME'] = $this->ipsclass->vars['board_name'];
|
||||
$words['SIGNATURE'] = $this->ipsclass->vars['signature'];
|
||||
$words['SIGNATURE'] = isset($this->ipsclass->vars['signature']) ? $this->ipsclass->vars['signature'] : '';
|
||||
|
||||
// Swop the words
|
||||
//-----------------------------------------
|
||||
// Swap the words
|
||||
//-----------------------------------------
|
||||
|
||||
$this->message = preg_replace( "/<#(.+?)#>/e", "\$words[\\1]", $this->message );
|
||||
$this->_words = $words;
|
||||
|
||||
$this->message = preg_replace_callback( "/<#(.+?)#>/", array( $this, '_swap_words' ), $this->message );
|
||||
|
||||
$this->_words = array();
|
||||
|
||||
$this->message = $this->clean_message( $this->message );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Swap words.
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function _swap_words( $matches )
|
||||
{
|
||||
return $this->_words[ $matches[1] ];
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// clean_message: (Mainly used internally)
|
||||
@@ -689,7 +812,7 @@ class emailer {
|
||||
|
||||
if ( $this->smtp_code == 220 )
|
||||
{
|
||||
$data = $this->smtp_crlf_encode( $this->mail_headers."\n" . $this->message);
|
||||
$data = $this->smtp_crlf_encode( $this->rfc_headers."\n" . $this->message);
|
||||
|
||||
//-----------------------------------------
|
||||
// HELO!, er... HELLO!
|
||||
|
||||
@@ -1,28 +1,18 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2005-12-01 16:45:12 +0000 (Thu, 01 Dec 2005) $
|
||||
| > $Revision: 88 $
|
||||
| > $Author: bfarber $
|
||||
| > $Date: 2006-09-26 17:13:44 +0100 (Tue, 26 Sep 2006) $
|
||||
| > $Revision: 575 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > FORUMS CLASS
|
||||
@@ -34,6 +24,12 @@
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class forum_functions
|
||||
{
|
||||
|
||||
@@ -80,7 +76,7 @@ class forum_functions
|
||||
$this->forum_cache = array();
|
||||
$this->forum_by_id = array();
|
||||
|
||||
foreach( $this->ipsclass->cache['forum_cache'] as $i => $f )
|
||||
foreach( $this->ipsclass->cache['forum_cache'] as $f )
|
||||
{
|
||||
if ( $this->strip_invisible )
|
||||
{
|
||||
@@ -91,11 +87,6 @@ class forum_functions
|
||||
continue;
|
||||
}
|
||||
|
||||
//if ( $f['status'] < 1 )
|
||||
//{
|
||||
// $hide_parents .= $f['id'].',';
|
||||
// continue;
|
||||
//}
|
||||
|
||||
if ( $f['show_perms'] != '*' )
|
||||
{
|
||||
@@ -123,7 +114,7 @@ class forum_functions
|
||||
|
||||
function forums_remove_childless_parents()
|
||||
{
|
||||
foreach ( $this->forum_cache['root'] as $id => $forum_data )
|
||||
foreach ( $this->forum_cache['root'] as $forum_data )
|
||||
{
|
||||
if ( ! is_array( $this->forum_cache['root'][ $forum_data['id'] ] ) )
|
||||
{
|
||||
@@ -147,8 +138,6 @@ class forum_functions
|
||||
{
|
||||
$this->ipsclass->cache['moderators'] = array();
|
||||
|
||||
define( "IN_ACP", 1 );
|
||||
|
||||
require_once( ROOT_PATH.'sources/action_admin/moderator.php' );
|
||||
$this->mod = new ad_moderator();
|
||||
$this->mod->ipsclass =& $this->ipsclass;
|
||||
@@ -158,7 +147,7 @@ class forum_functions
|
||||
|
||||
if ( count($this->ipsclass->cache['moderators']) )
|
||||
{
|
||||
foreach( $this->ipsclass->cache['moderators'] as $i => $r )
|
||||
foreach( $this->ipsclass->cache['moderators'] as $r )
|
||||
{
|
||||
$this->mod_cache[ $r['forum_id'] ][ $r['mid'] ] = array( 'name' => $r['members_display_name'],
|
||||
'memid' => $r['member_id'],
|
||||
@@ -243,13 +232,15 @@ class forum_functions
|
||||
// Blah-de-blah
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function forums_check_access($fid, $prompt_login=0, $in='forum')
|
||||
function forums_check_access($fid, $prompt_login=0, $in='forum', $lofi=0)
|
||||
{
|
||||
$deny_access = 1;
|
||||
|
||||
if ( $this->ipsclass->check_perms($this->forum_by_id[$fid]['show_perms']) == TRUE )
|
||||
if ( $this->ipsclass->check_perms( $this->forum_by_id[$fid]['show_perms'] ) == TRUE )
|
||||
{
|
||||
if ( $this->ipsclass->check_perms($this->forum_by_id[$fid]['read_perms']) == TRUE )
|
||||
$this->forum_by_id[$fid]['read_perms'] = isset( $this->forum_by_id[$fid]['read_perms'] ) ? $this->forum_by_id[$fid]['read_perms'] : '';
|
||||
|
||||
if ( $this->ipsclass->check_perms( $this->forum_by_id[$fid]['read_perms'] ) == TRUE )
|
||||
{
|
||||
$deny_access = 0;
|
||||
}
|
||||
@@ -258,7 +249,7 @@ class forum_functions
|
||||
//-----------------------------------------
|
||||
// Can see topics?
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
if ( $this->forum_by_id[$fid]['permission_showtopic'] )
|
||||
{
|
||||
$this->read_topic_only = 1;
|
||||
@@ -269,18 +260,20 @@ class forum_functions
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Custom error?
|
||||
//-----------------------------------------
|
||||
if ( ! $lofi )
|
||||
{
|
||||
$this->forums_custom_error($fid);
|
||||
}
|
||||
|
||||
$this->forums_custom_error($fid);
|
||||
|
||||
$deny_access = 1;
|
||||
$deny_access = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->forums_custom_error($fid);
|
||||
if ( ! $lofi )
|
||||
{
|
||||
$this->forums_custom_error($fid);
|
||||
}
|
||||
|
||||
$deny_access = 1;
|
||||
}
|
||||
@@ -288,11 +281,10 @@ class forum_functions
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// custom error
|
||||
//-----------------------------------------
|
||||
|
||||
$this->forums_custom_error($fid);
|
||||
if ( ! $lofi )
|
||||
{
|
||||
$this->forums_custom_error($fid);
|
||||
}
|
||||
|
||||
$deny_access = 1;
|
||||
}
|
||||
@@ -302,29 +294,51 @@ class forum_functions
|
||||
// Do we have permission to even see the password page?
|
||||
//-----------------------------------------
|
||||
|
||||
if ($deny_access == 0)
|
||||
if ( $deny_access == 0 )
|
||||
{
|
||||
if ( $this->forum_by_id[$fid]['password'] AND $this->forum_by_id[$fid]['sub_can_post'] )
|
||||
$group_exempt = 0;
|
||||
|
||||
if ( isset($this->forum_by_id[$fid]['password']) AND $this->forum_by_id[$fid]['password'] AND $this->forum_by_id[$fid]['sub_can_post'] )
|
||||
{
|
||||
if ( $this->forums_compare_password( $fid ) == TRUE )
|
||||
if ( isset($this->forum_by_id[$fid]['password_override']) )
|
||||
{
|
||||
$deny_access = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$deny_access = 1;
|
||||
|
||||
if ( $prompt_login == 1 )
|
||||
if( in_array( $this->ipsclass->member['mgroup'], explode(",", $this->forum_by_id[$fid]['password_override']) ) )
|
||||
{
|
||||
$this->forums_show_login( $fid );
|
||||
$group_exempt = 1;
|
||||
$deny_access = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $group_exempt == 0 )
|
||||
{
|
||||
if ( $this->forums_compare_password( $fid ) == TRUE )
|
||||
{
|
||||
$deny_access = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$deny_access = 1;
|
||||
|
||||
if ( $prompt_login == 1 && !$lofi )
|
||||
{
|
||||
$this->forums_show_login( $fid );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($deny_access == 1)
|
||||
if ( $deny_access == 1 && ! $lofi )
|
||||
{
|
||||
$this->ipsclass->Error( array( LEVEL => 1, MSG => 'no_permission') );
|
||||
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission') );
|
||||
}
|
||||
else if ( $deny_access == 1 && $lofi )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,15 +360,54 @@ class forum_functions
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Get all forums for loaded permission level
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Get all forum IDs we're allowed to view
|
||||
*
|
||||
* @return array Array of forum ids
|
||||
* @since IPB 2.2.0.2006-08-02
|
||||
*/
|
||||
function forums_get_all_allowed_forum_ids( $type='show_perms' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$forum_ids = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Go get 'em...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( is_array( $this->forum_by_id ) and count( $this->forum_by_id ) )
|
||||
{
|
||||
foreach( $this->forum_by_id as $data )
|
||||
{
|
||||
if ( ! $this->forums_quick_check_access( $data['id'], $type ) )
|
||||
{
|
||||
$forum_ids[ $data['id'] ] = $data['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Return..
|
||||
//-----------------------------------------
|
||||
|
||||
return $forum_ids;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Quick check
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function forums_quick_check_access($fid)
|
||||
function forums_quick_check_access( $fid, $type='show_perms' )
|
||||
{
|
||||
$deny_access = 1;
|
||||
|
||||
if ( $this->ipsclass->check_perms($this->forum_by_id[$fid]['show_perms']) == TRUE )
|
||||
if ( $this->ipsclass->check_perms( $this->forum_by_id[$fid][ $type ] ) === TRUE )
|
||||
{
|
||||
$deny_access = 0;
|
||||
}
|
||||
@@ -363,17 +416,31 @@ class forum_functions
|
||||
// Do we have permission to even see the password page?
|
||||
//-----------------------------------------
|
||||
|
||||
if ($deny_access == 0)
|
||||
if ( $deny_access == 0 )
|
||||
{
|
||||
if ($this->forum_by_id[$fid]['password'])
|
||||
$group_exempt = 0;
|
||||
|
||||
if (isset($this->forum_by_id[$fid]['password']) AND $this->forum_by_id[$fid]['password'])
|
||||
{
|
||||
if ( $this->forums_compare_password( $fid ) == TRUE )
|
||||
if ( isset($this->forum_by_id[$fid]['password_override']) )
|
||||
{
|
||||
$deny_access = 0;
|
||||
if ( in_array( $this->ipsclass->member['mgroup'], explode(",", $this->forum_by_id[$fid]['password_override']) ) )
|
||||
{
|
||||
$group_exempt = 1;
|
||||
$deny_access = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$deny_access = 1;
|
||||
|
||||
if ( $group_exempt == 0 )
|
||||
{
|
||||
if ( $this->forums_compare_password( $fid ) == TRUE )
|
||||
{
|
||||
$deny_access = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$deny_access = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -397,7 +464,7 @@ class forum_functions
|
||||
|
||||
if ( ! $this->ipsclass->compiled_templates['skin_global'] )
|
||||
{
|
||||
$this->load_template('skin_global');
|
||||
$this->ipsclass->load_template('skin_global');
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -433,10 +500,10 @@ class forum_functions
|
||||
$this->html = new skin_forum();
|
||||
}
|
||||
|
||||
if (empty($this->ipsclass->member['id']))
|
||||
/*if (empty($this->ipsclass->member['id']))
|
||||
{
|
||||
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_guests' ) );
|
||||
}
|
||||
}*/
|
||||
|
||||
$this->output = $this->ipsclass->compiled_templates['skin_forum']->forum_password_log_in( $fid );
|
||||
|
||||
@@ -460,6 +527,25 @@ class forum_functions
|
||||
|
||||
function forums_get_parents($root_id, $ids=array())
|
||||
{
|
||||
// Stop endless loop setting cat as it's own parent?
|
||||
if( in_array( $root_id, $ids ) )
|
||||
{
|
||||
$cnt = 0;
|
||||
|
||||
foreach( $ids as $id )
|
||||
{
|
||||
if( $id == $root_id )
|
||||
{
|
||||
$cnt++;
|
||||
|
||||
if( $cnt > 1 )
|
||||
{
|
||||
return $ids;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $this->forum_by_id[ $root_id ]['parent_id'] and $this->forum_by_id[ $root_id ]['parent_id'] != 'root' )
|
||||
{
|
||||
$ids[] = $this->forum_by_id[ $root_id ]['parent_id'];
|
||||
@@ -478,9 +564,9 @@ class forum_functions
|
||||
|
||||
function forums_get_children( $root_id, $ids=array() )
|
||||
{
|
||||
if ( is_array( $this->forum_cache[ $root_id ] ) )
|
||||
if ( isset($this->forum_cache[ $root_id ]) AND is_array( $this->forum_cache[ $root_id ] ) )
|
||||
{
|
||||
foreach( $this->forum_cache[ $root_id ] as $id => $forum_data )
|
||||
foreach( $this->forum_cache[ $root_id ] as $forum_data )
|
||||
{
|
||||
$ids[] = $forum_data['id'];
|
||||
|
||||
@@ -500,9 +586,9 @@ class forum_functions
|
||||
|
||||
function forums_calc_children($root_id, $forum_data=array(), $done_pass=0)
|
||||
{
|
||||
if ( is_array( $this->forum_cache[ $root_id ] ) )
|
||||
if ( isset($this->forum_cache[ $root_id ]) AND is_array( $this->forum_cache[ $root_id ] ) )
|
||||
{
|
||||
foreach( $this->forum_cache[ $root_id ] as $id => $data )
|
||||
foreach( $this->forum_cache[ $root_id ] as $data )
|
||||
{
|
||||
if ($data['last_post'] > $forum_data['last_post'])
|
||||
{
|
||||
@@ -510,7 +596,8 @@ class forum_functions
|
||||
$forum_data['fid'] = $data['id'];
|
||||
$forum_data['last_id'] = $data['last_id'];
|
||||
$forum_data['last_title'] = $data['last_title'];
|
||||
$forum_data['password'] = $data['password'];
|
||||
$forum_data['password'] = isset($data['password']) ? $data['password'] : '';
|
||||
$forum_data['password_override'] = isset($data['password_override']) ? $data['password_override'] : '';
|
||||
$forum_data['last_poster_id'] = $data['last_poster_id'];
|
||||
$forum_data['last_poster_name'] = $data['last_poster_name'];
|
||||
$forum_data['status'] = $data['status'];
|
||||
@@ -521,7 +608,7 @@ class forum_functions
|
||||
// this topic?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $data['_db_row']['marker_last_cleared'] > $forum_data['_db_row']['marker_last_cleared'] )
|
||||
if ( isset($data['_db_row']['marker_last_cleared']) AND $data['_db_row']['marker_last_cleared'] > $forum_data['_db_row']['marker_last_cleared'] )
|
||||
{
|
||||
$forum_data['_db_row']['marker_last_cleared'] = $data['_db_row']['marker_last_cleared'];
|
||||
}
|
||||
@@ -531,6 +618,8 @@ class forum_functions
|
||||
// Sort out forum marker
|
||||
//-----------------------------------------
|
||||
|
||||
$data['_db_row']['marker_unread'] = isset($data['_db_row']['marker_unread']) ? $data['_db_row']['marker_unread'] : 0;
|
||||
$forum_data['_db_row']['marker_unread'] = isset($forum_data['_db_row']['marker_unread']) ? $forum_data['_db_row']['marker_unread'] : 0;
|
||||
$forum_data['_db_row']['marker_unread'] += $data['_db_row']['marker_unread'];
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -538,8 +627,12 @@ class forum_functions
|
||||
// Takes care of rows not in the DB yet
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $data['_db_row']['marker_unread'] )
|
||||
if ( !isset($data['_db_row']['marker_unread']) OR !$data['_db_row']['marker_unread'] )
|
||||
{
|
||||
$data['_db_row']['marker_last_cleared'] = isset($data['_db_row']['marker_last_cleared']) ? $data['_db_row']['marker_last_cleared'] : 0;
|
||||
|
||||
$this->ipsclass->member['members_markers']['board'] = isset($this->ipsclass->member['members_markers']['board']) ? $this->ipsclass->member['members_markers']['board'] : '';
|
||||
|
||||
$test_time = $this->ipsclass->member['members_markers']['board'] > $data['_db_row']['marker_last_cleared'] ? $this->ipsclass->member['members_markers']['board'] : $data['_db_row']['marker_last_cleared'];
|
||||
|
||||
if ( $data['last_post'] > $test_time )
|
||||
@@ -564,7 +657,7 @@ class forum_functions
|
||||
$forum_data['posts'] += $data['posts'];
|
||||
$forum_data['topics'] += $data['topics'];
|
||||
|
||||
if ( $this->ipsclass->member['g_is_supmod'] or $this->ipsclass->member['_moderator'][ $data['id'] ]['post_q'] == 1 )
|
||||
if ( $this->ipsclass->member['g_is_supmod'] or ( isset($this->ipsclass->member['_moderator'][ $data['id'] ]['post_q']) AND $this->ipsclass->member['_moderator'][ $data['id'] ]['post_q'] == 1 ) )
|
||||
{
|
||||
$forum_data['queued_posts'] += $data['queued_posts'];
|
||||
$forum_data['queued_topics'] += $data['queued_topics'];
|
||||
@@ -615,19 +708,23 @@ class forum_functions
|
||||
|
||||
function forums_forum_jump($html=0, $override=0, $remove_redirects=0)
|
||||
{
|
||||
foreach( $this->forum_cache['root'] as $id => $forum_data )
|
||||
$jump_string = "";
|
||||
|
||||
foreach( $this->forum_cache['root'] as $forum_data )
|
||||
{
|
||||
if ( $forum_data['sub_can_post'] or ( is_array($this->forum_cache[ $forum_data['id'] ]) and count($this->forum_cache[ $forum_data['id'] ]) ) )
|
||||
if ( $forum_data['sub_can_post'] or ( isset($this->forum_cache[ $forum_data['id'] ]) AND is_array($this->forum_cache[ $forum_data['id'] ]) AND count($this->forum_cache[ $forum_data['id'] ]) ) )
|
||||
{
|
||||
$forum_data['redirect_on'] = isset($forum_data['redirect_on']) ? $forum_data['redirect_on'] : 0;
|
||||
|
||||
if( $remove_redirects == 1 AND $forum_data['redirect_on'] == 1 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$selected = "";
|
||||
|
||||
if ($html == 1 or $override == 1)
|
||||
{
|
||||
$selected = "";
|
||||
|
||||
if ($this->ipsclass->input['f'] and $this->ipsclass->input['f'] == $forum_data['id'])
|
||||
{
|
||||
$selected = ' selected="selected"';
|
||||
@@ -638,9 +735,9 @@ class forum_functions
|
||||
|
||||
$depth_guide = $this->depth_guide;
|
||||
|
||||
if ( is_array( $this->forum_cache[ $forum_data['id'] ] ) )
|
||||
if ( array_key_exists( $forum_data['id'], $this->forum_cache ) AND is_array( $this->forum_cache[ $forum_data['id'] ] ) )
|
||||
{
|
||||
foreach( $this->forum_cache[ $forum_data['id'] ] as $id => $forum_data )
|
||||
foreach( $this->forum_cache[ $forum_data['id'] ] as $forum_data )
|
||||
{
|
||||
if( $remove_redirects == 1 AND $forum_data['redirect_on'] == 1 )
|
||||
{
|
||||
@@ -673,19 +770,19 @@ class forum_functions
|
||||
|
||||
function forums_forum_jump_internal($root_id, $jump_string="", $depth_guide="",$html=0, $override=0, $remove_redirects=0)
|
||||
{
|
||||
if ( is_array( $this->forum_cache[ $root_id ] ) )
|
||||
if ( isset($this->forum_cache[ $root_id ]) AND is_array( $this->forum_cache[ $root_id ] ) )
|
||||
{
|
||||
foreach( $this->forum_cache[ $root_id ] as $id => $forum_data )
|
||||
foreach( $this->forum_cache[ $root_id ] as $forum_data )
|
||||
{
|
||||
if( $remove_redirects == 1 AND $forum_data['redirect_on'] == 1 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$selected = "";
|
||||
|
||||
if ($html == 1 or $override == 1)
|
||||
{
|
||||
$selected = "";
|
||||
|
||||
if ($this->ipsclass->input['f'] and $this->ipsclass->input['f'] == $forum_data['id'])
|
||||
{
|
||||
$selected = ' selected="selected"';
|
||||
@@ -710,9 +807,15 @@ class forum_functions
|
||||
|
||||
function forums_format_lastinfo($forum_data)
|
||||
{
|
||||
$show_subforums = 1;
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->check_perms($this->forum_by_id[ $forum_data['id'] ]['read_perms']) != TRUE )
|
||||
$show_subforums = 1;
|
||||
$this->ipsclass->input['f'] = isset($this->ipsclass->input['f']) ? intval($this->ipsclass->input['f']) : 0;
|
||||
$this->ipsclass->vars['disable_subforum_show'] = intval( $this->ipsclass->vars['disable_subforum_show'] );
|
||||
|
||||
if ( $this->ipsclass->check_perms( $this->forum_by_id[ $forum_data['id'] ]['read_perms'] ) !== TRUE )
|
||||
{
|
||||
$show_subforums = 0;
|
||||
}
|
||||
@@ -732,7 +835,7 @@ class forum_functions
|
||||
|
||||
$forum_data['last_topic'] = $this->ipsclass->lang['f_none'];
|
||||
|
||||
$forum_data['full_last_title'] = $forum_data['last_title'];
|
||||
$forum_data['full_last_title'] = isset($forum_data['last_title']) ? $forum_data['last_title'] : '';
|
||||
|
||||
if (isset($forum_data['last_title']) and $forum_data['last_id'])
|
||||
{
|
||||
@@ -742,7 +845,7 @@ class forum_functions
|
||||
|
||||
$forum_data['last_title'] = $this->ipsclass->txt_truncate($forum_data['last_title'], 30);
|
||||
|
||||
if ( $forum_data['password'] OR ( $this->ipsclass->check_perms($this->forum_by_id[ $forum_data['fid'] ]['read_perms']) != TRUE AND $this->forum_by_id[ $forum_data['fid'] ]['permission_showtopic'] == 0 ) )
|
||||
if ( ( isset($forum_data['password']) AND $forum_data['password'] ) OR ( $this->ipsclass->check_perms($this->forum_by_id[ $forum_data['fid'] ]['read_perms']) != TRUE AND $this->forum_by_id[ $forum_data['fid'] ]['permission_showtopic'] == 0 ) )
|
||||
{
|
||||
$forum_data['last_topic'] = $this->ipsclass->lang['f_protected'];
|
||||
}
|
||||
@@ -781,16 +884,12 @@ class forum_functions
|
||||
}
|
||||
}
|
||||
|
||||
if ( $this->ipsclass->member['g_is_supmod'] or $this->ipsclass->member['_moderator'][ $forum_data['id'] ]['post_q'] == 1 )
|
||||
if ( $this->ipsclass->member['g_is_supmod'] or ( isset($this->ipsclass->member['_moderator'][ $forum_data['id'] ]['post_q']) AND $this->ipsclass->member['_moderator'][ $forum_data['id'] ]['post_q'] == 1 ) )
|
||||
{
|
||||
if ( $forum_data['queued_posts'] or $forum_data['queued_topics'] )
|
||||
{
|
||||
$forum_data['_queued_info'] = $this->ipsclass->compiled_templates['skin_boards']->show_queued_info( intval($forum_data['queued_posts']), intval($forum_data['queued_topics']) );
|
||||
}
|
||||
|
||||
if ( $this->forum_by_id[ $forum_data['id'] ]['queued_posts'] or $this->forum_by_id[ $forum_data['id'] ]['queued_topics'] )
|
||||
{
|
||||
$forum_data['_queued_img'] = $this->ipsclass->compiled_templates['skin_boards']->show_queued_img( $forum_data['id'] );
|
||||
$forum_data['_queued_info'] = $this->ipsclass->compiled_templates['skin_boards']->show_queued_info( intval($forum_data['queued_posts']), intval($forum_data['queued_topics']) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -807,7 +906,7 @@ class forum_functions
|
||||
{
|
||||
$sub = 0;
|
||||
|
||||
if ( count($forum_data['subforums']) )
|
||||
if ( isset($forum_data['subforums']) AND count($forum_data['subforums']) )
|
||||
{
|
||||
$sub = 1;
|
||||
}
|
||||
@@ -817,11 +916,12 @@ class forum_functions
|
||||
# Uncomment if you want to clear markers from the last visit.
|
||||
//$rtime = $this->ipsclass->member['last_visit'] > $this->ipsclass->member['members_markers']['board'] ? $this->ipsclass->member['last_visit'] : $this->ipsclass->member['members_markers']['board'];
|
||||
|
||||
$this->ipsclass->member['members_markers']['board'] = $this->ipsclass->member['members_markers']['board'] ? $this->ipsclass->member['members_markers']['board'] : $this->ipsclass->forum_read[ 0 ];
|
||||
$forum_data['_db_row']['marker_last_cleared'] = $forum_data['_db_row']['marker_last_cleared'] ? $forum_data['_db_row']['marker_last_cleared'] : $this->ipsclass->forum_read[ $fid ];
|
||||
$this->ipsclass->member['members_markers']['board'] = isset( $this->ipsclass->member['members_markers']['board']) ? $this->ipsclass->member['members_markers']['board'] : ( isset($this->ipsclass->forum_read[ 0 ]) ? $this->ipsclass->forum_read[ 0 ] : 0 );
|
||||
$this->ipsclass->forum_read[ $fid ] = isset($this->ipsclass->forum_read[ $fid ]) ? $this->ipsclass->forum_read[ $fid ] : 0;
|
||||
$forum_data['_db_row']['marker_last_cleared'] = isset($forum_data['_db_row']['marker_last_cleared']) ? $forum_data['_db_row']['marker_last_cleared'] : $this->ipsclass->forum_read[ $fid ];
|
||||
|
||||
$rtime = $this->ipsclass->member['members_markers']['board'];
|
||||
$ctime = $this->ipsclass->forum_read[ $fid ];
|
||||
$ctime = isset($this->ipsclass->forum_read[ $fid ]) ? $this->ipsclass->forum_read[ $fid ] : 0;
|
||||
|
||||
$rtime = $rtime > $ctime ? $rtime : $ctime;
|
||||
|
||||
@@ -830,7 +930,7 @@ class forum_functions
|
||||
// row... and there are no unread topics
|
||||
//-----------------------------------------
|
||||
|
||||
if ( is_array( $forum_data['_db_row'] ) )
|
||||
if ( isset($forum_data['_db_row']) AND is_array( $forum_data['_db_row'] ) )
|
||||
{
|
||||
$rtime = $this->ipsclass->member['members_markers']['board'] > $forum_data['_db_row']['marker_last_cleared'] ? $this->ipsclass->member['members_markers']['board'] : $forum_data['_db_row']['marker_last_cleared'];
|
||||
}
|
||||
@@ -853,7 +953,7 @@ class forum_functions
|
||||
$sub_cat_img = '_CAT';
|
||||
}
|
||||
|
||||
if ( $forum_data['password'] AND $sub == 0 )
|
||||
if ( isset($forum_data['password']) AND $forum_data['password'] AND $sub == 0 )
|
||||
{
|
||||
return $forum_data['last_post'] && $forum_data['last_post'] > $rtime ? "<{C_ON_RES}>" : "<{C_OFF_RES}>";
|
||||
}
|
||||
|
||||
@@ -1,28 +1,18 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-02-06 23:08:03 +0000 (Mon, 06 Feb 2006) $
|
||||
| > $Revision: 140 $
|
||||
| > $Author: bfarber $
|
||||
| > $Date: 2006-10-11 13:55:47 +0100 (Wed, 11 Oct 2006) $
|
||||
| > $Revision: 624 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > SESSION CLASS
|
||||
@@ -34,6 +24,12 @@
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class session
|
||||
{
|
||||
# Global
|
||||
@@ -74,46 +70,44 @@ class session
|
||||
$this->time_now = time();
|
||||
$cookie = array();
|
||||
|
||||
# TMP:
|
||||
$this->ipsclass->vars['match_ipaddress'] = 1;
|
||||
|
||||
//-----------------------------------------
|
||||
// Before we go any lets check the load settings..
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->ipsclass->vars['load_limit'] > 0)
|
||||
{
|
||||
# @ supressor fixes warning in >4.3.2 with open_basedir restrictions
|
||||
if ( @file_exists('/proc/loadavg') )
|
||||
{
|
||||
if ( $fh = @fopen( '/proc/loadavg', 'r' ) )
|
||||
{
|
||||
$data = @fread( $fh, 6 );
|
||||
@fclose( $fh );
|
||||
|
||||
$load_avg = explode( " ", $data );
|
||||
|
||||
$this->ipsclass->server_load = trim($load_avg[0]);
|
||||
//-----------------------------------------
|
||||
// Check cache
|
||||
//-----------------------------------------
|
||||
|
||||
if( $this->ipsclass->cache['systemvars']['loadlimit'] )
|
||||
{
|
||||
$loadinfo = explode( "-", $this->ipsclass->cache['systemvars']['loadlimit'] );
|
||||
|
||||
if ( count($loadinfo) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// We have cache! $$
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->server_load = $loadinfo[0];
|
||||
|
||||
if ($this->ipsclass->server_load > $this->ipsclass->vars['load_limit'])
|
||||
{
|
||||
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'server_too_busy', 'INIT' => 1 ) );
|
||||
//---------------------------------------
|
||||
// Visiting Lo-fi page?
|
||||
//---------------------------------------
|
||||
|
||||
if( defined( 'LOFI_NAME' ) AND constant( 'LOFI_NAME' ) == 'lofiversion' )
|
||||
{
|
||||
$this->ipsclass->boink_it( $this->ipsclass->vars['board_url'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'server_too_busy', 'INIT' => 1 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $serverstats = @exec("uptime") )
|
||||
{
|
||||
preg_match( "/(?:averages)?\: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/", $serverstats, $load );
|
||||
|
||||
$this->ipsclass->server_load = $load[1];
|
||||
|
||||
if ($this->ipsclass->server_load > $this->ipsclass->vars['load_limit'])
|
||||
{
|
||||
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'server_too_busy', 'INIT' => 1 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +183,7 @@ class session
|
||||
}
|
||||
}
|
||||
|
||||
if ( preg_match( '/('.implode( '|', $this->bot_safe ) .')/i', $_SERVER['HTTP_USER_AGENT'], $match ) )
|
||||
if ( preg_match( '/('.implode( '|', $this->bot_safe ) .')/i', $this->ipsclass->my_getenv('HTTP_USER_AGENT'), $match ) )
|
||||
{
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*',
|
||||
'from' => 'groups',
|
||||
@@ -228,21 +222,23 @@ class session
|
||||
// Using lofi?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( strstr( $_SERVER['PHP_SELF'], 'lofiversion' ) )
|
||||
if ( strstr( $this->ipsclass->my_getenv('PHP_SELF'), 'lofiversion' ) )
|
||||
{
|
||||
$qstring = "Lo-Fi: ".str_replace( "/", "", strrchr( $_SERVER['PHP_SELF'], "/" ) );
|
||||
$qstring = "Lo-Fi: ".str_replace( "/", "", strrchr( $this->ipsclass->my_getenv('PHP_SELF'), "/" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$qstring = str_replace( "'", "", $_SERVER['QUERY_STRING']);
|
||||
$qstring = str_replace( "'", "", $this->ipsclass->my_getenv('QUERY_STRING'));
|
||||
}
|
||||
|
||||
$qstring = htmlentities( strip_tags( str_replace( '\\', '', $qstring ) ) );
|
||||
|
||||
if ( $this->ipsclass->vars['spider_visit'] )
|
||||
{
|
||||
$this->ipsclass->DB->do_shutdown_insert( 'spider_logs', array (
|
||||
'bot' => $agent,
|
||||
'query_string' => $qstring,
|
||||
'ip_address' => $_SERVER['REMOTE_ADDR'],
|
||||
'ip_address' => $this->ipsclass->my_getenv('REMOTE_ADDR'),
|
||||
'entry_date' => time(),
|
||||
) );
|
||||
}
|
||||
@@ -268,13 +264,13 @@ class session
|
||||
$cookie['session_id'] = $this->ipsclass->my_getcookie('session_id');
|
||||
$cookie['member_id'] = $this->ipsclass->my_getcookie('member_id');
|
||||
$cookie['pass_hash'] = $this->ipsclass->my_getcookie('pass_hash');
|
||||
|
||||
|
||||
if ( $cookie['session_id'] )
|
||||
{
|
||||
$this->get_session($cookie['session_id']);
|
||||
$this->ipsclass->session_type = 'cookie';
|
||||
}
|
||||
elseif ( $this->ipsclass->input['s'] )
|
||||
elseif ( isset($this->ipsclass->input['s']) AND $this->ipsclass->input['s'] )
|
||||
{
|
||||
$this->get_session($this->ipsclass->input['s']);
|
||||
$this->ipsclass->session_type = 'url';
|
||||
@@ -329,9 +325,9 @@ class session
|
||||
// Do we have cookies stored?
|
||||
//-----------------------------------------
|
||||
|
||||
if ($cookie['member_id'] != "" and $cookie['pass_hash'] != "")
|
||||
if ( $cookie['member_id'] != "" and $cookie['pass_hash'] != "" )
|
||||
{
|
||||
$this->load_member($cookie['member_id']);
|
||||
$this->load_member( $cookie['member_id'] );
|
||||
|
||||
if ( (! $this->member['id']) or ($this->member['id'] == 0) )
|
||||
{
|
||||
@@ -340,9 +336,67 @@ class session
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->member['member_login_key'] == $cookie['pass_hash'])
|
||||
if ( $this->member['member_login_key'] == $cookie['pass_hash'] )
|
||||
{
|
||||
$this->create_member_session();
|
||||
//-----------------------------------------
|
||||
// STRONG HOLD
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->stronghold_check_cookie( $this->member['id'], $this->member['member_login_key'] ) !== TRUE )
|
||||
{
|
||||
$this->unload_member();
|
||||
$this->create_guest_session();
|
||||
}
|
||||
else
|
||||
{
|
||||
$_ok = 1;
|
||||
$_days = 0;
|
||||
$_sticky = 1;
|
||||
$_time = ( $this->ipsclass->vars['login_key_expire'] ) ? ( time() + ( intval($this->ipsclass->vars['login_key_expire']) * 86400 ) ) : 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Key expired?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->vars['login_key_expire'] )
|
||||
{
|
||||
$_sticky = 0;
|
||||
$_days = $this->ipsclass->vars['login_key_expire'];
|
||||
|
||||
if ( time() > $this->member['member_login_key_expire'] )
|
||||
{
|
||||
$_ok = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $_ok == 1 )
|
||||
{
|
||||
$this->create_member_session();
|
||||
|
||||
//-----------------------------------------
|
||||
// Change the log in key to make each authentication
|
||||
// use a unique token. This means that if a cookie is
|
||||
// stolen, the hacker can only use the auth once.
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->vars['login_change_key'] )
|
||||
{
|
||||
$this->member['member_login_key'] = $this->ipsclass->converge->generate_auto_log_in_key();
|
||||
|
||||
$this->ipsclass->DB->do_update( 'members', array( 'member_login_key' => $this->member['member_login_key'],
|
||||
'member_login_key_expire' => $_time ), 'id='.$this->member['id'] );
|
||||
|
||||
$this->ipsclass->my_setcookie( "pass_hash", $this->member['member_login_key'], $_sticky, $_days );
|
||||
|
||||
$this->ipsclass->stronghold_set_cookie( $this->member['id'], $this->member['member_login_key'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->unload_member();
|
||||
$this->create_guest_session();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -361,7 +415,9 @@ class session
|
||||
// Knock out Google Web Accelerator
|
||||
//-----------------------------------------
|
||||
|
||||
if ( strstr( strtolower($_SERVER['HTTP_X_MOZ']), 'prefetch' ) AND $this->member['id'] )
|
||||
$http_moz = $this->ipsclass->my_getenv('HTTP_X_MOZ');
|
||||
|
||||
if ( isset($http_moz) AND strstr( strtolower($http_moz), 'prefetch' ) AND $this->member['id'] )
|
||||
{
|
||||
if ( IPB_PHP_SAPI == 'cgi-fcgi' OR IPB_PHP_SAPI == 'cgi' )
|
||||
{
|
||||
@@ -438,13 +494,25 @@ class session
|
||||
}
|
||||
else if ( count($this->ipsclass->cache['moderators']) )
|
||||
{
|
||||
foreach( $this->ipsclass->cache['moderators'] as $i => $r )
|
||||
$other_mgroups = array();
|
||||
|
||||
if( $this->member['mgroup_others'] )
|
||||
{
|
||||
$other_mgroups = explode( ",", $this->ipsclass->clean_perm_string( $this->member['mgroup_others'] ) );
|
||||
}
|
||||
|
||||
foreach( $this->ipsclass->cache['moderators'] as $r )
|
||||
{
|
||||
if ( $r['member_id'] == $this->member['id'] or $r['group_id'] == $this->member['mgroup'] )
|
||||
{
|
||||
$this->member['_moderator'][ $r['forum_id'] ] = $r;
|
||||
$this->member['is_mod'] = 1;
|
||||
}
|
||||
else if( count($other_mgroups) AND in_array( $r['group_id'], $other_mgroups ) )
|
||||
{
|
||||
$this->member['_moderator'][ $r['forum_id'] ] = $r;
|
||||
$this->member['is_mod'] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,13 +532,13 @@ class session
|
||||
|
||||
if ( $this->member['id'] )
|
||||
{
|
||||
if ( ! $this->ipsclass->input['last_activity'] )
|
||||
if ( !isset($this->ipsclass->input['last_activity']) OR !$this->ipsclass->input['last_activity'] )
|
||||
{
|
||||
$this->ipsclass->input['last_activity'] = $this->member['last_activity'] ? $this->member['last_activity'] : $this->time_now;
|
||||
|
||||
}
|
||||
|
||||
if ( ! $this->ipsclass->input['last_visit'] )
|
||||
if ( !isset($this->ipsclass->input['last_visit']) OR !$this->ipsclass->input['last_visit'] )
|
||||
{
|
||||
$this->ipsclass->input['last_visit'] = $this->member['last_visit'] ? $this->member['last_visit'] : $this->time_now;
|
||||
}
|
||||
@@ -555,7 +623,7 @@ class session
|
||||
|
||||
function build_group_permissions()
|
||||
{
|
||||
if ( $this->member['mgroup_others'] )
|
||||
if ( isset($this->member['mgroup_others']) AND $this->member['mgroup_others'] )
|
||||
{
|
||||
$groups_id = explode( ',', $this->member['mgroup_others'] );
|
||||
$exclude = array( 'g_title', 'g_icon', 'prefix', 'suffix', 'g_promotion', 'g_photo_max_vars' );
|
||||
@@ -566,7 +634,7 @@ class session
|
||||
{
|
||||
foreach( $groups_id as $pid )
|
||||
{
|
||||
if ( ! $this->ipsclass->cache['group_cache'][ $pid ]['g_id'] )
|
||||
if ( ! isset($this->ipsclass->cache['group_cache'][ $pid ]['g_id']) OR !$this->ipsclass->cache['group_cache'][ $pid ]['g_id'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -589,11 +657,11 @@ class session
|
||||
}
|
||||
else if ( in_array( $k, $zero_is_best ) )
|
||||
{
|
||||
if( $this->member[ $k ] == 0 )
|
||||
if ( $this->member[ $k ] == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if( $v > $this->member[ $k ] )
|
||||
else if ( $v > $this->member[ $k ] )
|
||||
{
|
||||
$this->member[ $k ] = $v;
|
||||
}
|
||||
@@ -638,7 +706,7 @@ class session
|
||||
}
|
||||
}
|
||||
|
||||
$this->ipsclass->perm_id = ( $this->member['org_perm_id'] ) ? $this->member['org_perm_id'] : $this->member['g_perm_id'];
|
||||
$this->ipsclass->perm_id = ( isset($this->member['org_perm_id']) AND $this->member['org_perm_id'] ) ? $this->member['org_perm_id'] : $this->member['g_perm_id'];
|
||||
|
||||
$this->ipsclass->perm_id_array = explode( ",", $this->ipsclass->perm_id );
|
||||
}
|
||||
@@ -653,10 +721,10 @@ class session
|
||||
|
||||
if ($member_id != 0)
|
||||
{
|
||||
$this->ipsclass->DB->build_query( array( 'select' => "id, name, mgroup, member_login_key, email, restrict_post, view_sigs, view_avs, view_pop, view_img, auto_track,
|
||||
$this->ipsclass->DB->build_query( array( 'select' => "id, name, mgroup, member_login_key, member_login_key_expire, email, restrict_post, view_sigs, view_avs, view_pop, view_img, auto_track,
|
||||
mod_posts, language, skin, new_msg, show_popup, msg_total, time_offset, posts, joined, last_post, subs_pkg_chosen,
|
||||
ignored_users, login_anonymous, last_visit, last_activity, dst_in_use, view_prefs, org_perm_id, mgroup_others, temp_ban, sub_end,
|
||||
has_blog, members_markers, members_editor_choice, members_auto_dst, members_display_name, members_created_remote,
|
||||
has_blog, has_gallery, members_markers, members_editor_choice, members_auto_dst, members_display_name, members_created_remote,
|
||||
members_cache, members_disable_pm",
|
||||
'from' => 'members',
|
||||
'where' => 'id='.$member_id ) );
|
||||
@@ -682,7 +750,7 @@ class session
|
||||
// Unpack cache
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->member['members_cache'] )
|
||||
if ( isset($this->member['members_cache']) )
|
||||
{
|
||||
$this->member['_cache'] = $this->ipsclass->unpack_member_cache( $this->member['members_cache'] );
|
||||
}
|
||||
@@ -691,6 +759,11 @@ class session
|
||||
$this->member['_cache'] = array();
|
||||
}
|
||||
|
||||
if ( ! isset( $this->member['_cache']['friends'] ) or ! is_array( $this->member['_cache']['friends'] ) )
|
||||
{
|
||||
$this->member['_cache']['friends'] = array();
|
||||
}
|
||||
|
||||
unset($member_id);
|
||||
}
|
||||
|
||||
@@ -731,6 +804,14 @@ class session
|
||||
return;
|
||||
}
|
||||
|
||||
if ( time() - $this->member['last_activity'] > $this->ipsclass->vars['session_expiration'] )
|
||||
{
|
||||
// Session is expired - create new session
|
||||
|
||||
$this->create_member_session();
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get module settings
|
||||
//-----------------------------------------
|
||||
@@ -746,6 +827,8 @@ class session
|
||||
return;
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->force_data_type = array( 'member_name' => 'string' );
|
||||
|
||||
$this->ipsclass->DB->do_shutdown_update( 'sessions',
|
||||
array(
|
||||
'member_name' => $this->member['members_display_name'],
|
||||
@@ -755,12 +838,12 @@ class session
|
||||
'running_time' => $this->time_now,
|
||||
'location' => $vars['location'],
|
||||
'in_error' => 0,
|
||||
'location_1_type' => $vars['1_type'],
|
||||
'location_1_id' => $vars['1_id'],
|
||||
'location_2_type' => $vars['2_type'],
|
||||
'location_2_id' => $vars['2_id'],
|
||||
'location_3_type' => $vars['3_type'],
|
||||
'location_3_id' => $vars['3_id'],
|
||||
'location_1_type' => isset($vars['1_type']) ? $vars['1_type'] : '',
|
||||
'location_1_id' => isset($vars['1_id']) ? intval($vars['1_id']) : 0,
|
||||
'location_2_type' => isset($vars['2_type']) ? $vars['2_type'] : '',
|
||||
'location_2_id' => isset($vars['2_id']) ? intval($vars['2_id']) : 0,
|
||||
'location_3_type' => isset($vars['3_type']) ? $vars['3_type'] : '',
|
||||
'location_3_id' => isset($vars['3_id']) ? intval($vars['3_id']) : 0,
|
||||
),
|
||||
"id='{$this->session_id}'"
|
||||
);
|
||||
@@ -797,21 +880,23 @@ class session
|
||||
return;
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->force_data_type = array( 'member_name' => 'string' );
|
||||
|
||||
$this->ipsclass->DB->do_shutdown_update( 'sessions',
|
||||
array(
|
||||
'member_name' => "",
|
||||
'member_name' => '',
|
||||
'member_id' => 0,
|
||||
'member_group' => $this->ipsclass->vars['guest_group'],
|
||||
'login_type' => substr($this->member['login_anonymous'],0, 1),
|
||||
'login_type' => '',
|
||||
'running_time' => $this->time_now,
|
||||
'location' => $vars['location'],
|
||||
'in_error' => 0,
|
||||
'location_1_type' => $vars['1_type'],
|
||||
'location_1_id' => $vars['1_id'],
|
||||
'location_2_type' => $vars['2_type'],
|
||||
'location_2_id' => $vars['2_id'],
|
||||
'location_3_type' => $vars['3_type'],
|
||||
'location_3_id' => $vars['3_id'],
|
||||
'location_1_type' => isset($vars['1_type']) ? $vars['1_type'] : '',
|
||||
'location_1_id' => isset($vars['1_id']) ? intval($vars['1_id']) : 0,
|
||||
'location_2_type' => isset($vars['2_type']) ? $vars['2_type'] : '',
|
||||
'location_2_id' => isset($vars['2_id']) ? intval($vars['2_id']) : 0,
|
||||
'location_3_type' => isset($vars['3_type']) ? $vars['3_type'] : '',
|
||||
'location_3_id' => isset($vars['3_id']) ? intval($vars['3_id']) : 0,
|
||||
),
|
||||
"id='{$this->session_id}'"
|
||||
);
|
||||
@@ -903,8 +988,7 @@ class session
|
||||
|
||||
$this->ipsclass->vars['session_expiration'] = $this->ipsclass->vars['session_expiration'] ? (time() - $this->ipsclass->vars['session_expiration']) : (time() - 3600);
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'delete' => 'sessions', 'where' => "member_id=".$this->member['id'] ) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
$this->ipsclass->DB->do_delete( 'sessions', "member_id=".$this->member['id'] );
|
||||
|
||||
$this->session_id = md5( uniqid(microtime()) );
|
||||
|
||||
@@ -927,6 +1011,8 @@ class session
|
||||
// Insert the new session
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->force_data_type = array( 'member_name' => 'string' );
|
||||
|
||||
$this->ipsclass->DB->do_shutdown_insert( 'sessions',
|
||||
array(
|
||||
'id' => $this->session_id,
|
||||
@@ -939,12 +1025,12 @@ class session
|
||||
'browser' => $this->ipsclass->user_agent,
|
||||
'location' => $vars['location'],
|
||||
'in_error' => 0,
|
||||
'location_1_type' => $vars['1_type'],
|
||||
'location_1_id' => $vars['1_id'],
|
||||
'location_2_type' => $vars['2_type'],
|
||||
'location_2_id' => $vars['2_id'],
|
||||
'location_3_type' => $vars['3_type'],
|
||||
'location_3_id' => $vars['3_id'],
|
||||
'location_1_type' => isset($vars['1_type']) ? $vars['1_type'] : '',
|
||||
'location_1_id' => isset($vars['1_id']) ? intval($vars['1_id']) : 0,
|
||||
'location_2_type' => isset($vars['2_type']) ? $vars['2_type'] : '',
|
||||
'location_2_id' => isset($vars['2_id']) ? intval($vars['2_id']) : 0,
|
||||
'location_3_type' => isset($vars['3_type']) ? $vars['3_type'] : '',
|
||||
'location_3_id' => isset($vars['3_id']) ? intval($vars['3_id']) : 0,
|
||||
)
|
||||
);
|
||||
|
||||
@@ -1007,7 +1093,8 @@ class session
|
||||
{
|
||||
$query[] = "id='".$this->session_dead_id."'";
|
||||
}
|
||||
else if ( $this->ipsclass->vars['match_ipaddress'] == 1 )
|
||||
|
||||
if ( $this->ipsclass->vars['match_ipaddress'] == 1 )
|
||||
{
|
||||
$query[] = "ip_address='".$this->ipsclass->ip_address."'";
|
||||
}
|
||||
@@ -1039,6 +1126,8 @@ class session
|
||||
// Insert the new session
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->force_data_type = array( 'member_name' => 'string' );
|
||||
|
||||
$this->ipsclass->DB->do_shutdown_insert( 'sessions',
|
||||
array(
|
||||
'id' => $this->session_id,
|
||||
@@ -1051,12 +1140,12 @@ class session
|
||||
'browser' => $this->ipsclass->user_agent,
|
||||
'location' => $vars['location'],
|
||||
'in_error' => 0,
|
||||
'location_1_type' => $vars['1_type'],
|
||||
'location_1_id' => $vars['1_id'],
|
||||
'location_2_type' => $vars['2_type'],
|
||||
'location_2_id' => $vars['2_id'],
|
||||
'location_3_type' => $vars['3_type'],
|
||||
'location_3_id' => $vars['3_id'],
|
||||
'location_1_type' => isset($vars['1_type']) ? $vars['1_type'] : '',
|
||||
'location_1_id' => isset($vars['1_id']) ? intval($vars['1_id']) : 0,
|
||||
'location_2_type' => isset($vars['2_type']) ? $vars['2_type'] : '',
|
||||
'location_2_id' => isset($vars['2_id']) ? intval($vars['2_id']) : 0,
|
||||
'location_3_type' => isset($vars['3_type']) ? $vars['3_type'] : '',
|
||||
'location_3_id' => isset($vars['3_id']) ? intval($vars['3_id']) : 0,
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -1073,6 +1162,8 @@ class session
|
||||
|
||||
$vars = $this->_get_location_settings();
|
||||
|
||||
$this->ipsclass->DB->force_data_type = array( 'member_name' => 'string' );
|
||||
|
||||
$this->ipsclass->DB->do_shutdown_insert( 'sessions',
|
||||
array(
|
||||
'id' => $bot.'='.str_replace('.','',$this->ipsclass->ip_address ).'_session',
|
||||
@@ -1085,12 +1176,12 @@ class session
|
||||
'browser' => $this->ipsclass->user_agent,
|
||||
'location' => $vars['location'],
|
||||
'in_error' => 0,
|
||||
'location_1_type' => $vars['1_type'],
|
||||
'location_1_id' => $vars['1_id'],
|
||||
'location_2_type' => $vars['2_type'],
|
||||
'location_2_id' => $vars['2_id'],
|
||||
'location_3_type' => $vars['3_type'],
|
||||
'location_3_id' => $vars['3_id'],
|
||||
'location_1_type' => isset($vars['1_type']) ? $vars['1_type'] : '',
|
||||
'location_1_id' => isset($vars['1_id']) ? intval($vars['1_id']) : 0,
|
||||
'location_2_type' => isset($vars['2_type']) ? $vars['2_type'] : '',
|
||||
'location_2_id' => isset($vars['2_id']) ? intval($vars['2_id']) : 0,
|
||||
'location_3_type' => isset($vars['3_type']) ? $vars['3_type'] : '',
|
||||
'location_3_id' => isset($vars['3_id']) ? intval($vars['3_id']) : 0,
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -1107,6 +1198,8 @@ class session
|
||||
|
||||
$vars = $this->_get_location_settings();
|
||||
|
||||
$this->ipsclass->DB->force_data_type = array( 'member_name' => 'string' );
|
||||
|
||||
$this->ipsclass->DB->do_shutdown_update( 'sessions',
|
||||
array(
|
||||
'member_name' => $name ? $name : $bot,
|
||||
@@ -1116,12 +1209,12 @@ class session
|
||||
'running_time' => $this->time_now,
|
||||
'location' => $vars['location'],
|
||||
'in_error' => 0,
|
||||
'location_1_type' => $vars['1_type'],
|
||||
'location_1_id' => $vars['1_id'],
|
||||
'location_2_type' => $vars['2_type'],
|
||||
'location_2_id' => $vars['2_id'],
|
||||
'location_3_type' => $vars['3_type'],
|
||||
'location_3_id' => $vars['3_id'],
|
||||
'location_1_type' => isset($vars['1_type']) ? $vars['1_type'] : '',
|
||||
'location_1_id' => isset($vars['1_id']) ? intval($vars['1_id']) : 0,
|
||||
'location_2_type' => isset($vars['2_type']) ? $vars['2_type'] : '',
|
||||
'location_2_id' => isset($vars['2_id']) ? intval($vars['2_id']) : 0,
|
||||
'location_3_type' => isset($vars['3_type']) ? $vars['3_type'] : '',
|
||||
'location_3_id' => isset($vars['3_id']) ? intval($vars['3_id']) : 0,
|
||||
),
|
||||
"id='".$bot.'='.str_replace('.','',$this->ipsclass->ip_address )."_session'"
|
||||
);
|
||||
@@ -1138,7 +1231,7 @@ class session
|
||||
//-----------------------------------------
|
||||
|
||||
$return = array();
|
||||
$module = $this->ipsclass->input['automodule'] ? $this->ipsclass->input['automodule'] : $this->ipsclass->input['module'];
|
||||
$module = isset($this->ipsclass->input['automodule']) ? $this->ipsclass->input['automodule'] : ( isset($this->ipsclass->input['module']) ? $this->ipsclass->input['module'] : '' );
|
||||
|
||||
//-----------------------------------------
|
||||
// MODULE?
|
||||
@@ -1203,6 +1296,9 @@ class session
|
||||
|
||||
else
|
||||
{
|
||||
$this->ipsclass->input['p'] = isset($this->ipsclass->input['p']) ? $this->ipsclass->input['p'] : '';
|
||||
$this->ipsclass->input['CODE'] = isset($this->ipsclass->input['CODE']) ? $this->ipsclass->input['CODE'] : '';
|
||||
|
||||
$return = array( 'location' => $this->ipsclass->input['act'].",".$this->ipsclass->input['p'].",".$this->ipsclass->input['CODE'] );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +1,14 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-06-23 10:44:15 +0100 (Fri, 23 Jun 2006) $
|
||||
| > $Revision: 338 $
|
||||
@@ -35,435 +24,444 @@
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class class_virus_checker
|
||||
{
|
||||
|
||||
/**
|
||||
* Global
|
||||
*/
|
||||
var $ipsclass;
|
||||
|
||||
/**
|
||||
* Directory separator
|
||||
*/
|
||||
var $dir_split = "/";
|
||||
|
||||
/**
|
||||
* Dodgy files
|
||||
* @var array [ idx ] = ( file_path, file_name );
|
||||
*/
|
||||
var $bad_files = array ();
|
||||
|
||||
/**
|
||||
* Checked folders
|
||||
*/
|
||||
var $checked_folders = array ();
|
||||
|
||||
/**
|
||||
* Known names
|
||||
*/
|
||||
var $known_names = array ();
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// CONSTRUCTAA
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function class_virus_checker()
|
||||
{
|
||||
set_time_limit(0);
|
||||
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
|
||||
{
|
||||
$this->dir_split = "\\";
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Known names
|
||||
//-----------------------------------------
|
||||
|
||||
require (ROOT_PATH.'sources/classes/class_virus_checker/lib_known_names.php');
|
||||
|
||||
$this->known_names = $KNOWN_NAMES;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Run the scan
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Runs the scan
|
||||
* All suspicious files are entered into
|
||||
* $this->bad_files array
|
||||
*/
|
||||
|
||||
function run_scan()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$expected = array ();
|
||||
$root_dir = preg_replace("#^(.+?)\/$#", "\\1", ROOT_PATH);
|
||||
$skin_dirs = array ();
|
||||
|
||||
//-----------------------------------------
|
||||
// Load extra db cache file
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->load_cache_file(ROOT_PATH.'sources/sql/'.SQL_DRIVER.'_extra_queries.php', 'sql_extra_queries');
|
||||
|
||||
//-----------------------------------------
|
||||
// Get libs
|
||||
//-----------------------------------------
|
||||
|
||||
require (ROOT_PATH.'sources/classes/class_virus_checker/lib_writeable_dirs.php');
|
||||
require (ROOT_PATH.'sources/classes/class_virus_checker/lib_lang_files.php');
|
||||
|
||||
//-----------------------------------------
|
||||
// Sort out directory separator
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->dir_split != '/')
|
||||
{
|
||||
$_WRITEABLE_DIRS = $WRITEABLE_DIRS;
|
||||
$WRITEABLE_DIRS = array ();
|
||||
|
||||
foreach ($_WRITEABLE_DIRS as $dir)
|
||||
{
|
||||
$WRITEABLE_DIRS[] = str_replace('/', $this->dir_split, $dir);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get language directories
|
||||
//-----------------------------------------
|
||||
|
||||
if (isset ($this->ipsclass->cache['languages']) AND is_array($this->ipsclass->cache['languages']) && count($this->ipsclass->cache['languages']))
|
||||
{
|
||||
foreach ($this->ipsclass->cache['languages'] as $v)
|
||||
{
|
||||
$WRITEABLE_DIRS[] = 'cache'.$this->dir_split.'lang_cache'.$this->dir_split.$v['ldir'];
|
||||
|
||||
foreach ($LANG_FILES as $filename)
|
||||
{
|
||||
$expected[] = 'cache'.$this->dir_split.'lang_cache'.$this->dir_split.$v['ldir'].$this->dir_split.$filename.'.php';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->DB->build_query(array ('select' => 'ldir', 'from' => 'languages'));
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
while ($v = $this->ipsclass->DB->fetch_row())
|
||||
{
|
||||
$WRITEABLE_DIRS[] = 'cache'.$this->dir_split.'lang_cache'.$this->dir_split.$v['ldir'];
|
||||
|
||||
foreach ($LANG_FILES as $filename)
|
||||
{
|
||||
$expected[] = 'cache'.$this->dir_split.'lang_cache'.$this->dir_split.$v['ldir'].$this->dir_split.$filename.'.php';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get skin directories
|
||||
//-----------------------------------------
|
||||
|
||||
if (is_array($this->ipsclass->cache['skin_id_cache']) && count($this->ipsclass->cache['skin_id_cache']))
|
||||
{
|
||||
foreach ($this->ipsclass->cache['skin_id_cache'] as $k => $v)
|
||||
{
|
||||
if ($k == 1 && !IN_DEV)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$WRITEABLE_DIRS[] = 'cache'.$this->dir_split.'skin_cache'.$this->dir_split.'cacheid_'.$v['set_skin_set_id'];
|
||||
$skin_dirs[] = $v['set_skin_set_id'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->DB->build_query(array ('select' => 'set_skin_set_id', 'from' => 'skin_sets'));
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
while ($v = $this->ipsclass->DB->fetch_row())
|
||||
{
|
||||
$WRITEABLE_DIRS[] = 'cache'.$this->dir_split.'skin_cache'.$this->dir_split.'cacheid_'.$v['set_skin_set_id '];
|
||||
$skin_dirs[] = $v['set_skin_set_id'];
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get skin files
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->cache_add_query('diag_distinct_skins', array (), 'sql_extra_queries');
|
||||
$this->ipsclass->DB->cache_exec_query();
|
||||
|
||||
while ($v = $this->ipsclass->DB->fetch_row())
|
||||
{
|
||||
foreach ($skin_dirs as $dir)
|
||||
{
|
||||
$expected[] = 'cache'.$this->dir_split.'skin_cache'.$this->dir_split.'cacheid_'.$dir.$this->dir_split.$v['group_name'].'.php';
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Alright, do it!
|
||||
//-----------------------------------------
|
||||
|
||||
$WRITEABLE_DIRS = array_unique($WRITEABLE_DIRS);
|
||||
|
||||
foreach ($WRITEABLE_DIRS as $dir_to_check)
|
||||
{
|
||||
if ($dir_to_check == 'uploads' OR $dir_to_check == 'style_emoticons')
|
||||
{
|
||||
# Leave this 'til later
|
||||
continue;
|
||||
}
|
||||
|
||||
if (file_exists($root_dir.$this->dir_split.$dir_to_check))
|
||||
{
|
||||
$this->checked_folders[] = $root_dir.$this->dir_split.$dir_to_check;
|
||||
|
||||
$dh = opendir($root_dir.$this->dir_split.$dir_to_check);
|
||||
|
||||
while (false !== ($file = readdir($dh)))
|
||||
{
|
||||
if (preg_match("#.*\.(php|js|html|htm|cgi|pl|perl|php3|php4|php5|php6)$#i", $file))
|
||||
{
|
||||
if (!in_array($dir_to_check.$this->dir_split.$file, $expected) AND $file != "index.html" AND $file != 'lang_javascript.js')
|
||||
{
|
||||
$score = intval($this->score_file($root_dir.$this->dir_split.$dir_to_check.$this->dir_split.$file));
|
||||
|
||||
$this->bad_files[] = array ('file_path' => $root_dir.$this->dir_split.$dir_to_check.$this->dir_split.$file, 'file_name' => $file, 'score' => $score);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ closedir($dh);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check 'blog' dir
|
||||
//-----------------------------------------
|
||||
|
||||
if (file_exists($root_dir.$this->dir_split.'blog'))
|
||||
{
|
||||
$this->anti_virus_deep_scan($root_dir.$this->dir_split.'blog', 'all', array ('index.php'));
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check 'html' dir
|
||||
//-----------------------------------------
|
||||
|
||||
if (file_exists($root_dir.$this->dir_split.'html'))
|
||||
{
|
||||
$this->anti_virus_deep_scan($root_dir.$this->dir_split.'html', 'all', array ('index.php'));
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check 'Skin' dir
|
||||
//-----------------------------------------
|
||||
|
||||
if (file_exists($root_dir.$this->dir_split.'Skin'))
|
||||
{
|
||||
$this->anti_virus_deep_scan($root_dir.$this->dir_split.'Skin', 'all');
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check emoticons
|
||||
//-----------------------------------------
|
||||
|
||||
$this->anti_virus_deep_scan($root_dir.$this->dir_split.'style_emoticons', 'all');
|
||||
|
||||
//-----------------------------------------
|
||||
// Check image directories
|
||||
//-----------------------------------------
|
||||
|
||||
$this->anti_virus_deep_scan($root_dir.$this->dir_split.'style_images', '(php|cgi|pl|perl|php3|php4|php5|php6)');
|
||||
|
||||
//-----------------------------------------
|
||||
// Check upload directories
|
||||
//-----------------------------------------
|
||||
|
||||
$this->anti_virus_deep_scan($root_dir.$this->dir_split.'uploads');
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Score a file
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Score a file
|
||||
*
|
||||
* Return a score from 0 being harmless to 10 being, well the complete opposite to harmless.
|
||||
*
|
||||
* Score information:
|
||||
* Name 3 chars or less + 2
|
||||
* '- Name 2 chars or less + 4
|
||||
* Size over 65k + 3
|
||||
* '- Size over 100k + 4
|
||||
* User nobody + 3
|
||||
* Modified in the 30 days + 1
|
||||
* In non PHP folder + 3
|
||||
*
|
||||
* @param string Full file path and name
|
||||
* @param array stat info
|
||||
*
|
||||
* @return int Score (0 - 10 )
|
||||
*/
|
||||
function score_file($file_name, $stat = array ())
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$SCORE = 0;
|
||||
$name = preg_replace("#^(.*)/(.+?)$#is", "\\2", $file_name);
|
||||
$name_sans_ext = preg_replace("#^(.*)\.(.+?)$#si", "\\1", $name);
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if (!$file_name)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!is_array($stat) OR !count($stat))
|
||||
{
|
||||
$stat = stat($file_name);
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Alright...
|
||||
//-----------------------------------------
|
||||
|
||||
if (in_array($file_name, $this->known_names))
|
||||
{
|
||||
$SCORE += 7;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// User nobody?
|
||||
//-----------------------------------------
|
||||
|
||||
if ($stat['uid'] == 99)
|
||||
{
|
||||
$SCORE += 3;
|
||||
}
|
||||
|
||||
if (strlen($name_sans_ext) < 3)
|
||||
{
|
||||
$SCORE += 4;
|
||||
}
|
||||
else
|
||||
if ($name_sans_ext == 'temp' OR $name_sans_ext == 'test')
|
||||
{
|
||||
$SCORE += 2;
|
||||
}
|
||||
else
|
||||
if (strlen($name_sans_ext) < 4)
|
||||
{
|
||||
$SCORE += 2;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Size
|
||||
//-----------------------------------------
|
||||
|
||||
if ($stat['size'] > 100 * 1024)
|
||||
{
|
||||
$SCORE += 4;
|
||||
}
|
||||
else
|
||||
if ($stat['size'] > 65 * 1024)
|
||||
{
|
||||
$SCORE += 3;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Last modified...
|
||||
//-----------------------------------------
|
||||
|
||||
if ($stat['mtime'] > time() - 86400 * 30)
|
||||
{
|
||||
$SCORE += 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Non PHP folder...
|
||||
//-----------------------------------------
|
||||
|
||||
if (preg_match("#(?:style_images|style_emoticons|uploads|style_avatars|default|1|skin_acp|html|skin)/#i", $file_name))
|
||||
{
|
||||
$SCORE += 3;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Return
|
||||
//-----------------------------------------
|
||||
|
||||
return $SCORE > 10 ? 10 : $SCORE;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Deep scan
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Deep scan
|
||||
*
|
||||
* All suspicious files are entered into
|
||||
* $this->bad_files array
|
||||
*/
|
||||
function anti_virus_deep_scan($dir, $look_for = '(php|js|html|htm|cgi|pl|perl|php3|php4|php5|php6)', $ignore_files = array ())
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Short-hand
|
||||
//-----------------------------------------
|
||||
|
||||
if ($look_for == 'all')
|
||||
{
|
||||
$look_for = '(php|js|html|htm|cgi|pl|perl|php3|php4|php5|php6)';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add into checked folders
|
||||
//-----------------------------------------
|
||||
|
||||
$this->checked_folders[] = $dir.$this->dir_split.$file;
|
||||
|
||||
$dh = opendir($dir);
|
||||
|
||||
while (false !== ($file = readdir($dh)))
|
||||
{
|
||||
if ($file == '.' or $file == '..' or $file == '.svn' or $file == '.DS_store' or $file == 'index.html')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_dir($dir.$this->dir_split.$file))
|
||||
{
|
||||
$this->anti_virus_deep_scan($dir.$this->dir_split.$file, $look_for);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (in_array($dir.$this->dir_split.$file, $ignore_files))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match("#^(.*)?\.".$look_for."$#i", $file))
|
||||
{
|
||||
$score = intval($this->score_file($dir.$this->dir_split.$file));
|
||||
|
||||
$this->bad_files[] = array ('file_path' => $dir.$this->dir_split.$file, 'file_name' => $file, 'score' => $score);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Global
|
||||
*/
|
||||
var $ipsclass;
|
||||
|
||||
/**
|
||||
* Directory separator
|
||||
*/
|
||||
var $dir_split = "/";
|
||||
|
||||
/**
|
||||
* Dodgy files
|
||||
* @var array [ idx ] = ( file_path, file_name );
|
||||
*/
|
||||
var $bad_files = array();
|
||||
|
||||
/**
|
||||
* Checked folders
|
||||
*/
|
||||
var $checked_folders = array();
|
||||
|
||||
/**
|
||||
* Known names
|
||||
*/
|
||||
var $known_names = array();
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// CONSTRUCTAA
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function class_virus_checker()
|
||||
{
|
||||
set_time_limit(0);
|
||||
|
||||
if ( strtoupper( substr(PHP_OS, 0, 3) ) === 'WIN' )
|
||||
{
|
||||
$this->dir_split = "\\";
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Known names
|
||||
//-----------------------------------------
|
||||
|
||||
require( ROOT_PATH . 'sources/classes/class_virus_checker/lib_known_names.php' );
|
||||
|
||||
$this->known_names = $KNOWN_NAMES;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Run the scan
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Runs the scan
|
||||
* All suspicious files are entered into
|
||||
* $this->bad_files array
|
||||
*/
|
||||
|
||||
function run_scan()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$expected = array();
|
||||
$root_dir = preg_replace( "#^(.+?)\/$#", "\\1", ROOT_PATH );
|
||||
$skin_dirs = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Load extra db cache file
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->load_cache_file( ROOT_PATH.'sources/sql/'.SQL_DRIVER.'_extra_queries.php', 'sql_extra_queries' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get libs
|
||||
//-----------------------------------------
|
||||
|
||||
require( ROOT_PATH . 'sources/classes/class_virus_checker/lib_writeable_dirs.php' );
|
||||
require( ROOT_PATH . 'sources/classes/class_virus_checker/lib_lang_files.php' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Sort out directory separator
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->dir_split != '/' )
|
||||
{
|
||||
$_WRITEABLE_DIRS = $WRITEABLE_DIRS;
|
||||
$WRITEABLE_DIRS = array();
|
||||
|
||||
foreach( $_WRITEABLE_DIRS as $dir )
|
||||
{
|
||||
$WRITEABLE_DIRS[] = str_replace( '/' , $this->dir_split, $dir );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get language directories
|
||||
//-----------------------------------------
|
||||
|
||||
if ( isset($this->ipsclass->cache['languages']) AND is_array( $this->ipsclass->cache['languages'] ) && count( $this->ipsclass->cache['languages'] ) )
|
||||
{
|
||||
foreach( $this->ipsclass->cache['languages'] as $v )
|
||||
{
|
||||
$WRITEABLE_DIRS[] = 'cache'.$this->dir_split.'lang_cache'.$this->dir_split.$v['ldir'];
|
||||
|
||||
foreach( $LANG_FILES as $filename )
|
||||
{
|
||||
$expected[] = 'cache'.$this->dir_split.'lang_cache'.$this->dir_split.$v['ldir'].$this->dir_split.$filename.'.php';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'ldir', 'from' => 'languages' ) );
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
while( $v = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$WRITEABLE_DIRS[] = 'cache'.$this->dir_split.'lang_cache'.$this->dir_split.$v['ldir'];
|
||||
|
||||
foreach( $LANG_FILES as $filename )
|
||||
{
|
||||
$expected[] = 'cache'.$this->dir_split.'lang_cache'.$this->dir_split.$v['ldir'].$this->dir_split.$filename.'.php';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get skin directories
|
||||
//-----------------------------------------
|
||||
|
||||
if ( is_array( $this->ipsclass->cache['skin_id_cache'] ) && count( $this->ipsclass->cache['skin_id_cache'] ) )
|
||||
{
|
||||
foreach( $this->ipsclass->cache['skin_id_cache'] as $k => $v )
|
||||
{
|
||||
if ( $k == 1 && !IN_DEV )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$WRITEABLE_DIRS[] = 'cache'.$this->dir_split.'skin_cache'.$this->dir_split.'cacheid_'.$v['set_skin_set_id'];
|
||||
$skin_dirs[] = $v['set_skin_set_id'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'set_skin_set_id', 'from' => 'skin_sets' ) );
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
while( $v = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$WRITEABLE_DIRS[] = 'cache'.$this->dir_split.'skin_cache'.$this->dir_split.'cacheid_'.$v['set_skin_set_id '];
|
||||
$skin_dirs[] = $v['set_skin_set_id'];
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get skin files
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->cache_add_query( 'diag_distinct_skins', array(), 'sql_extra_queries' );
|
||||
$this->ipsclass->DB->cache_exec_query();
|
||||
|
||||
while( $v = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
foreach( $skin_dirs as $dir )
|
||||
{
|
||||
$expected[] = 'cache'.$this->dir_split.'skin_cache'.$this->dir_split.'cacheid_'.$dir.$this->dir_split.$v['group_name'].'.php';
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Alright, do it!
|
||||
//-----------------------------------------
|
||||
|
||||
$WRITEABLE_DIRS = array_unique($WRITEABLE_DIRS);
|
||||
|
||||
foreach( $WRITEABLE_DIRS as $dir_to_check )
|
||||
{
|
||||
if ( $dir_to_check == 'uploads' OR $dir_to_check == 'style_emoticons' )
|
||||
{
|
||||
# Leave this 'til later
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( file_exists( $root_dir . $this->dir_split . $dir_to_check ) )
|
||||
{
|
||||
$this->checked_folders[] = $root_dir . $this->dir_split . $dir_to_check;
|
||||
|
||||
$dh = opendir( $root_dir . $this->dir_split . $dir_to_check );
|
||||
|
||||
while ( false !== ( $file = readdir($dh) ) )
|
||||
{
|
||||
if ( preg_match( "#.*\.(php|js|html|htm|cgi|pl|perl|php3|php4|php5|php6)$#i", $file ) )
|
||||
{
|
||||
if ( ! in_array( $dir_to_check.$this->dir_split.$file, $expected ) AND $file != "index.html" AND $file != 'lang_javascript.js' )
|
||||
{
|
||||
$score = intval( $this->score_file( $root_dir.$this->dir_split.$dir_to_check.$this->dir_split.$file ) );
|
||||
|
||||
$this->bad_files[] = array( 'file_path' => $root_dir.$this->dir_split.$dir_to_check.$this->dir_split.$file,
|
||||
'file_name' => $file,
|
||||
'score' => $score );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@closedir($dh);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check 'blog' dir
|
||||
//-----------------------------------------
|
||||
|
||||
if ( file_exists( $root_dir.$this->dir_split.'blog' ) )
|
||||
{
|
||||
$this->anti_virus_deep_scan( $root_dir.$this->dir_split.'blog', 'all', array( 'index.php' ) );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check 'html' dir
|
||||
//-----------------------------------------
|
||||
|
||||
if ( file_exists( $root_dir.$this->dir_split.'html' ) )
|
||||
{
|
||||
$this->anti_virus_deep_scan( $root_dir.$this->dir_split.'html', 'all', array( 'index.php' ) );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check 'Skin' dir
|
||||
//-----------------------------------------
|
||||
|
||||
if ( file_exists( $root_dir.$this->dir_split.'Skin' ) )
|
||||
{
|
||||
$this->anti_virus_deep_scan( $root_dir.$this->dir_split.'Skin', 'all' );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check emoticons
|
||||
//-----------------------------------------
|
||||
|
||||
$this->anti_virus_deep_scan( $root_dir.$this->dir_split.'style_emoticons', 'all' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check image directories
|
||||
//-----------------------------------------
|
||||
|
||||
$this->anti_virus_deep_scan( $root_dir.$this->dir_split.'style_images', '(php|cgi|pl|perl|php3|php4|php5|php6|phtml|shtml)' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check upload directories
|
||||
//-----------------------------------------
|
||||
|
||||
$this->anti_virus_deep_scan( $root_dir.$this->dir_split.'uploads' );
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Score a file
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Score a file
|
||||
*
|
||||
* Return a score from 0 being harmless to 10 being, well the complete opposite to harmless.
|
||||
*
|
||||
* Score information:
|
||||
* Name 3 chars or less + 2
|
||||
* '- Name 2 chars or less + 4
|
||||
* Size over 65k + 3
|
||||
* '- Size over 100k + 4
|
||||
* User nobody + 3
|
||||
* Modified in the 30 days + 1
|
||||
* In non PHP folder + 3
|
||||
*
|
||||
* @param string Full file path and name
|
||||
* @param array stat info
|
||||
*
|
||||
* @return int Score (0 - 10 )
|
||||
*/
|
||||
function score_file( $file_name, $stat=array() )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$SCORE = 0;
|
||||
$name = preg_replace( "#^(.*)/(.+?)$#is" , "\\2", $file_name );
|
||||
$name_sans_ext = preg_replace( "#^(.*)\.(.+?)$#si", "\\1", $name );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $file_name )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( ! is_array( $stat ) OR ! count( $stat ) )
|
||||
{
|
||||
$stat = stat( $file_name );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Alright...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( in_array( $file_name, $this->known_names ) )
|
||||
{
|
||||
$SCORE += 7;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// User nobody?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $stat['uid'] == 99 )
|
||||
{
|
||||
$SCORE += 3;
|
||||
}
|
||||
|
||||
if ( strlen( $name_sans_ext ) < 3 )
|
||||
{
|
||||
$SCORE += 4;
|
||||
}
|
||||
else if ( $name_sans_ext == 'temp' OR $name_sans_ext == 'test' )
|
||||
{
|
||||
$SCORE +=2;
|
||||
}
|
||||
else if ( strlen( $name_sans_ext ) < 4 )
|
||||
{
|
||||
$SCORE += 2;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Size
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $stat['size'] > 100 * 1024 )
|
||||
{
|
||||
$SCORE += 4;
|
||||
}
|
||||
else if ( $stat['size'] > 65 * 1024 )
|
||||
{
|
||||
$SCORE += 3;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Last modified...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $stat['mtime'] > time() - 86400 * 30 )
|
||||
{
|
||||
$SCORE += 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Non PHP folder...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( preg_match( "#(?:style_images|style_emoticons|uploads|style_avatars|default|1|skin_acp|html|skin)/#i", $file_name ) )
|
||||
{
|
||||
$SCORE += 3;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Return
|
||||
//-----------------------------------------
|
||||
|
||||
return $SCORE > 10 ? 10 : $SCORE;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Deep scan
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Deep scan
|
||||
*
|
||||
* All suspicious files are entered into
|
||||
* $this->bad_files array
|
||||
*/
|
||||
function anti_virus_deep_scan( $dir, $look_for='(php|js|html|htm|cgi|pl|perl|php3|php4|php5|php6|htaccess|so|phtml|shtml)', $ignore_files=array() )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Short-hand
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $look_for == 'all' )
|
||||
{
|
||||
$look_for = '(php|js|html|htm|cgi|pl|perl|php3|php4|php5|php6|htaccess|so|phtml|shtml)';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add into checked folders
|
||||
//-----------------------------------------
|
||||
|
||||
$this->checked_folders[] = $dir . $this->dir_split . $file;
|
||||
|
||||
$dh = opendir( $dir );
|
||||
|
||||
while ( false !== ( $file = readdir($dh) ) )
|
||||
{
|
||||
if ( $file == '.' or $file == '..' or $file == '.svn' or $file == '.DS_store' or $file == 'index.html' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( is_dir( $dir . $this->dir_split . $file ) )
|
||||
{
|
||||
$this->anti_virus_deep_scan( $dir . $this->dir_split . $file, $look_for );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( in_array( $dir . $this->dir_split . $file, $ignore_files ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( preg_match( "#^(.*)?\.".$look_for."$#i", $file ) )
|
||||
{
|
||||
$score = intval( $this->score_file( $dir . $this->dir_split . $file ) );
|
||||
|
||||
$this->bad_files[] = array( 'file_path' => $dir . $this->dir_split . $file,
|
||||
'file_name' => $file,
|
||||
'score' => $score );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,15 +0,0 @@
|
||||
<html>
|
||||
<head><title>Ошибка < Русская версия Invision Power Board</title></head>
|
||||
<body>
|
||||
<h1>Ошибка < Русская версия Invision Power Board</h1>
|
||||
<hr>
|
||||
Вы попали на несуществующую страницу!<br>Пожалуйста нажмите на кнопочку «<b>Назад</b>»
|
||||
в вашем браузере для возвращения на предыдущую страницу.
|
||||
<hr>
|
||||
<b>Invision Power Board:</b>
|
||||
<ul>
|
||||
<li><a href="http://www.bestwarez.ru" title="BestWarez.Ru - Только лучший Варез!">Русская версия</a></li>
|
||||
<li><a href="http://www.invisionboard.com" title="Official Site">English version</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,24 +1,15 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2003 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Email: matt@invisionpower.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@@ -31,7 +22,15 @@ $KNOWN_NAMES = array(
|
||||
'test.php3',
|
||||
'1.php',
|
||||
'2.php',
|
||||
'.php'
|
||||
'.php',
|
||||
'mysql.php',
|
||||
'shell.php',
|
||||
'c99.php',
|
||||
'info.php',
|
||||
'skin_msq.php',
|
||||
'lang_msq.php',
|
||||
'skin_posts.php',
|
||||
'lang_posts.php',
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -1,24 +1,15 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2003 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Email: matt@invisionpower.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,24 +1,15 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2003 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Email: matt@invisionpower.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,28 +2,18 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2005-10-24 22:17:00 +0100 (Mon, 24 Oct 2005) $
|
||||
| > $Revision: 64 $
|
||||
| > $Author: bfarber $
|
||||
| > $Date: 2006-09-22 11:28:54 +0100 (Fri, 22 Sep 2006) $
|
||||
| > $Revision: 567 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Posting Editor
|
||||
@@ -88,6 +78,13 @@
|
||||
* @version 2.1
|
||||
* @since 2.1.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class class_editor
|
||||
{
|
||||
/**
|
||||
@@ -188,14 +185,14 @@ class class_editor
|
||||
* @param string Raw text
|
||||
* @return string Converted text
|
||||
*/
|
||||
function unhtml_emoid( $emoid )
|
||||
function unhtml_emoid( $matches=array() )
|
||||
{
|
||||
$emoid = stripslashes( $emoid );
|
||||
$emoid = stripslashes( $matches[2] );
|
||||
|
||||
$emoid = str_replace( '<', '<', $emoid );
|
||||
$emoid = str_replace( '>', '>', $emoid );
|
||||
|
||||
return $emoid;
|
||||
return 'emoid="' . $emoid . '"';
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -208,15 +205,15 @@ class class_editor
|
||||
* @param string Raw text
|
||||
* @return string Converted text
|
||||
*/
|
||||
function html_emoid( $emoid )
|
||||
function html_emoid( $matches=array() )
|
||||
{
|
||||
$emoid = stripslashes( $emoid );
|
||||
$emoid = stripslashes( $matches[2] );
|
||||
|
||||
$emoid = str_replace( '<', '<', $emoid );
|
||||
$emoid = str_replace( '>', '>', $emoid );
|
||||
$emoid = str_replace( '"', '-', $emoid );
|
||||
|
||||
return $emoid;
|
||||
return ' ' . $emoid . ' ';
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -230,10 +227,10 @@ class class_editor
|
||||
* @param string URL
|
||||
* @return string Converted text
|
||||
*/
|
||||
function unhtml_url( $type='a href', $url='' )
|
||||
function unhtml_url( $matches=array() )
|
||||
{
|
||||
$url = stripslashes( $url );
|
||||
$type = stripslashes( $type );
|
||||
$url = stripslashes( $matches[3] );
|
||||
$type = stripslashes( $matches[1] ? $matches[1] : 'a href' );
|
||||
|
||||
$url = str_replace( '<', '<', $url );
|
||||
$url = str_replace( '>', '>', $url );
|
||||
@@ -255,9 +252,11 @@ class class_editor
|
||||
*/
|
||||
function _rgb_to_hex($t, $t2)
|
||||
{
|
||||
$t = $matches[1];
|
||||
$t2 = $matches[2];
|
||||
|
||||
$tmp = array_map( "trim", explode( ",", $t ) );
|
||||
//print sprintf("#%02X%02X%02X".$t2, intval($tmp[0]), intval($tmp[1]), intval($tmp[2]) );
|
||||
return sprintf("#%02X%02X%02X".$t2, intval($tmp[0]), intval($tmp[1]), intval($tmp[2]) );
|
||||
return 'color: ' . sprintf("#%02X%02X%02X".$t2, intval($tmp[0]), intval($tmp[1]), intval($tmp[2]) );
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
@@ -2,28 +2,18 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-01-30 18:53:19 +0000 (Mon, 30 Jan 2006) $
|
||||
| > $Revision: 127 $
|
||||
| > $Author: bfarber $
|
||||
| > $Date: 2006-10-04 11:22:28 +0100 (Wed, 04 Oct 2006) $
|
||||
| > $Revision: 605 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Posting RTE Editor
|
||||
@@ -60,6 +50,13 @@
|
||||
* @version 2.1
|
||||
* @since 2.1.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class class_editor_module extends class_editor
|
||||
{
|
||||
/**
|
||||
@@ -248,13 +245,22 @@ class class_editor_module extends class_editor
|
||||
// Make URLs safe (prevent tag stripping)
|
||||
//-----------------------------------------
|
||||
|
||||
$t = preg_replace( '#<(a href|img src)=([\'"])([^>]+?)(\\3)#ise', "\$this->unhtml_url( '\\1', '\\3' )", $t );
|
||||
$t = preg_replace_callback( '#<(a href|img src)=([\'"])([^>]+?)(\\3)#is', array( $this, 'unhtml_url' ), $t );
|
||||
|
||||
//-----------------------------------------
|
||||
// Make EMOids safe (prevent tag stripping)
|
||||
//-----------------------------------------
|
||||
|
||||
$t = preg_replace( '#(emoid=\")(.+?)(\")#ise', "'emoid=\"'.\$this->unhtml_emoid('\\2').'\"';", $t );
|
||||
$t = preg_replace_callback( '#(emoid=\")(.+?)(\")#is', array( $this, 'unhtml_emoid' ), $t );
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// WYSI-Weirdness #0: BR tags to \n
|
||||
//-----------------------------------------
|
||||
|
||||
$t = preg_replace( "#<br.*>#isU", "\n", $t );
|
||||
|
||||
$t = trim( $t );
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove tags we're not bothering with
|
||||
@@ -263,15 +269,9 @@ class class_editor_module extends class_editor
|
||||
|
||||
if ( ! $this->allow_html )
|
||||
{
|
||||
$t = strip_tags( $t, '<h1><h2><h3><h4><h5><h6><font><span><div><br><p><img><a><li><ol><ul><b><strong><em><i><u><strike><blockquote>' );
|
||||
$t = strip_tags( $t, '<h1><h2><h3><h4><h5><h6><font><span><div><br><p><img><a><li><ol><ul><b><strong><em><i><u><strike><blockquote><sub><sup>' );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// WYSI-Weirdness #0: BR tags to \n
|
||||
//-----------------------------------------
|
||||
|
||||
$t = preg_replace( "#<br.*>#isU", "\n", $t );
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// WYSI-Weirdness #1: Named anchors
|
||||
//-----------------------------------------
|
||||
@@ -310,7 +310,7 @@ class class_editor_module extends class_editor
|
||||
$t = str_replace( "<#EMO_DIR#>", "<#EMO_DIR>", $t );
|
||||
|
||||
# Parse...
|
||||
$t = preg_replace( "#[ ]?<([^>]+?)emoid=\"(.+?)\"([^>]+?)?".">[ ]?#ise", "' '.\$this->html_emoid('\\2').' '", $t );
|
||||
$t = preg_replace_callback( "#[ ]?<([^>]+?)emoid=\"(.+?)\"([^>]+?)?".">[ ]?#is", array( $this, 'html_emoid' ), $t );
|
||||
|
||||
# And convert it back again...
|
||||
$t = str_replace( "<#EMO_DIR>", "<#EMO_DIR#>", $t );
|
||||
@@ -330,7 +330,7 @@ class class_editor_module extends class_editor
|
||||
//-----------------------------------------
|
||||
|
||||
$t = preg_replace( "#\[url=(\"|'|")<a\s+?href=[\"'](.*)/??['\"]\\2/??</a>#is", "[url=\\1\\2", $t );
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Now, recursively parse the other tags
|
||||
// to make sure we get the nested ones
|
||||
@@ -344,6 +344,9 @@ class class_editor_module extends class_editor
|
||||
$t = $this->_recurse_and_parse( 'strike' , $t, "_parse_simple_tag", 's' );
|
||||
$t = $this->_recurse_and_parse( 'blockquote' , $t, "_parse_simple_tag", 'indent' );
|
||||
|
||||
$t = $this->_recurse_and_parse( 'sup' , $t, "_parse_simple_tag", 'sup' );
|
||||
$t = $this->_recurse_and_parse( 'sub' , $t, "_parse_simple_tag", 'sub' );
|
||||
|
||||
//-----------------------------------------
|
||||
// More complex tags
|
||||
//-----------------------------------------
|
||||
@@ -397,6 +400,19 @@ class class_editor_module extends class_editor
|
||||
$t = preg_replace( "#\[(url|img|b|u|i|s|email|list|indent|right|left|center)\]\[/\\1\]#is", "", $t );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// WYSI-Weirdness #11: Opera crap
|
||||
//-----------------------------------------
|
||||
|
||||
$t = preg_replace( "#\[(font|size|color)\]=[\"']([^\"']+?)[\"']\]\[/\\1\]#is", "", $t );
|
||||
|
||||
//-----------------------------------------
|
||||
// WYSI-Weirdness #11: No domain in FF?
|
||||
//-----------------------------------------
|
||||
|
||||
$t = preg_replace( "#(http|https):\/\/index.php(.*?)#is", $this->ipsclass->vars['board_url'].'/index.php\\2', $t );
|
||||
$t = preg_replace( "#\[url=['\"]index.php(.*?)[\"']#is", "[url=\"".$this->ipsclass->vars['board_url'].'/index.php\\1"', $t );
|
||||
|
||||
//-----------------------------------------
|
||||
// Now call the santize routine to make
|
||||
// html and nasties safe. VITAL!!
|
||||
@@ -700,7 +716,7 @@ class class_editor_module extends class_editor
|
||||
// Convert RGB to hex
|
||||
//-----------------------------------------
|
||||
|
||||
$style = preg_replace( '#(?<!\w)color:\s+?rgb\((\d+,\s+?\d+,\s+?\d+)\)(;?)#ie', "'color: '.\$this->_rgb_to_hex( '\\1','\\2' );", $style );
|
||||
$style = preg_replace_callback( '#(?<!\w)color:\s+?rgb\((\d+,\s+?\d+,\s+?\d+)\)(;?)#i', array( $this, '_rgb_to_hex' ), $style );
|
||||
|
||||
//-----------------------------------------
|
||||
// Pick through possible styles
|
||||
@@ -1213,9 +1229,18 @@ class class_editor_module extends class_editor
|
||||
*/
|
||||
function _get_value_of_option( $option, $text )
|
||||
{
|
||||
preg_match( "#$option(\s+?)?\=(\s+?)?[\"']?(.+?)([\"']|(\s+?)|$|>)#is", $text, $matches );
|
||||
if( $option == 'face' )
|
||||
{
|
||||
// Bad font face, bad
|
||||
preg_match( "#$option(\s+?)?\=(\s+?)?[\"']?(.+?)([\"']|$|color|size|>)#is", $text, $matches );
|
||||
}
|
||||
else
|
||||
{
|
||||
preg_match( "#$option(\s+?)?\=(\s+?)?[\"']?(.+?)([\"']|(\s+?)|$|>)#is", $text, $matches );
|
||||
}
|
||||
|
||||
//preg_match( "#$option(\s+?)?\=(\s+?)?[\"']?(.+?)([\"']|$|>|\s)#is", $text, $matches );
|
||||
return trim( $matches[3] );
|
||||
return isset($matches[3]) ? trim( $matches[3] ) : '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,28 +2,18 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2005-10-24 22:17:00 +0100 (Mon, 24 Oct 2005) $
|
||||
| > $Revision: 64 $
|
||||
| > $Author: bfarber $
|
||||
| > $Date: 2006-09-22 11:28:54 +0100 (Fri, 22 Sep 2006) $
|
||||
| > $Revision: 567 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Posting STD Editor
|
||||
@@ -62,6 +52,13 @@
|
||||
* @since 2.1.0
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class class_editor_module extends class_editor
|
||||
{
|
||||
# Global
|
||||
|
||||
@@ -1,15 +1 @@
|
||||
<html>
|
||||
<head><title>Ошибка < Русская версия Invision Power Board</title></head>
|
||||
<body>
|
||||
<h1>Ошибка < Русская версия Invision Power Board</h1>
|
||||
<hr>
|
||||
Вы попали на несуществующую страницу!<br>Пожалуйста нажмите на кнопочку «<b>Назад</b>»
|
||||
в вашем браузере для возвращения на предыдущую страницу.
|
||||
<hr>
|
||||
<b>Invision Power Board:</b>
|
||||
<ul>
|
||||
<li><a href="http://www.bestwarez.ru" title="BestWarez.Ru - Только лучший Варез!">Русская версия</a></li>
|
||||
<li><a href="http://www.invisionboard.com" title="Official Site">English version</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
<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://www.invisionboard.com/">Invision Power Board</a>␍</body>␍</html>␍
|
||||
@@ -1,15 +1 @@
|
||||
<html>
|
||||
<head><title>Ошибка < Русская версия Invision Power Board</title></head>
|
||||
<body>
|
||||
<h1>Ошибка < Русская версия Invision Power Board</h1>
|
||||
<hr>
|
||||
Вы попали на несуществующую страницу!<br>Пожалуйста нажмите на кнопочку «<b>Назад</b>»
|
||||
в вашем браузере для возвращения на предыдущую страницу.
|
||||
<hr>
|
||||
<b>Invision Power Board:</b>
|
||||
<ul>
|
||||
<li><a href="http://www.bestwarez.ru" title="BestWarez.Ru - Только лучший Варез!">Русская версия</a></li>
|
||||
<li><a href="http://www.invisionboard.com" title="Official Site">English version</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
<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://www.invisionboard.com/">Invision Power Board</a>␍</body>␍</html>␍
|
||||
@@ -2,24 +2,14 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2005 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
| Email: matt@invisionpower.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Payment Gateway API: PAYPAL
|
||||
@@ -75,6 +65,9 @@ class class_gw_module EXTENDS class_gateway
|
||||
var $can_do_recurring_billing = 0;
|
||||
var $can_do_upgrades = 0;
|
||||
|
||||
# No post back
|
||||
var $no_postback = 1;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// INIT
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -195,37 +188,40 @@ class class_gw_module EXTENDS class_gateway
|
||||
// INIT
|
||||
//--------------------------------------
|
||||
|
||||
$referers = array( 'www.2checkout.com', '2checkout.com' );
|
||||
$referers = array( 'www.2checkout.com', '2checkout.com', $_SERVER['HTTP_HOST'], str_replace( 'www.', '', $_SERVER['HTTP_HOST'] ) );
|
||||
$got_match = 0;
|
||||
|
||||
//--------------------------------------
|
||||
// Debug...
|
||||
//--------------------------------------
|
||||
|
||||
if ( GW_TEST_MODE_ON )
|
||||
{
|
||||
//if ( GW_TEST_MODE_ON )
|
||||
//{
|
||||
if ( ! is_array( $_POST ) or ! count( $_POST ) )
|
||||
{
|
||||
$_POST = $_GET;
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
//--------------------------------------
|
||||
// Check...
|
||||
//--------------------------------------
|
||||
|
||||
foreach( $referers as $r )
|
||||
if( $this->ipsclass->my_getenv('HTTP_REFERER') )
|
||||
{
|
||||
if ( preg_match( "#https?://$r#i", $_SERVER['HTTP_REFERER'] ) )
|
||||
foreach( $referers as $r )
|
||||
{
|
||||
$got_match = 1;
|
||||
if ( preg_match( "#http(s)?://$r#i", $this->ipsclass->my_getenv('HTTP_REFERER') ) )
|
||||
{
|
||||
$got_match = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $got_match AND ! GW_TEST_MODE_ON )
|
||||
{
|
||||
$this->error = 'not_valid';
|
||||
return array( 'verified' => FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $got_match AND ! GW_TEST_MODE_ON )
|
||||
{
|
||||
$this->error = 'not_valid';
|
||||
return array( 'verified' => FALSE );
|
||||
}
|
||||
|
||||
//--------------------------------------
|
||||
@@ -265,6 +261,8 @@ class class_gw_module EXTENDS class_gateway
|
||||
{
|
||||
$this->gateway->error = "";
|
||||
|
||||
$_POST['amount'] = $_POST['amount'] ? $_POST['amount'] : $_POST['total'];
|
||||
|
||||
//--------------------------------------
|
||||
// INIT
|
||||
//--------------------------------------
|
||||
|
||||
@@ -2,24 +2,14 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2005 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
| Email: matt@invisionpower.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Payment Gateway API: PAYPAL
|
||||
@@ -75,6 +65,9 @@ class class_gw_module EXTENDS class_gateway
|
||||
var $can_do_recurring_billing = 0;
|
||||
var $can_do_upgrades = 1;
|
||||
|
||||
# No post back
|
||||
var $no_postback = 1;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// INIT
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -117,7 +110,7 @@ class class_gw_module EXTENDS class_gateway
|
||||
$fp_hash = $this->my_calculatefp( $items['vendor_id'], $txn_key, $items['package_cost'], $fp_seq, $fp_time, $items['currency_code'] );
|
||||
|
||||
$this->core_add_hidden_field( "x_cust_id" , $items['package_id'].'x'.$items['member_unique_id'].'x0' );
|
||||
$this->core_add_hidden_field( "x_login" , $items['company_email'] );
|
||||
$this->core_add_hidden_field( "x_login" , $items['vendor_id'] );
|
||||
$this->core_add_hidden_field( "x_amount" , $items['package_cost'] );
|
||||
$this->core_add_hidden_field( "x_currency_code" , $items['currency_code'] );
|
||||
$this->core_add_hidden_field( "x_description" , $items['package_title'] );
|
||||
@@ -145,7 +138,7 @@ class class_gw_module EXTENDS class_gateway
|
||||
$fp_hash = $this->my_calculatefp( $items['vendor_id'], $txn_key, $items['ttr_balance'], $fp_seq, $fp_time, $items['currency_code'] );
|
||||
|
||||
$this->core_add_hidden_field( "x_cust_id" , $items['package_id'].'x'.$items['member_unique_id'].'x'.$items['ttr_package_id'] );
|
||||
$this->core_add_hidden_field( "x_login" , $items['company_email'] );
|
||||
$this->core_add_hidden_field( "x_login" , $items['vendor_id'] );
|
||||
$this->core_add_hidden_field( "x_amount" , $items['ttr_balance'] );
|
||||
$this->core_add_hidden_field( "x_currency_code" , $items['currency_code'] );
|
||||
$this->core_add_hidden_field( "x_description" , $items['package_title'] );
|
||||
|
||||
@@ -2,24 +2,14 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2005 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
| Email: matt@invisionpower.com
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE SOFTWARE!
|
||||
| http://www.invisionboard.com/?license
|
||||
@@ -164,7 +154,7 @@ class class_gateway
|
||||
// Attempt CURL
|
||||
//--------------------------------------
|
||||
|
||||
if ( function_exists("curl_init") )
|
||||
if ( function_exists("curl_init") AND function_exists("curl_exec") )
|
||||
{
|
||||
if ( $sock = curl_init() )
|
||||
{
|
||||
@@ -212,6 +202,18 @@ class class_gateway
|
||||
}
|
||||
}
|
||||
|
||||
if ( defined( 'GW_DEBUG_MODE_ON' ) AND GW_DEBUG_MODE_ON )
|
||||
{
|
||||
$to_write = $result.'\n\n'.$post_back_str.'\n\n';
|
||||
|
||||
foreach( $_POST as $k => $v )
|
||||
{
|
||||
$to_write .= "{$k}: {$v}\n";
|
||||
}
|
||||
|
||||
$this->_write_debug_message( $to_write );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------
|
||||
// Return...
|
||||
|
||||
@@ -2,24 +2,14 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2005 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
| Email: matt@invisionpower.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Payment Gateway API: PAYPAL
|
||||
|
||||
@@ -2,24 +2,14 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2005 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
| Email: matt@invisionpower.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Payment Gateway API: PAYPAL
|
||||
@@ -36,6 +26,8 @@ if ( ! defined( 'GW_CORE_INIT' ) )
|
||||
exit();
|
||||
}
|
||||
|
||||
define( 'IS_NOCHEX', 1 );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// DEFINITIONS EXPECTED AT THIS POINT
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -228,17 +220,24 @@ class class_gw_module EXTENDS class_gateway
|
||||
'sock_url' => 'ssl://www.nochex.com',
|
||||
'sock_path' => '/nochex.dll/apc/apc' );
|
||||
|
||||
foreach ($_POST as $key => $val)
|
||||
{
|
||||
$post_back[] = $key . '=' . urlencode (stripslashes($val));
|
||||
}
|
||||
|
||||
$post_back_str = implode('&', $post_back);
|
||||
|
||||
//--------------------------------------
|
||||
// Throw back to PayPal to verify
|
||||
// Throw back to NoChex to verify
|
||||
//--------------------------------------
|
||||
|
||||
$state = $this->core_post_back( $urls, "", 443 );
|
||||
$state = $this->core_post_back( $urls, $post_back_str, 443 );
|
||||
|
||||
//--------------------------------------
|
||||
// Check...
|
||||
//--------------------------------------
|
||||
|
||||
$state = ( strcmp($state, 'AUTHORISED') == 0 ) ? 'AUTHORISED' : 'INVALID';
|
||||
$state = $state == 'AUTHORISED' ? 'AUTHORISED' : 'INVALID';
|
||||
|
||||
if ( $state != 'AUTHORISED' AND ! GW_TEST_MODE_ON )
|
||||
{
|
||||
|
||||
@@ -2,24 +2,14 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2005 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
| Email: matt@invisionpower.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Payment Gateway API: PAYPAL
|
||||
@@ -269,7 +259,7 @@ class class_gw_module EXTENDS class_gateway
|
||||
|
||||
foreach ($_POST as $key => $val)
|
||||
{
|
||||
$post_back[] = $key . '=' . urlencode ($val);
|
||||
$post_back[] = $key . '=' . urlencode (stripslashes($val));
|
||||
}
|
||||
|
||||
$post_back_str = implode('&', $post_back);
|
||||
@@ -331,10 +321,14 @@ class class_gw_module EXTENDS class_gateway
|
||||
// Sort out payment status
|
||||
//--------------------------------------
|
||||
|
||||
if ( $_POST['payment_status'] == 'Refunded' OR $_POST['txn_type'] == 'subscr_cancel' )
|
||||
if ( $_POST['payment_status'] == 'Refunded' )
|
||||
{
|
||||
$return['payment_status'] = 'REFUND';
|
||||
}
|
||||
else if( $_POST['txn_type'] == 'subscr_cancel' )
|
||||
{
|
||||
$return['payment_status'] = 'CANCEL';
|
||||
}
|
||||
else if ( strstr( $_POST['txn_type'], 'subscr_' ) )
|
||||
{
|
||||
$return['payment_status'] = 'RECURRING';
|
||||
|
||||
@@ -2,24 +2,14 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2005 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
| Email: matt@invisionpower.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Payment Gateway API: PAYPAL
|
||||
@@ -77,6 +67,9 @@ class class_gw_module EXTENDS class_gateway
|
||||
var $can_do_recurring_billing = 0;
|
||||
var $can_do_upgrades = 1;
|
||||
|
||||
# No post back
|
||||
var $no_postback = 1;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// INIT
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -268,6 +261,8 @@ class class_gw_module EXTENDS class_gateway
|
||||
// Process GET data
|
||||
//--------------------------------------
|
||||
|
||||
$_GET['crypt'] = str_replace(" ", "+", $_GET['crypt']);
|
||||
|
||||
$values = $this->_get_token( $this->_simple_xor( base64_decode($_GET['crypt']), $password ) );
|
||||
|
||||
foreach( $values as $k => $v )
|
||||
|
||||
@@ -2,24 +2,14 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2005 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
| Email: matt@invisionpower.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Payment Gateway API: PAYPAL
|
||||
|
||||
@@ -2,24 +2,14 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2005 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
| Email: matt@invisionpower.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Payment Gateway API: PAYPAL
|
||||
|
||||
@@ -2,24 +2,15 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2003 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Email: matt@invisionpower.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Subscription Custom Module (EXAMPLE)
|
||||
|
||||
@@ -1,15 +1 @@
|
||||
<html>
|
||||
<head><title>Ошибка < Русская версия Invision Power Board</title></head>
|
||||
<body>
|
||||
<h1>Ошибка < Русская версия Invision Power Board</h1>
|
||||
<hr>
|
||||
Вы попали на несуществующую страницу!<br>Пожалуйста нажмите на кнопочку «<b>Назад</b>»
|
||||
в вашем браузере для возвращения на предыдущую страницу.
|
||||
<hr>
|
||||
<b>Invision Power Board:</b>
|
||||
<ul>
|
||||
<li><a href="http://www.bestwarez.ru" title="BestWarez.Ru - Только лучший Варез!">Русская версия</a></li>
|
||||
<li><a href="http://www.invisionboard.com" title="Official Site">English version</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
<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://www.invisionboard.com/">Invision Power Board</a>␍</body>␍</html>␍
|
||||
@@ -1,15 +1 @@
|
||||
<html>
|
||||
<head><title>Ошибка < Русская версия Invision Power Board</title></head>
|
||||
<body>
|
||||
<h1>Ошибка < Русская версия Invision Power Board</h1>
|
||||
<hr>
|
||||
Вы попали на несуществующую страницу!<br>Пожалуйста нажмите на кнопочку «<b>Назад</b>»
|
||||
в вашем браузере для возвращения на предыдущую страницу.
|
||||
<hr>
|
||||
<b>Invision Power Board:</b>
|
||||
<ul>
|
||||
<li><a href="http://www.bestwarez.ru" title="BestWarez.Ru - Только лучший Варез!">Русская версия</a></li>
|
||||
<li><a href="http://www.invisionboard.com" title="Official Site">English version</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
<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://www.invisionboard.com/">Invision Power Board</a>␍</body>␍</html>␍
|
||||
File diff suppressed because it is too large.
Load diff
@@ -2,28 +2,18 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-01-11 22:47:48 +0000 (Wed, 11 Jan 2006) $
|
||||
| > $Revision: 122 $
|
||||
| > $Author: bfarber $
|
||||
| > $Date: 2006-10-11 13:55:47 +0100 (Wed, 11 Oct 2006) $
|
||||
| > $Revision: 624 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Post Sub-Class
|
||||
@@ -32,6 +22,11 @@
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class post_functions extends class_post
|
||||
{
|
||||
@@ -94,7 +89,7 @@ class post_functions extends class_post
|
||||
{
|
||||
$this->ipsclass->Error( array( LEVEL => 1, MSG => 'missing_files') );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Generate post key (do we have one?)
|
||||
//-----------------------------------------
|
||||
@@ -110,7 +105,7 @@ class post_functions extends class_post
|
||||
|
||||
$this->ipsclass->DB->do_update( 'posts', array( 'post_key' => $this->post_key ), 'pid='.$this->orig_post['pid'] );
|
||||
|
||||
$this->ipsclass->DB->do_update( 'attachments', array( 'attach_post_key' => $this->post_key ), 'attach_pid='.$this->orig_post['pid'] );
|
||||
$this->ipsclass->DB->do_update( 'attachments', array( 'attach_post_key' => $this->post_key ), "attach_rel_module='post' AND attach_rel_id=".$this->orig_post['pid'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -121,11 +116,22 @@ class post_functions extends class_post
|
||||
// Load the moderator
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->ipsclass->member['id'])
|
||||
if ( $this->ipsclass->member['id'] )
|
||||
{
|
||||
$other_mgroups = array();
|
||||
|
||||
if( $this->ipsclass->member['mgroup_others'] )
|
||||
{
|
||||
$other_mgroups = explode( ",", $this->ipsclass->clean_perm_string( $this->ipsclass->member['mgroup_others'] ) );
|
||||
}
|
||||
|
||||
$other_mgroups[] = $this->ipsclass->member['mgroup'];
|
||||
|
||||
$mgroups = implode( ",", $other_mgroups );
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => 'member_id, member_name, mid, edit_post, edit_topic',
|
||||
'from' => 'moderators',
|
||||
'where' => "forum_id=".$this->forum['id']." AND (member_id='".$this->ipsclass->member['id']."' OR (is_group=1 AND group_id='".$this->ipsclass->member['mgroup']."'))" ) );
|
||||
'where' => "forum_id=".$this->forum['id']." AND (member_id='".$this->ipsclass->member['id']."' OR (is_group=1 AND group_id IN(".$mgroups.")))" ) );
|
||||
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
@@ -144,7 +150,7 @@ class post_functions extends class_post
|
||||
$can_edit = 1;
|
||||
}
|
||||
|
||||
if ($this->moderator['edit_post'])
|
||||
if ( $this->moderator['edit_post'] )
|
||||
{
|
||||
$can_edit = 1;
|
||||
}
|
||||
@@ -155,7 +161,7 @@ class post_functions extends class_post
|
||||
// Have we set a time limit?
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->ipsclass->member['g_edit_cutoff'] > 0)
|
||||
if ( $this->ipsclass->member['g_edit_cutoff'] > 0 )
|
||||
{
|
||||
if ( $this->orig_post['post_date'] > ( time() - ( intval($this->ipsclass->member['g_edit_cutoff']) * 60 ) ) )
|
||||
{
|
||||
@@ -184,33 +190,40 @@ class post_functions extends class_post
|
||||
//-----------------------------------------
|
||||
|
||||
# For edit, this means there is a poll and we have perm to edit
|
||||
$this->can_add_poll = 0;
|
||||
$this->can_add_poll = 0;
|
||||
$this->can_add_poll_mod = 0;
|
||||
|
||||
if ( $this->orig_post['new_topic'] == 1 )
|
||||
{
|
||||
if ( $this->ipsclass->member['g_is_supmod'] == 1 )
|
||||
{
|
||||
$this->edit_title = 1;
|
||||
$this->edit_title = 1;
|
||||
$this->can_add_poll_mod = 1;
|
||||
|
||||
if ( $this->topic['poll_state'] )
|
||||
{
|
||||
//if ( $this->topic['poll_state'] )
|
||||
//{
|
||||
$this->can_add_poll = 1;
|
||||
}
|
||||
//}
|
||||
}
|
||||
else if ( $this->moderator['edit_topic'] == 1 )
|
||||
{
|
||||
$this->edit_title = 1;
|
||||
$this->edit_title = 1;
|
||||
$this->can_add_poll_mod = 1;
|
||||
|
||||
if ( $this->topic['poll_state'] )
|
||||
{
|
||||
//if ( $this->topic['poll_state'] )
|
||||
//{
|
||||
$this->can_add_poll = 1;
|
||||
}
|
||||
//}
|
||||
|
||||
}
|
||||
else if ( $this->ipsclass->member['g_edit_topic'] == 1 )
|
||||
{
|
||||
$this->edit_title = 1;
|
||||
}
|
||||
else if ( $can_edit )
|
||||
{
|
||||
$this->can_add_poll = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,17 +252,6 @@ class post_functions extends class_post
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Did we add an attachment?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->input['attachgo'] )
|
||||
{
|
||||
$this->obj['post_errors'] = "";
|
||||
$this->upload_id = $this->process_upload();
|
||||
$this->show_form();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse the post, and check for any errors.
|
||||
// overwrites saved post intentionally
|
||||
@@ -267,22 +269,17 @@ class post_functions extends class_post
|
||||
// Check for errors
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->obj['post_errors'] == "")
|
||||
{
|
||||
$this->upload = $this->process_upload();
|
||||
}
|
||||
|
||||
if ( ($this->obj['post_errors'] != "") or ($this->obj['preview_post'] != "") )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Show the form again
|
||||
//-----------------------------------------
|
||||
|
||||
$this->show_form($class);
|
||||
$this->show_form( );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->save_post($class);
|
||||
$this->save_post( );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +308,7 @@ class post_functions extends class_post
|
||||
// If the post icon has changed, update the topic post icon
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->orig_post['new_topic'] == 1)
|
||||
if ( $this->orig_post['new_topic'] == 1 )
|
||||
{
|
||||
if ($this->post['icon_id'] != $this->orig_post['icon_id'])
|
||||
{
|
||||
@@ -375,38 +372,64 @@ class post_functions extends class_post
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update poll
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->can_add_poll )
|
||||
{
|
||||
if ( is_array( $this->poll_questions ) AND count( $this->poll_questions ) )
|
||||
{
|
||||
$poll_only = 0;
|
||||
|
||||
if ( $this->ipsclass->vars['ipb_poll_only'] AND $this->ipsclass->input['poll_only'] == 1 )
|
||||
{
|
||||
$poll_only = 1;
|
||||
}
|
||||
|
||||
if ( $this->topic['poll_state'] )
|
||||
{
|
||||
$this->ipsclass->DB->do_update( 'polls', array( 'votes' => intval($this->poll_total_votes),
|
||||
'choices' => addslashes(serialize( $this->poll_questions )),
|
||||
'poll_question' => $this->ipsclass->input['poll_question'],
|
||||
'poll_only' => $poll_only,
|
||||
), 'tid='.$this->topic['tid'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->DB->do_insert( 'polls',
|
||||
array (
|
||||
'tid' => $this->topic['tid'],
|
||||
'forum_id' => $this->forum['id'],
|
||||
'start_date' => time(),
|
||||
'choices' => addslashes(serialize( $this->poll_questions )),
|
||||
'starter_id' => $this->ipsclass->member['id'],
|
||||
'votes' => 0,
|
||||
'poll_question' => $this->ipsclass->input['poll_question'],
|
||||
'poll_only' => $poll_only,
|
||||
) );
|
||||
|
||||
$this->ipsclass->DB->do_update( 'topics', array( 'poll_state' => 1, 'last_vote' => 0, 'total_votes' => 0 ), 'tid='.$this->topic['tid'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Remove the poll
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'polls' , 'where' => "tid=".$this->topic['tid'] ) );
|
||||
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'voters', 'where' => "tid=".$this->topic['tid'] ) );
|
||||
$this->ipsclass->DB->do_update( 'topics', array( 'poll_state' => '', 'last_vote' => '', 'total_votes' => '' ), 'tid='.$this->topic['tid'] );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update topic title?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->edit_title == 1 )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Update poll
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->can_add_poll )
|
||||
{
|
||||
if ( is_array( $this->poll_questions ) AND count( $this->poll_questions ) )
|
||||
{
|
||||
$this->ipsclass->DB->do_update( 'polls', array( 'votes' => intval($this->poll_total_votes),
|
||||
'choices' => addslashes(serialize( $this->poll_questions )),
|
||||
'poll_question' => $this->ipsclass->input['poll_question'],
|
||||
), 'tid='.$this->topic['tid'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Remove the poll
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'polls' , 'where' => "tid=".$this->topic['tid'] ) );
|
||||
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'voters', 'where' => "tid=".$this->topic['tid'] ) );
|
||||
$this->ipsclass->DB->do_update( 'topics', array( 'poll_state' => '', 'last_vote' => '', 'total_votes' => '' ), 'tid='.$this->topic['tid'] );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update topic title
|
||||
//-----------------------------------------
|
||||
@@ -438,17 +461,26 @@ class post_functions extends class_post
|
||||
'member_id' => $this->ipsclass->member['id'],
|
||||
'member_name' => $this->ipsclass->member['members_display_name'],
|
||||
'ip_address' => $this->ip_address,
|
||||
'http_referer'=> $_SERVER['HTTP_REFERER'],
|
||||
'http_referer'=> $this->ipsclass->my_getenv('HTTP_REFERER'),
|
||||
'ctime' => time(),
|
||||
'topic_title' => $this->topic['title'],
|
||||
'action' => "Edited topic title or description '{$this->topic['title']}' to '{$this->ipsclass->input['TopicTitle']}' via post form",
|
||||
'query_string'=> $_SERVER['QUERY_STRING'],
|
||||
'query_string'=> $this->ipsclass->my_getenv('QUERY_STRING'),
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Reason for edit?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->moderator['edit_post'] OR $this->ipsclass->member['g_is_supmod'] )
|
||||
{
|
||||
$this->post['post_edit_reason'] = trim( $this->ipsclass->input['post_edit_reason'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update the database (ib_forum_post)
|
||||
//-----------------------------------------
|
||||
@@ -469,7 +501,7 @@ class post_functions extends class_post
|
||||
// Make attachments "permanent"
|
||||
//-----------------------------------------
|
||||
|
||||
$this->pf_make_attachments_permanent($this->post_key, $this->topic['tid'], $this->orig_post['pid']);
|
||||
$this->pf_make_attachments_permanent( $this->post_key, $this->orig_post['pid'], 'post', array( 'topic_id' => $this->topic['tid'] ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Make sure paperclip symbol is OK
|
||||
@@ -487,7 +519,7 @@ class post_functions extends class_post
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->print->redirect_screen( $this->ipsclass->lang['post_edited'], "act=ST&f={$this->forum['id']}&t={$this->topic['tid']}&st={$this->ipsclass->input['st']}#entry{$this->orig_post['pid']}");
|
||||
$this->ipsclass->print->redirect_screen( $this->ipsclass->lang['post_edited'], "showtopic={$this->topic['tid']}&st={$this->ipsclass->input['st']}#entry{$this->orig_post['pid']}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,8 +551,9 @@ class post_functions extends class_post
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->orig_post['post_htmlstatus'] = isset($this->orig_post['post_htmlstatus']) ? $this->orig_post['post_htmlstatus'] : 0;
|
||||
$this->parser->parse_html = intval($this->orig_post['post_htmlstatus']) AND $this->forum['use_html'] AND $this->ipsclass->member['g_dohtml'] ? 1 : 0;
|
||||
$this->parser->parse_nl2br = $this->ipsclass->input['post_htmlstatus'] == 2 ? 1 : 0;
|
||||
$this->parser->parse_nl2br = (isset($this->ipsclass->input['post_htmlstatus']) AND $this->ipsclass->input['post_htmlstatus'] == 2) ? 1 : 0;
|
||||
$this->parser->parse_smilies = intval($this->orig_post['use_emo']);
|
||||
$this->parser->parse_bbcode = $this->forum['use_ibc'];
|
||||
$raw_post = $this->parser->pre_edit_parse( $this->orig_post['post'] );
|
||||
@@ -535,6 +568,9 @@ class post_functions extends class_post
|
||||
// Is this the first post in the topic?
|
||||
//-----------------------------------------
|
||||
|
||||
$topic_title = "";
|
||||
$topic_desc = "";
|
||||
|
||||
if ( $this->edit_title == 1 )
|
||||
{
|
||||
$topic_title = isset($_POST['TopicTitle']) ? $this->ipsclass->input['TopicTitle'] : $this->topic['title'];
|
||||
@@ -547,21 +583,21 @@ class post_functions extends class_post
|
||||
// Do we have any posting errors?
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->obj['post_errors'])
|
||||
if ( isset($this->obj['post_errors']) AND $this->obj['post_errors'] )
|
||||
{
|
||||
$this->output .= $this->ipsclass->compiled_templates['skin_post']->errors( $this->ipsclass->lang[ $this->obj['post_errors'] ]);
|
||||
}
|
||||
|
||||
if ( $this->obj['preview_post'] )
|
||||
if ( isset($this->obj['preview_post']) AND $this->obj['preview_post'] )
|
||||
{
|
||||
$this->output .= $this->ipsclass->compiled_templates['skin_post']->preview( $this->show_post_preview( $this->post['post'] ) );
|
||||
}
|
||||
|
||||
$this->output .= $this->html_start_form( array( 1 => array( 'CODE', '09' ),
|
||||
2 => array( 't' , $this->topic['tid']),
|
||||
3 => array( 'p' , $this->ipsclass->input['p'] ),
|
||||
4 => array( 'st' , $this->ipsclass->input['st'] ),
|
||||
5 => array( 'post_key', $this->post_key )
|
||||
$this->output .= $this->html_start_form( array( 1 => array( 'CODE' , '09' ),
|
||||
2 => array( 't' , $this->topic['tid']),
|
||||
3 => array( 'p' , $this->ipsclass->input['p'] ),
|
||||
4 => array( 'st' , $this->ipsclass->input['st'] ),
|
||||
5 => array( 'attach_post_key', $this->post_key )
|
||||
) );
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -575,25 +611,21 @@ class post_functions extends class_post
|
||||
$name_fields = $this->html_name_field();
|
||||
|
||||
$post_box = $this->html_post_body( $raw_post );
|
||||
|
||||
if ( $this->edit_title == 1 )
|
||||
{
|
||||
$mod_options = $this->mod_options('edit');
|
||||
}
|
||||
|
||||
$mod_options = $this->edit_title == 1 ? $this->mod_options('edit') : '';
|
||||
|
||||
$end_form = $this->ipsclass->compiled_templates['skin_post']->EndForm( $this->ipsclass->lang['submit_edit'] );
|
||||
|
||||
$post_icons = $this->html_post_icons($this->orig_post['icon_id']);
|
||||
|
||||
if ( $this->can_upload )
|
||||
{
|
||||
$upload_field = $this->html_build_uploads($this->post_key,'edit',$this->orig_post['pid']);
|
||||
}
|
||||
$upload_field = $this->can_upload ? $this->html_build_uploads($this->post_key,'edit',$this->orig_post['pid']) : '';
|
||||
|
||||
//-----------------------------------------
|
||||
// Still here?
|
||||
//-----------------------------------------
|
||||
|
||||
$poll_box = "";
|
||||
|
||||
if ( $this->can_add_poll )
|
||||
{
|
||||
//-----------------------------------------
|
||||
@@ -606,8 +638,10 @@ class post_functions extends class_post
|
||||
$poll_votes = "";
|
||||
$show_open = 0;
|
||||
$is_mod = 0;
|
||||
$poll_only = "";
|
||||
$poll_multi = "";
|
||||
|
||||
if ( is_array( $_POST['question'] ) and count( $_POST['question'] ) )
|
||||
if ( isset($_POST['question']) AND is_array( $_POST['question'] ) and count( $_POST['question'] ) )
|
||||
{
|
||||
foreach( $_POST['question'] as $id => $question )
|
||||
{
|
||||
@@ -625,6 +659,14 @@ class post_functions extends class_post
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset($_POST['multi']) AND is_array( $_POST['multi'] ) and count( $_POST['multi'] ) )
|
||||
{
|
||||
foreach( $_POST['multi'] as $id => $checked )
|
||||
{
|
||||
$poll_multi .= "\t{$id} : '{$checked}',\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_array( $_POST['votes'] ) and count( $_POST['votes'] ) )
|
||||
{
|
||||
foreach( $_POST['votes'] as $id => $vote )
|
||||
@@ -633,8 +675,16 @@ class post_functions extends class_post
|
||||
}
|
||||
}
|
||||
|
||||
$poll_only = 0;
|
||||
|
||||
if( $this->ipsclass->vars['ipb_poll_only'] AND $this->ipsclass->input['poll_only'] == 1 )
|
||||
{
|
||||
$poll_only = "checked='checked'";
|
||||
}
|
||||
|
||||
$poll_questions = preg_replace( "#,(\n)?$#", "\\1", $poll_questions );
|
||||
$poll_choices = preg_replace( "#,(\n)?$#", "\\1", $poll_choices );
|
||||
$poll_multi = preg_replace( "#,(\n)?$#", "\\1", $poll_multi );
|
||||
$poll_votes = preg_replace( "#,(\n)?$#", "\\1", $poll_votes );
|
||||
|
||||
}
|
||||
@@ -649,7 +699,7 @@ class post_functions extends class_post
|
||||
|
||||
$poll_data = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
$poll_answers = unserialize(stripslashes($poll_data['choices']));
|
||||
$poll_answers = $poll_data['choices'] ? unserialize(stripslashes($poll_data['choices'])) : array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Lezz go
|
||||
@@ -659,6 +709,9 @@ class post_functions extends class_post
|
||||
{
|
||||
$poll_questions .= "\t{$question_id} : '".str_replace( "'", ''', $data['question'] )."',\n";
|
||||
|
||||
$data['multi'] = isset($data['multi']) ? intval($data['multi']) : 0;
|
||||
$poll_multi .= "\t{$question_id} : '".$data['multi']."',\n";
|
||||
|
||||
foreach( $data['choice'] as $choice_id => $text )
|
||||
{
|
||||
$choice = $text;
|
||||
@@ -669,36 +722,52 @@ class post_functions extends class_post
|
||||
}
|
||||
}
|
||||
|
||||
$poll_only = 0;
|
||||
|
||||
if ( $this->ipsclass->vars['ipb_poll_only'] AND $poll_data['poll_only'] == 1 )
|
||||
{
|
||||
$poll_only = "checked='checked'";
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Trim off trailing commas (Safari hates it)
|
||||
//-----------------------------------------
|
||||
|
||||
$poll_questions = preg_replace( "#,(\n)?$#", "\\1", $poll_questions );
|
||||
$poll_choices = preg_replace( "#,(\n)?$#", "\\1", $poll_choices );
|
||||
$poll_multi = preg_replace( "#,(\n)?$#", "\\1", $poll_multi );
|
||||
$poll_votes = preg_replace( "#,(\n)?$#", "\\1", $poll_votes );
|
||||
|
||||
$poll_question = $poll_data['poll_question'];
|
||||
$show_open = 1;
|
||||
$is_mod = 1;
|
||||
$show_open = $poll_data['choices'] ? 1 : 0;
|
||||
$is_mod = $this->can_add_poll_mod;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Print poll box
|
||||
//-----------------------------------------
|
||||
|
||||
$poll_box = $this->ipsclass->compiled_templates['skin_post']->poll_box( $this->max_poll_questions, $this->max_poll_choices_per_question, $poll_questions, $poll_choices, $poll_votes, $show_open, $poll_question, $is_mod );
|
||||
$poll_box = $this->ipsclass->compiled_templates['skin_post']->poll_box( $this->max_poll_questions, $this->max_poll_choices_per_question, $poll_questions, $poll_choices, $poll_votes, $show_open, $poll_question, $is_mod, $poll_multi, $poll_only );
|
||||
}
|
||||
|
||||
$edit_option = "";
|
||||
|
||||
if ($this->ipsclass->member['g_append_edit'])
|
||||
{
|
||||
$checked = "";
|
||||
$checked = "";
|
||||
$show_reason = 0;
|
||||
|
||||
if ($this->orig_post['append_edit'])
|
||||
{
|
||||
$checked = "checked";
|
||||
}
|
||||
|
||||
$edit_option = $this->ipsclass->compiled_templates['skin_post']->add_edit_box($checked);
|
||||
if ( $this->moderator['edit_post'] OR $this->ipsclass->member['g_is_supmod'] )
|
||||
{
|
||||
$show_reason = 1;
|
||||
}
|
||||
|
||||
$edit_option = $this->ipsclass->compiled_templates['skin_post']->add_edit_box( $checked, $show_reason, $this->orig_post['post_edit_reason'] );
|
||||
}
|
||||
|
||||
$this->output = str_replace( "<!--START TABLE-->" , $start_table , $this->output );
|
||||
@@ -712,8 +781,6 @@ class post_functions extends class_post
|
||||
$this->output = str_replace( "<!--FORUM RULES-->" , $this->ipsclass->print_forum_rules($this->forum), $this->output );
|
||||
$this->output = str_replace( "<!--TOPIC TITLE-->" , $topic_title , $this->output );
|
||||
|
||||
$this->output = $this->html_add_smilie_box( $this->output );
|
||||
|
||||
//-----------------------------------------
|
||||
// Add in siggy buttons and such
|
||||
//-----------------------------------------
|
||||
@@ -724,7 +791,7 @@ class post_functions extends class_post
|
||||
|
||||
$this->html_checkboxes('edit', $this->topic['tid'], $this->forum['id']);
|
||||
|
||||
$this->html_topic_summary($this->topic['tid']);
|
||||
$this->html_topic_summary( $this->topic['tid'] );
|
||||
|
||||
$this->show_post_navigation();
|
||||
|
||||
|
||||
@@ -2,28 +2,18 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2005-12-22 15:20:25 +0000 (Thu, 22 Dec 2005) $
|
||||
| > $Revision: 105 $
|
||||
| > $Author: bfarber $
|
||||
| > $Date: 2006-10-11 13:55:47 +0100 (Wed, 11 Oct 2006) $
|
||||
| > $Revision: 624 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Post Sub-Class
|
||||
@@ -33,6 +23,12 @@
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class post_functions extends class_post
|
||||
{
|
||||
var $nav = array();
|
||||
@@ -47,6 +43,8 @@ class post_functions extends class_post
|
||||
var $has_poll = 0;
|
||||
var $poll_questions = array();
|
||||
|
||||
var $orig_post;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Sub class init
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -64,8 +62,8 @@ class post_functions extends class_post
|
||||
// Check permissions
|
||||
//-----------------------------------------
|
||||
|
||||
$this->post_key = $this->ipsclass->input['post_key'] ? $this->ipsclass->input['post_key'] : md5(microtime());
|
||||
|
||||
$this->post_key = ( isset($this->ipsclass->input['attach_post_key']) AND $this->ipsclass->input['attach_post_key'] != "" ) ? $this->ipsclass->input['attach_post_key'] : md5( microtime() );
|
||||
|
||||
$this->check_for_new_topic();
|
||||
}
|
||||
|
||||
@@ -81,30 +79,6 @@ class post_functions extends class_post
|
||||
|
||||
$this->convert_open_close_times();
|
||||
|
||||
//-----------------------------------------
|
||||
// Did we remove an attachment?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->input['removeattachid'] )
|
||||
{
|
||||
if ( $this->ipsclass->input[ 'removeattach_'. $this->ipsclass->input['removeattachid'] ] )
|
||||
{
|
||||
$this->pf_remove_attachment( intval($this->ipsclass->input['removeattachid']), $this->post_key );
|
||||
$this->show_form();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Did we add an attachment?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->input['attachgo'] )
|
||||
{
|
||||
$this->obj['post_errors'] = "";
|
||||
$this->upload_id = $this->process_upload();
|
||||
$this->show_form();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse the post, and check for any errors.
|
||||
//-----------------------------------------
|
||||
@@ -141,15 +115,6 @@ class post_functions extends class_post
|
||||
|
||||
$this->poll_questions = $this->compile_poll();
|
||||
|
||||
//-----------------------------------------
|
||||
// If we don't have any errors yet, parse the upload
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->obj['post_errors'] == "")
|
||||
{
|
||||
$this->upload = $this->process_upload();
|
||||
}
|
||||
|
||||
if ( ($this->obj['post_errors'] != "") or ( $this->obj['preview_post'] != "" ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
@@ -160,6 +125,47 @@ class post_functions extends class_post
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Guest w/ CAPTCHA?
|
||||
//-----------------------------------------
|
||||
|
||||
if( $this->ipsclass->member['id'] == 0 AND $this->ipsclass->vars['guest_captcha'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Security code stuff
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->ipsclass->input['imgid'] == "")
|
||||
{
|
||||
$this->obj['post_errors'] = 'err_reg_code';
|
||||
$this->show_form();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*',
|
||||
'from' => 'reg_antispam',
|
||||
'where' => "regid='".trim($this->ipsclass->txt_alphanumerical_clean($this->ipsclass->input['imgid']))."'"
|
||||
) );
|
||||
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
if ( ! $row = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$this->obj['post_errors'] = 'err_reg_code';
|
||||
$this->show_form();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( trim( $this->ipsclass->txt_alphanumerical_clean($this->ipsclass->input['captcha']) ) != $row['regcode'] )
|
||||
{
|
||||
$this->obj['post_errors'] = 'err_reg_code';
|
||||
$this->show_form();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->do_delete( 'reg_antispam', "regid='".trim($this->ipsclass->txt_alphanumerical_clean($this->ipsclass->input['imgid']))."'" );
|
||||
}
|
||||
|
||||
$this->save_post();
|
||||
}
|
||||
}
|
||||
@@ -179,9 +185,13 @@ class post_functions extends class_post
|
||||
$this->ipsclass->input['TopicTitle'] = $this->parser->bad_words( $this->ipsclass->input['TopicTitle'] );
|
||||
$this->ipsclass->input['TopicDesc'] = $this->parser->bad_words( $this->ipsclass->input['TopicDesc'] );
|
||||
|
||||
$this->ipsclass->input['TopicDesc'] = $this->ipsclass->txt_mbsubstr( $this->ipsclass->input['TopicDesc'], 0, 70 );
|
||||
|
||||
$pinned = 0;
|
||||
$state = 'open';
|
||||
|
||||
$this->ipsclass->input['mod_options'] = isset($this->ipsclass->input['mod_options']) ? $this->ipsclass->input['mod_options'] : '';
|
||||
|
||||
if ( ($this->ipsclass->input['mod_options'] != "") or ($this->ipsclass->input['mod_options'] != 'nowt') )
|
||||
{
|
||||
if ($this->ipsclass->input['mod_options'] == 'pin')
|
||||
@@ -190,7 +200,7 @@ class post_functions extends class_post
|
||||
{
|
||||
$pinned = 1;
|
||||
|
||||
$this->moderate_log('Òåìà áûëà «ïîäíÿòà» ïðè åå ïóáëèêàöèè', $this->ipsclass->input['TopicTitle']);
|
||||
$this->moderate_log('Pinned topic from post form', $this->ipsclass->input['TopicTitle']);
|
||||
}
|
||||
}
|
||||
else if ($this->ipsclass->input['mod_options'] == 'close')
|
||||
@@ -199,7 +209,7 @@ class post_functions extends class_post
|
||||
{
|
||||
$state = 'closed';
|
||||
|
||||
$this->moderate_log('Òåìà áûëà çàêðûòà ïðè åå ïóáëèêàöèè', $this->ipsclass->input['TopicTitle']);
|
||||
$this->moderate_log('Closed topic from post form', $this->ipsclass->input['TopicTitle']);
|
||||
}
|
||||
}
|
||||
else if ($this->ipsclass->input['mod_options'] == 'pinclose')
|
||||
@@ -209,7 +219,7 @@ class post_functions extends class_post
|
||||
$pinned = 1;
|
||||
$state = 'closed';
|
||||
|
||||
$this->moderate_log('Òåìà áûëà «ïîäíÿòà» è çàêðûòà ïðè åå ïóáëèêàöèè', $this->ipsclass->input['TopicTitle']);
|
||||
$this->moderate_log('Pinned & closed topic from post form', $this->ipsclass->input['TopicTitle']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -239,7 +249,7 @@ class post_functions extends class_post
|
||||
'last_poster_id' => $this->ipsclass->member['id'],
|
||||
'last_poster_name' => $this->ipsclass->member['id'] ? $this->ipsclass->member['members_display_name'] : $this->ipsclass->input['UserName'],
|
||||
'last_post' => time(),
|
||||
'icon_id' => $this->ipsclass->input['iconid'],
|
||||
'icon_id' => intval($this->ipsclass->input['iconid']),
|
||||
'author_mode' => $this->ipsclass->member['id'] ? 1 : 0,
|
||||
'poll_state' => ( count( $this->poll_questions ) AND $this->can_add_poll ) ? 1 : 0,
|
||||
'last_vote' => 0,
|
||||
@@ -247,8 +257,8 @@ class post_functions extends class_post
|
||||
'forum_id' => $this->forum['id'],
|
||||
'approved' => ( $this->obj['moderate'] == 1 || $this->obj['moderate'] == 2 ) ? 0 : 1,
|
||||
'pinned' => $pinned,
|
||||
'topic_open_time' => $this->times['open'],
|
||||
'topic_close_time' => $this->times['close'],
|
||||
'topic_open_time' => intval( $this->times['open'] ),
|
||||
'topic_close_time' => intval( $this->times['close'] ),
|
||||
);
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -305,6 +315,13 @@ class post_functions extends class_post
|
||||
|
||||
if ( count( $this->poll_questions ) AND $this->can_add_poll )
|
||||
{
|
||||
$poll_only = 0;
|
||||
|
||||
if( $this->ipsclass->vars['ipb_poll_only'] AND $this->ipsclass->input['poll_only'] == 1 )
|
||||
{
|
||||
$poll_only = 1;
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->do_insert( 'polls',
|
||||
array (
|
||||
'tid' => $this->topic['tid'],
|
||||
@@ -314,6 +331,7 @@ class post_functions extends class_post
|
||||
'starter_id' => $this->ipsclass->member['id'],
|
||||
'votes' => 0,
|
||||
'poll_question' => $this->ipsclass->input['poll_question'],
|
||||
'poll_only' => $poll_only,
|
||||
) );
|
||||
}
|
||||
|
||||
@@ -328,7 +346,7 @@ class post_functions extends class_post
|
||||
// Make attachments "permanent"
|
||||
//-----------------------------------------
|
||||
|
||||
$this->pf_make_attachments_permanent($this->post_key, $this->topic['tid'], $this->post['pid']);
|
||||
$this->pf_make_attachments_permanent( $this->post_key, $this->post['pid'], 'post', array( 'topic_id' => $this->topic['tid'] ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// If we are a member, lets update thier last post
|
||||
@@ -396,18 +414,18 @@ class post_functions extends class_post
|
||||
// Do we have any posting errors?
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->obj['post_errors'])
|
||||
if (isset($this->obj['post_errors']) AND $this->obj['post_errors'])
|
||||
{
|
||||
$this->output .= $this->ipsclass->compiled_templates['skin_post']->errors( $this->ipsclass->lang[ $this->obj['post_errors'] ]);
|
||||
}
|
||||
|
||||
if ( $this->obj['preview_post'] )
|
||||
{
|
||||
$this->output .= $this->ipsclass->compiled_templates['skin_post']->preview( $this->show_post_preview( $this->post['post'] ) );
|
||||
$this->output .= $this->ipsclass->compiled_templates['skin_post']->preview( $this->show_post_preview( $this->post['post'], $this->post_key ) );
|
||||
}
|
||||
|
||||
$this->output .= $this->html_start_form( array( 1 => array( 'CODE' , '01' ),
|
||||
2 => array( 'post_key', $this->post_key ),
|
||||
$this->output .= $this->html_start_form( array( 1 => array( 'CODE' , '01' ),
|
||||
2 => array( 'attach_post_key', $this->post_key ),
|
||||
) );
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -434,6 +452,8 @@ class post_functions extends class_post
|
||||
// POLL BOX
|
||||
//-----------------------------------------
|
||||
|
||||
$poll_box = "";
|
||||
|
||||
if ( $this->can_add_poll )
|
||||
{
|
||||
//-----------------------------------------
|
||||
@@ -442,10 +462,14 @@ class post_functions extends class_post
|
||||
//-----------------------------------------
|
||||
|
||||
$poll_questions = "";
|
||||
$poll_question = "";
|
||||
$poll_votes = "";
|
||||
$poll_choices = "";
|
||||
$show_open = 0;
|
||||
$poll_only = "";
|
||||
$poll_multi = "";
|
||||
|
||||
if ( is_array( $_POST['question'] ) and count( $_POST['question'] ) )
|
||||
if ( isset($_POST['question']) AND is_array( $_POST['question'] ) and count( $_POST['question'] ) )
|
||||
{
|
||||
foreach( $_POST['question'] as $id => $question )
|
||||
{
|
||||
@@ -456,7 +480,15 @@ class post_functions extends class_post
|
||||
$show_open = 1;
|
||||
}
|
||||
|
||||
if ( is_array( $_POST['choice'] ) and count( $_POST['choice'] ) )
|
||||
if ( isset($_POST['multi']) AND is_array( $_POST['multi'] ) and count( $_POST['multi'] ) )
|
||||
{
|
||||
foreach( $_POST['multi'] as $id => $checked )
|
||||
{
|
||||
$poll_multi .= "\t{$id} : '{$checked}',\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset($_POST['choice']) AND is_array( $_POST['choice'] ) and count( $_POST['choice'] ) )
|
||||
{
|
||||
foreach( $_POST['choice'] as $id => $choice )
|
||||
{
|
||||
@@ -464,24 +496,29 @@ class post_functions extends class_post
|
||||
}
|
||||
}
|
||||
|
||||
$poll_only = 0;
|
||||
|
||||
if( $this->ipsclass->vars['ipb_poll_only'] AND isset($this->ipsclass->input['poll_only']) AND $this->ipsclass->input['poll_only'] == 1 )
|
||||
{
|
||||
$poll_only = "checked='checked'";
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Trim off trailing commas (Safari hates it)
|
||||
//-----------------------------------------
|
||||
|
||||
$poll_questions = preg_replace( "#,(\n)?$#", "\\1", $poll_questions );
|
||||
$poll_multi = preg_replace( "#,(\n)?$#", "\\1", $poll_multi );
|
||||
$poll_choices = preg_replace( "#,(\n)?$#", "\\1", $poll_choices );
|
||||
|
||||
$poll_box = $this->ipsclass->compiled_templates['skin_post']->poll_box( $this->max_poll_questions, $this->max_poll_choices_per_question, $poll_questions, $poll_choices, $poll_votes, $show_open, $poll_question );
|
||||
$poll_box = $this->ipsclass->compiled_templates['skin_post']->poll_box( $this->max_poll_questions, $this->max_poll_choices_per_question, $poll_questions, $poll_choices, $poll_votes, $show_open, $poll_question, 0, $poll_multi, $poll_only );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// UPLOAD BOX
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->can_upload )
|
||||
{
|
||||
$upload_field = $this->html_build_uploads( $this->post_key, 'new' );
|
||||
}
|
||||
$upload_field = $this->can_upload ? $this->html_build_uploads( $this->post_key, 'new' ) : '';
|
||||
|
||||
$this->output = str_replace( "<!--START TABLE-->" , $start_table , $this->output );
|
||||
$this->output = str_replace( "<!--NAME FIELDS-->" , $name_fields , $this->output );
|
||||
@@ -494,8 +531,6 @@ class post_functions extends class_post
|
||||
$this->output = str_replace( "<!--TOPIC TITLE-->" , $topic_title , $this->output );
|
||||
$this->output = str_replace( "<!--FORUM RULES-->" , $this->ipsclass->print_forum_rules($this->forum), $this->output );
|
||||
|
||||
$this->output = $this->html_add_smilie_box( $this->output );
|
||||
|
||||
//-----------------------------------------
|
||||
// Add in siggy buttons and such
|
||||
//-----------------------------------------
|
||||
@@ -506,6 +541,12 @@ class post_functions extends class_post
|
||||
|
||||
$this->show_post_navigation();
|
||||
|
||||
//-----------------------------------------
|
||||
// Reset multi-quote cookie
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->my_setcookie('mqtids', ',', 0);
|
||||
|
||||
$this->ipsclass->print->add_output( $this->output );
|
||||
$this->ipsclass->print->do_output( array( 'TITLE' => $this->ipsclass->vars['board_name']." -> ".$this->title,
|
||||
'JS' => 1,
|
||||
|
||||
@@ -2,28 +2,18 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-01-11 22:47:48 +0000 (Wed, 11 Jan 2006) $
|
||||
| > $Revision: 122 $
|
||||
| > $Author: bfarber $
|
||||
| > $Date: 2006-10-11 13:55:47 +0100 (Wed, 11 Oct 2006) $
|
||||
| > $Revision: 624 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Post Sub-Class
|
||||
@@ -33,6 +23,12 @@
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class post_functions extends class_post
|
||||
{
|
||||
var $nav = array();
|
||||
@@ -62,15 +58,22 @@ class post_functions extends class_post
|
||||
// Set up post key
|
||||
//-----------------------------------------
|
||||
|
||||
$this->post_key = $this->ipsclass->input['post_key'] ? $this->ipsclass->input['post_key'] : md5( microtime() );
|
||||
|
||||
$this->post_key = ( isset($this->ipsclass->input['attach_post_key']) AND $this->ipsclass->input['attach_post_key'] != "" ) ? $this->ipsclass->input['attach_post_key'] : md5( microtime() );
|
||||
|
||||
//-----------------------------------------
|
||||
// Lets load the topic from the database
|
||||
// before we do anything else.
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'topics', 'where' => "forum_id=".intval($this->forum['id'])." AND tid=".intval($this->ipsclass->input['t']) ) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 't.*, p.poll_only',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => "t.forum_id=".intval($this->forum['id'])." AND t.tid=".intval($this->ipsclass->input['t']),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'from' => array( 'polls' => 'p' ),
|
||||
'where' => 'p.tid=t.tid'
|
||||
) )
|
||||
) );
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
$this->topic = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
@@ -131,30 +134,6 @@ class post_functions extends class_post
|
||||
|
||||
$this->convert_open_close_times();
|
||||
|
||||
//-----------------------------------------
|
||||
// Did we remove an attachment?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->input['removeattachid'] )
|
||||
{
|
||||
if ( $this->ipsclass->input[ 'removeattach_'. $this->ipsclass->input['removeattachid'] ] )
|
||||
{
|
||||
$this->pf_remove_attachment( intval($this->ipsclass->input['removeattachid']), $this->post_key );
|
||||
$this->show_form();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Did we add an attachment?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->input['attachgo'] )
|
||||
{
|
||||
$this->obj['post_errors'] = "";
|
||||
$this->upload_id = $this->process_upload();
|
||||
$this->show_form();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse the post, and check for any errors.
|
||||
//-----------------------------------------
|
||||
@@ -167,22 +146,65 @@ class post_functions extends class_post
|
||||
|
||||
$this->poll_questions = $this->compile_poll();
|
||||
|
||||
if ($this->obj['post_errors'] == "")
|
||||
{
|
||||
$this->upload = $this->process_upload();
|
||||
}
|
||||
|
||||
if ( ($this->obj['post_errors'] != "") or ($this->obj['preview_post'] != "") )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Show the form again
|
||||
//-----------------------------------------
|
||||
|
||||
$this->show_form($class);
|
||||
$this->show_form();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->save_post($class);
|
||||
//-----------------------------------------
|
||||
// Guest w/ CAPTCHA?
|
||||
//-----------------------------------------
|
||||
|
||||
if( $this->ipsclass->member['id'] == 0 AND $this->ipsclass->vars['guest_captcha'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Security code stuff
|
||||
//-----------------------------------------
|
||||
|
||||
if( isset($this->ipsclass->input['fast_reply_used']) AND $this->ipsclass->input['fast_reply_used'] == 1 )
|
||||
{
|
||||
$this->obj['post_errors'] = 'reg_code_enter';
|
||||
$this->show_form();
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->ipsclass->input['imgid'] == "")
|
||||
{
|
||||
$this->obj['post_errors'] = 'err_reg_code';
|
||||
$this->show_form();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*',
|
||||
'from' => 'reg_antispam',
|
||||
'where' => "regid='".trim($this->ipsclass->txt_alphanumerical_clean($this->ipsclass->input['imgid']))."'"
|
||||
) );
|
||||
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
if ( ! $row = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$this->obj['post_errors'] = 'err_reg_code';
|
||||
$this->show_form();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( trim( $this->ipsclass->txt_alphanumerical_clean($this->ipsclass->input['captcha']) ) != $row['regcode'] )
|
||||
{
|
||||
$this->obj['post_errors'] = 'err_reg_code';
|
||||
$this->show_form();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->do_delete( 'reg_antispam', "regid='".trim($this->ipsclass->txt_alphanumerical_clean($this->ipsclass->input['imgid']))."'" );
|
||||
}
|
||||
|
||||
$this->save_post();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,6 +234,8 @@ class post_functions extends class_post
|
||||
|
||||
$return_to_move = 0;
|
||||
|
||||
$this->ipsclass->input['mod_options'] = isset($this->ipsclass->input['mod_options']) ? $this->ipsclass->input['mod_options'] : '';
|
||||
|
||||
if ( ($this->ipsclass->input['mod_options'] != "") or ($this->ipsclass->input['mod_options'] != 'nowt') )
|
||||
{
|
||||
if ($this->ipsclass->input['mod_options'] == 'pin')
|
||||
@@ -304,6 +328,20 @@ class post_functions extends class_post
|
||||
{
|
||||
$new_post = $last_post['post'].'<br /><br />'.$this->post['post'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Make sure we don't have too many images
|
||||
//-----------------------------------------
|
||||
|
||||
$new_post = $this->parser->pre_edit_parse( $new_post );
|
||||
$new_post = $this->parser->pre_db_parse( $new_post );
|
||||
|
||||
if( $this->parser->error )
|
||||
{
|
||||
$this->obj['post_errors'] = 'merge_'.$this->parser->error;
|
||||
$this->show_form($class);
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update post row
|
||||
//-----------------------------------------
|
||||
@@ -332,7 +370,7 @@ class post_functions extends class_post
|
||||
//-----------------------------------------
|
||||
|
||||
$this->post['post_key'] = $this->post_key;
|
||||
$this->post['post_parent'] = intval($this->ipsclass->input['parent_id']);
|
||||
$this->post['post_parent'] = isset($this->ipsclass->input['parent_id']) ? intval($this->ipsclass->input['parent_id']) : 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Typecast
|
||||
@@ -413,6 +451,13 @@ class post_functions extends class_post
|
||||
|
||||
if ( count( $this->poll_questions ) AND $this->can_add_poll )
|
||||
{
|
||||
$poll_only = 0;
|
||||
|
||||
if( $this->ipsclass->vars['ipb_poll_only'] AND $this->ipsclass->input['poll_only'] == 1 )
|
||||
{
|
||||
$poll_only = 1;
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->do_insert( 'polls',
|
||||
array (
|
||||
'tid' => $this->topic['tid'],
|
||||
@@ -422,6 +467,7 @@ class post_functions extends class_post
|
||||
'starter_id' => $this->ipsclass->member['id'],
|
||||
'votes' => 0,
|
||||
'poll_question' => $this->ipsclass->input['poll_question'],
|
||||
'poll_only' => $poll_only,
|
||||
) );
|
||||
}
|
||||
|
||||
@@ -438,8 +484,8 @@ class post_functions extends class_post
|
||||
//-----------------------------------------
|
||||
// Make attachments "permanent"
|
||||
//-----------------------------------------
|
||||
|
||||
$this->pf_make_attachments_permanent($this->post_key, $this->topic['tid'], $this->post['pid']);
|
||||
|
||||
$this->pf_make_attachments_permanent( $this->post_key, $this->post['pid'], 'post', array( 'topic_id' => $this->topic['tid'] ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// MAKE SURE ATTACHMENTS FOR MERGED POSTS
|
||||
@@ -452,7 +498,7 @@ class post_functions extends class_post
|
||||
// Update attachments
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->do_update( 'attachments', array( 'attach_post_key' => $this->post['post_key'] ), 'attach_pid='.$this->post['pid'] );
|
||||
$this->ipsclass->DB->do_update( 'attachments', array( 'attach_post_key' => $this->post['post_key'] ), "attach_rel_module='post' AND attach_rel_id=".$this->post['pid'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -536,20 +582,20 @@ class post_functions extends class_post
|
||||
// Do we have any posting errors?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->obj['post_errors'] )
|
||||
if ( isset($this->obj['post_errors']) AND $this->obj['post_errors'] )
|
||||
{
|
||||
$this->output .= $this->ipsclass->compiled_templates['skin_post']->errors( $this->ipsclass->lang[ $this->obj['post_errors'] ]);
|
||||
}
|
||||
|
||||
if ( $this->obj['preview_post'] )
|
||||
if ( isset($this->obj['preview_post']) AND $this->obj['preview_post'] )
|
||||
{
|
||||
$this->output .= $this->ipsclass->compiled_templates['skin_post']->preview( $this->show_post_preview( $this->post['post'] ) );
|
||||
$this->output .= $this->ipsclass->compiled_templates['skin_post']->preview( $this->show_post_preview( $this->post['post'], $this->post_key ) );
|
||||
}
|
||||
|
||||
$this->output .= $this->html_start_form( array( 1 => array( 'CODE' , '03' ),
|
||||
2 => array( 't' , $this->topic['tid'] ),
|
||||
3 => array( 'post_key' , $this->post_key ),
|
||||
4 => array( 'parent_id', $this->ipsclass->input['parent_id'] ),
|
||||
$this->output .= $this->html_start_form( array( 1 => array( 'CODE' , '03' ),
|
||||
2 => array( 't' , $this->topic['tid'] ),
|
||||
3 => array( 'attach_post_key' , $this->post_key ),
|
||||
4 => array( 'parent_id' , isset($this->ipsclass->input['parent_id']) ? intval($this->ipsclass->input['parent_id']) : 0 ),
|
||||
) );
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -574,6 +620,9 @@ class post_functions extends class_post
|
||||
// Still here?
|
||||
//-----------------------------------------
|
||||
|
||||
$poll_box = "";
|
||||
$upload_field = "";
|
||||
|
||||
if ( $this->can_add_poll )
|
||||
{
|
||||
//-----------------------------------------
|
||||
@@ -582,10 +631,14 @@ class post_functions extends class_post
|
||||
//-----------------------------------------
|
||||
|
||||
$poll_questions = "";
|
||||
$poll_question = "";
|
||||
$poll_choices = "";
|
||||
$show_open = 0;
|
||||
$poll_votes = "";
|
||||
$poll_only = "";
|
||||
$poll_multi = "";
|
||||
|
||||
if ( is_array( $_POST['question'] ) and count( $_POST['question'] ) )
|
||||
if ( isset($_POST['question']) AND is_array( $_POST['question'] ) and count( $_POST['question'] ) )
|
||||
{
|
||||
foreach( $_POST['question'] as $id => $question )
|
||||
{
|
||||
@@ -596,7 +649,15 @@ class post_functions extends class_post
|
||||
$show_open = 1;
|
||||
}
|
||||
|
||||
if ( is_array( $_POST['choice'] ) and count( $_POST['choice'] ) )
|
||||
if ( isset($_POST['multi']) AND is_array( $_POST['multi'] ) and count( $_POST['multi'] ) )
|
||||
{
|
||||
foreach( $_POST['multi'] as $id => $checked )
|
||||
{
|
||||
$poll_multi .= "\t{$id} : '{$checked}',\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset($_POST['choice']) AND is_array( $_POST['choice'] ) and count( $_POST['choice'] ) )
|
||||
{
|
||||
foreach( $_POST['choice'] as $id => $choice )
|
||||
{
|
||||
@@ -604,19 +665,27 @@ class post_functions extends class_post
|
||||
}
|
||||
}
|
||||
|
||||
$poll_only = 0;
|
||||
|
||||
if( $this->ipsclass->vars['ipb_poll_only'] AND isset($this->ipsclass->input['poll_only']) AND $this->ipsclass->input['poll_only'] == 1 )
|
||||
{
|
||||
$poll_only = "checked='checked'";
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Trim off trailing commas (Safari hates it)
|
||||
//-----------------------------------------
|
||||
|
||||
$poll_questions = preg_replace( "#,(\n)?$#", "\\1", $poll_questions );
|
||||
$poll_choices = preg_replace( "#,(\n)?$#", "\\1", $poll_choices );
|
||||
$poll_multi = preg_replace( "#,(\n)?$#", "\\1", $poll_multi );
|
||||
|
||||
$poll_box = $this->ipsclass->compiled_templates['skin_post']->poll_box( $this->max_poll_questions, $this->max_poll_choices_per_question, $poll_questions, $poll_choices, $poll_votes, $show_open, $poll_question );
|
||||
$poll_box = $this->ipsclass->compiled_templates['skin_post']->poll_box( $this->max_poll_questions, $this->max_poll_choices_per_question, $poll_questions, $poll_choices, $poll_votes, $show_open, $poll_question, 0, $poll_multi, $poll_only );
|
||||
}
|
||||
|
||||
if ( $this->can_upload )
|
||||
{
|
||||
$upload_field = $this->html_build_uploads($this->post_key,'reply');
|
||||
$upload_field = $this->html_build_uploads( $this->post_key,'reply' );
|
||||
}
|
||||
|
||||
$this->output = str_replace( "<!--START TABLE-->" , $start_table , $this->output );
|
||||
@@ -629,8 +698,6 @@ class post_functions extends class_post
|
||||
$this->output = str_replace( "<!--END TABLE-->" , $end_form , $this->output );
|
||||
$this->output = str_replace( "<!--FORUM RULES-->" , $this->ipsclass->print_forum_rules($this->forum), $this->output );
|
||||
|
||||
$this->output = $this->html_add_smilie_box( $this->output );
|
||||
|
||||
//-----------------------------------------
|
||||
// Add in siggy buttons and such
|
||||
//-----------------------------------------
|
||||
@@ -643,6 +710,12 @@ class post_functions extends class_post
|
||||
|
||||
$this->title = $this->ipsclass->lang['replying_in'].' '.$this->topic['title'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Reset multi-quote cookie
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->my_setcookie('mqtids', ',', 0);
|
||||
|
||||
$this->ipsclass->print->add_output( $this->output );
|
||||
|
||||
$this->ipsclass->print->do_output( array( 'TITLE' => $this->ipsclass->vars['board_name']." -> ".$this->title,
|
||||
|
||||
@@ -1,15 +1 @@
|
||||
<html>
|
||||
<head><title>Ошибка < Русская версия Invision Power Board</title></head>
|
||||
<body>
|
||||
<h1>Ошибка < Русская версия Invision Power Board</h1>
|
||||
<hr>
|
||||
Вы попали на несуществующую страницу!<br>Пожалуйста нажмите на кнопочку «<b>Назад</b>»
|
||||
в вашем браузере для возвращения на предыдущую страницу.
|
||||
<hr>
|
||||
<b>Invision Power Board:</b>
|
||||
<ul>
|
||||
<li><a href="http://www.bestwarez.ru" title="BestWarez.Ru - Только лучший Варез!">Русская версия</a></li>
|
||||
<li><a href="http://www.invisionboard.com" title="Official Site">English version</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
<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://www.invisionboard.com/">Invision Power Board</a>␍</body>␍</html>␍
|
||||
Reference in new issue
Block a user