Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yaCMS with the new modules #22

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
10 changes: 6 additions & 4 deletions src/modules/login_admin/autologin.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

$prev = NULL;
$out = array();
$out['prev'] = NULL;

if(isset($_COOKIE[session_name()])){
session_set_cookie_params(0, app_path());
Expand All @@ -12,11 +13,12 @@
}
elseif(isset($modules[$module]['VL']['login_need']) && $modules[$module]['VL']['login_need'] && !isset($_SESSION['admin'])){
if($module != 'login_admin'){
$prev = $module;
$out['prev'] = $module;
}

$module = 'login_admin';
$out['module'] = 'login_admin';
$out['reload'] = true;
}

return $prev;
return $out;
/* vim: set ts=4 sw=4 tw=80 sts=4 fdm=marker nowrap et :*/
6 changes: 3 additions & 3 deletions src/modules/login_admin/content.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<form action="index.php?show=login_admin
<?php
if(!empty($feedback_pre['autologin'])){
if(!empty($feedback_pre['autologin']['prev'])){
?>
&action=
<?php
echo $feedback_pre['autologin'];
echo $feedback_pre['autologin']['prev'];
}
?>
" method="post">
Expand Down Expand Up @@ -38,7 +38,7 @@
}

}
elseif($feedback['login']){
elseif($feedback['login']['auth']){
echo 'Authentified!';
}

Expand Down
11 changes: 6 additions & 5 deletions src/modules/login_admin/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
*/

$currentPass = NULL;
$auth = FALSE;
$out = array();
$out['auth'] = FALSE;


if(isset($_POST['adminlogin'])){
Expand All @@ -27,7 +28,7 @@

if(FALSE !== $currentPass){
if(trim($currentPass) == trim($pass)){
$auth = TRUE;
$out['auth'] = TRUE;

if(!isset($_SESSION)){
session_set_cookie_params(0, app_path());
Expand All @@ -37,8 +38,8 @@
$_SESSION['admin'] = TRUE;

if(isset($_GET['action']) && is_string($_GET['action'])){
$module = $_GET['action'];
$reload = TRUE;
$out['module'] = $_GET['action'];
$out['reload'] = TRUE;
}
}
else{
Expand Down Expand Up @@ -70,6 +71,6 @@
}
}

return $auth;
return $out;

/* vim: set ts=4 sw=4 tw=80 sts=4 fdm=marker nowrap et :*/
10 changes: 6 additions & 4 deletions src/modules/login_user/autologin.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

$prev = NULL;
$out = array();
$out['prev'] = NULL;

if(isset($_COOKIE[session_name()])){
session_set_cookie_params(0, app_path());
Expand All @@ -12,11 +13,12 @@
}
elseif(isset($modules[$module]['VL']['login_need']) && $modules[$module]['VL']['login_need'] && !isset($_SESSION['uID'])){
if($module != 'login_admin'){
$prev = $module;
$out['prev'] = $module;
}

$module = 'login_user';
$out['module'] = 'login_user';
$out['reload'] = true;
}

return $prev;
return $out;
/* vim: set ts=4 sw=4 tw=80 sts=4 fdm=marker nowrap et :*/
6 changes: 3 additions & 3 deletions src/modules/login_user/content.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<form action="index.php?show=login_user
<?php
if(!empty($feedback_pre['autologin'])){
if(!empty($feedback_pre['autologin']['prev'])){
?>
&action=
<?php
echo $feedback_pre['autologin'];
echo $feedback_pre['autologin']['prev'];
}
?>
" method="post">
Expand Down Expand Up @@ -37,7 +37,7 @@
default;
}
}
elseif($feedback['login']){
elseif($feedback['login']['auth']){
echo 'Authentified!';
}
echo '</h3>';
Expand Down
11 changes: 6 additions & 5 deletions src/modules/login_user/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@


$currentUser = array();
$auth = FALSE;
$out = array();
$out['auth'] = FALSE;

if(isset($_POST['go'])){

Expand All @@ -33,7 +34,7 @@
fclose($f);

if(FALSE !== $currentUser){
$auth = TRUE;
$out['auth'] = TRUE;


if(!isset($_SESSION)){
Expand All @@ -44,8 +45,8 @@
$_SESSION['uID'] = $currentUser[1];

if(isset($_GET['action']) && is_string($_GET['action'])){
$module = $_GET['action'];
$reload = TRUE;
$out['module'] = $_GET['action'];
$out['reload'] = TRUE;
}
}
else{ //inexistent username
Expand Down Expand Up @@ -79,5 +80,5 @@
}
}

return $auth;
return $out;
/* vim: set ts=4 sw=4 tw=80 sts=4 fdm=marker nowrap et :*/