Version 3.2.3
This commit is contained in:
1 parent
ae5c01cc78
commit
78706903a2
2641 files changed
+228363
-201264
No files matched your search
@@ -3,19 +3,19 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Custom fields library
|
||||
* Last Updated: $Date: 2010-09-15 19:24:25 -0400 (Wed, 15 Sep 2010) $
|
||||
* Last Updated: $Date: 2011-05-07 17:35:35 -0400 (Sat, 07 May 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @author $Author: rtissier $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Kernel
|
||||
* @link http://www.invisionpower.com
|
||||
* @link http://hatynka.in
|
||||
* @since Thursday 8th May 2008 10:31
|
||||
* @version $Revision: 464 $
|
||||
* @version $Revision: 8670 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -24,57 +24,50 @@ abstract class customFieldPlugin
|
||||
/**
|
||||
* Custom field name
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
**/
|
||||
*/
|
||||
public $name = '';
|
||||
|
||||
/**
|
||||
* Custom field title
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
**/
|
||||
*/
|
||||
public $title = '';
|
||||
|
||||
/**
|
||||
* Custom field id
|
||||
*
|
||||
* @access public
|
||||
* @var integer
|
||||
**/
|
||||
*/
|
||||
public $id = 0;
|
||||
|
||||
/**
|
||||
* Custom field attributes
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
**/
|
||||
*/
|
||||
public $attributes = array();
|
||||
|
||||
/**
|
||||
* Custom field value
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
**/
|
||||
*/
|
||||
public $raw_data = array();
|
||||
|
||||
/**
|
||||
* Custom field mode
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
**/
|
||||
*/
|
||||
public $mode = '';
|
||||
|
||||
/**
|
||||
* Allows you to treat a custom field type as a string
|
||||
*
|
||||
* @access public
|
||||
* @return string Current value of $this->parsed
|
||||
**/
|
||||
*/
|
||||
public function __tostring()
|
||||
{
|
||||
return $this->getValue();
|
||||
@@ -83,14 +76,13 @@ abstract class customFieldPlugin
|
||||
/**
|
||||
* Gets the value of the field
|
||||
*
|
||||
* @access public
|
||||
* @return string Current value of $this->parsed
|
||||
**/
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
if( is_array( $this->parsed ) )
|
||||
{
|
||||
return implode( ",", $this->parsed );
|
||||
return implode( ", ", $this->parsed );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -101,9 +93,8 @@ abstract class customFieldPlugin
|
||||
/**
|
||||
* Creates an attribute string from an array
|
||||
*
|
||||
* @access protected
|
||||
* @return string
|
||||
**/
|
||||
*/
|
||||
protected function _compileAttributes()
|
||||
{
|
||||
$_attributes = '';
|
||||
@@ -122,10 +113,9 @@ abstract class customFieldPlugin
|
||||
/**
|
||||
* Removes harmful html from display
|
||||
*
|
||||
* @access protected
|
||||
* @var string String to make safe
|
||||
* @return string
|
||||
**/
|
||||
*/
|
||||
protected function makeSafeForView( $t )
|
||||
{
|
||||
$t = htmlspecialchars( $t, ENT_QUOTES );
|
||||
@@ -138,10 +128,9 @@ abstract class customFieldPlugin
|
||||
/**
|
||||
* Format value for display in a form field
|
||||
*
|
||||
* @access protected
|
||||
* @var string String to make safe
|
||||
* @return string
|
||||
**/
|
||||
*/
|
||||
protected function makeSafeForForm( $t )
|
||||
{
|
||||
return str_replace( "'", "'", $t );
|
||||
@@ -151,64 +140,58 @@ abstract class customFieldPlugin
|
||||
/**
|
||||
* Interface for custom fields
|
||||
*
|
||||
**/
|
||||
*/
|
||||
interface interfaceCustomFieldPlugin
|
||||
{
|
||||
/**
|
||||
* Editing a custom field
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function edit();
|
||||
|
||||
/**
|
||||
* Viewing a custom field
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function view();
|
||||
}
|
||||
|
||||
/**
|
||||
* Text input custom fields
|
||||
*
|
||||
**/
|
||||
*/
|
||||
class customFieldText extends customFieldPlugin implements interfaceCustomFieldPlugin
|
||||
{
|
||||
/**
|
||||
* Plugin type
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
**/
|
||||
*/
|
||||
public $plugin_type = '';
|
||||
|
||||
/**
|
||||
* Value
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
**/
|
||||
*/
|
||||
public $value = '';
|
||||
|
||||
/**
|
||||
* Parsed value
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
**/
|
||||
*/
|
||||
public $parsed = '';
|
||||
|
||||
/**
|
||||
* CONSTRUCTOR
|
||||
*
|
||||
* @access public
|
||||
* @param array $field Array of field data { id, data, value, class }
|
||||
* @param string $mode Set to 'view' or 'edit'
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct( $field, $mode )
|
||||
{
|
||||
/* INI */
|
||||
@@ -234,9 +217,8 @@ class customFieldText extends customFieldPlugin implements interfaceCustomFieldP
|
||||
/**
|
||||
* edit a field
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
/* Attributes */
|
||||
@@ -258,9 +240,8 @@ class customFieldText extends customFieldPlugin implements interfaceCustomFieldP
|
||||
/**
|
||||
* view a field
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function view()
|
||||
{
|
||||
/* Make Safe */
|
||||
@@ -272,49 +253,44 @@ class customFieldText extends customFieldPlugin implements interfaceCustomFieldP
|
||||
/**
|
||||
* Check boxes button custom fields
|
||||
*
|
||||
**/
|
||||
*/
|
||||
class customFieldCbox extends customFieldPlugin implements interfaceCustomFieldPlugin
|
||||
{
|
||||
/**
|
||||
* Plugin type
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
**/
|
||||
*/
|
||||
public $plugin_type = 'radio';
|
||||
|
||||
/**
|
||||
* Value
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
**/
|
||||
*/
|
||||
public $value = '';
|
||||
|
||||
/**
|
||||
* Parsed value
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
**/
|
||||
*/
|
||||
public $parsed = '';
|
||||
|
||||
/**
|
||||
* Data
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
**/
|
||||
*/
|
||||
public $data = '';
|
||||
|
||||
/**
|
||||
* CONSTRUCTOR
|
||||
*
|
||||
* @access public
|
||||
* @param array $field Array of field data { id, data, value, class }
|
||||
* @param string $mode Set to 'view' or 'edit'
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct( $field, $mode )
|
||||
{
|
||||
/* INI */
|
||||
@@ -340,9 +316,8 @@ class customFieldCbox extends customFieldPlugin implements interfaceCustomFieldP
|
||||
/**
|
||||
* edit a field
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
/* INI */
|
||||
@@ -351,7 +326,7 @@ class customFieldCbox extends customFieldPlugin implements interfaceCustomFieldP
|
||||
$_attributes = $this->_compileAttributes();
|
||||
|
||||
#The first checkbox gets shifted over to the right due to the <label>, so add a linebreak to make them line up
|
||||
$this->parsed .= "<br />";
|
||||
$this->parsed .= "<!--<br />-->";
|
||||
|
||||
/* Make Safe */
|
||||
foreach( $def_values as $k => $v )
|
||||
@@ -369,11 +344,11 @@ class customFieldCbox extends customFieldPlugin implements interfaceCustomFieldP
|
||||
|
||||
if( count( $def_values ) && in_array( $ov, $def_values ) )
|
||||
{
|
||||
$this->parsed .= "<p><input type='checkbox' class='input_check' id='{$this->name}_{$ov}' name='{$this->name}[$ov]' value='1' checked='checked'{$_attributes}/> $td</p>\n";
|
||||
$this->parsed .= "<span class='f'><input type='checkbox' class='input_check' id='{$this->name}_{$ov}' name='{$this->name}[$ov]' value='1' checked='checked'{$_attributes}/> $td</span>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->parsed .= "<p><input type='checkbox' class='input_check' id='{$this->name}_{$ov}' name='{$this->name}[$ov]' value='1'{$_attributes}/> $td</p>\n";
|
||||
$this->parsed .= "<span class='f'><input type='checkbox' class='input_check' id='{$this->name}_{$ov}' name='{$this->name}[$ov]' value='1'{$_attributes}/> $td</span>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -381,9 +356,8 @@ class customFieldCbox extends customFieldPlugin implements interfaceCustomFieldP
|
||||
/**
|
||||
* view a field
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function view()
|
||||
{
|
||||
/* INI */
|
||||
@@ -412,49 +386,44 @@ class customFieldCbox extends customFieldPlugin implements interfaceCustomFieldP
|
||||
/**
|
||||
* Radio button custom fields
|
||||
*
|
||||
**/
|
||||
*/
|
||||
class customFieldRadio extends customFieldPlugin implements interfaceCustomFieldPlugin
|
||||
{
|
||||
/**
|
||||
* Plugin type
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
**/
|
||||
*/
|
||||
public $plugin_type = 'radio';
|
||||
|
||||
/**
|
||||
* Value
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
**/
|
||||
*/
|
||||
public $value = '';
|
||||
|
||||
/**
|
||||
* Parsed value
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
**/
|
||||
*/
|
||||
public $parsed = '';
|
||||
|
||||
/**
|
||||
* Data
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
**/
|
||||
*/
|
||||
public $data = '';
|
||||
|
||||
/**
|
||||
* CONSTRUCTOR
|
||||
*
|
||||
* @access public
|
||||
* @param array $field Array of field data { id, data, value, class }
|
||||
* @param string $mode Set to 'view' or 'edit'
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct( $field, $mode )
|
||||
{
|
||||
/* INI */
|
||||
@@ -480,9 +449,8 @@ class customFieldRadio extends customFieldPlugin implements interfaceCustomField
|
||||
/**
|
||||
* edit a field
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
/* Attributes */
|
||||
@@ -502,11 +470,11 @@ class customFieldRadio extends customFieldPlugin implements interfaceCustomField
|
||||
|
||||
if( $this->value == $ov and $this->value )
|
||||
{
|
||||
$this->parsed .= "<input type='radio' class='input_radio' id='{$this->name}_{$ov}' name='{$this->name}' value='$ov' checked='checked'{$_attributes}/> $td\n";
|
||||
$this->parsed .= "<span class='f'><input type='radio' class='input_radio' id='{$this->name}_{$ov}' name='{$this->name}' value='$ov' checked='checked'{$_attributes}/> $td</span>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->parsed .= "<input type='radio' class='input_radio' id='{$this->name}_{$ov}' name='{$this->name}' value='$ov'{$_attributes}/> $td\n";
|
||||
$this->parsed .= "<span class='f'><input type='radio' class='input_radio' id='{$this->name}_{$ov}' name='{$this->name}' value='$ov'{$_attributes}/> $td</span>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -514,9 +482,8 @@ class customFieldRadio extends customFieldPlugin implements interfaceCustomField
|
||||
/**
|
||||
* view a field
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function view()
|
||||
{
|
||||
/* INI */
|
||||
@@ -544,63 +511,57 @@ class customFieldRadio extends customFieldPlugin implements interfaceCustomField
|
||||
/**
|
||||
* Dropdown custom fields
|
||||
*
|
||||
**/
|
||||
*/
|
||||
class customFieldDrop extends customFieldPlugin implements interfaceCustomFieldPlugin
|
||||
{
|
||||
/**
|
||||
* Plugin type
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
**/
|
||||
*/
|
||||
public $plugin_type = 'drop';
|
||||
|
||||
/**
|
||||
* Value
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
**/
|
||||
*/
|
||||
public $value = '';
|
||||
|
||||
/**
|
||||
* Parsed value
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
**/
|
||||
*/
|
||||
public $parsed = '';
|
||||
|
||||
/**
|
||||
* Data
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
**/
|
||||
*/
|
||||
public $data = '';
|
||||
|
||||
/**
|
||||
* Allow multi-input
|
||||
*
|
||||
* @access private
|
||||
* @var boolean
|
||||
**/
|
||||
private $multi = false;
|
||||
*/
|
||||
protected $multi = false;
|
||||
|
||||
/**
|
||||
* CONSTRUCTOR
|
||||
*
|
||||
* @access public
|
||||
* @param array $field Array of field data { id, data, value, class }
|
||||
* @param string $mode Set to 'view' or 'edit'
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct( $field, $mode )
|
||||
{
|
||||
/* INI */
|
||||
$this->data = $field['data'];
|
||||
$this->value = $field['value'];
|
||||
$this->multi = ( isset( $field['multi'] ) && $field['multi'] == 1 ) ? 1 : 0;
|
||||
$this->multi = !empty( $field['multi'] ) ? 1 : 0;
|
||||
$this->name = $this->multi ? 'field_' . $field['id'] . '[]' : 'field_' . $field['id'];
|
||||
$this->id = $field['id'];
|
||||
$this->title = isset( $field['title'] ) ? $field['title'] : '';
|
||||
@@ -621,14 +582,13 @@ class customFieldDrop extends customFieldPlugin implements interfaceCustomFieldP
|
||||
/**
|
||||
* edit a field
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
/* INI */
|
||||
$carray = explode( '|', $this->data );
|
||||
$multi = ( isset( $this->multi ) && $this->multi ) ? " multiple='multiple'" : '';
|
||||
$multi = !empty( $this->multi ) ? " multiple='multiple'" : '';
|
||||
$def_values = ( is_array( $this->value ) ) ? $this->value : array( $this->value );
|
||||
$_attributes = $this->_compileAttributes();
|
||||
|
||||
@@ -665,9 +625,8 @@ class customFieldDrop extends customFieldPlugin implements interfaceCustomFieldP
|
||||
/**
|
||||
* view a field
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function view()
|
||||
{
|
||||
/* INI */
|
||||
@@ -695,49 +654,44 @@ class customFieldDrop extends customFieldPlugin implements interfaceCustomFieldP
|
||||
/**
|
||||
* Primary custom fields class
|
||||
*
|
||||
**/
|
||||
*/
|
||||
class classCustomFields
|
||||
{
|
||||
/**
|
||||
* List of fields
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
**/
|
||||
private $field_list = array();
|
||||
*/
|
||||
protected $field_list = array();
|
||||
|
||||
/**
|
||||
* Loaded plugins
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
**/
|
||||
*/
|
||||
public $loaded_plugins = array();
|
||||
|
||||
/**
|
||||
* Mode
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
**/
|
||||
private $mode = '';
|
||||
*/
|
||||
protected $mode = '';
|
||||
|
||||
/**
|
||||
* Custom Fields
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
**/
|
||||
*/
|
||||
public $cfields = array();
|
||||
|
||||
/**
|
||||
* CONSTRUCTOR
|
||||
*
|
||||
* @access public
|
||||
* @param array Field data
|
||||
* @param string Mode
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct( $field_data, $mode='view' )
|
||||
{
|
||||
/* Setup */
|
||||
@@ -759,9 +713,8 @@ class classCustomFields
|
||||
/**
|
||||
* Returns an array of supported field types
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
**/
|
||||
*/
|
||||
public function getFieldTypes()
|
||||
{
|
||||
return array(
|
||||
@@ -776,9 +729,8 @@ class classCustomFields
|
||||
/**
|
||||
* Returns an array of supported field search types
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
**/
|
||||
*/
|
||||
public function getFieldSearchTypes()
|
||||
{
|
||||
return array(
|
||||
@@ -790,10 +742,9 @@ class classCustomFields
|
||||
/**
|
||||
* Parses a submitted form for custom fields
|
||||
*
|
||||
* @access public
|
||||
* @param array Array of field data
|
||||
* @return array ( 'save_array', 'errors' )
|
||||
**/
|
||||
*/
|
||||
public function getFieldsToSave( $input_array )
|
||||
{
|
||||
/* INI */
|
||||
@@ -868,12 +819,11 @@ class classCustomFields
|
||||
/**
|
||||
* Parsed a field for display
|
||||
*
|
||||
* @access private
|
||||
* @param array $field Array of field data
|
||||
* @param string [$mode] View/Edit, or blank for class default
|
||||
* @return object
|
||||
**/
|
||||
private function parseField( $field, $mode='' )
|
||||
*/
|
||||
protected function parseField( $field, $mode='' )
|
||||
{
|
||||
/* INI */
|
||||
$mode = ( $mode ) ? $mode : $this->mode;
|
||||
@@ -892,10 +842,9 @@ class classCustomFields
|
||||
/**
|
||||
* Formats the content field for a textarea
|
||||
*
|
||||
* @access public
|
||||
* @param string Content to format
|
||||
* @return string
|
||||
**/
|
||||
*/
|
||||
public function formatContentForEdit( $c )
|
||||
{
|
||||
return str_replace( '|', "\n", $c );
|
||||
@@ -904,10 +853,9 @@ class classCustomFields
|
||||
/**
|
||||
* Formats the content field for saveing in the database
|
||||
*
|
||||
* @access public
|
||||
* @param string Content to format
|
||||
* @return string
|
||||
**/
|
||||
*/
|
||||
public function formatContentForSave( $c )
|
||||
{
|
||||
$c = str_replace( "\r" , "\n", $c );
|
||||
@@ -918,19 +866,37 @@ class classCustomFields
|
||||
/**
|
||||
* Foramts text for saving into the database
|
||||
*
|
||||
* @access public
|
||||
* @var string String to make safe
|
||||
* @return string
|
||||
**/
|
||||
private function formatTextToSave( $t )
|
||||
*/
|
||||
protected function formatTextToSave( $t )
|
||||
{
|
||||
$t = str_replace( "<br>" , "\n", $t );
|
||||
$t = str_replace( "<br />", "\n", $t );
|
||||
$t = str_replace( "'" , "'" , $t );
|
||||
|
||||
if ( @get_magic_quotes_gpc() )
|
||||
if( is_array( $t ) )
|
||||
{
|
||||
$t = stripslashes($t);
|
||||
foreach( $t as $k => $v )
|
||||
{
|
||||
$v = str_replace( "<br>" , "\n", $v );
|
||||
$v = str_replace( "<br />", "\n", $v );
|
||||
$v = str_replace( "'" , "'" , $v );
|
||||
|
||||
if ( @get_magic_quotes_gpc() )
|
||||
{
|
||||
$v = stripslashes($v);
|
||||
}
|
||||
|
||||
$t[ $k ] = $v;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$t = str_replace( "<br>" , "\n", $t );
|
||||
$t = str_replace( "<br />", "\n", $t );
|
||||
$t = str_replace( "'" , "'" , $t );
|
||||
|
||||
if ( @get_magic_quotes_gpc() )
|
||||
{
|
||||
$t = stripslashes($t);
|
||||
}
|
||||
}
|
||||
|
||||
return $t;
|
||||
|
||||
Reference in new issue
Block a user