当前位置: 首页>>代码示例>>PHP>>正文


PHP erLhcoreClassModelUserSetting类代码示例

本文整理汇总了PHP中erLhcoreClassModelUserSetting的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassModelUserSetting类的具体用法?PHP erLhcoreClassModelUserSetting怎么用?PHP erLhcoreClassModelUserSetting使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了erLhcoreClassModelUserSetting类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDirLanguage

 /**
  * This function should be used then value can be override by siteAccess
  * or user language has influence to returned value
  *
  * */
 public function getDirLanguage($attribute = 'dir_language')
 {
     $value = null;
     if ($this->hasSetting('site', $attribute)) {
         $value = $this->getSetting('site', $attribute);
     }
     $siteAccess = erLhcoreClassSystem::instance()->SiteAccess;
     if ($siteAccess == 'site_admin') {
         $valueOverride = $this->getSetting('site_access_options', $siteAccess);
         if (key_exists($attribute, $valueOverride)) {
             // User has not changed default site access language. So just return current value.
             if (erLhcoreClassModelUserSetting::getSetting('user_language', $valueOverride['locale']) == $valueOverride['locale']) {
                 return $valueOverride[$attribute];
             } else {
                 // User has changed default siteaccess language, we need to check does ltr or rtl matches
                 foreach ($this->getSetting('site', 'available_site_access') as $siteaccess) {
                     // Loop untill we find our locate siteaccess and check it's language direction
                     $siteAccessOptions = $this->getSetting('site_access_options', $siteaccess);
                     if ($siteAccessOptions['locale'] == erLhcoreClassModelUserSetting::getSetting('user_language', $valueOverride['locale'])) {
                         return $siteAccessOptions[$attribute];
                     }
                 }
             }
         }
     } else {
         $value = $this->getOverrideValue('site', $attribute);
     }
     return $value;
 }
开发者ID:detain,项目名称:livehelperchat,代码行数:34,代码来源:lhconfig.php

示例2: getSetting

 public static function getSetting($identifier, $default_value, $user_id = false, $noSession = false)
 {
     if ($user_id == false) {
         $currentUser = erLhcoreClassUser::instance();
         if ($currentUser->isLogged()) {
             $user_id = $currentUser->getUserID();
         }
     }
     if ($user_id !== false) {
         $value = CSCacheAPC::getMem()->getSession('settings_user_id_' . $user_id . '_' . $identifier, true);
         if ($value === false && ($value = CSCacheAPC::getMem()->restore('settings_user_id_' . $user_id . '_' . $identifier)) === false) {
             $value = $default_value;
             $list = self::getList(array('filter' => array('user_id' => $user_id, 'identifier' => $identifier)));
             if (count($list) > 0) {
                 $item = array_shift($list);
                 $value = $item->value;
             } else {
                 $item = new erLhcoreClassModelUserSetting();
                 $item->value = $default_value;
                 $item->user_id = $user_id;
                 $item->identifier = $identifier;
                 $item->saveThis();
             }
             CSCacheAPC::getMem()->store('settings_user_id_' . $user_id . '_' . $identifier, $value);
             CSCacheAPC::getMem()->setSession('settings_user_id_' . $user_id . '_' . $identifier, $value, true);
         }
     } else {
         $value = $default_value;
         if ($noSession === false && ($value = CSCacheAPC::getMem()->getSession('anonymous_' . $identifier)) === false) {
             $value = $default_value;
             CSCacheAPC::getMem()->setSession('anonymous_' . $identifier, $value);
         }
     }
     return $value;
 }
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:35,代码来源:erlhcoreclassmodelusersetting.php

示例3: 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

示例4: getSpeechInstance

 public static function getSpeechInstance(erLhcoreClassModelChat $chat)
 {
     $chatLanguageSession = null;
     $chatSpeech = erLhcoreClassModelSpeechChatLanguage::getList(array('filter' => array('chat_id' => $chat->id)));
     if (empty($chatSpeech)) {
         $chatLanguageSession = new erLhcoreClassModelSpeechChatLanguage();
         $chatLanguageSession->chat_id = $chat->id;
         $speechUserLanguage = erLhcoreClassModelUserSetting::getSetting('speech_language', '');
         $speechUserDialect = erLhcoreClassModelUserSetting::getSetting('speech_dialect', '');
         if ($speechUserLanguage != '' && $speechUserDialect != '') {
             $chatLanguageSession->dialect = $speechUserDialect;
             $chatLanguageSession->language_id = $speechUserLanguage;
         } else {
             $speechData = erLhcoreClassModelChatConfig::fetch('speech_data');
             $data = (array) $speechData->data;
             $chatLanguageSession->language_id = $data['language'];
             $chatLanguageSession->dialect = $data['dialect'];
         }
     } else {
         $chatLanguageSession = array_pop($chatSpeech);
     }
     return $chatLanguageSession;
 }
开发者ID:sirromas,项目名称:medical,代码行数:23,代码来源:lhspeech.php

示例5: catch

$modeAppend = '';
if ((string) $Params['user_parameters_unordered']['mode'] == 'embed') {
    $embedMode = true;
    $modeAppend = '/(mode)/embed';
}
if (isset($Params['user_parameters_unordered']['theme']) && (int) $Params['user_parameters_unordered']['theme'] > 0) {
    try {
        $theme = erLhAbstractModelWidgetTheme::fetch($Params['user_parameters_unordered']['theme']);
        $Result['theme'] = $theme;
        $tpl->set('theme', $theme);
        $modeAppend .= '/(theme)/' . $theme->id;
    } catch (Exception $e) {
    }
}
if ($Params['user_parameters_unordered']['sound'] !== null && is_numeric($Params['user_parameters_unordered']['sound'])) {
    erLhcoreClassModelUserSetting::setSetting('chat_message', (int) $Params['user_parameters_unordered']['sound'] == 1 ? 1 : 0);
}
if ($Params['user_parameters_unordered']['cstarted'] !== null && $Params['user_parameters_unordered']['cstarted'] != '') {
    $Result['parent_messages'][] = 'lh_callback:' . (string) strip_tags($Params['user_parameters_unordered']['cstarted']);
}
try {
    $chat = erLhcoreClassChat::getSession()->load('erLhcoreClassModelChat', $Params['user_parameters']['chat_id']);
    erLhcoreClassChat::setTimeZoneByChat($chat);
    if ($chat->hash == $Params['user_parameters']['hash']) {
        $tpl->set('chat_id', $Params['user_parameters']['chat_id']);
        $tpl->set('hash', $Params['user_parameters']['hash']);
        $tpl->set('chat', $chat);
        $tpl->set('chat_widget_mode', true);
        $tpl->set('chat_embed_mode', $embedMode);
        $tpl->set('survey', is_numeric($Params['user_parameters_unordered']['survey']) ? (int) $Params['user_parameters_unordered']['survey'] : false);
        $Result['chat'] = $chat;
开发者ID:Justmfree,项目名称:livehelperchat,代码行数:31,代码来源:chatwidgetchat.php

示例6: explode

        $canListOnlineUsersAll = $currentUser->hasAccessTo('lhuser', 'userlistonlineall');
    }
    $pendingTabEnabled = erLhcoreClassModelUserSetting::getSetting('enable_pending_list', 1);
    $activeTabEnabled = erLhcoreClassModelUserSetting::getSetting('enable_active_list', 1);
    $closedTabEnabled = erLhcoreClassModelUserSetting::getSetting('enable_close_list', 0);
    $unreadTabEnabled = erLhcoreClassModelUserSetting::getSetting('enable_unread_list', 1);
    $frontTabsOrder = explode(',', 'dashboard,online_users,online_map');
    $browserNotification = (int) erLhcoreClassModelUserSetting::getSetting('new_user_bn', (int) 0);
    $soundUserNotification = (int) erLhcoreClassModelUserSetting::getSetting('new_user_sound', (int) 0);
    $onlineDepartment = (int) erLhcoreClassModelUserSetting::getSetting('o_department', (int) 0);
    $ouserTimeout = (int) erLhcoreClassModelUserSetting::getSetting('ouser_timeout', (int) 3600);
    $oupdTimeout = (int) erLhcoreClassModelUserSetting::getSetting('oupdate_timeout', (int) 10);
    $omaxRows = (int) erLhcoreClassModelUserSetting::getSetting('omax_rows', (int) 50);
    $ogroupBy = (string) erLhcoreClassModelUserSetting::getSetting('ogroup_by', 'none');
    $omapDepartment = (int) erLhcoreClassModelUserSetting::getSetting('omap_depid', 0);
    $omapMarkerTimeout = (int) erLhcoreClassModelUserSetting::getSetting('omap_mtimeout', 30);
    $onlineCheck = (int) '0';
    if ($onlineCheck > 0) {
        $onlineCheck = ",online_user:(ou.last_check_time_ago < " . ($onlineCheck + 3) . ")";
    } else {
        $onlineCheck = '';
    }
    ?>
<div ng-controller="OnlineCtrl as online" ng-init='groupByField = <?php 
    echo json_encode($ogroupBy);
    ?>
;online.maxRows=<?php 
    echo (int) $omaxRows;
    ?>
;online.updateTimeout=<?php 
    echo (int) $oupdTimeout;
开发者ID:niravpatel2008,项目名称:north-american-nemesis-new,代码行数:31,代码来源:5d0370c4f43d45420ba48ede3ad4b44f.php

示例7: array

    $tab = 'generalsettings';
}
if (isset($_POST['changeSiteAccess'])) {
    $input->siteaccess = $_POST['siteaccess'];
}
if (isset($_POST['StoreUserSettingsAction'])) {
    $definition = array('language' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'));
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('system/languages');
        exit;
    }
    $Errors = array();
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if ($form->hasValidData('language') && !empty($form->language)) {
        erLhcoreClassModelUserSetting::setSetting('user_language', $form->language);
        // Redirect for change to take effect
        erLhcoreClassModule::redirect('system/languages', '/(updated)/true');
        exit;
    } else {
        $tpl->set('errors', array(erTranslationClassLhTranslation::getInstance()->getTranslation('system/languages', 'Please choose correct language')));
    }
}
if ($currentUser->hasAccessTo('lhsystem', 'configurelanguages')) {
    if (isset($_POST['StoreLanguageSettings'])) {
        $tab = 'generalsettings';
        $definition = array('siteaccess' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'language' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'theme' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'module' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'view' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'));
        if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
            erLhcoreClassModule::redirect('system/languages');
            exit;
        }
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:31,代码来源:languages.php

示例8:

    $validateSpeechData = erLhcoreClassUserValidator::validateSpeech();
    erLhcoreClassModelUserSetting::setSetting('speech_language', $validateSpeechData['speech_language']);
    erLhcoreClassModelUserSetting::setSetting('speech_dialect', $validateSpeechData['speech_dialect']);
    $tpl->set('account_updated', 'done');
    $tpl->set('tab', 'tab_speech');
}
if (erLhcoreClassUser::instance()->hasAccessTo('lhuser', 'change_visibility_list') && isset($_POST['UpdateTabsSettings_account'])) {
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('user/account');
        exit;
    }
    $validateVisibilityListData = erLhcoreClassUserValidator::validateVisibilityList();
    erLhcoreClassModelUserSetting::setSetting('enable_pending_list', $validateVisibilityListData['enable_pending_list']);
    erLhcoreClassModelUserSetting::setSetting('enable_active_list', $validateVisibilityListData['enable_active_list']);
    erLhcoreClassModelUserSetting::setSetting('enable_close_list', $validateVisibilityListData['enable_close_list']);
    erLhcoreClassModelUserSetting::setSetting('enable_unread_list', $validateVisibilityListData['enable_unread_list']);
    $tpl->set('account_updated', 'done');
    $tpl->set('tab', 'tab_settings');
}
if (isset($_POST['Update'])) {
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('user/account');
        exit;
    }
    $Errors = erLhcoreClassUserValidator::validateAccount($UserData);
    if (isset($_POST['DeletePhoto'])) {
        $UserData->removeFile();
    }
    $userPhotoErrors = erLhcoreClassUserValidator::validateUserPhoto($UserData);
    if ($userPhotoErrors !== false) {
        $Errors = array_merge($Errors, $userPhotoErrors);
开发者ID:detain,项目名称:livehelperchat,代码行数:31,代码来源:account.php

示例9: session_write_close

$currentUser = erLhcoreClassUser::instance();
$onlineTimeout = (int) erLhcoreClassModelChatConfig::fetchCache('sync_sound_settings')->data['online_timeout'];
$canListOnlineUsers = false;
$canListOnlineUsersAll = false;
if (erLhcoreClassModelChatConfig::fetchCache('list_online_operators')->current_value == 1) {
    $canListOnlineUsers = $currentUser->hasAccessTo('lhuser', 'userlistonline');
    $canListOnlineUsersAll = $currentUser->hasAccessTo('lhuser', 'userlistonlineall');
}
// We do not need a session anymore
session_write_close();
$ReturnMessages = array();
$pendingTabEnabled = erLhcoreClassModelUserSetting::getSetting('enable_pending_list', 1);
$activeTabEnabled = erLhcoreClassModelUserSetting::getSetting('enable_active_list', 1);
$closedTabEnabled = erLhcoreClassModelUserSetting::getSetting('enable_close_list', 0);
$unreadTabEnabled = erLhcoreClassModelUserSetting::getSetting('enable_unread_list', 1);
$showAllPending = erLhcoreClassModelUserSetting::getSetting('show_all_pending', 1);
$showDepartmentsStats = $currentUser->hasAccessTo('lhuser', 'canseedepartmentstats');
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'];
    }
    $filter['sort'] = 'pending_chats_counter DESC';
    $departments = erLhcoreClassModelDepartament::getList($filter);
    erLhcoreClassChat::prefillGetAttributes($departments, array('id', 'name', 'pending_chats_counter', 'active_chats_counter'), array(), array('remove_all' => true));
开发者ID:kenjiro7,项目名称:livehelperchat,代码行数:31,代码来源:syncadmininterface.php

示例10: array

    } else {
        $tpl->set('errors', $Errors);
    }
}
if (isset($_POST['UpdatePending_account'])) {
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('user/account');
        exit;
    }
    $definition = array('showAllPendingEnabled' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'));
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if ($form->hasValidData('showAllPendingEnabled') && $form->showAllPendingEnabled == true) {
        erLhcoreClassModelUserSetting::setSetting('show_all_pending', 1, $UserData->id);
    } else {
        erLhcoreClassModelUserSetting::setSetting('show_all_pending', 0, $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/userlist');
        exit;
    }
    $globalDepartament = array();
    if (isset($_POST['all_departments']) && $_POST['all_departments'] == 'on') {
        $UserData->all_departments = 1;
        $globalDepartament[] = 0;
    } else {
        $UserData->all_departments = 0;
开发者ID:nagyistoce,项目名称:livehelperchat,代码行数:31,代码来源:edit.php

示例11: foreach

			<form action="<?php 
    echo erLhcoreClassDesign::baseurl('system/languages');
    ?>
" method="post">
    				<?php 
    include erLhcoreClassDesign::designtpl('lhkernel/csfr_token.tpl.php');
    ?>
    				
    				<div class="form-group">
        				<label><?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('system/languages', 'Language');
    ?>
</label> 
        				<select name="language" class="form-control">
        					<?php 
    $userLanguage = erLhcoreClassModelUserSetting::getSetting('user_language', erLhcoreClassSystem::instance()->Language);
    foreach (erLhcoreClassSiteaccessGenerator::getLanguages() as $language) {
        ?>
        						<option value="<?php 
        echo $language['locale'];
        ?>
" <?php 
        $userLanguage == $language['locale'] ? print 'selected="selected"' : '';
        ?>
><?php 
        echo $language['locale'];
        ?>
</option>
        					<?php 
    }
    ?>
开发者ID:niravpatel2008,项目名称:north-american-nemesis-new,代码行数:31,代码来源:languages.tpl.php

示例12: array

$supportedWidgets = array('online_operators' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/dashboardwidgets', 'Online operators'), 'active_chats' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/dashboardwidgets', 'Active chats'), 'online_visitors' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/dashboardwidgets', 'Online visitors'), 'departments_stats' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/dashboardwidgets', 'Departments stats'), 'pending_chats' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/dashboardwidgets', 'Pending chats'), 'unread_chats' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/dashboardwidgets', 'Unread chats'), 'transfered_chats' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/dashboardwidgets', 'Transfered chats'), 'closed_chats' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/dashboardwidgets', 'Closed chats'));
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.dashboardwidgets', array('supported_widgets' => &$supportedWidgets));
if (ezcInputForm::hasPostData()) {
    $definition = array('WidgetsUser' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY));
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if ($form->hasValidData('WidgetsUser') && !empty($form->WidgetsUser)) {
        // Add new widgets
        foreach ($form->WidgetsUser as $newUserWidget) {
            if (!in_array($newUserWidget, $widgetsUser)) {
                $dashboardOrderString = $newUserWidget . ',' . $dashboardOrderString;
                $widgetsUser[] = $newUserWidget;
            }
        }
        // Remove removed widgets
        foreach ($widgetsUser as $userWidget) {
            if (!in_array($userWidget, $form->WidgetsUser)) {
                $dashboardOrderString = str_replace($userWidget, '', $dashboardOrderString);
                unset($widgetsUser[array_search($userWidget, $widgetsUser)]);
            }
        }
        // Just cleanup
        $dashboardOrderString = str_replace(array(',,', ',,,', ',,,,', '|,', ',|'), array(',', ',', ',', '|', '|'), $dashboardOrderString);
        // Store settings in user scope now
        erLhcoreClassModelUserSetting::setSetting('dwo', $dashboardOrderString);
        $tpl->set('updated', true);
    }
}
$tpl->setArray(array('widgets' => $supportedWidgets, 'user_widgets' => $widgetsUser));
echo $tpl->fetch();
exit;
开发者ID:keramist,项目名称:livehelperchat,代码行数:31,代码来源:dashboardwidgets.php

示例13: array

active<?php 
    }
    ?>
" id="speech">

		<form action="<?php 
    echo erLhcoreClassDesign::baseurl('user/account');
    ?>
" method="post">

	  	<?php 
    include erLhcoreClassDesign::designtpl('lhkernel/csfr_token.tpl.php');
    ?>

	  	<?php 
    $dataSpeech = array('language' => (int) erLhcoreClassModelUserSetting::getSetting('speech_language', ''), 'dialect' => (int) erLhcoreClassModelUserSetting::getSetting('speech_dialect', ''), 'optional' => true);
    ?>
	  	
		<?php 
    include erLhcoreClassDesign::designtpl('lhspeech/speech_form_fields.tpl.php');
    ?>
		
		<input type="submit" class="btn btn-default" name="UpdateSpeech_account" value="<?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('user/account', 'Update');
    ?>
" />

		</form>
	</div>
  <?php 
}
开发者ID:oscarmp4,项目名称:livehelperchat,代码行数:31,代码来源:account.tpl.php

示例14: json_encode

<?php

// Make sure that we support variable which is setting now
// It was possible in another portal to cheat, and overload server without this type of checking
try {
    // Start session if required only
    $currentUser = erLhcoreClassUser::instance();
    if (!isset($_SERVER['HTTP_X_CSRFTOKEN']) || !$currentUser->validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) {
        echo json_encode(array('error' => 'true', 'result' => 'Invalid CSRF Token'));
        exit;
    }
    $settingHandler = erLhcoreClassModelUserSettingOption::fetch($Params['user_parameters']['identifier']);
    // Never trust user input
    erLhcoreClassModelUserSetting::setSetting($Params['user_parameters']['identifier'], (string) $_POST['value']);
    exit;
} catch (Exception $e) {
    print_r($e);
}
exit;
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:19,代码来源:setsettingajaxraw.php

示例15: getInstance

 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         $sysConfiguration = erLhcoreClassSystem::instance();
         $urlCfgDefault = ezcUrlConfiguration::getInstance();
         $urlCfgDefault->basedir = $sysConfiguration->WWWDir;
         $urlCfgDefault->script = $sysConfiguration->IndexFile;
         $urlCfgDefault->unorderedDelimiters = array('(', ')');
         $urlCfgDefault->orderedParameters = array();
         $urlCfgDefault->unorderedParameters = array();
         $urlCfgDefault->addOrderedParameter('siteaccess');
         $urlCfgDefault->addOrderedParameter('module');
         $urlCfgDefault->addOrderedParameter('function');
         $cfgSite = erConfigClassLhConfig::getInstance();
         $urlInstance = new erLhcoreClassURL(($cfgSite->getSetting('site', 'force_virtual_host', false) === false ? 'index.php' : '') . $sysConfiguration->RequestURI, $urlCfgDefault);
         $siteaccess = $urlInstance->getParam('siteaccess');
         $availableSiteaccess = $cfgSite->getSetting('site', 'available_site_access');
         $defaultSiteAccess = $cfgSite->getSetting('site', 'default_site_access');
         if ($defaultSiteAccess != $siteaccess && in_array($siteaccess, $availableSiteaccess)) {
             $optionsSiteAccess = $cfgSite->getSetting('site_access_options', $siteaccess);
             $sysConfiguration->Language = $siteaccess == 'site_admin' ? erLhcoreClassModelUserSetting::getSetting('user_language', $optionsSiteAccess['locale'], false, true) : $optionsSiteAccess['locale'];
             $sysConfiguration->ThemeSite = $optionsSiteAccess['theme'];
             $sysConfiguration->ContentLanguage = $optionsSiteAccess['content_language'];
             $sysConfiguration->WWWDirLang = '/' . $siteaccess;
             $sysConfiguration->SiteAccess = $siteaccess;
             if ($optionsSiteAccess['locale'] != 'en_EN') {
                 $urlInstance->setParam('module', $urlInstance->getParam('module'));
                 $urlInstance->setParam('function', $urlInstance->getParam('function'));
             }
             if (isset($_POST['switchLang']) && in_array($_POST['switchLang'], $availableSiteaccess)) {
                 $optionsSiteAccessOverride = $cfgSite->getSetting('site_access_options', $_POST['switchLang']);
                 $sysConfiguration->Language = $optionsSiteAccessOverride['locale'];
                 $sysConfiguration->SiteAccess = $_POST['switchLang'];
                 if ($defaultSiteAccess != $sysConfiguration->SiteAccess) {
                     $sysConfiguration->WWWDirLang = '/' . $sysConfiguration->SiteAccess;
                 } else {
                     $sysConfiguration->WWWDirLang = '';
                 }
             }
         } else {
             $optionsSiteAccess = $cfgSite->getSetting('site_access_options', $defaultSiteAccess);
             // Falling back
             $sysConfiguration->SiteAccess = $defaultSiteAccess;
             $sysConfiguration->Language = $siteaccess == 'site_admin' ? erLhcoreClassModelUserSetting::getSetting('user_language', $optionsSiteAccess['locale'], false, true) : $optionsSiteAccess['locale'];
             $sysConfiguration->ThemeSite = $optionsSiteAccess['theme'];
             $sysConfiguration->ContentLanguage = $optionsSiteAccess['content_language'];
             if (isset($_POST['switchLang']) && in_array($_POST['switchLang'], $availableSiteaccess)) {
                 $optionsSiteAccessOverride = $cfgSite->getSetting('site_access_options', $_POST['switchLang']);
                 $sysConfiguration->Language = $optionsSiteAccessOverride['locale'];
                 $sysConfiguration->SiteAccess = $_POST['switchLang'];
                 if ($defaultSiteAccess != $sysConfiguration->SiteAccess) {
                     $sysConfiguration->WWWDirLang = '/' . $sysConfiguration->SiteAccess;
                 }
             }
             // To reset possition counter
             $urlCfgDefault->removeOrderedParameter('siteaccess');
             $urlCfgDefault->removeOrderedParameter('module');
             $urlCfgDefault->removeOrderedParameter('function');
             // Reinit parameters
             $urlCfgDefault->addOrderedParameter('module');
             $urlCfgDefault->addOrderedParameter('function');
             //Apply default configuration
             $urlInstance->applyConfiguration($urlCfgDefault);
             if ($optionsSiteAccess['locale'] != 'en_EN') {
                 $urlInstance->setParam('module', $urlInstance->getParam('module'));
                 $urlInstance->setParam('function', $urlInstance->getParam('function'));
             }
         }
         self::$instance = $urlInstance;
     }
     return self::$instance;
 }
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:72,代码来源:lhurl.php


注:本文中的erLhcoreClassModelUserSetting类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。