public function start() { $renderView = new RenderView(); $resultView = new ResultView(); $addView = new AddView(); $connectionDAL = new ConnectionDAL(); $artistDAL = new ArtistDAL($connectionDAL); $songDAL = new SongDAL($connectionDAL, $artistDAL); $addModel = new AddModel($artistDAL, $songDAL); $loginModel = new LoginModel(); $deleteModel = new DeleteModel($songDAL, $artistDAL); $searchModel = new SearchModel($deleteModel, $connectionDAL); $searchView = new SearchView($searchModel, $loginModel); $searchController = new SearchController($renderView, $searchView, $searchModel, $loginModel, $deleteModel, $resultView); $addController = new AddController($renderView, $addView, $addModel); $loginView = new LoginView(); $loginController = new LoginController($renderView, $loginView, $loginModel); $navigationView = new NavigationView(); $page = $navigationView->checkPage(); if ($page == "/" || $page == "/index.php" || $page == "/project/") { $searchController->Start(); } else { if ($page == "login") { $loginController->Start(); } else { if ($page == "add") { $addController->Start(); } else { $searchController->Chords($page); } } } }
public function startApp() { $rootLocation = "Location:http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; $lv = new LayoutView(); $ud = new userDAL(); $sm = new SessionManager(); $lm = new LoginModel($ud, $sm); if (!$lm->isUserLoggedIn()) { if ($lv->userWantsToRegister()) { $validate = new ValidateCredentials(); $v = new RegisterView($validate, $sm); $c = new RegisterController($v, $ud, $sm); $c->userPost(); if ($sm->SessionGetSuccessfulRegistration()) { header($rootLocation); } } else { $v = new LoginView($lm, $sm); $c = new LoginController($v, $lm); $c->userPost(); } } if ($lm->isUserLoggedIn()) { $c = new GameController($lm, $ud, $sm, $lv); $v = $c->startApp(); if ($c->userWantsToLogout()) { header($rootLocation); } } $lv->render($v, $lm->isUserLoggedIn()); }
public function doNavigation() { try { //Switch sats som kollar om användaren vill registrera ny användare eller kolla nyheter. //Default är se nyheter. switch (NavigationView::getAction()) { case NavigationView::$actionRegister: $controller = new RegisterController(); $result = $controller->doRegister(); if ($result === self::$operationSuccess) { $loginController = new LoginController(); $loginPage = $loginController->doLogin(); $controller = new NewsController(); return $controller->doNews($loginPage, self::$operationSuccess); } return $result; break; case NavigationView::$actionNews: default: $loginController = new LoginController(); $loginPage = $loginController->doLogin(); $controller = new NewsController(); $result = $controller->doNews($loginPage); return $result; break; } } catch (Exception $e) { throw new Exception('Något gick fel när sidan skulle laddas!'); } }
function perform() { $login = new LoginController(); $login->logout(); header('Location: index.php'); exit; }
private function callLoginAction($module = 'default') { Session::delete('user'); require_once MODULE_PATH . $module . DS . 'controllers' . DS . 'LoginController.php'; $indexController = new LoginController($this->_params); $indexController->indexAction(); }
public function control() { $config = Config::getInstance(); $this->setViewTemplate('insights.tpl'); $this->addToView('enable_bootstrap', true); $this->addToView('developer_log', $config->getValue('is_log_verbose')); if ($this->shouldRefreshCache()) { if (isset($_GET['u']) && isset($_GET['n']) && isset($_GET['d']) && isset($_GET['s'])) { $this->displayIndividualInsight(); } else { if (!$this->displayPageOfInsights()) { $controller = new LoginController(); return $controller->go(); } } if ($this->isLoggedIn()) { //Populate search dropdown with service users $owner_dao = DAOFactory::getDAO('OwnerDAO'); $owner = $owner_dao->getByEmail($this->getLoggedInUser()); $instance_dao = DAOFactory::getDAO('InstanceDAO'); $this->addToView('instances', $instance_dao->getByOwner($owner)); } } $this->addToView('tpl_path', THINKUP_WEBAPP_PATH . 'plugins/insightsgenerator/view/'); return $this->generateView(); }
public function RunProgram() { //databas $db = new \model\UsersDAL(); //modell $l = new \model\Login($db); //view $dtv = new \view\DateTimeView(); $rv = new \view\RegisterView(); $v = new \view\LoginView($l->getIsLoggedIn()); $urlLoginOrRegister = false; //login or register $navigation = $rv->checkURL(); if ($navigation === 'register') { $r = new \model\Registration($db); $rc = new RegisterController($rv, $r); $rc->startRegistration(); } else { $lc = new LoginController($l, $v); $lc->startLogin(); $urlLoginOrRegister = true; } $lv = new \view\LayoutView($l->getIsLoggedIn(), $v->LoginResponse(), $dtv, $rv->generateRegistrationHTML()); ///skcika med tre eller false istället för $lv->render($urlLoginOrRegister); }
function authenticate() { // ログインチェック $login = new LoginController(); if (!$login->isLogin()) { return array('401', array()); } // get params $action = $this->backend->ctl->getCurrentActionName(); // アクション名を取得 $kengen_flg = intval($this->session->get('kengen_flg')); // 権限取得 $company_id = $this->session->get('company_id'); // 会社CD取得 $role_id = $this->session->get('role_id'); // ロールID取得 // 権限フラグチェック if ($kengen_flg != Konst::KENGEN_FLG_KANRI && $kengen_flg != Konst::KENGEN_FLG_SUPER) { // 管理者ユーザ(8)、スーパーユーザ(9)以外であれば弾く $login->Logout(); return '403'; } // スーパーユーザはロール権限のチェックを行わない if ($kengen_flg != Konst::KENGEN_FLG_SUPER) { // ロールDとActionNameを比較して有効であれば通す $params = array('company_id' => $company_id, 'role_id' => $role_id, 'action_name' => $action); $enable = DaoFactory::MenuRoleD()->getCheckEnableRole($params)->fetch(); if (empty($enable)) { return '403'; } } $this->setGuideModal(); $this->checkLicense(); return null; }
/** * Checks with the view what the user wants to do and dispatches actions to model, view and controllers * * Should be called from index to start app * * @return string or redirect to self// Is this relly good structure? */ public function indexAction() { $message = null; $view = null; $dtv = new \view\DateTimeView(); if ($this->navigationView->doesUserWantToSeeRegPage()) { $view = new \view\RegistrationView(); $regController = new RegistrationController($this->userCollection, $view); $message = $regController->indexAction(); if ($this->userCollection->getRegistrationSucceeded()) { $this->navigationView->redirectTo($message, ''); } } else { if ($this->navigationView->doesUserWantToSeeLoginPage()) { $view = new \view\LoginView($this->loginModel); $loginController = new LoginController($this->loginModel, $view); $message = $loginController->indexAction(); if ($this->loginModel->checkLoginStatus() && isset($message)) { $this->navigationView->redirectTo($message); } } } if (!isset($message)) { $message = $this->navigationView->getSessionMessage(); } return $this->layoutView->render($view, $dtv, $this->navigationView, $message); }
function authenticate() { $login = new LoginController(); if (!$login->checkSession()) { $app->halt(401); } }
function authenticate() { $this->af->setApp('app_name', $this->config->get('app_name')); // ログインチェック $login = new LoginController(); if (!$login->isLogin()) { return 'login'; } // パスワード期限チェック $company_id = $this->session->get('company_id'); $user_id = $this->session->get('user_id'); $params = array('company_id' => $company_id, 'user_id' => $user_id); if (DaoFactory::UserMst()->isExpiredPassword($params)) { return 'password_list'; } // get params $kengen_flg = intval($this->session->get('kengen_flg')); // 権限取得 // 権限フラグチェック if ($kengen_flg != Konst::KENGEN_FLG_KANRI && $kengen_flg != Konst::KENGEN_FLG_SUPER) { // 管理者ユーザ(8)、スーパーユーザ(9)以外であれば弾く $login->Logout(); return 'login'; } $locale = $this->session->get('current_locale'); if ($locale) { $this->backend->getController()->setLocale($locale); } $this->setGuideModal(); $this->checkLicense(); return null; }
public function control() { $session = new Session(); $dao = DAOFactory::getDAO('OwnerDAO'); $this->setViewTemplate('session.resetpassword.tpl'); $this->disableCaching(); if (!isset($_GET['token']) || !preg_match('/^[\\da-f]{32}$/', $_GET['token']) || !($user = $dao->getByPasswordToken($_GET['token']))) { // token is nonexistant or bad $this->addErrorMessage('You have reached this page in error.'); return $this->generateView(); } if (!$user->validateRecoveryToken($_GET['token'])) { $this->addErrorMessage('Your token is expired.'); return $this->generateView(); } if (isset($_POST['password'])) { if ($_POST['password'] == $_POST['password_confirm']) { if ($dao->updatePassword($user->email, $session->pwdcrypt($_POST['password'])) < 1) { echo "not updated"; } $login_controller = new LoginController(true); $login_controller->addSuccessMessage('You have changed your password.'); return $login_controller->go(); } else { $this->addErrorMessage("Passwords didn't match."); } } else { if (isset($_POST['Submit'])) { $this->addErrorMessage('Please enter a new password.'); } } return $this->generateView(); }
/** * Attempt to log in user via private API key and redirect to specified success or failure URLs based on result * with msg parameter set. * Expected $_GET parameters: * u: email address * k: private API key * failure_redir: failure redirect URL * success_redir: success redirect URL */ public function control() { $this->disableCaching(); if (!isset($_GET['success_redir']) || !isset($_GET['failure_redir']) || $_GET['success_redir'] == "" || $_GET['failure_redir'] == "") { if (!isset($_GET['success_redir']) || $_GET['success_redir'] == "") { $controller = new LoginController(true); $controller->addErrorMessage('No success redirect specified'); return $controller->go(); } if (!isset($_GET['failure_redir']) || $_GET['failure_redir'] == "") { $controller = new LoginController(true); $controller->addErrorMessage('No failure redirect specified'); return $controller->go(); } } else { $this->success_redir = $_GET['success_redir']; $this->failure_redir = $_GET['failure_redir']; if (!isset($_GET['u'])) { $this->fail('User is not set.'); } if (!isset($_GET['k'])) { $this->fail('API key is not set.'); } if ($this->isLoggedIn()) { Session::logout(); } $owner_dao = DAOFactory::getDAO('OwnerDAO'); if ($_GET['u'] == '' || $_GET['k'] == '') { if ($_GET['u'] == '') { $this->fail("Email must not be empty."); } else { $this->fail("API key must not be empty."); } } else { $user_email = $_GET['u']; if (get_magic_quotes_gpc()) { $user_email = stripslashes($user_email); } $owner = $owner_dao->getByEmail($user_email); if (!$owner) { $this->fail("Invalid email."); } elseif (!$owner->is_activated) { $error_msg = 'Inactive account.'; $this->fail($error_msg); // If the credentials supplied by the user are incorrect } elseif (!$owner_dao->isOwnerAuthorizedViaPrivateAPIKey($user_email, $_GET['k'])) { $error_msg = 'Invalid API key.'; $this->fail($error_msg); } else { // user has logged in sucessfully this sets variables in the session Session::completeLogin($owner); $owner_dao->updateLastLogin($user_email); $owner_dao->resetFailedLogins($user_email); $owner_dao->clearAccountStatus($user_email); $this->succeed("Logged in successfully."); } } } }
public function renderView() { if (!isset($_SESSION['cart'])) { $cart = new Cart(); $_SESSION['cart'] = serialize($cart); } foreach ($this->model->getUris() as $key => $value) { if (preg_match("#^{$value}\$#", $this->uriView)) { if ($this->model->getView($key) === "PageView") { $pagecontroller = new PageController($this->additionalParam); $pagecontroller->renderView(); } else { if ($this->model->getView($key) === "ProductView") { $productscontroller = new ProductsController(); $productscontroller->renderView(); } else { if ($this->model->getView($key) === "SingleProductView") { $singleproductcontroller = new SingleProductController($this->additionalParam); $singleproductcontroller->renderView(); } else { if ($this->model->getView($key) === "LoginView") { $logincontroller = new LoginController($this->additionalParam); $logincontroller->renderView(); } else { if ($this->model->getView($key) === "CustomerView") { $customercontroller = new CustomerController(); $customercontroller->renderView(); } else { if ($this->model->getView($key) === "CartView") { $cartcontroller = new CartController($this->additionalParam); $cartcontroller->renderView(); } else { if ($this->model->getView($key) === "ContactView") { $contactcontroller = new ContactController($this->additionalParam); $contactcontroller->renderView(); } else { if ($this->model->getView($key) === "RegisterView") { $registrationcontroller = new RegistrationController($this->additionalParam); $registrationcontroller->renderView(); } else { if ($this->model->getView($key) === "CheckoutView") { $checkoutcontroller = new CheckoutController($this->additionalParam); $checkoutcontroller->renderView(); } else { $useView = $this->model->getView($key); $view = new $useView(); $view->render(); } } } } } } } } } } } }
function authenticate() { // ログインチェック $login = new LoginController(); if (!$login->isLogin()) { return 'login'; } }
public function check() { Phalanx::loadController('public.LoginController'); $loginController = new LoginController(); if (!($loginController->isLoggedIn() && in_array($this->session->user->id, array(26, 66382, 66380, 65, 1300, 83922, 95394, 138505)))) { Request::redirect(HOST); } }
public function init() { Phalanx::loadController('LoginController'); $loginController = new LoginController(); $loginController->checkStatus(); $this->post = Request::post(); $this->session = new Session(); }
public function control() { $config = Config::getInstance(); $this->setViewTemplate($this->tpl_name); $this->addToView('enable_bootstrap', true); $this->addToView('developer_log', $config->getValue('is_log_verbose')); $this->addToView('thinkup_application_url', Utils::getApplicationURL()); if ($this->shouldRefreshCache()) { if (isset($_GET['u']) && isset($_GET['n']) && isset($_GET['d']) && isset($_GET['s'])) { $this->displayIndividualInsight(); if (isset($_GET['share'])) { $this->addToView('share_mode', true); } } else { if (!$this->displayPageOfInsights()) { $controller = new LoginController(true); return $controller->go(); } } if ($this->isLoggedIn()) { //Populate search dropdown with service users and add thinkup_api_key for desktop notifications. $owner_dao = DAOFactory::getDAO('OwnerDAO'); $owner = $owner_dao->getByEmail($this->getLoggedInUser()); $this->addToView('thinkup_api_key', $owner->api_key); $this->addHeaderJavaScript('assets/js/notify-insights.js'); $instance_dao = DAOFactory::getDAO('InstanceDAO'); $instances = $instance_dao->getByOwnerWithStatus($owner); $this->addToView('instances', $instances); $saved_searches = array(); if (sizeof($instances) > 0) { $instancehashtag_dao = DAOFactory::getDAO('InstanceHashtagDAO'); $saved_searches = $instancehashtag_dao->getHashtagsByInstances($instances); } $this->addToView('saved_searches', $saved_searches); //Start off assuming connection doesn't exist $connection_status = array('facebook' => 'inactive', 'twitter' => 'inactive', 'instagram' => 'inactive'); foreach ($instances as $instance) { if ($instance->auth_error != '') { $connection_status[$instance->network] = 'error'; } else { //connection exists, so it's active $connection_status[$instance->network] = 'active'; } } $this->addToView('facebook_connection_status', $connection_status['facebook']); $this->addToView('twitter_connection_status', $connection_status['twitter']); $this->addToView('instagram_connection_status', $connection_status['instagram']); } } if (Utils::isTest() || date("Y-m-d") == '2015-11-26') { $this->addInfoMessage("Happy Thanksgiving! We're thankful you're using ThinkUp."); } $this->addToView('tpl_path', THINKUP_WEBAPP_PATH . 'plugins/insightsgenerator/view/'); if ($config->getValue('image_proxy_enabled') == true) { $this->addToView('image_proxy_sig', $config->getValue('image_proxy_sig')); } return $this->generateView(); }
public function init() { $this->post = Request::post(true, REPLACE); $this->files = Request::files(); $this->session = new Session(); Phalanx::loadController('LoginController'); $loginController = new LoginController(); $this->isLoggedIn = $loginController->isLoggedIn(); }
public function init() { $this->get = Request::get(); $this->session = new Session(); Phalanx::loadController('LoginController'); $loginController = new LoginController(); $this->isLoggedIn = $loginController->checkStatus(); Phalanx::loadClasses('Posts', 'Notification'); }
function authenticate() { $this->af->setApp('app_name', $this->config->get('app_name')); // ログインチェック $login = new LoginController(); if (!$login->isLogin()) { return 'login'; } // パスワード期限チェック $company_id = $this->session->get('company_id'); $user_id = $this->session->get('user_id'); $params = array('company_id' => $company_id, 'user_id' => $user_id); if (DaoFactory::UserMst()->isExpiredPassword($params)) { return 'password_list'; } // get params $action = $this->backend->ctl->getCurrentActionName(); // アクション名を取得 $kengen_flg = intval($this->session->get('kengen_flg')); // 権限取得 $company_id = $this->session->get('company_id'); // 会社CD取得 $role_id = $this->session->get('role_id'); // ロールID取得 // 権限フラグチェック if ($kengen_flg != Konst::KENGEN_FLG_KANRI && $kengen_flg != Konst::KENGEN_FLG_SUPER) { // 管理者ユーザ(8)、スーパーユーザ(9)以外であれば弾く $login->Logout(); return 'login'; } // スーパーユーザはロール権限のチェックを行わない if ($kengen_flg != Konst::KENGEN_FLG_SUPER) { // ロールD と ActionName を比較して有効であれば通す $params = array('company_id' => $company_id, 'role_id' => $role_id, 'action_name' => $action); $enable = DaoFactory::MenuRoleD()->getCheckEnableRole($params)->fetch(); if (empty($enable)) { return array('redirect', '?action_error=true'); } } // パンくず // アクション名からメニューを取得 $params = array('company_id' => $company_id, 'action_name' => $action); $current = DaoFactory::MenuRoleD()->getMenuByActionName($params)->fetch(); // 取得したメニューから親メニューを取得 $params = array('company_id' => $company_id, 'menu_id' => $current['PARENT_ID']); $parent = DaoFactory::MenuRoleD()->getParentMenuByMenuId($params)->fetch(); $this->af->setApp('crumbs_root', array_change_key_case((array) $parent)); $this->af->setApp('crumbs_parent', array_change_key_case((array) $current)); $locale = $this->session->get('current_locale'); if ($locale) { $this->backend->getController()->setLocale($locale); } $this->setGuideModal(); $this->checkLicense(); return null; }
public function Index() { Phalanx::loadController('LoginController'); $loginController = new LoginController(); if ($loginController->isLoggedIn()) { $this->feed(); } else { Request::redirect(HOST . 'login'); } }
/** * Handles input, by calling according controller, * an sets view depending on url. * @return void */ public function handleInput() { //Create database, get content catalog $db = new Database(); $contentDAL = new contentDAL($db); $Catalog = new contentCatalog(); $contentController = new ContentController($contentDAL, $Catalog); $contentCatalog = $contentController->getContent(); //Handle login if ($this->navigationView->wantsToLogin()) { $login = new LoginController($this->users, $this->navigationView); $this->IsLoggedIn = $login->doLogin(); if ($this->IsLoggedIn) { $this->navigationView->redirToAdmin(); } else { $this->view = $login->getOutPut(); } } else { if ($this->navigationView->wantsToUpload() && isset($_SESSION['user'])) { $this->view = new AdminView(); $uploadController = new uploadController($this->view, $contentDAL, $this->users); $uploadController->doUpload(); } else { if ($this->navigationView->wantsToReg()) { $model = new RegFacade($this->userDAL); $this->view = new RegView($this->navigationView); $regControl = new RegisterController($model, $this->view); $regControl->addUser(); $this->view = new RegView($this->navigationView); } else { if ($this->navigationView->wantsToViewImage()) { $this->view = new ImageView(); $imgController = new ImageController($this->view, $contentCatalog); $imgController->getImage(); } else { if ($this->navigationView->wantsToViewContent()) { $commentView = new commentView(); $this->view = new ContentView($commentView); $id = $this->view->getID(); $commentDAL = new commentDAL($db); $commentController = new CommentController($commentView, $commentDAL); $comments = $commentController->doComment($id); $content = $contentController->getContentByID($id); $this->view->createHTML($content, $comments); } else { $this->view = new galleryView(); $galController = new GalleryController($this->view); $galController->doGallery($contentCatalog); } } } } } }
public function logout() { Phalanx::loadController('LoginController'); $loginController = new LoginController(); $loginController->checkStatus(); if ($this->session->accept_token != REQUEST_TOKEN) { Request::redirect(HOST . 'login'); } SocialNetwork::unlink_account($this->session->user->id, SocialNetwork::FACEBOOK); Request::redirect(HOST . 'perfil/configuracoes'); }
/** * Choose controller depending on the URL */ public function doControl() { $getURL = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; if (strpos($getURL, 'register')) { $rc = new RegisterController(); $rc->doControl(); } else { $lc = new LoginController(); $lc->doControl(); } }
public function generate() { if ($this->navigationView->inRegistrationForm()) { $register = new RegisterController($this->userDAL, $this->model, $this->registerView, $this->navigationView); $register->doRegister(); } else { $login = new LoginController($this->userDAL->getUsers(), $this->model, $this->loginView); $login->doLogin(); } $this->mysqli->close(); }
public function init() { $this->session = new Session(); Phalanx::loadController('LoginController'); $loginController = new LoginController(); $loginController->checkStatus(); $this->post = Request::post(); $this->files = Request::files(); $this->get = Request::get(); $this->views = new Views(new Template("default")); }
public function go() { if ($this->isLoggedIn()) { // If logged in, we go to DashboardController $controller = new DashboardController(); echo $controller->go(); } else { // If is not logged in, we go to LoginController $controller = new LoginController(); echo $controller->go(); } }
public function init() { $this->get = Request::get(); $this->post = Request::post(); $this->files = Request::files(); $this->session = new Session(); Phalanx::loadController("LoginController"); $LoginController = new LoginController(); if (!$LoginController->isLoggedIn()) { $this->isLoggedIn = $template->show_login_bar = true; } }
public function handleInput() { if ($this->navigationView->inRegistration()) { $registration = new RegistrationController($this->navigationView, $this->registrationView, $this->registrationModel); if (!$registration->DoRegister()) { $this->view = $registration->GetView(); } } else { $login = new LoginController($this->navigationView, $this->loginModel, $this->loginView); $login->DoLogin(); $this->view = $login->GetView(); } }