Fix line endings

This commit is contained in:
Starbeamrainbowlabs 2018-10-31 16:44:34 +00:00
parent 77112ec7d3
commit 738a7c30c1
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
3 changed files with 2064 additions and 2064 deletions

3740
core.php

File diff suppressed because it is too large Load Diff

View File

@ -1,93 +1,93 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Pepperminty Wiki Download</title>
</head>
<body>
<h1><img src="https://starbeamrainbowlabs.com/images/logos/peppermint.png" class="logo" /> Pepperminty Wiki Downloader</h1>
<!-------------->
<h2>Module selector</h2>
<p>Choose the modules that you want to include in your installation of Pepperminty Wiki <?php echo(trim(file_get_contents("version"))); ?>.</p>
<p>
<button onclick="select(true);">Select All</button>
<button onclick="select(false);">Select None</button>
</p>
<table>
<tr>
<th></th>
<th>Name</th>
<th>Description</th>
<th>Author</th>
<th>Version</th>
<th style="width: 9rem;">Last Updated</th>
</tr>
<?php
$module_index = json_decode(file_get_contents("module_index.json"));
foreach($module_index as $module)
{
$checkedText = (isset($module->optional) && $module->optional === true) ? "" : " checked";
echo("<tr>
<td><input type='checkbox' id='$module->id'$checkedText /></td>
<td><label for='$module->id'>$module->name</label></td>
<td>$module->description</td>
<td>$module->author</td>
<td>$module->version</td>
<td>" . date("D jS M Y", $module->lastupdate) . "</td>
</tr>");
}
?>
</table>
<br />
<br />
<button onclick="download()" class="largebutton">Download</button>
<hr />
<p>
Pepperminty Wiki was built by <a href="https://starbeamrainbowlabs.com/"><img src="https://starbeamrainbowlabs.com/images/sbrl/SBRL-Small-64.png" class="logo" /> Starbeamrainbowlabs</a>. The code is available on <a href="//github.com/sbrl/pepperminty-wiki">GitHub</a>.
</p>
<p>
Other contributors: <a href="https://github.com/ikisler"><img src="https://avatars2.githubusercontent.com/u/12506147?v=3&s=32" class="logo" /> @ikisler</a>
</p>
<!------------------->
<link rel="stylesheet" href="//starbeamrainbowlabs.com/theme/basic.css" />
<style>
body { padding: 1rem; color: #442772; background-colour: #eee8f2; } /* syntaxtic gets confused sometimes */
a { color: #9e7eb4; }
.largebutton { font-size: 2rem; }
.logo { max-width: 1.25em; vertical-align: middle; }
</style>
<script>
function select(state)
{
var checkboxes = document.querySelectorAll("input[type=checkbox]");
for(var i = 0; i < checkboxes.length; i++)
{
checkboxes[i].checked = state;
}
}
function download()
{
var url = "pack.php?web=true&modules=",
checkboxes = document.querySelectorAll("input[type=checkbox]");
for(var i = 0; i < checkboxes.length; i++) {
if(!checkboxes[i].checked) continue;
url += encodeURIComponent(checkboxes[i].id) + ",";
}
location.href = url;
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Pepperminty Wiki Download</title>
</head>
<body>
<h1><img src="https://starbeamrainbowlabs.com/images/logos/peppermint.png" class="logo" /> Pepperminty Wiki Downloader</h1>
<!-------------->
<h2>Module selector</h2>
<p>Choose the modules that you want to include in your installation of Pepperminty Wiki <?php echo(trim(file_get_contents("version"))); ?>.</p>
<p>
<button onclick="select(true);">Select All</button>
<button onclick="select(false);">Select None</button>
</p>
<table>
<tr>
<th></th>
<th>Name</th>
<th>Description</th>
<th>Author</th>
<th>Version</th>
<th style="width: 9rem;">Last Updated</th>
</tr>
<?php
$module_index = json_decode(file_get_contents("module_index.json"));
foreach($module_index as $module)
{
$checkedText = (isset($module->optional) && $module->optional === true) ? "" : " checked";
echo("<tr>
<td><input type='checkbox' id='$module->id'$checkedText /></td>
<td><label for='$module->id'>$module->name</label></td>
<td>$module->description</td>
<td>$module->author</td>
<td>$module->version</td>
<td>" . date("D jS M Y", $module->lastupdate) . "</td>
</tr>");
}
?>
</table>
<br />
<br />
<button onclick="download()" class="largebutton">Download</button>
<hr />
<p>
Pepperminty Wiki was built by <a href="https://starbeamrainbowlabs.com/"><img src="https://starbeamrainbowlabs.com/images/sbrl/SBRL-Small-64.png" class="logo" /> Starbeamrainbowlabs</a>. The code is available on <a href="//github.com/sbrl/pepperminty-wiki">GitHub</a>.
</p>
<p>
Other contributors: <a href="https://github.com/ikisler"><img src="https://avatars2.githubusercontent.com/u/12506147?v=3&s=32" class="logo" /> @ikisler</a>
</p>
<!------------------->
<link rel="stylesheet" href="//starbeamrainbowlabs.com/theme/basic.css" />
<style>
body { padding: 1rem; color: #442772; background-colour: #eee8f2; } /* syntaxtic gets confused sometimes */
a { color: #9e7eb4; }
.largebutton { font-size: 2rem; }
.logo { max-width: 1.25em; vertical-align: middle; }
</style>
<script>
function select(state)
{
var checkboxes = document.querySelectorAll("input[type=checkbox]");
for(var i = 0; i < checkboxes.length; i++)
{
checkboxes[i].checked = state;
}
}
function download()
{
var url = "pack.php?web=true&modules=",
checkboxes = document.querySelectorAll("input[type=checkbox]");
for(var i = 0; i < checkboxes.length; i++) {
if(!checkboxes[i].checked) continue;
url += encodeURIComponent(checkboxes[i].id) + ",";
}
location.href = url;
}
</script>
</body>
</html>

202
pack.php
View File

@ -1,101 +1,101 @@
<?php
if(php_sapi_name() == "cli")
{
echo("*** Beginning main build sequence ***\n");
echo("Reading in module index...\n");
}
$module_index = json_decode(file_get_contents("module_index.json"));
$module_list = [];
foreach($module_index as $module)
{
// If the module is optional, the module's id isn't present in the command line arguments, and the special 'all' module id wasn't passed in, skip it
if($module->optional &&
(
isset($argv) &&
strrpos(implode(" ", $argv), $module->id) === false &&
!in_array("all", $argv)
)
)
continue;
$module_list[] = $module->id;
}
if(isset($_GET["modules"]))
{
$module_list = explode(",", $_GET["modules"]);
}
if(php_sapi_name() != "cli")
{
header("content-type: text/php");
header("content-disposition: attachment; filename=\"index.php\"");
}
if(php_sapi_name() == "cli") echo("Reading in core files...");
$core = file_get_contents("core.php");
$settings = file_get_contents("settings.fragment.php");
$settings = str_replace([ "<?php", "?>" ], "", $settings);
$core = str_replace([
"//{settings}",
"{version}",
"{commit}",
"{guiconfig}",
"{default-css}"
], [
$settings,
trim(file_get_contents("version")),
exec("git rev-parse HEAD"),
trim(file_get_contents("peppermint.guiconfig.json")),
trim(file_get_contents("theme_default.css"))
], $core);
$result = $core;
foreach($module_list as $module_id)
{
if($module_id == "") continue;
if(php_sapi_name() == "cli") echo("Adding $module_id\n");
$module_filepath = "modules/" . preg_replace("[^a-zA-Z0-9\-]", "", $module_id) . ".php";
//echo("id: $module_id | filepath: $module_filepath\n");
if(!file_exists($module_filepath))
{
http_response_code(400);
exit("Failed to load module with name: $module_filepath");
}
$modulecode = file_get_contents($module_filepath);
$modulecode = str_replace([ "<?php", "?>" ], "", $modulecode);
$result = str_replace(
"// %next_module% //",
"$modulecode\n// %next_module% //",
$result);
}
if(php_sapi_name() == "cli")
{
if(file_exists("build/index.php"))
{
echo("index.php already exists in the build folder, exiting\n");
exit(1);
}
else
{
echo("Done. Saving to disk...");
file_put_contents("build/index.php", $result);
echo("complete!\n");
echo("*** Build completed! ***\n");
}
}
else
{
exit($result);
}
?>
<?php
if(php_sapi_name() == "cli")
{
echo("*** Beginning main build sequence ***\n");
echo("Reading in module index...\n");
}
$module_index = json_decode(file_get_contents("module_index.json"));
$module_list = [];
foreach($module_index as $module)
{
// If the module is optional, the module's id isn't present in the command line arguments, and the special 'all' module id wasn't passed in, skip it
if($module->optional &&
(
isset($argv) &&
strrpos(implode(" ", $argv), $module->id) === false &&
!in_array("all", $argv)
)
)
continue;
$module_list[] = $module->id;
}
if(isset($_GET["modules"]))
{
$module_list = explode(",", $_GET["modules"]);
}
if(php_sapi_name() != "cli")
{
header("content-type: text/php");
header("content-disposition: attachment; filename=\"index.php\"");
}
if(php_sapi_name() == "cli") echo("Reading in core files...");
$core = file_get_contents("core.php");
$settings = file_get_contents("settings.fragment.php");
$settings = str_replace([ "<?php", "?>" ], "", $settings);
$core = str_replace([
"//{settings}",
"{version}",
"{commit}",
"{guiconfig}",
"{default-css}"
], [
$settings,
trim(file_get_contents("version")),
exec("git rev-parse HEAD"),
trim(file_get_contents("peppermint.guiconfig.json")),
trim(file_get_contents("theme_default.css"))
], $core);
$result = $core;
foreach($module_list as $module_id)
{
if($module_id == "") continue;
if(php_sapi_name() == "cli") echo("Adding $module_id\n");
$module_filepath = "modules/" . preg_replace("[^a-zA-Z0-9\-]", "", $module_id) . ".php";
//echo("id: $module_id | filepath: $module_filepath\n");
if(!file_exists($module_filepath))
{
http_response_code(400);
exit("Failed to load module with name: $module_filepath");
}
$modulecode = file_get_contents($module_filepath);
$modulecode = str_replace([ "<?php", "?>" ], "", $modulecode);
$result = str_replace(
"// %next_module% //",
"$modulecode\n// %next_module% //",
$result);
}
if(php_sapi_name() == "cli")
{
if(file_exists("build/index.php"))
{
echo("index.php already exists in the build folder, exiting\n");
exit(1);
}
else
{
echo("Done. Saving to disk...");
file_put_contents("build/index.php", $result);
echo("complete!\n");
echo("*** Build completed! ***\n");
}
}
else
{
exit($result);
}
?>