<?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();
if (empty($_SESSION['private_login']))
{
include "./sess.php";
exit;
}
include './header.php';
$connect = mysql_connect($host,$login,$pass);
mysql_select_db($base, $connect);
// form to album settings
?>
<script language="JavaScript">
<!--
function MM_popupMsg(msg) {
alert(msg);
}
//-->
</script>
<?php
if ($albumlevel != '')
{
$query = "SELECT level, comment, ecard, selection FROM mcgallery_albumvideo WHERE idalbum = $albumlevel";
$res = mysql_query($query);
$row = mysql_fetch_array($res);
echo '<table border="0" cellspacing="1" cellpadding="3" align="center">';
echo '<form method="post" action="indexvideo.php">';
echo '<tr><td bgcolor="black" align="center" colspan="3"><font face="verdana" size="2" color="white">'.$l_Album.' <b>'.$albumlevel.'</b></font></td</tr>';
echo '<tr><td bgcolor="#CCCCCC"><font face="verdana" size="1" color="black">'.$l_Album.' '.$l_Level.'</font></td>';
echo '<td bgcolor="#CCCCCC"><input type="text" name="alb_level" value="'.$row['level'].'" size="3"></ td>';
echo '<td bgcolor="#CCCCCC"> ';
echo '<a href="#" onClick="MM_popupMsg(\''.$l_pop_level.'\')">';
echo '<img src="../images/b_help.gif" border="0" alt=""></a></td></tr>';
echo '<tr><td bgcolor="#CCCCCC"><font face="verdana" size="1" color="black">'.$l_Comments.'</font></td>';
echo '<td bgcolor="#CCCCCC"><select name="alb_comment">';
echo '<option value="'.$row['comment'].'" checked>'.$row['comment'].'</option>';
echo '<option value=""> </option>';
echo '<option value="1">1</option>';
echo '<option value="2">2</option>';
echo '<option value="3">3</option>';
echo '<option value="4">4</option>';
echo '<option value="5">5</option>';
echo '<option value="6">6</option>';
echo '</select></ td>';
echo '<td bgcolor="#CCCCCC"> ';
echo '<a href="#" onClick="MM_popupMsg(\''.$l_pop_comment.'\')">';
echo '<img src="../images/b_help.gif" border="0" alt=""></a></td></tr>';
echo '<tr><td bgcolor="#CCCCCC"><font face="verdana" size="1" color="black">'.$l_Ecard.'</font></td>';
echo '<td bgcolor="#CCCCCC"><select name="alb_ecard">';
echo '<option value="'.$row['ecard'].'" checked>'.$row['ecard'].'</option>';
echo '<option value=""> </option>';
echo '<option value="1">1</option>';
echo '<option value="2">2</option>';
echo '<option value="3">3</option>';
echo '</select></ td>';
echo '<td bgcolor="#CCCCCC"> ';
echo '<a href="#" onClick="MM_popupMsg(\''.$l_pop_ecard.'\')">';
echo '<img src="../images/b_help.gif" border="0" alt=""></a></td></tr>';
echo '<tr><td bgcolor="#CCCCCC"><font face="verdana" size="1" color="black">'.$l_sel_add.'</font></td>';
echo '<td bgcolor="#CCCCCC"><select name="alb_selection">';
echo '<option value="'.$row['selection'].'" checked>'.$row['selection'].'</option>';
echo '<option value=""> </option>';
echo '<option value="1">1</option>';
echo '<option value="2">2</option>';
echo '</select></ td>';
echo '<td bgcolor="#CCCCCC"> ';
echo '<a href="#" onClick="MM_popupMsg(\''.$l_pop_select.'\')">';
echo '<img src="../images/b_help.gif" border="0" alt=""></a></td></tr>';
echo '<td bgcolor="#CCCCCC" colspan="3" align="right"><input type="submit" name="submit" value="OK">';
echo '<input type="hidden" name="start" value="'.$start.'">';
echo '<input type="hidden" name="set_level" value="'.$albumlevel.'"></td></tr>';
echo '</form></table><br>';
}
// albums settings
if (!empty($set_level))
{
$query = "SELECT idalbum FROM mcgallery_albumvideo WHERE idalbum=$set_level";
$result = mysql_query($query);
$nba = mysql_num_rows($result);
if ($nba == 1)
$query = "UPDATE mcgallery_albumvideo SET level='$alb_level', comment='$alb_comment', ecard='$alb_ecard', selection='$alb_selection' WHERE idalbum=$set_level";
else
$query = "INSERT INTO mcgallery_albumvideo VALUES($set_level, '','',$alb_level, $alb_comment, $alb_ecard, $alb_selection)";
mysql_query($query);
}
// update database with new videos
if ($id_album != '')
{
$dir = '../videos/'.$id_album;
$handle = opendir($dir);
rewinddir($handle);
while ($file = readdir($handle))
{
if ($file != "." && $file != ".." && $file != "small" && $file!= "Thumbs.db" && $file!="index.php" && $file!="_vti_cnf" && $file!="_vti_pvt" && $file!="_vti_script" && $file!="_vti_txt")
{
$file = $id_album.'_'.$file;
$date = date("Y-m-d");
$query = "INSERT INTO mcgallery_video (file, idalbum, album, cat, add_date) VALUES('$file',$id_album,'$album_name','$cat','$date')";
$result = mysql_query($query);
}
}
closedir($handle);
echo '<div align="center"><font face="verdana" size="2" color="black">'.$l_maj.' '.$id_album.'<br>';
echo '</font></div>';
}
// form to specify album's author
if ($author != '')
{
echo '<form method="post" action="indexvideo.php">';
echo '<table border="0" cellspacing="0" cellpadding="3" align="center">';
echo '<tr><td bgcolor="black" align="center"><font face="verdana" size="2" color="white">'.$l_auteur1.'<br>'.$author.'<br>'.$l_auteur2.':</font></td</tr>';
echo '<tr><td bgcolor="#CCCCCC" align="right"><font face="verdana" size="1" color="black">';
echo $l_Name.': <input type="text" name="unique_author"> <br>';
echo $l_Email.': <input type="text" name="unique_email"> <br>';
echo $l_Site.': <input type="text" name="unique_url"> <br>';
echo '<input type="hidden" name="start" value="'.$start.'">';
echo '<input type="submit" name="submit" value="OK"> ';
echo '<input type="hidden" name="album_author" value="'.$author.'"></font></td></tr>';
echo '</table></form>';
}
// update database with album's author
if ($unique_author != '')
{
$query = "UPDATE mcgallery_video SET author='$unique_author', email='$unique_email', url='$unique_url' WHERE idalbum=$album_author";
mysql_query($query);
}
// Give a name to an album
if ($act == 'name')
{
$query = "UPDATE mcgallery_video SET album='$album_name' WHERE idalbum=$idalbum";
mysql_query($query);
}
if ( empty($albumlevel) && empty($author)) include 'add_album.php';
// START DISPLAYING ALBUMS
?>
<table border="0" cellspacing="1" cellpadding="2" align="center">
<tr>
<td bgcolor="#OOOOOO" align="center"><font face="verdana" size="2" color="white"><? echo $l_Albums; ?></font></td>
<td bgcolor="#OOOOOO" align="center"><font face="verdana" size="2" color="white"><? echo $l_Videos; ?></font></td>
<td bgcolor="#OOOOOO" align="center"><font face="verdana" size="2" color="white"><? echo $l_Thumbs; ?></font></td>
<td bgcolor="#OOOOOO" align="center"><font face="verdana" size="2" color="white"><? echo $l_Base; ?></font></td>
<td bgcolor="#OOOOOO" align="center"><font face="verdana" size="2" color="white"><? echo $l_Ajuster; ?></font></td>
<td bgcolor="#OOOOOO" align="center"><font face="verdana" size="2" color="white"><? echo $l_N_Albums; ?></font></td>
<td bgcolor="#OOOOOO" align="center"><font face="verdana" size="2" color="white"><? echo $l_Detail; ?></font></td>
<td bgcolor="#OOOOOO" align="center"><font face="verdana" size="2" color="white"><? echo $l_Levels; ?></font></td>
<td bgcolor="#OOOOOO" align="center"><font face="verdana" size="2" color="white"><? echo $l_Auteur_unique; ?></font></td>
<td bgcolor="#OOOOOO" align="center"><font face="verdana" size="2" color="white"><? echo $l_Thumb; ?></font></td>
</tr>
<tr>
<td bgcolor="#OOOOOO" colspan="11"><font face="verdana, arial" size="1" color="white">
<?php
echo $l_page.': </font>';
$d = dir("../videos");
$album_array = array();
while($albums_list_array = $d->read())
{
if ($albums_list_array != "." && $albums_list_array != ".." && $albums_list_array != "index.php" && $albums_list_array != "_vti_cnf" && $$albums_list_array != "_vti_pvt" && $albums_list_array != "_vti_script" && $albums_list_array != "_vti_txt")
{
$albums_list[] = $albums_list_array;
}
}
sort($albums_list);
$nbre_pages = ceil(count($albums_list) / 10);
$np=1;
if (empty($start)) $start = 0;
while ($np < (($start + 10) / 10))
{
echo '<font face="verdana, arial" size="1"><a href="indexvideo.php?start='.(10 * ($np-1)).'" class="lien2"><b> '.$np.'</b></a></font> ';
$np++;
}
echo '<font face="verdana, arial" color="white" size="1"> '.$np.'</font> ';
$np++;
while ($np <= ceil(count($albums_list) / 10))
{
echo '<font face="verdana, arial" size="1"><a href="indexvideo.php?start='.(10 * ($np-1)).'" class="lien2"><b>'.$np.'</b></a></font> ';
$np++;
}
echo '</td></tr>';
for($l = $start; $l < $start + 10; $l++)
{
if ($l == count($albums_list))
{
$d->close();
echo ' </table>';
include './footer.php';
exit();
}
echo '<tr><td bgcolor="#CCCCCC" align="center"><font face="verdana" color="black" size="2">';
if ($albums_list[$l] == $id_album) { echo '<b>'; }
echo $albums_list[$l].'</font>';
if ($albums_list[$l] == $id_album) { echo '</b>'; }
$dir = '../videos/'.$albums_list[$l];
$handle = opendir($dir);
rewinddir($handle);
$i = 0;
while ($file = readdir($handle))
{
if ($file != "." && $file != ".." && $file != "small" && $file!="Thumbs.db" && $file!="index.php" && $file!="_vti_cnf" && $file!="_vti_pvt" && $file!="_vti_script" && $file!="_vti_txt")
{
$i++;
}
}
echo '</td><td bgcolor="#CCCCCC"><font face="verdana" color="black" size="1">'.$i.' '.$l_videos.'</font>';
closedir($handle);
$dir = '../videos/'.$albums_list[$l].'/small';
$handle = opendir($dir);
rewinddir($handle);
$j = 0;
while ($file = readdir($handle))
{
if ( $file != "." && $file != ".." && $file != "Thumbs.db" && $file != "index.php" && $file != "_vti_cnf" && $file != "_vti_pvt" && $file != "_vti_script" && $file != "_vti_txt")
{
$j++;
}
}
closedir($handle);
$query = "SELECT id, album, cat FROM mcgallery_video WHERE idalbum=$albums_list[$l]";
$result = mysql_query($query);
$nb = mysql_num_rows($result);
$row = mysql_fetch_array($result);
echo '</td><td bgcolor="#CCCCCC"><font face="verdana" color="black" size="1">'.$j.' '.$l_thumbs.'</font></td>';
echo '<td bgcolor="#CCCCCC"><font face="verdana" color="black" size="1">'.$nb.' '.$l_videos.'</font></td>';
echo '<td bgcolor="#CCCCCC" align="center">';
if ($j != $nb)
{
if (empty($row['album'])) $row['album'] = '?';
echo '<a href="indexvideo.php?start='.$start.'&cat='.stripslashes($row['cat']).'&album_name='.stripslashes($row['album']).'&id_album='.$albums_list[$l].'"><img src="../images/b_warning.gif" border="0"></a></td>';
}
else echo ' </td>';
if ($nb > 0)
{
echo '<form method="post" action="indexvideo.php?act=name">';
echo '<td bgcolor="#CCCCCC"><input type="text size="10" name="album_name" value="'.htmlspecialchars(stripslashes($row['album'])).'">';
echo '<input type="hidden" name="start" value="'.$start.'">';
echo '<input type="hidden" name="idalbum" value="'.$albums_list[$l].'"><input type="submit" value="OK"></td>';
echo '</form>';
}
else echo '<td bgcolor="#CCCCCC"> </td>';
echo '<td bgcolor="#CCCCCC" align="center">';
echo '<a href="detailvideo.php?idalbum='.$albums_list[$l].'"><img src="../images/b_go.gif" border="0"></a>';
echo "</td>\n";
// DEBUT LEVELS
$query = "SELECT thumb, level, comment, ecard, selection FROM mcgallery_albumvideo where idalbum=$albums_list[$l]";
$res = mysql_query($query);
$alb_descr = mysql_fetch_array($res);
$alb_exists = mysql_num_rows($res);
if (empty($alb_descr['level'] )) $im_level = '../images/b_warning.gif';
else $im_level = '../images/b_ok.gif';
if (empty($alb_descr['comment'] )) $im_comment = '../images/b_warning.gif';
else $im_comment = '../images/b_ok.gif';
if (empty($alb_descr['ecard'])) $im_ecard = '../images/b_warning.gif';
else $im_ecard = '../images/b_ok.gif';
if (empty($alb_descr['selection'] )) $im_selection = '../images/b_warning.gif';
else $im_selection = '../images/b_ok.gif';
echo '<td bgcolor="#CCCCCC" align="center">';
if ($nb > 0 && $j == $nb)
{
echo '<a href="indexvideo.php?start='.$start.'&albumlevel='.$albums_list[$l].'">';
echo '<img src="'.$im_level.'" border="0" alt="">';
echo '<img src="'.$im_comment.'" border="0" alt="">';
echo '<img src="'.$im_ecard.'" border="0" alt="">';
echo '<img src="'.$im_selection.'" border="0" alt="">';
echo '</a>';
}
else echo ' ';
echo '</td>';
echo "\n";
// FIN LEVELS
echo '<td bgcolor="#CCCCCC" align="center">';
if ($nb > 0)
{
echo '<a href="indexvideo.php?start='.$start.'&author='.$albums_list[$l].'"><img src="../images/b_go.gif" border="0"></a>';
}
else echo ' ';
echo '</td>';
echo '<td bgcolor="#CCCCCC" align="center">';
if ($nb == 0) echo ' ';
elseif (is_file('../videos/'.$albums_list[$l].'/small/'.$alb_descr['thumb']))
{
echo '<img src="../videos/'.$albums_list[$l].'/small/'.$alb_descr['thumb'].'" border="0" alt="" width="'.$thumb_title.'" height="'.($thumb_title /4*3).'">';
}
else
{
echo '<a href="alb_thumb.php?t=V&idalbum='.$albums_list[$l].'"><img src="../images/b_help.gif" border="0" alt=""></a>';
}
echo '</td></tr>';
}
$d->close();
echo ' </table>';
include './footer.php';
?>