1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-21 16:13:00 +00:00

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

202
pack.php
View file

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