Example #1
0
             if (isset($_POST['delete_image']) && $_POST['delete_image'] == 'on') {
                 $manufacturer_query = xos_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int) $manufacturers_id . "'");
                 $manufacturer = xos_db_fetch_array($manufacturer_query);
                 $duplicate_image_query = xos_db_query("select count(*) as total from " . TABLE_MANUFACTURERS . " where manufacturers_image = '" . xos_db_input($manufacturer['manufacturers_image']) . "'");
                 $duplicate_image = xos_db_fetch_array($duplicate_image_query);
                 if ($duplicate_image['total'] < 2) {
                     $image_location = DIR_FS_CATALOG_IMAGES . 'manufacturers/' . $manufacturer['manufacturers_image'];
                     @unlink($image_location);
                 }
             }
             xos_db_query("delete from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int) $manufacturers_id . "'");
             xos_db_query("delete from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int) $manufacturers_id . "'");
             if (isset($_POST['delete_products']) && $_POST['delete_products'] == 'on') {
                 $products_query = xos_db_query("select products_id from " . TABLE_PRODUCTS . " where manufacturers_id = '" . (int) $manufacturers_id . "'");
                 while ($products = xos_db_fetch_array($products_query)) {
                     xos_remove_product($products['products_id']);
                 }
             } else {
                 xos_db_query("update " . TABLE_PRODUCTS . " set products_last_modified = now(), manufacturers_id = '' where manufacturers_id = '" . (int) $manufacturers_id . "'");
             }
             $smarty_cache_control->clearAllCache();
             xos_redirect(xos_href_link(FILENAME_MANUFACTURERS, 'page=' . $_GET['page']));
             break;
     }
 }
 $javascript = '<script type="text/javascript" src="' . DIR_WS_ADMIN . 'includes/general.js"></script>' . "\n";
 require DIR_WS_INCLUDES . 'html_header.php';
 require DIR_WS_INCLUDES . 'header.php';
 require DIR_WS_INCLUDES . 'column_left.php';
 require DIR_WS_INCLUDES . 'footer.php';
 $manufacturers_query_raw = "select m.manufacturers_id, m.manufacturers_image, m.date_added, m.last_modified, mi.manufacturers_name from " . TABLE_MANUFACTURERS . " m, " . TABLE_MANUFACTURERS_INFO . " mi where m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int) $_SESSION['used_lng_id'] . "' order by mi.manufacturers_name";
Example #2
0
         }
         $smarty_cache_control->clearAllCache();
     }
     xos_redirect(xos_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
     break;
 case 'delete_product_confirm':
     if (isset($_POST['products_id']) && isset($_POST['product_categories']) && is_array($_POST['product_categories'])) {
         $product_id = xos_db_prepare_input($_POST['products_id']);
         $product_categories = $_POST['product_categories'];
         for ($i = 0, $n = sizeof($product_categories); $i < $n; $i++) {
             xos_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int) $product_id . "' and categories_or_pages_id = '" . (int) $product_categories[$i] . "'");
         }
         $product_categories_query = xos_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int) $product_id . "'");
         $product_categories = xos_db_fetch_array($product_categories_query);
         if ($product_categories['total'] == '0') {
             xos_remove_product($product_id);
         }
         $smarty_cache_control->clearAllCache();
     }
     xos_redirect(xos_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
     break;
 case 'move_category_confirm':
     if (isset($_POST['categories_or_pages_id']) && $_POST['categories_or_pages_id'] != $_POST['move_to_category_id']) {
         $categories_or_pages_id = xos_db_prepare_input($_POST['categories_or_pages_id']);
         $new_parent_id = xos_db_prepare_input($_POST['move_to_category_id']);
         $path = explode('_', xos_get_generated_category_path_ids($new_parent_id));
         if (in_array($categories_or_pages_id, $path)) {
             $messageStack->add_session('header', ERROR_CANNOT_MOVE_CATEGORY_TO_PARENT, 'error');
             xos_redirect(xos_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cpID=' . $categories_or_pages_id));
         } elseif (xos_children_in_category_count($new_parent_id) == 0 && xos_products_in_category_count($new_parent_id) > 0) {
             $messageStack->add_session('header', ERROR_CANNOT_MOVE_CATEGORY_TO_CATEGORY_CONTAINING_PRODUCTS, 'error');