(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
   (c) 2002-2003 osCommercecoding standards www.oscommerce.com
   (c) 2003 nextcommerce (content_manager.php,v 1.18 2003/08/25); www.nextcommerce.org
   (c) 2006 XT-Commerce (content_manager.php 1304 2005-10-12)

   Released under the GNU General Public License
   --------------------------------------------------------------*/
require 'includes/application_top.php';
require_once DIR_FS_INC . 'xtc_format_filesize.inc.php';
require_once DIR_FS_INC . 'xtc_filesize.inc.php';
require_once DIR_FS_INC . 'xtc_wysiwyg.inc.php';
$action = isset($_GET['action']) ? $_GET['action'] : '';
$special = isset($_GET['special']) ? $_GET['special'] : '';
$id = isset($_GET['id']) ? $_GET['id'] : '';
$g_coID = isset($_GET['coID']) ? (int) $_GET['coID'] : '';
$languages = xtc_get_languages();
if ($special == 'delete') {
    xtc_db_query("DELETE FROM " . TABLE_CONTENT_MANAGER . " where content_id='" . $g_coID . "'");
    xtc_redirect(xtc_href_link(FILENAME_CONTENT_MANAGER));
}
// if get special
if ($id == 'update' or $id == 'insert') {
    // set allowed c.groups
    $group_ids = '';
    if (isset($_POST['groups'])) {
        foreach ($_POST['groups'] as $b) {
            $group_ids .= 'c_' . $b . "_group ,";
        }
    }
    $customers_statuses_array = xtc_get_customers_statuses();
    if (strstr($group_ids, 'c_all_group')) {
Exemplo n.º 2
0
/**
 * xtc_reset_cache_block()
 *
 * @param mixed $cache_block
 * @return
 */
function xtc_reset_cache_block($cache_block)
{
    global $cache_blocks;
    for ($i = 0, $n = sizeof($cache_blocks); $i < $n; $i++) {
        if ($cache_blocks[$i]['code'] == $cache_block) {
            if ($cache_blocks[$i]['multiple']) {
                if ($dir = @opendir(DIR_FS_CACHE)) {
                    while ($cache_file = readdir($dir)) {
                        $cached_file = $cache_blocks[$i]['file'];
                        $languages = xtc_get_languages();
                        for ($j = 0, $k = sizeof($languages); $j < $k; $j++) {
                            $cached_file_unlink = preg_replace('/-language/i', '-' . $languages[$j]['directory'], $cached_file);
                            // Hetfield - 2009-08-19 - replaced deprecated function ereg_replace with preg_replace to be ready for PHP >= 5.3
                            if (preg_match('/^' . $cached_file_unlink . '/', $cache_file)) {
                                // Hetfield - 2009-08-19 - replaced deprecated function ereg with preg_match to be ready for PHP >= 5.3
                                @unlink(DIR_FS_CACHE . $cache_file);
                            }
                        }
                    }
                    closedir($dir);
                }
            } else {
                $cached_file = $cache_blocks[$i]['file'];
                $languages = xtc_get_languages();
                for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
                    $cached_file = preg_replace('/-language/i', '-' . $languages[$i]['directory'], $cached_file);
                    // Hetfield - 2009-08-19 - replaced deprecated function ereg_replace with preg_replace to be ready for PHP >= 5.3
                    @unlink(DIR_FS_CACHE . $cached_file);
                }
            }
            break;
        }
    }
}
 protected function _installRatepayPaidState()
 {
     $check_query = xtc_db_query("select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_name = 'RatePAY [Bezahlt]' limit 1");
     if (xtc_db_num_rows($check_query) < 1) {
         $status_query = xtc_db_query("select max(orders_status_id) as status_id from " . TABLE_ORDERS_STATUS);
         $status = xtc_db_fetch_array($status_query);
         $status_id = $status['status_id'] + 1;
         $languages = xtc_get_languages();
         foreach ($languages as $lang) {
             xtc_db_query("insert into " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . $status_id . "', '" . $lang['id'] . "', 'RatePAY [Bezahlt]')");
         }
         $flags_query = xtc_db_query("describe " . TABLE_ORDERS_STATUS . " public_flag");
         if (xtc_db_num_rows($flags_query) == 1) {
             xtc_db_query("update " . TABLE_ORDERS_STATUS . " set public_flag = 0 and downloads_flag = 0 where orders_status_id = '" . $status_id . "'");
         }
     } else {
         $check = xtc_db_fetch_array($check_query);
         $status_id = $check['orders_status_id'];
     }
     return $status_id;
 }
Exemplo n.º 4
0
 function insert_product($products_data, $dest_category_id, $link, $action = 'insert')
 {
     $products_id = xtc_db_prepare_input($products_data['products_id']);
     $products_date_available = xtc_db_prepare_input($products_data['products_date_available']);
     $products_date_available = date('Y-m-d') < $products_date_available ? $products_date_available : 'null';
     $products_status = xtc_db_prepare_input($products_data['products_status']);
     if ($products_data['products_startpage'] == 1) {
         $this->link_product($products_data['products_id'], 0);
         //$products_status = 1;    //web28 2012-10-30 - don't set status active
     } else {
         $this->set_product_remove_startpage_sql($products_data['products_id'], 0);
         //Dokuman - 2009-11-12 - BUGFIX #0000351: When products disable display on startpage, should update table products_to_categories
     }
     if (PRICE_IS_BRUTTO == 'true' && $products_data['products_price']) {
         $products_data['products_price'] = round($products_data['products_price'] / (xtc_get_tax_rate($products_data['products_tax_class_id']) + 100) * 100, PRICE_PRECISION);
     }
     $customers_statuses_array = xtc_get_customers_statuses();
     $permission = array();
     for ($i = 0, $n = sizeof($customers_statuses_array); $i < $n; $i++) {
         if (isset($customers_statuses_array[$i]['id'])) {
             $permission[$customers_statuses_array[$i]['id']] = 0;
         }
     }
     if (isset($products_data['groups'])) {
         foreach ($products_data['groups'] as $dummy => $b) {
             $permission[$b] = 1;
         }
     }
     // build array
     if ($permission['all'] == 1) {
         $permission = array();
         end($customers_statuses_array);
         for ($i = 0, $n = key($customers_statuses_array); $i < $n + 1; $i++) {
             if (isset($customers_statuses_array[$i]['id'])) {
                 $permission[$customers_statuses_array[$i]['id']] = 1;
             }
         }
     }
     $permission_array = array();
     // set pointer to last key
     end($customers_statuses_array);
     for ($i = 0, $n = key($customers_statuses_array); $i < $n + 1; $i++) {
         if (isset($customers_statuses_array[$i]['id'])) {
             $permission_array = array_merge($permission_array, array('group_permission_' . $customers_statuses_array[$i]['id'] => $permission[$customers_statuses_array[$i]['id']]));
         }
     }
     $sql_data_array = array('products_quantity' => xtc_db_prepare_input($products_data['products_quantity']), 'products_model' => xtc_db_prepare_input($products_data['products_model']), 'products_ean' => xtc_db_prepare_input($products_data['products_ean']), 'products_price' => xtc_db_prepare_input($products_data['products_price']), 'products_sort' => xtc_db_prepare_input($products_data['products_sort']), 'products_shippingtime' => xtc_db_prepare_input($products_data['shipping_status']), 'products_discount_allowed' => xtc_db_prepare_input($products_data['products_discount_allowed']), 'products_date_available' => $products_date_available, 'products_weight' => xtc_db_prepare_input($products_data['products_weight']), 'products_status' => $products_status, 'products_startpage' => xtc_db_prepare_input($products_data['products_startpage']), 'products_startpage_sort' => xtc_db_prepare_input($products_data['products_startpage_sort']), 'products_tax_class_id' => xtc_db_prepare_input($products_data['products_tax_class_id']), 'product_template' => xtc_db_prepare_input($products_data['info_template']), 'options_template' => xtc_db_prepare_input($products_data['options_template']), 'manufacturers_id' => xtc_db_prepare_input($products_data['manufacturers_id']), 'products_fsk18' => xtc_db_prepare_input($products_data['fsk18']), 'products_vpe_value' => xtc_db_prepare_input($products_data['products_vpe_value']), 'products_vpe_status' => xtc_db_prepare_input($products_data['products_vpe_status']), 'products_vpe' => xtc_db_prepare_input($products_data['products_vpe']), 'wholesaler_id' => xtc_db_prepare_input($products_data['wholesaler_id']), 'wholesaler_reorder' => xtc_db_prepare_input($products_data['wholesaler_reorder']));
     if (trim(ADD_PRODUCTS_FIELDS) != '') {
         $sql_data_array = array_merge($sql_data_array, $this->add_data_fields(ADD_PRODUCTS_FIELDS, $products_data));
     }
     //echo print_r($sql_data_array); EXIT;
     $sql_data_array = array_merge($sql_data_array, $permission_array);
     //get the next ai-value from table products if no products_id is set
     if (!$products_id || $products_id == '') {
         $new_pid_query = xtc_db_query("SHOW TABLE STATUS LIKE '" . TABLE_PRODUCTS . "'");
         $new_pid_query_values = xtc_db_fetch_array($new_pid_query);
         $products_id = $new_pid_query_values['Auto_increment'];
     }
     //prepare products_image filename
     $accepted_products_image_files_extensions = array("jpg", "jpeg", "jpe", "gif", "png", "bmp", "tiff", "tif", "bmp");
     $accepted_products_image_files_mime_types = array("image/jpeg", "image/gif", "image/png", "image/bmp");
     if ($products_image = xtc_try_upload('products_image', DIR_FS_CATALOG_ORIGINAL_IMAGES, '777', $accepted_products_image_files_extensions, $accepted_products_image_files_mime_types)) {
         $pname_arr = explode('.', $products_image->filename);
         $nsuffix = array_pop($pname_arr);
         $products_image_name = $products_id . '_0.' . $nsuffix;
         $dup_check_query = xtc_db_query("SELECT COUNT(*) AS total\n                                                FROM " . TABLE_PRODUCTS . "\n                                               WHERE products_image = '" . $products_data['products_previous_image_0'] . "'");
         $dup_check = xtc_db_fetch_array($dup_check_query);
         if ($dup_check['total'] < 2) {
             @xtc_del_image_file($products_data['products_previous_image_0']);
         }
         //workaround if there are v2 images mixed with v3
         $dup_check_query = xtc_db_query("SELECT COUNT(*) AS total\n                                                FROM " . TABLE_PRODUCTS . "\n                                               WHERE products_image = '" . $products_image->filename . "'");
         $dup_check = xtc_db_fetch_array($dup_check_query);
         if ($dup_check['total'] == 0) {
             rename(DIR_FS_CATALOG_ORIGINAL_IMAGES . $products_image->filename, DIR_FS_CATALOG_ORIGINAL_IMAGES . $products_image_name);
         } else {
             copy(DIR_FS_CATALOG_ORIGINAL_IMAGES . $products_image->filename, DIR_FS_CATALOG_ORIGINAL_IMAGES . $products_image_name);
         }
         $sql_data_array['products_image'] = xtc_db_prepare_input($products_image_name);
         require DIR_WS_INCLUDES . 'product_thumbnail_images.php';
         require DIR_WS_INCLUDES . 'product_info_images.php';
         require DIR_WS_INCLUDES . 'product_popup_images.php';
         // set file rights
         $this->set_products_images_file_rights($products_image_name);
     } else {
         // save, when wo no upload an image
         $mo_img = array('image_title' => xtc_db_prepare_input($products_data['image_title'][$img + 1]), 'image_alt' => xtc_db_prepare_input($products_data['image_alt'][$img + 1]));
         if ($action == 'update' && $products_data['products_previous_image_' . ($img + 1)]) {
             if ($products_data['del_mo_pic']) {
                 foreach ($products_data['del_mo_pic'] as $dummy => $val) {
                     if ($val == $products_data['products_previous_image_' . ($img + 1)]) {
                         xtc_db_perform(TABLE_PRODUCTS_IMAGES, $mo_img);
                     }
                     break;
                 }
             }
             xtc_db_perform(TABLE_PRODUCTS_IMAGES, $mo_img, 'update', 'image_name = \'' . xtc_db_input($products_data['products_previous_image_' . ($img + 1)]) . '\'');
         } elseif (!$products_data['products_previous_image_' . ($img + 1)]) {
             xtc_db_perform(TABLE_PRODUCTS_IMAGES, $mo_img);
         }
         $products_image_name = $products_data['products_previous_image_0'];
     }
     //are we asked to delete some pics?
     if ($products_data['del_pic'] != '') {
         $dup_check_query = xtc_db_query("SELECT COUNT(*) AS total\n                                                FROM " . TABLE_PRODUCTS . "\n                                               WHERE products_image = '" . $products_data['del_pic'] . "'");
         $dup_check = xtc_db_fetch_array($dup_check_query);
         if ($dup_check['total'] < 2) {
             @xtc_del_image_file($products_data['del_pic']);
         }
         xtc_db_query("UPDATE " . TABLE_PRODUCTS . "\n                         SET products_image = NULL\n                       WHERE products_id    = '" . xtc_db_input($products_id) . "'");
     }
     if ($products_data['del_mo_pic'] != '') {
         foreach ($products_data['del_mo_pic'] as $dummy => $val) {
             $dup_check_query = xtc_db_query("SELECT COUNT(*) AS total\n                                                      FROM " . TABLE_PRODUCTS_IMAGES . "\n                                                     WHERE image_name = '" . $val . "'");
             $dup_check = xtc_db_fetch_array($dup_check_query);
             if ($dup_check['total'] < 2) {
                 @xtc_del_image_file($val);
             }
             xtc_db_query("DELETE FROM " . TABLE_PRODUCTS_IMAGES . "\n                                     WHERE products_id = '" . xtc_db_input($products_id) . "'\n                                       AND image_name  = '" . $val . "'");
         }
     }
     //MO_PICS
     $accepted_mo_pics_image_files_extensions = array("jpg", "jpeg", "jpe", "gif", "png", "bmp", "tiff", "tif", "bmp");
     $accepted_mo_pics_image_files_mime_types = array("image/jpeg", "image/gif", "image/png", "image/bmp");
     for ($img = 0; $img < MO_PICS; $img++) {
         if ($pIMG = xtc_try_upload('mo_pics_' . $img, DIR_FS_CATALOG_ORIGINAL_IMAGES, '777', $accepted_mo_pics_image_files_extensions, $accepted_mo_pics_image_files_mime_types)) {
             $pname_arr = explode('.', $pIMG->filename);
             $nsuffix = array_pop($pname_arr);
             $products_image_name = $products_id . '_' . ($img + 1) . '.' . $nsuffix;
             $dup_check_query = xtc_db_query("SELECT COUNT(*) AS total\n                                                      FROM " . TABLE_PRODUCTS_IMAGES . "\n                                                     WHERE image_name = '" . $products_data['products_previous_image_' . ($img + 1)] . "'");
             $dup_check = xtc_db_fetch_array($dup_check_query);
             if ($dup_check['total'] < 2) {
                 @xtc_del_image_file($products_data['products_previous_image_' . ($img + 1)]);
             }
             @xtc_del_image_file($products_image_name);
             rename(DIR_FS_CATALOG_ORIGINAL_IMAGES . '/' . $pIMG->filename, DIR_FS_CATALOG_ORIGINAL_IMAGES . '/' . $products_image_name);
             //get data & write to table
             // $mo_img = array ('products_id' => xtc_db_prepare_input($products_id), 'image_nr' => xtc_db_prepare_input($img +1), 'image_name' => xtc_db_prepare_input($products_image_name));
             $mo_img = array('products_id' => xtc_db_prepare_input($products_id), 'image_nr' => xtc_db_prepare_input($img + 1), 'image_name' => xtc_db_prepare_input($products_image_name), 'image_title' => xtc_db_prepare_input($products_data['image_title'][$img + 1]), 'image_alt' => xtc_db_prepare_input($products_data['image_alt'][$img + 1]));
             if ($action == 'insert') {
                 xtc_db_perform(TABLE_PRODUCTS_IMAGES, $mo_img);
             } elseif ($action == 'update' && $products_data['products_previous_image_' . ($img + 1)]) {
                 if ($products_data['del_mo_pic']) {
                     foreach ($products_data['del_mo_pic'] as $dummy => $val) {
                         if ($val == $products_data['products_previous_image_' . ($img + 1)]) {
                             xtc_db_perform(TABLE_PRODUCTS_IMAGES, $mo_img);
                         }
                         break;
                     }
                 }
                 xtc_db_perform(TABLE_PRODUCTS_IMAGES, $mo_img, 'update', 'image_name = \'' . xtc_db_input($products_data['products_previous_image_' . ($img + 1)]) . '\'');
             } elseif (!$products_data['products_previous_image_' . ($img + 1)]) {
                 xtc_db_perform(TABLE_PRODUCTS_IMAGES, $mo_img);
             }
             //image processing
             require DIR_WS_INCLUDES . 'product_thumbnail_images.php';
             require DIR_WS_INCLUDES . 'product_info_images.php';
             require DIR_WS_INCLUDES . 'product_popup_images.php';
             //set file rights
             $this->set_products_images_file_rights($products_image_name);
         }
     }
     if (is_array($products_data['image_title'])) {
         foreach ($products_data['image_title'] as $it_image_nr => $it_image_title) {
             $mo_img = array('image_title' => xtc_db_prepare_input($it_image_title));
             xtc_db_perform(TABLE_PRODUCTS_IMAGES, $mo_img, 'update', 'image_nr = \'' . xtc_db_prepare_input($it_image_nr + 1) . '\' AND products_id = \'' . xtc_db_prepare_input($products_id) . '\'');
         }
     }
     if (is_array($products_data['image_alt'])) {
         foreach ($products_data['image_alt'] as $ia_image_nr => $ia_image_title) {
             $mo_img = array('image_alt' => xtc_db_prepare_input($ia_image_title));
             xtc_db_perform(TABLE_PRODUCTS_IMAGES, $mo_img, 'update', 'image_nr = \'' . xtc_db_prepare_input($ia_image_nr + 1) . '\' AND products_id = \'' . xtc_db_prepare_input($products_id) . '\'');
         }
     }
     if (isset($products_data['products_image']) && xtc_not_null($products_data['products_image']) && $products_data['products_image'] != 'none') {
         $sql_data_array['products_image'] = xtc_db_prepare_input($products_data['products_image']);
     }
     if ($action == 'insert') {
         $insert_sql_data = array('products_date_added' => 'now()');
         $sql_data_array = xtc_array_merge($sql_data_array, $insert_sql_data);
         xtc_db_perform(TABLE_PRODUCTS, $sql_data_array);
         $products_id = xtc_db_insert_id();
         xtc_db_query("INSERT INTO " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                              SET products_id   = '" . $products_id . "',\n                              categories_id = '" . $dest_category_id . "'");
         // web28 - 2012-03-11 - link product to startpage
         /* not longer needed
            if ($products_data['products_startpage'] == 1 ) {
              xtc_db_query("INSERT INTO ".TABLE_PRODUCTS_TO_CATEGORIES."
                                    SET products_id   = '".$products_id."',
                                        categories_id = '0'");
            }
            */
     } elseif ($action == 'update') {
         $update_sql_data = array('products_last_modified' => 'now()');
         $sql_data_array = xtc_array_merge($sql_data_array, $update_sql_data);
         xtc_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', 'products_id = \'' . xtc_db_input($products_id) . '\'');
     }
     //Included specials
     if (file_exists("includes/modules/categories_specials.php")) {
         require_once "includes/modules/categories_specials.php";
         saveSpecialsData($products_id);
     }
     $languages = xtc_get_languages();
     // Here we go, lets write Group prices into db
     // start
     $i = 0;
     $group_query = xtc_db_query("SELECT customers_status_id\n                                         FROM " . TABLE_CUSTOMERS_STATUS . "\n                                        WHERE language_id = '" . (int) $_SESSION['languages_id'] . "'\n                                          AND customers_status_id != '0'");
     while ($group_values = xtc_db_fetch_array($group_query)) {
         // load data into array
         $i++;
         $group_data[$i] = array('STATUS_ID' => $group_values['customers_status_id']);
     }
     for ($col = 0, $n = sizeof($group_data); $col < $n + 1; $col++) {
         if ($group_data[$col]['STATUS_ID'] != '') {
             $personal_price = xtc_db_prepare_input($products_data['products_price_' . $group_data[$col]['STATUS_ID']]);
             if ($personal_price == '' || $personal_price == '0.0000') {
                 $personal_price = '0.00';
             } else {
                 if (PRICE_IS_BRUTTO == 'true') {
                     $personal_price = $personal_price / (xtc_get_tax_rate($products_data['products_tax_class_id']) + 100) * 100;
                 }
                 $personal_price = xtc_round($personal_price, PRICE_PRECISION);
             }
             if ($action == 'insert') {
                 xtc_db_query("DELETE FROM personal_offers_by_customers_status_" . $group_data[$col]['STATUS_ID'] . "\n                              WHERE products_id = '" . $products_id . "'\n                                AND quantity    = '1'");
                 $insert_array = array();
                 $insert_array = array('personal_offer' => $personal_price, 'quantity' => '1', 'products_id' => $products_id);
                 xtc_db_perform("personal_offers_by_customers_status_" . $group_data[$col]['STATUS_ID'], $insert_array);
             } else {
                 xtc_db_query("UPDATE personal_offers_by_customers_status_" . $group_data[$col]['STATUS_ID'] . "\n                                         SET personal_offer = '" . $personal_price . "'\n                                       WHERE products_id = '" . $products_id . "'\n                                         AND quantity    = '1'");
             }
         }
     }
     // end
     // ok, lets check write new staffelpreis into db (if there is one)
     $i = 0;
     $group_query = xtc_db_query("SELECT customers_status_id\n                                         FROM " . TABLE_CUSTOMERS_STATUS . "\n                                        WHERE language_id = '" . (int) $_SESSION['languages_id'] . "'\n                                          AND customers_status_id != '0'");
     while ($group_values = xtc_db_fetch_array($group_query)) {
         // load data into array
         $i++;
         $group_data[$i] = array('STATUS_ID' => $group_values['customers_status_id']);
     }
     for ($col = 0, $n = sizeof($group_data); $col < $n + 1; $col++) {
         if ($group_data[$col]['STATUS_ID'] != '') {
             $quantity = xtc_db_prepare_input($products_data['products_quantity_staffel_' . $group_data[$col]['STATUS_ID']]);
             $staffelpreis = xtc_db_prepare_input($products_data['products_price_staffel_' . $group_data[$col]['STATUS_ID']]);
             if (PRICE_IS_BRUTTO == 'true') {
                 $staffelpreis = $staffelpreis / (xtc_get_tax_rate($products_data['products_tax_class_id']) + 100) * 100;
             }
             $staffelpreis = xtc_round($staffelpreis, PRICE_PRECISION);
             if ($staffelpreis != '' && $quantity != '') {
                 // ok, lets check entered data to get rid of user faults
                 if ($quantity <= 1) {
                     $quantity = 2;
                 }
                 $check_query = xtc_db_query("SELECT quantity\n                                                           FROM personal_offers_by_customers_status_" . $group_data[$col]['STATUS_ID'] . "\n                                                          WHERE products_id = '" . $products_id . "'\n                                                            AND quantity    = '" . $quantity . "'");
                 // dont insert if same qty!
                 if (xtc_db_num_rows($check_query) < 1) {
                     xtc_db_query("INSERT INTO personal_offers_by_customers_status_" . $group_data[$col]['STATUS_ID'] . "\n                                                   SET price_id       = '',\n                                                       products_id    = '" . $products_id . "',\n                                                       quantity       = '" . $quantity . "',\n                                                       personal_offer = '" . $staffelpreis . "'");
                 }
             }
         }
     }
     foreach ($languages as $lang) {
         $language_id = $lang['id'];
         $sql_data_array = array('products_name' => xtc_db_prepare_input($products_data['products_name'][$language_id]), 'products_description' => xtc_db_prepare_input($products_data['products_description_' . $language_id]), 'products_short_description' => xtc_db_prepare_input($products_data['products_short_description_' . $language_id]), 'products_keywords' => xtc_db_prepare_input($products_data['products_keywords'][$language_id]), 'products_url' => xtc_db_prepare_input($products_data['products_url'][$language_id]), 'products_meta_title' => xtc_db_prepare_input($products_data['products_meta_title'][$language_id]), 'products_meta_description' => xtc_db_prepare_input($products_data['products_meta_description'][$language_id]), 'products_meta_keywords' => xtc_db_prepare_input($products_data['products_meta_keywords'][$language_id]));
         if (trim(ADD_PRODUCTS_DESCRIPTION_FIELDS)) {
             $sql_data_array = array_merge($sql_data_array, $this->add_data_fields(ADD_PRODUCTS_DESCRIPTION_FIELDS, $products_data, $language_id));
         }
         if ($action == 'insert') {
             $insert_sql_data = array('products_id' => $products_id, 'language_id' => $language_id);
             $sql_data_array = xtc_array_merge($sql_data_array, $insert_sql_data);
             xtc_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
         } elseif ($action == 'update') {
             //BOF - web28 - 2010-07-11 - BUGFIX no entry stored for previous deactivated languages
             $product_query = xtc_db_query("SELECT * FROM " . TABLE_PRODUCTS_DESCRIPTION . "\n                                               WHERE language_id = '" . $lang['id'] . "'\n                                                 AND products_id = '" . $products_id . "'");
             if (xtc_db_num_rows($product_query) == 0) {
                 xtc_db_perform(TABLE_PRODUCTS_DESCRIPTION, array('products_id' => $products_id, 'language_id' => $lang['id']));
             }
             //EOF - web28 - 2010-07-11 - BUGFIX no entry stored for previous deactivated languages
             xtc_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', 'products_id = \'' . xtc_db_input($products_id) . '\' and language_id = \'' . $language_id . '\'');
         }
     }
     //redirect by update button
     if (isset($products_data['prod_update'])) {
         xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath=' . $_GET['cPath'] . '&action=new_product&pID=' . $products_id . $this->page_parameter));
     }
     xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, xtc_get_path($dest_categories_id) . '&pID=' . $products_id . $this->page_parameter));
     //web28 2012-04-14 new redirect
 }
 /**
  * Add the order status for this payment option to the database
  *
  * @return void
  */
 private function _addOrderStatus()
 {
     $result = $this->_klarnaDB->query("SELECT orders_status_id FROM " . TABLE_ORDERS_STATUS . " ORDER BY orders_status_id DESC LIMIT 1")->getArray();
     $this->_newId = (int) $result['orders_status_id'] + 1;
     $languages = xtc_get_languages();
     for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
         $language_id = $languages[$i]['id'];
         $this->_klarnaDB->query("INSERT INTO " . TABLE_ORDERS_STATUS . " (orders_status_id, orders_status_name,language_id) " . "VALUES ('{$this->_newId}', 'Waiting [{$this->_moduleName}]','" . $language_id . "')");
     }
 }