Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

+23 -16
View File
@@ -12,7 +12,7 @@
namespace IPS\cms\modules\admin\pages;
/* 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;
@@ -23,6 +23,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _media extends \IPS\Node\Controller
{
/**
* @brief Has been CSRF-protected
*/
public static $csrfProtected = TRUE;
/**
* Node Class
*/
@@ -75,15 +80,17 @@ class _media extends \IPS\Node\Controller
*/
public function deleteByFileIds()
{
\IPS\Session::i()->csrfCheck();
if ( isset( \IPS\Request::i()->fileIds ) )
{
$ids = \IPS\Request::i()->fileIds;
if ( ! is_array( $ids ) )
if ( ! \is_array( $ids ) )
{
$try = json_decode( $ids, TRUE );
if ( ! is_array( $try ) )
if ( ! \is_array( $try ) )
{
$ids = array( $ids );
}
@@ -93,7 +100,7 @@ class _media extends \IPS\Node\Controller
}
}
if ( count( $ids ) )
if ( \count( $ids ) )
{
\IPS\cms\Media::deleteByFileIds( $ids );
}
@@ -134,7 +141,7 @@ class _media extends \IPS\Node\Controller
}
if( \IPS\Request::i()->isAjax() ){
\IPS\Output::i()->sendOutput( json_encode( $rows ), 200, 'application/json', \IPS\Output::i()->httpHeaders );
\IPS\Output::i()->sendOutput( json_encode( $rows ), 200, 'application/json' );
}
return $data;
@@ -179,7 +186,7 @@ class _media extends \IPS\Node\Controller
}
if( \IPS\Request::i()->isAjax() ){
\IPS\Output::i()->sendOutput( json_encode( $rows ), 200, 'application/json', \IPS\Output::i()->httpHeaders );
\IPS\Output::i()->sendOutput( json_encode( $rows ), 200, 'application/json' );
}
return $rows;
@@ -195,7 +202,7 @@ class _media extends \IPS\Node\Controller
if( \IPS\Request::i()->isAjax() )
{
\IPS\Output::i()->sendOutput( $output, 200, 'text/html', \IPS\Output::i()->httpHeaders );
\IPS\Output::i()->sendOutput( $output, 200, 'text/html' );
}
else
{
@@ -228,7 +235,7 @@ class _media extends \IPS\Node\Controller
$form = new \IPS\Helpers\Form( 'form', 'upload' );
$form->class = 'ipsForm_vertical ipsForm_noLabels';
$form->add( new \IPS\Helpers\Form\Upload( 'media_filename', NULL, FALSE, array( 'allowedFileTypes' => array_merge( \IPS\File::$safeFileExtensions, array( 'pdf' ) ), 'obscure' => FALSE, 'maxFileSize' => 5, 'storageExtension' => 'cms_Media', 'storageContainer' => 'pages_media', 'multiple' => FALSE, 'minimize' => FALSE ), NULL, NULL, NULL, 'media_filename' ) );
$form->add( new \IPS\Helpers\Form\Upload( 'media_filename', NULL, FALSE, array( 'allowedFileTypes' => array_merge( \IPS\File::$safeFileExtensions, array( 'pdf' ) ), 'obscure' => FALSE, 'storageExtension' => 'cms_Media', 'storageContainer' => 'pages_media', 'multiple' => FALSE, 'minimize' => FALSE ), NULL, NULL, NULL, 'media_filename' ) );
if ( $values = $form->values() )
{
@@ -277,7 +284,7 @@ class _media extends \IPS\Node\Controller
}
}
\IPS\Output::i()->sendOutput( json_encode( array( 'fileID' => $media->id, 'folderID' => $media->parent, 'rows' => $rows ) ), 200, 'application/json', \IPS\Output::i()->httpHeaders );
\IPS\Output::i()->sendOutput( json_encode( array( 'fileID' => $media->id, 'folderID' => $media->parent, 'rows' => $rows ) ), 200, 'application/json' );
}
else
{
@@ -298,7 +305,7 @@ class _media extends \IPS\Node\Controller
$form = new \IPS\Helpers\Form( 'form', 'upload' );
$form->class = 'ipsForm_vertical ipsForm_noLabels';
$form->add( new \IPS\Helpers\Form\Upload( 'media_filename', NULL, FALSE, array( 'allowedFileTypes' => array_merge( \IPS\File::$safeFileExtensions, array( 'pdf', 'svg' ) ), 'obscure' => FALSE, 'maxFileSize' => 5, 'storageExtension' => 'cms_Media', 'storageContainer' => 'pages_media', 'multiple' => true, 'minimize' => FALSE ), NULL, NULL, NULL, 'media_filename' ) );
$form->add( new \IPS\Helpers\Form\Upload( 'media_filename', NULL, FALSE, array( 'allowedFileTypes' => array_merge( \IPS\File::$safeFileExtensions, array( 'pdf', 'svg' ) ), 'obscure' => FALSE, 'storageExtension' => 'cms_Media', 'storageContainer' => 'pages_media', 'multiple' => true, 'minimize' => FALSE ), NULL, NULL, NULL, 'media_filename' ) );
if ( ! isset( \IPS\Request::i()->media_parent ) and ! \IPS\Request::i()->media_parent )
{
@@ -380,7 +387,7 @@ class _media extends \IPS\Node\Controller
}
}
\IPS\Output::i()->sendOutput( json_encode( array( 'count' => $count, 'folderID' => $parent, 'rows' => $rows ) ), 200, 'application/json', \IPS\Output::i()->httpHeaders );
\IPS\Output::i()->sendOutput( json_encode( array( 'count' => $count, 'folderID' => $parent, 'rows' => $rows ) ), 200, 'application/json' );
}
else
{
@@ -412,7 +419,7 @@ class _media extends \IPS\Node\Controller
if( \IPS\Request::i()->isAjax() )
{
\IPS\Output::i()->sendOutput( json_encode( $rows ), 200, 'application/json', \IPS\Output::i()->httpHeaders );
\IPS\Output::i()->sendOutput( json_encode( $rows ), 200, 'application/json' );
}
else
{
@@ -453,13 +460,13 @@ class _media extends \IPS\Node\Controller
$output['dimensions'] = $dimensions[0] . ' x ' . $dimensions[1];
}
\IPS\Output::i()->sendOutput( json_encode( $output ), 200, 'application/json', \IPS\Output::i()->httpHeaders );
\IPS\Output::i()->sendOutput( json_encode( $output ), 200, 'application/json' );
}
/**
* Return HTML for a page row
*
* @param array $row Row data
* @param array $item Row data
* @param object $url \IPS\Http\Url object
* @return string HTML
*/
@@ -471,7 +478,7 @@ class _media extends \IPS\Node\Controller
/**
* Return HTML for a folder row
*
* @param array $row Row data
* @param array $folder Row data
* @param object $url \IPS\Http\Url object
* @return string HTML
*/
@@ -484,7 +491,7 @@ class _media extends \IPS\Node\Controller
/**
* Fetch rows of folders/pages
*
* @param int $folderId Parent ID to fetch from
* @param int $folderId Parent ID to fetch from
*/
public static function getRowsForTree( $folderId=0 )
{