Index: src/admin/includes/modules/new_attributes_include.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/admin/includes/modules/new_attributes_include.php	(revision bb340983cc1abc84abda8ece116314436e0ab6cf)
+++ src/admin/includes/modules/new_attributes_include.php	(revision )
@@ -8,18 +8,18 @@
    [http://www.gnu.org/licenses/gpl-2.0.html]
    --------------------------------------------------------------
 
-   based on: 
+   based on:
    (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
-   (c) 2002-2003 osCommerce(new_attributes_functions); www.oscommerce.com 
+   (c) 2002-2003 osCommerce(new_attributes_functions); www.oscommerce.com
    (c) 2003	 nextcommerce (new_attributes_include.php,v 1.11 2003/08/21); www.nextcommerce.org
    (c) 2003 XT-Commerce - community made shopping http://www.xt-commerce.com ($Id: new_attributes_include.php 901 2005-04-29 10:32:14Z novalis $)
 
-   Released under the GNU General Public License 
+   Released under the GNU General Public License
    --------------------------------------------------------------
    Third Party contributions:
    New Attribute Manager v4b				Autor: Mike G | mp3man@internetwork.net | http://downloads.ephing.com
 
-   Released under the GNU General Public License 
+   Released under the GNU General Public License
    --------------------------------------------------------------*/
 defined('_VALID_XTC') or die('Direct Access to this location is not allowed.');
 // include needed functions
@@ -73,23 +73,23 @@
 <?php } ?>
 <tr>
 	<td class="attributes-edit-wrapper multi-table-wrapper">
-		
+
 	<?php
-	
+
 	require(DIR_WS_MODULES . 'new_attributes_functions.php');
-	
+
 	// Temp id for text input contribution.. I'll put them in a seperate array.
 	$tempTextID = '1999043';
-	
+
 	// Lets get all of the possible options
 	$query = "SELECT * FROM ".TABLE_PRODUCTS_OPTIONS." where products_options_id LIKE '%' AND language_id = '" . $_SESSION['languages_id'] . "'";
 	$result = xtc_db_query($query);
 	$matches = xtc_db_num_rows($result);
-	
+
 	$totalOptionCountQuery = 'SELECT * FROM ' . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS;
 	$totalOptionCountQueryResult = xtc_db_query($totalOptionCountQuery);
 	$totalOptionCount = xtc_db_num_rows($totalOptionCountQueryResult);
-	
+
 	if ($matches) {
 		while ($line = xtc_db_fetch_array($result)) {
 			$current_product_option_name = $line['products_options_name'];
@@ -112,7 +112,7 @@
 			$query2 = "SELECT * FROM ".TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS." WHERE products_options_id = '" . $current_product_option_id . "' ORDER BY products_options_values_id DESC";
 			$result2 = xtc_db_query($query2);
 			$matches2 = xtc_db_num_rows($result2);
-			
+
 			if ($matches2) {
 				$i = 0;
 				while ($line = xtc_db_fetch_array($result2)) {
@@ -120,114 +120,134 @@
 					$rowClass = rowClass($i);
 					$current_value_id = $line['products_options_values_id'];
 					$isSelected = checkAttribute($current_value_id, $_POST['current_product_id'], $current_product_option_id);
-					
+
 					$CHECKED = '';
-					if ($isSelected) {
+					if ($isSelected)
+					{
 						$CHECKED = ' checked="checked"';
-					}
-					
+
-					$gm_get_vpe = xtc_db_query("SELECT products_vpe_id, products_vpe_name FROM products_vpe WHERE language_id = '" . $_SESSION['languages_id'] . "'");
+						$gm_get_vpe  = xtc_db_query("SELECT products_vpe_id, products_vpe_name FROM products_vpe WHERE language_id = '"
+						                            . $_SESSION['languages_id'] . "'");
-					$gm_vpe_data = array();
+						$gm_vpe_data = array();
-					while($gm_vpe = xtc_db_fetch_array($gm_get_vpe)) {
-						$gm_vpe_data[] = array('ID' => $gm_vpe['products_vpe_id'], 'NAME' => $gm_vpe['products_vpe_name']);
+						while($gm_vpe = xtc_db_fetch_array($gm_get_vpe))
+						{
+							$gm_vpe_data[] = array('ID'   => $gm_vpe['products_vpe_id'],
+							                       'NAME' => $gm_vpe['products_vpe_name']
+							);
-					}
-					
+						}
+
-					$query3 = "SELECT * FROM ".TABLE_PRODUCTS_OPTIONS_VALUES." WHERE products_options_values_id = '" . $current_value_id . "' AND language_id = '" . $_SESSION['languages_id'] . "'";
+						$query3  = "SELECT * FROM " . TABLE_PRODUCTS_OPTIONS_VALUES
+						           . " WHERE products_options_values_id = '" . $current_value_id
+						           . "' AND language_id = '" . $_SESSION['languages_id'] . "'";
-					$result3 = xtc_db_query($query3);
+						$result3 = xtc_db_query($query3);
-					while($line = xtc_db_fetch_array($result3)) {
+						while($line = xtc_db_fetch_array($result3))
+						{
-						$current_value_name = $line['products_options_values_name'];
-						// Print the Current Value Name
-			
-						$disable = '';
+							$current_value_name = $line['products_options_values_name'];
+							// Print the Current Value Name
+
+							$disable = '';
-						if(empty($CHECKED)){
+							if(empty($CHECKED))
+							{
-							$disable = "disabled='true'";
-						}
-						
+								$disable = "disabled='true'";
+							}
+
-						echo '<tr class="' . $rowClass . '">' .
-								'<td class="main">' .
-									'<input type="checkbox" name="optionValues[]" value="' . $current_value_id . '"' . $CHECKED . ' data-single_checkbox />' .
-									'&nbsp;&nbsp;' . $current_value_name . '&nbsp;&nbsp;' .
-								'</td>' .
-								'<td class="main" align="left">' .
-									'<input ' . $disable . ' type="text" name="' . $current_value_id . '_sortorder" value="' . $sortorder . '" size="4" />' .
-								'</td>' .
-								'<td class="main" align="left">' .
-									'<input ' . $disable . ' type="text" name="' . $current_value_id . '_model" value="' . $attribute_value_model . '" size="10" />' .
-								'</td>' .
-								'<td class="main" align="left">' .
-									'<input ' . $disable . ' type="text" name="' . $current_value_id . '_gm_ean" value="' . $gm_attribute_ean . '" size="10" />' .
-								'</td>' .
-								'<td class="main" align="left">' .
-									'<input ' . $disable . ' type="text" name="' . $current_value_id . '_stock" value="' . (double)$attribute_value_stock . '" size="4" />' .
-								'</td>' .
-								'<td class="main" align="left">' .
-									'<input ' . $disable . ' type="text" name="' . $current_value_id . '_vpe_value" value="' . (double)$gm_attribute_vpe_value . '" size="4" /> ' .
-									'<select ' . $disable . ' name="' . $current_value_id . '_vpe_id">';
-										if(empty($gm_attribute_vpe_id)){
+							echo '<tr class="' . $rowClass . '">' . '<td class="main">'
+							     . '<input type="checkbox" name="optionValues[]" value="' . $current_value_id . '"'
+							     . $CHECKED . ' data-single_checkbox />' . '&nbsp;&nbsp;' . $current_value_name
+							     . '&nbsp;&nbsp;' . '</td>' . '<td class="main" align="left">' . '<input ' . $disable
+							     . ' type="text" name="' . $current_value_id . '_sortorder" value="' . $sortorder
+							     . '" size="4" />' . '</td>' . '<td class="main" align="left">' . '<input ' . $disable
+							     . ' type="text" name="' . $current_value_id . '_model" value="'
+							     . $attribute_value_model . '" size="10" />' . '</td>'
+							     . '<td class="main" align="left">' . '<input ' . $disable . ' type="text" name="'
+							     . $current_value_id . '_gm_ean" value="' . $gm_attribute_ean . '" size="10" />'
+							     . '</td>' . '<td class="main" align="left">' . '<input ' . $disable
+							     . ' type="text" name="' . $current_value_id . '_stock" value="'
+							     . (double)$attribute_value_stock . '" size="4" />' . '</td>'
+							     . '<td class="main" align="left">' . '<input ' . $disable . ' type="text" name="'
+							     . $current_value_id . '_vpe_value" value="' . (double)$gm_attribute_vpe_value
+							     . '" size="4" /> ' . '<select ' . $disable . ' name="' . $current_value_id
+							     . '_vpe_id">';
+							if(empty($gm_attribute_vpe_id))
+							{
-											$gm_selected = ' selected="selected"';
+								$gm_selected = ' selected="selected"';
-										}else{
+							}
+							else
+							{
-											$gm_selected = '';
-										}
-										echo '<option value="0"' . $gm_selected . '></option>';
+								$gm_selected = '';
+							}
+							echo '<option value="0"' . $gm_selected . '></option>';
-										for($j = 0; $j < count($gm_vpe_data); $j++){
-											if($gm_vpe_data[$j]['ID'] == $gm_attribute_vpe_id){
+							for($j = 0; $j < count($gm_vpe_data); $j++)
+							{
+								if($gm_vpe_data[$j]['ID'] == $gm_attribute_vpe_id)
+								{
-												$gm_selected = ' selected="selected"';
+									$gm_selected = ' selected="selected"';
-											}else{
+								}
+								else
+								{
-												$gm_selected = '';
-											}
+									$gm_selected = '';
+								}
-											echo '<option value="' . $gm_vpe_data[$j]['ID'] .  '"' . $gm_selected . '>' . $gm_vpe_data[$j]['NAME'] . '</option>';
+								echo '<option value="' . $gm_vpe_data[$j]['ID'] . '"' . $gm_selected . '>'
+								     . $gm_vpe_data[$j]['NAME'] . '</option>';
-										}
+							}
-									echo '</select>' .
-								'</td>' .
-								'<td class="main" align="left">' .
-									'<input ' . $disable . ' type="text" name="' . $current_value_id . '_weight" value="' . $attribute_value_weight . '" size="10" /> ' .
-									'<select ' . $disable . ' name="' . $current_value_id . '_weight_prefix">' .
-										'<option value="+"' . $posCheck_weight . '>+</option>' .
-										'<option value="-"' . $negCheck_weight . '>-</option>' .
-									'</select>' .
-								'</td>';
+							echo '</select>' . '</td>' . '<td class="main" align="left">' . '<input ' . $disable
+							     . ' type="text" name="' . $current_value_id . '_weight" value="'
+							     . $attribute_value_weight . '" size="10" /> ' . '<select ' . $disable . ' name="'
+							     . $current_value_id . '_weight_prefix">' . '<option value="+"' . $posCheck_weight
+							     . '>+</option>' . '<option value="-"' . $negCheck_weight . '>-</option>' . '</select>'
+							     . '</td>';
-										
-						// brutto Admin
+
+							// brutto Admin
-						if (PRICE_IS_BRUTTO=='true'){
-							$attribute_value_price_calculate = $xtPrice->xtcFormat(xtc_round($attribute_value_price*((100+(xtc_get_tax_rate(xtc_get_tax_class_id($_POST['current_product_id']))))/100),PRICE_PRECISION), false);
-						} else {
+							if(PRICE_IS_BRUTTO == 'true')
+							{
+								$attribute_value_price_calculate = $xtPrice->xtcFormat(xtc_round($attribute_value_price
+								                                                                 * ((100
+								                                                                     + (xtc_get_tax_rate(xtc_get_tax_class_id($_POST['current_product_id']))))
+								                                                                    / 100),
+								                                                                 PRICE_PRECISION),
+								                                                       false);
+							}
+							else
+							{
-							$attribute_value_price_calculate = xtc_round($attribute_value_price, PRICE_PRECISION);
-						}
+								$attribute_value_price_calculate = xtc_round($attribute_value_price, PRICE_PRECISION);
+							}
-						echo '<td class="main" align="left">' .
-								'<input ' . $disable . ' type="text" name="' . $current_value_id . '_price" value="' . $attribute_value_price_calculate . '" size="10" />';
+							echo '<td class="main" align="left">' . '<input ' . $disable . ' type="text" name="'
+							     . $current_value_id . '_price" value="' . $attribute_value_price_calculate
+							     . '" size="10" />';
-								// brutto Admin
+							// brutto Admin
-								if (PRICE_IS_BRUTTO=='true'){
-									echo TEXT_NETTO . '<strong>' . $xtPrice->xtcFormat(xtc_round($attribute_value_price,PRICE_PRECISION),true) . '</strong>';
+							if(PRICE_IS_BRUTTO == 'true')
+							{
+								echo TEXT_NETTO . '<strong>' . $xtPrice->xtcFormat(xtc_round($attribute_value_price,
+								                                                             PRICE_PRECISION), true)
+								     . '</strong>';
-								}
-								
+							}
+
-							echo ' <select ' . $disable . ' name="' . $current_value_id . '_prefix">' .
-									 '<option value="+"' . $posCheck . '>+</option>' .
-									 '<option value="-"' . $negCheck . '>-</option>' .
-								 '</select>' .
-							'</td>' .
-						'</tr>';
+							echo ' <select ' . $disable . ' name="' . $current_value_id . '_prefix">'
+							     . '<option value="+"' . $posCheck . '>+</option>' . '<option value="-"' . $negCheck
+							     . '>-</option>' . '</select>' . '</td>' . '</tr>';
-							
+
-							
-							
-						// Download function start
+							// Download function start
-						if(strtoupper($current_product_option_name) == 'DOWNLOADS') {
-							echo '<tr>' .
-									'<td colspan="2">' . xtc_draw_pull_down_menu($current_value_id . '_download_file', xtc_getDownloads(), $attribute_value_download_filename, $disable) . '</td>' .
-									'<td class="main" colspan="3">' .
-										'&nbsp;' . DL_COUNT .
-										' <input ' . $disable . ' type="text" name="' . $current_value_id . '_download_count" value="' . $attribute_value_download_count . '">' .
-									'</td>' .
-									'<td class="main" colspan="3">' .
-										'&nbsp;' . DL_EXPIRE .
-										'<input ' . $disable . ' type="text" name="' . $current_value_id . '_download_expire" value="' . $attribute_value_download_expire . '">' .
-									'</td>' .
-								 '</tr>';
+							if(strtoupper($current_product_option_name) == 'DOWNLOADS')
+							{
+								echo '<tr>' . '<td colspan="2">' . xtc_draw_pull_down_menu($current_value_id
+								                                                           . '_download_file',
+								                                                           xtc_getDownloads(),
+								                                                           $attribute_value_download_filename,
+								                                                           $disable) . '</td>'
+								     . '<td class="main" colspan="3">' . '&nbsp;' . DL_COUNT . ' <input ' . $disable
+								     . ' type="text" name="' . $current_value_id . '_download_count" value="'
+								     . $attribute_value_download_count . '">' . '</td>'
+								     . '<td class="main" colspan="3">' . '&nbsp;' . DL_EXPIRE . '<input ' . $disable
+								     . ' type="text" name="' . $current_value_id . '_download_expire" value="'
+								     . $attribute_value_download_expire . '">' . '</td>' . '</tr>';
-						}
-					}
-					
-					// Download function end
+							}
+						}
+
+						// Download function end
-					if ($i == $matches2 ) {
+						if($i == $matches2)
+						{
-						$i = 0;
+							$i = 0;
+						}
 					}
 				}
 			} else {
@@ -262,7 +282,7 @@
 			//?>
 		</td>
 	</tr>
-	
+
 
 
 <script type="text/javascript">
\ No newline at end of file
