Просмотр файла module/gallery.php

Размер файла: 2.12Kb
<?php	
/*************************************************
 *    apwa.ru       gallery.php
 *                 -------------
 * [email protected] 2011 Модуль портала для phpbb 2.0.23
 ************************************************/
$CFG['nm_pics'] = (!$CFG['nm_pics']) ? '0' : $CFG['nm_pics'];
$CFG['cat_id'] = (!$CFG['cat_id']) ? '5' : $CFG['cat_id'];

if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
}
$template->set_filenames(array(
	'gallery' => 'module/gallery_body.tpl')
);

$template->assign_block_vars('gallery', array());

$display = ($CFG['display']) ? 'RAND()' : 'pic_time DESC';	
$limit = ($template_name == 'web') ? '12' : $CFG['nm_pics'];
$gallerysql = ($profiledata['user_id']) ? 'WHERE pic_user_id = ' . $profiledata['user_id'] . '' : 'WHERE pic_cat_id IN (' . $CFG['cat_id'] . ')';	

$sql = "SELECT pic_id, pic_title FROM " . ALBUM_TABLE . "	   
	$gallerysql 
        AND pic_lock = 0	
	AND pic_approval = 1
	ORDER BY $display LIMIT $limit";	 
if ( !$result = $db->sql_query($sql) )
{
	message_die(GENERAL_ERROR, "Не возможно получить информацию с галереи.", '', __LINE__, __FILE__, $sql);
}
$picrow = array();
while ($row = $db->sql_fetchrow($result))
{
	$picrow[] = $row;
}
$db->sql_freeresult($result);
for ($i = 0; $i < count($picrow); $i += 6)      
{
        $template->assign_block_vars('gallery.cool', array());		
	for ($j = $i; $j < ($i + 6); $j++)
	{ 
		if( $j >= count($picrow) )
		{
			break;
		}
                $pic_title = $picrow[$j]['pic_title'];	       	
                $template->assign_block_vars('gallery.cool.picrow', array(
              	      'PIC_IMAGE' => append_sid('album_pic.'. $phpEx . '?thumb=1&amp;pic_id=' . $picrow[$j]['pic_id']),
              	      'PIC_MINI' => append_sid('album_pic.'. $phpEx . '?thumb=2&amp;pic_id=' . $picrow[$j]['pic_id']), 
                      'PIC_TITLE' => $pic_title,
                      'U_PIC_LINK' => append_sid('album_page.' . $phpEx . '?pic_id=' . $picrow[$j]['pic_id']))
	        );
	}        
}
$template->assign_var_from_handle('MODULE_GALLERY', 'gallery');
   
?>