Version 2.3.6
This commit is contained in:
1 parent
a3bb603c96
commit
19b38c7c74
764 files changed
+143731
-118164
No files matched your search
@@ -26,8 +26,8 @@
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Íåêîððåêòíûé àäðåñ</h1>Âû íå èìååòå äîñòóïà ê ýòîìó ôàéëó íàïðÿìóþ. Åñëè âû íåäàâíî îáíîâëÿëè ôîðóì, âû äîëæíû îáíîâèòü âñå ñîîòâåòñòâóþùèå ôàéëû.";
|
||||
exit();
|
||||
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
|
||||
@@ -96,8 +96,8 @@ class plugin_post
|
||||
{
|
||||
if( $attach['attach_member_id'] != $this->ipsclass->member['id'] )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -116,7 +116,7 @@ class plugin_post
|
||||
// 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;
|
||||
@@ -187,10 +187,10 @@ class plugin_post
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$rows = array();
|
||||
$rows = array();
|
||||
$query_bits = array();
|
||||
$query = '';
|
||||
$match = 0;
|
||||
$query = '';
|
||||
$match = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
@@ -203,6 +203,9 @@ class plugin_post
|
||||
|
||||
if ( is_array( $rel_ids ) and count( $rel_ids ) )
|
||||
{
|
||||
// We need to reset the array - this query bit will return everything we need, but
|
||||
// if we "OR" join the above query bit with this one, it causes bigger mysql loads
|
||||
$query_bits = array();
|
||||
$query_bits[] = "attach_rel_id IN (" . implode( ",", $rel_ids ) . ")";
|
||||
//$query = " OR attach_rel_id IN (-1," . implode( ",", $rel_ids ) . ")";
|
||||
$match = 1;
|
||||
@@ -524,7 +527,7 @@ class plugin_post
|
||||
// to upload to another's post...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->ipsclass->member['g_is_supmod'] )
|
||||
if ( ! $this->ipsclass->member['g_is_supmod'] AND !$this->ipsclass->member['is_mod'] )
|
||||
{
|
||||
$post = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
'from' => 'posts',
|
||||
@@ -562,48 +565,73 @@ class plugin_post
|
||||
// Generate space allowed figure
|
||||
//-----------------------------------------
|
||||
|
||||
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."'" ) );
|
||||
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'] );
|
||||
}
|
||||
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'] );
|
||||
}
|
||||
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 . " AND attach_rel_module IN( 'post', 'msg' )" ) );
|
||||
|
||||
$space_used = intval( $_space_used['figure'] );
|
||||
$space_used = intval( $_space_used['figure'] );
|
||||
}
|
||||
|
||||
if ( $this->ipsclass->member['g_attach_max'] > 0 )
|
||||
{
|
||||
if ( $this->ipsclass->member['g_attach_per_post'] )
|
||||
{
|
||||
$space_allowed = intval( ( $this->ipsclass->member['g_attach_per_post'] * 1024 ) - $space_used );
|
||||
$space_allowed = $space_allowed < 0 ? 0 : $space_allowed;
|
||||
$_g_space_used = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'SUM(attach_filesize) as figure',
|
||||
'from' => 'attachments',
|
||||
'where' => 'attach_member_id='.$member_id . " AND attach_rel_module IN( 'post', 'msg' )" ) );
|
||||
|
||||
$g_space_used = intval( $_g_space_used['figure'] );
|
||||
|
||||
if( intval( ( $this->ipsclass->member['g_attach_max'] * 1024 ) - $g_space_used ) < 0 )
|
||||
{
|
||||
$space_used = $g_space_used;
|
||||
$total_space_allowed = $this->ipsclass->member['g_attach_max'] * 1024;
|
||||
|
||||
$space_allowed = intval( ( $this->ipsclass->member['g_attach_max'] * 1024 ) - $space_used );
|
||||
$space_allowed = $space_allowed < 0 ? -1 : $space_allowed;
|
||||
}
|
||||
else
|
||||
{
|
||||
$space_allowed = intval( ( $this->ipsclass->member['g_attach_per_post'] * 1024 ) - $space_used );
|
||||
$space_allowed = $space_allowed < 0 ? -1 : $space_allowed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$space_allowed = intval( ( $this->ipsclass->member['g_attach_max'] * 1024 ) - $space_used );
|
||||
$space_allowed = $space_allowed < 0 ? 0 : $space_allowed;
|
||||
$space_allowed = $space_allowed < 0 ? -1 : $space_allowed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# Unlimited
|
||||
$space_allowed = 0;
|
||||
if ( $this->ipsclass->member['g_attach_per_post'] )
|
||||
{
|
||||
$space_allowed = intval( ( $this->ipsclass->member['g_attach_per_post'] * 1024 ) - $space_used );
|
||||
$space_allowed = $space_allowed < 0 ? -1 : $space_allowed;
|
||||
}
|
||||
else
|
||||
{
|
||||
# Unlimited
|
||||
$space_allowed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -611,7 +639,7 @@ class plugin_post
|
||||
//-----------------------------------------
|
||||
|
||||
$space_left = $space_allowed ? $space_allowed : 0;
|
||||
$space_left = ($space_left < 0) ? 0 : $space_left;
|
||||
$space_left = ($space_left < 0) ? -1 : $space_left;
|
||||
|
||||
//-----------------------------------------
|
||||
// Generate max upload size
|
||||
@@ -631,7 +659,7 @@ class plugin_post
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user