Example #1
0
 /**
  * Add
  * @param $arFields
  * @return bool
  * @throws \Exception
  */
 public static function Add($arFields)
 {
     if (!isset($arFields['SECTIONS']) || empty($arFields['SECTIONS'])) {
         $arFields['SECTIONS'] = 'Y';
     }
     if (!isset($arFields['IN_RSS']) || empty($arFields['IN_RSS'])) {
         $arFields['IN_RSS'] = 'N';
     }
     if (isset($arFields['SORT'])) {
         if (!is_int($arFields['SORT'])) {
             if (intval($arFields['SORT'])) {
                 $arFields['SORT'] = intval($arFields['SORT']);
             } else {
                 $arFields['SORT'] = 500;
             }
         }
     } else {
         $arFields['SORT'] = 500;
     }
     if (!isset($arFields['LANG']) || empty($arFields['LANG'])) {
         $langDefaults = array('ru' => array('NAME' => 'Название', 'SECTION_NAME' => 'Разделы', 'ELEMENT_NAME' => 'Элементы'), 'en' => array('NAME' => 'Common', 'SECTION_NAME' => 'Sections', 'ELEMENT_NAME' => 'Elements'));
         $l = \CLanguage::GetList($lby = "sort", $lorder = "asc");
         while ($arIBTLang = $l->GetNext()) {
             if (array_key_exists($arIBTLang["LID"], $langDefaults)) {
                 $arFields["LANG"][$arIBTLang["LID"]] = $langDefaults[$arIBTLang["LID"]];
             }
         }
     }
     $CIblockType = new \CIBlockType();
     if ($CIblockType->Add($arFields)) {
         return true;
     } else {
         throw new BimException($CIblockType->LAST_ERROR);
     }
 }
Example #2
0
	function __wd_check_uf_use_bp_property($iblock_id)
	{
		$iblock_id = intval($iblock_id); 
		$db_res = CUserTypeEntity::GetList(array($by=>$order), array("ENTITY_ID" => "IBLOCK_".$iblock_id."_SECTION", "FIELD_NAME" => "UF_USE_BP"));
		if (!$db_res || !($res = $db_res->GetNext()))
		{
			$arFields = Array(
				"ENTITY_ID" => "IBLOCK_".$iblock_id."_SECTION",
				"FIELD_NAME" => "UF_USE_BP",
				"USER_TYPE_ID" => "string",
				"MULTIPLE" => "N",
				"MANDATORY" => "N", 
				"SETTINGS" => array("DEFAULT_VALUE" => "Y"));
			$arFieldName = array();
			$rsLanguage = CLanguage::GetList($by, $order, array());
			while($arLanguage = $rsLanguage->Fetch()):
//				GetMessage("SONET_UF_USE_BP");
				$dir = str_replace(array("\\", "//"), "/", dirname(__FILE__)); 
				$dirs = explode("/", $dir); 
				array_pop($dirs); 
				$file = trim(implode("/", $dirs)."/lang/".$arLanguage["LID"]."/include/webdav_settings.php");
				$tmp_mess = __IncludeLang($file, true);
				$arFieldName[$arLanguage["LID"]] = (empty($tmp_mess["SONET_UF_USE_BP"]) ? "Use Business Process" : $tmp_mess["SONET_UF_USE_BP"]);
			endwhile;
			$arFields["EDIT_FORM_LABEL"] = $arFieldName;
			$obUserField  = new CUserTypeEntity;
			$obUserField->Add($arFields);
			$GLOBALS["USER_FIELD_MANAGER"]->arFieldsCache = array();
		}
	}
Example #3
0
 /**
  * Creates events for sending e-mail.
  * @return bool
  */
 public static function installEvents()
 {
     $dbEvent = \CEventMessage::GetList($b = "ID", $order = "ASC", array("EVENT_NAME" => "SALE_EBAY_ERROR"));
     if (!$dbEvent->Fetch()) {
         $langs = \CLanguage::GetList($b = "", $o = "");
         while ($lang = $langs->Fetch()) {
             $lid = $lang["LID"];
             $obEventType = new \CEventType();
             $obEventType->Add(array("EVENT_NAME" => "SALE_EBAY_ERROR", "NAME" => Loc::getMessage("SALE_EBAY_HLP_EVNT_TYPE_ERROR"), "LID" => $lid, "DESCRIPTION" => "\n\t\t\t\t\t#ERROR_TYPE# - " . Loc::getMessage("SALE_EBAY_HLP_EVNT_TYPE_ERROR_TYPE") . "\n\t\t\t\t\t#ERROR_DETAILS# - " . Loc::getMessage("SALE_EBAY_HLP_EVNT_TYPE_ERROR_DETAIL") . "\n\t\t\t\t\t#EMAIL_FROM# - " . Loc::getMessage("SALE_EBAY_HLP_EVNT_TYPE_FROM") . "\n\t\t\t\t\t#EMAIL_TO# - " . Loc::getMessage("SALE_EBAY_HLP_EVNT_TYPE_TO") . "\n\t\t\t\t\t#BCC# - " . Loc::getMessage("SALE_EBAY_HLP_EVNT_TYPE_BCC")));
             $arSites = array();
             $sites = \CSite::GetList($b = "", $o = "", array("LANGUAGE_ID" => $lid));
             while ($site = $sites->Fetch()) {
                 $arSites[] = $site["LID"];
             }
             if (count($arSites) > 0) {
                 $arr = array();
                 $arr["ACTIVE"] = "Y";
                 $arr["EVENT_NAME"] = "SALE_EBAY_ERROR";
                 $arr["LID"] = $arSites;
                 $arr["EMAIL_FROM"] = "#DEFAULT_EMAIL_FROM#";
                 $arr["EMAIL_TO"] = "#EMAIL_TO#";
                 $arr["BCC"] = "#BCC#";
                 $arr["SUBJECT"] = "#SITE_NAME# " . Loc::getMessage("SALE_EBAY_EVNT_MSG_SBUJ']") . ".";
                 $arr["BODY_TYPE"] = "text";
                 $arr["MESSAGE"] = Loc::getMessage("SALE_EBAY_EVNT_MSG_INFO_SITE") . " #SITE_NAME#.\n\n" . Loc::getMessage("SALE_EBAY_EVNT_MSG") . ":\n\n" . "#ERROR_TYPE#\n\n" . "#ERROR_DETAILS#";
                 $obTemplate = new \CEventMessage();
                 $obTemplate->Add($arr);
             }
         }
     }
     return true;
 }
Example #4
0
function stemming_init($sLang = "ru")
{
    static $arStemFunc = false;
    //Init all languages
    if ($arStemFunc === false) {
        $arStemFunc = array();
        $rsLanguages = CLanguage::GetList($b = "", $o = "");
        while ($arLanguage = $rsLanguages->Fetch()) {
            stemming_init($arLanguage["LID"]);
        }
    }
    //Check if language was not used
    if ($sLang !== false && !isset($arStemFunc[$sLang])) {
        $stemming_function_suf = $sLang;
        if (!function_exists("stemming_" . $sLang)) {
            $strFileName = $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/" . $sLang . "/search/stemming.php";
            if (file_exists($strFileName)) {
                @(include $strFileName);
            }
            if (!function_exists("stemming_" . $sLang)) {
                $strFileName = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/search/tools/" . $sLang . "/stemming.php";
                if (file_exists($strFileName)) {
                    @(include $strFileName);
                }
                if (!function_exists("stemming_" . $sLang)) {
                    $stemming_function_suf = "default";
                }
            }
        }
        $stemming_stop_function = "stemming_stop_" . $sLang;
        if (!function_exists($stemming_stop_function)) {
            $stemming_stop_function = "stemming_stop_default";
        }
        $stemming_upper_function = "stemming_upper_" . $sLang;
        if (!function_exists($stemming_upper_function)) {
            $stemming_upper_function = "stemming_upper_default";
        }
        $letters = stemming_letter_default();
        $stemming_letter_function = "stemming_letter_" . $sLang;
        if (function_exists($stemming_letter_function)) {
            $letters .= $stemming_letter_function();
        }
        $letters .= COption::GetOptionString("search", "letters");
        if (function_exists($stemming_letter_function)) {
            $abc = $stemming_letter_function();
        } else {
            $abc = "";
        }
        if (strlen($abc) <= 0) {
            $abc = stemming_letter_default();
        }
        $arStemFunc[$sLang] = array("stem" => "stemming_" . $stemming_function_suf, "stop" => $stemming_stop_function, "upper" => $stemming_upper_function, "letters" => $letters, "pcre_letters" => str_replace(array("\\", "-", "^", "]", "/"), array("\\\\", "\\-", "\\^", "\\]", "\\/"), $letters), "abc" => $abc, "pcre_abc" => str_replace(array("\\", "-", "^", "]", "/"), array("\\\\", "\\-", "\\^", "\\]", "\\/"), $abc));
    }
    if ($sLang === false) {
        return $arStemFunc;
    } else {
        return $arStemFunc[$sLang];
    }
}
Example #5
0
 function GetLang($cur_dir = false, $cur_host = false)
 {
     global $DB, $lang, $MAIN_LANGS_CACHE, $MAIN_LANGS_ADMIN_CACHE;
     if ($cur_dir === false) {
         $cur_dir = $this->GetCurDir();
     }
     if ($cur_host === false) {
         $cur_host = $_SERVER["HTTP_HOST"];
     }
     if (strpos($cur_dir, FX_ROOT . "/admin/") === 0 || strpos($cur_dir, FX_ROOT . "/updates/") === 0 || defined("ADMIN_SECTION") && ADMIN_SECTION === true || defined("FX_PUBLIC_TOOLS") && FX_PUBLIC_TOOLS === true) {
         //if admin section
         //lang by global var
         if (strlen($lang) <= 0) {
             $lang = COption::GetOptionString("main", "admin_lid", "ru");
         }
         $R = CLanguage::GetList($o, $b, array("LID" => $lang, "ACTIVE" => "Y"));
         if ($res = $R->Fetch()) {
             $MAIN_LANGS_ADMIN_CACHE[$res["LID"]] = $res;
             return $res;
         }
         //no lang param - get default
         $R = CLanguage::GetList($by = "def", $order = "desc", array("ACTIVE" => "Y"));
         if ($res = $R->Fetch()) {
             $MAIN_LANGS_ADMIN_CACHE[$res["LID"]] = $res;
             return $res;
         }
         //core default
         return array("en", "MM/DD/YYYY", "MM/DD/YYYY HH24:MI:SS");
     } else {
         // all other sections
         $arURL = parse_url("http://" . $cur_host);
         if ($arURL["scheme"] == "" && strlen($arURL["host"]) > 0) {
             $CURR_DOMAIN = $arURL["host"];
         } else {
             $CURR_DOMAIN = $cur_host;
         }
         if (strpos($CURR_DOMAIN, ':') > 0) {
             $CURR_DOMAIN = substr($CURR_DOMAIN, 0, strpos($CURR_DOMAIN, ':'));
         }
         $CURR_DOMAIN = trim($CURR_DOMAIN, "\t\r\n .");
         $strSql = "SELECT L.*, L.LID as ID, L.LID as SITE_ID, " . "\tC.FORMAT_DATE, C.FORMAT_DATETIME, C.FORMAT_NAME, C.WEEK_START, C.CHARSET, C.DIRECTION " . "FROM b_lang L  " . "\tLEFT JOIN b_lang_domain LD ON L.LID=LD.LID AND '" . $DB->ForSql($CURR_DOMAIN, 255) . "' LIKE CONCAT('%', LD.DOMAIN) " . "\tINNER JOIN b_culture C ON C.ID=L.CULTURE_ID " . "WHERE " . "\t('" . $DB->ForSql($cur_dir) . "' LIKE CONCAT(L.DIR, '%') OR LD.LID IS NOT NULL)" . "\tAND L.ACTIVE='Y' " . "ORDER BY " . "\tIF((L.DOMAIN_LIMITED='Y' AND LD.LID IS NOT NULL) OR L.DOMAIN_LIMITED<>'Y', " . "\t\tIF('" . $DB->ForSql($cur_dir) . "' LIKE CONCAT(L.DIR, '%'), 3, 1), " . "\t\tIF('" . $DB->ForSql($cur_dir) . "' LIKE CONCAT(L.DIR, '%'), 2, 0) " . "\t) DESC, " . "\tLENGTH(L.DIR) DESC, " . "\tL.DOMAIN_LIMITED DESC, " . "\tL.SORT, " . "\tLENGTH(LD.DOMAIN) DESC ";
         $R = $DB->Query($strSql, false, "File: " . __FILE__ . " Line:" . __LINE__);
         $res = $R->Fetch();
         if ($res) {
             $MAIN_LANGS_CACHE[$res["LID"]] = $res;
             return $res;
         }
         //get default site
         $strSql = "SELECT L.*, L.LID as ID, L.LID as SITE_ID, " . "\tC.FORMAT_DATE, C.FORMAT_DATETIME, C.FORMAT_NAME, C.WEEK_START, C.CHARSET, C.DIRECTION " . "FROM b_lang L, b_culture C " . "WHERE C.ID=L.CULTURE_ID AND L.ACTIVE='Y' " . "ORDER BY L.DEF DESC, L.SORT";
         $R = $DB->Query($strSql);
         while ($res = $R->Fetch()) {
             $MAIN_LANGS_CACHE[$res["LID"]] = $res;
             return $res;
         }
     }
     return array("en", "MM/DD/YYYY", "MM/DD/YYYY HH24:MI:SS");
 }
Example #6
0
 protected static function CleanCache()
 {
     global $CACHE_MANAGER;
     $by = 'lid';
     $order = 'asc';
     $rsLangs = CLanguage::GetList($by, $order);
     while ($arLang = $rsLangs->Fetch()) {
         $CACHE_MANAGER->Clean("admin_notify_list_" . $arLang['LANGUAGE_ID']);
     }
     $CACHE_MANAGER->Clean("admin_notify_list");
 }
Example #7
0
function __cat_LoadMess($__current_file)
{
    $__current_dir = dirname($__current_file);
    $__current_file = basename($__current_file);
    $arMess = array();
    $dbLang = CLanguage::GetList($by = 'SORT', $order = 'ASC');
    while ($arLang = $dbLang->Fetch()) {
        $arMess[$arLang['LID']] = __IncludeLang($__current_dir . "/lang/" . $arLang['LID'] . '/' . $__current_file, true);
    }
    return $arMess;
}
Example #8
0
function isValidLang($lang)
{
    $rsLang = CLanguage::GetList($by = "sort", $order = "desc");
    $is_valid_lang = false;
    while ($arLang = $rsLang->Fetch()) {
        if ($lang == $arLang["LID"]) {
            $is_valid_lang = true;
            break;
        }
    }
    return $is_valid_lang;
}
 public function getLangs($filter = array())
 {
     $by = 'def';
     $order = 'desc';
     $lids = array();
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     $dbRes = \CLanguage::GetList($by, $order, $filter);
     while ($aItem = $dbRes->Fetch()) {
         $lids[] = $aItem;
     }
     return $lids;
 }
Example #10
0
function CreateForm($arForm, $arFormFields, $langFile)
{
    if (!CModule::IncludeModule("form")) {
        return false;
    }
    // set defaults
    $arFieldDefaults = array("ACTIVE" => "Y", "C_SORT" => 0, "ADDITIONAL" => "N", "TITLE_TYPE" => "text", "IN_RESULTS_TABLE" => "Y", "IN_EXCEL_TABLE" => "Y");
    foreach ($arFormFields as $key => $arField) {
        if ($arFormFields['ADDITIONAL'] == 'Y' && !is_set($arFormFields['C_SORT'])) {
            $arFormFields['C_SORT'] = 5000;
        }
        $arFieldDefaults["C_SORT"] += 100;
        $arFormFields[$key] = array_merge($arFieldDefaults, $arField);
        $arFormFields[$key]["TITLE"] = GetMessage($arField["SID"] . "_QUESTION");
    }
    $rsLanguage = CLanguage::GetList($by, $order, array());
    while ($arLanguage = $rsLanguage->Fetch()) {
        WizardServices::IncludeServiceLang($langFile, $arLanguage["LID"]);
        $arForm["arMENU"][$arLanguage["LID"]] = GetMessage(substr($arForm["SID"], 0, -3) . "_MENU_NAME");
    }
    $dbForm = CForm::GetBySID($arForm["SID"]);
    if ($dbForm->Fetch()) {
        return;
    }
    WizardServices::IncludeServiceLang("status.php");
    if ($formID = CForm::Set($arForm, false, "N")) {
        // setup form fields
        foreach ($arFormFields as $key => $arField) {
            $arField["FORM_ID"] = $formID;
            $fieldID = CFormField::Set($arField, false, "N");
        }
        if ($arTemplates = CForm::SetMailTemplate($formID)) {
            CForm::Set(array('SID' => $arForm['SID'], 'arMAIL_TEMPLATE' => $arTemplates), $formID, 'N');
        }
        $arStatuses = array(array("FORM_ID" => $formID, "TITLE" => GetMessage("STATUS_NEW"), "C_SORT" => 100, "ACTIVE" => "Y", "DEFAULT_VALUE" => "Y", "CSS" => "statusgray", "arPERMISSION_VIEW" => array(0), "arPERMISSION_MOVE" => array(0), "arPERMISSION_EDIT" => array(0), "arPERMISSION_DELETE" => array(0)), array("FORM_ID" => $formID, "TITLE" => GetMessage("STATUS_RECEIVED"), "C_SORT" => 200, "ACTIVE" => "Y", "DEFAULT_VALUE" => "N", "CSS" => "statusblue", "arPERMISSION_VIEW" => array(0)), array("FORM_ID" => $formID, "TITLE" => GetMessage("STATUS_DONE"), "C_SORT" => 300, "ACTIVE" => "Y", "DEFAULT_VALUE" => "N", "CSS" => "statusgreen", "arPERMISSION_VIEW" => array(0)), array("FORM_ID" => $formID, "TITLE" => GetMessage("STATUS_REFUSE"), "C_SORT" => 400, "ACTIVE" => "Y", "DEFAULT_VALUE" => "N", "CSS" => "statusred", "arPERMISSION_VIEW" => array(0)));
        foreach ($arStatuses as $key => $arStatus) {
            if ($STATUS_ID = CFormStatus::Set($arStatus, false, "N")) {
                if ($arStatus['DEFAULT_VALUE'] == 'N' && ($arTemplates = CFormStatus::SetMailTemplate($formID, $STATUS_ID))) {
                    foreach ($arTemplates as $TEMPLATE_ID) {
                        if (null == $em) {
                            $em = new CEventMessage();
                        }
                        $em->Update($TEMPLATE_ID, array('MESSAGE' => GetMessage('STATUS_MESSAGE')));
                    }
                    CFormStatus::Set(array('FORM_ID' => $formID, 'arMAIL_TEMPLATE' => $arTemplates), $STATUS_ID, 'N');
                }
            }
        }
    }
    return $formID;
}
Example #11
0
 /**
  * @param array $langId
  * @return mixed|void
  * @throws BimException
  * @internal param array $params
  */
 public function checkParams($langId)
 {
     $lang = new \CLanguage();
     if (!isset($langId) || empty($langId)) {
         throw new BimException('В параметрах не найден langId');
     }
     $this->ownerItemDbData = array();
     $langDbRes = $lang->GetList($by = "lid", $order = "desc", array('LID' => $langId));
     if ($langDbRes === false || !$langDbRes->SelectedRowsCount()) {
         throw new BimException('Не найден язык системы с id = ' . $langId);
     }
     $langData = $langDbRes->Fetch();
     $this->ownerItemDbData = $langData;
 }
Example #12
0
 /**
  * Удаление
  *
  * @param $ID
  * @return array
  * @throws BimException
  */
 public static function Delete($ID)
 {
     $obLang = new \CLanguage();
     if ($ID) {
         $dbLang = $obLang->GetList($by = "lid", $order = "desc", array('ID' => $ID));
         if ($arLang = $dbLang->Fetch()) {
             $res = $obLang->Delete($ID);
             if (!$res) {
                 throw new BimException($obLang->LAST_ERROR);
             }
         }
     } else {
         throw new BimException("Language ID is empty");
     }
 }
Example #13
0
 protected static function getAllLangIDs()
 {
     if (self::$allLangIDs !== null) {
         return self::$allLangIDs;
     }
     self::$allLangIDs = array();
     $sort = 'sort';
     $order = 'asc';
     $langEntity = new \CLanguage();
     $dbLangs = $langEntity->GetList($sort, $order);
     while ($lang = $dbLangs->Fetch()) {
         if (isset($lang['LID'])) {
             self::$allLangIDs[] = $lang['LID'];
         }
     }
     return self::$allLangIDs;
 }
Example #14
0
 function InstallFiles()
 {
     if ($_ENV["COMPUTERNAME"] != 'BX') {
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/controller/install/admin", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/admin", false);
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/controller/install/images", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/images/controller", true, true);
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/controller/install/themes", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/themes", true, true);
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/controller/install/components", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components", True, True);
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/controller/install/activities", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/activities", True, True);
         if (IsModuleInstalled('bizproc')) {
             CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/controller/install/bizproc/templates", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/bizproc/templates", true, true);
             $langs = CLanguage::GetList($b = "", $o = "");
             while ($lang = $langs->Fetch()) {
                 CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/controller/lang/" . $lang["LID"] . "/install/bizproc/templates", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/bizproc/lang/" . $lang["LID"] . "/templates", true, true);
             }
         }
     }
     return true;
 }
Example #15
0
function CheckIBlockTypeID($strIBlockTypeID, $strNewIBlockTypeID, $strNeedAdd)
{
    $arResult = false;
    $strNeedAdd = 'Y' == $strNeedAdd ? 'Y' : 'N';
    $strNewIBlockTypeID = trim($strNewIBlockTypeID);
    $strIBlockTypeID = trim($strIBlockTypeID);
    if ('Y' == $strNeedAdd) {
        $obIBlockType = new CIBlockType();
        if ('' != $strNewIBlockTypeID) {
            $rsIBlockTypes = CIBlockType::GetByID($strNewIBlockTypeID);
            if ($arIBlockType = $rsIBlockTypes->Fetch()) {
                $arResult = array('RESULT' => 'OK', 'VALUE' => $strNewIBlockTypeID);
            } else {
                $arFields = array('ID' => $strNewIBlockTypeID, 'SECTIONS' => 'N', 'IN_RSS' => 'N', 'SORT' => 500);
                $rsLanguages = CLanguage::GetList($by = "sort", $order = "desc", array('ACTIVE' => 'Y'));
                while ($arLanguage = $rsLanguages->Fetch()) {
                    $arFields['LANG'][$arLanguage['LID']]['NAME'] = $strNewIBlockTypeID;
                }
                $mxOffersType = $obIBlockType->Add($arFields);
                if (false == $mxOffersType) {
                    $arResult = array('RESULT' => 'ERROR', 'MESSAGE' => $obIBlockType->LAST_ERROR);
                } else {
                    $arResult = array('RESULT' => 'OK', 'VALUE' => $strNewIBlockTypeID);
                }
            }
        } else {
            $arResult = array('RESULT' => 'ERROR', 'MESSAGE' => GetMessage('IB_E_OF_ERR_NEW_IBLOCK_TYPE_ABSENT'));
        }
    } else {
        if ('' == $strIBlockTypeID) {
            $arResult = array('RESULT' => 'ERROR', 'MESSAGE' => GetMessage('IB_E_OF_ERR_IBLOCK_TYPE_ABSENT'));
        } else {
            $rsIBlockTypes = CIBlockType::GetByID($strIBlockTypeID);
            if (!($arIBlockType = $rsIBlockTypes->Fetch())) {
                $arResult = array('RESULT' => 'ERROR', 'MESSAGE' => GetMessage('IB_E_OF_ERR_IBLOCK_TYPE_BAD'));
            } else {
                $arResult = array('RESULT' => 'OK', 'VALUE' => $strIBlockTypeID);
            }
        }
    }
    return $arResult;
}
Example #16
0
 public function __construct($arParams)
 {
     $this->SITE_ID = $arParams["SITE_ID"];
     $this->REWRITE = $arParams["REWRITE"];
     $this->ModuleBlogGroup = '[' . $this->SITE_ID . '] ' . GetMessage("IDEA_BLOG_GROUP_NAME");
     $this->ModuleBlogUrl .= "_" . $this->SITE_ID;
     //NULL CACHE
     BXClearCache(True, '/' . $this->SITE_ID . '/idea/');
     BXClearCache(True, '/' . SITE_ID . '/idea/');
     global $CACHE_MANAGER;
     if (CACHED_b_user_field_enum !== false) {
         $CACHE_MANAGER->CleanDir("b_user_field_enum");
     }
     //Statuses List (for demo)
     $this->arResult["SETTINGS"]["STATUS"] = CIdeaManagment::getInstance()->Idea()->GetStatusList();
     foreach ($this->arResult["SETTINGS"]["STATUS"] as $arStatus) {
         $this->arResult["SETTINGS"]["STATUS_ID"][$arStatus["XML_ID"]] = $arStatus["ID"];
     }
     //Lang List
     $l = CLanguage::GetList($by = "sort", $order = "asc");
     while ($r = $l->Fetch()) {
         $this->arResult["SETTINGS"]["LANG"][] = $r;
     }
     //Sites List
     $oSites = CSite::GetList($b = "", $o = "", array("ACTIVE" => "Y"));
     while ($site = $oSites->Fetch()) {
         $this->arResult["SETTINGS"]["SITE"][$site["LID"]] = array("LANGUAGE_ID" => $site["LANGUAGE_ID"], "ABS_DOC_ROOT" => $site["ABS_DOC_ROOT"], "DIR" => $site["DIR"], "SITE_ID" => $site["LID"], "SERVER_NAME" => $site["SERVER_NAME"], "NAME" => $site["NAME"]);
     }
     if (array_key_exists($this->SITE_ID, $this->arResult["SETTINGS"]["SITE"])) {
         $this->PublicDir = str_replace(array("#SITE_DIR#"), array($this->arResult["SETTINGS"]["SITE"][$this->SITE_ID]["DIR"]), $this->PublicDir);
     }
     $site = CFileMan::__CheckSite($this->SITE_ID);
     $this->DOCUMENT_ROOT = CSite::GetSiteDocRoot($site);
     $this->IO = CBXVirtualIo::GetInstance();
     //SetDefault
     $this->arResult["INSTALLATION"]["IBLOCK_TYPE_INSTALL"] = true;
     $this->arResult["INSTALLATION"]["IBLOCK_INSTALL"] = true;
     $this->arResult["INSTALLATION"]["BLOG_GROUP_INSTALL"] = true;
     $this->arResult["INSTALLATION"]["BLOG_INSTALL"] = true;
     $this->CheckParams();
 }
Example #17
0
 function __load_exchange_use_login_messages()
 {
     $arEditFormLabel1 = array();
     $dbLang1 = CLanguage::GetList($b1, $o1, array());
     while ($arLang1 = $dbLang1->Fetch()) {
         $MESS = array();
         $fn1 = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/dav/lang/" . preg_replace("/[^a-z0-9]/i", "", $arLang1["LID"]) . "/options.php";
         $fnDef1 = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/dav/lang/en/options.php";
         if (file_exists($fn1)) {
             include $fn1;
         } elseif (file_exists($fnDef1)) {
             include $fnDef1;
         }
         if (isset($MESS["DAV_EXCHANGE_USER_FIELD"])) {
             $arEditFormLabel1[$arLang1["LID"]] = $MESS["DAV_EXCHANGE_USER_FIELD"];
         } else {
             $arEditFormLabel1[$arLang1["LID"]] = "Exchange mail box";
         }
     }
     return $arEditFormLabel1;
 }
Example #18
0
function CheckIBlockType($ID, $SECTIONS = "Y")
{
    $obType = new CIBlockType();
    $rsType = $obType->GetByID($ID);
    if ($arType = $rsType->Fetch()) {
        return $arType["ID"];
    } else {
        $arFields = array("ID" => $ID, "SECTIONS" => $SECTIONS, "LANG" => array());
        $rsLanguages = CLanguage::GetList($by = "sort", $order = "asc");
        while ($arLanguage = $rsLanguages->Fetch()) {
            $MY_MESS = IncludeModuleLangFile(__FILE__, $arLanguage["LID"], true);
            $arFields["LANG"][$arLanguage["LID"]] = array("NAME" => $MY_MESS["IBLOCK_INSTALL_" . strtoupper($ID) . "_NAME"], "SECTION_NAME" => $MY_MESS["IBLOCK_INSTALL_" . strtoupper($ID) . "_SECTIONS_NAME"], "ELEMENT_NAME" => $MY_MESS["IBLOCK_INSTALL_" . strtoupper($ID) . "_ELEMENTS_NAME"]);
        }
        $result = $obType->Add($arFields);
        if ($result) {
            return $result;
        } else {
            return false;
        }
    }
}
Example #19
0
         CCatalog::Add(array('IBLOCK_ID' => $IBLOCK_OFFERS_ID, 'PRODUCT_IBLOCK_ID' => $IBLOCK_CATALOG_ID, 'SKU_PROPERTY_ID' => $ID_SKU));
     }
     //create facet index
     $index = \Bitrix\Iblock\PropertyIndex\Manager::createIndexer($IBLOCK_CATALOG_ID);
     $index->startIndex();
     $index->continueIndex(0);
     $index->endIndex();
     $index = \Bitrix\Iblock\PropertyIndex\Manager::createIndexer($IBLOCK_OFFERS_ID);
     $index->startIndex();
     $index->continueIndex(0);
     $index->endIndex();
     \Bitrix\Iblock\PropertyIndex\Manager::checkAdminNotification();
 }
 //user fields for sections
 $arLanguages = array();
 $rsLanguage = CLanguage::GetList($by, $order, array());
 while ($arLanguage = $rsLanguage->Fetch()) {
     $arLanguages[] = $arLanguage["LID"];
 }
 $arUserFields = array("UF_BROWSER_TITLE", "UF_KEYWORDS", "UF_META_DESCRIPTION");
 foreach ($arUserFields as $userField) {
     $arLabelNames = array();
     foreach ($arLanguages as $languageID) {
         WizardServices::IncludeServiceLang("property_names.php", $languageID);
         $arLabelNames[$languageID] = GetMessage($userField);
     }
     $arProperty["EDIT_FORM_LABEL"] = $arLabelNames;
     $arProperty["LIST_COLUMN_LABEL"] = $arLabelNames;
     $arProperty["LIST_FILTER_LABEL"] = $arLabelNames;
     $dbRes = CUserTypeEntity::GetList(array(), array("ENTITY_ID" => 'IBLOCK_' . $IBLOCK_CATALOG_ID . '_SECTION', "FIELD_NAME" => $userField));
     if ($arRes = $dbRes->Fetch()) {
Example #20
0
if (isset($arCurrentValues['USE_VOTE_RATING']) && 'Y' == $arCurrentValues['USE_VOTE_RATING']) {
    $arTemplateParameters['VOTE_DISPLAY_AS_RATING'] = array('NAME' => GetMessage('CP_BCE_TPL_VOTE_DISPLAY_AS_RATING'), 'TYPE' => 'LIST', 'VALUES' => array('rating' => GetMessage('CP_BCE_TPL_VDAR_RATING'), 'vote_avg' => GetMessage('CP_BCE_TPL_VDAR_AVERAGE')), 'DEFAULT' => 'rating');
}
$arTemplateParameters['USE_COMMENTS'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CP_BCE_TPL_USE_COMMENTS'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N', 'REFRESH' => 'Y');
if (isset($arCurrentValues['USE_COMMENTS']) && $arCurrentValues['USE_COMMENTS'] == 'Y') {
    if (ModuleManager::isModuleInstalled("blog")) {
        $arTemplateParameters['BLOG_USE'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CP_BCE_TPL_BLOG_USE'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N', 'REFRESH' => 'Y');
        if (isset($arCurrentValues['BLOG_USE']) && $arCurrentValues['BLOG_USE'] == 'Y') {
            $arTemplateParameters['BLOG_URL'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CP_BCE_TPL_BLOG_URL'), 'TYPE' => 'STRING', 'DEFAULT' => 'catalog_comments');
            $arTemplateParameters['BLOG_EMAIL_NOTIFY'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CP_BCE_TPL_BLOG_EMAIL_NOTIFY'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N');
        }
    }
    $boolRus = false;
    $langBy = "id";
    $langOrder = "asc";
    $rsLangs = CLanguage::GetList($langBy, $langOrder, array('ID' => 'ru', "ACTIVE" => "Y"));
    if ($arLang = $rsLangs->Fetch()) {
        $boolRus = true;
    }
    if ($boolRus) {
        $arTemplateParameters['VK_USE'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CP_BCE_TPL_VK_USE'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N', 'REFRESH' => 'Y');
        if (isset($arCurrentValues['VK_USE']) && 'Y' == $arCurrentValues['VK_USE']) {
            $arTemplateParameters['VK_API_ID'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CP_BCE_TPL_VK_API_ID'), 'TYPE' => 'STRING', 'DEFAULT' => 'API_ID');
        }
    }
    $arTemplateParameters['FB_USE'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CP_BCE_TPL_FB_USE'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N', 'REFRESH' => 'Y');
    if (isset($arCurrentValues['FB_USE']) && 'Y' == $arCurrentValues['FB_USE']) {
        $arTemplateParameters['FB_APP_ID'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CP_BCE_TPL_FB_APP_ID'), 'TYPE' => 'STRING', 'DEFAULT' => '');
    }
}
if (ModuleManager::isModuleInstalled("highloadblock")) {
Example #21
0
					if ('Y' == $arIBlockInfo['CREATE_OFFERS_NEW_TYPE'])
					{
						$rsIBlockTypes = CIBlockType::GetByID($arIBlockInfo['OFFERS_NEW_TYPE']);
						if ($arIBlockType = $rsIBlockTypes->Fetch())
						{
							$arIBlockInfo['OFFERS_TYPE'] = $arIBlockInfo['OFFERS_NEW_TYPE'];
						}
						else
						{
							$arFields = array(
								'ID' => $arIBlockInfo['OFFERS_NEW_TYPE'],
								'SECTIONS' => 'N',
								'IN_RSS' => 'N',
								'SORT' => 500,
							);
							$rsLanguages = CLanguage::GetList($by="sort", $order="desc",array('ACTIVE' => 'Y'));
							while ($arLanguage = $rsLanguages->Fetch())
							{
								$arFields['LANG'][$arLanguage['LID']]['NAME'] = $arIBlockInfo['OFFERS_NEW_TYPE'];
							}
							$obIBlockType = new CIBlockType();
							$mxOffersType = $obIBlockType->Add($arFields);
							if (!$mxOffersType)
							{
								$boolFlag = false;
								$strWarning .= Loc::getMessage(
									'CAT_IBLOCK_OFFERS_ERR_NEW_IBLOCK_TYPE_NOT_ADD',
									array(
										'#PRODUCT#' => $arCurrentIBlocks[$intIBlockID]['INFO'],
										'#ERROR#' => $obIBlockType->LAST_ERROR
									)
Example #22
0
 /**
  * getLangData
  * @param $iblockTypeId
  * @return array
  */
 private function getLangData($iblockTypeId)
 {
     $CIblockType = new \CIBlockType();
     $lang = new \CLanguage();
     $result = array();
     $langDbRes = $lang->GetList($by = "lid", $order = "desc", array());
     while ($langData = $langDbRes->Fetch()) {
         $typeLangItemTmp = $CIblockType->GetByIDLang($iblockTypeId, $langData['LID']);
         $typeLangItem = array();
         foreach ($typeLangItemTmp as $key => $value) {
             if (strstr($key, '~')) {
                 continue;
             }
             $typeLangItem[$key] = $value;
         }
         $result[$langData['LID']] = $typeLangItem;
     }
     return $result;
 }
Example #23
0
 function __CreateUserProperty()
 {
     if ($this->attachIBlockID < 1) {
         return false;
     }
     $success = true;
     $dbRes = CUserTypeEntity::GetList(array(), array("ENTITY_ID" => "USER", "FIELD_NAME" => $this->userPropertyName));
     if (!$dbRes->Fetch()) {
         $arLabelNames = array();
         $rsLanguage = CLanguage::GetList($by, $order, array());
         while ($arLanguage = $rsLanguage->Fetch()) {
             IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/general/csv_user_import_labels.php", $arLanguage["LID"]);
             $arLabelNames[$arLanguage["LID"]] = GetMessage("DEPARTMENT_USER_PROPERTY_NAME");
         }
         $arFields = array('ENTITY_ID' => 'USER', 'FIELD_NAME' => $this->userPropertyName, 'USER_TYPE_ID' => 'iblock_section', 'XML_ID' => '', 'SORT' => 100, 'MULTIPLE' => 'Y', 'MANDATORY' => 'N', 'SHOW_FILTER' => 'I', 'SHOW_IN_LIST' => 'Y', 'EDIT_IN_LIST' => 'Y', 'IS_SEARCHABLE' => 'Y', 'SETTINGS' => array('DISPLAY' => 'LIST', 'LIST_HEIGHT' => '8', 'IBLOCK_ID' => $this->attachIBlockID), "EDIT_FORM_LABEL" => $arLabelNames, "LIST_COLUMN_LABEL" => $arLabelNames, "LIST_FILTER_LABEL" => $arLabelNames);
         $userType = new CUserTypeEntity();
         $success = (bool) $userType->Add($arFields);
     }
     return $success;
 }
Example #24
0
 function InstallEvents()
 {
     $arEventTypes = array();
     $langs = CLanguage::GetList($b = "", $o = "");
     while ($language = $langs->Fetch()) {
         $lid = $language["LID"];
         IncludeModuleLangFile(__FILE__, $lid);
         $arEventTypes[] = array("LID" => $lid, "EVENT_NAME" => "NEW_USER", "NAME" => GetMessage("MAIN_NEW_USER_TYPE_NAME"), "DESCRIPTION" => GetMessage("MAIN_NEW_USER_TYPE_DESC"), "SORT" => 1);
         $arEventTypes[] = array("LID" => $lid, "EVENT_NAME" => "USER_INFO", "NAME" => GetMessage("MAIN_USER_INFO_TYPE_NAME"), "DESCRIPTION" => GetMessage("MAIN_USER_INFO_TYPE_DESC"), "SORT" => 2);
         $arEventTypes[] = array("LID" => $lid, "EVENT_NAME" => "NEW_USER_CONFIRM", "NAME" => GetMessage("MAIN_NEW_USER_CONFIRM_TYPE_NAME"), "DESCRIPTION" => GetMessage("MAIN_NEW_USER_CONFIRM_TYPE_DESC"), "SORT" => 3);
         $arEventTypes[] = array("LID" => $lid, "EVENT_NAME" => "USER_PASS_REQUEST", "NAME" => GetMessage("MAIN_USER_PASS_REQUEST_TYPE_NAME"), "DESCRIPTION" => GetMessage("MAIN_USER_INFO_TYPE_DESC"), "SORT" => 4);
         $arEventTypes[] = array("LID" => $lid, "EVENT_NAME" => "USER_PASS_CHANGED", "NAME" => GetMessage("MAIN_USER_PASS_CHANGED_TYPE_NAME"), "DESCRIPTION" => GetMessage("MAIN_USER_INFO_TYPE_DESC"), "SORT" => 5);
         $arEventTypes[] = array("LID" => $lid, "EVENT_NAME" => "USER_INVITE", "NAME" => GetMessage("MAIN_USER_INVITE_TYPE_NAME"), "DESCRIPTION" => GetMessage("MAIN_USER_INVITE_TYPE_DESC"), "SORT" => 6);
         $arEventTypes[] = array("LID" => $lid, "EVENT_NAME" => "FEEDBACK_FORM", "NAME" => GetMessage("MF_EVENT_NAME"), "DESCRIPTION" => GetMessage("MF_EVENT_DESCRIPTION"), "SORT" => 7);
     }
     $type = new CEventType();
     foreach ($arEventTypes as $arEventType) {
         $type->Add($arEventType);
     }
     IncludeModuleLangFile(__FILE__);
     $arMessages = array();
     $arMessages[] = array("EVENT_NAME" => "NEW_USER", "LID" => "s1", "EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#", "EMAIL_TO" => "#DEFAULT_EMAIL_FROM#", "SUBJECT" => GetMessage("MAIN_NEW_USER_EVENT_NAME"), "MESSAGE" => GetMessage("MAIN_NEW_USER_EVENT_DESC"));
     $arMessages[] = array("EVENT_NAME" => "USER_INFO", "LID" => "s1", "EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#", "EMAIL_TO" => "#EMAIL#", "SUBJECT" => GetMessage("MAIN_USER_INFO_EVENT_NAME"), "MESSAGE" => GetMessage("MAIN_USER_INFO_EVENT_DESC"));
     $arMessages[] = array("EVENT_NAME" => "USER_PASS_REQUEST", "LID" => "s1", "EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#", "EMAIL_TO" => "#EMAIL#", "SUBJECT" => GetMessage("MAIN_USER_PASS_REQUEST_EVENT_NAME"), "MESSAGE" => GetMessage("MAIN_USER_PASS_REQUEST_EVENT_DESC"));
     $arMessages[] = array("EVENT_NAME" => "USER_PASS_CHANGED", "LID" => "s1", "EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#", "EMAIL_TO" => "#EMAIL#", "SUBJECT" => GetMessage("MAIN_USER_PASS_CHANGED_EVENT_NAME"), "MESSAGE" => GetMessage("MAIN_USER_PASS_CHANGED_EVENT_DESC"));
     $arMessages[] = array("EVENT_NAME" => "NEW_USER_CONFIRM", "LID" => "s1", "EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#", "EMAIL_TO" => "#EMAIL#", "SUBJECT" => GetMessage("MAIN_NEW_USER_CONFIRM_EVENT_NAME"), "MESSAGE" => GetMessage("MAIN_NEW_USER_CONFIRM_EVENT_DESC"));
     $arMessages[] = array("EVENT_NAME" => "USER_INVITE", "LID" => "s1", "EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#", "EMAIL_TO" => "#EMAIL#", "SUBJECT" => GetMessage("MAIN_USER_INVITE_EVENT_NAME"), "MESSAGE" => GetMessage("MAIN_USER_INVITE_EVENT_DESC"));
     $arMessages[] = array("EVENT_NAME" => "FEEDBACK_FORM", "LID" => "s1", "EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#", "EMAIL_TO" => "#EMAIL_TO#", "SUBJECT" => GetMessage("MF_EVENT_SUBJECT"), "MESSAGE" => GetMessage("MF_EVENT_MESSAGE"));
     $message = new CEventMessage();
     foreach ($arMessages as $arMessage) {
         $message->Add($arMessage);
     }
     return true;
 }
Example #25
0
 protected static function groupSectionCreate($groupId)
 {
     $groupLib = CWebDavIblock::LibOptions('group_files', false, SITE_ID);
     if (!$groupLib || !isset($groupLib['id']) || !($iblockId = intval($groupLib['id']))) {
         return false;
     }
     $result = CIBlockWebdavSocnet::GetSectionID($iblockId, 'group', $groupId);
     if (intval($result) > 0) {
         return $result;
     }
     $dbRes = CUserTypeEntity::GetList(array($by => $order), array("ENTITY_ID" => "IBLOCK_" . $iblockId . "_SECTION", "FIELD_NAME" => "UF_USE_BP"));
     if (!$dbRes || !($res = $dbRes->GetNext())) {
         $arFields = array("ENTITY_ID" => "IBLOCK_" . $iblockId . "_SECTION", "FIELD_NAME" => "UF_USE_BP", "USER_TYPE_ID" => "string", "MULTIPLE" => "N", "MANDATORY" => "N", "SETTINGS" => array("DEFAULT_VALUE" => "Y"));
         $arFieldName = array();
         $rsLanguage = CLanguage::GetList($by, $order, array());
         while ($arLanguage = $rsLanguage->Fetch()) {
             $dir = str_replace(array("\\", "//"), "/", dirname(__FILE__));
             $dirs = explode("/", $dir);
             array_pop($dirs);
             $file = trim(implode("/", $dirs) . "/lang/" . $arLanguage["LID"] . "/include/webdav_settings.php");
             $tmp_mess = __IncludeLang($file, true);
             $arFieldName[$arLanguage["LID"]] = empty($tmp_mess["SONET_UF_USE_BP"]) ? "Use Business Process" : $tmp_mess["SONET_UF_USE_BP"];
         }
         $arFields["EDIT_FORM_LABEL"] = $arFieldName;
         $obUserField = new CUserTypeEntity();
         $obUserField->Add($arFields);
         $GLOBALS["USER_FIELD_MANAGER"]->arFieldsCache = array();
     }
     $arFields = array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "SOCNET_GROUP_ID" => false, "IBLOCK_SECTION_ID" => 0, "UF_USE_BP" => "N");
     $arFields["SOCNET_GROUP_ID"] = $groupId;
     $arFields["NAME"] = GetMessage("SONET_GROUP_PREFIX") . $groupId;
     $dbGroup = CSocNetGroup::GetList(array(), array("ID" => (int) $groupId), false, false, array("ID", "SITE_ID", "NAME"));
     if ($arGroup = $dbGroup->Fetch()) {
         $arFields["NAME"] = GetMessage("SONET_GROUP_PREFIX") . $arGroup["NAME"];
     }
     if (CIBlock::GetarrayByID($iblockId, "RIGHTS_MODE") === "E") {
         $arTasks = CWebDavIblock::GetTasks();
         $arFields['RIGHTS'] = array('n0' => array('GROUP_CODE' => 'SG' . $arFields["SOCNET_GROUP_ID"] . '_A', 'TASK_ID' => $arTasks['X']), 'n1' => array('GROUP_CODE' => 'SG' . $arFields["SOCNET_GROUP_ID"] . '_E', 'TASK_ID' => $arTasks['W']), 'n2' => array('GROUP_CODE' => 'SG' . $arFields["SOCNET_GROUP_ID"] . '_K', 'TASK_ID' => $arTasks['W']));
     }
     $GLOBALS["UF_USE_BP"] = $arFields["UF_USE_BP"];
     $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("IBLOCK_" . $iblockId . "_SECTION", $arFields);
     $bs = new CIBlockSection();
     $sectionId = $bs->Add($arFields);
     if (!$sectionId) {
         return false;
     }
     return $sectionId;
 }
Example #26
0
<?php

$langs = CLanguage::GetList($b = "", $o = "");
while ($lang = $langs->Fetch()) {
    $lid = $lang["LID"];
    IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/im/install/events/set_events.php", $lid);
    $et = new CEventType();
    $et->Add(array("LID" => $lid, "EVENT_NAME" => "IM_NEW_NOTIFY", "NAME" => GetMessage("IM_NEW_NOTIFY_NAME"), "DESCRIPTION" => GetMessage("IM_NEW_NOTIFY_DESC")));
    $et = new CEventType();
    $et->Add(array("LID" => $lid, "EVENT_NAME" => "IM_NEW_NOTIFY_GROUP", "NAME" => GetMessage("IM_NEW_NOTIFY_GROUP_NAME"), "DESCRIPTION" => GetMessage("IM_NEW_NOTIFY_GROUP_DESC")));
    $et = new CEventType();
    $et->Add(array("LID" => $lid, "EVENT_NAME" => "IM_NEW_MESSAGE", "NAME" => GetMessage("IM_NEW_MESSAGE_NAME"), "DESCRIPTION" => GetMessage("IM_NEW_MESSAGE_DESC")));
    $et = new CEventType();
    $et->Add(array("LID" => $lid, "EVENT_NAME" => "IM_NEW_MESSAGE_GROUP", "NAME" => GetMessage("IM_NEW_MESSAGE_GROUP_NAME"), "DESCRIPTION" => GetMessage("IM_NEW_MESSAGE_GROUP_DESC")));
    $arSites = array();
    $sites = CSite::GetList($b = "", $o = "", array("LANGUAGE_ID" => $lid));
    while ($site = $sites->Fetch()) {
        $arSites[] = $site["LID"];
    }
    if (count($arSites) > 0) {
        $emess = new CEventMessage();
        $emess->Add(array("ACTIVE" => "Y", "EVENT_NAME" => "IM_NEW_NOTIFY", "LID" => $arSites, "EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#", "EMAIL_TO" => "#EMAIL_TO#", "SUBJECT" => GetMessage("IM_NEW_NOTIFY_SUBJECT"), "MESSAGE" => GetMessage("IM_NEW_NOTIFY_MESSAGE"), "BODY_TYPE" => "text"));
        $emess = new CEventMessage();
        $emess->Add(array("ACTIVE" => "Y", "EVENT_NAME" => "IM_NEW_NOTIFY_GROUP", "LID" => $arSites, "EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#", "EMAIL_TO" => "#EMAIL_TO#", "SUBJECT" => GetMessage("IM_NEW_NOTIFY_GROUP_SUBJECT"), "MESSAGE" => GetMessage("IM_NEW_NOTIFY_GROUP_MESSAGE"), "BODY_TYPE" => "text"));
        $emess = new CEventMessage();
        $emess->Add(array("ACTIVE" => "Y", "EVENT_NAME" => "IM_NEW_MESSAGE", "LID" => $arSites, "EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#", "EMAIL_TO" => "#EMAIL_TO#", "SUBJECT" => GetMessage("IM_NEW_MESSAGE_SUBJECT"), "MESSAGE" => GetMessage("IM_NEW_MESSAGE_MESSAGE"), "BODY_TYPE" => "text"));
        $emess = new CEventMessage();
        $emess->Add(array("ACTIVE" => "Y", "EVENT_NAME" => "IM_NEW_MESSAGE_GROUP", "LID" => $arSites, "EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#", "EMAIL_TO" => "#EMAIL_TO#", "SUBJECT" => GetMessage("IM_NEW_MESSAGE_GROUP_SUBJECT"), "MESSAGE" => GetMessage("IM_NEW_MESSAGE_GROUP_MESSAGE"), "BODY_TYPE" => "text"));
    }
}
}
if (StrLen($installPath) <= 0) {
    return;
}
$errorString = "";
$arSite = array();
$arSites = array();
$dbResult = CSite::GetList($b = "", $o = "", array("ID" => $installSiteID, "ACTIVE" => "Y"));
while ($arResult = $dbResult->Fetch()) {
    $arSites[] = $arResult["LID"];
    if ($arResult["LID"] == $installSiteID) {
        $arSite = array("LANGUAGE_ID" => $arResult["LANGUAGE_ID"], "ABS_DOC_ROOT" => $arResult["ABS_DOC_ROOT"], "DIR" => $arResult["DIR"], "SITE_ID" => $arResult["LID"], "SERVER_NAME" => $arResult["SERVER_NAME"], "NAME" => $arResult["NAME"]);
    }
}
$arLanguages = array();
$dbResult = CLanguage::GetList($lby = "sort", $lorder = "asc");
while ($arResult = $dbResult->Fetch()) {
    $arLanguages[] = $arResult;
}
if (Count($arLanguages) <= 0) {
    return;
}
if (Count($arSite) <= 0) {
    return;
}
if (!function_exists("GetSocNetMessageLocal")) {
    function GetSocNetMessageLocal($message, $lang)
    {
        global $arGetSocNetMessageLocalCache;
        if (!is_array($arGetSocNetMessageLocalCache)) {
            $arGetSocNetMessageLocalCache = array();
Example #28
0
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
IncludeModuleLangFile(__FILE__);
$forumPermissions = $APPLICATION->GetGroupRight("forum");
if ($forumPermissions == "D") {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/forum/include.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/forum/prolog.php";
/********************************************************************
				Input params
********************************************************************/
/***************** BASE ********************************************/
$ID = intVal($ID);
$arError = $arSmile = $arFields = $arLang = array();
$arLangTitle = array("reference_id" => array(), "reference" => array());
$db_res = CLanguage::GetList($b = "sort", $o = "asc");
while ($res = $db_res->Fetch()) {
    $arLang[$res["LID"]] = $res;
    $arLangTitle["reference_id"][] = $res["LID"];
    $arLangTitle["reference"][] = htmlspecialcharsbx($res["NAME"]);
}
$bInitVars = false;
/********************************************************************
				/Input params
********************************************************************/
$APPLICATION->SetTitle($ID > 0 ? GetMessage("FORUM_EDIT_RECORD", array("#ID#" => $ID)) : GetMessage("FORUM_NEW_RECORD"));
/********************************************************************
				Action
********************************************************************/
$fileName = '';
if ($REQUEST_METHOD == "POST" && $forumPermissions >= "W" && (strlen($save) > 0 || strlen($apply) > 0)) {
Example #29
0
 public static function InitUserEntityLoadMessages($key, $defaultMessage = "")
 {
     $arResult = array();
     $dbLang = CLanguage::GetList($b = "", $o = "", array());
     while ($arLang = $dbLang->Fetch()) {
         $MESS = array();
         $lid = preg_replace("/[^a-z0-9]/i", "", $arLang["LID"]);
         $fn = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/dav/lang/" . $lid . "/options.php";
         $fnDef = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/dav/lang/en/options.php";
         if (file_exists($fn)) {
             include $fn;
         } elseif (file_exists($fnDef)) {
             include $fnDef;
         }
         if (isset($MESS["DAV_" . $key])) {
             $arResult[$arLang["LID"]] = $MESS["DAV_" . $key];
         } else {
             $arResult[$arLang["LID"]] = $defaultMessage;
         }
     }
     return $arResult;
 }
 function SetMailTemplate($WEB_FORM_ID, $ADD_NEW_TEMPLATE = "Y", $old_SID = "", $bReturnFullInfo = false)
 {
     global $DB, $MESS, $strError;
     $err_mess = CAllForm::err_mess() . "<br>Function: SetMailTemplates<br>Line: ";
     $arrReturn = array();
     $WEB_FORM_ID = intval($WEB_FORM_ID);
     $q = CForm::GetByID($WEB_FORM_ID);
     if ($arrForm = $q->Fetch()) {
         $MAIL_EVENT_TYPE = "FORM_FILLING_" . $arrForm["SID"];
         if (strlen($old_SID) > 0) {
             $old_MAIL_EVENT_TYPE = "FORM_FILLING_" . $old_SID;
         }
         $et = new CEventType();
         $em = new CEventMessage();
         if (strlen($MAIL_EVENT_TYPE) > 0) {
             $et->Delete($MAIL_EVENT_TYPE);
         }
         $z = CLanguage::GetList($v1, $v2);
         $OLD_MESS = $MESS;
         while ($arLang = $z->Fetch()) {
             IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/form/admin/form_mail.php", $arLang["LID"]);
             $str = "";
             $str .= "#RS_FORM_ID# - " . GetMessage("FORM_L_FORM_ID") . "\n";
             $str .= "#RS_FORM_NAME# - " . GetMessage("FORM_L_NAME") . "\n";
             $str .= "#RS_FORM_SID# - " . GetMessage("FORM_L_SID") . "\n";
             $str .= "#RS_RESULT_ID# - " . GetMessage("FORM_L_RESULT_ID") . "\n";
             $str .= "#RS_DATE_CREATE# - " . GetMessage("FORM_L_DATE_CREATE") . "\n";
             $str .= "#RS_USER_ID# - " . GetMessage("FORM_L_USER_ID") . "\n";
             $str .= "#RS_USER_EMAIL# - " . GetMessage("FORM_L_USER_EMAIL") . "\n";
             $str .= "#RS_USER_NAME# - " . GetMessage("FORM_L_USER_NAME") . "\n";
             $str .= "#RS_USER_AUTH# - " . GetMessage("FORM_L_USER_AUTH") . "\n";
             $str .= "#RS_STAT_GUEST_ID# - " . GetMessage("FORM_L_STAT_GUEST_ID") . "\n";
             $str .= "#RS_STAT_SESSION_ID# - " . GetMessage("FORM_L_STAT_SESSION_ID") . "\n";
             $strFIELDS = "";
             $w = CFormField::GetList($WEB_FORM_ID, "ALL", $by, $order, array(), $is_filtered);
             while ($wr = $w->Fetch()) {
                 if (strlen($wr["RESULTS_TABLE_TITLE"]) > 0) {
                     $FIELD_TITLE = $wr["RESULTS_TABLE_TITLE"];
                 } elseif (strlen($wr["TITLE"]) > 0) {
                     $FIELD_TITLE = $wr["TITLE_TYPE"] == "html" ? htmlspecialcharsback(strip_tags($wr["TITLE"])) : $wr["TITLE"];
                 } else {
                     $FIELD_TITLE = TrimEx($wr["FILTER_TITLE"], ":");
                 }
                 $str .= "#" . $wr["SID"] . "# - " . $FIELD_TITLE . "\n";
                 $str .= "#" . $wr["SID"] . "_RAW# - " . $FIELD_TITLE . " (" . GetMessage('FORM_L_RAW') . ")\n";
                 $strFIELDS .= $FIELD_TITLE . "\n*******************************\n#" . $wr["SID"] . "#\n\n";
             }
             $et->Add(array("LID" => $arLang["LID"], "EVENT_NAME" => $MAIL_EVENT_TYPE, "NAME" => GetMessage("FORM_FILLING") . " \"" . $arrForm["SID"] . "\"", "DESCRIPTION" => $str));
         }
         // задаем новый тип событи¤ дл¤ старых шаблонов
         if (strlen($old_MAIL_EVENT_TYPE) > 0 && $old_MAIL_EVENT_TYPE != $MAIL_EVENT_TYPE) {
             $e = $em->GetList($by = "id", $order = "desc", array("EVENT_NAME" => $old_MAIL_EVENT_TYPE));
             while ($er = $e->Fetch()) {
                 $em->Update($er["ID"], array("EVENT_NAME" => $MAIL_EVENT_TYPE));
             }
             if (strlen($old_MAIL_EVENT_TYPE) > 0) {
                 $et->Delete($old_MAIL_EVENT_TYPE);
             }
         }
         if ($ADD_NEW_TEMPLATE == "Y") {
             $z = CSite::GetList($v1, $v2);
             while ($arSite = $z->Fetch()) {
                 $arrSiteLang[$arSite["ID"]] = $arSite["LANGUAGE_ID"];
             }
             $arrFormSite = CForm::GetSiteArray($WEB_FORM_ID);
             if (is_array($arrFormSite) && count($arrFormSite) > 0) {
                 foreach ($arrFormSite as $sid) {
                     IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/form/admin/form_mail.php", $arrSiteLang[$sid]);
                     $SUBJECT = "#SERVER_NAME#: " . GetMessage("FORM_FILLING_S") . " [#RS_FORM_ID#] #RS_FORM_NAME#";
                     $MESSAGE = "#SERVER_NAME#\n\n" . GetMessage("FORM_FILLING") . ": [#RS_FORM_ID#] #RS_FORM_NAME#\n-------------------------------------------------------\n\n" . GetMessage("FORM_DATE_CREATE") . "#RS_DATE_CREATE#\n" . GetMessage("FORM_RESULT_ID") . "#RS_RESULT_ID#\n" . GetMessage("FORM_USER") . "[#RS_USER_ID#] #RS_USER_NAME# #RS_USER_AUTH#\n" . GetMessage("FORM_STAT_GUEST_ID") . "#RS_STAT_GUEST_ID#\n" . GetMessage("FORM_STAT_SESSION_ID") . "#RS_STAT_SESSION_ID#\n\n\n{$strFIELDS}\n" . GetMessage("FORM_VIEW") . "\nhttp://#SERVER_NAME#/bitrix/admin/form_result_view.php?lang=" . $arrSiteLang[$sid] . "&WEB_FORM_ID=#RS_FORM_ID#&RESULT_ID=#RS_RESULT_ID#\n\n-------------------------------------------------------\n" . GetMessage("FORM_GENERATED_AUTOMATICALLY") . "\n\t\t\t\t\t\t";
                     // добавл¤ем новый шаблон
                     $arFields = array("ACTIVE" => "Y", "EVENT_NAME" => $MAIL_EVENT_TYPE, "LID" => $sid, "EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#", "EMAIL_TO" => "#DEFAULT_EMAIL_FROM#", "SUBJECT" => $SUBJECT, "MESSAGE" => $MESSAGE, "BODY_TYPE" => "text");
                     $TEMPLATE_ID = $em->Add($arFields);
                     if ($bReturnFullInfo) {
                         $arrReturn[] = array('ID' => $TEMPLATE_ID, 'FIELDS' => $arFields);
                     } else {
                         $arrReturn[] = $TEMPLATE_ID;
                     }
                 }
             }
         }
         $MESS = $OLD_MESS;
     }
     return $arrReturn;
 }