Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Editor class for Form Builder
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 5 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Helpers\Form;
|
||||
@@ -45,6 +44,7 @@ class _Editor extends FormAbstract
|
||||
'minimizeWithContent'=> FALSE, // If TRUE, the editor will be minimized even if there is default content
|
||||
'maxLength' => FALSE, // The maximum length. Note that the content is HTML, so this isn't the maximum number of visible characters, so should only be used for database limits. The database's max allowed packet will override if smaller
|
||||
'editorId' => NULL, // Passed to editorAttachments. Only necessary if the name may be changed
|
||||
'allowAttachments => TRUE, // Should the editor show upload options?
|
||||
);
|
||||
* @endcode
|
||||
*/
|
||||
@@ -63,6 +63,7 @@ class _Editor extends FormAbstract
|
||||
'minimizeWithContent' => FALSE,
|
||||
'maxLength' => 16777215, // The default for MEDIUMTEXT */
|
||||
'editorId' => NULL,
|
||||
'allowAttachments' => TRUE,
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -84,7 +85,7 @@ class _Editor extends FormAbstract
|
||||
* Constructor
|
||||
* Sets that the field is required if there is a minimum length and vice-versa
|
||||
*
|
||||
* @see \IPS\Helpers\Form\Abstract::__construct
|
||||
* @see \IPS\Helpers\Form\FormAbstract::__construct
|
||||
* @note $name and $htmlId must be different
|
||||
* @return void
|
||||
* @throws \OutOfBoundsException
|
||||
@@ -272,7 +273,7 @@ class _Editor extends FormAbstract
|
||||
/* Or if the user can't attach, just show a bar */
|
||||
else
|
||||
{
|
||||
$attachmentArea = \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->editorAttachmentsPlaceholder( $this->name, $this->postKey );
|
||||
$attachmentArea = \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->editorAttachmentsPlaceholder( $this->name, $this->postKey, $this->noUploaderError );
|
||||
}
|
||||
|
||||
/* Display */
|
||||
@@ -283,7 +284,7 @@ class _Editor extends FormAbstract
|
||||
/**
|
||||
* Convert the value to something that will look okay for the no-JS fallback
|
||||
*
|
||||
* @param string $value Valie
|
||||
* @param string $value Value
|
||||
* @return string
|
||||
*/
|
||||
public static function valueForNoJsFallback( $value )
|
||||
@@ -453,11 +454,16 @@ class _Editor extends FormAbstract
|
||||
return $canAttach;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Error message to display if we're not showing the uploader
|
||||
*/
|
||||
protected $noUploaderError = NULL;
|
||||
|
||||
/**
|
||||
* Get uploader
|
||||
*
|
||||
* @param string $name Form name
|
||||
* @return \IPS\Helpers\Form\Uploader
|
||||
* @return \IPS\Helpers\Form\Upload|NULL
|
||||
*/
|
||||
protected function getUploader( $name )
|
||||
{
|
||||
@@ -477,7 +483,7 @@ class _Editor extends FormAbstract
|
||||
$file->attachmentThumbnailUrl = $attachment['attach_thumb_location'] ? \IPS\File::get( 'core_Attachment', $attachment['attach_thumb_location'] )->url : $file->url;
|
||||
|
||||
/* Reset the original filename based on the attachment record as filenames can be renamed if they contain special characters as AWS being the lowest common denominator cannot
|
||||
handle special characters. @link https://community.invisionpower.com/4bugtrack/active-reports/408-wrong-name-for-uploaded-files-in-editor-r6519/ */
|
||||
handle special characters */
|
||||
$file->originalFilename = $attachment['attach_file'];
|
||||
|
||||
$existing[ $attachment['attach_id'] ] = $file;
|
||||
@@ -489,11 +495,21 @@ class _Editor extends FormAbstract
|
||||
$maxTotalSize = array();
|
||||
if ( \IPS\Member::loggedIn()->group['g_attach_max'] > 0 and \IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
$maxTotalSize[] = ( ( \IPS\Member::loggedIn()->group['g_attach_max'] * 1024 ) - \IPS\Db::i()->select( 'SUM(attach_filesize)', 'core_attachments', array( 'attach_member_id=?', \IPS\Member::loggedIn()->member_id ) )->first() ) / 1048576;
|
||||
$globalSpaceRemaining = ( ( \IPS\Member::loggedIn()->group['g_attach_max'] * 1024 ) - \IPS\Db::i()->select( 'SUM(attach_filesize)', 'core_attachments', array( 'attach_member_id=?', \IPS\Member::loggedIn()->member_id ) )->first() ) / 1048576;
|
||||
$maxTotalSize[] = $globalSpaceRemaining;
|
||||
if ( $globalSpaceRemaining <= 0 )
|
||||
{
|
||||
$this->noUploaderError = 'editor_used_global_space';
|
||||
}
|
||||
}
|
||||
if ( \IPS\Member::loggedIn()->group['g_attach_per_post'] )
|
||||
{
|
||||
$maxTotalSize[] = \IPS\Member::loggedIn()->group['g_attach_per_post'] / 1024;
|
||||
$perPostSpaceRemaining = \IPS\Member::loggedIn()->group['g_attach_per_post'] / 1024;
|
||||
$maxTotalSize[] = $perPostSpaceRemaining;
|
||||
if ( $perPostSpaceRemaining <= 0 )
|
||||
{
|
||||
$this->noUploaderError = 'editor_used_post_space';
|
||||
}
|
||||
}
|
||||
$maxTotalSize = count( $maxTotalSize ) ? min( $maxTotalSize ) : NULL;
|
||||
|
||||
@@ -544,7 +560,9 @@ class _Editor extends FormAbstract
|
||||
$options['image'] = TRUE;
|
||||
}
|
||||
|
||||
$uploader = new \IPS\Helpers\Form\Upload( str_replace( array( '[', ']' ), '_', $name ) . '_upload', $existing, FALSE, $options );
|
||||
$uploaderName = str_replace( array( '[', ']' ), '_', $name ) . '_upload';
|
||||
unset( \IPS\Request::i()->$uploaderName ); // We are setting the value here, so we don't want the normal form helper to overload, which will wipe out any attachments if there is an error elsewhere in the form
|
||||
$uploader = new \IPS\Helpers\Form\Upload( $uploaderName, $existing, FALSE, $options );
|
||||
$uploader->template = array( \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' ), 'editorAttachments' );
|
||||
|
||||
/* Handle delete calls */
|
||||
@@ -707,6 +725,8 @@ class _Editor extends FormAbstract
|
||||
|
||||
/**
|
||||
* Bypass the Profanity Check
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function bypassFilterProfanity()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user