basic post commit test

This commit is contained in:
Jeremy Kauffman 2015-10-25 12:01:04 -04:00
parent dd04216aba
commit 0d0754c993
3 changed files with 21 additions and 3 deletions

2
.gitignore vendored
View file

@ -1,7 +1,7 @@
/web/.sass-cache
/web/css
/log
/data/access_list.php
/data/secret
/web/zohoverify
nbproject

View file

@ -33,9 +33,20 @@ class Actions
return ['page/get-denied', ['inviteError' => $inviteError]];
}
public function executePostCommit()
{
$payload = json_decode($_REQUEST['payload']);
$secret = file_get_contents('data/secret/github-secret');
$isToMaster = $payload->ref === 'refs/heads/master';
file_put_contents('github.txt', ($isToMaster ? 'master' : 'apprentince') . "\n$secret\n" . print_r($payload, TRUE), FILE_APPEND);
return [null, []];
}
protected function validateDownloadAccess()
{
$seshionKey = 'buttsz';
$seshionKey = 'has-download-access';
if ($this->session->get($seshionKey))
{
return true;
@ -43,7 +54,7 @@ class Actions
if ($_SERVER['REQUEST_METHOD'] === 'POST')
{
$this->accessCodes = include $_SERVER['ROOT_DIR'] . '/data/access_list.php';
$this->accessCodes = include $_SERVER['ROOT_DIR'] . '/data/secret/access_list.php';
$today = date('Y-m-d H:i:s');
foreach($this->accessCodes as $code => $date)
{

View file

@ -13,6 +13,11 @@ class Controller
{
list($viewTemplate, $viewParameters) = static::execute($uri);
if ($viewTemplate === null)
{
return '';
}
if (!$viewTemplate)
{
throw new LogicException('All execute methods must return a template.');
@ -37,6 +42,8 @@ class Controller
return $action->executeHome();
case '/get':
return $action->executeGet();
case '/postcommit':
return $action->executePostCommit();
default:
if (View::exists('page/' . ltrim($uri, '/')))
{