-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpull.php
More file actions
68 lines (67 loc) · 1.75 KB
/
pull.php
File metadata and controls
68 lines (67 loc) · 1.75 KB
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
62
63
64
65
66
67
68
<?php
$conf = include(dirname(__FILE__)."/conf.php");
include(dirname(dirname(__FILE__))."/Teinte/Build.php");
if (php_sapi_name() == "cli") {
work($conf);
exit();
}
?>
<html>
<head>
<meta charset="UTF-8" />
<title>Administration, haine du théâtre</title>
<link rel="stylesheet" type="text/css" href="../Teinte/tei2html.css" />
<style>
label {width: 25em; display: block; text-align: right;}
</style>
</head>
<body>
<div id="center" style="padding: 1em; ">
<h1><a href="pull.php">Administration</a>, <a href="." target="_blank"><?=$conf['title']?></a></h1>
<form method="POST">
<label>Utilisateur
<input name="user"/>
</label>
<label>Mot de passe
<input name="pass" type="password"/>
</label>
<label>Forcer
<input name="force" type="checkbox"/>
<button name="up" type="submit">Mettre à jour</button>
</label>
</form>
<section>
<?php
if (!isset($_POST['user']));
else if (!isset($_POST['pass']));
else if ($_POST['user'] != $conf['user']) {
echo "Mauvais code utilisateur";
}
else if ($_POST['pass'] != $conf['pass']) {
echo "Mauvais mot de passe";
}
else {
work($conf, isset($_POST['force']));
}
?>
</section>
</div>
</body>
</html>
<?php
function work($conf, $force=null) {
if (isset($conf['cmdup'])) {
$getcwd = getcwd();
chdir($conf['srcdir']);
echo 'Mise à jour distante <pre style="white-space: pre-wrap;">'."\n";
passthru($conf['cmdup']);
chdir($getcwd);
echo '</pre>'."\n";
}
echo 'Transformations <pre style="white-space: pre-wrap;">'."\n";
$build = new Teinte_Build($conf);
if ($force) $build->clean();
$build->glob();
echo '</pre>'."\n";
}
?>