本文整理汇总了PHP中UserAttributeKey类的典型用法代码示例。如果您正苦于以下问题:PHP UserAttributeKey类的具体用法?PHP UserAttributeKey怎么用?PHP UserAttributeKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserAttributeKey类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: run
public function run() {
Cache::disableCache();
Loader::library('database_indexed_search');
$is = new IndexedSearch();
if ($_GET['force'] == 1) {
Loader::model('attribute/categories/collection');
Loader::model('attribute/categories/file');
Loader::model('attribute/categories/user');
$attributes = CollectionAttributeKey::getList();
$attributes = array_merge($attributes, FileAttributeKey::getList());
$attributes = array_merge($attributes, UserAttributeKey::getList());
foreach($attributes as $ak) {
$ak->updateSearchIndex();
}
$result = $is->reindexAll(true);
} else {
$result = $is->reindexAll();
}
if ($result->count == 0) {
return t('Indexing complete. Index is up to date');
} else {
if ($result->count == $is->searchBatchSize) {
return t('Index partially updated. %s pages indexed (maximum number.) Re-run this job to continue this process.', $result->count);
} else {
return t('Index updated. %s %s required reindexing.', $result->count, $result->count == 1 ? t('page') : t('pages'));
}
}
}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:30,代码来源:index_search.php
示例2: run
public function run()
{
Cache::disableAll();
$is = new IndexedSearch();
if ($_GET['force'] == 1) {
$attributes = \CollectionAttributeKey::getList();
$attributes = array_merge($attributes, \FileAttributeKey::getList());
$attributes = array_merge($attributes, \UserAttributeKey::getList());
foreach ($attributes as $ak) {
$ak->updateSearchIndex();
}
$result = $is->reindexAll(true);
} else {
$result = $is->reindexAll();
}
if ($result->count == 0) {
return t('Indexing complete. Index is up to date');
} else {
if ($result->count == $is->searchBatchSize) {
return t('Index partially updated. %s pages indexed (maximum number.) Re-run this job to continue this process.', $result->count);
} else {
return t('Index updated.') . ' ' . t2('%d page required reindexing.', '%d pages required reindexing.', $result->count, $result->count);
}
}
}
开发者ID:ceko,项目名称:concrete5-1,代码行数:25,代码来源:index_search.php
示例3: add_user_attribute_key
public function add_user_attribute_key($handle, $name, $type = 'text')
{
$ak = UserAttributeKey::getByHandle($handle);
if (!is_object($ak)) {
UserAttributeKey::add($type, array('akHandle' => $handle, 'akName' => t($name)), $pkg);
}
}
开发者ID:remo,项目名称:social,代码行数:7,代码来源:controller.php
示例4: filterByKeywords
public function filterByKeywords($keywords) {
$db = Loader::db();
$qkeywords = $db->quote('%' . $keywords . '%');
$keys = UserAttributeKey::getSearchableIndexedList();
$emailSearchStr=' OR u.uEmail like '.$qkeywords.' ';
$attribsStr = '';
foreach ($keys as $ak) {
$cnt = $ak->getController();
$attribsStr.=' OR ' . $cnt->searchKeywords($keywords);
}
$this->filter(false, '( u.uName like ' . $qkeywords . $emailSearchStr . $attribsStr . ')');
}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:12,代码来源:user_list.php
示例5: view
public function view() {
$userList = new UserList();
$userList->sortBy('uName', 'asc');
$keywords = $this->get('keywords');
if ($keywords != '') {
$userList->filterByKeywords($keywords);
}
$users = $userList->getPage();
$this->set('userList', $userList);
$this->set('users', $users);
$this->set('attribs', UserAttributeKey::getMemberListList());
$this->set('keywords', htmlentities($keywords, ENT_COMPAT, APP_CHARSET));
$this->addHeaderItem(Loader::helper('html')->css('ccm.profile.css'));
}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:14,代码来源:members.php
示例6: start
public function start(Zend_Queue $q)
{
Loader::library('database_indexed_search');
$this->is = new IndexedSearch();
Loader::model('attribute/categories/collection');
Loader::model('attribute/categories/file');
Loader::model('attribute/categories/user');
$attributes = CollectionAttributeKey::getList();
$attributes = array_merge($attributes, FileAttributeKey::getList());
$attributes = array_merge($attributes, UserAttributeKey::getList());
foreach ($attributes as $ak) {
$ak->updateSearchIndex();
}
$db = Loader::db();
$db->Execute('truncate table PageSearchIndex');
$r = $db->Execute('select Pages.cID from Pages left join CollectionSearchIndexAttributes csia on Pages.cID = csia.cID where (ak_exclude_search_index is null or ak_exclude_search_index = 0) and cIsActive = 1');
while ($row = $r->FetchRow()) {
$q->send($row['cID']);
}
}
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:20,代码来源:index_search_all.php
示例7: install
public function install()
{
Loader::library('mootools/attribute', FRONTEND_DEVELOPER_PACKAGE_HANDLE);
$pkg = parent::install();
Loader::model('single_page');
Loader::model('attribute/categories/user');
Loader::model('attribute/categories/file');
$singlePages = array("/dashboard/mootools" => array('cName' => t('Mootools Plugin Developer'), 'cDescription' => t('Management of mootools plugin')), "/dashboard/mootools/plugin" => array('cName' => t('plugin'), 'cDescription' => t('Management of Mootools Plugin that does import')), "/dashboard/mootools/importer" => array('cName' => t('import'), 'cDescription' => t('Import from repository')));
foreach ($singlePages as $key => $page) {
$collection = SinglePage::add($key, $pkg);
if (!empty($collection)) {
$collection->update($page);
}
}
//The name of the user of github is added to the attribute.
$values = array("akHandle" => MOOTOOLS_GITHUB_USER, "akName" => t("Name of user of github"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true);
$key = UserAttributeKey::add("text", $values, $pkg);
$fileAttributes = array(array("type" => "boolean", "values" => array("akHandle" => MOOTOOLS_PLUGIN, "akName" => t("This file is a plugin of Mootools"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "text", "values" => array("akHandle" => MOOTOOLS_COMPONENT_NAME, "akName" => t("Component name of Mootools"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "text", "values" => array("akHandle" => MOOTOOLS_PLUGIN_LICENSE, "akName" => t("License of Mootools plugin"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "text", "values" => array("akHandle" => MOOTOOLS_PLUGIN_AUTHORS, "akName" => t("Authors of Mootools plugin"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "select", "values" => array("akHandle" => MOOTOOLS_PLUGIN_DEPENDENCES, "akName" => t("Dependence of Mootools plugin"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "number", "values" => array("akHandle" => MOOTOOLS_PLUGIN_DISPLAY_ORDER, "akName" => t("The order of display of Mootools plugin"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)));
$attributesKeys = array();
foreach ($fileAttributes as $key => $attr) {
$type = $attr["type"];
$values = $attr["values"];
$handle = $values["akHandle"];
$attributesKeys[$handle] = FileAttributeKey::add($type, $values, $pkg);
}
if (!empty($attributesKeys[MOOTOOLS_PLUGIN_DEPENDENCES])) {
$key = $attributesKeys[MOOTOOLS_PLUGIN_DEPENDENCES];
$db = Loader::db();
$db->Replace('atSelectSettings', array('akID' => $key->getAttributeKeyID(), 'akSelectAllowMultipleValues' => true), array('akID'), true);
}
BlockType::installBlockTypeFromPackage("mootools_plugin_build_form", $pkg);
BlockType::installBlockTypeFromPackage("github_tags", $pkg);
BlockType::installBlockTypeFromPackage("github_issues", $pkg);
BlockType::installBlockTypeFromPackage("github_repository", $pkg);
PageTheme::add('small_project', $pkg);
}
开发者ID:holyshared,项目名称:developer-package,代码行数:36,代码来源:controller.php
示例8: foreach
foreach ($slist as $sk) {
$selectedAKIDs[] = $sk->getAttributeKeyID();
}
if ($_POST['task'] == 'update_columns') {
Loader::model('attribute/category');
$sc = AttributeKeyCategory::getByHandle('user');
$sc->clearAttributeKeyCategoryColumnHeaders();
if (is_array($_POST['akID'])) {
foreach ($_POST['akID'] as $akID) {
$ak = UserAttributeKey::getByID($akID);
$ak->setAttributeKeyColumnHeader(1);
}
}
exit;
}
$list = UserAttributeKey::getList();
?>
<form method="post" id="ccm-user-customize-search-columns-form" action="<?php
echo REL_DIR_FILES_TOOLS_REQUIRED;
?>
/users/customize_search_columns/">
<?php
echo $form->hidden('task', 'update_columns');
?>
<h1><?php
echo t('Additional Searchable Attributes');
?>
</h1>
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:30,代码来源:customize_search_columns.php
示例9: do_register
public function do_register() {
$registerData['success']=0;
$userHelper = Loader::helper('concrete/user');
$e = Loader::helper('validation/error');
$ip = Loader::helper('validation/ip');
$txt = Loader::helper('text');
$vals = Loader::helper('validation/strings');
$valc = Loader::helper('concrete/validation');
$username = $_POST['uName'];
$password = $_POST['uPassword'];
$passwordConfirm = $_POST['uPasswordConfirm'];
// clean the username
$username = trim($username);
$username = preg_replace("/ +/", " ", $username);
if (!$ip->check()) {
$e->add($ip->getErrorMessage());
}
if (ENABLE_REGISTRATION_CAPTCHA) {
$captcha = Loader::helper('validation/captcha');
if (!$captcha->check()) {
$e->add(t("Incorrect image validation code. Please check the image and re-enter the letters or numbers as necessary."));
}
}
if (!$vals->email($_POST['uEmail'])) {
$e->add(t('Invalid email address provided.'));
} else if (!$valc->isUniqueEmail($_POST['uEmail'])) {
$e->add(t("The email address %s is already in use. Please choose another.", $_POST['uEmail']));
}
//if (USER_REGISTRATION_WITH_EMAIL_ADDRESS == false) {
if (strlen($username) < USER_USERNAME_MINIMUM) {
$e->add(t('A username must be between at least %s characters long.', USER_USERNAME_MINIMUM));
}
if (strlen($username) > USER_USERNAME_MAXIMUM) {
$e->add(t('A username cannot be more than %s characters long.', USER_USERNAME_MAXIMUM));
}
if (strlen($username) >= USER_USERNAME_MINIMUM && !$valc->username($username)) {
if(USER_USERNAME_ALLOW_SPACES) {
$e->add(t('A username may only contain letters, numbers and spaces.'));
} else {
$e->add(t('A username may only contain letters or numbers.'));
}
}
if (!$valc->isUniqueUsername($username)) {
$e->add(t("The username %s already exists. Please choose another", $username));
}
//}
if ($username == USER_SUPER) {
$e->add(t('Invalid Username'));
}
/*
if ((strlen($password) < USER_PASSWORD_MINIMUM) || (strlen($password) > USER_PASSWORD_MAXIMUM)) {
$e->add(t('A password must be between %s and %s characters', USER_PASSWORD_MINIMUM, USER_PASSWORD_MAXIMUM));
}
if (strlen($password) >= USER_PASSWORD_MINIMUM && !$valc->password($password)) {
$e->add(t('A password may not contain ", \', >, <, or any spaces.'));
}
*/
$userHelper->validNewPassword($password,$e);
if ($password) {
if ($password != $passwordConfirm) {
$e->add(t('The two passwords provided do not match.'));
}
}
$aks = UserAttributeKey::getRegistrationList();
foreach($aks as $uak) {
if ($uak->isAttributeKeyRequiredOnRegister()) {
$e1 = $uak->validateAttributeForm();
if ($e1 == false) {
$e->add(t('The field "%s" is required', $uak->getAttributeKeyName()));
} else if ($e1 instanceof ValidationErrorHelper) {
$e->add($e1);
}
}
}
if (!$e->has()) {
// do the registration
$data = $_POST;
//.........这里部分代码省略.........
开发者ID:nbourguig,项目名称:concrete5,代码行数:101,代码来源:register.php
示例10: t
print t('Unknown');
break;
case '0':
print t('No');
break;
case '1':
print t('Yes');
break;
}?>
</strong></p>
<? } ?>
<br/>
<?
$attribs = UserAttributeKey::getList(true);
if (count($attribs) > 0) { ?>
<h3><?=t('User Attributes')?></h3><br/>
<?
for ($i = 0; $i < count($attribs); $i++) {
$uk = $attribs[$i];
if ($pk->validate($uk)) {
?>
<div class="row">
<div class="span5" style=""><p><strong><?=$uk->getAttributeKeyDisplayHandle()?></strong></p></div>
<div class="span5"><p>
<?=$uo->getAttribute($uk->getAttributeKeyHandle(), 'displaySanitized', 'display')?>
</p></div>
开发者ID:nveid,项目名称:concrete5,代码行数:31,代码来源:search.php
示例11: date
echo $ui->getUserEmail();
?>
"><?php
echo $txt->highlightSearch($ui->getUserEmail(), $keywords);
?>
</a></td>
<td><?php
echo date(DATE_APP_DASHBOARD_SEARCH_RESULTS_USERS, strtotime($ui->getUserDateAdded('user')));
?>
</td>
<td><?php
echo $ui->getNumLogins();
?>
</td>
<?php
$slist = UserAttributeKey::getColumnHeaderList();
foreach ($slist as $ak) {
?>
<td><?php
$vo = $ui->getAttributeValueObject($ak);
if (is_object($vo)) {
print $vo->getValue('display');
}
?>
</td>
<?php
}
?>
<td> </td>
</tr>
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:31,代码来源:search_results.php
示例12: defined
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$form = Loader::helper('form');
$searchFields = array('date_added' => t('Registered Between'), 'is_active' => t('Activated Users'));
if (Config::get('concrete.permissions_model') == 'advanced') {
$searchFields['group_set'] = t('Group Set');
}
$searchFieldAttributes = UserAttributeKey::getSearchableList();
foreach ($searchFieldAttributes as $ak) {
$searchFields[$ak->getAttributeKeyID()] = $ak->getAttributeKeyDisplayName();
}
$ek = PermissionKey::getByHandle('edit_user_properties');
$ik = PermissionKey::getByHandle('activate_user');
$dk = PermissionKey::getByHandle('delete_user');
$flr = new \Concrete\Core\Search\StickyRequest('users');
$searchRequest = $flr->getSearchRequest();
?>
<script type="text/template" data-template="search-form">
<form role="form" data-search-form="users" action="<?php
echo URL::to('/ccm/system/search/users/submit');
?>
" class="form-inline ccm-search-fields">
<div class="ccm-search-fields-row">
<div class="form-group">
<select data-bulk-action="users" disabled class="ccm-search-bulk-action form-control">
<option value=""><?php
echo t('Items Selected');
?>
</option>
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:31,代码来源:search.php
示例13: createUser
protected function createUser()
{
// Make sure that this extractor supports everything we need.
if (!$this->supportsEmail() && $this->supportsUniqueId()) {
throw new Exception('Email and unique ID support are required for user creation.');
}
// Make sure that email is verified if the extractor supports it.
if ($this->supportsVerifiedEmail() && !$this->isEmailVerified()) {
throw new Exception('Please verify your email with this service before attempting to log in.');
}
$email = $this->getEmail();
if (\UserInfo::getByEmail($email)) {
throw new Exception('Email is already in use.');
}
$first_name = "";
$last_name = "";
$name_support = array('full' => $this->supportsFullName(), 'first' => $this->supportsFirstName(), 'last' => $this->supportsLastName());
if ($name_support['first'] && $name_support['last']) {
$first_name = $this->getFirstName();
$last_name = $this->getLastName();
} elseif ($name_support['full']) {
$reversed_full_name = strrev($this->getFullName());
list($reversed_last_name, $reversed_first_name) = explode(' ', $reversed_full_name, 2);
$first_name = strrev($reversed_first_name);
$last_name = strrev($reversed_last_name);
}
$username = null;
if ($this->supportsUsername()) {
$username = $this->getUsername();
}
if ($username === null) {
if ($first_name || $last_name) {
$username = preg_replace('/[^a-z0-9\\_]/', '_', strtolower($first_name . ' ' . $last_name));
$username = trim(preg_replace('/_{2,}/', '_', $username), '_');
} else {
$username = preg_replace('/[^a-zA-Z0-9\\_]/i', '_', strtolower(substr($email, 0, strpos($email, '@'))));
$username = trim(preg_replace('/_{2,}/', '_', $username), '_');
}
}
$unique_username = $username;
$append = 1;
while (\UserInfo::getByUserName($unique_username)) {
// This is a heavy handed way to do this, but it must be done.
$unique_username = $username . '_' . $append++;
}
$username = $unique_username;
$data = array();
$data['uName'] = $username;
$data['uPassword'] = "";
$data['uEmail'] = $email;
$data['uIsValidated'] = 1;
$user_info = \UserInfo::add($data);
if (!$user_info) {
throw new Exception('Unable to create new account.');
}
if ($group_id = intval($this->registrationGroupID(), 10)) {
$group = \Group::getByID($group_id);
if ($group && is_object($group) && !$group->isError()) {
$user = \User::getByUserID($user_info->getUserID());
$user->enterGroup($group);
}
}
$key = \UserAttributeKey::getByHandle('first_name');
if ($key) {
$user_info->setAttribute($key, $first_name);
}
$key = \UserAttributeKey::getByHandle('last_name');
if ($key) {
$user_info->setAttribute($key, $last_name);
}
\User::loginByUserID($user_info->getUserID());
$this->bindUser($user = \User::getByUserID($user_info->getUserID()), $this->getUniqueId());
return $user;
}
开发者ID:ngreimel,项目名称:kovent,代码行数:74,代码来源:GenericOauthTypeController.php
示例14: defined
defined('C5_EXECUTE') or die("Access Denied.");
$token = \Core::make('Concrete\\Core\\Validation\\CSRF\\Token');
?>
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<div class="page-header">
<h1><?php
echo t('Site Registration');
?>
</h1>
</div>
</div>
</div>
<?php
$attribs = UserAttributeKey::getRegistrationList();
if ($registerSuccess) {
?>
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<?php
switch ($registerSuccess) {
case "registered":
?>
<p><strong><?php
echo $successMsg;
?>
</strong><br/><br/>
<a href="<?php
echo $view->url('/');
?>
开发者ID:digideskio,项目名称:concrete5,代码行数:31,代码来源:register.php
示例15: installUserAttributes
private function installUserAttributes($pkg)
{
$uakc = AttributeKeyCategory::getByHandle('user');
// Multiple means an attribute can be in more than one set, but you
// can't choose what set they show up in for the gui
// $uakc->setAllowAttributeSets(AttributeKeyCategory::ASET_ALLOW_MULTIPLE);
// $uakc->setAllowAttributeSets(AttributeKeyCategory::ASET_ALLOW_NONE);
$uakc->setAllowAttributeSets(AttributeKeyCategory::ASET_ALLOW_SINGLE);
$bua = $uakc->addSet('c5_boilerplate_user_attributes', t('Boilerplate User Attributes'), $pkg);
//add boolean attributes
$bp_boolean = UserAttributeKey::getByHandle('bp_boolean');
if (!$bp_boolean instanceof UserAttributeKey) {
$bp_boolean = UserAttributeKey::add('boolean', array('akHandle' => 'bp_boolean', 'akName' => t('Boolean Name'), 'akIsSearchable' => true, 'akIsSearchableIndexed' => true), $pkg)->setAttributeSet($bua);
}
//add text attributes
$bp_text = UserAttributeKey::getByHandle('bp_text');
if (!$bp_text instanceof UserAttributeKey) {
$bp_text = UserAttributeKey::add('text', array('akHandle' => 'bp_text', 'akName' => t('Text Name'), 'akIsSearchable' => true, 'akIsSearchableIndexed' => true), $pkg)->setAttributeSet($bua);
}
}
开发者ID:janzenz,项目名称:c5_boilerplate,代码行数:20,代码来源:controller.php
示例16: upgradeUserAttributes
protected function upgradeUserAttributes() {
$messages = array();
$db = Loader::db();
$r = $db->Execute('select _UserAttributeKeys.* from _UserAttributeKeys order by displayOrder asc');
while ($row = $r->FetchRow()) {
$cleanHandle = preg_replace("/[^A-Za-z0-9\_]/",'',$row['ukHandle']); // remove spaces, chars that'll mess up our index tables
$existingAKID = $db->GetOne('select akID from AttributeKeys where akHandle = ?', array($cleanHandle) );
if ($existingAKID < 1) {
if(!$row['ukHandle']) continue;
$args = array(
'akHandle' => $cleanHandle,
'akIsSearchable' => 1,
'akIsEditable' => 1,
'akName' => $row['ukName'],
'uakIsActive' => ($row['ukHidden']?0:1),
'uakProfileEditRequired' => $row['ukRequired'],
'uakProfileDisplay' => ($row['ukPrivate'] == 0),
'uakRegisterEdit' => $row['ukDisplayedOnRegister']
);
$sttype = $row['ukType'];
if ($sttype == 'TEXTAREA') {
$sttype = 'TEXT';
}
if ($sttype == 'RADIO') {
$sttype = 'SELECT';
}
$type = AttributeType::getByHandle(strtolower($sttype));
$ak = UserAttributeKey::add($type, $args);
if ($sttype == 'SELECT') {
$selectOptions = explode("\n", $row['ukValues']);
foreach($selectOptions as $so) {
if ($so != '') {
SelectAttributeTypeOption::add($ak, $so);
}
}
}
} else {
$ak = UserAttributeKey::getByID($existingAKID);
}
$r2 = $db->Execute('select * from _UserAttributeValues where ukID = ? and isImported = 0', $row['ukID']);
while ($row2 = $r2->FetchRow()) {
$ui = UserInfo::getByID($row2['uID']);
if(is_object($ui)) {
$value = $row2['value'];
$ui->setAttribute($ak, $value);
}
unset($ui);
$db->Execute('update _UserAttributeValues set isImported = 1 where ukID = ? and uID = ?', array($row['ukID'], $row2['uID']));
$this->incrementImported();
}
unset($ak);
unset($row2);
$r2->Close();
unset($r2);
}
unset($row);
$r->Close();
unset($r);
return $messages;
}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:65,代码来源:version_532.php
示例17: finishLogin
protected function finishLogin($loginData = array())
{
$u = new User();
if ($this->post('uMaintainLogin')) {
$u->setUserForeverCookie();
}
if (count($this->locales) > 0) {
if (Config::get('LANGUAGE_CHOOSE_ON_LOGIN') && $this->post('USER_LOCALE') != '') {
$u->setUserDefaultLanguage($this->post('USER_LOCALE'));
}
}
// Verify that the user has filled out all
// required items that are required on register
// That means users logging in after new user attributes
// have been created and required will be prompted here to
// finish their profile
$this->set('invalidRegistrationFields', false);
Loader::model('attribute/categories/user');
$ui = UserInfo::getByID($u->getUserID());
$aks = UserAttributeKey::getRegistrationList();
$unfilledAttributes = array();
foreach ($aks as $uak) {
if ($uak->isAttributeKeyRequiredOnRegister()) {
$av = $ui->getAttributeValueObject($uak);
if (!is_object($av)) {
$unfilledAttributes[] = $uak;
}
}
}
if ($this->post('completePartialProfile')) {
foreach ($unfilledAttributes as $uak) {
$e1 = $uak->validateAttributeForm();
if ($e1 == false) {
$this->error->add(t('The field "%s" is required', $uak->getAttributeKeyName()));
} else {
if ($e1 instanceof ValidationErrorHelper) {
$this->error->add($e1);
}
}
}
if (!$this->error->has()) {
// the user has needed to complete a partial profile, and they have done so,
// and they have no errors. So we save our profile data against the account.
foreach ($unfilledAttributes as $uak) {
$uak->saveAttributeForm($ui);
$unfilledAttributes = array();
}
}
}
if (count($unfilledAttributes) > 0) {
$u->logout();
$this->set('invalidRegistrationFields', true);
$this->set('unfilledAttributes', $unfilledAttributes);
}
$txt = Loader::helper('text');
$rcID = $this->post('rcID');
$nh = Loader::helper('validation/numbers');
//set redirect url
if ($nh->integer($rcID)) {
$nh = Loader::helper('navigation');
$rc = Page::getByID($rcID);
$url = $nh->getLinkToCollection($rc, true);
$loginData['redirectURL'] = $url;
} elseif (strlen($rcID)) {
$rcID = trim($rcID, '/');
$nc2 = Page::getByPath('/' . $rcID);
if (is_object($nc2) && !$nc2->isError()) {
$loginData['redirectURL'] = BASE_URL . DIR_REL . '/' . DISPATCHER_FILENAME . '/' . $rcID;
}
}
/*
//full page login redirect (non-ajax login)
if( strlen($loginData['redirectURL']) && $_REQUEST['format']!='JSON' ){
header('Location: ' . $loginData['redirectURL']);
exit;
}
*/
$dash = Page::getByPath("/dashboard", "RECENT");
$dbp = new Permissions($dash);
Events::fire('on_user_login', $this);
//End JSON Login
if ($_REQUEST['format'] == 'JSON') {
return $loginData;
}
//should administrator be redirected to dashboard? defaults to yes if not set.
$adminToDash = intval(Config::get('LOGIN_ADMIN_TO_DASHBOARD'));
//Full page login, standard redirection
$u = new User();
// added for the required registration attribute change above. We recalc the user and make sure they're still logged in
if ($u->isRegistered()) {
if ($u->config('NEWSFLOW_LAST_VIEWED') == 'FIRSTRUN') {
$u->saveConfig('NEWSFLOW_LAST_VIEWED', 0);
}
if ($loginData['redirectURL']) {
//make double secretly sure there's no caching going on
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");
header('Expires: Fri, 30 Oct 1998 14:19:41 GMT');
//in the past
$this->externalRedirect($loginData['redirectURL']);
//.........这里部分代码省略.........
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:101,代码来源:login.php
示例18: getAttributeField
public function getAttributeField($ak) {
Loader::model('attribute/categories/user');
if (!is_object($ak)) {
$ak = UserAttributeKey::getByHandle($ak);
}
$value = $this->getAttributeValueObject($ak);
$ak->render('form', $value);
}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:8,代码来源:userinfo.php
示例19: edit_attribute
public function edit_attribute()
{
$uo = UserInfo::getByID($_POST['uID']);
$u = new User();
if ($uo->getUserID() == USER_SUPER_ID && !$u->isSuperUser()) {
throw new Exception(t('Only the super user may edit this account.'));
}
$akID = $_REQUEST['uakID'];
$ak = UserAttributeKey::get($akID);
if ($_POST['task'] == 'update_extended_attribute') {
$ak->saveAttributeForm($uo);
$val = $uo->getAttributeValueObject($ak);
print $val->getValue('displaySanitized', 'display');
exit;
}
if ($_POST['task'] == 'clear_extended_attribute') {
$uo->clearAttribute($ak);
$val = $uo->getAttributeValueObject($ak);
print '<div class="ccm-attribute-field-none">' . t('None') . '</div>';
exit;
}
}
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:22,代码来源:search.php
示例20: view
public function view()
{
$assignment = PermissionKey::getByHandle('edit_user_properties')->getMyAssignment();
$vals = Loader::helper('validation/strings');
$valt = Loader::helper('validation/token');
$valc = Loader::helper('concrete/validation');
if ($_POST['create']) {
$username = trim($_POST['uName']);
$username = preg_replace("/\\s+/", " ", $username);
$_POST['uName'] = $username;
$password = $_POST['uPassword'];
if (!$vals->email($_POST['uEmail'])) {
$this->error->add(t('Invalid email address provided.'));
} else {
if (!$valc->isUniqueEmail($_POST['uEmail'])) {
$this->error->add(t("The email address '%s' is already in use. Please choose another.", $_POST['uEmail']));
}
}
if (strlen($username) < USER_USERNAME_MINIMUM) {
$this->error->add(t('A username must be between at least %s characters long.', USER_USERNAME_MINIMUM));
}
if (strlen($username) > USER_USERNAME_MAXIMUM) {
$this->error->add(t('A username cannot be more than %s characters long.', USER_USERNAME_MAXIMUM));
}
if (strlen($username) >= USER_USERNAME_MINIMUM && !$valc->username($username)) {
if (USER_USERNAME_ALLOW_SPACES) {
$this->error->add(t('A username may only contain letters, numbers and spaces.'));
} else {
$this->error->add(t('A username may only contain letters or numbers.'));
}
}
if (!$valc->isUniqueUsername($username)) {
$this->error->add(t("The username '%s' already exists. Please choose another", $username));
}
if ($username == USER_SUPER) {
$this->error->add(t('Invalid Username'));
}
if (strlen($password) < USER_PASSWORD_MINIMUM || strlen($password) > USER_PASSWORD_MAXIMUM) {
$this->error->add(t('A password must be between %s and %s characters', USER_PASSWORD_MINIMUM, USER_PASSWORD_MAXIMUM));
}
if (strlen($password) >= USER_PASSWORD_MINIMUM && !$valc->password($password)) {
$this->error->add(t('A password may not contain ", \', >, <, or any spaces.'));
}
if (!$valt->validate('create_account')) {
$this->error->add($valt->getErrorMessage());
}
Loader::model("attribute/categories/user");
$aks = UserAttributeKey::getRegistrationList();
foreach ($aks as $uak) {
if ($uak->isAttributeKeyRequiredOnRegister()) {
$e1 = $uak->validateAttributeForm();
if ($e1 == false) {
$this->error->add(t('The field "%s" is required', $uak->getAttributeKeyName()));
} else {
if ($e1 instanceof ValidationErrorHelper) {
$this->error->add($e1->getList());
}
}
}
}
if (!$this->error->has()) {
// do the registration
$data = array('uName' => $username, 'uPassword' => $password, 'uEmail' => $_POST['uEmail'], 'uDefaultLanguage' => $_POST['uDefaultLanguage']);
$uo = UserInfo::add($data);
if (is_object($uo)) {
$av = Loader::helper('concrete/avatar');
if ($assignment->allowEditAvatar()) {
if (is_uploaded_file($_FILES['uAvatar']['tmp_name'])) {
$uHasAvatar = $av->updateUserAvatar($_FILES['uAvatar']['tmp_name'], $uo->getUserID());
}
}
foreach ($aks as $uak) {
if (in_array($uak->getAttributeKeyID(), $assignment->getAttributesAllowedArray())) {
$uak->saveAttributeForm($uo);
}
}
$gak = PermissionKey::getByHandle('assign_user_groups');
$gIDs = array();
if (is_array($_POST['gID'])) {
foreach ($_POST['gID'] as $gID) {
if ($gak->validate($gID)) {
$gIDs[] = $gID;
}
}
}
$uo->updateGroups($gIDs);
$uID = $uo->getUserID();
$this->redirect('/dashboard/users/search?uID=' . $uID . '&user_created=1');
} else {
$this->error->add(t('An error occurred while trying to create the account.'));
$this->set('error', $this->error);
}
} else {
$this->set('error', $this->error);
}
}
}
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:97,代码来源:add.php
注:本文中的UserAttributeKey类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论