Version 3.1.4

This commit is contained in:
Neo committed 2025-12-19 00:32:22 -08:00
1 parent 1d4720f3e2
commit ae5c01cc78
2563 files changed
+283048 -240689

No files matched your search

@@ -1,18 +1,21 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.0.5
* IP.Board v3.1.4
* Allow user to change their status
* Last Updated: $Date: 2010-10-04 21:50:24 -0400 (Mon, 04 Oct 2010) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @license http://www.invisionpower.com/community/board/license.html
* @package IP.Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @link http://www.invisionpower.com
* @since Tuesday 1st March 2005 (11:52)
* @version $Revision: 4948 $
* @version $Revision: 6942 $
*
*/
@@ -45,26 +48,309 @@ class public_members_ajax_status extends ipsAjaxCommand
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( !$this->memberData['g_mem_info'] OR $this->memberData['gbw_no_status_update'] )
/* 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 'new':
$this->_new();
break;
case 'reply':
$this->_reply();
break;
case 'showall':
$this->_showAll();
break;
case 'deleteStatus':
$this->_deleteStatus();
break;
case 'deleteReply':
$this->_deleteReply();
break;
case 'lockStatus':
$this->_lockStatus();
break;
case 'unlockStatus':
$this->_unlockStatus();
break;
}
}
/**
* Add a reply statussesses
*
* @access protected
* @return void
*/
protected function _showAll()
{
/* INIT */
$status_id = intval( $this->request['status_id'] );
$st = intval( $this->request['st'] );
/* Quick check? */
if ( ! $status_id )
{
$this->returnJsonError( $this->lang->words['status_off'] );
}
/* Set Author */
$this->registry->getClass('memberStatus')->setAuthor( $this->memberData );
/* Set Data */
$this->registry->getClass('memberStatus')->setStatusData( $status_id );
/* And the number of replies */
$statusData = $this->registry->getClass('memberStatus')->getStatusData();
/* Fetch */
$this->returnJsonArray( array( 'status' => 'success', 'status_replies' => $statusData['status_replies'] + 1, 'html' => $this->cleanOutput( $this->registry->getClass('output')->getTemplate('profile')->statusReplies( $this->registry->getClass('memberStatus')->fetchAllReplies() ) ) ) );
}
/**
* Lock a status
*
* @access protected
* @return void
*/
protected function _lockStatus()
{
/* INIT */
$status_id = intval( $this->request['status_id'] );
/* Quick check? */
if ( ! $status_id )
{
$this->returnJsonError( $this->lang->words['status_off'] );
}
if( !$id )
{
/* 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->returnJsonError( $this->lang->words['status_off'] );
}
$newStatus = trim( IPSText::getTextClass('bbcode')->stripBadWords( IPSText::parseCleanValue( $_POST['new_status'] ) ) );
/* Update */
$this->registry->getClass('memberStatus')->lockStatus();
IPSMember::save( $id, array( 'extendedProfile' => array( 'pp_status' => $newStatus, 'pp_status_update' => time() ) ) );
/* Success? */
$this->returnJsonArray( array( 'status' => 'success' ) );
}
/**
* Lock a status
*
* @access protected
* @return void
*/
protected function _unlockStatus()
{
/* INIT */
$status_id = intval( $this->request['status_id'] );
/* Quick check? */
if ( ! $status_id )
{
$this->returnJsonError( $this->lang->words['status_off'] );
}
$this->returnJsonArray( array( 'status' => 'success', 'new_status' => $newStatus ) );
/* 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->returnJsonError( $this->lang->words['status_off'] );
}
/* Update */
$this->registry->getClass('memberStatus')->unlockStatus();
/* Success? */
$this->returnJsonArray( array( 'status' => 'success' ) );
}
/**
* Delete a status
*
* @access protected
* @return void
*/
protected function _deleteStatus()
{
/* INIT */
$status_id = intval( $this->request['status_id'] );
/* Quick check? */
if ( ! $status_id )
{
$this->returnJsonError( $this->lang->words['status_off'] );
}
/* 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')->canDeleteStatus() )
{
$this->returnJsonError( $this->lang->words['status_off'] );
}
/* Update */
$this->registry->getClass('memberStatus')->deleteStatus();
/* Success? */
$this->returnJsonArray( array( 'status' => 'success' ) );
}
/**
* Delete a status reply
*
* @access protected
* @return void
*/
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->returnJsonError( $this->lang->words['status_off'] );
}
/* 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->returnJsonError( $this->lang->words['status_off'] );
}
/* Update */
$this->registry->getClass('memberStatus')->deleteReply();
/* Success? */
$this->returnJsonArray( array( 'status' => 'success' ) );
}
/**
* Add a reply statussesses
*
* @access protected
* @return void
*/
protected function _reply()
{
/* INIT */
$status_id = intval( $this->request['status_id'] );
$comment = $this->convertAndMakeSafe( $_POST['content'] );
$id = intval( $this->request['id'] );
/* Quick check? */
if ( ! $status_id OR ! $comment )
{
$this->returnJsonError( $this->lang->words['status_no_reply'] );
}
/* 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->returnJsonError( $this->lang->words['status_no_reply'] );
}
/* Update */
$this->registry->getClass('memberStatus')->reply();
/* Now grab the reply and return it */
$reply = $this->registry->getClass('output')->getTemplate('profile')->statusReplies( $this->registry->getClass('memberStatus')->fetchAllReplies( $status_id, array( 'sort_dir' => 'desc', 'limit' => 1 ) ) );
/* And the number of replies */
$statusData = $this->registry->getClass('memberStatus')->getStatusData();
$this->returnJsonArray( array( 'status' => 'success', 'html' => $this->cleanOutput( $reply ), 'status_replies' => $statusData['status_replies'] + 1 ) );
}
/**
* Add a new statussesses
*
* @access protected
* @return void
*/
protected function _new()
{
IPSDebug::fireBug( 'info', array( 'Status content: ' . $_POST['content'] ) );
IPSDebug::fireBug( 'info', array( 'Cleaned status: ' . trim( $this->convertAndMakeSafe( $_POST['content'] ) ) ) );
/* INIT */
$smallSpace = intval( $this->request['smallSpace'] );
$su_Twitter = intval( $this->request['su_Twitter'] );
$su_Facebook = intval( $this->request['su_Facebook'] );
/* Got content? */
if( !trim( $this->convertAndMakeSafe( str_replace( array( '&nbsp;', '&#160;' ), '', $_POST['content'] ) ) ) )
{
$this->returnJsonError( $this->lang->words['no_status_sent'] );
}
/* Set Author */
$this->registry->getClass('memberStatus')->setAuthor( $this->memberData );
/* Set Content */
$this->registry->getClass('memberStatus')->setContent( trim( $this->convertAndMakeSafe( $_POST['content'] ) ) );
/* Set post outs */
$this->registry->getClass('memberStatus')->setExternalUpdates( array( 'twitter' => $su_Twitter, 'facebook' => $su_Facebook ) );
/* Can we reply? */
if ( ! $this->registry->getClass('memberStatus')->canCreate() )
{
$this->returnJsonError( $this->lang->words['status_off'] );
}
/* Update */
$newStatus = $this->registry->getClass('memberStatus')->create();
/* Now grab the reply and return it */
$new = $this->registry->getClass('output')->getTemplate('profile')->statusUpdates( $this->registry->getClass('memberStatus')->fetch( $this->memberData['member_id'], array( 'member_id' => $this->memberData['member_id'], 'sort_dir' => 'desc', 'limit' => 1 ) ), $smallSpace );
$this->returnJsonArray( array( 'status' => 'success', 'html' => $this->cleanOutput( $new ) ) );
exit;
}