Version 4.7.13
This commit is contained in:
1 parent
fd22d99e69
commit
7124a02564
954 files changed
+29277
-59308
No files matched your search
@@ -36,12 +36,25 @@ class _Images
|
||||
$where = array(
|
||||
array( "image_member_id=? AND image_approved=?", $member->member_id, 1 ),
|
||||
);
|
||||
|
||||
|
||||
if ( $search )
|
||||
{
|
||||
$where[] = array( "image_caption LIKE ( CONCAT( '%', ?, '%' ) )", $search );
|
||||
$albumIds = [];
|
||||
foreach( \IPS\Db::i()->select( 'album_id', 'gallery_albums', array( "album_owner_id=? AND album_name LIKE ( CONCAT( '%', ?, '%' ) )", $member->member_id, $search ), NULL, 250 ) as $album )
|
||||
{
|
||||
$albumIds[] = $album;
|
||||
}
|
||||
|
||||
if ( count( $albumIds ) )
|
||||
{
|
||||
$where[] = array( "( image_caption LIKE ( CONCAT( '%', ?, '%' ) ) OR ( " . \IPS\Db::i()->in( 'image_album_id', $albumIds ) . " ) )", $search );
|
||||
}
|
||||
else
|
||||
{
|
||||
$where[] = array( "image_caption LIKE ( CONCAT( '%', ?, '%' ) )", $search );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return \IPS\Db::i()->select( 'COUNT(*)', 'gallery_images', $where )->first();
|
||||
}
|
||||
|
||||
@@ -60,17 +73,31 @@ class _Images
|
||||
$where = array(
|
||||
array( "image_member_id=? AND image_approved=?", $member->member_id, 1 ),
|
||||
);
|
||||
|
||||
|
||||
if ( $search )
|
||||
{
|
||||
$where[] = array( "image_caption LIKE ( CONCAT( '%', ?, '%' ) )", $search );
|
||||
$albumIds = [];
|
||||
foreach( \IPS\Db::i()->select( 'album_id', 'gallery_albums', array( "album_owner_id=? AND album_name LIKE ( CONCAT( '%', ?, '%' ) )", $member->member_id, $search ), NULL, 250 ) as $album )
|
||||
{
|
||||
$albumIds[] = $album;
|
||||
}
|
||||
|
||||
if ( count( $albumIds ) )
|
||||
{
|
||||
$where[] = array( "( image_caption LIKE ( CONCAT( '%', ?, '%' ) ) OR ( " . \IPS\Db::i()->in( 'image_album_id', $albumIds ) . " ) )", $search );
|
||||
}
|
||||
else
|
||||
{
|
||||
$where[] = array( "image_caption LIKE ( CONCAT( '%', ?, '%' ) )", $search );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$return = array();
|
||||
foreach ( \IPS\Db::i()->select( '*', 'gallery_images', $where, 'image_date DESC', array( ( $page - 1 ) * $limit, $limit ) ) as $row )
|
||||
{
|
||||
$image = \IPS\gallery\Image::load( $row['image_id'] );
|
||||
$obj = \IPS\File::get( 'gallery_Images', $image->masked_file_name );
|
||||
$fileName = $image->masked_file_name ?: $image->original_file_name;
|
||||
$obj = \IPS\File::get( 'gallery_Images', $fileName );
|
||||
$obj->contextInfo = $image->caption;
|
||||
$return[ (string) $image->url() ] = $obj;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user