www/bagis/index.php
2024-01-03 22:36:43 +03:00

257 lines
No EOL
12 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<?php
### ERROR HANDLING ###
function warnError($errno, $errstr, $errfile, $errline)
{
echo "<br><p style='padding:0px;margin:0px;background-color:white;color:black;'><b style='color:red;'>Error:</b> [$errno] $errstr <br> in file <b style='color:blue'>$errfile</b> line <b style='color:red'>$errline</b></p>";
}
set_error_handler("warnError");
if (!$_SERVER['DOCUMENT_ROOT']) {
$_SERVER['DOCUMENT_ROOT'] = '/weblink';
}
# TODO separate file
?>
<head>
<!-- Meta Content -->
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Bana bir kahve ısmarla, Aliberk Sandıı Bağış sayfası">
<meta name="keywords" content="bagis,dontaion,coffee,kahve">
<meta name="author" content="Aliberk Sandıı">
<!-- CSS Files -->
<link rel="stylesheet" type="text/css" href="./bagis.css"> <!-- INNER CSS !!! -->
<link rel="stylesheet" type="text/css" href="/assets/css/extra_without_scss.css">
<title>
Bi' Kahve Ismarla | Aliberk Sandıı
</title>
<link rel="shortcut icon" href="/assets/images/icons/favicon.ico" type="image/x-icon">
</head>
<body>
<header>
<a href="/" id="hlogo" style="margin:auto;"><img src="/assets/images/icons/favicon.png"></a>
</header>
<div class="main-scrollable">
<article class="plain" style="text-align:center;align-items:center;">
<h1 style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-weight: 800;">Bana Bi' Kahve Ismarla ☕</h1>
<div><span>IBAN: </span><span style="margin-top: 0px;text-decoration:none;"> <b class="copy_element" id="IBAN" onclick="copy2Clipboard('IBAN')">TR63 0082 9000 0949 1444 3182 51</b><span id="IBAN-tip"></span></span></div>
<div><span>Papara Numarası: </span><span style="margin-top: 0px;text-decoration:none;"> <b class="copy_element" id="Papara" onclick="copy2Clipboard('Papara')">14444318251</b><span id="Papara-tip"></span></span></div>
<div><sup>Açıklama Kısmını <span style="font-weight:800;">Gözükmesini İstediğiniz İsim - Bağış</span> şeklinde doldurunuz. Anonim Kalmak için <span style="font-weight:800;">Anonim - Bağış</span> Yazabilirsiniz</sup></div>
<br><hr style="width: 100%;"><br>
<div id="current-goal"><label id="label1" for="pprogress">Sıradaki Hedef: </label><progress id="pprogress"><span></span></progress> <label id="label2" for="pprogress">x/y</label><br></div>
<p id="next-todo" style="margin-top:0px; margin-bottom:0px;font-size:15px;">Sırada Yapılacaklar: <b><span id="sirada-yapilacaklar"></span></b><br></p>
<!-- <p><a href="../iflpanel/path.php" style="border:solid 1px orange; border-radius:10px; padding: 10px; background-color:royalblue; font-weight:800; color:orange">&#x1F449; Yol Haritası &#x1F448;</a></p> -->
<br><hr style="width: 100%;"><br>
<h1 style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-weight: 800; margin-top:1px; margin-bottom:1px;">Bağışçılar</h1>
<div id="bagiscilar" style="text-align: left;"></div>
<br>
<hr style="width: 100%;"><br><br>
<!-- <h1 style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-weight: 800; margin-bottom: 0px;">Sponsorlar</h1> -->
<!-- <div id="sponsorlar">
<p>Henüz sponsorumuz bulunmamakta, sponsor olmak için <a href="mailto:contact@aliberksandikci.com.tr">mail</a> adresim üzerinden bana ulaşabilirsiniz.<br>
Kişisel sunucu masraflarını karşılamaktan yanı sıra, buradaki projelere de sponsor olabilirsiniz:
<ul style="text-align:left;">
<li>SSA VPN</li>
<li>Tahta Arkaplanı</li>
<li><del>İFL Kütüphane</del< /li>
<li><del>İFL Galeri</del></li>
</ul>
Sponsorluklar ve Bağışlar ile devam ettireceğim İFL/Eğitim Odaklı projelerime <a href="../iflpanel/path.php">buradan</a> ulaşabilirsiniz.<br>
Sponsor olabileceğiniz diğer projelerime <a href="https://github.com/asandikci">GitHub</a> veya <a href="https://git.aliberksandikci.com.tr">Forgejo</a> adresi üzerinden ulaşabilirsiniz.</p>
</div> -->
<br>
<hr style="width: 100%;"><br><br>
<h1 style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-weight: 800; margin-bottom: 0px;">Teşekkürler</h1>
<div id="tesekkurler">
<p style="text-align:left;">
<ul style="text-align:left;">
<li>Sitede ve projelerde kullanılan açık kaynak kodlu uygulamaların geliştiricilerine,</li>
<ul>
<li>YunoHost Geliştirici Topluluğuna,</li>
<li>Forgejo/Gitea Geliştirici Topluluğuna,</li>
</ul>
<li>Sunucularımızın ayakta kalmasına maddi/manevi destek olan tüm destekçilerimize,</li>
</ul>
<span style="font-weight:800;">Teşekür Ederiz</span>
</p>
</div>
</article>
<footer>
<div class="tmpinfo">2024 &#x1f12f; Aliberk Sandıı</div>
</footer>
</div>
<?php
$dir = new DirectoryIterator($_SERVER['DOCUMENT_ROOT'] . "/assets/js");
foreach ($dir as $file) {
if ((!$file->isDot()) && str_ends_with($file, ".js") && $file != "jquery.js") {
echo '<script src="/assets/js/' . $file . '"></script>' . PHP_EOL . ' ';
}
} ?>
<script>
function b64DecodeUnicode(str) {
// Going backwards: from bytestream, to percent-encoding, to original string.
return decodeURIComponent(atob(str).split('').map(function(c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
}).join(''));
}
var curAmount = 0
var goalAmount = 0;
let localtest = 0;
let url = 'https://git.aliberksandikci.com.tr/api/v1/repos/asandikci.com/www/contents/donations.json';
// let url = "http://127.0.0.1:PORT/donations.json";
// localtest = 1;
fetch(url)
.then(res => res.json())
.then(out => {
var lastjson;
if (localtest) {
lastjson = out;
} else {
var cnt = out.content;
console.log("base64: " + cnt);
lastjson = JSON.parse(b64DecodeUnicode(cnt));
}
console.log(lastjson);
lastjson.sort(function(a, b) {
return a.amount < b.amount;
});
for (let i = 0; i < lastjson.length; i++) {
const s = lastjson[i];
const curId = s.place + s.name;
document.getElementById("bagiscilar").innerHTML += "<p><span id='" + curId + "'>" + s.name + "</span> - <span id='" + curId + "amount'> " + s.amount + "₺<span></p>";
curAmount += s.amount;
document.getElementById(curId).style.fontWeight = "500";
if (s.amount <= 1) {
document.getElementById(curId).style.color = "grey";
document.getElementById(curId).style.fontSize = "12px";
} else if (s.amount <= 5) {
document.getElementById(curId).style.color = "white";
document.getElementById(curId).style.fontSize = "14px";
} else if (s.amount <= 10) {
document.getElementById(curId).style.color = "orange";
document.getElementById(curId).style.fontSize = "16px";
} else if (s.amount <= 15) {
document.getElementById(curId).style.color = "yellow";
document.getElementById(curId).style.fontSize = "18px";
} else if (s.amount <= 20) {
document.getElementById(curId).style.color = "purple";
document.getElementById(curId).style.fontSize = "20px";
} else if (s.amount <= 25) {
document.getElementById(curId).style.color = "red";
document.getElementById(curId).style.fontSize = "22px";
} else if (s.amount <= 30) {
document.getElementById(curId).style.color = "black";
document.getElementById(curId).style.fontSize = "24px";
} else if (s.amount <= 50) {
document.getElementById(curId).style.color = "#cc00ff";
document.getElementById(curId).style.fontSize = "26px";
} else if (s.amount <= 75) {
document.getElementById(curId).style.color = "#ff6e95";
document.getElementById(curId).style.fontSize = "28px";
} else if (s.amount <= 100) {
document.getElementById(curId).style.color = "#cc3300";
document.getElementById(curId).style.fontSize = "30px";
document.getElementById(curId).style.fontWeight = "500";
} else if (s.amount <= 150) {
document.getElementById(curId).style.color = "#00cc00";
document.getElementById(curId).style.fontSize = "32px";
document.getElementById(curId).style.fontWeight = "600";
} else if (s.amount <= 200) {
document.getElementById(curId).style.color = "#0066ff";
document.getElementById(curId).style.fontSize = "34px";
document.getElementById(curId).style.fontWeight = "700";
} else if (s.amount <= 300) {
document.getElementById(curId).style.color = "#ffff00";
document.getElementById(curId).style.fontSize = "36px";
document.getElementById(curId).style.fontWeight = "800";
} else {
document.getElementById(curId).style.color = "#ffff00";
document.getElementById(curId).style.fontSize = "38px";
document.getElementById(curId).style.fontWeight = "900";
document.getElementById(curId).style.textDecoration = "underline";
}
if(lastjson.length < 5 ){
document.getElementById(curId).style.color = "#ffff00";
document.getElementById(curId).style.fontSize = "38px";
document.getElementById(curId).style.fontWeight = "900";
document.getElementById(curId).style.textDecoration = "underline";
}
let progbar = document.getElementById("pprogress")
progbar.max = goalAmount;
progbar.value = curAmount;
progbar.labels[1].innerHTML = curAmount + "/" + goalAmount + "₺";
}
})
.catch(err => {
throw err
});
//
// PUBLIC DATA
//
let url2 = 'https://git.aliberksandikci.com.tr/api/v1/repos/asandikci.com/www/contents/public-data.json';
// let url2 = "http://127.0.0.1:PORT/public-data.json";
// localtest = 1;
fetch(url2)
.then(res => res.json())
.then(out => {
var publicjson;
if (localtest) {
publicjson = out[0]["public-todo"];
} else {
var cnt = out.content;
console.log("base64: " + cnt);
publicjson = JSON.parse(b64DecodeUnicode(cnt))[0]["public-todo"];
}
publicjson.sort(function(a, b) {
return Number(Object.keys(a)) > Number(Object.keys(b));
});
console.log(publicjson);
var curi = 0;
for (let i = 0; i < publicjson.length; i++) {
const element = Number(Object.keys(publicjson[i]));
if (curAmount < element) {
goalAmount = element;
curi = i;
break;
}
}
console.log(goalAmount);
document.getElementById("sirada-yapilacaklar").innerHTML = publicjson[i][goalAmount][0];
let progbar = document.getElementById("pprogress")
progbar.max = goalAmount;
progbar.labels[1].innerHTML = curAmount + "/" + goalAmount + "₺";
})
.catch(err => {
throw err
});
</script>
</body>
</html>