/** * one action Index * for show and update userinfo */ public function actionIndex() { if ($_SERVER['REQUEST_METHOD'] === 'POST') { Module::getTable('UserInfo'); $usersTable = new UserInfo(); if (isset($_POST['firstname'])) { echo $_POST['surname']; // save user's additional info $userInfo['uid'] = $_SESSION['uid']; $userInfo['firstname'] = isset($_POST['firstname']) ? $_POST['firstname'] : ' '; $userInfo['surname'] = isset($_POST['surname']) ? $_POST['surname'] : ' '; $userInfo['website'] = isset($_POST['website']) ? $_POST['website'] : ' '; $userInfo['imageurl'] = isset($_POST['imageurl']) ? $_POST['imageurl'] : ' '; $usersTable->addUserInfo($userInfo); header("Location: " . $_SERVER['HTTP_REFERER']); } } Module::getTable('UserInfo'); $usersTable = new UserInfo(); $where = 'users.id = ' . $_SESSION['uid']; $translator = new translate(); $data = $usersTable->fetchByCond($where); $data['lang'] = $translator->getVocab($_SESSION['lang']); $this->view->generate('InfoView.php', 'TemplateView.php', $data); }