<?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 
  
  -----------------------------------------------------------------------
  
 ##################################################################################




*/
?>
<?php
  require('load_this/load_bigware_11.php');
  $set = (isset($_GET['set']) ? $_GET['set'] : '');
  
if ($konfig_shipping == 1){
go_db_query("update " . DB_TBL_SET_IT_UP . " SET  set_it_up_value = '$VERSANMODUL_EINSTELLUNG' WHERE set_it_up_key = 'VERSANMODUL_EINSTELLUNG'");
}
  if (go_not_null($set)) {
    switch ($set) {
      case 'shipping':
        $module_type = 'shipping';
        $module_directory = FOLDER_ABSOLUT_CATALOG_MODULES . 'shipping/';
        $module_key = 'CONSTITUENT_SHIPPING_INSTALLED';
        define('ABOVE_TITLE', ABOVE_TITLE_MODULES_SHIPPING);
        break;
      case 'ordertotal':
        $module_type = 'order_total';
        $module_directory = FOLDER_ABSOLUT_CATALOG_MODULES . 'order_total/';
        $module_key = 'CONSTITUENT_ORDER_TOTAL_INSTALLED';
        define('ABOVE_TITLE', ABOVE_TITLE_MODULES_ORDER_TOTAL);
        break;
      case 'payment':
      default:
        $module_type = 'payment';
        $module_directory = FOLDER_ABSOLUT_CATALOG_MODULES . 'payment/';
        $module_key = 'CONSTITUENT_PAYMENT_INSTALLED';
        define('ABOVE_TITLE', ABOVE_TITLE_MODULES_PAYMENT);
        break;
	  case 'haendlerbund':
         $module_type = 'haendlerbund';
         $module_directory = FOLDER_ABSOLUT_CATALOG_MODULES . 'haendlerbund/';
         $module_key = 'HB_AGB_SERVICE_INSTALLED';
         define('ABOVE_TITLE', 'Haendlerbund-AGB-Service');
         break;
    }
  }
  $action = (isset($_GET['action']) ? $_GET['action'] : '');
  if (go_not_null($action)) {
    switch ($action) {
      case 'save':
        while (list($key, $value) = each($_POST['set_it_up'])) {
          go_db_query("update " . DB_TBL_SET_IT_UP . " set set_it_up_value = '" . $value . "' where set_it_up_key = '" . $key . "'");
        }
        go_forward(go_href_link(NAME_OF_FILE_MODULES, 'set=' . $set . '&module=' . $_GET['module']));
        break;
      case 'install':
      case 'remove':
        $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));
        $class = basename($_GET['module']);
        if (file_exists($module_directory . $class . $file_extension)) {
          include($module_directory . $class . $file_extension);
          $module = new $class;
          if ($action == 'install') {
            $module->install();
          } elseif ($action == 'remove') {
            $module->remove();
          }
        }
        go_forward(go_href_link(NAME_OF_FILE_MODULES, 'set=' . $set . '&module=' . $class));
        break;
    }
  }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="load_this/style.css">
<script language="javascript" src="load_this/menu.js"></script>
<script language="javascript" src="load_this/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_9.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td width="<?php echo FRAME_WIDTH; ?>" valign="top">
<!-- left_navigation //-->
<!-- left_navigation_eof //-->
</td>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageGeneralsign"><?php echo ABOVE_TITLE; ?></td>
            <td class="pageGeneralsign" align="right"><?php echo go_fetch_dividing_up('tranparentes.gif', ABOVE_PICTURE_WIDTH, ABOVE_PICTURE_HEIGHT); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><table cellpadding="5" border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td valign="top">
  
 <?php 
 if ($set=="shipping"){
          $konfig_value_query = go_db_query("select set_it_up_value from " . DB_TBL_SET_IT_UP . " where set_it_up_key = 'VERSANMODUL_EINSTELLUNG'");
          $konfig_value = go_db_fetch_array($konfig_value_query);
	  $VERSANMODUL_EINSTELLUNG = $konfig_value['set_it_up_value'];
?>
            
            
 	    <form method="POST" action="main_bigware_85.php?set=shipping">
 	    <input type="hidden" name="set" value="shipping">
 	    <input type="hidden" name="konfig_shipping" value="1">
 	    <table border="0" cellpadding="5" cellspacing="1" style="border-collapse: collapse" width="100%" id="AutoNumber1">
              <tr class="tbUPCountData">
                <td class="tbUPDataInside" colspan="5"><?php echo TEXT_QUEUE_SEVERAL; ?></td>
              </tr>           
 		<tr class="tbCountData">
                <td class="TbInsideData" align="right" valign="top">
                <input type="radio" value="1" <?php if ($VERSANMODUL_EINSTELLUNG == 1){echo "checked";} ?> name="VERSANMODUL_EINSTELLUNG">&nbsp; <?php echo TEXT_QUEUE_INDIVIDUAL_PRICE; ?></td>
                <td class="TbInsideData" align="right" valign="top">
                <input type="radio" name="VERSANMODUL_EINSTELLUNG" value="2" <?php if ($VERSANMODUL_EINSTELLUNG == 2){echo "checked";} ?>>&nbsp; <?php echo TEXT_BEST_PRICE; ?></td>
                <td class="TbInsideData" align="right" valign="top">
                <input type="radio" name="VERSANMODUL_EINSTELLUNG" value="3" <?php if ($VERSANMODUL_EINSTELLUNG == 3){echo "checked";} ?>>&nbsp; <?php echo TEXT_BEST_PRICE_PRESELECTED; ?></td>
                <td class="TbInsideData" align="right" valign="top">
                <input type="radio" name="VERSANMODUL_EINSTELLUNG" value="4" <?php if ($VERSANMODUL_EINSTELLUNG == 4){echo "checked";} ?>>&nbsp; <?php echo TEXT_NO_PRESELECTION; ?></td>
              </tr>            
 		</table>
 		<?php echo go_picture_submit('button_update.gif', PICTURE_UPDATE); ?>
 		</form>
 <br><br>
 <?php 
 }
 ?>
           
            <table border="0" cellpadding="5" cellspacing="1" style="border-collapse: collapse" width="100%" id="AutoNumber1">
              <tr class="tbUPCountData">
                <td class="tbUPDataInside"><?php echo DB_TBL_ABOVE_MODULES; ?></td>
                <td class="tbUPDataInside" align="right"><?php echo DB_TBL_ABOVE_SORT_ORDER; ?></td>
                <td class="tbUPDataInside" align="right"><?php echo DB_TBL_ABOVE_ACTION; ?>&nbsp;</td>
              </tr>
<?php
  $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));
  $directory_array = array();
  if ($dir = @dir($module_directory)) {
    while ($file = $dir->read()) {
      if (!is_dir($module_directory . $file)) {
        if (substr($file, strrpos($file, '.')) == $file_extension) {
          $directory_array[] = $file;
        }
      }
    }
    sort($directory_array);
    $dir->close();
  }
  $installed_modules = array();
  for ($i=0, $n=sizeof($directory_array); $i<$n; $i++) {
    $file = $directory_array[$i];
     if ($file != 'authorizenet.php' && $file != 'nochex.php' && $file != 'pm2checkout.php' && $file != 'psigate.php' && $file != 'secpay.php' && $file != 'table.php' && $file != 'flat_pro.php'){
		    include(FOLDER_ABSOLUT_CATALOG_LANGUAGES . $language . '/mods/' . $module_type . '/' . $file);
		    include($module_directory . $file);
		    $class = substr($file, 0, strrpos($file, '.'));
		    if (go_class_exists($class)) {
		      $module = new $class;
		      if ($module->check() > 0) {
		        if ($module->sort_order > 0) {
		          $installed_modules[$module->sort_order] = $file;
		        } else {
		          $installed_modules[] = $file;
		        }
		      }
		      if ((!isset($_GET['module']) || (isset($_GET['module']) && ($_GET['module'] == $class))) && !isset($mInfo)) {
		        $module_info = array('code' => $module->code,
		                             'title' => $module->title,
		                             'description' => $module->description,
		                             'status' => $module->check());
		        $module_keys = $module->keys();
		        $keys_extra = array();
		        for ($j=0, $k=sizeof($module_keys); $j<$k; $j++) {
		          $key_value_query = go_db_query("select set_it_up_title, set_it_up_value, set_it_up_description, use_function, set_function from " . DB_TBL_SET_IT_UP . " where set_it_up_key = '" . $module_keys[$j] . "'");
		          $key_value = go_db_fetch_array($key_value_query);
		          $keys_extra[$module_keys[$j]]['title'] = $key_value['set_it_up_title'];
		          $keys_extra[$module_keys[$j]]['value'] = $key_value['set_it_up_value'];
		          $keys_extra[$module_keys[$j]]['description'] = $key_value['set_it_up_description'];
		          $keys_extra[$module_keys[$j]]['use_function'] = $key_value['use_function'];
		          $keys_extra[$module_keys[$j]]['set_function'] = $key_value['set_function'];
		        }
		        $module_info['keys'] = $keys_extra;
		        $mInfo = new objectInfo($module_info);
		      }
		      if (isset($mInfo) && is_object($mInfo) && ($class == $mInfo->code) ) {
		        if ($module->check() > 0) {
		          echo '              <tr id="defaultSelected" class="tbCountDataSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . go_href_link(NAME_OF_FILE_MODULES, 'set=' . $set . '&module=' . $class . '&action=change') . '\'">' . "\n";
		        } else {
		          echo '              <tr id="defaultSelected" class="tbCountDataSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "\n";
		        }
		      } else {
		        echo '              <tr class="tbCountData" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . go_href_link(NAME_OF_FILE_MODULES, 'set=' . $set . '&module=' . $class) . '\'">' . "\n";
		      }
		?>
		                <td class="TbInsideData"><?php echo $module->title; ?></td>
		                <td class="TbInsideData" align="right"><?php if (is_numeric($module->sort_order)) echo $module->sort_order; ?></td>
		                <td class="TbInsideData" align="right"><?php if (isset($mInfo) && is_object($mInfo) && ($class == $mInfo->code) ) { echo go_picture(FOLDER_RELATIV_PICTURES . 'icon_arrow_right.gif'); } else { echo '<a href="' . go_href_link(NAME_OF_FILE_MODULES, 'set=' . $set . '&module=' . $class) . '">' . go_picture(FOLDER_RELATIV_PICTURES . 'icon_info.gif', PICTURE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
		              </tr>
		<?php
		    }
  	}
  }
  ksort($installed_modules);
  $check_query = go_db_query("select set_it_up_value from " . DB_TBL_SET_IT_UP . " where set_it_up_key = '" . $module_key . "'");
  if (go_db_num_rows($check_query)) {
    $check = go_db_fetch_array($check_query);
    if ($check['set_it_up_value'] != implode(';', $installed_modules)) {
      go_db_query("update " . DB_TBL_SET_IT_UP . " set set_it_up_value = '" . implode(';', $installed_modules) . "', last_modified = now() where set_it_up_key = '" . $module_key . "'");
    }
  } else {
    go_db_query("insert into " . DB_TBL_SET_IT_UP . " (set_it_up_title, set_it_up_key, set_it_up_value, set_it_up_description, set_it_up_group_id, sort_order, date_added) values ('Installed Modules', '" . $module_key . "', '" . implode(';', $installed_modules) . "', 'This is automatically updated. No need to change.', '6', '0', now())");
  }
?>
              <tr>
                <td colspan="3" class="smallText"><?php echo TEXT_CONSTITUENT_DIRECTORY . ' ' . $module_directory; ?></td>
              </tr>
            </table></td>
<?php
  $heading = array();
  $contents = array();
  switch ($action) {
    case 'change':
      $keys = '';
      reset($mInfo->keys);
      while (list($key, $value) = each($mInfo->keys)) {
        $keys .= '<b>' . constant($value['title']) . '</b><br>' . constant($value['description']) . '<br>';
		  if ($value['set_function']) {
          eval('$keys .= ' . $value['set_function'] . "'" . $value['value'] . "', '" . $key . "');");
        } else {
          $keys .= go_fetch_inputfeld('set_it_up[' . $key . ']', $value['value']);
        }
        $keys .= '<br><br>';
      }
      $keys = substr($keys, 0, strrpos($keys, '<br><br>'));
      $heading[] = array('text' => '<b>' . $mInfo->title . '</b>');
      $contents = array('form' => go_fetch_form('modules', NAME_OF_FILE_MODULES, 'set=' . $set . '&module=' . $_GET['module'] . '&action=save'));
      $contents[] = array('text' => $keys);
      $contents[] = array('align' => 'center', 'text' => '<br>' . go_picture_submit('button_update.gif', PICTURE_UPDATE) . ' <a href="' . go_href_link(NAME_OF_FILE_MODULES, 'set=' . $set . '&module=' . $_GET['module']) . '">' . go_picture_button('button_cancel.gif', PICTURE_CANCEL) . '</a>');
      break;
    default:
      $heading[] = array('text' => '<b>' . $mInfo->title . '</b>');
      if ($mInfo->status == '1') {
        $keys = '';
        reset($mInfo->keys);
        while (list(, $value) = each($mInfo->keys)) {
          $keys .= '<b>' . constant($value['title']) . '</b><br>';
          if ($value['use_function']) {
            $use_function = $value['use_function'];
            if (preg_match('/->/', $use_function)) {
              $class_method = explode('->', $use_function);
              if (!is_object(${$class_method[0]})) {
              	
		 if ($class_method[0] == 'currencies'){
		 include(FOLDER_RELATIV_CLASSES . 'class_bigware_1' . '.php');	
		}
		else{
		 include(FOLDER_RELATIV_CLASSES . $class_method[0] . '.php');
		}             	

                ${$class_method[0]} = new $class_method[0]();
              }
              $keys .= go_call_function($class_method[1], $value['value'], ${$class_method[0]});
            } else {
            	if (strlen(go_call_function($use_function, $value['value'])) >= 25){
              		$keys .= substr(go_call_function($use_function, $value['value']), 0, 25) . '...';
        	}
        	else{
        		$keys .= go_call_function($use_function, $value['value']);
        	}
            }
          } else {
          	if (strlen($value['value']) >= 25){
            		$keys .= substr($value['value'], 0, 25) . '...';
                }
        	else{
        		$keys .= $value['value'];
        	}
          }
          $keys .= '<br><br>';
        }
        $keys = substr($keys, 0, strrpos($keys, '<br><br>'));
        $contents[] = array('align' => 'center', 'text' => '<a href="' . go_href_link(NAME_OF_FILE_MODULES, 'set=' . $set . '&module=' . $mInfo->code . '&action=remove') . '">' . go_picture_button('button_module_remove.gif', PICTURE_CONSTITUENT_REMOVE) . '</a> <a href="' . go_href_link(NAME_OF_FILE_MODULES, 'set=' . $set . (isset($_GET['module']) ? '&module=' . $_GET['module'] : '') . '&action=change') . '">' . go_picture_button('button_change.gif', PICTURE_CHANGE) . '</a>');
        $contents[] = array('text' => '<br>' . $mInfo->description);
        $contents[] = array('text' => '<br>' . $keys);
      } else {
        $contents[] = array('align' => 'center', 'text' => '<a href="' . go_href_link(NAME_OF_FILE_MODULES, 'set=' . $set . '&module=' . $mInfo->code . '&action=install') . '">' . go_picture_button('button_module_install.gif', PICTURE_CONSTITUENT_INSTALL) . '</a>');
        $contents[] = array('text' => '<br>' . $mInfo->description);
      }
      break;
  }
  if ( (go_not_null($heading)) && (go_not_null($contents)) ) {
    echo '            <td width="25%" valign="top"><br>' . "\n";
    $frame = new frame;
    echo $frame->infoBox($heading, $contents);
    echo '            </td>' . "\n";
  }
?>
          </tr>
        </table></td>
      </tr>
    </table></td>
<!-- body_text_eof //-->
  </tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_7.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_6.php'); ?>
