Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
David Collinson committed Oct 16, 2013
2 parents 6337a63 + 2429e80 commit f7aa82a
Show file tree
Hide file tree
Showing 80 changed files with 7,119 additions and 588 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
/vendor
composer.phar
composer.lock
.DS_Store
.DS_Store
/app/config/database.php
/app/config/app.php
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ branches:
- master
- develop

before_script: composer install
before_script:
- cp app/config/app.php.sample app/config/app.php
- cp app/config/database.php.sample app/config/database.php
- composer install
script: phpunit --configuration phpunit.xml
6 changes: 5 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Contribution Guidelines

Please submit all issues and pull requests to the [laravel/framework](http://github.com/laravel/framework) repository!
Bug reports go into issues. Be as detailed as possible.

Discussion should ideally be first on IRC (#r/a/[email protected]) and then in a github issue if the discussion has any merit.

Pull request to your heart's content if you fancy doing something that's lacking.
19 changes: 16 additions & 3 deletions app/config/app.php → app/config/app.php.sample
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,20 @@
|
*/

'url' => 'http://localhost',
'url' => 'https://r-a-d.io/dev/',

/*
|--------------------------------------------------------------------------
| Application Base
|--------------------------------------------------------------------------
|
| This is the base URI which the webserver will recognize.
| It is used within views so that the layout generator can provide
| correct URLs to templates when inside a folder (/dev/, /live/, /beta/)
|
*/

'base' => '/dev',

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -79,7 +92,6 @@
*/

'providers' => array(

'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
'Illuminate\Cache\CacheServiceProvider',
Expand Down Expand Up @@ -113,7 +125,7 @@
'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider',
'Illuminate\Workbench\WorkbenchServiceProvider',

'Cartalyst\Sentry\SentryServiceProvider',
),

/*
Expand Down Expand Up @@ -178,6 +190,7 @@
'URL' => 'Illuminate\Support\Facades\URL',
'Validator' => 'Illuminate\Support\Facades\Validator',
'View' => 'Illuminate\Support\Facades\View',
'Sentry' => 'Cartalyst\Sentry\Facades\Laravel\Sentry',

),

Expand Down
2 changes: 1 addition & 1 deletion app/config/database.php → app/config/database.php.sample
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
|
*/

'fetch' => PDO::FETCH_CLASS,
'fetch' => PDO::FETCH_ASSOC,

/*
|--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion app/config/session.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
|
*/

'lifetime' => 120,
'lifetime' => 10080,

/*
|--------------------------------------------------------------------------
Expand Down
70 changes: 70 additions & 0 deletions app/controllers/Admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

class Admin extends BaseController {

/*
|--------------------------------------------------------------------------
| Admin Controller - Split this up maybe?
|--------------------------------------------------------------------------
|
| SUPAH SEKRIT
| Except it's open-sourced. So that means no funky hacks.
| Brace for an ACTUAL DASHBOARD
|
| // Dashboard
| Route::controller('admin', 'AdminController');
|
| MAGIC GOES HERE.
|
*/

public function __construct() {

// Auth, naturally.
//$this->beforeFilter('auth');

// ALL POST/PUT/DELETE REQUIRE CSRF TOKENS.
$this->beforeFilter('csrf', ['on' => ['post', 'put', 'delete']]);

}
protected $layout = "admin";

public function getIndex() {
$this->layout->content = View::make('admin.dashboard')
->with("base", Config::get("app.base", ""));
//->with("user", $this->user);
}

public function getUsers() {}
public function getLogin() {}
public function getLogout() {}
public function getPending() {}
public function getSongs() {}
public function getProfile() {}
public function getSettings() {}
public function getNews() {}
public function getBans() {}
// /admin/dev-functions
public function getDevFunctions() {}



/**
* DELETE functions
* I am well aware that these dont properly adhere to REST.
* TODO (Maybe): fix that.
*/

// DELETE /admin/users?id={id}?
public function deleteUsers() {}

// DELETE /admin/pending?id={id}
public function deletePending() {}

// DELETE /admin/bans?id={id}
public function deleteBans() {}

// DELETE /admin/news?id={id}
public function deleteNews() {}

}
17 changes: 16 additions & 1 deletion app/controllers/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,31 @@

class BaseController extends Controller {

/**
* Retrieve the current theme's identifier.
*
* @return string
*/
protected function getTheme()
{
// TODO: check database access, DJ column will have theme
return "default";
}

/**
* Setup the layout used by the controller.
* Also adds a few required variables.
*
* @return void
*/
protected function setupLayout()
{
if ( ! is_null($this->layout))
{
$this->layout = View::make($this->layout);
// TODO: dynamic source for the themes
$this->layout = View::make($this->layout)
->with("base", Config::get("app.base", ""))
->with("theme", $this->getTheme());
}
}

Expand Down
107 changes: 107 additions & 0 deletions app/controllers/Home.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?php

class Home extends Player {

/*
|--------------------------------------------------------------------------
| Default Home Controller
|--------------------------------------------------------------------------
|
| Default Home Controller.
| Passes in default variables since they are otherwise not available
| in an @section() block.
|
| Route::get('/', 'HomeController@showHome');
|
*/

protected $layout = 'master';


/**
* Builds the homepage queue
*
* @return string
*/
private function makeQueue() {
$curqueue = $this->getQueueArray();

if (!$curqueue)
$curqueue = [
["timestr" => "", "track" => ""],
["timestr" => "", "track" => ""],
["timestr" => "", "track" => ""],
["timestr" => "", "track" => ""],
["timestr" => "", "track" => ""],
];

$html = "";

foreach($curqueue as $queue) {

$queue["meta"] = htmlspecialchars($queue["meta"]);
$diff = Helper::humanTimeDiff($queue["time"]);


if ($queue["type"] == 1)
$queue["meta"] = "<b>" . $queue["meta"] . "</b>";

$html .= <<<QUEUE
<li class="list-group-item">
<div class="container">
<div class="col-md-4">
in {$diff}
</div>
<div class="col-md-8" style="line-height: 1; height: 30px;">
{$queue["meta"]}
</div>
</div>
</li>
QUEUE;
}

return $html;
}

private function makeLastPlayed() {
$last_played = $this->getLastPlayedArray();

$html = "";

foreach ($last_played as $lp) {
$diff = Helper::humanTimeDiff($lp["time"]);
$html .= <<<LP
<li class="list-group-item">
<div class="container">
<div class="col-md-4">
{$diff} ago
</div>
<div class="col-md-8" style="line-height: 1; height: 30px;">
{$lp["meta"]}
</div>
</div>
</li>
LP;
}

return $html;
}


/**
* Show the homepage (and throw in a load of variables)
*
* @return void
*/
public function showHome() {

$this->layout->content = View::make($this->getTheme() . ".home")
->with("base", Config::get("app.base", ""))
->with("theme", $this->getTheme())
->with("queue", $this->makeQueue())
->with("lp", $this->makeLastPlayed());

}

}
24 changes: 0 additions & 24 deletions app/controllers/HomeController.php

This file was deleted.

10 changes: 10 additions & 0 deletions app/controllers/IRC.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

class IRC extends BaseController {

protected $layout = "master";

public function show() {
$this->layout->content = View::make($this->getTheme() . '.irc');
}
}
Loading

0 comments on commit f7aa82a

Please sign in to comment.