public static function moduleInit($params = array()) { $cfg = erConfigClassLhConfig::getInstance(); self::$debugEnabled = $cfg->getSetting('site', 'debug_output'); // Enable errors output before extensions intialization if (self::$debugEnabled == true) { @ini_set('error_reporting', E_ALL); @ini_set('display_errors', 1); } self::$cacheInstance = CSCacheAPC::getMem(); self::$cacheVersionSite = self::$cacheInstance->getCacheVersion('site_version'); self::$defaultTimeZone = $cfg->getSetting('site', 'time_zone', false); self::$dateFormat = $cfg->getSetting('site', 'date_format', false); self::$dateHourFormat = $cfg->getSetting('site', 'date_hour_format', false); self::$dateDateHourFormat = $cfg->getSetting('site', 'date_date_hour_format', false); $url = erLhcoreClassURL::getInstance(); if (!isset($params['ignore_extensions'])) { // Attatch extension listeners self::attatchExtensionListeners(); } self::$currentModuleName = preg_replace('/[^a-zA-Z0-9\\-_]/', '', $url->getParam('module')); self::$currentView = preg_replace('/[^a-zA-Z0-9\\-_]/', '', $url->getParam('function')); if (self::$currentModuleName == '' || (self::$currentModule = self::getModule(self::$currentModuleName)) === false) { $params = $cfg->getOverrideValue('site', 'default_url'); if (self::$currentModuleName != '') { header("HTTP/1.1 301 Moved Permanently"); self::redirect(); exit; } self::$currentView = $params['view']; self::$currentModuleName = $params['module']; erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.core.default_url', array('url' => &$url)); self::$currentModule = self::getModule(self::$currentModuleName); } return self::runModule(); }
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; } } } }
public static function moduleInit() { $url = erLhcoreClassURL::getInstance(); $cfg = erConfigClassLhConfig::getInstance(); self::$currentModuleName = preg_replace('/[^a-zA-Z0-9\\-_]/', '', $url->getParam('module')); self::$currentView = preg_replace('/[^a-zA-Z0-9\\-_]/', '', $url->getParam('function')); self::$cacheInstance = CSCacheAPC::getMem(); self::$cacheVersionSite = self::$cacheInstance->getCacheVersion('site_version'); self::$defaultTimeZone = $cfg->getSetting('site', 'time_zone', false); self::$dateFormat = $cfg->getSetting('site', 'date_format', false); self::$dateHourFormat = $cfg->getSetting('site', 'date_hour_format', false); self::$dateDateHourFormat = $cfg->getSetting('site', 'date_date_hour_format', false); if (self::$currentModuleName == '' || (self::$currentModule = self::getModule(self::$currentModuleName)) === false) { $params = $cfg->getOverrideValue('site', 'default_url'); if (self::$currentModuleName != '') { header("HTTP/1.1 301 Moved Permanently"); self::redirect(); exit; } self::$currentView = $params['view']; self::$currentModuleName = $params['module']; self::$currentModule = self::getModule(self::$currentModuleName); } return self::runModule(); }