本文整理汇总了PHP中e107::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::getUser方法的具体用法?PHP e107::getUser怎么用?PHP e107::getUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::getUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionTest
public function actionTest()
{
echo 'Login controller<br /><br />';
if (isset($_GET['lgt'])) {
e107::getUser()->logout();
}
echo 'Logged in: ' . (e107::getUser()->isUser() ? 'true' : 'false');
$provider = e107::getUser()->getProvider();
if ($provider) {
print_a($provider->getUserProfile());
}
echo '<br /><br /><a href="' . e107::getUrl()->create('system/xup/test?lgt') . '">Test logout</a>';
echo '<br /><a href="' . e107::getUrl()->create('system/xup/login?provider=Facebook') . '">Test login with Facebook</a>';
echo '<br /><a href="' . e107::getUrl()->create('system/xup/signup?provider=Facebook') . '">Test signup with Facebook</a>';
}
示例2: actionTest
public function actionTest()
{
echo '<h3>Social Login Tester</h3>';
if (getperms('0')) {
echo e107::getMessage()->addError("Please logout of e107 before testing the new-user login/signup procedure.")->render();
return;
}
if (isset($_GET['lgt'])) {
e107::getUser()->logout();
}
$profileData = null;
$provider = e107::getUser()->getProvider();
if ($provider) {
$profileData = $provider->getUserProfile();
if (!empty($profileData)) {
print_a($profileData);
}
}
echo 'Logged in: ' . (e107::getUser()->isUser() && !empty($profileData) ? '<span class="label label-success">true</span>' : '<span class="label label-danger">false</span>');
$testUrl = SITEURL . "?route=system/xup/test";
$providers = e107::getPref('social_login', array());
foreach ($providers as $key => $var) {
if ($var['enabled'] == 1) {
echo '<h3>' . $key . '</h3><ul>';
echo '<li><a class="btn btn-default" href="' . e107::getUrl()->create('system/xup/login?provider=' . $key . '&back=' . base64_encode($testUrl)) . '">Test login only with ' . $key . '</a></li>';
echo '<li><a class="btn btn-default" href="' . e107::getUrl()->create('system/xup/signup?provider=' . $key . '&back=' . base64_encode($testUrl)) . '">Test signup/login with ' . $key . '</a></li>';
echo "</ul>";
}
// print_a($var);
}
echo '<br /><br /><a class="btn btn-default" href="' . e107::getUrl()->create('system/xup/test?lgt') . '">Test logout</a>';
/*
echo '<h3>Facebook</h3>';
echo '<br /><a href="'.e107::getUrl()->create('system/xup/login?provider=Facebook').'">Test login with Facebook</a>';
echo '<br /><a href="'.e107::getUrl()->create('system/xup/signup?provider=Facebook').'">Test signup with Facebook</a>';
echo '<h3>Twitter</h3>';
echo '<br /><a href="'.e107::getUrl()->create('system/xup/login?provider=Twitter').'">Test login with Twitter</a>';
echo '<br /><a href="'.e107::getUrl()->create('system/xup/signup?provider=Twitter').'">Test signup with Twitter</a>';
*/
}
示例3: processUpload
function processUpload()
{
$ns = e107::getRender();
$sql = e107::getDb();
$mes = e107::getMessage();
$tp = e107::getParser();
$error = false;
$postemail = '';
if (($_POST['file_email'] || USER == TRUE) && $_POST['file_name'] && $_POST['file_description'] && $_POST['download_category']) {
// $uploaded = file_upload(e_FILE."public/", "unique");
$fl = e107::getFile();
$uploaded = $fl->getUploaded(e_UPLOAD, "unique", array('max_file_count' => 2, 'extra_file_types' => TRUE));
// $uploaded = process_uploaded_files(e_UPLOAD, "unique", array('max_file_count' => 2, 'extra_file_types' => TRUE));
// First, see what errors the upload handler picked up
if ($uploaded === FALSE) {
$error = true;
$mes->addError(LAN_UL_021);
}
// Now see if we have a code file
if (count($uploaded) > 0) {
if ($uploaded[0]['error'] == 0) {
$file = $uploaded[0]['name'];
$filesize = $uploaded[0]['size'];
} else {
$error = true;
$mes->addError($uploaded[0]['message']);
}
}
// Now see if we have an image file
if (count($uploaded) > 1) {
if ($uploaded[1]['error'] == 0) {
$image = $uploaded[1]['name'];
} else {
$error = true;
$mes->addError($uploaded[1]['message']);
}
}
// The upload handler checks max file size
$downloadCategory = intval($_POST['download_category']);
if (!$downloadCategory) {
$error = true;
$mes->addError(LAN_UL_037);
}
// an error - delete the files to keep things tidy
if ($error) {
@unlink($file);
@unlink($image);
} else {
if (USER) {
$poster = USERID;
$row = e107::getUser()->toArray();
if ($row['user_hideemail']) {
$postemail = '-witheld-';
} else {
$postemail = USEREMAIL;
}
} else {
$poster = "0";
//.$tp -> toDB($_POST['file_poster']);
$postemail = $tp->toDB($_POST['file_email']);
}
if ($postemail != '-witheld-' && !check_email($postemail)) {
$error = true;
$mes->addError(LAN_UL_001);
} else {
if ($postemail == '-witheld-') {
$postemail = '';
}
$_POST['file_description'] = $tp->toDB($_POST['file_description']);
$file_time = time();
$sql->insert("upload", "0, '" . $poster . "', '" . $postemail . "', '" . $tp->toDB($_POST['file_website']) . "', '" . $file_time . "', '" . $tp->toDB($_POST['file_name']) . "', '" . $tp->toDB($_POST['file_version']) . "', '" . $file . "', '" . $image . "', '" . $tp->toDB($_POST['file_description']) . "', '" . $tp->toDB($_POST['file_demo']) . "', '" . $filesize . "', 0, '" . $downloadCategory . "'");
$edata_fu = array("upload_user" => $poster, "upload_email" => $postemail, "upload_name" => $tp->toDB($_POST['file_name']), "upload_file" => $file, "upload_version" => $_POST['file_version'], "upload_description" => $tp->toDB($_POST['file_description']), "upload_size" => $filesize, "upload_category" => $downloadCategory, "upload_website" => $tp->toDB($_POST['file_website']), "upload_image" => $image, "upload_demo" => $tp->toDB($_POST['file_demo']), "upload_time" => $file_time);
e107::getEvent()->trigger("fileupload", $edata_fu);
// BC
e107::getEvent()->trigger("user_file_upload", $edata_fu);
$mes->addSuccess(LAN_404);
}
}
} else {
// Error - missing data
$mes->addError(LAN_ERROR_29);
}
echo e107::getMessage()->render();
}
示例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: __construct
/**
* Constructor
*
* @param array $user_data trusted data, loaded from DB
* @return void
*/
public function __construct($user_data = array())
{
parent::__construct($user_data);
$this->setEditor(e107::getUser());
}
示例6: sc_comment_share
function sc_comment_share($parm = '')
{
if (!($xup = e107::getUser()->getProviderName())) {
return;
}
list($prov, $id) = explode("_", $xup);
$prov = strtolower($prov);
if ($prov == 'facebook' || $prov == 'twitter') {
//TODO Move styling to e107.css
$text = "<img src='" . e_IMAGE . "xup/" . $prov . ".png' style='display:inline-block;width:26px;height:26px;vertical-align:middle' alt='Share' />";
$text .= e107::getForm()->checkbox('comment_share', $prov, true);
$text .= "Share";
return $text;
}
}
示例7: checkActionPermissions
/**
* Check persmission for current action
* @return boolean
*/
protected function checkActionPermissions()
{
// per action restrictions
$action = $this->getRequest()->getAction();
if (isset($this->access[$action]) && !e107::getUser()->checkClass($this->access[$action], false)) {
$this->forward403();
return false;
}
return true;
}
示例8: time
/* update time delay every couple of minutes.
* Benefit: account for user time corrections and changes in internet delays
* Drawback: each update may cause all server times to display a bit different
*/
echo "<script type='text/javascript'>\n";
echo "\tSyncWithServerTime('', '{$_serverPath}', '{$_serverDomain}');\n";
//tdOffset disabled as it can't live together with HTTP_IF_NONE_MATCH (page load speed)
//echo " SyncWithServerTime('{$_serverTime}', '{$_serverPath}', '{$_serverDomain}');\n";
echo "</script>\n";
}
//
// H Final HTML
//
// browser cache control - FIXME - use this value as AJAX requests cache control!
// TODO - create the $bcache string via e107 class method, use it in the canCache() method
$uclist = e107::getUser()->getClassList();
sort($uclist, SORT_NUMERIC);
$bcache = (deftrue('e_NOCACHE') ? time() : e107::getPref('e_jslib_browser_cache')) . '.' . implode(',', $uclist);
echo "\n<!-- " . md5($bcache) . " -->\n";
unset($uclist, $bcache);
$show = deftrue('e_POWEREDBY_DISABLE') ? "none" : "block";
// Let search engines find us to increase e107.org ranking - even if hidden.
//XXX Must not contain IDs or Classes
// echo "<div style='text-align:center; display:".$show."; position: absolute; width:99%; height:20px; margin-top:-30px; z-index:30000; opacity:1.0; color: silver'>Proudly powered by <a style='color:silver' href='http://e107.org/' title='e107 Content Management System'>e107</a></div>";
unset($show);
echo "\n</body>\n</html>";
// Shutdown
$e107->destruct();
//
// I Send the buffered page data, along with appropriate headers
//
示例9: options
function options($val, $mode)
{
$controller = $this->getController();
if ($controller->getMode() != 'main' || $controller->getAction() != 'list') {
return;
}
$row = $controller->getListModel()->getData();
if (!getperms('4')) {
// return;
}
extract($row);
$text = "";
$head = "<div>\r\n\r\n\t\t\t\t<input type='hidden' name='userid[{$user_id}]' value='{$user_id}' />\r\n\t\t\t\t<input type='hidden' name='userip[{$user_id}]' value='{$user_ip}' />\r\n\t\t\t\t<select name='useraction[{$user_id}]' onchange='this.form.submit()' class='e-select tbox' data-placement='left' title='Modify' style='text-align:left;width:75%'>\r\n\t\t\t\t<option selected='selected' value=''> </option>";
if ($user_perms != "0") {
// disabled user info <option value='userinfo'>".USRLAN_80."</option>
$text .= "\r\n\t\t\t\t\t<option value='usersettings'>" . LAN_EDIT . "</option>\r\n\t\t\t\t\t";
// login/logout As
if (getperms('0') && !($row['user_admin'] && getperms('0', $row['user_perms']))) {
if (e107::getUser()->getSessionDataAs() == $row['user_id']) {
$text .= "<option value='logoutas'>" . sprintf(USRLAN_AS_2, $row['user_name']) . "</option>";
} else {
$text .= "<option value='loginas'>" . sprintf(USRLAN_AS_1, $row['user_name']) . "</option>";
}
}
switch ($user_ban) {
case 0:
$text .= "<option value='ban'>" . USRLAN_30 . "</option>\n";
break;
case 1:
// Banned user
$text .= "<option value='unban'>" . USRLAN_33 . "</option>\n";
break;
case 2:
// Unverified
$text .= "<option value='ban'>" . USRLAN_30 . "</option>\r\n\t\t\t\t\t\t<option value='verify'>" . USRLAN_32 . "</option>\r\n\t\t\t\t\t\t<option value='resend'>" . USRLAN_112 . "</option>\r\n\t\t\t\t\t\t<option value='test'>" . USRLAN_118 . "</option>";
break;
case 3:
// Bounced
// FIXME wrong lan for 'reqverify' - USRLAN_181, wrong lan for 'verify' (USRLAN_182), changed to USRLAN_32
$text .= "<option value='ban'>" . USRLAN_30 . "</option>\r\n\t\t\t\t\t\t<option value='reqverify'>Make not verified</option>\r\n\t\t\t\t\t\t<option value='verify'>" . USRLAN_32 . "</option>\r\n\t\t\t\t\t\t<option value='test'>" . USRLAN_118 . "</option>";
break;
default:
}
if (!$user_admin && !$user_ban && $user_ban != 2 && getperms('3')) {
$text .= "<option value='admin'>" . USRLAN_35 . "</option>\n";
} else {
if ($user_admin && $user_perms != "0" && getperms('3')) {
$text .= "<option value='adminperms'>" . USRLAN_221 . "</option>\n";
$text .= "<option value='unadmin'>" . USRLAN_34 . "</option>\n";
}
}
}
if ($user_perms == "0" && !getperms("0")) {
$text .= "";
} elseif ($user_id != USERID || getperms("0")) {
// $text .= "<option value='userclass'>".USRLAN_36."</option>\n"; // DEPRECATED. inline & batch should be enough.
}
if ($user_perms != "0") {
$text .= "<option value='deluser'>" . LAN_DELETE . "</option>\n";
}
$foot = "</select></div>";
return $text ? $head . $text . $foot : "";
}
示例10: setUserPref
/**
* Set column preference array
* @return boolean success
*/
public function setUserPref($new)
{
//global $user_pref;
//e107::getUser()->getConfig()->setData($new);
//$user_pref['admin_cols_'.$this->getTableName()] = $new;
//$this->fieldpref = $new;
//return save_prefs('user');
$this->fieldpref = $new;
return e107::getUser()->getConfig()->set('admin_cols_' . $this->getTableName(), $new)->save();
}
示例11: init_session
/**
* The whole could happen inside e_user class
* @return void
*/
function init_session()
{
/*
# Validate user
#
# - parameters none
# - return boolean
# - scope public
*/
// ----------------------------------------
global $user_pref, $currentUser;
$e107 = e107::getInstance();
// New user model
$user = e107::getUser();
define('USERIP', e107::getIPHandler()->getIP(FALSE));
define('POST_REFERER', md5($user->getToken()));
// Check for intruders - outside the model for now
// TODO replace __referer with e-token, remove the above
if (isset($_POST['__referer']) && !$user->checkToken($_POST['__referer']) || isset($_GET['__referer']) && !$user->checkToken($_GET['__referer'])) {
// Die, die, die! DIE!!!
die('Unauthorized access!');
}
if (e107::isCli()) {
define('USER', true);
define('USERID', 1);
define('USERNAME', 'e107-cli');
define('USERTHEME', false);
define('ADMIN', true);
define('GUEST', false);
define('USERCLASS', '');
define('USEREMAIL', '');
define('USERCLASS_LIST', '');
define('USERCLASS', '');
define('USERJOINED', '');
return;
}
if ($user->hasBan()) {
$msg = e107::findPref('ban_messages/6');
if ($msg) {
echo e107::getParser()->toHTML($msg);
}
exit;
}
if (!$user->isUser()) {
define('USER', false);
define('USERID', 0);
define('USERTHEME', false);
define('ADMIN', false);
define('GUEST', true);
define('USERCLASS', '');
define('USEREMAIL', '');
define('USERSIGNATURE', '');
if ($user->hasSessionError()) {
define('LOGINMESSAGE', CORE_LAN10);
define('CORRUPT_COOKIE', true);
}
} else {
// we shouldn't use getValue() here, it's there for e.g. shortcodes, profile page render etc.
define('USERID', $user->getId());
define('USERNAME', $user->get('user_name'));
define('USERURL', $user->get('user_homepage', false));
//required for BC
define('USEREMAIL', $user->get('user_email'));
define('USER', true);
define('USERCLASS', $user->get('user_class'));
define('USERIMAGE', $user->get('user_image'));
define('USERPHOTO', $user->get('user_sess'));
define('USERJOINED', $user->get('user_join'));
define('USERVISITS', $user->get('user_visits'));
define('USERSIGNATURE', $user->get('user_signature'));
define('ADMIN', $user->isAdmin());
define('ADMINID', $user->getAdminId());
define('ADMINNAME', $user->getAdminName());
define('ADMINPERMS', $user->getAdminPerms());
define('ADMINEMAIL', $user->getAdminEmail());
define('ADMINPWCHANGE', $user->getAdminPwchange());
if (ADMIN) {
e107::getRedirect()->setPreviousUrl();
}
define('USERLV', $user->get('user_lastvisit'));
// BC - FIXME - get rid of them!
$currentUser = $user->getData();
$currentUser['user_realname'] = $user->get('user_login');
// Used by force_userupdate
$e107->currentUser =& $currentUser;
// if(defined('SETTHEME')) //override - within e_module for example.
// {
// $_POST['sitetheme'] = SETTHEME;
// $_POST['settheme'] = 1;
// }
// XXX could go to e_user class as well
if ($user->checkClass(e107::getPref('allow_theme_select', false), false)) {
// User can set own theme
if (isset($_POST['settheme'])) {
$uconfig = $user->getConfig();
if (e107::getPref('sitetheme') != $_POST['sitetheme']) {
//.........这里部分代码省略.........
示例12: cacheString
public function cacheString($category, $type = 'sys')
{
if (!isset($this->_md5cache[$category])) {
$uclist = e107::getUser()->getClassList();
sort($uclist, SORT_NUMERIC);
$this->_md5cache[$category] = md5($category . $uclist);
}
switch ($type) {
case 'sys':
return $this->cacheBase() . $this->_md5cache[$category];
break;
case 'md5':
return $this->_md5cache[$category];
break;
}
}
示例13: options
function options()
{
// return 'hello';
$row = $this->getController()->getListModel()->getData();
// $this->getController()->getListModel()->
// return print_a($row,true);
if (!getperms('4')) {
// return;
}
extract($row);
$text .= "<div>\r\n\r\n\t\t\t\t<input type='hidden' name='userid[{$user_id}]' value='{$user_id}' />\r\n\t\t\t\t<input type='hidden' name='userip[{$user_id}]' value='{$user_ip}' />\r\n\t\t\t\t<select name='useraction[{$user_id}]' onchange='this.form.submit()' class='tbox' style='width:75%'>\r\n\t\t\t\t<option selected='selected' value=''> </option>";
if ($user_perms != "0") {
// disabled user info <option value='userinfo'>".USRLAN_80."</option>
$text .= "\r\n\t\t\t\t\t<option value='usersettings'>" . LAN_EDIT . "</option>\r\n\t\t\t\t\t";
// login/logout As
if (getperms('0') && !($row['user_admin'] && getperms('0', $row['user_perms']))) {
if (e107::getUser()->getSessionDataAs() == $row['user_id']) {
$text .= "<option value='logoutas'>" . sprintf(USRLAN_AS_2, $row['user_name']) . "</option>";
} else {
$text .= "<option value='loginas'>" . sprintf(USRLAN_AS_1, $row['user_name']) . "</option>";
}
}
switch ($user_ban) {
case 0:
$text .= "<option value='ban'>" . USRLAN_30 . "</option>\n";
break;
case 1:
// Banned user
$text .= "<option value='unban'>" . USRLAN_33 . "</option>\n";
break;
case 2:
// Unverified
$text .= "<option value='ban'>" . USRLAN_30 . "</option>\r\n\t\t\t\t\t\t<option value='verify'>" . USRLAN_32 . "</option>\r\n\t\t\t\t\t\t<option value='resend'>" . USRLAN_112 . "</option>\r\n\t\t\t\t\t\t<option value='test'>" . USRLAN_118 . "</option>";
break;
case 3:
// Bounced
$text .= "<option value='ban'>" . USRLAN_30 . "</option>\r\n\t\t\t\t\t\t<option value='reqverify'>" . USRLAN_181 . "</option>\r\n\t\t\t\t\t\t<option value='verify'>" . USRLAN_182 . "</option>\r\n\t\t\t\t\t\t<option value='test'>" . USRLAN_118 . "</option>";
break;
default:
}
if (!$user_admin && !$user_ban && $user_ban != 2 && getperms('3')) {
$text .= "<option value='admin'>" . USRLAN_35 . "</option>\n";
} else {
if ($user_admin && $user_perms != "0" && getperms('3')) {
$text .= "<option value='adminperms'>" . USRLAN_221 . "</option>\n";
$text .= "<option value='unadmin'>" . USRLAN_34 . "</option>\n";
}
}
}
if ($user_perms == "0" && !getperms("0")) {
$text .= "";
} elseif ($user_id != USERID || getperms("0")) {
$text .= "<option value='userclass'>" . USRLAN_36 . "</option>\n";
}
if ($user_perms != "0") {
$text .= "<option value='deluser'>" . LAN_DELETE . "</option>\n";
}
$text .= "</select></div>";
return $text;
}
示例14: _handleListBatch
/**
* Handle posted batch options routine
* @param string $batch_trigger
* @return e_admin_controller_ui
*/
protected function _handleListBatch($batch_trigger)
{
$tp = e107::getParser();
//$multi_name = vartrue($this->fields['checkboxes']['toggle'], 'multiselect');
$multi_name = $this->getFieldAttr('checkboxes', 'toggle', 'multiselect');
$selected = array_values($this->getPosted($multi_name, array()));
$trigger = $tp->toDB(explode('__', $batch_trigger));
if (empty($selected) && !$this->getPosted('etrigger_delete_confirm')) {
$params = $this->getFieldAttr($trigger[1], 'writeParms', array());
if (!is_array($params)) {
parse_str($params, $params);
}
if (!vartrue($params['batchNoCheck'])) {
return $this;
}
}
if ($selected) {
foreach ($selected as $i => $_sel) {
$selected[$i] = preg_replace('/[^\\w-:.]/', '', $_sel);
}
}
$this->setTriggersEnabled(false);
//disable further triggering
switch ($trigger[0]) {
case 'delete':
//FIXME - confirmation screen
//method handleListDeleteBatch(); for custom handling of 'delete' batch
// if(empty($selected)) return $this;
// don't check selected data - subclass need to check additional post variables(confirm screen)
$method = 'handle' . $this->getRequest()->getActionName() . 'DeleteBatch';
if (method_exists($this, $method)) {
$this->{$method}($selected);
}
break;
case 'bool':
if (empty($selected)) {
return $this;
}
$field = $trigger[1];
$value = $trigger[2] ? 1 : 0;
//something like handleListBoolBatch(); for custom handling of 'bool' batch
$method = 'handle' . $this->getRequest()->getActionName() . 'BoolBatch';
if (method_exists($this, $method)) {
$this->{$method}($selected, $field, $value);
}
break;
case 'boolreverse':
if (empty($selected)) {
return $this;
}
$field = $trigger[1];
//something like handleListBoolreverseBatch(); for custom handling of 'boolreverse' batch
$method = 'handle' . $this->getRequest()->getActionName() . 'BoolreverseBatch';
if (method_exists($this, $method)) {
$this->{$method}($selected, $field);
}
break;
// see commma, userclasses batch options
// see commma, userclasses batch options
case 'attach':
case 'deattach':
case 'addAll':
case 'clearAll':
$field = $trigger[1];
$value = $trigger[2];
if ($trigger[0] == 'addAll') {
$parms = $this->getFieldAttr($field, 'writeParms', array());
if (!is_array($parms)) {
parse_str($parms, $parms);
}
unset($parms['__options']);
$value = $parms;
if (empty($value)) {
return $this;
}
if (!is_array($value)) {
$value = array_map('trim', explode(',', $value));
}
}
if (method_exists($this, 'handleCommaBatch')) {
$this->handleCommaBatch($selected, $field, $value, $trigger[0]);
}
break;
// append to userclass list
// append to userclass list
case 'ucadd':
case 'ucremove':
//if(empty($selected)) return $this;
$field = $trigger[1];
$class = $trigger[2];
$user = e107::getUser();
$e_userclass = e107::getUserClass();
// check userclass manager class
if (!isset($e_userclass->class_tree[$class]) || !$user->checkClass($e_userclass->class_tree[$class])) {
return $this;
//.........这里部分代码省略.........
示例15: options
function options($val, $mode)
{
$controller = $this->getController();
if ($controller->getMode() != 'main' || $controller->getAction() != 'list') {
return;
}
$row = $controller->getListModel()->getData();
if (!getperms('4')) {
// return;
}
extract($row);
$user_id = $row['user_id'];
$user_ip = $row['user_ip'];
$user_admin = $row['user_admin'];
$text = "";
$head = "<div>\r\n\r\n\t\t\t\t<input type='hidden' name='userid[{$user_id}]' value='{$user_id}' />\r\n\t\t\t\t<input type='hidden' name='userip[{$user_id}]' value='{$user_ip}' />\r\n\t\t\t\t<input type='hidden' class='user-action-hidden' id='user-action-" . $user_id . "' name='useraction[{$user_id}]' value='' />\r\n\t\t\t\t";
// <select name='useraction[{$user_id}]' onchange='this.form.submit()' class='e-select tbox' data-placement='left' title='Modify' style='text-align:left;width:75%'>
// <option selected='selected' value=''> </option>";
$opts = array();
if ($row['user_perms'] != "0") {
// disabled user info <option value='userinfo'>".USRLAN_80."</option>
// $text .= "<option value='usersettings'>".LAN_EDIT."</option>";
$opts['usersettings'] = LAN_EDIT;
// login/logout As
if (getperms('0') && !($row['user_admin'] && getperms('0', $row['user_perms']))) {
if (e107::getUser()->getSessionDataAs() == $row['user_id']) {
// $text .= "<option value='logoutas'>".sprintf(USRLAN_AS_2, $row['user_name'])."</option>";
$opts['logoutas'] = e107::getParser()->lanVars(USRLAN_AS_2, $row['user_name']);
} else {
// $text .= "<option value='loginas'>".sprintf(USRLAN_AS_1, $row['user_name'])."</option>";
$opts['loginas'] = e107::getParser()->lanVars(USRLAN_AS_1, $row['user_name']);
}
}
switch ($row['user_ban']) {
case 0:
// $text .= "<option value='ban'>".USRLAN_30."</option>\n";
$opts['ban'] = USRLAN_30;
break;
case 1:
// Banned user
// $text .= "<option value='unban'>".USRLAN_33."</option>\n";
$opts['unban'] = USRLAN_33;
break;
case 2:
// Unverified
/* $text .= "<option value='ban'>".USRLAN_30."</option>
<option value='verify'>".USRLAN_32."</option>
<option value='resend'>".USRLAN_112."</option>
<option value='test'>".USRLAN_118."</option>";*/
$opts['ban'] = USRLAN_30;
$opts['verify'] = USRLAN_32;
$opts['resend'] = USRLAN_112;
$opts['test'] = USRLAN_118;
break;
case 3:
// Bounced
// FIXME wrong lan for 'reqverify' - USRLAN_181, wrong lan for 'verify' (USRLAN_182), changed to USRLAN_32
/* $text .= "<option value='ban'>".USRLAN_30."</option>
<option value='reqverify'>Make not verified</option>
<option value='verify'>".USRLAN_32."</option>
<option value='test'>".USRLAN_118."</option>";
*/
$opts['ban'] = USRLAN_30;
$opts['reqverify'] = "Make not verified";
$opts['verify'] = USRLAN_32;
$opts['test'] = USRLAN_118;
break;
default:
}
if (!$user_admin && !$row['user_ban'] && $row['user_ban'] != 2 && getperms('3')) {
// $text .= "<option value='admin'>".USRLAN_35."</option>\n";
$opts['admin'] = USRLAN_35;
} else {
if ($user_admin && $row['user_perms'] != "0" && getperms('3')) {
// $text .= "<option value='adminperms'>".USRLAN_221."</option>\n";
// $text .= "<option value='unadmin'>".USRLAN_34."</option>\n";
$opts['adminperms'] = USRLAN_221;
$opts['uadmin'] = USRLAN_34;
}
}
}
if ($row['user_perms'] == "0" && !getperms("0")) {
// $text .= "";
} elseif ($user_id != USERID || getperms("0")) {
// $text .= "<option value='userclass'>".USRLAN_36."</option>\n"; // DEPRECATED. inline & batch should be enough.
}
if ($row['user_perms'] != "0") {
// $text .= "<option value='deluser'>".LAN_DELETE."</option>\n";
$opts['deldiv'] = 'divider';
$opts['deluser'] = LAN_DELETE;
}
// $foot = "</select>";
// $foot = "</div>";
$btn = '<div class="btn-group pull-right">
<button aria-expanded="false" class="btn btn-default btn-user-action dropdown-toggle" data-toggle="dropdown">
<span class="user-action-indicators" id="user-action-indicator-' . $user_id . '">' . e107::getParser()->toGlyph('cog') . '</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
//.........这里部分代码省略.........