public function initLanguage() { $sys = erLhcoreClassSystem::instance()->SiteDir; $this->languageCode = erLhcoreClassSystem::instance()->Language; $cfg = erConfigClassLhCacheConfig::getInstance(); if ($this->languageCode != 'en_EN') { $this->translationFileModifyTime = filemtime($sys . '/translations/' . $this->languageCode . '/translation.xml'); if ($cfg->getSetting('cachetimestamps', 'translationfile') != $this->translationFileModifyTime) { $this->updateCache(); $cfg->setSetting('cachetimestamps', 'translationfile', $this->translationFileModifyTime); $cfg->save(); } $this->cacheObj = new ezcCacheStorageFileArray($sys . '/cache/translations'); $this->backend = new ezcTranslationCacheBackend($this->cacheObj); $this->manager = new ezcTranslationManager($this->backend); } }
} if ($form->hasValidData('HideFor')) { $data['hide_for'] = $form->HideFor; } else { $data['hide_for'] = ''; } if ($form->hasValidData('OtherStatus')) { $data['other_status'] = $form->OtherStatus; } else { $data['other_status'] = ''; } if ($form->hasValidData('RestStatus')) { $data['rest_status'] = $form->RestStatus; } else { $data['rest_status'] = ''; } if ($form->hasValidData('ApplyWidget')) { $data['apply_widget'] = 1; } else { $data['apply_widget'] = 0; } } $geoData->value = serialize($data); $geoData->saveThis(); $CacheManager = erConfigClassLhCacheConfig::getInstance(); $CacheManager->expireCache(); $tpl->set('updated', 'done'); } $tpl->set('geo_data', $data); $Result['content'] = $tpl->fetch(); $Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'System configuration')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/geoadjustment', 'GEO adjustment')));
function accessArray() { if ($this->AccessArray !== false) { return $this->AccessArray; } if (isset($_SESSION['lhc_access_array'])) { $this->AccessArray = $_SESSION['lhc_access_array']; $this->AccessTimestamp = $_SESSION['lhc_access_timestamp']; return $this->AccessArray; /* For future * $cacheObj = CSCacheAPC::getMem(); if (($AccessTimestamp = $cacheObj->restore('cachetimestamp_accessfile_version_'.$cacheObj->getCacheVersion('site_version'))) === false) { $cfg = erConfigClassLhCacheConfig::getInstance(); $AccessTimestamp = $cfg->getSetting( 'cachetimestamps', 'accessfile' ); $cacheObj->store('cachetimestamp_accessfile_version_'.$cacheObj->getCacheVersion('site_version'),$AccessTimestamp); } if ( $this->AccessTimestamp === $AccessTimestamp) { return $this->AccessArray; }*/ } $cfg = erConfigClassLhCacheConfig::getInstance(); $_SESSION['lhc_access_timestamp'] = $this->AccessTimestamp = $cfg->getSetting('cachetimestamps', 'accessfile'); $_SESSION['lhc_access_array'] = $this->AccessArray = $this->generateAccessArray(); if ($this->AccessTimestamp < time()) { $AccessTimestamp = time() + 60 * 60 * 24 * 1; $cfg->setSetting('cachetimestamps', 'accessfile', $AccessTimestamp); $cfg->save(); $_SESSION['lhc_access_timestamp'] = $this->AccessTimestamp = $AccessTimestamp; } return $this->AccessArray; }
public function run() { $dispatcher = erLhcoreClassChatEventDispatcher::getInstance(); // Attatch event listeners $dispatcher->listen('user.edit.photo_path', array($this, 'userEditPhotoPath')); $dispatcher->listen('chat.getstatus', array($this, 'getStatus')); $dispatcher->listen('file.storescreenshot.screenshot_path', array($this, 'screenshotPath')); $dispatcher->listen('file.uploadfile.file_path', array($this, 'screenshotPath')); $dispatcher->listen('file.uploadfileadmin.file_path', array($this, 'screenshotPath')); $dispatcher->listen('file.new.file_path', array($this, 'newFilePath')); // Themes listeners $dispatcher->listen('theme.edit.logo_image_path', array($this, 'themeStoragePath')); $dispatcher->listen('theme.edit.need_help_image_path', array($this, 'themeStoragePath')); $dispatcher->listen('theme.edit.offline_image_path', array($this, 'themeStoragePath')); $dispatcher->listen('theme.edit.online_image_path', array($this, 'themeStoragePath')); $dispatcher->listen('theme.edit.copyright_image_path', array($this, 'themeStoragePath')); $dispatcher->listen('theme.edit.operator_image_path', array($this, 'themeStoragePath')); $dispatcher->listen('theme.edit.popup_image_path', array($this, 'themeStoragePath')); $dispatcher->listen('theme.edit.close_image_path', array($this, 'themeStoragePath')); $dispatcher->listen('theme.edit.restore_image_path', array($this, 'themeStoragePath')); $dispatcher->listen('theme.edit.minimize_image_path', array($this, 'themeStoragePath')); // Permissions $dispatcher->listen('feature.can_use_forms', array($this, 'canUseForms')); $dispatcher->listen('form.index', array($this, 'canUseForms')); $dispatcher->listen('form.embedcode', array($this, 'canUseForms')); // Canned messages $dispatcher->listen('chat.cannedmsg', array($this, 'canUseCannedMessages')); $dispatcher->listen('chat.newcannedmsg', array($this, 'canUseCannedMessages')); // FAQ $dispatcher->listen('faq.list', array($this, 'canUseFAQ')); $dispatcher->listen('faq.view', array($this, 'canUseFAQ')); // SugarCRM $dispatcher->listen('sugarcrm.createorupdatelead', array($this, 'canUseSugarCRM')); // Browse offers $dispatcher->listen('browseoffer.index', array($this, 'canUseBO')); $dispatcher->listen('browseoffer.htmlcode', array($this, 'canUseBO')); $dispatcher->listen('feature.can_use_browse_offers', array($this, 'canUseBO')); // Questionary $dispatcher->listen('questionary.edit', array($this, 'canUseQuestionary')); $dispatcher->listen('questionary.list', array($this, 'canUseQuestionary')); $dispatcher->listen('questionary.new', array($this, 'canUseQuestionary')); // Chatbox $dispatcher->listen('chatbox.list', array($this, 'canUseChatbox')); $dispatcher->listen('chatbox.configuration', array($this, 'canUseChatbox')); // Statistic $dispatcher->listen('chat.statistic', array($this, 'canUseStatistic')); // Pro active $dispatcher->listen('feature.can_use_proactive', array($this, 'canUseProactive')); // Auto responder $dispatcher->listen('feature.can_use_autoresponder', array($this, 'canUseAutoresponder')); $dispatcher->listen('chat.geoadjustment', array($this, 'canUseGeoAdjustment')); // Block users $dispatcher->listen('chat.blockedusers', array($this, 'canUseBlock')); // XMPP send message action $dispatcher->listen('xml.send_xmp_message', array($this, 'xmppSendMessage')); // Automated hosting overrides mail sending parameters $dispatcher->listen('chatmail.setup_smtp', array($this, 'setupSMTP')); // temporary path $dispatcher->listen('theme.temppath', array($this, 'tempStoragePath')); // Disable database variables cache $dispatcher->listen('tpl.new', array($this, 'changeTemplateSettings')); // Forms module listener $dispatcher->listen('form.fill.file_path', array($this, 'formFillPath')); $dispatcher->listen('xmp.configuration', array($this, 'canUseXMPP')); // Translation config $dispatcher->listen('translation.get_config', array($this, 'getTranslationConfig')); // Check can user create a new operators $dispatcher->listen('user.new_user', array($this, 'canNewUserCanBeCreated')); $dispatcher->listen('user.edit_user', array($this, 'canUserBeSaved')); $dispatcher->listen('chat.sendnotice', array($this, 'canSendNotice')); $dispatcher->listen('chat.chatcheckoperatormessage', array($this, 'proactiveIsEnabled')); $instanceCustomer = erLhcoreClassInstance::getInstance(); if (is_object($instanceCustomer)) { erLhcoreClassModule::$cacheDbVariables = false; // Disable cache expire for customers, only through command line possible erConfigClassLhCacheConfig::getInstance()->setExpiredInRuntime(true); erLhcoreClassModule::$defaultTimeZone = $instanceCustomer->time_zone; erLhcoreClassModule::$dateFormat = $instanceCustomer->date_format; erLhcoreClassModule::$dateHourFormat = $instanceCustomer->date_hour_format; erLhcoreClassModule::$dateDateHourFormat = $instanceCustomer->date_date_hour_format; // Check one logged user per account if ($instanceCustomer->one_per_account == 1) { // Set instance policy regarding how many operators can be looged under same account erLhcoreClassUser::$oneLoginPerAccount = $instanceCustomer->one_per_account == 1; } $cfgSite = erConfigClassLhConfig::getInstance(); $sysConfiguration = erLhcoreClassSystem::instance(); $defaultSiteAccess = $cfgSite->getSetting('site', 'default_site_access'); // Perhaps we need to change default siteaccess if ($sysConfiguration->SiteAccess != 'site_admin' && $sysConfiguration->SiteAccess == $defaultSiteAccess && !isset($_POST['switchLang']) && $instanceCustomer->siteaccess != '' && $instanceCustomer->siteaccess != $sysConfiguration->SiteAccess) { $optionsSiteAccessOverride = $cfgSite->getSetting('site_access_options', $instanceCustomer->siteaccess); $sysConfiguration->Language = $optionsSiteAccessOverride['locale']; $sysConfiguration->SiteAccess = $instanceCustomer->siteaccess; $sysConfiguration->ContentLanguage = $optionsSiteAccessOverride['content_language']; $sysConfiguration->ThemeSite = $optionsSiteAccessOverride['theme']; if ($defaultSiteAccess != $sysConfiguration->SiteAccess) { $sysConfiguration->WWWDirLang = '/' . $sysConfiguration->SiteAccess; } } } }
static function runModule() { if (isset(self::$currentModule[self::$currentView])) { $Params = array(); $Params['module'] = self::$currentModule[self::$currentView]; $Params['module']['name'] = self::$currentModule; $Params['module']['view'] = self::$currentView; $urlCfgDefault = ezcUrlConfiguration::getInstance(); $url = erLhcoreClassURL::getInstance(); self::$currentModule[self::$currentView]['uparams'][] = 'page'; foreach (self::$currentModule[self::$currentView]['params'] as $userParameter) { $urlCfgDefault->addOrderedParameter($userParameter); } foreach (self::$currentModule[self::$currentView]['uparams'] as $userParameter) { $urlCfgDefault->addUnorderedParameter($userParameter, isset(self::$currentModule[self::$currentView]['multiple_arguments']) && in_array($userParameter, self::$currentModule[self::$currentView]['multiple_arguments']) ? ezcUrlConfiguration::MULTIPLE_ARGUMENTS : null); } $url->applyConfiguration($urlCfgDefault); foreach (array_merge(self::$currentModule[self::$currentView]['uparams'], self::$currentModule[self::$currentView]['params']) as $userParameter) { $Params[in_array($userParameter, self::$currentModule[self::$currentView]['params']) ? 'user_parameters' : 'user_parameters_unordered'][$userParameter] = $url->getParam($userParameter); } // Function set, check permission if (isset($Params['module']['functions'])) { // Just to start session $currentUser = erLhcoreClassUser::instance(); if (!$currentUser->hasAccessTo('lh' . self::$currentModuleName, $Params['module']['functions'])) { if ($currentUser->isLogged()) { include_once 'modules/lhkernel/nopermission.php'; $Result['pagelayout'] = 'login'; return $Result; } else { if (isset($Params['module']['ajax']) && $Params['module']['ajax'] == true) { echo json_encode(array('error_url' => erLhcoreClassDesign::baseurl('user/login'))); exit; } else { self::redirect('user/login'); exit; } } } } if (isset($Params['module']['limitations'])) { // Just to start session $currentUser = erLhcoreClassUser::instance(); $access = call_user_func($Params['module']['limitations']['self']['method'], $Params['user_parameters'][$Params['module']['limitations']['self']['param']], $currentUser->hasAccessTo('lh' . self::$currentModuleName, $Params['module']['limitations']['global'])); if ($access == false) { if ($currentUser->isLogged()) { include_once 'modules/lhkernel/nopermissionobject.php'; $Result['pagelayout'] = 'login'; return $Result; } else { self::redirect('user/login'); exit; } } else { $Params['user_object'] = $access; } } try { if (isset($currentUser) && $currentUser->isLogged() && ($timeZone = $currentUser->getUserTimeZone()) != '') { self::$defaultTimeZone = $timeZone; date_default_timezone_set(self::$defaultTimeZone); } elseif (self::$defaultTimeZone != '') { date_default_timezone_set(self::$defaultTimeZone); } if (self::$debugEnabled == false) { $includeStatus = @(include self::getModuleFile()); } else { $includeStatus = (include self::getModuleFile()); } // Inclusion failed if ($includeStatus === false) { $CacheManager = erConfigClassLhCacheConfig::getInstance(); $CacheManager->expireCache(); if (self::$debugEnabled == true) { // Just try reinclude include self::getModuleFile(true); } else { // Just try reinclude @(include self::getModuleFile(true)); } if (!isset($Result)) { self::redirect(self::$currentModuleName . '/' . self::$currentView); exit; } } } catch (Exception $e) { $CacheManager = erConfigClassLhCacheConfig::getInstance(); $CacheManager->expireCache(); if (erConfigClassLhConfig::getInstance()->getSetting('site', 'debug_output') == true) { echo "<pre>"; print_r($e); echo "</pre>"; exit; } if (erConfigClassLhConfig::getInstance()->getSetting('site', 'installed') == false) { header('Location: ' . erLhcoreClassDesign::baseurldirect('site_admin/install/install')); exit; } header('HTTP/1.1 503 Service Temporarily Unavailable'); header('Status: 503 Service Temporarily Unavailable'); header('Retry-After: 300'); exit; } if (isset($Params['module']['pagelayout']) && !isset($Result['pagelayout'])) { $Result['pagelayout'] = $Params['module']['pagelayout']; } return $Result; } else { // Default module view if (($viewDefault = self::getModuleDefaultView(self::$currentModuleName)) !== false) { self::redirect(self::$currentModuleName . '/' . $viewDefault); exit; } // No sutch module etc, redirect to frontpage self::redirect(); exit; } }