Version 3.3.4
This commit is contained in:
1 parent
78706903a2
commit
fb6b5baabc
2206 files changed
+409828
-382984
No files matched your search
@@ -3,11 +3,11 @@
|
||||
* @file defaultSection.php Define the default section for the 'profile' module
|
||||
*~TERABYTE_DOC_READY~
|
||||
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
|
||||
* $License: This is NULLED!
|
||||
* $License: http://www.invisionpower.com/company/standards.php#license$
|
||||
* $Author: ips_terabyte $
|
||||
* @since 20th February 2002
|
||||
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
|
||||
* @version v3.2.3
|
||||
* @version v3.3.4
|
||||
* $Revision: 8655 $
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,108 +1,114 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.2.3
|
||||
* Profile View
|
||||
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://hatynka.in
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 8644 $
|
||||
*
|
||||
*/
|
||||
|
||||
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 public_members_profile_dname extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @param object Registry reference
|
||||
* @return @e void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$info = array();
|
||||
$id = intval( $this->request['id'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get HTML and skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Can we access?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->memberData['g_mem_info'] )
|
||||
{
|
||||
$this->registry->output->showError( 'dname_profiles_off', 10233.22, null, null, 403 );
|
||||
}
|
||||
|
||||
if ( ! $this->settings['auth_allow_dnames'] )
|
||||
{
|
||||
$this->registry->output->showError( 'dnames_off', 10234, null, null, 403 );
|
||||
}
|
||||
|
||||
if( !$id )
|
||||
{
|
||||
$this->registry->output->showError( 'dnames_no_id', 10235, null, null, 404 );
|
||||
}
|
||||
|
||||
$member = IPSMember::load( $id );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get Dname history
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => 'd.*',
|
||||
'from' => array( 'dnames_change' => 'd' ),
|
||||
'where' => 'dname_member_id='.$id,
|
||||
'add_join' => array( 0 => array( 'select' => 'm.members_display_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=d.dname_member_id',
|
||||
'type' => 'inner' ) ),
|
||||
'order' => 'dname_date DESC'
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
$records[] = $row;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Print the pop-up window
|
||||
//-----------------------------------------
|
||||
|
||||
$html = $this->registry->getClass('output')->getTemplate('profile')->dnameWrapper( $member['members_display_name'], $records );
|
||||
|
||||
//-----------------------------------------
|
||||
// Push to print handler
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('output')->setTitle( $this->lang->words['dname_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
|
||||
$this->registry->getClass('output')->addNavigation( $this->lang->words['dname_title'], '' );
|
||||
$this->registry->getClass('output')->addContent( $html );
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* Profile View
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 10914 $
|
||||
*
|
||||
*/
|
||||
|
||||
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 public_members_profile_dname extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @param object Registry reference
|
||||
* @return @e void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$info = array();
|
||||
$id = intval( $this->request['id'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get HTML and skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Can we access?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->memberData['g_mem_info'] )
|
||||
{
|
||||
$this->registry->output->showError( 'dname_profiles_off', 10233.22, null, null, 403 );
|
||||
}
|
||||
|
||||
if ( ! $this->settings['auth_allow_dnames'] )
|
||||
{
|
||||
$this->registry->output->showError( 'dnames_off', 10234, null, null, 403 );
|
||||
}
|
||||
|
||||
if( !$id )
|
||||
{
|
||||
$this->registry->output->showError( 'dnames_no_id', 10235, null, null, 404 );
|
||||
}
|
||||
|
||||
$member = IPSMember::load( $id );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get Dname history
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => 'd.*',
|
||||
'from' => array( 'dnames_change' => 'd' ),
|
||||
'where' => 'dname_member_id='.$id,
|
||||
'add_join' => array( 0 => array( 'select' => 'm.members_display_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=d.dname_member_id',
|
||||
'type' => 'inner' ) ),
|
||||
'order' => 'dname_date DESC'
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
$records[] = $row;
|
||||
}
|
||||
|
||||
/* Stop Google indexing soft 404s */
|
||||
if ( ! count( $records ) && ! $this->memberData['member_id'] )
|
||||
{
|
||||
$this->registry->output->showError( '404_soft', 10235.1, null, null, 404 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Print the pop-up window
|
||||
//-----------------------------------------
|
||||
|
||||
$html = $this->registry->getClass('output')->getTemplate('profile')->dnameWrapper( $member['members_display_name'], $records );
|
||||
|
||||
//-----------------------------------------
|
||||
// Push to print handler
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('output')->setTitle( $this->lang->words['dname_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
|
||||
$this->registry->getClass('output')->addNavigation( $this->lang->words['dname_title'], '' );
|
||||
$this->registry->getClass('output')->addContent( $html );
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,246 +1,246 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.2.3
|
||||
* Ignore a user
|
||||
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://hatynka.in
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 8644 $
|
||||
*
|
||||
*/
|
||||
|
||||
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 public_members_profile_ignore extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @param object Registry reference
|
||||
* @return @e void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
default:
|
||||
case 'add':
|
||||
$result = $this->ignoreMember( $this->request['memberID'], 'topics' );
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
$result = $this->stopIgnoringMember( $this->request['memberID'], 'topics' );
|
||||
break;
|
||||
|
||||
case 'addPM':
|
||||
$result = $this->ignoreMember( $this->request['memberID'], 'messages' );
|
||||
break;
|
||||
|
||||
case 'removePM':
|
||||
$result = $this->stopIgnoringMember( $this->request['memberID'], 'messages' );
|
||||
break;
|
||||
}
|
||||
|
||||
if( $result['error'] )
|
||||
{
|
||||
$this->registry->output->showError( $result['error'], 10266 );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->output->redirectScreen( $result['message'], $this->settings['base_url'] . 'showuser=' . $this->request['memberID'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ignore a member's topics
|
||||
*
|
||||
* @param integer Member ID to ignore
|
||||
* @param string Column to update
|
||||
* @return array Array of info
|
||||
*/
|
||||
public function ignoreMember( $ignoreId, $type='topics' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$this->lang->loadLanguageFile( array( 'public_usercp' ), 'core' );
|
||||
|
||||
$ignoreId = intval( $ignoreId );
|
||||
$md5check = IPSText::md5Clean( $this->request['md5check'] );
|
||||
$antiType = $type == 'topics' ? 'messages' : 'topics';
|
||||
|
||||
//-----------------------------------------
|
||||
// MD5 check
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$ignoreId )
|
||||
{
|
||||
return array( 'error' => $this->lang->words['ignoreuser_noid'] );
|
||||
}
|
||||
|
||||
if ( $md5check != $this->member->form_hash )
|
||||
{
|
||||
return array( 'error' => $this->lang->words['securehash_not_secure'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Load member
|
||||
//-----------------------------------------
|
||||
|
||||
$member = IPSMember::load( $ignoreId, 'core' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $member['member_id'] )
|
||||
{
|
||||
return array( 'error' => $this->lang->words['ignoreuser_noid'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Can we ignore them?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $member['_canBeIgnored'] !== TRUE )
|
||||
{
|
||||
return array( 0 => $this->lang->words['ignoreuser_cannot'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Already ignoring?
|
||||
//-----------------------------------------
|
||||
|
||||
$ignoreMe = $this->DB->buildAndFetch( array(
|
||||
'select' => '*',
|
||||
'from' => 'ignored_users',
|
||||
'where' => 'ignore_owner_id=' . $this->memberData['member_id'] . ' AND ignore_ignore_id=' . $member['member_id']
|
||||
) );
|
||||
|
||||
if ( $ignoreMe['ignore_id'] )
|
||||
{
|
||||
if( $ignoreMe['ignore_' . $type ] )
|
||||
{
|
||||
return array( 'error' => $this->lang->words['ignoreuser_already'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DB->update( 'ignored_users', array( 'ignore_' . $type => 1 ), 'ignore_id=' . $ignoreMe['ignore_id'] );
|
||||
|
||||
return array( 'message' => $this->lang->words['ignoreuser_success'] );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add it
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->insert( 'ignored_users', array(
|
||||
'ignore_owner_id' => $this->memberData['member_id'],
|
||||
'ignore_ignore_id' => $member['member_id'],
|
||||
'ignore_' . $antiType => 0,
|
||||
'ignore_' . $type => 1,
|
||||
)
|
||||
);
|
||||
|
||||
/* Rebuild cache */
|
||||
IPSMember::rebuildIgnoredUsersCache( $this->memberData );
|
||||
|
||||
return array( 'message' => $this->lang->words['ignoreuser_success'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop ignoring the user's topics
|
||||
*
|
||||
* @param integer Member ID to stop ignoring
|
||||
* @param string Column to update
|
||||
* @return array Array of info
|
||||
*/
|
||||
public function stopIgnoringMember( $ignoreId, $type='topics' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$this->lang->loadLanguageFile( array( 'public_usercp' ), 'core' );
|
||||
|
||||
$ignoreId = intval( $ignoreId );
|
||||
$md5check = IPSText::md5Clean( $this->request['md5check'] );
|
||||
$antiType = $type == 'topics' ? 'messages' : 'topics';
|
||||
|
||||
//-----------------------------------------
|
||||
// MD5 check
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$ignoreId )
|
||||
{
|
||||
return array( 'error' => $this->lang->words['noignoreuser_noid'] );
|
||||
}
|
||||
|
||||
if ( $md5check != $this->member->form_hash )
|
||||
{
|
||||
return array( 'error' => $this->lang->words['securehash_not_secure'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Load member
|
||||
//-----------------------------------------
|
||||
|
||||
$member = IPSMember::load( $ignoreId, 'core' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $member['member_id'] )
|
||||
{
|
||||
return array( 'error' => $this->lang->words['noignoreuser_noid'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Already ignoring?
|
||||
//-----------------------------------------
|
||||
|
||||
$ignoreMe = $this->DB->buildAndFetch( array(
|
||||
'select' => '*',
|
||||
'from' => 'ignored_users',
|
||||
'where' => 'ignore_owner_id=' . $this->memberData['member_id'] . ' AND ignore_ignore_id=' . $member['member_id']
|
||||
) );
|
||||
|
||||
if ( $ignoreMe['ignore_id'] )
|
||||
{
|
||||
if( !$ignoreMe['ignore_' . $antiType ] )
|
||||
{
|
||||
$this->DB->delete( 'ignored_users', 'ignore_id=' . $ignoreMe['ignore_id'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DB->update( 'ignored_users', array( 'ignore_' . $type => 0 ), 'ignore_id=' . $ignoreMe['ignore_id'] );
|
||||
}
|
||||
|
||||
/* Rebuild cache */
|
||||
IPSMember::rebuildIgnoredUsersCache( $this->memberData );
|
||||
|
||||
return array( 'message' => $this->lang->words['noignoreuser_success'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
return array( 'error' => $this->lang->words['noignoreuser_noid'] );
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* Ignore a user
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 10914 $
|
||||
*
|
||||
*/
|
||||
|
||||
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 public_members_profile_ignore extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @param object Registry reference
|
||||
* @return @e void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
default:
|
||||
case 'add':
|
||||
$result = $this->ignoreMember( $this->request['memberID'], 'topics' );
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
$result = $this->stopIgnoringMember( $this->request['memberID'], 'topics' );
|
||||
break;
|
||||
|
||||
case 'addPM':
|
||||
$result = $this->ignoreMember( $this->request['memberID'], 'messages' );
|
||||
break;
|
||||
|
||||
case 'removePM':
|
||||
$result = $this->stopIgnoringMember( $this->request['memberID'], 'messages' );
|
||||
break;
|
||||
}
|
||||
|
||||
if( $result['error'] )
|
||||
{
|
||||
$this->registry->output->showError( $result['error'], 10266 );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->output->redirectScreen( $result['message'], $this->settings['base_url'] . 'showuser=' . $this->request['memberID'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ignore a member's topics
|
||||
*
|
||||
* @param integer Member ID to ignore
|
||||
* @param string Column to update
|
||||
* @return array Array of info
|
||||
*/
|
||||
public function ignoreMember( $ignoreId, $type='topics' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$this->lang->loadLanguageFile( array( 'public_usercp' ), 'core' );
|
||||
|
||||
$ignoreId = intval( $ignoreId );
|
||||
$md5check = IPSText::md5Clean( $this->request['md5check'] );
|
||||
$antiType = $type == 'topics' ? 'messages' : 'topics';
|
||||
|
||||
//-----------------------------------------
|
||||
// MD5 check
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$ignoreId )
|
||||
{
|
||||
return array( 'error' => $this->lang->words['ignoreuser_noid'] );
|
||||
}
|
||||
|
||||
if ( $md5check != $this->member->form_hash )
|
||||
{
|
||||
return array( 'error' => $this->lang->words['securehash_not_secure'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Load member
|
||||
//-----------------------------------------
|
||||
|
||||
$member = IPSMember::load( $ignoreId, 'core' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $member['member_id'] )
|
||||
{
|
||||
return array( 'error' => $this->lang->words['ignoreuser_noid'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Can we ignore them?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $member['_canBeIgnored'] !== TRUE )
|
||||
{
|
||||
return array( 0 => $this->lang->words['ignoreuser_cannot'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Already ignoring?
|
||||
//-----------------------------------------
|
||||
|
||||
$ignoreMe = $this->DB->buildAndFetch( array(
|
||||
'select' => '*',
|
||||
'from' => 'ignored_users',
|
||||
'where' => 'ignore_owner_id=' . $this->memberData['member_id'] . ' AND ignore_ignore_id=' . $member['member_id']
|
||||
) );
|
||||
|
||||
if ( $ignoreMe['ignore_id'] )
|
||||
{
|
||||
if( $ignoreMe['ignore_' . $type ] )
|
||||
{
|
||||
return array( 'error' => $this->lang->words['ignoreuser_already'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DB->update( 'ignored_users', array( 'ignore_' . $type => 1 ), 'ignore_id=' . $ignoreMe['ignore_id'] );
|
||||
|
||||
return array( 'message' => $this->lang->words['ignoreuser_success'] );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add it
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->insert( 'ignored_users', array(
|
||||
'ignore_owner_id' => $this->memberData['member_id'],
|
||||
'ignore_ignore_id' => $member['member_id'],
|
||||
'ignore_' . $antiType => 0,
|
||||
'ignore_' . $type => 1,
|
||||
)
|
||||
);
|
||||
|
||||
/* Rebuild cache */
|
||||
IPSMember::rebuildIgnoredUsersCache( $this->memberData );
|
||||
|
||||
return array( 'message' => $this->lang->words['ignoreuser_success'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop ignoring the user's topics
|
||||
*
|
||||
* @param integer Member ID to stop ignoring
|
||||
* @param string Column to update
|
||||
* @return array Array of info
|
||||
*/
|
||||
public function stopIgnoringMember( $ignoreId, $type='topics' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$this->lang->loadLanguageFile( array( 'public_usercp' ), 'core' );
|
||||
|
||||
$ignoreId = intval( $ignoreId );
|
||||
$md5check = IPSText::md5Clean( $this->request['md5check'] );
|
||||
$antiType = $type == 'topics' ? 'messages' : 'topics';
|
||||
|
||||
//-----------------------------------------
|
||||
// MD5 check
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$ignoreId )
|
||||
{
|
||||
return array( 'error' => $this->lang->words['noignoreuser_noid'] );
|
||||
}
|
||||
|
||||
if ( $md5check != $this->member->form_hash )
|
||||
{
|
||||
return array( 'error' => $this->lang->words['securehash_not_secure'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Load member
|
||||
//-----------------------------------------
|
||||
|
||||
$member = IPSMember::load( $ignoreId, 'core' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $member['member_id'] )
|
||||
{
|
||||
return array( 'error' => $this->lang->words['noignoreuser_noid'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Already ignoring?
|
||||
//-----------------------------------------
|
||||
|
||||
$ignoreMe = $this->DB->buildAndFetch( array(
|
||||
'select' => '*',
|
||||
'from' => 'ignored_users',
|
||||
'where' => 'ignore_owner_id=' . $this->memberData['member_id'] . ' AND ignore_ignore_id=' . $member['member_id']
|
||||
) );
|
||||
|
||||
if ( $ignoreMe['ignore_id'] )
|
||||
{
|
||||
if( !$ignoreMe['ignore_' . $antiType ] )
|
||||
{
|
||||
$this->DB->delete( 'ignored_users', 'ignore_id=' . $ignoreMe['ignore_id'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DB->update( 'ignored_users', array( 'ignore_' . $type => 0 ), 'ignore_id=' . $ignoreMe['ignore_id'] );
|
||||
}
|
||||
|
||||
/* Rebuild cache */
|
||||
IPSMember::rebuildIgnoredUsersCache( $this->memberData );
|
||||
|
||||
return array( 'message' => $this->lang->words['noignoreuser_success'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
return array( 'error' => $this->lang->words['noignoreuser_noid'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
<html>
|
||||
<head><title>IP.Board - Bulletin Board System</title></head>
|
||||
<body>
|
||||
<h1>403: IP.Board -> Forbidden</h1>
|
||||
<hr>
|
||||
You have reached this page in error, please use your back button to return to the forum.
|
||||
<hr>
|
||||
<a href="http://www.invisionpower.com">IP.Board</a>
|
||||
</body>
|
||||
<html>
|
||||
<head><title>IP.Board - Bulletin Board System</title></head>
|
||||
<body>
|
||||
<h1>403: IP.Board -> Forbidden</h1>
|
||||
<hr>
|
||||
You have reached this page in error, please use your back button to return to the forum.
|
||||
<hr>
|
||||
<a href="http://www.invisionpower.com">IP.Board</a>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,161 +1,185 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.2.3
|
||||
* Ignore a user
|
||||
* Last Updated: $Date: 2011-09-08 11:58:29 -0400 (Thu, 08 Sep 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: mmecham $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://hatynka.in
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 9467 $
|
||||
*
|
||||
*/
|
||||
|
||||
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 public_members_profile_photo extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @param object Registry reference
|
||||
* @return @e void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* Load lang file */
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
|
||||
|
||||
/* Load library */
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/member/photo.php', 'classes_member_photo' );
|
||||
$this->photo = new $classToLoad( $registry );
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'save':
|
||||
$this->_save();
|
||||
break;
|
||||
default:
|
||||
case 'show':
|
||||
$output = $this->_show();
|
||||
break;
|
||||
case 'remove':
|
||||
$this->_remove();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Got anything to show? */
|
||||
if ( $output )
|
||||
{
|
||||
$this->registry->output->addContent( $output );
|
||||
$this->registry->output->setTitle( $this->lang->words['pe_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
|
||||
$this->registry->output->addNavigation( $this->lang->words['pe_title'], '' );
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes pics
|
||||
*
|
||||
* @return @e void [HTML]
|
||||
*/
|
||||
protected function _remove()
|
||||
{
|
||||
$this->photo->remove( $this->memberData['member_id'] );
|
||||
|
||||
/* redirect to show */
|
||||
$this->registry->output->redirectScreen( $this->lang->words['pp_photo_edited'], $this->settings['base_url'] . 'showuser=' . $this->memberData['member_id'], $this->memberData['members_seo_name'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves data
|
||||
*
|
||||
* @return @e void [HTML]
|
||||
*/
|
||||
protected function _save()
|
||||
{
|
||||
$getJson = intval( $this->request['getJson'] );
|
||||
$photoType = $this->request['photoType'];
|
||||
$gravatar = $this->request['gravatar'];
|
||||
|
||||
if ( $getJson )
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
|
||||
$ajax = new $classToLoad();
|
||||
}
|
||||
|
||||
/* Do it */
|
||||
try
|
||||
{
|
||||
$photo = $this->photo->save( $this->memberData, $photoType, $gravatar );
|
||||
|
||||
if ( is_array( $photo ) )
|
||||
{
|
||||
if ( $getJson )
|
||||
{
|
||||
$photo['oldThumb'] = $this->memberData['pp_small_photo'];
|
||||
return $ajax->returnJsonArray( $photo, false, 'text/html' );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* redirect to show */
|
||||
$this->registry->output->redirectScreen( $this->lang->words['pp_photo_edited'], $this->settings['base_url'] . 'showuser=' . $this->memberData['member_id'], $this->memberData['members_seo_name'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Exception $error )
|
||||
{
|
||||
$msg = $error->getMessage();
|
||||
|
||||
switch ( $msg )
|
||||
{
|
||||
default:
|
||||
if ( $getJson )
|
||||
{
|
||||
$msg = ( ! empty( $this->lang->words[ 'pp_' . $msg ] ) ) ? $this->lang->words[ 'pp_' . $msg ] : $this->lang->words[ 'pp_generic_error' ];
|
||||
$ajax->returnJsonError( $msg, 'text/html' );
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->getClass('output')->showError( $this->lang->words[ 'pp_' . $msg ], 1027, null, null, 403 );
|
||||
}
|
||||
break;
|
||||
case 'PROFILE_DISABLED':
|
||||
if ( $getJson )
|
||||
{
|
||||
$ajax->returnJsonError( 'member_profile_disabled', 'text/html' );
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->getClass('output')->showError( $this->lang->words['member_profile_disabled'], 1027, null, null, 403 );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the photo editor
|
||||
*
|
||||
* @return @e void [HTML]
|
||||
*/
|
||||
protected function _show()
|
||||
{
|
||||
return $this->photo->getEditorHtml( $this->memberData );
|
||||
}
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* Profile Photo
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 10914 $
|
||||
*
|
||||
*/
|
||||
|
||||
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 public_members_profile_photo extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @param object Registry reference
|
||||
* @return @e void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* Load lang file */
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
|
||||
|
||||
/* Load library */
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/member/photo.php', 'classes_member_photo' );
|
||||
$this->photo = new $classToLoad( $registry );
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'save':
|
||||
$this->_save();
|
||||
break;
|
||||
default:
|
||||
case 'show':
|
||||
$output = $this->_show();
|
||||
break;
|
||||
case 'remove':
|
||||
$this->_remove();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Got anything to show? */
|
||||
if ( $output )
|
||||
{
|
||||
$this->registry->output->addContent( $output );
|
||||
$this->registry->output->setTitle( $this->lang->words['pe_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
|
||||
$this->registry->output->addNavigation( $this->lang->words['pe_title'], '' );
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes pics
|
||||
*
|
||||
* @return @e void [HTML]
|
||||
*/
|
||||
protected function _remove()
|
||||
{
|
||||
$this->photo->remove( $this->memberData['member_id'] );
|
||||
|
||||
/* redirect to show */
|
||||
$this->registry->output->redirectScreen( $this->lang->words['pp_photo_edited'], $this->settings['base_url'] . 'showuser=' . $this->memberData['member_id'], $this->memberData['members_seo_name'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves data
|
||||
*
|
||||
* @return @e void [HTML]
|
||||
*/
|
||||
protected function _save()
|
||||
{
|
||||
$getJson = intval( $this->request['getJson'] );
|
||||
$photoType = $this->request['photoType'];
|
||||
$gravatar = $this->request['gravatar'];
|
||||
|
||||
if ( $getJson )
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
|
||||
$ajax = new $classToLoad();
|
||||
}
|
||||
|
||||
/* Do it */
|
||||
try
|
||||
{
|
||||
$photo = $this->photo->save( $this->memberData, $photoType, $gravatar );
|
||||
|
||||
if ( is_array( $photo ) )
|
||||
{
|
||||
if ( $getJson )
|
||||
{
|
||||
$photo['oldThumb'] = $this->memberData['pp_small_photo'];
|
||||
return $ajax->returnJsonArray( $photo, false, 'text/html' );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* redirect to show */
|
||||
$this->registry->output->redirectScreen( $this->lang->words['pp_photo_edited'], $this->settings['base_url'] . 'showuser=' . $this->memberData['member_id'], $this->memberData['members_seo_name'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Exception $error )
|
||||
{
|
||||
$msg = $error->getMessage();
|
||||
|
||||
if ( $msg == 'upload_to_big' )
|
||||
{
|
||||
$this->lang->words[ 'pp_' . $msg ] = sprintf( $this->lang->words[ 'pp_' . $msg ], $this->memberData['photoMaxKb'] );
|
||||
}
|
||||
|
||||
switch ( $msg )
|
||||
{
|
||||
default:
|
||||
if ( $getJson )
|
||||
{
|
||||
|
||||
|
||||
if ( $this->lang->words[ 'pp_' . $msg ] )
|
||||
{
|
||||
$msg = $this->lang->words[ 'pp_' . $msg ];
|
||||
}
|
||||
elseif ( $this->lang->words[ $msg ] )
|
||||
{
|
||||
$msg = $this->lang->words[ $msg ];
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = $this->lang->words['pp_generic_error'];
|
||||
}
|
||||
|
||||
$ajax->returnJsonError( $msg, 'text/html' );
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->getClass('output')->showError( $this->lang->words[ 'pp_' . $msg ], 1027, null, null, 403 );
|
||||
}
|
||||
break;
|
||||
case 'PROFILE_DISABLED':
|
||||
if ( $getJson )
|
||||
{
|
||||
$ajax->returnJsonError( 'member_profile_disabled', 'text/html' );
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->getClass('output')->showError( $this->lang->words['member_profile_disabled'], 1027, null, null, 403 );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the photo editor
|
||||
*
|
||||
* @return @e void [HTML]
|
||||
*/
|
||||
protected function _show()
|
||||
{
|
||||
/* Check we're a member */
|
||||
if ( !$this->memberData['member_id'] )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['pp_generic_error'], 1027.1, null, null, 403 );
|
||||
}
|
||||
|
||||
return $this->photo->getEditorHtml( $this->memberData );
|
||||
}
|
||||
}
|
||||
@@ -1,412 +1,412 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.2.3
|
||||
* Allow user to change their status
|
||||
* Last Updated: $Date: 2011-08-25 07:46:38 -0400 (Thu, 25 Aug 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: mmecham $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://hatynka.in
|
||||
* @since Tuesday 1st March 2005 (11:52)
|
||||
* @version $Revision: 9413 $
|
||||
*
|
||||
*/
|
||||
|
||||
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 public_members_profile_status extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @param object Registry reference
|
||||
* @return @e void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$this->request['do'] = ( $this->request['do'] ) ? $this->request['do'] : 'list';
|
||||
|
||||
//-----------------------------------------
|
||||
// Security check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->request['do'] != 'list' AND ( $this->request['k'] != $this->member->form_hash ) )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'no_permission', 20314, null, null, 403 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get HTML and skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
|
||||
|
||||
/* Load status class */
|
||||
if ( ! $this->registry->isClassLoaded( 'memberStatus' ) )
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/member/status.php', 'memberStatus' );
|
||||
$this->registry->setClass( 'memberStatus', new $classToLoad( ipsRegistry::instance() ) );
|
||||
}
|
||||
|
||||
/* WHAT R WE DOING? */
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
default:
|
||||
case 'list':
|
||||
$this->_list();
|
||||
break;
|
||||
case 'new':
|
||||
$this->_new();
|
||||
break;
|
||||
case 'reply':
|
||||
$this->_reply();
|
||||
break;
|
||||
case 'deleteStatus':
|
||||
$this->_deleteStatus();
|
||||
break;
|
||||
case 'deleteReply':
|
||||
$this->_deleteReply();
|
||||
break;
|
||||
case 'lockStatus':
|
||||
$this->_lockStatus();
|
||||
break;
|
||||
case 'unlockStatus':
|
||||
$this->_unlockStatus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lock a status
|
||||
*
|
||||
*/
|
||||
protected function _lockStatus()
|
||||
{
|
||||
/* INIT */
|
||||
$status_id = intval( $this->request['status_id'] );
|
||||
|
||||
/* Quick check? */
|
||||
if ( ! $status_id )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10276, null, null, 404 );
|
||||
}
|
||||
|
||||
/* Set Author */
|
||||
$this->registry->getClass('memberStatus')->setAuthor( $this->memberData );
|
||||
|
||||
/* Set Data */
|
||||
$this->registry->getClass('memberStatus')->setStatusData( $status_id );
|
||||
|
||||
/* Can we reply? */
|
||||
if ( ! $this->registry->getClass('memberStatus')->canLockStatus() )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10277, null, null, 403 );
|
||||
}
|
||||
|
||||
/* Update */
|
||||
$this->registry->getClass('memberStatus')->lockStatus();
|
||||
|
||||
/* Got a return URL? */
|
||||
if ( $this->request['rurl'] )
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_locked'], $this->settings['base_url'] . base64_decode( $this->request['rurl'] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_locked'], $this->settings['base_url'] . 'showuser=' . $this->memberData['member_id'], $this->memberData['members_seo_name'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lock a status
|
||||
*
|
||||
*/
|
||||
protected function _unlockStatus()
|
||||
{
|
||||
/* INIT */
|
||||
$status_id = intval( $this->request['status_id'] );
|
||||
|
||||
/* Quick check? */
|
||||
if ( ! $status_id )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10276, null, null, 404 );
|
||||
}
|
||||
|
||||
/* Set Author */
|
||||
$this->registry->getClass('memberStatus')->setAuthor( $this->memberData );
|
||||
|
||||
/* Set Data */
|
||||
$this->registry->getClass('memberStatus')->setStatusData( $status_id );
|
||||
|
||||
/* Can we reply? */
|
||||
if ( ! $this->registry->getClass('memberStatus')->canUnlockStatus() )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10277, null, null, 403 );
|
||||
}
|
||||
|
||||
/* Update */
|
||||
$this->registry->getClass('memberStatus')->unlockStatus();
|
||||
|
||||
/* Got a return URL? */
|
||||
if ( $this->request['rurl'] )
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_unlocked'], $this->settings['base_url'] . base64_decode( $this->request['rurl'] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_unlocked'], $this->settings['base_url'] . 'showuser=' . $this->memberData['member_id'], $this->memberData['members_seo_name'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a status reply
|
||||
*
|
||||
*/
|
||||
protected function _list()
|
||||
{
|
||||
/* INIT */
|
||||
$filters = array( 'offset' => intval( $this->request['st'] ), 'limit' => 15, 'getCount' => true );
|
||||
|
||||
/* Add to the filters */
|
||||
if ( $this->request['member_id'] )
|
||||
{
|
||||
$filters['relatedTo'] = intval( $this->request['member_id'] );
|
||||
$filters['isApproved'] = true;
|
||||
}
|
||||
else if ( $this->request['status_id'] )
|
||||
{
|
||||
$filters['status_id'] = intval( $this->request['status_id'] );
|
||||
$filters['type'] = 'all';
|
||||
}
|
||||
else if ( $this->request['type'] == 'friends' )
|
||||
{
|
||||
$filters['friends_only'] = 1;
|
||||
$filters['type'] = 'all';
|
||||
}
|
||||
|
||||
/* Fetch last 20 */
|
||||
$this->registry->getClass('memberStatus')->setAuthor( $this->memberData );
|
||||
|
||||
/* Fetch */
|
||||
$statuses = $this->registry->getClass('memberStatus')->fetch( $this->memberData, $filters );
|
||||
$count = $this->registry->getClass('memberStatus')->getStatusCount();
|
||||
|
||||
$pages = $this->registry->getClass('output')->generatePagination( array( 'totalItems' => $count,
|
||||
'itemsPerPage' => 15,
|
||||
'currentStartValue' => $this->request['st'],
|
||||
'seoTitle' => true,
|
||||
'seoTemplate' => 'members_status_all',
|
||||
'showNumbers' => false,
|
||||
'baseUrl' => "app=members&module=profile&section=status&type={$this->request['type']}&member_id={$this->request['member_id']}" ) );
|
||||
|
||||
$content = $this->registry->getClass('output')->getTemplate('profile')->statusUpdatesPage( $statuses, $pages );
|
||||
|
||||
$this->registry->output->addContent( $content );
|
||||
$this->registry->output->setTitle( $this->lang->words['status_updates_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
|
||||
$this->registry->output->addNavigation( $this->lang->words['status_updates_title'], '' );
|
||||
$this->registry->output->sendOutput();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a status reply
|
||||
*
|
||||
*/
|
||||
protected function _deleteReply()
|
||||
{
|
||||
/* INIT */
|
||||
$status_id = intval( $this->request['status_id'] );
|
||||
$reply_id = intval( $this->request['reply_id'] );
|
||||
|
||||
/* Quick check? */
|
||||
if ( ! $status_id OR ! $reply_id )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10276, null, null, 404 );
|
||||
}
|
||||
|
||||
/* Set Author */
|
||||
$this->registry->getClass('memberStatus')->setAuthor( $this->memberData );
|
||||
|
||||
/* Set Data */
|
||||
$this->registry->getClass('memberStatus')->setStatusData( $status_id );
|
||||
$this->registry->getClass('memberStatus')->setReplyData( $reply_id );
|
||||
|
||||
/* Can we reply? */
|
||||
if ( ! $this->registry->getClass('memberStatus')->canDeleteReply() )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10277, null, null, 403 );
|
||||
}
|
||||
|
||||
/* Update */
|
||||
$this->registry->getClass('memberStatus')->deleteReply();
|
||||
|
||||
/* Got a return URL? */
|
||||
if ( $this->request['rurl'] )
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_reply_deleted'], $this->settings['base_url'] . base64_decode( $this->request['rurl'] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_reply_deleted'], $this->settings['base_url'] . 'app=members&module=profile&section=status&status_id=' . $status_id, 'false', 'members_status_all' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a status
|
||||
*
|
||||
*/
|
||||
protected function _deleteStatus()
|
||||
{
|
||||
/* INIT */
|
||||
$status_id = intval( $this->request['status_id'] );
|
||||
|
||||
/* Quick check? */
|
||||
if ( ! $status_id )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10278, null, null, 404 );
|
||||
}
|
||||
|
||||
/* Set Author */
|
||||
$this->registry->getClass('memberStatus')->setAuthor( $this->memberData );
|
||||
|
||||
/* Set Data */
|
||||
$this->registry->getClass('memberStatus')->setStatusData( $status_id );
|
||||
|
||||
/* Can we delete? */
|
||||
if ( ! $this->registry->getClass('memberStatus')->canDeleteStatus() )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10279, null, null, 403 );
|
||||
}
|
||||
|
||||
/* Get info */
|
||||
$status = $this->registry->getClass('memberStatus')->getStatusData();
|
||||
|
||||
/* Update */
|
||||
$this->registry->getClass('memberStatus')->deleteStatus();
|
||||
|
||||
/* Got a return URL? */
|
||||
if ( $this->request['rurl'] )
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_deleted'], $this->settings['base_url'] . base64_decode( $this->request['rurl'] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$_text = ( $status['status_member_id'] == $status['status_author_id'] ) ? $this->lang->words['status_deleted'] : $this->lang->words['comment_was_deleted'];
|
||||
|
||||
$this->registry->output->redirectScreen( $_text, $this->settings['base_url'] . 'showuser=' . $status['status_member_id'] . '&tab=status', $status['members_seo_name'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a reply statussesses
|
||||
*
|
||||
*/
|
||||
protected function _reply()
|
||||
{
|
||||
/* INIT */
|
||||
$status_id = intval( $this->request['status_id'] );
|
||||
$comment = trim( $this->request['comment-' . $status_id ] );
|
||||
$id = intval( $this->request['id'] );
|
||||
|
||||
/* Quick check? */
|
||||
if ( ! $status_id OR ! $comment )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10280, null, null, 404 );
|
||||
}
|
||||
|
||||
/* Set Author */
|
||||
$this->registry->getClass('memberStatus')->setAuthor( $this->memberData );
|
||||
|
||||
/* Set Content */
|
||||
$this->registry->getClass('memberStatus')->setContent( $comment );
|
||||
|
||||
/* Set Data */
|
||||
$this->registry->getClass('memberStatus')->setStatusData( $status_id );
|
||||
|
||||
/* Can we reply? */
|
||||
if ( ! $this->registry->getClass('memberStatus')->canReply() )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10281, null, null, 403 );
|
||||
}
|
||||
|
||||
/* Update */
|
||||
$this->registry->getClass('memberStatus')->reply();
|
||||
|
||||
/* Got a return URL? */
|
||||
if ( $this->request['rurl'] )
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_reply_done'], $this->settings['base_url'] . base64_decode( $this->request['rurl'] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_reply_done'], $this->settings['base_url'] . 'showuser=' . $id, $this->memberData['members_seo_name'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new statussesses
|
||||
*
|
||||
*/
|
||||
protected function _new()
|
||||
{
|
||||
$id = intval( $this->memberData['member_id'] );
|
||||
$su_Twitter = intval( $this->request['su_Twitter'] );
|
||||
$su_Facebook = intval( $this->request['su_Facebook'] );
|
||||
$forMemberId = intval( $this->request['forMemberId'] );
|
||||
|
||||
/* Set Author */
|
||||
$this->registry->getClass('memberStatus')->setAuthor( $this->memberData );
|
||||
|
||||
/* Set Content */
|
||||
$this->registry->getClass('memberStatus')->setContent( trim( $this->request['content'] ) );
|
||||
|
||||
/* Can we reply? */
|
||||
if ( ! $this->registry->getClass('memberStatus')->canCreate() )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10268, null, null, 403 );
|
||||
}
|
||||
|
||||
/* Update or comment? */
|
||||
if ( $forMemberId && $forMemberId != $this->memberData['member_id'] )
|
||||
{
|
||||
$owner = IPSMember::load( $forMemberId );
|
||||
|
||||
if ( ! $owner['pp_setting_count_comments'] )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10268, null, null, 403 );
|
||||
}
|
||||
|
||||
/* Set owner */
|
||||
$this->registry->getClass('memberStatus')->setStatusOwner( $owner );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set post outs */
|
||||
$this->registry->getClass('memberStatus')->setExternalUpdates( array( 'twitter' => $su_Twitter, 'facebook' => $su_Facebook ) );
|
||||
}
|
||||
|
||||
/* Update */
|
||||
$this->registry->getClass('memberStatus')->create();
|
||||
|
||||
/* Got a return URL? */
|
||||
if ( $this->request['rurl'] )
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_was_changed'], $this->settings['base_url'] . base64_decode( $this->request['rurl'] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_was_changed'], $this->settings['base_url'] . 'showuser=' . $id, $this->memberData['members_seo_name'] );
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* Allow user to change their status
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://www.invisionpower.com
|
||||
* @since Tuesday 1st March 2005 (11:52)
|
||||
* @version $Revision: 10914 $
|
||||
*
|
||||
*/
|
||||
|
||||
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 public_members_profile_status extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @param object Registry reference
|
||||
* @return @e void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$this->request['do'] = ( $this->request['do'] ) ? $this->request['do'] : 'list';
|
||||
|
||||
//-----------------------------------------
|
||||
// Security check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->request['do'] != 'list' AND ( $this->request['k'] != $this->member->form_hash ) )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'no_permission', 20314, null, null, 403 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get HTML and skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
|
||||
|
||||
/* Load status class */
|
||||
if ( ! $this->registry->isClassLoaded( 'memberStatus' ) )
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/member/status.php', 'memberStatus' );
|
||||
$this->registry->setClass( 'memberStatus', new $classToLoad( ipsRegistry::instance() ) );
|
||||
}
|
||||
|
||||
/* WHAT R WE DOING? */
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
default:
|
||||
case 'list':
|
||||
$this->_list();
|
||||
break;
|
||||
case 'new':
|
||||
$this->_new();
|
||||
break;
|
||||
case 'reply':
|
||||
$this->_reply();
|
||||
break;
|
||||
case 'deleteStatus':
|
||||
$this->_deleteStatus();
|
||||
break;
|
||||
case 'deleteReply':
|
||||
$this->_deleteReply();
|
||||
break;
|
||||
case 'lockStatus':
|
||||
$this->_lockStatus();
|
||||
break;
|
||||
case 'unlockStatus':
|
||||
$this->_unlockStatus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lock a status
|
||||
*
|
||||
*/
|
||||
protected function _lockStatus()
|
||||
{
|
||||
/* INIT */
|
||||
$status_id = intval( $this->request['status_id'] );
|
||||
|
||||
/* Quick check? */
|
||||
if ( ! $status_id )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10276, null, null, 404 );
|
||||
}
|
||||
|
||||
/* Set Author */
|
||||
$this->registry->getClass('memberStatus')->setAuthor( $this->memberData );
|
||||
|
||||
/* Set Data */
|
||||
$this->registry->getClass('memberStatus')->setStatusData( $status_id );
|
||||
|
||||
/* Can we reply? */
|
||||
if ( ! $this->registry->getClass('memberStatus')->canLockStatus() )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10277, null, null, 403 );
|
||||
}
|
||||
|
||||
/* Update */
|
||||
$this->registry->getClass('memberStatus')->lockStatus();
|
||||
|
||||
/* Got a return URL? */
|
||||
if ( $this->request['rurl'] )
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_locked'], $this->settings['base_url'] . base64_decode( $this->request['rurl'] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_locked'], $this->settings['base_url'] . 'showuser=' . $this->memberData['member_id'], $this->memberData['members_seo_name'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lock a status
|
||||
*
|
||||
*/
|
||||
protected function _unlockStatus()
|
||||
{
|
||||
/* INIT */
|
||||
$status_id = intval( $this->request['status_id'] );
|
||||
|
||||
/* Quick check? */
|
||||
if ( ! $status_id )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10276, null, null, 404 );
|
||||
}
|
||||
|
||||
/* Set Author */
|
||||
$this->registry->getClass('memberStatus')->setAuthor( $this->memberData );
|
||||
|
||||
/* Set Data */
|
||||
$this->registry->getClass('memberStatus')->setStatusData( $status_id );
|
||||
|
||||
/* Can we reply? */
|
||||
if ( ! $this->registry->getClass('memberStatus')->canUnlockStatus() )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10277, null, null, 403 );
|
||||
}
|
||||
|
||||
/* Update */
|
||||
$this->registry->getClass('memberStatus')->unlockStatus();
|
||||
|
||||
/* Got a return URL? */
|
||||
if ( $this->request['rurl'] )
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_unlocked'], $this->settings['base_url'] . base64_decode( $this->request['rurl'] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_unlocked'], $this->settings['base_url'] . 'showuser=' . $this->memberData['member_id'], $this->memberData['members_seo_name'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a status reply
|
||||
*
|
||||
*/
|
||||
protected function _list()
|
||||
{
|
||||
/* INIT */
|
||||
$filters = array( 'offset' => intval( $this->request['st'] ), 'limit' => 15, 'getCount' => true );
|
||||
|
||||
/* Add to the filters */
|
||||
if ( $this->request['member_id'] )
|
||||
{
|
||||
$filters['relatedTo'] = intval( $this->request['member_id'] );
|
||||
$filters['isApproved'] = true;
|
||||
}
|
||||
else if ( $this->request['status_id'] )
|
||||
{
|
||||
$filters['status_id'] = intval( $this->request['status_id'] );
|
||||
$filters['type'] = 'all';
|
||||
}
|
||||
else if ( $this->request['type'] == 'friends' )
|
||||
{
|
||||
$filters['friends_only'] = 1;
|
||||
$filters['type'] = 'all';
|
||||
}
|
||||
|
||||
/* Fetch last 20 */
|
||||
$this->registry->getClass('memberStatus')->setAuthor( $this->memberData );
|
||||
|
||||
/* Fetch */
|
||||
$statuses = $this->registry->getClass('memberStatus')->fetch( $this->memberData, $filters );
|
||||
$count = $this->registry->getClass('memberStatus')->getStatusCount();
|
||||
|
||||
$pages = $this->registry->getClass('output')->generatePagination( array( 'totalItems' => $count,
|
||||
'itemsPerPage' => 15,
|
||||
'currentStartValue' => $this->request['st'],
|
||||
'seoTitle' => true,
|
||||
'seoTemplate' => 'members_status_all',
|
||||
'showNumbers' => false,
|
||||
'baseUrl' => "app=members&module=profile&section=status&type={$this->request['type']}&member_id={$this->request['member_id']}" ) );
|
||||
|
||||
$content = $this->registry->getClass('output')->getTemplate('profile')->statusUpdatesPage( $statuses, $pages );
|
||||
|
||||
$this->registry->output->addContent( $content );
|
||||
$this->registry->output->setTitle( $this->lang->words['status_updates_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
|
||||
$this->registry->output->addNavigation( $this->lang->words['status_updates_title'], '' );
|
||||
$this->registry->output->sendOutput();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a status reply
|
||||
*
|
||||
*/
|
||||
protected function _deleteReply()
|
||||
{
|
||||
/* INIT */
|
||||
$status_id = intval( $this->request['status_id'] );
|
||||
$reply_id = intval( $this->request['reply_id'] );
|
||||
|
||||
/* Quick check? */
|
||||
if ( ! $status_id OR ! $reply_id )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10276, null, null, 404 );
|
||||
}
|
||||
|
||||
/* Set Author */
|
||||
$this->registry->getClass('memberStatus')->setAuthor( $this->memberData );
|
||||
|
||||
/* Set Data */
|
||||
$this->registry->getClass('memberStatus')->setStatusData( $status_id );
|
||||
$this->registry->getClass('memberStatus')->setReplyData( $reply_id );
|
||||
|
||||
/* Can we reply? */
|
||||
if ( ! $this->registry->getClass('memberStatus')->canDeleteReply() )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10277, null, null, 403 );
|
||||
}
|
||||
|
||||
/* Update */
|
||||
$this->registry->getClass('memberStatus')->deleteReply();
|
||||
|
||||
/* Got a return URL? */
|
||||
if ( $this->request['rurl'] )
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_reply_deleted'], $this->settings['base_url'] . base64_decode( $this->request['rurl'] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_reply_deleted'], $this->settings['base_url'] . 'app=members&module=profile&section=status&status_id=' . $status_id, 'false', 'members_status_all' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a status
|
||||
*
|
||||
*/
|
||||
protected function _deleteStatus()
|
||||
{
|
||||
/* INIT */
|
||||
$status_id = intval( $this->request['status_id'] );
|
||||
|
||||
/* Quick check? */
|
||||
if ( ! $status_id )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10278, null, null, 404 );
|
||||
}
|
||||
|
||||
/* Set Author */
|
||||
$this->registry->getClass('memberStatus')->setAuthor( $this->memberData );
|
||||
|
||||
/* Set Data */
|
||||
$this->registry->getClass('memberStatus')->setStatusData( $status_id );
|
||||
|
||||
/* Can we delete? */
|
||||
if ( ! $this->registry->getClass('memberStatus')->canDeleteStatus() )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10279, null, null, 403 );
|
||||
}
|
||||
|
||||
/* Get info */
|
||||
$status = $this->registry->getClass('memberStatus')->getStatusData();
|
||||
|
||||
/* Update */
|
||||
$this->registry->getClass('memberStatus')->deleteStatus();
|
||||
|
||||
/* Got a return URL? */
|
||||
if ( $this->request['rurl'] )
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_deleted'], $this->settings['base_url'] . base64_decode( $this->request['rurl'] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$_text = ( $status['status_member_id'] == $status['status_author_id'] ) ? $this->lang->words['status_deleted'] : $this->lang->words['comment_was_deleted'];
|
||||
|
||||
$this->registry->output->redirectScreen( $_text, $this->settings['base_url'] . 'showuser=' . $status['status_member_id'] . '&tab=status', $status['members_seo_name'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a reply statussesses
|
||||
*
|
||||
*/
|
||||
protected function _reply()
|
||||
{
|
||||
/* INIT */
|
||||
$status_id = intval( $this->request['status_id'] );
|
||||
$comment = trim( $this->request['comment-' . $status_id ] );
|
||||
$id = intval( $this->request['id'] );
|
||||
|
||||
/* Quick check? */
|
||||
if ( ! $status_id OR ! $comment )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10280, null, null, 404 );
|
||||
}
|
||||
|
||||
/* Set Author */
|
||||
$this->registry->getClass('memberStatus')->setAuthor( $this->memberData );
|
||||
|
||||
/* Set Content */
|
||||
$this->registry->getClass('memberStatus')->setContent( $comment );
|
||||
|
||||
/* Set Data */
|
||||
$this->registry->getClass('memberStatus')->setStatusData( $status_id );
|
||||
|
||||
/* Can we reply? */
|
||||
if ( ! $this->registry->getClass('memberStatus')->canReply() )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10281, null, null, 403 );
|
||||
}
|
||||
|
||||
/* Update */
|
||||
$this->registry->getClass('memberStatus')->reply();
|
||||
|
||||
/* Got a return URL? */
|
||||
if ( $this->request['rurl'] )
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_reply_done'], $this->settings['base_url'] . base64_decode( $this->request['rurl'] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_reply_done'], $this->settings['base_url'] . 'showuser=' . $id, $this->memberData['members_seo_name'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new statussesses
|
||||
*
|
||||
*/
|
||||
protected function _new()
|
||||
{
|
||||
$id = intval( $this->memberData['member_id'] );
|
||||
$su_Twitter = intval( $this->request['su_Twitter'] );
|
||||
$su_Facebook = intval( $this->request['su_Facebook'] );
|
||||
$forMemberId = intval( $this->request['forMemberId'] );
|
||||
|
||||
/* Set Author */
|
||||
$this->registry->getClass('memberStatus')->setAuthor( $this->memberData );
|
||||
|
||||
/* Set Content */
|
||||
$this->registry->getClass('memberStatus')->setContent( trim( $this->request['content'] ) );
|
||||
|
||||
/* Can we reply? */
|
||||
if ( ! $this->registry->getClass('memberStatus')->canCreate() )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10268, null, null, 403 );
|
||||
}
|
||||
|
||||
/* Update or comment? */
|
||||
if ( $forMemberId && $forMemberId != $this->memberData['member_id'] )
|
||||
{
|
||||
$owner = IPSMember::load( $forMemberId );
|
||||
|
||||
if ( ! $owner['pp_setting_count_comments'] )
|
||||
{
|
||||
$this->registry->output->showError( 'status_off', 10268, null, null, 403 );
|
||||
}
|
||||
|
||||
/* Set owner */
|
||||
$this->registry->getClass('memberStatus')->setStatusOwner( $owner );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set post outs */
|
||||
$this->registry->getClass('memberStatus')->setExternalUpdates( array( 'twitter' => $su_Twitter, 'facebook' => $su_Facebook ) );
|
||||
}
|
||||
|
||||
/* Update */
|
||||
$this->registry->getClass('memberStatus')->create();
|
||||
|
||||
/* Got a return URL? */
|
||||
if ( $this->request['rurl'] )
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_was_changed'], $this->settings['base_url'] . base64_decode( $this->request['rurl'] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['status_was_changed'], $this->settings['base_url'] . 'showuser=' . $id, $this->memberData['members_seo_name'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,812 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* Warnings Management
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $ (Original: Mark)
|
||||
* @copyright © 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 9th November 2011
|
||||
* @version $Revision: 10914 $
|
||||
*
|
||||
*/
|
||||
|
||||
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 public_members_profile_warnings extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Can the member warn other users?
|
||||
*
|
||||
* @var $canWarn
|
||||
*/
|
||||
public $canWarn = false;
|
||||
|
||||
/**
|
||||
* List of all the reasons for a warning
|
||||
*
|
||||
* @var $reasons
|
||||
*/
|
||||
public $reasons = array();
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @param object Registry reference
|
||||
* @return @e void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Init
|
||||
//-----------------------------------------
|
||||
|
||||
/* Do we even have warnings enabled? */
|
||||
if ( !$this->settings['warn_on'] )
|
||||
{
|
||||
$this->registry->output->showError( 'no_permission', 10260, null, null, 403 );
|
||||
}
|
||||
|
||||
/* Load the member */
|
||||
$memberId = intval( $this->request['member'] );
|
||||
$this->_member = IPSMember::load( $memberId );
|
||||
if ( !$this->_member['member_id'] )
|
||||
{
|
||||
$this->_member = $this->memberData;
|
||||
}
|
||||
|
||||
/* Is this user protected? */
|
||||
if ( $this->settings['warn_protected'] )
|
||||
{
|
||||
if ( IPSMember::isInGroup( $this->_member, explode( ',', $this->settings['warn_protected'] ) ) )
|
||||
{
|
||||
$this->registry->output->showError( 'warn_protected_member', 10265, null, null, 403 );
|
||||
}
|
||||
}
|
||||
|
||||
/* Can we view? */
|
||||
$pass = FALSE;
|
||||
$this->canWarn = FALSE;
|
||||
$modType = NULL;
|
||||
|
||||
if( $this->memberData['member_id'] )
|
||||
{
|
||||
if( $this->memberData['g_is_supmod'] )
|
||||
{
|
||||
$pass = TRUE;
|
||||
$this->canWarn = TRUE;
|
||||
$modType = 'warn_gmod_day';
|
||||
}
|
||||
elseif( $this->memberData['is_mod'] )
|
||||
{
|
||||
$other_mgroups = array();
|
||||
$_other_mgroups = IPSText::cleanPermString( $this->memberData['mgroup_others'] );
|
||||
|
||||
if( $_other_mgroups )
|
||||
{
|
||||
$other_mgroups = explode( ",", $_other_mgroups );
|
||||
}
|
||||
|
||||
$other_mgroups[] = $this->memberData['member_group_id'];
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => '*',
|
||||
'from' => 'moderators',
|
||||
'where' => "(member_id='" . $this->memberData['member_id'] . "' OR (is_group=1 AND group_id IN(" . implode( ",", $other_mgroups ) . ")))"
|
||||
) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $this->moderator = $this->DB->fetch() )
|
||||
{
|
||||
if ( $this->moderator['allow_warn'] )
|
||||
{
|
||||
$pass = TRUE;
|
||||
$this->canWarn = TRUE;
|
||||
$modType = 'warn_mod_day';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( ! $pass && $this->memberData['member_id'] == $this->_member['member_id'] )
|
||||
{
|
||||
if ( $this->settings['warn_show_own'] || $this->canWarn || in_array( $this->request['do'], array( 'acknowledge', 'do_acknowledge' ) ) )
|
||||
{
|
||||
$pass = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$pass )
|
||||
{
|
||||
$this->registry->output->showError( 'no_permission', 10262, null, null, 403 );
|
||||
}
|
||||
|
||||
/* Are we limited per day? */
|
||||
if ( $this->canWarn and !$this->memberData['g_access_cp'] and $this->settings[ $modType ] != -1 )
|
||||
{
|
||||
$count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as dracula', 'from' => 'members_warn_logs', 'where' => "wl_moderator={$this->memberData['member_id']} AND wl_member={$this->_member['member_id']} AND wl_date>" . ( time() - 86400 ) ) );
|
||||
if ( $count['dracula'] >= $this->settings[ $modType ] )
|
||||
{
|
||||
$this->canWarn = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Load reasons */
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'members_warn_reasons', 'order' => 'wr_order' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $row = $this->DB->fetch() )
|
||||
{
|
||||
$this->reasons[ $row['wr_id'] ] = $row;
|
||||
}
|
||||
|
||||
/* Output init */
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
|
||||
$this->registry->output->addNavigation( "{$this->lang->words['page_title_pp']}: {$this->_member['members_display_name']}", "showuser={$this->_member['member_id']}", $this->_member['members_seo_name'], 'showuser' );
|
||||
$this->registry->output->addNavigation( $this->lang->words['warnings'], "app=members&module=profile§ion=warnings&member={$this->_member['member_id']}" );
|
||||
|
||||
//-----------------------------------------
|
||||
// What are we doing?
|
||||
//-----------------------------------------
|
||||
|
||||
switch ( $this->request['do'] )
|
||||
{
|
||||
case 'add':
|
||||
$this->form();
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
$this->save();
|
||||
break;
|
||||
|
||||
case 'acknowledge':
|
||||
$this->acknowledge();
|
||||
break;
|
||||
|
||||
case 'do_acknowledge':
|
||||
$this->doAcknowledge();
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->viewWarnings();
|
||||
break;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Output
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->sendOutput();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Action: View Warnings
|
||||
*/
|
||||
public function viewWarnings()
|
||||
{
|
||||
$warnings = array();
|
||||
|
||||
/* Get the count */
|
||||
$count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as dracula', 'from' => 'members_warn_logs', 'where' => "wl_member={$this->_member['member_id']}" ) );
|
||||
|
||||
/* Sort out pagination */
|
||||
$st = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
|
||||
$pagination = $this->registry->output->generatePagination( array(
|
||||
'totalItems' => $count['dracula'],
|
||||
'itemsPerPage' => 25,
|
||||
'currentStartValue' => $st,
|
||||
'baseUrl' => "app=members&module=profile&section=warnings&member={$this->_member['member_id']}&from_app={$this->request['from_app']}&from_id1={$this->request['from_id1']}&from_id2={$this->request['from_id2']}",
|
||||
'seoTemplate' => '',
|
||||
'seoTitle' => '',
|
||||
) );
|
||||
|
||||
/* Fetch 'em */
|
||||
$this->DB->build( array(
|
||||
'select' => '*',
|
||||
'from' => 'members_warn_logs',
|
||||
'where' => "wl_member={$this->_member['member_id']}",
|
||||
'order' => 'wl_date DESC'
|
||||
) );
|
||||
$e = $this->DB->execute();
|
||||
while ( $row = $this->DB->fetch( $e ) )
|
||||
{
|
||||
$row['wl_moderator'] = IPSMember::load( $row['wl_moderator'] );
|
||||
$warnings[ $row['wl_id'] ] = $row;
|
||||
}
|
||||
|
||||
/* Display */
|
||||
$this->registry->output->addContent( $this->registry->output->getTemplate('profile')->listWarnings( $this->_member, $warnings, $pagination, $this->reasons, $this->canWarn ) );
|
||||
$this->registry->output->setTitle( sprintf( $this->lang->words['warnings_member'], $this->_member['members_display_name'] ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show Form: Warning
|
||||
*/
|
||||
public function form( $errors=array() )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Permission Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->canWarn )
|
||||
{
|
||||
$this->registry->output->showError( 'no_permission', 10263, null, null, 403 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Work out current punishments
|
||||
//-----------------------------------------
|
||||
|
||||
$currentPunishments = array();
|
||||
foreach ( array( 'mq' => 'mod_posts', 'rpa' => 'restrict_post', 'suspend' => 'temp_ban' ) as $k => $mk )
|
||||
{
|
||||
if ( $this->_member[ $mk ] )
|
||||
{
|
||||
if ( $this->_member[ $mk ] == 1 )
|
||||
{
|
||||
$currentPunishments[ $k ] = sprintf( $this->lang->words['warnings_already_'.$k.'_perm'], $this->_member['members_display_name'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$_processed = IPSMember::processBanEntry( $this->_member[ $mk ] );
|
||||
$currentPunishments[ $k ] = sprintf( $this->lang->words['warnings_already_'.$k.'_time'], $this->_member['members_display_name'], $this->lang->getDate( $_processed['date_end'], 'SHORT' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Editor
|
||||
//-----------------------------------------
|
||||
|
||||
$editor = array();
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite' );
|
||||
|
||||
$editor['member'] = new $classToLoad();
|
||||
if( $this->request['note_member'] )
|
||||
{
|
||||
$editor['member']->setContent( $editor['member']->process( $_POST['note_member'] ) );
|
||||
}
|
||||
$editor['member'] = $editor['member']->show( 'note_member', array( 'autoSaveKey' => "warn-member", 'type' => 'mini', 'minimize' => TRUE ) );
|
||||
|
||||
$editor['mod'] = new $classToLoad();
|
||||
if( $this->request['note_mods'] )
|
||||
{
|
||||
$editor['mod']->setContent( $editor['mod']->process( $_POST['note_mods'] ) );
|
||||
}
|
||||
$editor['mod'] = $editor['mod']->show( 'note_mods', array( 'autoSaveKey' => "warn-mod", 'type' => 'mini', 'minimize' => TRUE ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Display
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->addContent( $this->registry->output->getTemplate('profile')->addWarning( $this->_member, $this->reasons, $errors, $editor, $currentPunishments ) );
|
||||
$this->registry->output->setTitle( sprintf( $this->lang->words['warnings_member_add'], $this->_member['members_display_name'] ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Action: Issue Warning
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Init
|
||||
//-----------------------------------------
|
||||
|
||||
$points = 0;
|
||||
$mq = 0;
|
||||
$mq_unit = 'd';
|
||||
$rpa = 0;
|
||||
$rpa_unit = 'd';
|
||||
$suspend = 0;
|
||||
$suspend_unit = 'd';
|
||||
$banGroup = 0;
|
||||
$removePoints = 0;
|
||||
$removePointsUnit = 'd';
|
||||
|
||||
//-----------------------------------------
|
||||
// Validate
|
||||
//-----------------------------------------
|
||||
|
||||
$errors = array();
|
||||
|
||||
if ( $this->request['reason'] === '' )
|
||||
{
|
||||
/* No reason selected */
|
||||
$errors['reason'] = $this->lang->words['warnings_err_reason'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$reason = intval( $this->request['reason'] );
|
||||
|
||||
/* "Other" reason selected */
|
||||
if ( !$reason )
|
||||
{
|
||||
/* Check we're actually allowed to use it */
|
||||
if ( !$this->memberData['g_access_cp'] and !$this->settings['warnings_enable_other'] )
|
||||
{
|
||||
/* Nope */
|
||||
$errors['reason'] = $this->lang->words['warnings_err_reason'];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If we select "Other", we determine the number of points and when they expire */
|
||||
$points = floatval( $this->request['points'] );
|
||||
$removePoints = intval( $this->request['remove'] );
|
||||
$removePointsUnit = $this->request['remove_unit'] == 'h' ? 'h' : 'd';
|
||||
}
|
||||
}
|
||||
/* Defined reason selected */
|
||||
else
|
||||
{
|
||||
$reason = $this->reasons[ $reason ];
|
||||
|
||||
/* Check it's valid */
|
||||
if ( !$reason['wr_id'] )
|
||||
{
|
||||
/* Nope */
|
||||
$errors['reason'] = $this->lang->words['warnings_err_reason'];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Can we override the number of points for this reason? */
|
||||
if ( $this->memberData['g_access_cp'] or $reason['wr_points_override'] )
|
||||
{
|
||||
// Yes, get value from input
|
||||
$points = floatval( $this->request['points'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// No, take whatever the reason has set
|
||||
$points = $reason['wr_points'];
|
||||
}
|
||||
|
||||
/* Can we override when the points expire? */
|
||||
if ( $this->memberData['g_access_cp'] or $reason['wr_remove_override'] )
|
||||
{
|
||||
// Yes, get value from input
|
||||
$removePoints = intval( $this->request['remove'] );
|
||||
$removePointsUnit = $this->request['remove_unit'] == 'h' ? 'h' : 'd';
|
||||
}
|
||||
else
|
||||
{
|
||||
// No, take whatever the reason has set
|
||||
$removePoints = intval( $reason['wr_remove'] );
|
||||
$removePointsUnit = $reason['wr_remove_unit'];
|
||||
}
|
||||
}
|
||||
|
||||
$reason = $reason['wr_id'];
|
||||
}
|
||||
|
||||
/* Now let's get the action */
|
||||
$newPointLevel = floatval( $this->_member['warn_level'] + $points );
|
||||
$action = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'members_warn_actions', 'where' => "wa_points<={$newPointLevel}", 'order' => 'wa_points DESC', 'limit' => 1 ) );
|
||||
|
||||
if ( $action )
|
||||
{
|
||||
/* We have an action. Can we override it's punishment? */
|
||||
if ( $action['wa_override'] )
|
||||
{
|
||||
// Yes, get values from input
|
||||
$mq = $this->request['mq_perm'] ? -1 : intval( $this->request['mq'] );
|
||||
$mq_unit = $this->request['mq_unit'];
|
||||
$rpa = $this->request['rpa_perm'] ? -1 : intval( $this->request['rpa'] );
|
||||
$rpa_unit = $this->request['rpa_unit'];
|
||||
$suspend = $this->request['suspend_perm'] ? -1 : intval( $this->request['suspend'] );
|
||||
$suspend_unit = $this->request['suspend_unit'];
|
||||
$banGroup = $this->request['ban_group'] ? intval( $this->request['ban_group_id'] ) : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No, do whatever the action says
|
||||
$mq = intval( $action['wa_mq'] );
|
||||
$mq_unit = $action['wa_mq_unit'];
|
||||
$rpa = intval( $action['wa_rpa'] );
|
||||
$rpa_unit = $action['wa_rpa_unit'];
|
||||
$suspend = intval( $action['wa_suspend'] );
|
||||
$suspend_unit = $action['wa_suspend_unit'];
|
||||
$banGroup = intval( $action['wa_ban_group'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We don't have an action - are we allowed to give a custom punishment? */
|
||||
if ( $this->memberData['g_access_cp'] or $this->settings['warning_custom_noaction'] )
|
||||
{
|
||||
// Yes, get values from input
|
||||
$mq = $this->request['mq_perm'] ? -1 : intval( $this->request['mq'] );
|
||||
$mq_unit = $this->request['mq_unit'];
|
||||
$rpa = $this->request['rpa_perm'] ? -1 : intval( $this->request['rpa'] );
|
||||
$rpa_unit = $this->request['rpa_unit'];
|
||||
$suspend = $this->request['suspend_perm'] ? -1 : intval( $this->request['suspend'] );
|
||||
$suspend_unit = $this->request['suspend_unit'];
|
||||
$banGroup = $this->request['ban_group'] ? intval( $this->request['ban_group_id'] ) : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We're not allowed to give a punishment so this is a verbal warning only.
|
||||
// The values we set earlier during init are fine
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !empty( $errors ) )
|
||||
{
|
||||
return $this->form( $errors );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse
|
||||
//-----------------------------------------
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite' );
|
||||
$editor = new $classToLoad();
|
||||
|
||||
$noteForMember = $editor->process( $_POST['note_member'] );
|
||||
$noteForMods = $editor->process( $_POST['note_mods'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Save Log
|
||||
//-----------------------------------------
|
||||
|
||||
/* If our points are going to expire, woprk out exactly when */
|
||||
$expireDate = 0;
|
||||
if ( $removePoints )
|
||||
{
|
||||
IPSTime::setTimestamp( time() );
|
||||
if ( $removePointsUnit == 'h' )
|
||||
{
|
||||
IPSTime::add_hours( $removePoints );
|
||||
}
|
||||
else
|
||||
{
|
||||
IPSTime::add_days( $removePoints );
|
||||
}
|
||||
$expireDate = IPSTime::getTimestamp();
|
||||
}
|
||||
|
||||
/* Log */
|
||||
$warning = array(
|
||||
'wl_member' => $this->_member['member_id'],
|
||||
'wl_moderator' => $this->memberData['member_id'],
|
||||
'wl_date' => time(),
|
||||
'wl_reason' => $reason,
|
||||
'wl_points' => $points,
|
||||
'wl_note_member' => $noteForMember,
|
||||
'wl_note_mods' => $noteForMods,
|
||||
'wl_mq' => $mq,
|
||||
'wl_mq_unit' => $mq_unit,
|
||||
'wl_rpa' => $rpa,
|
||||
'wl_rpa_unit' => $rpa_unit,
|
||||
'wl_suspend' => $suspend,
|
||||
'wl_suspend_unit' => $suspend_unit,
|
||||
'wl_ban_group' => $banGroup,
|
||||
'wl_expire' => $removePoints,
|
||||
'wl_expire_unit' => $removePointsUnit,
|
||||
'wl_acknowledged' => ( $this->settings['warnings_acknowledge'] ? 0 : 1 ),
|
||||
'wl_content_app' => trim( $this->request['from_app'] ),
|
||||
'wl_content_id1' => $this->request['from_id1'],
|
||||
'wl_content_id2' => $this->request['from_id2'],
|
||||
'wl_expire_date' => $expireDate,
|
||||
);
|
||||
|
||||
/* Data Hook Location */
|
||||
$warning['actionData'] = $action;
|
||||
$warning['reasonsData'] = $this->reasons;
|
||||
IPSLib::doDataHooks( $warning, 'memberWarningPre' );
|
||||
unset( $warning['actionData'], $warning['reasonsData'] );
|
||||
|
||||
$this->DB->insert( 'members_warn_logs', $warning );
|
||||
$warning['wl_id'] = $this->DB->getInsertId();
|
||||
|
||||
/* Data Hook Location */
|
||||
$warning['actionData'] = $action;
|
||||
$warning['reasonsData'] = $this->reasons;
|
||||
IPSLib::doDataHooks( $warning, 'memberWarningPost' );
|
||||
unset( $warning['actionData'], $warning['reasonsData'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Actually do it
|
||||
//-----------------------------------------
|
||||
|
||||
$update = array();
|
||||
|
||||
/* Add Points */
|
||||
if ( $points )
|
||||
{
|
||||
$update['warn_level'] = $this->_member['warn_level'] + $points;
|
||||
}
|
||||
|
||||
/* Set Punishments */
|
||||
if ( $mq )
|
||||
{
|
||||
$update['mod_posts'] = ( $mq == -1 ? 1 : IPSMember::processBanEntry( array( 'unit' => $mq_unit, 'timespan' => $mq ) ) );
|
||||
}
|
||||
if ( $rpa )
|
||||
{
|
||||
$update['restrict_post'] = ( $rpa == -1 ? 1 : IPSMember::processBanEntry( array( 'unit' => $rpa_unit, 'timespan' => $rpa ) ) );
|
||||
}
|
||||
if ( $suspend )
|
||||
{
|
||||
if ( $suspend == -1 )
|
||||
{
|
||||
$update['member_banned'] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$update['temp_ban'] = IPSMember::processBanEntry( array( 'unit' => $suspend_unit, 'timespan' => $suspend ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $banGroup > 0 )
|
||||
{
|
||||
$update['member_group_id'] = $banGroup;
|
||||
}
|
||||
|
||||
if ( $this->settings['warnings_acknowledge'] )
|
||||
{
|
||||
$update['unacknowledged_warnings'] = 1;
|
||||
}
|
||||
|
||||
/* Save */
|
||||
if ( !empty( $update ) )
|
||||
{
|
||||
IPSMember::save( $this->_member['member_id'], array( 'core' => $update ) );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Work out where this warning came from
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $warning['wl_content_app'] and IPSLib::appIsInstalled( $warning['wl_content_app'] ) )
|
||||
{
|
||||
$file = IPSLib::getAppDir( $warning['wl_content_app'] ) . '/extensions/warnings.php';
|
||||
|
||||
if ( is_file( $file ) )
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( $file, 'warnings_' . $warning['wl_content_app'], $warning['wl_content_app'] );
|
||||
|
||||
if ( class_exists( $classToLoad ) and method_exists( $classToLoad, 'getContentUrl' ) )
|
||||
{
|
||||
$object = new $classToLoad();
|
||||
$content = $object->getContentUrl( $warning );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Send notifications
|
||||
//-----------------------------------------
|
||||
|
||||
/* Init */
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
|
||||
$notifyLibrary = new $classToLoad( $this->registry );
|
||||
|
||||
/* Send to member being warned */
|
||||
if ( $this->settings['warnings_acknowledge'] OR $noteForMember )
|
||||
{
|
||||
try
|
||||
{
|
||||
$notifyLibrary->setMember( $this->_member );
|
||||
$notifyLibrary->setFrom( $this->memberData );
|
||||
$notifyLibrary->setNotificationKey( 'warning' );
|
||||
$notifyLibrary->setNotificationUrl( "app=members&module=profile§ion=warnings&member={$this->_member['member_id']}" );
|
||||
$notifyLibrary->setNotificationTitle( sprintf( $this->lang->words['warnings_notify'], $this->registry->output->buildUrl( "app=members&module=profile§ion=warnings&member={$this->_member['member_id']}" ) ) );
|
||||
$notifyLibrary->setNotificationText( sprintf(
|
||||
$this->lang->words['warnings_notify_text'],
|
||||
$this->_member['members_display_name'],
|
||||
$this->memberData['members_display_name'],
|
||||
$reason ? $this->reasons[ $reason ]['wr_name'] : $this->lang->words['warnings_reasons_other'],
|
||||
$noteForMember ? sprintf( $this->lang->words['warnings_notify_member_note'], $noteForMember ) : '',
|
||||
$this->settings['warn_show_own'] ? sprintf( $this->lang->words['warnings_notify_view_link'], $this->registry->output->buildUrl( "app=members&module=profile§ion=warnings&member={$this->_member['member_id']}" ) ) : ''
|
||||
) );
|
||||
$notifyLibrary->sendNotification();
|
||||
}
|
||||
catch ( Exception $e ) {}
|
||||
}
|
||||
|
||||
/* And all mods that can warn and are super_mods (split this up because of: @link http://community.invisionpower.com/tracker/issue-36960-bad-warn-query/ */
|
||||
$mods = array();
|
||||
$mids = array();
|
||||
$gids = array();
|
||||
$canWarnMids = array();
|
||||
$canWarnGids = array();
|
||||
|
||||
$this->DB->build( array( 'select' => 'member_id, allow_warn',
|
||||
'from' => 'moderators',
|
||||
'where' => 'is_group=0' ) );
|
||||
|
||||
$this->DB->execute();
|
||||
while ( $row = $this->DB->fetch() )
|
||||
{
|
||||
$mids[ $row['member_id'] ] = $row['member_id'];
|
||||
|
||||
if ( $row['allow_warn'] )
|
||||
{
|
||||
$canWarnMids[] = $row['member_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->DB->build( array( 'select' => 'group_id',
|
||||
'from' => 'moderators',
|
||||
'where' => 'is_group=1 AND allow_warn=1' ) );
|
||||
|
||||
$this->DB->execute();
|
||||
while ( $row = $this->DB->fetch() )
|
||||
{
|
||||
$gids[] = $row['group_id'];
|
||||
$canWarnGids[] = $row['group_id'];
|
||||
}
|
||||
|
||||
foreach( $this->caches['group_cache'] as $id => $row )
|
||||
{
|
||||
if ( $row['g_is_supmod'] )
|
||||
{
|
||||
$gids[] = $row['g_id'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Limit this because it could go a bit wrong innit */
|
||||
if ( count( $gids ) )
|
||||
{
|
||||
$this->DB->build( array( 'select' => 'member_id',
|
||||
'from' => 'members',
|
||||
'where' => 'member_group_id IN (' . implode( ',', $gids ) . ')',
|
||||
'limit' => array( 0, 750 ) ) );
|
||||
|
||||
$this->DB->execute();
|
||||
while ( $row = $this->DB->fetch() )
|
||||
{
|
||||
$mids[ $row['member_id'] ] = $row['member_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$_mods = IPSMember::load( $mids, 'all' );
|
||||
|
||||
if ( count( $_mods ) )
|
||||
{
|
||||
foreach( $_mods as $id => $row )
|
||||
{
|
||||
if ( $row['member_id'] == $this->memberData['member_id'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $row['g_is_supmod'] OR ( in_array( $row['member_id'], $canWarnMids ) ) OR ( in_array( $row['member_group_id'], $canWarnGids ) ) )
|
||||
{
|
||||
$mods[ $row['member_id'] ] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $mods ) )
|
||||
{
|
||||
$notifyLibrary = new $classToLoad( $this->registry );
|
||||
$notifyLibrary->setMultipleRecipients( $mods );
|
||||
$notifyLibrary->setFrom( $this->memberData );
|
||||
$notifyLibrary->setNotificationKey( 'warning_mods' );
|
||||
$notifyLibrary->setNotificationUrl( "app=members&module=profile§ion=warnings&member={$this->_member['member_id']}" );
|
||||
$notifyLibrary->setNotificationTitle( sprintf(
|
||||
$this->lang->words['warnings_notify_mod'],
|
||||
$this->_member['members_display_name'],
|
||||
$this->registry->output->buildUrl( "app=members&module=profile§ion=warnings&member={$this->_member['member_id']}" ),
|
||||
$this->memberData['members_display_name']
|
||||
) );
|
||||
$notifyLibrary->setNotificationText( sprintf(
|
||||
$this->lang->words['warnings_notify_text_mod'],
|
||||
$this->_member['members_display_name'],
|
||||
$this->memberData['members_display_name'],
|
||||
$this->registry->output->buildUrl( "app=members&module=profile§ion=warnings&member={$this->_member['member_id']}" )
|
||||
) );
|
||||
|
||||
try
|
||||
{
|
||||
$notifyLibrary->sendNotification();
|
||||
} catch ( Exception $e ) { }
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Boink
|
||||
//-----------------------------------------
|
||||
|
||||
if ( empty( $content['url'] ) )
|
||||
{
|
||||
$this->registry->getClass('output')->redirectScreen( $this->lang->words['warnings_done'] , $this->settings['base_url'] . 'app=members&module=profile&section=warnings&member=' . $this->_member['member_id'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->getClass('output')->redirectScreen( $this->lang->words['warnings_done'] , $content['url'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show Form: Acknowledge
|
||||
*/
|
||||
public function acknowledge()
|
||||
{
|
||||
$id = intval( $this->request['id'] );
|
||||
$warning = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'members_warn_logs', 'where' => "wl_id={$id}" ) );
|
||||
if ( !$warning['wl_id'] or $warning['wl_member'] != $this->memberData['member_id'] )
|
||||
{
|
||||
$this->registry->output->showError( 'no_permission', 10264, null, null, 403 );
|
||||
}
|
||||
|
||||
$warning['wl_moderator'] = IPSMember::load( $warning['wl_moderator'] );
|
||||
$warning['wl_reason'] = $this->reasons[ $warning['wl_reason'] ];
|
||||
|
||||
$warning['content'] = NULL;
|
||||
|
||||
if ( $warning['wl_content_app'] and IPSLib::appIsInstalled( $warning['wl_content_app'] ) )
|
||||
{
|
||||
$file = IPSLib::getAppDir( $warning['wl_content_app'] ) . '/extensions/warnings.php';
|
||||
|
||||
if ( is_file( $file ) )
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( $file, 'warnings_' . $warning['wl_content_app'], $warning['wl_content_app'] );
|
||||
|
||||
if ( class_exists( $classToLoad ) and method_exists( $classToLoad, 'getContentUrl' ) )
|
||||
{
|
||||
$object = new $classToLoad();
|
||||
$content = $object->getContentUrl( $warning );
|
||||
|
||||
if ( !is_null( $content ) )
|
||||
{
|
||||
$warning['content'] = "<a href='{$content['url']}'>{$content['title']}</a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->registry->output->addContent( $this->registry->output->getTemplate('profile')->acknowledgeWarning( $warning ) );
|
||||
$this->registry->output->setTitle( $this->lang->words['warnings_acknowledge'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Action: Acknowledge
|
||||
*/
|
||||
public function doAcknowledge()
|
||||
{
|
||||
$id = intval( $this->request['id'] );
|
||||
$warning = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'members_warn_logs', 'where' => "wl_id={$id}" ) );
|
||||
if ( !$warning['wl_id'] or $warning['wl_member'] != $this->_member['member_id'] or $this->request['secure_key'] != $this->member->form_hash )
|
||||
{
|
||||
$this->registry->output->showError( 'no_permission', 10264, null, null, 403 );
|
||||
}
|
||||
|
||||
$this->DB->update( 'members_warn_logs', array( 'wl_acknowledged' => 1 ), "wl_id={$warning['wl_id']}" );
|
||||
|
||||
$count = array( 'count' => 0 );
|
||||
if ( $this->settings['warnings_acknowledge'] )
|
||||
{
|
||||
$count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count', 'from' => 'members_warn_logs', 'where' => "wl_member={$this->_member['member_id']} AND wl_acknowledged=0" ) );
|
||||
}
|
||||
if ( !$count['count'] and $this->memberData['unacknowledged_warnings'] )
|
||||
{
|
||||
IPSMember::save( $this->_member['member_id'], array( 'core' => array( 'unacknowledged_warnings' => 0 ) ) );
|
||||
}
|
||||
|
||||
if ( $this->request['ref'] )
|
||||
{
|
||||
$this->registry->output->silentRedirect( $this->request['ref'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['warnings_acknowledged'], $this->settings['board_url'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user