Пример #1
0
                     $arFieldsVal["SITE_ID"] = $site_id;
                 } else {
                     $arFieldsVal["SITE_ID"] = false;
                 }
                 if (strlen($transport) > 0) {
                     $arFieldsVal["TRANSPORT"] = $transport;
                 }
                 foreach ($arEventID as $event_id) {
                     $arFields["EVENT_ID"] = $event_id;
                     $dbResultTmp = CSocNetLogEvents::GetList(array(), $arFields, false, false, array("ID", "TRANSPORT"));
                     $arFieldsSet = array_merge($arFields, $arFieldsVal);
                     if ($arResultTmp = $dbResultTmp->Fetch()) {
                         if ($arFieldsVal["TRANSPORT"] == "I") {
                             CSocNetLogEvents::Delete($arResultTmp["ID"]);
                         } else {
                             $idTmp = CSocNetLogEvents::Update($arResultTmp["ID"], $arFieldsSet);
                         }
                     } elseif ($arFieldsVal["TRANSPORT"] != "I") {
                         if (!array_key_exists("TRANSPORT", $arFieldsSet)) {
                             $arFieldsSet["TRANSPORT"] = "I";
                         }
                         $idTmp = CSocNetLogEvents::Add($arFieldsSet);
                     }
                 }
             }
         }
     }
 } elseif ($action == "change_follow" && $GLOBALS["USER"]->IsAuthorized()) {
     if ($strRes = CSocNetLogFollow::Set($GLOBALS["USER"]->GetID(), "L" . intval($_REQUEST["log_id"]), $_REQUEST["follow"] == "Y" ? "Y" : "N")) {
         $arResult["SUCCESS"] = "Y";
     } else {
Пример #2
0
         }
     }
 }
 if (!$bFound) {
     $arEventID = array($event_id);
 }
 foreach ($arEventID as $event_id) {
     $dbRes = CSocNetLogEvents::GetList(array(), array("USER_ID" => $GLOBALS["USER"]->GetID(), "ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "ENTITY_CB" => $entity_cb, "ENTITY_MY" => $entity_my, "EVENT_ID" => $event_id, "SITE_ID" => $entity_cb != "Y" && array_key_exists("HAS_SITE_ID", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type]) && $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type]["HAS_SITE_ID"] == "Y" && defined("SITE_ID") && strlen(SITE_ID) > 0 ? SITE_ID : false));
     $arFields = array("USER_ID" => $GLOBALS["USER"]->GetID(), "ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "ENTITY_CB" => $entity_cb, "ENTITY_MY" => $entity_my, "EVENT_ID" => $event_id, "SITE_ID" => $entity_cb != "Y" && array_key_exists("HAS_SITE_ID", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type]) && $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type]["HAS_SITE_ID"] == "Y" && defined("SITE_ID") && strlen(SITE_ID) > 0 ? SITE_ID : false);
     if (strpos($key, "t_bx_sl_") === 0 || strpos($key, "t_cb_bx_sl_") === 0) {
         $arFields["TRANSPORT"] = $value;
     } elseif (strpos($key, "v_bx_sl_") === 0 || strpos($key, "v_cb_bx_sl_") === 0) {
         $arFields["VISIBLE"] = $value;
     }
     if ($arRes = $dbRes->Fetch()) {
         $idTmp = CSocNetLogEvents::Update($arRes["ID"], $arFields);
     } else {
         if (isset($arFields["TRANSPORT"])) {
             $arFields["VISIBLE"] = "I";
         } elseif (isset($arFields["VISIBLE"])) {
             $arFields["TRANSPORT"] = "I";
         }
         $idTmp = CSocNetLogEvents::Add($arFields);
     }
     if (!$idTmp) {
         if ($e = $APPLICATION->GetException()) {
             $errorMessage .= $e->GetString();
         }
         break;
     }
 }