• Модуль: forum
  • Путь к файлу: ~/bitrix/modules/forum/classes/general/user.php
  • Класс: CALLForumStat
  • Вызов: CALLForumStat::RegisterUSER_OLD
static function RegisterUSER_OLD($arFields = array())
{
	global $DB, $USER;
	$tmp = "";
	if ($_SESSION["FORUM"]["SHOW_NAME"] == "Y" && trim($USER->GetFormattedName(false)) <> '')
		$tmp = $USER->GetFormattedName(false);
	else
		$tmp = $USER->GetLogin();


	$session_id = BitrixMainApplication::getInstance()->getKernelSession()->getId();
	$session_id = "'".$DB->ForSQL($session_id, 255)."'";
	$Fields = array(
		"FS.USER_ID" => intval($USER->GetID()),
		"FS.IP_ADDRESS" => "'".$DB->ForSql($_SERVER["REMOTE_ADDR"],15)."'",
		"FS.SHOW_NAME" => "'".$DB->ForSQL($tmp, 255)."'",
		"FS.LAST_VISIT" => $DB->GetNowFunction(),
		"FS.FORUM_ID" => intval($arFields["FORUM_ID"]),
		"FS.TOPIC_ID" => intval($arFields["TOPIC_ID"])
		);
	$FieldsForInsert = array(
		"USER_ID" => $Fields["FS.USER_ID"],
		"IP_ADDRESS" => $Fields["FS.IP_ADDRESS"],
		"SHOW_NAME" => $Fields["FS.SHOW_NAME"],
		"LAST_VISIT" => $Fields["FS.LAST_VISIT"],
		"FORUM_ID" => $Fields["FS.FORUM_ID"],
		"TOPIC_ID" => $Fields["FS.TOPIC_ID"],
		"PHPSESSID" => $session_id
		);


	if (intval($USER->GetID()) > 0)
	{
		$FieldsForUpdate = $Fields;
		$FieldsForUpdate["FU.LAST_VISIT"] = $DB->GetNowFunction();
		$rows = $DB->Update(
			"b_forum_user FU, b_forum_stat FS",
			$FieldsForUpdate,
			"WHERE (FU.USER_ID=".$Fields["FS.USER_ID"].") AND (FS.PHPSESSID=".$session_id.")",
			"File: ".__FILE__."
Line: ".__LINE__, false); if (intval($rows) < 2) { if (intval($rows)<=0) { $rows = $DB->Update( "b_forum_user", array("USER_ID" => $Fields["FS.USER_ID"]), "WHERE (USER_ID=".$Fields["FS.USER_ID"].")", "File: ".__FILE__."
Line: ".__LINE__, false); if (intval($rows) <= 0) { $ID = CForumUser::Add(array("USER_ID" => $Fields["FS.USER_ID"])); } $rows = $DB->Update( "b_forum_stat", array( "USER_ID" => $Fields["FS.USER_ID"], "IP_ADDRESS" => $Fields["FS.IP_ADDRESS"], "SHOW_NAME" => $Fields["FS.SHOW_NAME"], "LAST_VISIT" => $Fields["FS.LAST_VISIT"], "FORUM_ID" => $Fields["FS.FORUM_ID"], "TOPIC_ID" => $Fields["FS.TOPIC_ID"], ), "WHERE (PHPSESSID=".$session_id.")", "File: ".__FILE__."
Line: ".__LINE__, false); if (intval($rows) <= 0) { $DB->Insert("b_forum_stat", $FieldsForInsert, "File: ".__FILE__."
Line: ".__LINE__); } } } } else { $rows = $DB->Update( "b_forum_stat", array( "USER_ID" => $Fields["FS.USER_ID"], "IP_ADDRESS" => $Fields["FS.IP_ADDRESS"], "SHOW_NAME" => $Fields["FS.SHOW_NAME"], "LAST_VISIT" => $Fields["FS.LAST_VISIT"], "FORUM_ID" => $Fields["FS.FORUM_ID"], "TOPIC_ID" => $Fields["FS.TOPIC_ID"], ), "WHERE (PHPSESSID=".$session_id.")", "File: ".__FILE__."
Line: ".__LINE__); if (intval($rows)<=0) { $DB->Insert("b_forum_stat", $FieldsForInsert, "File: ".__FILE__."
Line: ".__LINE__); } } return true; }