本文整理汇总了PHP中UserInfo类的典型用法代码示例。如果您正苦于以下问题:PHP UserInfo类的具体用法?PHP UserInfo怎么用?PHP UserInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:28,代码来源:dofinishregister.class.php
示例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);
}
开发者ID:shurick31,项目名称:mymvc,代码行数:29,代码来源:ControllerInfo.php
示例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());
}
开发者ID:hidetobara,项目名称:voices,代码行数:7,代码来源:TestUserInfo.php
示例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));
}
}
}
开发者ID:rajnishp,项目名称:bjs,代码行数:26,代码来源:ServicesResource.class.php
示例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();
}
开发者ID:kreativmind,项目名称:concrete5-5.7.0,代码行数:14,代码来源:Avatar.php
示例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();
}
开发者ID:googlecode-mirror,项目名称:schifers,代码行数:57,代码来源:cdDatabase.php
示例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;
}
开发者ID:moelius,项目名称:instagram-wrapper,代码行数:23,代码来源:UserMedia.php
示例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]);
}
}
开发者ID:nqzhang,项目名称:MoeFQ-sspanel,代码行数:14,代码来源:Invite.php
示例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();
}
开发者ID:jianhua1982,项目名称:wlight,代码行数:14,代码来源:statistics.php
示例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));
}
开发者ID:zywh,项目名称:maplecity,代码行数:52,代码来源:UserController.php
示例11: testCreateSuperUserLegacy
public function testCreateSuperUserLegacy()
{
$ui = \UserInfo::addSuperUser('test', '[email protected]');
$this->assertEquals(USER_SUPER_ID, $ui->getUserID());
$this->assertEquals(USER_SUPER, $ui->getUserName());
$this->assertEquals('[email protected]', $ui->getUserEmail());
}
开发者ID:digideskio,项目名称:concrete5,代码行数:7,代码来源:UserTest.php
示例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;
}
开发者ID:rmurray1,项目名称:RAPTOR,代码行数:36,代码来源:DeleteUserPage.php
示例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();
}
}
});
}
开发者ID:katzueno,项目名称:forums,代码行数:35,代码来源:controller.php
示例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());
}
开发者ID:worldskills,项目名称:concrete5-worldskills,代码行数:34,代码来源:Controller.php
示例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);
}
}
}
}
}
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:25,代码来源:task_permissions.php
示例16: __construct
public function __construct()
{
Loader::model('user_statistics');
Loader::model('page_statistics');
$u = new User();
$ui = UserInfo::getByID($u->getUserID());
$us = new UserStatistics($ui);
$this->set('uLastActivity', $us->getPreviousSessionPageViews());
$timeStr = '';
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$timeStr = '%x ' . t('at') . ' %I:%M %p';
} else {
$timeStr = '%x ' . t('at') . ' %l:%M %p';
}
$this->set('uLastLogin', strftime($timeStr, $ui->getLastLogin('user')));
$this->set('uName', $ui->getUserName());
$this->set('totalViews', PageStatistics::getTotalPageViewsForOthers($u));
$this->set('totalVersions', PageStatistics::getTotalPageVersions());
$this->set('lastEditSite', strftime($timeStr, strtotime(PageStatistics::getSiteLastEdit('user'))));
$llu = UserStatistics::getLastLoggedInUser();
if ($llu->getUserID() == $u->getUserID()) {
$this->set('lastLoginSite', t('Your login is the most recent.'));
} else {
$this->set('lastLoginSite', strftime($timeStr, $llu->getLastLogin()));
}
$this->set('totalEditMode', PageStatistics::getTotalPagesCheckedOut());
Loader::block('form');
$this->set('totalFormSubmissions', FormBlockStatistics::getTotalSubmissions());
$this->set('totalFormSubmissionsToday', FormBlockStatistics::getTotalSubmissions(date('Y-m-d')));
}
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:30,代码来源:activity.php
示例17: save
public function save()
{
$config = Core::make('config');
if (Core::make('token')->validate('conversations.settings.save')) {
$helper_file = Core::make('helper/concrete/file');
$config->save('conversations.files.guest.max_size', intval($this->post('maxFileSizeGuest')));
$config->save('conversations.files.registered.max_size', intval($this->post('maxFileSizeRegistered')));
$config->save('conversations.files.guest.max', intval($this->post('maxFilesGuest')));
$config->save('conversations.files.registered.max', intval($this->post('maxFilesRegistered')));
$config->save('conversations.attachments_enabled', (bool) $this->post('attachmentsEnabled'));
$config->save('conversations.subscription_enabled', (bool) $this->post('subscriptionEnabled'));
$users = array();
if (is_array($this->post('defaultUsers'))) {
foreach ($this->post('defaultUsers') as $uID) {
$ui = \UserInfo::getByID($uID);
if (is_object($ui)) {
$users[] = $ui;
}
}
}
Conversation::setDefaultSubscribedUsers($users);
if ($this->post('fileExtensions')) {
$types = preg_split('{,}', $this->post('fileExtensions'), null, PREG_SPLIT_NO_EMPTY);
$types = $helper_file->serializeUploadFileExtensions($types);
$config->save('conversations.files.allowed_types', $types);
}
$this->saveEditors();
$this->success();
} else {
$this->error->add('Invalid Token.');
$this->view();
}
}
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:33,代码来源:settings.php
示例18: view
public function view()
{
$u = new User();
$ui = UserInfo::getByID($u->getUserID());
Loader::model("page_statistics");
Loader::model("user_statistics");
$timeStr = '';
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$timeStr = '%x ' . t('at') . ' %I:%M %p';
} else {
$timeStr = '%x ' . t('at') . ' %l:%M %p';
}
if (is_object($ui)) {
$this->set('uLastLogin', strftime($timeStr, $ui->getLastLogin('user')));
$this->set('uName', $ui->getUserName());
$this->set('lastEditSite', strftime($timeStr, strtotime(PageStatistics::getSiteLastEdit('user'))));
$llu = UserStatistics::getLastLoggedInUser();
if ($llu->getUserID() == $u->getUserID()) {
$this->set('lastLoginSite', t('Your login is the most recent.'));
} else {
$this->set('lastLoginSite', strftime($timeStr, $llu->getLastLogin()));
}
Loader::block('form');
}
$this->set('totalFormSubmissions', FormBlockStatistics::getTotalSubmissions());
$this->set('totalFormSubmissionsToday', FormBlockStatistics::getTotalSubmissions(date('Y-m-d')));
}
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:27,代码来源:dashboard_site_activity.php
示例19: authenticate
/**
* Authenticates a user.
* The example implementation makes sure if the username and password
* are both 'demo'.
* In practical applications, this should be changed to authenticate
* against some persistent user identity storage (e.g. database).
* @return boolean whether authentication succeeds.
*/
public function authenticate($Oauth = false)
{
$user = User::model()->findByAttributes(array('email' => $this->username));
if (!$user) {
$this->errorCode = self::ERROR_USERNAME_INVALID;
} elseif (!$user->comparePassword($this->password) && !$Oauth) {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
} else {
$this->errorCode = self::ERROR_NONE;
$userInfo = UserInfo::model()->findByAttributes(array('email' => $this->username));
$userInfo->upTime = time();
$userInfo->save();
if ($userInfo->status == 'frozened') {
throw new CHttpException(404, '错误!你的账号已被冻结.');
Yii::app()->end();
}
//动态设为超级用户
if ($userInfo->isAdmin) {
Yii::app()->user->setIsSuperuser(true);
}
// elseif($userInfo->inRoles(array('superAdmin','admin'))) Yii::app()->user->setIsSuperuser(true);
$this->_id = $userInfo->id;
//用setState添加的变量会加入Yii::app()->user的属性中
$this->setState('displayName', $userInfo->name);
}
return !$this->errorCode;
}
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:35,代码来源:UserIdentity.php
示例20: getUserInfo
public function getUserInfo()
{
if (!$this->_userInfo) {
$this->_userInfo = UserInfo::model()->findByAttributes(array('email' => $this->username));
}
return $this->_userInfo;
}
开发者ID:stan5621,项目名称:eduwind,代码行数:7,代码来源:UserIdentity.php
注:本文中的UserInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论