<?php
    //----------------------------------------------------
    // m_gallery
    // the gallery menu
    //----------------------------------------------------
    drawMenuTop("Galleries");
    // this assumes a directory called 'gallery' in the top-level
    // blur6ex folder.  Within that directory are more directories,
    // each of them containing images and an HTML file from MakeGallery
    //
    $gallery_dir = "gallery";
     
     
     
     
    //If you can't open the directory specified in $gallery_dir, print a notice.
    //also, suppress the warning here, as it is caught and referenced.
    $handle = @opendir($gallery_dir );
    if ($handle != FALSE )
    {
         
        while (($file = readdir($handle )) != FALSE )
        {
            if ($file != "." && $file != ".." )
                $files[] = $file;
        }
         
         
        $ngals = count($files );
        //The following line prints out how many galleries there are, if you want that
        //print("There are $ngals albums in the gallery<br /><br />");
         
        if (count($files ) > 0 )
        {
            foreach($files as $d )
            {
                $path = $gallery_dir . "/" . $d . "/index.html";
                 
                 
                if ($siteSettings['slickurls'] == TRUE )
                {
                    print("<a href='" . $siteSettings['siteurl'] . "/index.php?shard=makegallery&amp;action=g_showgallery&amp;file=" . $path . "'>" . $d . "</a><br />");
                }
                else
                {
                    print("<a href='index.php?shard=makegallery&amp;action=g_showgallery&amp;file=" . $path . "'>" . $d . "</a><br />");
                }
                 
            }
        }
         
    }
    else
    {
        print("<small>Unable to open gallery directory<br />see m_gallery.php</small>");
    }
     
     
    drawMenuBottom();
     
?>
