本文整理汇总了PHP中UserController类的典型用法代码示例。如果您正苦于以下问题:PHP UserController类的具体用法?PHP UserController怎么用?PHP UserController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserController类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: reopen
function reopen()
{
//update user table to set submit_date to $current_datetime
$myuserController = new UserController();
$myuserController->unSealUser();
$this->f3->reroute('@home');
}
开发者ID:srccn,项目名称:hy,代码行数:7,代码来源:MyClass.php
示例2: actionProfile
public function actionProfile()
{
$id = Yii::app()->user->id;
if (!isset($_SESSION['filemanager'])) {
$_SESSION['filemanager'] = true;
}
$_SESSION['currentFolder'] = 'user/';
$model = $this->loadModel($id);
$modelProfile = UserProfile::model()->exists('userid=' . $id) ? UserProfile::model()->findByPk($id) : new UserProfile();
$role = Yii::app()->request->getPost('role');
$postUser = Yii::app()->request->getPost('User');
$postProfile = Yii::app()->request->getPost('UserProfile');
if (isset($postUser) && isset($postProfile)) {
Yii::import('application.modules.backend.controllers.UserController');
//do hàm contruct của UserController(extends controllers) lỗi ko cho phép null iduser nên thêm vào để ko xảy ra lỗi này
//mục đích là dùng dc hàm saveUserInfo trong UserController nên ko ảnh hưởng gì
$UserControllerTemp = new UserController(2);
if ($UserControllerTemp->saveUserInfo($model, $modelProfile, $postUser, $postProfile, $role, false)) {
Yii::app()->user->setFlash('success', Yii::t('user', 'Update user\'s info successfully.'));
} else {
Yii::app()->user->setFlash('error', Yii::t('user', 'Update user\'s info fail. Please try it later.'));
}
}
$this->render('profile', array('model' => $model, 'modelProfile' => $modelProfile, 'role' => User::model()->getRoleUser($model->id)));
}
开发者ID:huuly188,项目名称:vietnamrealty,代码行数:25,代码来源:PersonalController.php
示例3: showAuditorProjects
function showAuditorProjects($info = "")
{
$userId = isLoggedIn();
if (isAdmin()) {
$sql = "select ap.*,w.name,u.username from websites w,users u,auditorprojects ap where ap.website_id=w.id and u.id=w.user_id";
$sql .= empty($info['userid']) ? "" : " and w.user_id=" . $info['userid'];
$sql .= " order by ap.score DESC,ap.id";
$this->set('isAdmin', 1);
$userCtrler = new UserController();
$userList = $userCtrler->__getAllUsers();
$this->set('userList', $userList);
} else {
$sql = "select w.name,ap.* from websites w, auditorprojects ap where ap.website_id=w.id and user_id={$userId} order by ap.id";
}
$this->set('userId', empty($info['userid']) ? 0 : $info['userid']);
# pagination setup
$this->db->query($sql, true);
$this->paging->setDivClass('pagingdiv');
$this->paging->loadPaging($this->db->noRows, SP_PAGINGNO);
$pagingDiv = $this->paging->printPages('siteauditor.php?userid=' . $info['userid']);
$this->set('pagingDiv', $pagingDiv);
$sql .= " limit " . $this->paging->start . "," . $this->paging->per_page;
$projectList = $this->db->select($sql);
foreach ($projectList as $i => $projectInfo) {
$projectList[$i]['total_links'] = $this->getCountcrawledLinks($projectInfo['id']);
$projectList[$i]['crawled_links'] = $this->getCountcrawledLinks($projectInfo['id'], true);
$projectList[$i]['last_updated'] = $this->getProjectLastUpdate($projectInfo['id']);
}
$this->set('pageNo', $info['pageno']);
$this->set('list', $projectList);
$this->render('siteauditor/list');
}
开发者ID:codegooglecom,项目名称:seopanel,代码行数:32,代码来源:siteauditor.ctrl.php
示例4: process
function process()
{
if ($this->_input->post("Login")) {
$userName = $this->_input->post('user_name');
$passwd = md5($this->_input->post('passwd'));
$this->_template->set_var("user_name", $userName);
$checkArray = array('user_name' => 'Username', 'passwd' => 'Password');
if ($this->_jScript->checkFilds($checkArray)) {
$userCtrl = new UserController();
$userEnt = $userCtrl->loginUser($userName, $passwd);
if (is_object($userEnt)) {
$userObj = $userCtrl->createUser($userEnt);
$_SESSION['REGI_userObject'] = serialize($userObj);
$sessionObj = unserialize($_SESSION['REGI_userObject']);
if (is_object($sessionObj)) {
if ($sessionObj->getActive() == 0) {
$this->redirect('UserActivate');
} else {
$this->redirect('Radio');
}
}
} else {
$this->_jScript->alert("Ingevoerde gebruikersnaam en/of wachtwoord is/zijn niet correct!");
}
}
}
$this->_template->parse($this->_outputName, $this->_mainBlock);
}
开发者ID:srookhuizen,项目名称:nedernesia,代码行数:28,代码来源:Login.php
示例5: __invoke
public function __invoke($controller_services)
{
$services = $controller_services->getServiceLocator();
$authentication = $services->get('session_authentication');
$loginForm = $services->get('DotUser\\Form\\LoginForm');
$controller = new UserController($authentication);
$controller->setLoginForm($loginForm);
return $controller;
}
开发者ID:n3vrax,项目名称:dotkernel,代码行数:9,代码来源:UserControllerFactory.php
示例6: testUserLoginContainsEmailField
/**
* Tests if the user Login page is OK
*
* @return void
*/
public function testUserLoginContainsEmailField()
{
$UserController = new UserController();
$login_form = $UserController->show_login();
$contains_email_field = false;
if (strpos($login_form, '<input type="text" name="email" class="form-control" placeholder="E-Mail"/>') !== false) {
$contains_email_field == true;
}
$this->assertTrue($contains_email_field);
}
开发者ID:sourcedonates,项目名称:SDv2-Code,代码行数:15,代码来源:ExampleTest.php
示例7: run
static function run()
{
$r = new Request();
$r->parse();
$controller = $r->controller . 'Controller';
$action = $r->action;
if (class_exists($controller)) {
$obj = new $controller($r);
$obj->render();
} else {
// do default stuff;
$obj = new UserController(new Request());
$obj->render();
}
}
开发者ID:jyip,项目名称:myMVC,代码行数:15,代码来源:request.php
示例8: update
/**
* Updates password in database
* @return ErrorResponse|Response
*/
protected function update()
{
$missing_fields = UserController::validateJSONFormat($this->body, User::REQUIRED_PASSWORD_PUT_FIELD);
// Check that required fields are not missing
if (!$missing_fields) {
$mapper = new UserDBMapper();
$json = $this->body;
$user = User::fromResetPasswordQuery($this->id, $json);
// If user is set
if ($user) {
$db_response = $mapper->resetPassword($user);
if ($db_response instanceof DBError) {
$response = new ErrorResponse($db_response);
} else {
$user = $mapper->getById($this->id);
if ($user) {
$response = new Response(json_encode($user->toArray(), JSON_PRETTY_PRINT), Response::STATUS_CODE_CREATED);
} else {
$response = new ErrorResponse(new NotFoundError());
}
return $response;
}
} else {
$response = new ErrorResponse(new ApplicationError("Reset password error", "There was a problem with the password"));
}
} else {
$response = new ErrorResponse(new MalformedJSONFormatError($missing_fields));
}
return $response;
}
开发者ID:DEH-Standardization,项目名称:ehelse_server,代码行数:34,代码来源:PasswordController.php
示例9: setNewPassword
/**
* @param $json
* @param $email_type
* @return ErrorResponse|null|Response
*/
public static function setNewPassword($json, $email_type)
{
$response = null;
$missing_fields = UserController::validateJSONFormat($json, User::REQUIRED_PASSWORD_RESET_FIELD);
// Check that required fields are not missing
if (!$missing_fields) {
$user_mapper = new UserDBMapper();
$email = $json['email'];
$user = User::fromDBArray($user_mapper->getByEmail($email));
// Set random password
$password = ResetPasswordController::getRandomString(ResetPasswordController::PASSWORD_LENGTH);
$json['password'] = $password;
$id = $user->getId();
$reset_password_user = User::fromResetPasswordQuery($id, $json);
if ($reset_password_user) {
$db_response = $user_mapper->resetPassword($reset_password_user);
if ($db_response instanceof DBError) {
$response = new ErrorResponse($db_response);
} else {
$reset_password_user = $user_mapper->getById($id);
if ($reset_password_user) {
EmailSender::sendEmail($email, $password, $email_type);
// Sending Email notification
$response = new Response(json_encode(array('message' => ResetPasswordController::RESET_PASSWORD_ACCEPTED_MESSAGE), JSON_PRETTY_PRINT), Response::STATUS_CODE_ACCEPTED);
} else {
$response = new ErrorResponse(new NotFoundError());
}
}
}
return $response;
}
return new Response($response);
}
开发者ID:DEH-Standardization,项目名称:ehelse_server,代码行数:38,代码来源:ResetPasswordController.php
示例10: run
public static function run()
{
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$webuser = new WebUser($_POST);
if ($webuser->getErrorCount() == 0) {
if (!empty(WebUserDB::getUsersBy('hockName', $webuser->getHockName()))) {
$webuser->setError('hockName', 'HOCKUSER_NAMECLAIMED');
SignupView::show($webuser);
} else {
//create a webuser in db
$id = WebUserDB::addUser($webuser);
if ($id != 0) {
$base = array_key_exists('base', $_SESSION) ? $_SESSION['base'] : "";
//find the hockuser related to this dude
//$hockusers = HockUserDB::getUsersBy('name', $webuser->getHockName());
header("Location: /" . $base . "/user/show/" . $webuser->getHockName());
UserController::show();
//ProfileView::show($webuser, $hockusers[0]);//HomeView::show();
} else {
$webuser->setError('userName', 'DBERROR_ADDWEBUSER');
SignupView::show($webuser);
}
}
} else {
SignupView::show($webuser);
}
} else {
// Initial link
SignupView::show(null);
}
}
开发者ID:Trivette,项目名称:cs4413,代码行数:31,代码来源:SignupController.class.php
示例11: enroll
/**
* Create a new Enrollment instance.
*
* @param int $idCourse
* @param int $idUser
* @return int $idEnrollment
*/
public static function enroll($idCourse, $idUser, $end_at = Null)
{
$app = \Slim\Slim::getInstance();
$user = UserController::findUser($idUser);
$course = CourseController::getCourseDetails($idCourse);
if ($end_at && date('Y-m-d H:i:s') > $end_at) {
$app->halt("400", json_encode("Enrollment already expired. Please check the end date."));
}
$data = array('user_id' => $idUser, 'course_id' => $idCourse);
$enrollment = Enrollment::firstOrNew($data);
// if there is scorm cloud id then enroll in scorm cloud
if (isset($course->scorm_id)) {
$scormRegistrationId = ScormCloudAPIController::register($idCourse, $idUser);
if (isset($scormRegistrationId)) {
$enrollment->scorm_registration_id = $scormRegistrationId;
$enrollment->scorm_status = "enrolled";
}
}
if (!$enrollment->id) {
$enrollment->isSafety = $course->safety;
$enrollment->end_at = $end_at;
$enrollment->save();
} else {
$enrollment->end_at = $end_at;
//echo $enrollment->end_at;
$enrollment->save();
}
return $enrollment->id;
}
开发者ID:aanyun,项目名称:PHP-Sample-Code,代码行数:36,代码来源:EnrollmentController.php
示例12: testLogin
public function testLogin()
{
// Turn off sending email on usere creation
UserController::$sendEmailOnVerify = false;
// Create a user
$contestant = UserFactory::createUserWithoutVerify();
// Open index
$this->open('/');
// Click in Iniciar Sesion
$this->clickAndWait('link=Inicia sesion');
// Type login data
$this->type('user', $contestant->getUsername());
$this->type('pass', $contestant->getPassword());
// Click inicia sesion
$this->clickAndWait("//input[@value='Inicia sesion']");
// Wait for message
$this->waitForElementPresent('//*[@id="content"]/div[2]/div');
$this->assertElementContainsText('//*[@id="content"]/div[2]/div', 'Your email is not verified yet. Please check your e-mail.');
// Go to verification page and wait for redirection to login page
$this->open('/api/user/verifyemail/id/' . $contestant->getVerificationId());
$this->waitForElementPresent('//*[@id="content"]/div[2]/div[1]/h1');
// Type login data
$this->type('user', $contestant->getUsername());
$this->type('pass', $contestant->getPassword());
// Click inicia sesion
$this->clickAndWait("//input[@value='Inicia sesion']");
// Sanity check that we are logged in
$this->waitForElementPresent('//*[@id="wrapper"]/div[1]/a');
$this->assertElementContainsText('//*[@id="wrapper"]/div[1]/a', $contestant->getUsername());
}
开发者ID:andreasantillana,项目名称:omegaup,代码行数:30,代码来源:EmailVerificationUITest.php
示例13: run
public function run()
{
$form = new AjaxRegisterAction_RegisterForm();
$form->name = $_REQUEST['popup_username'];
$form->email = $_REQUEST['popup_email'];
if ($form->validate()) {
$user = new User();
$user->name = $form->name;
$user->mail = $form->email;
$user->type = User::TYPE_INDIVIDUAL;
$user->created = time();
$user->status = User::STATUS_NOT_CONFIRMED;
// Change password to a new one
Yii::import('webroot.controllers.UserController');
$generatedPass = UserController::generatePassword();
$user->pass = md5($generatedPass);
$user->save(false);
// Mail the user
if (Mailer::mailFastRegister($user, $generatedPass, $form->email)) {
$result = array("result" => 0, "message" => Yii::t('amo', 'Email sent!!'));
} else {
$result = array("result" => -1, "message" => Yii::t('amo', 'Error sending email'));
}
} else {
$errors = $form->getErrors('email');
$result = array("result" => -1, "message" => implode(", ", $errors));
}
echo CJSON::encode($result);
exit(0);
// To avoid loggers append things to request
}
开发者ID:CHILMEX,项目名称:amocasion,代码行数:31,代码来源:AjaxRegisterAction.php
示例14: testUserUpdate
/**
* Basic update test
*/
public function testUserUpdate()
{
// Create the user to edit
$user = UserFactory::createUser();
$r = new Request();
// Login
$r["auth_token"] = $this->login($user);
// Change values
$r["name"] = Utils::CreateRandomString();
$r["country_id"] = 'MX';
$r["state_id"] = 3;
$r["scholar_degree"] = 'Maestría';
$r["birth_date"] = strtotime('1988-01-01');
$r["graduation_date"] = strtotime('2016-02-02');
// Call api
$response = UserController::apiUpdate($r);
// Check user from db
$user_db = AuthTokensDAO::getUserByToken($r["auth_token"]);
$this->assertEquals($user_db->getName(), $r["name"]);
$this->assertEquals($user_db->getCountryId(), $r["country_id"]);
$this->assertEquals($user_db->getStateId(), $r["state_id"]);
$this->assertEquals($user_db->getScholarDegree(), $r["scholar_degree"]);
$this->assertEquals($user_db->getBirthDate(), gmdate('Y-m-d', $r["birth_date"]));
$this->assertEquals($user_db->getGraduationDate(), gmdate('Y-m-d', $r["graduation_date"]));
}
开发者ID:kukogit,项目名称:omegaup,代码行数:28,代码来源:UserUpdateTest.php
示例15: run
public function run()
{
$form = new AjaxForgotAction_ForgotForm();
$form->email = $_REQUEST['popup_email'];
if ($form->validate()) {
$user = User::model()->find('mail=:mail', array(':mail' => $form->email));
if (isset($user)) {
// Change password to a new one
Yii::import('webroot.controllers.UserController');
$generatedPass = UserController::generatePassword();
$user->pass = md5($generatedPass);
if ($user->save(false)) {
// Mail the user
if (Mailer::mailForgotPassword($generatedPass, $form->email)) {
$result = array("result" => 0, "message" => Yii::t('amo', 'Email sent!!'));
} else {
$result = array("result" => -1, "message" => Yii::t('amo', 'Error sending email'));
}
} else {
$result = array("result" => -1, "message" => Yii::t('amo', 'Could not save to database'));
}
} else {
$result = array("result" => -1, "message" => Yii::t('amo', 'There is no user with such email'));
}
} else {
$errors = $form->getErrors('email');
$result = array("result" => -1, "message" => implode(", ", $errors));
}
echo CJSON::encode($result);
exit(0);
// To avoid loggers append things to request
}
开发者ID:CHILMEX,项目名称:amocasion,代码行数:32,代码来源:AjaxForgotAction.php
示例16: display_view
public function display_view($message)
{
// Grabs the URI and breaks it apart in case we have querystring stuff
$request_uri = explode('?', $_SERVER['REQUEST_URI'], 2);
//Root
if ($request_uri[0] === '/public_html/') {
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
require '../App/Views/goals.php';
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
GoalController::add_goal();
}
}
//Goals
if ($request_uri[0] === '/public_html/goals') {
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
require '../App/Views/goals.php';
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
GoalController::add_goal();
}
}
if ($request_uri[0] === '/public_html/goals/json') {
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
header('Location: /public_html/json_goals.php');
}
}
if ($request_uri[0] === '/public_html/goal') {
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
require '../App/Views/goal.php';
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
GoalController::update_goal_by_id();
}
}
//Register
if ($request_uri[0] === '/public_html/register') {
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
require '../App/Views/register.php';
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
UserController::add_user();
}
}
//Login
if ($request_uri[0] === '/public_html/login') {
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
require '../App/Views/login.php';
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
AuthController::login_user();
}
}
if ($request_uri[0] === '/public_html/logout') {
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
AuthController::logout_user();
}
}
}
开发者ID:jdarrohn,项目名称:goal-cms,代码行数:59,代码来源:RequestHandler.class.php
示例17: testCoderOfTheMonthList
public function testCoderOfTheMonthList()
{
$user = UserFactory::createUser();
$auth_token = $this->login($user);
$r = new Request(array('auth_token' => $auth_token));
$response = UserController::apiCoderOfTheMonthList($r);
$this->assertEquals(1, count($response['coders']));
}
开发者ID:andreasantillana,项目名称:omegaup,代码行数:8,代码来源:CoderOfTheMonthTest.php
示例18: testExistentUserWithInstance
public function testExistentUserWithInstance()
{
$builders = $this->buildData();
$this->simulateLogin('[email protected]');
$_GET['u'] = 'someuser1';
$_GET['n'] = 'twitter';
$_GET['i'] = 'instancetestuser';
$controller = new UserController(true);
$this->assertTrue(isset($controller));
$results = $controller->control();
$this->assertPattern("/someuser1/", $results);
//test if view variables were set correctly
$v_mgr = $controller->getViewManager();
$this->assertEqual($v_mgr->getTemplateDataItem('controller_title'), 'User Details: someuser1');
$this->assertEqual($v_mgr->getTemplateDataItem('logo_link'), 'index.php');
$this->assertEqual($controller->getCacheKeyString(), '[email protected]');
}
开发者ID:rayyan,项目名称:ThinkUp,代码行数:17,代码来源:TestOfUserController.php
示例19: actionSignup
public function actionSignup()
{
if (isset($_POST['register'])) {
if (trim($_POST['compName']) == "") {
$_SESSION['compName'] = $_POST['compName'];
$_SESSION['error'] = "Please provide your company or individual name";
header("location: {$_SERVER['HTTP_REFERER']}");
exit;
}
if (trim($_POST['password']) == "") {
$_SESSION['error'] = "Password field cannot be blank!";
header("location: {$_SERVER['HTTP_REFERER']}");
exit;
}
if ($_POST['location'] == "") {
$_SESSION['error'] = "Specify your location";
header("location: {$_SERVER['HTTP_REFERER']}");
exit;
}
if (trim($_POST['email']) == "" || filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) == false) {
$_SESSION['email'] = $_POST['email'];
$_SESSION['error'] = "The email you provided was invalid";
header("location: {$_SERVER['HTTP_REFERER']}");
exit;
}
if (!ctype_alnum($_POST['location'])) {
$_SESSION['error'] = "Location is NOT sensible!";
header("location: {$_SERVER['HTTP_REFERER']}");
exit;
}
if (User::checker($_POST['email']) != 0) {
$_SESSION['error'] = "Sorry, a user already exists with the email you provided. Forgot your password? <a href='#'>Get a new one</a>";
header("location: {$_SERVER['HTTP_REFERER']}");
exit;
}
if (trim($_POST['tel']) != "") {
if (!isPhoneNumber($_POST['tel'])) {
$_SESSION['tel'] = $_POST['tel'];
$_SESSION['error'] = "Invalid phone number";
header("location: {$_SERVER['HTTP_REFERER']}");
exit;
}
}
$x = new Employer($_POST);
$x->utype = $this->user_type;
if (!$x->create()) {
//Log the next line and simply show an error message
$_SESSION['error'] = "Oops! Something went wrong!";
} else {
UserController::redirectToLogin("Account has been created. Please login to continue");
exit;
}
}
$type = $this->user_type;
//passed to the view for toggling
include __VIEWPATH__ . "employer/signup.php";
}
开发者ID:idoqo,项目名称:yedoe,代码行数:57,代码来源:EmployerController.php
示例20: testNoProblems
public function testNoProblems()
{
$author = UserFactory::createUser();
// Call API
// Call api
$r = new Request(array("auth_token" => self::login($author)));
$response = UserController::apiProblems($r);
$this->assertEquals(0, count($response["problems"]));
}
开发者ID:kukogit,项目名称:omegaup,代码行数:9,代码来源:UserProblemsTest.php
注:本文中的UserController类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论