mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-25 20:44:53 -04:00
Adds PHP support checks to index page.
This commit is contained in:
parent
eda1a3b6ac
commit
c173d74d06
6 changed files with 113 additions and 20 deletions
|
@ -89,6 +89,18 @@ html.h5ai-splash {
|
||||||
margin-top: 0.6em;
|
margin-top: 0.6em;
|
||||||
line-height: 1.4em;
|
line-height: 1.4em;
|
||||||
}
|
}
|
||||||
|
.test-label {
|
||||||
|
|
||||||
|
}
|
||||||
|
.test-result {
|
||||||
|
font-weight: bold;
|
||||||
|
&.test-passed {
|
||||||
|
color: #5a5;
|
||||||
|
}
|
||||||
|
&.test-failed {
|
||||||
|
color: #a55;
|
||||||
|
}
|
||||||
|
}
|
||||||
pre.prettyprint.nice, code.prettyprint.nice {
|
pre.prettyprint.nice, code.prettyprint.nice {
|
||||||
font-family: "Ubuntu Mono", Ubuntu, Arial, sans;
|
font-family: "Ubuntu Mono", Ubuntu, Arial, sans;
|
||||||
font-size: 0.95em;
|
font-size: 0.95em;
|
||||||
|
|
|
@ -21,11 +21,10 @@
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<h1><span class="logo-h">h</span><span class="logo-5"><img src="/_h5ai/images/html5.png" alt="5" title="HTML 5" /></span><span class="logo-a">a</span><span class="logo-i">i</span></h1>
|
<h1><span class="logo-h">h</span><span class="logo-5"><img src="/_h5ai/images/html5.png" alt="5" title="HTML 5" /></span><span class="logo-a">a</span><span class="logo-i">i</span></h1>
|
||||||
|
<h2>· version %BUILD_VERSION% ·</h2>
|
||||||
</header>
|
</header>
|
||||||
<section>
|
<section>
|
||||||
<p>
|
<h2>Links</h2>
|
||||||
<span class="h5ai">h5ai</span> %BUILD_VERSION% is provided under the terms of the <a target="_blank" href="http://github.com/lrsjng/h5ai/blob/master/LICENSE.txt">MIT License</a>.
|
|
||||||
</p>
|
|
||||||
<p>
|
<p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Project page: <a target="_blank" href="http://larsjung.de/h5ai">http://larsjung.de/h5ai</a></li>
|
<li>Project page: <a target="_blank" href="http://larsjung.de/h5ai">http://larsjung.de/h5ai</a></li>
|
||||||
|
@ -35,6 +34,14 @@
|
||||||
<p>
|
<p>
|
||||||
To report a bug or make a feature request please create <a target="_blank" href="http://github.com/lrsjng/h5ai/issues/new">a new issue</a>.
|
To report a bug or make a feature request please create <a target="_blank" href="http://github.com/lrsjng/h5ai/issues/new">a new issue</a>.
|
||||||
</p>
|
</p>
|
||||||
|
<h2>Checks</h2>
|
||||||
|
<p>
|
||||||
|
<ul>
|
||||||
|
<li id="test-php"><span class="test-label">PHP</span>: <span class="test-result"></span></li>
|
||||||
|
<li id="test-zips"><span class="test-label">Zipped Downloads</span>: <span class="test-result"></span></li>
|
||||||
|
<li id="test-thumbs"><span class="test-label">Thumbnails</span>: <span class="test-result"></span></li>
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
<h2>Contact</h2>
|
<h2>Contact</h2>
|
||||||
<p>
|
<p>
|
||||||
<img class="gravatar" src="http://www.gravatar.com/avatar/0340cc810fd79ee143476d4ad51fac9f?s=80" width="80" height="80" />
|
<img class="gravatar" src="http://www.gravatar.com/avatar/0340cc810fd79ee143476d4ad51fac9f?s=80" width="80" height="80" />
|
||||||
|
@ -43,10 +50,6 @@
|
||||||
<a target="_blank" href="http://twitter.com/lrsjng">@lrsjng</a>
|
<a target="_blank" href="http://twitter.com/lrsjng">@lrsjng</a>
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
|
||||||
<pre id="config-file">
|
|
||||||
</pre>
|
|
||||||
</section>
|
|
||||||
<script src="/_h5ai/config.js"></script>
|
<script src="/_h5ai/config.js"></script>
|
||||||
<script src="/_h5ai/js/scripts.js"></script>
|
<script src="/_h5ai/js/scripts.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -97,6 +97,8 @@
|
||||||
// @include "Html.js"
|
// @include "Html.js"
|
||||||
// @include "Extended.js"
|
// @include "Extended.js"
|
||||||
|
|
||||||
|
// @include "splash.js"
|
||||||
|
|
||||||
$(init);
|
$(init);
|
||||||
|
|
||||||
}(jQuery, H5AI_CONFIG));
|
}(jQuery, H5AI_CONFIG));
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
|
|
||||||
(function (window, $) {
|
(function ($, h5ai) {
|
||||||
'use strict';
|
'use strict';
|
||||||
/*jslint browser: true, confusion: true, white: true */
|
|
||||||
/*global jQuery */
|
|
||||||
|
|
||||||
var deobfuscate = function () {
|
var deobfuscate = function () {
|
||||||
|
|
||||||
|
@ -15,16 +13,55 @@
|
||||||
$this.replaceWith($a);
|
$this.replaceWith($a);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
configFile = function () {
|
handleChecksResponse = function (response) {
|
||||||
|
|
||||||
$('#config-file').text(JSON.stringify(H5AI_CONFIG.options));
|
if (response) {
|
||||||
|
$('#test-php .test-result').addClass('test-passed').text('passed');
|
||||||
|
if (response.zips === 0) {
|
||||||
|
$('#test-zips .test-result').addClass('test-passed').text('passed');
|
||||||
|
} else {
|
||||||
|
$('#test-zips .test-result').addClass('test-failed').text('failed (' + response.zips + ')');
|
||||||
|
}
|
||||||
|
if (response.thumbs === 0) {
|
||||||
|
$('#test-thumbs .test-result').addClass('test-passed').text('passed');
|
||||||
|
} else {
|
||||||
|
$('#test-thumbs .test-result').addClass('test-failed').text('failed (' + response.thumbs + ')');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('#test-php .test-result').addClass('test-failed').text('failed');
|
||||||
|
$('#test-zips .test-result').addClass('test-failed').text('failed');
|
||||||
|
$('#test-thumbs .test-result').addClass('test-failed').text('failed');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
checks = function () {
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: h5ai.core.api(),
|
||||||
|
data: {
|
||||||
|
action: 'checks'
|
||||||
|
},
|
||||||
|
type: 'POST',
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (response) {
|
||||||
|
|
||||||
|
handleChecksResponse(response);
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
|
||||||
|
handleChecksResponse();
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
init = function () {
|
init = function () {
|
||||||
|
|
||||||
deobfuscate();
|
h5ai.isSplash = $('html').hasClass('h5ai-splash');
|
||||||
configFile();
|
|
||||||
|
if (h5ai.isSplash) {
|
||||||
|
deobfuscate();
|
||||||
|
checks();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$(init);
|
$(init);
|
||||||
|
|
||||||
}(window, jQuery));
|
}(jQuery, h5ai));
|
|
@ -17,7 +17,3 @@
|
||||||
// h5ai
|
// h5ai
|
||||||
// ----
|
// ----
|
||||||
// @include "inc/H5ai.js"
|
// @include "inc/H5ai.js"
|
||||||
|
|
||||||
// info
|
|
||||||
// ----
|
|
||||||
// @include "inc/splash.js"
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function safe_dirname($path, $endWithSlash = false) {
|
function safe_dirname($path, $endWithSlash = false) {
|
||||||
|
|
||||||
$path = str_replace("\\", "/", dirname($path));
|
$path = str_replace("\\", "/", dirname($path));
|
||||||
return preg_match("#^(\w:)?/$#", $path) ? $path : (preg_replace('#/$#', '', $path) . ($endWithSlash ? "/" : ""));
|
return preg_match("#^(\w:)?/$#", $path) ? $path : (preg_replace('#/$#', '', $path) . ($endWithSlash ? "/" : ""));
|
||||||
}
|
}
|
||||||
|
@ -143,6 +143,49 @@ else if ($action === "getzip") {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if ($action === "checks") {
|
||||||
|
|
||||||
|
function checkZipSupport () {
|
||||||
|
|
||||||
|
if (!class_exists("ZipArchive")) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$zipFile = tempnam(sys_get_temp_dir(), "h5ai-zip-");
|
||||||
|
$zip = new ZipArchive();
|
||||||
|
|
||||||
|
if (!$zip->open($zipFile, ZIPARCHIVE::CREATE)) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
$zip->addEmptyDir("/");
|
||||||
|
$zip->close();
|
||||||
|
|
||||||
|
if (filesize($zipFile) === 0) {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return 4;
|
||||||
|
};
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkGdSupport () {
|
||||||
|
|
||||||
|
if (GD_VERSION == "GD_VERSION") {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = array('zips' => checkZipSupport(), 'thumbs' => checkGdSupport());
|
||||||
|
echo json_encode($response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
else {
|
else {
|
||||||
fail(1, "unsupported 'action' specified");
|
fail(1, "unsupported 'action' specified");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue