Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -22,7 +22,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
/**
|
||||
* Ajax only methods
|
||||
*/
|
||||
class _ajax extends \IPS\Content\Controller
|
||||
class _ajax extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Return a FURL
|
||||
@@ -33,5 +33,42 @@ class _ajax extends \IPS\Content\Controller
|
||||
{
|
||||
return \IPS\Output::i()->json( array( 'slug' => \IPS\Http\Url::seoTitle( \IPS\Request::i()->slug ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Find Record
|
||||
*
|
||||
* @retun void
|
||||
*/
|
||||
public function findRecord()
|
||||
{
|
||||
$results = array();
|
||||
$database = \IPS\cms\Databases::load( \IPS\Request::i()->id );
|
||||
$input = mb_strtolower( \IPS\Request::i()->input );
|
||||
$field = "field_" . $database->field_title;
|
||||
$class = '\IPS\cms\Records' . $database->id;
|
||||
$category = '';
|
||||
|
||||
$where = array( $field . " LIKE CONCAT('%', ?, '%')" );
|
||||
$binds = array( $input );
|
||||
|
||||
foreach ( \IPS\Db::i()->select( '*', 'cms_custom_database_' . $database->id, array_merge( array( implode( ' OR ', $where ) ), $binds ), 'LENGTH(' . $field . ') ASC', array( 0, 20 ) ) as $row )
|
||||
{
|
||||
$record = $class::constructFromData( $row );
|
||||
|
||||
if ( $database->use_categories )
|
||||
{
|
||||
$category = \IPS\Member::loggedIn()->language()->addToStack( 'cms_autocomplete_category', NULL, array( 'sprintf' => array( $record->container()->_title ) ) );
|
||||
}
|
||||
|
||||
$results[] = array(
|
||||
'id' => $record->_id,
|
||||
'value' => $record->_title,
|
||||
'category' => $category,
|
||||
'date' => \IPS\DateTime::ts( $record->record_publish_date )->html(),
|
||||
);
|
||||
}
|
||||
|
||||
\IPS\Output::i()->json( $results );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,6 +24,13 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
class _category extends \IPS\cms\Databases\Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Store any active filters for this view
|
||||
*
|
||||
* @param array
|
||||
*/
|
||||
static public $activeFilters = array();
|
||||
|
||||
/**
|
||||
* Determine which method to load
|
||||
*
|
||||
@@ -86,7 +93,6 @@ class _category extends \IPS\cms\Databases\Controller
|
||||
}
|
||||
|
||||
/* Check cookie */
|
||||
$activeFilters = array();
|
||||
$where = array();
|
||||
$cookie = $category->getFilterCookie();
|
||||
if ( $cookie !== NULL )
|
||||
@@ -120,7 +126,8 @@ class _category extends \IPS\cms\Databases\Controller
|
||||
$where[] = array( mb_substr( $k, 8 ) . "=?", $v );
|
||||
}
|
||||
}
|
||||
$activeFilters[ $f ] = array( 'field' => $customFields[ $f ], 'value' => $customFields[ $f ]->displayValue( $v ) );
|
||||
|
||||
static::$activeFilters[ $f ] = array( 'field' => $customFields[ $f ], 'value' => $customFields[ $f ]->displayValue( $v ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,7 +137,7 @@ class _category extends \IPS\cms\Databases\Controller
|
||||
$where = NULL;
|
||||
}
|
||||
|
||||
$table = new \IPS\Helpers\Table\Content( 'IPS\cms\Records' . \IPS\cms\Databases\Dispatcher::i()->databaseId, $category->url(), $where, $category, NULL );
|
||||
$table = new \IPS\Helpers\Table\Content( 'IPS\cms\Records' . \IPS\cms\Databases\Dispatcher::i()->databaseId, $category->url(), $where, $category, NULL, 'view', isset( \IPS\Request::i()->rss ) ? FALSE : TRUE );
|
||||
$table->tableTemplate = array( \IPS\cms\Theme::i()->getTemplate( $category->_template_listing, 'cms', 'database' ), 'categoryTable' );
|
||||
$table->rowsTemplate = array( \IPS\cms\Theme::i()->getTemplate( $category->_template_listing, 'cms', 'database' ), 'recordRow' );
|
||||
$table->baseUrl = $table->baseUrl->setQueryString( 'd', \IPS\cms\Databases\Dispatcher::i()->databaseId );
|
||||
@@ -231,8 +238,8 @@ class _category extends \IPS\cms\Databases\Controller
|
||||
|
||||
$table->advancedSearch = array(
|
||||
'record_type' => array( \IPS\Helpers\Table\SEARCH_SELECT, array( 'options' => $filterOptions ) ),
|
||||
'sortby' => array( \IPS\Helpers\Table\SEARCH_SELECT, array( 'options' => $sortBy ) ),
|
||||
'sortdirection' => array( \IPS\Helpers\Table\SEARCH_SELECT, array( 'options' => array(
|
||||
'sort_by' => array( \IPS\Helpers\Table\SEARCH_SELECT, array( 'options' => $sortBy ) ),
|
||||
'sort_direction' => array( \IPS\Helpers\Table\SEARCH_SELECT, array( 'options' => array(
|
||||
'asc' => 'asc',
|
||||
'desc' => 'desc',
|
||||
) )
|
||||
@@ -246,13 +253,13 @@ class _category extends \IPS\cms\Databases\Controller
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['content_field_' . $obj->id ] = $obj->_title;
|
||||
$table->advancedSearch[ 'content_field_' . $obj->id ] = array( \IPS\Helpers\Table\SEARCH_SELECT, array( 'options' => $obj->extra, 'multiple' => TRUE, 'noDefault' => true ) );
|
||||
$table->advancedSearch['sortby'][1]['options']['field_' . $obj->id ] = 'content_field_' . $obj->id;
|
||||
$table->advancedSearch['sort_by'][1]['options']['field_' . $obj->id ] = 'content_field_' . $obj->id;
|
||||
}
|
||||
|
||||
$table->sortOptions[ 'field_' . $obj->id ] = 'field_' . $obj->id;
|
||||
}
|
||||
|
||||
$table->advancedSearchCallback = function( $table, $values ) use ( $database, $sortBy )
|
||||
$table->advancedSearchCallback = function( $table, $values ) use ( $database, $sortBy, $customFields )
|
||||
{
|
||||
/* Type */
|
||||
foreach( $values as $k => $v )
|
||||
@@ -286,6 +293,9 @@ class _category extends \IPS\cms\Databases\Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$key = mb_substr( $k, 14 );
|
||||
\IPS\cms\modules\front\database\category::$activeFilters[ $key ] = array( 'field' => $customFields[ $key ], 'value' => $customFields[ $key ]->displayValue( $v ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,10 +313,10 @@ class _category extends \IPS\cms\Databases\Controller
|
||||
}
|
||||
|
||||
/* Sort */
|
||||
if ( isset( $values['sortby'] ) and isset( $sortBy[ $values['sortby'] ] ) )
|
||||
if ( isset( $values['sort_by'] ) and isset( $sortBy[ $values['sort_by'] ] ) )
|
||||
{
|
||||
$table->sortBy = $values['sortby'];
|
||||
$table->sortDirection = $values['sortdirection'];
|
||||
$table->sortBy = $values['sort_by'];
|
||||
$table->sortDirection = $values['sort_direction'];
|
||||
}
|
||||
|
||||
/* Cutoff */
|
||||
@@ -374,7 +384,14 @@ class _category extends \IPS\cms\Databases\Controller
|
||||
{
|
||||
if ( ! $record->hidden() )
|
||||
{
|
||||
$document->addItem( $record->_title, $record->url(), $record->$contentField, \IPS\DateTime::ts( $record->record_last_comment ), $record->_id );
|
||||
$content = $record->$contentField;
|
||||
|
||||
if ( $record->record_image )
|
||||
{
|
||||
$content = \IPS\cms\Theme::i()->getTemplate( $category->_template_listing, 'cms', 'database' )->rssItemWithImage( $content, $record->record_image );
|
||||
}
|
||||
|
||||
$document->addItem( $record->_title, $record->url(), $content, \IPS\DateTime::ts( $record->record_last_comment ), $record->_id );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,14 +406,14 @@ class _category extends \IPS\cms\Databases\Controller
|
||||
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'records/list.css', 'cms', 'front' ) );
|
||||
|
||||
\IPS\cms\Databases\Dispatcher::i()->output .= \IPS\cms\Theme::i()->getTemplate( $category->_template_listing, 'cms', 'database' )->categoryHeader( $category, (string) $table, $activeFilters );
|
||||
\IPS\cms\Databases\Dispatcher::i()->output .= \IPS\cms\Theme::i()->getTemplate( $category->_template_listing, 'cms', 'database' )->categoryHeader( $category, (string) $table, static::$activeFilters );
|
||||
|
||||
if ( ( $category->hasChildren() AND $category->show_records ) OR ! $category->hasChildren() )
|
||||
{
|
||||
\IPS\cms\Databases\Dispatcher::i()->output .= (string) $table;
|
||||
}
|
||||
|
||||
\IPS\cms\Databases\Dispatcher::i()->output .= \IPS\cms\Theme::i()->getTemplate( $category->_template_listing, 'cms', 'database' )->categoryFooter( $category, (string) $table, $activeFilters );
|
||||
\IPS\cms\Databases\Dispatcher::i()->output .= \IPS\cms\Theme::i()->getTemplate( $category->_template_listing, 'cms', 'database' )->categoryFooter( $category, (string) $table, static::$activeFilters );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -428,7 +445,9 @@ class _category extends \IPS\cms\Databases\Controller
|
||||
$hasModOptions = TRUE;
|
||||
}
|
||||
|
||||
\IPS\Output::i()->allowDefaultWidgets = FALSE;
|
||||
\IPS\Output::i()->sidebar['enabled'] = FALSE;
|
||||
\IPS\cms\Pages\Page::$currentPage->getWidgets();
|
||||
\IPS\Output::i()->output = $form->customTemplate( array( call_user_func_array( array( \IPS\cms\Theme::i(), 'getTemplate' ), array( $database->template_form, 'cms', 'database' ) ), 'recordForm' ), NULL, $category, $database, \IPS\cms\Pages\Page::$currentPage, $title, $hasModOptions );
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( $title );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'records/form.css', 'cms', 'front' ) );
|
||||
|
||||
@@ -96,17 +96,17 @@ class _index extends \IPS\cms\Databases\Controller
|
||||
|
||||
$where = ( $database->featured_settings['featured'] ) ? array( array( 'record_featured=?', 1 ) ) : NULL;
|
||||
|
||||
$articles = $recordClass::getItemsWithPermission( $where, 'record_pinned DESC, ' . $database->featured_settings['sort'] . ' ' . $database->featured_settings['direction'], array( $limit, $database->featured_settings['perpage'] ), 'read', FALSE, 0, NULL, FALSE, FALSE, FALSE, FALSE );
|
||||
$articles = $recordClass::getItemsWithPermission( $where, 'record_pinned DESC, ' . $database->featured_settings['sort'] . ' ' . $database->featured_settings['direction'], array( $limit, $database->featured_settings['perpage'] ), 'read', NULL, 0, NULL, FALSE, FALSE, FALSE, FALSE );
|
||||
|
||||
if ( $database->featured_settings['pagination'] )
|
||||
{
|
||||
$count = $recordClass::getItemsWithPermission( $where, 'record_pinned DESC, ' . $database->featured_settings['sort'] . ' ' . $database->featured_settings['direction'], $database->featured_settings['perpage'], 'read', FALSE, 0, NULL, FALSE, FALSE, FALSE, TRUE );
|
||||
$count = $recordClass::getItemsWithPermission( $where, 'record_pinned DESC, ' . $database->featured_settings['sort'] . ' ' . $database->featured_settings['direction'], $database->featured_settings['perpage'], 'read', NULL, 0, NULL, FALSE, FALSE, FALSE, TRUE );
|
||||
}
|
||||
|
||||
/* Pagination */
|
||||
$pagination = array(
|
||||
'page' => $page,
|
||||
'pages' => ( $count > 0 ) ? ceil( $count['cnt'] / $database->featured_settings['perpage'] ) : 1
|
||||
'pages' => ( $count > 0 ) ? ceil( $count / $database->featured_settings['perpage'] ) : 1
|
||||
);
|
||||
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'database_index/featured.css', 'cms', 'front' ) );
|
||||
|
||||
@@ -56,12 +56,12 @@ class _record extends \IPS\Content\Controller
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '3T252/1', 403, '' );
|
||||
\IPS\Output::i()->error( 'node_error', '2T252/1', 403, '' );
|
||||
}
|
||||
|
||||
if ( $record === NULL )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '3T252/2', 403, '' );
|
||||
\IPS\Output::i()->error( 'node_error', '2T252/2', 404, '' );
|
||||
}
|
||||
|
||||
if ( \IPS\Request::i()->view )
|
||||
@@ -86,8 +86,9 @@ class _record extends \IPS\Content\Controller
|
||||
$FieldsClass = '\\IPS\\cms\\Fields' . $record::$customDatabaseId;
|
||||
$updateFields = $FieldsClass::fields( $record->fieldValues(), 'edit', $record->container(), $FieldsClass::FIELD_SKIP_TITLE_CONTENT | $FieldsClass::FIELD_DISPLAY_COMMENTFORM );
|
||||
$form = null;
|
||||
|
||||
if ( count( $updateFields ) )
|
||||
|
||||
/* We need edit permission to change the record */
|
||||
if ( count( $updateFields ) and $record->canEdit() )
|
||||
{
|
||||
$form = new \IPS\Helpers\Form( 'update_record', 'update', $record->url()->setQueryString( array( 'd' => $record::$customDatabaseId ) ) );
|
||||
$form->class = 'ipsForm_vertical';
|
||||
@@ -101,11 +102,6 @@ class _record extends \IPS\Content\Controller
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
if ( ! $record->canEdit() )
|
||||
{
|
||||
\IPS\Output::i()->error( 'module_no_permission', '2T252/3', 403, '' );
|
||||
}
|
||||
|
||||
/* Custom fields */
|
||||
$customValues = array();
|
||||
$fieldsClass = 'IPS\cms\Fields' . $record::$customDatabaseId;
|
||||
@@ -528,8 +524,10 @@ class _record extends \IPS\Content\Controller
|
||||
|
||||
\IPS\Output::i()->redirect( $record->url() );
|
||||
}
|
||||
|
||||
|
||||
\IPS\Output::i()->allowDefaultWidgets = FALSE;
|
||||
\IPS\Output::i()->sidebar['enabled'] = FALSE;
|
||||
\IPS\cms\Pages\Page::$currentPage->getWidgets();
|
||||
\IPS\Output::i()->output = $form->customTemplate( array( call_user_func_array( array( \IPS\cms\Theme::i(), 'getTemplate' ), array( $database->template_form, 'cms', 'database' ) ), 'recordForm' ), NULL, $category, $database, \IPS\cms\Pages\Page::$currentPage, $title, $hasModOptions );
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( $title );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'records/form.css', 'cms', 'front' ) );
|
||||
|
||||
@@ -60,6 +60,13 @@ class _builder extends \IPS\core\modules\front\system\widgets
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if( mb_strpos( $field, "widget_feed_container_" ) !== FALSE )
|
||||
{
|
||||
/* On means that the all checkbox is ticked */
|
||||
$params[ 'widget_feed_container'] = \IPS\Request::i()->$field == 'on' ? 0 : \IPS\Request::i()->$field;
|
||||
continue;
|
||||
}
|
||||
|
||||
$params[ $field ] = \IPS\Request::i()->$field;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,19 @@ class _page extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function manage()
|
||||
{
|
||||
/* As we bypass the normal URL checks, we need to perform this here */
|
||||
if ( \IPS\Settings::i()->use_friendly_urls and ! empty( \IPS\Request::i()->url()->data['query'] ) and ( mb_stripos( \IPS\Request::i()->url()->data['query'], 'app=cms&module=pages&controller=page&path=' ) !== FALSE ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$url = \IPS\Request::i()->url();
|
||||
$url->makeFriendly( 'content_page_path', \IPS\Request::i()->url()->queryString['path'] );
|
||||
|
||||
\IPS\Output::i()->redirect( $url );
|
||||
}
|
||||
catch( \Exception $ex ) { }
|
||||
}
|
||||
|
||||
$this->view();
|
||||
}
|
||||
|
||||
@@ -61,105 +74,14 @@ class _page extends \IPS\Dispatcher\Controller
|
||||
return;
|
||||
}
|
||||
|
||||
$includes = $page->getIncludes();
|
||||
|
||||
if ( isset( $includes['js'] ) and is_array( $includes['js'] ) )
|
||||
if ( \IPS\Request::i()->path == $page->full_path )
|
||||
{
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, array_values( $includes['js'] ) );
|
||||
/* Just viewing this page, no database categories or records */
|
||||
$permissions = $page->permissions();
|
||||
\IPS\Session::i()->setLocation( $page->url(), explode( ",", $permissions['perm_view'] ), 'loc_cms_viewing_page', array( 'cms_page_' . $page->_id => TRUE ) );
|
||||
}
|
||||
|
||||
/* Display */
|
||||
if ( $page->ipb_wrapper or $page->type === 'builder' )
|
||||
{
|
||||
$page->setTheme();
|
||||
$nav = array();
|
||||
|
||||
\IPS\Output::i()->title = $page->getHtmlTitle();
|
||||
|
||||
/* This has to be done after setTheme(), otherwise \IPS\Theme::switchTheme() can wipe out CSS includes */
|
||||
if ( isset( $includes['css'] ) and is_array( $includes['css'] ) )
|
||||
{
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, array_values( $includes['css'] ) );
|
||||
}
|
||||
|
||||
if ( $page->type === 'builder' )
|
||||
{
|
||||
list( $group, $name, $key ) = explode( '__', $page->template );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('pages')->globalWrap( $nav, \IPS\cms\Theme::i()->getTemplate($group, 'cms', 'page')->$name( $page, $page->getWidgets() ), $page );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Populate \IPS\Output::i()->sidebar['widgets'] sidebar/header/footer widgets */
|
||||
$page->getWidgets();
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('pages')->globalWrap( $nav, $page->getHtmlContent(), $page );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->sidebar['enabled'] = true;
|
||||
|
||||
/* Set the meta tags, but do not reset them if they are already set - articles can define custom meta tags and this code
|
||||
overwrites the ones set by articles if we don't verify they aren't set first */
|
||||
if ( $page->meta_keywords AND ( !isset( \IPS\Output::i()->metaTags['keywords'] ) OR !\IPS\Output::i()->metaTags['keywords'] ) )
|
||||
{
|
||||
\IPS\Output::i()->metaTags['keywords'] = $page->meta_keywords;
|
||||
}
|
||||
|
||||
if ( $page->meta_description AND ( !isset( \IPS\Output::i()->metaTags['description'] ) OR !\IPS\Output::i()->metaTags['description'] ) )
|
||||
{
|
||||
\IPS\Output::i()->metaTags['description'] = $page->meta_description;
|
||||
}
|
||||
|
||||
/* Can only disable sidebar if HTML page */
|
||||
if ( ! $page->show_sidebar and $page->type === 'html' )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['enabled'] = false;
|
||||
}
|
||||
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'pages/page.css', 'cms', 'front' ) );
|
||||
|
||||
if ( \IPS\Request::i()->path == $page->full_path )
|
||||
{
|
||||
/* Just viewing this page, no database categories or records */
|
||||
$permissions = $page->permissions();
|
||||
\IPS\Session::i()->setLocation( $page->url(), explode( ",", $permissions['perm_view'] ), 'loc_cms_viewing_page', array( 'cms_page_' . $page->_id => TRUE ) );
|
||||
}
|
||||
|
||||
if ( ! ( \IPS\Application::load('cms')->default AND ! $page->folder_id AND $page->default ) )
|
||||
{
|
||||
\IPS\Output::i()->breadcrumb['module'] = array( $page->url(), $page->_title );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->allowDefaultWidgets = FALSE;
|
||||
/* Let the dispatcher finish off and show page */
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( isset( $includes['css'] ) and is_array( $includes['css'] ) )
|
||||
{
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, array_values( $includes['css'] ) );
|
||||
}
|
||||
|
||||
if ( $page->wrapper_template and $page->wrapper_template !== '_none_' and ! \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
try
|
||||
{
|
||||
list( $group, $name, $key ) = explode( '__', $page->wrapper_template );
|
||||
\IPS\Output::i()->sendOutput( \IPS\cms\Theme::i()->getTemplate($group, 'cms', 'page')->$name( $page->getHtmlContent(), $page->getHtmlTitle() ), 200, $page->getContentType(), \IPS\Output::i()->httpHeaders );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the title */
|
||||
\IPS\Output::i()->title = $page->getHtmlTitle();
|
||||
\IPS\Member::loggedIn()->language()->parseOutputForDisplay( \IPS\Output::i()->title );
|
||||
|
||||
/* Send straight to the output engine */
|
||||
\IPS\Output::i()->sendOutput( $page->getHtmlContent(), 200, $page->getContentType(), \IPS\Output::i()->httpHeaders );
|
||||
}
|
||||
$page->output();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user