<?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 gro�e 
  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');
 $action = (isset($_GET['action']) ? $_GET['action'] : '');
 if (go_not_null($action)) {
	 switch ($action) {
		 case 'save':
 				// f�r den Upload einer Datei
			 if ((isset($_GET['upload']) AND $_GET['upload'] == '1')){
			 	
			 		// Am Ende das "/" aus dem Pfad l�schen f�r den Admin Upload
			 		if (substr(FOLDER_ABSOLUT_FORMER . FOLDER_RELATIV_PICTURES, -1) == '/'){
			 			$admin_upload_path = substr(FOLDER_ABSOLUT_FORMER . FOLDER_RELATIV_PICTURES, 0, -1);  
			 		}else{
			 			$admin_upload_path = FOLDER_ABSOLUT_FORMER . FOLDER_RELATIV_PICTURES;
			 		}
			 		// Am Ende das "/" aus dem Pfad l�schen f�r den Endkunden Upload
			 		if (substr(FOLDER_ABSOLUT_CATALOG . FOLDER_RELATIV_PICTURES, -1) == '/'){
			 			$user_upload_path = substr(FOLDER_ABSOLUT_CATALOG . FOLDER_RELATIV_PICTURES, 0, -1);  
			 		}else{
			 			$user_upload_path = FOLDER_ABSOLUT_CATALOG . FOLDER_RELATIV_PICTURES;
			 		}
			 		
					if (is_writeable($admin_upload_path)){
				    if (is_writeable($user_upload_path)){
					    if (move_uploaded_file($_FILES['upload_file']['tmp_name'], FOLDER_ABSOLUT_CATALOG . FOLDER_RELATIV_PICTURES . $_FILES['upload_file']['name'])){					    	
					    	$messageStack->add(TEXT_UPLOAD, 'success');
					    	$stopp = '0';
								sleep(3);
					    	@chmod (FOLDER_ABSOLUT_CATALOG . FOLDER_RELATIV_PICTURES . $_FILES['upload_file']['name'], 0777);
								if (copy(FOLDER_ABSOLUT_CATALOG . FOLDER_RELATIV_PICTURES . $_FILES['upload_file']['name'], FOLDER_ABSOLUT_FORMER . FOLDER_RELATIV_PICTURES . $_FILES['upload_file']['name'])) {
								    @chmod (FOLDER_ABSOLUT_FORMER . FOLDER_RELATIV_PICTURES . $_FILES['upload_file']['name'], 0777);
								    $messageStack->add(TEXT_UPLOAD_END, 'success');
								    $stopp = '0';
								}else{
									$messageStack->add(TEXT_UPLOAD_NO_END, 'error');
									$stopp = '1';
								}

					    }else{
					    	$messageStack->add(TEXT_UPLOAD_NO, 'error');
					    	$stopp = '1';
					    }
				    }else{
				    	$messageStack->add(sprintf(TEXT_NOT_WRITEABLE_IN_THIS, $user_upload_path), 'error');
				    	$stopp = '1';
				    }
			  	}else{
			  		$messageStack->add(sprintf(TEXT_NOT_WRITEABLE_IN_THIS, $admin_upload_path), 'error');
			  		$stopp = '1';
			  	}
			  	// Wenn nichts upgeloadet wurde, dann auch nichts in die Datenbank
					if ($stopp == '0'){
						$set_it_up_value = go_db_producing_input($_FILES['upload_file']['name']);
						$bigID = go_db_producing_input($_GET['bigID']);
				 		go_db_query("update " . DB_TBL_SET_IT_UP . " set set_it_up_value = '" . go_db_input($set_it_up_value) . "', last_modified = now() where set_it_up_id = '" . (int)$bigID . "'");
					}
					
			 }else{ // fuer alles andere
			 
				 $set_it_up_value = go_db_producing_input($_POST['set_it_up_value']);
				 $bigID = go_db_producing_input($_GET['bigID']);
				 
				 $set_it_up_title_master_secure_query = go_db_query("select set_it_up_title from " . DB_TBL_SET_IT_UP . " where set_it_up_id = '" . (int)$bigID . "'");
				 $set_it_up_title_master_secure = go_db_fetch_array($set_it_up_title_master_secure_query);		 
				 
					if (MASTER_SECURE == '1'){
						if ($set_it_up_title_master_secure['set_it_up_title'] == 'SHOP_OWNER_EMAIL_ADDRESS_TITEL' 
								OR $set_it_up_title_master_secure['set_it_up_title'] == 'EMAIL_FROM_TITEL' 
								OR $set_it_up_title_master_secure['set_it_up_title'] == 'SEND_EXTRA_ORDER_EMAILS_TO_TITEL'
								OR $set_it_up_title_master_secure['set_it_up_title'] == 'SHOP_NAME_ADDRESS_TITEL'
								OR $set_it_up_title_master_secure['set_it_up_title'] == 'OWNER_BANK_NAME_TITEL'
								OR $set_it_up_title_master_secure['set_it_up_title'] == 'SHOP_OWNER_BLZ_TITEL'
								OR $set_it_up_title_master_secure['set_it_up_title'] == 'OWNER_BANK_TITEL'
								OR $set_it_up_title_master_secure['set_it_up_title'] == 'OWNER_BANK_IBAN_TITEL'
								OR $set_it_up_title_master_secure['set_it_up_title'] == 'OWNER_BANK_SWIFT_TITEL'){
								
								$messageStack->add('Diese Daten k�nnen nicht geaendert werden, weil MASTER_SECURE aktiv ist. Bitte setzen Sie den Wert in der Konfigurationsdatei auf "0"!', 'error');
								
						}
						else{
							go_db_query("update " . DB_TBL_SET_IT_UP . " set set_it_up_value = '" . go_db_input($set_it_up_value) . "', last_modified = now() where set_it_up_id = '" . (int)$bigID . "'");				
							go_forward(go_href_link(NAME_OF_FILE_SET_IT_UP, 'gID=' . $_GET['gID'] . '&bigID=' . $bigID));	
						}
					}
					else{
				 		go_db_query("update " . DB_TBL_SET_IT_UP . " set set_it_up_value = '" . go_db_input($set_it_up_value) . "', last_modified = now() where set_it_up_id = '" . (int)$bigID . "'");		 
				 		go_forward(go_href_link(NAME_OF_FILE_SET_IT_UP, 'gID=' . $_GET['gID'] . '&bigID=' . $bigID));
					}
				}
		 break;
	 }
 }
 $gID = (isset($_GET['gID'])) ? $_GET['gID'] : 1;
 $cfg_group_query = go_db_query("select set_it_up_group_title, set_it_up_group_description from " . DB_TBL_SET_IT_UP_GROUP . " where set_it_up_group_id = '" . (int)$gID . "'");
 $cfg_group = go_db_fetch_array($cfg_group_query);
?>
<!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>
 <style>
<!--
.tabelle1 { border:1px dashed #808080; padding:10; }
-->
</style>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<!-- 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"></td>
<!-- body_text //-->
 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
 <td>
 <br>
 <table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
 <td class="pageGeneralsign"><?php echo constant($cfg_group['set_it_up_group_title']); ?></td>  <!--Fred-->
 </tr>
 <tr>
 <td class="smallText"><?php echo constant($cfg_group['set_it_up_group_description']); ?></td>
 </tr>
 </table>
 <br>
 </td>
 </tr>
 <tr>
 <td><table cellpadding="5" border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
 <td valign="top"><table border="0" cellpadding="5" cellspacing="0" width="100%" id="AutoNumber1">
 <tr class="tbUPCountData">
 <td class="tbUPDataInside"><?php echo DB_TBL_ABOVE_SET_IT_UP_TITLE; ?></td>
 <td class="tbUPDataInside"><?php echo DB_TBL_ABOVE_SET_IT_UP_VALUE; ?></td>
 <td class="tbUPDataInside" align="right"><?php echo DB_TBL_ABOVE_ACTION; ?>&nbsp;</td>
 </tr>
<?php
 $set_it_up_query = go_db_query("select set_it_up_id, set_it_up_title, set_it_up_key, set_it_up_value, use_function from " . DB_TBL_SET_IT_UP . " where set_it_up_group_id = '" . (int)$gID . "' order by sort_order");
 while ($set_it_up = go_db_fetch_array($set_it_up_query)) {
 if (go_not_null($set_it_up['use_function'])) {
 $use_function = $set_it_up['use_function'];
 if (preg_match('/->/', $use_function)) {
 $class_method = explode('->', $use_function);
 if (!is_object(${$class_method[0]})) {
 include(FOLDER_RELATIV_CLASSES . $class_method[0] . '.php');
 ${$class_method[0]} = new $class_method[0]();
 }
 $cfgValue = go_call_function($class_method[1], $set_it_up['set_it_up_value'], ${$class_method[0]});
 } else {
 $cfgValue = go_call_function($use_function, $set_it_up['set_it_up_value']);
 }
 } else {
 $cfgValue = $set_it_up['set_it_up_value'];
 }
 
 
 
 
 
 
 if ((!isset($_GET['bigID']) || (isset($_GET['bigID']) && ($_GET['bigID'] == $set_it_up['set_it_up_id']))) && !isset($bigwareInfo) && (substr($action, 0, 3) != 'new')) {
	 $cfg_extra_query = go_db_query("select * from " . DB_TBL_SET_IT_UP . " where set_it_up_id = '" . (int)$set_it_up['set_it_up_id'] . "'");
	 $cfg_extra = go_db_fetch_array($cfg_extra_query);
	 $bigwareInfo_array = array_merge($set_it_up, $cfg_extra);
	 $bigwareInfo = new objectInfo($bigwareInfo_array);
 }
 if ( (isset($bigwareInfo) && is_object($bigwareInfo)) && ($set_it_up['set_it_up_id'] == $bigwareInfo->set_it_up_id) ) {
 	echo ' <tr id="defaultSelected" class="tbCountDataSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . go_href_link(NAME_OF_FILE_SET_IT_UP, 'gID=' . $_GET['gID'] . '&bigID=' . $bigwareInfo->set_it_up_id . '&action=change') . '\'">' . "\n";
 } else {
 	echo ' <tr class="tbCountData" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . go_href_link(NAME_OF_FILE_SET_IT_UP, 'gID=' . $_GET['gID'] . '&bigID=' . $set_it_up['set_it_up_id']) . '\'">' . "\n";
 }
?>
 <td class="TbInsideData"><?php echo constant($set_it_up['set_it_up_title']); ?></td>
 <td class="TbInsideData"><?php echo constants_language($cfgValue);?></td>
 <td class="TbInsideData" align="right"><?php if ( (isset($bigwareInfo) && is_object($bigwareInfo)) && ($set_it_up['set_it_up_id'] == $bigwareInfo->set_it_up_id) ) { echo go_picture(FOLDER_RELATIV_PICTURES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . go_href_link(NAME_OF_FILE_SET_IT_UP, 'gID=' . $_GET['gID'] . '&bigID=' . $set_it_up['set_it_up_id']) . '">' . go_picture(FOLDER_RELATIV_PICTURES . 'icon_info.gif', PICTURE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
 </tr>
<?php
}
?>
 </table>
<?php
if ($gID==1000){
	?>
	<br> 
	<b>.htaccess Datei anlegen: </b> <br> <br> 
	 <div class="tabelle1">
	 <table cellSpacing="0" cellPadding="0" border="0">
	 <tr>
	 <td class="TbInsideData">
	 <?php echo TEXT_EXPLAIN_MOD_REWRITE_ONE . FOLDER_ABSOLUT_DOCUMENT_ROOT . TEXT_EXPLAIN_MOD_REWRITE_TWO; ?>
	<br><br><textarea rows="7" name="S1" cols="100">
<?php echo "Options +FollowSymLinks" . "\n" .
"RewriteEngine On" . "\n" .
"RewriteBase " . FOLDER_RELATIV_CATALOG . "\n" .
"RewriteRule ^(.*)-p-(.*).html$ main_bigware_34.php?items_id=$2&%{QUERY_STRING}" . "\n" .
"RewriteRule ^(.*)-c-(.*).html$ main_bigware_29.php?bigPfad=$2&%{QUERY_STRING}" . "\n" .
"RewriteRule ^(.*)-m-(.*).html$ main_bigware_29.php?producers_id=$2&%{QUERY_STRING}"; ?></textarea> 
	 
	 </td>
	 </tr>
	 </table>
	 </div> 
	<?php
}
?>
</td>
<?php
 $heading = array();
 $contents = array();
	if ($bigwareInfo->set_it_up_key == 'CHANGE_INVOICE_LOGO'){
			if (file_exists(FOLDER_ABSOLUT_FORMER . FOLDER_RELATIV_PICTURES . $bigwareInfo->set_it_up_value) AND !file_exists(FOLDER_ABSOLUT_CATALOG . FOLDER_RELATIV_PICTURES . $bigwareInfo->set_it_up_value)) {
				$logo_not_in_use = '<br><br><font color="#FF0000">' . TEXT_LOGO_NOT_FOR_EMAIL . '</font><br><br>';
			}else{
				$logo_not_in_use = '';
			}
	 		$relative_path = FOLDER_RELATIV_FORMER . FOLDER_RELATIV_PICTURES . ' <b>und</b> ' . FOLDER_ABSOLUT_CATALOG . FOLDER_RELATIV_PICTURES;
	 		$filename = $bigwareInfo->set_it_up_value;
			$this_set_it_up_description = sprintf(constant($bigwareInfo->set_it_up_description), $filename, $relative_path);
	}else{
		$logo_not_in_use = '';
		$this_set_it_up_description = constant($bigwareInfo->set_it_up_description);
	} 
 switch ($action) {
	 case 'change':
		$heading[] = array('text' => '<b>' . constant($bigwareInfo->set_it_up_title) . '</b>');
		// Besonderheiten.
		// Wenn Logo Rechnungslayout => Logo...
		if ($bigwareInfo->set_it_up_key == 'CHANGE_INVOICE_LOGO'){
			$value_field = '';
			$get_para = '&upload=1';
			$more_para = ' enctype="multipart/form-data"';
			$more_input = '<input type="file" name="upload_file">';
		}else{// ansonsten, dann...
			$get_para = '';
			$more_para = '';
			$more_input = '';
			if ($bigwareInfo->set_function) {
				eval('$value_field = ' . stripslashes($bigwareInfo->set_function) . '"' . isohtmlspecialchars($bigwareInfo->set_it_up_value) . '");');
			} else {
				$value_field = go_fetch_inputfeld('set_it_up_value', $bigwareInfo->set_it_up_value);
			}
		} 
	 

	 	$contents = array('form' => go_fetch_form('set_it_up', NAME_OF_FILE_SET_IT_UP, 'gID=' . $_GET['gID'] . '&bigID=' . $bigwareInfo->set_it_up_id . '&action=save' . $get_para, 'post', $more_para));		 
		$contents[] = array('text' => TEXT_INFO_CHANGE_INTRO);
		$contents[] = array('text' => '<br><b>' . constant($bigwareInfo->set_it_up_title) . '</b><br>' . $this_set_it_up_description . '<br>' . $value_field);
		$contents[] = array('text' => $more_input);
		$contents[] = array('align' => 'center', 'text' => '<br>' . go_picture_submit('button_update.gif', PICTURE_UPDATE) . '&nbsp;<a href="' . go_href_link(NAME_OF_FILE_SET_IT_UP, 'gID=' . $_GET['gID'] . '&bigID=' . $bigwareInfo->set_it_up_id) . '">' . go_picture_button('button_cancel.gif', PICTURE_CANCEL) . '</a>');
	 break;
	 default:
		 if (isset($bigwareInfo) && is_object($bigwareInfo)) {
		 $heading[] = array('text' => '<b>' . constant($bigwareInfo->set_it_up_title) . '</b>');
		 $contents[] = array('align' => 'center', 'text' => '<a href="' . go_href_link(NAME_OF_FILE_SET_IT_UP, 'gID=' . $_GET['gID'] . '&bigID=' . $bigwareInfo->set_it_up_id . '&action=change') . '">' . go_picture_button('button_change.gif', PICTURE_CHANGE) . '</a>');
		 $contents[] = array('text' => $logo_not_in_use . $this_set_it_up_description); 
		 $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . go_date_short($bigwareInfo->date_added));
		 if (go_not_null($bigwareInfo->last_modified)) $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . go_date_short($bigwareInfo->last_modified));
		 }
	 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'); ?>
