本文整理汇总了PHP中CSocNetLog::Delete方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLog::Delete方法的具体用法?PHP CSocNetLog::Delete怎么用?PHP CSocNetLog::Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetLog
的用法示例。
在下文中一共展示了CSocNetLog::Delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UnInstallDB
function UnInstallDB($arParams = array())
{
global $DB, $APPLICATION;
$errors = null;
if (CModule::IncludeModule("socialnetwork")) {
$dbLog = CSocNetLog::GetList(array(), array("ENTITY_TYPE" => array("R", "T"), "EVENT_ID" => array("timeman_entry", "report")), false, false, array("ID"));
while ($arLog = $dbLog->Fetch()) {
CSocNetLog::Delete($arLog["ID"]);
}
}
if (true == array_key_exists("savedata", $arParams) && $arParams["savedata"] != 'Y') {
$errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/' . $this->MODULE_ID . '/install/db/' . strtolower($DB->type) . '/uninstall.sql');
if (!empty($errors)) {
$APPLICATION->ThrowException(implode("", $errors));
return false;
}
$this->UnInstallTasks();
}
UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetLogEvents', 'timeman', 'CReportNotifications', 'AddEvent');
UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetAllowedSubscribeEntityTypes', 'timeman', 'CReportNotifications', 'OnFillSocNetAllowedSubscribeEntityTypes');
UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetLogEvents', 'timeman', 'CTimeManNotify', 'OnFillSocNetLogEvents');
UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetAllowedSubscribeEntityTypes', 'timeman', 'CTimeManNotify', 'OnFillSocNetAllowedSubscribeEntityTypes');
UnRegisterModuleDependences("im", "OnGetNotifySchema", "timeman", "CTimemanNotifySchema", "OnGetNotifySchema");
UnRegisterModuleDependences('main', 'OnAfterUserUpdate', 'timeman', 'CTimeManNotify', 'OnAfterUserUpdate');
UnRegisterModuleDependences('main', 'OnAfterUserUpdate', 'timeman', 'CReportNotifications', 'OnAfterUserUpdate');
UnRegisterModule($this->MODULE_ID);
return true;
}
示例2: OnAfterIBlockElementDelete
public function OnAfterIBlockElementDelete($fields)
{
$errors = array();
if (Loader::includeModule('socialnetwork')) {
$states = CBPStateService::getDocumentStates(array('lists', 'BizprocDocument', $fields['ID']));
foreach ($states as $workflowId => $state) {
$sourceId = CBPStateService::getWorkflowIntegerId($workflowId);
$resultQuery = CSocNetLog::getList(array(), array('EVENT_ID' => 'lists_new_element', 'SOURCE_ID' => $sourceId), false, false, array('ID'));
while ($log = $resultQuery->fetch()) {
CSocNetLog::Delete($log['ID']);
}
}
}
CBPDocument::OnDocumentDelete(array('lists', 'BizprocDocument', $fields['ID']), $errors);
}
示例3: DeleteLogEvents
public static function DeleteLogEvents($params, $options = array())
{
if (!CModule::IncludeModule('socialnetwork')) {
return false;
}
$entityTypeID = isset($params['ENTITY_TYPE_ID']) ? intval($params['ENTITY_TYPE_ID']) : CCrmOwnerType::Undefined;
$liveFeedEntityType = CCrmLiveFeedEntity::GetByEntityTypeID($entityTypeID);
if ($liveFeedEntityType === CCrmLiveFeedEntity::Undefined) {
return false;
}
$entityID = isset($params['ENTITY_ID']) ? intval($params['ENTITY_ID']) : 0;
if ($entityID <= 0) {
return false;
}
$dbRes = CSocNetLog::GetList(array('ID' => 'DESC'), array('ENTITY_TYPE' => $liveFeedEntityType, 'ENTITY_ID' => $entityID), false, false, array('ID'));
while ($arRes = $dbRes->Fetch()) {
CSocNetLog::Delete($arRes['ID']);
}
if (!is_array($options)) {
$options = array();
}
$unregisterRelation = !(isset($options['UNREGISTER_RELATION']) && $options['UNREGISTER_RELATION'] === false);
if ($unregisterRelation) {
CCrmSonetRelation::UnRegisterRelationsByEntity($entityTypeID, $entityID);
}
}
示例4: RemoveMessage
private function RemoveMessage($MessageId = false)
{
$arNotification = $this->Notify->getNotification();
//Remove comments
$oComment = CBlogComment::GetList(
array(),
array(
"POST_ID" => $MessageId?$MessageId:$arNotification["ID"],
),
false,
false,
array("ID")
);
while ($arComment = $oComment->Fetch())
$this->RemoveComment($arComment["ID"]);
//Remove message
$oLogMessage = CSocNetLog::GetList(
array("ID" => "DESC"),
array("SOURCE_ID" => $MessageId?$MessageId:$arNotification["ID"]),
false,
false,
array("ID")
);
while($arLogMessage = $oLogMessage->Fetch())
CSocNetLog::Delete($arLogMessage["ID"]);
}
示例5: OnAfterPhotoCommentDeleteBlog
public function OnAfterPhotoCommentDeleteBlog($ID)
{
if (!$this->IsSocnet) {
return;
}
if (intval($ID) > 0) {
$dbRes = CSocNetLogComments::GetList(array("ID" => "DESC"), array("EVENT_ID" => "photo_comment", "SOURCE_ID" => $ID), false, false, array("ID", "LOG_ID"));
if ($arRes = $dbRes->Fetch()) {
$res = CSocNetLogComments::Delete($arRes["ID"]);
if ($res) {
$dbResult = CSocNetLog::GetList(array(), array("ID" => $arRes["LOG_ID"]), false, false, array("ID", "COMMENTS_COUNT"));
if ($arLog = $dbResult->Fetch()) {
if ($arLog["COMMENTS_COUNT"] == 0) {
CSocNetLog::Delete($arRes["LOG_ID"]);
}
}
}
}
}
}
示例6: OnDeleteCalendarEventEntry
public static function OnDeleteCalendarEventEntry($eventId, $arFields = array())
{
if (CModule::IncludeModule("socialnetwork")) {
$dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "calendar", "SOURCE_ID" => $eventId), false, false, array("ID"));
while ($arRes = $dbRes->Fetch()) {
CSocNetLog::Delete($arRes["ID"]);
}
}
}
示例7: array
case "DELETE":
$arLogID = array();
foreach ($arTopic as $topic_id_tmp) {
// delete message log records
$dbForumMessage = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $topic_id_tmp));
while ($arForumMessage = $dbForumMessage->Fetch()) {
$dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "forum", "SOURCE_ID" => $arForumMessage["ID"]), false, false, array("ID", "PARAMS"));
while ($arRes = $dbRes->Fetch()) {
$arLogID[] = $arRes["ID"];
}
}
}
$result = ForumDeleteTopic($arTopic, $strErrorMessage, $strOkMessage, array("PERMISSION" => $arParams["PERMISSION"]));
if ($result) {
foreach ($arLogID as $log_id) {
CSocNetLog::Delete($log_id);
}
}
break;
case "STATE_Y":
case "STATE_N":
case "CLOSE":
case "OPEN":
$ACTION = $ACTION == "STATE_Y" ? "OPEN" : ($ACTION == "STATE_N" ? "CLOSE" : $ACTION);
$state = $ACTION == "OPEN" ? "Y" : "N";
$result = ForumOpenCloseTopic($arTopic, $ACTION, $strErrorMessage, $strOkMessage, array("PERMISSION" => $arParams["PERMISSION"]));
break;
default:
$arError[] = array("id" => "bad action", "text" => $ACTION);
break;
}
示例8: UnInstallDB
function UnInstallDB($arParams = array())
{
global $DB, $DBType, $APPLICATION;
$this->errors = false;
if (!array_key_exists("savedata", $arParams) || $arParams["savedata"] != "Y") {
$rsUserType = CUserTypeEntity::getList(array(), array('ENTITY_ID' => 'TASKS_TASK', 'FIELD_NAME' => 'UF_TASK_WEBDAV_FILES'));
if ($arUserType = $rsUserType->fetch()) {
$obUserField = new CUserTypeEntity();
$obUserField->Delete($arUserType['ID']);
}
$this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/tasks/install/db/" . strtolower($DB->type) . "/uninstall.sql");
}
//delete agents
CAgent::RemoveModuleAgents("tasks");
if (CModule::IncludeModule("search")) {
CSearch::DeleteIndex("tasks");
}
UnRegisterModule("tasks");
UnRegisterModuleDependences("search", "OnReindex", "tasks", "CTasks", "OnSearchReindex");
UnRegisterModuleDependences("main", "OnUserDelete", "tasks", "CTasks", "OnUserDelete");
UnRegisterModuleDependences("im", "OnGetNotifySchema", "tasks", "CTasksNotifySchema", "OnGetNotifySchema");
UnRegisterModuleDependences('main', 'OnBeforeUserDelete', 'tasks', 'CTasks', 'OnBeforeUserDelete');
UnRegisterModuleDependences("pull", "OnGetDependentModule", "tasks", "CTasksPullSchema", "OnGetDependentModule");
UnRegisterModuleDependences('search', 'BeforeIndex', 'tasks', 'CTasksTools', 'FixForumCommentURL');
UnRegisterModuleDependences('intranet', 'OnPlannerInit', 'tasks', 'CTaskPlannerMaintance', 'OnPlannerInit');
UnRegisterModuleDependences('intranet', 'OnPlannerAction', 'tasks', 'CTaskPlannerMaintance', 'OnPlannerAction');
UnRegisterModuleDependences('rest', 'OnRestServiceBuildDescription', 'tasks', 'CTaskRestService', 'OnRestServiceBuildDescription');
UnRegisterModuleDependences('forum', 'OnCommentTopicAdd', 'tasks', 'CTaskComments', 'onCommentTopicAdd');
UnRegisterModuleDependences('forum', 'OnAfterCommentTopicAdd', 'tasks', 'CTaskComments', 'onAfterCommentTopicAdd');
UnRegisterModuleDependences('forum', 'OnAfterCommentAdd', 'tasks', 'CTaskComments', 'onAfterCommentAdd');
UnRegisterModuleDependences('forum', 'OnAfterCommentUpdate', 'tasks', 'CTaskComments', 'onAfterCommentUpdate');
UnRegisterModuleDependences('forum', 'OnModuleUnInstall', 'tasks', 'CTasksRarelyTools', 'onForumUninstall');
UnRegisterModuleDependences('webdav', 'OnModuleUnInstall', 'tasks', 'CTasksRarelyTools', 'onWebdavUninstall');
UnRegisterModuleDependences('intranet', 'OnModuleUnInstall', 'tasks', 'CTasksRarelyTools', 'onIntranetUninstall');
UnRegisterModuleDependences('timeman', 'OnAfterTMDayStart', 'tasks', 'CTaskPlannerMaintance', 'OnAfterTMDayStart');
UnRegisterModuleDependences('timeman', 'OnAfterTMDayStart', 'tasks', 'CTaskCountersNotifier', 'onAfterTimeManagerDayStart');
UnRegisterModuleDependences('timeman', 'OnAfterTMEntryUpdate', 'tasks', 'CTaskTimerManager', 'onAfterTMEntryUpdate');
UnRegisterModuleDependences('tasks', 'OnBeforeTaskUpdate', 'tasks', 'CTaskTimerManager', 'onBeforeTaskUpdate');
UnRegisterModuleDependences('tasks', 'OnBeforeTaskDelete', 'tasks', 'CTaskTimerManager', 'onBeforeTaskDelete');
UnRegisterModuleDependences('socialnetwork', 'OnBeforeSocNetGroupDelete', 'tasks', 'CTasks', 'onBeforeSocNetGroupDelete');
UnRegisterModuleDependences("main", "OnAfterRegisterModule", "main", "tasks", "InstallUserFields", "/modules/tasks/install/index.php");
// check webdav UF
UnRegisterModuleDependences("main", "OnBeforeUserTypeAdd", "tasks", "CTasksRarelyTools", "onBeforeUserTypeAdd");
UnRegisterModuleDependences("main", "OnBeforeUserTypeUpdate", "tasks", "CTasksRarelyTools", "onBeforeUserTypeUpdate");
UnRegisterModuleDependences("main", "OnBeforeUserTypeDelete", "tasks", "CTasksRarelyTools", "onBeforeUserTypeDelete");
// im "ilike"
UnRegisterModuleDependences("main", "OnGetRatingContentOwner", "tasks", "CTaskNotifications", "OnGetRatingContentOwner");
UnRegisterModuleDependences("im", "OnGetMessageRatingVote", "tasks", "CTaskNotifications", "OnGetMessageRatingVote");
if ((!array_key_exists("savedata", $arParams) || $arParams["savedata"] != "Y") && IsModuleInstalled('socialnetwork') && CModule::IncludeModule('socialnetwork')) {
$dbRes = CSocNetLog::GetList(array(), array("EVENT_ID" => "tasks"), false, false, array("ID"));
if ($dbRes) {
while ($arRes = $dbRes->Fetch()) {
CSocNetLog::Delete($arRes["ID"]);
}
}
}
// Remove tasks from IM
if (IsModuleInstalled('im') && CModule::IncludeModule('im')) {
if (method_exists('CIMNotify', 'DeleteByModule')) {
CIMNotify::DeleteByModule('tasks');
}
}
// remove comment edit flags
COption::RemoveOption('tasks', 'task_comment_allow_edit', '');
COption::RemoveOption('tasks', 'task_comment_allow_remove', '');
return true;
}
示例9: SendDeleteMessage
function SendDeleteMessage($arFields)
{
global $USER;
$cacheWasEnabled = CTaskNotifications::enableStaticCache();
$arRecipientsIDs = CTaskNotifications::GetRecipientsIDs($arFields);
if (sizeof($arRecipientsIDs) && (is_object($USER) && $USER->GetID() || $arFields["CREATED_BY"])) {
$occurAsUserId = CTasksTools::getOccurAsUserId();
if (!$occurAsUserId) {
$occurAsUserId = is_object($USER) && $USER->GetID() ? $USER->GetID() : $arFields["CREATED_BY"];
}
$messageInstant = str_replace("#TASK_TITLE#", self::formatTaskName($arFields['ID'], $arFields['TITLE'], $arFields['GROUP_ID'], false), self::getGenderMessage($occurAsUserId, 'TASKS_TASK_DELETED_MESSAGE'));
CTaskNotifications::sendMessageEx($arFields["ID"], $occurAsUserId, $arRecipientsIDs, array('INSTANT' => $messageInstant, 'PUSH' => CTaskNotifications::makePushMessage('TASKS_TASK_DELETED_MESSAGE', $occurAsUserId, $arFields)), array('EVENT_DATA' => array('ACTION' => 'TASK_DELETE', 'arFields' => $arFields)));
/*
CTaskNotifications::SendMessage($occurAsUserId, $arRecipientsIDs,
$message, $arFields['ID'], null,
array(
'ACTION' => 'TASK_DELETE',
'arFields' => $arFields
)
);
*/
}
// sonet log
if (CModule::IncludeModule("socialnetwork")) {
$dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "tasks", "SOURCE_ID" => $arFields["ID"]), false, false, array("ID"));
while ($arRes = $dbRes->Fetch()) {
CSocNetLog::Delete($arRes["ID"]);
}
}
if ($cacheWasEnabled) {
CTaskNotifications::disableStaticCache();
}
}
示例10: array
}
$SocNetGroupID = false;
$db_blog_group = CBlogGroup::GetList(array("ID" => "ASC"), array("SITE_ID" => WIZARD_SITE_ID, "NAME" => "[" . WIZARD_SITE_ID . "] " . GetMessage("BLOG_DEMO_GROUP_SOCNET")));
if ($res_blog_group = $db_blog_group->Fetch()) {
$SocNetGroupID = $res_blog_group["ID"];
if (WIZARD_INSTALL_DEMO_DATA) {
$db_blog = CBlog::GetList(array(), array("GROUP_ID" => $res_blog_group["ID"]), false, false, array("ID"));
if ($res_blog = $db_blog->Fetch()) {
do {
CBlog::Delete($res_blog["ID"]);
} while ($res_blog = $db_blog->Fetch());
}
if (CModule::IncludeModule("socialnetwork")) {
$db_log = CSocNetLog::GetList(array("ID" => "DESC"), array("SITE_ID" => WIZARD_SITE_ID, "EVENT_ID" => array("blog", "blog_post", "blog_comment")), false, false, array("ID"));
while ($arLog = $db_log->Fetch()) {
CSocNetLog::Delete($arLog["ID"]);
}
}
BXClearCache(True, "/" . WIZARD_SITE_ID . "/blog/");
} else {
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/_index.php", array("BLOG_GROUP_ID" => $SocNetGroupID));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/index.php", array("BLOG_GROUP_ID" => $SocNetGroupID));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/people/user.php", array("BLOG_GROUP_ID" => $SocNetGroupID));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/groups/group.php", array("BLOG_GROUP_ID" => $SocNetGroupID));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/blogs/index.php", array("BLOG_GROUP_ID" => $SocNetGroupID));
return;
}
}
COption::SetOptionString('blog', 'avatar_max_size', '30000');
COption::SetOptionString('blog', 'avatar_max_width', '100');
COption::SetOptionString('blog', 'avatar_max_height', '100');
示例11: SocnetLogFileDelete
public function SocnetLogFileDelete($arParams)
{
if ($arLog = $this->GetSocnetLogByFileID($arParams["ELEMENT"]["id"], $this->event_id)) {
CSocNetLog::Delete($arLog['ID']);
}
}
示例12: foreach
$arLogComments[] = $arLog;
}
foreach ($arLogComments as $arLogComment) {
if (intval($arLogComment["SOURCE_ID"]) > 0) {
$log_tmp_id = false;
$arBlogComment = CBlogComment::GetByID($arLogComment["SOURCE_ID"]);
if ($arBlogComment) {
$dbLog = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "blog_post", "SOURCE_ID" => $arBlogComment["POST_ID"]), false, array("nTopCount" => 1), array("ID", "TMP_ID"));
if ($arLog = $dbLog->Fetch()) {
$log_tmp_id = $arLog["TMP_ID"];
}
}
if (intval($log_tmp_id) > 0) {
$arFields = array("ENTITY_TYPE" => $arLogComment["ENTITY_TYPE"], "ENTITY_ID" => $arLogComment["ENTITY_ID"], "EVENT_ID" => "blog_comment", "LOG_DATE" => $arLogComment["LOG_DATE"], "MESSAGE" => $arLogComment["MESSAGE"], "TEXT_MESSAGE" => $arLogComment["TEXT_MESSAGE"], "URL" => $arLogComment["URL"], "MODULE_ID" => false, "SOURCE_ID" => $arLogComment["SOURCE_ID"], "LOG_ID" => $log_tmp_id, "USER_ID" => $arLogComment["USER_ID"]);
CSocNetLogComments::Add($arFields, false, false, false);
CSocNetLog::Delete($arLogComment["ID"]);
}
}
}
}
$dbLog = CSocNetLog::GetList(array("LOG_DATE" => "ASC"), array("COMMENTS_COUNT" => false), false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID", "LOG_DATE", "MESSAGE", "TEXT_MESSAGE", "URL", "SOURCE_ID", "USER_ID"));
while ($arLog = $dbLog->Fetch()) {
CSocNetLog::Update($arLog["ID"], array("LOG_UPDATE" => $arLog["LOG_DATE"]));
}
if (IsModuleInstalled("intranet")) {
$dbResult = CSocNetEventUserView::GetList(array("ENTITY_ID" => "ASC"), array("ENTITY_TYPE" => "N"));
$arResult = $dbResult->Fetch();
if (!$arResult) {
CSocNetEventUserView::Add(array("ENTITY_TYPE" => "N", "ENTITY_ID" => 0, "EVENT_ID" => "news", "USER_ID" => 0, "USER_ANONYMOUS" => "N"));
CSocNetEventUserView::Add(array("ENTITY_TYPE" => "N", "ENTITY_ID" => 0, "EVENT_ID" => "news_comment", "USER_ID" => 0, "USER_ANONYMOUS" => "N"));
}
示例13: SendDeleteMessage
function SendDeleteMessage($arFields)
{
global $USER;
$arRecipientsIDs = CTaskNotifications::GetRecipientsIDs($arFields);
if (sizeof($arRecipientsIDs) && (is_object($USER) && $USER->GetID() || $arFields["CREATED_BY"])) {
$message = str_replace("#TASK_TITLE#", self::formatTaskName($arFields['ID'], $arFields['TITLE'], $arFields['GROUP_ID']), GetMessage("TASKS_TASK_DELETED_MESSAGE"));
$occurAsUserId = CTasksTools::getOccurAsUserId();
if (!$occurAsUserId) {
$occurAsUserId = is_object($USER) && $USER->GetID() ? $USER->GetID() : $arFields["CREATED_BY"];
}
CTaskNotifications::SendMessage($occurAsUserId, $arRecipientsIDs, $message, 0, null, array('ACTION' => 'TASK_DELETE', 'arFields' => $arFields));
}
// sonet log
if (CModule::IncludeModule("socialnetwork")) {
$dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "tasks", "SOURCE_ID" => $arFields["ID"]), false, false, array("ID"));
while ($arRes = $dbRes->Fetch()) {
CSocNetLog::Delete($arRes["ID"]);
}
}
}
示例14: OnUserDelete
function OnUserDelete($USER_ID)
{
$arIBlockList = array('iblock_absence', 'iblock_honour', 'iblock_state_history');
foreach ($arIBlockList as $var_name) {
$IBLOCK_ID = COption::GetOptionInt('intranet', $var_name);
if ($IBLOCK_ID > 0) {
$dbRes = CIBlockElement::GetList(array(), array('IBLOCK_ID' => $IBLOCK_ID, 'PROPERTY_USER' => $USER_ID), false, false, array('ID', 'IBLOCK_ID'));
while ($arRes = $dbRes->Fetch()) {
CIBlockElement::Delete($arRes['ID']);
}
}
}
if (CModule::IncludeModule('socialnetwork')) {
$dbRes = CSocNetLog::GetList(array(), array('ENTITY_TYPE' => SONET_INTRANET_NEW_USER_ENTITY, 'EVENT_ID' => SONET_INTRANET_NEW_USER_EVENT_ID, 'ENTITY_ID' => $USER_ID, 'SOURCE_ID' => $USER_ID), false, array('ID'));
$arRes = $dbRes->Fetch();
if ($arRes) {
CSocNetLog::Delete($arRes['ID']);
}
}
if (CModule::IncludeModule('iblock')) {
$IBLOCK_ID = COption::GetOptionInt('intranet', 'iblock_structure');
if ($IBLOCK_ID > 0) {
$dbRes = CIBlockSection::GetList(array(), array('IBLOCK_ID' => $IBLOCK_ID, 'UF_HEAD' => $USER_ID), false, array('ID', 'IBLOCK_ID'));
$obSection = new CIBlockSection();
while ($arRes = $dbRes->Fetch()) {
$obSection->Update($arRes['ID'], array('UF_HEAD' => ''));
}
}
}
}
示例15: OnSearchReindex
//.........这里部分代码省略.........
if (strlen($arUser["NAME"] . "" . $arUser["LAST_NAME"]) <= 0) {
$arFields["NAME"] = GetMessage("BLG_NAME") . " " . $arUser["LOGIN"];
} else {
$arFields["NAME"] = GetMessage("BLG_NAME") . " " . $arUser["NAME"] . " " . $arUser["LAST_NAME"];
}
$arFields["URL"] = str_replace(" ", "_", $arUser["LOGIN"]) . "-blog-" . $ar["SITE_ID"];
$arFields["OWNER_ID"] = $ar["AUTHOR_ID"];
$urlCheck = preg_replace("/[^a-zA-Z0-9_-]/is", "", $arFields["URL"]);
if ($urlCheck != $arFields["URL"]) {
$arFields["URL"] = "u" . $arUser["ID"] . "-blog-" . $ar["SITE_ID"];
}
if (CBlog::GetByUrl($arFields["URL"])) {
$uind = 0;
do {
$uind++;
$arFields["URL"] = $arFields["URL"] . $uind;
} while (CBlog::GetByUrl($arFields["URL"]));
}
$featureOperationPerms = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_USER, $ar["AUTHOR_ID"], "blog", "view_post");
if ($featureOperationPerms == SONET_RELATIONS_TYPE_ALL) {
$bRights = true;
}
$blogID = CBlog::Add($arFields);
if ($bRights) {
CBlog::AddSocnetRead($blogID);
}
$newBlogId = $blogID;
$arUser2Blog[$arFields["OWNER_ID"]][$arFields["GROUP_ID"]] = $newBlogId;
}
if (intVal($newBlogId) > 0) {
$arF = array("BLOG_ID" => $newBlogId, "SOCNET_RIGHTS" => array("SG" . $ar["SOCNET_GROUP_ID"]));
}
if (IntVal($ar["SLID"]) > 0) {
CSocNetLog::Delete($ar["SLID"]);
$ar["SLID"] = 0;
}
$arSites = array();
$rsGroupSite = CSocNetGroup::GetSite($ar["SOCNET_GROUP_ID"]);
while ($arGroupSite = $rsGroupSite->Fetch()) {
$arSites[] = $arGroupSite["LID"];
}
} else {
$newBlogId = 0;
if ($ar["OWNER_ID"] != $ar["AUTHOR_ID"]) {
if (IntVal($arUser2Blog[$ar["AUTHOR_ID"]][$ar["GROUP_ID"]]) > 0) {
$newBlogId = IntVal($arUser2Blog[$ar["AUTHOR_ID"]][$ar["GROUP_ID"]]);
} else {
$arFields = array("=DATE_UPDATE" => $DB->CurrentTimeFunction(), "GROUP_ID" => $ar["GROUP_ID"], "ACTIVE" => "Y", "ENABLE_COMMENTS" => "Y", "ENABLE_IMG_VERIF" => "Y", "EMAIL_NOTIFY" => "Y", "ENABLE_RSS" => "Y", "ALLOW_HTML" => "N", "ENABLE_TRACKBACK" => "N", "SEARCH_INDEX" => "Y", "USE_SOCNET" => "Y", "=DATE_CREATE" => $DB->CurrentTimeFunction(), "PERMS_POST" => array(1 => "I", 2 => "I"), "PERMS_COMMENT" => array(1 => "P", 2 => "P"));
$bRights = false;
$rsUser = CUser::GetByID($ar["AUTHOR_ID"]);
$arUser = $rsUser->Fetch();
if (strlen($arUser["NAME"] . "" . $arUser["LAST_NAME"]) <= 0) {
$arFields["NAME"] = GetMessage("BLG_NAME") . " " . $arUser["LOGIN"];
} else {
$arFields["NAME"] = GetMessage("BLG_NAME") . " " . $arUser["NAME"] . " " . $arUser["LAST_NAME"];
}
$arFields["URL"] = str_replace(" ", "_", $arUser["LOGIN"]) . "-blog-" . $ar["SITE_ID"];
$arFields["OWNER_ID"] = $ar["AUTHOR_ID"];
$urlCheck = preg_replace("/[^a-zA-Z0-9_-]/is", "", $arFields["URL"]);
if ($urlCheck != $arFields["URL"]) {
$arFields["URL"] = "u" . $arUser["ID"] . "-blog-" . $ar["SITE_ID"];
}
if (CBlog::GetByUrl($arFields["URL"])) {
$uind = 0;
do {
$uind++;