Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
72b003d
Use nightly builds for php-core package
Feb 15, 2017
80a546b
Update composer.lock
Feb 15, 2017
bad97b6
Introducing Storage
Feb 15, 2017
7baecdc
Storage config file
Feb 15, 2017
79418d7
Remove para under nightly build
Feb 15, 2017
5e0035f
Added #second section
Feb 15, 2017
4794892
Add to main.css for styling the exec time
Feb 15, 2017
8d520a8
Directory structures, nightly footer class
Feb 15, 2017
f6285be
Add apps listing
Feb 15, 2017
65ddd24
Added tempting engine
Feb 24, 2017
6aa5b98
Release candidate 0.5 (need to review changes)
farizluqman Oct 3, 2017
793eabd
Release candidate 0.5
farizluqman Oct 4, 2017
585ab3a
Fix Travis-CI .yml and xml
farizluqman Oct 4, 2017
421c312
Apply fixes from StyleCI
farizluqman Oct 5, 2017
cd1ec2c
Merge pull request #13 from stupidlysimple/analysis-qo23yg
farizluqman Oct 5, 2017
7ea059b
Edit database.php and .htaccess
farizluqman Oct 5, 2017
f511a2c
Fix database.php
farizluqman Oct 5, 2017
59c7ef7
Apply fixes from StyleCI
farizluqman Oct 5, 2017
b3725c7
Merge pull request #15 from stupidlysimple/analysis-qyM14p
farizluqman Oct 5, 2017
d1c71c7
Update README.md
farizluqman Oct 6, 2017
5eac644
Release candidate 0.5 (need to review changes)
farizluqman Oct 6, 2017
ece8450
Apply fixes from StyleCI
farizluqman Oct 6, 2017
151af5c
Merge pull request #18 from stupidlysimple/analysis-X0KR6e
farizluqman Oct 6, 2017
d92c71c
Add minimum stability to dev (for nightly)
farizluqman Oct 6, 2017
2bd36f4
Release candidate 0.5.0-dev
farizluqman Oct 10, 2017
351bbd9
Release candidate 0.5-beta2
farizluqman Oct 16, 2017
125ba29
Add php unit testing
farizluqman Oct 16, 2017
56aa5f5
Change directory of test files
farizluqman Oct 16, 2017
8a25ed4
Apply fixes from StyleCI
farizluqman Oct 16, 2017
ca4640f
Merge pull request #20 from stupidlysimple/analysis-zeoyn7
farizluqman Oct 16, 2017
8226920
Update README.md
farizluqman Oct 16, 2017
667bd28
Add DIscord invite link
farizluqman Oct 16, 2017
bc3cc78
Add DIscord chat icon and link
farizluqman Oct 16, 2017
234bca7
Add support for various templating engine / renderer
farizluqman Oct 24, 2017
49b980d
Added platform configuration on composer.json
farizluqman Oct 25, 2017
334ce89
Change version 5.6.19 to 5.6
farizluqman Oct 25, 2017
12b27b3
Add --ignore-platform-reqs in travis.yml
farizluqman Oct 25, 2017
74454ad
Apply fixes from StyleCI
farizluqman Oct 25, 2017
25d8153
Merge pull request #22 from stupidlysimple/analysis-zRbJOM
farizluqman Oct 25, 2017
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
vendor/*
.idea/*

.zedstate
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: php
php:
- 5.6
before_script: composer update
script: phpunit vendor/damnstupidsimple/core/tests/AppTest.php --colors=auto
before_script: composer update --ignore-platform-reqs
script: phpunit tests/AppTest.php --colors=auto
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

Follow us on [Facebook](https://www.facebook.com/stupidlysimpleframework).

[![Join the chat at https://gitter.im/stupidlysimpleframework](https://badges.gitter.im/stupidlysimple/php.svg)](https://gitter.im/stupidlysimpleframework?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Chat with Discord](https://i.imgur.com/imbJExE.jpg)](https://discord.gg/EQ4w9Cs)

[![PHP version](https://badge.fury.io/ph/stupidlysimple%2Fphp.svg)](https://badge.fury.io/ph/stupidlysimple%2Fphp) [![Build](https://api.travis-ci.org/stupidlysimple/php.svg)](https://travis-ci.org/stupidlysimple/php)
[![Total Downloads](https://poser.pugx.org/stupidlysimple/php/downloads)](https://packagist.org/packages/stupidlysimple/php)
[![PHP version](https://badge.fury.io/ph/stupidlysimple%2Fphp.svg)](https://badge.fury.io/ph/stupidlysimple%2Fphp) [![Build](https://api.travis-ci.org/stupidlysimple/php.svg)](https://travis-ci.org/stupidlysimple/php) [![Style-CI](https://styleci.io/repos/62019007/shield?branch=nightly)](https://styleci.io/repos/62019007) [![Scrutinizer-CI](https://scrutinizer-ci.com/g/stupidlysimple/php/badges/quality-score.png?b=nightly)](https://scrutinizer-ci.com/g/stupidlysimple/php/) [![Total Downloads](https://poser.pugx.org/stupidlysimple/php/downloads)](https://packagist.org/packages/stupidlysimple/php)
[![composer.lock](https://poser.pugx.org/stupidlysimple/php/composerlock)](https://packagist.org/packages/stupidlysimple/php)
[![License](https://img.shields.io/:license-mit-blue.svg)](https://github.com/stupidlysimple/php/blob/master/LICENSE)
[![Made In](https://img.shields.io/badge/made%20in-Malaysia-red.svg)](https://www.google.com/search?q=malaysia)
Expand Down Expand Up @@ -92,8 +91,6 @@ Introducing nightly builds: we are really committed to project that we decided t

Nightly builds are released more often than the stable build. Eventually a nightly build will be converted to stable.

Developers are very recommended to create pull request under the nightly branch.

[Get nightly builds](https://github.com/stupidlysimple/php/wiki/Nightly-Builds)

[[back to top]](#table-of-contents)
Expand Down
33 changes: 0 additions & 33 deletions app/Controller/Admin.php

This file was deleted.

157 changes: 79 additions & 78 deletions app/Controller/Auth.php
Original file line number Diff line number Diff line change
@@ -1,130 +1,131 @@
<?php
/**
* StupidlySimple - A PHP Framework For Lazy Developers
* StupidlySimple - A PHP Framework For Lazy Developers.
*
* @package StupidlySimple
* @author Fariz Luqman <fariz.fnb@gmail.com>
* @copyright 2017 Fariz Luqman
* @license MIT
*
* @link https://stupidlysimple.github.io/
*/
namespace Controller;

use Sentry;
use Response;
use Request;
use Viewer;
namespace Controller;

class Auth {
public function __construct()
{
}
use Cartalyst\Sentry\Facades\Native\Sentry;
use Cartalyst\Sentry\Users;
use Simplyfier\Http\Request;
use Simplyfier\Http\Response;

public function displayRegisterPage()
{
Viewer::file('resources/views/auth/register');
}
/**
* Class Auth.
*/
class Auth
{
private static $successRedirectURL = 'admin';

public function displayLoginPage()
public static function check()
{
Viewer::file('resources/views/auth/login');
if (Sentry::check() !== true) {
Response::redirect('login');
}
}

public function doAuthenticate()
public static function authenticate()
{
try{
try {
// Login credentials
$credentials = array(
$credentials = [
'email' => Request::get('email'),
'password' => Request::get('password')
);
'password' => Request::get('password'),
];

// Authenticate the user
$user = Sentry::authenticate($credentials, false);

}catch (\Cartalyst\Sentry\Users\LoginRequiredException $e){
} catch (Users\LoginRequiredException $e) {
Response::redirect('login')->with([
'login_message'=>'Login credentials not supplied',
'type' =>'alert-danger'
'login_message'=> 'Login credentials not supplied',
'type' => 'alert-danger',
]);

}catch (\Cartalyst\Sentry\Users\PasswordRequiredException $e){
} catch (Users\PasswordRequiredException $e) {
Response::redirect('login')->with([
'login_message'=>'Password field is required',
'type' =>'alert-danger'
'login_message'=> 'Password field is required',
'type' => 'alert-danger',
]);

}catch (\Cartalyst\Sentry\Users\WrongPasswordException $e){
} catch (Users\WrongPasswordException $e) {
Response::redirect('login')->with([
'login_message'=>'Wrong password, try again.',
'type' =>'alert-danger'
'login_message'=> 'Wrong password, try again.',
'type' => 'alert-danger',
]);

}catch (\Cartalyst\Sentry\Users\UserNotFoundException $e){
} catch (Users\UserNotFoundException $e) {
Response::redirect('login')->with([
'login_message'=>'User not found.',
'type' =>'alert-danger'
'login_message'=> 'User not found.',
'type' => 'alert-danger',
]);

}catch (\Cartalyst\Sentry\Users\UserNotActivatedException $e){
} catch (Users\UserNotActivatedException $e) {
Response::redirect('login')->with([
'login_message'=>'User is not activated.',
'type' =>'alert-danger'
'login_message'=> 'User is not activated.',
'type' => 'alert-danger',
]);

}finally{
if(Sentry::check() === true){
Admin::redirectToAdminHome();
}else{
} finally {
if (Sentry::check() === true) {
Response::redirect(self::$successRedirectURL)->with([
'login_message'=> 'Login successful.',
'type' => 'alert-success',
]);
} else {
Response::redirect('login')->with([
'login_message'=>'Unable to login',
'type' =>'alert-danger'
'login_message'=> 'Unable to login',
'type' => 'alert-danger',
]);
}
}
}

public function doRegister(){
try{
$user = Sentry::register(array(
'email' => Request::get('email'),
'password' => Request::get('password'),
public static function register()
{
try {
$user = Sentry::register([
'email' => Request::get('email'),
'password' => Request::get('password'),
'first_name' => Request::get('first_name'),
'last_name' => Request::get('last_name')
), $activate = true);

}catch (\Cartalyst\Sentry\Users\LoginRequiredException $e){
'last_name' => Request::get('last_name'),
], $activate = true);
} catch (Users\LoginRequiredException $e) {
Response::redirect('register')->with([
'login_message'=>'Login credentials not supplied',
'type' =>'alert-danger'
'login_message'=> 'Login credentials not supplied',
'type' => 'alert-danger',
]);

}catch (\Cartalyst\Sentry\Users\PasswordRequiredException $e){
} catch (Users\PasswordRequiredException $e) {
Response::redirect('register')->with([
'login_message'=>'Password field is required',
'type' =>'alert-danger'
'login_message'=> 'Password field is required',
'type' => 'alert-danger',
]);

}catch (\Cartalyst\Sentry\Users\UserExistsException $e){
} catch (Users\UserExistsException $e) {
Response::redirect('register')->with([
'login_message'=>'User with that login already exist.',
'type' =>'alert-danger'
'login_message'=> 'User with that login already exist.',
'type' => 'alert-danger',
]);

}catch(\Exception $e){

}finally{
if($user){
} catch (\Exception $e) {
Response::redirect('register')->with([
'login_message'=> 'Login is not successful.',
'type' => 'alert-danger',
]);
} finally {
if ($user) {
Response::redirect('login')->with([
'login_message'=>'Registration successful. You can now login.',
'type' =>'alert-success'
'login_message'=> 'Registration successful. You can now login.',
'type' => 'alert-success',
]);
}
}
}

public function doLogout(){
public static function logout()
{
Sentry::logout();
Response::redirect('login');
Response::redirect('login')->with([
'login_message'=> 'Logout successful.',
'type' => 'alert-success',
]);
}

}
28 changes: 16 additions & 12 deletions app/Controller/Hello.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
<?php
/**
* StupidlySimple - A PHP Framework For Lazy Developers
* StupidlySimple - A PHP Framework For Lazy Developers.
*
* @package StupidlySimple
* @author Fariz Luqman <fariz.fnb@gmail.com>
* @copyright 2017 Fariz Luqman
* @license MIT
*
* @link https://stupidlysimple.github.io/
*/

namespace Controller;

use Core\Response;
use Core\Request;
use Simplyfier\Http\Request;

class Hello {
public function greetWithName($name){
echo ('Hello, '. $name. '!');
class Hello
{
public function greetWithName($name)
{
echo 'Hello, '.$name.'!';
}
public function greetForm(){

public function greetForm()
{
$name = Request::get('name');
if($name == ''){
if ($name == '') {
echo 'How could you have no name :(';
}else{
echo ('Hello, '. $name. '!');
} else {
echo 'Hello, '.$name.'!';
}
}
}
}
Loading