Jump to content


Corporate Sponsors


Latest News: (loading..)

* * * * * 4 votes

Contrib Installer


430 replies to this topic

#41 demon2lima

  • Community Member
  • 57 posts
  • Real Name:Charles Einarson

Posted 23 August 2005, 23:34

I am really in a bind. I used Contrib Installer to install Header Tags and now my categories file is missing a lot of ] and }. I am still new to PHP and can't figure out how to fix this problem. Can I get help fixing this file?

Here it is if anybody can help.

<?php
/*
$Id: categories.php,v 1.146 2003/07/11 14:40:27 hpdl Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright © 2003 osCommerce

Released under the GNU General Public License
*/

require('includes/application_top.php');

require(DIR_WS_CLASSES . 'currencies.php');
$currencies = new currencies();

$action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

if (tep_not_null($action)) {
switch ($action) {
case 'setflag':
if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {
if (isset($HTTP_GET_VARS['pID'])) {
tep_set_product_status($HTTP_GET_VARS['pID'], $HTTP_GET_VARS['flag']);
}
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

if (USE_CACHE == 'true') {
tep_reset_cache_block('categories');
tep_reset_cache_block('also_purchased');
}
}
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_GET_VARS['cPath'] . '&pID=' . $HTTP_GET_VARS['pID']));
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
break;
case 'insert_category':
case 'update_category':
if (isset($HTTP_POST_VARS['categories_id'])) $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);
$sort_order = tep_db_prepare_input($HTTP_POST_VARS['sort_order']);

$sql_data_array = array('sort_order' => $sort_order);

if ($action == 'insert_category') {
$insert_sql_data = array('parent_id' => $current_category_id,
'date_added' => 'now()');

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

tep_db_perform(TABLE_CATEGORIES, $sql_data_array);

$categories_id = tep_db_insert_id();
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ elseif ($action == 'update_category') {
$update_sql_data = array('last_modified' => 'now()');

$sql_data_array = array_merge($sql_data_array, $update_sql_data);

tep_db_perform(TABLE_CATEGORIES, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "'");
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

$languages = tep_get_languages();
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$categories_name_array = $HTTP_POST_VARS['categories_name'];

$language_id = $languages[$i]['id'];

$sql_data_array = array('categories_name' => tep_db_prepare_input($categories_name_array[$language_id/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

if ($action == 'insert_category') {
$insert_sql_data = array('categories_id' => $categories_id,
'language_id' => $languages[$i]['id']);

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

tep_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ elseif ($action == 'update_category') {
tep_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "' and language_id = '" . (int)$languages[$i]['id'/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

if ($categories_image = new upload('categories_image', DIR_FS_CATALOG_IMAGES)) {
tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'");
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

if (USE_CACHE == 'true') {
tep_reset_cache_block('categories');
tep_reset_cache_block('also_purchased');
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));
break;
case 'delete_category_confirm':
if (isset($HTTP_POST_VARS['categories_id'])) {
$categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);

$categories = tep_get_category_tree($categories_id, '', '0', '', true);
$products = array();
$products_delete = array();

for ($i=0, $n=sizeof($categories); $i<$n; $i++) {
$product_ids_query = tep_db_query("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$categories[$i]['id'/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

while ($product_ids = tep_db_fetch_array($product_ids_query)) {
$products[$product_ids['products_id']]['categories'][] = $categories[$i]['id'];
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

reset($products);
while (list($key, $value) = each($products)) {
$category_ids = '';

for ($i=0, $n=sizeof($value['categories']); $i<$n; $i++) {
$category_ids .= "'" . (int)$value['categories'][$i] . "', ";
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
$category_ids = substr($category_ids, 0, -2);

$check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$key . "' and categories_id not in (" . $category_ids . ")");
$check = tep_db_fetch_array($check_query);
if ($check['total'] < '1') {
$products_delete[$key] = $key;
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

// removing categories can be a lengthy process
tep_set_time_limit(0);
for ($i=0, $n=sizeof($categories); $i<$n; $i++) {
tep_remove_category($categories[$i]['id']);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

reset($products_delete);
while (list($key) = each($products_delete)) {
tep_remove_product($key);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

if (USE_CACHE == 'true') {
tep_reset_cache_block('categories');
tep_reset_cache_block('also_purchased');
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
break;
case 'delete_product_confirm':
if (isset($HTTP_POST_VARS['products_id']) && isset($HTTP_POST_VARS['product_categories']) && is_array($HTTP_POST_VARS['product_categories'])) {
$product_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
$product_categories = $HTTP_POST_VARS['product_categories'];

for ($i=0, $n=sizeof($product_categories); $i<$n; $i++) {
tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$product_id . "' and categories_id = '" . (int)$product_categories[$i/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

$product_categories_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$product_id . "'");
$product_categories = tep_db_fetch_array($product_categories_query);

if ($product_categories['total'] == '0') {
tep_remove_product($product_id);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

if (USE_CACHE == 'true') {
tep_reset_cache_block('categories');
tep_reset_cache_block('also_purchased');
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
break;
case 'move_category_confirm':
if (isset($HTTP_POST_VARS['categories_id']) && ($HTTP_POST_VARS['categories_id'] != $HTTP_POST_VARS['move_to_category_id'])) {
$categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);
$new_parent_id = tep_db_prepare_input($HTTP_POST_VARS['move_to_category_id']);

$path = explode('_', tep_get_generated_category_path_ids($new_parent_id));

if (in_array($categories_id, $path)) {
$messageStack->add_session(ERROR_CANNOT_MOVE_CATEGORY_TO_PARENT, 'error');

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ else {
tep_db_query("update " . TABLE_CATEGORIES . " set parent_id = '" . (int)$new_parent_id . "', last_modified = now() where categories_id = '" . (int)$categories_id . "'");

if (USE_CACHE == 'true') {
tep_reset_cache_block('categories');
tep_reset_cache_block('also_purchased');
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $new_parent_id . '&cID=' . $categories_id));
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

break;
case 'move_product_confirm':
$products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
$new_parent_id = tep_db_prepare_input($HTTP_POST_VARS['move_to_category_id']);

$duplicate_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$new_parent_id . "'");
$duplicate_check = tep_db_fetch_array($duplicate_check_query);
if ($duplicate_check['total'] < 1) tep_db_query("update " . TABLE_PRODUCTS_TO_CATEGORIES . " set categories_id = '" . (int)$new_parent_id . "' where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$current_category_id . "'");

if (USE_CACHE == 'true') {
tep_reset_cache_block('categories');
tep_reset_cache_block('also_purchased');
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $new_parent_id . '&pID=' . $products_id));
break;
case 'insert_product':
case 'update_product':
if (isset($HTTP_POST_VARS['edit_x']) || isset($HTTP_POST_VARS['edit_y'])) {
$action = 'new_product';
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ else {
if (isset($HTTP_GET_VARS['pID'])) $products_id = tep_db_prepare_input($HTTP_GET_VARS['pID']);
$products_date_available = tep_db_prepare_input($HTTP_POST_VARS['products_date_available']);

$products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';

$sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']),
'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']),
'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']),
'products_date_available' => $products_date_available,
'products_weight' => tep_db_prepare_input($HTTP_POST_VARS['products_weight']),
'products_status' => tep_db_prepare_input($HTTP_POST_VARS['products_status']),
'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']),
'manufacturers_id' => tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id'/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

if (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none')) {
$sql_data_array['products_image'] = tep_db_prepare_input($HTTP_POST_VARS['products_image']);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

if ($action == 'insert_product') {
$insert_sql_data = array('products_date_added' => 'now()');

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

tep_db_perform(TABLE_PRODUCTS, $sql_data_array);
$products_id = tep_db_insert_id();

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$current_category_id . "')");
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ elseif ($action == 'update_product') {
$update_sql_data = array('products_last_modified' => 'now()');

$sql_data_array = array_merge($sql_data_array, $update_sql_data);

tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

$languages = tep_get_languages();
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$language_id = $languages[$i]['id'];

$sql_data_array = array('products_name' => tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id]),
'products_description' => tep_db_prepare_input($HTTP_POST_VARS['products_description'][$language_id]),
'products_url' => tep_db_prepare_input($HTTP_POST_VARS['products_url'][$language_id/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

if ($action == 'insert_product') {
$insert_sql_data = array('products_id' => $products_id,
'language_id' => $language_id);

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ elseif ($action == 'update_product') {
tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

if (USE_CACHE == 'true') {
tep_reset_cache_block('categories');
tep_reset_cache_block('also_purchased');
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
break;
case 'copy_to_confirm':
if (isset($HTTP_POST_VARS['products_id']) && isset($HTTP_POST_VARS['categories_id'])) {
$products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
$categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);

if ($HTTP_POST_VARS['copy_as'] == 'link') {
if ($categories_id != $current_category_id) {
$check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$categories_id . "'");
$check = tep_db_fetch_array($check_query);
if ($check['total'] < '1') {
tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$categories_id . "')");
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ else {
$messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error');
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {
$product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);

tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");
$dup_products_id = tep_db_insert_id();

$description_query = tep_db_query("select language_id, products_name, products_description, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'");
while ($description = tep_db_fetch_array($description_query)) {
tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description['products_description']) . "', '" . tep_db_input($description['products_url']) . "', '0')");
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");
$products_id = $dup_products_id;
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

if (USE_CACHE == 'true') {
tep_reset_cache_block('categories');
tep_reset_cache_block('also_purchased');
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $categories_id . '&pID=' . $products_id));
break;
case 'new_product_preview':
// copy image only if modified
$products_image = new upload('products_image');
$products_image->set_destination(DIR_FS_CATALOG_IMAGES);
if ($products_image->parse() && $products_image->save()) {
$products_image_name = $products_image->filename;
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ else {
$products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : '');
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
break;
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

// check if the catalog image directory exists
if (is_dir(DIR_FS_CATALOG_IMAGES)) {
if (!is_writeable(DIR_FS_CATALOG_IMAGES)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error');
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ else {
$messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error');
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
?>
<!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="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<div id="spiffycalendar" class="text"></div>
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top">
<?php
if ($action == 'new_product') {
$parameters = array('products_name' => '',
'products_description' => '',
'products_url' => '',
'products_id' => '',
'products_quantity' => '',
'products_model' => '',
'products_image' => '',
'products_price' => '',
'products_weight' => '',
'products_date_added' => '',
'products_last_modified' => '',
'products_date_available' => '',
'products_status' => '',
'products_tax_class_id' => '',
'manufacturers_id' => '');

$pInfo = new objectInfo($parameters);

if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) {
$product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
$product = tep_db_fetch_array($product_query);

$pInfo->objectInfo($product);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ elseif (tep_not_null($HTTP_POST_VARS)) {
$pInfo->objectInfo($HTTP_POST_VARS);
$products_name = $HTTP_POST_VARS['products_name'];
$products_description = $HTTP_POST_VARS['products_description'];
$products_url = $HTTP_POST_VARS['products_url'];
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

$manufacturers_array = array(array('id' => '', 'text' => TEXT_NONE));
$manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
$manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],
'text' => $manufacturers['manufacturers_name']);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

$tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE));
$tax_class_query = tep_db_query("select tax_class_id, tax_class_title from " . TABLE_TAX_CLASS . " order by tax_class_title");
while ($tax_class = tep_db_fetch_array($tax_class_query)) {
$tax_class_array[] = array('id' => $tax_class['tax_class_id'],
'text' => $tax_class['tax_class_title']);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

$languages = tep_get_languages();

if (!isset($pInfo->products_status)) $pInfo->products_status = '1';
switch ($pInfo->products_status) {
case '0': $in_status = false; $out_status = true; break;
case '1':
default: $in_status = true; $out_status = false;
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
?>
<link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">
<script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>
<script language="javascript"><!--
var dateAvailable = new ctlSpiffyCalendarBox("dateAvailable", "new_product", "products_date_available","btnDate1","<?php echo $pInfo->products_date_available; ?>",scBTNMODE_CUSTOMBLUE);
//--></script>
<script language="javascript"><!--
var tax_rates = new Array();
<?php
for ($i=0, $n=sizeof($tax_class_array); $i<$n; $i++) {
if ($tax_class_array[$i]['id'] > 0) {
echo 'tax_rates["' . $tax_class_array[$i]['id'] . '"] = ' . tep_get_tax_rate_value($tax_class_array[$i]['id']) . ';' . "n";
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
?>

function doRound(x, places) {
return Math.round(x * Math.pow(10, places)) / Math.pow(10, places);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

function getTaxRate() {
var selected_value = document.forms["new_product"].products_tax_class_id.selectedIndex;
var parameterVal = document.forms["new_product"].products_tax_class_id[selected_value].value;

if ( (parameterVal > 0) && (tax_rates[parameterVal] > 0) ) {
return tax_rates[parameterVal];
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ else {
return 0;
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

function updateGross() {
var taxRate = getTaxRate();
var grossValue = document.forms["new_product"].products_price.value;

if (taxRate > 0) {
grossValue = grossValue * ((taxRate / 100) + 1);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

document.forms["new_product"].products_price_gross.value = doRound(grossValue, 4);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

function updateNet() {
var taxRate = getTaxRate();
var netValue = document.forms["new_product"].products_price_gross.value;

if (taxRate > 0) {
netValue = netValue / ((taxRate / 100) + 1);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

document.forms["new_product"].products_price.value = doRound(netValue, 4);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
//--></script>
<?php echo tep_draw_form('new_product', FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '') . '&action=new_product_preview', 'post', 'enctype="multipart/form-data"'); ?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading"><?php echo sprintf(TEXT_NEW_PRODUCT, tep_output_generated_category_path($current_category_id)); ?></td>
<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td><table border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="main"><?php echo TEXT_PRODUCTS_STATUS; ?></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_radio_field('products_status', '1', $in_status) . '&nbsp;' . TEXT_PRODUCT_AVAILABLE . '&nbsp;' . tep_draw_radio_field('products_status', '0', $out_status) . '&nbsp;' . TEXT_PRODUCT_NOT_AVAILABLE; ?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_PRODUCTS_DATE_AVAILABLE; ?><br><small>(YYYY-MM-DD)</small></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;'; ?><script language="javascript">dateAvailable.writeControl(); dateAvailable.dateFormat="yyyy-MM-dd";</script></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_PRODUCTS_MANUFACTURER; ?></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, $pInfo->manufacturers_id); ?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<?php
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
<tr>
<td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_NAME; ?></td>
<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . tep_draw_input_field('products_name[' . $languages[$i]['id'] . ']', (isset($products_name[$languages[$i]['id']]) ? $products_name[$languages[$i]['id']] : tep_get_products_name($pInfo->products_id, $languages[$i]['id']))); ?></td>
</tr>
<?php
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
?>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr bgcolor="#ebebff">
<td class="main"><?php echo TEXT_PRODUCTS_TAX_CLASS; ?></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id, 'onchange="updateGross()"'); ?></td>
</tr>
<tr bgcolor="#ebebff">
<td class="main"><?php echo TEXT_PRODUCTS_PRICE_NET; ?></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_price', $pInfo->products_price, 'onKeyUp="updateGross()"'); ?></td>
</tr>
<tr bgcolor="#ebebff">
<td class="main"><?php echo TEXT_PRODUCTS_PRICE_GROSS; ?></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_price_gross', $pInfo->products_price, 'OnKeyUp="updateNet()"'); ?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<script language="javascript"><!--
updateGross();
//--></script>
<?php
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
<tr>
<td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_DESCRIPTION; ?></td>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?>&nbsp;</td>
<td class="main"><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? $products_description[$languages[$i]['id']] : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td>
</tr>
</table></td>
</tr>
<?php
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
?>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_PRODUCTS_QUANTITY; ?></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_quantity', $pInfo->products_quantity); ?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_PRODUCTS_MODEL; ?></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_model', $pInfo->products_model); ?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_PRODUCTS_IMAGE; ?></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_file_field('products_image') . '<br>' . tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . $pInfo->products_image . tep_draw_hidden_field('products_previous_image', $pInfo->products_image); ?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<?php
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
<tr>
<td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_URL . '<br><small>' . TEXT_PRODUCTS_URL_WITHOUT_HTTP . '</small>'; ?></td>
<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . tep_draw_input_field('products_url[' . $languages[$i]['id'] . ']', (isset($products_url[$languages[$i]['id']]) ? $products_url[$languages[$i]['id']] : tep_get_products_url($pInfo->products_id, $languages[$i]['id']))); ?></td>
</tr>
<?php
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
?>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_PRODUCTS_WEIGHT; ?></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_weight', $pInfo->products_weight); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="main" align="right"><?php echo tep_draw_hidden_field('products_date_added', (tep_not_null($pInfo->products_date_added) ? $pInfo->products_date_added : date('Y-m-d'))) . tep_image_submit('button_preview.gif', IMAGE_PREVIEW) . '&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
</tr>
</table></form>
<?php
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ elseif ($action == 'new_product_preview') {
if (tep_not_null($HTTP_POST_VARS)) {
$pInfo = new objectInfo($HTTP_POST_VARS);
$products_name = $HTTP_POST_VARS['products_name'];
$products_description = $HTTP_POST_VARS['products_description'];
$products_url = $HTTP_POST_VARS['products_url'];
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ else {
$product_query = tep_db_query("select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_url, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_id = '" . (int)$HTTP_GET_VARS['pID'/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
$product = tep_db_fetch_array($product_query);

$pInfo = new objectInfo($product);
$products_image_name = $pInfo->products_image;
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

$form_action = (isset($HTTP_GET_VARS['pID'])) ? 'update_product' : 'insert_product';

echo tep_draw_form($form_action, FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '') . '&action=' . $form_action, 'post', 'enctype="multipart/form-data"');

$languages = tep_get_languages();
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
if (isset($HTTP_GET_VARS['read']) && ($HTTP_GET_VARS['read'] == 'only')) {
$pInfo->products_name = tep_get_products_name($pInfo->products_id, $languages[$i]['id']);
$pInfo->products_description = tep_get_products_description($pInfo->products_id, $languages[$i]['id']);
$pInfo->products_url = tep_get_products_url($pInfo->products_id, $languages[$i]['id']);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ else {
$pInfo->products_name = tep_db_prepare_input($products_name[$languages[$i]['id']]);
$pInfo->products_description = tep_db_prepare_input($products_description[$languages[$i]['id']]);
$pInfo->products_url = tep_db_prepare_input($products_url[$languages[$i]['id']]);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . $pInfo->products_name; ?></td>
<td class="pageHeading" align="right"><?php echo $currencies->format($pInfo->products_price); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="main"><?php echo tep_image(DIR_WS_CATALOG_IMAGES . $products_image_name, $pInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="right" hspace="5" vspace="5"') . $pInfo->products_description; ?></td>
</tr>
<?php
if ($pInfo->products_url) {
?>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="main"><?php echo sprintf(TEXT_PRODUCT_MORE_INFORMATION, $pInfo->products_url); ?></td>
</tr>
<?php
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
?>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<?php
if ($pInfo->products_date_available > date('Y-m-d')) {
?>
<tr>
<td align="center" class="smallText"><?php echo sprintf(TEXT_PRODUCT_DATE_AVAILABLE, tep_date_long($pInfo->products_date_available)); ?></td>
</tr>
<?php
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ else {
?>
<tr>
<td align="center" class="smallText"><?php echo sprintf(TEXT_PRODUCT_DATE_ADDED, tep_date_long($pInfo->products_date_added)); ?></td>
</tr>
<?php
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
?>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<?php
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */

if (isset($HTTP_GET_VARS['read']) && ($HTTP_GET_VARS['read'] == 'only')) {
if (isset($HTTP_GET_VARS['origin'])) {
$pos_params = strpos($HTTP_GET_VARS['origin'], '?', 0);
if ($pos_params != false) {
$back_url = substr($HTTP_GET_VARS['origin'], 0, $pos_params);
$back_url_params = substr($HTTP_GET_VARS['origin'], $pos_params + 1);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ else {
$back_url = $HTTP_GET_VARS['origin'];
$back_url_params = '';
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ else {
$back_url = FILENAME_CATEGORIES;
$back_url_params = 'cPath=' . $cPath . '&pID=' . $pInfo->products_id;
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
?>
<tr>
<td align="right"><?php echo '<a href="' . tep_href_link($back_url, $back_url_params, 'NONSSL') . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
</tr>
<?php
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ else {
?>
<tr>
<td align="right" class="smallText">
<?php
/* Re-Post all POST'ed variables */
reset($HTTP_POST_VARS);
while (list($key, $value) = each($HTTP_POST_VARS)) {
if (!is_array($HTTP_POST_VARS[$key])) {
echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
$languages = tep_get_languages();
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
echo tep_draw_hidden_field('products_name[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_name[$languages[$i]['id']])));
echo tep_draw_hidden_field('products_description[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_description[$languages[$i]['id']])));
echo tep_draw_hidden_field('products_url[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_url[$languages[$i]['id']])));
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
echo tep_draw_hidden_field('products_image', stripslashes($products_image_name));

echo tep_image_submit('button_back.gif', IMAGE_BACK, 'name="edit"') . '&nbsp;&nbsp;';

if (isset($HTTP_GET_VARS['pID'])) {
echo tep_image_submit('button_update.gif', IMAGE_UPDATE);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ else {
echo tep_image_submit('button_insert.gif', IMAGE_INSERT);
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
echo '&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>';
?></td>
</tr>
</table></form>
<?php
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ else {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
<td align="right"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="smallText" align="right">
<?php
echo tep_draw_form('search', FILENAME_CATEGORIES, '', 'get');
echo HEADING_TITLE_SEARCH . ' ' . tep_draw_input_field('search');
echo '</form>';
?>
</td>
</tr>
<tr>
<td class="smallText" align="right">
<?php
echo tep_draw_form('goto', FILENAME_CATEGORIES, '', 'get');
echo HEADING_TITLE_GOTO . ' ' . tep_draw_pull_down_menu('cPath', tep_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"');
echo '</form>';
?>
</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr class="dataTableHeadingRow">
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CATEGORIES_PRODUCTS; ?></td>
<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
</tr>
<?php
$categories_count = 0;
$rows = 0;
if (isset($HTTP_GET_VARS['search'])) {
$search = tep_db_prepare_input($HTTP_GET_VARS['search']);

/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */ else {
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
/* End Header_Tags_Controller-2.5.4-2 - installed by contrib_installer */
while ($categories = tep_db_fetch_array($categories_query)) {
$categories_count++;
$rows++;

// Get parent_id for subcategories if search
if (isset($HTTP_GET_VARS['search'])) $cPath= $categories['parent_id'];

if ((!isset($HTTP_GET_VARS['cID']) && !isset($HTTP_GET_VARS['pID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $categories['categories_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
$categ

#42 rinon

  • Community Member
  • 79 posts
  • Real Name:Rinon Encaitarion

Posted 23 August 2005, 23:55

demon2lima, on Aug 23 2005, 04:34 PM, said:

I am really in a bind. I used Contrib Installer to install Header Tags and now my categories file is missing a lot of ] and }. I am still new to PHP and can't figure out how to fix this problem. Can I get help fixing this file?

Here it is if anybody can help.

<snip>

<{POST_SNAPBACK}>


Hopefully you hadn't altered this file previously? If you haven't altered, then you can just replace it with the categories.php file from the oscommerce zip file. I assume you mean admin/categories.php, correct?

I'm working on fixing this bug, but I'm not sure what's causing it, it works fine on my system. What version of PHP and MySQL are you using? (you can find this info under "Server Info" in the Tools section of the administration) Also, had you installed anything else before the Header Tags Controller CIP (Contrib Installer Package)? Any manual altering? Any information that you (or anyone else who's having similar problems) can provide will be immensely helpful in getting this fixed. I especially need to know the PHP and MySQL versions of anyone who's having these (or similar) problems.

Also, for next time, just a posting on this thread would have been sufficient, instead of the announcements thread.

- Rinon

#43 Dayna

  • Community Member
  • 3 posts
  • Real Name:Dayna Vez

Posted 26 August 2005, 12:20

maxcdr, on Aug 14 2005, 01:40 PM, said:

Hello,

Thanks for this fantastic job !

Anyway still dos not work for me... :(

I'm trying to instal Header Tags Controller using Contrib installer locally with EasyPHP. Everything seems fine until I reach this page : http://127.0.0.1/admin/contrib_installer.php.
Here the title is "HEADING_TITLE" and below I have the big square with the contrib I have in my admin/contributions folder. So I select Header Tags Controller and hit the INSTALL button.
This lead to the following error message :
"Not Found
The requested URL /admin/FILENAME_CONTRIB_INSTALLER was not found on this server."
And the URL in the address bar is the following :
"http://127.0.0.1/admin/FILENAME_CONTRIB_INSTALLER?contrib=Header_Tags_Controller-2.5.4-2&action=install"

I think the problem come from FILENAME_CONTRIB_INSTALLER which should be something else, but I don't know what....

Thanks for your help

<{POST_SNAPBACK}>


I have a problem like yours. :blink: The message says:

Warning: opendir(e:/easyphp1-8/www/contributions/): failed to open dir: Invalid argument in e:\easyphp1-8\www\oscommerce\admin\contrib_installer.php on line 832

Warning: readdir(): supplied argument is not a valid Directory resource in e:\easyphp1-8\www\oscommerce\admin\contrib_installer.php on line 833

Warning: closedir(): supplied argument is not a valid Directory resource in e:\easyphp1-8\www\oscommerce\admin\contrib_installer.php on line 838


and the line 832 is
$dh = opendir(MODULE_CONTRIB_INSTALLER_DIR_FS_CONTRIBUTIONS);

#44 rinon

  • Community Member
  • 79 posts
  • Real Name:Rinon Encaitarion

Posted 26 August 2005, 16:16

Dayna, on Aug 26 2005, 05:20 AM, said:

I have a problem like yours.  :blink: The message says:

Warning: opendir(e:/easyphp1-8/www/contributions/): failed to open dir: Invalid argument in e:\easyphp1-8\www\oscommerce\admin\contrib_installer.php on line 832

Warning: readdir(): supplied argument is not a valid Directory resource in e:\easyphp1-8\www\oscommerce\admin\contrib_installer.php on line 833

Warning: closedir(): supplied argument is not a valid Directory resource in e:\easyphp1-8\www\oscommerce\admin\contrib_installer.php on line 838


and the line 832 is
$dh  = opendir(MODULE_CONTRIB_INSTALLER_DIR_FS_CONTRIBUTIONS);

<{POST_SNAPBACK}>


In both of these cases, it would seem to me that the correct database entry doesn't exist. Can you see if there is any database entry in the configuration table referrring to MODULE_CONTRIB_INSTALLER_DIR_FS_CONTRIBUTIONS? Perhaps this SQL would work for you:
SELECT * FROM configuration WHERE configuration_key = 'MODULE_CONTRIB_INSTALLER_DIR_FS_CONTRIBUTIONS';

- Rinon

#45 EvaD

  • Community Member
  • 5 posts
  • Real Name:Dave

Posted 26 August 2005, 21:39

Hi. I am new and I am having problems installing the Admin_Access-2.1.1-2. I go through all the steps, and after setting the permissions I get a list of actions that the installer performed. Such as things that it created in the sql, and changes that it made. After that I try to access the admin and I get the following error

Quote

Parse error: parse error, unexpected '}', expecting ']' in /home/airsoft1/public_html/admin/index.php on line 146
Was there something that I was suppose to do that I somehow missed? Your help is appreciated, thanks.

Edited by EvaD, 26 August 2005, 21:40.


#46 EvaD

  • Community Member
  • 5 posts
  • Real Name:Dave

Posted 26 August 2005, 22:32

i just reinstalled the contrib again and proceeded to install the admin access. going through the instructions step by step i noticed that it says

Quote

2. Database.
You must to create three tables into your DB, using the 'admin_tabel.sql' file.
i searched through the zip file and did not find that admin_table.sql, where am i suppose to find this file so i can create the 3 tables?

#47 rinon

  • Community Member
  • 79 posts
  • Real Name:Rinon Encaitarion

Posted 26 August 2005, 22:39

EvaD, on Aug 26 2005, 02:39 PM, said:

Hi. I am new and I am having problems installing the Admin_Access-2.1.1-2. I go through all the steps, and after setting the permissions I get a list of actions that the installer performed. Such as things that it created in the sql, and changes that it made. After that I try to access the admin and I get the following error
Was there something that I was suppose to do that I somehow missed? Your help is appreciated, thanks.

<{POST_SNAPBACK}>

This is a bug, and has been reported before. I'm working on figuring out exactly what this is and why it is occurring, since I can't duplicate it on my machine. What version of PHP do you have? Can you post the lines around 146 in catalog/admin/index.php please?

EvaD, on Aug 26 2005, 03:32 PM, said:

i just reinstalled the contrib again and proceeded to install the admin access. going through the instructions step by step i noticed that it says

i searched through the zip file and did not find that admin_table.sql, where am i suppose to find this file so i can create the 3 tables?

<{POST_SNAPBACK}>


What you described above sounds correct (although it is obviously not working). You don't need to use the instructions in the readme for Admin_Access CIP, I just put that there for documentation sake. If you want to install using the Contrib Installer, just do what you did above, don't follow the manual instructions. BTW - the Installer will take care of creating those tables.

Sorry for the bug, I'm working on fixing it. I unfortunately just can't duplicate this behavior.

- Rinon

#48 mooncylde

  • Community Member
  • 3 posts
  • Real Name:Angel

Posted 28 August 2005, 06:56

Hello! I think this is a fantastic idea !

Have yet to try it out (no time @@) but jus like u to know that I appreciate ur efforts! :lol:

#49 EvaD

  • Community Member
  • 5 posts
  • Real Name:Dave

Posted 31 August 2005, 17:41

rinon, on Aug 26 2005, 02:39 PM, said:

This is a bug, and has been reported before. I'm working on figuring out exactly what this is and why it is occurring, since I can't duplicate it on my machine. What version of PHP do you have? Can you post the lines around 146 in catalog/admin/index.php please?
What you described above sounds correct (although it is obviously not working). You don't need to use the instructions in the readme for Admin_Access CIP, I just put that there for documentation sake. If you want to install using the Contrib Installer, just do what you did above, don't follow the manual instructions. BTW - the Installer will take care of creating those tables.

Sorry for the bug, I'm working on fixing it. I unfortunately just can't duplicate this behavior.

- Rinon

<{POST_SNAPBACK}>

hi thanks for your quick response. i am using php version 4.3.11. i will do a fresh install right now and as soon as i am done i will post the lines that you asked for.

#50 EvaD

  • Community Member
  • 5 posts
  • Real Name:Dave

Posted 31 August 2005, 17:57

ok i just finished the fresh install, and i have the same problem. here are the lines from 140 to 150:
  $orders_contents = '';
  $orders_status_query = tep_db_query("select orders_status_name, orders_status_id from " . TABLE_ORDERS_STATUS . " where language_id = '" . $languages_id . "'");
  while ($orders_status = tep_db_fetch_array($orders_status_query)) {
    $orders_pending_query = tep_db_query("select count(*) as count from " . TABLE_ORDERS . " where orders_status = '" . $orders_status['orders_status_id'] . "'");
    $orders_pending = tep_db_fetch_array($orders_pending_query);
    $orders_contents .= '<a href="' . tep_href_link(FILENAME_ORDERS, 'selected_box=customers&status=' . $orders_status['orders_status_id']) . '">' . $orders_status['orders_status_name'] . '</a>: ' . $orders_pending['count'/* End Admin_Access-2.1.1 - installed by contrib_installer */
}
  $orders_contents = substr($orders_contents, 0, -4);

  $heading = array();
  $contents = array();
line 146 is " } "

Edited by EvaD, 31 August 2005, 17:58.


#51 EvaD

  • Community Member
  • 5 posts
  • Real Name:Dave

Posted 31 August 2005, 18:06

i also noticed that when i went to the contrib_installer.php it gives me the following error

Quote

Parse error: parse error, unexpected T_ELSEIF in /home/airsoft1/public_html/admin/includes/functions/html_output.php on line 21
and the code from 18-23 is:
    /* End Admin_Access-2.1.1 - installed by contrib_installer */
    if ($connection == 'NONSSL') {
      $link = HTTP_SERVER . DIR_WS_ADMIN;
    /* End Admin_Access-2.1.1 - installed by contrib_installer */ elseif ($connection == 'SSL') {
      if (ENABLE_SSL == 'true') {
        $link = HTTPS_SERVER . DIR_WS_ADMIN;

line 21 is " /* End Admin_Access-2.1.1 - installed by contrib_installer */ elseif ($connection == 'SSL') { "

Edited by EvaD, 31 August 2005, 18:07.


#52 demon2lima

  • Community Member
  • 57 posts
  • Real Name:Charles Einarson

Posted 31 August 2005, 18:36

EvaD, on Aug 31 2005, 11:06 AM, said:

i also noticed that when i went to the contrib_installer.php it gives me the following error and the code from 18-23 is:
    /* End Admin_Access-2.1.1 - installed by contrib_installer */
    if ($connection == 'NONSSL') {
      $link = HTTP_SERVER . DIR_WS_ADMIN;
    /* End Admin_Access-2.1.1 - installed by contrib_installer */ elseif ($connection == 'SSL') {
      if (ENABLE_SSL == 'true') {
        $link = HTTPS_SERVER . DIR_WS_ADMIN;

line 21 is "  /* End Admin_Access-2.1.1 - installed by contrib_installer */ elseif ($connection == 'SSL') { "

<{POST_SNAPBACK}>


Contrib Installer is pasting itself in the middle of code, sometimes removing code completely. The only package I have had work is the PayPal IPN install.

#53 rinon

  • Community Member
  • 79 posts
  • Real Name:Rinon Encaitarion

Posted 01 September 2005, 02:52

demon2lima, on Aug 31 2005, 11:36 AM, said:

Contrib Installer is pasting itself in the middle of code, sometimes removing code completely. The only package I have had work is the PayPal IPN install.

<{POST_SNAPBACK}>


Yes, that seems to be the problem with it. Sorry everyone for all the trouble. I'm on vacation till saturday, so I can't work on this until I get back.

It seems to be related to PHP4 vs. PHP5. I have everything running on 5, but when I get back I'm going to try to install and test this on 4.

- Rinon

#54 propowders

  • Community Member
  • 57 posts
  • Real Name:Chris

Posted 05 September 2005, 11:22

Hey rinon,

This Contribution should be great once i have it running howvere, i was hoping you can shead some light on my issue.

I downloaded the latest version of Contrib Installer, posted on 10 Aug 2005,



I browse to http://www.doming.com/admin/contrib_installer.php where it displays the "Initialize Contrib Installer page".

In the "Contribution Directory" it displays "/home/httpd/vhosts/domain.com/admin/contributions",

When i hit "Continue" i get the following Error message,

"I need write permission for: /home/httpd/vhosts/domain.com/admin/contributions"

I have tried to allow write permissions on the admin folder but without any luck..
I even tried to allow write permissions on everysingle files to see if that would work..


What do you think could be the issue?

Thanks
Chris
Director
ProPowders.com.au
Your Online Health Supplement Store

#55 rinon

  • Community Member
  • 79 posts
  • Real Name:Rinon Encaitarion

Posted 05 September 2005, 18:02

propowders, on Sep 5 2005, 04:22 AM, said:

Hey rinon,

This Contribution should be great once i have it running howvere, i was hoping you can shead some light on my issue.

I downloaded the latest version of Contrib Installer, posted on 10 Aug 2005,
I browse to http://www.doming.com/admin/contrib_installer.php where it displays the "Initialize Contrib Installer page".

In the "Contribution Directory" it displays  "/home/httpd/vhosts/domain.com/admin/contributions",

When i hit "Continue" i get the following Error message,

"I need write permission for: /home/httpd/vhosts/domain.com/admin/contributions"

I have tried to allow write permissions on the admin folder but without any luck..
I even tried to allow write permissions on everysingle files to see if that would work..
What do you think could be the issue?

Thanks

<{POST_SNAPBACK}>


You will need to manually create a directory to store CIPs in. I would suggest using the default, so create a directory called contributions in the admin/ folder.

- Rinon

#56 propowders

  • Community Member
  • 57 posts
  • Real Name:Chris

Posted 06 September 2005, 06:06

thanks for your reply..
i had already created a new dicectore in the admin folder called "contributions"

and ive set full permissions on the folder..


Hmmm strange
Chris
Director
ProPowders.com.au
Your Online Health Supplement Store

#57 rinon

  • Community Member
  • 79 posts
  • Real Name:Rinon Encaitarion

Posted 06 September 2005, 23:53

propowders, on Sep 5 2005, 11:06 PM, said:

thanks for your reply..
i had already created a new dicectore in the admin folder called "contributions"

and ive set full permissions on the folder..
Hmmm strange

<{POST_SNAPBACK}>


Which version of PHP are you using (you can find this under server info in the Tools section of the Admin interface)? The installer (at least for the moment) requires at least PHP 4.

I did find a few mistakes in the code, which may be the cause of your problem:

Line 75:
  if(!is_writable(dirname($contrib_dir)) && !is_dir(dirname($contrib_dir)))
should be:
  if(!is_writable(dirname($contrib_dir)) && !is_dir($contrib_dir))

And line 86:
  if(!is_dir(dirname($contrib_dir)))
should be:
  if(!is_dir($contrib_dir))

I will fix these in the next release.

- Rinon

#58 demon2lima

  • Community Member
  • 57 posts
  • Real Name:Charles Einarson

Posted 07 September 2005, 02:36

Any idea when the next version will be?

#59 rinon

  • Community Member
  • 79 posts
  • Real Name:Rinon Encaitarion

Posted 07 September 2005, 19:11

demon2lima, on Sep 6 2005, 07:36 PM, said:

Any idea when the next version will be?

<{POST_SNAPBACK}>


I'm really not sure. It will be when I figure out what is causing these critical bugs. I can't duplicate them on my system, so I'm having trouble finding exactly what's the problem.

- Rinon

#60 crashwave

  • Community Member
  • 146 posts
  • Real Name:H@D!R
  • Gender:Female
  • Location:USA

Posted 11 September 2005, 17:52

Sorry if this question was asked before (really I looked)

How does it know what was deleted and what wasn't and if a contribution looks for something that was changed by another contribution what happens
I read part of the script and so far this is what I see might happen
//////////////////////

if there are 3 contributions (made for CI)
contrib1 instalation (installs succesfully in new MS2)
--find in fileX tep_something($something) line 200 change to
if(tep_something($something))
do this;
else do that:

contrib2 instalation
--change in fileX tep_something($something) line 200 to
if((something_here) && tep_something($something))
do this too;
else do that too;

contribution 3 instalation
--delete in fileX tep_something($something) line 200

but tep_something($something) was changed by contrib 1 so contribution 2 and 3 will leave file x line 200 looking like this

if(if((something_here) && )
do this too;
else do that too;)
do this;
else do that:

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

or does something else happen

Edited by crashwave, 11 September 2005, 17:54.

q_|_|| _|9~~J >-o>-o q_|_|| )| q_|| )