-
Notifications
You must be signed in to change notification settings - Fork 2
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 #48 from kivudesign/version_boss
Refactoring app project to support multiple folder autoloading from buildit autoload,
- Loading branch information
Showing
48 changed files
with
951 additions
and
572 deletions.
There are no files selected for viewing
File renamed without changes.
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 | ||
/** | ||
* Support for DataBase configuration resource | ||
* Authentication information store on global variable | ||
*/ | ||
$db_conf= $load_init_config["db_conf"]; | ||
// database configuration setup | ||
$GLOBALS['config']=[ | ||
'mysql'=>[ | ||
'host'=> $db_conf["host"], | ||
'username'=> $db_conf["user"], | ||
'password'=> $db_conf["password"], | ||
'db'=> $db_conf["database"] | ||
], | ||
'remender'=>[], | ||
'session'=>[ | ||
"token_name"=>"token" | ||
], | ||
'controller'=>WEB_ROOT, | ||
'middleware'=>WEB_ROOT, | ||
'vendor'=>false, | ||
'autoload'=>["src","controller","middleware"] | ||
]; |
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,5 @@ | ||
<?php | ||
if ( $_SERVER['REQUEST_METHOD']=='GET' && realpath(__FILE__) == realpath( $_SERVER['SCRIPT_FILENAME'] ) ) { | ||
header( 'HTTP/1.0 403 Forbidden', TRUE, 403 ); | ||
die( header( 'location:'.str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']) ) ); | ||
} |
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,2 @@ | ||
<?php | ||
$load_init_config = parse_ini_file("config.ini", true); |
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 | ||
/** | ||
* Wepesi Home Controller | ||
* | ||
*/ | ||
namespace Wepesi\Controller; | ||
use Wepesi\Core\Input; | ||
use Wepesi\Core\Redirect; | ||
use Wepesi\Core\Session; | ||
|
||
class homeController{ | ||
function __construct() | ||
{ | ||
} | ||
|
||
function home(){ | ||
Redirect::to(WEB_ROOT); | ||
} | ||
function changeLang(){ | ||
Session::put('lang', Input::get("lang")); | ||
Redirect::to(WEB_ROOT); | ||
} | ||
} |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
if ( $_SERVER['REQUEST_METHOD']=='GET' && realpath(__FILE__) == realpath( $_SERVER['SCRIPT_FILENAME'] ) ) { | ||
header( 'HTTP/1.0 403 Forbidden', TRUE, 403 ); | ||
die( header( 'location:'.str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']) ) ); | ||
} |
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
if ( $_SERVER['REQUEST_METHOD']=='GET' && realpath(__FILE__) == realpath( $_SERVER['SCRIPT_FILENAME'] ) ) { | ||
header( 'HTTP/1.0 403 Forbidden', TRUE, 403 ); | ||
die( header( 'location:'.str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']) ) ); | ||
} |
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 |
---|---|---|
@@ -1,35 +1,21 @@ | ||
<?php | ||
session_start(); | ||
|
||
require_once 'global.php'; | ||
// | ||
|
||
/** | ||
* @param $dir | ||
* @return array|false | ||
* | ||
*/ | ||
function getSubDirectories($dir) { | ||
$subDir = array(); | ||
$directories = array_filter(glob($dir), 'is_dir'); | ||
$subDir = array_merge($subDir, $directories); | ||
foreach ($directories as $directory) $subDir = array_merge($subDir, getSubDirectories($directory . '/*')); | ||
return $subDir; | ||
} | ||
session_start(); | ||
|
||
include "config/load_init_config.php"; | ||
include "constant.php"; | ||
include "config/globals.php"; | ||
include "helper/functions.php"; | ||
/** | ||
* @param $fileName | ||
* @return mixed|string | ||
* | ||
*/ | ||
function checkFileExtension($fileName){ | ||
$file_parts = pathinfo($fileName); | ||
$file = isset($file_parts['extension']) ? $fileName : $fileName . ".php"; | ||
return $file; | ||
} | ||
require_once 'cors.php'; | ||
//activet this module for only for api app | ||
$autoload= (object)$ini_array->autoload; | ||
if(isset($autoload->vendor) && !$autoload->vendor){ | ||
var_dump($GLOBALS['config']); | ||
include 'autoload.php'; | ||
}else{ | ||
die("There hould be a vendor key on autoload patern to manage with autoload to be used. by default if false"); | ||
} | ||
|
||
$vendor = isset($GLOBALS["config"]) ? (isset($GLOBALS["config"]["vendor"]) ?$GLOBALS["config"]["vendor"]: false) : false; | ||
|
||
if( !$vendor ){ | ||
include "autoload.php"; | ||
}else{ | ||
include "vendor/autoload.php"; | ||
} |
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 | ||
|
||
/** | ||
* Scan a folder an get all directory inside | ||
* @param $dir | ||
* @return array | ||
*/ | ||
function getSubDirectories($dir): array | ||
{ | ||
$subDir = array(); | ||
$directories = array_filter(glob($dir), 'is_dir'); | ||
$subDir = array_merge($subDir, $directories); | ||
foreach ($directories as $directory) $subDir = array_merge($subDir, getSubDirectories($directory . '/*')); | ||
return $subDir; | ||
} | ||
/** | ||
* @param $fileName | ||
* @return mixed|string | ||
*/ | ||
function checkFileExtension($fileName){ | ||
$file_parts = pathinfo($fileName); | ||
return isset($file_parts['extension']) ? $fileName : $fileName . ".php"; | ||
} |
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,5 @@ | ||
<?php | ||
if ( $_SERVER['REQUEST_METHOD']=='GET' && realpath(__FILE__) == realpath( $_SERVER['SCRIPT_FILENAME'] ) ) { | ||
header( 'HTTP/1.0 403 Forbidden', TRUE, 403 ); | ||
die( header( 'location:'.str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']) ) ); | ||
} |
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
<?php | ||
require_once 'global/init.php'; | ||
require_once 'route/index.php'; | ||
?> | ||
require_once 'route/router.php'; |
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,5 @@ | ||
<?php | ||
if ( $_SERVER['REQUEST_METHOD']=='GET' && realpath(__FILE__) == realpath( $_SERVER['SCRIPT_FILENAME'] ) ) { | ||
header( 'HTTP/1.0 403 Forbidden', TRUE, 403 ); | ||
die( header( 'location:'.str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']) ) ); | ||
} |
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,5 @@ | ||
<?php | ||
if ( $_SERVER['REQUEST_METHOD']=='GET' && realpath(__FILE__) == realpath( $_SERVER['SCRIPT_FILENAME'] ) ) { | ||
header( 'HTTP/1.0 403 Forbidden', TRUE, 403 ); | ||
die( header( 'location:'.str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']) ) ); | ||
} |
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,5 @@ | ||
<?php | ||
if ( $_SERVER['REQUEST_METHOD']=='GET' && realpath(__FILE__) == realpath( $_SERVER['SCRIPT_FILENAME'] ) ) { | ||
header( 'HTTP/1.0 403 Forbidden', TRUE, 403 ); | ||
die( header( 'location:'.str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']) ) ); | ||
} |
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,5 @@ | ||
<?php | ||
if ( $_SERVER['REQUEST_METHOD']=='GET' && realpath(__FILE__) == realpath( $_SERVER['SCRIPT_FILENAME'] ) ) { | ||
header( 'HTTP/1.0 403 Forbidden', TRUE, 403 ); | ||
die( header( 'location:'.str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']) ) ); | ||
} |
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,5 @@ | ||
<?php | ||
if ( $_SERVER['REQUEST_METHOD']=='GET' && realpath(__FILE__) == realpath( $_SERVER['SCRIPT_FILENAME'] ) ) { | ||
header( 'HTTP/1.0 403 Forbidden', TRUE, 403 ); | ||
die( header( 'location:'.str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']) ) ); | ||
} |
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,5 @@ | ||
<?php | ||
if ( $_SERVER['REQUEST_METHOD']=='GET' && realpath(__FILE__) == realpath( $_SERVER['SCRIPT_FILENAME'] ) ) { | ||
header( 'HTTP/1.0 403 Forbidden', TRUE, 403 ); | ||
die( header( 'location:'.str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']) ) ); | ||
} |
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,29 @@ | ||
<?php | ||
namespace wepesi\Validation; | ||
|
||
use Wepesi\Core\Validation\Validate; | ||
|
||
class HomeValidation | ||
{ | ||
function changeLang(){ | ||
$valid = new Validate(); | ||
$schema = [ | ||
"token" => $valid->string("token") | ||
->min(1) | ||
->max(2) | ||
->required() | ||
->check(), | ||
"lang" => $valid->string("lang") | ||
->min(1) | ||
->max(2) | ||
->required() | ||
->check() | ||
]; | ||
|
||
$valid->check($_POST,$schema); | ||
if(!$valid->passed()){ | ||
var_dump($valid->errors()); | ||
die(); | ||
} | ||
} | ||
} |
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,5 @@ | ||
<?php | ||
if ( $_SERVER['REQUEST_METHOD']=='GET' && realpath(__FILE__) == realpath( $_SERVER['SCRIPT_FILENAME'] ) ) { | ||
header( 'HTTP/1.0 403 Forbidden', TRUE, 403 ); | ||
die( header( 'location:'.str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']) ) ); | ||
} |
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,5 @@ | ||
<?php | ||
if ( $_SERVER['REQUEST_METHOD']=='GET' && realpath(__FILE__) == realpath( $_SERVER['SCRIPT_FILENAME'] ) ) { | ||
header( 'HTTP/1.0 403 Forbidden', TRUE, 403 ); | ||
die( header( 'location:'.str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']) ) ); | ||
} |
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 |
---|---|---|
@@ -1,15 +1,5 @@ | ||
<?php | ||
|
||
use Wepesi\Core\Routing\Router; | ||
use Wepesi\Core\View; | ||
|
||
$route=new Router(); | ||
// setup get started pages index | ||
$route->get('/', function () { | ||
new View('index'); | ||
}); | ||
$route->get('/home', "homeCtrl#home"); | ||
$route->get('/contact', [homeCtrl::class,"contact"]); | ||
|
||
$route->run(); | ||
?> | ||
if ( $_SERVER['REQUEST_METHOD']=='GET' && realpath(__FILE__) == realpath( $_SERVER['SCRIPT_FILENAME'] ) ) { | ||
header( 'HTTP/1.0 403 Forbidden', TRUE, 403 ); | ||
die( header( 'location:'.str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']) ) ); | ||
} |
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,2 @@ | ||
<?php | ||
include "web.php"; |
Oops, something went wrong.