Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

@@ -2,9 +2,9 @@
/**
* @brief Record View
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Content
* @since 17 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -76,7 +76,7 @@ class _record extends \IPS\Content\Controller
$activeTabContents = $record->commentReviews( $tab );
$comments = count( $tabs ) ? \IPS\cms\Theme::i()->getTemplate( $record->container()->_template_display, 'cms', 'database' )->commentsAndReviewsTabs( \IPS\Theme::i()->getTemplate( 'global', 'core' )->tabs( $tabs, $tab, $activeTabContents, $record->url(), 'tab', FALSE, TRUE ), md5( $record->url() ) ) : NULL;
if ( \IPS\Request::i()->isAjax() and isset( \IPS\Request::i()->tab ) )
if ( \IPS\Request::i()->isAjax() and ( isset( \IPS\Request::i()->page ) OR isset( \IPS\Request::i()->tab ) ) )
{
\IPS\Output::i()->sendOutput( $activeTabContents, 200, 'text/html', \IPS\Output::i()->httpHeaders );
}
@@ -121,7 +121,7 @@ class _record extends \IPS\Content\Controller
$record->addCommentWhenFiltersChanged( $values );
}
foreach( $fieldsClass::fields( $customValues, 'edit', $record->category_id ? $category : NULL, $FieldsClass::FIELD_SKIP_TITLE_CONTENT | $FieldsClass::FIELD_DISPLAY_COMMENTFORM) as $key => $field )
foreach( $fieldsClass::fields( $customValues, 'edit', $record->category_id ? $category : NULL, $FieldsClass::FIELD_SKIP_TITLE_CONTENT | $FieldsClass::FIELD_DISPLAY_COMMENTFORM ) as $key => $field )
{
$key = 'field_' . $key;
$record->$key = $field::stringValue( isset( $values[ $field->name ] ) ? $values[ $field->name ] : NULL );
@@ -172,7 +172,8 @@ class _record extends \IPS\Content\Controller
{
\IPS\Output::i()->metaTags['og:image'] = (string) \IPS\File::get( 'cms_Records', $record->record_image )->url;
}
\IPS\Output::i()->contextualSearchOptions = array();
\IPS\Output::i()->contextualSearchOptions[ \IPS\Member::loggedIn()->language()->addToStack( 'search_contextual_item', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->addToStack( $record::$title ) ) ) ) ] = array( 'type' => mb_strtolower( str_replace( '\\', '_', mb_substr( $class, 4 ) ) ), 'nodes' => $record->_id );
\IPS\cms\Databases\Dispatcher::i()->output .= \IPS\cms\Theme::i()->getTemplate( $record->container()->_template_display, 'cms', 'database' )->record( $record, $comments, $form, $nextUnread );
}
@@ -185,7 +186,8 @@ class _record extends \IPS\Content\Controller
*/
protected function _setBreadcrumbAndTitle( $item, $link=TRUE )
{
if ( \IPS\cms\Databases::load( \IPS\cms\Databases\Dispatcher::i()->databaseId )->use_categories )
$database = \IPS\cms\Databases::load( \IPS\cms\Databases\Dispatcher::i()->databaseId );
if ( $database->use_categories )
{
parent::_setBreadcrumbAndTitle( $item, $link );
}
@@ -193,7 +195,7 @@ class _record extends \IPS\Content\Controller
{
\IPS\Output::i()->breadcrumb[] = array( $link ? $item->url() : NULL, $item->mapped('title') );
$title = ( isset( \IPS\Request::i()->page ) and \IPS\Request::i()->page > 1 ) ? \IPS\Member::loggedIn()->language()->addToStack( 'title_with_page_number', FALSE, array( 'sprintf' => array( $item->mapped('title'), \IPS\Request::i()->page ) ) ) : $item->mapped('title');
$title = ( isset( \IPS\Request::i()->page ) and \IPS\Request::i()->page > 1 ) ? \IPS\Member::loggedIn()->language()->addToStack( 'title_with_page_number', FALSE, array( 'sprintf' => array( $item->mapped('title') . ' - ' . $database->pageTitle(), \IPS\Request::i()->page ) ) ) : $item->mapped('title') . ' - ' . $database->pageTitle();
\IPS\Output::i()->title = $title;
}
}
@@ -279,6 +281,9 @@ class _record extends \IPS\Content\Controller
);
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'system/diff.css', 'core', 'admin' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'codemirror/diff_match_patch.js', 'core', 'interface' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'codemirror/codemirror.js', 'core', 'interface' ) );
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'codemirror/codemirror.css', 'core', 'interface' ) );
/* Output */
if ( \IPS\Request::i()->isAjax() )
@@ -313,6 +318,9 @@ class _record extends \IPS\Content\Controller
{
\IPS\Session::i()->csrfCheck();
/* Make sure the user confirmed the deletion */
\IPS\Request::i()->confirmedDelete();
$recordClass = '\IPS\cms\Records' . \IPS\cms\Databases\Dispatcher::i()->databaseId;
try
@@ -389,28 +397,13 @@ class _record extends \IPS\Content\Controller
$customFields = $fieldsClass::data( 'view', $category );
$conflicts = array();
$form = new \IPS\Helpers\Form( 'form', 'content_revision_restore' );
require_once \IPS\ROOT_PATH . "/system/3rd_party/Diff/class.Diff.php";
/* Build up our data set */
foreach( $customFields as $id => $field )
$conflicts = $revision->getDiffHtmlTables( $record::$customDatabaseId, $record, true );
foreach( $conflicts as $conflict )
{
$key = 'field_' . $field->id;
if ( $record->$key AND $revision->get( $key ) )
{
if ( md5( $record->$key ) != md5( $revision->get( $key ) ) )
{
$conflicts[ $key ] = array(
'revision' => $revision->get( $key ),
'record' => $record->$key,
'field' => $field,
'diff' => \Diff::toTable( \Diff::compare( $revision->get( $key ), $record->$key ) )
);
$form->add( new \IPS\Helpers\Form\Radio( 'conflict_' . $field->id, 'no', false, array( 'options' => array( 'old' => '', 'new' => '' ) ) ) );
}
}
$form->add( new \IPS\Helpers\Form\Radio( 'conflict_' . $conflict['field']->id, 'no', false, array( 'options' => array( 'old' => '', 'new' => '' ) ) ) );
}
if ( $values = $form->values() )
@@ -449,6 +442,9 @@ class _record extends \IPS\Content\Controller
\IPS\Output::i()->title = $title;
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'system/diff.css', 'core', 'admin' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'codemirror/diff_match_patch.js', 'core', 'interface' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'codemirror/codemirror.js', 'core', 'interface' ) );
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'codemirror/codemirror.css', 'core', 'interface' ) );
\IPS\Output::i()->output = $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'revisions', 'cms' ), 'view' ), $record, $revision, $conflicts );
}
@@ -463,6 +459,7 @@ class _record extends \IPS\Content\Controller
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_records.js', 'cms' ) );
$recordClass = '\IPS\cms\Records' . \IPS\cms\Databases\Dispatcher::i()->databaseId;
$fieldsClass = '\IPS\cms\Fields' . \IPS\cms\Databases\Dispatcher::i()->databaseId;
$database = \IPS\cms\Databases::load( \IPS\cms\Databases\Dispatcher::i()->databaseId );
try
{
@@ -494,9 +491,13 @@ class _record extends \IPS\Content\Controller
$hasModOptions = FALSE;
if ( $recordClass::modPermission( 'lock', NULL, $category ) or
$recordClass::modPermission( 'pin', NULL, $category ) or
$recordClass::modPermission( 'hide', NULL, $category ) or
$recordClass::modPermission( 'feature', NULL, $category ) )
$recordClass::modPermission( 'pin', NULL, $category ) or
$recordClass::modPermission( 'hide', NULL, $category ) or
$recordClass::modPermission( 'feature', NULL, $category ) or
$fieldsClass::fixedFieldFormShow( 'record_allow_comments' ) or
$fieldsClass::fixedFieldFormShow( 'record_expiry_date' ) or
$fieldsClass::fixedFieldFormShow( 'record_comment_cutoff' ) or
\IPS\Member::loggedIn()->modPermission('can_content_edit_meta_tags') )
{
$hasModOptions = TRUE;
}
@@ -514,14 +515,12 @@ class _record extends \IPS\Content\Controller
{
$record->$column = $values[ $recordClass::$formLangPrefix . 'date' ]->getTimestamp();
}
else
{
$record->$column = time();
}
}
$record->save();
\IPS\Session::i()->modLog( 'modlog__item_edit', array( $record::$title => FALSE, $record->url()->__toString() => FALSE, $record::$title => TRUE, $record->mapped( 'title' ) => FALSE ), $record );
\IPS\Output::i()->redirect( $record->url() );
}
@@ -738,7 +737,7 @@ class _record extends \IPS\Content\Controller
$comment = $commentClass::load( \IPS\Request::i()->comment );
$item = $record;
}
try
{
return parent::$method( $commentClass, $comment, $item );