CHANGE_CLAIM_DRIVE_VIEW_URL_CONVERT_TO_DOWNLOAD_URL
This commit is contained in:
parent
e0eeb42779
commit
a219dce42e
@ -2789,7 +2789,7 @@ class TicketController extends BaseController
|
|||||||
|
|
||||||
$insertData = [
|
$insertData = [
|
||||||
'doc_name' => $data['docs_name'][$key] ?? '',
|
'doc_name' => $data['docs_name'][$key] ?? '',
|
||||||
'url' => $data['url'][$key] ?? '',
|
'url' => convertGoogleDriveToDownloadLink($data['url'][$key] ?? ''),
|
||||||
'ticket_id' => $data['ticket_id_url'] ?? '',
|
'ticket_id' => $data['ticket_id_url'] ?? '',
|
||||||
'created_by' => get_session_userid(),
|
'created_by' => get_session_userid(),
|
||||||
'is_active' => 1,
|
'is_active' => 1,
|
||||||
|
|||||||
@ -23,11 +23,11 @@ class AuthMVC implements FilterInterface
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// Fingerprint validation
|
// Fingerprint validation
|
||||||
$fp = generateFingerprint();
|
// $fp = generateFingerprint();
|
||||||
// log_message('error',$fp);
|
// // log_message('error',$fp);
|
||||||
if (session()->get('fingerprint') !== $fp) {
|
// if (session()->get('fingerprint') !== $fp) {
|
||||||
return AuthLogout::logout();
|
// return AuthLogout::logout();
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1067,3 +1067,35 @@ function generateFingerprint()
|
|||||||
// return hash('sha256', $ua . '|' . $ipSubnet . '|' . $secret);
|
// return hash('sha256', $ua . '|' . $ipSubnet . '|' . $secret);
|
||||||
return hash('sha256', $ua . '|' . $ipSubnet );
|
return hash('sha256', $ua . '|' . $ipSubnet );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('convertGoogleDriveToDownloadLink')) {
|
||||||
|
function convertGoogleDriveToDownloadLink(?string $url): ?string
|
||||||
|
{
|
||||||
|
if (empty($url)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trim spaces
|
||||||
|
$url = trim($url);
|
||||||
|
|
||||||
|
// Pattern to extract Google Drive file ID
|
||||||
|
$patterns = [
|
||||||
|
'#https?://drive\.google\.com/file/d/([^/]+)/?#',
|
||||||
|
'#https?://drive\.google\.com/open\?id=([^&]+)#',
|
||||||
|
'#https?://drive\.google\.com/uc\?id=([^&]+)#'
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($patterns as $pattern) {
|
||||||
|
if (preg_match($pattern, $url, $matches)) {
|
||||||
|
$fileId = $matches[1];
|
||||||
|
|
||||||
|
// Return direct download link
|
||||||
|
return 'https://drive.google.com/uc?export=download&id=' . $fileId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not a Google Drive link → return original
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user