本文整理汇总了PHP中CSocNetLogTools::SetCacheLastLogID方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLogTools::SetCacheLastLogID方法的具体用法?PHP CSocNetLogTools::SetCacheLastLogID怎么用?PHP CSocNetLogTools::SetCacheLastLogID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetLogTools
的用法示例。
在下文中一共展示了CSocNetLogTools::SetCacheLastLogID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SetCacheLastLogID
public static function SetCacheLastLogID($id)
{
return CSocNetLogTools::SetCacheLastLogID("log", $id);
}
示例2: Add
//.........这里部分代码省略.........
$arInsert[1] .= $value;
}
$ID = false;
if (strlen($arInsert[0]) > 0)
{
$strSql =
"INSERT INTO b_sonet_log_comment(".$arInsert[0].") ".
"VALUES(".$arInsert[1].")";
$DB->Query($strSql, False, "File: ".__FILE__."<br>Line: ".__LINE__);
$ID = IntVal($DB->LastID());
if ($ID > 0)
{
if (
!array_key_exists("RATING_TYPE_ID", $arFields)
|| empty($arFields["RATING_TYPE_ID"])
)
CSocNetLogComments::Update($ID, array(
"RATING_TYPE_ID" => "LOG_COMMENT",
"RATING_ENTITY_ID" => $ID
));
CSocNetLogFollow::Set(
$arFields["USER_ID"],
"L".$arFields["LOG_ID"],
"Y",
ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL")
);
$rsLog = CSocNetLog::GetList(
array(),
array("ID" => $arFields["LOG_ID"]),
false,
false,
array("ID", "USER_ID")
);
if (
($arLog = $rsLog->Fetch())
&& (intval($arLog["USER_ID"]) > 0)
)
{
$default_follow = CSocNetLogFollow::GetDefaultValue($arLog["USER_ID"]);
if ($default_follow != "Y")
{
$rsLogFollow = CSocNetLogFollow::GetList(
array(
"USER_ID" => $arLog["USER_ID"],
"CODE" => "L".$arFields["LOG_ID"]
),
array("TYPE")
);
$arLogFollow = $rsLogFollow->Fetch();
if (!$arLogFollow)
CSocNetLogFollow::Set($arLog["USER_ID"], "L".$arFields["LOG_ID"], "Y");
}
}
if ($bSendEvent)
{
CSocNetLogComments::SendEvent($ID, "SONET_NEW_EVENT");
}
CSocNetLogComments::UpdateLogData($arFields["LOG_ID"], $bSetLogUpDate);
$db_events = GetModuleEvents("socialnetwork", "OnAfterSocNetLogCommentAdd");
while ($arEvent = $db_events->Fetch())
{
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
$GLOBALS["USER_FIELD_MANAGER"]->Update("SONET_COMMENT", $ID, $arFields);
if(defined("BX_COMP_MANAGED_CACHE"))
{
$GLOBALS["CACHE_MANAGER"]->ClearByTag("SONET_LOG_".$arFields["LOG_ID"]);
}
else
{
$cache = new CPHPCache;
$cache->CleanDir("/sonet/log/".$arFields["LOG_ID"]."/comments/");
}
CSocNetLogComments::SendMentionNotification(array_merge($arFields, array("ID" => $ID)));
}
}
CSocNetLogTools::SetCacheLastLogID("comment", $ID);
return $ID;
}
elseif ($bSetSource && strlen($strMessage) > 0)
return array(
"ID" => false,
"MESSAGE" => $strMessage
);
else
return false;
}
示例3: Add
function Add($arFields, $bSendEvent = true)
{
global $DB;
$arSocNetAllowedSubscribeEntityTypesDesc = CSocNetAllowed::GetAllowedEntityTypesDesc();
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CSocNetLog::CheckFields("ADD", $arFields)) {
return false;
} else {
$arSiteID = array();
if (array_key_exists("SITE_ID", $arFields)) {
if (is_array($arFields["SITE_ID"])) {
foreach ($arFields["SITE_ID"] as $site_id) {
$arSiteID[$site_id] = $DB->ForSQL($site_id);
}
} else {
$arSiteID[$arFields["SITE_ID"]] = $DB->ForSQL($arFields["SITE_ID"]);
}
}
}
if (empty($arSiteID)) {
unset($arFields["SITE_ID"]);
} else {
$arFields["SITE_ID"] = end($arSiteID);
}
unset($arFields["LOG_UPDATE"]);
if (empty($arFields1["LOG_UPDATE"])) {
$arFields["~LOG_UPDATE"] = $DB->CurrentTimeFunction();
}
$arInsert = $DB->PrepareInsert("b_sonet_log", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($arInsert[0]) > 0) {
$arInsert[0] .= ", ";
}
$arInsert[0] .= $key;
if (strlen($arInsert[1]) > 0) {
$arInsert[1] .= ", ";
}
$arInsert[1] .= $value;
}
$ID = false;
if (strlen($arInsert[0]) > 0) {
$strSql = "INSERT INTO b_sonet_log(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$ID = IntVal($DB->LastID());
if ($ID > 0 && intval($arFields["USER_ID"]) > 0 && strlen($arFields["ENTITY_TYPE"]) > 0 && array_key_exists($arFields["ENTITY_TYPE"], $arSocNetAllowedSubscribeEntityTypesDesc) && is_array($arSocNetAllowedSubscribeEntityTypesDesc[$arFields["ENTITY_TYPE"]]) && $arSocNetAllowedSubscribeEntityTypesDesc[$arFields["ENTITY_TYPE"]]["USE_CB_FILTER"] == "Y") {
CSocNetLogFollow::Set($arFields["USER_ID"], "L" . $ID, "Y");
}
if ($ID > 0 && $bSendEvent) {
CSocNetLog::SendEvent($ID, "SONET_NEW_EVENT");
}
if ($ID > 0 && !empty($arSiteID)) {
$DB->Query("\n\t\t\t\t\t\tDELETE FROM b_sonet_log_site WHERE LOG_ID = " . $ID . "\n\t\t\t\t\t", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
$DB->Query("\n\t\t\t\t\t\tINSERT INTO b_sonet_log_site(LOG_ID, SITE_ID)\n\t\t\t\t\t\tSELECT " . $ID . ", LID\n\t\t\t\t\t\tFROM b_lang\n\t\t\t\t\t\tWHERE LID IN ('" . implode("', '", $arSiteID) . "')\n\t\t\t\t\t", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
}
if ($ID > 0) {
$GLOBALS["USER_FIELD_MANAGER"]->Update("SONET_LOG", $ID, $arFields);
}
}
CSocNetLogTools::SetCacheLastLogID("log", $ID);
return $ID;
}
示例4: Add
function Add($arFields, $bSetSource = false, $bSendEvent = true, $bSetLogUpDate = true)
{
global $DB;
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CSocNetLogComments::CheckFields("ADD", $arFields)) {
return false;
}
$arCommentEvent = CSocNetLogTools::FindLogCommentEventByID($arFields["EVENT_ID"]);
if (!$arCommentEvent || !array_key_exists("ADD_CALLBACK", $arCommentEvent) || !is_callable($arCommentEvent["ADD_CALLBACK"])) {
$bSetSource = false;
}
$db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetLogCommentAdd");
while ($arEvent = $db_events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false) {
return false;
}
}
if ($bSetSource) {
$arSource = CSocNetLogComments::SetSource($arFields);
if (intval($arSource["SOURCE_ID"]) > 0) {
$arFields["SOURCE_ID"] = $arSource["SOURCE_ID"];
if (array_key_exists("RATING_ENTITY_ID", $arSource) && array_key_exists("RATING_TYPE_ID", $arSource) && intval($arSource["RATING_ENTITY_ID"]) > 0 && strlen($arSource["RATING_TYPE_ID"]) > 0) {
$arFields["RATING_TYPE_ID"] = $arSource["RATING_TYPE_ID"];
$arFields["RATING_ENTITY_ID"] = $arSource["RATING_ENTITY_ID"];
}
if (isset($arSource["MESSAGE"]) && strlen($arSource["MESSAGE"]) > 0) {
$arFields["MESSAGE"] = $arSource["MESSAGE"];
}
if (isset($arSource["TEXT_MESSAGE"]) && strlen($arSource["TEXT_MESSAGE"]) > 0) {
$arFields["TEXT_MESSAGE"] = $arSource["TEXT_MESSAGE"];
}
} else {
$strMessage = array_key_exists("ERROR", $arSource) && strlen($arSource["ERROR"]) > 0 ? $arSource["ERROR"] : (array_key_exists("NOTES", $arSource) && strlen($arSource["NOTES"]) > 0 ? $arSource["NOTES"] : "");
}
}
if (!$bSetSource || is_array($arSource) && array_key_exists("SOURCE_ID", $arFields) && intval($arFields["SOURCE_ID"]) > 0) {
$arInsert = $DB->PrepareInsert("b_sonet_log_comment", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($arInsert[0]) > 0) {
$arInsert[0] .= ", ";
}
$arInsert[0] .= $key;
if (strlen($arInsert[1]) > 0) {
$arInsert[1] .= ", ";
}
$arInsert[1] .= $value;
}
$ID = false;
if (strlen($arInsert[0]) > 0) {
$strSql = "INSERT INTO b_sonet_log_comment(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$ID = IntVal($DB->LastID());
if ($ID > 0) {
if (!array_key_exists("RATING_TYPE_ID", $arFields) || empty($arFields["RATING_TYPE_ID"])) {
CSocNetLogComments::Update($ID, array("RATING_TYPE_ID" => "LOG_COMMENT", "RATING_ENTITY_ID" => $ID));
}
CSocNetLogFollow::Set($arFields["USER_ID"], "L" . $arFields["LOG_ID"], "Y");
$rsLog = CSocNetLog::GetList(array(), array("ID" => $arFields["LOG_ID"]), false, false, array("ID", "USER_ID"));
if (($arLog = $rsLog->Fetch()) && intval($arLog["USER_ID"]) > 0) {
$default_follow = CSocNetLogFollow::GetDefaultValue($arLog["USER_ID"]);
if ($default_follow != "Y") {
$rsLogFollow = CSocNetLogFollow::GetList(array("USER_ID" => $arLog["USER_ID"], "CODE" => "L" . $arFields["LOG_ID"]), array("TYPE"));
$arLogFoillow = $rsLogFollow->Fetch();
if (!$arLogFoillow) {
CSocNetLogFollow::Set($arLog["USER_ID"], "L" . $arFields["LOG_ID"], "Y");
}
}
}
if ($bSendEvent) {
CSocNetLogComments::SendEvent($ID, "SONET_NEW_EVENT");
}
CSocNetLogComments::UpdateLogData($arFields["LOG_ID"], $bSetLogUpDate);
$db_events = GetModuleEvents("socialnetwork", "OnAfterSocNetLogCommentAdd");
while ($arEvent = $db_events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->ClearByTag("SONET_LOG_" . $arFields["LOG_ID"]);
}
}
}
CSocNetLogTools::SetCacheLastLogID("comment", $ID);
return $ID;
} elseif ($bSetSource && strlen($strMessage) > 0) {
return array("ID" => false, "MESSAGE" => $strMessage);
} else {
return false;
}
}