/*-------------------------------------------------------------------------*/
// 3 Случайных изображения из галереи
/*-------------------------------------------------------------------------*/
function rand5_images()
{
//-----------------------------------------
// Init
//-----------------------------------------
$this->ipsclass->vars['gallery_img_show_filesize'] = 0;
$this->ipsclass->vars['gallery_img_show_views'] = 0;
$this->ipsclass->vars['gallery_img_show_rate'] = 0;
$this->ipsclass->vars['gallery_img_show_comments'] = 0;
$this->ipsclass->gallery_root = './modules/gallery/';
$this->ipsclass->DB->load_cache_file( ROOT_PATH.'sources/sql/'.SQL_DRIVER.'_gallery_queries.php', 'gallery_sql_queries' );
require_once( $this->ipsclass->gallery_root.'lib/gallery_library.php' );
$glib = new gallery_lib();
$glib->ipsclass =& $this->ipsclass;
require_once( $this->ipsclass->gallery_root.'categories.php' );
$category = new Categories;
$category->ipsclass =& $this->ipsclass;
$category->glib =& $glib;
$category->read_data( true, 'Select a category', 0 );
//-----------------------------------------
// Output
//-----------------------------------------
if( $this->ipsclass->vars['gallery_stats_where'] == 'both' || $this->ipsclass->vars['gallery_stats_where'] == 'cat' )
{
$allow_cats = $allow_cats ? $allow_cats : $glib->get_allowed_cats( 1, $category->data );
}
else
{
$show_cats = 'no';
}
if( $this->ipsclass->vars['gallery_stats_where'] == 'both' || $this->ipsclass->vars['gallery_stats_where'] == 'album' )
{
$allow_albums = ( $allow_albums ) ? $allow_albums : $glib->get_allowed_albums();
}
else
{
$show_albums = 'no';
}
if( ! $img_list )
{
require_once( $this->ipsclass->gallery_root.'lib/imagelisting.php' );
$img_list = new ImageListing();
$img_list->ipsclass =& $this->ipsclass;
$img_list->glib =& $glib;
$img_list->init();
}
$total = $this->ipsclass->vars['gallery_idx_num_row'] * $this->ipsclass->vars['gallery_idx_num_col'];
$img_list->get_listing_data( array(
'st' => 0,
'show' => $total,
'approve' => 1,
'sort_key' => 'RAND()', /* If you wish to show 5 Lastest Images, replace with '' */
'album' => $show_albums,
'category' => $show_cats,
'allow_cats' => $allow_cats,
'allow_albums' => $allow_albums,
) );
$rand5 .= $this->ipsclass->compiled_templates['skin_boards']->rand5_list_top( str_replace( "<#NUM#>", $total, $this->ipsclass->lang['random5'] ) );
$rand5 .= $img_list->get_html_listing( array( 'imgs_per_col' => $this->ipsclass->vars['gallery_idx_num_col'], 'imgs_per_row' => $this->ipsclass->vars['gallery_idx_num_row'] ) );
$rand5 .= $this->ipsclass->compiled_templates['skin_boards']->rand5_list_end();
return $rand5;
}