[TEP-COMMIT] [CVS admin] replace calls to the database functions with the database class
hpdl-OfajU3CKLf1/[email protected] 30 Oct 2004 22:49:58 -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>admin/admin/includes/graphs</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1">banner_daily.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/admin/admin/includes/graphs/banner_daily.php?rev=1.3&content-type=text/vnd.viewcvs-markup">1.3</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_daily.php.diff?r1=1.3&r2=1.4">-></a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_daily.php?rev=1.4&content-type=text/vnd.viewcvs-markup">1.4</a></td></tr>
<tr class="alt"><td><tt><a href="#file2">banner_monthly.php</a></tt></td><td align="right" id="added">+12</td><td align="right" id="removed">-7</td><td nowrap="nowrap" align="center"><a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_monthly.php?rev=1.4&content-type=text/vnd.viewcvs-markup">1.4</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_monthly.php.diff?r1=1.4&r2=1.5">-></a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_monthly.php?rev=1.5&content-type=text/vnd.viewcvs-markup">1.5</a></td></tr>
<tr><td><tt><a href="#file3">banner_yearly.php</a></tt></td><td align="right" id="added">+11</td><td align="right" id="removed">-6</td><td nowrap="nowrap" align="center"><a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_yearly.php?rev=1.4&content-type=text/vnd.viewcvs-markup">1.4</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_yearly.php.diff?r1=1.4&r2=1.5">-></a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_yearly.php?rev=1.5&content-type=text/vnd.viewcvs-markup">1.5</a></td></tr>
<tr class="alt"><td><tt><span id="removed">banner_infobox.php</span></tt></td><td></td><td></td><td nowrap="nowrap"><a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_infobox.php?rev=1.5&content-type=text/vnd.viewcvs-markup">1.5</a> removed</td></tr>
<tr><td></td><td align="right" id="added">+36</td><td align="right" id="removed">-20</td><td></td></tr>
</table>
<small id="info">1 removed + 3 modified, total 4 files</small><br />
<pre class="comment">
replace calls to the database functions with the database class
fix a bug with the monthly statistics of wrong month names being returned
due to months having a different number of days (ie, October with 31 days)
remove redundant infobox graph file
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname"><a href="http://cvs.oscommerce.com/viewcvs.cgi/admin">admin</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin">admin</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs">graphs</a><br /></span>
<div class="fileheader"><big><b>banner_daily.php</b></big> <small id="info"><a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_daily.php?rev=1.3&content-type=text/vnd.viewcvs-markup">1.3</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_daily.php.diff?r1=1.3&r2=1.4">-></a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_daily.php?rev=1.4&content-type=text/vnd.viewcvs-markup">1.4</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.3 -r1.4
--- banner_daily.php 2004/08/15 18:18:35 1.3
+++ banner_daily.php 2004/10/30 22:49:51 1.4
@@ -19,7 +19,7 @@
</small></pre><pre class="diff" id="context"> $year = isset($_GET['year']) ? $_GET['year'] : date('Y');
$month = isset($_GET['month']) ? $_GET['month'] : date('n');
</pre><pre class="diff" id="removed">- $days = date('t', mktime(0,<span id="removedchars">0,0,</span>$month))+1;
</pre><pre class="diff" id="added">+ $days = date('t', mktime(0,<span id="addedchars"> 0, 0, </span>$month))+1;
</pre><pre class="diff" id="context"> $stats = array();
for ($i=1; $i<$days; $i++) {
$stats[] = array($i, '0', '0');
</pre><pre class="diff"><small id="info">@@ -29,16 +29,22 @@
</small></pre><pre class="diff" id="context"> $vLabels[] = $i;
}
</pre><pre class="diff" id="removed">- $banner_stats_query = tep_db_query("select dayofmonth(banners_history_date) as banner_day, banners_shown as value, banners_clicked as dvalue from " . TABLE_BANNERS_HISTORY . " where banners_id = '" . $_GET['bID'] . "' and month(banners_history_date) = '" . $month . "' and year(banners_history_date) = '" . $year . "'");
- while ($banner_stats = tep_db_fetch_array($banner_stats_query)) {
- $stats[($banner_stats['banner_day']-1)] = array($banner_stats['banner_day'], (($banner_stats['value']) ? $banner_stats['value'] : '0'), (($banner_stats['dvalue']) ? $banner_stats['dvalue'] : '0'));
</pre><pre class="diff" id="added">+ $Qstats = $osC_Database->query('select dayofmonth(banners_history_date) as banner_day, banners_shown as value, banners_clicked as dvalue from :table_banners_history where banners_id = :banners_id and month(banners_history_date) = :month and year(banners_history_date) = :year');
+ $Qstats->bindTable(':table_banners_history', TABLE_BANNERS_HISTORY);
+ $Qstats->bindInt(':banners_id', $_GET['bID']);
+ $Qstats->bindInt(':month', $month);
+ $Qstats->bindInt(':year', $year);
+ $Qstats->execute();
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">- $views[($banner_stats['banner_day']-1)] = $banner_stats['value'];
- $clicks[($banner_stats['banner_day']-1)] = $banner_stats['dvalue'];
</pre><pre class="diff" id="added">+ while ($Qstats->next()) {
+ $stats[($Qstats->valueInt('banner_day')-1)] = array($Qstats->valueInt('banner_day'), (($Qstats->valueInt('value') > 0) ? $Qstats->valueInt('value') : '0'), (($Qstats->valueInt('dvalue') > 0) ? $Qstats->valueInt('dvalue') : '0'));
+
+ $views[($Qstats->valueInt('banner_day')-1)] = $Qstats->valueInt('value');
+ $clicks[($Qstats->valueInt('banner_day')-1)] = $Qstats->valueInt('dvalue');
</pre><pre class="diff" id="context"> }
$ochart = new chart(600,350, 5, '#eeeeee');
</pre><pre class="diff" id="removed">- $ochart->setTitle(sprintf(TEXT_BANNERS_DAILY_STATISTICS, $Qbanner->value('banners_title'), strftime('%B', mktime(0,<span id="removedchars">0,0,</span>$month)), $year), '#000000', 2);
</pre><pre class="diff" id="added">+ $ochart->setTitle(sprintf(TEXT_BANNERS_DAILY_STATISTICS, $Qbanner->value('banners_title'), strftime('%B', mktime(0,<span id="addedchars"> 0, 0, </span>$month)), $year), '#000000', 2);
</pre><pre class="diff" id="context"> $ochart->setPlotArea(SOLID, '#444444', '#dddddd');
$ochart->setFormat(0, ',', '.');
$ochart->setXAxis('#000000', SOLID, 1, '');
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname"><a href="http://cvs.oscommerce.com/viewcvs.cgi/admin">admin</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin">admin</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs">graphs</a><br /></span>
<div class="fileheader"><big><b>banner_monthly.php</b></big> <small id="info"><a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_monthly.php?rev=1.4&content-type=text/vnd.viewcvs-markup">1.4</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_monthly.php.diff?r1=1.4&r2=1.5">-></a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_monthly.php?rev=1.5&content-type=text/vnd.viewcvs-markup">1.5</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.4 -r1.5
--- banner_monthly.php 2004/08/15 18:18:35 1.4
+++ banner_monthly.php 2004/10/30 22:49:52 1.5
@@ -16,23 +16,28 @@
</small></pre><pre class="diff" id="context">
$stats = array();
for ($i=1; $i<13; $i++) {
</pre><pre class="diff" id="removed">- $stats[] = array(strftime('%b', mktime(0,<span id="removedchars">0,0,$i</span>)), '0', '0');
</pre><pre class="diff" id="added">+ $stats[] = array(strftime('%b', mktime(0,<span id="addedchars"> 0, 0, $i, 1, $year</span>)), '0', '0');
</pre><pre class="diff" id="context"> }
$views = array();
$clicks = array();
</pre><pre class="diff" id="removed">- $banner_stats_query = tep_db_query("select month(banners_history_date) as banner_month, sum(banners_shown) as value, sum(banners_clicked) as dvalue from " . TABLE_BANNERS_HISTORY . " where banners_id = '" . $_GET['bID'] . "' and year(banners_history_date) = '" . $year . "' group by banner_month");
- while ($banner_stats = tep_db_fetch_array($banner_stats_query)) {
- $stats[($banner_stats['banner_month']-1)] = array(strftime('%b', mktime(0,0,0,$banner_stats['banner_month'])), (($banner_stats['value']) ? $banner_stats['value'] : '0'), (($banner_stats['dvalue']) ? $banner_stats['dvalue'] : '0'));
</pre><pre class="diff" id="added">+ $Qstats = $osC_Database->query('select month(banners_history_date) as banner_month, sum(banners_shown) as value, sum(banners_clicked) as dvalue from :table_banners_history where banners_id = :banners_id and year(banners_history_date) = :year group by banner_month');
+ $Qstats->bindTable(':table_banners_history', TABLE_BANNERS_HISTORY);
+ $Qstats->bindInt(':banners_id', $_GET['bID']);
+ $Qstats->bindInt(':year', $year);
+ $Qstats->execute();
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">- $views[($banner_stats['banner_month']-1)] = $banner_stats['value'];
- $clicks[($banner_stats['banner_month']-1)] = $banner_stats['dvalue'];
</pre><pre class="diff" id="added">+ while ($Qstats->next()) {
+ $stats[($Qstats->valueInt('banner_month')-1)] = array(strftime('%b', mktime(0, 0, 0, $Qstats->valueInt('banner_month'), 1, $year)), (($Qstats->valueInt('value') > 0) ? $Qstats->valueInt('value') : '0'), (($Qstats->valueInt('dvalue') > 0) ? $Qstats->valueInt('dvalue') : '0'));
+
+ $views[($Qstats->valueInt('banner_month')-1)] = $Qstats->valueInt('value');
+ $clicks[($Qstats->valueInt('banner_month')-1)] = $Qstats->valueInt('dvalue');
</pre><pre class="diff" id="context"> }
$vLabels = array();
for ($i=1; $i<13; $i++) {
</pre><pre class="diff" id="removed">- $vLabels[] = strftime('%b', mktime(0,<span id="removedchars">0,0,$i</span>));
</pre><pre class="diff" id="added">+ $vLabels[] = strftime('%b', mktime(0,<span id="addedchars"> 0, 0, $i, 1, $year</span>));
</pre><pre class="diff" id="context">
if (!isset($views[$i-1])) {
$views[$i-1] = 0;
</pre></div>
<hr /><a name="file3" /><div class="file">
<span class="pathname"><a href="http://cvs.oscommerce.com/viewcvs.cgi/admin">admin</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin">admin</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs">graphs</a><br /></span>
<div class="fileheader"><big><b>banner_yearly.php</b></big> <small id="info"><a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_yearly.php?rev=1.4&content-type=text/vnd.viewcvs-markup">1.4</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_yearly.php.diff?r1=1.4&r2=1.5">-></a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_yearly.php?rev=1.5&content-type=text/vnd.viewcvs-markup">1.5</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.4 -r1.5
--- banner_yearly.php 2004/08/15 18:18:35 1.4
+++ banner_yearly.php 2004/10/30 22:49:52 1.5
@@ -17,13 +17,18 @@
</small></pre><pre class="diff" id="context"> $vLabels = array();
$stats = array();
</pre><pre class="diff" id="removed">- $banner_stats_query = tep_db_query("select year(banners_history_date) as year, sum(banners_shown) as value, sum(banners_clicked) as dvalue from " . TABLE_BANNERS_HISTORY . " where banners_id = '" . $_GET['bID'] . "' group by year");
- while ($banner_stats = tep_db_fetch_array($banner_stats_query)) {
- $stats[] = array($banner_stats['year'], (($banner_stats['value']) ? $banner_stats['value'] : '0'), (($banner_stats['dvalue']) ? $banner_stats['dvalue'] : '0'));
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">- $views[] = $banner_stats['value'];
- $clicks[] = $banner_stats['dvalue'];
- $vLabels[] = $banner_stats['year'];
</pre><pre class="diff" id="added">+ $Qstats = $osC_Database->query('select year(banners_history_date) as year, sum(banners_shown) as value, sum(banners_clicked) as dvalue from :table_banners_history where banners_id = :banners_id group by year');
+ $Qstats->bindTable(':table_banners_history', TABLE_BANNERS_HISTORY);
+ $Qstats->bindInt(':banners_id', $_GET['bID']);
+ $Qstats->execute();
+
+ while ($Qstats->next()) {
+ $stats[] = array($Qstats->valueInt('year'), (($Qstats->valueInt('value') > 0) ? $Qstats->valueInt('value') : '0'), (($Qstats->valueInt('dvalue') > 0) ? $Qstats->valueInt('dvalue') : '0'));
+
+ $views[] = $Qstats->valueInt('value');
+ $clicks[] = $Qstats->valueInt('dvalue');
+ $vLabels[] = $Qstats->valueInt('year');
</pre><pre class="diff" id="context"> }
$ochart = new chart(600,350, 5, '#eeeeee');
</pre></div>
<hr /><a name="file4" /><div class="file">
<span class="pathname" id="removed"><a href="http://cvs.oscommerce.com/viewcvs.cgi/admin">admin</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin">admin</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs">graphs</a><br /></span>
<div class="fileheader" id="removed"><big><b>banner_infobox.php</b></big> <small id="info">removed after <a href="http://cvs.oscommerce.com/viewcvs.cgi/admin/admin/includes/graphs/banner_infobox.php?rev=1.5&content-type=text/vnd.viewcvs-markup">1.5</a></small></div>
<pre class="diff"><small id="info">diff -N banner_infobox.php
--- /tmp/cvsAAAzbaaJG Sun Oct 31 00:49:55 2004
+++ /dev/null Sun Oct 31 00:49:37 2004
@@ -1,41 +0,0 @@
</small></pre><pre class="diff" id="removed">-<?php
-/*
- $Id$
-
- osCommerce, Open Source E-Commerce Solutions
- http://www.oscommerce.com
-
- Copyright (c) 2004 osCommerce
-
- Released under the GNU General Public License
-*/
-
- require('external/panachart/panachart.php');
-
- $views = array(0, 0, 0);
- $clicks = array(0, 0, 0);
- $vLabels = array(0, 0, 0);
-
- $index = 2;
-
- $banner_stats_query = tep_db_query("select date_format(banners_history_date, '%e-%b') as name, banners_shown as value, banners_clicked as dvalue from " . TABLE_BANNERS_HISTORY . " where banners_id = '" . $banner_id . "' order by banners_history_date desc limit " . $days);
- while ($banner_stats = tep_db_fetch_array($banner_stats_query)) {
- $views[$index] = $banner_stats['value'];
- $clicks[$index] = $banner_stats['dvalue'];
- $vLabels[$index] = $banner_stats['name'];
-
- $index--;
- }
-
- $ochart = new chart(200, 220, 5, '#eeeeee');
- $ochart->setTitle(TEXT_BANNERS_LAST_3_DAYS, '#000000', 2);
- $ochart->setPlotArea(SOLID, '#444444', '#dddddd');
- $ochart->setFormat(0, ',', '.');
- $ochart->setXAxis('#000000', SOLID, 1, '');
- $ochart->setYAxis('#000000', SOLID, 2, '');
- $ochart->setLabels($vLabels, '#000000', 1, VERTICAL);
- $ochart->setGrid('#bbbbbb', DASHED, '#bbbbbb', DOTTED);
- $ochart->addSeries($views, 'area', 'Series1', SOLID, '#000000', '#0000ff');
- $ochart->addSeries($clicks, 'area', 'Series1', SOLID, '#000000', '#ff0000');
- $ochart->plot('images/graphs/banner_infobox-' . $banner_id . '.' . $image_extension);
-?>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.9</small></center>
</body></html>
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click