3 include("t_config.php");
8 <title>ewikictl (www-only interface)</title>
9 <link rel="stylesheet" type="text/css" href="t_config.css">
11 <body bgcolor="#ffffff" text="#000000">
12 <h1>ewikictl<sup><small>/web</small></sup></h1>
16 if (empty($_REQUEST["action"])) {
20 <tt>ewikictl</tt> is a commandline tool, ought to be used from within
21 a shell account on your Web server. If your provider doesn't give you
22 that you have to stick to the features that can be provided through
23 this www-only interface.
26 You often need to prepare a www-deamon writeable directory, into
27 which you upload files before or download from after execution of one
28 of the actions. Inconvinient as it is, this is the only way to work
34 <table border="0" width="85%">
36 <td width="50%" valign="top" class="add-border-right">
42 "dest" => array("", "", "directory", "(must exist on web server and be world-writeable)"),
43 "format" => array(array(
44 "fast" => "fast files (recommended)",
45 "flat" => "flat files (rfc822 format)",
46 "plain" => "plain text pages",
47 "meta" => "plain text companion .meta",
48 "xmlmeta" => "plain with .meta in xml",
49 "xml" => "XML-like format",
50 "sql" => "MySQL INSERT (backup only)",
51 ), "select", "file format", "(not all can be imported again!)<br>"),
52 "all" => array("1", "x", "all versions", "backs up database fully"),
53 "enc" => array("1", "x", "urlencode", "makes filenames DOS/Win-compatible"),
54 "force" => array("1", "checkbox", "force", "don't stop on errors"),
59 <td width="50%" valign="top">
65 "source" => array("", "", "directory", "(you must upload the backed up files there beforehand)"),
66 "format" => array(array(
67 "fast" => "fast files (serialized)",
68 "flat" => "flat files (message/http)",
69 "plain" => "plain text pages",
70 ), "select", "file format", "<br>"),
71 "all" => array("1", "x", "versioned files", "if they have .NNN extensions"),
72 "keep" => array("1", "x", "keep", "don't overwrite existing page versions"),
73 "dec" => array("1", "x", "urldecode filenames", "from Win-sys"),
74 "force" => array("1", "checkbox", "force", "don't stop on errors"),
83 <table border="0" width="80%">
85 <td width="60%" valign="top" class="add-border-right">
87 Removes older revisions (in given range) from all pages. It can
88 automatically make a backup of the killed data.
94 "holes_start" => array("2", "", "keep versions", "how many of the first few versions to keep (no 1 must remain for flat file databases!)"),
95 "holes_end" => array("-10", "", "kill from end", "that many versions shall remain at the end (minimum is 1 here of course!)<br>"),
96 "dest" => array("", "", "backup dir", "(must exist on web server and be world-writeable)"),
97 "format" => array(array(
98 "fast" => "fast files",
99 "flat" => "flat files",
100 "plain" => "plain text",
101 ), "select", "backup format", "<br>"),
102 "all" => array("1", "x", "backup all", "(implicit)"),
103 "enc" => array("1", "x", "backup filnames encode", ""),
104 "force" => array("1", "checkbox", "force", "don't stop on errors"),
109 <td width="40%" valign="top">
111 to learn about new features in the commandline version ;)
125 <table border="0" width="99%">
127 <td width="25%" valign="top" class="add-border-right">
129 shows a wide list of all existing pages, including flags, size
130 author name and timestamp (like 'ls -l' under Unix)
138 <td width="40%" valign="top" class="add-border-right">
144 "0" => array("", "", "from", "(pagenames)"),
145 "1" => array("", "", "to"),
150 <td width="40%" valign="top" class="add-border-right">
156 "file" => array("SandBox", "", "page", ""),
157 "0" => array("+TEXT,-OFF", "", "flags", "can be either decimal (54), octal (0377) or hex (0x137f) - or a combination of <a href=\"t_commander/info.php\">flag abbreviations</a> separated by comma, + or a - sign<br> like <tt>+HTM,WRITE,-OFF</tt>"),
162 <td width="40%" valign="top">
164 deletes a page completely (with all its versions)<br><br>
169 "0" => array("SandBox", "", "page", ""),
180 There are equations for some of the above commands in the collection
181 of <a href=".">database tools</a>, that sometimes provide more options
182 or are easier to use.
197 $action = $_REQUEST["action"];
200 $argv[0] = "t_ewikictl";
201 $argv[1] = "--$action";
203 // special treatment to
204 if ($action == "holes") {
205 $argv[] = $_REQUEST["holes_start"] . ".." . $_REQUEST["holes_end"];
207 if (($action == "holes") && ($dir = $_REQUEST["dir"])) {
208 $argv[] = "--backup";
212 foreach ($_REQUEST as $field=>$str) {
213 if (is_int($field) && $str) {
218 // take common --args asis
219 foreach (array("force", "dest", "source", "dir", "all",
220 "urlencode", "urldecode", "keep", "db", "file")
223 if ($str = $_REQUEST[$field]) {
224 $argv[] = "--$field";
233 echo "<h3>--$action</h3>\n<br>\n";
236 $GLOBALS["argv"] = $_SERVER["argv"] = $argv;
237 $GLOBALS["argv"] = $_SERVER["argc"] = count($argv);
238 $_SERVER["SERVER_SOFTWARE"] = 0;
242 $text = ob_get_contents();
245 $text = htmlentities($text);
246 $text = preg_replace('/\033\[([\d;]+)m/e', 'ansiesc2font("$1")', $text);
247 echo '<pre style="background:#111611;color:white;font:monospace;display:block;padding:5px;">'
253 }// end of everything here
258 #-- output form for one action
259 function aform($action, $args) {
261 echo '<form action="t_ewikictl.php">';
262 echo "\n<input type=\"hidden\" name=\"action\" value=\"$action\">\n";
263 foreach ($args as $i=>$l) {
264 echo "<label for=\"$i$xn\">$l[2]</label> ";
265 if (is_array($l[0])) {
266 echo "<select name=\"$i\" id=\"$i\">";
267 foreach ($l[0] as $v=>$vd) {
268 echo "<option value=\"$v\">$vd</option>";
273 if (!strlen($l[1])) {
276 elseif ($l[1]=="x") {
277 $l[1] = 'checkbox" checked="checked';
279 echo "<input type=\"$l[1]\" name=\"$i\" id=\"$i$xn\" value=\"$l[0]\">\n";
281 echo "<small>$l[3]</small>\n<br>\n";
283 echo '<input type="submit" value="do">';
290 function ansiesc2font($str) {
292 "black", "red", "green", "magenta", "blue", "yellow", "grey", "white",
294 foreach (explode(";", $str) as $n) {
295 $col = $cols[0 + ((0+$n) % 10)];
296 if (($n == "37") or ($n == "0") or ($n == "27")) {
300 return "<b style=\"background:$col\">";
303 return "<b style=\"color:$col\">";