Example #1
0
	public static function import_cancel()
	{
		$moduleId = 'prmedia.treelikecomments';

		// retrieve or init session storage
		$sessionStorage = $_SESSION['tlc_import_cancel'];
		if ($_REQUEST['start'] == 'Y')
		{
			$sessionStorage = array(
				'processing_time' => time(),
				'current_count' => 0,
				'total_count' => CTreelikeForumImporter::getImportedCount()
			);
		}


		// import cancel comments...
		$obComment = new CTreelikeComments;
		global $DB;
		$is_finish = true;
		$currentTime = time();
		$rsCommentId = $DB->Query('SELECT COMMENT_ID FROM prmedia_treelike_comments_import_forum');
		while ($arCommentId = $rsCommentId->Fetch())
		{
			$is_finish = false;
			$commentId = intval($arCommentId['COMMENT_ID']);
			$obComment->Delete($commentId);
			CTreelikeForumImporter::removeImportedComment($commentId);
			$sessionStorage['current_count']++;

			// one step is one second
			if ($currentTime != time())
			{
				break;
			}
		}


		if ($is_finish)
		{
			// go to finish step
			echo '<script>document.getElementsByClassName("wizard-next-button")[0].click();</script>';
			CTreelikeForumImporter::clearCache();
			return;
		}

		// progress message
		$text = GetMessage('PRMEDIA_WIZARDS_IMPORT_CANCEL_FORUM_PROGRESS_MESSAGE');
		$arReplace = array(
			"#IMPORTED#" => $sessionStorage['current_count'],
			"#COUNT#" => $sessionStorage['total_count'],
			"#TIME#" => gmdate("i:s", time() - $sessionStorage['processing_time'])
		);
		$progressMessage = str_replace(array_keys($arReplace), $arReplace, $text);
		CAdminMessage::ShowMessage(array(
			"TYPE" => "PROGRESS",
			"MESSAGE" => GetMessage('PRMEDIA_SS_DIST_CANCEL_PROGRESS_TITLE'),
			"DETAILS" => $progressMessage,
			"HTML" => true,
			"PROGRESS_VALUE" => $sessionStorage['current_count'],
			"PROGRESS_TOTAL" => $sessionStorage['total_count']
		));
		echo "<script>jsPrmediaCommentImporter.update();</script>";

		$_SESSION['tlc_import_cancel'] = $sessionStorage;
	}
Example #2
0
			"DETAIL_PAGE_URL" => $detail_url,
			"EMAIL_FROM" => $mail_sender,
			"EMAIL_TO" => $to_Mail_like,
			"SITE_NAME" => $siteName
		);

		CEvent::Send("PRMEDIA_TC_USER_MENTION", SITE_ID, $arEmailFieldsLike, false);
	}
}


// delete (moderator action)
if(isset($_POST['D_ID']))
{
	$objectID = $AxObject->GetObjectData($_POST['D_ID']);
	$AxObject->Delete($_POST['D_ID'], false);
	@$CACHE_MANAGER->ClearByTag("bestcomments_".$objectID);
	@$CACHE_MANAGER->ClearByTag("prmedia_treelike_comments_".$objectID);
}


// delete (moderator action) // @todo dublicate prev block (join $_POST variables into the one block)
if(isset($_POST['ALL_ID']))
{
	$objectID = $AxObject->GetObjectData($_POST['ALL_ID']);
	$AxObject->Delete($_POST['ALL_ID'], true);
	@$CACHE_MANAGER->ClearByTag("bestcomments_".$objectID);
	@$CACHE_MANAGER->ClearByTag("prmedia_treelike_comments_".$objectID);
}

Example #3
0
File: index.php Project: ASDAFF/mp
CModule::IncludeModule('iblock');
if (empty($arGadgetParams['COUNT']))
{
	$arGadgetParams['COUNT'] = 10;
}

// delete comment
if (!empty($_GET['delete-comment-id']))
{
	$commentId = intval($_GET['delete-comment-id']);
	$obComment = new CTreelikeComments;

	$rsComment = $obComment->GetByID($commentId);
	if ($arComment = $rsComment->Fetch())
	{
		$obComment->Delete($commentId);
		$CACHE_MANAGER->ClearByTag("prmedia_treelike_comments_" . $arComment['OBJECT_ID']);
	}

	LocalRedirect($APPLICATION->GetCurPageParam("", array("delete-comment-id")));
}


$arResult = array();
$rsComment = CTreelikeComments::GetList(array(), array(), intval($arGadgetParams['COUNT']));
$count = CTreelikeComments::GetList(array(), array(), intval($arGadgetParams['COUNT']), true);
if ($count > $arGadgetParams['COUNT'])
{
	$count = $arGadgetParams['COUNT'];
}
while ($arComment = $rsComment->GetNext())
Example #4
0
				$arIPs[] = $addr;
			}
			COption::SetOptionString("prmedia.treelikecomments", "ban", implode(", ", $arIPs));

			$addr = $arComment['REMOTE_ADDR'];
			if ($action == 'ban_delete')
			{
				// delete all comments for ip
				$arFilter = array(
					"REMOTE_ADDR" => $addr
				);
				$rsComment = $obComment->GetList(false, $arFilter);
				while ($arComment = $rsComment->Fetch())
				{
					$objectId = $obComment->GetObjectData($arComment['ID']);
					$obComment->Delete($arComment['ID']);
					@$CACHE_MANAGER->ClearByTag("prmedia_treelike_comments_" . $objectId);
				}
				LocalRedirect('/bitrix/admin/tc_comment_list.php?result=ban_delete');
				return;
			}
			LocalRedirect('/bitrix/admin/tc_comment_list.php?result=ban');
		}
	}
}
else
{
	LocalRedirect('/bitrix/admin/tc_comment_list.php');
}

Example #5
0
		$rsData = $OComments->GetList(array($by=>$order), $arFilter, "", false, true);
		while($arRes = $rsData->Fetch())
			$arID[] = $arRes['ID'];
	}

  foreach($arID as $ID)
  {

    if(strlen($ID)<=0)
      continue;

      $ID = IntVal($ID);

      $objectID = $OComments->GetObjectData($ID);

      $OComments->Delete($ID, false);
      $CACHE_MANAGER->ClearByTag("prmedia_treelike_comments_".$objectID);
  }

}

$lAdmin->AddHeaders(array(
  array(  "id"    =>"ID",
    "content"  =>"ID",
    "sort"    =>"id",
    "align"    =>"center",
    "default"  =>true,
  ),

  array(  "id"    =>"DATE",
    "content"  => GetMessage("TC_DATE"),