[TEP-COMMIT] [CVS catalog] use the new database class

hpdl-OfajU3CKLf1/[email protected] 25 Feb 2005 03:04:07 -0000
Newsgroups gmane.comp.web.oscommerce.cvs
Message-ID <[email protected]>
<html>
<head>
<style><!--
  body {background-color:#ffffff;}
  .file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
  .pathname {font-family:monospace; float:right;}
  .fileheader {margin-bottom:.5em;}
  .diff {margin:0;}
  .tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
  .tasklist ul {margin-top:0;margin-bottom:0;}
  tr.alt {background-color:#eeeeee}
  #added {background-color:#ddffdd;}
  #addedchars {background-color:#99ff99;font-weight:bolder;}
  tr.alt #added {background-color:#ccf7cc;}
  #removed {background-color:#ffdddd;}
  #removedchars {background-color:#ff9999;font-weight:bolder;}
  tr.alt #removed {background-color:#f7cccc;}
  #info {color:#888888;}
  #context {background-color:#eeeeee;}
  td {padding-left:.3em;padding-right:.3em;}
  tr.head {border-bottom-width:1px;border-bottom-style:solid;}
  tr.head td {padding:0;padding-top:.2em;}
  .task {background-color:#ffff00;}
  .comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
  .error {color:red;}
  hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>catalog/catalog/includes/classes</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1">session_compatible.php</a></tt></td><td align="right" id="added">+53</td><td align="right" id="removed">-12</td><td nowrap="nowrap" align="center"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/session_compatible.php?rev=1.7&amp;content-type=text/vnd.viewcvs-markup">1.7</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/session_compatible.php.diff?r1=1.7&amp;r2=1.8">-&gt;</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/session_compatible.php?rev=1.8&amp;content-type=text/vnd.viewcvs-markup">1.8</a></td></tr>
<tr class="alt"><td><tt><a href="#file2">shopping_cart.php</a></tt></td><td align="right" id="added">+199</td><td align="right" id="removed">-72</td><td nowrap="nowrap" align="center"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/shopping_cart.php?rev=1.38&amp;content-type=text/vnd.viewcvs-markup">1.38</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/shopping_cart.php.diff?r1=1.38&amp;r2=1.39">-&gt;</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/shopping_cart.php?rev=1.39&amp;content-type=text/vnd.viewcvs-markup">1.39</a></td></tr>
<tr><td><tt><a href="#file3">tax.php</a></tt></td><td align="right" id="added">+28</td><td align="right" id="removed">-10</td><td nowrap="nowrap" align="center"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/tax.php?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/tax.php.diff?r1=1.1&amp;r2=1.2">-&gt;</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/tax.php?rev=1.2&amp;content-type=text/vnd.viewcvs-markup">1.2</a></td></tr>
<tr><td></td><td align="right" id="added">+280</td><td align="right" id="removed">-94</td><td></td></tr>
</table>
<small id="info">3 modified files</small><br />
<pre class="comment">
use the new database class
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes">classes</a><br /></span>
<div class="fileheader"><big><b>session_compatible.php</b></big> <small id="info"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/session_compatible.php?rev=1.7&amp;content-type=text/vnd.viewcvs-markup">1.7</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/session_compatible.php.diff?r1=1.7&amp;r2=1.8">-&gt;</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/session_compatible.php?rev=1.8&amp;content-type=text/vnd.viewcvs-markup">1.8</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.7 -r1.8
--- session_compatible.php	2004/11/24 16:43:02	1.7
+++ session_compatible.php	2005/02/25 03:04:04	1.8
@@ -5,7 +5,7 @@
</small></pre><pre class="diff" id="context">   osCommerce, Open Source E-Commerce Solutions
   http://www.oscommerce.com
 
</pre><pre class="diff" id="removed">-  Copyright (c) 200<span id="removedchars">4</span> osCommerce
</pre><pre class="diff" id="added">+  Copyright (c) 200<span id="addedchars">5</span> osCommerce
</pre><pre class="diff" id="context"> 
   Released under the GNU General Public License
 */
</pre><pre class="diff"><small id="info">@@ -221,39 +221,80 @@
</small></pre><pre class="diff" id="context">     }
 
     function _read($key) {
</pre><pre class="diff" id="removed">-      $value_query = tep_db_query("select value from " . TABLE_SESSIONS . " where sesskey = '" . tep_db_input($key) . "' and expiry &gt; '" . time() . "'");
-      if (tep_db_num_rows($value_query)) {
-        $value = tep_db_fetch_array($value_query);
</pre><pre class="diff" id="added">+      global $osC_Database;
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-        return $value['value'];
</pre><pre class="diff" id="added">+      $Qsession = $osC_Database-&gt;query('select value from :table_sessions where sesskey = :sesskey and expiry &gt; :expiry');
+      $Qsession-&gt;bindTable(':table_sessions', TABLE_SESSIONS);
+      $Qsession-&gt;bindValue(':sesskey', $key);
+      $Qsession-&gt;bindRaw(':expiry', time());
+      $Qsession-&gt;execute();
+
+      if ($Qsession-&gt;numberOfRows() &gt; 0) {
+        $value = $Qsession-&gt;value('value');
+
+        $Qsession-&gt;freeResult();
+
+        return $value;
</pre><pre class="diff" id="context">       }
 
       return false;
     }
 
     function _write($key, $value) {
</pre><pre class="diff" id="added">+      global $osC_Database;
+
</pre><pre class="diff" id="context">       if (!$SESS_LIFE = get_cfg_var('session.gc_maxlifetime')) {
         $SESS_LIFE = 1440;
       }
 
       $expiry = time() + $SESS_LIFE;
 
</pre><pre class="diff" id="removed">-      $check_query = tep_db_query("select count(*) as total from " . TABLE_SESSIONS . " where sesskey = '" . tep_db_input($key) . "'");
-      $check = tep_db_fetch_array($check_query);
</pre><pre class="diff" id="added">+      $Qsession = $osC_Database-&gt;query('select count(*) as total from :table_sessions where sesskey = :sesskey');
+      $Qsession-&gt;bindTable(':table_sessions', TABLE_SESSIONS);
+      $Qsession-&gt;bindValue(':sesskey', $key);
+      $Qsession-&gt;execute();
+
+      if ($Qsession-&gt;valueInt('total') &gt; 0) {
+        $Qsession = $osC_Database-&gt;query('update :table_sessions set expiry = :expiry, value = :value where sesskey = :sesskey');
+      } else {
+        $Qsession = $osC_Database-&gt;query('insert into :table_sessions values (:sesskey, :expiry, :value)');
+      }
+      $Qsession-&gt;bindRaw(':table_sessions', TABLE_SESSIONS);
+      $Qsession-&gt;bindValue(':sesskey', $key);
+      $Qsession-&gt;bindValue(':expiry', $expiry);
+      $Qsession-&gt;bindValue(':value', $value);
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-      if ($check['total'] &gt; 0) {
-        return tep_db_query("update " . TABLE_SESSIONS . " set expiry = '" . tep_db_input($expiry) . "', value = '" . tep_db_input($value) . "' where sesskey = '" . tep_db_input($key) . "'");
</pre><pre class="diff" id="added">+      if ($Qsession-&gt;execute()) {
+        $write = true;
</pre><pre class="diff" id="context">       } else {
</pre><pre class="diff" id="removed">-        return tep_db_query("insert into " . TABLE_SESSIONS . " values ('" . tep_db_input($key) . "', '" . tep_db_input($expiry) . "', '" . tep_db_input($value) . "')");
</pre><pre class="diff" id="added">+        $write = false;
</pre><pre class="diff" id="context">       }
</pre><pre class="diff" id="added">+
+      $Qsession-&gt;freeResult();
+
+      return $write;
</pre><pre class="diff" id="context">     }
 
     function _destroy($key) {
</pre><pre class="diff" id="removed">-      return tep_db_query("delete from " . TABLE_SESSIONS . " where sesskey = '" . tep_db_input($key) . "'");
</pre><pre class="diff" id="added">+      global $osC_Database;
+
+      $Qsession = $osC_Database-&gt;query('delete from :table_sessions where sesskey = :sesskey');
+      $Qsession-&gt;bindTable(':table_sessions', TABLE_SESSIONS);
+      $Qsession-&gt;bindValue(':sesskey', $key);
+      $Qsession-&gt;execute();
+
+      $Qsession-&gt;freeResult();
</pre><pre class="diff" id="context">     }
 
     function _gc($maxlifetime) {
</pre><pre class="diff" id="removed">-      return tep_db_query("delete from " . TABLE_SESSIONS . " where expiry &lt; '" . time() . "'");
</pre><pre class="diff" id="added">+      global $osC_Database;
+
+      $Qsession = $osC_Database-&gt;query('delete from :table_sessions where expiry &lt; :expiry');
+      $Qsession-&gt;bindTable(':table_sessions', TABLE_SESSIONS);
+      $Qsession-&gt;bindValue(':expiry', time());
+      $Qsession-&gt;execute();
+
+      $Qsession-&gt;freeResult();
</pre><pre class="diff" id="context">     }
   }
 ?&gt;
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes">classes</a><br /></span>
<div class="fileheader"><big><b>shopping_cart.php</b></big> <small id="info"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/shopping_cart.php?rev=1.38&amp;content-type=text/vnd.viewcvs-markup">1.38</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/shopping_cart.php.diff?r1=1.38&amp;r2=1.39">-&gt;</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/shopping_cart.php?rev=1.39&amp;content-type=text/vnd.viewcvs-markup">1.39</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.38 -r1.39
--- shopping_cart.php	2004/04/15 16:05:36	1.38
+++ shopping_cart.php	2005/02/25 03:04:04	1.39
@@ -5,7 +5,7 @@
</small></pre><pre class="diff" id="context">   osCommerce, Open Source E-Commerce Solutions
   http://www.oscommerce.com
 
</pre><pre class="diff" id="removed">-  Copyright (c) 200<span id="removedchars">3</span> osCommerce
</pre><pre class="diff" id="added">+  Copyright (c) 200<span id="addedchars">5</span> osCommerce
</pre><pre class="diff" id="context"> 
   Released under the GNU General Public License
 */
</pre><pre class="diff"><small id="info">@@ -18,7 +18,7 @@
</small></pre><pre class="diff" id="context">     }
 
     function restore_contents() {
</pre><pre class="diff" id="removed">-      global $osC_Customer;
</pre><pre class="diff" id="added">+      global $osC_Database, $osC_Customer;
</pre><pre class="diff" id="context"> 
       if ($osC_Customer-&gt;isLoggedOn() == false) return false;
 
</pre><pre class="diff"><small id="info">@@ -27,17 +27,41 @@
</small></pre><pre class="diff" id="context">         reset($this-&gt;contents);
         while (list($products_id, ) = each($this-&gt;contents)) {
           $qty = $this-&gt;contents[$products_id]['qty'];
</pre><pre class="diff" id="removed">-          $product_query = tep_db_query("select products_id from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$osC_Customer-&gt;id . "' and products_id = '" . tep_db_input($products_id) . "'");
-          if (!tep_db_num_rows($product_query)) {
-            tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$osC_Customer-&gt;id . "', '" . tep_db_input($products_id) . "', '" . $qty . "', '" . date('Ymd') . "')");
</pre><pre class="diff" id="added">+
+          $Qproduct = $osC_Database-&gt;query('select products_id from :table_customers_basket where customers_id = :customers_id and products_id = :products_id');
+          $Qproduct-&gt;bindTable(':table_customers_basket', TABLE_CUSTOMERS_BASKET);
+          $Qproduct-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+          $Qproduct-&gt;bindValue(':products_id', $products_id);
+          $Qproduct-&gt;execute();
+
+          if ($Qproduct-&gt;numberOfRows() &lt; 1) {
+            $Qnew = $osC_Database-&gt;query('insert into :table_customers_basket (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values (:customers_id, :products_id, :customers_basket_quantity, :customers_basket_date_added)');
+            $Qnew-&gt;bindTable(':table_customers_basket', TABLE_CUSTOMERS_BASKET);
+            $Qnew-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+            $Qnew-&gt;bindValue(':products_id', $products_id);
+            $Qnew-&gt;bindInt(':customers_basket_quantity', $qty);
+            $Qnew-&gt;bindValue(':customers_basket_date_added', date('Ymd'));
+            $Qnew-&gt;execute();
+
</pre><pre class="diff" id="context">             if (isset($this-&gt;contents[$products_id]['attributes'])) {
               reset($this-&gt;contents[$products_id]['attributes']);
               while (list($option, $value) = each($this-&gt;contents[$products_id]['attributes'])) {
</pre><pre class="diff" id="removed">-                tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$osC_Customer-&gt;id . "', '" . tep_db_input($products_id) . "', '" . (int)$option . "', '" . (int)$value . "')");
</pre><pre class="diff" id="added">+                $Qnew = $osC_Database-&gt;query('insert into :table_customers_basket_attributes (customers_id, products_id, products_options_id, products_options_value_id) values (:customers_id, :products_id, :products_options_id, :products_options_value_id)');
+                $Qnew-&gt;bindTable(':table_customers_basket_attributes', TABLE_CUSTOMERS_BASKET_ATTRIBUTES);
+                $Qnew-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+                $Qnew-&gt;bindValue(':products_id', $products_id);
+                $Qnew-&gt;bindInt(':products_options_id', $option);
+                $Qnew-&gt;bindInt(':products_options_value_id', $value);
+                $Qnew-&gt;execute();
</pre><pre class="diff" id="context">               }
             }
           } else {
</pre><pre class="diff" id="removed">-            tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . $qty . "' where customers_id = '" . (int)$osC_Customer-&gt;id . "' and products_id = '" . tep_db_input($products_id) . "'");
</pre><pre class="diff" id="added">+            $Qupdate = $osC_Database-&gt;query('update :table_customers_basket set customers_basket_quantity = :customers_basket_quantity where customers_id = :customers_id and products_id = :products_id');
+            $Qupdate-&gt;bindTable(':table_customers_basket', TABLE_CUSTOMERS_BASKET);
+            $Qupdate-&gt;bindInt(':customers_basket_quantity', $qty);
+            $Qupdate-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+            $Qupdate-&gt;bindValue(':products_id', $products_id);
+            $Qupdate-&gt;execute();
</pre><pre class="diff" id="context">           }
         }
       }
</pre><pre class="diff"><small id="info">@@ -45,13 +69,22 @@
</small></pre><pre class="diff" id="context"> // reset per-session cart contents, but not the database contents
       $this-&gt;reset(false);
 
</pre><pre class="diff" id="removed">-      $products_query = tep_db_query("select products_id, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$osC_Customer-&gt;id . "'");
-      while ($products = tep_db_fetch_array($products_query)) {
-        $this-&gt;contents[$products['products_id']] = array('qty' =&gt; $products['customers_basket_quantity']);
</pre><pre class="diff" id="added">+      $Qproducts = $osC_Database-&gt;query('select products_id, customers_basket_quantity from :table_customers_basket where customers_id = :customers_id');
+      $Qproducts-&gt;bindTable(':table_customers_basket', TABLE_CUSTOMERS_BASKET);
+      $Qproducts-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+      $Qproducts-&gt;execute();
+
+      while ($Qproducts-&gt;next()) {
+        $this-&gt;contents[$Qproducts-&gt;value('products_id')] = array('qty' =&gt; $Qproducts-&gt;valueInt('customers_basket_quantity'));
</pre><pre class="diff" id="context"> // attributes
</pre><pre class="diff" id="removed">-        $attributes_query = tep_db_query("select products_options_id, products_options_value_id from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$osC_Customer-&gt;id . "' and products_id = '" . tep_db_input($products['products_id']) . "'");
-        while ($attributes = tep_db_fetch_array($attributes_query)) {
-          $this-&gt;contents[$products['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];
</pre><pre class="diff" id="added">+        $Qattributes = $osC_Database-&gt;query('select products_options_id, products_options_value_id from :table_customers_basket_attributes where customers_id = :customers_id and products_id = :products_id');
+        $Qattributes-&gt;bindTable(':table_customers_basket_attributes', TABLE_CUSTOMERS_BASKET_ATTRIBUTES);
+        $Qattributes-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+        $Qattributes-&gt;bindValue(':products_id', $Qproducts-&gt;value('products_id'));
+        $Qattributes-&gt;execute();
+
+        while ($Qattributes-&gt;next()) {
+          $this-&gt;contents[$Qproducts-&gt;value('products_id')]['attributes'][$Qattributes-&gt;valueInt('products_options_id')] = $Qattributes-&gt;valueInt('products_options_value_id');
</pre><pre class="diff" id="context">         }
       }
 
</pre><pre class="diff"><small id="info">@@ -59,7 +92,7 @@
</small></pre><pre class="diff" id="context">     }
 
     function reset($reset_database = false) {
</pre><pre class="diff" id="removed">-      global $osC_Session, $osC_Customer;
</pre><pre class="diff" id="added">+      global $osC_<span id="addedchars">Database,&nbsp;$osC_</span>Session, $osC_Customer;
</pre><pre class="diff" id="context"> 
       $this-&gt;contents = array();
       $this-&gt;total = 0;
</pre><pre class="diff"><small id="info">@@ -67,8 +100,15 @@
</small></pre><pre class="diff" id="context">       $this-&gt;content_type = false;
 
       if (($reset_database == true) &amp;&amp; $osC_Customer-&gt;isLoggedOn()) {
</pre><pre class="diff" id="removed">-        tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$osC_Customer-&gt;id . "'");
-        tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$osC_Customer-&gt;id . "'");
</pre><pre class="diff" id="added">+        $Qdelete = $osC_Database-&gt;query('delete from :table_customers_basket where customers_id = :customers_id');
+        $Qdelete-&gt;bindTable(':table_customers_basket', TABLE_CUSTOMERS_BASKET);
+        $Qdelete-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+        $Qdelete-&gt;execute();
+
+        $Qdelete = $osC_Database-&gt;query('delete from :table_customers_basket_attributes where customers_id = :customers_id');
+        $Qdelete-&gt;bindTable(':table_customers_basket_attributes', TABLE_CUSTOMERS_BASKET_ATTRIBUTES);
+        $Qdelete-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+        $Qdelete-&gt;execute();
</pre><pre class="diff" id="context">       }
 
       unset($this-&gt;cartID);
</pre><pre class="diff"><small id="info">@@ -76,16 +116,18 @@
</small></pre><pre class="diff" id="context">     }
 
     function add_cart($products_id, $qty = '1', $attributes = '', $notify = true) {
</pre><pre class="diff" id="removed">-      global $osC_Session, $osC_Customer;
</pre><pre class="diff" id="added">+      global $osC_<span id="addedchars">Database,&nbsp;$osC_</span>Session, $osC_Customer;
</pre><pre class="diff" id="context"> 
       $products_id_string = tep_get_uprid($products_id, $attributes);
       $products_id = tep_get_prid($products_id_string);
 
       if (is_numeric($products_id) &amp;&amp; is_numeric($qty)) {
</pre><pre class="diff" id="removed">-        $check_product_query = tep_db_query("select products_status from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
-        $check_product = tep_db_fetch_array($check_product_query);
</pre><pre class="diff" id="added">+        $Qcheck = $osC_Database-&gt;query('select products_status from :table_products where products_id = :products_id');
+        $Qcheck-&gt;bindTable(':table_products', TABLE_PRODUCTS);
+        $Qcheck-&gt;bindInt(':products_id', $products_id);
+        $Qcheck-&gt;execute();
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-        if (($check_product !== false) &amp;&amp; ($check_product['products_status'] == '1')) {
</pre><pre class="diff" id="added">+        if (($check_product !== false) &amp;&amp; ($Qcheck-&gt;valueInt('products_status') == '1')) {
</pre><pre class="diff" id="context">           if ($notify == true) {
             $osC_Session-&gt;set('new_products_id_in_cart', $products_id_string);
           }
</pre><pre class="diff"><small id="info">@@ -95,14 +137,30 @@
</small></pre><pre class="diff" id="context">           } else {
             $this-&gt;contents[$products_id_string] = array('qty' =&gt; $qty);
 // insert into database
</pre><pre class="diff" id="removed">-            if ($osC_Customer-&gt;isLoggedOn()) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$osC_Customer-&gt;id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$qty . "', '" . date('Ymd') . "')");
</pre><pre class="diff" id="added">+            if ($osC_Customer-&gt;isLoggedOn()) {
+              $Qnew = $osC_Database-&gt;query('insert into :table_customers_basket (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values (:customers_id, :products_id, :customers_basket_quantity, :customers_basket_date_added)');
+              $Qnew-&gt;bindTable(':table_customers_basket', TABLE_CUSTOMERS_BASKET);
+              $Qnew-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+              $Qnew-&gt;bindValue(':products_id', $products_id_string);
+              $Qnew-&gt;bindInt(':customers_basket_quantity', $qty);
+              $Qnew-&gt;bindValue(':customers_basket_date_added', date('Ymd'));
+              $Qnew-&gt;execute();
+            }
</pre><pre class="diff" id="context"> 
             if (is_array($attributes)) {
               reset($attributes);
               while (list($option, $value) = each($attributes)) {
                 $this-&gt;contents[$products_id_string]['attributes'][$option] = $value;
 // insert into database
</pre><pre class="diff" id="removed">-                if ($osC_Customer-&gt;isLoggedOn()) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$osC_Customer-&gt;id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$option . "', '" . (int)$value . "')");
</pre><pre class="diff" id="added">+                if ($osC_Customer-&gt;isLoggedOn()) {
+                  $Qnew = $osC_Database-&gt;query('insert into :table_customers_basket_attributes (customers_id, products_id, products_options_id, products_options_value_id) values (:customers_id, :products_id, :products_options_id, :products_options_value_id)');
+                  $Qnew-&gt;bindTable(':table_customers_basket_attributes', TABLE_CUSTOMERS_BASKET_ATTRIBUTES);
+                  $Qnew-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+                  $Qnew-&gt;bindValue(':products_id', $products_id_string);
+                  $Qnew-&gt;bindInt(':products_options_id', $option);
+                  $Qnew-&gt;bindInt(':products_options_value_id', $value);
+                  $Qnew-&gt;execute();
+                }
</pre><pre class="diff" id="context">               }
             }
           }
</pre><pre class="diff"><small id="info">@@ -116,7 +174,7 @@
</small></pre><pre class="diff" id="context">     }
 
     function update_quantity($products_id, $quantity = '', $attributes = '') {
</pre><pre class="diff" id="removed">-      global $osC_Customer;
</pre><pre class="diff" id="added">+      global $osC_Database, $osC_Customer;
</pre><pre class="diff" id="context"> 
       $products_id_string = tep_get_uprid($products_id, $attributes);
       $products_id = tep_get_prid($products_id_string);
</pre><pre class="diff"><small id="info">@@ -124,21 +182,36 @@
</small></pre><pre class="diff" id="context">       if (is_numeric($products_id) &amp;&amp; isset($this-&gt;contents[$products_id_string]) &amp;&amp; is_numeric($quantity)) {
         $this-&gt;contents[$products_id_string] = array('qty' =&gt; $quantity);
 // update database
</pre><pre class="diff" id="removed">-        if ($osC_Customer-&gt;isLoggedOn()) tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . (int)$quantity . "' where customers_id = '" . (int)$osC_Customer-&gt;id . "' and products_id = '" . tep_db_input($products_id_string) . "'");
</pre><pre class="diff" id="added">+        if ($osC_Customer-&gt;isLoggedOn()) {
+          $Qupdate = $osC_Database-&gt;query('update :table_customers_basket set customers_basket_quantity = :customers_basket_quantity where customers_id = :customers_id and products_id = :products_id');
+          $Qupdate-&gt;bindTable(':table_customers_basket', TABLE_CUSTOMERS_BASKET);
+          $Qupdate-&gt;bindInt(':customers_basket_quantity', $quantity);
+          $Qupdate-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+          $Qupdate-&gt;bindValue(':products_id', $products_id_string);
+          $Qupdate-&gt;execute();
+        }
</pre><pre class="diff" id="context"> 
         if (is_array($attributes)) {
           reset($attributes);
           while (list($option, $value) = each($attributes)) {
             $this-&gt;contents[$products_id_string]['attributes'][$option] = $value;
 // update database
</pre><pre class="diff" id="removed">-            if ($osC_Customer-&gt;isLoggedOn()) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "' where customers_id = '" . (int)$osC_Customer-&gt;id . "' and products_id = '" . tep_db_input($products_id_string) . "' and products_options_id = '" . (int)$option . "'");
</pre><pre class="diff" id="added">+            if ($osC_Customer-&gt;isLoggedOn()) {
+              $Qupdate = $osC_Database-&gt;query('update :table_customers_basket_attributes set products_options_value_id = :products_options_value_id where customers_id = :customers_id and products_id = :products_id and products_options_id = :products_options_id');
+              $Qupdate-&gt;bindTable(':table_customers_basket_attributes', TABLE_CUSTOMERS_BASKET_ATTRIBUTES);
+              $Qupdate-&gt;bindInt(':products_options_value_id', $value);
+              $Qupdate-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+              $Qupdate-&gt;bindValue(':products_id', $products_id_string);
+              $Qupdate-&gt;bindInt(':products_options_id', $option);
+              $Qupdate-&gt;execute();
+            }
</pre><pre class="diff" id="context">           }
         }
       }
     }
 
     function cleanup() {
</pre><pre class="diff" id="removed">-      global $osC_Customer;
</pre><pre class="diff" id="added">+      global $osC_Database, $osC_Customer;
</pre><pre class="diff" id="context"> 
       reset($this-&gt;contents);
       while (list($key,) = each($this-&gt;contents)) {
</pre><pre class="diff"><small id="info">@@ -146,8 +219,17 @@
</small></pre><pre class="diff" id="context">           unset($this-&gt;contents[$key]);
 // remove from database
           if ($osC_Customer-&gt;isLoggedOn()) {
</pre><pre class="diff" id="removed">-            tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$osC_Customer-&gt;id . "' and products_id = '" . tep_db_input($key) . "'");
-            tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$osC_Customer-&gt;id . "' and products_id = '" . tep_db_input($key) . "'");
</pre><pre class="diff" id="added">+            $Qdelete = $osC_Database-&gt;query('delete from :table_customers_basket where customers_id = :customers_id and products_id = :products_id');
+            $Qdelete-&gt;bindTable(':table_customers_basket', TABLE_CUSTOMERS_BASKET);
+            $Qdelete-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+            $Qdelete-&gt;bindValue(':products_id', $key);
+            $Qdelete-&gt;execute();
+
+            $Qdelete = $osC_Database-&gt;query('delete from :table_customers_basket_attributes where customers_id = :customers_id and products_id = :products_id');
+            $Qdelete-&gt;bindTable(':table_customers_basket_attributes', TABLE_CUSTOMERS_BASKET_ATTRIBUTES);
+            $Qdelete-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+            $Qdelete-&gt;bindValue(':products_id', $key);
+            $Qdelete-&gt;execute();
</pre><pre class="diff" id="context">           }
         }
       }
</pre><pre class="diff"><small id="info">@@ -182,13 +264,22 @@
</small></pre><pre class="diff" id="context">     }
 
     function remove($products_id) {
</pre><pre class="diff" id="removed">-      global $osC_Customer;
</pre><pre class="diff" id="added">+      global $osC_Database, $osC_Customer;
</pre><pre class="diff" id="context"> 
       unset($this-&gt;contents[$products_id]);
 // remove from database
       if ($osC_Customer-&gt;isLoggedOn()) {
</pre><pre class="diff" id="removed">-        tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$osC_Customer-&gt;id . "' and products_id = '" . tep_db_input($products_id) . "'");
-        tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$osC_Customer-&gt;id . "' and products_id = '" . tep_db_input($products_id) . "'");
</pre><pre class="diff" id="added">+        $Qdelete = $osC_Database-&gt;query('delete from :table_customers_basket where customers_id = :customers_id and products_id = :products_id');
+        $Qdelete-&gt;bindTable(':table_customers_basket', TABLE_CUSTOMERS_BASKET);
+        $Qdelete-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+        $Qdelete-&gt;bindValue(':products_id', $products_id);
+        $Qdelete-&gt;execute();
+
+        $Qdelete = $osC_Database-&gt;query('delete from :table_customers_basket_attributes where customers_id = :customers_id and products_id = :products_id');
+        $Qdelete-&gt;bindTable(':table_customers_basket_attributes', TABLE_CUSTOMERS_BASKET_ATTRIBUTES);
+        $Qdelete-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+        $Qdelete-&gt;bindValue(':products_id', $products_id);
+        $Qdelete-&gt;execute();
</pre><pre class="diff" id="context">       }
 
 // assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
</pre><pre class="diff"><small id="info">@@ -212,7 +303,7 @@
</small></pre><pre class="diff" id="context">     }
 
     function calculate() {
</pre><pre class="diff" id="removed">-      global $osC_Tax, $osC_Weight;
</pre><pre class="diff" id="added">+      global $osC_<span id="addedchars">Database,&nbsp;$osC_</span>Tax, $osC_Weight;
</pre><pre class="diff" id="context"> 
       $this-&gt;total = 0;
       $this-&gt;weight = 0;
</pre><pre class="diff"><small id="info">@@ -223,18 +314,26 @@
</small></pre><pre class="diff" id="context">         $qty = $this-&gt;contents[$products_id]['qty'];
 
 // products price
</pre><pre class="diff" id="removed">-        $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight, products_weight_class from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
-        if ($product = tep_db_fetch_array($product_query)) {
-          $prid = $product['products_id'];
-          $products_tax = $osC_Tax-&gt;getTaxRate($product['products_tax_class_id']);
-          $products_price = $product['products_price'];
-
-          $products_weight = $osC_Weight-&gt;convert($product['products_weight'], $product['products_weight_class'], SHIPPING_WEIGHT_UNIT);
-
-          $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
-          if (tep_db_num_rows ($specials_query)) {
-            $specials = tep_db_fetch_array($specials_query);
-            $products_price = $specials['specials_new_products_price'];
</pre><pre class="diff" id="added">+        $Qproduct = $osC_Database-&gt;query('select products_id, products_price, products_tax_class_id, products_weight, products_weight_class from :table_products where products_id = :products_id');
+        $Qproduct-&gt;bindTable(':table_products', TABLE_PRODUCTS);
+        $Qproduct-&gt;bindInt(':products_id', $products_id);
+        $Qproduct-&gt;execute();
+
+        if ($Qproduct-&gt;numberOfRows()) {
+          $prid = $Qproduct-&gt;valueInt('products_id');
+          $products_tax = $osC_Tax-&gt;getTaxRate($Qproduct-&gt;valueInt('products_tax_class_id'));
+          $products_price = $Qproduct-&gt;value('products_price');
+
+          $products_weight = $osC_Weight-&gt;convert($Qproduct-&gt;value('products_weight'), $Qproduct-&gt;valueInt('products_weight_class'), SHIPPING_WEIGHT_UNIT);
+
+          $Qspecials = $osC_Database-&gt;query('select specials_new_products_price from :table_specials where products_id = :products_id and status = :status');
+          $Qspecials-&gt;bindTable(':table_specials', TABLE_SPECIALS);
+          $Qspecials-&gt;bindInt(':products_id', $prid);
+          $Qspecials-&gt;bindInt(':status', 1);
+          $Qspecials-&gt;execute();
+
+          if ($Qspecials-&gt;numberOfRows()) {
+            $products_price = $Qspecials-&gt;value('specials_new_products_price');
</pre><pre class="diff" id="context">           }
 
           $this-&gt;total += tep_add_tax($products_price, $products_tax) * $qty;
</pre><pre class="diff"><small id="info">@@ -245,12 +344,17 @@
</small></pre><pre class="diff" id="context">         if (isset($this-&gt;contents[$products_id]['attributes'])) {
           reset($this-&gt;contents[$products_id]['attributes']);
           while (list($option, $value) = each($this-&gt;contents[$products_id]['attributes'])) {
</pre><pre class="diff" id="removed">-            $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$prid . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
-            $attribute_price = tep_db_fetch_array($attribute_price_query);
-            if ($attribute_price['price_prefix'] == '+') {
-              $this-&gt;total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
</pre><pre class="diff" id="added">+            $Qattributes = $osC_Database-&gt;query('select options_values_price, price_prefix from :table_products_attributes where products_id = :products_id and options_id = :options_id and options_values_id = :options_values_id');
+            $Qattributes-&gt;bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
+            $Qattributes-&gt;bindInt(':products_id', $prid);
+            $Qattributes-&gt;bindInt(':options_id', $option);
+            $Qattributes-&gt;bindInt(':options_values_id', $value);
+            $Qattributes-&gt;execute();
+
+            if ($Qattributes-&gt;value('price_prefix') == '+') {
+              $this-&gt;total += $qty * tep_add_tax($Qattributes-&gt;value('options_values_price'), $products_tax);
</pre><pre class="diff" id="context">             } else {
</pre><pre class="diff" id="removed">-              $this-&gt;total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
</pre><pre class="diff" id="added">+              $this-&gt;total -= $qty * tep_add_tax($Qattributes-&gt;value('options_values_price'), $products_tax);
</pre><pre class="diff" id="context">             }
           }
         }
</pre><pre class="diff"><small id="info">@@ -258,17 +362,24 @@
</small></pre><pre class="diff" id="context">     }
 
     function attributes_price($products_id) {
</pre><pre class="diff" id="added">+      global $osC_Database;
+
</pre><pre class="diff" id="context">       $attributes_price = 0;
 
       if (isset($this-&gt;contents[$products_id]['attributes'])) {
         reset($this-&gt;contents[$products_id]['attributes']);
         while (list($option, $value) = each($this-&gt;contents[$products_id]['attributes'])) {
</pre><pre class="diff" id="removed">-          $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
-          $attribute_price = tep_db_fetch_array($attribute_price_query);
-          if ($attribute_price['price_prefix'] == '+') {
-            $attributes_price += $attribute_price['options_values_price'];
</pre><pre class="diff" id="added">+          $Qattributes = $osC_Database-&gt;query('select options_values_price, price_prefix from :table_products_attributes where products_id = :products_id and options_id = :options_id and options_values_id = :options_values_id');
+          $Qattributes-&gt;bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
+          $Qattributes-&gt;bindInt(':products_id', $products_id);
+          $Qattributes-&gt;bindInt(':options_id', $option);
+          $Qattributes-&gt;bindInt(':options_values_id', $value);
+          $Qattributes-&gt;execute();
+
+          if ($Qattributes-&gt;value('price_prefix') == '+') {
+            $attributes_price += $Qattributes-&gt;value('options_values_price');
</pre><pre class="diff" id="context">           } else {
</pre><pre class="diff" id="removed">-            $attributes_price -= $attribute_price['options_values_price'];
</pre><pre class="diff" id="added">+            $attributes_price -= $Qattributes-&gt;value('options_values_price');
</pre><pre class="diff" id="context">           }
         }
       }
</pre><pre class="diff"><small id="info">@@ -277,33 +388,43 @@
</small></pre><pre class="diff" id="context">     }
 
     function get_products() {
</pre><pre class="diff" id="removed">-      global $osC_Session;
</pre><pre class="diff" id="added">+      global $osC_Database, $osC_Session;
</pre><pre class="diff" id="context"> 
       if (!is_array($this-&gt;contents)) return false;
 
       $products_array = array();
       reset($this-&gt;contents);
       while (list($products_id, ) = each($this-&gt;contents)) {
</pre><pre class="diff" id="removed">-        $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$osC_Session-&gt;value('languages_id') . "'");
-        if ($products = tep_db_fetch_array($products_query)) {
-          $prid = $products['products_id'];
-          $products_price = $products['products_price'];
-
-          $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
-          if (tep_db_num_rows($specials_query)) {
-            $specials = tep_db_fetch_array($specials_query);
-            $products_price = $specials['specials_new_products_price'];
</pre><pre class="diff" id="added">+        $Qproducts = $osC_Database-&gt;query('select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from :table_products p, :table_products_description pd where p.products_id = :products_id and pd.products_id = p.products_id and pd.language_id = :language_id');
+        $Qproducts-&gt;bindTable(':table_products', TABLE_PRODUCTS);
+        $Qproducts-&gt;bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
+        $Qproducts-&gt;bindInt(':products_id', $products_id);
+        $Qproducts-&gt;bindInt(':language_id', $osC_Session-&gt;value('languages_id'));
+        $Qproducts-&gt;execute();
+
+        if ($Qproducts-&gt;numberOfRows()) {
+          $prid = $Qproducts-&gt;valueInt('products_id');
+          $products_price = $Qproducts-&gt;value('products_price');
+
+          $Qspecials = $osC_Database-&gt;query('select specials_new_products_price from :table_specials where products_id = :products_id and status = :status');
+          $Qspecials-&gt;bindTable(':table_specials', TABLE_SPECIALS);
+          $Qspecials-&gt;bindInt(':products_id', $prid);
+          $Qspecials-&gt;bindInt(':status', 1);
+          $Qspecials-&gt;execute();
+
+          if ($Qspecials-&gt;numberOfRows()) {
+            $products_price = $Qspecials-&gt;value('specials_new_products_price');
</pre><pre class="diff" id="context">           }
 
           $products_array[] = array('id' =&gt; $products_id,
</pre><pre class="diff" id="removed">-                                    'name' =&gt; $products['products_name'],
-                                    'model' =&gt; $products['products_model'],
-                                    'image' =&gt; $products['products_image'],
</pre><pre class="diff" id="added">+                                    'name' =&gt; $Qproducts-&gt;value('products_name'),
+                                    'model' =&gt; $Qproducts-&gt;value('products_model'),
+                                    'image' =&gt; $Qproducts-&gt;value('products_image'),
</pre><pre class="diff" id="context">                                     'price' =&gt; $products_price,
                                     'quantity' =&gt; $this-&gt;contents[$products_id]['qty'],
</pre><pre class="diff" id="removed">-                                    'weight' =&gt; $products['products_weight'],
</pre><pre class="diff" id="added">+                                    'weight' =&gt; $Qproducts-&gt;value('products_weight'),
</pre><pre class="diff" id="context">                                     'final_price' =&gt; ($products_price + $this-&gt;attributes_price($products_id)),
</pre><pre class="diff" id="removed">-                                    'tax_class_id' =&gt; $products['products_tax_class_id'],
</pre><pre class="diff" id="added">+                                    'tax_class_id' =&gt; $Qproducts-&gt;valueInt('products_tax_class_id'),
</pre><pre class="diff" id="context">                                     'attributes' =&gt; (isset($this-&gt;contents[$products_id]['attributes']) ? $this-&gt;contents[$products_id]['attributes'] : ''));
         }
       }
</pre><pre class="diff"><small id="info">@@ -328,6 +449,8 @@
</small></pre><pre class="diff" id="context">     }
 
     function get_content_type() {
</pre><pre class="diff" id="added">+      global $osC_Database;
+
</pre><pre class="diff" id="context">       $this-&gt;content_type = false;
 
       if ( (DOWNLOAD_ENABLED == 'true') &amp;&amp; ($this-&gt;count_contents() &gt; 0) ) {
</pre><pre class="diff"><small id="info">@@ -336,10 +459,14 @@
</small></pre><pre class="diff" id="context">           if (isset($this-&gt;contents[$products_id]['attributes'])) {
             reset($this-&gt;contents[$products_id]['attributes']);
             while (list(, $value) = each($this-&gt;contents[$products_id]['attributes'])) {
</pre><pre class="diff" id="removed">-              $virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad where pa.products_id = '" . (int)$products_id . "' and pa.options_values_id = '" . (int)$value . "' and pa.products_attributes_id = pad.products_attributes_id");
-              $virtual_check = tep_db_fetch_array($virtual_check_query);
</pre><pre class="diff" id="added">+              $Qcheck = $osC_Database-&gt;query('select count(*) as total from :table_products_attributes pa, :table_products_attributes_download pad where pa.products_id = :products_id and pa.options_values_id = :options_values_id and pa.products_attributes_id = pad.products_attributes_id');
+              $Qcheck-&gt;bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
+              $Qcheck-&gt;bindTable(':table_products_attributes_download', TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD);
+              $Qcheck-&gt;bindInt(':products_id', $products_id);
+              $Qcheck-&gt;bindInt(':options_values_id', $value);
+              $Qcheck-&gt;execute();
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-              if ($virtual_check['total'] &gt; 0) {
</pre><pre class="diff" id="added">+              if ($Qcheck-&gt;valueInt('total') &gt; 0) {
</pre><pre class="diff" id="context">                 switch ($this-&gt;content_type) {
                   case 'physical':
                     $this-&gt;content_type = 'mixed';
</pre></div>
<hr /><a name="file3" /><div class="file">
<span class="pathname"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes">classes</a><br /></span>
<div class="fileheader"><big><b>tax.php</b></big> <small id="info"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/tax.php?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/tax.php.diff?r1=1.1&amp;r2=1.2">-&gt;</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/tax.php?rev=1.2&amp;content-type=text/vnd.viewcvs-markup">1.2</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.1 -r1.2
--- tax.php	2003/11/17 16:56:11	1.1
+++ tax.php	2005/02/25 03:04:04	1.2
@@ -5,7 +5,7 @@
</small></pre><pre class="diff" id="context">   osCommerce, Open Source E-Commerce Solutions
   http://www.oscommerce.com
 
</pre><pre class="diff" id="removed">-  Copyright (c) 200<span id="removedchars">3</span> osCommerce
</pre><pre class="diff" id="added">+  Copyright (c) 200<span id="addedchars">5</span> osCommerce
</pre><pre class="diff" id="context"> 
   Released under the GNU General Public License
 */
</pre><pre class="diff"><small id="info">@@ -20,7 +20,7 @@
</small></pre><pre class="diff" id="context"> 
 // class methods
     function getTaxRate($class_id, $country_id = -1, $zone_id = -1) {
</pre><pre class="diff" id="removed">-      global $osC_Customer;
</pre><pre class="diff" id="added">+      global $osC_Database, $osC_Customer;
</pre><pre class="diff" id="context"> 
       if ( ($country_id == -1) &amp;&amp; ($zone_id == -1) ) {
         if ($osC_Customer-&gt;isLoggedOn()) {
</pre><pre class="diff"><small id="info">@@ -33,11 +33,19 @@
</small></pre><pre class="diff" id="context">       }
 
       if (isset($this-&gt;tax_rates[$class_id][$country_id][$zone_id]['rate']) == false) {
</pre><pre class="diff" id="removed">-        $tax_query = tep_db_query("select sum(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' group by tr.tax_priority");
-        if (tep_db_num_rows($tax_query)) {
</pre><pre class="diff" id="added">+        $Qtax = $osC_Database-&gt;query('select sum(tax_rate) as tax_rate from :table_tax_rates tr left join :table_zones_to_geo_zones za on (tr.tax_zone_id = za.geo_zone_id) left join :table_geo_zones tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = 0 or za.zone_country_id = :zone_country_id) and (za.zone_id is null or za.zone_id = 0 or za.zone_id = :zone_id) and tr.tax_class_id = :tax_class_id group by tr.tax_priority');
+        $Qtax-&gt;bindTable(':table_tax_rates', TABLE_TAX_RATES);
+        $Qtax-&gt;bindTable(':table_zones_to_geo_zones', TABLE_ZONES_TO_GEO_ZONES);
+        $Qtax-&gt;bindTable(':table_geo_zones', TABLE_GEO_ZONES);
+        $Qtax-&gt;bindInt(':zone_country_id', $country_id);
+        $Qtax-&gt;bindInt(':zone_id', $zone_id);
+        $Qtax-&gt;bindInt(':tax_class_id', $class_id);
+        $Qtax-&gt;execute();
+
+        if ($Qtax-&gt;numberOfRows()) {
</pre><pre class="diff" id="context">           $tax_multiplier = 1.0;
</pre><pre class="diff" id="removed">-          while ($tax = tep_db_fetch_array($tax_query)) {
-            $tax_multiplier *= 1.0 + ($tax['tax_rate'] / 100);
</pre><pre class="diff" id="added">+          while ($Qtax-&gt;next()) {
+            $tax_multiplier *= 1.0 + ($Qtax-&gt;value('tax_rate') / 100);
</pre><pre class="diff" id="context">           }
 
           $tax_rate = ($tax_multiplier - 1.0) * 100;
</pre><pre class="diff"><small id="info">@@ -52,13 +60,23 @@
</small></pre><pre class="diff" id="context">     }
 
     function getTaxRateDescription($class_id, $country_id, $zone_id) {
</pre><pre class="diff" id="added">+      global $osC_Database;
+
</pre><pre class="diff" id="context">       if (isset($this-&gt;tax_rates[$class_id][$country_id][$zone_id]['description']) == false) {
</pre><pre class="diff" id="removed">-        $tax_query = tep_db_query("select tax_description from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' order by tr.tax_priority");
-        if (tep_db_num_rows($tax_query)) {
</pre><pre class="diff" id="added">+        $Qtax = $osC_Database-&gt;query('select tax_description from :table_tax_rates tr left join :table_zones_to_geo_zones za on (tr.tax_zone_id = za.geo_zone_id) left join :table_geo_zones tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = 0 or za.zone_country_id = :zone_country_id) and (za.zone_id is null or za.zone_id = 0 or za.zone_id = :zone_id) and tr.tax_class_id = :tax_class_id group by tr.tax_priority');
+        $Qtax-&gt;bindTable(':table_tax_rates', TABLE_TAX_RATES);
+        $Qtax-&gt;bindTable(':table_zones_to_geo_zones', TABLE_ZONES_TO_GEO_ZONES);
+        $Qtax-&gt;bindTable(':table_geo_zones', TABLE_GEO_ZONES);
+        $Qtax-&gt;bindInt(':zone_country_id', $country_id);
+        $Qtax-&gt;bindInt(':zone_id', $zone_id);
+        $Qtax-&gt;bindInt(':tax_class_id', $class_id);
+        $Qtax-&gt;execute();
+
+        if ($Qtax-&gt;numberOfRows()) {
</pre><pre class="diff" id="context">           $tax_description = '';
 
</pre><pre class="diff" id="removed">-          while ($tax = tep_db_fetch_array($tax_query)) {
-            $tax_description .= $tax['tax_description'] . ' + ';
</pre><pre class="diff" id="added">+          while ($Qtax-&gt;next()) {
+            $tax_description .= $Qtax-&gt;value('tax_description') . ' + ';
</pre><pre class="diff" id="context">           }
 
           $this-&gt;tax_rates[$class_id][$country_id][$zone_id]['description'] = substr($tax_description, 0, -3);
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -&gt; email">CVSspam</a> 0.2.9</small></center>
</body></html>


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click