Skip to content

Commit

Permalink
Update Routing
Browse files Browse the repository at this point in the history
  • Loading branch information
ronmarasigan committed Jul 27, 2021
1 parent b1fd92d commit 54b482c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 10 deletions.
25 changes: 23 additions & 2 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,31 @@ LavaLust Version 2

# Changelog

## Security
To access your index file from public folder, put index.php inside it and change the ff:
1. ROOT_DIR should be dirname(__DIR__);
2. add .htaccess file inside your root directly
AddDefaultCharset UTF-8
<IfModule mod_rewrite.c>
RewriteEngine On
# Route all other requests
RewriteRule ^(.*) public/$1 [L]
</IfModule>
3. add .htaccess file inside your public folder
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>

## Update url_helper
Add exit option as 4th parameter of the function

## Optional usage of mod_rewrite
You can remove the .htaccess file and access the url like http://website.com/index.php/controller/model/args
If you want to use the previous way like http://website.com/index.php/controller/model/args, edit the .htaccess
file accordingly.
If you want to use the previous way like http://website.com/index.php/controller/model/args, rename the htaccess.example
to .htaccess only.

## Fixed Cookie samesite error in PHP version < 7.3
set_cookie($name, $value, $expiration, array())
Expand Down
22 changes: 14 additions & 8 deletions scheme/helpers/url_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,29 @@
if ( ! function_exists('redirect'))
{
/**
* Redirect to a location
* @param string $uri Redirect URL
* @param string $method Refresh or Location
* @param integer $sec [description]
* @return mixed
* redirect helper
*
* @param string $uri
* @param string $method
* @param integer $sec
* @param boolean $exit
* @return void
*/
function redirect($uri = '', $method = NULL, $sec = 0)
function redirect($url = '', $method = NULL, $sec = 0, $exit = FALSE)
{
switch ($method)
{
case 'refresh':
header('Refresh:' .$sec. ';url='. site_url($uri).'');
header('Refresh:' .$sec. ';url='. site_url($url).'');
break;
default:
header('Location: '. site_url($uri), TRUE);
header('Location: '. site_url($url), TRUE);
break;
}
if($exit)
{
exit;
}
}
}

Expand Down

0 comments on commit 54b482c

Please sign in to comment.