"download", "courseId" => $courseId, "userId" => $userId, "docId" => $docId, "sessionId" => $sessionId, ]; if (!empty($groupId)) { $data["groupId"] = $groupId; } $hashUrl = Crypt::GetHash($data); return api_get_path(WEB_PLUGIN_PATH).self::app_name."/"."callback.php?hash=".$hashUrl; } /** * Return file key. */ public static function getKey(string $courseCode, int $docId): string { $docInfo = DocumentManager::get_document_data_by_id($docId, $courseCode); $mtime = filemtime($docInfo["absolute_path"]); $key = $mtime.$courseCode.$docId; return self::GenerateRevisionId($key); } /** * Translation key to a supported form. */ public static function GenerateRevisionId(string $expectedKey): string { if (strlen($expectedKey) > 20) { $expectedKey = crc32($expectedKey); } $key = preg_replace("[^0-9-.a-zA-Z_=]", "_", $expectedKey); $key = substr($key, 0, min([strlen($key), 20])); return $key; } }