public function calculate() { parent::calculate(); // load records .. see $this->firstRecord, $this->perPage $limitSql = sprintf(' LIMIT %s,%s', $this->firstRecord, $this->perPage); $this->records = array_values(DBObject::glob($this->itemClass, $this->pageSql . $limitSql)); }
$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); } die(json_encode($arr)); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Shine</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" > <link rel="stylesheet" href="http://yui.yahooapis.com/2.7.0/build/reset-fonts-grids/reset-fonts-grids.css" type="text/css"> <link rel="stylesheet" href="css/yuiapp.css" type="text/css">
require 'includes/master.inc.php'; $Auth->requireAdmin('login.php'); $db = Database::getDatabase(); $nav = 'applications'; // Create a new application if needed if (isset($_POST['btnNewApp']) && strlen($_POST['name'])) { $a = new Application(); $a->name = $_POST['name']; $a->insert(); redirect('application.php?id=' . $a->id); } // Get a list of our apps $apps = DBObject::glob('Application', 'SELECT * FROM shine_applications WHERE hidden = 0 ORDER BY name'); // Get our recent orders $orders = DBObject::glob('Order', 'SELECT * FROM shine_orders ORDER BY dt DESC LIMIT 10'); // Downloads in last 24 hours $sel = "TIME_FORMAT(dt, '%Y%m%d%H')"; $order_totals = $db->getRows("SELECT {$sel} as dtstr, COUNT(*) FROM shine_downloads WHERE DATE_ADD(dt, INTERVAL 24 HOUR) > NOW() GROUP BY dtstr ORDER BY {$sel} ASC"); $opw24 = new googleChart(implode(',', gimme($order_totals, 'COUNT(*)')), 'bary'); $opw24->showGrid = 1; $opw24->dimensions = '280x100'; $opw24->setLabelsMinMax(4, 'left'); $opw24_fb = clone $opw24; $opw24_fb->dimensions = '640x400'; // Downloads in last 30 days $sel = "TO_DAYS(dt)"; $order_totals = $db->getRows("SELECT {$sel} as dtstr, COUNT(*) FROM shine_downloads WHERE DATE_ADD(dt, INTERVAL 30 DAY) > NOW() GROUP BY {$sel} ORDER BY {$sel} ASC"); $opw30 = new googleChart(implode(',', gimme($order_totals, 'COUNT(*)')), 'bary'); $opw30->showGrid = 1; $opw30->dimensions = '280x100';
public function listAllServices() { $this->requireGet('hostname'); $db = Database::getDatabase(); $machine_id = $db->getValue('SELECT id FROM hw_cpus WHERE hostname = ' . $db->quote($_GET['hostname']) . ' AND user_id = ' . $this->user->id); if ($machine_id === false) { $this->error('machine does not exist'); } else { $arr = array('services' => array()); $services = DBObject::glob('Service', 'SELECT * FROM hw_services WHERE cpu_id = ' . $machine_id); foreach ($services as $s) { $arr['services'][] = array('type' => $s->type, 'name' => $s->name, 'txt_record' => $s->txt_record, 'port' => $s->port); } $this->out($arr); } }
<?php require 'includes/master.inc.php'; $Auth->requireAdmin('login.php'); $db = Database::getDatabase(); if (isset($_GET['q'])) { $q = $_GET['q']; $_q = $db->escape($q); $search_sql = " AND (username LIKE '%{$_q}%' OR email LIKE '%{$_q}%') "; } else { $q = ''; $search_sql = ''; } $users = DBObject::glob('User', "SELECT * FROM shine_users WHERE 1 = 1 {$search_sql} ORDER BY username"); include 'inc/header.inc.php'; ?> <div id="bd"> <div id="yui-main"> <div class="yui-b"><div class="yui-g"> <div class="block tabs spaces"> <div class="hd"> <ul> <li class="active"><a href="users.php">Users</a></li> <li><a href="user-new.php">Create new user</a></li> </ul> <div class="clear"></div> </div> <div class="bd">
require 'includes/master.inc.php'; $app = new Application($_GET['id']); if (!$app->ok()) { die('Application not found'); } $db = Database::getDatabase(); // This table format is crap, but it future proofs us against Sparkle format changes $ip = $_SERVER['REMOTE_ADDR']; $dt = date("Y-m-d H:i:s"); $db->query("INSERT INTO sparkle_reports (ip, dt) VALUES (:ip, :dt)", array('ip' => $ip, 'dt' => $dt)); $id = $db->insertId(); foreach ($_GET as $k => $v) { $db->query("INSERT INTO sparkle_data (sparkle_id, `key`, data) VALUES (:id, :k, :v)", array('id' => $id, 'k' => $k, 'v' => $v)); } $versions = DBObject::glob('Version', "SELECT * FROM versions WHERE app_id = '{$app->id}' ORDER BY dt DESC LIMIT 10"); header("Content-type: application/xml"); echo '<'; ?> ?xml version="1.0" encoding="utf-8"?> <rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" xmlns:dc="http://purl.org/dc/elements/1.1/"> <channel> <title><?php echo $app->name; ?> Changelog</title> <link><?php echo $app->link; ?> </link> <description>Most recent changes with links to updates.</description>
<?php require 'includes/master.inc.php'; $Auth->requireAdmin('login.php'); $applications = DBObject::glob('Application', 'SELECT * FROM applications ORDER BY name'); $db = Database::getDatabase(); $keys = $db->getValues("SELECT DISTINCT(`key`) FROM sparkle_data"); $charts = array(); foreach ($keys as $k) { $data = array(); $rows = $db->getRows("SELECT COUNT(*) as num, `data` FROM sparkle_data WHERE `key` = '{$k}' GROUP BY `data` ORDER BY num DESC"); $count = 0; $total = 0; foreach ($rows as $row) { if ($count++ < 5) { $data[$row['data']] = $row['num']; $total += $row['num']; } } $charts[$k] = $data; } unset($charts['id']); unset($charts['appName']); unset($charts['appVersion']); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Shine</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
$search_sql = " AND (first_name LIKE '%{$_q}%' OR last_name LIKE '%{$_q}%' OR payer_email LIKE '%{$_q}%') "; } else { $q = ''; $search_sql = ''; } if (isset($_GET['id'])) { $app_id = intval($_GET['id']); $total_num_orders = $db->getValue("SELECT COUNT(*) FROM shine_orders WHERE app_id = {$app_id} {$search_sql} ORDER BY dt DESC"); $pager = new Pager(@$_GET['page'], 50, $total_num_orders); $orders = DBObject::glob('Order', "SELECT * FROM shine_orders WHERE app_id = {$app_id} {$search_sql} ORDER BY dt DESC LIMIT {$pager->firstRecord}, {$pager->perPage}"); $where = " AND app_id = {$app_id} "; $app_name = $applications[$app_id]->name; } else { $total_num_orders = $db->getValue("SELECT COUNT(*) FROM shine_orders WHERE 1 = 1 {$search_sql} "); $pager = new Pager(@$_GET['page'], 50, $total_num_orders); $orders = DBObject::glob('Order', "SELECT * FROM shine_orders WHERE 1 = 1 {$search_sql} ORDER BY dt DESC LIMIT {$pager->firstRecord}, {$pager->perPage}"); $where = ''; $app_name = 'All'; } // Orders Per Month $order_totals = $db->getRows("SELECT DATE_FORMAT(dt, '%b') as dtstr, COUNT(*) FROM shine_orders WHERE type = 'PayPal' {$where} GROUP BY CONCAT(YEAR(dt), '-', MONTH(dt)) ORDER BY YEAR(dt) ASC, MONTH(dt) ASC"); $opm = new googleChart(implode(',', gimme($order_totals, 'COUNT(*)')), 'bary'); $opm->showGrid = 1; $opm->dimensions = '280x100'; $opm->setLabelsMinMax(4, 'left'); $opm_fb = clone $opm; $opm_fb->dimensions = '640x400'; // Orders Per Week $order_totals = $db->getRows("SELECT WEEK(dt) as dtstr, COUNT(*) FROM shine_orders WHERE type = 'PayPal' {$where} GROUP BY CONCAT(YEAR(dt), WEEK(dt)) ORDER BY YEAR(dt) ASC, WEEK(dt) ASC"); $opw = new googleChart(implode(',', gimme($order_totals, 'COUNT(*)')), 'bary'); $opw->showGrid = 1;
$t->new = 0; $t->update(); redirect("http://twitter.com/home?status=@{$t->username}%20&in_reply_to={$t->tweet_id}"); } $sql = ''; $app_id = ''; if (isset($_GET['id'])) { $sql = 'AND app_id = ' . intval($_GET['id']); $app_id = intval($_GET['id']); } if (isset($_GET['read'])) { $db = Database::getDatabase(); $db->query("UPDATE tweets SET new = 0 WHERE 1 = 1 {$sql}"); redirect("tweets.php?id={$app_id}"); } $tweets = DBObject::glob('Tweet', "SELECT * FROM tweets WHERE deleted = 0 {$sql} ORDER BY dt DESC"); function twitterfy($str) { // Via http://www.snipe.net/2009/09/php-twitter-clickable-links/ $str = preg_replace("#(^|[\n ])([\\w]+?://[\\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $str); $str = preg_replace("#(^|[\n ])((www|ftp)\\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $str); $str = preg_replace("/@(\\w+)/", "<a href=\"http://www.twitter.com/\\1\" target=\"_blank\">@\\1</a>", $str); $str = preg_replace("/#(\\w+)/", "<a href=\"http://search.twitter.com/search?q=\\1\" target=\"_blank\">#\\1</a>", $str); return $str; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Shine</title>
} // Get related orders $db = Database::getDatabase(); $email = $db->quote($f->email); $orders = DBObject::glob('Order', 'SELECT * FROM shine_orders WHERE payer_email = ' . $email . ' ORDER BY dt DESC'); // Get related feedbacks $email = $db->quote($f->email); $feedbacks = DBObject::glob('Feedback', 'SELECT * FROM shine_feedback WHERE email = ' . $email . ' AND id <> ' . $f->id . ' ORDER BY dt DESC'); // Get related activations $order_ids = array(-1); // -1 prevents sql error when no orders are added to the array foreach ($orders as $o) { $order_ids[] = $o->id; } $order_ids = implode(',', $order_ids); $activations = DBObject::glob('Activation', "SELECT * FROM shine_activations WHERE (order_id IN ({$order_ids})) OR (ip = '{$f->ip}') ORDER BY dt DESC"); include 'inc/header.inc.php'; ?> <div id="bd"> <div id="yui-main"> <div class="yui-b"><div class="yui-g"> <div class="block tabs spaces"> <div class="hd"> <h2>Orders</h2> <ul> <li><a href="feedback.php">All Feedback</a></li> <li><a href="feedback.php?type=support">Support Questions</a></li> <li><a href="feedback.php?type=bug">Bug Reports</a></li> <li><a href="feedback.php?type=feature">Feature Requests</a></li>
protected function getHasMany($key) { $db = Database::getDatabase(); $data = ORMObject::$_data[$this->className][strtolower($key)]; $tmp_obj = new $data['fc'](); if ($data['joined']) { $join_table = $this->joinTable($this->tableName, $tmp_obj->tableName); $data_b = ORMObject::$_data[$tmp_obj->className][strtolower($this->className . 's')]; $sql = "SELECT b.* FROM `{$join_table}` ab LEFT JOIN `{$tmp_obj->tableName}` b ON ab.{$data_b['fk']} = b.{$data_b['pk']} WHERE ab.{$data['fk']} = " . $db->quote($this->{$data['pk']}); return DBObject::glob($data['fc'], $sql); } else { if (isset($data['sort'])) { $sorter = " SORT BY `{$data['sort']}` "; } else { $sorter = ''; } $sql = "SELECT * FROM `{$tmp_obj->tableName}` WHERE `{$data['fk']}` = " . $db->quote($this->id) . $sorter; return DBObject::glob($data['fc'], $sql); } }
$padding = 3; for ($i = 1; $i <= $Pager->numPages; $i++) { $min = $Pager->page - $padding; $max = $Pager->page + $padding; if ($i == 1) { $paging .= '<li><a href="?page=' . $i . $searchAppend . '">«</a></li>' . nl(); } if ($i == $Pager->page) { $paging .= '<li class="active"><a href="#">' . $i . '</a></li>' . nl(); } else { if ($i >= $max xor $i > $min) { $paging .= '<li><a href="?page=' . $i . $searchAppend . '">' . $i . '</a></li>' . nl(); } } if ($i == $Pager->numPages) { $paging .= '<li><a href="?page=' . $Pager->numPages . $searchAppend . '">»</a></li>' . nl(); } } $paging .= '</ul></div>' . nl(); // Build the paging // Build the user list array and pass it into the template $Users = DBObject::glob('Users', 'SELECT * FROM users ' . $search . ' ORDER By username ASC' . $Pager->limits); foreach ($Users as $User) { $userList[$User->id]['email'] = $User->email; $userList[$User->id]['username'] = $User->username; $userList[$User->id]['group'] = $User->level; } // Build the user list Template::setBaseDir('./assets/tmpl'); $html = Template::loadTemplate('layout', array('header' => Template::loadTemplate('header', array('title' => $title, 'user' => $user, 'admin' => $isadmin, 'msg' => $msg, 'selected' => 'users')), 'content' => Template::loadTemplate('users', array('users' => $userList, 'pager' => $paging, 'search' => $searchValue, 'total' => $Pager->numRecords, 'user' => $user, 'admin' => $isadmin, 'page' => $Pager->page, 'update' => $update)), 'footer' => Template::loadTemplate('footer', array('time_start' => $time_start)))); echo $html;
$sparkle_key = $app->sparkle_key; $sparkle_pkey = $app->sparkle_pkey; $ap_key = $app->ap_key; $ap_pkey = $app->ap_pkey; $custom_salt = $app->custom_salt; $from_email = $app->from_email; $email_subject = $app->email_subject; $email_body = $app->email_body; $license_filename = $app->license_filename; $return_url = $app->return_url; $fs_security_key = $app->fs_security_key; $tweet_terms = $app->tweet_terms; $upgrade_app_id = $app->upgrade_app_id; $engine_class_name = $app->engine_class_name; } $upgrade_apps = DBObject::glob('Application', "SELECT * FROM shine_applications WHERE id <> '{$app->id}' ORDER BY name"); $includes_path = DOC_ROOT . '/includes/'; $files = scandir($includes_path); $available_engines = array(); foreach ($files as $fn) { $engine_name = match('/^class\\.engine(..*?)\\.php/', $fn, 1); if ($engine_name !== false) { $available_engines[] = $engine_name; } } $available_engines = implode(', ', $available_engines); include 'inc/header.inc.php'; ?> <div id="bd"> <div id="yui-main">
<?php // This is just a helper script you can use on your website to track // downloads of each version of your app. Set the $app_id variable below, // and this will automatically redirect the user to download the most // recent version of your app. The downloads will be counted and reported // in Shine. require 'includes/master.inc.php'; if (isset($_GET['id'])) { $app_id = $_GET['id']; } else { // So that functionality mirrors what it was before you could specify an app_id $app_id = 1; } $v = DBObject::glob('Version', "SELECT * FROM versions WHERE app_id = {$app_id} ORDER BY dt DESC LIMIT 1"); $v = array_pop($v); $v->downloads++; $v->update(); Download::track(); header('Location: ' . $v->url);
<?php require 'includes/master.inc.php'; $Auth->requireAdmin('login.php'); $nav = 'feedback'; if (isset($_GET['type'])) { $db = Database::getDatabase(); $type = mysql_real_escape_string($_GET['type'], $db->db); $feedback = DBObject::glob('Feedback', "SELECT * FROM shine_feedback WHERE type = '{$type}' ORDER BY dt DESC"); } else { $feedback = DBObject::glob('Feedback', "SELECT * FROM shine_feedback ORDER BY dt DESC"); } include 'inc/header.inc.php'; ?> <div id="bd"> <div id="yui-main"> <div class="yui-b"><div class="yui-g"> <div class="block tabs spaces"> <div class="hd"> <h2>Feedback</h2> <ul> <li <?php if (@$_GET['type'] == '') { ?> class="active"<?php } ?> ><a href="feedback.php">All Feedback</a></li> <li <?php if (@$_GET['type'] == 'support') {
<?php require 'includes/master.inc.php'; $Auth->requireAdmin('login.php'); $nav = 'tickets'; $app = new Application($_GET['app_id']); if (!$app->ok()) { redirect('/tickets/'); } $users = DBObject::glob('user', 'SELECT * FROM shine_users'); $users[0] = new User(); $milestones = DBObject::glob('milestone', "SELECT * FROM shine_milestones WHERE app_id = '{$app->id}'"); $milestones[0] = new Milestone(); $tickets = DBObject::glob('ticket', "SELECT * FROM shine_tickets WHERE app_id = '{$app->id}' ORDER BY dt_created DESC"); include 'inc/header.inc.php'; ?> <div id="bd"> <div id="yui-main"> <div class="yui-b"><div class="yui-g"> <div class="block tabs spaces"> <div class="hd"> <h2><?php echo $a->name; ?> Ticket Summary</h2> <ul> <li><a href="/tickets/app/<?php echo $app->id; ?>
<?php require 'includes/master.inc.php'; $Auth->requireAdmin('login.php'); $nav = 'tickets'; $app = new Application($_GET['app_id']); if (!$app->ok()) { redirect('tickets.php'); } $milestones = DBObject::glob('milestone', "SELECT * FROM shine_milestones WHERE app_id = '{$app->id}' ORDER BY dt_due ASC"); include 'inc/header.inc.php'; ?> <div id="bd"> <div id="yui-main"> <div class="yui-b"><div class="yui-g"> <div class="block tabs spaces"> <div class="hd"> <h2><?php echo $a->name; ?> Ticket Summary</h2> <ul> <li><a href="tickets-app-summary.php?id=<?php echo $app->id; ?> "><?php echo $app->name; ?> Summary</a></li>
public function versions() { return DBObject::glob('Version', "SELECT * FROM shine_versions WHERE app_id = '{$this->id}' ORDER BY dt DESC"); }
} $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(); $db->query("UPDATE shine_tweets SET new = 0 WHERE 1 = 1 {$sql}"); redirect("tweets.php?id={$app_id}"); } $tweets = DBObject::glob('Tweet', "SELECT * FROM shine_tweets WHERE deleted = 0 {$sql} {$group} ORDER BY dt DESC LIMIT 100"); $db = Database::getDatabase(); $available_apps = $db->getValues("SELECT id FROM shine_applications WHERE CHAR_LENGTH(tweet_terms) > 0"); $tweet_terms = $db->getValues("SELECT tweet_terms FROM shine_applications WHERE CHAR_LENGTH(tweet_terms) > 0"); function twitterfy($str) { // Via http://www.snipe.net/2009/09/php-twitter-clickable-links/ $str = preg_replace("#(^|[\n ])([\\w]+?://[\\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $str); $str = preg_replace("#(^|[\n ])((www|ftp)\\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $str); $str = preg_replace("/@(\\w+)/", "<a href=\"http://www.twitter.com/\\1\" target=\"_blank\">@\\1</a>", $str); $str = preg_replace("/#(\\w+)/", "<a href=\"http://search.twitter.com/search?q=\\1\" target=\"_blank\">#\\1</a>", $str); return $str; } include 'inc/header.inc.php'; ?>
$search_sql = " AND (name LIKE '%{$_q}%' OR serial_number LIKE '%{$_q}%' OR ip LIKE '%{$_q}%') "; } else { $q = ''; $search_sql = ''; } if (isset($_GET['id'])) { $app_id = intval($_GET['id']); $total_num_activations = $db->getValue("SELECT COUNT(*) FROM shine_activations WHERE app_id = {$app_id} {$search_sql} ORDER BY dt DESC"); $pager = new Pager(@$_GET['page'], 100, $total_num_activations); $activations = DBObject::glob('Activation', "SELECT * FROM shine_activations WHERE app_id = {$app_id} {$search_sql} ORDER BY dt DESC LIMIT {$pager->firstRecord}, {$pager->perPage}"); $where = " AND app_id = {$app_id} "; $app_name = $applications[$app_id]->name; } else { $total_num_activations = $db->getValue("SELECT COUNT(*) FROM shine_activations WHERE 1 = 1 {$search_sql} "); $pager = new Pager(@$_GET['page'], 100, $total_num_activations); $activations = DBObject::glob('Activation', "SELECT * FROM shine_activations WHERE 1 = 1 {$search_sql} ORDER BY dt DESC LIMIT {$pager->firstRecord}, {$pager->perPage}"); $where = ''; $app_name = 'All'; } $available_apps = $db->getValues("SELECT app_id FROM shine_activations GROUP BY app_id"); $top_emails = $db->getRows("SELECT COUNT(*) as num, name from shine_activations GROUP BY name ORDER BY num DESC LIMIT 5"); $top_serials = $db->getRows("SELECT COUNT(*) as num, serial_number from shine_activations GROUP BY serial_number ORDER BY num DESC LIMIT 5"); $top_ips = $db->getRows("SELECT COUNT(*) as num, ip from shine_activations GROUP BY ip ORDER BY num DESC LIMIT 5"); include 'inc/header.inc.php'; ?> <div id="bd"> <div id="yui-main"> <div class="yui-b"><div class="yui-g">
<?php require 'includes/master.inc.php'; $Auth->requireAdmin('login.php'); $nav = 'tickets'; // Get a list of our apps $apps = DBObject::glob('Application', 'SELECT * FROM shine_applications WHERE hidden = 0 ORDER BY name'); include 'inc/header.inc.php'; ?> <div id="bd"> <div id="yui-main"> <div class="yui-b"><div class="yui-g"> <div class="block"> <div class="hd"> <h2>Your Applications</h2> </div> <div class="bd"> <table> <thead> <tr> <td>Name</td> <td>New Tickets</td> <td>Open Tickets</td> <td>Next Milestone</td> <td>Progress</td> </tr> </thead> <tbody> <?php
public function tagged($tag_name, $sql = '') { $db = Database::getDatabase(); $tag = new Tag($tag_name); if (is_null($tag->id)) { return array(); } return DBObject::glob(get_class($this), "SELECT b.* FROM {$this->tableName}2tags a LEFT JOIN {$this->tableName} b ON a.{$this->tagColumnName} = b.{$this->idColumnName} WHERE a.tag_id = {$tag->id} {$sql}"); }
function changes() { $users = DBObject::glob('user', 'SELECT * FROM shine_users'); $milestones = DBObject::glob('milestone', "SELECT * FROM shine_milestones WHERE app_id = '{$this->app_id}'"); $changes = array(); if ($this->user_from != $this->user_to) { $from = isset($users[$this->user_from]) ? $users[$this->user_from]->username : null; $to = isset($users[$this->user_to]) ? $users[$this->user_to]->username : null; if ($from && $to) { $changes[] = "Reassigned to <span class='noun'>{$to}</span> from <span class='noun'>{$from}</span>"; } elseif ($to) { $changes[] = "Assigned to <span class='noun'>{$to}</span>"; } elseif ($from) { $changes[] = "No longer assigned to <span class='noun'>{$from}</span>"; } } if ($this->milestone_from_id != $this->milestone_to_id) { $from = isset($milestones[$this->milestone_from_id]) ? $milestones[$this->milestone_from_id]->title : null; $to = isset($milestones[$this->milestone_to_id]) ? $milestones[$this->milestone_to_id]->title : null; if ($from && $to) { $changes[] = "Milestone changed from <span class='noun'>{$from}</span> to <span class='noun'>{$to}</span>"; } elseif ($to) { $changes[] = "Milestone changed to <span class='noun'>{$to}</span>"; } elseif ($from) { $changes[] = "Removed from the <span class='noun'>{$from}</span> milestone"; } } if ($this->status_from != $this->status_to) { $changes[] = "Status changed from <span class='noun'>" . ucwords($this->status_from) . "</span> to <span class='noun'>" . ucwords($this->status_to) . "</span>"; } return $changes; }
$subject = cleanerString($subject); if (empty($subject)) { $subject = 'There is no subject'; } //$message = "<html><body>" . nl2br($message) . "</body></html>"; return mail($to, $subject, $message, $headers); } $db = Database::getDatabase(); foreach ($_POST as $key => $val) { $_POST[$key] = mysql_real_escape_string($val, $db->db); } $dt = date('Y-m-d H:i:s'); $query = "INSERT INTO feedback (appname, appversion, systemversion, email, reply, `type`, message, importance, critical, dt, ip, `new`, reguser, regmail) VALUES\n ('{$_POST['appname']}',\n '{$_POST['appversion']}',\n '{$_POST['systemversion']}',\n '{$_POST['email']}',\n '{$_POST['reply']}',\n '{$_POST['type']}',\n '{$_POST['message']}',\n '{$_POST['importance']}',\n '{$_POST['critical']}',\n '{$dt}',\n '{$_SERVER['REMOTE_ADDR']}',\n '1',\n '{$_POST['reguser']}',\n '{$_POST['regmail']}')"; mysql_query($query, $db->db) or die('error'); $feedback_id = $db->insertId(); $app_id = DBObject::glob('Application', "SELECT id FROM applications WHERE name = '{$_POST['appname']}' "); $app = new Application($app_id); // if (!is_null($app->of_email_notify)) { // Format email to external system $full_url = full_url_for_page('feedback-view.php'); $message = "{$_POST['type']} case: " . "{$full_url}?id={$feedback_id} \n"; $message .= "Importance: {$_POST['importance']}\n"; $message .= "Application Name: {$_POST['appname']}\n"; $message .= "Version:{$_POST['appversion']}\n"; $message .= "System Version:{$_POST['systemversion']}\n"; $message .= "Type:{$_POST['type']}\n"; $msg = str_replace("\\n", "\n", $_POST['message']); $message .= "Message:" . $msg . "\n"; $message .= "Importance:{$_POST['importance']}\n"; $message .= "Criticality:{$_POST['critical']}\n"; // error_log(str_hex($_POST['message']));
$o->update(); redirect('order.php?id=' . $o->id); } if (isset($_GET['act']) && $_GET['act'] == 'delete') { $o->delete(); redirect('orders.php'); } if (isset($_POST['btnNotes'])) { $o->notes = $_POST['notes']; $o->update(); redirect('order.php?id=' . $o->id); } $app = new Application($o->app_id); // Get related orders $db = Database::getDatabase(); $orders = DBObject::glob('Order', 'SELECT * FROM shine_orders WHERE payer_email = ' . $db->quote($o->payer_email) . ' AND id <> ' . $o->id . ' ORDER BY dt DESC'); include 'inc/header.inc.php'; ?> <div id="bd"> <div id="yui-main"> <div class="yui-b"><div class="yui-g"> <div class="block"> <div class="hd"> <h2> Order #<?php echo $o->id; ?> <?php if ($o->deactivated == 1) {