This repository has been archived by the owner on Sep 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from PHPSP/develop
Release 0.2.0
- Loading branch information
Showing
13 changed files
with
224 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,6 @@ | |
# Project Files | ||
|
||
config/config.ini | ||
phpunit.xml | ||
public/uploads/* | ||
tests/_reports/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
web1: | ||
name: liga-solidaria-storage | ||
shared_writable_dirs: | ||
- public/uploads | ||
document_root: public | ||
php_version: 5.4.14 | ||
php_default_locale: "pt_BR" | ||
php_date_timezone: "America/Sao_Paulo" | ||
php_error_reporting: -1 | ||
php_display_errors: "1" | ||
php_extensions: | ||
- zip | ||
after_build: | ||
- "if [ ! -f composer.phar ]; then curl -s http://getcomposer.org/installer | php; fi" | ||
- "php composer.phar install --no-dev --optimize-autoloader" | ||
- "cp config/config.ini.dist config/config.ini" | ||
|
||
db1: | ||
name: liga-solidaria-storage | ||
type: mysql |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
-- Database: Liga Solidaria Storage | ||
|
||
CREATE DATABASE `liga`; | ||
|
||
CREATE TABLE `user` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`name` varchar(40) NOT NULL, | ||
`password` varchar(40) NOT NULL, | ||
`email` varchar(100) NOT NULL, | ||
`group_id` int(11) NOT NULL, | ||
PRIMARY KEY (`id`), | ||
KEY `group` (`group_id`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
|
||
CREATE TABLE `group` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`name` varchar(45) NOT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=InnoDB DEFAULT CHARSE=utf8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace LigaSolidariaStorage\Routine; | ||
|
||
use \PHP_SESSION_ACTIVE; | ||
|
||
class Auth | ||
{ | ||
public function __construct() | ||
{ | ||
session_start(); | ||
} | ||
|
||
public function __invoke() | ||
{ | ||
if (isset($_SESSION['email'])) | ||
return true; | ||
|
||
header('HTTP/1.1 403 Permission denied'); | ||
header('Location: /login'); | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace LigaSolidariaStorage\Storage\Controller; | ||
|
||
use Respect\Rest\Routable; | ||
use \InvalidArgumentException as Argument; | ||
|
||
class Login implements Routable | ||
{ | ||
public function get() | ||
{ | ||
return array('_view' => 'login.html.twig'); | ||
} | ||
|
||
public function post() | ||
{ | ||
try { | ||
$vars = array('_view'=>'index.html.twig'); | ||
$email = filter_input(INPUT_POST, 'email'); | ||
$pass = filter_input(INPUT_POST, 'password'); | ||
|
||
if (empty($email) || empty($pass)) { | ||
throw new Argument('Email ou senha inválidos'); | ||
} | ||
|
||
$_SESSION['email'] = $_POST['email']; | ||
|
||
header('Location: /'); | ||
|
||
} catch(Argument $e) { | ||
$vars['message'] = $e->getMessage(); | ||
return $vars; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace LigaSolidariaStorage\Storage\Controller; | ||
|
||
use Respect\Rest\Routable; | ||
|
||
class Logout implements Routable | ||
{ | ||
public function get() | ||
{ | ||
session_destroy(); | ||
header('Location: /'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.