-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Download button (#20) * add functioning download button. seems like some of the temperature values are mangled when importing in to tunerstudio but this at least gives the ability to read in the majority of the tune. will troubleshoot the temp issues later * blank out mariadb username and password from local docker, users can set their own as needed * add download link to browse file as well * complete items from @nearwood's code review: delete db/msqur-4.sql, revert script.config.dist, update src/browse.php to have a capital D for Download and use the floppy emoji in place of download MSQ text, drop null xml check from src/db.php.getMSQForDownload function, change content-type header to application/xml in src/download.php, use floppy emoji in download link in src/msq.php * remove duplicate DB_USER param from script.config.dist * oops: forgot to commit changes to config.php.dist switching DB_HOST and DB_USERNAME back to original settings * Move deploy prereqs to deploy script * Update README * Fix links * Update copyright
- Loading branch information
Showing
19 changed files
with
117 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,63 @@ | ||
# MSQur # | ||
# MSQur | ||
|
||
'Masker' I guess? Supposed to be a play on imgur. | ||
MegaSquirt MSQ file sharing and viewing site. | ||
|
||
Parses MSQ "XML" in tandem with an associated INI (config) file and displays it in a familiar format for viewing and comparing. | ||
|
||
Try it now at: http://msqur.com/ | ||
Try it now at: https://msqur.com/ | ||
|
||
### Build Status: | ||
* msqur.com [![Build Status](https://travis-ci.org/nearwood/msqur.svg?branch=msqur.com)](https://travis-ci.org/nearwood/msqur) | ||
* master [![Build Status](https://travis-ci.org/nearwood/msqur.svg?branch=master)](https://travis-ci.org/nearwood/msqur) | ||
|
||
### Installation ### | ||
### Installation | ||
|
||
#### Needed software #### | ||
#### Needed software | ||
|
||
* AMP Stack: Apache, MySQL (MariaDB), PHP | ||
* MariaDB, PHP | ||
* PDO extension for PHP. | ||
|
||
#### Recommended software #### | ||
#### Recommended software | ||
|
||
* phpMyAdmin - For managing the DB | ||
* rsync - For the deployment script | ||
|
||
#### Development Setup #### | ||
#### Development Setup | ||
|
||
> These steps could be improved | ||
1. Clone repo to dev directory | ||
1. Copy script.config.dist to script.config | ||
1. Copy src/config.php.dist to src/config.php | ||
1. Create database for msqur, and assign it a user | ||
1. Setup parameters in each config file | ||
1. Update DB with update scripts in sequential order | ||
1. Run deploy script | ||
1. Hit webserver to start using it. | ||
1. Copy script.config.dist to script.config and modify for use (setup DB connection information) | ||
1. Copy src/config.php.dist to src/config.php (setup DB information again) | ||
1. Update DB with update scripts in sequential order (patse into phpMyAdmin or piped to `sqlcmd`, etc.) | ||
1. Hit webserver to start using it (eg. `php -S`, etc.) | ||
|
||
### Update & Deployment Instructions | ||
|
||
### Update & Deployment Instructions ### | ||
> These steps are outdated | ||
* Pull updates on host. | ||
* Update any configuration files (config.php, script.config) if needed. | ||
* Run any new DB scripts. | ||
* Run deploy.sh to copy web files to web server. | ||
|
||
### License ### | ||
### License | ||
|
||
msqur is licensed under the GPL v3.0. A copy of this license is included in the LICENSE.md file in the source tree. | ||
|
||
### Who do I talk to? ### | ||
### Who do I talk to? | ||
|
||
* Nicholas Earwood | ||
* [email protected] | ||
* http://nearwood.net/ | ||
* https://nearwood.dev/ | ||
|
||
### Credits | ||
|
||
[CamHenlin](https://github.com/CamHenlin) | ||
|
||
> This section needs to be updated | ||
### Credits ### | ||
* Apache | ||
* PHP | ||
* MariaDB | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
/* msqur - MegaSquirt .msq file viewer web application | ||
Copyright (C) 2016 Nicholas Earwood [email protected] http://nearwood.net | ||
Copyright 2014-2019 Nicholas Earwood [email protected] https://nearwood.dev | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
/* msqur - MegaSquirt .msq file viewer web application | ||
Copyright (C) 2016 Nicholas Earwood [email protected] http://nearwood.net | ||
Copyright 2014-2019 Nicholas Earwood [email protected] https://nearwood.dev | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
/* msqur - MegaSquirt .msq file viewer web application | ||
Copyright (C) 2016 Nicholas Earwood [email protected] http://nearwood.net | ||
Copyright 2014-2019 Nicholas Earwood [email protected] https://nearwood.dev | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
/* msqur - MegaSquirt .msq file viewer web application | ||
Copyright (C) 2016 Nicholas Earwood [email protected] http://nearwood.net | ||
Copyright 2014-2019 Nicholas Earwood [email protected] https://nearwood.dev | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
@@ -88,11 +88,11 @@ | |
|
||
echo '<div id="content"><div class="info">' . $numResults . ' results.</div>'; | ||
echo '<table ng-controller="BrowseController">'; | ||
echo '<tr><th>ID</th><th>Engine Make</th><th>Engine Code</th><th>Cylinders</th><th>Liters</th><th>Compression</th><th>Aspiration</th><th>Firmware/Version</th><th>Upload Date</th><th>Views</th></tr>'; | ||
echo '<tr><th>ID</th><th>Download</th><th>Engine Make</th><th>Engine Code</th><th>Cylinders</th><th>Liters</th><th>Compression</th><th>Aspiration</th><th>Firmware/Version</th><th>Upload Date</th><th>Views</th></tr>'; | ||
for ($c = 0; $c < $numResults; $c++) | ||
{ | ||
$aspiration = $results[$c]['induction'] == 1 ? "Turbo" : "NA"; | ||
echo '<tr><td><a href="view.php?msq=' . $results[$c]['mid'] . '">' . $results[$c]['mid'] . '</a></td><td>' . $results[$c]['make'] . '</td><td>' . $results[$c]['code'] . '</td><td>' . $results[$c]['numCylinders'] . '</td><td>' . $results[$c]['displacement'] . '</td><td>' . $results[$c]['compression'] . ':1</td><td>' . $aspiration . '</td><td>' . $results[$c]['firmware'] . '/' . $results[$c]['signature'] . '</td><td>' . $results[$c]['uploadDate'] . '</td><td>' . $results[$c]['views'] . '</td></tr>'; | ||
echo '<tr><td><a href="view.php?msq=' . $results[$c]['mid'] . '">' . $results[$c]['mid'] . '</a></td><td><a href="download.php?msq=' . $results[$c]['mid'] . '">💾</a></td><td>' . $results[$c]['make'] . '</td><td>' . $results[$c]['code'] . '</td><td>' . $results[$c]['numCylinders'] . '</td><td>' . $results[$c]['displacement'] . '</td><td>' . $results[$c]['compression'] . ':1</td><td>' . $aspiration . '</td><td>' . $results[$c]['firmware'] . '/' . $results[$c]['signature'] . '</td><td>' . $results[$c]['uploadDate'] . '</td><td>' . $results[$c]['views'] . '</td></tr>'; | ||
} | ||
echo '</table></div>'; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
/* msqur - MegaSquirt .msq file viewer web application | ||
Copyright (C) 2016 Nicholas Earwood [email protected] http://nearwood.net | ||
Copyright 2014-2019 Nicholas Earwood [email protected] https://nearwood.dev | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
@@ -280,6 +280,40 @@ public function getMSQ($id) | |
return $html; | ||
} | ||
|
||
public function getMSQForDownload($id) | ||
{ | ||
|
||
if (!$this->connect()) return null; | ||
|
||
$xml = FALSE; | ||
|
||
try | ||
{ | ||
$st = $this->db->prepare("SELECT xml FROM msqs INNER JOIN metadata ON metadata.msq = msqs.id WHERE metadata.id = :id LIMIT 1"); | ||
DB::tryBind($st, ":id", $id); | ||
$st->execute(); | ||
if ($st->rowCount() > 0) | ||
{ | ||
$result = $st->fetch(PDO::FETCH_ASSOC); | ||
$st->closeCursor(); | ||
$xml = $result['xml']; | ||
if (DEBUG) debug('<div class="debug">Cached, returning HTML.</div>'); | ||
} | ||
else | ||
{ | ||
echo "<div class=\"debug\">No result for $id</div>"; | ||
echo '<div class="error">Invalid MSQ err 2</div>'; | ||
return null; | ||
} | ||
} | ||
catch (PDOException $e) | ||
{ | ||
$this->dbError($e); | ||
} | ||
|
||
return $xml; | ||
} | ||
|
||
/** | ||
* @brief Get a list of MSQs | ||
* @param $bq The BrowseQuery to filter results | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
/* msqur - MegaSquirt .msq file viewer web application | ||
Copyright 2014-2019 Nicholas Earwood [email protected] https://nearwood.dev | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
|
||
require "msqur.php"; | ||
|
||
if (isset($_GET['msq'])) { | ||
|
||
header('Content-Type: application/xml'); | ||
header('Content-Disposition: attachment; filename=' . $_GET['msq'] . '.msq'); | ||
header('Pragma: no-cache'); | ||
|
||
echo $msqur->getMSQForDownload($_GET['msq']); | ||
} else { | ||
|
||
include "index.php"; | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
/* msqur - MegaSquirt .msq file viewer web application | ||
Copyright (C) 2016 Nicholas Earwood [email protected] http://nearwood.net | ||
Copyright 2014-2019 Nicholas Earwood [email protected] https://nearwood.dev | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
/* msqur - MegaSquirt .msq file viewer web application | ||
Copyright (C) 2016 Nicholas Earwood [email protected] http://nearwood.net | ||
Copyright 2014-2019 Nicholas Earwood [email protected] https://nearwood.dev | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
/* msqur - MegaSquirt .msq file viewer web application | ||
Copyright (C) 2016 Nicholas Earwood [email protected] http://nearwood.net | ||
Copyright 2014-2019 Nicholas Earwood [email protected] https://nearwood.dev | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
@@ -60,6 +60,7 @@ public function parseMSQ($xml, &$engine, &$metadata) | |
$msqHeader .= "<div>MS Signature: " . $msq->versionInfo['signature'] . "</div>"; | ||
$msqHeader .= "<div>Tuning SW: " . $msq->bibliography['author'] . "</div>"; | ||
$msqHeader .= "<div>Date: " . $msq->bibliography['writeDate'] . "</div>"; | ||
$msqHeader .= "<div><a href='download.php?msq=" . $_GET['msq'] . "'>💾</a></div>"; | ||
$msqHeader .= '</div>'; | ||
|
||
$sig = $msq->versionInfo['signature']; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
/* msqur - MegaSquirt .msq file viewer web application | ||
Copyright (C) 2016 Nicholas Earwood [email protected] http://nearwood.net | ||
Copyright 2014-2019 Nicholas Earwood [email protected] https://nearwood.dev | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
@@ -43,6 +43,12 @@ public function getMSQ($id) | |
return $this->db->getMSQ($id); | ||
} | ||
|
||
public function getMSQForDownload($id) | ||
{ | ||
|
||
return $this->db->getMSQForDownload($id); | ||
} | ||
|
||
public function addMSQs($files, $engineid) | ||
{ | ||
$fileList = array(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
/* msqur - MegaSquirt .msq file viewer web application | ||
Copyright (C) 2016 Nicholas Earwood [email protected] http://nearwood.net | ||
Copyright 2014-2019 Nicholas Earwood [email protected] https://nearwood.dev | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
/* msqur - MegaSquirt .msq file viewer web application | ||
Copyright (C) 2016 Nicholas Earwood [email protected] http://nearwood.net | ||
Copyright 2014-2019 Nicholas Earwood [email protected] https://nearwood.dev | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
/* msqur - MegaSquirt .msq file viewer web application | ||
Copyright (C) 2016 Nicholas Earwood [email protected] http://nearwood.net | ||
Copyright 2014-2019 Nicholas Earwood [email protected] https://nearwood.dev | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
/* msqur - MegaSquirt .msq file viewer web application | ||
Copyright (C) 2016 Nicholas Earwood [email protected] http://nearwood.net | ||
Copyright 2014-2019 Nicholas Earwood [email protected] https://nearwood.dev | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* msqur - MegaSquirt .msq file viewer web application | ||
Copyright (C) 2015 Nicholas Earwood [email protected] http://nearwood.net | ||
Copyright 2014-2019 Nicholas Earwood [email protected] https://nearwood.dev | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* msqur - MegaSquirt .msq file viewer web application | ||
Copyright (C) 2015 Nicholas Earwood [email protected] http://nearwood.net | ||
Copyright 2014-2019 Nicholas Earwood [email protected] https://nearwood.dev | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|