本文整理汇总了PHP中e107::getSystemUser方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::getSystemUser方法的具体用法?PHP e107::getSystemUser怎么用?PHP e107::getSystemUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::getSystemUser方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unsubscribe
/**
* @param $mode - check || process
* @param array $data - usually email, date, id - but dependent on unsubscribe link above.
*/
function unsubscribe($mode, $data = null)
{
if ($mode == 'check') {
$ucl = intval($data['userclass']);
return e107::getDb()->select('user', '*', 'FIND_IN_SET(' . $ucl . ',user_class) AND user_id=' . intval($data['id']) . " AND user_join=" . intval($data['date']) . " AND user_email=\"" . $data['email'] . "\"");
}
// print_a($data);
if ($mode == 'process') {
$uid = intval($data['id']);
$ucl = intval($data['userclass']);
return e107::getSystemUser($uid)->removeClass($ucl);
// best way to remove userclass from user.
}
}
示例2: updatePerms
/**
* Update user (admin) permissions.
* NOTE: exit if $uid is not an integer or is 0.
*
* @param integer $uid
* @param array $permArray eg. array('A', 'K', '1');
* @return void
*/
function updatePerms($uid, $permArray)
{
global $admin_log;
$sql = e107::getDb();
$tp = e107::getParser();
$modID = intval($uid);
$mes = e107::getMessage();
if ($modID == 0) {
$mes->addError("Malfunction at line " . __LINE__ . " of user_handler.php");
return;
}
$sysuser = e107::getSystemUser($modID, false);
$row = $sysuser->getData();
$a_name = $row['user_name'];
$perm = "";
foreach ($permArray as $value) {
$value = $tp->toDB($value);
if ($value == "0") {
if (!getperms('0')) {
$value = "";
break;
}
$perm = "0";
break;
}
if ($value) {
$perm .= $value . ".";
}
}
//$sql->db_Update("user", "user_perms='{$perm}' WHERE user_id='{$modID}' ")
if (!$sysuser->isAdmin()) {
$sysuser->set('user_admin', 1)->save();
$lan = str_replace(array('--UID--', '--NAME--', '--EMAIL--'), array($sysuser->getId(), $sysuser->getName(), $sysuser->getValue('email')), USRLAN_164);
e107::getLog()->add('USET_08', $lan, E_LOG_INFORMATIVE);
}
e107::getMessage()->addAuto($sysuser->set('user_perms', $perm)->save(), 'update', sprintf(LAN_UPDATED, $tp->toDB($_POST['ad_name'])), false, false);
$logMsg = str_replace(array('--ID--', '--NAME--'), array($modID, $a_name), ADMSLAN_72) . $perm;
e107::getLog()->add('ADMIN_01', $logMsg, E_LOG_INFORMATIVE, '');
}
示例3: renderElement
//.........这里部分代码省略.........
unset($parms['classlist']);
// $method = ($attributes['type'] == 'userclass') ? 'uc_select' : 'uc_select';
if (vartrue($attributes['type']) == 'userclasses') {
$parms['multiple'] = true;
}
$ret = vartrue($parms['pre']) . $this->uc_select($key, $value, $uc_options, vartrue($parms, array())) . vartrue($parms['post']);
break;
/*case 'user_name':
case 'user_loginname':
case 'user_login':
case 'user_customtitle':
case 'user_email':*/
/*case 'user_name':
case 'user_loginname':
case 'user_login':
case 'user_customtitle':
case 'user_email':*/
case 'user':
//user_id expected
// Just temporary solution, could be changed soon
if (!isset($parms['__options'])) {
$parms['__options'] = array();
}
if (!is_array($parms['__options'])) {
parse_str($parms['__options'], $parms['__options']);
}
if (empty($value) && varset($parms['currentInit'], USERID) !== 0 || vartrue($parms['current'])) {
$value = USERID;
if (vartrue($parms['current'])) {
$parms['__options']['readonly'] = true;
}
}
if (!is_array($value)) {
$value = $value ? e107::getSystemUser($value, true)->getUserData() : array();
// e107::user($value);
}
$colname = vartrue($parms['nameType'], 'user_name');
$parms['__options']['name'] = $colname;
if (!$value) {
$value = array();
}
$uname = varset($value[$colname]);
$value = varset($value['user_id'], 0);
$ret = $this->userpicker(vartrue($parms['nameField'], $key), $key, $uname, $value, vartrue($parms['__options']));
break;
case 'bool':
case 'boolean':
if (varset($parms['label']) === 'yesno') {
$lenabled = 'LAN_YES';
$ldisabled = 'LAN_NO';
} else {
$lenabled = vartrue($parms['enabled'], 'LAN_ENABLED');
$ldisabled = vartrue($parms['disabled'], 'LAN_DISABLED');
}
unset($parms['enabled'], $parms['disabled'], $parms['label']);
$ret = vartrue($parms['pre']) . $this->radio_switch($key, $value, defset($lenabled, $lenabled), defset($ldisabled, $ldisabled), $parms) . vartrue($parms['post']);
break;
case "checkbox":
$value = isset($parms['value']) ? $parms['value'] : $value;
$ret = vartrue($parms['pre']) . $this->checkbox($key, 1, $value, $parms) . vartrue($parms['post']);
break;
case 'method':
// Custom Function
$meth = !empty($attributes['method']) ? $attributes['method'] : $key;
$parms['field'] = $key;
$ret = call_user_func_array(array($this, $meth), array($value, 'write', $parms));
示例4: define
if (!defined('e107_INIT')) {
exit;
}
/* done in class2
@include_once(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_admin.php");
@include_once(e_LANGUAGEDIR."English/admin/lan_admin.php");
*/
if (ADMIN) {
define('ADMIN_PAGE', true);
//don't include it if it'a an AJAX call or not wanted
if (!e_AJAX_REQUEST && !defset('e_NOHEADER')) {
// XXX LOGIN AS Temporary solution, we need something smarter, e.g. reserved message stack 'admin' which will be always printed
// inside admin area
if (e107::getUser()->getSessionDataAs()) {
// TODO - lan
$asuser = e107::getSystemUser(e107::getUser()->getSessionDataAs(), false);
e107::getMessage()->addInfo('Successfully logged in as ' . ($asuser && $asuser->getValue('name') ? $asuser->getValue('name') : 'unknown') . ' <a href="' . e_ADMIN_ABS . 'users.php?logoutas">[logout]</a>');
}
// NEW, legacy 3rd party code fix, header called inside the footer o.O
if (deftrue('e_ADMIN_UI')) {
// boot.php already loaded
require_once e_ADMIN . "header.php";
} else {
// boot.php is included in admin dispatcher constructor, so do it only for legacy code
require_once e_ADMIN . 'boot.php';
}
}
/*
* FIXME - missing $style for tablerender
* The Solution: parse_admin() without sending it to the browser if it's an ajax call
* The Problem: doubled render time for the ajax called page!!!
示例5: move2download
protected function move2download($upload)
{
if (!$upload['upload_active']) {
return 0;
}
$media = e107::getMedia();
$uploadPath = e_UPLOAD;
if (!file_exists($uploadPath . $upload['upload_file'])) {
$this->getModel()->addValidationError(LAN_FILE_NOT_FOUND);
return false;
}
$downloadPath = $media->importFile($upload['upload_file'], 'download_file', $uploadPath . $upload['upload_file'], array('media_caption' => $upload['upload_name']));
if (false === $downloadPath) {
$this->getModel()->addValidationError(UPLLAN_66);
return false;
}
$imagePath = null;
if ($upload['upload_ss'] && file_exists($uploadPath . $upload['upload_ss'])) {
$imagePath = $media->importFile($upload['upload_ss'], '_common_image', $uploadPath . $upload['upload_ss'], array('media_caption' => $upload['upload_name'] . ' ' . LAN_PREVIEW));
}
$author = $upload['upload_poster'] ? e107::getSystemUser($upload['upload_poster'])->getRealName() : LAN_ANONYMOUS;
$dl = array('download_name' => $upload['upload_name'], 'download_url' => $downloadPath, 'download_sef' => eHelper::title2sef($upload['upload_name']), 'download_author' => $author, 'download_author_email' => $upload['upload_email'], 'download_author_website' => $upload['upload_website'], 'download_description' => $upload['upload_description'], 'download_keywords' => null, 'download_filesize' => $upload['upload_filesize'], 'download_requested' => 0, 'download_category' => $upload['upload_category'], 'download_active' => 1, 'download_datestamp' => $upload['upload_datestamp'], 'download_thumb' => null, 'download_image' => $imagePath, 'download_comment' => 1, 'download_class' => e_UC_MEMBER, 'download_visible' => e_UC_MEMBER, 'download_mirror' => null, 'download_mirror_type' => 0);
$sql = e107::getDb('activate');
$id = $sql->insert('download', $dl);
if (!$id) {
$this->getModel()->addValidationError(UPLLAN_68 . ' #' . $sql->getLastErrorNumber() . ' ' . $sql->getLastErrorText());
e107::getMessage()->addDebug($sql->getLastQuery());
return;
}
return $id;
}
示例6: signup
public function signup($redirectUrl = true, $loginAfterSuccess = true, $emailAfterSuccess = true)
{
if (!e107::getPref('social_login_active', false)) {
throw new Exception("Signup failed! This feature is disabled.", 100);
// TODO lan
}
if (!$this->getProvider()) {
throw new Exception("Signup failed! Wrong provider.", 2);
// TODO lan
}
if ($redirectUrl) {
if (true === $redirectUrl) {
$redirectUrl = SITEURL;
} elseif (strpos($redirectUrl, 'http://') !== 0 && strpos($redirectUrl, 'https://') !== 0) {
$redirectUrl = e107::getUrl()->create($redirectUrl);
}
}
if (e107::getUser()->isUser()) {
throw new Exception("Signup failed! User already signed in. ", 1);
// TODO lan
}
$this->adapter = $this->hybridauth->authenticate($this->getProvider());
$profile = $this->adapter->getUserProfile();
// returned back, if success...
if ($profile->identifier) {
$sql = e107::getDb();
$userMethods = e107::getUserSession();
$plainPwd = $userMethods->generateRandomString('************');
// auto plain passwords
// TODO - auto login name, shouldn't be used if system set to user_email login...
$userdata['user_loginname'] = $this->getProvider() . $userMethods->generateUserLogin(e107::getPref('predefinedLoginName', '_..#..#..#'));
$userdata['user_email'] = $sql->escape($profile->emailVerified ? $profile->emailVerified : $profile->email);
$userdata['user_name'] = $sql->escape($profile->displayName);
$userdata['user_login'] = $userdata['user_name'];
$userdata['user_customtitle'] = '';
// not used
$userdata['user_password'] = $userMethods->HashPassword($plainPwd, $userdata['user_loginname']);
// pwd
$userdata['user_sess'] = '';
//
$userdata['user_image'] = $profile->photoURL;
// avatar
$userdata['user_signature'] = '';
// not used
$userdata['user_hideemail'] = 1;
// hide it by default
$userdata['user_xup'] = $sql->escape($this->userId());
$userdata['user_class'] = '';
// TODO - check (with Steve) initial class for new users feature...
// user_name, user_xup, user_email and user_loginname shouldn't match
if ($sql->db_Count("user", "(*)", "user_xup='" . $sql->escape($this->userId()) . "' OR user_email='{$userdata['user_email']}' OR user_loginname='{$userdata['user_loginname']}' OR user_name='{$userdata['user_name']}'")) {
throw new Exception("Signup failed! User already exists. Please use 'login' instead.", 3);
// TODO lan
}
if (empty($userdata['user_email'])) {
throw new Exception("Signup failed! Can't access user email - registration without an email is impossible.", 4);
// TODO lan
}
// other fields
$now = time();
$userdata['user_id'] = null;
$userdata['user_join'] = $now;
$userdata['user_lastvisit'] = 0;
$userdata['user_currentvisit'] = 0;
$userdata['user_comments'] = 0;
$userdata['user_ip'] = e107::getIPHandler()->getIP(FALSE);
$userdata['user_ban'] = USER_VALIDATED;
$userdata['user_prefs'] = '';
$userdata['user_visits'] = 0;
$userdata['user_admin'] = 0;
$userdata['user_perms'] = '';
$userdata['user_realm'] = '';
$userdata['user_pwchange'] = $now;
$user = e107::getSystemUser(0, false);
$user->setData($userdata);
$user->getExtendedModel();
// init
//$user->setEditor(e107::getSystemUser(1, false));
$user->save(true);
// user model error
if ($user->hasError()) {
throw new Exception($user->renderMessages(), 5);
}
### Successful signup!
// FIXME documentation of new signup trigger - usersupprov
//$user->set('provider', $this->getProvider());
$userdata = $user->getData();
$userdata['provider'] = $this->getProvider();
$ret = e107::getEvent()->trigger('usersupprov', $userdata);
// XXX - it's time to pass objects instead of array?
if (true === $ret) {
return $this;
}
// send email
if ($emailAfterSuccess) {
$user->set('user_password', $plainPwd)->email('signup');
}
e107::getUser()->setProvider($this);
// auto login
if ($loginAfterSuccess) {
//.........这里部分代码省略.........
示例7: render_email
/**
* Create email to send to user who just registered.
* @param array $userInfo is the array of user-related DB variables
* @return array of data for mailer - field names directly compatible
*/
function render_email($userInfo, $preview = FALSE)
{
if ($preview == TRUE) {
$userInfo['user_password'] = "test-password";
$userInfo['user_loginname'] = "test-loginname";
$userInfo['user_name'] = "test-username";
$userInfo['user_email'] = "test-username@email";
$userInfo['user_website'] = "www.test-site.com";
// This may not be defined
$userInfo['user_id'] = 0;
$userInfo['user_sess'] = "1234567890ABCDEFGHIJKLMNOP";
$userInfo['activation_url'] = 'http://whereever.to.activate.com/';
}
return e107::getSystemUser($userInfo['user_id'], false)->renderEmail('signup', $userInfo);
}
示例8: e107forum
require_once e_PLUGIN . 'forum/forum_class.php';
$forum = new e107forum();
$forumList = implode(',', $forum->getForumPermList('view'));
/*if(is_numeric($id))
{
$uinfo = e107::user($id);
$fcaption = UP_LAN_0.' '.$uinfo['user_name'];
}
else
{
$user_name = 0;
}*/
if ($id == e107::getUser()->getId()) {
$user_name = USERNAME;
} else {
$user_name = e107::getSystemUser($id, false)->getName(LAN_ANONYMOUS);
}
if (!$user_name) {
header("Location:" . SITEURL);
exit;
}
$fcaption = UP_LAN_0 . ' ' . $user_name;
/*
if (!$USERPOSTS_FORUM_TABLE)
{
if (file_exists(THEME.'userposts_template.php'))
{
require_once(THEME.'userposts_template.php');
}
else
{
示例9: AddSubmitTrigger
/**
* Quick Add user submit trigger
*/
public function AddSubmitTrigger()
{
$e107cache = e107::getCache();
$userMethods = e107::getUserSession();
$mes = e107::getMessage();
$sql = e107::getDb();
$e_event = e107::getEvent();
$admin_log = e107::getAdminLog();
if (!$_POST['ac'] == md5(ADMINPWCHANGE)) {
exit;
}
$e107cache->clear('online_menu_member_total');
$e107cache->clear('online_menu_member_newest');
$error = false;
if (isset($_POST['generateloginname'])) {
$_POST['loginname'] = $userMethods->generateUserLogin($pref['predefinedLoginName']);
}
$_POST['password2'] = $_POST['password1'] = $_POST['password'];
// Now validate everything
$allData = validatorClass::validateFields($_POST, $userMethods->userVettingInfo, true);
// Fix Display and user name
if (!check_class($pref['displayname_class'], $allData['data']['user_class'])) {
if ($allData['data']['user_name'] != $allData['data']['user_loginname']) {
$allData['data']['user_name'] = $allData['data']['user_loginname'];
$mes->addWarning(str_replace('[x]', $allData['data']['user_loginname'], USRLAN_237));
//$allData['errors']['user_name'] = ERR_FIELDS_DIFFERENT;
}
}
// Do basic validation
validatorClass::checkMandatory('user_name, user_loginname', $allData);
// Check for missing fields (email done in userValidation() )
validatorClass::dbValidateArray($allData, $userMethods->userVettingInfo, 'user', 0);
// Do basic DB-related checks
$userMethods->userValidation($allData);
// Do user-specific DB checks
if (!isset($allData['errors']['user_password'])) {
// No errors in password - keep it outside the main data array
$savePassword = $allData['data']['user_password'];
// Delete the password value in the output array
unset($allData['data']['user_password']);
}
// Restrict the scope of this
unset($_POST['password2'], $_POST['password1']);
if (count($allData['errors'])) {
$temp = validatorClass::makeErrorList($allData, 'USER_ERR_', '%n - %x - %t: %v', '<br />', $userMethods->userVettingInfo);
$mes->addError($temp);
$error = true;
}
// Always save some of the entered data - then we can redisplay on error
$user_data =& $allData['data'];
if ($error) {
$this->setParam('user_data', $user_data);
return;
}
if (varset($_POST['perms'])) {
$allData['data']['user_admin'] = 1;
$allData['data']['user_perms'] = implode('.', $_POST['perms']);
}
$user_data['user_password'] = $userMethods->HashPassword($savePassword, $user_data['user_login']);
$user_data['user_join'] = time();
if ($userMethods->needEmailPassword()) {
// Save separate password encryption for use with email address
$user_prefs = e107::getArrayStorage()->unserialize($user_data['user_prefs']);
$user_prefs['email_password'] = $userMethods->HashPassword($savePassword, $user_data['user_email']);
$user_data['user_prefs'] = e107::getArrayStorage()->serialize($user_prefs);
unset($user_prefs);
}
$userMethods->userClassUpdate($allData['data'], 'userall');
//FIXME - (SecretR) there is a better way to fix this (missing default value, sql error in strict mode - user_realm is to be deleted from DB later)
$allData['data']['user_realm'] = '';
// Set any initial classes
$userMethods->addNonDefaulted($user_data);
validatorClass::addFieldTypes($userMethods->userVettingInfo, $allData);
$userid = $sql->insert('user', $allData);
if ($userid) {
$sysuser = e107::getSystemUser(false, false);
$sysuser->setData($allData['data']);
$sysuser->setId($userid);
$user_data['user_id'] = $userid;
// Add to admin log
e107::getLog()->add('USET_02', "UName: {$user_data['user_name']}; Email: {$user_data['user_email']}", E_LOG_INFORMATIVE);
// Add to user audit trail
e107::getLog()->user_audit(USER_AUDIT_ADD_ADMIN, $user_data, 0, $user_data['user_loginname']);
e107::getEvent()->trigger('userfull', $user_data);
e107::getEvent()->trigger('admin_user_created', $user_data);
// send everything available for user data - bit sparse compared with user-generated signup
if (isset($_POST['sendconfemail'])) {
$check = false;
// Send confirmation email to user
switch ((int) $_POST['sendconfemail']) {
case 0:
// activate, don't notify
$check = -1;
break;
case 1:
// activate and send password
$check = $sysuser->email('quickadd', array('user_password' => $savePassword, 'mail_subject' => USRLAN_187 . SITENAME, 'activation_url' => USRLAN_238));
//.........这里部分代码省略.........
示例10: get_user_data
/**
* @deprecated
* Get the user data from user and user_extended tables
* SO MUCH DEPRECATED! Use e107::user($uid);
* @return array
*/
function get_user_data($uid, $extra = '')
{
if (e107::getPref('developer')) {
e107::getAdminLog()->log_event('Deprecated call - get_user_data()', 'Call to deprecated function get_user_data() (class2.php) ' . "\n" . print_r(debug_backtrace(null, 2), true), E_LOG_INFORMATIVE, 'DEPRECATED');
// TODO - debug screen Deprecated Functions (e107)
e107::getMessage()->addDebug('Deprecated get_user_data() backtrace:<pre>' . "\n" . print_r(debug_backtrace(null, 2), true) . '</pre>');
}
$var = array();
$user = e107::getSystemUser($uid, true);
if ($user) {
$var = $user->getUserData();
}
return $var;
}
示例11: getRanks
function getRanks($userId, $moderator = false)
{
$e107 = e107::getInstance();
if (!$userId && USER) {
$userId = USERID;
}
if (isset($this->userRanks[$userId])) {
return $this->userRanks[$userId];
}
$ret = array();
if (is_array($userId)) {
$userData = $userId;
$userId = $userData['user_id'];
} else {
$userData = e107::getSystemUser($userId)->getData();
//get_user_data($userId);
}
if ($userData['user_admin']) {
if ($userData['user_perms'] == '0') {
//Main Site Admin
$data['special'] = "<img src='" . $this->_getImage($this->ranks['special'][1]) . "' alt='" . $this->_getName($this->ranks['special'][1]) . "' title='" . $this->_getName($this->ranks['special'][1]) . "' />";
} else {
//Site Admin
$data['special'] = "<img src='" . $this->_getImage($this->ranks['special'][2]) . "' alt='" . $this->_getName($this->ranks['special'][2]) . "' title='" . $this->_getName($this->ranks['special'][2]) . "' />";
}
} elseif ($moderator) {
$data['special'] = "<img src='" . $this->_getImage($this->ranks['special'][3]) . "' alt='" . $this->_getName($this->ranks['special'][3]) . "' title='" . $this->_getName($this->ranks['special'][3]) . "' />";
}
$userData['user_daysregged'] = max(1, round((time() - $userData['user_join']) / 86400));
$level = $this->_calcLevel($userData);
$lastRank = count($this->ranks['data']);
$rank = false;
if ($level <= $this->ranks['data'][0]['thresh']) {
$rank = 1;
} elseif ($level >= $this->ranks['data'][$lastRank]['thresh']) {
$rank = $lastRank;
} else {
for ($i = 0; $i < $lastRank; $i++) {
if ($level >= $this->ranks['data'][$i]['thresh'] && $level < $this->ranks['data'][$i + 1]['thresh']) {
$rank = $i + 1;
break;
}
}
}
if ($rank !== false) {
$data['name'] = $this->_getName($this->ranks['data'][$rank]);
$img_title = $this->ranks['data'][$rank]['name'] ? " alt='{$data['name']}' title='{$data['name']}'" : ' alt = ""';
$data['pic'] = "<img {$img_title} src='" . $this->_getImage($this->ranks['data'][$rank]) . "'{$img_title} />";
}
$this->userRanks[$userId] = $data;
return $data;
}
示例12: renderElement
//.........这里部分代码省略.........
case 'userclass':
case 'userclasses':
$uc_options = vartrue($parms['classlist'], 'public,guest,nobody,member,admin,main,classes');
// defaults to 'public,guest,nobody,member,classes' (userclass handler)
unset($parms['classlist']);
$method = $attributes['type'] == 'userclass' ? 'uc_select' : 'uc_select';
if ($atrributes['type'] == 'userclasses') {
$parms['multiple'] = true;
}
$ret = $this->{$method}($key, $value, $uc_options, vartrue($parms, array()));
break;
/*case 'user_name':
case 'user_loginname':
case 'user_login':
case 'user_customtitle':
case 'user_email':*/
/*case 'user_name':
case 'user_loginname':
case 'user_login':
case 'user_customtitle':
case 'user_email':*/
case 'user':
//user_id expected
// Just temporary solution, could be changed soon
if (!isset($parms['__options'])) {
$parms['__options'] = array();
}
if (!is_array($parms['__options'])) {
parse_str($parms['__options'], $parms['__options']);
}
if (empty($value) && vartrue($parms['currentInit']) || vartrue($parms['current'])) {
$value = USERID;
if (vartrue($parms['current'])) {
$parms['__options']['readonly'] = true;
}
}
if (!is_array($value)) {
$value = $value ? e107::getSystemUser($value, true)->getUserData() : array();
// get_user_data($value);
}
$colname = vartrue($parms['nameType'], 'user_name');
$parms['__options']['name'] = $colname;
if (!$value) {
$value = array();
}
$uname = varset($value[$colname]);
$value = varset($value['user_id'], 0);
$ret = $this->userpicker(vartrue($parms['nameField'], $key . '_usersearch'), $key, $uname, $value, vartrue($parms['__options']));
break;
case 'bool':
case 'boolean':
$lenabled = vartrue($parms['enabled'], 'LAN_ENABLED');
$ldisabled = vartrue($parms['disabled'], 'LAN_DISABLED');
unset($parms['enabled'], $parms['disabled']);
$ret = $this->radio_switch($key, $value, defset($lenabled, $lenabled), defset($ldisabled, $ldisabled), $parms);
break;
case 'method':
// Custom Function
$ret = call_user_func_array(array($this, $key), array($value, 'write', $parms));
break;
case 'upload':
//TODO - from method
// TODO uploadfile SC is now processing uploads as well (add it to admin UI), write/readParms have to be added (see uploadfile.php parms)
$disbut = varset($parms['disable_button'], '0');
$ret = $tp->parseTemplate("{UPLOADFILE=" . (vartrue($parms['path']) ? e107::getParser()->replaceConstants($parms['path']) : e_UPLOAD) . "|nowarn&trigger=etrigger_uploadfiles&disable_button={$disbut}}");
break;
case 'hidden':
$ret = vartrue($parms['show']) ? $value ? $value : varset($parms['empty'], $value) : '';
$value = vartrue($parms['value']) ? $parms['value'] : $value;
echo "key=" . $key . "<br />value=" . $value;
$ret = $ret . $this->hidden($key, $value);
break;
case 'lanlist':
case 'language':
$options = e107::getLanguage()->getLanSelectArray();
$eloptions = vartrue($parms['__options'], array());
if (!is_array($eloptions)) {
parse_str($eloptions, $eloptions);
}
unset($parms['__options']);
if (vartrue($eloptions['multiple']) && !is_array($value)) {
$value = explode(',', $value);
}
$ret = vartrue($eloptions['pre']) . $this->selectbox($key, $options, $value, $eloptions) . vartrue($eloptions['post']);
break;
default:
$ret = $value;
break;
}
if (vartrue($parms['expand'])) {
$k = "exp-" . $this->name2id($key);
$text = "<a class='e-expandit e-tip' href='#{$k}'>" . $parms['expand'] . "</a>";
$text .= vartrue($parms['help']) ? '<div class="field-help">' . $parms['help'] . '</div>' : '';
$text .= "<div id='{$k}' class='e-hideme'>" . $ret . "</div>";
return $text;
} else {
$ret .= vartrue($parms['help']) ? '<div class="field-help">' . $tp->toHtml($parms['help'], false, 'defs') . '</div>' : '';
}
return $ret;
}
示例13: elseif
e107::getMessage()->addError('FIXME, I\'m not working...');
//$user->user_userclass($_POST['userid'], $_POST['userclass'],'clear');
}
if (isset($_POST['useraction']) && $_POST['useraction'] == 'userclass') {
e107::getMessage()->addError('FIXME, I\'m not working...');
// header('location:'.e_ADMIN.'userclass.php?'.$e107->tp->toDB($_POST['userid'].'.'.e_QUERY));
// exit;
//$user->show_userclass($_POST['userid']);
}
// ---- Login as another user --------------------
if (isset($_POST['useraction']) && $_POST['useraction'] == 'loginas') {
if (e107::getUser()->getSessionDataAs()) {
e107::getMessage()->addWarning(USRLAN_AS_3);
} elseif (e107::getUser()->loginAs($_POST['userid'])) {
// TODO - lan
e107::getMessage()->addSuccess('Successfully logged in as ' . e107::getSystemUser($_POST['userid'])->getValue('name') . ' <a href="' . e_ADMIN_ABS . 'users.php?logoutas">[logout]</a>')->addSuccess('Please, <a href="' . SITEURL . '" rel="external">Leave Admin</a> to browse the system as this user. Use "Logout" option in Administration to end front-end session');
e107::getEvent()->trigger('loginas', array('user_id' => $_POST['userid'], 'admin_id' => e107::getUser()->getId()));
}
}
// ------- Resend Email Confirmation. --------------
if (isset($_POST['useraction']) && $_POST['useraction'] == 'resend') {
$qry = e_QUERY ? "?" . e_QUERY : "";
if ($sql->db_Select("user", "*", "user_id='" . $_POST['userid'] . "' ")) {
$resend = $sql->db_Fetch();
$text .= "<form method='post' action='" . e_SELF . $qry . "'><div style='text-align:center'>\n";
$text .= USRLAN_116 . " <b>" . $resend['user_name'] . "</b><br /><br />\r\n\r\n\t\t<input type='hidden' name='resend_id' value='" . $_POST['userid'] . "' />\n\r\n\t\t<input type='hidden' name='resend_name' value='" . $resend['user_name'] . "' />\n\r\n\t\t<input type='hidden' name='resend_key' value='" . $resend['user_sess'] . "' />\n\r\n\t\t<input type='hidden' name='resend_email' value='" . $resend['user_email'] . "' />\n\r\n\t\t<input class='button' type='submit' name='resend_mail' value='" . USRLAN_112 . "' />\n</div></form>\n";
$caption = USRLAN_112;
$ns->tablerender($caption, $text);
require_once "footer.php";
exit;
}