From a464ef4c0e3ce235fb1da70dfb282449beeeac80 Mon Sep 17 00:00:00 2001 From: Frankie B Date: Tue, 13 Jun 2023 21:59:16 +0100 Subject: Initialize laravel app --- inc/config.example.inc.php | 6 ---- inc/footer.inc.php | 9 ------ inc/header.inc.php | 6 ---- inc/lastfm.inc.php | 65 -------------------------------------------- inc/nav.inc.php | 13 --------- inc/title.inc.php | 22 --------------- inc/weatherdata.inc.php | 68 ---------------------------------------------- 7 files changed, 189 deletions(-) delete mode 100644 inc/config.example.inc.php delete mode 100644 inc/footer.inc.php delete mode 100644 inc/header.inc.php delete mode 100644 inc/lastfm.inc.php delete mode 100644 inc/nav.inc.php delete mode 100644 inc/title.inc.php delete mode 100644 inc/weatherdata.inc.php (limited to 'inc') diff --git a/inc/config.example.inc.php b/inc/config.example.inc.php deleted file mode 100644 index da01886..0000000 --- a/inc/config.example.inc.php +++ /dev/null @@ -1,6 +0,0 @@ - "key", - "lastfm_user" => "username" -); diff --git a/inc/footer.inc.php b/inc/footer.inc.php deleted file mode 100644 index 9f96798..0000000 --- a/inc/footer.inc.php +++ /dev/null @@ -1,9 +0,0 @@ -
-
- Any Damn Browser  - Linux NOW!  - vim  - Valid CSS!  - Valid HTML 4.01!
- Last Modified GMT -
diff --git a/inc/header.inc.php b/inc/header.inc.php deleted file mode 100644 index f891dca..0000000 --- a/inc/header.inc.php +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/inc/lastfm.inc.php b/inc/lastfm.inc.php deleted file mode 100644 index fa279ac..0000000 --- a/inc/lastfm.inc.php +++ /dev/null @@ -1,65 +0,0 @@ -

Last.fm (Profile)

- "https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=".CONF['lastfm_user']."&nowplaying=true&format=json&api_key=".CONF['lastfm_key'], - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => "", - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 30, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => "GET", -]); - -$current_response = curl_exec($curl_current); -$err = curl_error($curl_current); - -curl_close($curl_current); - -if ($err) { - die("cURL Error #:" . $err); -} -$current_response = json_decode($current_response, true); -$nowplaying = $current_response['recenttracks']['track'][0]; - -echo ' Last/Current Track: '.$nowplaying['name'].' • '.$nowplaying['artist']['#text'].''.PHP_EOL; - -$tracks_to_show = 10; - -$curl = curl_init(); - -curl_setopt_array($curl, [ - CURLOPT_URL => "https://ws.audioscrobbler.com/2.0/?method=user.gettoptracks&user=".CONF['lastfm_user']."&format=json&period=7day&api_key=".CONF['lastfm_key'], - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => "", - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 30, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => "GET", -]); - -$toptracks_response = curl_exec($curl); -$err = curl_error($curl); - -curl_close($curl); - -if ($err) { - die("cURL Error #:" . $err); -} -echo '

Top '.$tracks_to_show.' Tracks (Last 7 days)

'.PHP_EOL; -echo '
    '.PHP_EOL; -$toptracks_response = json_decode($toptracks_response, true); -$tracks = $toptracks_response['toptracks']['track']; -$count = 0; -foreach ($tracks as $track) { - echo '
  1. '.PHP_EOL; - echo ' '.$track['name'].' • '.$track['artist']['name'].''.PHP_EOL; - echo ' ('.$track['playcount'].' plays)'.PHP_EOL; - echo '
  2. '.PHP_EOL; - if ($count >= $tracks_to_show - 1) break; - $count++; -} -echo '
'; \ No newline at end of file diff --git a/inc/nav.inc.php b/inc/nav.inc.php deleted file mode 100644 index b3876ea..0000000 --- a/inc/nav.inc.php +++ /dev/null @@ -1,13 +0,0 @@ -
- -
diff --git a/inc/title.inc.php b/inc/title.inc.php deleted file mode 100644 index 149f0c8..0000000 --- a/inc/title.inc.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php -$uri = $_SERVER['REQUEST_URI']; -if ($uri === '/') { echo '~floppydisk'; } -else { - $uri = substr(substr($uri, 1), 0, -1); - if (!strpos($uri, '/')) { - $uriArr = explode('/', $uri); - $link = "/"; - $links = '~floppydisk / '; - $currentDir = basename(getcwd()); - foreach($uriArr as $page) { - if ($page !== $currentDir) { - if ($link !== '/') $link = $link . '/' . $page; - else $link = $link . $page; - $links = $links . $link . $page . ' / '; - } - } - $links = substr($links, 0, -3) . ' / ' . $currentDir; - echo $links; - } -} -?> diff --git a/inc/weatherdata.inc.php b/inc/weatherdata.inc.php deleted file mode 100644 index cfc6a49..0000000 --- a/inc/weatherdata.inc.php +++ /dev/null @@ -1,68 +0,0 @@ - "http://weather.diskfloppy.me/data/weatherData.json", - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => "", - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 300, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => "GET", -]); - -$current_response = curl_exec($curl_current); -$err = curl_error($curl_current); - -curl_close($curl_current); - -$curl_current = curl_init(); - -curl_setopt_array($curl_current, [ - CURLOPT_URL => "http://weather.diskfloppy.me/data/got.txt", - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => "", - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 300, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => "GET", -]); - -$last_update = curl_exec($curl_current); -$err = curl_error($curl_current); - -curl_close($curl_current); - -if ($err) { - die("cURL Error: " . $err); -} -$current_response = json_decode($current_response, true); -$weather_data = $current_response['data']['conditions'][0]; -echo '

Local Weather (Last Update: '.gmdate('H:i Y-m-d', intval(rtrim($last_update))).')

'; -$windDirDeg = $weather_data['wind_dir_last']; -$windDir = ""; -// W I N D -if (349 <= $windDirDeg || $windDirDeg <= 11) { $windDir = "N"; } -else if (12 <= $windDirDeg && $windDirDeg <= 33) { $windDir = "NNE"; } -else if (34 <= $windDirDeg && $windDirDeg <= 56) { $windDir = "NE"; } -else if (57 <= $windDirDeg && $windDirDeg <= 78) { $windDir = "ENE"; } -else if (79 <= $windDirDeg && $windDirDeg <= 101) { $windDir = "E"; } -else if (102 <= $windDirDeg && $windDirDeg <= 123) { $windDir = "ESE"; } -else if (124 <= $windDirDeg && $windDirDeg <= 146) { $windDir = "SE"; } -else if (147 <= $windDirDeg && $windDirDeg <= 168) { $windDir = "SSE"; } -else if (169 <= $windDirDeg && $windDirDeg <= 191) { $windDir = "S"; } -else if (192 <= $windDirDeg && $windDirDeg <= 213) { $windDir = "SSW"; } -else if (214 <= $windDirDeg && $windDirDeg <= 236) { $windDir = "SW"; } -else if (237 <= $windDirDeg && $windDirDeg <= 258) { $windDir = "WSW"; } -else if (259 <= $windDirDeg && $windDirDeg <= 281) { $windDir = "W"; } -else if (282 <= $windDirDeg && $windDirDeg <= 303) { $windDir = "WNE"; } -else if (304 <= $windDirDeg && $windDirDeg <= 326) { $windDir = "NW"; } -else if (327 <= $windDirDeg && $windDirDeg <= 348) { $windDir = "WNW"; } - - -echo 'Wind Speed: '.$weather_data['wind_speed_last'].' mph
'; -echo 'Wind Direction: '.$weather_data['wind_dir_last'].'°, '.$windDir.'
'; -echo 'Temperature: '.round(($weather_data['temp']-32)*(5/9), 1).'°C
'; -echo 'Rain Rate: '.round($weather_data['rain_rate_last']*0.2, 2).' mm/hr
'; -echo 'Humidity: '.round($weather_data['hum']).'%
'; -- cgit v1.2.3-54-g00ecf