Skip to content
This repository has been archived by the owner on Apr 12, 2020. It is now read-only.

Entrega Proyecto 1 #33

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e3f5611
vscode gitignore rules
gabriel-sg Apr 13, 2019
5f9dda0
Delete .editorconfig
gabriel-sg Apr 13, 2019
1fac3f1
activate laravel authentication
gabriel-sg Apr 14, 2019
1d3ccad
Merge branch 'master' of https://github.com/gabriel-sg/proyecto-1
gabriel-sg Apr 14, 2019
434f993
message
gabriel-sg Apr 25, 2019
9d92024
redirecto /mis-listas after login
gabriel-sg Apr 25, 2019
80bba2c
Crate list table migration, model and controller
gabriel-sg Apr 29, 2019
65a8c32
change $redirecTo of login
gabriel-sg Apr 29, 2019
5f087f7
npm install
gabriel-sg Apr 29, 2019
8d35d51
add my own css
gabriel-sg Apr 29, 2019
3029e0f
scripts at the end and add some stylesheets
gabriel-sg Apr 29, 2019
765e019
perfil and listas views, and routes
gabriel-sg Apr 29, 2019
2e63c7e
procfile for heroku
gabriel-sg Apr 29, 2019
d8a5128
sin comillas
gabriel-sg Apr 29, 2019
fe650a6
change title and brand
gabriel-sg Apr 29, 2019
999b259
Libros table, model and controller
gabriel-sg Apr 30, 2019
f096b40
user seeder
gabriel-sg Apr 30, 2019
1268940
show a list
gabriel-sg Apr 30, 2019
0138f2a
crear libro view
gabriel-sg Apr 30, 2019
636b4c3
nuevas rutas
gabriel-sg Apr 30, 2019
2cf87ab
welcome view
gabriel-sg Apr 30, 2019
6954b76
Delete home controles and view
gabriel-sg Apr 30, 2019
3b4d0c2
muchos cambios
gabriel-sg May 1, 2019
d5f1aed
ajustes finales
gabriel-sg May 1, 2019
83d5da7
orden de migracion
gabriel-sg May 1, 2019
210d0c0
README
gabriel-sg May 1, 2019
2f1bb0b
change string to bigInt
gabriel-sg May 1, 2019
8e927c1
cambia la url de los assets
gabriel-sg May 1, 2019
84254c4
correccion de url
gabriel-sg May 1, 2019
52755ec
usar https si enviroment = remote
gabriel-sg May 1, 2019
cf1db4a
import URL
gabriel-sg May 1, 2019
32fc433
asset()
gabriel-sg May 1, 2019
d6c052c
pedir confirmacion al eliminar
gabriel-sg May 1, 2019
ac492b4
Traduccion de alguna palabras
gabriel-sg May 1, 2019
88e182e
minor changes
gabriel-sg May 1, 2019
7d92a1c
Editar lista mas intuitivo
gabriel-sg May 1, 2019
a974f35
favicon
gabriel-sg May 1, 2019
289df3a
Boton volver en varias paginas
gabriel-sg May 1, 2019
d80d16a
corregi la ruta de volver
gabriel-sg May 1, 2019
cbca8d6
jdownloader2 link decrypt
gabriel-sg May 15, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log

.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

notas-personales.txt
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: vendor/bin/heroku-php-apache2 public/
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,17 @@ TODO
## Herramienta Audit de Chrome

TODO

## Resultados de performance con audit:
"/":
Performance: 72
Accessibility: 90
"usuario/mis-listas":
Performance: 66
Accessibility: 60
"/register":
Performance: 72
Accessibility: 91

## Autor:
Salazar Gabriel
10 changes: 10 additions & 0 deletions app/Book.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Book extends Model
{
//
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LoginController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = '/usuario/mis-listas';

/**
* Create a new controller instance.
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RegisterController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = '/usuario/mis-listas';

/**
* Create a new controller instance.
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/ResetPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ResetPasswordController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = '/usuario/mis-listas';

/**
* Create a new controller instance.
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/VerificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class VerificationController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = '/usuario/mis-listas';

/**
* Create a new controller instance.
Expand Down
95 changes: 95 additions & 0 deletions app/Http/Controllers/BookController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?php

namespace App\Http\Controllers;

use App\Book;
use Illuminate\Http\Request;
use App\ListModel;
use Illuminate\Support\Facades\Auth;

class BookController extends Controller
{

/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create(Request $request, $id){
// validacion
$validateData = $request->validate([
'name' => 'required|max:255',
'author' => 'required|max:255',
'year' => 'required|max:255',
]);

$book = new Book();

$book->name = $request->input('name');
$book->author = $request->input('author');
$book->year = $request->input('year');
$book->list_id = $id;
echo $book;
$book->save();
return redirect()->action('ListController@show', $id);
}


/**
* Show the form for editing the specified resource.
*
* @param \App\Book $book
* @return \Illuminate\Http\Response
*/
public function edit(ListModel $list, Book $book)
{
//
return view('libros.editar', ['list_id' => $list['id']])->with('book', $book);
}

/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Book $book
* @return \Illuminate\Http\Response
*/
public function update(Request $request, ListModel $list, Book $book)
{
// The user must be first log in
// validacion
$validateData = $request->validate([
'name' => 'required|max:255',
'author' => 'required|max:255',
'year' => 'required|max:255',
]);

// valido que la lista sea del usuario logeado
if($list['user_id'] == Auth::user()->id){
$book->name = $request->input('name');
$book->author = $request->input('author');
$book->year = $request->input('year');
$book->save();

$request->session()->flash('success', 'Lista actualizada!');
}
else{
$request->session()->flash('error', 'La lista no pertenece al usuario autenticado');
}
return redirect()->action('ListController@show', $list['id']);
}

/**
* Remove the specified resource from storage.
*
* @param \App\Book $book
* @return \Illuminate\Http\Response
*/
public function destroy($id, Book $book)
{
//
$book->delete();

return redirect()->action('ListController@show', $id);
}
}
37 changes: 37 additions & 0 deletions app/Http/Controllers/GuestController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\ListModel;
use App\User;
use App\Book;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;

class GuestController extends Controller
{
//
public function welcome(){
// find public lists
$publicLists = DB::table('lists')
->where('status', 'Publica');

// join public lists with users to get the user name of each list
$listUser = DB::table('users')
->select('public_lists.*', 'users.name as user_name')
->joinSub($publicLists, 'public_lists', function($join){
$join->on('users.id', '=', 'public_lists.user_id')
->orderBy('public_lists.updated_at', 'desc');
})->get();

return view('welcome')->with('lists', $listUser);
}

public function showList(ListModel $list){
$books = Book::where('list_id', $list['id'])
->orderBy('name', 'asc')
->get();
return view('show-lista', ['list_name' => $list['name'], 'list_id' => $list['id']])->with('books', $books);
}
}
115 changes: 115 additions & 0 deletions app/Http/Controllers/ListController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\ListModel;
use App\Book;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;
use function GuzzleHttp\json_encode;

class ListController extends Controller{


public function show(ListModel $list){
if($list['user_id'] == Auth::user()->id){
$books = Book::where('list_id', $list['id'])
->orderBy('name', 'asc')
->get();
return view('listas.show', ['list_name' => $list['name'], 'list_id' => $list['id']])->with('books', $books);
}
else{
abort(404);
}
}

public function showAll(){
// $list = new ListModel();
$lists = ListModel::where('user_id',Auth::user()->id)
->orderBy('name', 'asc')
->get();
return view('listas.mis-listas')->with('lists', $lists);
}

public function create(Request $request){
// The user must be first log in
// validacion
$validateData = $request->validate([
'name' => 'required|max:255',
'status' => 'required|max:255',
]);

$list = new ListModel();

$list->name = $request->input('name');
$list->status = $request->input('status');
$list->user_id = Auth::user()->id;

$list->save();
$request->session()->flash('success', 'Lista creada!');
return redirect()->action('ListController@showAll');
}

// Show the form for editing the specified resource.
public function edit(ListModel $list){
// valido que la lista sea del usuario logeado
if($list['user_id'] == Auth::user()->id){
return view('listas.editar')->with('list', $list);
}
else{
abort(404);
}
}

// Update the specified resource in storage.
public function update(Request $request, ListModel $list){
// The user must be first log in
// validacion
$validateData = $request->validate([
'name' => 'required|max:255',
'status' => 'required|max:255',
]);

// valido que la lista sea del usuario logeado
if($list['user_id'] == Auth::user()->id){
$list->name = $request->input('name');
$list->status = $request->input('status');
$list->save();

$request->session()->flash('success', 'Lista actualizada!');
}
else{
$request->session()->flash('error', 'La lista no pertenece al usuario autenticado');
}
return redirect()->action('ListController@showAll');
}

public function eliminar(Request $request, ListModel $list){

if($list['user_id'] == Auth::user()->id){
$list->delete();
$request->session()->flash('success', 'Lista eliminada!');
}
else{
$request->session()->flash('error', 'La lista no pertenece al usuario autenticado');
}
return redirect()->action('ListController@showAll');

}

public function updateStatus(ListModel $list){
if($list->status == 'Publica'){
$list->status = 'Privada';
}
else{
$list->status = 'Publica';
}
$list->save();
return redirect()->action('ListController@showAll');

}



}
35 changes: 35 additions & 0 deletions app/Http/Controllers/PruebasController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;


class PruebasController extends Controller{
//
public function prueba(){}

public function jd2decrypt(Request $req){

function base16Encode($arg){
$ret="";
for($i=0;$i<strlen($arg);$i++){
$tmp=ord(substr($arg,$i,1));
$ret.=dechex($tmp);
}
return $ret;
}

$key = "1234567890987654";
$transmitKey=base16Encode($key);
$method = 'aes-128-cbc';
// $enc = openssl_encrypt ($link, $method, $key, OPENSSL_RAW_DATA, $key);
// $crypted=base64_encode($enc);

// echo hex2bin($transmitKey)."<br>";

$decrypted = openssl_decrypt($req->input('crypted'), $method, $key, OPENSSL_ZERO_PADDING, $key); // OPENSSL_ZERO_PADDING: permite recivir el texto cifrado en base64
// echo "<p style='white-space: pre-line'>".$decrypted."</p>";
return redirect('jd2')->with('links', $decrypted);
}
}
Loading