<?php
/*-----------------------------------------------------------------------------------------
mcGalleryPRO
All code is © 2003 Marc Cagninacci.
No files may be redistributed in whole or significant part.
----------------- mcgalleryPRO IS NOT FREE SOFTWARE -------------------
You should have receive a file called license.txt in this package
--------------------------------------------------------------------------------------------*/
session_start();
include './admin/conf.inc.php';
include './header.php';
if (empty($_SESSION['lang'])) $_SESSION['lang'] = $lang_def;
include './lang/'.$_SESSION['lang'];
if ((empty($video) && empty($flash)) || $sel == 'P' || $t == 'P')
{
$table = 'mcgallery_photo';
$table_album = 'mcgallery_albumphoto';
$item = 'photos';
$selt = 'P';
$backtype = '';
}
if (!empty($rand)) { unset($_SESSION['tab']); }
else
{
if ($video == '1' || $sel == 'V' || $t == 'V' || $tab == 'v')
{
$table = 'mcgallery_video';
$table_album = 'mcgallery_albumvideo';
$item = 'videos';
$selt = 'V';
$backtype = 'video=1&';
}
if ($flash == '1' || $sel == 'F' || $t == 'F' || $tab == 'f')
{
$table = 'mcgallery_flash';
$table_album = 'mcgallery_albumflash';
$item = 'flash';
$selt = 'F';
$backtype = 'flash=1&';
}
}
$connect = mysql_connect($host,$login,$pass);
mysql_select_db($base, $connect);
$query = "UPDATE $table SET visite=visite+1 WHERE id = $id";
mysql_query ($query);
$query = "SELECT * FROM $table WHERE id = $id";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$album = $row['idalbum'];
if ($searchit == '')
{
if ($sel != '')
{
$private_login = $_SESSION['private_login'];
$query2 = "SELECT id, file FROM mcgallery_select WHERE login ='$private_login' AND type ='$sel' ORDER BY file";
}
else
{
$query2 = "SELECT id, file FROM $table WHERE idalbum ='$album' ORDER BY title, file";
}
$result2 = mysql_query($query2);
$prevarray = array();
$prevfile = array();
while ($row2 = mysql_fetch_array($result2))
{
$prevarray[] = $row2['id'];
$prevfile[] = $row2['file'];
}
$cle = array_search($id, $prevarray);
if ($cle > 0)
{
list($path1,$path2) = split('_', $prevfile[$cle - 1], 2);
$small = explode('.', $path2);
if (file_exists($item.'/'.$path1.'/small/'.$small[0].'.jpg')) $thumbnail = $small[0].'.jpg';
if (file_exists($item.'/'.$path1.'/small/'.$small[0].'.JPG')) $thumbnail = $small[0].'.JPG';
if (file_exists($item.'/'.$path1.'/small/'.$small[0].'.png')) $thumbnail = $small[0].'.png';
if (file_exists($item.'/'.$path1.'/small/'.$small[0].'.PNG')) $thumbnail = $small[0].'.PNG';
$previd = '<a href="show.php?'.$backtype.'sel='.$sel.'&start='.$start.'&id='.$prevarray[$cle-1].'" onMouseOver="window.status=\'\';return true" class="lien1"><img src="images/gauche.gif" border="0" alt="<" align="middle"> <img src="'.$item.'/'.$path1.'/small/'.$thumbnail.'" border="0" alt="<" width="'.$thumb_title.'" align="middle"></a>';
}
if (isset($prevarray[$cle + 1]))
{
list($path3,$path4) = split('_', $prevfile[$cle + 1], 2);
$small1 = explode('.', $path4);
if (file_exists($item.'/'.$path3.'/small/'.$small1[0].'.jpg')) $thumbnail1 = $small1[0].'.jpg';
if (file_exists($item.'/'.$path3.'/small/'.$small1[0].'.JPG')) $thumbnail1 = $small1[0].'.JPG';
if (file_exists($item.'/'.$path3.'/small/'.$small1[0].'.png')) $thumbnail1 = $small1[0].'.png';
if (file_exists($item.'/'.$path3.'/small/'.$small1[0].'.PNG')) $thumbnail1 = $small1[0].'.PNG';
$nextid = '<a href="show.php?'.$backtype.'sel='.$sel.'&start='.$start.'&id='.$prevarray[$cle+1].'" onMouseOver="window.status=\'\';return true"class="lien1"><img src="'.$item.'/'.$path3.'/small/'.$thumbnail1.'" border="0" alt=">" width="'.$thumb_title.'" align="middle"> <img src="images/droit.gif" border="0" alt=">" align="middle"></a>';
}
}
?>
<table border="0" cellspacing="1" cellpadding="5" align="center" class="td1">
<tr>
<td class="td0" align="center" colspan="2">
<table border="0" cellspacing="0" cellpadding="1" align="center" width="100%">
<tr>
<td class="td1bis" nowrap><font size="1"><?php echo $previd; ?></font></td>
<td class="td1bis" align="center" width="100%">
<font size="2">
<?php
if ($row['cat'] != '') { echo stripslashes($row['cat']).' - '; }
if ($row['album'] != '') { echo stripslashes($row['album']); }
if ($row['title'] != '') { echo ' - '.stripslashes($row['title']); }
echo '</font></td><td class="td1bis" align="right" nowrap><font size="1">'.$nextid.'</font></td>';
echo '</tr></table>';
echo '</td></tr><tr>';
$len= strlen($album);
$image= substr($row['file'], ($len + 1));
echo '<td class="td3" align="center" colspan="2">';
if ($item == 'photos')
{
if ($row['watermark'] == 3) $wm = urlencode(stripslashes($row['string']));
else $wm = $row['watermark'];
if ($sel != '')
{
echo shadow8($album, $image, $start, $wm);
}
elseif ($t == 'P')
{
echo shadow4($album, $image, $start, $t, $searchit, $searchwhere, $searchalb, $wm);
}
elseif (!empty($top))
{
echo shadow21($album, $image, $tab, $top, $wm);
}
else
{
echo shadow2($album, $image, $start, $wm);
}
}
if ($item == 'videos')
{
echo '<embed src="'.$item.'/'.$album.'/'.$image.'" width="'.$video_width.'" height="'.$video_height.'" autostart="true" align="middle"></embed>';
}
if ($item == 'flash')
{
?>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="<?php echo $flash_width; ?>" height="<?php echo $flash_height; ?>">
<param name="movie" value="flash/<?php echo $album.'/'.$image; ?>"><param name="quality" value="high">
<embed src="flash/<?php echo $album.'/'.$image; ?>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="<?php echo $flash_width; ?>" height="<?php echo $flash_height; ?>"></embed>
</object>
<?php
}
echo '</td></tr>';
echo "\n";
list($y, $m, $d) = split('-', $row['add_date']);
if ($datepref == 'fr') $datedis = $d.'/'.$m.'/'.$y;
elseif ($datepref == 'en') $datedis = $m.'/'.$d.'/'.$y;
else $datedis = $row['add_date'];
echo '<tr><td class="td0" colspan="2" align="center"><font size="1">'.$l_Added.': '.$datedis.' - '.$l_Visite.' '.$row['visite'].' '.$l_times.'</font></td></tr>';
echo "\n";
if ($row['title'] != '')
{
echo '<tr><td class="td1" align="left" width="20%"><font size="1">'.$l_Album.': </font></td>';
echo '<td class="td2" align="left"><font size="1">'.stripslashes($row['album']).'</font></td></tr>';
echo '<tr><td class="td1" align="left" width="20%"><font size="1">'.$l_Titre.': </font></td>';
echo '<td class="td2" align="left"><font size="1">'.stripslashes($row['title']).'</font></td></tr>';
echo "\n";
}
if ($row['author'] != '' || $row['email'] != '' || $row['url'] != '')
{
echo '<tr><td class="td1" align="left" width="20%"><font size="1">'.$l_Auteur.': </font></td>';
echo '<td class="td2" align="left"><font size="1">'.stripslashes($row['author']).'</font>';
if ($row['email'] != '') { echo ' <a href="#" onclick="javascript:window.open(\'./mailto.php?wh='.$selt.'&for='.$row['id'].'\',\'\',\'width=300,height=350,left=100, top=100\');" onMouseOver="window.status=\'\';return true"><img src="images/ecrire.gif" border="0" alt="mail to"></a>'; }
if ($row['url'] != '') { echo ' <a href="'.$row['url'].'" target="_blank" onMouseOver="window.status=\'\';return true"><img src="images/home.gif" border="0" alt="home"></a>'; }
echo '</td></tr>';
echo "\n";
}
if ($row['descr'] != '')
{
echo '<tr><td class="td1" align="left" width="20%" valign="top"><font size="1">'. $l_Description.': </font></td>';
echo '<td class="td2" align="left" width="'.($taille[0]/1.3).'"><font size="1">'.nl2br(stripslashes($row['descr'])).'</font></td></tr>';
echo "\n";
}
if ($row['ref'] != '')
{
echo '<tr><td class="td1" align="left" width="20%" valign="top"><font size="1">'. $l_ref.': </font></td>';
echo '<td class="td2" align="left" width="'.($taille[0]/1.3).'"><font size="1">'.$row['ref'];
echo '</font></td></tr>';
echo "\n";
}
echo "\n";
echo '<tr><td class="td1" align="center" colspan="2"><font size="1">';
$query = "SELECT comment, ecard, selection FROM $table_album WHERE idalbum = $album";
$rowalb = mysql_fetch_array(mysql_query($query));
if ($rowalb['comment'] > 1)
{
echo "\n";
echo '<a href="#" onclick="javascript:window.open(\'./add.php?l='.$rowalb['comment'].'&t='.$selt.'&id='.$row['id'].'\',\'\',\'width=300,height=300,left=100, top=100\');" class="lien2" onMouseOver="window.status=\'\';return true">'.$l_add_comment.'</a>';
}
if ($rowalb['selection'] == 2 && empty($sel))
{
echo "\n";
echo ' <a href="#" onclick="javascript:window.open(\'./select.php?&t='.$selt.'&id='.$row['id'].'\',\'\',\'width=250,height=250,left=100, top=100\');" class="lien2" onMouseOver="window.status=\'\';return true">'.$l_sel_add.'</a>';
}
if ($rowalb['ecard'] >= 2)
{
echo "\n";
echo ' <a href="#" onclick="javascript:window.open(\'./card.php?l='.$rowalb['ecard'].'&im='.$item.'/'.$album.'/'.$image.'\',\'\',\'width=300,height=350,left=100, top=100\');" class="lien2" onMouseOver="window.status=\'\';return true">'.$l_ecard.'</a>';
}
if (file_exists('./photos/'.$album.'/big/'.$image))
{
echo "\n";
$hidef = 'photos/'.$album.'/big/'.$image;
?>
<A HREF="#" onClick="window.open('hidef.php?hidef=<?php echo $id; ?>','','scrollbars=1,fullscreen');return(false)" class="lien2" onMouseOver="window.status='';return true"><?php echo $l_hidef; ?> (<?php echo round((filesize($hidef)/1024/1024),2); ?> Mb)</A>
<?php
}
echo '</font></td></tr>';
if ($rowalb['comment'] > 1)
{
include './comment.php';
}
echo '<tr><td class="td1" align="center" colspan="2">';
if (!empty($sel))
{
echo "\n";
echo '<font size="1"><a href="index.php?start='.$start.'&sel='.$sel.'" class="lien2" onMouseOver="window.status=\'\';return true">'.$l_Retour.'</a></font>';
}
if (!empty($top))
{
echo "\n";
echo '<font size="1"><a href="index.php?tab='.$tab.'&top='.$top.'" class="lien2" onMouseOver="window.status=\'\';return true">'.$l_Retour.'</a></font>';
}
if (empty($top) && empty($sel))
{
echo "\n";
if (!empty($t)) { $go = '&searchalb='.$searchalb.'&searchwhere='.$searchwhere.'&t='.$t.'&searchit='.$searchit; }
echo '<font size="1"><a href="index.php?'.$backtype.'start='.$start.'&album='.$album.$go.'" class="lien2" onMouseOver="window.status=\'\';return true">'.$l_Retour.'</a></font>';
}
echo '</td></tr><tr><td class="td0" colspan="2"> ';
echo '</td></tr></table>';
include './footer.php';
?>