本文整理汇总了PHP中erConfigClassLhConfig类的典型用法代码示例。如果您正苦于以下问题:PHP erConfigClassLhConfig类的具体用法?PHP erConfigClassLhConfig怎么用?PHP erConfigClassLhConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了erConfigClassLhConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createDB
public static function createDB($client_id)
{
$cfg = erConfigClassLhConfig::getInstance();
self::deleteDB($client_id);
$db = ezcDbInstance::get();
$db->query('CREATE DATABASE ' . $cfg->getSetting('db', 'database_user_prefix') . $client_id . ';');
}
示例2: __construct
public function __construct()
{
$this->memcache = new Memcache();
$hosts = erConfigClassLhConfig::getInstance()->getSetting('memecache', 'servers');
foreach ($hosts as $server) {
$this->memcache->addServer($server['host'], $server['port'], $server['weight']);
}
}
示例3: createDB
public static function createDB($client_id)
{
$cfg = erConfigClassLhConfig::getInstance();
$sock = new HTTPSocket();
$sock->connect('ssl://' . $cfg->getSetting('site', 'direct_admin_ip'), $cfg->getSetting('site', 'direct_admin_port'));
$sock->set_login($cfg->getSetting('site', 'direct_admin_user'), $cfg->getSetting('site', 'direct_admin_pass'));
$sock->set_method('POST');
$sock->query('/CMD_API_DATABASES', array('action' => 'create', 'name' => "client{$client_id}", 'userlist' => $cfg->getSetting('site', 'direct_admin_dbuser'), 'passwd' => $cfg->getSetting('site', 'direct_admin_dbpass'), 'passwd2' => $cfg->getSetting('site', 'direct_admin_dbpass')));
return $sock->fetch_body();
}
示例4: __construct
public function __construct()
{
try {
$params = erConfigClassLhConfig::getInstance()->getSetting('redis', 'server');
$this->redis = new Redis();
$this->redis->connect($params['host'], $params['port'], 2.5);
$this->redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
} catch (Exception $e) {
// Do nothing
}
}
示例5: updateSiteAccess
public static function updateSiteAccess(stdClass $input)
{
$languages = self::getLanguages();
$languageData = $languages[$input->language];
$siteAccessData = erConfigClassLhConfig::getInstance()->getSetting('site_access_options', $input->siteaccess);
$siteAccessData['locale'] = $languageData['locale'];
$siteAccessData['content_language'] = $languageData['content_language'];
$siteAccessData['dir_language'] = $languageData['dir_language'];
$siteAccessData['theme'] = self::trimArrayElements(explode("\n", trim($input->theme)));
$siteAccessData['default_url']['module'] = $input->module;
$siteAccessData['default_url']['view'] = $input->view;
$cfgSite = erConfigClassLhConfig::getInstance();
$cfgSite->setSetting('site_access_options', $input->siteaccess, $siteAccessData);
$cfgSite->save();
}
示例6: setupInstance
public static function setupInstance($db)
{
if (isset($_SERVER['HTTP_HOST'])) {
$cfg = erConfigClassLhConfig::getInstance();
$subdomain = str_replace('.' . $cfg->getSetting('site', 'seller_domain'), '', $_SERVER['HTTP_HOST']);
$items = erLhcoreClassModelInstance::getList(array('filter' => array('address' => $subdomain)));
if (!empty($items)) {
erLhcoreClassInstance::$instanceChat = array_shift($items);
$db->query('USE ' . $cfg->getSetting('db', 'database_user_prefix') . erLhcoreClassInstance::$instanceChat->id);
} else {
header('Location: ' . $cfg->getSetting('site', 'seller_url'));
exit;
}
}
}
示例7: setupInstance
public static function setupInstance($db)
{
if (isset($_SERVER['HTTP_HOST'])) {
$cfg = erConfigClassLhConfig::getInstance();
$subdomain = str_replace('.' . $cfg->getSetting('site', 'seller_domain'), '', $_SERVER['HTTP_HOST']);
$session = erLhcoreClassInstance::getSession();
$q = $session->createFindQuery('erLhcoreClassModelInstance');
$q->where($q->expr->eq('address', $q->bindValue($subdomain)) . ' OR (full_domain = 1 AND ' . $q->expr->eq('address', $q->bindValue($_SERVER['HTTP_HOST'])) . ')');
$items = $session->find($q);
if (!empty($items)) {
erLhcoreClassInstance::$instanceChat = array_shift($items);
$db->query('USE ' . $cfg->getSetting('db', 'database_user_prefix') . erLhcoreClassInstance::$instanceChat->id);
} else {
header('Location: ' . $cfg->getSetting('site', 'seller_url'));
exit;
}
}
}
示例8: sevabot
/**
* Arguments
* array('chat' => & $chat)
* */
public function sevabot($params)
{
$settings = (include 'extension/sevabot/settings/settings.ini.php');
// Format message content
$chat = $params['chat'];
$messages = array_reverse(erLhcoreClassModelmsg::getList(array('limit' => 5, 'sort' => 'id DESC', 'filter' => array('chat_id' => $chat->id))));
$messagesContent = '';
foreach ($messages as $msg) {
if ($msg->user_id == -1) {
$messagesContent .= date(erLhcoreClassModule::$dateDateHourFormat, $msg->time) . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmin', 'System assistant') . ': ' . htmlspecialchars($msg->msg) . "\n";
} else {
$messagesContent .= date(erLhcoreClassModule::$dateDateHourFormat, $msg->time) . ' ' . ($msg->user_id == 0 ? htmlspecialchars($chat->nick) : htmlspecialchars($msg->name_support)) . ': ' . htmlspecialchars($msg->msg) . "\n";
}
}
$cfgSite = erConfigClassLhConfig::getInstance();
$secretHash = $cfgSite->getSetting('site', 'secrethash');
$chatDataItems = $settings['chat'];
if (isset($settings['chat_dep'][$chat->dep_id]) && !empty($settings['chat_dep'][$chat->dep_id])) {
$chatDataItems = array_merge($chatDataItems, $settings['chat_dep'][$chat->dep_id]);
}
// Global notifications
foreach ($chatDataItems as $chatData) {
$veryfyEmail = sha1(sha1($chatData['email'] . $secretHash) . $secretHash);
$msgParsed = str_replace(array('{messages}', '{url_accept}', '{chat_id}', '{user_name}'), array($messagesContent, erLhcoreClassXMP::getBaseHost() . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurl('chat/accept') . '/' . erLhcoreClassModelChatAccept::generateAcceptLink($chat) . '/' . $veryfyEmail . '/' . $chatData['email'], $chat->id, $chat->user_name), $settings['msg']);
$md5 = md5($chatData['chat_id'] . $msgParsed . $settings['sevabot_secret']);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $settings['url']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('md5' => $md5, 'msg' => $msgParsed, 'chat' => $chatData['chat_id']));
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
// Some hostings produces wargning...
$content = curl_exec($ch);
if ($content != 'OK') {
erLhcoreClassLog::write(print_r($content, true));
}
}
}
示例9:
?>
</div>
</div>
<?php
}
?>
</div>
<?php
}
?>
</div>
<?php
include_once erLhcoreClassDesign::designtpl('pagelayouts/parts/page_footer.tpl.php');
?>
</div>
</div>
<?php
if (erConfigClassLhConfig::getInstance()->getSetting('site', 'debug_output') == true) {
$debug = ezcDebug::getInstance();
echo $debug->generateOutput();
}
?>
</body>
</html>
示例10: dirname
{
ezcBase::autoload($className);
}
ezcBase::addClassRepository(dirname(__FILE__) . '/', dirname(__FILE__) . '/lib/autoloads');
$input = new ezcConsoleInput();
$helpOption = $input->registerOption(new ezcConsoleOption('s', 'siteaccess', ezcConsoleInput::TYPE_STRING));
$cronjobPartOption = $input->registerOption(new ezcConsoleOption('c', 'cronjob', ezcConsoleInput::TYPE_STRING));
$cronjobPathOption = $input->registerOption(new ezcConsoleOption('p', 'path', ezcConsoleInput::TYPE_STRING));
$extensionPartOption = $input->registerOption(new ezcConsoleOption('e', 'extension', ezcConsoleInput::TYPE_STRING));
try {
$input->process();
} catch (ezcConsoleOptionException $e) {
die($e->getMessage());
}
ezcBaseInit::setCallback('ezcInitDatabaseInstance', 'erLhcoreClassLazyDatabaseConfiguration');
$instance = erLhcoreClassSystem::instance();
$instance->SiteAccess = $helpOption->value;
$instance->SiteDir = dirname(__FILE__) . '/';
$cfgSite = erConfigClassLhConfig::getInstance();
$defaultSiteAccess = $cfgSite->getSetting('site', 'default_site_access');
$optionsSiteAccess = $cfgSite->getSetting('site_access_options', $helpOption->value);
$instance->Language = $optionsSiteAccess['locale'];
$instance->ThemeSite = $optionsSiteAccess['theme'];
$instance->WWWDirLang = '/' . $helpOption->value;
// php cron.php -s site_admin -c cron/workflow
// php cron.php -s site_admin -e customstatus -c cron/customcron
if ($extensionPartOption->value) {
include_once 'extension/' . $extensionPartOption->value . '/modules/lh' . $cronjobPartOption->value . '.php';
} else {
include_once 'modules/lh' . $cronjobPartOption->value . '.php';
}
示例11: foreach
<?php
/**
* Iterates through all instances and executes callback timeout
* At the moment it's a simple foreach. In the future we may need to enahance this part
* with some queues etc.
*
* php cron.php -s site_admin -e instance -c cron/extensions_update
* */
$cfg = erConfigClassLhConfig::getInstance();
$db = ezcDbInstance::get();
foreach (erLhcoreClassModelInstance::getList(array('limit' => 1000000, 'filter' => array('status' => erLhcoreClassModelInstance::WORKING))) as $instance) {
echo "Executing request to update instance internal structure for extensions - ", $instance->id, "\n";
$secretHash = $cfg->getSetting('site', 'seller_secret_hash');
$hash = sha1($instance->id . 'extensions' . date('Ym') . $secretHash);
if ($instance->full_domain == 1) {
$url = erConfigClassLhConfig::getInstance()->getSetting('site', 'http_mode') . $instance->address . '/index.php/instance/extensionsstructure/' . $instance->id . '/' . date('Ym') . '/' . $hash;
} else {
$url = erConfigClassLhConfig::getInstance()->getSetting('site', 'http_mode') . $instance->address . '.' . $cfg->getSetting('site', 'seller_domain') . '/index.php/instance/extensionsstructure/' . $instance->id . '/' . date('Ym') . '/' . $hash;
}
$response = erLhcoreClassModelChatOnlineUser::executeRequest($url);
echo "Response:\n";
print_r($response);
echo PHP_EOL;
}
示例12: array
}
if ($form->hasValidData('hattr') && !empty($form->hattr)) {
$inputData->hattr = $form->hattr;
}
$inputData->name_items = $form->name_items;
$stringParts = array();
foreach ($form->name_items as $key => $name_item) {
if (isset($inputData->values_req[$key]) && $inputData->values_req[$key] == 't' && ($inputData->value_show[$key] == 'b' || $inputData->value_show[$key] == (isset($additionalParams['offline']) ? 'off' : 'on')) && (!isset($valuesArray[$key]) || trim($valuesArray[$key]) == '')) {
$Errors[] = trim($name_item) . ' : ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'is required');
}
$stringParts[] = array('key' => $name_item, 'value' => isset($valuesArray[$key]) ? trim($valuesArray[$key]) : '');
}
$chat->additional_data = json_encode($stringParts);
}
if (erLhcoreClassModelChatConfig::fetch('session_captcha')->current_value == 1) {
if (!$form->hasValidData($nameField) || $form->{$nameField} == '' || $form->{$nameField} < time() - 600 || $hashCaptcha != sha1($_SERVER['REMOTE_ADDR'] . $form->{$nameField} . erConfigClassLhConfig::getInstance()->getSetting('site', 'secrethash'))) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Invalid captcha code, please enable Javascript!');
}
} else {
// Captcha validation
if (!$form->hasValidData($nameField) || $form->{$nameField} == '' || $form->{$nameField} < time() - 600) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Invalid captcha code, please enable Javascript!');
}
}
if ($form->hasValidData('operator') && erLhcoreClassModelUser::getUserCount(array('filter' => array('id' => $form->operator, 'disabled' => 0))) > 0) {
$inputData->operator = $chat->user_id = $form->operator;
}
if ($form->hasValidData('user_timezone')) {
$timezone_name = timezone_name_from_abbr(null, $form->user_timezone * 3600, true);
if ($timezone_name !== false) {
$chat->user_tz_identifier = $timezone_name;
示例13: foreach
<?php
$tpl = erLhcoreClassTemplate::getInstance('lhchat/listchatconfig.tpl.php');
if ($currentUser->hasAccessTo('lhchat', 'administrateconfig')) {
if (isset($_POST['UpdateConfig'])) {
foreach (erLhcoreClassModelChatConfig::getItems() as $item) {
$ConfigData = erLhcoreClassModelChatConfig::fetch($item->identifier);
switch ($ConfigData->type) {
case erLhcoreClassModelChatConfig::SITE_ACCESS_PARAM_ON:
$data = array();
foreach (erConfigClassLhConfig::getInstance()->getSetting('site', 'available_site_access') as $siteaccess) {
$data[$siteaccess] = $_POST[$item->identifier . 'Value' . $siteaccess];
}
$ConfigData->value = serialize($data);
break;
case erLhcoreClassModelChatConfig::SITE_ACCESS_PARAM_OFF:
$ConfigData->value = isset($_POST[$item->identifier . 'ValueParam']) ? $_POST[$item->identifier . 'ValueParam'] : 0;
break;
default:
break;
}
$ConfigData->saveThis();
}
// Cleanup cache to recompile templates etc.
$CacheManager = erConfigClassLhCacheConfig::getInstance();
$CacheManager->expireCache();
$tpl->set('updated', 'done');
}
}
$tpl->set('currentUser', $currentUser);
$Result['content'] = $tpl->fetch();
示例14: htmlspecialchars
echo htmlspecialchars(erLhcoreClassModelChatConfig::fetch('application_name')->current_value);
?>
</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<link rel="icon" type="image/png" href="<?php
echo erLhcoreClassDesign::design('images/favicon.ico');
?>
" />
<link rel="shortcut icon" type="image/x-icon" href="<?php
echo erLhcoreClassDesign::design('images/favicon.ico');
?>
">
<meta name="Keywords" content="" />
<meta name="Description" content="<?php
echo erConfigClassLhConfig::getInstance()->getOverrideValue('site', 'description');
?>
" />
<meta name="robots" content="noindex, nofollow">
<?php
include_once erLhcoreClassDesign::designtpl('pagelayouts/parts/copyright_meta.tpl.php');
?>
<?php
include_once erLhcoreClassDesign::designtpl('pagelayouts/parts/page_head_css.tpl.php');
include_once erLhcoreClassDesign::designtpl('pagelayouts/parts/page_head_css_admin_theme.tpl.php');
include_once erLhcoreClassDesign::designtpl('pagelayouts/parts/page_head_css_extension_multiinclude.tpl.php');
?>
<?php
示例15: newChatInformWorkflow
public static function newChatInformWorkflow($options = array(), &$chat)
{
$chat->nc_cb_executed = 1;
$chat->updateThis();
if (in_array('mail', $options['options'])) {
erLhcoreClassChatMail::sendMailUnacceptedChat($chat);
}
if (in_array('xmp', $options['options'])) {
erLhcoreClassXMP::sendXMPMessage($chat);
}
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.new_chat', array('chat' => &$chat));
// Execute callback if it exists
$extensions = erConfigClassLhConfig::getInstance()->getSetting('site', 'extensions');
$instance = erLhcoreClassSystem::instance();
foreach ($extensions as $ext) {
$callbackFile = $instance->SiteDir . '/extension/' . $ext . '/callbacks/new_chat.php';
if (file_exists($callbackFile)) {
include $callbackFile;
}
}
}