コード例 #1
1
ファイル: typograf.php プロジェクト: askew-/bitrix-typograf
 public static function onBeforeHTMLEditorScriptRuns()
 {
     $asset = Asset::getInstance();
     $asset->addJs('/bitrix/js/newkaliningrad.typografru/typograf.js');
     $messages = Loc::loadLanguageFile(Path::normalize(__FILE__));
     $asset->addString(sprintf('<script>BX.message(%s)</script>', Json::encode($messages, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE)));
 }
コード例 #2
0
	"ACTIVE_FROM" => "16.03.2011 10:00:00",
	"ACTIVE_TO" => "16.03.2011 10:30:00",
	"PROPERTY_LOCATION" => "ReCoRd 13",
);
$r = $e->Update(
	array("XML_ID" => "AAATAGFudG...", "MODIFICATION_LABEL" => "DwAAABY..."),
	$arFields
);

$r = $e->Delete("AAATAGFud...");

print_r($e->GetErrors());
*/
if (!class_exists("CDavExchangeCalendar")) {
    IncludeModuleLangFile(__FILE__);
    \Bitrix\Main\Localization\Loc::loadLanguageFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/dav/classes/general/exchangecalendar.php");
    class CDavExchangeCalendar extends CDavExchangeClient
    {
        static $arMapItem = array("MimeContent", "ItemId", "ParentFolderId", "ItemClass", "Subject", "Sensitivity", "Body", "Attachments", "DateTimeReceived", "Size", "Categories", "Importance", "InReplyTo", "IsSubmitted", "IsDraft", "IsFromMe", "IsResend", "IsUnmodified", "InternetMessageHeaders", "DateTimeSent", "DateTimeCreated", "ResponseObjects", "ReminderDueBy", "ReminderIsSet", "ReminderMinutesBeforeStart", "DisplayCc", "DisplayTo", "HasAttachments", "ExtendedProperty", "Culture", "EffectiveRights", "LastModifiedName", "LastModifiedTime");
        static $arMapCalendar = array("UID", "RecurrenceId", "DateTimeStamp", "Start", "End", "OriginalStart", "IsAllDayEvent", "LegacyFreeBusyStatus", "Location", "When", "IsMeeting", "IsCancelled", "IsRecurring", "MeetingRequestWasSent", "IsResponseRequested", "CalendarItemType", "MyResponseType", "Organizer", "RequiredAttendees", "OptionalAttendees", "Resources", "ConflictingMeetingCount", "AdjacentMeetingCount", "ConflictingMeetings", "AdjacentMeetings", "Duration", "TimeZone", "AppointmentReplyTime", "AppointmentSequenceNumber", "AppointmentState", "Recurrence", "FirstOccurrence", "LastOccurrence", "ModifiedOccurrences", "DeletedOccurrences", "MeetingTimeZone", "ConferenceType", "AllowNewTimeProposal", "IsOnlineMeeting", "MeetingWorkspaceUrl", "NetShowUrl");
        public function __construct($scheme, $server, $port, $userName, $userPassword, $siteId = null)
        {
            parent::__construct($scheme, $server, $port, $userName, $userPassword);
            $this->SetCurrentEncoding($siteId);
        }
        public function GetList($arFilter = array(), $arMode = array())
        {
            $this->ClearErrors();
            $request = $this->CreateSOAPRequest("POST", $this->GetPath());
            $request->AddHeader("Content-Type", "text/xml; charset=utf-8");
            $request->AddHeader("SOAPAction", "http://schemas.microsoft.com/exchange/services/2006/messages/FindItem");
コード例 #3
0
ファイル: result_rec.php プロジェクト: DarneoStudio/bitrix
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
use Bitrix\Main\Localization\Loc;
use Bitrix\Main\IO\Path;
use Bitrix\Sale\Order;
require_once Path::combine(__DIR__, "functions.php");
Loc::loadLanguageFile(Path::combine(__DIR__, "statuses.php"));
$success = isset($_POST['bill_id']) && isset($_POST['amount']) && isset($_POST['ccy']) && isset($_POST['status']) && isset($_POST['error']) && isset($_POST['user']) && isset($_POST['comment']) && isset($_POST['prv_name']) && isset($_POST['command']);
if (!$success) {
    qiwiWalletXmlResponse(QIWI_WALLET_ERROR_CODE_NONE);
}
if (!isset($GLOBALS["SALE_INPUT_PARAMS"])) {
    $GLOBALS["SALE_INPUT_PARAMS"] = array();
}
$authType = CSalePaySystemAction::GetParamValue("AUTHORIZATION");
if ($authType == "OPEN") {
    $login = CSalePaySystemAction::GetParamValue("SHOP_ID");
    $password = CSalePaySystemAction::GetParamValue("NOTICE_PASSWORD");
    if (!qiwiWalletCheckAuth($login, $password)) {
        qiwiWalletXmlResponse(QIWI_WALLET_ERROR_CODE_AUTH);
    }
} else {
    $key = CSalePaySystemAction::GetParamValue("API_PASSWORD");
    if (isset($_SERVER['HTTP_X_API_SIGNATURE']) && strlen($key) > 0) {
        $key = CSalePaySystemAction::GetParamValue("API_PASSWORD");
        $params = $_POST;
        ksort($params);
        $check = base64_encode(sha1($key, implode("|", array_values($params))));
コード例 #4
0
ファイル: calendar.php プロジェクト: andy-profi/bxApiDocs
 public static function GetAccessTasks($binging = 'calendar_section')
 {
     \Bitrix\Main\Localization\Loc::loadLanguageFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/calendar/admin/task_description.php");
     if (is_array(self::$arAccessTask[$binging])) {
         return self::$arAccessTask[$binging];
     }
     $bIntranet = self::IsIntranetEnabled();
     $arTasks = array();
     $res = CTask::GetList(array('ID' => 'asc'), array('MODULE_ID' => 'calendar', 'BINDING' => $binging));
     while ($arRes = $res->Fetch()) {
         if (!$bIntranet && (strtolower($arRes['NAME']) == 'calendar_view_time' || strtolower($arRes['NAME']) == 'calendar_view_title')) {
             continue;
         }
         $name = '';
         if ($arRes['SYS']) {
             $name = GetMessage('TASK_NAME_' . strtoupper($arRes['NAME']));
         }
         if (strlen($name) == 0) {
             $name = $arRes['NAME'];
         }
         $arTasks[$arRes['ID']] = array('name' => $arRes['NAME'], 'title' => $name);
     }
     self::$arAccessTask[$binging] = $arTasks;
     return $arTasks;
 }
コード例 #5
0
ファイル: step1.php プロジェクト: nycmic/bittest
		{
			$orderPaidStatus    = 'P';
			$deliveryAssembleStatus  = 'DA';
			$deliveryGoodsStatus     = 'DG';
			$deliveryTransportStatus = 'DT';
			$deliveryShipmentStatus  = 'DS';

			$statusIds = array(
				$orderPaidStatus, $deliveryAssembleStatus, $deliveryGoodsStatus, $deliveryTransportStatus, $deliveryShipmentStatus,
			);

			$statusLanguages = array();

			foreach($arLanguages as $langID)
			{
				Loc::loadLanguageFile($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/sale/lib/status.php', $langID);

				foreach ($statusIds as $statusId)
				{
					if ($statusName = Loc::getMessage("SALE_STATUS_{$statusId}"))
					{
						$statusLanguages[$statusId] []= array(
							'LID'         => $langID,
							'NAME'        => $statusName,
							'DESCRIPTION' => Loc::getMessage("SALE_STATUS_{$statusId}_DESCR"),
						);
					}
				}
			}

			OrderStatus::install(array(
コード例 #6
0
ファイル: component.php プロジェクト: DarneoStudio/bitrix
 /**
  * Function includes language files from within the component directory.
  *
  * <p>For example: $this->includeComponentLang("ajax.php") will include "lang/en/ajax.php" file. </p>
  * <p>Note: component must be inited by initComponent method.</p>
  * @param string $relativePath
  * @param string|bool $lang
  * @return void
  *
  */
 public final function includeComponentLang($relativePath = "", $lang = false)
 {
     if (!$this->__bInited) {
         return null;
     }
     if ($relativePath == "") {
         $relativePath = "component.php";
     }
     $path = $_SERVER["DOCUMENT_ROOT"] . $this->__path . "/" . $relativePath;
     if ($lang === false) {
         \Bitrix\Main\Localization\Loc::loadMessages($path);
     } else {
         \Bitrix\Main\Localization\Loc::loadLanguageFile($path, $lang);
     }
 }
コード例 #7
0
ファイル: sale_link.php プロジェクト: mrdeadmouse/u136006
// get default vat
$defCatVatId = 0;
$dbVat = CCatalogVat::GetListEx(array('SORT' => 'ASC'), array(), false, array('nPageTop' => 1));
if ($arVat = $dbVat->Fetch()) {
    $defCatVatId = $arVat['ID'];
}
unset($arVat, $dbVat);
$defCatVatId = (int) $defCatVatId;
// create base price
$basePriceId = 0;
$basePrice = array();
$dbRes = CCatalogGroup::GetListEx(array(), array("BASE" => "Y"), false, false, array('ID'));
if (!($basePrice = $dbRes->Fetch())) {
    $catalogGroupLangFiles = array();
    foreach ($arActiveLangs as &$language) {
        $catalogGroupLangFiles[$language] = Loc::loadLanguageFile(__FILE__, $language);
    }
    $arFields = array();
    $arFields["USER_LANG"] = array();
    foreach ($arActiveLangs as &$language) {
        if (isset($catalogGroupLangFiles[$language])) {
            $arFields["USER_LANG"][$language] = $catalogGroupLangFiles[$language]['CRM_BASE_PRICE_NAME'];
        }
    }
    unset($language);
    unset($catalogGroupLangFiles);
    $arFields["BASE"] = "Y";
    $arFields["SORT"] = 100;
    $arFields["NAME"] = "BASE";
    $arFields["USER_GROUP"] = array(1, 2);
    $arFields["USER_GROUP_BUY"] = array(1, 2);
コード例 #8
0
ファイル: index.php プロジェクト: mrdeadmouse/u136006
 private function __getLangMessages($path, $messID, $langList)
 {
     $result = array();
     if (empty($messID)) {
         return $result;
     }
     if (!is_array($messID)) {
         $messID = array($messID);
     }
     if (!is_array($langList)) {
         $langList = array($langList);
     }
     if (empty($langList)) {
         $languageIterator = LanguageTable::getList(array('select' => array('ID'), 'filter' => array('ACTIVE' => 'Y')));
         while ($oneLanguage = $languageIterator->fetch()) {
             $langList[] = $oneLanguage['ID'];
         }
         unset($oneLanguage, $languageIterator);
     }
     foreach ($langList as &$oneLanguage) {
         $mess = Loc::loadLanguageFile($path, $oneLanguage);
         foreach ($messID as &$oneMess) {
             if (empty($oneMess) || !isset($mess[$oneMess]) || empty($mess[$oneMess])) {
                 continue;
             }
             if (!isset($result[$oneMess])) {
                 $result[$oneMess] = array();
             }
             $result[$oneMess][$oneLanguage] = $mess[$oneMess];
         }
         unset($oneMess, $mess);
     }
     unset($oneLanguage);
     return $result;
 }
コード例 #9
0
 function GetUserTypeDescription()
 {
     \Bitrix\Main\Localization\Loc::loadLanguageFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/webdav/classes/usertypewebdav.php");
     return array("USER_TYPE_ID" => "webdav_element_history", "CLASS_NAME" => __CLASS__, "DESCRIPTION" => GetMessage("USER_TYPE_WEBDAV_FILE_HISTORY_DESCRIPTION"), "BASE_TYPE" => "string");
 }
コード例 #10
0
ファイル: export.php プロジェクト: akniyev/itprom_dobrohost
 /**
  * @param $name
  *
  * @return string
  */
 public static function getTagName($name)
 {
     if (static::$lid === null) {
         static::setLanguage(LANGUAGE_ID);
     }
     static $lang = array();
     if (empty($lang[static::$lid])) {
         $lang[static::$lid] = \Bitrix\Main\Localization\Loc::loadLanguageFile($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/sale/general/export.php', static::$lid);
     }
     if (array_key_exists($name, $lang[static::$lid]) && strval(trim($lang[static::$lid][$name])) !== '') {
         $value = $lang[static::$lid][$name];
     } else {
         $value = \Bitrix\Main\Localization\Loc::getMessage($name);
     }
     return $value;
 }
コード例 #11
0
ファイル: converter.php プロジェクト: Satariall/izurit
         $adminNotifyIterator = CAdminNotify::GetList(array(), array('MODULE_ID' => 'sale', 'TAG' => 'BASKET_DISCOUNT_CONVERTED'));
         if (!$adminNotifyIterator) {
             $adminNotify = $adminNotifyIterator->Fetch();
         }
         unset($adminNotifyIterator);
         if (empty($adminNotify)) {
             $langMess = array();
             $langList = array();
             $languageIterator = \Bitrix\Main\Localization\LanguageTable::getList(array('select' => array('ID'), 'filter' => array('=ACTIVE' => 'Y')));
             while ($oneLanguage = $languageIterator->fetch()) {
                 $langList[] = $oneLanguage['ID'];
             }
             unset($oneLanguage, $languageIterator);
             $messID = 'SALE_CONVERTER_ADMIN_NOTIFY_CONVERT_BASKET_DISCOUNT';
             foreach ($langList as &$oneLanguage) {
                 $mess = Loc::loadLanguageFile(__FILE__, $oneLanguage);
                 if (!isset($mess[$messID]) || empty($mess[$messID])) {
                     continue;
                 }
                 $langMess[$oneLanguage] = str_replace('#LINK#', '/bitrix/admin/settings.php?lang=' . $oneLanguage . '&mid=sale', $mess[$messID]);
             }
             unset($mess, $oneLanguage);
             reset($langMess);
             $defaultMess = isset($langMess[LANGUAGE_ID]) ? $langMess[LANGUAGE_ID] : current($langMess);
             $fields = array('MESSAGE' => $defaultMess, 'TAG' => 'BASKET_DISCOUNT_CONVERTED', 'MODULE_ID' => 'sale', 'ENABLE_CLOSE' => 'Y', 'PUBLIC_SECTION' => 'N', 'LANG' => $langMess);
             CAdminNotify::Add($fields);
             unset($fields, $langMess, $defaultMess, $langList);
         }
         unset($adminNotify);
     }
 }
コード例 #12
0
ファイル: index.php プロジェクト: Satariall/izurit
 protected function installCurrencies()
 {
     if (!Loader::includeModule('currency')) {
         return;
     }
     $bitrix24Path = $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/bitrix24/';
     $bitrix24 = file_exists($bitrix24Path) && is_dir($bitrix24Path);
     unset($bitrix24Path);
     $currencyIterator = \Bitrix\Currency\CurrencyTable::getList(array('select' => array('CURRENCY'), 'limit' => 1));
     $currency = $currencyIterator->fetch();
     if (!empty($currency)) {
         return;
     }
     $languageID = '';
     $siteIterator = SiteTable::getList(array('select' => array('LID', 'LANGUAGE_ID'), 'filter' => array('=DEF' => 'Y', '=ACTIVE' => 'Y')));
     if ($site = $siteIterator->fetch()) {
         $languageID = (string) $site['LANGUAGE_ID'];
     }
     unset($site, $siteIterator);
     if ($languageID == '') {
         $languageID = 'en';
     }
     $currencyList = array();
     $currencySetID = '';
     switch ($languageID) {
         case 'ua':
         case 'de':
         case 'en':
         case 'la':
         case 'tc':
         case 'sc':
         case 'in':
             $currencySetID = $languageID;
             break;
         case 'ru':
             if (!$bitrix24) {
                 $languageIterator = LanguageTable::getList(array('select' => array('ID'), 'filter' => array('=ID' => 'kz', '=ACTIVE' => 'Y')));
                 if ($existLanguage = $languageIterator->fetch()) {
                     $currencySetID = $existLanguage['ID'];
                 }
                 if ($currencySetID == '') {
                     $languageIterator = LanguageTable::getList(array('select' => array('ID'), 'filter' => array('=ID' => 'ua', '=ACTIVE' => 'Y')));
                     if ($existLanguage = $languageIterator->fetch()) {
                         $currencySetID = $existLanguage['ID'];
                     }
                 }
                 unset($existLanguage, $languageIterator);
             }
             if ($currencySetID == '') {
                 $currencySetID = $languageID;
             }
             break;
         default:
             $currencySetID = 'en';
             break;
     }
     $datetimeEntity = new Main\DB\SqlExpression(Main\Application::getConnection()->getSqlHelper()->getCurrentDateTimeFunction());
     switch ($currencySetID) {
         case 'kz':
             $addCurrency = array(array('CURRENCY' => 'KZT', 'NUMCODE' => '398', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1), array('CURRENCY' => 'RUB', 'NUMCODE' => '643', 'AMOUNT' => 4.4, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 4.4), array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 283.17, 'AMOUNT_CNT' => 1, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 283.17), array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 310.78, 'AMOUNT_CNT' => 1, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 310.78));
             break;
         case 'ua':
             $addCurrency = array(array('CURRENCY' => 'UAH', 'NUMCODE' => '980', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1), array('CURRENCY' => 'RUB', 'NUMCODE' => '643', 'AMOUNT' => 3.61, 'AMOUNT_CNT' => 10, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.361), array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 2322.93, 'AMOUNT_CNT' => 100, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 23.2293), array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 2548.19, 'AMOUNT_CNT' => 100, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 25.4819));
             break;
         case 'ru':
             $addCurrency = array(array('CURRENCY' => 'RUB', 'NUMCODE' => '643', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1), array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 64.36, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 64.36), array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 70.59999999999999, 'AMOUNT_CNT' => 1, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 70.59999999999999), array('CURRENCY' => 'UAH', 'NUMCODE' => '980', 'AMOUNT' => 27.69, 'AMOUNT_CNT' => 10, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 2.769), array('CURRENCY' => 'BYR', 'NUMCODE' => '974', 'AMOUNT' => 36.9, 'AMOUNT_CNT' => 10000, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.00369));
             break;
         case 'de':
         case 'la':
             $addCurrency = array(array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1), array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 0.91, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.91), array('CURRENCY' => 'CNY', 'NUMCODE' => '156', 'AMOUNT' => 14.35, 'AMOUNT_CNT' => 100, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.1435), array('CURRENCY' => 'BRL', 'NUMCODE' => '986', 'AMOUNT' => 23.21, 'AMOUNT_CNT' => 100, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.2321), array('CURRENCY' => 'INR', 'NUMCODE' => '356', 'AMOUNT' => 13.97, 'AMOUNT_CNT' => 1000, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.01397));
             break;
         case 'tc':
         case 'sc':
             $addCurrency = array(array('CURRENCY' => 'CNY', 'NUMCODE' => '156', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1), array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 6.36, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 6.36), array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 6.97, 'AMOUNT_CNT' => 1, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 6.97), array('CURRENCY' => 'BRL', 'NUMCODE' => '986', 'AMOUNT' => 1.61, 'AMOUNT_CNT' => 1, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 1.61), array('CURRENCY' => 'INR', 'NUMCODE' => '356', 'AMOUNT' => 9.74, 'AMOUNT_CNT' => 100, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.09737));
             break;
         case 'in':
             $addCurrency = array(array('CURRENCY' => 'INR', 'NUMCODE' => '356', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1), array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 65.31, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 65.31), array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 71.56, 'AMOUNT_CNT' => 1, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 71.56), array('CURRENCY' => 'CNY', 'NUMCODE' => '156', 'AMOUNT' => 10.27, 'AMOUNT_CNT' => 1, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 10.27), array('CURRENCY' => 'BRL', 'NUMCODE' => '986', 'AMOUNT' => 16.56, 'AMOUNT_CNT' => 1, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 16.56));
             break;
         case 'br':
             $addCurrency = array(array('CURRENCY' => 'BRL', 'NUMCODE' => '986', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1), array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 3.9, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 3.9), array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 4.29, 'AMOUNT_CNT' => 1, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 4.29), array('CURRENCY' => 'CNY', 'NUMCODE' => '156', 'AMOUNT' => 61.44, 'AMOUNT_CNT' => 100, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.6143999999999999), array('CURRENCY' => 'INR', 'NUMCODE' => '356', 'AMOUNT' => 5.99, 'AMOUNT_CNT' => 100, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.0599));
             break;
         default:
         case 'en':
             $addCurrency = array(array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1), array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 1.1, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 1.1), array('CURRENCY' => 'CNY', 'NUMCODE' => '156', 'AMOUNT' => 15.73, 'AMOUNT_CNT' => 100, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.1573), array('CURRENCY' => 'BRL', 'NUMCODE' => '986', 'AMOUNT' => 25.35, 'AMOUNT_CNT' => 100, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.2535), array('CURRENCY' => 'INR', 'NUMCODE' => '356', 'AMOUNT' => 15.31, 'AMOUNT_CNT' => 1000, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.01531));
             break;
     }
     foreach ($addCurrency as &$fields) {
         $fields['CREATED_BY'] = null;
         $fields['MODIFIED_BY'] = null;
         $fields['DATE_CREATE'] = $datetimeEntity;
         $fields['DATE_UPDATE'] = $datetimeEntity;
         $currencyResult = \Bitrix\Currency\CurrencyTable::add($fields);
         if ($currencyResult->isSuccess()) {
             $currencyList[] = $fields['CURRENCY'];
         }
     }
     unset($currencyResult, $fields);
     if (!empty($currencyList)) {
         Option::set('currency', 'installed_currencies', implode(',', $currencyList), '');
         $languageIterator = LanguageTable::getList(array('select' => array('ID'), 'filter' => array('=ACTIVE' => 'Y')));
         while ($existLanguage = $languageIterator->fetch()) {
             $messList = Loc::loadLanguageFile($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/currency/install_lang.php', $existLanguage['ID']);
             foreach ($currencyList as &$oneCurrency) {
                 $fields = array('LID' => $existLanguage['ID'], 'CURRENCY' => $oneCurrency, 'THOUSANDS_SEP' => false, 'DECIMALS' => 2, 'HIDE_ZERO' => 'Y', 'FORMAT_STRING' => $messList['CUR_INSTALL_' . $oneCurrency . '_FORMAT_STRING'], 'FULL_NAME' => $messList['CUR_INSTALL_' . $oneCurrency . '_FULL_NAME'], 'DEC_POINT' => $messList['CUR_INSTALL_' . $oneCurrency . '_DEC_POINT'], 'THOUSANDS_VARIANT' => $messList['CUR_INSTALL_' . $oneCurrency . '_THOUSANDS_SEP'], 'CREATED_BY' => null, 'MODIFIED_BY' => null, 'DATE_CREATE' => $datetimeEntity, 'TIMESTAMP_X' => $datetimeEntity);
                 $resultCurrencyLang = \Bitrix\Currency\CurrencyLangTable::add($fields);
                 unset($resultCurrencyLang);
             }
             unset($oneCurrency, $messList);
         }
         unset($existLanguage, $languageIterator);
         if (!$bitrix24) {
             $checkDate = Main\Type\DateTime::createFromTimestamp(strtotime('tomorrow 00:01:00'));
             CAgent::AddAgent('\\Bitrix\\Currency\\CurrencyTable::currencyBaseRateAgent();', 'currency', 'Y', 86400, '', 'Y', $checkDate->toString(), 100, false, true);
             unset($checkDate);
         }
         \Bitrix\Currency\CurrencyManager::clearCurrencyCache();
     }
     unset($datetimeEntity);
 }
コード例 #13
0
ファイル: index.php プロジェクト: nycmic/bittest
	protected function installCurrencies()
	{
		if (!Loader::includeModule('currency'))
			return;

		$bitrix24Path = $_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/bitrix24/';
		$bitrix24 = file_exists($bitrix24Path) && is_dir($bitrix24Path);
		unset($bitrix24Path);

		$currencyIterator = \Bitrix\Currency\CurrencyTable::getList(array(
			'select' => array('CURRENCY'),
			'limit' => 1
		));
		$currency = $currencyIterator->fetch();
		if (!empty($currency))
			return;

		$languageID = '';
		$siteIterator = SiteTable::getList(array(
			'select' => array('LID', 'LANGUAGE_ID'),
			'filter' => array('=DEF' => 'Y', '=ACTIVE' => 'Y')
		));
		if ($site = $siteIterator->fetch())
			$languageID = (string)$site['LANGUAGE_ID'];
		unset($site, $siteIterator);

		if ($languageID == '')
			$languageID = 'en';

		$currencyList = array();
		$currencySetID = '';
		switch ($languageID)
		{
			case 'ua':
			case 'de':
			case 'en':
			case 'la':
			case 'tc':
			case 'sc':
				$currencySetID = $languageID;
				break;
			case 'ru':
				if (!$bitrix24)
				{
					$languageIterator = LanguageTable::getList(array(
						'select' => array('ID'),
						'filter' => array('=ID' => 'kz', '=ACTIVE' => 'Y')
					));
					if ($existLanguage = $languageIterator->fetch())
						$currencySetID = $existLanguage['ID'];

					if ($currencySetID == '')
					{
						$languageIterator = LanguageTable::getList(array(
							'select' => array('ID'),
							'filter' => array('=ID' => 'ua', '=ACTIVE' => 'Y')
						));
						if ($existLanguage = $languageIterator->fetch())
							$currencySetID = $existLanguage['ID'];
					}
					unset($existLanguage, $languageIterator);
				}
				if ($currencySetID == '')
					$currencySetID = $languageID;
				break;
			default:
				$currencySetID = 'en';
				break;
		}
		$datetimeEntity = new Main\DB\SqlExpression(Main\Application::getConnection()->getSqlHelper()->getCurrentDateTimeFunction());
		switch ($currencySetID)
		{
			case 'kz':
				$addCurrency = array(
					array('CURRENCY' => 'KZT', 'NUMCODE' => '398', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
					array('CURRENCY' => 'RUB', 'NUMCODE' => '643', 'AMOUNT' => 1, 'AMOUNT_CNT' => 3.09, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 3.09),
					array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 1, 'AMOUNT_CNT' => 185.5, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 185.5),
					array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 1, 'AMOUNT_CNT' => 198.13, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 198.13)
				);
				break;
			case 'ua':
				$addCurrency = array(
					array('CURRENCY' => 'UAH', 'NUMCODE' => '980', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
					array('CURRENCY' => 'RUB', 'NUMCODE' => '643', 'AMOUNT' => 4.00, 'AMOUNT_CNT' => 10, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.4),
					array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 2355.70, 'AMOUNT_CNT' => 100, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 23.557),
					array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 2579.49, 'AMOUNT_CNT' => 100, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 25.7949)
				);
				break;
			case 'ru':
				$addCurrency = array(
					array('CURRENCY' => 'RUB', 'NUMCODE' => '643', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
					array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 57.39, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 57.39),
					array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 62.77, 'AMOUNT_CNT' => 1, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 62.77),
					array('CURRENCY' => 'UAH', 'NUMCODE' => '980', 'AMOUNT' => 24.53, 'AMOUNT_CNT' => 10, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 2.453),
					array('CURRENCY' => 'BYR', 'NUMCODE' => '974', 'AMOUNT' => 39.44, 'AMOUNT_CNT' => 10000, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.003944)
				);
				break;
			case 'de':
			case 'la':
				$addCurrency = array(
					array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
					array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 0.91, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.91),
					array('CURRENCY' => 'CNY', 'NUMCODE' => '156', 'AMOUNT' => 14.65, 'AMOUNT_CNT' => 100, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.1465),
					array('CURRENCY' => 'BRL', 'NUMCODE' => '986', 'AMOUNT' => 29.12, 'AMOUNT_CNT' => 100, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.2912),
					array('CURRENCY' => 'INR', 'NUMCODE' => '356', 'AMOUNT' => 14.59, 'AMOUNT_CNT' => 1000, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.01459)
				);
				break;
			case 'tc':
			case 'sc':
				$addCurrency = array(
					array('CURRENCY' => 'CNY', 'NUMCODE' => '156', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
					array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 6.21, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.1610),
					array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 6.75, 'AMOUNT_CNT' => 1, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.1482),
					array('CURRENCY' => 'BRL', 'NUMCODE' => '986', 'AMOUNT' => 1.93, 'AMOUNT_CNT' => 1, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.5181),
					array('CURRENCY' => 'INR', 'NUMCODE' => '356', 'AMOUNT' => 9,94, 'AMOUNT_CNT' => 100, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.0994)
				);
				break;
			default:
			case 'en':
				$addCurrency = array(
					array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
					array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 1.09, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 1.09),
					array('CURRENCY' => 'CNY', 'NUMCODE' => '156', 'AMOUNT' => 16.09, 'AMOUNT_CNT' => 100, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.1609),
					array('CURRENCY' => 'BRL', 'NUMCODE' => '986', 'AMOUNT' => 31.24, 'AMOUNT_CNT' => 100, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.3124),
					array('CURRENCY' => 'INR', 'NUMCODE' => '356', 'AMOUNT' => 16.02, 'AMOUNT_CNT' => 1000, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.01602)
				);
				break;
		}
		foreach ($addCurrency as &$fields)
		{
			$fields['CREATED_BY'] = null;
			$fields['MODIFIED_BY'] = null;
			$fields['DATE_CREATE'] = $datetimeEntity;
			$fields['DATE_UPDATE'] = $datetimeEntity;
			$currencyResult = \Bitrix\Currency\CurrencyTable::add($fields);
			if ($currencyResult->isSuccess())
				$currencyList[] = $fields['CURRENCY'];
		}
		unset($currencyResult, $fields);

		if (!empty($currencyList))
		{
			Option::set('currency', 'installed_currencies', implode(',', $currencyList), '');
			$languageIterator = LanguageTable::getList(array(
				'select' => array('ID'),
				'filter' => array('=ACTIVE' => 'Y')
			));
			while ($existLanguage = $languageIterator->fetch())
			{
				$messList = Loc::loadLanguageFile($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/currency/install_lang.php', $existLanguage['ID']);
				foreach($currencyList as &$oneCurrency)
				{
					$fields = array(
						'LID' => $existLanguage['ID'],
						'CURRENCY' => $oneCurrency,
						'THOUSANDS_SEP' => false,
						'DECIMALS' => 2,
						'HIDE_ZERO' => 'Y',
						'FORMAT_STRING' => $messList['CUR_INSTALL_'.$oneCurrency.'_FORMAT_STRING'],
						'FULL_NAME' => $messList['CUR_INSTALL_'.$oneCurrency.'_FULL_NAME'],
						'DEC_POINT' => $messList['CUR_INSTALL_'.$oneCurrency.'_DEC_POINT'],
						'THOUSANDS_VARIANT' => $messList['CUR_INSTALL_'.$oneCurrency.'_THOUSANDS_SEP'],
						'CREATED_BY' => null,
						'MODIFIED_BY' => null,
						'DATE_CREATE' => $datetimeEntity,
						'TIMESTAMP_X' => $datetimeEntity
					);
					$resultCurrencyLang = \Bitrix\Currency\CurrencyLangTable::add($fields);
					unset($resultCurrencyLang);
				}
				unset($oneCurrency, $messList);
			}
			unset($existLanguage, $languageIterator);
			if (!$bitrix24)
			{
				$checkDate = Main\Type\DateTime::createFromTimestamp(strtotime('tomorrow 00:01:00'));;
				CAgent::AddAgent('\Bitrix\Currency\CurrencyTable::currencyBaseRateAgent();', 'currency', 'Y', 86400, '', 'Y', $checkDate->toString(), 100, false, true);
				unset($checkDate);
			}
			\Bitrix\Currency\CurrencyManager::clearCurrencyCache();
		}
		unset($datetimeEntity);
	}
コード例 #14
0
 protected function getNamesSavedSection()
 {
     static $array = null;
     if ($array !== null) {
         return $array;
     }
     $names = array();
     foreach ($this->getLanguageList() as $lang) {
         \Bitrix\Main\Localization\Loc::loadLanguageFile($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/webdav/classes/general.php', $lang["LID"]);
         $names[$lang["LID"]] = \Bitrix\Main\Localization\Loc::getMessage('WD_SAVED', null, $lang["LID"]);
     }
     unset($lang);
     return $names;
 }
コード例 #15
0
ファイル: configmap.php プロジェクト: ASDAFF/entask.ru
 /**
  * Gets lang messages
  * @return array
  */
 public function getLangMessages()
 {
     return Loc::loadLanguageFile(Path::normalize(__FILE__));
 }
コード例 #16
0
ファイル: delegate.php プロジェクト: Satariall/izurit
<?php

define('STOP_STATISTICS', true);
define('NO_AGENT_CHECK', true);
define('DisableEventsCheck', true);
define('BX_SECURITY_SHOW_MESSAGE', true);
global $APPLICATION, $USER;
$SITE_ID = '';
if (isset($_REQUEST["SITE_ID"]) && is_string($_REQUEST["SITE_ID"])) {
    $SITE_ID = substr(preg_replace("/[^a-z0-9_]/i", "", $_REQUEST["SITE_ID"]), 0, 2);
}
if ($SITE_ID != '') {
    define("SITE_ID", $SITE_ID);
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';
\Bitrix\Main\Localization\Loc::loadLanguageFile(__FILE__);
if (!check_bitrix_sessid() || !$USER->IsAuthorized()) {
    die;
}
if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'delegate') {
    CModule::IncludeModule('bizproc');
    $isAdmin = $USER->IsAdmin() || CModule::IncludeModule('bitrix24') && CBitrix24::IsPortalAdmin($USER->GetID());
    $errors = array();
    if (!empty($_REQUEST['task_id']) && !empty($_REQUEST['from_user_id']) && !empty($_REQUEST['to_user_id']) && ($isAdmin || CBPHelper::checkUserSubordination($USER->GetID(), $_REQUEST['to_user_id']))) {
        if (!CBPDocument::delegateTasks($_REQUEST['from_user_id'], $_REQUEST['to_user_id'], $_REQUEST['task_id'], $errors)) {
            $errors[] = GetMessage('BPAT_DELEGATE_NOTASKS');
        }
    } else {
        $errors[] = GetMessage('BPAT_DELEGATE_ERROR');
    }
    $message = $errors ? $errors[0] : GetMessage('BPAT_DELEGATE_SUCCESS');
コード例 #17
0
ファイル: bitrix24net.php プロジェクト: rasuldev/torino
<?php

use Bitrix\Main\Localization\Loc;
Loc::loadLanguageFile(__FILE__);
if (!defined('B24NETWORK_URL')) {
    // define('B24NETWORK_URL', 'https://www.bitrix24.net');
}
class CSocServBitrix24Net extends CSocServAuth
{
    const ID = "Bitrix24Net";
    const NETWORK_URL = B24NETWORK_URL;
    protected $entityOAuth = null;
    public static function GetSettings()
    {
        return array(array("bitrix24net_id", Loc::getMessage("socserv_b24net_id"), "", array("text", 40)), array("bitrix24net_secret", Loc::getMessage("socserv_b24net_secret"), "", array("text", 40)), array("note" => GetMessage("socserv_b24net_sett_note")));
    }
    public function getFormHtml()
    {
        $url = $this->getUrl("popup");
        $phrase = $arParams["FOR_INTRANET"] ? Loc::getMessage("socserv_b24net_note_intranet") : Loc::getMessage("socserv_b24net_note");
        return $arParams["FOR_INTRANET"] ? array("ON_CLICK" => 'onclick="window.location.href = \'' . htmlspecialcharsbx(CUtil::JSEscape($url)) . '\'"') : '<a href="javascript:void(0)" onclick="BX.util.popup(\'' . htmlspecialcharsbx(CUtil::JSEscape($url)) . '\', 800, 600)" class="bx-ss-button bitrix24net-button"></a><span class="bx-spacer"></span><span>' . $phrase . '</span>';
    }
    public function getEntityOAuth($code = false)
    {
        if (!$this->entityOAuth) {
            $this->entityOAuth = new CBitrix24NetOAuthInterface();
        }
        if ($code !== false) {
            $this->entityOAuth->setCode($code);
        }
        return $this->entityOAuth;
コード例 #18
0
ファイル: index.php プロジェクト: ASDAFF/1C_Bitrix_info_site
	function InstallDB()
	{
		global $DB, $APPLICATION;
		global $stackCacheManager;
		global $CACHE_MANAGER;

		$this->errors = false;

		$bitrix24Path = $_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/bitrix24/';
		$bitrix24 = file_exists($bitrix24Path) && is_dir($bitrix24Path);
		unset($bitrix24Path);

		if (!$DB->Query("SELECT COUNT(CURRENCY) FROM b_catalog_currency", true)):
			$this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/currency/install/db/".strtolower($DB->type)."/install.sql");
		endif;

		if ($this->errors !== false)
		{
			$APPLICATION->ThrowException(implode("", $this->errors));
			return false;
		}
		RegisterModule("currency");
		$stackCacheManager->Clear("currency_currency_lang");
		$CACHE_MANAGER->Clean("currency_currency_list", 'b_catalog_currency');
		$CACHE_MANAGER->Clean("currency_base_currency", 'b_catalog_currency');
		$stackCacheManager->Clear("currency_rate");

		if (Loader::includeModule("currency"))
		{
			$currencyIterator = CurrencyTable::getList(array(
				'select' => array('CURRENCY'),
				'limit' => 1
			));
			if (!($currency = $currencyIterator->fetch()))
			{
				$languageID = '';
				$siteIterator = SiteTable::getList(array(
					'select' => array('LID', 'LANGUAGE_ID'),
					'filter' => array('DEF' => 'Y', 'ACTIVE' => 'Y')
				));
				if ($site = $siteIterator->fetch())
				{
					$languageID = (string)$site['LANGUAGE_ID'];
				}
				if (isset($site))
					unset($site);
				unset($siteIterator);

				if ($languageID == '')
					$languageID = 'en';

				$currencyList = array();
				$currencySetID = '';
				switch ($languageID)
				{
					case 'ua':
					case 'de':
					case 'en':
						$currencySetID = $languageID;
						break;
					case 'ru':
						if (!$bitrix24)
						{
							$languageIterator = LanguageTable::getList(array(
								'select' => array('ID'),
								'filter' => array('ID' => 'kz', 'ACTIVE' => 'Y')
							));
							if ($existLanguage = $languageIterator->fetch())
							{
								$currencySetID = $existLanguage['ID'];
							}
							if ($currencySetID == '')
							{
								$languageIterator = LanguageTable::getList(array(
									'select' => array('ID'),
									'filter' => array('ID' => 'ua', 'ACTIVE' => 'Y')
								));
								if ($existLanguage = $languageIterator->fetch())
								{
									$currencySetID = $existLanguage['ID'];
								}
							}
						}
						if ($currencySetID == '')
						{
							$currencySetID = $languageID;
						}
						break;
					default:
						$currencySetID = 'en';
						break;
				}
				$datetimeEntity = new SqlExpression(Application::getConnection()->getSqlHelper()->getCurrentDateTimeFunction());
				switch ($currencySetID)
				{
					case 'kz':
						$addCurrency = array(
							array('CURRENCY' => 'KZT', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
							array('CURRENCY' => 'RUB', 'AMOUNT' => 1, 'AMOUNT_CNT' => 4.72, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 4.72),
							array('CURRENCY' => 'USD', 'AMOUNT' => 1, 'AMOUNT_CNT' => 154.52, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 154.52),
							array('CURRENCY' => 'EUR', 'AMOUNT' => 1, 'AMOUNT_CNT' => 212.73, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 212.73)
						);
						break;
					case 'ua':
						$addCurrency = array(
							array('CURRENCY' => 'UAH', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
							array('CURRENCY' => 'RUB', 'AMOUNT' => 2.54, 'AMOUNT_CNT' => 10, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.254),
							array('CURRENCY' => 'USD', 'AMOUNT' => 799.3, 'AMOUNT_CNT' => 100, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 7.993),
							array('CURRENCY' => 'EUR', 'AMOUNT' => 1083.37, 'AMOUNT_CNT' => 100, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 10.8337)
						);
						break;
					case 'ru':
						$addCurrency = array(
							array('CURRENCY' => 'RUB', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
							array('CURRENCY' => 'USD', 'AMOUNT' => 32.30, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 32.30),
							array('CURRENCY' => 'EUR', 'AMOUNT' => 43.80, 'AMOUNT_CNT' => 1, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 43.80),
							array('CURRENCY' => 'UAH', 'AMOUNT' => 39.41, 'AMOUNT_CNT' => 10, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 3.941),
							array('CURRENCY' => 'BYR', 'AMOUNT' => 36.72, 'AMOUNT_CNT' => 10000, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.003672)
						);
						break;
					case 'de':
						$addCurrency = array(
							array('CURRENCY' => 'EUR', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
							array('CURRENCY' => 'USD', 'AMOUNT' => 0.74, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.74)
						);
						break;
					default:
					case 'en':
						$addCurrency = array(
							array('CURRENCY' => 'USD', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
							array('CURRENCY' => 'EUR', 'AMOUNT' => 1.36, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 1.36)
						);
						break;
				}
				foreach ($addCurrency as &$fields)
				{
					$fields['CREATED_BY'] = null;
					$fields['MODIFIED_BY'] = null;
					$fields['DATE_CREATE'] = $datetimeEntity;
					$fields['DATE_UPDATE'] = $datetimeEntity;
					$currencyResult = CurrencyTable::add($fields);
					if ($currencyResult->isSuccess())
						$currencyList[] = $fields['CURRENCY'];
				}
				unset($currencyResult, $fields);

				if (!empty($currencyList))
				{
					Option::set('currency', 'installed_currencies', implode(',', $currencyList), '');
					$languageIterator = LanguageTable::getList(array(
						'select' => array('ID'),
						'filter' => array('ACTIVE' => 'Y')
					));
					while ($existLanguage = $languageIterator->fetch())
					{
						$CACHE_MANAGER->Clean('currency_currency_list_'.$existLanguage['ID']);
						$messList = Loc::loadLanguageFile($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/currency/install_lang.php', $existLanguage['ID']);
						foreach($currencyList as &$oneCurrency)
						{
							$fields = array(
								'LID' => $existLanguage['ID'],
								'CURRENCY' => $oneCurrency,
								'THOUSANDS_SEP' => false,
								'DECIMALS' => 2,
								'HIDE_ZERO' => 'Y',
								'FORMAT_STRING' => $messList['CUR_INSTALL_'.$oneCurrency.'_FORMAT_STRING'],
								'FULL_NAME' => $messList['CUR_INSTALL_'.$oneCurrency.'_FULL_NAME'],
								'DEC_POINT' => $messList['CUR_INSTALL_'.$oneCurrency.'_DEC_POINT'],
								'THOUSANDS_VARIANT' => $messList['CUR_INSTALL_'.$oneCurrency.'_THOUSANDS_SEP'],
								'CREATED_BY' => null,
								'MODIFIED_BY' => null,
								'DATE_CREATE' => $datetimeEntity,
								'TIMESTAMP_X' => $datetimeEntity
							);
							$resultCurrencyLang = CurrencyLangTable::add($fields);
						}
						unset($oneCurrency);
					}
					unset($existLanguage, $languageIterator);
					if (!$bitrix24)
					{
						$checkDate = DateTime::createFromTimestamp(strtotime('tomorrow 00:01:00'));;
						CAgent::AddAgent('\Bitrix\Currency\CurrencyTable::currencyBaseRateAgent();', 'currency', 'Y', 86400, '', 'Y', $checkDate->toString(), 100, false, true);
					}
				}
			}
		}
		$stackCacheManager->Clear("currency_currency_lang");
		$CACHE_MANAGER->Clean("currency_currency_list", 'b_catalog_currency');
		$CACHE_MANAGER->Clean("currency_base_currency", 'b_catalog_currency');
		$stackCacheManager->Clear("currency_rate");

		return true;
	}
コード例 #19
0
 function IncludeLangFile($relativePath = "", $lang = false, $return = false)
 {
     $arLangMessages = array();
     if ($this->__folder != '') {
         if ($relativePath == "") {
             $relativePath = bx_basename($this->__file);
         }
         $absPath = $_SERVER["DOCUMENT_ROOT"] . $this->__folder . "/" . $relativePath;
         if ($lang === false && $return === false) {
             \Bitrix\Main\Localization\Loc::loadMessages($absPath);
         } else {
             if ($lang === false) {
                 $lang = $this->getLanguageId();
             }
             $arLangMessages = \Bitrix\Main\Localization\Loc::loadLanguageFile($absPath, $lang);
         }
     }
     return $arLangMessages;
 }
コード例 #20
0
ファイル: class.php プロジェクト: digitalwand/mvc.base
 /**
  * Если наш класс отнаследован от другого класса, то может быть полезным включить ланг-файлы родительского
  * класса. Таким образом, переводы тоже будут наследоваться.
  * Наследование будет работать только в случае, если отключена "ленивая загрузка" переводов. Если включена -
  * то тоже может сработать, но при нескольких родителях может выдать непредсказуемый результат. Так же нельзя
  * будет переопределить сообщения, объявленные в каком-нибудь из родительских классов
  */
 private function includeLangTree()
 {
     /** @var $class ReflectionClass */
     $class = $this->reflection;
     $paths = array();
     while ($class = $class->getParentClass()) {
         if ($class->getName() == 'CBitrixComponent') {
             break;
         }
         $path = str_replace('class.php', 'component.php', $class->getFileName());
         //При ленивой загрузке нормальное наслдедование переводов невозможно,
         //т.к. файлы для ленивой загрузки будут проверяться в рандомном порядке.
         if ($this->langLazyLoad()) {
             Loc::loadMessages($path);
         } else {
             $paths[] = $path;
         }
     }
     //Если ленивоз загрузки нет, то порядок подключения имеет значение:
     //сначала классы-предки, поотм потомки.
     if ($this->langLazyLoad()) {
         Loc::loadMessages(__FILE__);
     } else {
         $paths = array_reverse($paths);
         foreach ($paths as $path) {
             Loc::loadLanguageFile($path);
         }
         Loc::loadLanguageFile(__FILE__);
     }
 }