本文整理汇总了PHP中e107::user方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::user方法的具体用法?PHP e107::user怎么用?PHP e107::user使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::user方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nodejs_forum_event_user_forum_post_created_callback
/**
* Event callback after triggering "user_forum_post_created".
*
* @param array $info
* Details about forum post.
*/
function nodejs_forum_event_user_forum_post_created_callback($info)
{
$postID = intval(vartrue($info['data']['post_id'], 0));
$postUserID = intval(vartrue($info['data']['post_user'], 0));
$postThreadID = intval(vartrue($info['data']['post_thread'], 0));
if ($postID === 0 || $postThreadID === 0) {
return;
}
// Get forum plugin preferences.
$plugForumPrefs = e107::getPlugConfig('forum')->getPref();
$db = e107::getDb();
// Load thread.
$thread = $db->retrieve('forum_thread', '*', 'thread_id = ' . $postThreadID);
$threadUser = intval(vartrue($thread['thread_user'], 0));
// Load forum to check (read) permission.
$forum = $db->retrieve('forum', '*', 'forum_id = ' . intval(vartrue($thread['thread_forum_id'], 0)));
// Author of the forum post.
$authorPost = e107::user($postUserID);
// Author of the forum topic.
$authorThread = e107::user($threadUser);
e107_require_once(e_PLUGIN . 'nodejs/nodejs.main.php');
$template = e107::getTemplate('nodejs_forum');
$sc = e107::getScBatch('nodejs_forum', true);
$tp = e107::getParser();
// Get topic page number.
$postNum = $db->count('forum_post', '(*)', "WHERE post_id <= " . $postID . " AND post_thread = " . $postThreadID . " ORDER BY post_id ASC");
$postPage = ceil($postNum / vartrue($plugForumPrefs['postspage'], 10));
// Push rendered row item into Latest Forum Posts menu.
$sc_vars = array('author' => $authorPost, 'post' => $info['data'], 'thread' => $thread, 'topicPage' => $postPage);
$sc->setVars($sc_vars);
$markup = $tp->parseTemplate($template['MENU']['RECENT']['ITEM'], true, $sc);
$message = (object) array('broadcast' => true, 'channel' => 'nodejs_notify', 'callback' => 'nodejsForumMenu', 'type' => 'latestForumPosts', 'markup' => $markup);
nodejs_enqueue_message($message);
// Broadcast logged in users to inform about new forum post created.
if ($authorPost) {
$sc->setVars($sc_vars);
$markup = $tp->parseTemplate($template['NOTIFICATION']['POST_ALL'], true, $sc);
// It's a public forum, so broadcast every online user.
if (intval(vartrue($forum['forum_class'], 0)) === 0) {
$message = (object) array('broadcast' => true, 'channel' => 'nodejs_notify', 'callback' => 'nodejsForum', 'type' => 'newForumPostAny', 'markup' => $markup, 'exclude' => $postUserID);
nodejs_enqueue_message($message);
} else {
$forumClass = vartrue($forum['forum_class'], 0);
$db->select('nodejs_presence');
while ($row = $db->fetch()) {
if (isset($row['uid']) && check_class($forumClass, null, $row['uid'])) {
$message = (object) array('channel' => 'nodejs_user_' . $row['uid'], 'callback' => 'nodejsForum', 'type' => 'newForumPostAny', 'markup' => $markup, 'exclude' => $postUserID);
nodejs_enqueue_message($message);
}
}
}
}
// Broadcast logged in (thread-author) user to inform about new forum post created in his/her topic.
if (isset($authorThread['user_id'])) {
$sc->setVars($sc_vars);
$markup = $tp->parseTemplate($template['NOTIFICATION']['POST_OWN'], true, $sc);
$message = (object) array('channel' => 'nodejs_user_' . $authorThread['user_id'], 'callback' => 'nodejsForum', 'type' => 'newForumPostOwn', 'markup' => $markup, 'exclude' => $postUserID);
nodejs_enqueue_message($message);
}
}
示例2: user_avatar_shortcode
function user_avatar_shortcode($parm = null)
{
global $loop_uid;
$tp = e107::getParser();
$width = $tp->thumbWidth;
$height = $tp->thumbHeight !== 0 ? $tp->thumbHeight : "";
if (intval($loop_uid) > 0 && trim($parm) == "") {
$parm = $loop_uid;
}
if (is_numeric($parm)) {
if ($parm == USERID) {
$image = USERIMAGE;
} else {
$row = e107::user($parm);
$image = $row['user_image'];
}
} elseif (!empty($parm)) {
$image = $parm;
} elseif (USERIMAGE) {
$image = USERIMAGE;
} else {
$image = "";
}
$genericImg = $tp->thumbUrl(e_IMAGE . "generic/blank_avatar.jpg", "w=" . $width . "&h=" . $height, true);
if (vartrue($image)) {
if (strpos($image, "://") !== false) {
$img = $image;
//$height = e107::getPref("im_height",100); // these prefs are too limiting for local images.
//$width = e107::getPref("im_width",100);
} elseif (substr($image, 0, 8) == "-upload-") {
$image = substr($image, 8);
// strip the -upload- from the beginning.
if (file_exists(e_AVATAR_UPLOAD . $image)) {
$img = $tp->thumbUrl(e_AVATAR_UPLOAD . $image, "w=" . $width . "&h=" . $height);
} else {
$img = $genericImg;
}
} elseif (file_exists(e_AVATAR_DEFAULT . $image)) {
$img = $tp->thumbUrl(e_AVATAR_DEFAULT . $image, "w=" . $width . "&h=" . $height);
} else {
$img = $genericImg;
}
} else {
$img = $genericImg;
}
$title = ADMIN ? $image : "";
$text = "<img class='img-rounded user-avatar e-tip' title='" . $title . "' src='" . $img . "' alt='' style='width:" . $width . "px; height:" . $height . "px' />";
// return $img;
return $text;
}
示例3: nodejs_comment_event_postcomment_callback
/**
* Event callback after triggering "postcomment".
*
* @param array $comment
* Comment item.
*
* $comment contains:
* - comment_pid
* - comment_item_id
* - comment_subject
* - comment_author_id
* - comment_author_name
* - comment_author_email
* - comment_datestamp
* - comment_comment
* - comment_blocked
* - comment_ip
* - comment_type
* - comment_lock
* - comment_share
* - comment_nick
* - comment_time
* - comment_id
*
* getCommentData() returns with array, which contains:
* - comment_datestamp
* - comment_author_id
* - comment_author
* - comment_comment
* - comment_subject
* - comment_type
* - comment_title
* - comment_url
*/
function nodejs_comment_event_postcomment_callback($comment)
{
e107_require_once(e_PLUGIN . 'nodejs/nodejs.main.php');
$tpl = e107::getTemplate('nodejs_comment');
$sc = e107::getScBatch('nodejs_comment', true);
$tp = e107::getParser();
$cm = e107::getComment();
$cid = (int) vartrue($comment['comment_id'], 0);
$pid = (int) vartrue($comment['comment_pid'], 0);
$uid = (int) vartrue($comment['comment_author_id'], 0);
$commentData = $cm->getCommentData(1, 0, 'comment_id=' . $cid);
if (!isset($commentData[0])) {
return;
}
$authorData = e107::user($uid);
// Send notification to everyone for updating latest comments menu.
$sc->setVars($commentData[0]);
$markup = $tp->parseTemplate($tpl['MENU']['LATEST']['ITEM'], true, $sc);
$message = (object) array('broadcast' => true, 'channel' => 'nodejs_notify', 'callback' => 'nodejsCommentMenu', 'type' => 'latestComments', 'markup' => $markup);
nodejs_enqueue_message($message);
// Send notification to everyone for notifying about new comment.
$sc->setVars(array('account' => $authorData, 'comment' => $commentData[0]));
$markup = $tp->parseTemplate($tpl['NOTIFICATION']['POST_ALL'], true, $sc);
$message = (object) array('broadcast' => true, 'channel' => 'nodejs_notify', 'callback' => 'nodejsComments', 'type' => 'newCommentAny', 'markup' => $markup, 'exclude' => $authorData['user_id']);
nodejs_enqueue_message($message);
// Reply on comment.
if ($pid > 0) {
$commentParentData = $cm->getCommentData(1, 0, 'comment_id=' . $pid);
array_pop($commentParentData);
$authorParentData = e107::user();
// Send notification to author of parent comment for notifying about new reply.
$sc->setVars(array('account' => $authorData, 'comment' => $commentData[0]));
$markup = $tp->parseTemplate($tpl['NOTIFICATION']['POST_OWN'], true, $sc);
$message = (object) array('channel' => 'nodejs_user_' . $authorParentData['user_id'], 'callback' => 'nodejsComments', 'type' => 'newCommentOwn', 'markup' => $markup, 'exclude' => $authorData['user_id']);
nodejs_enqueue_message($message);
}
}
示例4: user_extended_getvalue
/**
* Retrieve the value of an extended field
*
* $ue = new e107_user_extended;
* $value = $ue->user_extended_getvalue(2, 'location');
*
*/
function user_extended_getvalue($uid, $field_name, $ifnotset = false)
{
$uid = intval($uid);
if (substr($field_name, 0, 5) != 'user_') {
$field_name = 'user_' . $field_name;
}
$uinfo = e107::user($uid);
if (!isset($uinfo[$field_name])) {
return $ifnotset;
}
return $uinfo[$field_name];
}
示例5: renderValue
//.........这里部分代码省略.........
$thparms['aw'] = intval($parms['thumb_aw']);
}
// return print_a($thparms,true);
$src = $tp->replaceConstants(vartrue($parms['pre']) . $value, 'abs');
$thsrc = $tp->thumbUrl(vartrue($parms['pre']) . $value, $thparms, varset($parms['thumb_urlraw']));
$alt = basename($src);
$ttl = '<img src="' . $thsrc . '" alt="' . $alt . '" class="thumbnail e-thumb" />';
$value = '<a href="' . $src . '" data-modal-caption="' . $alt . '" data-target="#uiModal" class="e-modal e-image-preview" title="' . $alt . '" rel="external">' . $ttl . '</a>';
} else {
$src = $tp->replaceConstants(vartrue($parms['pre']) . $value, 'abs');
$alt = $src;
//basename($value);
$ttl = vartrue($parms['title'], 'LAN_PREVIEW');
$value = '<a href="' . $src . '" class="e-image-preview" title="' . $alt . '" rel="external">' . defset($ttl, $ttl) . '</a>';
}
}
break;
case 'files':
$ret = '<ol>';
for ($i = 0; $i < 5; $i++) {
$k = $key . '[' . $i . '][path]';
$ival = $value[$i]['path'];
$ret .= '<li>' . $ival . '</li>';
}
$ret .= '</ol>';
$value = $ret;
break;
case 'datestamp':
$value = $value ? e107::getDate()->convert_date($value, vartrue($parms['mask'], 'short')) : '';
break;
case 'date':
// just show original value
break;
case 'userclass':
$dispvalue = $this->_uc->uc_get_classname($value);
// Inline Editing.
if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
$mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], ''));
$uc_options = vartrue($parms['classlist'], 'public,guest,nobody,member,admin,main,classes');
// defaults to 'public,guest,nobody,member,classes' (userclass handler)
unset($parms['classlist']);
$array = e107::getUserClass()->uc_required_class_list($uc_options);
//XXX Ugly looking (non-standard) function naming - TODO discuss name change.
$source = str_replace('"', "'", json_encode($array, JSON_FORCE_OBJECT));
//NOTE Leading ',' required on $value; so it picks up existing value.
$value = "<a class='e-tip e-editable editable-click' data-placement='left' data-value='" . $value . "' data-name='" . $field . "' data-source=\"" . $source . "\" title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='select' data-pk='" . $id . "' data-url='" . e_SELF . "?mode={$mode}&action=inline&id={$id}&ajax_used=1' href='#'>" . $dispvalue . "</a>";
} else {
$value = $dispvalue;
}
break;
case 'userclasses':
// return $value;
$classes = explode(',', $value);
$uv = array();
foreach ($classes as $cid) {
if (!empty($parms['defaultLabel']) && $cid === '') {
$uv[] = $parms['defaultLabel'];
continue;
}
$uv[] = $this->_uc->getName($cid);
}
$dispvalue = implode(vartrue($parms['separator'], "<br />"), $uv);
// Inline Editing.
if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
$uc_options = vartrue($parms['classlist'], 'public,guest, nobody,member,admin,main,classes');
// defaults to 'public,guest,nobody,member,classes' (userclass handler)
示例6:
exit;
}
$adminEdit = TRUE;
// Flag to indicate admin edit
} else {
//Non admin attempting to edit another user's ID
e107::redirect();
exit;
}
}
require_once HEADERF;
// Save user settings (changes only)
//-----------------------------------
if (isset($_POST['updatesettings']) || isset($_POST['SaveValidatedInfo'])) {
// $udata = e107::user($inp); //@deprecated // Get all the existing user data, including any extended fields
$udata = e107::user($inp);
// Get all the existing user data, including any extended fields
$udata['user_classlist'] = $userMethods->addCommonClasses($udata, FALSE);
}
if (isset($_POST['updatesettings'])) {
if (!vartrue($pref['auth_method'])) {
$pref['auth_method'] = 'e107';
}
if ($pref['auth_method'] != 'e107') {
$_POST['password1'] = '';
$_POST['password2'] = '';
}
// Uploaded avatar and/or photo
if ($file_userfile['error'] != 4) {
require_once e_HANDLER . 'upload_handler.php';
require_once e_HANDLER . 'resize_handler.php';
示例7: renderuser
function renderuser($uid, $mode = "verbose")
{
global $pref, $sc_style, $user_shortcodes;
global $EXTENDED_START, $EXTENDED_TABLE, $EXTENDED_END, $USER_SHORT_TEMPLATE, $USER_FULL_TEMPLATE, $USER_TEMPLATE;
global $user;
$tp = e107::getParser();
if (is_array($uid)) {
$user = $uid;
} else {
if (!($user = e107::user($uid))) {
return FALSE;
}
}
e107::getScBatch('user')->setVars($user);
if ($mode == 'verbose') {
return $tp->parseTemplate($USER_FULL_TEMPLATE, TRUE, $user_shortcodes);
} else {
return $tp->parseTemplate($USER_SHORT_TEMPLATE, TRUE, $user_shortcodes);
}
}
示例8: 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
//.........这里部分代码省略.........
示例9: ListUnbanTrigger
/**
* Unban user trigger
* @param int $userid
* @return void
*/
public function ListUnbanTrigger($userid)
{
$sql = e107::getDb();
$sysuser = e107::getSystemUser($userid, false);
if (!$sysuser->getId()) {
e107::getMessage()->addError(USRLAN_223);
return;
}
$row = e107::user($userid);
$sql->update("user", "user_ban='0' WHERE user_id='" . $userid . "' ");
$sql->delete("banlist", " banlist_ip='{$row['user_ip']}' ");
e107::getAdminLog()->log_event('USET_06', str_replace(array('--UID--', '--NAME--', '--EMAIL--'), array($sysuser->getId(), $sysuser->getName(), $sysuser->getValue('email')), USRLAN_162), E_LOG_INFORMATIVE);
e107::getMessage()->addSuccess("(" . $sysuser->getId() . "." . $sysuser->getName() . " - " . $sysuser->getValue('email') . ") " . USRLAN_9);
// List data reload
$this->getTreeModel()->load(true);
}
示例10: class_list
function class_list($uid = '')
{
$clist = array();
if (is_numeric($uid) || USER === true) {
if (is_numeric($uid)) {
if ($ud = e107::user($uid)) {
$admin_status = $ud['user_admin'];
$class_list = $ud['user_class'];
$admin_perms = $ud['user_perms'];
} else {
$admin_status = false;
$class_list = "";
$admin_perms = "";
}
} else {
$admin_status = ADMIN;
$class_list = USERCLASS;
$admin_perms = ADMINPERMS;
}
if ($class_list) {
$clist = explode(',', $class_list);
}
$clist[] = e_UC_MEMBER;
if ($admin_status == true) {
$clist[] = e_UC_ADMIN;
}
if ($admin_perms === '0') {
$clist[] = e_UC_MAINADMIN;
}
} else {
$clist[] = e_UC_GUEST;
}
$clist[] = e_UC_READONLY;
$clist[] = e_UC_PUBLIC;
return implode(',', $clist);
}
示例11: sc_anteup_donation_donator
function sc_anteup_donation_donator($parm = '')
{
$userInfo = e107::user($this->var['user_id']);
return $userInfo['user_name'];
}
示例12: sc_latest_comment_author
/**
* Comment author.
*/
function sc_latest_comment_author()
{
$user = e107::user($this->var['comment_author_id']);
// return vartrue($user['user_login'], $user['user_name']);
return $user['user_name'];
}
示例13: threadGetUserViewed
function threadGetUserViewed($uid = USERID)
{
$e107 = e107::getInstance();
if ($uid == USERID) {
$viewed = $e107->currentUser['user_plugin_forum_viewed'];
} else {
$tmp = e107::user($uid);
$viewed = $tmp['user_plugin_forum_viewed'];
unset($tmp);
}
return explode(',', $viewed);
}