Skip to content

Commit 4a46ea3

Browse files
committed
Replaced file_get_contents with curl
Replaced all external file_get_contents request with curl, using the new helper function external_file_get_contents.
1 parent 2329d83 commit 4a46ea3

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

resources/views/layouts/sidebar.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ function getUrlSatusCodesb($urlsb, $timeoutsb = 3)
279279

280280
<?php // Requests newest version from server and sets it as variable
281281
ini_set('user_agent', 'Mozilla/4.0 (compatible; MSIE 6.0)');
282-
$json = file_get_contents("https://api.github.com/repos/julianprieber/littlelink-custom/releases/latest");
282+
$json = external_file_get_contents("https://api.github.com/repos/julianprieber/littlelink-custom/releases/latest");
283283
$myObj = json_decode($json);
284284
$Vgit = $myObj->tag_name;
285285
@@ -300,7 +300,7 @@ function getUrlSatusCodesb($urlsb, $timeoutsb = 3)
300300
<?php // Requests newest version from server and sets it as variable
301301
302302
try{
303-
$Vgit = file_get_contents("https://version.littlelink-custom.com/");
303+
$Vgit = external_file_get_contents("https://version.littlelink-custom.com/");
304304
305305
// Requests current version from the local version file and sets it as variable
306306
$Vlocal = file_get_contents(base_path("version.json"));
@@ -387,7 +387,7 @@ function getUrlSatusCodesb($urlsb, $timeoutsb = 3)
387387

388388
@if(env('JOIN_BETA') === true and auth()->user()->role == 'admin')
389389
<style>.beta-mobile {display: none;margin: 0 auto;font-size:200%;padding-left: 15px;margin-right: -15px;position: relative;bottom: 3px;}@media only screen and (max-width: 1300px) {.beta {display: none;}.beta-mobile {display: inline-block !important;}}</style>
390-
<a style="color:tomato;" class="nav-link beta" href="{{ url('update') }}">You are in BETA mode! <img src="https://img.llc.ovh/static/v1?label=installed:&message=<?php if(file_exists(base_path("vbeta.json"))) {echo file_get_contents(base_path("vbeta.json"));} else {echo "none";} ?>&color=FFFFFF"> <img src="https://img.llc.ovh/static/v1?label=server:&message=<?php echo file_get_contents("https://update.littlelink-custom.com/beta/vbeta.json"); ?>&color=FFFFFF"></a>
390+
<a style="color:tomato;" class="nav-link beta" href="{{ url('update') }}">You are in BETA mode! <img src="https://img.llc.ovh/static/v1?label=installed:&message=<?php if(file_exists(base_path("vbeta.json"))) {echo file_get_contents(base_path("vbeta.json"));} else {echo "none";} ?>&color=FFFFFF"> <img src="https://img.llc.ovh/static/v1?label=server:&message=<?php echo external_file_get_contents("https://update.littlelink-custom.com/beta/vbeta.json"); ?>&color=FFFFFF"></a>
391391
<a style="color:tomato;" class="beta-mobile" href="{{ url('update') }}"><i class="bi bi-file-code-fill"></i></a>
392392
@endif
393393

@@ -451,7 +451,7 @@ function copyText(text) {
451451
@if(env('NOTIFY_EVENTS') === true)
452452
<?php
453453
try{
454-
$GetEventJson = file_get_contents("https://event.littlelink-custom.com/");
454+
$GetEventJson = external_file_get_contents("https://event.littlelink-custom.com/");
455455
$EventJson = json_decode($GetEventJson, true);
456456
if(isset($_COOKIE['HideEvent']) == NULL) {
457457
setcookie("HideEvent",$_COOKIE['ID'] = "0", time()+60*60*24*5, "/");

resources/views/update.blade.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="container">
55

66
<?php // Requests newest version from server and sets it as variable
7-
$Vgit = file_get_contents("https://version.littlelink-custom.com/");
7+
$Vgit = external_file_get_contents("https://version.littlelink-custom.com/");
88
99
// Requests current version from the local version file and sets it as variable
1010
$Vlocal = file_get_contents(base_path("version.json"));
@@ -21,7 +21,7 @@
2121
<h1>Updater</h1>
2222
@if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
2323
@if(env('JOIN_BETA') === true)
24-
<p><?php echo "latest beta version= " . file_get_contents("https://update.littlelink-custom.com/beta/vbeta.json"); ?></p>
24+
<p><?php echo "latest beta version= " . external_file_get_contents("https://update.littlelink-custom.com/beta/vbeta.json"); ?></p>
2525
<p><?php if(file_exists(base_path("vbeta.json"))) {echo "Installed beta version= " . file_get_contents(base_path("vbeta.json"));} else {echo "Installed beta version= none";} ?></p>
2626
<p><?php if($Vgit > $Vlocal) {echo "You need to update to the latest mainline release";} else {echo "You're running the latest mainline release";} ?></p>
2727
@else
@@ -34,7 +34,7 @@
3434
</div>
3535
@else
3636
@if(env('JOIN_BETA') === true)
37-
<p><?php echo "latest beta version= " . file_get_contents("https://update.littlelink-custom.com/beta/vbeta.json"); ?></p>
37+
<p><?php echo "latest beta version= " . external_file_get_contents("https://update.littlelink-custom.com/beta/vbeta.json"); ?></p>
3838
<p><?php if(file_exists(base_path("vbeta.json"))) {echo "Installed beta version= " . file_get_contents(base_path("vbeta.json"));} else {echo "Installed beta version= none";} ?></p>
3939
<p><?php if($Vgit > $Vlocal) {echo "You need to update to the latest mainline release";} else {echo "You're running the latest mainline release";} ?></p>
4040
@else
@@ -72,7 +72,7 @@
7272
7373
// Download the zip file
7474
75-
$latestversion = trim(file_get_contents("https://version.littlelink-custom.com/"));
75+
$latestversion = trim(external_file_get_contents("https://version.littlelink-custom.com/"));
7676
7777
if(env('JOIN_BETA') === true){
7878
$fileUrl = 'https://update.littlelink-custom.com/beta/'. $latestversion . '.zip';
@@ -135,7 +135,7 @@
135135

136136
<?php // Get update preperation script from GitHub
137137
try {
138-
$file = file_get_contents('https://pre-update.littlelink-custom.com');
138+
$file = external_file_get_contents('https://pre-update.littlelink-custom.com');
139139
$newfile = base_path('resources/views/components/pre-update.blade.php');
140140
file_put_contents($newfile, $file);
141141
} catch (exception $e) {}
@@ -215,7 +215,7 @@
215215
</div>
216216
<h1>Success!</h1>
217217
@if(env('JOIN_BETA') === true)
218-
<p><?php echo "latest beta version= " . file_get_contents("https://update.littlelink-custom.com/beta/vbeta.json"); ?></p>
218+
<p><?php echo "latest beta version= " . external_file_get_contents("https://update.littlelink-custom.com/beta/vbeta.json"); ?></p>
219219
<p><?php if(file_exists(base_path("vbeta.json"))) {echo "Installed beta version= " . file_get_contents(base_path("vbeta.json"));} else {echo "Installed beta version= none";} ?></p>
220220
<p><?php if($Vgit > $Vlocal) {echo "You need to update to the latest mainline release";} else {echo "You're running the latest mainline release";} ?></p>
221221
@else

0 commit comments

Comments
 (0)