Skip to content

Commit

Permalink
Slim4 prep
Browse files Browse the repository at this point in the history
  • Loading branch information
rotexdegba committed Feb 18, 2023
1 parent b9779d4 commit 373650b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/controllers/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -579,11 +579,11 @@ public function actionLogin() {

if( $auth->isValid() ) {

if( sMVC_GetBaseUrlPath().'' === '' || strpos($success_redirect_path, sMVC_GetBaseUrlPath()) === false ) {
if( $this->getAppBasePath().'' === '' || strpos($success_redirect_path, $this->getAppBasePath()) === false ) {

//prepend base path
$success_redirect_path =
sMVC_GetBaseUrlPath().'/'.ltrim($success_redirect_path, '/');
$this->getAppBasePath().'/'.ltrim($success_redirect_path, '/');
}

//re-direct
Expand Down Expand Up @@ -635,7 +635,7 @@ public function actionLogout($show_status_on_completion = false) {
$controller = 'base-controller';
}

$redirect_path = sMVC_GetBaseUrlPath() . "/{$controller}/{$actn}";
$redirect_path = $this->getAppBasePath() . "/{$controller}/{$actn}";

if(
session_status() === PHP_SESSION_ACTIVE
Expand Down Expand Up @@ -730,7 +730,7 @@ protected function getResponseObjForLoginRedirectionIfNotLoggedIn() {

$prepend_action = !SMVC_APP_AUTO_PREPEND_ACTION_TO_ACTION_METHOD_NAMES;
$action = ($prepend_action) ? 'action-login' : 'login';
$redr_path = sMVC_GetBaseUrlPath() . "/{$controller}/$action";
$redr_path = $this->getAppBasePath() . "/{$controller}/$action";

return $this->response->withStatus(302)->withHeader('Location', $redr_path);
}
Expand Down Expand Up @@ -768,7 +768,7 @@ protected function storeCurrentUrlForLoginRedirection(): self {
) { return $this; }

$uri = $this->request->getUri();
$base_path = sMVC_GetBaseUrlPath();
$base_path = $this->getAppBasePath();
$fragment = $uri->getFragment();
$query = $uri->getQuery();
$path = $uri->getPath();
Expand Down
6 changes: 6 additions & 0 deletions src/functions/framework-helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ function sMVC_DumpVar(...$vals): void {
* \Slim\Http\Uri::getBasePath(), in order to ensure that your
* app will be compatible with other PSR-7 implementations because
* \Slim\Http\Uri::getBasePath() is not a PSR-7 method.
*
* @deprecated since version 4.x
* @see SlimMvcTools\Controllers\BaseController->getAppBasePath()
*/
function sMVC_GetBaseUrlPath(): string {

Expand Down Expand Up @@ -149,6 +152,9 @@ function sMVC_GetBaseUrlPath(): string {
*
* @param string $path
* @return string
*
* @deprecated since version 4.x
* @see SlimMvcTools\Controllers\BaseController->makeLink(string $path): string
*/
function sMVC_MakeLink(string $path) {

Expand Down

0 comments on commit 373650b

Please sign in to comment.