diff --git a/components/header.php b/components/header.php index c1940b2..77516fa 100644 --- a/components/header.php +++ b/components/header.php @@ -16,6 +16,13 @@ $showNowPlaying = !empty($is_index) || !empty($do_fullscreen_header); + + +
diff --git a/pages/index.php b/pages/index.php index 7e2e399..e1954b6 100644 --- a/pages/index.php +++ b/pages/index.php @@ -120,12 +120,14 @@ if($reqPath === '/donate') { return FM_HIT | 302; } -if($reqPath === '/') { +if($reqPath === '/' || $reqPath === '/365') { if($reqMethod !== 'GET') return FM_ERR | 405; if($reqHead) return FM_HIT; + $is365 = $reqPath === '/365'; + $legacyPage = filter_input(INPUT_GET, 'p', FILTER_SANITIZE_STRING); if(!empty($legacyPage)) { $legacyPages = [ @@ -185,6 +187,7 @@ if($reqPath === '/') { fm_component('header', [ 'title' => 'flash.moe', 'is_index' => true, + 'is_365' => $is365, ]); ?>
diff --git a/public/_v4/html.php b/public/_v4/html.php index b643bfa..3b13c2c 100644 --- a/public/_v4/html.php +++ b/public/_v4/html.php @@ -14,6 +14,9 @@ define('HTML_INORI', 5); define('HTML_GECKSCAPE', 5); define('HTML_N3DS', 6); +if(isset($_GET['jvdg'])) + define('FWH_MODE', FWH_JVDG); + function html_browser(): int { static $browser = null; diff --git a/public/key.php b/public/key.php index 5ce0a3b..1e67f69 100644 --- a/public/key.php +++ b/public/key.php @@ -3,9 +3,9 @@ define('KEY_CHARS', 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456 define('KEY_CHARS_LENGTH', strlen(KEY_CHARS)); function generateKey(int $length): string { - $bytes = random_bytes($length); + $bytes = str_repeat("\0", $length); for($i = 0; $i < $length; ++$i) - $bytes[$i] = KEY_CHARS[ord($bytes[$i]) % KEY_CHARS_LENGTH]; + $bytes[$i] = KEY_CHARS[random_int(0, KEY_CHARS_LENGTH - 1)]; return $bytes; } @@ -19,7 +19,8 @@ if(isset($_GET['length'])) { } } -echo '16: ' . generateKey(8) . PHP_EOL; -echo '32: ' . generateKey(16) . PHP_EOL; -echo '64: ' . generateKey(32) . PHP_EOL; -echo '128: ' . generateKey(64) . PHP_EOL; +echo '8: ' . generateKey(8) . PHP_EOL; +echo '16: ' . generateKey(16) . PHP_EOL; +echo '32: ' . generateKey(32) . PHP_EOL; +echo '64: ' . generateKey(64) . PHP_EOL; +echo '128: ' . generateKey(128) . PHP_EOL; diff --git a/public/signature/bg4.png b/public/signature/bg4.png new file mode 100644 index 0000000..45afade Binary files /dev/null and b/public/signature/bg4.png differ diff --git a/public/signature/bg5.png b/public/signature/bg5.png new file mode 100644 index 0000000..3e6e4d5 Binary files /dev/null and b/public/signature/bg5.png differ diff --git a/public/signature/signature.php b/public/signature/signature.php index 695807c..ac7119a 100644 --- a/public/signature/signature.php +++ b/public/signature/signature.php @@ -1,6 +1,6 @@ 1205 && $currentDate < 1227) { + define('BG_IMAGE', 'bg5.png'); +} else { + define('BG_IMAGE', 'bg4.png'); +} if(!isset($_GET['_force']) && is_file(SIG_STATIC) && time() - filemtime(SIG_STATIC) < SIG_AGE) { $imagick = new Imagick(SIG_STATIC); @@ -28,7 +36,7 @@ if(!isset($_GET['_force']) && is_file(SIG_STATIC) && time() - filemtime(SIG_STAT if(is_array($np)) { file_put_contents(NP_FILE, $npRaw); - if(empty($np[0]->images->large)) { + if(empty($np[0]->images->large) || $np[0]->images->large === NP_COVER_URL_DEFAULT) { unlink(NP_COVER); file_put_contents(NP_COVER_URL, ''); } elseif(!empty($np[0]->images->large) && $np[0]->images->large !== file_get_contents(NP_COVER_URL)) { @@ -54,39 +62,42 @@ if(!isset($_GET['_force']) && is_file(SIG_STATIC) && time() - filemtime(SIG_STAT $imagick->compositeImage($footer, Imagick::COMPOSITE_MATHEMATICS, 0, SIG_HEIGHT - $footer->getImageHeight()); $footer->destroy(); - if($nowPlaying) { - $npCover = new Imagick(is_file(NP_COVER) ? NP_COVER : NP_COVER_DEFAULT); - $npCover->resizeImage(60, 60, Imagick::FILTER_CATROM, 0.9, true); - $imagick->compositeImage($npCover, Imagick::COMPOSITE_COPY, SIG_WIDTH - 70, 10); + $hasCover = $nowPlaying && is_file(NP_COVER); + + if($hasCover) { + $npCover = new Imagick(/*is_file(NP_COVER) ?*/ NP_COVER /*: NP_COVER_DEFAULT*/); + $npCover->resizeImage(80, 80, Imagick::FILTER_CATROM, 0.9, true); + $imagick->compositeImage($npCover, Imagick::COMPOSITE_COPY, SIG_WIDTH - 90, 10); $npCover->destroy(); } $imagickDraw = new ImagickDraw; - $imagickDraw->setFillColor($ip_fff); + $imagickDraw->setFillColor(BG_IMAGE === 'bg4.png' ? $ip_000 : $ip_fff); $imagickDraw->setFont(FW_FONT_FAM); $imagickDraw->setFontSize(FW_FONT_SIZE); $imagickLogo = new Imagick(); $imagickLogo->newImage($imagick->getImageWidth(), $imagick->getImageHeight(), new ImagickPixel('none'), 'png'); - $imagickLogo->annotateImage($imagickDraw, 15, 35, 0, FW_TEXT); + $imagickLogo->annotateImage($imagickDraw, $hasCover ? 367 : 457, 60, 0, FW_TEXT); $imagickShadow = clone $imagickLogo; - $imagickShadow->shadowImage(80, 2, 0, 0); + $imagickShadow->shadowImage(80, 5, 0, 0); $imagickShadow->compositeImage($imagickLogo, Imagick::COMPOSITE_OVER, 4, 2); $imagickLogo->destroy(); $imagick->compositeImage($imagickShadow, Imagick::COMPOSITE_OVER, -4, -2); $imagickShadow->destroy(); + $imagickDraw->setFillColor($ip_fff); $imagickDraw->setFont(NP_FONT_FAM); $imagickDraw->setFontSize(NP_FONT_SIZE); if($nowPlaying) { - $imagick->annotateImage($imagickDraw, 40, 71, 0, sprintf('%s - %s', $np[0]->artist->name ?? '', $np[0]->name ?? '')); + $imagick->annotateImage($imagickDraw, 40, 91, 0, sprintf('%s - %s', $np[0]->artist->name ?? '', $np[0]->name ?? '')); $imagickDraw->setFont(FA_FONT_FAM); - $imagick->annotateImage($imagickDraw, 10, 71, 0, "\u{f001}"); + $imagick->annotateImage($imagickDraw, 10, 91, 0, "\u{f001}"); } else { - $imagick->annotateImage($imagickDraw, 10, 71, 0, "If it ain't broke, I'll break it"); + $imagick->annotateImage($imagickDraw, 10, 91, 0, "If it ain't broke, I'll break it"); } file_put_contents(SIG_STATIC, $imagick->getImageBlob()); diff --git a/public/ssh.php b/public/ssh.php index ce9949f..5651966 100644 --- a/public/ssh.php +++ b/public/ssh.php @@ -7,7 +7,7 @@ $json = !empty($_GET['j']); header('Content-Type: ' . ($json ? 'application/json; charset=utf-8' : 'text/plain; charset=us-ascii')); -$keys = $pdo->prepare('SELECT *, UNIX_TIMESTAMP(`key_created`) AS `key_created` FROM `fm_public_keys` WHERE `key_deprecated` IS NULL AND `key_level` >= :level'); +$keys = $pdo->prepare('SELECT *, UNIX_TIMESTAMP(`key_created`) AS `key_created` FROM `fm_public_keys` WHERE `key_deprecated` IS NULL AND `key_level` >= :level ORDER BY `key_level` DESC, `key_id`'); $keys->bindValue('level', $minLevel); $keys->execute(); $keys = $keys->fetchAll(PDO::FETCH_OBJ); diff --git a/public/temp.php b/public/temp.php index 65be17a..61b1c6e 100644 --- a/public/temp.php +++ b/public/temp.php @@ -1,12 +1,32 @@ PDO::CASE_NATURAL, + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, + PDO::ATTR_STRINGIFY_FETCHES => false, + PDO::ATTR_EMULATE_PREPARES => false, + PDO::MYSQL_ATTR_INIT_COMMAND => " + SET SESSION + sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION', + time_zone = '+00:00'; + ", + ]); +} catch(Exception $ex) { + http_response_code(500); + echo '

Unable to connect to database

'; + die($ex->getMessage()); +} + if(isset($_POST['temp']) && isset($_POST['hash']) && isset($_POST['time'])) { $temp = (string)filter_input(INPUT_POST, 'temp', FILTER_SANITIZE_STRING); $hash = (string)filter_input(INPUT_POST, 'hash', FILTER_SANITIZE_STRING); @@ -35,11 +55,32 @@ if(isset($_GET['since'])) { return; } +if(isset($_GET['since_3mo'])) { + $since = (int)filter_input(INPUT_GET, 'since_3mo', FILTER_SANITIZE_NUMBER_INT); + $temps = $pdo->prepare('SELECT MAX(`temp_celcius`) AS `temp_celcius_max`, AVG(`temp_celcius`) AS `temp_celcius_avg`, MIN(`temp_celcius`) AS `temp_celcius_min`, UNIX_TIMESTAMP(DATE(`temp_datetime`)) AS `temp_datetime` FROM `fm_temperature` WHERE `temp_datetime` > DATE(FROM_UNIXTIME(:since)) AND `temp_datetime` > NOW() - INTERVAL 3 MONTH GROUP BY DATE(`temp_datetime`) ORDER BY `temp_datetime` ASC LIMIT 92'); + $temps->bindValue('since', $since); + $temps->execute(); + header('Content-Type: application/json; charset=utf-8'); + echo json_encode($temps->fetchAll(PDO::FETCH_ASSOC)); + return; +} + +if(isset($_GET['since_6mo'])) { + $since = (int)filter_input(INPUT_GET, 'since_6mo', FILTER_SANITIZE_NUMBER_INT); + $temps = $pdo->prepare('SELECT MAX(`temp_celcius`) AS `temp_celcius_max`, AVG(`temp_celcius`) AS `temp_celcius_avg`, MIN(`temp_celcius`) AS `temp_celcius_min`, UNIX_TIMESTAMP(DATE(`temp_datetime`)) AS `temp_datetime` FROM `fm_temperature` WHERE `temp_datetime` > DATE(FROM_UNIXTIME(:since)) AND `temp_datetime` > NOW() - INTERVAL 6 MONTH GROUP BY DATE(`temp_datetime`) ORDER BY `temp_datetime` ASC LIMIT 92'); + $temps->bindValue('since', $since); + $temps->execute(); + header('Content-Type: application/json; charset=utf-8'); + echo json_encode($temps->fetchAll(PDO::FETCH_ASSOC)); + return; +} + if(!empty($_GET['siri'])) { header('Content-Type: text/plain; charset=utf-8'); $temps = $pdo->prepare('SELECT `temp_celcius`, UNIX_TIMESTAMP(`temp_datetime`) AS `temp_datetime` FROM `fm_temperature` ORDER BY `temp_datetime` DESC LIMIT 1'); $temps->execute(); $temps = $temps->fetch(PDO::FETCH_ASSOC); + date_default_timezone_set('Europe/Amsterdam'); printf('It was %2$.1f°C at %1$s.', date('H:i:s', $temps['temp_datetime']), $temps['temp_celcius']); return; } @@ -106,15 +147,21 @@ if(!empty($_GET['siri'])) {
+
+ +
diff --git a/public/topmostfriend/index.php b/public/topmostfriend/index.php index 8aa56cc..7aa46e9 100644 --- a/public/topmostfriend/index.php +++ b/public/topmostfriend/index.php @@ -12,13 +12,13 @@ $body .= $indent . '
' . $indent . '
'; $body .= $indent . '

Tray Area

'; -$body .= $indent . 'Main UI in v1.5.1'; +$body .= $indent . 'Main UI in v1.6.0'; $body .= $indent . '

Top Most Friend runs in your system tray area. When right clicking on it you\'re presented with a menu that contains all currently open windows as well as a number of actions.

'; $body .= $indent . '

Clicking any of the windows will toggle its always on top status, Refresh will reload the window list without dismissing the menu, Settings will open the settings menu displayed below, About shows the about window displayed in the screenshot, and Quit closes the program.

'; $body .= $indent . '
'; $body .= $indent . '

Settings

'; -$body .= $indent . 'Settings in v1.5.1'; +$body .= $indent . 'Settings in v1.6.0'; $body .= $indent . '

In the settings you can alter program behaviour, set a global hotkey that will toggle the always on top status of whichever window currently has focus and open the title blacklist window.

'; $body .= $indent . '

Some windows require administrator privileges to have their top most status toggled, normally the program will prompt you if this is needed but you can also choose to always make the program start itself as administrator. This will have no effect on version of Windows before Vista.

'; $body .= $indent . '

You can also choose to omit the program list from the taskbar menu if you only plan on using the hotkey functionality, this will make the menu open ever so slightly faster.

'; @@ -26,12 +26,12 @@ $body .= $indent . '

The other options are fairly self explanatory, if you\'ve $body .= $indent . '

'; $body .= $indent . '

Title Blacklisting

'; -$body .= $indent . 'Title blacklist in v1.5.1'; +$body .= $indent . 'Title blacklist in v1.6.0'; $body .= $indent . '

The title blacklist functions as a way to keep the list in the menu clean, it does not affect anything in regards to the hotkey. Depending on your version of Windows, a number of items may be added by default which are either invisible windows or cannot be toggled at all.

'; $body .= $indent . '

You can add, edit and remove entries using a simple text entry screen, as described in the previous section you can also SHIFT+CLICK things in the program list if enable.

'; $body .= $indent . '
'; -$body .= $indent . ''; +//$body .= $indent . ''; $body .= substr($indent, 0, -4); diff --git a/public/topmostfriend/ss-main-160.jpg b/public/topmostfriend/ss-main-160.jpg new file mode 100644 index 0000000..907a389 Binary files /dev/null and b/public/topmostfriend/ss-main-160.jpg differ diff --git a/public/topmostfriend/ss-settings-160.jpg b/public/topmostfriend/ss-settings-160.jpg new file mode 100644 index 0000000..fd77cd1 Binary files /dev/null and b/public/topmostfriend/ss-settings-160.jpg differ diff --git a/public/topmostfriend/ss-settings-blacklist-160.jpg b/public/topmostfriend/ss-settings-blacklist-160.jpg new file mode 100644 index 0000000..3734b37 Binary files /dev/null and b/public/topmostfriend/ss-settings-blacklist-160.jpg differ diff --git a/public/userscripts/remove-trending-tab.user.js b/public/userscripts/remove-trending-tab.user.js index dad92f5..49be162 100644 --- a/public/userscripts/remove-trending-tab.user.js +++ b/public/userscripts/remove-trending-tab.user.js @@ -1,13 +1,13 @@ // ==UserScript== -// @name Removed Trending tab -// @version 6 +// @name Remove Trending tab +// @version 7 // @grant none // @include https://www.youtube.com/* // ==/UserScript== window.addEventListener('load', function() { var checkInterval = setInterval(function() { - var buttons = Array.from(document.querySelectorAll('[href="/feed/explore"], [href="/feed/trending"]')); + var buttons = Array.from(document.querySelectorAll('[href="/feed/explore"], [href="/feed/trending"], [href="/channel/UCqVDpXKLmKeBU_yyt_QkItQ"]')); if(buttons.length) { while(buttons.length) diff --git a/public/whois/index.php b/public/whois/index.php index 04b012c..98de138 100644 --- a/public/whois/index.php +++ b/public/whois/index.php @@ -1,27 +1,6 @@ PDO::CASE_NATURAL, - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, - PDO::ATTR_STRINGIFY_FETCHES => false, - PDO::ATTR_EMULATE_PREPARES => false, - PDO::MYSQL_ATTR_INIT_COMMAND => " - SET SESSION - sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION', - time_zone = '+00:00'; - ", - ]); - - $pdo->exec('DELETE FROM `fm_whois` WHERE `whois_timestamp` < NOW() - INTERVAL 30 MINUTE'); -} catch(Exception $ex) { - die($ex->getMessage()); -} +require_once __DIR__ . '/../_v4/includes.php'; $domain = isset($_GET['domain']) && is_string($_GET['domain']) ? idn_to_ascii(mb_strtolower($_GET['domain']), IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46) @@ -105,7 +84,7 @@ if(isset($_GET['ajax'])) {
flash.moe whois