www/bagis/index.php

257 lines
12 KiB
PHP
Raw Normal View History

2023-11-22 19:03:21 +03:00
<!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 !!! -->
2023-11-22 19:03:21 +03:00
<link rel="stylesheet" type="text/css" href="/assets/css/extra_without_scss.css">
2023-11-24 17:05:33 +03:00
<title>
2023-11-22 19:03:21 +03:00
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;">
2023-11-22 19:36:18 +03:00
<h1 style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-weight: 800;">Bana Bi' Kahve Ismarla </h1>
2023-11-24 23:47:05 +03:00
<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>
2023-11-25 01:39:22 +03:00
<div><sup>ı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>
2023-12-13 16:50:50 +03:00
<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>
2023-11-24 23:47:05 +03:00
<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>
2023-11-25 01:39:22 +03:00
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>
2023-11-26 20:46:01 +03:00
<li><del>İFL Kütüphane</del< /li>
2023-11-25 01:39:22 +03:00
<li><del>İFL Galeri</del></li>
</ul>
2023-11-26 20:46:01 +03:00
Sponsorluklar ve Bağışlar ile devam ettireceğim İFL/Eğitim Odaklı projelerime <a href="../iflpanel/path.php">buradan</a> ulaşabilirsiniz.<br>
2023-11-25 01:39:22 +03:00
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>
2023-11-24 23:47:05 +03:00
</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 ı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>
2023-11-22 19:03:21 +03:00
</article>
<footer>
<div class="tmpinfo">2024 &#x1f12f; Aliberk Sandıı</div>
2023-11-22 19:03:21 +03:00
</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 . ' ';
}
} ?>
2023-11-22 19:36:18 +03:00
<script>
2023-11-26 20:46:01 +03:00
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;
2023-11-24 23:47:05 +03:00
let localtest = 0;
2023-11-24 17:05:33 +03:00
let url = 'https://git.aliberksandikci.com.tr/api/v1/repos/asandikci.com/www/contents/donations.json';
2023-11-24 23:47:05 +03:00
// let url = "http://127.0.0.1:PORT/donations.json";
// localtest = 1;
2023-11-22 19:36:18 +03:00
fetch(url)
.then(res => res.json())
2023-11-24 17:05:33 +03:00
.then(out => {
2023-11-24 23:47:05 +03:00
var lastjson;
if (localtest) {
lastjson = out;
} else {
var cnt = out.content;
console.log("base64: " + cnt);
2023-11-26 20:46:01 +03:00
lastjson = JSON.parse(b64DecodeUnicode(cnt));
2023-11-24 23:47:05 +03:00
}
2023-11-26 20:46:01 +03:00
console.log(lastjson);
2023-11-24 23:47:05 +03:00
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";
2023-12-22 12:08:21 +03:00
if (s.amount <= 1) {
2023-11-24 23:47:05 +03:00
document.getElementById(curId).style.color = "grey";
document.getElementById(curId).style.fontSize = "12px";
2023-12-22 12:08:21 +03:00
} else if (s.amount <= 5) {
2023-11-24 23:47:05 +03:00
document.getElementById(curId).style.color = "white";
document.getElementById(curId).style.fontSize = "14px";
2023-12-22 12:08:21 +03:00
} else if (s.amount <= 10) {
2023-11-24 23:47:05 +03:00
document.getElementById(curId).style.color = "orange";
document.getElementById(curId).style.fontSize = "16px";
2023-12-22 12:08:21 +03:00
} else if (s.amount <= 15) {
2023-11-24 23:47:05 +03:00
document.getElementById(curId).style.color = "yellow";
document.getElementById(curId).style.fontSize = "18px";
2023-12-22 12:08:21 +03:00
} else if (s.amount <= 20) {
2023-11-24 23:47:05 +03:00
document.getElementById(curId).style.color = "purple";
document.getElementById(curId).style.fontSize = "20px";
2023-12-22 12:08:21 +03:00
} else if (s.amount <= 25) {
2023-11-24 23:47:05 +03:00
document.getElementById(curId).style.color = "red";
document.getElementById(curId).style.fontSize = "22px";
2023-12-22 12:08:21 +03:00
} else if (s.amount <= 30) {
2023-11-24 23:47:05 +03:00
document.getElementById(curId).style.color = "black";
document.getElementById(curId).style.fontSize = "24px";
2023-12-22 12:08:21 +03:00
} else if (s.amount <= 50) {
2023-11-24 23:47:05 +03:00
document.getElementById(curId).style.color = "#cc00ff";
document.getElementById(curId).style.fontSize = "26px";
2023-12-22 12:08:21 +03:00
} else if (s.amount <= 75) {
2023-11-24 23:47:05 +03:00
document.getElementById(curId).style.color = "#ff6e95";
document.getElementById(curId).style.fontSize = "28px";
2023-11-24 23:47:05 +03:00
} else if (s.amount <= 100) {
document.getElementById(curId).style.color = "#cc3300";
document.getElementById(curId).style.fontSize = "30px";
2023-11-24 23:47:05 +03:00
document.getElementById(curId).style.fontWeight = "500";
} else if (s.amount <= 150) {
document.getElementById(curId).style.color = "#00cc00";
document.getElementById(curId).style.fontSize = "32px";
2023-11-24 23:47:05 +03:00
document.getElementById(curId).style.fontWeight = "600";
} else if (s.amount <= 200) {
document.getElementById(curId).style.color = "#0066ff";
document.getElementById(curId).style.fontSize = "34px";
2023-11-24 23:47:05 +03:00
document.getElementById(curId).style.fontWeight = "700";
} else if (s.amount <= 300) {
document.getElementById(curId).style.color = "#ffff00";
document.getElementById(curId).style.fontSize = "36px";
2023-11-24 23:47:05 +03:00
document.getElementById(curId).style.fontWeight = "800";
2023-11-26 20:46:01 +03:00
} else {
2023-11-24 23:47:05 +03:00
document.getElementById(curId).style.color = "#ffff00";
document.getElementById(curId).style.fontSize = "38px";
2023-11-24 23:47:05 +03:00
document.getElementById(curId).style.fontWeight = "900";
document.getElementById(curId).style.textDecoration = "underline";
}
2023-12-13 17:05:37 +03:00
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";
}
2023-11-26 20:46:01 +03:00
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;
}
2023-11-24 23:47:05 +03:00
}
2023-11-26 20:46:01 +03:00
console.log(goalAmount);
document.getElementById("sirada-yapilacaklar").innerHTML = publicjson[i][goalAmount][0];
let progbar = document.getElementById("pprogress")
2023-11-24 23:47:05 +03:00
progbar.max = goalAmount;
progbar.labels[1].innerHTML = curAmount + "/" + goalAmount + "";
2023-11-24 17:05:33 +03:00
})
2023-11-22 20:07:15 +03:00
.catch(err => {
throw err
});
2023-11-22 19:36:18 +03:00
</script>
2023-11-22 19:03:21 +03:00
</body>
</html>