<?php
/*
###################################################################################
  Bigware Shop 2.3
  Release Datum: 23.08.2015
  
  Bigware Shop
  http://www.bigware.de

  Copyright (c) 2015 Bigware LTD
  (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
  (c) 2015	Bigware LTD

  Copyrightvermerke duerfen nicht entfernt werden.
  ------------------------------------------------------------------------
  Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
  der GNU General Public License, wie von der Free Software Foundation
  veroeffentlicht, weitergeben und/oder modifizieren, entweder gemaess Version 2 
  der Lizenz oder (nach Ihrer Option) jeder spaeteren Version.
  Die Veroeffentlichung dieses Programms erfolgt in der Hoffnung, dass es Ihnen
  von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die
  implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT FUER EINEN
  BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License.
  
  Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
  Programm erhalten haben. Falls nicht, schreiben Sie an die Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

  Infos:
  ------------------------------------------------------------------------
  Der Bigware Shop wurde vor vielen Jahren bereits aus dem bekannten Shopsystem osCommerce
  weiter- und neuentwickelt.
  Der Bigware Shop legt im hohen Masse Wert auf Bedienerfreundlichkeit, beinhaltet eine leichte
  Installation, viele neue professionelle Werkzeuge und zeichnet sich aus durch eine grosse 
  Community, die bei Problemen weiterhelfen kann.
  
  Der Bigware Shop ist auf jedem System lauffaehig, welches eine PHP Umgebung
  (ab PHP 4.1.3) und mySQL zur Verfuegung stellt und auf Linux basiert.
 
  Hilfe erhalten Sie im Forum auf www.bigware.de 
  
  -----------------------------------------------------------------------
  
 ##################################################################################




*/
?>
    <table border="0" style="width:100%" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" style="width:100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageGeneralsign">
            </td>
<?php 
	       $conf_query = go_db_query("SELECT * FROM " . DB_TBL_GALERIE_CONF . " where galerie_conf_id = '1'");
	       $conf_werte = go_db_fetch_array($conf_query);
	
	       
			   $rahmenbreite2 = $conf_werte["rahmenbreite2"];            
			   $rahmenfarbe2 = $conf_werte["rahmenfarbe2"];                
			   $bildbreitevorschau = $conf_werte["bildbreitevorschau"];               
			   $bildhoehevorschau = $conf_werte["bildhoehevorschau"];                                   
			   $cellspacing2 = $conf_werte["cellspacing2"];  	       		 			
			   $name_bild = $conf_werte["name_bild"];               
			   $name_name = $conf_werte["name_name"];                                   
			   $name_anzahl = $conf_werte["name_anzahl"]; 
			   $bilderanzahl_anzeigen = $conf_werte["bilderanzahl_anzeigen"]; 
			   $ausrichtung_bild = $conf_werte["ausrichtung_bild"];               
			   $ausrichtung_name = $conf_werte["ausrichtung_name"];                                   
			   $ausrichtung_anzahl = $conf_werte["ausrichtung_anzahl"]; 
			   $bildbreite_cat_pic = $conf_werte["bildbreite_cat_pic"]; 
			   $bildhoehe_cat_pic = $conf_werte["bildhoehe_cat_pic"]; 
			   $wieviele_subcats_zeile = $conf_werte["wieviele_subcats_zeile"];
			   $farbe_linie_galerieliste = $conf_werte["farbe_linie_galerieliste"];
			   $abstand_zelle_untercat = $conf_werte["abstand_zelle_untercat"];
			   $name_untercat_ausrichtung = $conf_werte["name_untercat_ausrichtung"];
			   $name_untercat_ausrichtung_in_zelle = $conf_werte["name_untercat_ausrichtung_in_zelle"];
			   
    if (ITEM_LIST_FILTER > 0) {
        $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . DB_TBL_GALERIE . " p, " . DB_TBL_GALERIE_TO_CATEGORIES . " p2c, " . DB_TBL_CATEGORIES . " c, " . DB_TBL_CATEGORIES_DESCRIPTION . " cd where p.galeries_status = '1' and p.galeries_id = p2c.galeries_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'";
      $filterlist_query = go_db_query($filterlist_sql);
      if (go_db_num_rows($filterlist_query) > 1) {
        echo '            <td align="center" class="main">' . go_fetch_form('filter', $GLOBALS[CONFIG_NAME_FILE][main_bigware_24], 'get') . TEXT_SHOW . '&nbsp;';
          echo go_fetch_hidden_field('bigPfad', $bigPfad);
          $options = array(array('id' => '', 'text' => TEXT_ALL_PRODUCERS));
        echo go_fetch_hidden_field('sort', $_GET['sort']);
        while ($filterlist = go_db_fetch_array($filterlist_query)) {
          $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']);
        }
        echo go_fetch_pull_down_menu('filter_id', $options, (isset($_GET['filter_id']) ? $_GET['filter_id'] : ''), 'onchange="this.form.submit()"');
        echo '</form></td>' . "\n";
      }
    } 
    $picture = FOLDER_RELATIV_PICTURES . 'table_background_list.gif';
   if ($current_category_id) {
      $picture = go_db_query("select categories_picture  from " . DB_TBL_GALERIE_CAT . " where categories_id = '" . (int)$current_category_id . "'");
      $picture = go_db_fetch_array($picture);
      $picture = $picture['categories_picture'];
      $cat_desc = go_db_query("select categories_desc  from " .DB_TBL_GALERIE_CAT_DESCRIPTION . " where categories_id = '" . (int)$current_category_id . "' and language_id = '" . (int)$languages_id . "'");
      $cat_desc = go_db_fetch_array($cat_desc);
      $cat_desc = $cat_desc['categories_desc'];
    }
$subcats_vorhanden == 0;


///////////////////// Unterkategorien  ////////////////////////



  function go_show_galerie_cat_liste($counter_cat) {
    global $foo_liste, $frameContent, $id_cat, $aa;
$frameContent .= "</center>";
    for ($a=0; $a<$foo_liste[$counter_cat]['level']; $a++) {  
    } 


    if ($foo_liste[$counter_cat]['parent'] == 0) {
      $bigPfad_new = 'bigPfad=' . $counter_cat;
    } else {
      $bigPfad_new = 'bigPfad=' . $foo_liste[$counter_cat]['path'];
    }

    $frameContent .= $foo_liste[$counter_cat]['name'];


    if (SHOW_COUNTS == 'true') {
      $items_in_category = go_count_galeries_in_category($counter_cat);
      if ($items_in_category > 0) {
        $frameContent .= '&nbsp;(' . $items_in_category . ')';
      }
    } 

    if ($foo_liste[$counter_cat]['next_id']) {
      go_show_galerie_cat_liste($foo_liste[$counter_cat]['next_id']);
    }
  }     
  $frameContent = '';
  $categories_query = go_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . DB_TBL_GALERIE_CAT . " c, " . DB_TBL_GALERIE_CAT_DESCRIPTION . " cd where c.categories_status = '1' and c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name");
  while ($categories = go_db_fetch_array($categories_query))  {
    $foo_liste[$categories['categories_id']] = array(
                                        'name' => $categories['categories_name'],
                                        'parent' => $categories['parent_id'],
                                        'level' => 0,
                                        'path' => $categories['categories_id'],
                                        'next_id' => false
                                       );
    if (isset($prev_id)) {
      $foo_liste[$prev_id]['next_id'] = $categories['categories_id'];
    }
    $prev_id = $categories['categories_id'];
    if (!isset($first_element2)) {
      $first_element2 = $categories['categories_id'];
    }
  } 
  if ($bigPfad) {
    $id_cat = preg_split('/_/', $bigPfad);
    reset($id_cat);
    while (list($key, $value) = each($id_cat)) {
      $new_path .= $value;
      unset($prev_id);
      unset($first_id);
      $categories_query = go_db_query("select  c.categories_picture, c.categories_id, cd.categories_name, c.parent_id from " . DB_TBL_GALERIE_CAT . " c, " . DB_TBL_GALERIE_CAT_DESCRIPTION . " cd where c.categories_status = '1' and c.parent_id = '" . $value . "' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name");
      $category_check = go_db_num_rows($categories_query);
      while ($row = go_db_fetch_array($categories_query)) {
        $foo_liste[$row['categories_id']] = array(
                                            'name' => $row['categories_name'],
                                            'parent' => $row['parent_id'],
                                            'level' => $key+1,
                                            'path' => $new_path . '_' . $row['categories_id'],
                                            'next_id' => false,
                                            'picture' => $row['categories_picture']
                                           );
        if (isset($prev_id)) {
          $foo_liste[$prev_id]['next_id'] = $row['categories_id'];
        }
        $prev_id = $row['categories_id'];
        if (!isset($first_id)) {
          $first_id = $row['categories_id'];
        }
        $last_id = $row['categories_id'];
      }
      if ($category_check != 0) {
        $foo_liste[$last_id]['next_id'] = $foo_liste[$value]['next_id'];
        $foo_liste[$value]['next_id'] = $first_id;
      }
             $new_path .= '_';
    }
  }

foreach ($foo_liste as $key => $value) {
    	foreach ($value as $key2 => $value2) {
    		if ($key2 == "parent" AND $value2 == $current_category_id){
    		  $subcats_vorhanden = 1;	
    		}
	}
}
if ($subcats_vorhanden == 1){
	if ($name_untercat_ausrichtung == 1){$abstand_zelle_untercat1 = '0';}else{$abstand_zelle_untercat1 = $abstand_zelle_untercat;}
	$subcatecories = '<hr color="' . $farbe_linie_galerieliste . '" size="1"><table border="0" cellpadding="0" cellspacing="' . $abstand_zelle_untercat1 . '" style="border-collapse: collapse; width:100%" id="AutoNumber1">';
}
else{
$subcatecories = '';
}
$count_zeile = 1;		  
foreach ($foo_liste as $key => $value) {
    	foreach ($value as $key2 => $value2) {
    		if ($key2 == "parent" AND $value2 == $current_category_id){
    		if ($count_zeile == 1){
    			$subcatecories .= '<tr>';
    		}    			
    			
    			if ($name_untercat_ausrichtung == 1){
    				$subcatecories .= '<td><table border="0" cellpadding="0" cellspacing="' . $abstand_zelle_untercat . '"><tr><td style="width:100%" align="' . $name_untercat_ausrichtung_in_zelle . '"><a href="' . $GLOBALS[CONFIG_NAME_FILE][main_bigware_24] . '?bigPfad=' . $value['path'] . '">' . go_picture(FOLDER_RELATIV_PICTURES . $value['picture'], $value['name'], $bildbreite_cat_pic, $bildhoehe_cat_pic) . '</a></td></tr><tr><td style="width:100%" align="' . $name_untercat_ausrichtung_in_zelle . '"><a href="' . $GLOBALS[CONFIG_NAME_FILE][main_bigware_24] . '?bigPfad=' . $value['path'] . '">' . $value['name'] . '</a></td></tr></table></td>';
    			}
    			
    			else{
    				$subcatecories .= '<td><a href="' . $GLOBALS[CONFIG_NAME_FILE][main_bigware_24] . '?bigPfad=' . $value['path'] . '">' . go_picture(FOLDER_RELATIV_PICTURES . $value['picture'], $value['name'], $bildbreite_cat_pic, $bildhoehe_cat_pic) . '</a></td><td><a href="' . $GLOBALS[CONFIG_NAME_FILE][main_bigware_24] . '?bigPfad=' . $value['path'] . '">' . $value['name'] . '</a></td>';
    			}


    		
    		if ($count_zeile == $wieviele_subcats_zeile){
    			$subcatecories .= '</tr>';
    			$count_zeile = 0;
    		}
    		$count_zeile++;
    		}
	}
}
if ($subcats_vorhanden == 1){
	if ($count_zeile == 1){
	$subcatecories .= '</tr></table>';	
	}
	else{
	$subcatecories .= '</table>';
	}
}



//////////////////////////////////////////////////////////////





?>
            <td>
            
<?php echo $breadcrumb->trail('<img src="templates/Blau/picture/pfeil.gif" border="0" style="width:11px" height="11"> '); ?> <br><br>
<?php echo $subcatecories; ?>
<hr color="<?php echo $farbe_linie_galerieliste; ?>" size="1">
                
            
		<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; width:100%" id="AutoNumber1">
		  <tr>
		    <td><?php echo go_picture(FOLDER_RELATIV_PICTURES . $picture, ABOVE_TITLE, $bildbreite_cat_pic, $bildhoehe_cat_pic);?></td>
		    <td><?php echo $cat_desc;?></td>
		  </tr>
		</table>            
            
            
            </td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo go_fetch_dividing_up('tranparentes.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td><?php include(FOLDER_RELATIV_MODULES . $GLOBALS[CONFIG_NAME_FILE][galerie_listing]); ?></td>
      </tr>
    </table>
