Compare commits
No commits in common. "master" and "v0.1" have entirely different histories.
@ -2,7 +2,6 @@
|
|||||||
class Page
|
class Page
|
||||||
{
|
{
|
||||||
public $name, $filename;
|
public $name, $filename;
|
||||||
public static $parentDir = "../";
|
|
||||||
public static $contentFolder = "content/";
|
public static $contentFolder = "content/";
|
||||||
|
|
||||||
public function __construct($name, $filename)
|
public function __construct($name, $filename)
|
||||||
@ -27,24 +26,11 @@ class Page
|
|||||||
return $this->filename;
|
return $this->filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function nodir($item)
|
|
||||||
{
|
|
||||||
return (!is_dir(Page::$parentDir . Page::$contentFolder . $item));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function fileList()
|
|
||||||
{
|
|
||||||
$dirContent = scandir(Page::$parentDir . Page::$contentFolder);
|
|
||||||
$files = (array_filter($dirContent, "Page::nodir"));
|
|
||||||
return $files;
|
|
||||||
}
|
|
||||||
|
|
||||||
// For future-uses...
|
// For future-uses...
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
function start_html($title)
|
function start_html($title)
|
||||||
{
|
{
|
||||||
print "
|
print "
|
||||||
<!DOCTYPE html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>$title</title>
|
<title>$title</title>
|
||||||
</head>
|
</head>
|
||||||
|
@ -3,7 +3,6 @@ function terminate($message="")
|
|||||||
{
|
{
|
||||||
print "$message\n";
|
print "$message\n";
|
||||||
footer();
|
footer();
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -78,6 +78,7 @@ $contactPage = new Page("Contact", "contact.html");
|
|||||||
}
|
}
|
||||||
|
|
||||||
$dirContent = scandir(Page::$contentFolder);
|
$dirContent = scandir(Page::$contentFolder);
|
||||||
|
|
||||||
$files = (array_filter($dirContent, "nodir"));
|
$files = (array_filter($dirContent, "nodir"));
|
||||||
|
|
||||||
// Iterate through all the files for a match (from ?content=)
|
// Iterate through all the files for a match (from ?content=)
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
<?php
|
|
||||||
require ("../includes/content.php");
|
|
||||||
require ("../includes/miscfunc.php");
|
|
||||||
require ("../includes/htmlcode.php");
|
|
||||||
|
|
||||||
/*regexp to strip away '..', '/' and so forth. Filename must now be in the
|
|
||||||
format of myfile.ext, where myfile can be 1 to 20 chars long (including '-'
|
|
||||||
and '_') and ext can be
|
|
||||||
from 1 to 4 chars.*/
|
|
||||||
$filename = $_GET['file'];
|
|
||||||
preg_match_all("/[a-z_\-0-9]{1,30}\.[a-z]{1,4}/i", $filename, $checkedFilename);
|
|
||||||
$file = Page::$parentDir . Page::$contentFolder . $checkedFilename[0][0];
|
|
||||||
|
|
||||||
if(isset($_POST['content']))
|
|
||||||
{
|
|
||||||
$postedContent = $_POST['content'];
|
|
||||||
file_put_contents($file, $postedContent);
|
|
||||||
}
|
|
||||||
start_html("Edit file");
|
|
||||||
print "<form action=\"\" method=\"post\">\n";
|
|
||||||
$content = file_get_contents($file);
|
|
||||||
print "<textarea name='content' cols='80' rows='30'>\n" . ($content) . "\n</textarea>";
|
|
||||||
print "<br/>\n
|
|
||||||
<input type=\"submit\" value=\"Save file\"/>
|
|
||||||
</form>";
|
|
||||||
end_html();
|
|
||||||
|
|
||||||
?>
|
|
@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
require ("../includes/content.php");
|
|
||||||
require ("../includes/miscfunc.php");
|
|
||||||
|
|
||||||
$files = Page::fileList();
|
|
||||||
foreach($files as $file)
|
|
||||||
{
|
|
||||||
print "<a href=\"editfile.php?file=$file\">$file</a><br/>\n";
|
|
||||||
}
|
|
||||||
?>
|
|
@ -12,9 +12,6 @@ include "../includes/login.inc";
|
|||||||
<a href="edit.php">Edit existing post</a>
|
<a href="edit.php">Edit existing post</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="editfiles.php">Edit content files</a>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<a href="logout.php">Logout</a>
|
<a href="logout.php">Logout</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user