Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -12,7 +12,7 @@
|
||||
namespace IPS\nexus\Package;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -132,7 +132,7 @@ class _CustomField extends \IPS\CustomField
|
||||
public function form( &$form )
|
||||
{
|
||||
parent::form( $form );
|
||||
|
||||
|
||||
$packages = array();
|
||||
foreach ( array_filter( explode( ',', $this->packages ) ) as $id )
|
||||
{
|
||||
@@ -146,7 +146,7 @@ class _CustomField extends \IPS\CustomField
|
||||
{
|
||||
return !( $node instanceof \IPS\nexus\Package\Group );
|
||||
} ) ), 'pf_desc' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'cf_sticky', $this->sticky, FALSE, array(), NULL, NULL, NULL, 'cf_sticky' ), 'pf_type' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'cf_sticky', $this->sticky ?: FALSE, FALSE, array(), NULL, NULL, NULL, 'cf_sticky' ), 'pf_type' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'cf_allow_attachments', $this->id ? $this->allow_attachments : 1, FALSE, array( ), NULL, NULL, NULL, 'pf_allow_attachments' ) );
|
||||
|
||||
$form->addHeader( 'display_settings' );
|
||||
@@ -174,7 +174,7 @@ class _CustomField extends \IPS\CustomField
|
||||
*/
|
||||
public function formatFormValues( $values )
|
||||
{
|
||||
if( isset( $values['cf_packages'] ) AND is_array( $values['cf_packages'] ) )
|
||||
if( isset( $values['cf_packages'] ) AND \is_array( $values['cf_packages'] ) )
|
||||
{
|
||||
$values['packages'] = implode( ',', array_map( function( $node ){ return $node->id; }, $values['cf_packages'] ) );
|
||||
unset( $values['cf_packages'] );
|
||||
@@ -197,17 +197,22 @@ class _CustomField extends \IPS\CustomField
|
||||
*
|
||||
* @param mixed $value The value
|
||||
* @param callback $customValidationCode Custom validation code
|
||||
* @param \IPS\Content|NULL $content The associated content, if editing
|
||||
* @return \IPS\Helpers\Form\FormAbstract
|
||||
*/
|
||||
public function buildHelper( $value=NULL, $customValidationCode=NULL )
|
||||
public function buildHelper( $value=NULL, $customValidationCode=NULL, \IPS\Content $content = NULL )
|
||||
{
|
||||
if ( $this->type === 'UserPass' )
|
||||
{
|
||||
$class = 'IPS\nexus\Form\\' . $this->type;
|
||||
return new $class( static::$langKey . '_' . $this->id, $value, $this->not_null, array(), NULL, NULL, NULL, static::$langKey . '_' . $this->id );
|
||||
}
|
||||
elseif ( $this->type === 'Ftp' )
|
||||
{
|
||||
return new \IPS\Helpers\Form\Ftp( static::$langKey . '_' . $this->id, $value, $this->not_null, array( 'validate' => $this->validate ), NULL, NULL, NULL, static::$langKey . '_' . $this->id );
|
||||
}
|
||||
|
||||
return parent::buildHelper( $value, $customValidationCode );
|
||||
return parent::buildHelper( $value, $customValidationCode, $content );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -221,7 +226,7 @@ class _CustomField extends \IPS\CustomField
|
||||
{
|
||||
if ( $this->type === 'UserPass' )
|
||||
{
|
||||
if ( !is_array( $value ) )
|
||||
if ( !\is_array( $value ) )
|
||||
{
|
||||
$value = json_decode( \IPS\Text\Encrypt::fromTag( $value )->decrypt(), TRUE );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user