• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/classes/general/taskfiles.php
  • Класс: CTaskFiles
  • Вызов: CTaskFiles::getRegisteredTemporaryFilesList
static function getRegisteredTemporaryFilesList($userId)
{
	/**
	 * @global CDatabase $DB
	 */
	global $DB;

	$arFiles = array();

	$userId = (int) $userId;

	$rc = $DB->Query(
		"SELECT FILE_ID FROM b_tasks_files_temporary
		WHERE USER_ID = $userId");

	while ($ar = $rc->Fetch())
		$arFiles[] = (int) $ar['FILE_ID'];

	// For backward compatibility. Just uploaded files was registered in
	// $_SESSION["TASKS_UPLOADED_FILES"] in past
	if (isset($_SESSION['TASKS_UPLOADED_FILES']) && count($_SESSION['TASKS_UPLOADED_FILES']))
	{
		$loggedUserId = (int) User::getId();

		// this files list can be used only if logged user and checked user are equals
		if ($loggedUserId)
		{
			if ($loggedUserId === $userId)
			{
				foreach ($_SESSION['TASKS_UPLOADED_FILES'] as $fileId)
					$arFiles[] = (int) $fileId;
			}
		}
	}

	return (array_unique($arFiles));
}