function redirectIfNotLoggedIn() { $actionNavigator = new ActionNavigator(null); if (!isLogInActive()) { $actionNavigator->logOutAndRedirect(); } }
function main() { $email = $_POST[EMAIL]; $password = $_POST[PASSWORD]; $actor = $_POST[ACTOR]; $userInstance = getLoggedInUserByCredentials($actor, $email, $password); $actionNavigator = new ActionNavigator($userInstance); $actionNavigator->logInAndRedirect($actor); }
function processChangedPassword() { $loggedInUserInstance = getCurrentlyLoggedInUser(); $oldPassword = $_POST[OLD_PASSWORD]; $currentPassword = $_POST[PASSWORD]; $currentPasswordConfirmation = $_POST[PASSWORD_CONFIRMATION]; $isOldPasswordCorrect = $loggedInUserInstance->isPasswordCorrect($oldPassword); $isCurrentPasswordConfirmed = strcmp($currentPassword, $currentPasswordConfirmation) === 0; $loggedInUserInstance->setPassword($currentPassword); $actionNavigator = new ActionNavigator($loggedInUserInstance); $actionNavigator->changePasswordAndRedirect($isOldPasswordCorrect && $isCurrentPasswordConfirmed); }
<?php /** * Created by PhpStorm. * User: Marin Kaçaj * Date: 6/12/2015 * Time: 12:08 PM */ use fti\adv_db\entity\Professor; use fti\adv_db\http\HttpEntityParamBuilder; use fti\adv_db\nav\ActionNavigator; require_once dirname(dirname(__FILE__)) . '/includes/session.php'; require_once dirname(dirname(__FILE__)) . '/auth/security.php'; require_once dirname(dirname(dirname(__FILE__))) . '/src/fti/adv_db/functions/auto_loader.php'; spl_autoload_register('class_auto_loader'); redirectIfNotSecretary(); $params = HttpEntityParamBuilder::buildParams(); $professorInstance = new Professor($params); $actionNavigator = new ActionNavigator($professorInstance); $actionNavigator->saveAndRedirect();
<?php /** * Created by PhpStorm. * User: Marin Kaçaj * Date: 6/13/2015 * Time: 7:29 PM */ use fti\adv_db\entity\Season; use fti\adv_db\http\HttpEntityParamBuilder; use fti\adv_db\nav\ActionNavigator; require_once dirname(dirname(__FILE__)) . '/includes/session.php'; require_once dirname(dirname(__FILE__)) . '/auth/security.php'; require_once dirname(dirname(dirname(__FILE__))) . '/src/fti/adv_db/functions/auto_loader.php'; spl_autoload_register('class_auto_loader'); redirectIfNotSecretary(); $params = HttpEntityParamBuilder::buildParams(); $seasonInstance = new Season($params); $actionNavigator = new ActionNavigator($seasonInstance); $actionNavigator->updateAndRedirect();
<?php /** * Created by PhpStorm. * User: Marin Kaçaj * Date: 6/14/2015 * Time: 4:49 PM */ use fti\adv_db\entity\Subject; use fti\adv_db\http\HttpEntityParamBuilder; use fti\adv_db\nav\ActionNavigator; require_once dirname(dirname(__FILE__)) . '/includes/session.php'; require_once dirname(dirname(__FILE__)) . '/auth/security.php'; require_once dirname(dirname(dirname(__FILE__))) . '/src/fti/adv_db/functions/auto_loader.php'; spl_autoload_register('class_auto_loader'); redirectIfNotSecretary(); $id = HttpEntityParamBuilder::retrieveFilter(array(Subject::PROP_ID)); $subjectInstance = Subject::getBuilder()->getByIdentifier($id); $actionNavigator = new ActionNavigator($subjectInstance); $actionNavigator->deleteAndRedirect();
<?php /** * Created by PhpStorm. * User: C.R.C * Date: 6/23/2015 * Time: 9:03 PM */ use fti\adv_db\nav\ActionNavigator; require_once dirname(dirname(__FILE__)) . '/includes/session.php'; require_once dirname(dirname(dirname(__FILE__))) . '/src/fti/adv_db/constants/auth.php'; require_once dirname(dirname(dirname(__FILE__))) . '/src/fti/adv_db/functions/auto_loader.php'; spl_autoload_register('class_auto_loader'); $actionNavigator = new ActionNavigator(null); $actionNavigator->logOutAndRedirect();