Version 3.1.4
This commit is contained in:
1 parent
1d4720f3e2
commit
ae5c01cc78
2563 files changed
+283048
-240689
No files matched your search
@@ -1,15 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* IP.Board v3.1.4
|
||||
* Custom Profile Fields
|
||||
* Last Updated: $Date: 2009-11-13 19:55:00 -0500 (Fri, 13 Nov 2009) $
|
||||
* Last Updated: $Date: 2010-09-27 18:18:35 -0400 (Mon, 27 Sep 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 5405 $
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 6917 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -24,7 +27,6 @@ class customProfileFields
|
||||
/**
|
||||
* Member ID
|
||||
*
|
||||
* @access public
|
||||
* @var int
|
||||
*/
|
||||
public $member_id = 0;
|
||||
@@ -32,7 +34,6 @@ class customProfileFields
|
||||
/**
|
||||
* Member ID
|
||||
*
|
||||
* @access public
|
||||
* @var int
|
||||
*/
|
||||
public $mem_data_id = 0;
|
||||
@@ -40,7 +41,6 @@ class customProfileFields
|
||||
/**
|
||||
* Array of incoming data
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $in_fields = array();
|
||||
@@ -48,7 +48,6 @@ class customProfileFields
|
||||
/**
|
||||
* Final/parsed data
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $out_fields = array();
|
||||
@@ -56,7 +55,6 @@ class customProfileFields
|
||||
/**
|
||||
* Chosen output data
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $out_chosen = array();
|
||||
@@ -64,7 +62,6 @@ class customProfileFields
|
||||
/**
|
||||
* Member record
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $member_data = array();
|
||||
@@ -72,7 +69,6 @@ class customProfileFields
|
||||
/**
|
||||
* Field names
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $field_names = array();
|
||||
@@ -80,7 +76,6 @@ class customProfileFields
|
||||
/**
|
||||
* Field descriptions
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $field_desc = array();
|
||||
@@ -88,7 +83,6 @@ class customProfileFields
|
||||
/**
|
||||
* Error fields
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $error_fields = array();
|
||||
@@ -96,7 +90,6 @@ class customProfileFields
|
||||
/**
|
||||
* Error messages
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $error_messages = array();
|
||||
@@ -104,7 +97,6 @@ class customProfileFields
|
||||
/**
|
||||
* What type of parse this is
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = '';
|
||||
@@ -112,7 +104,6 @@ class customProfileFields
|
||||
/**
|
||||
* Is an admin
|
||||
*
|
||||
* @access public
|
||||
* @var bool
|
||||
*/
|
||||
public $admin = false;
|
||||
@@ -120,7 +111,6 @@ class customProfileFields
|
||||
/**
|
||||
* Is an admin
|
||||
*
|
||||
* @access public
|
||||
* @var bool
|
||||
*/
|
||||
public $supmod = false;
|
||||
@@ -128,7 +118,6 @@ class customProfileFields
|
||||
/**
|
||||
* Initialized yet
|
||||
*
|
||||
* @access public
|
||||
* @var bool
|
||||
*/
|
||||
public $init = false;
|
||||
@@ -136,7 +125,6 @@ class customProfileFields
|
||||
/**
|
||||
* Cache data
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $cache_data = array();
|
||||
@@ -144,7 +132,6 @@ class customProfileFields
|
||||
/**
|
||||
* Custom fields library
|
||||
*
|
||||
* @access public
|
||||
* @var object
|
||||
*/
|
||||
public $cfields;
|
||||
@@ -152,7 +139,6 @@ class customProfileFields
|
||||
/**
|
||||
* Skin group to use for view parsing
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $skinGroup = '';
|
||||
@@ -160,24 +146,21 @@ class customProfileFields
|
||||
/**
|
||||
* Database handle
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $DB;
|
||||
protected $DB;
|
||||
|
||||
/**
|
||||
* Already added fields
|
||||
* Prevents MSSQL getting confused
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $_addedFields = array();
|
||||
protected $_addedFields = array();
|
||||
|
||||
/**
|
||||
* CONSTRUCTOR
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
@@ -195,7 +178,6 @@ class customProfileFields
|
||||
/**
|
||||
* Initializes cache, loads kernel class, and formats data for kernel class
|
||||
*
|
||||
* @access public
|
||||
* @param string $type Set to view for displaying the field normally or edit for displaying in a form
|
||||
* @param bool $mlist Whether this is the memberlist or not
|
||||
* @return void
|
||||
@@ -248,11 +230,11 @@ class customProfileFields
|
||||
|
||||
if( $mlist )
|
||||
{
|
||||
$this->in_fields[ $id ] = ipsRegistry::$request[ 'field_' . $id ];
|
||||
$this->in_fields[ $id ] = ( isset(ipsRegistry::$request[ 'field_' . $id ]) AND ipsRegistry::$request[ 'field_' . $id ] ) ? ipsRegistry::$request[ 'field_' . $id ] : '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->in_fields[ $id ] = isset( $this->member_data['field_'.$id] ) ? $this->member_data['field_' . $id] : ipsRegistry::$request[ 'field_' . $id ];
|
||||
$this->in_fields[ $id ] = isset( $this->member_data['field_'.$id] ) ? $this->member_data['field_' . $id] : ( isset(ipsRegistry::$request[ 'field_' . $id ]) ? ipsRegistry::$request[ 'field_' . $id ] : '' );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -279,10 +261,11 @@ class customProfileFields
|
||||
/* Field Restrictions */
|
||||
$this->cache_data[$k]['restrictions'] = array(
|
||||
|
||||
'max_size' => isset( $v['pf_max_input'] ) ? $v['pf_max_input'] : '',
|
||||
'min_size' => isset( $v['pf_min_input'] ) ? $v['pf_min_input'] : '',
|
||||
'not_null' => isset( $v['pf_not_null'] ) ? $v['pf_not_null'] : '',
|
||||
'format' => isset( $v['pf_input_format'] ) ? $v['pf_input_format'] : '',
|
||||
'max_size' => isset( $v['pf_max_input'] ) ? $v['pf_max_input'] : '',
|
||||
'min_size' => isset( $v['pf_min_input'] ) ? $v['pf_min_input'] : '',
|
||||
'not_null' => isset( $v['pf_not_null'] ) ? $v['pf_not_null'] : '',
|
||||
'format' => isset( $v['pf_input_format'] ) ? $v['pf_input_format'] : '',
|
||||
'urlfilter' => isset( $v['pf_filtering'] ) ? $v['pf_filtering'] : '',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -299,7 +282,6 @@ class customProfileFields
|
||||
/**
|
||||
* Parses fields for saving into the database, results are stored in $this->out_fields
|
||||
*
|
||||
* @access public
|
||||
* @param array $field_data Array that contains the fields to parse, usually $this->request
|
||||
* @return void
|
||||
*/
|
||||
@@ -315,7 +297,7 @@ class customProfileFields
|
||||
if( is_array( $this->error_fields ) && count( $this->error_fields ) )
|
||||
{
|
||||
/* Make sure error message texts are loaded */
|
||||
ipsRegistry::getClass( 'class_localization' )->loadLanguageFile( array( 'public_profile' ), 'members' );
|
||||
ipsRegistry::getClass( 'class_localization' )->loadLanguageFile( array( 'public_profile' ), 'members' );
|
||||
|
||||
foreach( $this->error_fields as $id => $err )
|
||||
{
|
||||
@@ -342,7 +324,7 @@ class customProfileFields
|
||||
/* Can we view this field? */
|
||||
if( ! $this->_checkFieldAuth( $field, $mode ) )
|
||||
{
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Now add any missing content fields */
|
||||
@@ -357,13 +339,34 @@ class customProfileFields
|
||||
}
|
||||
|
||||
$this->out_fields[ 'field_' . $id ] = IPSText::getTextClass( 'bbcode' )->stripBadWords( $save_fields['save_array']['field_' . $id] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Blacklisted urls
|
||||
// @link http://community.invisionpower.com/tracker/issue-7872-url-black-list-in-profile/
|
||||
//-----------------------------------------
|
||||
|
||||
if( $this->cache_data[$id]['restrictions']['urlfilter'] AND !IPSText::getTextClass( 'bbcode' )->checkBlacklistUrls( $save_fields['save_array']['field_' . $id] ) )
|
||||
{
|
||||
/* Make sure error message texts are loaded */
|
||||
ipsRegistry::getClass( 'class_localization' )->loadLanguageFile( array( 'public_profile' ), 'members' );
|
||||
|
||||
if( array_key_exists( 'field_' . $id, $this->error_messages ) )
|
||||
{
|
||||
$this->error_messages['field_' . $id] .= ', ' . ipsRegistry::getClass( 'class_localization' )->words['profile_field_error__blacklist'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error_messages['field_' . $id] = $this->cache_data[ $id ]['pf_title'] . ': ' . ipsRegistry::getClass( 'class_localization' )->words['profile_field_error__blacklist'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//print_r($this->error_messages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses fields for viewing, results are stored in $this->out_fields
|
||||
*
|
||||
* @access public
|
||||
* @param bool $check_topic_format Whether to apply topic formatting
|
||||
* @param string $location Location being called from
|
||||
* @return void
|
||||
@@ -446,7 +449,6 @@ class customProfileFields
|
||||
/**
|
||||
* Fetch group keys and titles
|
||||
*
|
||||
* @access public
|
||||
* @return array array( pf_group_key => pf_group_name )
|
||||
*/
|
||||
public function fetchGroupTitles()
|
||||
@@ -471,7 +473,6 @@ class customProfileFields
|
||||
/**
|
||||
* Parses fields for editing, results are stored in $this->out_fields
|
||||
*
|
||||
* @access public
|
||||
* @param string [$mode] register or normal, normal is default
|
||||
* @return void
|
||||
*/
|
||||
@@ -499,12 +500,11 @@ class customProfileFields
|
||||
/**
|
||||
* Checks to see if the field is viewable by the current user
|
||||
*
|
||||
* @access private
|
||||
* @param array $field Array of field data
|
||||
* @param string $mode Register, or blank
|
||||
* @return bool
|
||||
*/
|
||||
private function _checkFieldAuth( $field, $mode='normal' )
|
||||
protected function _checkFieldAuth( $field, $mode='normal' )
|
||||
{
|
||||
/* Admin / mod only? */
|
||||
if( $field->raw_data['pf_admin_only'] )
|
||||
@@ -521,11 +521,11 @@ class customProfileFields
|
||||
if ( $mode != 'register' AND ! $this->admin AND !$this->supmod )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Registering */
|
||||
if ( $mode == 'register' AND ! $field->raw_data['pf_show_on_reg'] )
|
||||
if ( $mode == 'register' AND ! $field->raw_data['pf_show_on_reg'] AND ! IN_ACP ) // Bug Fix #21163
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -557,8 +557,8 @@ class customProfileFields
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user