本文整理汇总了PHP中erLhcoreClassUserDep类的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassUserDep类的具体用法?PHP erLhcoreClassUserDep怎么用?PHP erLhcoreClassUserDep使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了erLhcoreClassUserDep类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getDepartmentLimitation
public static function getDepartmentLimitation()
{
$currentUser = erLhcoreClassUser::instance();
$LimitationDepartament = '';
$userData = $currentUser->getUserData(true);
if ($userData->all_departments == 0) {
$userDepartaments = erLhcoreClassUserDep::getUserDepartaments($currentUser->getUserID());
if (count($userDepartaments) == 0) {
return false;
}
$LimitationDepartament = '(lh_transfer.dep_id IN (' . implode(',', $userDepartaments) . '))';
return $LimitationDepartament;
}
return true;
}
开发者ID:detain,项目名称:livehelperchat,代码行数:15,代码来源:lhtransfer.php
示例2: loginBySSO
public static function loginBySSO($params)
{
$settings = (include 'extension/singlesignon/settings/settings.ini.php');
// Try to find operator by our logins
if (isset($params[$settings['attr_map']['username']][0])) {
$username = $params[$settings['attr_map']['username']][0];
if (erLhcoreClassModelUser::userExists($username)) {
$user = array_shift(erLhcoreClassModelUser::getUserList(array('limit' => 1, 'filter' => array('username'))));
erLhcoreClassUser::instance()->setLoggedUser($user->id);
} else {
$user = new erLhcoreClassModelUser();
foreach ($settings['attr_map'] as $attr => $ssoAttr) {
$user->{$attr} = $params[$settings['attr_map'][$attr]][0];
}
foreach ($settings['default_attributes'] as $attr => $value) {
$user->{$attr} = $value;
}
$user->password = sha1(erLhcoreClassModelForgotPassword::randomPassword() . rand(0, 1000) . microtime());
$user->saveThis();
// Set that users sees all pending chats
erLhcoreClassModelUserSetting::setSetting('show_all_pending', 1, $user->id);
// Set default departments
erLhcoreClassUserDep::addUserDepartaments($settings['default_departments'], $user->id, $user);
// Cleanup if previously existed
erLhcoreClassModelGroupUser::removeUserFromGroups($user->id);
// Assign user to default group
foreach ($settings['default_user_groups'] as $group_id) {
$groupUser = new erLhcoreClassModelGroupUser();
$groupUser->group_id = $group_id;
$groupUser->user_id = $user->id;
$groupUser->saveThis();
}
erLhcoreClassUser::instance()->setLoggedUser($user->id);
}
return true;
} else {
throw new Exception('Username field not found');
}
}
开发者ID:creativeprogramming,项目名称:livehelperchat-extensions,代码行数:39,代码来源:lhsinglesingon.php
示例3: getOnlineOperators
public static function getOnlineOperators($currentUser, $canListOnlineUsersAll = false)
{
$LimitationDepartament = '';
$userData = $currentUser->getUserData(true);
$filter = array();
if ($userData->all_departments == 0 && $canListOnlineUsersAll == false) {
$userDepartaments = erLhcoreClassUserDep::getUserDepartaments($currentUser->getUserID());
if (count($userDepartaments) == 0) {
return array();
}
$index = array_search(-1, $userDepartaments);
if ($index !== false) {
unset($userDepartaments[$index]);
}
$filter['customfilter'][] = '(dep_id IN (' . implode(',', $userDepartaments) . ') OR user_id = ' . $currentUser->getUserID() . ')';
}
$filter['filtergt']['last_activity'] = time() - 120;
$filter['limit'] = 10;
$filter['sort'] = 'last_activity DESC';
$filter['groupby'] = 'user_id';
return self::getList($filter);
}
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:22,代码来源:erlhcoreclassmodeluserdep.php
示例4: is_numeric
if ($showDepartmentsStats == true) {
/**
* Departments stats
* */
$limitList = is_numeric($Params['user_parameters_unordered']['limitd']) ? (int) $Params['user_parameters_unordered']['limitd'] : 10;
$filter = array('ignore_fields' => erLhcoreClassChat::$chatListIgnoreField);
$filter['limit'] = $limitList;
if (is_array($Params['user_parameters_unordered']['departmentd']) && !empty($Params['user_parameters_unordered']['departmentd'])) {
erLhcoreClassChat::validateFilterIn($Params['user_parameters_unordered']['departmentd']);
$filter['filterin']['id'] = $Params['user_parameters_unordered']['departmentd'];
}
// Add permission check if operator does not have permission to see all departments stats
if ($showDepartmentsStatsAll === false) {
$userData = $currentUser->getUserData(true);
if ($userData->all_departments == 0) {
$userDepartaments = erLhcoreClassUserDep::getUserDepartaments($currentUser->getUserID());
if (!empty($userDepartaments)) {
if (isset($filter['filterin']['id'])) {
$validDepartments = array_intersect($userDepartaments, $filter['filterin']['id']);
if (!empty($validDepartments)) {
$filter['filterin']['id'] = $validDepartments;
} else {
$filter['filterin']['id'] = array(-1);
}
} else {
$filter['filterin']['id'] = $userDepartaments;
}
} else {
$filter['filterin']['id'] = array(-1);
// No departments
}
开发者ID:my-instantcms,项目名称:livehelperchat,代码行数:31,代码来源:syncadmininterface.php
示例5: hasAccessToRead
public static function hasAccessToRead($chat)
{
$currentUser = erLhcoreClassUser::instance();
$userData = $currentUser->getUserData(true);
if ($userData->all_departments == 0) {
/*
* --From now permission is strictly by assigned department, not by chat owner
*
* Finally decided to keep this check, it allows more advance permissions configuration
* */
if ($chat->user_id == $currentUser->getUserID()) {
return true;
}
$userDepartaments = erLhcoreClassUserDep::getUserDepartaments($currentUser->getUserID());
if (count($userDepartaments) == 0) {
return false;
}
if (in_array($chat->dep_id, $userDepartaments)) {
if ($currentUser->hasAccessTo('lhchat', 'allowopenremotechat') == true) {
return true;
} elseif ($chat->user_id == 0 || $chat->user_id == $currentUser->getUserID()) {
return true;
}
return false;
}
return false;
}
return true;
}
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:29,代码来源:lhchat.php
示例6:
?>
</h5>
<?php
if (isset($account_updated_departaments) && $account_updated_departaments == 'done') {
$msg = erTranslationClassLhTranslation::getInstance()->getTranslation('user/account', 'Account updated');
?>
<?php
include erLhcoreClassDesign::designtpl('lhkernel/alert_success.tpl.php');
?>
<?php
}
?>
<?php
$userDepartaments = erLhcoreClassUserDep::getUserDepartaments($user->id);
?>
<form action="<?php
echo erLhcoreClassDesign::baseurl('user/edit');
?>
/<?php
echo $user->id;
?>
#departments" method="post">
<?php
include erLhcoreClassDesign::designtpl('lhkernel/csfr_token.tpl.php');
?>
<label><input type="checkbox" value="on" name="all_departments" <?php
开发者ID:niravpatel2008,项目名称:north-american-nemesis-new,代码行数:31,代码来源:edit.tpl.php
示例7: getFields
public function getFields()
{
$currentUser = erLhcoreClassUser::instance();
$userDepartments = erLhcoreClassUserDep::parseUserDepartmetnsForFilter($currentUser->getUserID());
return array('name' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Name for personal purposes'), 'required' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'operator_name' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Operator name'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'position' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Position'), 'required' => true, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'siteaccess' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Language, leave empty for all. E.g lit, rus, ger etc...'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'time_on_site' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Time on site in seconds'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int')), 'pageviews' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Pageviews'), 'required' => false, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'referrer' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Referrer domain without www, E.g google keyword will match any of google domain'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'hide_after_ntimes' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'How many times user show invitation, 0 - untill users closes it, > 0 limits.'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int')), 'requires_email' => array('type' => 'checkbox', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Requires e-mail'), 'required' => false, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean')), 'requires_username' => array('type' => 'checkbox', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Requires name'), 'required' => false, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean')), 'requires_phone' => array('type' => 'checkbox', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Requires phone'), 'required' => false, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean')), 'show_random_operator' => array('type' => 'checkbox', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Show random operator profile'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean')), 'operator_ids' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Enter operators IDs from whom random operator should be shown, separated by comma'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string')), 'identifier' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Identifier, for what identifier this message should be shown, leave empty for all'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string')), 'tag' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Tag'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string')), 'dep_id' => array('type' => 'combobox', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Department'), 'required' => false, 'hidden' => true, 'source' => 'erLhcoreClassModelDepartament::getList', 'hide_optional' => $userDepartments !== true, 'params_call' => $userDepartments === true ? array() : array('filterin' => array('id' => $userDepartments)), 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int')), 'executed_times' => array('type' => 'none', 'hide_edit' => true, 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Matched times'), 'required' => false, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'message' => array('type' => 'textarea', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message to user'), 'required' => true, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'message_returning' => array('type' => 'textarea', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message to returning user'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'message_returning_nick' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Nick which will be used if we cannot determine returning user name'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'wait_message' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Wait message. Visible then users starts chat and is waiting for someone to accept a chat.'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'wait_timeout' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Wait timeout. Time in seconds before timeout message is shown.'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'timeout_message' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Show visitor this message then wait timeout passes.'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'repeat_number' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'How many times repeat message?'), 'required' => true, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1))));
}
开发者ID:detain,项目名称:livehelperchat,代码行数:6,代码来源:erlhabstractmodeleproactivechatinvitation.php
示例8: hasAccessToRead
/**
*
* @param erLhcoreClassModelChat $chat
*
* @return boolean
*/
public static function hasAccessToRead(erLhcoreClassModelChat $chat)
{
if (self::$apiKey->user->all_departments == 0) {
if ($chat->user_id == self::$apiKey->user->id) {
return true;
}
$userDepartaments = erLhcoreClassUserDep::getUserDepartaments(self::$apiKey->user->id);
if (count($userDepartaments) == 0) {
return false;
}
if (in_array($chat->dep_id, $userDepartaments)) {
if (self::hasAccessTo('lhchat', 'allowopenremotechat') == true || $chat->status == erLhcoreClassModelChat::STATUS_OPERATORS_CHAT) {
return true;
} elseif ($chat->user_id == 0 || $chat->user_id == self::$apiKey->user->id) {
return true;
}
return false;
}
return false;
}
return true;
}
开发者ID:detain,项目名称:livehelperchat,代码行数:28,代码来源:lhrestapivalidator.php
示例9: array
}
$tpl->set('account_updated', 'done');
$tpl->set('tab', 'tab_pending');
}
if (isset($_POST['UpdateDepartaments_account'])) {
if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
erLhcoreClassModule::redirect('user/userlist');
exit;
}
$globalDepartament = array();
if (isset($_POST['all_departments']) && $_POST['all_departments'] == 'on') {
$UserData->all_departments = 1;
$globalDepartament[] = 0;
} else {
$UserData->all_departments = 0;
$globalDepartament[] = -1;
}
erLhcoreClassUser::getSession()->update($UserData);
if (isset($_POST['UserDepartament']) && count($_POST['UserDepartament']) > 0) {
$globalDepartament = array_merge($_POST['UserDepartament'], $globalDepartament);
}
if (count($globalDepartament) > 0) {
erLhcoreClassUserDep::addUserDepartaments($globalDepartament, $Params['user_parameters']['user_id'], $UserData);
} else {
erLhcoreClassUserDep::addUserDepartaments(array(), $Params['user_parameters']['user_id'], $UserData);
}
$tpl->set('account_updated_departaments', 'done');
}
$tpl->set('user', $UserData);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'System configuration')), array('url' => erLhcoreClassDesign::baseurl('user/userlist'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'Users')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'User edit') . ' - ' . $UserData->name . ' ' . $UserData->surname));
开发者ID:nagyistoce,项目名称:livehelperchat,代码行数:31,代码来源:edit.php
示例10: array
$tpl->set('errors', $Errors);
}
}
if (isset($_POST['UpdatePending_account'])) {
if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
erLhcoreClassModule::redirect('user/edit', '/' . $UserData->id);
exit;
}
$showAllPending = erLhcoreClassUserValidator::validateShowAllPendingOption();
erLhcoreClassModelUserSetting::setSetting('show_all_pending', $showAllPending, $UserData->id);
$tpl->set('account_updated', 'done');
$tpl->set('tab', 'tab_pending');
}
if (isset($_POST['UpdateDepartaments_account'])) {
if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
erLhcoreClassModule::redirect('user/edit', '/' . $UserData->id);
exit;
}
$globalDepartament = erLhcoreClassUserValidator::validateDepartments($UserData, array('all_departments_0_global_value' => -1));
erLhcoreClassUser::getSession()->update($UserData);
if (count($globalDepartament) > 0) {
erLhcoreClassUserDep::addUserDepartaments($globalDepartament, $UserData->id, $UserData);
} else {
erLhcoreClassUserDep::addUserDepartaments(array(), $UserData->id, $UserData);
}
$tpl->set('account_updated_departaments', 'done');
}
$tpl->set('user', $UserData);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'System configuration')), array('url' => erLhcoreClassDesign::baseurl('user/userlist'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'Users')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'User edit') . ' - ' . $UserData->name . ' ' . $UserData->surname));
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('user.edit_path', array('result' => &$Result));
开发者ID:detain,项目名称:livehelperchat,代码行数:31,代码来源:edit.php
示例11: htmlspecialchars_decode
$chat->status_sub = erLhcoreClassModelChat::STATUS_SUB_OWNER_CHANGED;
$chat->user_typing_txt = (string) $chat->user . ' ' . htmlspecialchars_decode(erTranslationClassLhTranslation::getInstance()->getTranslation('chat/accepttrasnfer', 'has joined the chat!'), ENT_QUOTES);
$chat->user_typing = time();
// Change department if user cannot read current department, so chat appears in right menu
$filter = erLhcoreClassUserDep::parseUserDepartmetnsForFilter($currentUser->getUserID());
if ($filter !== true && !in_array($chat->dep_id, $filter)) {
$dep_id = erLhcoreClassUserDep::getDefaultUserDepartment();
if ($dep_id > 0) {
$chat->dep_id = $dep_id;
$chat->status_sub = erLhcoreClassModelChat::STATUS_SUB_OWNER_CHANGED;
}
}
}
if (!erLhcoreClassChat::hasAccessToRead($chat)) {
if ($currentUser->getUserID() == $chatTransfer->transfer_to_user_id) {
$dep_id = erLhcoreClassUserDep::getDefaultUserDepartment();
if ($dep_id > 0) {
$chat->dep_id = $dep_id;
$chat->status_sub = erLhcoreClassModelChat::STATUS_SUB_OWNER_CHANGED;
}
} else {
exit;
// User does not have permission to assign chat to himself
}
}
// All ok, we can make changes
erLhcoreClassChat::getSession()->update($chat);
erLhcoreClassTransfer::getSession()->delete($chatTransfer);
if ($Params['user_parameters_unordered']['postaction'] == 'singlewindow') {
erLhcoreClassModule::redirect('chat/single/' . $chat->id);
exit;
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:31,代码来源:accepttransfer.php
示例12: isset
$userDepartamentsGroup = isset($_POST['UserDepartamentGroup']) ? $_POST['UserDepartamentGroup'] : array();
$userParams = array('show_all_pending' => 1, 'global_departament' => array());
$tpl->set('tab', $Params['user_parameters_unordered']['tab'] == 'canned' ? 'tab_canned' : '');
if (isset($_POST['Update_account'])) {
if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
erLhcoreClassModule::redirect('user/new');
exit;
}
$Errors = erLhcoreClassUserValidator::validateUserNew($UserData, $userParams);
if (count($Errors) == 0) {
try {
$db = ezcDbInstance::get();
$db->beginTransaction();
erLhcoreClassUser::getSession()->save($UserData);
if (count($userParams['global_departament']) > 0) {
erLhcoreClassUserDep::addUserDepartaments($userParams['global_departament'], $UserData->id, $UserData);
}
$UserData->setUserGroups();
$userPhotoErrors = erLhcoreClassUserValidator::validateUserPhoto($UserData);
if ($userPhotoErrors !== false && count($userPhotoErrors) == 0) {
$UserData->saveThis();
}
erLhcoreClassModelDepartamentGroupUser::addUserDepartmentGroups($UserData, erLhcoreClassUserValidator::validateDepartmentsGroup($UserData));
erLhcoreClassModelUserSetting::setSetting('show_all_pending', $userParams['show_all_pending'], $UserData->id);
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('user.user_created', array('userData' => &$UserData, 'password' => $UserData->password_front));
$db->commit();
erLhcoreClassModule::redirect('user/userlist');
exit;
} catch (Exception $e) {
$tpl->set('errors', array($e->getMessage()));
$UserData->removeFile();
开发者ID:remdex,项目名称:livehelperchat,代码行数:31,代码来源:new.php
示例13:
?>
</h5>
<?php
if (isset($account_updated_departaments) && $account_updated_departaments == 'done') {
$msg = erTranslationClassLhTranslation::getInstance()->getTranslation('user/account', 'Account updated');
?>
<?php
include erLhcoreClassDesign::designtpl('lhkernel/alert_success.tpl.php');
?>
<?php
}
?>
<?php
$userDepartaments = erLhcoreClassUserDep::getUserDepartamentsIndividual($user->id);
$userDepartamentsGroup = erLhcoreClassModelDepartamentGroupUser::getUserGroupsIds($user->id);
?>
<form action="<?php
echo erLhcoreClassDesign::baseurl('user/edit');
?>
/<?php
echo $user->id;
?>
#departments" method="post">
<?php
include erLhcoreClassDesign::designtpl('lhuser/account/departments_assignment.tpl.php');
?>
开发者ID:remdex,项目名称:livehelperchat,代码行数:30,代码来源:edit.tpl.php
示例14: array
}
$globalDepartament = array();
if (isset($_POST['all_departments']) && $_POST['all_departments'] == 'on') {
$UserData->all_departments = 1;
$globalDepartament[] = 0;
} else {
$UserData->all_departments = 0;
}
erLhcoreClassUser::getSession()->update($UserData);
if (isset($_POST['UserDepartament']) && count($_POST['UserDepartament']) > 0) {
$globalDepartament = array_merge($_POST['UserDepartament'], $globalDepartament);
}
if (count($globalDepartament) > 0) {
erLhcoreClassUserDep::addUserDepartaments($globalDepartament, false, $UserData);
} else {
erLhcoreClassUserDep::addUserDepartaments(array(), false, $UserData);
}
$tpl->set('account_updated_departaments', 'done');
$tpl->set('tab', 'tab_departments');
}
// If already set during account update
if (!isset($UserData)) {
$UserData = $currentUser->getUserData();
}
$tpl->set('editdepartaments', $allowEditDepartaments);
$tpl->set('user', $UserData);
if (erLhcoreClassUser::instance()->hasAccessTo('lhuser', 'personalcannedmsg')) {
/**
* Canned messages part
* */
$cannedMessage = new erLhcoreClassModelCannedMsg();
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:31,代码来源:account.php
示例15: array_merge
$UserData->all_departments = 1;
$globalDepartament[] = 0;
} else {
$UserData->all_departments = 0;
}
if (count($Errors) == 0) {
$UserData->setPassword($form->Password);
$UserData->email = $form->Email;
$UserData->name = $form->Name;
$UserData->username = $form->Username;
erLhcoreClassUser::getSession()->save($UserData);
if (isset($_POST['UserDepartament']) && count($_POST['UserDepartament']) > 0) {
$globalDepartament = array_merge($_POST['UserDepartament'], $globalDepartament);
}
if (count($globalDepartament) > 0) {
erLhcoreClassUserDep::addUserDepartaments($globalDepartament, $UserData->id, $UserData);
}
erLhcoreClassModelGroupUser::removeUserFromGroups($UserData->id);
foreach ($UserData->user_groups_id as $group_id) {
$groupUser = new erLhcoreClassModelGroupUser();
$groupUser->group_id = $group_id;
$groupUser->user_id = $UserData->id;
$groupUser->saveThis();
}
// Store photo
if (isset($_FILES["UserPhoto"]) && is_uploaded_file($_FILES["UserPhoto"]["tmp_name"]) && $_FILES["UserPhoto"]["error"] == 0 && erLhcoreClassImageConverter::isPhoto('UserPhoto')) {
$dir = 'var/userphoto/' . date('Y') . 'y/' . date('m') . '/' . date('d') . '/' . $UserData->id . '/';
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('user.edit.photo_path', array('dir' => &$dir, 'storage_id' => $UserData->id));
erLhcoreClassFileUpload::mkdirRecursive($dir);
$file = qqFileUploader::upload($_FILES, 'UserPhoto', $dir);
if (empty($file["errors"])) {
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:31,代码来源:new.php
示例16: header
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
header('Content-Type: application/json');
try {
erLhcoreClassRestAPIHandler::validateRequest();
if (isset($_GET['user_id']) && is_numeric($_GET['user_id'])) {
$userData = erLhcoreClassModelUser::fetch((int) $_GET['user_id']);
} elseif (isset($_GET['username']) && !empty($_GET['username'])) {
$userData = erLhcoreClassModelUser::findOne(array('filter' => array('username' => $_GET['username'])));
} elseif (isset($_GET['email']) && !empty($_GET['email'])) {
$userData = erLhcoreClassModelUser::findOne(array('filter' => array('email' => $_GET['email'])));
}
if (!$userData instanceof erLhcoreClassModelUser) {
throw new Exception('User could not be found!');
}
if ($_GET['status'] == 'true') {
$userData->hide_online = 0;
$text = 'flash_on';
} else {
$text = 'flash_off';
$userData->hide_online = 1;
}
$userData->operation_admin .= "\$('#online-offline-user').text('" . $text . "');";
erLhcoreClassUser::getSession()->update($userData);
erLhcoreClassUserDep::setHideOnlineStatus($userData);
erLhcoreClassRestAPIHandler::outputResponse(array('offline' => $userData->hide_online));
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.operator_status_changed', array('user' => &$userData, 'reason' => 'rest_api'));
} catch (Exception $e) {
echo json_encode(array('error' => true, 'result' => $e->getMessage()));
}
exit;
开发者ID:detain,项目名称:livehelperchat,代码行数:31,代码来源:setoperatorstatus.php
示例17:
<?php
$tpl = erLhcoreClassTemplate::getInstance('lhdepartament/edit.tpl.php');
$Departament = erLhcoreClassDepartament::getSession()->load('erLhcoreClassModelDepartament', (int) $Params['user_parameters']['departament_id']);
$userDepartments = true;
/**
* Append user departments filter
* */
if ($currentUser->hasAccessTo('lhdepartment', 'manageall') !== true) {
$userDepartments = erLhcoreClassUserDep::parseUserDepartmetnsForFilter($currentUser->getUserID());
if ($userDepartments !== true) {
if (!in_array($Departament->id, $userDepartments)) {
erLhcoreClassModule::redirect('departament/departaments');
exit;
}
}
}
if (isset($_POST['Cancel_departament'])) {
erLhcoreClassModule::redirect('departament/departaments');
exit;
}
if (isset($_POST['Delete_departament'])) {
if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token']) || !$currentUser->hasAccessTo('lhdepartament', 'delete') || !$Departament->can_delete) {
erLhcoreClassModule::redirect('departament/departaments');
exit;
}
$Departament->removeThis();
erLhcoreClassModule::redirect('departament/departaments');
exit;
}
if (isset($_POST['Update_departament']) || isset($_POST['Save_departament'])) {
开发者ID:sajawalsz,项目名称:WebDealerSolutions,代码行数:31,代码来源:edit.php
示例18: handleOperatorPing
/**
* Handlers requests like
*
* May 08 23:02:11 [Warning] [default] [default] {"action":"ping","user":"[email protected]/25304460891431118632139491"}
* May 08 23:02:14 [Warning] [default] [default] {"action":"disconnect","user":"remdex2","server":"xmpp.livehelperchat.com"}
* May 08 23:21:52 [Warning] [default] [default] {"action":"connect","user":"remdex2","server":"xmpp.livehelperchat.com"}
*/
public static function handleOperatorPing($jsonContent)
{
$params = json_decode($jsonContent, true);
$xmppService = erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice');
// If ping just update last action
if ($params['action'] == 'ping') {
// Parse user parts
$userParts = self::parseXMPPUser($params['user']);
// Fetches user id by xmpp username
$userId = self::getUserIDByXMPPUsername($userParts['xmppuser']);
// Updates last activity
if (is_numeric($userId)) {
self::updateActivityByUserId($userId, time() + $xmppService->settings['append_time']);
} else {
throw new Exception("Could not find LHC user by user - " . $userParts['xmppuser']);
}
} elseif ($params['action'] == 'disconnect' || $params['action'] == 'connect') {
// Fetches user id by xmpp username
$userId = self::getUserIDByXMPPUsername($params['user'] . '@' . $params['server']);
// Updates last activity to zero
if (is_numeric($userId)) {
self::updateActivityByUserId($userId, $params['action'] == 'connect' ? time() + $xmppService->settings['append_time'] : 0);
if ($params['action'] == 'connect') {
$userData = erLhcoreClassModelUser::fetch($userId);
if ($userData instanceof erLhcoreClassModelUser && $userData->hide_online == 1) {
$userData->hide_online = 0;
erLhcoreClassUser::getSession()->update($userData);
erLhcoreClassUserDep::setHideOnlineStatus($userData);
}
}
} else {
throw new Exception("Could not find LHC user by user - " . $params['user'] . '@' . $params['server']);
}
}
return true;
}
开发者ID:noikiy,项目名称:xmpp-chat,代码行数:43,代码来源:erlhcoreclassxmppservicehandler.php
示例19: getSession
public static function getSession()
{
if (!isset(self::$persistentSession)) {
self::$persistentSession = new ezcPersistentSession(ezcDbInstance::get(), new ezcPersistentCodeManager('./pos/lhdepartament'));
}
return self::$persistentSession;
}
开发者ID:remdex,项目名称:livehelperchat,代码行数:7,代码来源:lhuserdep.php
注:本文中的erLhcoreClassUserDep类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论