Version 4.7.23
This commit is contained in:
1 parent
7124a02564
commit
25ddeb65d6
1791 files changed
+76990
-44452
No files matched your search
@@ -94,6 +94,7 @@ class _Db extends Table
|
||||
|
||||
/**
|
||||
* Get rows
|
||||
* @note This method is called twice, so if there'some expensive operation happening, or if you're calculating something, make sure to cache it.
|
||||
*
|
||||
* @param array $advancedSearchValues Values from the advanced search form
|
||||
* @return array
|
||||
@@ -107,7 +108,7 @@ class _Db extends Table
|
||||
{
|
||||
$where[] = \is_array( $this->filters[ $this->filter ] ) ? $this->filters[ $this->filter ] : array( $this->filters[ $this->filter ] );
|
||||
}
|
||||
|
||||
|
||||
/* Add quick search term to where clause if necessary */
|
||||
if ( $this->quickSearch !== NULL and \IPS\Request::i()->quicksearch )
|
||||
{
|
||||
@@ -303,6 +304,7 @@ class _Db extends Table
|
||||
}
|
||||
|
||||
$selects = $this->selects;
|
||||
$isOtherJoin = false;
|
||||
|
||||
if ( \count( $this->joins ) )
|
||||
{
|
||||
@@ -312,12 +314,20 @@ class _Db extends Table
|
||||
{
|
||||
$selects[] = $join['select'];
|
||||
}
|
||||
|
||||
if ( isset( $join['type'] ) and \mb_strtolower( $join['type'] ) != 'left' )
|
||||
{
|
||||
/* Inner join or straight join which will affect the query results */
|
||||
$isOtherJoin = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Count results (for pagination) */
|
||||
$count = $this->db->select( 'count(*)', $this->table, $where, NULL, NULL, $this->groupBy );
|
||||
if ( \count( $this->joins ) )
|
||||
|
||||
/* Add the joins if we have a where statement and all joins are left for the count */
|
||||
if ( ( $isOtherJoin or \count( $where ) ) and \count( $this->joins ) )
|
||||
{
|
||||
foreach( $this->joins as $join )
|
||||
{
|
||||
@@ -366,7 +376,7 @@ class _Db extends Table
|
||||
}
|
||||
else
|
||||
{
|
||||
list( $field, $direction ) = explode( ' ', $v );
|
||||
[ $field, $direction ] = explode( ' ', $v );
|
||||
$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' );
|
||||
}
|
||||
@@ -538,7 +548,7 @@ class _Db extends Table
|
||||
|
||||
if ( mb_strstr( $field, ' ' ) )
|
||||
{
|
||||
list( $field, $direction ) = explode( ' ', $field );
|
||||
[ $field, $direction ] = explode( ' ', $field );
|
||||
}
|
||||
|
||||
if ( !array_key_exists( trim($field), $count ) )
|
||||
|
||||
Reference in new issue
Block a user