adding new list_pages tool
This commit is contained in:
@@ -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>
|
||||||
@@ -5,6 +5,10 @@
|
|||||||
' Calibri', 'Trebuchet MS', 'sans-serif';
|
' Calibri', 'Trebuchet MS', 'sans-serif';
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
button {
|
||||||
|
font-size: large;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
/* Create two unequal columns that floats next to each other */
|
/* Create two unequal columns that floats next to each other */
|
||||||
.column {
|
.column {
|
||||||
float: left;
|
float: left;
|
||||||
@@ -80,7 +84,7 @@ width: 100%;
|
|||||||
</style>
|
</style>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="column first">
|
<div class="column first">
|
||||||
<form action="edit_scripts.php" method="POST">
|
<form action="edit_pages.php" method="POST" id="form1">
|
||||||
<?php
|
<?php
|
||||||
function printFoldersRecursive($dir) {
|
function printFoldersRecursive($dir) {
|
||||||
$allfiles = array();
|
$allfiles = array();
|
||||||
@@ -89,7 +93,7 @@ function printFoldersRecursive($dir) {
|
|||||||
if (is_dir($dir)){
|
if (is_dir($dir)){
|
||||||
if ($dh = opendir($dir)){
|
if ($dh = opendir($dir)){
|
||||||
while (($file = readdir($dh)) !== false){
|
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;
|
$allfiles[] = $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,14 +104,14 @@ function printFoldersRecursive($dir) {
|
|||||||
sort($allfiles);
|
sort($allfiles);
|
||||||
|
|
||||||
foreach($allfiles as $file) {
|
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)){
|
if(is_dir($dir.'/'.$file)){
|
||||||
printFoldersRecursive($dir.'/'.$file);
|
printFoldersRecursive($dir.'/'.$file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printFoldersRecursive('../../BirdSongs/Extracted');
|
printFoldersRecursive('/home/pi/BirdNET-Pi');
|
||||||
?>
|
?>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ function printFoldersRecursive($dir) {
|
|||||||
if (is_dir($dir)){
|
if (is_dir($dir)){
|
||||||
if ($dh = opendir($dir)){
|
if ($dh = opendir($dir)){
|
||||||
while (($file = readdir($dh)) !== false){
|
while (($file = readdir($dh)) !== false){
|
||||||
if($file != '.' && $file != '..') {
|
if($file != '.' && $file != '..' && $file != 'birdnet' && $file != '.git') {
|
||||||
$allfiles[] = $file;
|
$allfiles[] = $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user