function ordersPerMonth() { $db = Database::getDatabase(); $orders = $db->getRows("SELECT DATE_FORMAT(dt, '%Y-%m') as dtstr, COUNT(*) FROM orders WHERE type = 'PayPal' AND app_id = '{$this->id}' GROUP BY CONCAT(YEAR(dt), '-', MONTH(dt)) ORDER BY YEAR(dt) ASC, MONTH(dt) ASC"); $keys = gimme($orders, 'dtstr'); $values = gimme($orders, 'COUNT(*)'); $orders = array(); for ($i = 0; $i < count($keys); $i++) { $orders[$keys[$i]] = $values[$i]; } $first_order_date = $db->getValue("SELECT dt FROM orders ORDER BY dt ASC LIMIT 1"); list($year, $month) = explode('-', dater($first_order_date, 'Y-n')); do { $month = str_pad($month, 2, '0', STR_PAD_LEFT); if (!isset($orders["{$year}-{$month}"])) { $orders["{$year}-{$month}"] = 0; } $month = intval($month) + 1; if ($month == 13) { $month = 1; $year++; } } while ($year != date('Y') && $month != date('m')); ksort($orders); return $orders; }
function testDater() { $ts = time(); $date = date('Y-m-d H:i:s', $ts); $this->assertEquals($date, dater($ts, 'Y-m-d H:i:s')); $this->assertEquals($date, dater($date, 'Y-m-d H:i:s')); $this->assertEquals($date, dater(strtotime($date), 'Y-m-d H:i:s')); }
function testDater() { $ts = time(); $date = date('Y-m-d H:i:s', $ts); $this->equals(dater($ts, 'Y-m-d H:i:s'), $date); $this->equals(dater($date, 'Y-m-d H:i:s'), $date); $this->equals(dater(strtotime($date), 'Y-m-d H:i:s'), $date); }
public static function refreshContent($url, $expires_in = 300) { $str = self::getURL($url); $data = self::decodeStrData($str); if ($data === false) { return false; } $db = Database::getDatabase(); $db->query("REPLACE INTO url_cache (url, dt_refreshed, dt_expires, data) VALUES (:url, :dt_refreshed, :dt_expires, :data)", array('url' => $url, 'dt_refreshed' => dater(), 'dt_expires' => dater(time() + $expires_in), 'data' => $str)); return $str; }
public function upgradeLicense() { $upgrade_app = new Application($this->application->upgrade_app_id); if ($upgrade_app->ok()) { $o = new Order(); $o->app_id = $upgrade_app->id; $o->dt = dater(); $o->first_name = $this->order->first_name; $o->last_name = $this->order->last_name; $o->payer_email = $this->order->payer_email; $o->notes = "Upgrade via Shine"; $o->type = 'Upgrade'; $o->insert(); $o->generateLicense(); return $o; } return null; }
public static function track($page_title = '') { $db = Database::getDatabase(); $dt = dater(); $referer = getenv('HTTP_REFERER'); $referer_is_local = self::refererIsLocal($referer); $url = full_url(); $search_terms = self::searchTerms(); $img_search = ''; $ip = self::getIP(); $info = self::browserInfo(); $browser_family = $info['browser']; $browser_version = $info['version']; $os = $info['platform']; $os_version = ''; $user_agent = $info['useragent']; $exec_time = defined('START_TIME') ? microtime(true) - START_TIME : 0; $num_queries = $db->numQueries(); $sql = "INSERT INTO stats (dt, referer, referer_is_local, url, page_title, search_terms, img_search, browser_family, browser_version, os, os_version, ip, user_agent, exec_time, num_queries)\n VALUES (:dt, :referer, :referer_is_local, :url, :page_title, :search_terms, :img_search, :browser_family, :browser_version, :os, :os_version, :ip, :user_agent, :exec_time, :num_queries)"; $vals = array('dt' => $dt, 'referer_is_local' => $referer_is_local, 'referer' => $referer, 'url' => $url, 'page_title' => $page_title, 'search_terms' => $search_terms, 'img_search' => $img_search, 'ip' => $ip, 'browser_family' => $browser_family, 'browser_version' => $browser_version, 'os_version' => $os_version, 'os' => $os, 'user_agent' => $user_agent, 'exec_time' => $exec_time, 'num_queries' => $num_queries); $db->query($sql, $vals); }
if ($f->type == "bug") { ?> <tr> <th class="r">Critical</th> <td><?php echo $f->critical == 0 ? "No" : "Yes!"; ?> </td> </tr> <?php } ?> <tr> <th class="r">Date Submitted</th> <td><?php echo dater('n/j/Y g:ia', $f->dt); ?> </td> </tr> <tr> <th class="r">IP</th> <td><?php echo $f->ip; ?> </td> </tr> <tr> <th class="r">Registration</th> <td><?php echo $f->reguser; ?>
echo utf8_encode($o->last_name); ?> </td> <td><a href="mailto:<?php echo utf8_encode($o->payer_email); ?> "><?php echo utf8_encode($o->payer_email); ?> </a></td> <td><?php echo $o->type; ?> </td> <td><?php echo dater($o->dt, 'm/d/Y g:ia'); ?> </td> <td><?php echo $o->intlAmount(); ?> </td> <td><a href="order.php?id=<?php echo $o->id; ?> ">View</a></td> </tr> <?php } ?> </tbody>
</tr> </thead> <tbody> <?php foreach ($milestones as $m) { ?> <tr> <td><a href="tickets-milestone.php?id=<?php echo $m->id; ?> "><?php echo $m->title; ?> </a></td> <td><?php echo dater($m->dt_due, 'F j'); ?> </td> <td><span class="pbar"><span class="inner" style="width:<?php echo $m->percent(); ?> %;"></span><span class="percent"><?php echo $m->percent(); ?> %</span></span></td> </tr> <?php } ?> </tbody> </table>
foreach ($versions as $v) { ?> <tr> <td><a href="version-edit.php?id=<?php echo $v->id; ?> "><?php echo $v->human_version; ?> </a></td> <td><?php echo $v->version_number; ?> </td> <td><?php echo dater($v->dt, 'n/d/Y g:ia'); ?> </td> <td><?php echo number_format($v->downloads); ?> </td> <td><?php echo number_format($v->updates); ?> </td> </tr> <?php } ?> </tbody>
?> </td> </tr> <?php if ($Auth->level != 'free user') { ?> <tr> <td class="first"> <?php echo UCWords(t('reverts_to_free_account', 'reverts to free account')); ?> : </td> <td> <?php echo $Auth->level == 'paid user' ? dater($Auth->paidExpiryDate) : UCWords(t('never', 'never')); ?> </td> </tr> <?php } ?> </tbody> </table> </div> <div class="clear"><!-- --></div> <div id="pageHeader" style="padding-top: 18px;"> <h2><?php echo strtolower(PAGE_NAME); ?>
if (empty($_POST['last_name']) || empty($_POST['first_name']) || empty($_POST['payment_gross']) || empty($_POST['transaction_id'])) { header("HTTP/1.1 400 Missing parameter"); error_log("Incomplete POST variables – exiting."); exit; } // $app = new Application(); $app->select(7); if (!$app->ok()) { header("HTTP/1.1 400 Missing parameter"); error_log("Application not found!"); exit; } // $o = new Order(); $o->app_id = $app->id; $o->item_name = $app->name; $o->dt = dater(); $o->type = 'MUPromo'; $o->first_name = $_POST['first_name']; $o->last_name = $_POST['last_name']; $o->payer_email = $_POST['email']; $o->txn_id = $_POST['transaction_id']; $o->payment_gross = preg_replace('/[^0-9.]/', '', $_POST['payment_gross']); // custom $o->insert(); $o->generateLicense(); //$o->emailLicense(); // return the URL header('Content-type: text/plain', TRUE); echo "http://updates.basil-salad.com/shine/order-retrieve.php?order_id=" . urlencode($o->id) . "&email=" . urlencode($o->payer_email) . "\n";
<description>Most recent changes with links to updates.</description> <language>en</language> <item> <title><?php echo $app->name; ?> <?php echo $v->human_version; ?> </title> <description><![CDATA[ <?php echo $combined_description; ?> ]]></description> <pubDate><?php echo dater('D, d M Y H:i:s O', $v->dt); ?> </pubDate> <enclosure url="<?php echo $v->url; ?> " sparkle:shortVersionString="<?php echo $v->human_version; ?> " sparkle:version="<?php echo $v->version_number; ?> " length="<?php echo $v->filesize; ?> " type="application/octet-stream" sparkle:dsaSignature="<?php
$app = new Application($_GET['app_id']); if (!$app->ok()) { redirect('/tickets/'); } if (isset($_POST['btnNew'])) { if ($Error->ok()) { $t = new Ticket(); $t->app_id = $app->id; $t->title = trim($_POST['title']); $t->description = $_POST['description']; $t->created_by = $Auth->id; $t->assigned_to = $_POST['assigned_to']; $t->milestone_id = $_POST['milestone_id']; $t->status = $_POST['status']; $t->dt_created = dater(); $t->dt_last_state = dater(); if (strlen($t->title) == 0) { $t->title = 'Untitled Ticket'; } $t->insert(); redirect('/tickets/app/' . $app->id . '/list/'); } else { } } else { $title = ''; $description = ''; $assigned_to = ''; $milestone_id = ''; $tags = ''; } $fakeTicket = new Ticket();
<?php require 'includes/master.inc.php'; $Auth->requireAdmin('login.php'); $nav = 'applications'; $app = new Application($_GET['id']); if (!$app->ok()) { redirect('index.php'); } if (isset($_POST['btnSerial'])) { if (strlen($_POST['serial']) > 0) { $s = new Serial(); $s->app_id = $app->id; $s->dt = dater(); $s->guid = $_POST['guid']; $s->serial = $_POST['serial']; $s->insert(); redirect('pirates.php?id=' . $app->id); } } $db = Database::getDatabase(); $pirates = $db->getRows("SELECT * FROM pirates WHERE app_id = '{$app->id}' ORDER BY dt DESC"); $serial_count = $db->getValue("SELECT COUNT(*) from pirated_serials WHERE app_id = '{$app->id}'"); $serial_date = $db->getValue("SELECT dt FROM pirated_serials WHERE app_id = '{$app->id}' ORDER BY dt DESC LIMIT 1"); $serial_date = $serial_date ? time2str($serial_date) : 'never'; if (isset($_GET['feed']) && $_GET['feed'] == 'json') { $serials = DBObject::glob('Serial', "SELECT * from pirated_serials WHERE app_id = '{$app->id}'"); $arr = array(); foreach ($serials as $s) { $arr[] = array('dt' => $s->dt, 'guid' => $s->guid, 'serial' => $s->serial); }
</div> <div class="comments"> <?php foreach ($ticket->histories() as $th) { $thu = new User($th->user_id); ?> <div class="comment"> <img src="<?php echo $thu->avatar(); ?> "> <p class="meta"><?php echo $thu->username; ?> | <?php echo dater($th->dt, 'F j, Y \\a\\t g:ia'); ?> </p> <?php foreach ($th->changes() as $c) { ?> <p class="changes"><?php echo $c; ?> </p> <?php } ?> <div class="markdown"> <?php echo premarkdown($th->comment);
if (COUNT($rows) > 0) { ?> <script> mfScripts.settingsTable = {}; mfScripts.settingsTable.Data = { configData: [ <?php $formattedRow = array(); foreach ($rows as $row) { $userAction = "<a href='#' onClick='return editUserPopup(" . $row['id'] . ");'>edit</a>"; $userAction .= " | <a href='files.php?user="******"'>" . t("view_files", "view files") . "</a>"; if ($row['username'] != $userObj->username) { $userAction .= " | <a href='#' onClick='return changeUserState(" . $row['id'] . ");'>" . ($row['status'] == "active" ? t("disable") : t("enable")) . "</a>"; } $formattedRow[] = "{id:\"" . $row['id'] . "\", username:\"" . addslashes($row['username']) . "\", email:\"" . addslashes($row['email']) . "\", level:\"" . addslashes($row['level']) . "\", lastlogin:\"" . dater($row['lastlogindate']) . "\", status:\"" . addslashes($row['status']) . "\", total_space_used:\"" . addslashes($row['totalFileSize']) . "\", raw_total_space_used:\"" . addslashes($row['totalFileSize']) . "\", total_files:" . (int) $row['totalFiles'] . ", user_action:\"" . $userAction . "\"}"; } echo implode(",", $formattedRow); ?> ] }; YAHOO.util.Event.addListener(window, "load", function() { mfScripts.settingsTable.InlineCellEditing = function() { YAHOO.widget.DataTable.formatSize = function(elLiner, oRecord, oColumn, oData) { elLiner.innerHTML = bytesToSize(oData); }; var myColumnDefs = [
$Auth->requireAdmin('login.php'); $nav = 'tweets'; $applications = DBObject::glob('Application', 'SELECT * FROM shine_applications ORDER BY name'); if (isset($_GET['refresh'])) { include 'tweet-cron.php'; } if (isset($_GET['delete'])) { $t = new Tweet($_GET['delete']); $t->deleted = 1; $t->new = 0; $t->update(); } if (isset($_GET['reply'])) { $t = new Tweet($_GET['reply']); $t->replied_to = 1; $t->reply_date = dater(); $t->new = 0; $t->update(); redirect("http://twitter.com/home?status=@{$t->username}%20&in_reply_to={$t->tweet_id}"); } $sql = ''; $app_id = ''; $group = ''; if (isset($_GET['id']) && !empty($_GET['id'])) { $sql = 'AND app_id = ' . intval($_GET['id']); $app_id = intval($_GET['id']); } else { $group = ' GROUP BY tweet_id '; } if (isset($_GET['read'])) { $db = Database::getDatabase();
private function notify() { if ($this->emailOnError === true) { $globals = print_r($GLOBALS, true); $msg = ''; $msg .= "Url: " . full_url() . "\n"; $msg .= "Date: " . dater() . "\n"; $msg .= "Server: " . $_SERVER['SERVER_NAME'] . "\n"; $msg .= "ReadDB Error:\n" . mysql_error($this->readDB) . "\n\n"; $msg .= "WriteDB Error:\n" . mysql_error($this->writeDB) . "\n\n"; ob_start(); debug_print_backtrace(); $trace = ob_get_contents(); ob_end_clean(); $msg .= $trace . "\n\n"; $msg .= $globals; mail($this->emailTo, $this->emailSubject, $msg); } if ($this->onError == 'die') { echo "<p style='border:5px solid red;background-color:#fff;padding:5px;'><strong>Read Database Error:</strong><br/>" . mysql_error($this->readDB) . "</p>"; echo "<p style='border:5px solid red;background-color:#fff;padding:5px;'><strong>Write Database Error:</strong><br/>" . mysql_error($this->writeDB) . "</p>"; echo "<p style='border:5px solid red;background-color:#fff;padding:5px;'><strong>Last Query:</strong><br/>" . $this->lastQuery() . "</p>"; echo "<pre>"; debug_print_backtrace(); echo "</pre>"; exit; } if ($this->onError == 'redirect') { redirect($this->errorUrl); } }
<?php /* load in config options from db */ $rows = $db->getRows("SELECT * FROM banned_ips ORDER BY ipAddress"); if (COUNT($rows) > 0) { ?> <script> mfScripts.bannedIPsTable = {}; mfScripts.bannedIPsTable.Data = { configData: [ <?php $formattedRow = array(); foreach ($rows as $row) { $banNotes = $row['banNotes'] ? $row['banNotes'] : "-"; $banNotes = str_replace(array("\n", "\r"), "<br/>", $banNotes); $formattedRow[] = "{id:\"" . $row['id'] . "\", ip_address:\"" . addslashes($row['ipAddress']) . "\", date_banned:\"" . dater($row['dateBanned']) . "\", ban_type:\"" . addslashes($row['banType']) . "\", ban_notes:\"" . addslashes($banNotes) . "\", ban_action:\"<a href='#' onClick='return removeBannedIP(" . $row['id'] . ");'>" . t("remove") . "</a>\"}"; } echo implode(",", $formattedRow); ?> ] }; YAHOO.util.Event.addListener(window, "load", function() { mfScripts.bannedIPsTable.InlineCellEditing = function() { var myColumnDefs = [ {key:"id", hidden:true}, {key:"ip_address", label:"IP Address", sortable:true}, {key:"date_banned", label:"Date Banned", sortable:true}, {key:"ban_type", label:"Ban Type", sortable:true},
} } if (isset($_POST['btnCreateVersion'])) { $Error->blank($_POST['version_number'], 'Version Number'); $Error->blank($_POST['human_version'], 'Human Readable Version Number'); if (!$_POST['url']) { $Error->upload($_FILES['file'], 'file'); } if ($Error->ok()) { $v = new Version(); $v->app_id = $app->id; $v->version_number = $_POST['version_number']; $v->human_version = $_POST['human_version']; $v->release_notes = $_POST['release_notes']; $v->url = $_POST['url']; $v->dt = dater(); $v->downloads = 0; $v->updates = 0; $tmpfile = ""; if ($v->url) { $tmpfile = tempnam(sys_get_temp_dir(), 'sparkle_stdin'); $data = get_data_from_url($v->url); if (!$data) { die("The file at <a href='{$v->url}'>{$v->url}</a> does not exist or is empty!"); } file_put_contents($tmpfile, $data); } else { $tmpfile = $_FILES['file']['tmp_name']; } $v->filesize = filesize($tmpfile); $v->signature = sign_file($tmpfile, $app->sparkle_pkey);
<th scope="col" class="figures"><?php echo t("total_visits", "total visits"); ?> </th> <th scope="col" class="figures"><?php echo t("percentage", "percentage"); ?> </th> </tr> </thead> <tbody> <?php $last7Days = array_reverse($last7Days, true); foreach ($last7Days as $k => $total) { echo "<tr>"; echo "<td>" . dater($k, "M y") . "</td>"; echo "<td class=\"figures\">" . $total . "</td>"; echo "<td class=\"figures\">" . number_format($total / $totalVisits * 100, 1) . "%</td>"; echo "</tr>"; } ?> </tbody> </table> </div> </div> </div> <div> <!-- TAB 2 --> <?php
} ?> "> <td><?php echo $act->applicationName(); ?> </td> <td><a href="order.php?id=<?php echo $act->order_id; ?> "><?php echo $act->name; ?> </a></td> <td><?php echo dater($act->dt, 'm/d/Y g:ia'); ?> </td> <td><?php echo array_shift(explode('-', $act->serial_number)); ?> ...</td> <td><?php echo $act->ip; ?> </td> </tr> <?php } ?> </tbody>
<?php // This is just a simple script to help you keep track of how often // your app is being pirated. // // How you detect piracy is up to you, but when you do, have your app // ping this script. In my case, if the user enters a serial number I // know to be pirated, I simply do... // // NSString *urlStr = [NSString stringWithFormat:@"http://shine.your-domain.com/pirate.php?app_id=1&guid=%@", @"some unique identifier"]; // NSURL *url = [NSURL URLWithString:urlStr]; // NSURLRequest *request = [NSURLRequest requestWithURL:url]; // [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; // // It's not particularly elegent, but it gets the job done. require 'includes/master.inc.php'; $app_id = $_GET['app_id']; $ip = $_SERVER['REMOTE_ADDR']; $guid = $_GET['guid']; $dt = dater(); $db = Database::getDatabase(); $app_id = mysql_real_escape_string($app_id, $db->db); $guid = mysql_real_escape_string($guid, $db->db); $db->query("INSERT INTO pirates (`app_id`, `ip`, `guid`, `dt`) VALUES ('{$app_id}', '{$ip}', '{$guid}', '{$dt}')"); $v = DBObject::glob('Version', "SELECT * FROM versions WHERE app_id = {$app_id} ORDER BY dt DESC LIMIT 1"); $v = array_pop($v); $v->pirate_count++; $v->update();
foreach ($versions as $v) { ?> <item> <title><?php echo $app->name; ?> <?php echo $v->human_version; ?> </title> <description><![CDATA[ <?php echo $v->release_notes; ?> ]]></description> <pubDate><?php echo dater($v->dt, 'D, d M Y H:i:s O'); ?> </pubDate> <enclosure url="<?php echo "http://" . $_SERVER['HTTP_HOST'] . slash(WEB_ROOT) . "update.php?id={$v->id}"; ?> " sparkle:shortVersionString="<?php echo $v->human_version; ?> " sparkle:version="<?php echo $v->version_number; ?> " length="<?php echo $v->filesize; ?> " type="application/octet-stream" sparkle:dsaSignature="<?php
$lArr[] = "Id"; $lArr[] = "Filename"; $lArr[] = "Url"; $lArr[] = "Filesize"; $lArr[] = "Total Downloads"; $lArr[] = "Uploaded Date"; $lArr[] = "Last Accessed"; $formattedCSVData[] = "\"" . implode("\",\"", $lArr) . "\""; /* get all url data */ $urlData = $db->getRows("SELECT * FROM file ORDER BY uploadedDate asc"); foreach ($urlData as $row) { $lArr = array(); $lArr[] = $row['id']; $lArr[] = $row['originalFilename']; $lArr[] = WEB_ROOT . "/" . $row['shortUrl']; $lArr[] = $row['fileSize']; $lArr[] = $row['visits']; $lArr[] = $row['uploadedDate'] != "0000-00-00 00:00:00" ? dater($row['uploadedDate']) : ""; $lArr[] = $row['lastAccessed'] != "0000-00-00 00:00:00" ? dater($row['lastAccessed']) : ""; $formattedCSVData[] = "\"" . implode("\",\"", $lArr) . "\""; } header("Expires: Mon, 26 Jul 1997 05:00:00 GMT\n"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Content-type: application/zip;\n"); //or yours? header("Content-Transfer-Encoding: binary"); //$len = strlen($formattedCSVData); //header("Content-Length: $len;\n"); $outname = "file_data.csv"; header("Content-Disposition: attachment; filename=\"{$outname}\";\n\n"); echo implode("\n", $formattedCSVData);
public function adult($val, $id) { if (dater($val) > date('Y') - 18 . date('-m-d H:i:s')) { $this->add($id, 'You must be at least 18 years old.'); return false; } return true; }
<?php require_once 'includes/master.inc.php'; $db = Database::getDatabase(); $tweet_apps = $db->getRows('SELECT id, tweet_terms FROM applications'); foreach ($tweet_apps as $tweet_app) { $terms = explode(',', $tweet_app['tweet_terms']); foreach ($terms as $term) { $term = trim($term); if (strlen($term) > 0) { $json = geturl("http://search.twitter.com/search.json?q=" . urlencode($term)); $data = json_decode($json); if (!is_object($data)) { continue; } foreach ($data->results as $result) { $t = new Tweet(); $t->tweet_id = $result->id; $t->username = $result->from_user; $t->app_id = $tweet_app['id']; $t->dt = dater($result->created_at); $t->body = $result->text; $t->profile_img = $result->profile_image_url; $t->new = 1; $t->replied_to = 0; $t->insert(); } } } }
$tracker--; } $minY = 0; $maxY = 10; foreach ($last7Days as $k => $total) { $totalUrls = $db->getValue("SELECT COUNT(id) AS total FROM file WHERE MID(uploadedDate, 1, 7) = '" . $k . "'"); $last7Days[$k] = (int) $totalUrls; if ($totalUrls > $maxY) { $maxY = $totalUrls; } } $strXML = ""; $strXML .= "<graph caption='" . t("dashboard_graph_last_12_months_title", "Last 12 months file uploads") . "' yAxisMinValue='" . $minY . "' yAxisMaxValue='" . $maxY . "' canvasBorderThickness='1' showValues='0' canvasBgColor='dddddd' divlinecolor='ffffff' canvasBorderColor='cccccc' rotateNames='0' animation='1' xAxisName='Month' yAxisName='" . UCWords(t("files", "files")) . "' decimalPrecision='0' formatNumberScale='0' baseFont='Arial' baseFontSize='12'>"; foreach ($last7Days as $k => $total) { $position = rand(0, COUNT($colours) - 1); $strXML .= "<set name='" . dater($k, "M") . "' value='" . $total . "' color='" . $colours[$position] . "'/>"; } $strXML .= "</graph>"; echo renderChartHTML("admin_libraries/charts/Charts/FCF_Column2D.swf", "", $strXML, "yearChart", 600, 300); ?> </div> <div class="dashboardDataTable"> <div id="dashboardOverviewTable" class="yuiTable"></div> <script> mfScripts.dashboardOverviewTable = {}; mfScripts.dashboardOverviewTable.Data = { configData: [ <?php $db = Database::getDatabase(true); $formattedRow = array();
foreach ($versions as $v) { ?> <tr> <td><a href="version-edit.php?id=<?php echo $v->id; ?> "><?php echo $v->human_version; ?> </a></td> <td><?php echo $v->version_number; ?> </td> <td><?php echo dater($v->dt, 'Y-m-d h:i'); ?> </td> <td><?php $total = $v->downloads + $v->updates; echo "<strong>{$total}</strong> = "; echo number_format($v->downloads); if ($v->downloads) { $pd = round($v->downloads / $total * 100); echo " ({$pd}%)"; } echo " + "; echo number_format($v->updates); if ($v->updates) { $pu = round($v->updates / $total * 100); echo " ({$pu}%)";