/** * 活动报名 * @param array $sign_data * @param $aid * @return bool */ public static function signUp(array $sign_data, $aid) { $connection = self::_getConnection(); $connection->begin(); $add_activity_user_success = self::addActivityUser($sign_data, $aid); $new_au_id = $connection->lastInsertId(); $save_user_info_success = User::saveUserInfo($sign_data); $success = $add_activity_user_success and $save_user_info_success; if (!$success) { $connection->roolback(); return false; } $success = $connection->commit(); if (!$success) { return false; } return $new_au_id; }
<div id="title-bar-cont"> <h1 class="left">Account Settings</h1> </div> </div> <div id="container"> <?php if (isset($_POST['save'])) { ?> <?php User::saveUserInfo($_SESSION['username'], $_POST['name'], $_POST['email']); ?> <p class="message success">Account Settings Saved</p> <?php if ($_POST['current'] != '' && $_POST['new'] != '' && $_POST['confirm'] != '') { if ($_POST['new'] != $_POST['confirm']) { echo '<p class="message notice">Sorry, your new passwords don\'t match!</p>'; } else { User::changePassword($_SESSION['username'], $_POST['current'], $_POST['new']); } } ?> <?php }
private function updateUser() { // Get data $uname = $this->pageState['_username']; $fname = $this->pageState['fullname']; $email = $this->pageState['email']; $home = $this->pageState['homefolder']; $dm = $this->pageState['foldermgr']; $em = $this->pageState['adveditor']; // If the user is an admin, make their home folder blank if ($home == '/') { $home = ''; } try { // Process the incoming user data $userInfo = User::getUserInfo($uname); // Place the given data into the user's information $userInfo['friendlyName'] = $fname; $userInfo['email'] = $email; $userInfo['userPath'] = $home; $userInfo['directoryMode'] = strtolower($dm) == 'foldermgr' ? 'ADVANCED' : 'BASIC'; $userInfo['editorMode'] = strtolower($em) == 'adveditor' ? 'ADVANCED' : 'BASIC'; // Save the information to the user's config file User::saveUserInfo($uname, $userInfo); // Head back to the user management page header('Location:/manage/userMgmt/showMessage/msg/userUpdated/user/' . $uname); } catch (Exception $exc) { $errors[] = 'There was a problem saving the user file for the user. Please check permissions on the config/users directory and the specific user configuration file (make sure both are writeable) and try again.'; $this->view->errors = $errors; $this->get(); } }
private function createNewUser() { // Get data $uname = $this->pageState['username']; $pw = $this->pageState['password']; $fname = $this->pageState['fullname']; $email = $this->pageState['email']; $home = $this->pageState['homefolder']; $dm = $this->pageState['foldermgr']; $em = $this->pageState['adveditor']; // If the user is an admin, make their home folder blank if ($home == '/') { $home = ''; } // Place the given data into the user's information $userInfo['username'] = $uname; $userInfo['password'] = User::generatePassword($pw); $userInfo['friendlyName'] = $fname; $userInfo['email'] = $email; $userInfo['userPath'] = $home; $userInfo['directoryMode'] = strtolower($dm) == 'foldermgr' ? 'ADVANCED' : 'BASIC'; $userInfo['editorMode'] = strtolower($em) == 'adveditor' ? 'ADVANCED' : 'BASIC'; // Save the information to the user's config file if (User::saveUserInfo($uname, $userInfo)) { // Now save the username and fullname to the user file if (User::addNewUser($uname, $fname)) { // Redirect to userMgmt page header('Location:/manage/userMgmt/showMessage/msg/newUserAdded/user/' . $uname); } else { $errors[] = 'There was a problem adding the new user to the users file. Please check file permissions on the users file (make sure the file is writeable) and try again.'; showForm($pageState, $errors); } } else { $errors[] = 'There was a problem creating a new user file for the user. Please check permissions on the config/users folder (make sure the folder is writeable) and try again.'; $this->view->errors = $errors; $this->get(); } }