Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Custom Profile Field Node
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @since 11 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -18,13 +18,6 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
exit;
|
||||
}
|
||||
|
||||
const PROFILE = 0;
|
||||
const REG = 1;
|
||||
const STAFF = 2;
|
||||
const CONTENT = 3;
|
||||
const SEARCH = 4;
|
||||
|
||||
|
||||
/**
|
||||
* Custom Profile Field Node
|
||||
*/
|
||||
@@ -34,6 +27,15 @@ class _Field extends \IPS\CustomField
|
||||
* @brief [ActiveRecord] Multiton Store
|
||||
*/
|
||||
protected static $multitons;
|
||||
|
||||
/**
|
||||
* @brief Access level constants
|
||||
*/
|
||||
const PROFILE = 0;
|
||||
const REG = 1;
|
||||
const STAFF = 2;
|
||||
const CONTENT = 3;
|
||||
const SEARCH = 4;
|
||||
|
||||
/**
|
||||
* @brief [ActiveRecord] Database Table
|
||||
@@ -92,14 +94,14 @@ class _Field extends \IPS\CustomField
|
||||
/**
|
||||
* @brief [CustomField] FileStorage Extension for Upload fields
|
||||
*/
|
||||
public static $uploadStorageExtension = 'ProfileField';
|
||||
public static $uploadStorageExtension = 'core_ProfileField';
|
||||
|
||||
/**
|
||||
* Get field data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function fieldData()
|
||||
public static function fieldData()
|
||||
{
|
||||
if ( !isset( \IPS\Data\Store::i()->profileFields ) )
|
||||
{
|
||||
@@ -144,7 +146,7 @@ class _Field extends \IPS\CustomField
|
||||
* Get Fields
|
||||
*
|
||||
* @param array $values Current values
|
||||
* @param int $location \IPS\core\ProfileFields\PROFILE for profile, \IPS\core\ProfileFields\REG for registration screen or \IPS\core\ProfileFields\STAFF for ModCP/ACP
|
||||
* @param int $location \IPS\core\ProfileFields\Field::PROFILE for profile, \IPS\core\ProfileFields\Field::REG for registration screen or \IPS\core\ProfileFields\Field::STAFF for ModCP/ACP
|
||||
* @return array
|
||||
*/
|
||||
public static function fields( $values=array(), $location=0 )
|
||||
@@ -160,7 +162,8 @@ class _Field extends \IPS\CustomField
|
||||
{
|
||||
foreach ( $fields as $row )
|
||||
{
|
||||
if ( ( $row['pf_admin_only'] and $location !== STAFF ) or ( $location === REG and !$row['pf_show_on_reg'] ) or ( $location === PROFILE and !$row['pf_member_edit'] ) or ( $location === SEARCH and !$row['pf_search_type'] ) )
|
||||
|
||||
if ( ( $row['pf_admin_only'] and $location !== static::STAFF ) or ( $location === static::REG and !$row['pf_show_on_reg'] ) or ( $location === static::PROFILE and !$row['pf_member_edit'] ) or ( $location === static::SEARCH and ( !$row['pf_search_type'] or $row['pf_member_hide'] ) ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -177,7 +180,7 @@ class _Field extends \IPS\CustomField
|
||||
static::$editorOptions['attachIds'] = array( ( isset( \IPS\Request::i()->id ) ? \IPS\Request::i()->id : 0 ), $row['pf_id'] );
|
||||
}
|
||||
|
||||
if ( $location === STAFF )
|
||||
if ( $location === static::STAFF )
|
||||
{
|
||||
/* @link https://community.invisionpower.com/4bugtrack/active-reports/required-profile-fields-shouldnt-be-required-for-admins-r8058/ */
|
||||
$row['pf_not_null'] = 0;
|
||||
@@ -220,7 +223,7 @@ class _Field extends \IPS\CustomField
|
||||
* Get Values
|
||||
*
|
||||
* @param array $values Current values
|
||||
* @param int $location \IPS\core\ProfileFields\PROFILE for profile, \IPS\core\ProfileFields\REG for registration screen or \IPS\core\ProfileFields\STAFF for ModCP/ACP
|
||||
* @param int $location \IPS\core\ProfileFields\Field::PROFILE for profile, \IPS\core\ProfileFields\Field::REG for registration screen or \IPS\core\ProfileFields\Field::STAFF for ModCP/ACP
|
||||
* @return array
|
||||
*/
|
||||
public static function values( $values, $location=0 )
|
||||
@@ -230,18 +233,18 @@ class _Field extends \IPS\CustomField
|
||||
{
|
||||
foreach ( $fields as $row )
|
||||
{
|
||||
if ( $row['pf_admin_only'] and $location !== STAFF )
|
||||
if ( $row['pf_admin_only'] and $location !== static::STAFF )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $location == CONTENT and $row['pf_format'] != '' and isset( $values[ 'field_' . $row['pf_id'] ] ) )
|
||||
if ( $location == static::CONTENT and $row['pf_format'] != '' and isset( $values[ 'field_' . $row['pf_id'] ] ) and $row['pf_type'] != 'Poll' )
|
||||
{
|
||||
$row = static::constructFromData( $row );
|
||||
$value = $row->displayValue( $values[ 'field_' . $row->id ] );
|
||||
$value = $row->type == 'Url' ? (string) $values[ 'field_' . $row->id ] : $row->displayValue( $values[ 'field_' . $row->id ] );
|
||||
$return[ $row->group_id ][ $row->id ] = str_replace( array( '{title}', '{content}' ), array( \IPS\Member::loggedIn()->language()->addToStack( static::$langKey . '_' . $row->id ), $value ), $row->format );
|
||||
}
|
||||
else if ( $location !== CONTENT )
|
||||
else if ( $location !== static::CONTENT )
|
||||
{
|
||||
$return[ $groupId ][ static::$langKey . '_' . $row['pf_id'] ] = static::constructFromData( $row )->displayValue( $values[ 'field_' . $row['pf_id'] ] );
|
||||
}
|
||||
@@ -260,9 +263,7 @@ class _Field extends \IPS\CustomField
|
||||
public function form( &$form )
|
||||
{
|
||||
parent::form( $form );
|
||||
//$form->addHeader( 'pfield_displayoptions' );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'pf_search_type', $this->id ? $this->search_type : 'loose', FALSE, array( 'options' => array( 'exact' => 'pf_search_type_exact', 'loose' => 'pf_search_type_loose', '' => 'pf_search_type_none' ) ), NULL, NULL, NULL, 'pf_search_type' ) );
|
||||
$form->add( new \IPS\Helpers\Form\TextArea( 'pf_format', $this->id ? $this->format : '', FALSE, array( 'placeholder' => "<strong>{title}:</strong> {content}" ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\TextArea( 'pf_format', $this->id ? $this->format : '', FALSE, array( 'placeholder' => "<strong>{title}:</strong> {content}" ), NULL, NULL, NULL, 'pf_format' ) );
|
||||
$form->addheader( 'pfield_permissions' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'pf_admin_only', $this->id ? !$this->admin_only : TRUE, FALSE, array( 'togglesOn' => array( 'pf_show_on_reg', 'pf_member_edit', 'pf_member_hide' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'pf_show_on_reg', $this->id ? $this->show_on_reg : TRUE, FALSE, array(), NULL, NULL, NULL, 'pf_show_on_reg' ) );
|
||||
@@ -297,7 +298,12 @@ class _Field extends \IPS\CustomField
|
||||
{
|
||||
$values['pf_search_type'] = (string) $values['pf_search_type'];
|
||||
}
|
||||
|
||||
|
||||
if ( $values['pf_type'] == 'Poll' )
|
||||
{
|
||||
$values['pf_format'] = '';
|
||||
}
|
||||
|
||||
return parent::formatFormValues( $values );
|
||||
}
|
||||
|
||||
@@ -311,7 +317,7 @@ class _Field extends \IPS\CustomField
|
||||
if( $this->_new )
|
||||
{
|
||||
$return = parent::save();
|
||||
\IPS\Db::i()->addColumn( 'core_pfields_content', array( 'name' => "field_{$this->id}", 'type' => 'TEXT' ) );
|
||||
\IPS\Db::i()->addColumn( 'core_pfields_content', array( 'name' => "field_{$this->id}", 'type' => 'MEDIUMTEXT' ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -334,4 +340,11 @@ class _Field extends \IPS\CustomField
|
||||
\IPS\Db::i()->dropColumn( 'core_pfields_content', "field_{$this->id}" );
|
||||
unset( \IPS\Data\Store::i()->profileFields );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* This is only here for backwards compatibility */
|
||||
const PROFILE = _Field::PROFILE;
|
||||
const REG = _Field::REG;
|
||||
const STAFF = _Field::STAFF;
|
||||
const CONTENT = _Field::CONTENT;
|
||||
const SEARCH = _Field::SEARCH;
|
||||
Reference in new issue
Block a user