Beispiel #1
0
 function GetSite($event_message_id)
 {
     $event_message_id = intval($event_message_id);
     $resultDb = Mail\Internal\EventMessageSiteTable::getList(array('select' => array('*', '' => 'SITE.*'), 'filter' => array('EVENT_MESSAGE_ID' => $event_message_id), 'runtime' => array('SITE' => array('data_type' => 'Bitrix\\Main\\Site', 'reference' => array('=this.SITE_ID' => 'ref.LID')))));
     return new CDBResult($resultDb);
 }
 /**
  * @param $sites
  * @return array
  * @throws \Bitrix\Main\ArgumentException
  * @throws \Bitrix\Main\ArgumentNullException
  */
 protected function getSiteFieldsArray($sites)
 {
     /*
     global $BX_EVENT_SITE_PARAMS;
     if($site_id !== false && isset($BX_EVENT_SITE_PARAMS[$site_id]))
     	return $BX_EVENT_SITE_PARAMS[$site_id];
     */
     $site_id = $sites[0];
     if (!empty($this->eventMessageId)) {
         $messageSiteDb = MailInternal\EventMessageSiteTable::getList(array('select' => array('SITE_ID'), 'filter' => array('EVENT_MESSAGE_ID' => $this->eventMessageId, 'SITE_ID' => $sites)));
         if ($arMessageSite = $messageSiteDb->Fetch()) {
             $site_id = $arMessageSite['SITE_ID'];
         }
     }
     $SITE_NAME = Config\Option::get("main", "site_name", $GLOBALS["SERVER_NAME"]);
     $SERVER_NAME = Config\Option::get("main", "server_name", $GLOBALS["SERVER_NAME"]);
     $DEFAULT_EMAIL_FROM = Config\Option::get("main", "email_from", "admin@" . $GLOBALS["SERVER_NAME"]);
     if (strlen($site_id) > 0) {
         $result = \Bitrix\Main\SiteTable::getById($site_id);
         if ($arSite = $result->fetch()) {
             $this->siteId = $arSite['LID'];
             $this->languageId = $arSite['LANGUAGE_ID'];
             $BX_EVENT_SITE_PARAMS[$site_id] = array("SITE_NAME" => $arSite["SITE_NAME"] != '' ? $arSite["SITE_NAME"] : $SITE_NAME, "SERVER_NAME" => $arSite["SERVER_NAME"] != '' ? $arSite["SERVER_NAME"] : $SERVER_NAME, "DEFAULT_EMAIL_FROM" => $arSite["EMAIL"] != '' ? $arSite["EMAIL"] : $DEFAULT_EMAIL_FROM, "LANGUAGE_ID" => $arSite['LANGUAGE_ID'], "SITE_ID" => $arSite['LID'], "SITE_DIR" => $arSite['DIR']);
             return $BX_EVENT_SITE_PARAMS[$site_id];
         }
     }
     return array("SITE_NAME" => $SITE_NAME, "SERVER_NAME" => $SERVER_NAME, "DEFAULT_EMAIL_FROM" => $DEFAULT_EMAIL_FROM);
 }