Пример #1
0
 public static function GetDefaultCurrencyID()
 {
     if (self::$DEFAULT_CURRENCY_ID !== '') {
         return self::$DEFAULT_CURRENCY_ID;
     }
     self::$DEFAULT_CURRENCY_ID = 'USD';
     $rsLang = CLanguage::GetByID('ru');
     if ($arLang = $rsLang->Fetch()) {
         self::$DEFAULT_CURRENCY_ID = 'RUB';
     } else {
         $rsLang = CLanguage::GetByID('de');
         if ($arLang = $rsLang->Fetch()) {
             self::$DEFAULT_CURRENCY_ID = 'EUR';
         }
     }
     return self::$DEFAULT_CURRENCY_ID;
 }
Пример #2
0
 function CheckFields($arFields)
 {
     global $APPLICATION;
     $aMsg = array();
     if (is_set($arFields, "NAME") && trim($arFields["NAME"]) == "") {
         $aMsg[] = array("id" => "NAME", "text" => GetMessage("fav_general_err_name"));
     }
     if (is_set($arFields, "URL") && trim($arFields["URL"]) == "") {
         $aMsg[] = array("id" => "URL", "text" => GetMessage("fav_general_err_url"));
     }
     if (is_set($arFields, "USER_ID")) {
         if (intval($arFields["USER_ID"]) > 0) {
             $res = CUser::GetByID(intval($arFields["USER_ID"]));
             if (!$res->Fetch()) {
                 $aMsg[] = array("id" => "USER_ID", "text" => GetMessage("fav_general_err_user"));
             }
         } elseif ($arFields["COMMON"] == "N") {
             $aMsg[] = array("id" => "USER_ID", "text" => GetMessage("fav_general_err_user1"));
         }
     }
     if (is_set($arFields, "LANGUAGE_ID")) {
         if ($arFields["LANGUAGE_ID"] != "") {
             $res = CLanguage::GetByID($arFields["LANGUAGE_ID"]);
             if (!$res->Fetch()) {
                 $aMsg[] = array("id" => "LANGUAGE_ID", "text" => GetMessage("fav_general_err_lang"));
             }
         } else {
             $aMsg[] = array("id" => "LANGUAGE_ID", "text" => GetMessage("fav_general_err_lang1"));
         }
     }
     if (!empty($aMsg)) {
         $e = new CAdminException($aMsg);
         $APPLICATION->ThrowException($e);
         return false;
     }
     return true;
 }
Пример #3
0
 function InstallDB()
 {
     /** @global string $DBType */
     global $DB, $DBType, $DBHost, $DBLogin, $DBPassword, $DBName, $APPLICATION;
     if (!is_object($APPLICATION)) {
         $APPLICATION = new CMain();
     }
     $DB = new CDatabase();
     $DB->DebugToFile = false;
     $DB->debug = true;
     if (!defined("DBPersistent")) {
         define("DBPersistent", false);
     }
     if (!$DB->Connect($DBHost, $DBName, $DBLogin, $DBPassword)) {
         $APPLICATION->ThrowException(GetMessage("MAIN_INSTALL_DB_ERROR"));
         return false;
     }
     $result = $DB->Query("SELECT * FROM b_module WHERE ID='main'", true, "", array("fixed_connection" => true));
     $success = $result && $result->Fetch();
     if ($success) {
         return true;
     }
     if ($DBType == "mysql" && defined("MYSQL_TABLE_TYPE") && strlen(MYSQL_TABLE_TYPE) > 0) {
         $DB->Query("SET storage_engine = '" . MYSQL_TABLE_TYPE . "'", true);
     }
     $errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/install/" . $DBType . "/install.sql");
     if ($errors !== false) {
         $APPLICATION->ThrowException(implode("", $errors));
         return false;
     }
     $this->InstallTasks();
     $group = new CGroup();
     $arGroups = array(array("~ID" => 1, "ACTIVE" => "Y", "C_SORT" => 1, "NAME" => GetMessage("MAIN_ADMIN_GROUP_NAME"), "ANONYMOUS" => "N", "DESCRIPTION" => GetMessage("MAIN_ADMIN_GROUP_DESC")), array("~ID" => 2, "ACTIVE" => "Y", "C_SORT" => 2, "NAME" => GetMessage("MAIN_EVERYONE_GROUP_NAME"), "ANONYMOUS" => "Y", "DESCRIPTION" => GetMessage("MAIN_EVERYONE_GROUP_DESC")), array("~ID" => 3, "ACTIVE" => "Y", "C_SORT" => 3, "NAME" => GetMessage("MAIN_VOTE_RATING_GROUP_NAME"), "ANONYMOUS" => "N", "DESCRIPTION" => GetMessage("MAIN_VOTE_RATING_GROUP_DESC"), "STRING_ID" => "RATING_VOTE"), array("~ID" => 4, "ACTIVE" => "Y", "C_SORT" => 4, "NAME" => GetMessage("MAIN_VOTE_AUTHORITY_GROUP_NAME"), "ANONYMOUS" => "N", "DESCRIPTION" => GetMessage("MAIN_VOTE_AUTHORITY_GROUP_DESC"), "STRING_ID" => "RATING_VOTE_AUTHORITY"));
     foreach ($arGroups as $arGroup) {
         $rsGroup = CGroup::GetByID($arGroup["~ID"]);
         if ($rsGroup->Fetch()) {
             continue;
         }
         //mssql does not allow insert identity by default
         if (strtolower($DB->type) == "mssql") {
             unset($arGroup["~ID"]);
         }
         $success = (bool) $group->Add($arGroup);
         if (!$success) {
             $APPLICATION->ThrowException($group->LAST_ERROR);
             return false;
         }
     }
     self::InstallRatings();
     $arLanguages = array(array("LID" => LANGUAGE_ID, "ACTIVE" => "Y", "SORT" => 1, "DEF" => "Y", "NAME" => GetMessage("MAIN_DEFAULT_LANGUAGE_NAME"), "FORMAT_DATE" => GetMessage("MAIN_DEFAULT_LANGUAGE_FORMAT_DATE"), "FORMAT_DATETIME" => GetMessage("MAIN_DEFAULT_LANGUAGE_FORMAT_DATETIME"), "FORMAT_NAME" => GetMessage("MAIN_DEFAULT_LANGUAGE_FORMAT_NAME"), "CHARSET" => defined("BX_UTF") ? "UTF-8" : GetMessage("MAIN_DEFAULT_LANGUAGE_FORMAT_CHARSET")));
     if (LANGUAGE_ID != "en") {
         $arLanguages[] = array("LID" => "en", "ACTIVE" => "Y", "SORT" => 2, "DEF" => "N", "NAME" => "English", "FORMAT_DATE" => "MM/DD/YYYY", "FORMAT_DATETIME" => "MM/DD/YYYY H:MI:SS T", "FORMAT_NAME" => "#NAME# #LAST_NAME#", "CHARSET" => defined("BX_UTF") ? "UTF-8" : "iso-8859-1");
     }
     if (LANGUAGE_ID != "de" && file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/lang/de/install/index.php')) {
         $arLanguages[] = array("LID" => "de", "ACTIVE" => "Y", "SORT" => 3, "DEF" => "N", "NAME" => "German", "FORMAT_DATE" => "DD.MM.YYYY", "FORMAT_DATETIME" => "DD.MM.YYYY HH:MI:SS", "FORMAT_NAME" => "#NAME# #LAST_NAME#", "CHARSET" => defined("BX_UTF") ? "UTF-8" : "iso-8859-1");
     }
     if (LANGUAGE_ID != "ru" && file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/lang/ru/install/index.php')) {
         $arLanguages[] = array("LID" => "ru", "ACTIVE" => "Y", "SORT" => 3, "DEF" => "N", "NAME" => "Russian", "FORMAT_DATE" => "DD.MM.YYYY", "FORMAT_DATETIME" => "DD.MM.YYYY HH:MI:SS", "FORMAT_NAME" => "#NAME# #LAST_NAME#", "CHARSET" => defined("BX_UTF") ? "UTF-8" : "windows-1251");
     }
     $lang = new CLanguage();
     foreach ($arLanguages as $arLanguage) {
         $rsLang = CLanguage::GetByID($arLanguage["LID"]);
         if ($rsLang->Fetch()) {
             continue;
         }
         $success = (bool) $lang->Add($arLanguage);
         if (!$success) {
             $APPLICATION->ThrowException($lang->LAST_ERROR);
             return false;
         }
     }
     $arSite = array("LID" => "s1", "ACTIVE" => "Y", "SORT" => 1, "DEF" => "Y", "NAME" => GetMessage("MAIN_DEFAULT_SITE_NAME"), "DIR" => "/", "FORMAT_DATE" => GetMessage("MAIN_DEFAULT_SITE_FORMAT_DATE"), "FORMAT_DATETIME" => GetMessage("MAIN_DEFAULT_SITE_FORMAT_DATETIME"), "FORMAT_NAME" => GetMessage("MAIN_DEFAULT_SITE_FORMAT_NAME"), "CHARSET" => defined("BX_UTF") ? "UTF-8" : GetMessage("MAIN_DEFAULT_SITE_FORMAT_CHARSET"), "LANGUAGE_ID" => LANGUAGE_ID);
     $rsSites = CSite::GetByID($arSite["LID"]);
     if (!$rsSites->Fetch()) {
         $site = new CSite();
         $success = (bool) $site->Add($arSite);
         if (!$success) {
             $APPLICATION->ThrowException($site->LAST_ERROR);
             return false;
         }
     }
     RegisterModule("main");
     RegisterModuleDependences('iblock', 'OnIBlockPropertyBuildList', 'main', 'CIBlockPropertyUserID', 'GetUserTypeDescription', 100, '/modules/main/tools/prop_userid.php');
     RegisterModuleDependences('main', 'OnUserDelete', 'main', 'CFavorites', 'OnUserDelete', 100, "/modules/main/classes/" . strtolower($GLOBALS["DB"]->type) . "/favorites.php");
     RegisterModuleDependences('main', 'OnLanguageDelete', 'main', 'CFavorites', 'OnLanguageDelete', 100, "/modules/main/classes/" . strtolower($GLOBALS["DB"]->type) . "/favorites.php");
     RegisterModuleDependences('main', 'OnUserDelete', 'main', 'CUserOptions', 'OnUserDelete');
     RegisterModuleDependences('main', 'OnChangeFile', 'main', 'CMain', 'OnChangeFileComponent');
     RegisterModuleDependences('main', 'OnUserTypeRightsCheck', 'main', 'CUser', 'UserTypeRightsCheck');
     RegisterModuleDependences('main', 'OnUserLogin', 'main', 'UpdateTools', 'CheckUpdates');
     RegisterModuleDependences('main', 'OnModuleUpdate', 'main', 'UpdateTools', 'SetUpdateResult');
     RegisterModuleDependences('main', 'OnUpdateCheck', 'main', 'UpdateTools', 'SetUpdateError');
     RegisterModuleDependences('main', 'OnPanelCreate', 'main', 'CUndo', 'CheckNotifyMessage');
     RegisterModuleDependences('main', 'OnAfterAddRating', 'main', 'CRatingsComponentsMain', 'OnAfterAddRating');
     RegisterModuleDependences('main', 'OnAfterUpdateRating', 'main', 'CRatingsComponentsMain', 'OnAfterUpdateRating');
     RegisterModuleDependences('main', 'OnSetRatingsConfigs', 'main', 'CRatingsComponentsMain', 'OnSetRatingConfigs');
     RegisterModuleDependences('main', 'OnGetRatingsConfigs', 'main', 'CRatingsComponentsMain', 'OnGetRatingConfigs');
     RegisterModuleDependences('main', 'OnGetRatingsObjects', 'main', 'CRatingsComponentsMain', 'OnGetRatingObject');
     RegisterModuleDependences('main', 'OnGetRatingContentOwner', 'main', 'CRatingsComponentsMain', 'OnGetRatingContentOwner');
     RegisterModuleDependences('main', 'OnAfterAddRatingRule', 'main', 'CRatingRulesMain', 'OnAfterAddRatingRule');
     RegisterModuleDependences('main', 'OnAfterUpdateRatingRule', 'main', 'CRatingRulesMain', 'OnAfterUpdateRatingRule');
     RegisterModuleDependences('main', 'OnGetRatingRuleObjects', 'main', 'CRatingRulesMain', 'OnGetRatingRuleObjects');
     RegisterModuleDependences('main', 'OnGetRatingRuleConfigs', 'main', 'CRatingRulesMain', 'OnGetRatingRuleConfigs');
     RegisterModuleDependences('main', 'OnAfterUserAdd', 'main', 'CRatings', 'OnAfterUserRegister');
     RegisterModuleDependences('main', 'OnUserDelete', 'main', 'CRatings', 'OnUserDelete');
     RegisterModuleDependences('main', 'OnUserDelete', 'main', 'CAccess', 'OnUserDelete');
     RegisterModuleDependences('main', 'OnAfterGroupAdd', 'main', 'CGroupAuthProvider', 'OnAfterGroupAdd');
     RegisterModuleDependences('main', 'OnBeforeGroupUpdate', 'main', 'CGroupAuthProvider', 'OnBeforeGroupUpdate');
     RegisterModuleDependences('main', 'OnBeforeGroupDelete', 'main', 'CGroupAuthProvider', 'OnBeforeGroupDelete');
     RegisterModuleDependences('main', 'OnAfterUserUpdate', 'main', 'CGroupAuthProvider', 'OnAfterUserUpdate');
     RegisterModuleDependences('main', 'OnUserLogin', 'main', 'CGroupAuthProvider', 'OnUserLogin');
     RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "main", "CEventMain", "GetAuditTypes");
     RegisterModuleDependences("main", "OnEventLogGetAuditHandlers", "main", "CEventMain", "MakeMainObject");
     RegisterModuleDependences("perfmon", "OnGetTableSchema", "main", "CTableSchema", "OnGetTableSchema");
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeString", "GetUserTypeDescription", 110);
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeInteger", "GetUserTypeDescription", 120);
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeDouble", "GetUserTypeDescription", 130);
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeDateTime", "GetUserTypeDescription", 140);
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeBoolean", "GetUserTypeDescription", 150);
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeFile", "GetUserTypeDescription", 160);
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeEnum", "GetUserTypeDescription", 170);
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeIBlockSection", "GetUserTypeDescription", 180);
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeIBlockElement", "GetUserTypeDescription", 190);
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeStringFormatted", "GetUserTypeDescription", 200);
     COption::SetOptionString('main', 'auth_comp2', 'Y');
     COption::SetOptionString("main", "PARAM_MAX_SITES", "2");
     COption::SetOptionString("main", "PARAM_MAX_USERS", "0");
     COption::SetOptionString("main", "distributive6", "Y");
     COption::SetOptionString("main", "~new_license11_sign", "Y");
     COption::SetOptionString("main", "GROUP_DEFAULT_TASK", "1");
     if (LANGUAGE_ID == "ru") {
         COption::SetOptionString("main", "vendor", "1c_bitrix");
     } else {
         COption::SetOptionString("main", "vendor", "bitrix");
     }
     COption::SetOptionString("main", "admin_lid", LANGUAGE_ID);
     COption::SetOptionString("main", "update_site", "www.bitrixsoft.com");
     COption::SetOptionString("main", "update_site_ns", "Y");
     COption::SetOptionString("main", "optimize_css_files", "Y");
     COption::SetOptionString("main", "optimize_js_files", "Y");
     CAgent::AddAgent("CEvent::CleanUpAgent();", "main", "Y", 86400);
     CAgent::AddAgent("CUser::CleanUpHitAuthAgent();", "main", "Y", 86400);
     CAgent::AddAgent("CCaptchaAgent::DeleteOldCaptcha(3600);", "main", "N", 3600);
     CAgent::AddAgent("CUndo::CleanUpOld();", "main", "Y", 86400);
     self::InstallDesktop();
     self::InstallSmiles();
     return true;
 }
Пример #4
0
IncludeModuleLangFile(__FILE__);
require_once $_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/modules/crm/functions.php';
require_once $_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/modules/crm/classes/general/crm_usertypecrmstatus.php';
require_once $_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/modules/crm/classes/general/crm_usertypecrm.php';
CModule::AddAutoloadClasses('crm', array('CAllCrmLead' => 'classes/general/crm_lead.php', 'CCrmLead' => 'classes/' . $DBType . '/crm_lead.php', 'CCrmLeadWS' => 'classes/general/ws_lead.php', 'CCRMLeadRest' => 'classes/general/rest_lead.php', 'CAllCrmDeal' => 'classes/general/crm_deal.php', 'CCrmDeal' => 'classes/' . $DBType . '/crm_deal.php', 'CAllCrmCompany' => 'classes/general/crm_company.php', 'CCrmCompany' => 'classes/' . $DBType . '/crm_company.php', 'CAllCrmContact' => 'classes/general/crm_contact.php', 'CCrmContact' => 'classes/' . $DBType . '/crm_contact.php', 'CCrmContactWS' => 'classes/general/ws_contact.php', 'CCrmPerms' => 'classes/general/crm_perms.php', 'CCrmRole' => 'classes/general/crm_role.php', 'CCrmFields' => 'classes/general/crm_fields.php', 'CCrmUserType' => 'classes/general/crm_usertype.php', 'CCrmGridOptions' => 'classes/general/crm_grids.php', 'CCrmStatus' => 'classes/general/crm_status.php', 'CCrmFieldMulti' => 'classes/general/crm_field_multi.php', 'CCrmEvent' => 'classes/general/crm_event.php', 'CCrmEMail' => 'classes/general/crm_email.php', 'CCrmVCard' => 'classes/general/crm_vcard.php', 'CCrmActivityTask' => 'classes/general/crm_activity_task.php', 'CCrmActivityCalendar' => 'classes/general/crm_activity_calendar.php', 'CUserTypeCrm' => 'classes/general/crm_usertypecrm.php', 'CUserTypeCrmStatus' => 'classes/general/crm_usertypecrmstatus.php', 'CCrmSearch' => 'classes/general/crm_search.php', 'CCrmBizProc' => 'classes/general/crm_bizproc.php', 'CCrmDocument' => 'classes/general/crm_document.php', 'CCrmDocumentLead' => 'classes/general/crm_document_lead.php', 'CCrmDocumentContact' => 'classes/general/crm_document_contact.php', 'CCrmDocumentCompany' => 'classes/general/crm_document_company.php', 'CCrmDocumentDeal' => 'classes/general/crm_document_deal.php', 'CCrmReportHelper' => 'classes/general/crm_report_helper.php', 'Bitrix\\Crm\\StatusTable' => 'lib/status.php', 'Bitrix\\Crm\\EventTable' => 'lib/event.php', 'Bitrix\\Crm\\EventRelationsTable' => 'lib/event.php', 'Bitrix\\Crm\\DealTable' => 'lib/deal.php', 'Bitrix\\Crm\\LeadTable' => 'lib/lead.php', 'Bitrix\\Crm\\ContactTable' => 'lib/contact.php', 'Bitrix\\Crm\\CompanyTable' => 'lib/company.php', '\\Bitrix\\Crm\\StatusTable' => 'lib/status.php', '\\Bitrix\\Crm\\EventTable' => 'lib/event.php', '\\Bitrix\\Crm\\EventRelationsTable' => 'lib/event.php', '\\Bitrix\\Crm\\DealTable' => 'lib/deal.php', '\\Bitrix\\Crm\\LeadTable' => 'lib/lead.php', '\\Bitrix\\Crm\\ContactTable' => 'lib/contact.php', '\\Bitrix\\Crm\\CompanyTable' => 'lib/company.php', 'CCrmExternalSale' => 'classes/general/crm_external_sale.php', 'CCrmExternalSaleProxy' => 'classes/general/crm_external_sale_proxy.php', 'CCrmExternalSaleImport' => 'classes/general/crm_external_sale_import.php', 'CCrmUtils' => 'classes/general/crm_utils.php', 'CCrmEntityHelper' => 'classes/general/entity_helper.php', 'CAllCrmCatalog' => 'classes/general/crm_catalog.php', 'CCrmCatalog' => 'classes/' . $DBType . '/crm_catalog.php', 'CCrmCurrency' => 'classes/general/crm_currency.php', 'CCrmCurrencyHelper' => 'classes/general/crm_currency_helper.php', 'CCrmProductResult' => 'classes/general/crm_product_result.php', 'CCrmProduct' => 'classes/general/crm_product.php', 'CCrmProductHelper' => 'classes/general/crm_product_helper.php', 'CAllCrmProductRow' => 'classes/general/crm_product_row.php', 'CCrmProductRow' => 'classes/' . $DBType . '/crm_product_row.php', 'CAllCrmInvoice' => 'classes/general/crm_invoice.php', 'CCrmInvoice' => 'classes/' . $DBType . '/crm_invoice.php', 'CAllCrmQuote' => 'classes/general/crm_quote.php', 'CCrmQuote' => 'classes/' . $DBType . '/crm_quote.php', 'CCrmOwnerType' => 'classes/general/crm_owner_type.php', 'CCrmOwnerTypeAbbr' => 'classes/general/crm_owner_type.php', 'Bitrix\\Crm\\ProductTable' => 'lib/product.php', 'Bitrix\\Crm\\ProductRowTable' => 'lib/productrow.php', 'Bitrix\\Crm\\IBlockElementProxyTable' => 'lib/iblockelementproxy.php', 'Bitrix\\Crm\\IBlockElementGrcProxyTable' => 'lib/iblockelementproxy.php', '\\Bitrix\\Crm\\ProductTable' => 'lib/product.php', '\\Bitrix\\Crm\\ProductRowTable' => 'lib/productrow.php', '\\Bitrix\\Crm\\IBlockElementProxyTable' => 'lib/iblockelementproxy.php', '\\Bitrix\\Crm\\IBlockElementGrcProxyTable' => 'lib/iblockelementproxy.php', 'CCrmAccountingHelper' => 'classes/general/crm_accounting_helper.php', 'Bitrix\\Crm\\ExternalSaleTable' => 'lib/externalsale.php', '\\Bitrix\\Crm\\ExternalSaleTable' => 'lib/externalsale.php', 'CCrmExternalSaleHelper' => 'classes/general/crm_external_sale_helper.php', 'CCrmEntityListBuilder' => 'classes/general/crm_entity_list_builder.php', 'CCrmComponentHelper' => 'classes/general/crm_component_helper.php', 'CCrmInstantEditorHelper' => 'classes/general/crm_component_helper.php', 'CAllCrmActivity' => 'classes/general/crm_activity.php', 'CCrmActivity' => 'classes/' . $DBType . '/crm_activity.php', 'CCrmActivityType' => 'classes/general/crm_activity.php', 'CCrmActivityStatus' => 'classes/general/crm_activity.php', 'CCrmActivityPriority' => 'classes/general/crm_activity.php', 'CCrmActivityNotifyType' => 'classes/general/crm_activity.php', 'CCrmActivityStorageType' => 'classes/general/crm_activity.php', 'CCrmContentType' => 'classes/general/crm_activity.php', 'CCrmEnumeration' => 'classes/general/crm_enumeration.php', 'CCrmEntitySelectorHelper' => 'classes/general/crm_entity_selector_helper.php', 'CCrmBizProcHelper' => 'classes/general/crm_bizproc_helper.php', 'CCrmBizProcEventType' => 'classes/general/crm_bizproc_helper.php', 'CCrmUrlUtil' => 'classes/general/crm_url_util.php', 'CCrmAuthorizationHelper' => 'classes/general/crm_authorization_helper.php', 'CCrmWebDavHelper' => 'classes/general/crm_webdav_helper.php', 'CCrmActivityDirection' => 'classes/general/crm_activity.php', 'CCrmViewHelper' => 'classes/general/crm_view_helper.php', 'CCrmSecurityHelper' => 'classes/general/crm_security_helper.php', 'CCrmMailHelper' => 'classes/general/crm_mail_helper.php', 'CCrmNotifier' => 'classes/general/crm_notifier.php', 'CCrmNotifierSchemeType' => 'classes/general/crm_notifier.php', 'CCrmActivityConverter' => 'classes/general/crm_activity_converter.php', 'CCrmDateTimeHelper' => 'classes/general/datetime_helper.php', 'CCrmEMailCodeAllocation' => 'classes/general/crm_email.php', 'CCrmActivityCalendarSettings' => 'classes/general/crm_activity.php', 'CCrmActivityCalendarSettings' => 'classes/general/crm_activity.php', 'CCrmProductReportHelper' => 'classes/general/crm_report_helper.php', 'CCrmReportManager' => 'classes/general/crm_report_helper.php', 'CCrmCallToUrl' => 'classes/general/crm_url_util.php', 'CCrmUrlTemplate' => 'classes/general/crm_url_util.php', 'CCrmFileProxy' => 'classes/general/file_proxy.php', 'CAllCrmMailTemplate' => 'classes/general/mail_template.php', 'CCrmMailTemplate' => 'classes/' . $DBType . '/mail_template.php', 'CCrmMailTemplateScope' => 'classes/general/mail_template.php', 'CCrmTemplateAdapter' => 'classes/general/template_adapter.php', 'CCrmTemplateMapper' => 'classes/general/template_mapper.php', 'CCrmTemplateManager' => 'classes/general/template_manager.php', 'CCrmGridContext' => 'classes/general/crm_grids.php', 'CCrmUserCounter' => 'classes/general/user_counter.php', 'CCrmUserCounterSettings' => 'classes/general/user_counter.php', 'CCrmMobileHelper' => 'classes/general/mobile_helper.php', 'CCrmStatusInvoice' => 'classes/general/crm_status_invoice.php', 'CCrmTax' => 'classes/general/crm_tax.php', 'CCrmVat' => 'classes/general/crm_vat.php', 'CCrmLocations' => 'classes/general/crm_locations.php', 'CCrmPaySystem' => 'classes/general/crm_pay_system.php', 'CCrmRestService' => 'classes/general/restservice.php', 'CCrmFieldInfo' => 'classes/general/field_info.php', 'CCrmFieldInfoAttr' => 'classes/general/field_info.php', 'CCrmActivityEmailSender' => 'classes/general/crm_activity.php', 'CCrmProductSection' => 'classes/general/crm_product_section.php', 'CCrmProductSectionDbResult' => 'classes/general/crm_product_section.php', 'CCrmActivityDbResult' => 'classes/general/crm_activity.php', 'CCrmInvoiceRestService' => 'classes/general/restservice_invoice.php', 'CCrmInvoiceEvent' => 'classes/general/crm_invoice_event.php', 'CCrmInvoiceEventFormat' => 'classes/general/crm_invoice_event.php', 'CCrmLeadReportHelper' => 'classes/general/crm_report_helper.php', 'CCrmInvoiceReportHelper' => 'classes/general/crm_report_helper.php', 'CCrmActivityReportHelper' => 'classes/general/crm_report_helper.php', 'CCrmLiveFeed' => 'classes/general/livefeed.php', 'CCrmLiveFeedMessageRestProxy' => 'classes/general/restservice.php', 'CCrmLiveFeedEntity' => 'classes/general/livefeed.php', 'CCrmLiveFeedEvent' => 'classes/general/livefeed.php', 'CCrmLiveFeedFilter' => 'classes/general/livefeed.php', 'CCrmLiveFeedComponent' => 'classes/general/livefeed.php', 'CAllCrmSonetRelation' => 'classes/general/sonet_relation.php', 'CCrmSonetRelationType' => 'classes/general/sonet_relation.php', 'CCrmSonetRelation' => 'classes/' . $DBType . '/sonet_relation.php', 'CAllCrmSonetSubscription' => 'classes/general/sonet_subscription.php', 'CCrmSonetSubscriptionType' => 'classes/general/sonet_subscription.php', 'CCrmSonetSubscription' => 'classes/' . $DBType . '/sonet_subscription.php', 'CCrmSipHelper' => 'classes/general/sip_helper.php', 'CCrmSaleHelper' => 'classes/general/sale_helper.php', 'CCrmProductFile' => 'classes/general/crm_product_file.php', 'CCrmProductFileControl' => 'classes/general/crm_product_file.php', 'CCrmProductPropsHelper' => 'classes/general/crm_productprops_helper.php', 'CCrmProductSectionHelper' => 'classes/general/crm_product_section_helper.php', '\\Bitrix\\Crm\\Honorific' => 'lib/honorific.php', '\\Bitrix\\Crm\\Conversion\\LeadConverter' => 'lib/conversion/leadconverter.php', '\\Bitrix\\Crm\\Conversion\\EntityConversionConfigItem' => 'lib/conversion/entityconversionconfigitem.php', '\\Bitrix\\Crm\\Conversion\\EntityConversionMapItem' => 'lib/conversion/entityconversionmapitem.php', '\\Bitrix\\Crm\\Conversion\\EntityConversionMap' => 'lib/conversion/entityconversionmap.php', '\\Bitrix\\Crm\\Conversion\\LeadConversionMapper' => 'lib/conversion/leadconversionmapper.php', '\\Bitrix\\Crm\\Conversion\\LeadConversionWizard' => 'lib/conversion/leadconversionwizard.php', '\\Bitrix\\Crm\\Conversion\\LeadConversionPhase' => 'lib/conversion/leadconversionphase.php', '\\Bitrix\\Crm\\Conversion\\LeadConversionConfig' => 'lib/conversion/leadconversionconfig.php', '\\Bitrix\\Crm\\Conversion\\LeadConversionScheme' => 'lib/conversion/leadconversionscheme.php', '\\Bitrix\\Crm\\Conversion\\DealConversionConfig' => 'lib/conversion/dealconversionconfig.php', '\\Bitrix\\Crm\\Conversion\\DealConversionScheme' => 'lib/conversion/dealconversionscheme.php', '\\Bitrix\\Crm\\Conversion\\EntityConversionFileViewer' => 'lib/conversion/entityconversionfileviewer.php', '\\Bitrix\\Crm\\Conversion\\Entity\\EntityConversionMapTable' => 'lib/conversion/entity/entityconversionmap.php', '\\Bitrix\\Crm\\Conversion\\ConversionWizardStep' => 'lib/conversion/conversionwizardstep.php', '\\Bitrix\\Crm\\Conversion\\ConversionWizard' => 'lib/conversion/conversionwizard.php', '\\Bitrix\\Crm\\Synchronization\\UserFieldSynchronizer' => 'lib/synchronization/userfieldsynchronizer.php', '\\Bitrix\\Crm\\Synchronization\\UserFieldSynchronizationException' => 'lib/synchronization/userfieldsynchronizationexception.php', '\\Bitrix\\Crm\\UserField\\UserFieldHistory' => 'lib/userfield/userfieldhistory.php', '\\Bitrix\\Crm\\UserField\\FileViewer' => 'lib/userfield/fileviewer.php', '\\Bitrix\\Crm\\Restriction\\ClientRestriction' => 'lib/restriction/clientrestriction.php', '\\Bitrix\\Crm\\Restriction\\ClientRestrictionManager' => 'lib/restriction/clientrestrictionmanager.php', '\\Bitrix\\Crm\\Restriction\\SelectRestriction' => 'lib/restriction/selectrestriction.php'));
CModule::AddAutoloadClasses('', array('CAdminCalendar' => BX_ROOT . '/modules/main/interface/admin_lib.php'));
//Disable data initialization under agent context
if (CCrmSecurityHelper::GetCurrentUserID() > 0) {
    // Convert LEAD & DEAL PRODUCT  -->
    if (COption::GetOptionString('crm', '~crm_11_0_6_convertion', 'N') !== 'Y') {
        $baseCurrencyID = "USD";
        $rsLang = CLanguage::GetByID("ru");
        if ($arLang = $rsLang->Fetch()) {
            $baseCurrencyID = "RUB";
        } else {
            $rsLang = CLanguage::GetByID("de");
            if ($arLang = $rsLang->Fetch()) {
                $baseCurrencyID = "EUR";
            }
        }
        $arProducts = CCrmStatus::GetStatusList('PRODUCT', true);
        foreach ($arProducts as $prodCode => $prodName) {
            CCrmProduct::Add(array('NAME' => $prodName, 'ACTIVE' => 'Y', 'CURRENCY_ID' => $baseCurrencyID, 'PRICE' => 1, 'ORIGIN_ID' => 'CRM_PROD_' . $prodCode, 'ORIGINATOR_ID' => 'CRM_PRODUCT_REFERENCE'));
        }
        $rsDeals = CCrmDeal::GetListEx(array('ID' => 'ASC'), array("CHECK_PERMISSIONS" => "N"), false, false, array('ID', 'PRODUCT_ID', 'OPPORTUNITY', 'CURRENCY_ID'));
        while ($arDeal = $rsDeals->Fetch()) {
            $ID = isset($arDeal['ID']) ? intval($arDeal['ID']) : 0;
            if ($ID <= 0) {
                continue;
            }
            $productID = isset($arDeal['PRODUCT_ID']) ? $arDeal['PRODUCT_ID'] : '';
Пример #5
0
            }
        }
        if (isset($arIBlock['FIELDS']['SECTION_CODE']['DEFAULT_VALUE'])) {
            if ('Y' == $arIBlock['FIELDS']['SECTION_CODE']['DEFAULT_VALUE']['TRANSLITERATION'] && 'Y' == $arIBlock['FIELDS']['SECTION_CODE']['DEFAULT_VALUE']['USE_GOOGLE']) {
                $boolOutTranslit = true;
            }
        }
        if ($boolOutTranslit) {
            $USE_TRANSLIT = 'N';
            $strImportErrorMessage .= GetMessage("CATI_USE_CODE_TRANSLIT_OUT") . "<br>";
        }
    }
    if ('Y' == $USE_TRANSLIT) {
        $TRANSLIT_LANG = isset($TRANSLIT_LANG) ? strval($TRANSLIT_LANG) : '';
        if (!empty($TRANSLIT_LANG)) {
            $rsTransLangs = CLanguage::GetByID($TRANSLIT_LANG);
            if (!($arTransLang = $rsTransLangs->Fetch())) {
                $TRANSLIT_LANG = '';
            }
        }
        if (empty($TRANSLIT_LANG)) {
            $USE_TRANSLIT = 'N';
            $strImportErrorMessage .= GetMessage("CATI_CODE_TRANSLIT_LANG_ERR") . "<br>";
        }
    }
}
$IMAGE_RESIZE = isset($IMAGE_RESIZE) && 'Y' == $IMAGE_RESIZE ? 'Y' : 'N';
$CLEAR_EMPTY_PRICE = isset($CLEAR_EMPTY_PRICE) && 'Y' == $CLEAR_EMPTY_PRICE ? 'Y' : 'N';
$CML2_LINK_IS_XML = isset($CML2_LINK_IS_XML) && 'Y' == $CML2_LINK_IS_XML ? 'Y' : 'N';
if (empty($arSku)) {
    $CML2_LINK_IS_XML = 'N';
Пример #6
0
 /**
  * Возвращает данные по коду языка
  *
  * Если код языка не передан, то возвращает данные по языку текущего сайта
  *
  * @param bool|false $id
  * @return mixed
  */
 public static function getLangData($id = false)
 {
     static $data = array();
     if (!$id) {
         $id = self::getSiteLang();
     }
     if (!isset($data[$id])) {
         $res = \CLanguage::GetByID($id);
         $data[$id] = $res->Fetch();
     }
     return $data[$id];
 }
Пример #7
0
if ($APPLICATION->GetTitle() == '') {
    $APPLICATION->SetTitle(GetMessage("MAIN_PROLOG_ADMIN_TITLE"));
}
$aUserOpt = CUserOptions::GetOption("admin_panel", "settings");
$aUserOptGlobal = CUserOptions::GetOption("global", "settings");
$adminPage->Init();
$adminMenu->Init($adminPage->aModules);
$bShowAdminMenu = !empty($adminMenu->aGlobalMenu);
$aOptMenuPos = array();
if ($bShowAdminMenu && class_exists("CUserOptions")) {
    $aOptMenuPos = CUserOptions::GetOption("admin_menu", "pos", array());
    $bOptMenuMinimized = $aOptMenuPos['ver'] == 'off';
}
if (!defined('ADMIN_SECTION_LOAD_AUTH') || !ADMIN_SECTION_LOAD_AUTH) {
    $direction = "";
    $direct = CLanguage::GetByID(LANGUAGE_ID);
    $arDirect = $direct->Fetch();
    if ($arDirect["DIRECTION"] == "N") {
        $direction = ' dir="rtl"';
    }
    ?>
<!DOCTYPE html>
<html<?php 
    echo $aUserOpt['fix'] == 'on' ? ' class="adm-header-fixed"' : '';
    echo $direction;
    ?>
>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
    echo htmlspecialcharsbx(LANG_CHARSET);
    ?>
Пример #8
0
 function Start($Params)
 {
     global $USER;
     $bCloudsBrowse = is_object($USER) && $USER->CanDoOperation('clouds_browse') && $Params["operation"] === "O";
     $arSites = array();
     $dbSitesList = CSite::GetList($b = "SORT", $o = "asc");
     $arSitesPP = array();
     while ($arSite = $dbSitesList->GetNext()) {
         $arSites[$arSite["ID"]] = $arSite["NAME"] ? $arSite["NAME"] : $arSite["ID"];
         $arSitesPP[] = array("ID" => $arSite["ID"], "TEXT" => '[' . $arSite["ID"] . '] ' . $arSite["NAME"], "ONCLICK" => "oBXDialogControls.SiteSelectorOnChange('" . $arSite["ID"] . "')", "ICON" => $arSite["ID"] == $Params['site'] ? 'checked' : '');
     }
     if ($bCloudsBrowse && CModule::IncludeModule('clouds')) {
         foreach (CCloudStorageBucket::GetAllBuckets() as $arBucket) {
             if ($arBucket["ACTIVE"] == "Y") {
                 $id = $arBucket["BUCKET"];
                 $arSites[$id] = $arBucket["BUCKET"];
                 $arSitesPP[] = array("ID" => $id, "TEXT" => $arBucket["BUCKET"], "ONCLICK" => "oBXDialogControls.SiteSelectorOnChange('" . $id . "')", "ICON" => $id == $Params['site'] ? 'checked' : '');
             }
         }
     }
     $Params['arSites'] = $arSites;
     $Params['arSitesPP'] = $arSitesPP;
     $Params['site'] = $Params['site'] && isset($arSites[$Params['site']]) ? $Params['site'] : key($arSites);
     // Secure site var
     if (!in_array(strtolower($Params['lang']), array('en', 'ru'))) {
         $res = CLanguage::GetByID($Params['lang']);
         if ($lang = $res->Fetch()) {
             $Params['lang'] = $lang['ID'];
         } else {
             $Params['lang'] = 'en';
         }
     }
     if ($Params['bAddToMenu']) {
         $armt = self::GetMenuTypes($Params['site'], $Params['path']);
         $Params['arMenuTypes'] = $armt[0];
         $Params['arMenuTypesScript'] = $armt[1];
         $Params['menuItems'] = $armt[2];
     }
     self::BuildDialog($Params);
     self::ShowJS($Params);
 }
Пример #9
0
 /**
  * Returns current name template
  *
  * If site is not defined - will look for name template for current language.
  * If there is no value for language - returns pre-defined value @see CSite::GetDefaultNameFormat
  * FORMAT_NAME constant can be set in dbconn.php
  *
  * @param $dummy Unused
  * @param string $site_id - use to get value for the specific site
  * @return string ex: #LAST_NAME# #NAME#
  */
 function GetNameFormat($dummy = null, $site_id = "")
 {
     if ($site_id == "") {
         $site_id = SITE_ID;
     }
     $format = "";
     //for current site
     if (defined("SITE_ID") && $site_id == SITE_ID) {
         if (defined("FORMAT_NAME")) {
             $format = FORMAT_NAME;
         }
     }
     //site value
     if ($format == "") {
         $db_res = CSite::GetByID($site_id);
         if ($res = $db_res->Fetch()) {
             $format = $res["FORMAT_NAME"];
         }
     }
     //if not found - trying to get value for the language
     if ($format == "") {
         global $MAIN_LANGS_ADMIN_CACHE;
         if (!is_set($MAIN_LANGS_ADMIN_CACHE, $site_id)) {
             $db_res = CLanguage::GetByID(LANGUAGE_ID);
             if ($res = $db_res->Fetch()) {
                 $MAIN_LANGS_ADMIN_CACHE[$res["LID"]] = $res;
             }
         }
         if (is_set($MAIN_LANGS_ADMIN_CACHE, LANGUAGE_ID)) {
             $format = strtoupper($MAIN_LANGS_ADMIN_CACHE[LANGUAGE_ID]["FORMAT_NAME"]);
         }
     }
     //if not found - trying to get default values
     if ($format == "") {
         $format = self::GetDefaultNameFormat(empty($res["LANGUAGE_ID"]) ? "" : $res["LANGUAGE_ID"]);
     }
     $format = str_replace(array("#NOBR#", "#/NOBR#"), "", $format);
     return $format;
 }
Пример #10
0
    $errorMessage .= "<br>" . GetMessage("SUP_CANT_CONTRUPDATE") . ". ";
}
if (extension_loaded('eaccelerator')) {
    $errorMessage .= "<br>" . GetMessage("SUP_CANT_EACCELERATOR") . ". ";
}
// MySQL 5.0.0, PHP 5.3.0
if ($DB->type == "MYSQL") {
    $dbQueryRes = $DB->Query("select VERSION() as ver", True);
    if ($arQueryRes = $dbQueryRes->Fetch()) {
        $curMySqlVer = Trim($arQueryRes["ver"]);
        $arCurMySqlVer = Explode(".", $curMySqlVer);
        if (IntVal($arCurMySqlVer[0]) < 5 || IntVal($arCurMySqlVer[0]) == 5 && IntVal($arCurMySqlVer[1]) < 0 || IntVal($arCurMySqlVer[0]) == 5 && IntVal($arCurMySqlVer[1]) == 0 && IntVal($arCurMySqlVer[2]) < 0) {
            $errorMessage .= "<br>" . GetMessage("SUP_MYSQL_L4111", array("#VERS#" => $curMySqlVer));
        }
    }
    $dbLangTmp = CLanguage::GetByID("ru");
    if (defined("BX_UTF") && BX_UTF || $dbLangTmp->Fetch()) {
        $dbQueryRes = $DB->Query("show variables like 'character_set_database'", True);
        if ($arQueryRes = $dbQueryRes->Fetch()) {
            $curCharacterSet = strtolower(Trim($arQueryRes["Value"]));
            if (defined("BX_UTF") && BX_UTF) {
                if (substr($curCharacterSet, 0, 3) != "utf") {
                    $errorMessage .= "<br>" . GetMessage("SUP_MYSQL_LCP_ERROR", array("#CP#" => "utf8", "#CP1#" => $curCharacterSet, "#DB#" => $DB->DBName));
                }
            } else {
                if ($curCharacterSet != "cp1251") {
                    $errorMessage .= "<br>" . GetMessage("SUP_MYSQL_LCP_ERROR", array("#CP#" => "cp1251", "#CP1#" => $curCharacterSet, "#DB#" => $DB->DBName));
                }
            }
        }
        /*
Пример #11
0
 function AddPosting($arRubric)
 {
     global $DB, $USER, $MESS;
     if (!is_object($USER)) {
         $USER = new CUser();
     }
     //Include language file for template.php
     $rsSite = CSite::GetByID($arRubric["SITE_ID"]);
     $arSite = $rsSite->Fetch();
     $rsLang = CLanguage::GetByID($arSite["LANGUAGE_ID"]);
     $arLang = $rsLang->Fetch();
     $arFields = false;
     if (CPostingTemplate::IsExists($arRubric["TEMPLATE"])) {
         $strFileName = $_SERVER["DOCUMENT_ROOT"] . "/" . $arRubric["TEMPLATE"] . "/lang/" . $arSite["LANGUAGE_ID"] . "/template.php";
         if (file_exists($strFileName)) {
             include $strFileName;
         }
         //Execute template
         $strFileName = $_SERVER["DOCUMENT_ROOT"] . "/" . $arRubric["TEMPLATE"] . "/template.php";
         if (file_exists($strFileName)) {
             ob_start();
             $arFields = @(include $strFileName);
             $strBody = ob_get_contents();
             ob_end_clean();
         }
     }
     $ID = false;
     //If there was an array returned then add posting
     if (is_array($arFields)) {
         $arFields["BODY"] = $strBody;
         $cPosting = new CPosting();
         $arFields["AUTO_SEND_TIME"] = $arRubric["END_TIME"];
         $arFields["RUB_ID"] = array($arRubric["ID"]);
         $arFields["MSG_CHARSET"] = $arLang["CHARSET"];
         $ID = $cPosting->Add($arFields);
         if ($ID) {
             if (array_key_exists("FILES", $arFields)) {
                 foreach ($arFields["FILES"] as $arFile) {
                     $cPosting->SaveFile($ID, $arFile);
                 }
             }
             if (!array_key_exists("DO_NOT_SEND", $arFields) || $arFields["DO_NOT_SEND"] != "Y") {
                 $cPosting->ChangeStatus($ID, "P");
                 if (COption::GetOptionString("subscribe", "subscribe_auto_method") !== "cron") {
                     CAgent::AddAgent("CPosting::AutoSend(" . $ID . ",true,\"" . $arRubric["LID"] . "\");", "subscribe", "N", 0, $arRubric["END_TIME"], "Y", $arRubric["END_TIME"]);
                 }
             }
         }
     }
     //Update last execution time mark
     $strSql = "UPDATE b_list_rubric SET LAST_EXECUTED=" . $DB->CharToDateFunction($arRubric["END_TIME"]) . " WHERE ID=" . intval($arRubric["ID"]);
     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     return $ID;
 }
Пример #12
0
 function InstallDB()
 {
     global $DB, $DBType, $APPLICATION;
     global $stackCacheManager;
     global $CACHE_MANAGER;
     $this->errors = false;
     if (!$DB->Query("SELECT COUNT(CURRENCY) FROM b_catalog_currency", true)) {
         $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/currency/install/db/" . $DBType . "/install.sql");
     }
     if ($this->errors !== false) {
         $APPLICATION->ThrowException(implode("", $this->errors));
         return false;
     }
     RegisterModule("currency");
     $stackCacheManager->Clear("currency_currency_lang");
     $CACHE_MANAGER->Clean("currency_currency_list");
     $CACHE_MANAGER->Clean("currency_base_currency");
     $stackCacheManager->Clear("currency_rate");
     if (CModule::IncludeModule("currency")) {
         $dbCurrency = CCurrency::GetList($by = "sort", $order = "asc");
         if (!$dbCurrency->Fetch()) {
             $rsLang = CLanguage::GetByID("ru");
             if ($arLang = $rsLang->Fetch()) {
                 $arFields = array("CURRENCY" => "RUB", "AMOUNT" => 1, "AMOUNT_CNT" => 1, "SORT" => 100);
                 CCurrency::Add($arFields);
                 $arFields = array("CURRENCY" => "USD", "AMOUNT" => 30.33, "AMOUNT_CNT" => 1, "SORT" => 200);
                 CCurrency::Add($arFields);
                 $arFields = array("CURRENCY" => "EUR", "AMOUNT" => 38.98, "AMOUNT_CNT" => 1, "SORT" => 300);
                 CCurrency::Add($arFields);
                 $arFields = array("CURRENCY" => "UAH", "AMOUNT" => 3.77, "AMOUNT_CNT" => 1, "SORT" => 400);
                 CCurrency::Add($arFields);
                 $arCurrency = array("RUB", "USD", "EUR", "UAH");
             } else {
                 $rsLang = CLanguage::GetByID("de");
                 if ($arLang = $rsLang->Fetch()) {
                     $arFields = array("CURRENCY" => "USD", "AMOUNT" => 0.78, "AMOUNT_CNT" => 1, "SORT" => 200);
                     CCurrency::Add($arFields);
                     $arFields = array("CURRENCY" => "EUR", "AMOUNT" => 1, "AMOUNT_CNT" => 1, "SORT" => 100);
                     CCurrency::Add($arFields);
                     $arCurrency = array("USD", "EUR");
                 } else {
                     $arFields = array("CURRENCY" => "USD", "AMOUNT" => 1, "AMOUNT_CNT" => 1, "SORT" => 100);
                     CCurrency::Add($arFields);
                     $arFields = array("CURRENCY" => "EUR", "AMOUNT" => 1.26, "AMOUNT_CNT" => 1, "SORT" => 200);
                     CCurrency::Add($arFields);
                     $arCurrency = array("USD", "EUR");
                 }
             }
             $dbLangs = CLanguage::GetList($b = "", $o = "", array("ACTIVE" => "Y"));
             while ($arLangs = $dbLangs->Fetch()) {
                 $CACHE_MANAGER->Clean("currency_currency_list_" . $arLangs["LID"]);
                 IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/currency/install_lang.php", $arLangs["LID"]);
                 foreach ($arCurrency as $val) {
                     $arFields = array();
                     if ($val == "USD") {
                         $arFields = array("LID" => $arLangs["LID"], "CURRENCY" => "USD", "FORMAT_STRING" => GetMessage("CUR_INSTALL_USD_FORMAT_STRING"), "FULL_NAME" => GetMessage("CUR_INSTALL_USD_FULL_NAME"), "DEC_POINT" => GetMessage("CUR_INSTALL_USD_DEC_POINT"), "THOUSANDS_VARIANT" => GetMessage("CUR_INSTALL_USD_THOUSANDS_SEP"), "THOUSANDS_SEP" => false, "DECIMALS" => 2);
                     } elseif ($val == "EUR") {
                         $arFields = array("LID" => $arLangs["LID"], "CURRENCY" => "EUR", "FORMAT_STRING" => GetMessage("CUR_INSTALL_EUR_FORMAT_STRING"), "FULL_NAME" => GetMessage("CUR_INSTALL_EUR_FULL_NAME"), "DEC_POINT" => GetMessage("CUR_INSTALL_EUR_DEC_POINT"), "THOUSANDS_VARIANT" => GetMessage("CUR_INSTALL_EUR_THOUSANDS_SEP"), "THOUSANDS_SEP" => false, "DECIMALS" => 2);
                     } elseif ($val == "RUB") {
                         $arFields = array("LID" => $arLangs["LID"], "CURRENCY" => "RUB", "FORMAT_STRING" => GetMessage("CUR_INSTALL_RUB_FORMAT_STRING"), "FULL_NAME" => GetMessage("CUR_INSTALL_RUB_FULL_NAME"), "DEC_POINT" => GetMessage("CUR_INSTALL_RUB_DEC_POINT"), "THOUSANDS_VARIANT" => GetMessage("CUR_INSTALL_RUB_THOUSANDS_SEP"), "THOUSANDS_SEP" => false, "DECIMALS" => 2);
                     } elseif ($val == "UAH") {
                         $arFields = array("LID" => $arLangs["LID"], "CURRENCY" => "UAH", "FORMAT_STRING" => GetMessage("CUR_INSTALL_UAH_FORMAT_STRING"), "FULL_NAME" => GetMessage("CUR_INSTALL_UAH_FULL_NAME"), "DEC_POINT" => GetMessage("CUR_INSTALL_UAH_DEC_POINT"), "THOUSANDS_VARIANT" => GetMessage("CUR_INSTALL_UAH_THOUSANDS_SEP"), "THOUSANDS_SEP" => false, "DECIMALS" => 2);
                     }
                     CCurrencyLang::Add($arFields);
                 }
             }
         }
     }
     $stackCacheManager->Clear("currency_currency_lang");
     $CACHE_MANAGER->Clean("currency_currency_list");
     $CACHE_MANAGER->Clean("currency_base_currency");
     $stackCacheManager->Clear("currency_rate");
     return true;
 }
Пример #13
0
            LocalRedirect(BX_ROOT . "/admin/lang_edit.php?lang=" . LANGUAGE_ID . "&LID=" . $LID . "&" . $tabControl->ActiveTabParam());
        }
    }
}
$str_ACTIVE = "Y";
$str_WEEK_START = GetMessage('LANG_EDIT_WEEK_START_DEFAULT');
if (!$str_WEEK_START && $str_WEEK_START !== '0') {
    $str_WEEK_START = 1;
}
$str_WEEK_START = intval($str_WEEK_START);
$ID = 0;
if (strlen($COPY_ID) > 0) {
    $lng = CLanguage::GetByID($COPY_ID);
    $lng->ExtractFields("str_");
} elseif (strlen($LID) > 0) {
    $lng = CLanguage::GetByID($LID);
    if ($x = $lng->ExtractFields("str_")) {
        $ID = 1;
    }
} else {
    //only if new
    if (empty($str_FORMAT_NAME)) {
        $str_FORMAT_NAME = CSite::GetDefaultNameFormat();
    }
}
if ($bVarsFromForm) {
    $DB->InitTableVarsForEdit("b_lang", "", "str_");
    $str_FORMAT_NAME = CSite::GetNameFormatByValue($_POST["FORMAT_NAME"]);
}
$strTitle = $ID > 0 ? str_replace("#ID#", "{$str_LID}", GetMessage("EDIT_LANG_TITLE")) : GetMessage("NEW_LANG_TITLE");
$APPLICATION->SetTitle($strTitle);
Пример #14
0
<?

$rsLang = CLanguage::GetByID("ru");
$arLang = $rsLang->Fetch();
if (strtoupper($arLang['CHARSET']) == 'UTF-8') {
	include('.description-utf8.php');
}
else {
	$MESS["WD_TITLE"] = "Мастер установки шаблона Bitrixtemplates";
	$MESS["WD_TITLE_DESCR"] = "Мастер устанавливает шаблон(ы) и файлы шаблона для публичной части сайта";
}
?>
Пример #15
0
			LocalRedirect(FX_ROOT."/admin/lang_edit.php?lang=".LANGUAGE_ID."&LID=".$_POST["LID"]."&".$tabControl->ActiveTabParam());
	}
}

if($bVarsFromForm == false)
{
	$ID = 0;
	$language = false;
	if($_REQUEST["COPY_ID"] <> '')
	{
		$lng = CLanguage::GetByID($_REQUEST["COPY_ID"]);
		$language = $lng->Fetch();
	}
	elseif($_REQUEST["LID"] <> '')
	{
		$lng = CLanguage::GetByID($_REQUEST["LID"]);
		if(($language = $lng->Fetch()))
			$ID = 1;
	}
	if($language === false)
	{
		$language = array(
			"ACTIVE" => "Y",
		);
	}
}
else
{
	$language = $_POST;
}
Пример #16
0
    function ReallyKeep()
    {
        global $USER, $APPLICATION, $STOP_SAVE_STATISTIC, $STOP_MESSAGE, $STOP_REDIRECT_URL, $STOP, $STOP_LIST_ID, $STOP_MESSAGE_LID;
        $DB = CDatabase::GetModuleConnection('statistic');
        $SITE_ID = "";
        if (defined("ADMIN_SECTION") && ADMIN_SECTION === true) {
            $sql_site = "null";
        } elseif (defined("SITE_ID")) {
            $sql_site = "'" . $DB->ForSql(SITE_ID, 2) . "'";
            $SITE_ID = SITE_ID;
        } else {
            $sql_site = "null";
        }
        $ADV_NA = COption::GetOptionString("statistic", "ADV_NA");
        __SetReferer("referer1", "REFERER1_SYN");
        __SetReferer("referer2", "REFERER2_SYN");
        __SetReferer("referer3", "REFERER3_SYN");
        $SAVE_HITS = COption::GetOptionString("statistic", "SAVE_HITS") == "N" ? "N" : "Y";
        $SAVE_VISITS = COption::GetOptionString("statistic", "SAVE_VISITS") == "N" ? "N" : "Y";
        $SAVE_REFERERS = COption::GetOptionString("statistic", "SAVE_REFERERS") == "N" ? "N" : "Y";
        $SAVE_PATH_DATA = COption::GetOptionString("statistic", "SAVE_PATH_DATA") == "N" ? "N" : "Y";
        $stmp = time();
        $hour = date("G", $stmp);
        // 0..23
        $weekday = date("w", $stmp);
        // 0..6
        if ($weekday == 0) {
            $weekday = 7;
        }
        $month = date("n", $stmp);
        // 1..12
        if ($STOP_SAVE_STATISTIC != "N" or $STOP != "Y") {
            if (isset($_SESSION["SESS_ADD_TO_FAVORITES"]) && $_SESSION["SESS_ADD_TO_FAVORITES"] == "Y") {
                $FAVORITES = "Y";
                $_SESSION["SESS_ADD_TO_FAVORITES"] = "";
            } else {
                $FAVORITES = "N";
            }
            $ERROR_404 = defined("ERROR_404") && ERROR_404 == "Y" ? "Y" : "N";
            $DB_now = $DB->GetNowFunction();
            // save function for use in sql
            $DB_now_date = $DB->GetNowDate();
            // save function for use in sql
            $STOP_LIST_ID = intval($STOP_LIST_ID);
            if ($ERROR_404 == "Y") {
                init_get_params($APPLICATION->GetCurUri());
            }
            $IS_USER_AUTHORIZED = intval($_SESSION["SESS_LAST_USER_ID"]) > 0 && is_object($USER) && $USER->IsAuthorized() ? "Y" : "N";
            stat_session_register("SESS_SEARCHER_ID");
            stat_session_register("SESS_SEARCHER_NAME");
            stat_session_register("SESS_SEARCHER_CHECK_ACTIVITY");
            stat_session_register("SESS_SEARCHER_SAVE_STATISTIC");
            stat_session_register("SESS_SEARCHER_HIT_KEEP_DAYS");
            stat_session_register("SESS_LAST_PROTOCOL");
            stat_session_register("SESS_LAST_URI");
            stat_session_register("SESS_LAST_HOST");
            stat_session_register("SESS_LAST_PAGE");
            stat_session_register("SESS_LAST_DIR");
            stat_session_register("SESS_HTTP_REFERER");
            stat_session_register("SESS_COUNTRY_ID");
            stat_session_register("SESS_CITY_ID");
            stat_session_register("SESS_SESSION_ID");
            stat_session_register("SESS_REFERER_ID");
            stat_session_register("FROM_SEARCHER_ID");
            stat_session_register("SESS_FROM_SEARCHERS");
            stat_session_register("SESS_REQUEST_URI_CHANGE");
            stat_session_register("SESS_LAST_DIR_ID");
            stat_session_register("SESS_LAST_PAGE_ID");
            stat_session_register("SESS_GRABBER_STOP_TIME");
            stat_session_register("SESS_GRABBER_DEFENCE_STACK");
            stat_session_register("ACTIVITY_EXCEEDING_NOTIFIED");
            // SESSION_DATA_ID will be false when there is no sessions stored
            // true when session was not found in database
            // and an integer when was found and populated to $SESSION array
            $SESSION_DATA_ID = CKeepStatistics::RestoreSession();
            // Let's check activity limit
            $BLOCK_ACTIVITY = CStatistics::BlockVisitorActivity();
            // Activity under the limit
            if (!$BLOCK_ACTIVITY) {
                //Check if searcher was not deleted from searchers list
                if (intval($_SESSION["SESS_SEARCHER_ID"]) > 0) {
                    $strSql = "\n\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\tFROM b_stat_searcher\n\t\t\t\t\t\tWHERE ID = '" . intval($_SESSION["SESS_SEARCHER_ID"]) . "'\n\t\t\t\t\t";
                    $z = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                    if (!$z->Fetch()) {
                        unset($_SESSION["SESS_SEARCHER_ID"]);
                    }
                }
                // We did not check for searcher
                if (strlen($_SESSION["SESS_SEARCHER_ID"]) <= 0) {
                    // is it searcher hit?
                    $strSql = "\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\tID, NAME, SAVE_STATISTIC, HIT_KEEP_DAYS, CHECK_ACTIVITY\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\tb_stat_searcher\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tACTIVE = 'Y'\n\t\t\t\t\t\tand " . $DB->Length("USER_AGENT") . ">0\n\t\t\t\t\t\tand upper('" . $DB->ForSql($_SERVER["HTTP_USER_AGENT"], 500) . "') like " . $DB->Concat("'%'", "upper(USER_AGENT)", "'%'") . "\n\t\t\t\t\t\tORDER BY " . $DB->Length("USER_AGENT") . " desc, ID\n\t\t\t\t\t\t";
                    $z = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                    if ($zr = $z->Fetch()) {
                        $_SESSION["SESS_SEARCHER_ID"] = intval($zr["ID"]);
                        $_SESSION["SESS_SEARCHER_NAME"] = $zr["NAME"];
                        $_SESSION["SESS_SEARCHER_CHECK_ACTIVITY"] = $zr["CHECK_ACTIVITY"];
                        $_SESSION["SESS_SEARCHER_SAVE_STATISTIC"] = $zr["SAVE_STATISTIC"];
                        $_SESSION["SESS_SEARCHER_HIT_KEEP_DAYS"] = $zr["HIT_KEEP_DAYS"];
                        //Here was warning "A session is active. You cannot change the session module's ini settings at this time."
                        //@ini_set("url_rewriter.tags", "");
                    }
                    $_SESSION["SESS_SEARCHER_ID"] = intval($_SESSION["SESS_SEARCHER_ID"]);
                }
                /************************************************
                					Searcher section
                			************************************************/
                // searcher detected
                if (intval($_SESSION["SESS_SEARCHER_ID"]) > 0) {
                    $_SESSION["SESS_SEARCHER_ID"] = intval($_SESSION["SESS_SEARCHER_ID"]);
                    // let's update day counter
                    $arFields = array("DATE_LAST" => $DB_now, "TOTAL_HITS" => "TOTAL_HITS + 1");
                    $rows = $DB->Update("b_stat_searcher_day", $arFields, "WHERE SEARCHER_ID='" . $_SESSION["SESS_SEARCHER_ID"] . "' and DATE_STAT=" . $DB_now_date, "File: " . __FILE__ . "<br>Line: " . __LINE__, false, false, false);
                    // there is no stat for the day yet
                    if (intval($rows) <= 0) {
                        // add it
                        $arFields_i = array("DATE_STAT" => $DB_now_date, "DATE_LAST" => $DB_now, "SEARCHER_ID" => $_SESSION["SESS_SEARCHER_ID"], "TOTAL_HITS" => 1);
                        $DB->Insert("b_stat_searcher_day", $arFields_i, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                    } elseif (intval($rows) > 1) {
                        $strSql = "SELECT ID FROM b_stat_searcher_day WHERE SEARCHER_ID='" . $_SESSION["SESS_SEARCHER_ID"] . "' and DATE_STAT=" . $DB_now_date . " ORDER BY ID";
                        $i = 0;
                        $rs = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                        while ($ar = $rs->Fetch()) {
                            $i++;
                            if ($i > 1) {
                                $strSql = "DELETE FROM b_stat_searcher_day WHERE ID = " . $ar["ID"];
                                $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                            }
                        }
                    }
                    // save indexed page if neccessary
                    if ($_SESSION["SESS_SEARCHER_SAVE_STATISTIC"] == "Y") {
                        $sql_HIT_KEEP_DAYS = strlen($_SESSION["SESS_SEARCHER_HIT_KEEP_DAYS"]) > 0 ? intval($_SESSION["SESS_SEARCHER_HIT_KEEP_DAYS"]) : "null";
                        $arFields = array("DATE_HIT" => $DB_now, "SEARCHER_ID" => intval($_SESSION["SESS_SEARCHER_ID"]), "URL" => "'" . $DB->ForSql(__GetFullRequestUri(), 2000) . "'", "URL_404" => "'" . $ERROR_404 . "'", "IP" => "'" . $DB->ForSql($_SERVER["REMOTE_ADDR"], 15) . "'", "USER_AGENT" => "'" . $DB->ForSql($_SERVER["HTTP_USER_AGENT"], 500) . "'", "HIT_KEEP_DAYS" => $sql_HIT_KEEP_DAYS, "SITE_ID" => $sql_site);
                        $id = $DB->Insert("b_stat_searcher_hit", $arFields, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                        if ($ERROR_404 == "N") {
                            CStatistics::Set404("b_stat_searcher_hit", "ID = " . intval($id), array("URL_404" => "Y"));
                        }
                    }
                } else {
                    /************************************************
                    					Visitor section
                    			************************************************/
                    /************************************************
                    				Variables which describe current page
                    			************************************************/
                    $CURRENT_DIR = __GetCurrentDir();
                    $CURRENT_PAGE = __GetCurrentPage();
                    $CURRENT_PROTOCOL = CMain::IsHTTPS() ? "https://" : "http://";
                    // protocol
                    $CURRENT_PORT = $_SERVER["SERVER_PORT"];
                    // port
                    $CURRENT_HOST = $_SERVER["HTTP_HOST"];
                    // domain
                    $CURRENT_PAGE = __GetFullRequestUri($CURRENT_PAGE);
                    // w/o parameters
                    $CURRENT_URI = __GetFullRequestUri();
                    // with params
                    $CURRENT_DIR = __GetFullRequestUri($CURRENT_DIR);
                    // catalog
                    /************************************************
                    					Country detection
                    			************************************************/
                    if (strlen($_SESSION["SESS_COUNTRY_ID"]) <= 0) {
                        $obCity = new CCity();
                        $_SESSION["SESS_COUNTRY_ID"] = $obCity->GetCountryCode();
                        $_SESSION["SESS_CITY_ID"] = $obCity->GetCityID();
                    }
                    /************************************************
                    					IP => number
                    			************************************************/
                    $REMOTE_ADDR_NUMBER = ip2number($_SERVER["REMOTE_ADDR"]);
                    /************************************************
                    					Advertising campaign
                    			************************************************/
                    CStatistics::Set_Adv();
                    /************************************************
                    					Guest ID detection
                    			************************************************/
                    $arGuest = CStatistics::Set_Guest();
                    // Setup default advertising campaign
                    if ($ADV_NA == "Y" && intval($_SESSION["SESS_ADV_ID"]) <= 0 && intval($_SESSION["SESS_LAST_ADV_ID"]) <= 0) {
                        $_SESSION["referer1"] = COption::GetOptionString("statistic", "AVD_NA_REFERER1");
                        $_SESSION["referer2"] = COption::GetOptionString("statistic", "AVD_NA_REFERER2");
                        CStatistics::Set_Adv();
                        $arGuest = CStatistics::Set_Guest();
                    }
                    /************************************************
                    					Session section
                    			************************************************/
                    $_SESSION["SESS_SESSION_ID"] = intval($_SESSION["SESS_SESSION_ID"]);
                    //session already exists
                    if ($_SESSION["SESS_SESSION_ID"] > 0) {
                        $SESSION_NEW = "N";
                        // update
                        $arFields = array("USER_ID" => intval($_SESSION["SESS_LAST_USER_ID"]), "USER_AUTH" => "'" . $IS_USER_AUTHORIZED . "'", "USER_AGENT" => "'" . $DB->ForSql($_SERVER["HTTP_USER_AGENT"], 500) . "'", "DATE_LAST" => $DB_now, "IP_LAST" => "'" . $DB->ForSql($_SERVER["REMOTE_ADDR"], 15) . "'", "IP_LAST_NUMBER" => $REMOTE_ADDR_NUMBER, "HITS" => "HITS + 1");
                        $rows = $DB->Update("b_stat_session", $arFields, "WHERE ID='" . $_SESSION["SESS_SESSION_ID"] . "'", "File: " . __FILE__ . "<br>Line: " . __LINE__);
                        // was cleaned up
                        if (intval($rows) <= 0) {
                            // store as new
                            $_SESSION["SESS_SESSION_ID"] = 0;
                            if ($ADV_NA == "Y" && intval($_SESSION["SESS_ADV_ID"]) <= 0 && intval($_SESSION["SESS_LAST_ADV_ID"]) <= 0) {
                                $_SESSION["referer1"] = COption::GetOptionString("statistic", "AVD_NA_REFERER1");
                                $_SESSION["referer2"] = COption::GetOptionString("statistic", "AVD_NA_REFERER2");
                            }
                            CStatistics::Set_Adv();
                            $arGuest = CStatistics::Set_Guest();
                        }
                    }
                    // it is new session
                    if ($_SESSION["SESS_SESSION_ID"] <= 0) {
                        $SESSION_NEW = "Y";
                        // save session data
                        $arFields = array("GUEST_ID" => intval($_SESSION["SESS_GUEST_ID"]), "NEW_GUEST" => "'" . $DB->ForSql($_SESSION["SESS_GUEST_NEW"]) . "'", "USER_ID" => intval($_SESSION["SESS_LAST_USER_ID"]), "USER_AUTH" => "'" . $DB->ForSql($IS_USER_AUTHORIZED) . "'", "URL_FROM" => "'" . $DB->ForSql($_SERVER["HTTP_REFERER"], 2000) . "'", "URL_TO" => "'" . $DB->ForSql($CURRENT_URI, 2000) . "'", "URL_TO_404" => "'" . $DB->ForSql($ERROR_404) . "'", "URL_LAST" => "'" . $DB->ForSql($CURRENT_URI, 2000) . "'", "URL_LAST_404" => "'" . $DB->ForSql($ERROR_404) . "'", "USER_AGENT" => "'" . $DB->ForSql($_SERVER["HTTP_USER_AGENT"], 500) . "'", "DATE_STAT" => $DB_now_date, "DATE_FIRST" => $DB_now, "DATE_LAST" => $DB_now, "IP_FIRST" => "'" . $DB->ForSql($_SERVER["REMOTE_ADDR"], 15) . "'", "IP_FIRST_NUMBER" => "'" . $DB->ForSql($REMOTE_ADDR_NUMBER) . "'", "IP_LAST" => "'" . $DB->ForSql($_SERVER["REMOTE_ADDR"], 15) . "'", "IP_LAST_NUMBER" => "'" . $DB->ForSql($REMOTE_ADDR_NUMBER) . "'", "PHPSESSID" => "'" . $DB->ForSql(session_id(), 255) . "'", "STOP_LIST_ID" => "'" . $DB->ForSql($STOP_LIST_ID) . "'", "COUNTRY_ID" => "'" . $DB->ForSql($_SESSION["SESS_COUNTRY_ID"], 2) . "'", "CITY_ID" => $_SESSION["SESS_CITY_ID"] > 0 ? intval($_SESSION["SESS_CITY_ID"]) : "null", "ADV_BACK" => "null", "FIRST_SITE_ID" => $sql_site, "LAST_SITE_ID" => $sql_site, "HITS" => 1);
                        // campaign?
                        if (intval($_SESSION["SESS_ADV_ID"]) > 0) {
                            $arFields["ADV_ID"] = intval($_SESSION["SESS_ADV_ID"]);
                            $arFields["ADV_BACK"] = "'N'";
                            $arFields["REFERER1"] = "'" . $DB->ForSql($_SESSION["referer1"], 255) . "'";
                            $arFields["REFERER2"] = "'" . $DB->ForSql($_SESSION["referer2"], 255) . "'";
                            $arFields["REFERER3"] = "'" . $DB->ForSql($_SESSION["referer3"], 255) . "'";
                        } elseif (intval($_SESSION["SESS_LAST_ADV_ID"]) > 0) {
                            $arFields["ADV_ID"] = intval($_SESSION["SESS_LAST_ADV_ID"]);
                            $arFields["ADV_BACK"] = "'Y'";
                            $arFields["REFERER1"] = "'" . $DB->ForSql($arGuest["last_referer1"], 255) . "'";
                            $arFields["REFERER2"] = "'" . $DB->ForSql($arGuest["last_referer2"], 255) . "'";
                        }
                        // look for the same IP?
                        $day_host_counter = 1;
                        $day_host_counter_site = strlen($SITE_ID) > 0 ? 1 : 0;
                        $strSql = "\n\t\t\t\t\t\t\tSELECT S.FIRST_SITE_ID\n\t\t\t\t\t\t\tFROM b_stat_session S\n\t\t\t\t\t\t\tWHERE S.IP_FIRST_NUMBER = " . $REMOTE_ADDR_NUMBER . "\n\t\t\t\t\t\t\t\tAND S.DATE_STAT=" . $DB_now_date . "\n\t\t\t\t\t\t";
                        $e = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                        while ($er = $e->Fetch()) {
                            $day_host_counter = 0;
                            if ($SITE_ID == $er["FIRST_SITE_ID"]) {
                                $day_host_counter_site = 0;
                                break;
                            }
                        }
                        $_SESSION["SESS_SESSION_ID"] = intval($DB->Insert("b_stat_session", $arFields, "File: " . __FILE__ . "<br>Line: " . __LINE__));
                        if ($ERROR_404 == "N") {
                            CStatistics::Set404("b_stat_session", "ID = " . $_SESSION["SESS_SESSION_ID"], array("URL_TO_404" => "Y", "URL_LAST_404" => "Y"));
                        }
                        $day_guest_counter = 0;
                        $new_guest_counter = 0;
                        // new guest
                        if ($_SESSION["SESS_GUEST_NEW"] == "Y") {
                            // update day statistic
                            $day_guest_counter = 1;
                            $new_guest_counter = 1;
                        } else {
                            // first hit for today
                            if ($_SESSION["SESS_LAST"] != "Y") {
                                // update day statistic
                                $day_guest_counter = 1;
                                $_SESSION["SESS_LAST"] = "Y";
                            }
                        }
                        // update day counter
                        $arFields = array("SESSIONS" => 1, "C_HOSTS" => intval($day_host_counter), "GUESTS" => intval($day_guest_counter), "NEW_GUESTS" => intval($new_guest_counter), "SESSION" => 1, "HOST" => intval($day_host_counter), "GUEST" => intval($day_guest_counter), "NEW_GUEST" => intval($new_guest_counter));
                        // when current day is already exists
                        // we have to update it
                        $rows = CTraffic::IncParam($arFields);
                        if ($rows !== false && $rows <= 0) {
                            // add new one
                            CStatistics::SetNewDay(1, 0, 1, 0, intval($new_guest_counter), 1);
                            // and update it
                            CTraffic::IncParam(array("SESSION" => 1, "HOST" => 1, "GUEST" => 1, "NEW_GUEST" => intval($new_guest_counter)));
                        }
                        // site is not defined
                        if (strlen($SITE_ID) > 0) {
                            // обновляем счетчик "по дням" для текущего сайта
                            $arFields = array("SESSIONS" => 1, "C_HOSTS" => intval($day_host_counter_site), "SESSION" => 1, "HOST" => intval($day_host_counter_site));
                            // обновим счетчики траффика для текущего дня
                            $rows = CTraffic::IncParam(array(), $arFields, $SITE_ID);
                            // если текущего дня для сайта в базе еще нет то
                            if ($rows !== false && intval($rows) <= 0) {
                                // добавляем его
                                CStatistics::SetNewDayForSite($SITE_ID, 1, 0, 1);
                                // обновим счетчики траффика для текущего дня
                                CTraffic::IncParam(array(), array("SESSION" => 1, "HOST" => 1), $SITE_ID);
                            }
                        }
                        // если страна определена то
                        if (strlen($_SESSION["SESS_COUNTRY_ID"]) > 0) {
                            $arFields = array("SESSIONS" => 1, "NEW_GUESTS" => $new_guest_counter);
                            CStatistics::UpdateCountry($_SESSION["SESS_COUNTRY_ID"], $arFields);
                        }
                        if ($_SESSION["SESS_CITY_ID"] > 0) {
                            $arFields = array("SESSIONS" => 1, "NEW_GUESTS" => $new_guest_counter);
                            CStatistics::UpdateCity($_SESSION["SESS_CITY_ID"], $arFields);
                        }
                        // обновляем гостя
                        $arFields = array("SESSIONS" => "SESSIONS + 1", "LAST_SESSION_ID" => $_SESSION["SESS_SESSION_ID"], "LAST_USER_AGENT" => "'" . $DB->ForSql($_SERVER["HTTP_USER_AGENT"], 500) . "'", "LAST_COUNTRY_ID" => "'" . $DB->ForSql($_SESSION["SESS_COUNTRY_ID"], 2) . "'", "LAST_CITY_ID" => $_SESSION["SESS_CITY_ID"] > 0 ? intval($_SESSION["SESS_CITY_ID"]) : "null");
                        //
                        if ($obCity) {
                            $arFields["LAST_CITY_INFO"] = "'" . $obCity->ForSQL() . "'";
                        }
                        // если это прямой заход по рекламной кампании то
                        if (intval($_SESSION["SESS_ADV_ID"]) > 0) {
                            // обновляем рекламную кампанию последнего захода гостя
                            $arFields["LAST_ADV_ID"] = intval($_SESSION["SESS_ADV_ID"]);
                            $arFields["LAST_ADV_BACK"] = "'N'";
                            $arFields["LAST_REFERER1"] = "'" . $DB->ForSql($_SESSION["referer1"], 255) . "'";
                            $arFields["LAST_REFERER2"] = "'" . $DB->ForSql($_SESSION["referer2"], 255) . "'";
                            $arFields["LAST_REFERER3"] = "'" . $DB->ForSql($_SESSION["referer3"], 255) . "'";
                        } elseif (intval($_SESSION["SESS_LAST_ADV_ID"]) > 0) {
                            // взводим флаг возврата на последнем заходе гостя
                            $arFields["LAST_ADV_BACK"] = "'Y'";
                            $arFields["LAST_REFERER1"] = "'" . $DB->ForSql($arGuest["last_referer1"], 255) . "'";
                            $arFields["LAST_REFERER2"] = "'" . $DB->ForSql($arGuest["last_referer2"], 255) . "'";
                        }
                        if ($_SESSION["SESS_GUEST_NEW"] == "Y") {
                            $arFields["FIRST_SESSION_ID"] = $_SESSION["SESS_SESSION_ID"];
                        }
                        $rows = $DB->Update("b_stat_guest", $arFields, "WHERE ID=" . intval($_SESSION["SESS_GUEST_ID"]), "File: " . __FILE__ . "<br>Line: " . __LINE__, false, false, false);
                        // обновляем рекламные кампании
                        if (intval($_SESSION["SESS_ADV_ID"]) > 0 || intval($_SESSION["SESS_LAST_ADV_ID"]) > 0) {
                            CStatistics::Update_Adv();
                        }
                        /************************************************
                        					Referring sites
                        			************************************************/
                        if ($SAVE_REFERERS != "N" && __GetReferringSite($PROT, $SN, $SN_WithoutPort, $PAGE_FROM) && strlen($SN) > 0 && $SN != $_SERVER["HTTP_HOST"]) {
                            $REFERER_LIST_ID = CStatistics::GetRefererListID($PROT, $SN, $PAGE_FROM, $CURRENT_URI, $ERROR_404, $sql_site);
                            /************************************************
                            					Search phrases
                            			************************************************/
                            if (substr($SN, 0, 4) == "www.") {
                                $sql = "('" . $DB->ForSql(substr($SN, 4), 255) . "' like P.DOMAIN or '" . $DB->ForSql($SN, 255) . "' like P.DOMAIN)";
                            } else {
                                $sql = "'" . $DB->ForSql($SN, 255) . "' like P.DOMAIN";
                            }
                            $strSql = "\n\t\t\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t\t\tS.ID,\n\t\t\t\t\t\t\t\t\tS.NAME,\n\t\t\t\t\t\t\t\t\tP.DOMAIN,\n\t\t\t\t\t\t\t\t\tP.VARIABLE,\n\t\t\t\t\t\t\t\t\tP.CHAR_SET\n\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\tb_stat_searcher S,\n\t\t\t\t\t\t\t\t\tb_stat_searcher_params P\n\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\tS.ACTIVE='Y'\n\t\t\t\t\t\t\t\tand\tP.SEARCHER_ID = S.ID\n\t\t\t\t\t\t\t\tand\t" . $sql . "\n\t\t\t\t\t\t\t";
                            $q = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                            if ($qr = $q->Fetch()) {
                                $_SESSION["FROM_SEARCHER_ID"] = $qr["ID"];
                                $FROM_SEARCHER_NAME = $qr["NAME"];
                                $FROM_SEARCHER_PHRASE = "";
                                if (strlen($qr["VARIABLE"]) > 0) {
                                    $page = substr($PAGE_FROM, strpos($PAGE_FROM, "?") + 1);
                                    $bIsUTF8 = is_utf8_url($page);
                                    parse_str($page, $arr);
                                    $arrVar = explode(",", $qr["VARIABLE"]);
                                    foreach ($arrVar as $var) {
                                        $var = trim($var);
                                        $phrase = $arr[$var];
                                        if (get_magic_quotes_gpc()) {
                                            $phrase = stripslashes($phrase);
                                        }
                                        if ($bIsUTF8) {
                                            $phrase_temp = trim($APPLICATION->ConvertCharset($phrase, "utf-8", LANG_CHARSET));
                                            if (strlen($phrase_temp)) {
                                                $phrase = $phrase_temp;
                                            }
                                        } elseif (strlen($qr["CHAR_SET"]) > 0) {
                                            $phrase_temp = trim($APPLICATION->ConvertCharset($phrase, $qr["CHAR_SET"], LANG_CHARSET));
                                            if (strlen($phrase_temp)) {
                                                $phrase = $phrase_temp;
                                            }
                                        }
                                        $phrase = trim($phrase);
                                        if (strlen($phrase)) {
                                            $FROM_SEARCHER_PHRASE .= strlen($FROM_SEARCHER_PHRASE) > 0 ? " / " . $phrase : $phrase;
                                        }
                                    }
                                }
                                //echo "FROM_SEARCHER_PHRASE = ".$FROM_SEARCHER_PHRASE."<br>\n";
                                // если извлекли поисковую фразу, то занесем ее в базу
                                if (strlen($FROM_SEARCHER_PHRASE) > 0) {
                                    $arFields = array("DATE_HIT" => $DB_now, "SEARCHER_ID" => intval($_SESSION["FROM_SEARCHER_ID"]), "REFERER_ID" => $REFERER_LIST_ID, "PHRASE" => "'" . $DB->ForSql($FROM_SEARCHER_PHRASE, 255) . "'", "URL_FROM" => "'" . $DB->ForSql($PROT . $SN . $PAGE_FROM, 2000) . "'", "URL_TO" => "'" . $DB->ForSql($CURRENT_URI, 2000) . "'", "URL_TO_404" => "'" . $ERROR_404 . "'", "SESSION_ID" => $_SESSION["SESS_SESSION_ID"], "SITE_ID" => $sql_site);
                                    $id = $DB->Insert("b_stat_phrase_list", $arFields, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                                    if ($ERROR_404 == "N") {
                                        CStatistics::Set404("b_stat_phrase_list", "ID = " . intval($id), array("URL_TO_404" => "Y"));
                                    }
                                    // запомним поисковую фразу в сессии
                                    $_SESSION["SESS_SEARCH_PHRASE"] = $FROM_SEARCHER_PHRASE;
                                    // увеличим счетчик фраз у поисковой системы
                                    $_SESSION["SESS_FROM_SEARCHERS"][] = $_SESSION["FROM_SEARCHER_ID"];
                                    $arFields = array("PHRASES" => "PHRASES + 1");
                                    $rows = $DB->Update("b_stat_searcher", $arFields, "WHERE ID=" . intval($_SESSION["FROM_SEARCHER_ID"]), "File: " . __FILE__ . "<br>Line: " . __LINE__, false, false, false);
                                }
                            }
                        }
                    }
                    /************************************************
                    						Hits
                    			************************************************/
                    if ($_SESSION["SESS_SESSION_ID"] > 0) {
                        if ($SAVE_HITS != "N") {
                            // добавляем хит
                            $arFields = array("SESSION_ID" => $_SESSION["SESS_SESSION_ID"], "DATE_HIT" => $DB_now, "GUEST_ID" => intval($_SESSION["SESS_GUEST_ID"]), "NEW_GUEST" => "'" . $DB->ForSql($_SESSION["SESS_GUEST_NEW"]) . "'", "USER_ID" => intval($_SESSION["SESS_LAST_USER_ID"]), "USER_AUTH" => "'" . $IS_USER_AUTHORIZED . "'", "URL" => "'" . $DB->ForSql($CURRENT_URI, 2000) . "'", "URL_404" => "'" . $ERROR_404 . "'", "URL_FROM" => "'" . $DB->ForSql(isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "", 2000) . "'", "IP" => "'" . $DB->ForSql($_SERVER["REMOTE_ADDR"], 15) . "'", "METHOD" => "'" . $DB->ForSql($_SERVER["REQUEST_METHOD"], 10) . "'", "COOKIES" => "'" . $DB->ForSql(GetCookieString(), 2000) . "'", "USER_AGENT" => "'" . $DB->ForSql($_SERVER["HTTP_USER_AGENT"], 500) . "'", "STOP_LIST_ID" => "'" . $STOP_LIST_ID . "'", "COUNTRY_ID" => "'" . $DB->ForSql($_SESSION["SESS_COUNTRY_ID"], 2) . "'", "CITY_ID" => $_SESSION["SESS_CITY_ID"] > 0 ? intval($_SESSION["SESS_CITY_ID"]) : "null", "SITE_ID" => $sql_site);
                            self::$HIT_ID = intval($DB->Insert("b_stat_hit", $arFields, "File: " . __FILE__ . "<br>Line: " . __LINE__));
                            if ($ERROR_404 == "N") {
                                CStatistics::Set404("b_stat_hit", "ID = " . self::$HIT_ID, array("URL_404" => "Y"));
                            }
                        }
                        // если гость на данном хите добавил в фавориты и до этого еще не добавлял то
                        $favorites_counter = 0;
                        if ($FAVORITES == "Y" && $_SESSION["SESS_GUEST_FAVORITES"] == "N") {
                            $ALLOW_ADV_FAVORITES = "Y";
                            $_SESSION["SESS_GUEST_FAVORITES"] = "Y";
                            $favorites_counter = 1;
                        }
                        // обновляем счетчик "по дням"
                        $arFields = array("HITS" => 1, "FAVORITES" => $favorites_counter, "HIT" => 1, "FAVORITE" => $favorites_counter);
                        // если текущий день есть в базе то
                        // обновим счетчики траффика для текущего дня
                        $rows = CTraffic::IncParam($arFields);
                        if ($rows !== false && intval($rows) <= 0) {
                            // если текущий день не определен в базе то
                            // добавляем его
                            $new_guest_counter = $_SESSION["SESS_GUEST_NEW"] == "Y" ? 1 : 0;
                            CStatistics::SetNewDay(1, 0, 1, 1, $new_guest_counter, 1, $favorites_counter);
                            // обновим счетчики траффика для текущего дня
                            CTraffic::IncParam(array("SESSION" => 1, "HIT" => 1, "HOST" => 1, "GUEST" => 1, "NEW_GUEST" => $new_guest_counter, "FAVORITE" => $favorites_counter));
                        }
                        // если сайт определен то
                        if (strlen($SITE_ID) > 0) {
                            // обновляем счетчик "по дням"
                            $arFields = array("HITS" => 1, "HIT" => 1);
                            // если текущий день сайта определен в базе то
                            // обновим счетчики траффика для текущего дня
                            $rows = CTraffic::IncParam(array(), $arFields, $SITE_ID);
                            if ($rows !== false && intval($rows) <= 0) {
                                // если текущий день сайта не определен в базе то
                                // добавляем его
                                CStatistics::SetNewDayForSite($SITE_ID, 1, 0, 1, 1);
                                // обновим счетчики траффика для текущего дня
                                CTraffic::IncParam(array(), array("SESSION" => 1, "HIT" => 1, "HOST" => 1), $SITE_ID);
                            }
                        }
                        /************************************************
                        							Пути по сайту
                        			************************************************/
                        if ($SAVE_PATH_DATA != "N") {
                            CStatistics::SavePathData($SITE_ID, $CURRENT_PAGE, $ERROR_404);
                        }
                        /************************************************
                        						Посещение разделов и страниц
                        			************************************************/
                        if ($SAVE_VISITS != "N") {
                            CStatistics::SaveVisits($sql_site, $SESSION_NEW, $CURRENT_DIR, $CURRENT_PAGE, $ERROR_404);
                        }
                        // обновляем сессию
                        $arFields = array("LAST_HIT_ID" => self::$HIT_ID, "URL_LAST" => "'" . $DB->ForSql($CURRENT_URI, 2000) . "'", "URL_LAST_404" => "'" . $ERROR_404 . "'", "DATE_LAST" => $DB_now, "LAST_SITE_ID" => $sql_site);
                        if ($SESSION_NEW == "Y") {
                            $arFields["FIRST_HIT_ID"] = self::$HIT_ID;
                        }
                        if ($FAVORITES == "Y") {
                            $arFields["FAVORITES"] = "'Y'";
                        }
                        $DB->Update("b_stat_session", $arFields, "WHERE ID=" . $_SESSION["SESS_SESSION_ID"], "File: " . __FILE__ . "<br>Line: " . __LINE__, false, false, false);
                        if ($ERROR_404 == "N") {
                            CStatistics::Set404("b_stat_session", "ID = " . $_SESSION["SESS_SESSION_ID"], array("URL_LAST_404" => "Y"));
                        }
                        // обновляем гостя
                        $arFields = array("HITS" => "HITS + 1", "LAST_SESSION_ID" => $_SESSION["SESS_SESSION_ID"], "LAST_DATE" => $DB_now, "LAST_USER_ID" => intval($_SESSION["SESS_LAST_USER_ID"]), "LAST_USER_AUTH" => "'" . $IS_USER_AUTHORIZED . "'", "LAST_URL_LAST" => "'" . $DB->ForSql($CURRENT_URI, 2000) . "'", "LAST_URL_LAST_404" => "'" . $ERROR_404 . "'", "LAST_USER_AGENT" => "'" . $DB->ForSql($_SERVER["HTTP_USER_AGENT"], 500) . "'", "LAST_IP" => "'" . $DB->ForSql($_SERVER["REMOTE_ADDR"], 15) . "'", "LAST_COOKIE" => "'" . $DB->ForSql(GetCookieString(), 2000) . "'", "LAST_LANGUAGE" => "'" . $DB->ForSql($_SERVER["HTTP_ACCEPT_LANGUAGE"], 255) . "'", "LAST_SITE_ID" => $sql_site);
                        if ($FAVORITES == "Y") {
                            $arFields["FAVORITES"] = "'Y'";
                        }
                        $DB->Update("b_stat_guest", $arFields, "WHERE ID=" . intval($_SESSION["SESS_GUEST_ID"]), "File: " . __FILE__ . "<br>Line: " . __LINE__, false, false, false);
                        if ($ERROR_404 == "N") {
                            CStatistics::Set404("b_stat_guest", "ID = " . intval($_SESSION["SESS_GUEST_ID"]), array("LAST_URL_LAST_404" => "Y"));
                        }
                        // обновляем прямые рекламные кампании
                        if (intval($_SESSION["SESS_ADV_ID"]) > 0) {
                            // увеличиваем счетчик хитов на прямом заходе
                            $arFields = array("DATE_LAST" => $DB_now, "HITS" => "HITS+1");
                            if ($FAVORITES == "Y" && $ALLOW_ADV_FAVORITES == "Y") {
                                // увеличиваем счетчик посетителей добавивших в избранное на прямом заходе
                                $arFields["FAVORITES"] = "FAVORITES + 1";
                                $favorite = 1;
                            }
                            $DB->Update("b_stat_adv", $arFields, "WHERE ID=" . intval($_SESSION["SESS_ADV_ID"]), "File: " . __FILE__ . "<br>Line: " . __LINE__, false, false, false);
                            // обновляем счетчик хитов по дням
                            $arFields = array("HITS" => "HITS+1", "FAVORITES" => "FAVORITES + " . intval($favorite));
                            $rows = $DB->Update("b_stat_adv_day", $arFields, "WHERE ADV_ID=" . intval($_SESSION["SESS_ADV_ID"]) . " and DATE_STAT=" . $DB_now_date, "File: " . __FILE__ . "<br>Line: " . __LINE__, false, false, false);
                            // если его нет то
                            if (intval($rows) <= 0) {
                                // добавляем его
                                $arFields = array("ADV_ID" => intval($_SESSION["SESS_ADV_ID"]), "DATE_STAT" => $DB_now_date, "HITS" => 1, "FAVORITES" => intval($favorite));
                                $DB->Insert("b_stat_adv_day", $arFields, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                            }
                        } elseif (intval($_SESSION["SESS_LAST_ADV_ID"]) > 0) {
                            // увеличиваем счетчик хитов на возврате
                            $arFields = array("DATE_LAST" => $DB_now, "HITS_BACK" => "HITS_BACK+1");
                            if ($FAVORITES == "Y" && $ALLOW_ADV_FAVORITES == "Y") {
                                // увеличиваем счетчик посетителей добавивших в избранное на возврате
                                $arFields["FAVORITES_BACK"] = "FAVORITES_BACK + 1";
                                $favorite = 1;
                            }
                            $DB->Update("b_stat_adv", $arFields, "WHERE ID=" . intval($_SESSION["SESS_LAST_ADV_ID"]), "File: " . __FILE__ . "<br>Line: " . __LINE__, false, false, false);
                            $arFields = array("HITS_BACK" => "HITS_BACK+1", "FAVORITES_BACK" => "FAVORITES_BACK + " . intval($favorite));
                            // обновляем счетчик хитов по дням
                            $rows = $DB->Update("b_stat_adv_day", $arFields, "WHERE ADV_ID=" . intval($_SESSION["SESS_LAST_ADV_ID"]) . " and DATE_STAT=" . $DB_now_date, "File: " . __FILE__ . "<br>Line: " . __LINE__, false, false, false);
                            // если его нет то
                            if (intval($rows) <= 0) {
                                // добавляем его
                                $arFields = array("ADV_ID" => intval($_SESSION["SESS_LAST_ADV_ID"]), "DATE_STAT" => $DB_now_date, "HITS_BACK" => 1, "FAVORITES_BACK" => intval($favorite));
                                $DB->Insert("b_stat_adv_day", $arFields, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                            }
                        }
                        // обрабатываем событие
                        if (defined("GENERATE_EVENT") && GENERATE_EVENT == "Y") {
                            global $event1, $event2, $event3, $goto, $money, $currency, $site_id;
                            if (strlen($site_id) <= 0) {
                                $site_id = false;
                            }
                            CStatistics::Set_Event($event1, $event2, $event3, $goto, $money, $currency, $site_id);
                        }
                        // увеличиваем счетчик хитов у страны
                        if (strlen($_SESSION["SESS_COUNTRY_ID"]) > 0) {
                            CStatistics::UpdateCountry($_SESSION["SESS_COUNTRY_ID"], array("HITS" => 1));
                        }
                        if ($_SESSION["SESS_CITY_ID"] > 0) {
                            CStatistics::UpdateCity($_SESSION["SESS_CITY_ID"], array("HITS" => 1));
                        }
                        if (isset($_SESSION["SESS_FROM_SEARCHERS"]) && is_array($_SESSION["SESS_FROM_SEARCHERS"]) && !empty($_SESSION["SESS_FROM_SEARCHERS"])) {
                            // обновляем счетчик хитов у поисковых фраз для поисковиков
                            $arFields = array("PHRASES_HITS" => "PHRASES_HITS+1");
                            $_SESSION["SESS_FROM_SEARCHERS"] = array_unique($_SESSION["SESS_FROM_SEARCHERS"]);
                            if (count($_SESSION["SESS_FROM_SEARCHERS"]) > 0) {
                                $str = "0";
                                foreach ($_SESSION["SESS_FROM_SEARCHERS"] as $value) {
                                    $str .= ", " . intval($value);
                                }
                                $DB->Update("b_stat_searcher", $arFields, "WHERE ID in ({$str})", "File: " . __FILE__ . "<br>Line: " . __LINE__, false, false, false);
                            }
                        }
                        if (isset($_SESSION["SESS_REFERER_ID"]) && intval($_SESSION["SESS_REFERER_ID"]) > 0) {
                            // обновляем ссылающиеся
                            $arFields = array("HITS" => "HITS+1");
                            $DB->Update("b_stat_referer", $arFields, "WHERE ID=" . intval($_SESSION["SESS_REFERER_ID"]), "File: " . __FILE__ . "<br>Line: " . __LINE__, false, false, false);
                        }
                    }
                    /*******************************************************
                    				Переменные хранящие параметры предыдущей страницы
                    			*******************************************************/
                    $_SESSION["SESS_HTTP_REFERER"] = $_SESSION["SESS_LAST_URI"];
                    $_SESSION["SESS_LAST_PROTOCOL"] = $CURRENT_PROTOCOL;
                    $_SESSION["SESS_LAST_PORT"] = $CURRENT_PORT;
                    $_SESSION["SESS_LAST_HOST"] = $CURRENT_HOST;
                    $_SESSION["SESS_LAST_URI"] = $CURRENT_URI;
                    $_SESSION["SESS_LAST_PAGE"] = $CURRENT_PAGE;
                    $_SESSION["SESS_LAST_DIR"] = $CURRENT_DIR;
                }
            } else {
                /************************************************
                				Обработка превышения лимита активности
                			*************************************************/
                $fname = $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/activity_limit.php";
                if (file_exists($fname)) {
                    include $fname;
                } else {
                    CHTTP::SetStatus("503 Service Unavailable");
                    die;
                }
            }
            /************************************************************
            				Обрабатываем ситуацию когда не поддерживаются
            				сессии и/или не сохраняются куки
            			*************************************************************/
            // если мы делали select из таблицы b_stat_session_data то
            if ($SESSION_DATA_ID) {
                $arrSTAT_SESSION = stat_session_register(true);
                $sess_data_for_db = strtolower($DB->type) == "oracle" ? "'" . $DB->ForSql(serialize($arrSTAT_SESSION), 2000) . "'" : "'" . $DB->ForSql(serialize($arrSTAT_SESSION)) . "'";
                // если в результате этого select'а были выбраны данные то
                if (intval($SESSION_DATA_ID) > 0 && $SESSION_DATA_ID !== true) {
                    // обновляем их
                    $arFields = array("DATE_LAST" => $DB_now, "GUEST_MD5" => "'" . get_guest_md5() . "'", "SESS_SESSION_ID" => intval($_SESSION["SESS_SESSION_ID"]), "SESSION_DATA" => $sess_data_for_db);
                    $DB->Update("b_stat_session_data", $arFields, "WHERE ID = " . intval($SESSION_DATA_ID), "File: " . __FILE__ . "<br>Line: " . __LINE__, false, false, false);
                } else {
                    // иначе вставляем эти данные
                    $arFields = array("DATE_FIRST" => $DB_now, "DATE_LAST" => $DB_now, "GUEST_MD5" => "'" . get_guest_md5() . "'", "SESS_SESSION_ID" => intval($_SESSION["SESS_SESSION_ID"]), "SESSION_DATA" => $sess_data_for_db);
                    $DB->Insert("b_stat_session_data", $arFields, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                }
            }
        }
        // if ($STOP_SAVE_STATISTIC!="N" or $STOP!="Y")
        if ($STOP == "Y") {
            $z = CLanguage::GetByID($STOP_MESSAGE_LID);
            $zr = $z->Fetch();
            $charset = strlen($zr["CHARSET"]) > 0 ? $zr["CHARSET"] : "windows-1251";
            //We have URL with no MESSAGE
            if (strlen($STOP_REDIRECT_URL) > 0 && strlen($STOP_MESSAGE) <= 0) {
                //So just do redirect
                LocalRedirect($STOP_REDIRECT_URL, true);
            } elseif (strlen($STOP_MESSAGE) > 0) {
                $STOP_MESSAGE .= " [" . $STOP_LIST_ID . "]";
                echo '<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=' . $charset . '">
		' . (strlen($STOP_REDIRECT_URL) > 0 ? '<meta http-equiv="Refresh" content="3;URL=' . htmlspecialcharsbx($STOP_REDIRECT_URL) . '">' : '') . '
	</head>
	<body>
		<div align="center"><h3>' . $STOP_MESSAGE . '</h3></div>
	</body>
</html>';
            }
            die;
        }
    }