Browse Source

add base project files copied from Quill

pull/10/head
Aaron Parecki 6 years ago
commit
46517dd366
40 changed files with 13393 additions and 0 deletions
  1. +3
    -0
      .gitignore
  2. +84
    -0
      README.md
  3. +20
    -0
      composer.json
  4. +420
    -0
      composer.lock
  5. +270
    -0
      controllers/auth.php
  6. +170
    -0
      controllers/controllers.php
  7. +95
    -0
      lib/Savant.php
  8. +14
    -0
      lib/config.template.php
  9. +177
    -0
      lib/helpers.php
  10. +2953
    -0
      lib/markdown.php
  11. +347
    -0
      public/bootstrap/css/bootstrap-theme.css
  12. +1
    -0
      public/bootstrap/css/bootstrap-theme.css.map
  13. +7
    -0
      public/bootstrap/css/bootstrap-theme.min.css
  14. +5785
    -0
      public/bootstrap/css/bootstrap.css
  15. +1
    -0
      public/bootstrap/css/bootstrap.css.map
  16. +7
    -0
      public/bootstrap/css/bootstrap.min.css
  17. BIN
      public/bootstrap/fonts/glyphicons-halflings-regular.eot
  18. +229
    -0
      public/bootstrap/fonts/glyphicons-halflings-regular.svg
  19. BIN
      public/bootstrap/fonts/glyphicons-halflings-regular.ttf
  20. BIN
      public/bootstrap/fonts/glyphicons-halflings-regular.woff
  21. +1951
    -0
      public/bootstrap/js/bootstrap.js
  22. +6
    -0
      public/bootstrap/js/bootstrap.min.js
  23. +192
    -0
      public/css/style.css
  24. BIN
      public/images/spinner.gif
  25. BIN
      public/images/teacup-icon.psd
  26. BIN
      public/images/teacup-logo-144.png
  27. +21
    -0
      public/index.php
  28. +4
    -0
      public/js/jquery-1.7.1.min.js
  29. +6
    -0
      views/add-to-home.php
  30. +73
    -0
      views/auth_callback.php
  31. +58
    -0
      views/auth_start.php
  32. +94
    -0
      views/creating-a-micropub-endpoint.php
  33. +60
    -0
      views/docs.php
  34. +17
    -0
      views/index.php
  35. +89
    -0
      views/layout.php
  36. +226
    -0
      views/new-post.php
  37. +2
    -0
      views/partials/auth-endpoint-help.php
  38. +4
    -0
      views/partials/header.php
  39. +2
    -0
      views/partials/micropub-endpoint-help.php
  40. +5
    -0
      views/partials/token-endpoint-help.php

+ 3
- 0
.gitignore View File

@ -0,0 +1,3 @@
vendor/
.DS_Store
lib/config.php

+ 84
- 0
README.md View File

@ -0,0 +1,84 @@
# Teacup
## Routes
### /
Teacup is a simple app for tracking what you are drinking.
You can post what you're drinking to your own site, or you can post to an account provided by Teacup.
### /auth/start
Copy from Quill.
Discover IndieAuth + Micropub endpoints.
#### Authorize
If a Micropub endpoint is found, show a message with a button to start the authorization flow.
Also provide a button to create an account in case they don't want to use their own site.
#### Create Account
Show a message and provide a button to create an account.
Starts authentication with indieauth.com using the authenication flow.
### /auth/callback
Copy from Quill up to line 200.
If a token endpoint is found, get an access token from it.
If no token endpoint is found, verify the code with indieauth.com and create an account for the user.
### /post/new
The signed-in view used to post new content.
Show the list of drinks that can be posted.
### /post/submit
The form submits here. Saves the post in the database, then tries to make a micropub request if necessary. If the micropub request succeeds, updates the post with the canonical URL in the response.
### /{domain}
Show feed of the user's recent posts. Posts include a link to the canonical URL if appropriate.
### /signout
Destroy session.
## Contributing
By contributing to this project, you agree to irrevocably release your contributions under the same license as this project.
## Credits
## License
Copyright 2013 by Aaron Parecki
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

+ 20
- 0
composer.json View File

@ -0,0 +1,20 @@
{
"require": {
"slim/slim": "2.2.*",
"saltybeagle/savant3": "dev-master",
"j4mie/idiorm": "1.4.*",
"mf2/mf2": "0.1.*",
"indieweb/date-formatter": "0.1.*",
"indieauth/client": "0.1.*",
"mpratt/relativetime": ">=1.0",
"firebase/php-jwt": "dev-master"
},
"autoload": {
"files": [
"lib/Savant.php",
"lib/config.php",
"lib/helpers.php",
"lib/markdown.php"
]
}
}

+ 420
- 0
composer.lock View File

@ -0,0 +1,420 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
"hash": "9bb0e458422964208f350c0332e251c9",
"packages": [
{
"name": "firebase/php-jwt",
"version": "dev-master",
"target-dir": "Firebase/PHP-JWT",
"source": {
"type": "git",
"url": "https://github.com/firebase/php-jwt.git",
"reference": "6e4b99948f79622aad86101c4baeb744d14d5946"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/6e4b99948f79622aad86101c4baeb744d14d5946",
"reference": "6e4b99948f79622aad86101c4baeb744d14d5946",
"shasum": ""
},
"require": {
"php": ">=5.2.0"
},
"type": "library",
"autoload": {
"classmap": [
"Authentication/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Neuman Vong",
"email": "neuman+pear@twilio.com",
"role": "Developer"
},
{
"name": "Anant Narayanan",
"email": "anant@php.net",
"role": "Developer"
}
],
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
"homepage": "https://github.com/firebase/php-jwt",
"time": "2014-09-10 01:49:07"
},
{
"name": "indieauth/client",
"version": "0.1.3",
"source": {
"type": "git",
"url": "https://github.com/indieweb/indieauth-client-php.git",
"reference": "d0a9748aa643d826616ec1b02fb121f4aba0c9fc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/indieweb/indieauth-client-php/zipball/d0a9748aa643d826616ec1b02fb121f4aba0c9fc",
"reference": "d0a9748aa643d826616ec1b02fb121f4aba0c9fc",
"shasum": ""
},
"require": {
"indieweb/link-rel-parser": "0.1.1",
"php": ">5.3.0"
},
"type": "library",
"autoload": {
"psr-0": {
"IndieAuth": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache 2.0"
],
"authors": [
{
"name": "Aaron Parecki",
"homepage": "http://aaronparecki.com"
}
],
"description": "IndieAuth Client Library",
"time": "2014-03-02 21:07:38"
},
{
"name": "indieweb/date-formatter",
"version": "0.1.5",
"source": {
"type": "git",
"url": "https://github.com/indieweb/date-formatter-php.git",
"reference": "f0dc028ba53da4da2718d2a263300396b1c14203"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/indieweb/date-formatter-php/zipball/f0dc028ba53da4da2718d2a263300396b1c14203",
"reference": "f0dc028ba53da4da2718d2a263300396b1c14203",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"autoload": {
"psr-0": {
"IndieWeb": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Aaron Parecki",
"homepage": "http://aaronparecki.com"
}
],
"description": "Render dates and date ranges in a human-readable format, including proper microformats-2 markup",
"homepage": "https://github.com/indieweb/date-formatter-php",
"keywords": [
"date",
"format",
"microformats",
"microformats2"
],
"time": "2013-10-27 23:46:11"
},
{
"name": "indieweb/link-rel-parser",
"version": "0.1.1",
"source": {
"type": "git",
"url": "https://github.com/indieweb/link-rel-parser-php.git",
"reference": "9e0e635fd301a8b1da7bc181f651f029c531dbb6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/indieweb/link-rel-parser-php/zipball/9e0e635fd301a8b1da7bc181f651f029c531dbb6",
"reference": "9e0e635fd301a8b1da7bc181f651f029c531dbb6",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"autoload": {
"files": [
"src/IndieWeb/link_rel_parser.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Aaron Parecki",
"homepage": "http://aaronparecki.com"
},
{
"name": "Tantek Çelik",
"homepage": "http://tantek.com"
}
],
"description": "Parse rel values from HTTP headers",
"homepage": "https://github.com/indieweb/link-rel-parser-php",
"keywords": [
"http",
"indieweb",
"microformats2"
],
"time": "2013-12-23 00:14:58"
},
{
"name": "j4mie/idiorm",
"version": "v1.4.1",
"source": {
"type": "git",
"url": "https://github.com/j4mie/idiorm.git",
"reference": "11e964157a6a2c6128a0546673ad5e99ac1a62cd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/j4mie/idiorm/zipball/11e964157a6a2c6128a0546673ad5e99ac1a62cd",
"reference": "11e964157a6a2c6128a0546673ad5e99ac1a62cd",
"shasum": ""
},
"require": {
"php": ">=5.2.0"
},
"type": "library",
"autoload": {
"classmap": [
"idiorm.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-2-Clause",
"BSD-3-Clause",
"BSD-4-Clause"
],
"authors": [
{
"name": "Simon Holywell",
"email": "treffynnon@php.net",
"homepage": "http://simonholywell.com",
"role": "Maintainer"
},
{
"name": "Jamie Matthews",
"email": "jamie.matthews@gmail.com",
"homepage": "http://j4mie.org",
"role": "Developer"
},
{
"name": "Durham Hale",
"email": "me@durhamhale.com",
"homepage": "http://durhamhale.com",
"role": "Maintainer"
}
],
"description": "A lightweight nearly-zero-configuration object-relational mapper and fluent query builder for PHP5",
"homepage": "http://j4mie.github.com/idiormandparis",
"keywords": [
"idiorm",
"orm",
"query builder"
],
"time": "2013-12-12 10:25:27"
},
{
"name": "mf2/mf2",
"version": "v0.1.23",
"source": {
"type": "git",
"url": "https://github.com/indieweb/php-mf2.git",
"reference": "9094e4f7ad535e0796f5a384dec42bab81393e0e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/indieweb/php-mf2/zipball/9094e4f7ad535e0796f5a384dec42bab81393e0e",
"reference": "9094e4f7ad535e0796f5a384dec42bab81393e0e",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
"suggest": {
"barnabywalters/mf-cleaner": "To more easily handle the canonical data php-mf2 gives you"
},
"type": "library",
"autoload": {
"psr-0": {
"mf2\\Parser": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Barnaby Walters",
"homepage": "http://waterpigs.co.uk"
}
],
"description": "A pure (generic) microformats-2 parser",
"keywords": [
"microformats",
"microformats 2",
"parser",
"semantic"
],
"time": "2013-10-20 12:25:50"
},
{
"name": "mpratt/relativetime",
"version": "1.0",
"source": {
"type": "git",
"url": "https://github.com/mpratt/RelativeTime.git",
"reference": "5dd7078d2bc830227c1f5a0081c68c323fb18555"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mpratt/RelativeTime/zipball/5dd7078d2bc830227c1f5a0081c68c323fb18555",
"reference": "5dd7078d2bc830227c1f5a0081c68c323fb18555",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"type": "library",
"autoload": {
"psr-0": {
"RelativeTime": "Lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Pratt",
"email": "pratt@hablarmierda.net",
"homepage": "http://www.michael-pratt.com",
"role": "Author/Developer"
}
],
"description": "A library that calculates the time difference between two dates and returns the result in words (Example: 5 minutes ago or 5 Minutes left). The library supports other languages aswell like Spanish and German.",
"homepage": "https://github.com/mpratt/RelativeTime",
"keywords": [
"ago",
"date",
"future",
"interval",
"relative",
"time",
"time-ago"
],
"time": "2013-09-23 22:51:48"
},
{
"name": "saltybeagle/savant3",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/saltybeagle/Savant3.git",
"reference": "ebf4385bf44bec8c7a169571ac178f626017c466"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/saltybeagle/Savant3/zipball/ebf4385bf44bec8c7a169571ac178f626017c466",
"reference": "ebf4385bf44bec8c7a169571ac178f626017c466",
"shasum": ""
},
"type": "library",
"autoload": {
"classmap": [
"Savant3.php",
"Savant3",
"Savant3/resources"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL"
],
"authors": [
{
"name": "Brett Bieber",
"email": "brett.bieber@gmail.com"
}
],
"description": "Savant3 template engine",
"time": "2014-01-07 17:10:32"
},
{
"name": "slim/slim",
"version": "2.2.0",
"source": {
"type": "git",
"url": "https://github.com/codeguy/Slim.git",
"reference": "b8181de1112a1e2f565b40158b621c34ded38053"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/codeguy/Slim/zipball/b8181de1112a1e2f565b40158b621c34ded38053",
"reference": "b8181de1112a1e2f565b40158b621c34ded38053",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"autoload": {
"psr-0": {
"Slim": "."
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Josh Lockhart",
"email": "info@joshlockhart.com",
"homepage": "http://www.joshlockhart.com/"
}
],
"description": "Slim Framework, a PHP micro framework",
"homepage": "http://github.com/codeguy/Slim",
"keywords": [
"microframework",
"rest",
"router"
],
"time": "2012-12-13 02:15:50"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"saltybeagle/savant3": 20,
"firebase/php-jwt": 20
},
"platform": [],
"platform-dev": []
}

+ 270
- 0
controllers/auth.php View File

@ -0,0 +1,270 @@
<?php
function buildRedirectURI() {
return Config::$base_url . 'auth/callback';
}
function clientID() {
return Config::$base_url;
}
function build_url($parsed_url) {
$scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
$host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
$port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
$user = isset($parsed_url['user']) ? $parsed_url['user'] : '';
$pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : '';
$pass = ($user || $pass) ? "$pass@" : '';
$path = isset($parsed_url['path']) ? $parsed_url['path'] : '';
$query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : '';
$fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
return "$scheme$user$pass$host$port$path$query$fragment";
}
// Input: Any URL or string like "aaronparecki.com"
// Output: Normlized URL (default to http if no scheme, force "/" path)
// or return false if not a valid URL (has query string params, etc)
function normalizeMeURL($url) {
$me = parse_url($url);
if(array_key_exists('path', $me) && $me['path'] == '')
return false;
// parse_url returns just "path" for naked domains
if(count($me) == 1 && array_key_exists('path', $me)) {
$me['host'] = $me['path'];
unset($me['path']);
}
if(!array_key_exists('scheme', $me))
$me['scheme'] = 'http';
if(!array_key_exists('path', $me))
$me['path'] = '/';
// Invalid scheme
if(!in_array($me['scheme'], array('http','https')))
return false;
// Invalid path
if($me['path'] != '/')
return false;
// query and fragment not allowed
if(array_key_exists('query', $me) || array_key_exists('fragment', $me))
return false;
return build_url($me);
}
$app->get('/', function($format='html') use($app) {
$res = $app->response();
ob_start();
render('index', array(
'title' => 'Quill',
'meta' => ''
));
$html = ob_get_clean();
$res->body($html);
});
$app->get('/auth/start', function() use($app) {
$req = $app->request();
$params = $req->params();
// the "me" parameter is user input, and may be in a couple of different forms:
// aaronparecki.com http://aaronparecki.com http://aaronparecki.com/
// Normlize the value now (move this into a function in IndieAuth\Client later)
if(!array_key_exists('me', $params) || !($me = normalizeMeURL($params['me']))) {
$html = render('auth_error', array(
'title' => 'Sign In',
'error' => 'Invalid "me" Parameter',
'errorDescription' => 'The URL you entered, "<strong>' . $params['me'] . '</strong>" is not valid.'
));
$app->response()->body($html);
return;
}
$authorizationEndpoint = IndieAuth\Client::discoverAuthorizationEndpoint($me);
$tokenEndpoint = IndieAuth\Client::discoverTokenEndpoint($me);
$micropubEndpoint = IndieAuth\Client::discoverMicropubEndpoint($me);
if($tokenEndpoint && $micropubEndpoint && $authorizationEndpoint) {
// Generate a "state" parameter for the request
$state = IndieAuth\Client::generateStateParameter();
$_SESSION['auth_state'] = $state;
$scope = 'post';
$authorizationURL = IndieAuth\Client::buildAuthorizationURL($authorizationEndpoint, $me, buildRedirectURI(), clientID(), $state, $scope);
} else {
$authorizationURL = false;
}
// If the user has already signed in before and has a micropub access token, skip
// the debugging screens and redirect immediately to the auth endpoint.
// This will still generate a new access token when they finish logging in.
$user = ORM::for_table('users')->where('url', $me)->find_one();
if($user && $user->micropub_access_token && !array_key_exists('restart', $params)) {
$user->micropub_endpoint = $micropubEndpoint;
$user->authorization_endpoint = $authorizationEndpoint;
$user->token_endpoint = $tokenEndpoint;
$user->save();
$app->redirect($authorizationURL, 301);
} else {
if(!$user)
$user = ORM::for_table('users')->create();
$user->url = $me;
$user->date_created = date('Y-m-d H:i:s');
$user->micropub_endpoint = $micropubEndpoint;
$user->authorization_endpoint = $authorizationEndpoint;
$user->token_endpoint = $tokenEndpoint;
$user->save();
$html = render('auth_start', array(
'title' => 'Sign In',
'me' => $me,
'authorizing' => $me,
'meParts' => parse_url($me),
'tokenEndpoint' => $tokenEndpoint,
'micropubEndpoint' => $micropubEndpoint,
'authorizationEndpoint' => $authorizationEndpoint,
'authorizationURL' => $authorizationURL
));
$app->response()->body($html);
}
});
$app->get('/auth/callback', function() use($app) {
$req = $app->request();
$params = $req->params();
// Double check there is a "me" parameter
// Should only fail for really hacked up requests
if(!array_key_exists('me', $params) || !($me = normalizeMeURL($params['me']))) {
$html = render('auth_error', array(
'title' => 'Auth Callback',
'error' => 'Invalid "me" Parameter',
'errorDescription' => 'The ID you entered, <strong>' . $params['me'] . '</strong> is not valid.'
));
$app->response()->body($html);
return;
}
// If there is no state in the session, start the login again
if(!array_key_exists('auth_state', $_SESSION)) {
$app->redirect('/auth/start?me='.urlencode($params['me']));
return;
}
if(!array_key_exists('code', $params) || trim($params['code']) == '') {
$html = render('auth_error', array(
'title' => 'Auth Callback',
'error' => 'Missing authorization code',
'errorDescription' => 'No authorization code was provided in the request.'
));
$app->response()->body($html);
return;
}
// Verify the state came back and matches what we set in the session
// Should only fail for malicious attempts, ok to show a not as nice error message
if(!array_key_exists('state', $params)) {
$html = render('auth_error', array(
'title' => 'Auth Callback',
'error' => 'Missing state parameter',
'errorDescription' => 'No state parameter was provided in the request. This shouldn\'t happen. It is possible this is a malicious authorization attempt.'
));
$app->response()->body($html);
return;
}
if($params['state'] != $_SESSION['auth_state']) {
$html = render('auth_error', array(
'title' => 'Auth Callback',
'error' => 'Invalid state',
'errorDescription' => 'The state parameter provided did not match the state provided at the start of authorization. This is most likely caused by a malicious authorization attempt.'
));
$app->response()->body($html);
return;
}
// Now the basic sanity checks have passed. Time to start providing more helpful messages when there is an error.
// An authorization code is in the query string, and we want to exchange that for an access token at the token endpoint.
// Discover the endpoints
$micropubEndpoint = IndieAuth\Client::discoverMicropubEndpoint($me);
$tokenEndpoint = IndieAuth\Client::discoverTokenEndpoint($me);
if($tokenEndpoint) {
$token = IndieAuth\Client::getAccessToken($tokenEndpoint, $params['code'], $params['me'], buildRedirectURI(), clientID(), $params['state'], true);
} else {
$token = array('auth'=>false, 'response'=>false);
}
$redirectToDashboardImmediately = false;
// If a valid access token was returned, store the token info in the session and they are signed in
if(k($token['auth'], array('me','access_token','scope'))) {
$_SESSION['auth'] = $token['auth'];
$_SESSION['me'] = $params['me'];
$user = ORM::for_table('users')->where('url', $me)->find_one();
if($user) {
// Already logged in, update the last login date
$user->last_login = date('Y-m-d H:i:s');
// If they have logged in before and we already have an access token, then redirect to the dashboard now
if($user->micropub_access_token)
$redirectToDashboardImmediately = true;
} else {
// New user! Store the user in the database
$user = ORM::for_table('users')->create();
$user->url = $me;
$user->date_created = date('Y-m-d H:i:s');
}
$user->micropub_endpoint = $micropubEndpoint;
$user->access_token = $token['auth']['access_token'];
$user->token_scope = $token['auth']['scope'];
$user->token_response = $token['response'];
$user->save();
$_SESSION['user_id'] = $user->id();
// Make a request to the micropub endpoint to discover the syndication targets if any.
// Errors are silently ignored here. The user will be able to retry from the new post interface and get feedback.
get_syndication_targets($user);
}
unset($_SESSION['auth_state']);
if($redirectToDashboardImmediately) {
$app->redirect('/new', 301);
} else {
$html = render('auth_callback', array(
'title' => 'Sign In',
'me' => $me,
'authorizing' => $me,
'meParts' => parse_url($me),
'tokenEndpoint' => $tokenEndpoint,
'auth' => $token['auth'],
'response' => $token['response'],
'curl_error' => (array_key_exists('error', $token) ? $token['error'] : false)
));
$app->response()->body($html);
}
});
$app->get('/signout', function() use($app) {
unset($_SESSION['auth']);
unset($_SESSION['me']);
unset($_SESSION['auth_state']);
unset($_SESSION['user_id']);
$app->redirect('/', 301);
});

+ 170
- 0
controllers/controllers.php View File

@ -0,0 +1,170 @@
<?php
function require_login(&$app) {
$params = $app->request()->params();
if(array_key_exists('token', $params)) {
try {
$data = JWT::decode($params['token'], Config::$jwtSecret);
$_SESSION['user_id'] = $data->user_id;
$_SESSION['me'] = $data->me;
} catch(DomainException $e) {
header('X-Error: DomainException');
$app->redirect('/', 301);
} catch(UnexpectedValueException $e) {
header('X-Error: UnexpectedValueException');
$app->redirect('/', 301);
}
}
if(!array_key_exists('user_id', $_SESSION)) {
$app->redirect('/');
return false;
} else {
return ORM::for_table('users')->find_one($_SESSION['user_id']);
}
}
function generate_login_token() {
return JWT::encode(array(
'user_id' => $_SESSION['user_id'],
'me' => $_SESSION['me'],
'created_at' => time()
), Config::$jwtSecret);
}
$app->get('/new', function() use($app) {
if($user=require_login($app)) {
$entry = false;
$photo_url = false;
$test_response = '';
if($user->last_micropub_response) {
try {
if(@json_decode($user->last_micropub_response)) {
$d = json_decode($user->last_micropub_response);
$test_response = $d->response;
}
} catch(Exception $e) {
}
}
$html = render('new-post', array(
'title' => 'New Post',
'micropub_endpoint' => $user->micropub_endpoint,
'micropub_scope' => $user->micropub_scope,
'micropub_access_token' => $user->micropub_access_token,
'response_date' => $user->last_micropub_response_date,
'syndication_targets' => json_decode($user->syndication_targets, true),
'test_response' => $test_response,
'location_enabled' => $user->location_enabled
));
$app->response()->body($html);
}
});
$app->post('/prefs', function() use($app) {
if($user=require_login($app)) {
$params = $app->request()->params();
$user->location_enabled = $params['enabled'];
$user->save();
}
$app->response()->body(json_encode(array(
'result' => 'ok'
)));
});
$app->get('/creating-a-token-endpoint', function() use($app) {
$app->redirect('http://indiewebcamp.com/token-endpoint', 301);
});
$app->get('/creating-a-micropub-endpoint', function() use($app) {
$html = render('creating-a-micropub-endpoint', array('title' => 'Creating a Micropub Endpoint'));
$app->response()->body($html);
});
$app->get('/docs', function() use($app) {
$html = render('docs', array('title' => 'Documentation'));
$app->response()->body($html);
});
$app->get('/add-to-home', function() use($app) {
$params = $app->request()->params();
if(array_key_exists('token', $params) && !session('add-to-home-started')) {
// Verify the token and sign the user in
try {
$data = JWT::decode($params['token'], Config::$jwtSecret);
$_SESSION['user_id'] = $data->user_id;
$_SESSION['me'] = $data->me;
$app->redirect('/new', 301);
} catch(DomainException $e) {
header('X-Error: DomainException');
$app->redirect('/', 301);
} catch(UnexpectedValueException $e) {
header('X-Error: UnexpectedValueException');
$app->redirect('/', 301);
}
} else {
if($user=require_login($app)) {
if(array_key_exists('start', $params)) {
$_SESSION['add-to-home-started'] = true;
$token = JWT::encode(array(
'user_id' => $_SESSION['user_id'],
'me' => $_SESSION['me'],
'created_at' => time()
), Config::$jwtSecret);
$app->redirect('/add-to-home?token='.$token, 301);
} else {
unset($_SESSION['add-to-home-started']);
$html = render('add-to-home', array('title' => 'Teacup'));
$app->response()->body($html);
}
}
}
});
$app->post('/micropub/post', function() use($app) {
if($user=require_login($app)) {
$params = $app->request()->params();
// Remove any blank params
$params = array_filter($params, function($v){
return $v !== '';
});
// Now send to the micropub endpoint
$r = micropub_post($user->micropub_endpoint, $params, $user->micropub_access_token);
$request = $r['request'];
$response = $r['response'];
$user->last_micropub_response = json_encode($r);
$user->last_micropub_response_date = date('Y-m-d H:i:s');
// Check the response and look for a "Location" header containing the URL
if($response && preg_match('/Location: (.+)/', $response, $match)) {
$location = $match[1];
$user->micropub_success = 1;
} else {
$location = false;
}
$user->save();
$app->response()->body(json_encode(array(
'request' => htmlspecialchars($request),
'response' => htmlspecialchars($response),
'location' => $location,
'error' => $r['error'],
'curlinfo' => $r['curlinfo']
)));
}
});

+ 95
- 0
lib/Savant.php View File

@ -0,0 +1,95 @@
<?php
/**
* Slim - a micro PHP 5 framework
*
* @author Josh Lockhart
* @link http://www.slimframework.com
* @copyright 2011 Josh Lockhart
*
* MIT LICENSE
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Slim\Extras\Views;
/**
* SavantView
*
* The SavantView is a Custom View class that renders templates using the
* Savant3 template language (http://phpsavant.com/).
*
* There are two fields that you, the developer, will need to change:
* - savantDirectory
* - savantOptions
*
* @package Slim
* @author Matthew Callis <http://superfamicom.org/>
*/
class Savant extends \Slim\View
{
/**
* @var string The path to the directory containing Savant3.php and the Savant3 folder without trailing slash.
*/
public static $savantDirectory = null;
/**
* @var array The options for the Savant3 environment, see http://phpsavant.com/api/Savant3/
*/
public static $savantOptions = array('template_path' => 'templates');
/**
* @var persistent instance of the Savant object
*/
private static $savantInstance = null;
/**
* Renders a template using Savant3.php.
*
* @see View::render()
* @param string $template The template name specified in Slim::render()
* @return string
*/
public function render($template)
{
$savant = $this->getInstance();
$savant->assign($this->data);
return $savant->fetch($template);
}
/**
* Creates new Savant instance if it doesn't already exist, and returns it.
*
* @throws RuntimeException If Savant3 lib directory does not exist.
* @return SavantInstance
*/
private function getInstance()
{
if (!self::$savantInstance) {
if (!is_dir(self::$savantDirectory)) {
throw new \RuntimeException('Cannot set the Savant lib directory : ' . self::$savantDirectory . '. Directory does not exist.');
}
require_once self::$savantDirectory . '/Savant3.php';
self::$savantInstance = new \Savant3(self::$savantOptions);
}
return self::$savantInstance;
}
}

+ 14
- 0
lib/config.template.php View File

@ -0,0 +1,14 @@
<?php
class Config {
public static $hostname = 'teacup.p3k.io';
public static $base_url = 'https://teacup.p3k.io/';
public static $gaid = '';
public static $dbHost = '127.0.0.1';
public static $dbName = 'teacup';
public static $dbUsername = 'teacup';
public static $dbPassword = '';
public static $jwtSecret = 'xxx';
}

+ 177
- 0
lib/helpers.php View File

@ -0,0 +1,177 @@
<?php
ORM::configure('mysql:host=' . Config::$dbHost . ';dbname=' . Config::$dbName);
ORM::configure('username', Config::$dbUsername);
ORM::configure('password', Config::$dbPassword);
function render($page, $data) {
global $app;
return $app->render('layout.php', array_merge($data, array('page' => $page)));
};
function partial($template, $data=array(), $debug=false) {
global $app;
if($debug) {
$tpl = new Savant3(\Slim\Extras\Views\Savant::$savantOptions);
echo '<pre>' . $tpl->fetch($template . '.php') . '</pre>';
return '';
}
ob_start();
$tpl = new Savant3(\Slim\Extras\Views\Savant::$savantOptions);
foreach($data as $k=>$v) {
$tpl->{$k} = $v;
}
$tpl->display($template . '.php');
return ob_get_clean();
}
function js_bookmarklet($partial, $context) {
return str_replace('+','%20',urlencode(str_replace(array("\n"),array(''),partial($partial, $context))));
}
function session($key) {
if(array_key_exists($key, $_SESSION))
return $_SESSION[$key];
else
return null;
}
function k($a, $k, $default=null) {
if(is_array($k)) {
$result = true;
foreach($k as $key) {
$result = $result && array_key_exists($key, $a);
}
return $result;
} else {
if(is_array($a) && array_key_exists($k, $a) && $a[$k])
return $a[$k];
elseif(is_object($a) && property_exists($a, $k) && $a->$k)
return $a->$k;
else
return $default;
}
}
function get_timezone($lat, $lng) {
try {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://timezone-api.geoloqi.com/timezone/'.$lat.'/'.$lng);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$tz = @json_decode($response);
if($tz)
return new DateTimeZone($tz->timezone);
} catch(Exception $e) {
return null;
}
return null;
}
function micropub_post($endpoint, $params, $access_token) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer ' . $access_token
));
curl_setopt($ch, CURLOPT_POST, true);
$post = http_build_query(array_merge(array(
'h' => 'entry'
), $params));
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
$response = curl_exec($ch);
$error = curl_error($ch);
$sent_headers = curl_getinfo($ch, CURLINFO_HEADER_OUT);
$request = $sent_headers . $post;
return array(
'request' => $request,
'response' => $response,
'error' => $error,
'curlinfo' => curl_getinfo($ch)
);
}
function micropub_get($endpoint, $params, $access_token) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint . '?' . http_build_query($params));
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer ' . $access_token
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$data = array();
if($response) {
parse_str($response, $data);
}
$error = curl_error($ch);
return array(
'response' => $response,
'data' => $data,
'error' => $error,
'curlinfo' => curl_getinfo($ch)
);
}
function get_syndication_targets(&$user) {
$targets = array();
$r = micropub_get($user->micropub_endpoint, array('q'=>'syndicate-to'), $user->micropub_access_token);
if($r['data'] && array_key_exists('syndicate-to', $r['data'])) {
$targetURLs = preg_split('/, ?/', $r['data']['syndicate-to']);
foreach($targetURLs as $t) {
// If the syndication target doesn't have a scheme, add http
if(!preg_match('/^http/', $t))
$tmp = 'http://' . $t;
// Parse the target expecting it to be a URL
$url = parse_url($tmp);
// If there's a host, and the host contains a . then we can assume there's a favicon
// parse_url will parse strings like http://twitter into an array with a host of twitter, which is not resolvable
if(array_key_exists('host', $url) && strpos($url['host'], '.') !== false) {
$targets[] = array(
'target' => $t,
'favicon' => 'http://' . $url['host'] . '/favicon.ico'
);
} else {
$targets[] = array(
'target' => $t,
'favicon' => false
);
}
}
}
if(count($targets)) {
$user->syndication_targets = json_encode($targets);
$user->save();
}
return array(
'targets' => $targets,
'response' => $r
);
}
function static_map($latitude, $longitude, $height=180, $width=700, $zoom=14) {
return 'http://static-maps.pdx.esri.com/img.php?marker[]=lat:' . $latitude . ';lng:' . $longitude . ';icon:small-blue-cutout&basemap=gray&width=' . $width . '&height=' . $height . '&zoom=' . $zoom;
}
function relative_time($date) {
static $rel;
if(!isset($rel)) {
$config = array(
'language' => '\RelativeTime\Languages\English',
'separator' => ', ',
'suffix' => true,
'truncate' => 1,
);
$rel = new \RelativeTime\RelativeTime($config);
}
return $rel->timeAgo($date);
}

+ 2953
- 0
lib/markdown.php
File diff suppressed because it is too large
View File


+ 347
- 0
public/bootstrap/css/bootstrap-theme.css View File

@ -0,0 +1,347 @@
/*!
* Bootstrap v3.1.1 (http://getbootstrap.com)
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
.btn-default,
.btn-primary,
.btn-success,
.btn-info,
.btn-warning,
.btn-danger {
text-shadow: 0 -1px 0 rgba(0, 0, 0, .2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
}
.btn-default:active,
.btn-primary:active,
.btn-success:active,
.btn-info:active,
.btn-warning:active,
.btn-danger:active,
.btn-default.active,
.btn-primary.active,
.btn-success.active,
.btn-info.active,
.btn-warning.active,
.btn-danger.active {
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
}
.btn:active,
.btn.active {
background-image: none;
}
.btn-default {
text-shadow: 0 1px 0 #fff;
background-image: -webkit-linear-gradient(top, #fff 0%, #e0e0e0 100%);
background-image: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #dbdbdb;
border-color: #ccc;
}
.btn-default:hover,
.btn-default:focus {
background-color: #e0e0e0;
background-position: 0 -15px;
}
.btn-default:active,
.btn-default.active {
background-color: #e0e0e0;
border-color: #dbdbdb;
}
.btn-primary {
background-image: -webkit-linear-gradient(top, #428bca 0%, #2d6ca2 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #2d6ca2 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff2d6ca2', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #2b669a;
}
.btn-primary:hover,
.btn-primary:focus {
background-color: #2d6ca2;
background-position: 0 -15px;
}
.btn-primary:active,
.btn-primary.active {
background-color: #2d6ca2;
border-color: #2b669a;
}
.btn-success {
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%);
background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #3e8f3e;
}
.btn-success:hover,
.btn-success:focus {
background-color: #419641;
background-position: 0 -15px;
}
.btn-success:active,
.btn-success.active {
background-color: #419641;
border-color: #3e8f3e;
}
.btn-info {
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #28a4c9;
}
.btn-info:hover,
.btn-info:focus {
background-color: #2aabd2;
background-position: 0 -15px;
}
.btn-info:active,
.btn-info.active {
background-color: #2aabd2;
border-color: #28a4c9;
}
.btn-warning {
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #e38d13;
}
.btn-warning:hover,
.btn-warning:focus {
background-color: #eb9316;
background-position: 0 -15px;
}
.btn-warning:active,
.btn-warning.active {
background-color: #eb9316;
border-color: #e38d13;
}
.btn-danger {
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #b92c28;
}
.btn-danger:hover,
.btn-danger:focus {
background-color: #c12e2a;
background-position: 0 -15px;
}
.btn-danger:active,
.btn-danger.active {
background-color: #c12e2a;
border-color: #b92c28;
}
.thumbnail,
.img-thumbnail {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
background-color: #e8e8e8;
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
background-repeat: repeat-x;
}
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
background-color: #357ebd;
background-image: -webkit-linear-gradient(top, #428bca 0%, #357ebd 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);
background-repeat: repeat-x;
}
.navbar-default {
background-image: -webkit-linear-gradient(top, #fff 0%, #f8f8f8 100%);
background-image: linear-gradient(to bottom, #fff 0%, #f8f8f8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075);
}
.navbar-default .navbar-nav > .active > a {
background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f3f3f3 100%);
background-image: linear-gradient(to bottom, #ebebeb 0%, #f3f3f3 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff3f3f3', GradientType=0);
background-repeat: repeat-x;
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075);
box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075);
}
.navbar-brand,
.navbar-nav > li > a {
text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
}
.navbar-inverse {
background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222 100%);
background-image: linear-gradient(to bottom, #3c3c3c 0%, #222 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
}
.navbar-inverse .navbar-nav > .active > a {
background-image: -webkit-linear-gradient(top, #222 0%, #282828 100%);
background-image: linear-gradient(to bottom, #222 0%, #282828 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff282828', GradientType=0);
background-repeat: repeat-x;
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25);
box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25);
}
.navbar-inverse .navbar-brand,
.navbar-inverse .navbar-nav > li > a {
text-shadow: 0 -1px 0 rgba(0, 0, 0, .25);
}
.navbar-static-top,
.navbar-fixed-top,
.navbar-fixed-bottom {
border-radius: 0;
}
.alert {
text-shadow: 0 1px 0 rgba(255, 255, 255, .2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05);
}
.alert-success {
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);
background-repeat: repeat-x;
border-color: #b2dba1;
}
.alert-info {
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);
background-repeat: repeat-x;
border-color: #9acfea;
}
.alert-warning {
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);
background-repeat: repeat-x;
border-color: #f5e79e;
}
.alert-danger {
background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);
background-repeat: repeat-x;
border-color: #dca7a7;
}
.progress {
background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar {
background-image: -webkit-linear-gradient(top, #428bca 0%, #3071a9 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #3071a9 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-success {
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%);
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-info {
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-warning {
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-danger {
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%);
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
background-repeat: repeat-x;
}
.list-group {
border-radius: 4px;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
}
.list-group-item.active,
.list-group-item.active:hover,
.list-group-item.active:focus {
text-shadow: 0 -1px 0 #3071a9;
background-image: -webkit-linear-gradient(top, #428bca 0%, #3278b3 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #3278b3 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3278b3', GradientType=0);
background-repeat: repeat-x;
border-color: #3278b3;
}
.panel {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
.panel-default > .panel-heading {
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
background-repeat: repeat-x;
}
.panel-primary > .panel-heading {
background-image: -webkit-linear-gradient(top, #428bca 0%, #357ebd 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);
background-repeat: repeat-x;
}
.panel-success > .panel-heading {
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);
background-repeat: repeat-x;
}
.panel-info > .panel-heading {
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);
background-repeat: repeat-x;
}
.panel-warning > .panel-heading {
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);
background-repeat: repeat-x;
}
.panel-danger > .panel-heading {
background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);
background-repeat: repeat-x;
}
.well {
background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);
background-repeat: repeat-x;
border-color: #dcdcdc;
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1);
}
/*# sourceMappingURL=bootstrap-theme.css.map */

+ 1
- 0
public/bootstrap/css/bootstrap-theme.css.map
File diff suppressed because it is too large
View File


+ 7
- 0
public/bootstrap/css/bootstrap-theme.min.css
File diff suppressed because it is too large
View File


+ 5785
- 0
public/bootstrap/css/bootstrap.css
File diff suppressed because it is too large
View File


+ 1
- 0
public/bootstrap/css/bootstrap.css.map
File diff suppressed because it is too large
View File


+ 7
- 0
public/bootstrap/css/bootstrap.min.css
File diff suppressed because it is too large
View File


BIN
public/bootstrap/fonts/glyphicons-halflings-regular.eot View File


+ 229
- 0
public/bootstrap/fonts/glyphicons-halflings-regular.svg View File

@ -0,0 +1,229 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata></metadata>
<defs>
<font id="glyphicons_halflingsregular" horiz-adv-x="1200" >
<font-face units-per-em="1200" ascent="960" descent="-240" />
<missing-glyph horiz-adv-x="500" />
<glyph />
<glyph />
<glyph unicode="&#xd;" />
<glyph unicode=" " />
<glyph unicode="*" d="M100 500v200h259l-183 183l141 141l183 -183v259h200v-259l183 183l141 -141l-183 -183h259v-200h-259l183 -183l-141 -141l-183 183v-259h-200v259l-183 -183l-141 141l183 183h-259z" />
<glyph unicode="+" d="M0 400v300h400v400h300v-400h400v-300h-400v-400h-300v400h-400z" />
<glyph unicode="&#xa0;" />
<glyph unicode="&#x2000;" horiz-adv-x="652" />
<glyph unicode="&#x2001;" horiz-adv-x="1304" />
<glyph unicode="&#x2002;" horiz-adv-x="652" />
<glyph unicode="&#x2003;" horiz-adv-x="1304" />
<glyph unicode="&#x2004;" horiz-adv-x="434" />
<glyph unicode="&#x2005;" horiz-adv-x="326" />
<glyph unicode="&#x2006;" horiz-adv-x="217" />
<glyph unicode="&#x2007;" horiz-adv-x="217" />
<glyph unicode="&#x2008;" horiz-adv-x="163" />
<glyph unicode="&#x2009;" horiz-adv-x="260" />
<glyph unicode="&#x200a;" horiz-adv-x="72" />
<glyph unicode="&#x202f;" horiz-adv-x="260" />
<glyph unicode="&#x205f;" horiz-adv-x="326" />
<glyph unicode="&#x20ac;" d="M100 500l100 100h113q0 47 5 100h-218l100 100h135q37 167 112 257q117 141 297 141q242 0 354 -189q60 -103 66 -209h-181q0 55 -25.5 99t-63.5 68t-75 36.5t-67 12.5q-24 0 -52.5 -10t-62.5 -32t-65.5 -67t-50.5 -107h379l-100 -100h-300q-6 -46 -6 -100h406l-100 -100 h-300q9 -74 33 -132t52.5 -91t62 -54.5t59 -29t46.5 -7.5q29 0 66 13t75 37t63.5 67.5t25.5 96.5h174q-31 -172 -128 -278q-107 -117 -274 -117q-205 0 -324 158q-36 46 -69 131.5t-45 205.5h-217z" />
<glyph unicode="&#x2212;" d="M200 400h900v300h-900v-300z" />
<glyph unicode="&#x25fc;" horiz-adv-x="500" d="M0 0z" />
<glyph unicode="&#x2601;" d="M-14 494q0 -80 56.5 -137t135.5 -57h750q120 0 205 86.5t85 207.5t-85 207t-205 86q-46 0 -90 -14q-44 97 -134.5 156.5t-200.5 59.5q-152 0 -260 -107.5t-108 -260.5q0 -25 2 -37q-66 -14 -108.5 -67.5t-42.5 -122.5z" />
<glyph unicode="&#x2709;" d="M0 100l400 400l200 -200l200 200l400 -400h-1200zM0 300v600l300 -300zM0 1100l600 -603l600 603h-1200zM900 600l300 300v-600z" />