本文整理汇总了PHP中e107::getUserExt方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::getUserExt方法的具体用法?PHP e107::getUserExt怎么用?PHP e107::getUserExt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::getUserExt方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: user_import
function user_import()
{
$this->userDB = new db();
// Have our own database object to write to the user table
$this->actualExtended = e107::getUserExt()->getFieldNames();
// Create list of predefined extended user fields which are present
}
示例2: toolsPageProcess
function toolsPageProcess()
{
$mes = e107::getMessage();
$fList = array();
if (isset($_POST['tools'])) {
$msg = '';
if (isset($_POST['forum_all'])) {
$fList[] = 'all';
} else {
foreach (array_keys($_POST['forumlist']) as $k) {
$fList[] = $k;
}
}
foreach ($fList as $fid) {
if (isset($_POST['counts'])) {
$this->forumObj->forumUpdateCounts($fid, $_POST['counts_threads']);
$msg .= FORLAN_167 . ": {$fid} <br />";
}
if (isset($_POST['lastpost'])) {
$with_threads = !empty($_POST['lastpost_nothread']) ? FALSE : TRUE;
$this->forumObj->forumUpdateLastpost('forum', $fid, $with_threads);
$msg .= FORLAN_168 . ": {$fid} <br />";
}
}
if (isset($_POST['userpostcounts'])) {
$ue = e107::getUserExt();
$list = $this->forumObj->getUserCounts();
foreach ($list as $uid => $cnt) {
$ue->user_extended_setvalue($uid, 'user_plugin_forum_posts', $cnt, 'int');
}
$msg .= FORLAN_169 . ' <br />';
}
$mes->addSuccess($msg);
// $ns->tablerender($caption, $mes->render().$text);
}
}
示例3: ret_extended_field_list
/**
* Creates a 'select' dropdown of non-system user fields
*
* @param string $list_name - name for <select>
* @param string $curval - current select value
* @param boolean $add_blank - add a blank line before the options if TRUE
* @return text for display
*/
public function ret_extended_field_list($list_name, $curval = '', $add_blank = FALSE)
{
$ue = e107::getUserExt();
// Get the extended field handler
$ret = "<select name='{$list_name}' class='tbox'>\n";
if ($add_blank) {
$ret .= "<option value=''> </option>\n";
}
foreach ($ue->fieldDefinitions as $fd) {
if ($fd['user_extended_struct_text'] != '_system_') {
$value = 'ue.user_' . $fd['user_extended_struct_name'];
$selected = $value == $curval ? " selected='selected'" : '';
$ret .= "<option value='" . $value . "' {$selected}>" . ucfirst($fd['user_extended_struct_name']) . "</option>\n";
}
}
$ret .= "</select>\n";
return $ret;
}
示例4: step3
function step3()
{
$ns = e107::getRender();
$mes = e107::getMessage();
$stepCaption = 'Step 3: Extended user field creation';
if (!isset($_POST['create_extended'])) {
$text = "\n\t\tThis step will create the new extended user fields required for the new forum code: <br />\n\t\t<ul>\n\t\t<li>user_plugin_forum_posts (to track number of posts for each user)</li>\n\t\t<li>user_plugin_forum_viewed (to track threads viewed by each user</li>\n\t\t</ul>\n\t\t<br /><br />\n\t\t<form method='post'>\n\t\t<input class='btn btn-success' data-loading-text='Please wait...' type='submit' name='create_extended' value='Proceed with field creation' />\n\t\t</form>\n\t\t";
$ns->tablerender($stepCaption, $text);
return;
}
$fieldList = array('plugin_forum_posts' => 'integer', 'plugin_forum_viewed' => 'radio');
$failed = false;
$ext = e107::getUserExt();
foreach ($fieldList as $fieldName => $fieldType) {
$result = $ext->user_extended_add_system($fieldName, $fieldType);
if ($result === true) {
$mes->addSuccess('Creating extended user field user_' . $fieldName);
} else {
$mes->addError('Creating extended user field user_' . $fieldName);
$mes->addDebug(print_a($result, true));
$failed = true;
}
}
if ($failed) {
$mes->addError("Creation of extended field(s) failed. You can not continue until these are create successfully!");
} else {
$text = "\n\t\t\t<form method='post' action='" . e_SELF . "?step=4'>\n\t\t\t<input class='btn btn-success' type='submit' name='nextStep[4]' value='Proceed to step 4' />\n\t\t\t</form>\n\t\t\t";
}
$ns->tablerender($stepCaption, $mes->render() . $text);
}
示例5: user_extended_shortcode
/**
* @param $parm
* @usage {USER_EXTENDED=<field_name>.[text|value|icon|text_value].<user_id>}
* @example {USER_EXTENDED=user_gender.value.5} will show the value of the extended field user_gender for user #5
* @return bool|string
*/
function user_extended_shortcode($parm)
{
$currentUser = e107::user();
$tp = e107::getParser();
global $loop_uid, $e107, $sc_style;
// include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_user_extended.php');
$parms = explode('.', $parm);
if (isset($loop_uid) && intval($loop_uid) == 0) {
return '';
}
$key = $parms[0] . "." . $parms[1];
$sc_style['USER_EXTENDED']['pre'] = isset($sc_style['USER_EXTENDED'][$key]['pre']) ? $sc_style['USER_EXTENDED'][$key]['pre'] : '';
$sc_style['USER_EXTENDED']['post'] = isset($sc_style['USER_EXTENDED'][$key]['post']) ? $sc_style['USER_EXTENDED'][$key]['post'] : '';
//include_once(e_HANDLER.'user_extended_class.php');
$ueStruct = e107::getUserExt()->user_extended_getStruct();
// $ueStruct = e107_user_extended::user_extended_getStruct();
$uid = intval(varset($parms[2], 0));
if ($uid == 0) {
if (isset($loop_uid) && intval($loop_uid) > 0) {
$uid = $loop_uid;
} else {
$uid = USERID;
}
}
$udata = e107::user($uid);
$udata['user_class'] .= $udata['user_class'] == '' ? '' : ',';
$udata['user_class'] .= e_UC_PUBLIC . "," . e_UC_MEMBER;
if (!empty($udata['user_admin'])) {
$udata['user_class'] .= ',' . e_UC_ADMIN;
}
// Need to pick up the 'miscellaneous' category - anything which isn't in a named category. Have to control visibility on a field by field basis
// And I don't think this should apply to icons
/**
* @todo - must be a better way of picking up the 'Miscellaneous' category
*/
include_lan(e_LANGUAGEDIR . e_LANGUAGE . '/lan_user.php');
if ($parms[1] != 'icon' && $parms[0] != LAN_USER_44) {
$fkeyApplic = varset($ueStruct["user_" . $parms[0]]['user_extended_struct_applicable']);
$fkeyRead = varset($ueStruct["user_" . $parms[0]]['user_extended_struct_read']);
$fkeyStruct = varset($ueStruct["user_" . $parms[0]]['user_extended_struct_parms']);
$ret_cause = 0;
if (!check_class($fkeyApplic, $udata['user_class'])) {
$ret_cause = 1;
}
if (!check_class($fkeyRead, $udata['user_class'])) {
$ret_cause = 2;
}
if ($ueStruct["user_" . $parms[0]]['user_extended_struct_read'] == e_UC_READONLY && (!ADMIN && $udata['user_id'] != USERID)) {
$ret_cause = 3;
}
if (!ADMIN && substr($fkeyStruct, -1) == 1 && strpos($udata['user_hidden_fields'], "^user_" . $parms[0] . "^") !== FALSE && $uid != USERID) {
$ret_cause = 4;
}
if ($ret_cause != 0) {
return FALSE;
}
}
if ($parms[1] == 'text_value') {
// $_value = $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.value}");
$_value = user_extended_shortcode($parms[0] . ".value");
if ($_value) {
$__pre = isset($sc_style['USER_EXTENDED'][$key]['pre']) ? $sc_style['USER_EXTENDED'][$key]['pre'] : '';
$__post = isset($sc_style['USER_EXTENDED'][$key]['post']) ? $sc_style['USER_EXTENDED'][$key]['post'] : '';
// $_text = $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.text}");
$_text = user_extended_shortcode($parms[0], ".text");
$_mid = isset($sc_style['USER_EXTENDED'][$key]['mid']) ? $sc_style['USER_EXTENDED'][$key]['mid'] : '';
return $__pre . $_text . $_mid . $_value . $__post;
}
return false;
}
if ($parms[1] == 'text') {
$text_val = $ueStruct['user_' . $parms[0]]['user_extended_struct_text'];
if ($text_val) {
return defined($text_val) ? constant($text_val) : $text_val;
} else {
return FALSE;
}
}
if ($parms[1] == 'icon') {
if (defined(strtoupper($parms[0]) . '_ICON')) {
return constant(strtoupper($parms[0]) . '_ICON');
} elseif (is_readable(e_IMAGE . "user_icons/user_{$parms[0]}.png")) {
return "<img src='" . e_IMAGE_ABS . "user_icons/user_{$parms[0]}.png' style='width:16px; height:16px' alt='' />";
} elseif (is_readable(e_IMAGE . "user_icons/{$parms[0]}.png")) {
return "<img src='" . e_IMAGE_ABS . "user_icons/{$parms[0]}.png' style='width:16px; height:16px' alt='' />";
}
//return '';
return FALSE;
}
if ($parms[1] == 'value') {
$uVal = str_replace(chr(1), '', $udata['user_' . $parms[0]]);
switch ($ueStruct["user_" . $parms[0]]['user_extended_struct_type']) {
case EUF_DB_FIELD:
// check for db_lookup type
//.........这里部分代码省略.........
示例6: showExtendedList
function showExtendedList()
{
global $curtype, $mySQLdefaultdb, $action, $sub_action;
$ue = e107::getUserExt();
$frm = e107::getForm();
$ns = e107::getRender();
$sql = e107::getDb();
$tp = e107::getParser();
$extendedList = $ue->user_extended_get_fields();
$emessage = e107::getMessage();
$text = $emessage->render();
$mode = 'show';
$text .= "\n\n\t\t\t <form method='post' action='" . e_SELF . "' >\n\t\t\t <table class='table adminlist'>\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t<th>" . EXTLAN_1 . "</th>\n <th>" . EXTLAN_79 . "</th>\n\n\t\t\t\t<th>" . EXTLAN_2 . "</th>\n\t\t\t\t<th>" . EXTLAN_44 . "</th>\n\t\t\t\t<th>" . EXTLAN_4 . "</th>\n\n\t\t\t\t<th>" . EXTLAN_5 . "</th>\n\t\t\t\t<th>" . EXTLAN_6 . "</th>\n\t\t\t\t<th>" . EXTLAN_7 . "</th>\n\t\t\t\t<th class='center last' colspan='2'>" . EXTLAN_8 . "</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t";
foreach ($this->catNums as $cn) {
$i = 0;
$category_name = $this->catList[$cn][0]['user_extended_struct_name'];
if (vartrue($extendedList[$cn])) {
foreach ($extendedList[$cn] as $ext) {
$name = $ext['user_extended_struct_name'];
$fname = "user_" . $name;
$id = $ext['user_extended_struct_id'];
$uVal = str_replace(chr(1), "", $ext['user_extended_struct_default']);
// Is this right?
$text .= "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>{$ext['user_extended_struct_name']}</td>\n\t\t\t\t\t\t\t<td>" . $tp->toHTML(deftrue($ext['user_extended_struct_text'], $ext['user_extended_struct_text']), FALSE, "defs") . "</td>\n\t\t\t\t\t\t\t<td class='left'>" . $ue->user_extended_edit($ext, $uVal) . "</td>\n\t\t\t\t\t\t\t<td class='left'>" . $category_name . "</td>\n\t\t\t\t\t\t\t<td>" . ($ext['user_extended_struct_required'] == 1 ? LAN_YES : LAN_NO) . "</td>\n\t\t\t\t\t\t\t<td>" . r_userclass_name($ext['user_extended_struct_applicable']) . "</td>\n\t\t\t\t\t\t\t<td>" . r_userclass_name($ext['user_extended_struct_read']) . "</td>\n\t\t\t\t\t\t\t<td>" . r_userclass_name($ext['user_extended_struct_write']) . "</td>\n\t\t\t\t\t\t\t<td>";
if ($i > 0) {
$text .= "<input type='image' alt='' title='" . EXTLAN_26 . "' src='" . ADMIN_UP_ICON_PATH . "' name='up[{$id}]' value='{$ext['user_extended_struct_id']}.{$ext['user_extended_struct_order']}.{$ext['user_extended_struct_parent']}' />";
}
if ($i <= count($extendedList[$cn]) - 2) {
$text .= "<input type='image' alt='' title='" . EXTLAN_25 . "' src='" . ADMIN_DOWN_ICON_PATH . "' name='down[{$id}]' value='{$ext['user_extended_struct_id']}.{$ext['user_extended_struct_order']}.{$ext['user_extended_struct_parent']}' />";
}
$text .= "\n\t\t\t\t\t\t \t</td>\n\t\t\t\t\t\t\t<td class='center' style='width:10%;white-space:nowrap'>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<a class='btn btn-default' style='text-decoration:none' href='" . e_SELF . "?editext." . $id . "'>" . ADMIN_EDIT_ICON . "</a>\n\t\t\t\t\t\t\t" . $frm->submit_image('eudel[' . $name . ']', $id, 'delete', LAN_DELETE . ' [ ID: ' . $id . ' ]', array('class' => 'action delete btn btn-default' . $delcls));
// ."<input class='btn btn-large' type='image' title='".LAN_DELETE."' name='eudel[".$name."]' src='".ADMIN_DELETE_ICON_PATH."' value='".$id."' onclick='return confirm(\"".EXTLAN_27."\")' />
$text .= "</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t";
$i++;
}
} elseif ($cn == 0) {
$text .= "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan='10' class='center'>" . EXTLAN_28 . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t";
}
}
//Show add/edit form
$text .= "</tbody>\n\t\t\t</table></form>";
$ns->tablerender(EXTLAN_9, $text);
}
示例7: user_extended
function user_extended($curval, $mode, $att)
{
if ($mode == 'read') {
$field = $att['field'];
$data = $this->getController()->getListModel()->get($field);
// ($att['field']);
return $data;
}
if ($mode == 'write') {
// e107::getUserExt()->user_extended_edit
// return 'hello';
$field = $att['field'];
$extData = $this->getController()->getExtended();
$extData[$field]['user_extended_struct_required'] = 0;
return e107::getUserExt()->user_extended_edit($extData[$field], $curval);
// return print_a($att,true);
}
}
示例8: __construct
//.........这里部分代码省略.........
}
if (count($xFields)) {
$xArray = array();
$xArray['data'] = $xFields;
if ($row['user_extended_id']) {
$ue->addFieldTypes($xArray);
// Add in the data types for storage
$xArray['WHERE'] = '`user_extended_id`=' . intval($row['user_id']);
if (AA_DEBUG) {
$this->e107->admin_log->e_log_event(10, debug_backtrace(), "DEBUG", "Alt auth login", "User xtnd update: " . print_r($xFields, TRUE), FALSE, LOG_TO_ROLLING);
}
$aa_sql->db_Update('user_extended', $xArray);
} else {
// Never been an extended user fields record for this user
$xArray['data']['user_extended_id'] = $row['user_id'];
$ue->addDefaultFields($xArray);
// Add in the data types for storage, plus any default values
if (AA_DEBUG) {
$this->e107->admin_log->e_log_event(10, debug_backtrace(), "DEBUG", "Alt auth login", "Write new extended record" . print_r($xFields, TRUE), FALSE, LOG_TO_ROLLING);
}
$aa_sql->db_Insert('user_extended', $xArray);
}
}
} else {
// Just add a new user
if (AA_DEBUG) {
$this->e107->admin_log->e_log_event(10, debug_backtrace(), "DEBUG", "Alt auth login", "Add new user: " . print_r($db_vals, TRUE) . "[!br!]" . print_r($xFields, TRUE), FALSE, LOG_TO_ROLLING);
}
if (!isset($db_vals['user_name'])) {
$db_vals['user_name'] = $username;
}
if (!isset($db_vals['user_loginname'])) {
$db_vals['user_loginname'] = $username;
}
if (!isset($db_vals['user_join'])) {
$db_vals['user_join'] = time();
}
$db_vals['user_class'] = e107::getPref('initial_user_classes');
if (!isset($db_vals['user_signature'])) {
$db_vals['user_signature'] = '';
}
if (!isset($db_vals['user_prefs'])) {
$db_vals['user_prefs'] = '';
}
if (!isset($db_vals['user_perms'])) {
$db_vals['user_perms'] = '';
}
$userMethods->userClassUpdate($db_vals, 'userall');
$newUser = array();
$newUser['data'] = $db_vals;
$userMethods->addNonDefaulted($newUser);
validatorClass::addFieldTypes($userMethods->userVettingInfo, $newUser);
$newID = $aa_sql->insert('user', $newUser);
if ($newID !== FALSE) {
if (count($xFields)) {
$xFields['user_extended_id'] = $newID;
$xArray = array();
$xArray['data'] = $xFields;
e107::getUserExt()->addDefaultFields($xArray);
// Add in the data types for storage, plus any default values
$result = $aa_sql->insert('user_extended', $xArray);
if (AA_DEBUG) {
e107::getLog()->e_log_event(10, debug_backtrace(), 'DEBUG', 'Alt auth login', "Add extended: UID={$newID} result={$result}", FALSE, LOG_TO_ROLLING);
}
}
} else {
// Error adding user to database - possibly a conflict on unique fields
$this->e107->admin_log->e_log_event(10, __FILE__ . '|' . __FUNCTION__ . '@' . __LINE__, 'ALT_AUTH', 'Alt auth login', 'Add user fail: DB Error ' . $aa_sql->getLastErrorText() . "[!br!]" . print_r($db_vals, TRUE), FALSE, LOG_TO_ROLLING);
$this->loginResult = LOGIN_DB_ERROR;
return;
}
}
$this->loginResult = LOGIN_CONTINUE;
return;
} else {
// Failure modes
switch ($login_result) {
case AUTH_NOCONNECT:
if (varset(e107::getPref('auth_noconn'), TRUE)) {
$this->loginResult = LOGIN_TRY_OTHER;
return;
}
$username = md5('xx_noconn_xx');
$this->loginResult = LOGIN_ABORT;
return;
case AUTH_BADPASSWORD:
if (varset(e107::getPref('auth_badpassword'), TRUE)) {
$this->loginResult = LOGIN_TRY_OTHER;
return;
}
$userpass = md5('xx_badpassword_xx');
$this->loginResult = LOGIN_ABORT;
// Not going to magically be able to log in!
return;
}
}
$this->loginResult = LOGIN_ABORT;
// catch-all just in case
return;
}