$manufacturer_result = $dbconn->Execute("SELECT manufacturers_image FROM {$manufacturerstable} WHERE manufacturers_id = '" . oos_db_input($manufacturers_id) . "'");
                $manufacturer = $manufacturer_result->fields;
                $image_location = OOS_ABSOLUTE_PATH . OOS_IMAGES . $manufacturer['manufacturers_image'];
                if (file_exists($image_location)) {
                    @unlink($image_location);
                }
            }
            $manufacturerstable = $oostable['manufacturers'];
            $dbconn->Execute("DELETE FROM {$manufacturerstable} WHERE manufacturers_id = '" . oos_db_input($manufacturers_id) . "'");
            $manufacturers_infotable = $oostable['manufacturers_info'];
            $dbconn->Execute("DELETE FROM {$manufacturers_infotable} WHERE manufacturers_id = '" . oos_db_input($manufacturers_id) . "'");
            if (isset($_POST['delete_products']) && $_POST['delete_products'] == 'on') {
                $productstable = $oostable['products'];
                $products_result = $dbconn->Execute("SELECT products_id FROM {$productstable} WHERE manufacturers_id = '" . oos_db_input($manufacturers_id) . "'");
                while ($products = $products_result->fields) {
                    oos_remove_product($products['products_id']);
                    // Move that ADOdb pointer!
                    $products_result->MoveNext();
                }
                // Close result set
                $products_result->Close();
            } else {
                $productstable = $oostable['products'];
                $dbconn->Execute("UPDATE {$productstable} SET manufacturers_id = '' WHERE manufacturers_id = '" . oos_db_input($manufacturers_id) . "'");
            }
            oos_redirect_admin(oos_href_link_admin($aFilename['manufacturers'], 'page=' . $_GET['page']));
            break;
    }
}
require 'includes/oos_header.php';
?>
Example #2
0
         while (list($key) = each($products_delete)) {
             oos_remove_product($key);
         }
     }
     oos_redirect_admin(oos_href_link_admin($aFilename['categories'], 'categories=' . $categories));
     break;
 case 'delete_product_confirm':
     if ($_POST['products_id'] && $_POST['product_categories'] && is_array($_POST['product_categories'])) {
         $product_categories = $_POST['product_categories'];
         for ($i = 0, $n = count($product_categories); $i < $n; $i++) {
             $dbconn->Execute("DELETE FROM " . $oostable['products_to_categories'] . " WHERE products_id = '" . (int) $products_id . "' and categories_id = '" . (int) $product_categories[$i] . "'");
         }
         $product_categories_result = $dbconn->Execute("SELECT COUNT(*) AS total FROM " . $oostable['products_to_categories'] . " WHERE products_id = '" . (int) $products_id . "'");
         $product_categories = $product_categories_result->fields;
         if ($product_categories['total'] == '0') {
             oos_remove_product($products_id);
         }
     }
     oos_redirect_admin(oos_href_link_admin($aFilename['categories'], 'categories=' . $categories));
     break;
 case 'move_category_confirm':
     if ($_POST['categories_id'] && $_POST['categories_id'] != $_POST['move_to_category_id']) {
         $new_parent_id = $move_to_category_id;
         $dbconn->Execute("UPDATE " . $oostable['categories'] . " SET parent_id = '" . oos_db_input($new_parent_id) . "', last_modified = '" . date("Y-m-d H:i:s", time()) . "' WHERE categories_id = '" . oos_db_input($categories_id) . "'");
     }
     oos_redirect_admin(oos_href_link_admin($aFilename['categories'], 'categories=' . $new_parent_id . '&cID=' . $categories_id));
     break;
 case 'move_product_confirm':
     $products_id = oos_db_prepare_input($_POST['products_id']);
     $new_parent_id = oos_db_prepare_input($_POST['move_to_category_id']);
     $duplicate_check_result = $dbconn->Execute("SELECT COUNT(*) AS total FROM " . $oostable['products_to_categories'] . " WHERE products_id = '" . oos_db_input($products_id) . "' and categories_id = '" . oos_db_input($new_parent_id) . "'");