Add permissions checks everywhere;

This commit is contained in:
Benjamin Bouvier 2017-05-22 17:47:32 +02:00
Родитель dcdf2ba2e3
Коммит 443bba25a8
34 изменённых файлов: 240 добавлений и 334 удалений

Просмотреть файл

@ -1,104 +0,0 @@
<?php
/**
* Verification library for the BrowserID / Persona authentication system
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* @category Auth
* @package Auth_BrowserID
* @author Francois Marier <francois@mozilla.com>
* @copyright 2013 Mozilla Foundation
* @license http://mozilla.org/MPL/2.0/
* @link http://pear.php.net/package/Auth_BrowserID
* @since File available since Release 0.1.0
*/
class Auth_BrowserID
{
/**
* Scheme, hostname and port
*/
protected $audience;
/**
* Verification type: 'local' or 'remote'
*/
protected $type;
/**
* URL of the remote verifier
*/
protected $verifierUrl;
/**
* Constructor
*
* @param string $audience The scheme, hostname and port of the server
* @param string $type The type of verification ('local' or 'remote')
* @param string $verifierUrl The URL to use for remote verification
*/
public function __construct($audience, $type = 'remote', $verifierUrl = 'https://verifier.login.persona.org/verify')
{
$this->audience = $audience;
$this->type = $type;
$this->verifierUrl = $verifierUrl;
}
/**
* Verify the validity of the assertion received from the user
*
* @param string $assertion The assertion as received from the login dialog
* @param boolean $type The type of verification ('local' or 'remote')
* @return object The response from the Persona online verifier
*/
public function verifyAssertion($assertion)
{
if ($this->type === 'local') {
return $this->verifyLocally($assertion);
} else {
return $this->verifyRemotely($assertion);
}
}
/**
* Contact the identity provider directly when verifying the
* validity of the assertion.
*
* @param string $assertion The assertion as received from the login dialog
* @return object The response from the Persona online verifier
*/
private function verifyLocally($assertion)
{
// Mozilla currently recommends against local verification
// since the details of the certificate format are not yet finalized and
// may change.
throw new Exception("Not implemented.");
}
/**
* Use the verification service at verifier.login.persona.org to
* verify the validity of the assertion.
*
* @param string $assertion The assertion as received from the login dialog
* @return object The response from the Persona online verifier
*/
private function verifyRemotely($assertion)
{
$postdata = 'assertion=' . urlencode($assertion) . '&audience=' . urlencode($this->audience);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->verifierUrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response);
}
}

Просмотреть файл

@ -6,7 +6,7 @@
if (strpos($_SERVER['SCRIPT_FILENAME'], "UPDATE.php") !== false) if (strpos($_SERVER['SCRIPT_FILENAME'], "UPDATE.php") !== false)
die("Please rename this file to something more unknown."); die("Please rename this file to something more unknown.");
require_once("internals.php"); require_once("lib/internals.php");
init_database(); init_database();

Просмотреть файл

@ -35,11 +35,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("internals.php"); require_once("lib/internals.php");
check_permissions();
if (!has_permissions()) {
die("You need to be logged in.");
}
require_once("lib/DB/Mode.php"); require_once("lib/DB/Mode.php");
require_once("lib/DB/Machine.php"); require_once("lib/DB/Machine.php");

Просмотреть файл

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("internals.php"); require_once("lib/internals.php");
require_once("regressions/data-func.php"); require_once("regressions/data-func.php");
init_database(); init_database();
@ -11,41 +11,42 @@ $subtest = GET_bool("subtest");
$id = GET_int("id"); $id = GET_int("id");
if ($subtest) { if ($subtest) {
$score_id = get("breakdown", $id, "score_id"); $score_id = get("breakdown", $id, "score_id");
$prev_breakdown_id = imm_prev_suite_test($id); $prev_breakdown_id = imm_prev_suite_test($id);
$prev_score_id = get("breakdown", $prev_breakdown_id, "score_id"); $prev_score_id = get("breakdown", $prev_breakdown_id, "score_id");
$prev_build_id = get("score", $prev_score_id, "build_id"); $prev_build_id = get("score", $prev_score_id, "build_id");
$query = mysql_query("SELECT awfy_regression.id, noise, status $query = mysql_query("SELECT awfy_regression.id, noise, status
FROM `awfy_regression_breakdown` FROM `awfy_regression_breakdown`
LEFT JOIN awfy_regression LEFT JOIN awfy_regression
ON awfy_regression.id = awfy_regression_breakdown.regression_id ON awfy_regression.id = awfy_regression_breakdown.regression_id
WHERE breakdown_id = ".$id." AND WHERE breakdown_id = ".$id." AND
prev_build_id = ".$prev_build_id); prev_build_id = ".$prev_build_id);
} else { } else {
$score_id = $id; $score_id = $id;
$prev_score_id = imm_prev_($id); $prev_score_id = imm_prev_($id);
$prev_build_id = get("score", $prev_score_id, "build_id"); $prev_build_id = get("score", $prev_score_id, "build_id");
$query = mysql_query("SELECT awfy_regression.id, noise, status $query = mysql_query("SELECT awfy_regression.id, noise, status
FROM `awfy_regression_score` FROM `awfy_regression_score`
LEFT JOIN awfy_regression LEFT JOIN awfy_regression
ON awfy_regression.id = awfy_regression_score.regression_id ON awfy_regression.id = awfy_regression_score.regression_id
WHERE score_id = ".$id." AND WHERE score_id = ".$id." AND
prev_build_id = ".$prev_build_id); prev_build_id = ".$prev_build_id);
} }
$data = Array("regression" => Array()); $data = Array("regression" => Array());
if (mysql_num_rows($query) >= 1) { if (mysql_num_rows($query) >= 1) {
$result = mysql_fetch_object($query); $result = mysql_fetch_object($query);
$data["regression"]["id"] = $result->id; $data["regression"]["id"] = $result->id;
if ($result->noise) if ($result->noise)
$data["regression"]["status"] = "noise"; $data["regression"]["status"] = "noise";
else else
$data["regression"]["status"] = $result->status; $data["regression"]["status"] = $result->status;
} else { } else {
$data["regression"]["status"] = "no"; $data["regression"]["status"] = "no";
} }
$data["info"] = get("score", $score_id, "extra_info"); $data["info"] = get("score", $score_id, "extra_info");
echo json_encode($data); echo json_encode($data);

Просмотреть файл

@ -1,6 +1,6 @@
<?php <?php
include "internals.php"; include "lib/internals.php";
global $config; global $config;

Просмотреть файл

@ -1,27 +1,27 @@
<?php <?php
class Slack { class Slack {
// (string) $message - message to be passed to Slack // (string) $message - message to be passed to Slack
// (string) $icon - You can set up custom emoji icons to use with each message // (string) $icon - You can set up custom emoji icons to use with each message
public static function log($message, $icon = ":longbox:") public static function log($message, $icon = ":longbox:")
{ {
global $config; global $config;
$data = "payload=" . json_encode(array( $data = "payload=" . json_encode(array(
"text" => $message, "text" => $message,
"icon_emoji" => $icon "icon_emoji" => $icon
)); ));
// You can get your webhook endpoint from your Slack settings // You can get your webhook endpoint from your Slack settings
$url = $config->slack_webhook; $url = $config->slack_webhook;
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch); $result = curl_exec($ch);
curl_close($ch); curl_close($ch);
return $result; return $result;
} }
} }

Просмотреть файл

@ -35,7 +35,7 @@ class Config {
} }
function throw_exception($exception) { function throw_exception($exception) {
throw new Exception($exception); throw new Exception($exception);
} }
function init_database() function init_database()
@ -49,8 +49,8 @@ function username()
{ {
if (!isset($_SESSION['persona'])) if (!isset($_SESSION['persona']))
return "guest"; return "guest";
else
return $_SESSION['persona']; return $_SESSION['persona'];
} }
function has_permissions() function has_permissions()
@ -61,20 +61,28 @@ function has_permissions()
# Test here which persons have permission to see all benchmarks # Test here which persons have permission to see all benchmarks
if (preg_match("/^[0-9A-Za-z.]*@mozilla\.com$/", $_SESSION['persona'])) { if (preg_match("/^[0-9A-Za-z.]*@mozilla\.com$/", $_SESSION['persona'])) {
return true; return true;
} else { }
$split = explode("@", $_SESSION['persona'], 2);
if ($split[1] == "gmail.com") { $split = explode("@", $_SESSION['persona'], 2);
if ($split[0] == "hv1989")
return true; if ($split[0] == 'hv1989' && split[1] == "gmail.com") {
} else if ($split[1] == "googlemail.com") { return true;
if ($split[0] == "evilpies") }
return true;
} if ($split[0] == "evilpies" && $split[1] == "googlemail.com") {
} return true;
}
return false; return false;
} }
function check_permissions()
{
if (!has_permissions()) {
die('You must be logged in to visit this page.');
}
}
function GET_bool($name) function GET_bool($name)
{ {
if (isset($_GET[$name])) if (isset($_GET[$name]))
@ -192,66 +200,66 @@ function awfy_query($query)
return $result; return $result;
} }
if (!function_exists("mysql_connect")){ if (!function_exists("mysql_connect")) {
/* warning: fatal error "cannot redeclare" if a function was disabled in php.ini with disable_functions: /* warning: fatal error "cannot redeclare" if a function was disabled in php.ini with disable_functions:
disable_functions =mysql_connect,mysql_pconnect,mysql_select_db,mysql_ping,mysql_query,mysql_fetch_assoc,mysql_num_rows,mysql_fetch_array,mysql_error,mysql_insert_id,mysql_close,mysql_real_escape_string,mysql_data_seek,mysql_result disable_functions =mysql_connect,mysql_pconnect,mysql_select_db,mysql_ping,mysql_query,mysql_fetch_assoc,mysql_num_rows,mysql_fetch_array,mysql_error,mysql_insert_id,mysql_close,mysql_real_escape_string,mysql_data_seek,mysql_result
*/ */
function mysql_connect($host, $username, $password){ function mysql_connect($host, $username, $password){
global $dbconnect; global $dbconnect;
$dbconnect = mysqli_connect($host, $username, $password); $dbconnect = mysqli_connect($host, $username, $password);
return $dbconnect; return $dbconnect;
} }
function mysql_pconnect($host, $username, $password){ function mysql_pconnect($host, $username, $password){
global $dbconnect; global $dbconnect;
$dbconnect = mysqli_connect("p:".$host, $username, $password); $dbconnect = mysqli_connect("p:".$host, $username, $password);
return $dbconnect; return $dbconnect;
} }
function mysql_select_db($db){ function mysql_select_db($db){
global $dbconnect; global $dbconnect;
return mysqli_select_db ( $dbconnect,$db ); return mysqli_select_db ( $dbconnect,$db );
} }
function mysql_ping($dbconnect){ function mysql_ping($dbconnect){
return mysqli_ping ( $dbconnect ); return mysqli_ping ( $dbconnect );
} }
function mysql_query($stmt){ function mysql_query($stmt){
global $dbconnect; global $dbconnect;
return mysqli_query ($dbconnect, $stmt ); return mysqli_query ($dbconnect, $stmt );
} }
function mysql_fetch_assoc($erg){ function mysql_fetch_assoc($erg){
return mysqli_fetch_assoc ($erg ); return mysqli_fetch_assoc ($erg );
} }
function mysql_num_rows($e){ function mysql_num_rows($e){
return mysqli_num_rows ($e ); return mysqli_num_rows ($e );
} }
function mysql_affected_rows($e=NULL){ function mysql_affected_rows($e=NULL){
return mysqli_affected_rows ($e ); return mysqli_affected_rows ($e );
} }
function mysql_fetch_array($e){ function mysql_fetch_array($e){
return mysqli_fetch_array ($e ); return mysqli_fetch_array ($e );
} }
function mysql_error(){ function mysql_error(){
global $dbconnect; global $dbconnect;
return mysqli_error ($dbconnect); return mysqli_error ($dbconnect);
} }
function mysql_insert_id(){ function mysql_insert_id(){
global $dbconnect; global $dbconnect;
return mysqli_insert_id ($dbconnect); return mysqli_insert_id ($dbconnect);
} }
function mysql_close(){ function mysql_close(){
return true; return true;
} }
function mysql_escape_string($s){ function mysql_escape_string($s){
global $dbconnect; global $dbconnect;
return mysqli_real_escape_string($dbconnect,$s); return mysqli_real_escape_string($dbconnect,$s);
} }
function mysql_real_escape_string($s){ function mysql_real_escape_string($s){
global $dbconnect; global $dbconnect;
return mysqli_real_escape_string($dbconnect,$s); return mysqli_real_escape_string($dbconnect,$s);
} }
function mysql_data_seek($re,$row){ function mysql_data_seek($re,$row){
return mysqli_data_seek($re,$row); return mysqli_data_seek($re,$row);
} }
function mysql_result($res,$row=0,$col=0){ function mysql_result($res,$row=0,$col=0){
$numrows = mysqli_num_rows($res); $numrows = mysqli_num_rows($res);
if ($numrows && $row <= ($numrows-1) && $row >=0){ if ($numrows && $row <= ($numrows-1) && $row >=0){

Просмотреть файл

@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include "../internals.php"; include "../lib/internals.php";
init_database(); init_database();

Просмотреть файл

@ -6,7 +6,7 @@
error_reporting(-1); error_reporting(-1);
include "../internals.php"; include "../lib/internals.php";
init_database(); init_database();

Просмотреть файл

@ -39,6 +39,7 @@
</header> </header>
<div class='container content' ng-view><div> <div class='container content' ng-view><div>
<script> <script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@ -47,23 +48,7 @@
ga('create', 'UA-58850314-2', 'auto'); ga('create', 'UA-58850314-2', 'auto');
ga('send', 'pageview'); ga('send', 'pageview');
</script> </script>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//arewefastyet.com/piwik/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//arewefastyet.com/piwik/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
</body> </body>
</html> </html>

Просмотреть файл

@ -3,13 +3,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php"); require_once("../lib/internals.php");
check_permissions();
init_database(); init_database();
if (!has_permissions())
die();
$postdata = file_get_contents("php://input"); $postdata = file_get_contents("php://input");
$request = json_decode($postdata); $request = json_decode($postdata);

Просмотреть файл

@ -3,13 +3,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php"); require_once("../lib/internals.php");
check_permissions();
init_database(); init_database();
if (!has_permissions())
die();
$postdata = file_get_contents("php://input"); $postdata = file_get_contents("php://input");
$request = json_decode($postdata); $request = json_decode($postdata);

Просмотреть файл

@ -3,19 +3,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php"); require_once("../lib/internals.php");
check_permissions();
init_database(); init_database();
if (!has_permissions())
die();
$postdata = file_get_contents("php://input"); $postdata = file_get_contents("php://input");
$request = json_decode($postdata); $request = json_decode($postdata);
$regression_id = (int)$request->regression_id; $regression_id = (int)$request->regression_id;
foreach($request->noise->score as $score_id => $noise) { foreach($request->noise->score as $score_id => $noise) {
$noise = (int)$noise; $noise = (int)$noise;
$score_id = (int)$score_id; $score_id = (int)$score_id;
$query = mysql_query("UPDATE awfy_regression_score SET noise = $noise $query = mysql_query("UPDATE awfy_regression_score SET noise = $noise
@ -24,7 +22,7 @@ foreach($request->noise->score as $score_id => $noise) {
") or die(mysql_error()); ") or die(mysql_error());
} }
foreach($request->noise->breakdown as $score_id => $noise) { foreach($request->noise->breakdown as $score_id => $noise) {
$noise = (int)$noise; $noise = (int)$noise;
$score_id = (int)$score_id; $score_id = (int)$score_id;
$query = mysql_query("UPDATE awfy_regression_breakdown SET noise = $noise $query = mysql_query("UPDATE awfy_regression_breakdown SET noise = $noise

Просмотреть файл

@ -3,13 +3,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php"); require_once("../lib/internals.php");
check_permissions();
init_database(); init_database();
if (!has_permissions())
die();
$postdata = file_get_contents("php://input"); $postdata = file_get_contents("php://input");
$request = json_decode($postdata); $request = json_decode($postdata);
@ -22,7 +20,6 @@ $query = mysql_query("UPDATE awfy_regression SET status = '$status' WHERE id = $
$extra = "Changed status to ".$status; $extra = "Changed status to ".$status;
$query = mysql_query("INSERT INTO awfy_regression_status $query = mysql_query("INSERT INTO awfy_regression_status
(regression_id, name, extra, stamp) (regression_id, name, extra, stamp)
VALUES VALUES
('$regression_id', '$name', '$extra', UNIX_TIMESTAMP()) ('$regression_id', '$name', '$extra', UNIX_TIMESTAMP())
") or die(mysql_error()); ") or die(mysql_error());

Просмотреть файл

@ -3,6 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../lib/internals.php");
check_permissions();
function prev_($sort_order_id, $machine, $mode, $suite, $limit = 1) { function prev_($sort_order_id, $machine, $mode, $suite, $limit = 1) {
$limit = (int) $limit; $limit = (int) $limit;
$query = "SELECT awfy_score.id, score, cset $query = "SELECT awfy_score.id, score, cset

Просмотреть файл

@ -3,44 +3,48 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php"); require_once("../lib/internals.php");
check_permissions();
require_once("data-func.php"); require_once("data-func.php");
init_database(); init_database();
$amount = Array(); $amount = Array();
$query = mysql_query("SELECT awfy_regression.id, build_id FROM awfy_regression $query = mysql_query("SELECT awfy_regression.id, build_id FROM awfy_regression
INNER JOIN awfy_build ON awfy_build.id = build_id INNER JOIN awfy_build ON awfy_build.id = build_id
WHERE (mode_id = 14 OR WHERE (mode_id = 14 OR
mode_id = 28 or mode_id = 28 or
mode_id = 33 or mode_id = 33 or
mode_id = 26 or mode_id = 26 or
mode_id = 32 or mode_id = 32 or
mode_id = 20) AND mode_id = 20) AND
status != 'fixed' AND status != 'improvement'"); status != 'fixed' AND status != 'improvement'");
while ($regs = mysql_fetch_object($query)) { while ($regs = mysql_fetch_object($query)) {
$qScore = mysql_query("SELECT count(*) as count FROM awfy_regression_score $qScore = mysql_query("SELECT count(*) as count FROM awfy_regression_score
WHERE regression_id = ".$regs->id); WHERE regression_id = ".$regs->id);
$score = mysql_fetch_object($qScore); $score = mysql_fetch_object($qScore);
$qBreakdown = mysql_query("SELECT count(*) as count FROM awfy_regression_breakdown $qBreakdown = mysql_query("SELECT count(*) as count FROM awfy_regression_breakdown
WHERE regression_id = ".$regs->id); WHERE regression_id = ".$regs->id);
$breakdown = mysql_fetch_object($qBreakdown); $breakdown = mysql_fetch_object($qBreakdown);
$qDate = mysql_query("SELECT finish_stamp FROM awfy_build $qDate = mysql_query("SELECT finish_stamp FROM awfy_build
LEFT JOIN awfy_run ON awfy_run.id = awfy_build.run_id LEFT JOIN awfy_run ON awfy_run.id = awfy_build.run_id
WHERE awfy_build.id = ".$regs->build_id); WHERE awfy_build.id = ".$regs->build_id);
$date = mysql_fetch_object($qDate); $date = mysql_fetch_object($qDate);
$date_str = date("Y", $date->finish_stamp).",".(date("m", $date->finish_stamp)*1-1).",".date("d", $date->finish_stamp); $date_str = date("Y", $date->finish_stamp).",".(date("m", $date->finish_stamp)*1-1).",".date("d", $date->finish_stamp);
$amount[$date_str] += $score->count + $breakdown->count; $amount[$date_str] += $score->count + $breakdown->count;
} }
echo "["; echo "[";
$first = true; $first = true;
foreach ($amount as $key => $value) { foreach ($amount as $key => $value) {
if (!$first) if (!$first)
echo ','; echo ',';
echo '{"c":[{"v":"Date('.$key.')"},{"v":'.$value.'}]}'; echo '{"c":[{"v":"Date('.$key.')"},{"v":'.$value.'}]}';
$first = false; $first = false;
} }
echo "]"; echo "]";
?> ?>

Просмотреть файл

@ -3,7 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php"); require_once("../lib/internals.php");
check_permissions();
init_database(); init_database();
require_once("../lib/ScoreTools.php"); require_once("../lib/ScoreTools.php");
@ -24,4 +26,4 @@ else
$list = ScoreTools::nextList($score, (int)$request->amount); $list = ScoreTools::nextList($score, (int)$request->amount);
$last = array_pop($list); $last = array_pop($list);
echo ScoreTools::build($last)->run()->approx_stamp(); echo ScoreTools::build($last)->run()->approx_stamp();

Просмотреть файл

@ -3,7 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php"); require_once("../lib/internals.php");
check_permissions();
init_database(); init_database();
require_once("data-func.php"); require_once("data-func.php");

Просмотреть файл

@ -3,7 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php"); require_once("../lib/internals.php");
check_permissions();
require_once("../lib/DB/Regression.php"); require_once("../lib/DB/Regression.php");
require_once("../lib/VersionControl.php"); require_once("../lib/VersionControl.php");

Просмотреть файл

@ -3,7 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php"); require_once("../lib/internals.php");
check_permissions();
init_database(); init_database();
@ -13,11 +14,12 @@ $request = json_decode($postdata);
$query = mysql_query("SELECT * $query = mysql_query("SELECT *
FROM awfy_regression_status FROM awfy_regression_status
WHERE regression_id = '".(int)$request->id."' WHERE regression_id = '".(int)$request->id."'
ORDER BY stamp DESC") or die(mysql_error()); ORDER BY stamp DESC") or die(mysql_error());
$data = array(); $data = array();
while ($output = mysql_fetch_assoc($query)) { while ($output = mysql_fetch_assoc($query)) {
$data[] = $output; $data[] = $output;
} }
echo json_encode($data); echo json_encode($data);

Просмотреть файл

@ -3,7 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php"); require_once("../lib/internals.php");
check_permissions();
init_database(); init_database();
require_once("data-func.php"); require_once("data-func.php");
@ -19,10 +21,10 @@ $ids = array();
$single = true; $single = true;
if (isset($request->ids)) { if (isset($request->ids)) {
for ($i=0; $i < count($request->ids); $i++) for ($i=0; $i < count($request->ids); $i++)
$ids[] = (int)$request->ids[$i]; $ids[] = (int)$request->ids[$i];
$single = false; $single = false;
} else { } else {
$ids[] = (int)$request->id; $ids[] = (int)$request->id;
} }
$minimal = isset($request->minimal) ? !!$request->minimal : false; $minimal = isset($request->minimal) ? !!$request->minimal : false;

Просмотреть файл

@ -3,7 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php"); require_once("../lib/internals.php");
check_permissions();
require_once("data-func.php"); require_once("data-func.php");
init_database(); init_database();

Просмотреть файл

@ -3,7 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php"); require_once("../lib/internals.php");
check_permissions();
require_once("data-func.php"); require_once("data-func.php");
init_database(); init_database();

Просмотреть файл

@ -3,7 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php"); require_once("../lib/internals.php");
check_permissions();
require_once("data-func.php"); require_once("data-func.php");
init_database(); init_database();

Просмотреть файл

@ -3,7 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php"); require_once("../lib/internals.php");
check_permissions();
require_once("data-func.php"); require_once("data-func.php");
init_database(); init_database();

Просмотреть файл

@ -1,3 +1,10 @@
<?php
require_once("../lib/internals.php");
check_permissions();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html ng-app="awfyApp"> <html ng-app="awfyApp">
<head> <head>
@ -58,22 +65,7 @@
ga('create', 'UA-58850314-2', 'auto'); ga('create', 'UA-58850314-2', 'auto');
ga('send', 'pageview'); ga('send', 'pageview');
</script>
</script>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//arewefastyet.com/piwik/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//arewefastyet.com/piwik/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
</body> </body>
</html> </html>

Просмотреть файл

@ -3,7 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php"); require_once("../lib/internals.php");
check_permissions();
require_once("../lib/RetriggerController.php"); require_once("../lib/RetriggerController.php");
init_database(); init_database();
@ -22,4 +24,3 @@ $retrigger = RetriggerController::fromMachine($machine_id, $mode_id);
$retrigger->convertToRevision($mode_id, $revision, $run_before_id, $run_after_id); $retrigger->convertToRevision($mode_id, $revision, $run_before_id, $run_after_id);
$retrigger->selectBenchmarks($benchmarks); $retrigger->selectBenchmarks($benchmarks);
$retrigger->enqueueNow(); $retrigger->enqueueNow();

Просмотреть файл

@ -3,7 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php"); require_once("../lib/internals.php");
check_permissions();
require_once("../lib/RetriggerController.php"); require_once("../lib/RetriggerController.php");
require_once("../lib/VersionControl/HGWeb.php"); require_once("../lib/VersionControl/HGWeb.php");
require_once("../lib/DB/ControlTasks.php"); require_once("../lib/DB/ControlTasks.php");

Просмотреть файл

@ -3,7 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php"); require_once("../lib/internals.php");
check_permissions();
require_once("../lib/RetriggerController.php"); require_once("../lib/RetriggerController.php");
require_once("../lib/VersionControl/HGWeb.php"); require_once("../lib/VersionControl/HGWeb.php");
require_once("../lib/DB/ControlTasks.php"); require_once("../lib/DB/ControlTasks.php");

Просмотреть файл

@ -3,7 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php"); require_once("../lib/internals.php");
check_permissions();
require_once("../lib/RetriggerController.php"); require_once("../lib/RetriggerController.php");
require_once("../lib/VersionControl/HGWeb.php"); require_once("../lib/VersionControl/HGWeb.php");
require_once("../lib/DB/ControlTasks.php"); require_once("../lib/DB/ControlTasks.php");

Просмотреть файл

@ -1,3 +1,10 @@
<?php
require_once("../lib/internals.php");
check_permissions();
?>
<html> <html>
<head> <head>
<style> <style>
@ -162,7 +169,7 @@ $(function() {
<label>Benchmarks: <label>Benchmarks:
<select multiple id='benchmarks'> <select multiple id='benchmarks'>
</select> </select>
</label> </label>

Просмотреть файл

@ -41,45 +41,45 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("internals.php"); require_once("lib/internals.php");
check_permissions();
require_once("lib/DB/QueuedTask.php"); require_once("lib/DB/QueuedTask.php");
require_once("lib/DB/TaskRecipe.php"); require_once("lib/DB/TaskRecipe.php");
init_database(); init_database();
if (!has_permissions()) { if (isset($_POST["task"])) {
die("You need to be logged in.");
} else if (isset($_POST["task"])) {
$recipe = new TaskRecipe((int)$_POST["task"]); $recipe = new TaskRecipe((int)$_POST["task"]);
$task = $recipe->fill($_POST); $task = $recipe->fill($_POST);
$email = isset($_POST["email"]) ? username() : ""; $email = isset($_POST["email"]) ? username() : "";
$id = QueuedTask::insert($recipe->control_unit_id(), $task, $email); $id = QueuedTask::insert($recipe->control_unit_id(), $task, $email);
echo "Task submitted. <br />Results will become visible on <a href='https://arewefastyet.com/task_info.php?id=$id'>https://arewefastyet.com/task_info.php?id=$id</a>"; echo "Task submitted. <br />Results will become visible on <a href='https://arewefastyet.com/task_info.php?id=$id'>https://arewefastyet.com/task_info.php?id=$id</a>";
} else { } else {
$recipes = TaskRecipe::all(); $recipes = TaskRecipe::all();
$recipes_json = []; $recipes_json = [];
foreach ($recipes as $recipe) { foreach ($recipes as $recipe) {
$recipes_json[] = array( $recipes_json[] = array(
"id" => $recipe->id, "id" => $recipe->id,
"name" => $recipe->name(), "name" => $recipe->name(),
"description" => $recipe->description(), "description" => $recipe->description(),
"task" => $recipe->task(), "task" => $recipe->task(),
"inputs" => $recipe->inputs() "inputs" => $recipe->inputs()
); );
} }
?> ?>
<script> <script>
var recipes = <?php echo json_encode($recipes_json); ?> var recipes = <?php echo json_encode($recipes_json); ?>
</script> </script>
<form method=POST> <form method=POST>
<h2>Schedule a task</h2> <h2>Schedule a task</h2>
<div class='dashboard_content'></div> <div class='dashboard_content'></div>
<script src='schedule.js'></script> <script src='schedule.js'></script>
<script>init_schedule();</script> <script>init_schedule();</script>
</form> </form>
<?php <?php
} }
?> ?>
</div> </div>

Просмотреть файл

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("internals.php"); require_once("lib/internals.php");
require_once("lib/RetriggerController.php"); require_once("lib/RetriggerController.php");
require_once("lib/DB/TaskQueue.php"); require_once("lib/DB/TaskQueue.php");
require_once("lib/DB/QueuedTask.php"); require_once("lib/DB/QueuedTask.php");
@ -23,14 +23,14 @@ if ($unit = GET_int("unit")) {
RetriggerController::fillQueue($unit); RetriggerController::fillQueue($unit);
$task = $queue->get_oldest_available_queued_task(); $task = $queue->get_oldest_available_queued_task();
if (!$task) { if (!$task) {
echo json_encode(Array( echo json_encode(Array(
"task" => "sleep 60", "task" => "sleep 60",
"id" => 0 "id" => 0
)); ));
sleep(5); sleep(5);
die(); die();
} }
$task->setStarted(); $task->setStarted();
@ -46,13 +46,13 @@ if ($unit = GET_int("unit")) {
$task = new QueuedTask($task_id); $task = new QueuedTask($task_id);
$task->setFinished(); $task->setFinished();
if (isset($_POST["output"])) if (isset($_POST["output"]))
$task->setOutput($_POST["output"]); $task->setOutput($_POST["output"]);
if ($task->hasEmail()) { if ($task->hasEmail()) {
mail($task->email(), "AreWeFastYet task ".$task_id." finished", mail($task->email(), "AreWeFastYet task ".$task_id." finished",
"Task ".$task_id." has finished.\r\n". "Task ".$task_id." has finished.\r\n".
"You can see the results on https://arewefastyet.com/task_info.php?id=".$task_id); "You can see the results on https://arewefastyet.com/task_info.php?id=".$task_id);
} }
die(); die();
} }

Просмотреть файл

@ -35,11 +35,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("internals.php"); require_once("lib/internals.php");
check_permissions();
if (!has_permissions()) {
die("You need to be logged in.");
}
require_once("lib/RetriggerController.php"); require_once("lib/RetriggerController.php");
require_once("lib/DB/TaskQueue.php"); require_once("lib/DB/TaskQueue.php");