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

hpdl-OfajU3CKLf1/[email protected] 23 Feb 2005 16:30:50 -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/boxes</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1">manufacturer_info.php</a></tt></td><td align="right" id="added">+13</td><td align="right" id="removed">-7</td><td nowrap="nowrap" align="center"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/boxes/manufacturer_info.php?rev=1.12&amp;content-type=text/vnd.viewcvs-markup">1.12</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/boxes/manufacturer_info.php.diff?r1=1.12&amp;r2=1.13">-&gt;</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/boxes/manufacturer_info.php?rev=1.13&amp;content-type=text/vnd.viewcvs-markup">1.13</a></td></tr>
<tr class="alt"><td><tt><a href="#file2">order_history.php</a></tt></td><td align="right" id="added">+23</td><td align="right" id="removed">-9</td><td nowrap="nowrap" align="center"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/boxes/order_history.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/boxes/order_history.php.diff?r1=1.7&amp;r2=1.8">-&gt;</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/boxes/order_history.php?rev=1.8&amp;content-type=text/vnd.viewcvs-markup">1.8</a></td></tr>
<tr><td><tt><a href="#file3">product_notifications.php</a></tt></td><td align="right" id="added">+7</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/boxes/product_notifications.php?rev=1.10&amp;content-type=text/vnd.viewcvs-markup">1.10</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/boxes/product_notifications.php.diff?r1=1.10&amp;r2=1.11">-&gt;</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/boxes/product_notifications.php?rev=1.11&amp;content-type=text/vnd.viewcvs-markup">1.11</a></td></tr>
<tr><td></td><td align="right" id="added">+43</td><td align="right" id="removed">-20</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/boxes">boxes</a><br /></span>
<div class="fileheader"><big><b>manufacturer_info.php</b></big> <small id="info"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/boxes/manufacturer_info.php?rev=1.12&amp;content-type=text/vnd.viewcvs-markup">1.12</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/boxes/manufacturer_info.php.diff?r1=1.12&amp;r2=1.13">-&gt;</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/boxes/manufacturer_info.php?rev=1.13&amp;content-type=text/vnd.viewcvs-markup">1.13</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.12 -r1.13
--- manufacturer_info.php	2003/11/17 20:01:23	1.12
+++ manufacturer_info.php	2005/02/23 16:30:48	1.13
@@ -5,15 +5,21 @@
</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
 */
 
   if (isset($_GET['products_id'])) {
</pre><pre class="diff" id="removed">-    $manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int)$osC_Session-&gt;value('languages_id') . "'), " . TABLE_PRODUCTS . " p  where p.products_id = '" . (int)$_GET['products_id'] . "' and p.manufacturers_id = m.manufacturers_id");
-    if (tep_db_num_rows($manufacturer_query)) {
-      $manufacturer = tep_db_fetch_array($manufacturer_query);
</pre><pre class="diff" id="added">+    $Qmanufacturer = $osC_Database-&gt;query('select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from :table_manufacturers m left join :table_manufacturers_info mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = :languages_id), :table_products p  where p.products_id = :products_id and p.manufacturers_id = m.manufacturers_id');
+    $Qmanufacturer-&gt;bindTable(':table_manufacturers', TABLE_MANUFACTURERS);
+    $Qmanufacturer-&gt;bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
+    $Qmanufacturer-&gt;bindTable(':table_products', TABLE_PRODUCTS);
+    $Qmanufacturer-&gt;bindInt(':languages_id', $osC_Session-&gt;value('languages_id'));
+    $Qmanufacturer-&gt;bindInt(':products_id', $_GET['products_id']);
+    $Qmanufacturer-&gt;execute();
+
+    if ($Qmanufacturer-&gt;numberOfRows()) {
</pre><pre class="diff" id="context"> ?&gt;
 &lt;!-- manufacturer_info //--&gt;
           &lt;tr&gt;
</pre><pre class="diff"><small id="info">@@ -25,9 +31,9 @@
</small></pre><pre class="diff" id="context">       new infoBoxHeading($info_box_contents, false, false);
 
       $manufacturer_info_string = '&lt;table border="0" width="100%" cellspacing="0" cellpadding="0"&gt;';
</pre><pre class="diff" id="removed">-      if (tep_not_null($manufacturer['manufacturers_image'])) $manufacturer_info_string .= '&lt;tr&gt;&lt;td align="center" class="infoBoxContents" colspan="2"&gt;' . tep_image(DIR_WS_IMAGES . $manufacturer['manufacturers_image'], $manufacturer['manufacturers_name']) . '&lt;/td&gt;&lt;/tr&gt;';
-      if (tep_not_null($manufacturer['manufacturers_url'])) $manufacturer_info_string .= '&lt;tr&gt;&lt;td valign="top" class="infoBoxContents"&gt;-&amp;nbsp;&lt;/td&gt;&lt;td valign="top" class="infoBoxContents"&gt;&lt;a href="' . tep_href_link(FILENAME_REDIRECT, 'action=manufacturer&amp;manufacturers_id=' . $manufacturer['manufacturers_id']) . '" target="_blank"&gt;' . sprintf(BOX_MANUFACTURER_INFO_HOMEPAGE, $manufacturer['manufacturers_name']) . '&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;';
-      $manufacturer_info_string .= '&lt;tr&gt;&lt;td valign="top" class="infoBoxContents"&gt;-&amp;nbsp;&lt;/td&gt;&lt;td valign="top" class="infoBoxContents"&gt;&lt;a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturer['manufacturers_id']) . '"&gt;' . BOX_MANUFACTURER_INFO_OTHER_PRODUCTS . '&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;' .
</pre><pre class="diff" id="added">+      if (tep_not_null($Qmanufacturer-&gt;value('manufacturers_image'))) $manufacturer_info_string .= '&lt;tr&gt;&lt;td align="center" class="infoBoxContents" colspan="2"&gt;' . tep_image(DIR_WS_IMAGES . $Qmanufacturer-&gt;value('manufacturers_image'), $Qmanufacturer-&gt;value('manufacturers_name')) . '&lt;/td&gt;&lt;/tr&gt;';
+      if (tep_not_null($Qmanufacturer-&gt;value('manufacturers_url'))) $manufacturer_info_string .= '&lt;tr&gt;&lt;td valign="top" class="infoBoxContents"&gt;-&amp;nbsp;&lt;/td&gt;&lt;td valign="top" class="infoBoxContents"&gt;&lt;a href="' . tep_href_link(FILENAME_REDIRECT, 'action=manufacturer&amp;manufacturers_id=' . $Qmanufacturer-&gt;valueInt('manufacturers_id')) . '" target="_blank"&gt;' . sprintf(BOX_MANUFACTURER_INFO_HOMEPAGE, $Qmanufacturer-&gt;value('manufacturers_name')) . '&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;';
+      $manufacturer_info_string .= '&lt;tr&gt;&lt;td valign="top" class="infoBoxContents"&gt;-&amp;nbsp;&lt;/td&gt;&lt;td valign="top" class="infoBoxContents"&gt;&lt;a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $Qmanufacturer-&gt;valueInt('manufacturers_id')) . '"&gt;' . BOX_MANUFACTURER_INFO_OTHER_PRODUCTS . '&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;' .
</pre><pre class="diff" id="context">                                    '&lt;/table&gt;';
 
       $info_box_contents = array();
</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/boxes">boxes</a><br /></span>
<div class="fileheader"><big><b>order_history.php</b></big> <small id="info"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/boxes/order_history.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/boxes/order_history.php.diff?r1=1.7&amp;r2=1.8">-&gt;</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/boxes/order_history.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
--- order_history.php	2004/04/13 07:53:42	1.7
+++ order_history.php	2005/02/23 16:30:48	1.8
@@ -5,15 +5,23 @@
</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
 */
 
   if ($osC_Customer-&gt;isLoggedOn()) {
 // retreive the last x products purchased
</pre><pre class="diff" id="removed">-    $orders_query = tep_db_query("select distinct op.products_id from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_PRODUCTS . " p where o.customers_id = '" . (int)$osC_Customer-&gt;id . "' and o.orders_id = op.orders_id and op.products_id = p.products_id and p.products_status = '1' group by products_id order by o.date_purchased desc limit " . MAX_DISPLAY_PRODUCTS_IN_ORDER_HISTORY_BOX);
-    if (tep_db_num_rows($orders_query)) {
</pre><pre class="diff" id="added">+    $Qorders = $osC_Database-&gt;query('select distinct op.products_id from :table_orders o, :table_orders_products op, :table_products p where o.customers_id = :customers_id and o.orders_id = op.orders_id and op.products_id = p.products_id and p.products_status = :products_status group by products_id order by o.date_purchased desc limit :limit');
+    $Qorders-&gt;bindTable(':table_orders', TABLE_ORDERS);
+    $Qorders-&gt;bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
+    $Qorders-&gt;bindTable(':table_products', TABLE_PRODUCTS);
+    $Qorders-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+    $Qorders-&gt;bindInt(':products_status', 1);
+    $Qorders-&gt;bindInt(':limit', MAX_DISPLAY_PRODUCTS_IN_ORDER_HISTORY_BOX);
+    $Qorders-&gt;execute();
+
+    if ($Qorders-&gt;numberOfRows()) {
</pre><pre class="diff" id="context"> ?&gt;
 &lt;!-- customer_orders //--&gt;
           &lt;tr&gt;
</pre><pre class="diff"><small id="info">@@ -25,17 +33,23 @@
</small></pre><pre class="diff" id="context">       new infoBoxHeading($info_box_contents, false, false);
 
       $product_ids = '';
</pre><pre class="diff" id="removed">-      while ($orders = tep_db_fetch_array($orders_query)) {
-        $product_ids .= (int)$orders['products_id'] . ',';
</pre><pre class="diff" id="added">+      while ($Qorders-&gt;next()) {
+        $product_ids .= $Qorders-&gt;valueInt('products_id') . ',';
</pre><pre class="diff" id="context">       }
       $product_ids = substr($product_ids, 0, -1);
 
       $customer_orders_string = '&lt;table border="0" width="100%" cellspacing="0" cellpadding="1"&gt;';
</pre><pre class="diff" id="removed">-      $products_query = tep_db_query("select products_id, products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id in (" . $product_ids . ") and language_id = '" . (int)$osC_Session-&gt;value('languages_id') . "' order by products_name");
-      while ($products = tep_db_fetch_array($products_query)) {
</pre><pre class="diff" id="added">+
+      $Qproducts = $osC_Database-&gt;query('select products_id, products_name from :table_products_description where products_id in (:products_id) and language_id = :language_id order by products_name');
+      $Qproducts-&gt;bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
+      $Qproducts-&gt;bindRaw(':products_id', $product_ids);
+      $Qproducts-&gt;bindInt(':language_id', $osC_Session-&gt;value('languages_id'));
+      $Qproducts-&gt;execute();
+
+      while ($Qproducts-&gt;next()) {
</pre><pre class="diff" id="context">         $customer_orders_string .= '  &lt;tr&gt;' .
</pre><pre class="diff" id="removed">-                                   '    &lt;td class="infoBoxContents"&gt;&lt;a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '"&gt;' . $products['products_name'] . '&lt;/a&gt;&lt;/td&gt;' .
-                                   '    &lt;td class="infoBoxContents" align="right" valign="top"&gt;&lt;a href="' . tep_href_link(basename($_SERVER['PHP_SELF']), tep_get_all_get_params(array('action')) . 'action=cust_order&amp;pid=' . $products['products_id']) . '"&gt;' . tep_image(DIR_WS_ICONS . 'cart.gif', ICON_CART) . '&lt;/a&gt;&lt;/td&gt;' .
</pre><pre class="diff" id="added">+                                   '    &lt;td class="infoBoxContents"&gt;&lt;a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $Qproducts-&gt;valueInt('products_id')) . '"&gt;' . $Qproducts-&gt;value('products_name') . '&lt;/a&gt;&lt;/td&gt;' .
+                                   '    &lt;td class="infoBoxContents" align="right" valign="top"&gt;&lt;a href="' . tep_href_link(basename($_SERVER['PHP_SELF']), tep_get_all_get_params(array('action')) . 'action=cust_order&amp;pid=' . $Qproducts-&gt;valueInt('products_id')) . '"&gt;' . tep_image(DIR_WS_ICONS . 'cart.gif', ICON_CART) . '&lt;/a&gt;&lt;/td&gt;' .
</pre><pre class="diff" id="context">                                    '  &lt;/tr&gt;';
       }
       $customer_orders_string .= '&lt;/table&gt;';
</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/boxes">boxes</a><br /></span>
<div class="fileheader"><big><b>product_notifications.php</b></big> <small id="info"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/boxes/product_notifications.php?rev=1.10&amp;content-type=text/vnd.viewcvs-markup">1.10</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/boxes/product_notifications.php.diff?r1=1.10&amp;r2=1.11">-&gt;</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/boxes/product_notifications.php?rev=1.11&amp;content-type=text/vnd.viewcvs-markup">1.11</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.10 -r1.11
--- product_notifications.php	2004/04/13 07:53:43	1.10
+++ product_notifications.php	2005/02/23 16:30:48	1.11
@@ -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">@@ -22,10 +22,13 @@
</small></pre><pre class="diff" id="context">     new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, '', 'SSL'));
 
     if ($osC_Customer-&gt;isLoggedOn()) {
</pre><pre class="diff" id="removed">-      $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . (int)$_GET['products_id'] . "' and customers_id = '" . (int)$osC_Customer-&gt;id . "'");
-      $check = tep_db_fetch_array($check_query);
</pre><pre class="diff" id="added">+      $Qcheck = $osC_Database-&gt;query('select count(*) as count from :table_products_notifications where products_id = :products_id and customers_id = :customers_id');
+      $Qcheck-&gt;bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
+      $Qcheck-&gt;bindInt(':products_id', $_GET['products_id']);
+      $Qcheck-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+      $Qcheck-&gt;execute();
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-      $notification_exists = (($<span id="removedchars">check['count']</span> &gt; 0) ? true : false);
</pre><pre class="diff" id="added">+      $notification_exists = (($<span id="addedchars">Qcheck-&gt;valueInt('count')</span> &gt; 0) ? true : false);
</pre><pre class="diff" id="context">     } else {
       $notification_exists = false;
     }
</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