<?php

$scrolling = 1;
$number = 2; # Anzahl der Bilder im Block
$hoehe = 150; # Hoehe des Marquee Tag

defined('mxMainFileLoaded') or die('access denied');
$mxblockcache = true;

global $prefix;
include 'admin/modules/gallery/config.php';
$show = "";
$a = 1;
if (mxIsUser())
    $pic = sql_query("SELECT p.pid, p.img, p.name, p.description, c.galloc FROM " . $prefix . "_gallery_pictures AS p LEFT JOIN " . $prefix . "_gallery_categories AS c ON c.gallid=p.gid WHERE (extension='jpg' OR extension='gif' OR extension='png') AND c.visible>=1 order by rand() LIMIT 0,$number");
else
    $pic = sql_query("SELECT p.pid, p.img, p.name, p.description, c.galloc FROM " . $prefix . "_gallery_pictures AS p LEFT JOIN " . $prefix . "_gallery_categories AS c ON c.gallid=p.gid WHERE (extension='jpg' OR extension='gif' OR extension='png') AND c.visible>=2 order by rand() LIMIT 0,$number");


if (@file_exists("$gallerypath/" . $pic["galloc"] . "/thumb/" . $pic["img"] . ""))
    {
    while (list($pid, $img, $name, $description, $galloc) = sql_fetch_row($pic))
    	{
         $show .= "<td align=\"center\" valign=\"baseline\"><a href=\"$baseurl&amp;do=showpic&amp;pid=" . $pid. "\"><img src=\"$gallerypath/" . $galloc . "/thumb/" . $img . "\"                border=\"0\" alt=\"" . $description . "\" /><br /><font class=\"tiny\">" . $name . "</font></a></td>";
    }
}
else
if (@file_exists("$gallerypath/" . $pic["galloc"] . "/" . $pic["img"] . ""))
    {
    while (list($pid, $img, $name, $description, $galloc) = sql_fetch_row($pic))
    	{
         $show .= "<td align=\"center\" valign=\"baseline\"><a href=\"$baseurl&amp;do=showpic&amp;pid=" . $pid. "\"><img src=\"$gallerypath/" . $galloc . "/"       . $img . "\"  width=\"70\"  border=\"0\" alt=\"" . $description . "\" /><br /><font class=\"tiny\">" . $name . "</font></a></td>";
    }
}


if ($show) {
    $content = "";
    if ($scrolling) $content .= "<MARQUEE behavior=\"scroll\" align=\"left\" direction=\"left\" height=\"" . $hoehe . "\" scrollamount= \"2\" scrolldelay= \"90\" onmouseover='this.stop()' onmouseout='this.start()'>";
    $content .= '<table width="100%" cellpadding="0" cellspacing="10" border="0" align="center">
      <tr>
        '. $show .'
      </tr>
    </table>
    ';
    if ($scrolling) $content .= "</MARQUEE>";
}

?>