本文整理汇总了PHP中UserInfo类的典型用法代码示例。如果您正苦于以下问题:PHP UserInfo类的具体用法?PHP UserInfo怎么用?PHP UserInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createUser
/**
* create the user
*/
function createUser()
{
// all data is already correct
$this->userName = $this->_request->getValue("userName");
$this->userFullName = $this->_request->getValue("userFullName");
$this->userPassword = $this->_request->getValue("userPassword");
$this->userEmail = $this->_request->getValue("userEmail");
$users = new Users();
$user = new UserInfo($this->userName, $this->userPassword, $this->userEmail, "", $this->userFullName);
// if user registration need email confirm, that is
// user must active his account
if ($this->need_confirm == true) {
$user->setStatus(USER_STATUS_UNCONFIRMED);
} else {
$user->setStatus(USER_STATUS_ACTIVE);
}
$userId = $users->addUser($user);
if (!$userId) {
$this->_view = new SummaryView("registererror");
$this->_view->setErrorMessage($this->_locale->tr("error_adding_user"));
$this->setCommonData(true);
return false;
}
return $userId;
}
示例2: actionIndex
/**
* 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);
}
示例3: testCheckPassword
function testCheckPassword()
{
$info = new UserInfo($this->data);
$this->assertEquals("", $info->checkPassword());
$info = new UserInfo(array('password' => 'ab'));
$this->assertEquals(UserInfo::CODE_PASSWORD_LENGTH, $info->checkPassword());
}
示例4: post
public function post($resourceVals, $data, $userId)
{
global $logger, $warnings_payload;
$UserInfoId = $resourceVals['user'];
if (isset($UserInfoId)) {
$warnings_payload[] = 'POST call to /user must not have ' . '/user_ID appended i.e. POST /user';
throw new UnsupportedResourceMethodException();
}
$userInfoObj = new UserInfo($data['firstName'], $data['lastName'], $data['email'], $data['phoneNo'], $data['password'], 0);
$logger->debug("POSTed User Detail: " . $userInfoObj->toString());
if ($data['phoneNo'] == '') {
return array('code' => '6014');
} else {
if ($data['password'] == '') {
return array('code' => '6015');
} else {
$this->mobacDAO->insert($userInfoObj);
$userDetail = $userInfoObj->toArray();
if (!isset($userDetail['id'])) {
return array('code' => '6011');
}
$this->userDetail[] = $userDetail;
return array('code' => '6001', 'data' => array('userDetail' => $this->userDetail));
}
}
}
示例5: getImagePath
/**
* gets the image path for a users avatar
* @param \UserInfo $uo
* @param bool $withNoCacheStr
* @return bool|string $src
*/
public function getImagePath($uo, $withNoCacheStr = true)
{
if (!$uo->hasAvatar()) {
return false;
}
$avatar = $uo->getUserAvatar();
return $avatar->getPath();
}
示例6: DropTables
function DropTables()
{
$moderator = new Moderator();
$moderator->SetDatabase($this);
$moderator->Drop();
$message = new Message();
$message->SetDatabase($this);
$message->Drop();
$topic = new Topic();
$topic->SetDatabase($this);
$topic->Drop();
$user_info = new UserInfo();
$user_info->SetDatabase($this);
$user_info->Drop();
$session = new Session();
$session->SetDatabase($this);
$session->Drop();
$new = new News();
$new->SetDatabase($this);
$new->Drop();
$shout = new Shout();
$shout->SetDatabase($this);
$shout->Drop();
$paragraph = new Paragraph();
$paragraph->SetDatabase($this);
$paragraph->Drop();
$privilege = new Privilege();
$privilege->SetDatabase($this);
$privilege->Drop();
$role = new Role();
$role->SetDatabase($this);
$role->Drop();
$menu_item = new MenuItem();
$menu_item->SetDatabase($this);
$menu_item->Drop();
$module = new Module();
$module->SetDatabase($this);
$module->Drop();
$page = new Page();
$page->SetDatabase($this);
$page->Drop();
$article = new Article();
$article->SetDatabase($this);
$article->Drop();
$subject = new Subject();
$subject->SetDatabase($this);
$subject->Drop();
$menu = new Menu();
$menu->SetDatabase($this);
$menu->Drop();
$profile = new Profile();
$profile->SetDatabase($this);
$profile->Drop();
$user = new User();
$user->SetDatabase($this);
$user->Drop();
}
示例7: get
/**
* Get user media from instagram
*
* @see constructQuery
*
* @param $user_name
* @param null $cursor_after
* @param null $limit
* @return array
*/
public function get($user_name, $cursor_after = NULL, $limit = NULL)
{
if (!$cursor_after) {
$resultObj = new UserInfo($this->client);
$result = $resultObj->get($user_name);
$this->user_id = $result->id;
} else {
$post_params = $this->constructQuery($user_name, $cursor_after, $limit);
$result = $this->asObject($this->client->webRequest('/query/', 'POST', [], $post_params));
}
$media = ['cursor_after' => !empty($result->media->page_info->end_cursor) && !empty($result->media->page_info->has_next_page) ? $result->media->page_info->end_cursor : NULL, 'data' => !empty($result->media->nodes) ? $result->media->nodes : NULL];
return $media;
}
示例8: AddAllCode
function AddAllCode()
{
$u = new UserInfo($this->uid);
$num = $u->InviteNum();
$sub = $this->uid;
for ($a = 0; $a < $num; $a++) {
$x = rand(10, 1000);
$z = rand(10, 1000);
$x = md5($x) . md5($z);
$x = base64_encode($x);
$code = $sub . substr($x, rand(1, 13), 24);
$this->db->insert("moefq_invite", ["code" => $code, "user" => $this->uid]);
}
}
示例9: add
public function add($content)
{
$time = intval(RECORD_DAYS_MESSAGE) * 24;
$time = '-' . strval($time) . ' hour';
$time = date('Y-m-d', strtotime($time, time()));
$sql = "DELETE FROM `wx_message` WHERE `time` <= '{$time}'";
$this->delete($sql);
$content = str_replace("'", "''", $content);
$sql = "INSERT INTO `wx_message` (`openid`, `content`, `type`) VALUES ('{$this->fromUserName}','{$content}', 'rcv')";
$this->insert($sql);
include_once dirname(__FILE__) . '/user/info.php';
$info = new UserInfo($this->fromUserName);
$info->load();
}
示例10: actionRegister
/**
* 新用户注册
*
*/
public function actionRegister()
{
$this->layout = " ";
Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jquery-1.9.1.js');
Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . '/css/login.css');
$username = Yii::app()->request->getQuery('username', null);
$phone = Yii::app()->request->getQuery('phone', null);
$email = Yii::app()->request->getQuery('email', null);
$model = new User('create');
if (isset($_POST['User'])) {
$model->attributes = $_POST['User'];
if ($model->validate()) {
$code_model = Temp::model()->findByPk(trim($model->phone));
if (!empty($code_model)) {
if (time() - $code_model->time <= 180) {
if ($model->sms_code == $code_model->code) {
if ($model->save()) {
$userInfo = new UserInfo();
$userInfo->userId = $model->id;
$userInfo->username = $model->username;
$userInfo->phone = $model->phone;
$userInfo->save();
$this->redirect(array('registerSuccess'));
}
} else {
$model->addError('sms_code', '验证码不正确');
}
} else {
$model->addError('sms_code', '验证码已失效,请重新获取');
}
} else {
$model->addError('sms_code', '验证失败,请重新获取');
}
}
}
if (!empty($username) && trim($username) != '您的姓名') {
$model->username = $username;
}
if (!empty($phone) && trim($phone) != '您的电话') {
$model->phone = $phone;
}
if (!empty($email) && trim($email) != '您的邮箱') {
$model->email = $email;
}
$sms_list = Sms::model()->findAll();
$link_list = Link::model()->findAll();
$this->render('create', array('model' => $model, 'sms_data' => $sms_list[0], 'link_list' => $link_list));
}
示例11: testCreateSuperUserLegacy
public function testCreateSuperUserLegacy()
{
$ui = \UserInfo::addSuperUser('test', 'andrew@concrete5.org');
$this->assertEquals(USER_SUPER_ID, $ui->getUserID());
$this->assertEquals(USER_SUPER, $ui->getUserName());
$this->assertEquals('andrew@concrete5.org', $ui->getUserEmail());
}
示例12: updateDatabase
/**
* Actually removes the record IF there are no records referencing this user.
* If records do reference it, then only marks it inactive.
*/
function updateDatabase($myvalues)
{
$bHasReferences = UserInfo::userIsReferenced($this->m_nUID);
$feedback = NULL;
if ($bHasReferences) {
$updated_dt = date("Y-m-d H:i", time());
$nUpdated = db_update('raptor_user_profile')->fields(array('accountactive_yn' => 0, 'updated_dt' => $updated_dt))->condition('uid', $this->m_nUID, '=')->execute();
if ($nUpdated !== 1) {
error_log("Failed to edit user back to database!\n" . var_dump($myvalues));
die("Failed to edit user back to database!\n" . var_dump($myvalues));
}
$feedback = 'Marked user as inactive instead of deleted because referenced by other records.';
} else {
//Delete all the child records first.
$num_deleted = db_delete('raptor_user_modality')->condition('uid', $this->m_nUID, '=')->execute();
$num_deleted = db_delete('raptor_user_anatomy')->condition('uid', $this->m_nUID, '=')->execute();
$num_deleted = db_delete('raptor_user_group_membership')->condition('uid', $this->m_nUID, '=')->execute();
//Now delete the profile.
$num_deleted = db_delete('raptor_user_profile')->condition('uid', $this->m_nUID, '=')->execute();
if ($this->m_nUID == 1) {
//Do NOT delete this drupal user or will be very unhappy!
error_log('Removed user 1 from RAPTOR but left it alone in Drupal users table.');
$feedback = 'Removed user from RAPTOR system.';
} else {
//Now delete the Drupal user.
$num_deleted = db_delete('users')->condition('uid', $this->m_nUID, '=')->execute();
$feedback = 'Removed the ADMIN user from RAPTOR system.';
}
}
drupal_set_message($feedback);
return 1;
}
示例13: on_start
public function on_start()
{
$ihm = Loader::helper('concrete/ui/menu');
$p = new Permissions(Page::getByPath('/dashboard/forums/'));
if ($p->canRead()) {
$ihm->addPageHeaderMenuItem('forums', 'webli_forums', array('icon' => '', 'label' => t('Forums'), 'position' => 'right', 'href' => URL::to('/dashboard/forums'), 'linkAttributes' => array('style' => 'padding:0 5px;width:auto;')));
}
Events::addListener('on_page_add', function ($e) {
$page = $e->getPageObject();
if ($page->getCollectionTypeHandle() == 'forum_post') {
$settings = $this->get_saved_settings($page->getCollectionParentID());
if ($settings['notification']) {
if (Config::get('concrete.email.webli_forum.address') && strstr(Config::get('concrete.email.webli_forum.address'), '@')) {
$formFormEmailAddress = Config::get('concrete.email.webli_forum.address');
} else {
if (Config::get('concrete.email.default.address') && strstr(Config::get('concrete.email.default.address'), '@')) {
$formFormEmailAddress = Config::get('concrete.email.default.address');
} else {
$adminUserInfo = UserInfo::getByID(USER_SUPER_ID);
$formFormEmailAddress = $adminUserInfo->getUserEmail();
}
}
$mh = Core::make('helper/mail');
$mh->to($settings['email_addresses']);
$mh->from($formFormEmailAddress);
$parentPage = Page::getByID($page->getCollectionParentID());
$mh->addParameter('forumName', $parentPage->getCollectionName());
$mh->addParameter('forumPath', BASE_URL . DIR_REL . $parentPage->getCollectionPath());
$mh->load('forum_notification', 'webli_forums');
$mh->setSubject(t('New Forum Post to %s', $parentPage->getCollectionName()));
@$mh->sendMail();
}
}
});
}
示例14: attemptAuthentication
protected function attemptAuthentication()
{
$user = parent::attemptAuthentication();
$userInfo = \UserInfo::getByID($user->getUserID());
$extractor = $this->getExtractor();
$roles = $extractor->getExtra('roles');
// sync groups with roles
if (is_array($roles)) {
$groupIds = array();
foreach ($roles as $role) {
$roleApplicationCode = $role['role_application']['application_code'];
if ($roleApplicationCode == \Config::get('auth.worldskills.roles_application_code')) {
$roleName = $role['name'];
// check for entity role and append entity name
if (isset($role['ws_entity'])) {
$roleName = $roleName . ' - ' . $role['ws_entity']['name']['text'];
}
// check if group exists
$group = \Group::getByName($roleName);
if (!is_object($group)) {
// add missing groups
$group = \Group::add($roleName, '');
}
$groupIds[] = $group->getGroupID();
}
}
// remove duplicate groups
$groupIds = array_unique($groupIds);
// update groups of user
$userInfo->updateGroups($groupIds);
}
// login user again to make sure groups are reloaded
return \User::loginByUserID($user->getUserID());
}
示例15: save
public function save($post)
{
// clear all selected permissions
$tps = array();
foreach ($post['tpID'] as $tpID) {
$tp = TaskPermission::getByID($tpID);
$tps[] = $tp;
$tp->clearPermissions();
}
foreach ($post['selectedEntity'] as $e) {
if ($e != '') {
$o1 = explode('_', $e);
if ($o1[0] == 'uID') {
$obj = UserInfo::getByID($o1[1]);
} else {
$obj = Group::getByID($o1[1]);
}
foreach ($tps as $tp) {
if ($post[$e . '_' . $tp->getTaskPermissionID()] == 1) {
$tp->addAccess($obj);
}
}
}
}
}