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

+64 -17
View File
@@ -2,9 +2,9 @@
/**
* @brief Table Builder using an \IPS\Content\Item class datasource
* @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
* @since 16 Jul 2013
* @version SVN_VERSION_NUMBER
*/
@@ -57,7 +57,12 @@ class _Content extends Table
* @brief Honor the pinned flag for sorting. Will be set to false in stream-like views
*/
protected $honorPinned = TRUE;
/**
* @brief Show moved links in the result set. This is desirable in controller generated views but not streams or widgets, etc.
*/
protected $showMovedLinks = FALSE;
/**
* Number of results
*/
@@ -107,9 +112,11 @@ class _Content extends Table
* @param \IPS\Node\Model|NULL $container The container
* @param bool|null $includeHidden Flag to pass to getItemsWithPermission() method for $includeHiddenContent, defaults to NULL
* @param string|NULL $permCheck Permission key to check
* @param bool $honorPinned Show pinned topics at the top of the table
* @param bool $showMovedLinks Show moved links in the result set.
* @return void
*/
public function __construct( $class, \IPS\Http\Url $baseUrl, $where=NULL, \IPS\Node\Model $container=NULL, $includeHidden=NULL, $permCheck='view', $honorPinned=TRUE )
public function __construct( $class, \IPS\Http\Url $baseUrl, $where=NULL, \IPS\Node\Model $container=NULL, $includeHidden=\IPS\Content\Hideable::FILTER_AUTOMATIC, $permCheck='view', $honorPinned=TRUE, $showMovedLinks=FALSE )
{
/* Init */
$this->include = array();
@@ -118,6 +125,7 @@ class _Content extends Table
$this->container = $container;
$this->includeHiddenContent = $includeHidden;
$this->honorPinned = $honorPinned;
$this->showMovedLinks = $showMovedLinks;
$this->permCheck = $permCheck;
/* Init */
@@ -133,14 +141,14 @@ class _Content extends Table
if ( !$this->sortBy and $container->_sortBy !== NULL )
{
$this->sortBy = $container->_sortBy;
$this->sortBy = $class::$databaseTable . '.' . $class::$databasePrefix . $container->_sortBy;
}
if ( !$this->filter )
{
$this->filter = $container->_filter;
}
if ( $this->includeHiddenContent === NULL )
if ( $this->includeHiddenContent === \IPS\Content\Hideable::FILTER_AUTOMATIC )
{
$this->includeHiddenContent = $class::canViewHiddenItems( \IPS\Member::loggedIn(), $container );
}
@@ -153,9 +161,11 @@ class _Content extends Table
\IPS\Output::i()->breadcrumb[] = array( NULL, $container->_title );
/* Meta tags */
\IPS\Output::i()->title = ( $this->page > 1 ) ? \IPS\Member::loggedIn()->language()->addToStack( 'title_with_page_number', FALSE, array( 'sprintf' => array( $container->_title, $this->page ) ) ) : $container->_title;
\IPS\Output::i()->metaTags['title'] = $container->_title;
\IPS\Output::i()->title = ( $this->page > 1 ) ? \IPS\Member::loggedIn()->language()->addToStack( 'title_with_page_number', FALSE, array( 'sprintf' => array( $container->metaTitle(), $this->page ) ) ) : $container->metaTitle();
\IPS\Output::i()->metaTags['title'] = $container->metaTitle();
\IPS\Output::i()->metaTags['description'] = $container->metaDescription();
\IPS\Output::i()->metaTags['og:title'] = $container->metaTitle();
\IPS\Output::i()->metaTags['og:description'] = $container->metaDescription();
\IPS\Output::i()->linkTags['canonical'] = (string) $baseUrl;
}
@@ -221,16 +231,28 @@ class _Content extends Table
break;
}
}
$this->sortBy = in_array( $this->sortBy, $this->sortOptions ) ? $this->sortBy :
( array_key_exists( $this->sortBy, $this->sortOptions) ? $this->sortOptions[ $this->sortBy ] : $defaultSort );
if ( ! mb_stristr( $this->sortBy, '`' ) )
{
$compareSortBy = $this->sortBy;
$lookFor = $class::$databaseTable . '.' . $class::$databasePrefix;
if ( mb_substr( $this->sortBy, 0, mb_strlen( $lookFor ) ) === $lookFor )
{
$compareSortBy = mb_substr( $this->sortBy, mb_strlen( $lookFor ) );
}
$this->sortBy = in_array( $compareSortBy, $this->sortOptions ) ? $this->sortBy :
( array_key_exists( $compareSortBy, $this->sortOptions ) ? $this->sortOptions[ $compareSortBy ] : $defaultSort );
}
/* Callback? */
if ( $this->advancedSearchCallback and !empty( $advancedSearchValues ) )
{
$obj = $this;
call_user_func( $this->advancedSearchCallback, $obj, $advancedSearchValues );
}
/* What are we sorting by? */
$sortBy = $this->sortBy . ' ' . ( mb_strtolower( $this->sortDirection ) == 'asc' ? 'asc' : 'desc' );
if ( in_array( 'IPS\Content\Pinnable', class_implements( $class ) ) and $this->honorPinned )
@@ -245,10 +267,10 @@ class _Content extends Table
{
$where[] = is_array( $this->filters[ $this->filter ] ) ? $this->filters[ $this->filter ] : array( $this->filters[ $this->filter ] );
}
/* Get results */
$this->count = $class::getItemsWithPermission( $where, $sortBy, NULL, $this->permCheck, $this->includeHiddenContent, 0, NULL, $this->joinContainer, $this->joinComments, $this->joinReviews, TRUE, $this->joins );
$it = $class::getItemsWithPermission( $where, $sortBy, array( ( $this->limit * ( $this->page - 1 ) ), $this->limit ), $this->permCheck, $this->includeHiddenContent, 0, NULL, $this->joinContainer, $this->joinComments, $this->joinReviews, FALSE, $this->joins );
$this->count = $class::getItemsWithPermission( $where, $sortBy, NULL, $this->permCheck, $this->includeHiddenContent, 0, NULL, $this->joinContainer, $this->joinComments, $this->joinReviews, TRUE, $this->joins, FALSE, TRUE, TRUE, TRUE, $this->showMovedLinks );
$it = $class::getItemsWithPermission( $where, $sortBy, array( ( $this->limit * ( $this->page - 1 ) ), $this->limit ), $this->permCheck, $this->includeHiddenContent, 0, NULL, $this->joinContainer, $this->joinComments, $this->joinReviews, FALSE, $this->joins, FALSE, TRUE, TRUE, TRUE, $this->showMovedLinks );
$this->pages = ceil( $this->count / $this->limit );
$rows = iterator_to_array( $it );
@@ -385,9 +407,17 @@ class _Content extends Table
{
$return[] = 'unhide';
}
elseif ( $item->hidden() === 1 and $item->canUnhide() )
elseif ( $item->hidden() === 1 )
{
$return[] = 'approve';
if( $item->canUnhide() )
{
$return[] = 'approve';
}
if( $item->canHide() )
{
$return[] = 'hide';
}
}
elseif ( $item->canHide() )
{
@@ -455,6 +485,14 @@ class _Content extends Table
*/
protected function multimod()
{
\IPS\Session::i()->csrfCheck();
/* Basic check that we selected something */
if( !isset( \IPS\Request::i()->moderate ) OR empty( \IPS\Request::i()->moderate ) )
{
\IPS\Output::i()->error( 'nothing_mm_selected', '1S330/1', 403, '' );
}
$class = $this->class;
$params = array();
@@ -568,6 +606,15 @@ class _Content extends Table
$form->hiddenValues['modaction'] = 'merge';
$form->hiddenValues['moderate'] = \IPS\Request::i()->moderate;
$form->add( new \IPS\Helpers\Form\Radio( 'merge_master', NULL, TRUE, array( 'options' => $options, 'descriptions' => $descriptions ) ) );
if ( isset( $class::$databaseColumnMap['moved_to'] ) )
{
$form->add( new \IPS\Helpers\Form\Checkbox( 'move_keep_link' ) );
if ( \IPS\Settings::i()->topic_redirect_prune )
{
\IPS\Member::loggedIn()->language()->words['move_keep_link_desc'] = \IPS\Member::loggedIn()->language()->addToStack( '_move_keep_link_desc', FALSE, array( 'pluralize' => array( \IPS\Settings::i()->topic_redirect_prune ) ) );
}
}
if ( $values = $form->values() )
{
$otherItems = array();
@@ -579,7 +626,7 @@ class _Content extends Table
}
}
$class::load( $values['merge_master'] )->mergeIn( $otherItems );
$class::load( $values['merge_master'] )->mergeIn( $otherItems, isset( $values['move_keep_link'] ) ? $values['move_keep_link'] : FALSE );
}
else
{
+21 -14
View File
@@ -2,9 +2,9 @@
/**
* @brief Table Builder using an array datasource
* @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
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
@@ -38,6 +38,11 @@ class _Custom extends Table
*/
public $count = 0;
/**
* Number of pages
*/
public $pages = NULL;
/**
* Constructor
*
@@ -47,6 +52,7 @@ class _Custom extends Table
public function __construct( $dataSource, \IPS\Http\Url $baseUrl )
{
$this->dataSource = $dataSource;
$this->count = count( $this->dataSource );
return parent::__construct( $baseUrl );
}
@@ -60,9 +66,10 @@ class _Custom extends Table
*/
public function getRows( $advancedSearchValues )
{
/* Sort out paging */
$this->count = count( $this->dataSource );
$this->pages = ceil( $this->count / $this->limit );
if ( ! $this->pages )
{
$this->pages = ceil( $this->count / $this->limit );
}
/* Get them */
$rows = array();
@@ -86,23 +93,17 @@ class _Custom extends Table
/* Add it to the array */
$rows[ $i ] = $row;
}
/* Quicksearch */
if ( $this->quickSearch !== NULL and \IPS\Request::i()->quicksearch )
{
$quickSearchColumn = $this->quickSearch;
$rows = array_filter( $rows, is_callable( $this->quickSearch ) ? $this->quickSearch : function( $row ) use ( $quickSearchColumn )
{
return mb_strpos( $row[ $quickSearchColumn ], trim( \IPS\Request::i()->quicksearch ) ) !== FALSE;
return mb_strpos( mb_strtolower( $row[ $quickSearchColumn ] ), mb_strtolower( trim( \IPS\Request::i()->quicksearch ) ) ) !== FALSE;
} );
}
/* Limit */
if ( $this->limit and $this->count > $this->limit )
{
$rows = array_slice( $rows, ( $this->limit * ( $this->page - 1 ) ), $this->limit );
}
/* Do we need to sort? */
if( !empty( $rows ) and $this->sortBy and isset( $rows[ key( $rows ) ][ $this->sortBy ] ) )
{
@@ -120,6 +121,12 @@ class _Custom extends Table
}
});
}
/* Limit */
if ( $this->limit and $this->count > $this->limit )
{
$rows = array_slice( $rows, ( $this->limit * ( $this->page - 1 ) ), $this->limit );
}
/* Apply parsers */
foreach( $rows as $i => $row )
+100 -47
View File
@@ -2,9 +2,9 @@
/**
* @brief Table Builder using a database table datasource
* @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
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
@@ -58,10 +58,15 @@ class _Db extends Table
*/
public $keyField = NULL;
/**
* @brief Restrict select columns to only those listed - useful when grouping
*/
public $onlySelected = NULL;
/**
* Constructor
*
* @param array $table Database table
* @param array|string $table Database table
* @param \IPS\Http\Url $baseUrl Base URL
* @param array|null $where WHERE clause
* @param string|null $group GROUP clause
@@ -106,7 +111,7 @@ class _Db extends Table
$columns = is_array( $this->quickSearch ) ? $this->quickSearch[0] : $this->quickSearch;
$columns = is_array( $columns ) ? $columns : array( $columns );
$_where = '';
$_where = array();
foreach ( $columns as $c )
{
$_where[] = "LOWER(`{$c}`) LIKE CONCAT( '%', ?, '%' )";
@@ -121,7 +126,7 @@ class _Db extends Table
{
foreach ( $advancedSearchValues as $k => $v )
{
if ( isset( $this->advancedSearch[ $k ] ) )
if ( isset( $this->advancedSearch[ $k ] ) AND $v !== '' )
{
$type = $this->advancedSearch[ $k ];
@@ -151,14 +156,39 @@ class _Db extends Table
case SEARCH_CONTAINS_TEXT:
$where[] = array( "{$k} LIKE ?", '%' . $v . '%' );
break;
case SEARCH_QUERY_TEXT:
switch ( $v[0] )
{
case 'c':
$where[] = array( "{$k} LIKE ?", '%' . $v[1] . '%' );
break;
case 'bw':
$where[] = array( "{$k} LIKE ?", $v[1] . '%' );
break;
case 'eq':
$where[] = array( "{$k}=?", $v[1] );
break;
}
break;
case SEARCH_DATE_RANGE:
$timezone = ( \IPS\Member::loggedIn()->timezone ? new \DateTimeZone( \IPS\Member::loggedIn()->timezone ) : NULL );
if ( $v['start'] )
{
if( !( $v['start'] instanceof \IPS\DateTime ) )
{
$v['start'] = new \IPS\DateTime( $v['start'], $timezone );
}
$where[] = array( "{$k}>?", $v['start']->getTimestamp() );
}
if ( $v['end'] )
{
if( !( $v['end'] instanceof \IPS\DateTime ) )
{
$v['end'] = new \IPS\DateTime( $v['end'], $timezone );
}
$where[] = array( "{$k}<?", $v['end']->getTimestamp() );
}
break;
@@ -175,7 +205,10 @@ class _Db extends Table
break;
case SEARCH_MEMBER:
$where[] = array( "{$k}=?", $v->member_id );
if( $v instanceof \IPS\Member )
{
$where[] = array( "{$k}=?", $v->member_id );
}
break;
case SEARCH_NODE:
@@ -211,6 +244,7 @@ class _Db extends Table
break;
case SEARCH_NUMERIC:
case SEARCH_NUMERIC_TEXT:
switch ( $v[0] )
{
case 'gt':
@@ -230,40 +264,55 @@ class _Db extends Table
break;
}
}
else
{
unset( $advancedSearchValues[ $k ] );
}
}
}
$selects = $this->selects;
if ( count( $this->joins ) )
if( $this->onlySelected !== NULL )
{
foreach( $this->joins as $join )
foreach( $this->onlySelected as $column )
{
if ( isset( $join['select'] ) )
$selects[] = $column;
}
if( $this->group !== NULL )
{
$this->group = is_array( $this->group ) ? $this->group : array( $this->group );
$this->group = array_unique( array_merge( $this->group, $this->onlySelected ) );
}
}
else
{
if ( count( $this->joins ) )
{
foreach( $this->joins as $join )
{
$selects[] = $join['select'];
if ( isset( $join['select'] ) )
{
$selects[] = $join['select'];
}
}
}
}
/* Count results (for pagination) */
if ( $this->group === null )
$count = \IPS\Db::i()->select( 'count(*)', $this->table, $where );
if ( count( $this->joins ) )
{
$count = \IPS\Db::i()->select( 'count(*)', $this->table, $where );
if ( count( $this->joins ) )
foreach( $this->joins as $join )
{
foreach( $this->joins as $join )
{
$count->join( $join['from'], ( isset( $join['where'] ) ? $join['where'] : null ), 'LEFT' );
}
$count->join( $join['from'], ( isset( $join['where'] ) ? $join['where'] : null ), ( isset( $join['type'] ) ) ? $join['type'] : 'LEFT' );
}
$count = $count->first();
}
$count = $count->first();
$query = \IPS\Db::i()->select( '*' . ( count( $selects ) ? ', ' . implode( ', ', $selects ) : '' ), $this->table, $where, NULL, array( 0, 1 ) );
}
else
{
$query = \IPS\Db::i()->select( '*, count(DISTINCT( '.$this->table.'.' . $this->group . ')) as _count' . ( count( $selects ) ? ', ' . implode( ', ', $selects ) : '' ), $this->table, $where, NULL, array( 0, 1 ) );
}
/* Now get column headers */
$query = \IPS\Db::i()->select( $this->onlySelected ? implode( ', ', $selects ) : '*', $this->table, $where, NULL, array( 0, 1 ), $this->group );
if ( count( $this->joins ) )
{
@@ -277,23 +326,14 @@ class _Db extends Table
{
$query->forceIndex( $this->index );
}
if ( $this->group === null )
try
{
try
{
$results = $query->first();
}
catch( \UnderflowException $e )
{
$results = array();
}
$results = $query->first();
}
else
catch( \UnderflowException $e )
{
$count = $query->first();
$results = $count;
$count = $count['_count'];
$results = array();
}
$this->pages = ceil( $count / $this->limit );
@@ -304,15 +344,20 @@ class _Db extends Table
{
$orderBy = implode( ',', array_map( function( $v )
{
/* This gives you something like "g`.`g_id" which is then turned into "`g`.`g_id`" below */
$v = str_replace( '.', "`.`", $v );
if ( ! mb_strstr( trim( $v ), ' ' ) )
{
return '`' . trim( $v ) . '`';
$return = ( isset( $this->advancedSearch[$v] ) and $this->advancedSearch[$v] == SEARCH_NUMERIC_TEXT ) ? 'LENGTH(' . '`' . trim( $v ) . '`' . ') ' . $this->sortDirection . ', ' . '`' . trim( $v ) . '` ' : '`' . trim( $v ) . '` ';
}
else
{
list( $field, $direction ) = explode( ' ', $v );
return '`' . trim( $field ) . '` ' . $direction;
$return = ( isset( $this->advancedSearch[$v] ) and $this->advancedSearch[$v] == SEARCH_NUMERIC_TEXT ) ? 'LENGTH(' . '`' . trim( $field ) . '`' . ') ' . mb_strtolower( $direction ) == 'asc' ? 'asc' : 'desc' . ', ' . '`' . trim( $field ) . '` ' : '`' . trim( $field ) . '` ';
$return .= ( mb_strtolower( $direction ) == 'asc' ? 'asc' : 'desc' );
}
return $return;
}, explode( ',', $this->sortBy ) ) );
$orderBy .= $this->sortDirection == 'asc' ? ' asc' : ' desc';
@@ -321,13 +366,14 @@ class _Db extends Table
/* Run query */
$rows = array();
$select = \IPS\Db::i()->select(
( count( $selects ) ) ? $this->table . '.*, ' . implode( ', ', $selects ) : '*',
$this->onlySelected ? implode( ', ', $selects ) : ( ( count( $selects ) ) ? $this->table . '.*, ' . implode( ', ', $selects ) : '*' ),
$this->table,
$where,
$orderBy,
array( ( $this->limit * ( $this->page - 1 ) ), $this->limit ), $this->group
array( ( $this->limit * ( $this->page - 1 ) ), $this->limit ),
$this->group
);
if ( $this->index )
{
$select->forceIndex( $this->index );
@@ -337,14 +383,14 @@ class _Db extends Table
{
foreach( $this->joins as $join )
{
$select->join( $join['from'], $join['where'], 'LEFT' );
$select->join( $join['from'], $join['where'], ( isset( $join['type'] ) ) ? $join['type'] : 'LEFT' );
}
}
if ( $this->keyField !== NULL )
{
$select->setKeyField( $this->keyField );
}
foreach ( $select as $rowId => $row )
{
/* Add in any 'custom' fields */
@@ -437,6 +483,13 @@ class _Db extends Table
{
foreach( explode( ',', $this->sortBy ) as $field )
{
/* Get rid of table alias if there is one */
if( mb_strpos( $field, '.' ) !== FALSE )
{
$field = explode( '.', $field );
$field = $field[1];
}
$field = trim($field);
if ( mb_strstr( $field, ' ' ) )
@@ -452,7 +505,7 @@ class _Db extends Table
return true;
}
elseif ( array_key_exists( $this->sortBy, $count ) )
elseif ( array_key_exists( preg_replace( "/^.+?\.(.+?)$/", "$1", $this->sortBy ), $count ) )
{
return true;
}
+72 -8
View File
@@ -2,9 +2,9 @@
/**
* @brief Table Builder
* @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
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
@@ -28,7 +28,8 @@ const SEARCH_NUMERIC = 6;
const SEARCH_BOOL = 7;
const HEADER = 8;
const SEARCH_RADIO = 9;
const SEARCH_NUMERIC_TEXT = 10;
const SEARCH_QUERY_TEXT = 11;
/**
* List Table Builder
*/
@@ -306,6 +307,28 @@ abstract class _Table
}
}
/**
* Return the column without a table prefix
* For example, we might allow array( 'last_post', 'author' ) but the $this->sortBy property is often set as "app_table.last_post" meaning
* that the filter drop down doesn't show the selected value correctly.
*
* @param string $property Property we are updating
* @param mixed $value Value being set
* @return void
*/
public function getSortByColumn()
{
if ( mb_strpos( $this->sortBy, '.' ) )
{
list( $table, $column ) = explode( '.', $this->sortBy );
return $column;
}
else
{
return $this->sortBy;
}
}
/**
* Build Advanced Search Form
*
@@ -337,6 +360,21 @@ abstract class _Table
$form->add( new \IPS\Helpers\Form\Text( $this->langPrefix . $k, NULL, FALSE, $options ) );
break;
case SEARCH_QUERY_TEXT:
$form->add( new \IPS\Helpers\Form\Custom( $this->langPrefix . $k, NULL, FALSE, array(
'getHtml' => function( $element )
{
return \IPS\Theme::i()->getTemplate( 'forms', 'core' )->select( "{$element->name}[0]", $element->value[0], $element->required, array(
'c' => \IPS\Member::loggedIn()->language()->addToStack('contains'),
'bw' => \IPS\Member::loggedIn()->language()->addToStack('begins_with'),
'eq' => \IPS\Member::loggedIn()->language()->addToStack('exactly'),
) )
. ' '
. \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->text( "{$element->name}[1]", 'text', $element->value[1], $element->required, NULL, FALSE, NULL, NULL, NULL, '', NULL, FALSE, NULL, array(), array(), array( $element->name . '-qty' ) );
}
) ) );
break;
case SEARCH_DATE_RANGE:
$form->add( new \IPS\Helpers\Form\DateRange( $this->langPrefix . $k, array( 'start' => '', 'end' => '' ), FALSE, $options ) );
break;
@@ -358,6 +396,7 @@ abstract class _Table
break;
case SEARCH_NUMERIC:
case SEARCH_NUMERIC_TEXT:
$form->add( new \IPS\Helpers\Form\Custom( $this->langPrefix . $k, NULL, FALSE, array(
'getHtml' => function( $element )
{
@@ -411,6 +450,9 @@ abstract class _Table
/* Are we displaying the advanced search form? */
if ( \IPS\Request::i()->advancedSearchForm )
{
/* If we are showing just the advanced search form, send a noindex meta tag */
\IPS\Output::i()->metaTags['robots'] = 'noindex';
return (string) $this->advancedSearch();
}
/* No? Try getting some values then */
@@ -422,7 +464,7 @@ abstract class _Table
/* Get rows */
$rows = $this->getRows( $advancedSearchValues );
/* Check we're on a valid page (must come after getRows() as this is where $this->pages is set) */
if ( $this->page )
{
@@ -435,9 +477,15 @@ abstract class _Table
/* Add link tags */
if ( $this->page != 1 )
{
\IPS\Output::i()->linkTags['canonical'] = (string) $this->baseUrl->setQueryString( $this->paginationKey, $this->page );
\IPS\Output::i()->linkTags['first'] = (string) $this->baseUrl->setQueryString( $this->paginationKey, 1 );
\IPS\Output::i()->linkTags['prev'] = (string) $this->baseUrl->setQueryString( $this->paginationKey, $this->page - 1 );
}
/* If we literally requested ?page=1 add canonical tag to get rid of the page query string param */
elseif( isset( $this->baseUrl->data[ \IPS\Http\Url::COMPONENT_QUERY ][ $this->paginationKey ] ) )
{
\IPS\Output::i()->linkTags['canonical'] = (string) $this->baseUrl->stripQueryString( $this->paginationKey );
}
if ( $this->pages > $this->page )
{
\IPS\Output::i()->linkTags['next'] = (string) $this->baseUrl->setQueryString( $this->paginationKey, $this->page + 1 );
@@ -476,6 +524,10 @@ abstract class _Table
{
\IPS\IPS::exceptionHandler( $e );
}
catch ( \Throwable $e )
{
\IPS\IPS::exceptionHandler( $e );
}
}
/**
@@ -558,7 +610,16 @@ abstract class _Table
{
if( !empty( $advancedSearchValues ) )
{
$headers = array_combine( array_merge( $this->include, array_keys( $advancedSearchValues ) ), array_merge( $this->include, array_keys( $advancedSearchValues ) ) );
$headers = array_combine( $this->include, $this->include );
foreach ( $this->getRows( $advancedSearchValues ) as $row )
{
foreach ( array_keys( $row ) as $header )
{
$headers[ $header ] = $header;
}
break;
}
}
else
{
@@ -589,7 +650,7 @@ abstract class _Table
{
return FALSE;
}
/**
* Get the advanced search values
*
@@ -623,7 +684,7 @@ abstract class _Table
continue;
}
if ( $v )
if ( $v !== NULL )
{
if( \IPS\Request::i()->isAjax() )
{
@@ -638,7 +699,10 @@ abstract class _Table
}
else
{
$v = urldecode( $v );
if ( ! is_object( $v ) )
{
$v = urldecode( $v );
}
}
}