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

hpdl-OfajU3CKLf1/[email protected] 23 Feb 2005 16:08:30 -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</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1">application_top.php</a></tt></td><td align="right" id="added">+26</td><td align="right" id="removed">-9</td><td nowrap="nowrap" align="center"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/application_top.php?rev=1.288&amp;content-type=text/vnd.viewcvs-markup">1.288</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/application_top.php.diff?r1=1.288&amp;r2=1.289">-&gt;</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/application_top.php?rev=1.289&amp;content-type=text/vnd.viewcvs-markup">1.289</a></td></tr>
</table>
<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><br /></span>
<div class="fileheader"><big><b>application_top.php</b></big> <small id="info"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/application_top.php?rev=1.288&amp;content-type=text/vnd.viewcvs-markup">1.288</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/application_top.php.diff?r1=1.288&amp;r2=1.289">-&gt;</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/application_top.php?rev=1.289&amp;content-type=text/vnd.viewcvs-markup">1.289</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.288 -r1.289
--- application_top.php	2004/11/24 15:51:36	1.288
+++ application_top.php	2005/02/23 16:08:29	1.289
@@ -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">@@ -172,10 +172,19 @@
</small></pre><pre class="diff" id="context"> 
                                 if (!is_array($notify)) $notify = array($notify);
                                 for ($i=0, $n=sizeof($notify); $i&lt;$n; $i++) {
</pre><pre class="diff" id="removed">-                                  $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . (int)$notify[$i] . "' and customers_id = '" . (int)$osC_Customer-&gt;id . "'");
-                                  $check = tep_db_fetch_array($check_query);
-                                  if ($check['count'] &lt; 1) {
-                                    tep_db_query("insert into " . TABLE_PRODUCTS_NOTIFICATIONS . " (products_id, customers_id, date_added) values ('" . (int)$notify[$i] . "', '" . (int)$osC_Customer-&gt;id . "', now())");
</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', $notify[$i]);
+                                  $Qcheck-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+                                  $Qcheck-&gt;execute();
+
+                                  if ($Qcheck-&gt;valueInt('count') &lt; 1) {
+                                    $Qn = $osC_Database-&gt;query('insert into :table_products_notifications (products_id, customers_id, date_added) values (:products_id, :customers_id, :date_added)');
+                                    $Qn-&gt;bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
+                                    $Qn-&gt;bindInt(':products_id', $notify[$i]);
+                                    $Qn-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+                                    $Qn-&gt;bindRaw(':date_added', 'now()');
+                                    $Qn-&gt;execute();
</pre><pre class="diff" id="context">                                   }
                                 }
 
</pre><pre class="diff"><small id="info">@@ -187,10 +196,18 @@
</small></pre><pre class="diff" id="context">                               }
                               break;
       case 'notify_remove' :  if ($osC_Customer-&gt;isLoggedOn() &amp;&amp; isset($_GET['products_id'])) {
</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);
-                                if ($check['count'] &gt; 0) {
-                                  tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . (int)$_GET['products_id'] . "' and customers_id = '" . (int)$osC_Customer-&gt;id . "'");
</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();
+
+                                if ($Qcheck-&gt;valueInt('count') &gt; 0) {
+                                  $Qn = $osC_Database-&gt;query('delete from :table_products_notifications where products_id = :products_id and customers_id = :customers_id');
+                                  $Qn-&gt;bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
+                                  $Qn-&gt;bindInt(':products_id', $_GET['products_id']);
+                                  $Qn-&gt;bindInt(':customers_id', $osC_Customer-&gt;id);
+                                  $Qn-&gt;execute();
</pre><pre class="diff" id="context">                                 }
 
                                 tep_redirect(tep_href_link(basename($_SERVER['PHP_SELF']), tep_get_all_get_params(array('action'))));
</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