Version 4.7.23

This commit is contained in:
Neo committed 2025-12-19 16:21:27 -08:00
1 parent 7124a02564
commit 25ddeb65d6
1791 files changed
+76990 -44452

No files matched your search

+65 -2
View File
@@ -12,6 +12,9 @@
namespace IPS\downloads;
/* To prevent PHP errors (extending class does not exist) revealing path */
use IPS\Lang;
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
@@ -21,7 +24,7 @@ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Field Node
*/
class _Field extends \IPS\CustomField
class _Field extends \IPS\CustomField implements \IPS\Node\Permissions
{
/**
* @brief [ActiveRecord] Multiton Store
@@ -74,6 +77,30 @@ class _Field extends \IPS\CustomField
* @brief [CustomField] Set to TRUE if uploads fields are capable of holding the submitted content for moderation
*/
public static $uploadsCanBeModerated = TRUE;
/**
* @brief The map of permission columns
*/
public static $permissionMap = array(
'view' => 'view',
'edit' => 2,
'add' => 3
);
/**
* @brief [Node] App for permission index
*/
public static $permApp = 'downloads';
/**
* @brief [Node] Type for permission index
*/
public static $permType = 'fields';
/**
* @brief [Node] Prefix string that is automatically prepended to permission matrix language strings
*/
public static $permissionLangPrefix = 'perm_cfield_';
/**
* @brief [Node] ACP Restrictions
@@ -110,6 +137,17 @@ class _Field extends \IPS\CustomField
return $this->format;
}
/**
*
* [Node] Does the currently logged in user have permission to edit permissions for this node?
*
* @return bool
*/
public function canManagePermissions()
{
return true;
}
/**
* [Node] Add/Edit Form
*
@@ -120,8 +158,9 @@ class _Field extends \IPS\CustomField
{
parent::form( $form );
unset( $form->elements['']['pf_search_type'] );
unset( $form->elements['']['pf_search_type_on_off'] );
\IPS\Member::loggedIn()->language()->words['field_displayoptions'] = \IPS\Member::loggedIn()->language()->addToStack('pfield_displayoptions');
$form->add( new \IPS\Helpers\Form\Radio( 'downloads_field_location', $this->id ? $this->display_location : 'below', FALSE, array( 'options' => array( 'sidebar' => 'idm_cfield_sidebar', 'below' => 'idm_cfield_below', 'tab' => 'idm_cfield_tab' ) ), NULL, NULL, NULL, 'idm_field_location' ) );
@@ -166,4 +205,28 @@ class _Field extends \IPS\CustomField
return parent::formatFormValues( $values );
}
/**
* Get output for API
*
* @param \IPS\Member|NULL $authorizedMember The member making the API request or NULL for API Key / client_credentials
* @param array $fieldValues Current values for a specific file
* @return array
* @apiresponse int id ID number
* @apiresponse string name Name
* @apiresponse string description Description
* @apiresponse string value Raw field value from the database
* @apiresponse string|int|array|boolean displayValue Parsed Field value with all field data
*/
public function apiOutput( \IPS\Member $authorizedMember = NULL, $fieldValues=array() )
{
$lang = $authorizedMember ? $authorizedMember->language() : Lang::load( Lang::defaultLanguage() );
return [
'id' => $this->id,
'name' => $lang->addToStack( 'downloads_field_' . $this->id ),
'description' => $lang->addToStack( 'downloads_field_' . $this->id . '_desc' ),
'value' => $fieldValues[ 'field_' . $this->id ] ?? null,
'displayValue' => $this->apiValue( $fieldValues[ 'field_' . $this->id ] )
];
}
}