www/dev/tmptest/index.php

92 lines
2.6 KiB
PHP
Raw Permalink Normal View History

2024-01-09 19:31:35 +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="description" content="Geçici Test Sayfası">
<meta name="keywords" content="test,tmptest">
<meta name="author" content="Aliberk Sandıı">
<!-- CSS Files -->
<link rel="stylesheet" type="text/css" href="/assets/css/main.css">
<title>
TMP TEST | GEÇİCİ TEST SAYFASI
</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;">
TEMPORARY TEST (see page source or consoles)
</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>
let url = 'https://next.forgejo.org/asandikci-tmp/tmp-cors-test/raw/branch/main/example.md';
fetch(url)
.then(res => {
console.log("SUCCESFULLY GET RAW CONTENT: " + out.content);
})
.catch(err => {
throw err
});
let url2 = 'https://next.forgejo.org/api/v1/repos/asandikci-tmp/tmp-cors-test/raw/example.md';
fetch(url2)
.then(res => {
console.log("SUCCESFULLY GET API CONTENT: " + res);
})
.catch(err => {
throw err
});
let url3 = "https://next.forgejo.org/asandikci-tmp/tmp-cors-test/src/branch/main/example.md"
fetch(url3)
.then(res => {
console.log("SUCCESFULLY GET WEBSITE CONTENT: " + out.content);
})
.catch(err => {
throw err
});
</script>
</body>
</html>