adding new list_pages tool

This commit is contained in:
mcguirepr89
2022-01-25 14:42:47 -05:00
parent 77c61f9a50
commit 087c3f6fb1
3 changed files with 56 additions and 6 deletions
+46
View File
@@ -0,0 +1,46 @@
<?php
// configuration
$url = 'list_scripts.php';
$file = $_POST["page"];
// check if form has been submitted
if (isset($_POST['text']))
{
// save the text contents
file_put_contents($file, $_POST['text']);
// redirect to form again
header(sprintf('Location: %s', $url));
printf('<a href="%s">Moved</a>.', htmlspecialchars($url));
exit();
}
// read the textfile
$text = file_get_contents($file);
?>
<!-- HTML form -->
<head>
<style>
* {
font-family: 'monospace';
}
a {
text-decoration: none;
color: black;
}
form {
text-align: center;
}
</style>
<body style="background-color:rgb(119, 196, 135);">
<form style="height:95%" action="" method="post">
<input style="margin-left:-150px;" type="submit" value="Update" />
<input type="reset" value="Discard Changes" />
<button type="text"><a href="advanced.php">Back</a></button><br>
<textarea name="text" style="font-size:large;width:100%;height:95%;"><?php echo htmlspecialchars($text) ?></textarea>
</form>
</body>
+9 -5
View File
@@ -5,6 +5,10 @@
' Calibri', 'Trebuchet MS', 'sans-serif';
box-sizing: border-box;
}
button {
font-size: large;
padding: 5px;
}
/* Create two unequal columns that floats next to each other */
.column {
float: left;
@@ -80,7 +84,7 @@ width: 100%;
</style>
<div class="row">
<div class="column first">
<form action="edit_scripts.php" method="POST">
<form action="edit_pages.php" method="POST" id="form1">
<?php
function printFoldersRecursive($dir) {
$allfiles = array();
@@ -89,7 +93,7 @@ function printFoldersRecursive($dir) {
if (is_dir($dir)){
if ($dh = opendir($dir)){
while (($file = readdir($dh)) !== false){
if($file != '.' && $file != '..' && $file != 'By_Date' && $file != 'By_Common_Name' && $file != 'By_Scientific_Name' && $file != 'Charts' && $file != 'Processed' && $file != '.git' && $file != '.github' && $file != 'phpsysinfo' && $file != '.DS_Store'){
if($file != '.' && $file != '..' && $file != 'By_Date' && $file != 'By_Common_Name' && $file != 'By_Scientific_Name' && $file != 'Charts' && $file != 'Processed' && $file != '.git' && $file != '.github' && $file != 'phpsysinfo' && $file != '.DS_Store' && $file != 'birdnet' && $file != 'scripts'){
$allfiles[] = $file;
}
}
@@ -100,14 +104,14 @@ function printFoldersRecursive($dir) {
sort($allfiles);
foreach($allfiles as $file) {
echo "<input name=\"script\" type=\"submit\" value=\"$file\">";
echo "<button name=\"page\" type=\"submit\" form=\"form1\" value=\"$dir/$file\">$file</button><br>";
if(is_dir($dir.'/'.$file)){
printFoldersRecursive($dir.'/'.$file);
printFoldersRecursive($dir.'/'.$file);
}
}
}
printFoldersRecursive('../../BirdSongs/Extracted');
printFoldersRecursive('/home/pi/BirdNET-Pi');
?>
</form>
</div>
+1 -1
View File
@@ -89,7 +89,7 @@ function printFoldersRecursive($dir) {
if (is_dir($dir)){
if ($dh = opendir($dir)){
while (($file = readdir($dh)) !== false){
if($file != '.' && $file != '..') {
if($file != '.' && $file != '..' && $file != 'birdnet' && $file != '.git') {
$allfiles[] = $file;
}
}