/* ==================================== */
case 'gallery':
/* ==================================== */
//TESTING
$f = sed_import('f','G','TXT');
$collections = explode("|", $f);
$numcol = count($collections);
$count = '0';
$num = '0';
//$serialized = serialise($collections);
while ($numcol != $count){
$jj=0;
$sql_pff = mysql_query("SELECT f.*, u.user_name FROM $db_pfs_folders f, $db_users u WHERE pff_id=$collections[$count] AND pff_ispublic=1 AND pff_isgallery=1 AND f.pff_userid=u.user_id") or die(mysql_error());
sed_die(mysql_num_rows($sql_pff)==0);
$pff = sed_sql_fetcharray($sql_pff);
$sql = mysql_query("SELECT * FROM $db_pfs WHERE pfs_folderid=$collections[$count] ORDER BY pfs_$cfg_sortby $cfg_sortway") or die(mysql_error());
$nbitems = sed_sql_numrows($sql_pff);
$pff['pff_title'] = sed_cc($pff['pff_title']);
$userid = $pff['pff_userid'];
$t->assign(array(
"GALLERY_ID" => $pff['pff_id'],
"GALLERY_TITLE" => "<a href=\"plug.php?e=gallery&f=".$pff['pff_id']."\"> ".$pff['pff_title']."</a>",
"GALLERY_SHORTTITLE" => $pff['pff_title'],
"GALLERY_DESC" => sed_cc($pff['pff_desc']),
"GALLERY_COUNT" => $pff['pff_count'],
// "GALLERY_COMMENTS" => $pff['comments'],
// "GALLERY_RATING" => $pff['ratings'],
"GALLERY_AUTHOR" => $pff['author']
));
// $pff['comments'] = sed_comments('g'.$pff['pff_id']);
// $pff['ratings'] = sed_ratings('g'.$pff['pff_id']);
while ($pfs = sed_sql_fetcharray($sql))
{
$jj++;
$pfs['pfs_fullfile'] = $cfg['pfs_dir'].$pfs['pfs_file'];
$pfs['pfs_filesize'] = floor($pfs['pfs_size']/1024);
if (($pfs['extension']=='jpg' || $pfs['extension']=='jpeg' || $pfs['extension']=='png') && $cfg['th_amode']!='Disabled')
{
if (!file_exists($cfg['th_dir'].$pfs['pfs_file']) && file_exists($cfg['pfs_dir'].$pfs['pfs_file']))
{
$pfs['th_colortext'] = array(
hexdec(substr($cfg['th_colortext'], 0, 2)),
hexdec(substr($cfg['th_colortext'], 2 ,2)),
hexdec(substr($cfg['th_colortext'], 4 ,2))
);
$pfs['th_colorbg'] = array(
hexdec(substr($cfg['th_colorbg'], 0, 2)),
hexdec(substr($cfg['th_colorbg'], 2, 2)),
hexdec(substr($cfg['th_colorbg'], 4, 2))
);
sed_createthumb(
$cfg['pfs_dir'].$pfs['pfs_file'],
$cfg['th_dir'].$pfs['pfs_file'],
$cfg['th_x'],
$cfg['th_y'],
$cfg['th_keepratio'],
$pfs['pfs_extension'],
$pfs['pfs_file'],
$pfs['pfs_filesize'],
$pfs['th_colortext'],
$cfg['th_textsize'],
$pfs['th_colorbg'],
$cfg['th_border'],
$cfg['th_jpeg_quality']
);
}
}
if ($cfg['plugin']['gallery']['columns']==1)
{
$pfs['cond1'] = '<tr>';
$pfs['cond2'] = '</tr>';
}
elseif ($jj==1)
{
$pfs['cond1'] = '<tr>';
$pfs['cond2'] = '';
}
elseif ($jj==$cfg['plugin']['gallery']['columns'])
{
$jj=0;
$pfs['cond1'] = '';
$pfs['cond2'] = '</tr>';
}
else
{
$pfs['cond1'] = '';
$pfs['cond2'] = '';
}
$pfs['picturecode'] = 'g'.$pff['pff_id'].'-'.$pfs['pfs_id'];
// $pfs['comments'] = sed_comments($pfs['picturecode']);
// $pfs['ratings'] = sed_ratings($pfs['picturecode']);
$pfs['new'] = ($pfs['pfs_date']+$cfg['plugin']['gallery']['newdelay']*86400>$sys['now']) ? $cfg['plugin']['gallery']['newtext'] : '';
if (sed_gallery_ismovie($pfs['pfs_extension']))
{
$pfs['pfs_imgsize'] = array ('?','?');
$pfs['pfs_imgsize_xy'] = '';
$pfs['popup'] = "plug.php?e=gallery&v=".$pfs['pfs_id'];
}
else
{
$pfs['pfs_imgsize'] = @getimagesize($pfs['pfs_fullfile']);
$pfs['pfs_imgsize_xy'] = $pfs['pfs_imgsize'][0].'x'.$pfs['pfs_imgsize'][1];
$pfs['popup'] = "javascript:popup('gallery&v=".$pfs['pfs_id']."',".($pfs['pfs_imgsize'][0]+$cfg['plugin']['gallery']['popupmargin']).",".($pfs['pfs_imgsize'][1]+$cfg['plugin']['gallery']['popupmargin']).")";
}
if ($usr['isadmin'])
{
$pfs['admin'] = "<a href=\"pfs.php?m=edit&id=".$pfs['pfs_id']."&userid=".$userid."\">".$L['Edit']."</a>";
$pfs['admin'] .= " <a href=\"plug.php?e=gallery&m=edit&a=potw&id=".$pfs['pfs_id']."\">".$L['gal_setaspotw']."</a>";
}
$t-> assign(array(
"GALLERY_ROW_ID" => $pfs['pfs_id'],
"GALLERY_ROW_VIEWURL" => "plug.php?e=galleria&f=".$pfs['pfs_folderid']."#datas/users/".$pfs['pfs_file'],
"GALLERY_ROW_VIEWURL_POPUP" => $pfs['popup'],
"GALLERY_ROW_FILE" => $pfs['pfs_file'],
"GALLERY_ROW_FULLFILE" => $pfs['pfs_fullfile'],
"GALLERY_ROW_THUMB" => sed_gallery_thumb($pfs['pfs_extension'], $pfs['pfs_file']),
"GALLERY_ROW_ICON" => $icon[$pfs['pfs_extension']],
"GALLERY_ROW_DESC" => $pfs['pfs_desc'],
"GALLERY_ROW_SHORTDESC" => sed_cc($pfs['pfs_desc'], 64),
"GALLERY_ROW_DATE" => date($cfg['dateformat'], $pfs['pfs_date'] + $usr['timezone'] * 3600),
"GALLERY_ROW_NEW" => $pfs['new'],
"GALLERY_ROW_SIZE" => $pfs['pfs_filesize'].$L['kb'],
"GALLERY_ROW_DIMX" => $pfs['pfs_imgsize'][0],
"GALLERY_ROW_DIMY" => $pfs['pfs_imgsize'][1],
"GALLERY_ROW_DIMXY" => $pfs['pfs_imgsize_xy'],
"GALLERY_ROW_COUNT" => $pfs['pfs_count'],
// "GALLERY_ROW_COMMENTS" => $pfs['comments'],
// "GALLERY_ROW_RATING" => $pfs['ratings'],
"GALLERY_ROW_ADMIN" => $pfs['admin'],
"GALLERY_ROW_COND1" => $pfs['cond1'],
"GALLERY_ROW_COND2" => $pfs['cond2'],
"GALLERY_ROW_TEST" => $num
));
$t->parse("MAIN.GALLERY.ROW");
}
$t->parse("MAIN.GALLERY");
$count++;
}
$t->parse("MAIN.MENU");
break;