initial code from release 2.3.1
--HG-- extra : convert_revision : svn%3Ab267cdba-c1da-11dd-874b-8bacd04a0a74/trunk%402
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
$a = (isset($_GET["action"]) ? $_GET["action"] : false);
|
||||
switch ($a) {
|
||||
case "list":
|
||||
$files = glob("data/*");
|
||||
foreach ($files as $file) {
|
||||
$name = basename($file);
|
||||
echo $name."\n";
|
||||
}
|
||||
break;
|
||||
case "save":
|
||||
$keyword = (isset($_GET["keyword"]) ? $_GET["keyword"] : "");
|
||||
$keyword = "data/".basename($keyword);
|
||||
$f = fopen($keyword, "w");
|
||||
$data = file_get_contents("php://input");
|
||||
if (get_magic_quotes_gpc() || get_magic_quotes_runtime()) {
|
||||
$data = stripslashes($data);
|
||||
}
|
||||
fwrite($f, $data);
|
||||
fclose($f);
|
||||
header("HTTP/1.0 201 Created");
|
||||
break;
|
||||
case "load":
|
||||
$keyword = (isset($_GET["keyword"]) ? $_GET["keyword"] : "");
|
||||
$keyword = "data/".basename($keyword);
|
||||
if (!file_exists($keyword)) {
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
} else {
|
||||
header("Content-type: text/xml");
|
||||
echo file_get_contents($keyword);
|
||||
}
|
||||
break;
|
||||
default: header("HTTP/1.0 501 Not Implemented");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user