forked from mekhall/Das-Rebussystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatic.php
executable file
·61 lines (48 loc) · 1.26 KB
/
static.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/php
<?php
global $argv,$argc;
if (count($argv) < 2) {
echo "$argv[0] <dir>\n";
exit(1);
}
require_once 'rebus.php';
require_once 'present_setup.php';
$dir = $argv[1];
mkdir($dir, 0755, true);
function dcopy($src, $ddir) {
$base = basename($src);
copy($src, "$ddir/$base");
}
dcopy(NAME . ".css", $dir);
dcopy("tratex_vit.ttf", $dir);
dcopy("jquery-2.1.4.min.js", $dir);
dcopy("d3.v3.min.js", $dir);
foreach (glob(PICTURE_PATH . "*.jpg") as $f) {
dcopy($f, $dir);
}
foreach (glob(PICTURE_PATH . "*.png") as $f) {
dcopy($f, $dir);
}
foreach (glob(PICTURE_PATH . "*.gif") as $f) {
dcopy($f, $dir);
}
foreach (glob(PICTURE_PATH . "*.jfif") as $f) {
dcopy($f, $dir);
}
chdir($dir);
$GLOBALS['index_links'] = 1;
$GLOBALS['rebus_split'] = 0;
$static = 1;
for ($xnr = 0; $xnr < count($actions); ++$xnr) {
$_GET['nr'] = $xnr;
ob_start();
require 'present.php';
$out = ob_get_clean();
$out = preg_replace('/present.php\?nr=(\d+)/', 'page$1.html', $out);
$out = preg_replace('/present.php\?nr=(.*);/', 'page$1 + ".html";', $out);
$out = preg_replace('#' . PICTURE_URL . '\\/?#', '', $out);
$out = preg_replace('#' . NAME . '\\\\/#', '', $out);
file_put_contents("page$nr.html", $out);
}
copy("page0.html", "index.html");
?>