Просмотр файла script/category_no.php

Размер файла: 12.47Kb
<?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
--------------------------------------------------------------------------------------------*/

 if (empty($_SESSION['private_login']))
 {
 $album_level = 'level = 1';
 }
 else
 {
	if ($_SESSION['level'] == 'admin' || $_SESSION['level'] == 'all') $album_level = 'level > 0';
	else  $album_level = 'level = 1 OR level IN ('. $_SESSION['level'].')';
 }

 // start photos

 $query = "SELECT idalbum, thumb FROM mcgallery_albumphoto WHERE $album_level";
 $res = (mysql_query($query));
 $liste_albumsP = array();
 $liste_thumbsP = array();
 while ($rowP = mysql_fetch_array ($res))
 {
  $liste_albumsP[] = $rowP['idalbum'];
  $liste_thumbsP[$rowP['idalbum']] = $rowP['thumb'];
  }
 if (empty($liste_albumsP)) $listeP = 0;
 else $listeP = implode (',', $liste_albumsP);

$query = "SELECT idalbum, album, COUNT(id) FROM mcgallery_photo WHERE idalbum IN ($listeP) GROUP BY idalbum ORDER BY album";
$result = mysql_query($query);
$nbp = mysql_num_rows($result);
 if ($nbp > 0) { echo '<td class="td0" colspan="3"><font size="2">'.$l_Photos.'</font></td></tr>'; }
 while($row=mysql_fetch_row($result))
 {
    $thumb = $liste_thumbsP[$row[0]] ;
    if ($thumb == '' || $thumb_title == 0) { $thumb = 'images/blank.gif'; }
    else { $thumb = 'photos/'.$row[0].'/small/'.$thumb; }
    echo '<tr><td class="td2" width="'.$thumb_title.'">';
    echo '<a href="index.php?cat=0&tab=p&album='.$row[0].'" onMouseOver="window.status=\'\';return true"><img src="'.$thumb.'" width="'.$thumb_title.'" height="'.($thumb_title /4*3).'" border="0" alt=""></a></td>';
    //
    echo '<td class="td2" width="100%"><font size="1">';
    if ($row[0] == $album && $video == 0 && $flash == 0 && $searchalb < 2)  { echo '<b>'; }
    echo '<a href="index.php?cat=0&tab=p&album='.$row[0].'" class="lien1" onMouseOver="window.status=\'\';return true">'.stripslashes($row[1]).'</a>';
    if ($row[0] == $album && $video == 0 && $flash == 0 && $searchalb < 2)  { echo '</b>'; }
    echo '</font>';
    echo '</td>';
    echo '<td class="td2" align="right" nowrap><font size="1">'.$row[2].' '.$l_photos.'</font></td></tr>';
 }

 if (!empty($_SESSION['private_login']))
 {
 $private_login = $_SESSION['private_login'];
  $query = "SELECT COUNT(file) FROM mcgallery_select WHERE type='P' AND login='$private_login'";
  $result = mysql_query($query);
  $nbre_sel = mysql_fetch_row($result);
  if ($nbre_sel[0] > 0)
    {
    if ($nbp == 0 && $nbpp == 0)  { echo '<td class="td0" colspan="3"><font size="2">'.$l_Photos.'</font></td></tr>'; }
    echo '<tr><td class="td1" align="center"><img src="images/sel.gif" border="0"></td>';
    echo '<td class="td2" width="100%"><font size="1">';
    if ($sel == 'P' && $l == '')  { echo '<b>'; }
    echo '<a href="index.php?sel=P" class="lien1" onMouseOver="window.status=\'\';return true">'.$l_your_select.'</a>';
    if ($sel == 'P' && $l == '')  { echo '</b>'; }
    echo '</font>';
    echo '</td>';
    echo '<td class="td2" align="right" nowrap><font size="1">'.$nbre_sel[0].' '.$l_photos.'</font></td></tr>';
    }
  if ($_SESSION['level'] == 'admin')
  {
   $query = "SELECT login, COUNT(file) as vid FROM mcgallery_select WHERE type='P' AND login != '$private_login' GROUP BY login ORDER BY login";
   $result = mysql_query($query);
   $nbre_sel_l = mysql_num_rows($result);
   if ($nbre_sel_l > 0)
   {
     if ($nbp == 0 && $nbpp == 0 & $nbre_sel[0] == 0) { echo '<tr><td class="td0" colspan="3"><font size="2">'.$l_Photos.'</font></td></tr>'; }
     while ($selec=mysql_fetch_array($result))
     {
    //
    echo '<tr><td class="td1" align="center"><img src="images/sel.gif" border="0"></td>';
    //
     echo '<td class="td2" width="100%"><font size="1">';
     if ($sel == 'P' && $l == $selec['login'])  { echo '<b>'; }
     echo '<a href="index.php?sel=P&l='.$selec['login'].'" class="lien1" onMouseOver="window.status=\'\';return true">'.$l_sel_add.': '.$selec['login'].'</a>';
     if ($sel == 'P' && $l == $selec['login'])  { echo '</b>'; }
     echo '</font>';
     echo '</td>';
     echo '<td class="td2" align="right" nowrap><font size="1">'.$selec['vid'].' '.$l_photos.'</font></td></tr>';
     }
   }
  }
 }
 // Top Ten
if (($nbp + $nbpp + $nbre_sel_l > 0) && ($use_topten{0} == 2 || ($use_topten{0} == 1 && !empty($_SESSION['private_login']))))
{
include 'topten_p.php';
}

// end photos

 $query = "SELECT idalbum, thumb FROM mcgallery_albumvideo WHERE $album_level";
 $res = (mysql_query($query));
 $liste_thumbsV = array();
 $liste_albumsV = array();
 while ($rowV = mysql_fetch_array ($res))
 {
 $liste_albumsV[] = $rowV['idalbum'];
 $liste_thumbsV[$rowV['idalbum']] = $rowV['thumb'];
  }
 if (empty($liste_albumsV)) $listeV = 0;
 else $listeV = implode (',', $liste_albumsV);

$query = "SELECT idalbum, album, COUNT(id) FROM mcgallery_video WHERE idalbum IN ($listeV) GROUP BY idalbum ORDER BY album";
$result = mysql_query($query);
  $nbv = mysql_num_rows($result);
  if ($nbv > 0)
  {
  echo '<tr><td class="td0" colspan="3"><font size="2">'.$l_Videos.'</font></td></tr>';
   while($row = mysql_fetch_row($result))
   {
    $thumb = $liste_thumbsV[$row[0]] ;
    if ($thumb == '' || $thumb_title == 0) { $thumb = 'images/blank.gif'; }
    else { $thumb = 'videos/'.$row[0].'/small/'.$thumb; }
    echo '<tr><td class="td2" width="'.$thumb_title.'">';
    echo '<a href="index.php?cat=0&video=1&album='.$row[0].'" onMouseOver="window.status=\'\';return true"><img src="'.$thumb.'" width="'.$thumb_title.'" height="'.($thumb_title /4*3).'" border="0" alt=""></a></td>';
    //
    echo '<td class="td2" width="100%"><font size="1">';
    if ($row[0] == $album && $video == 1 && $searchalb < 2)  { echo '<b>'; }
    echo '<a href="index.php?cat=0&video=1&album='.$row[0].'" class="lien1" onMouseOver="window.status=\'\';return true">'.stripslashes($row[1]).'</a>';
    if ($row[0] == $album && $video == 1 && $searchalb < 2)  { echo '</b>'; }
    echo '</font>';
    echo '</td>';
    echo '<td class="td2" align="right" nowrap><font size="1">'.$row[2].' '.$l_videos.'</font></td></tr>';
   }
  }

 if (!empty($_SESSION['private_login']))
 {
 $private_login = $_SESSION['private_login'];
  $query = "SELECT COUNT(file) FROM mcgallery_select WHERE type='V' AND login='$private_login'";
  $result = mysql_query($query);
  $nbre_sel = mysql_fetch_row($result);
  if ($nbre_sel[0] > 0)
  {
     if ($nbv == 0 && $nbvp == 0) { echo '<tr><td class="td0" colspan="3"><font size="2">'.$l_Videos.'</font></td></tr>'; }
    echo '<tr><td class="td1" align="center"><img src="images/sel.gif" border="0"></td>';
    echo '<td class="td2" width="100%"><font size="1">';
    if ($sel == 'V' && $l == '')  { echo '<b>'; }
    echo '<a href="index.php?sel=V" class="lien1" onMouseOver="window.status=\'\';return true">'.$l_your_select.'</a>';
    if ($sel == 'V' && $l == '')  { echo '</b>'; }
    echo '</font>';
    echo '</td>';
    echo '<td class="td2" align="right" nowrap><font size="1">'.$nbre_sel[0].' '.$l_videos.'</font></td></tr>';
  }
  if ($_SESSION['level'] == 'admin')
  {
   $query = "SELECT login, COUNT(file) as vid FROM mcgallery_select WHERE type='V' AND login != '$private_login' GROUP BY login ORDER BY login";
   $result = mysql_query($query);
   $nbre_sel_l = mysql_num_rows($result);
   if ($nbre_sel_l > 0)
   {
     if ($nbv == 0 && $nbvp == 0 & $nbre_sel[0] == 0) { echo '<tr><td class="td0" colspan="3"><font size="2">'.$l_Videos.'</font></td></tr>'; }
     while ($selec=mysql_fetch_array($result))
     {
    //
    echo '<tr><td class="td1" align="center"><img src="images/sel.gif" border="0"></td>';
    //
     echo '<td class="td2" width="100%"><font size="1">';
     if ($sel == 'V' && $l == $selec['login'])  { echo '<b>'; }
     echo '<a href="index.php?sel=V&l='.$selec['login'].'" class="lien1" onMouseOver="window.status=\'\';return true">'.$l_sel_add.': '.$selec['login'].'</a>';
     if ($sel == 'V' && $l == $selec['login'])  { echo '</b>'; }
     echo '</font>';
     echo '</td>';
     echo '<td class="td2" align="right" nowrap><font size="1">'.$selec['vid'].' '.$l_videos.'</font></td></tr>';
     }
   }
  }
 }

// Top Ten
if (($nbv + $nbvp + $nbre_sel_l > 0) && ($use_topten{0} == 2 || ($use_topten{0} == 1 && !empty($_SESSION['private_login']))))
{
include 'topten_v.php';
}
// end video

 $query = "SELECT idalbum, thumb FROM mcgallery_albumflash WHERE $album_level";
 $res = (mysql_query($query));
 $liste_thumbsF = array();
 $liste_albumsF = array();
 while ($rowF = mysql_fetch_array ($res))
 {
 $liste_albumsF[] = $rowF['idalbum'];
 $liste_thumbsF[$rowF['idalbum']] = $rowF['thumb'];
  }
 if (empty($liste_albumsF)) $listeF = 0;
 else $listeF = implode (',', $liste_albumsF);

$query = "SELECT idalbum, album, COUNT(id) FROM mcgallery_flash WHERE idalbum IN ($listeF) GROUP BY idalbum ORDER BY album";
$result = mysql_query($query);
  $nbf = mysql_num_rows($result);
  if ($nbf > 0)
  {
  echo '<tr><td class="td0" colspan="3"><font size="2">'.$l_Flash.'</font></td></tr>';
   while($row=mysql_fetch_row($result))
   {
    $thumb = $liste_thumbsF[$row[0]] ;
    if ($thumb == '' || $thumb_title == 0) { $thumb = 'images/blank.gif'; }
    else { $thumb = 'flash/'.$row[0].'/small/'.$thumb; }
    echo '<tr><td class="td2" width="'.$thumb_title.'">';
    echo '<a href="index.php?cat=0&flash=1&album='.$row[0].'" onMouseOver="window.status=\'\';return true"><img src="'.$thumb.'" width="'.$thumb_title.'" height="'.($thumb_title /4*3).'" border="0" alt=""></a></td>';
    echo '<td class="td2" width="100%"><font size="1">';
    if ($row[0] == $album && $flash == 1 && $searchalb < 2)  { echo '<b>'; }
    echo '<a href="index.php?cat=0&flash=1&album='.$row[0].'" class="lien1" onMouseOver="window.status=\'\';return true">'.stripslashes($row[1]).'</a>';
    if ($row[0] == $album && $flash == 1 && $searchalb < 2)  { echo '</b>'; }
    echo '</font>';
    echo '</td>';
    echo '<td class="td2" align="right" nowrap><font size="1">'.$row[2].' '.$l_flash_anims.'</font></td></tr>';
   }
  }

if (!empty($_SESSION['private_login']))
 {
 $private_login = $_SESSION['private_login'];
  $query = "SELECT COUNT(file) FROM mcgallery_select WHERE type='F' AND login='$private_login'";
  $result = mysql_query($query);
  $nbre_sel = mysql_fetch_row($result);
  if ($nbre_sel[0] > 0)
  {
     if ($nbf == 0 && $nbfp == 0) { echo '<tr><td class="td0" colspan="3"><font size="2">'.$l_Flash.'</font></td></tr>'; }
    echo '<tr><td class="td2">&nbsp;</td>';
    echo '<td class="td2" width="100%"><font size="1">';
    if ($sel == 'F' && $l =='')  { echo '<b>'; }
    echo '<a href="index.php?sel=F" class="lien1" onMouseOver="window.status=\'\';return true">'.$l_your_select.'</a>';
    if ($sel == 'F' && $l =='')  { echo '</b>'; }
    echo '</font>';
    echo '</td>';
    echo '<td class="td2" align="right" nowrap><font size="1">'.$nbre_sel[0].' '.$l_flash_anims.'</font></td></tr>';
  }
  if ($_SESSION['level'] == 'admin')
  {
   $query = "SELECT login, COUNT(file) as vid FROM mcgallery_select WHERE type='F' AND login != '$private_login' GROUP BY login ORDER BY login";
   $result = mysql_query($query);
   $nbre_sel_l = mysql_num_rows($result);
   if ($nbre_sel_l > 0)
   {
     if ($nbf == 0 && $nbfp == 0 && $nbre_sel[0] == 0) { echo '<tr><td class="td0" colspan="3"><font size="2">'.$l_Flash.'</font></td></tr>'; }
     while ($selec=mysql_fetch_array($result))
     {
    //
    echo '<tr><td class="td1" align="center"><img src="images/sel.gif" border="0"></td>';
    //
     echo '<td class="td2" width="100%"><font size="1">';
     if ($sel == 'F' && $l == $selec['login'])  { echo '<b>'; }
     echo '<a href="index.php?sel=F&l='.$selec['login'].'" class="lien1" onMouseOver="window.status=\'\';return true">'.$l_sel_add.': '.$selec['login'].'</a>';
     if ($sel == 'F' && $l == $selec['login'])  { echo '</b>'; }
     echo '</font>';
     echo '</td>';
     echo '<td class="td2" align="right" nowrap><font size="1">'.$selec['vid'].' '.$l_flash_anims.'</font></td></tr>';
     }
   }
  }
}
// Top Ten
if (($nbf + $nbfp + $nbre_sel_l >0) && ($use_topten{0} == 2 || ($use_topten{0} == 1 && !empty($_SESSION['private_login']))))
{
include 'topten_f.php';
}

// end flash
?>