420 |
florian |
1 |
<?php
|
|
|
2 |
/*
|
|
|
3 |
*/
|
|
|
4 |
if (!defined("WIKINI_VERSION"))
|
|
|
5 |
{
|
|
|
6 |
die ("accès direct interdit");
|
|
|
7 |
}
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
if ($this->HasAccess("write") && $this->HasAccess("read"))
|
|
|
11 |
{
|
|
|
12 |
|
|
|
13 |
// Edition
|
|
|
14 |
if ($_POST["submit"] != 'Aperçu' && $_POST["submit"] != 'Sauver') {
|
|
|
15 |
|
|
|
16 |
require_once('tools/hashcash/secret/wp-hashcash.lib');
|
|
|
17 |
|
|
|
18 |
// UPDATE RANDOM SECRET
|
|
|
19 |
$curr = @file_get_contents(HASHCASH_SECRET_FILE);
|
|
|
20 |
if(empty($curr) || (time() - @filemtime(HASHCASH_SECRET_FILE)) > HASHCASH_REFRESH){
|
|
|
21 |
|
|
|
22 |
// update our secret
|
|
|
23 |
$fp = fopen(HASHCASH_SECRET_FILE, 'w');
|
|
|
24 |
|
|
|
25 |
if(@flock($fp, LOCK_EX)){
|
|
|
26 |
fwrite($fp, rand(21474836, 2126008810));
|
|
|
27 |
@flock($fp, LOCK_UN);
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
fclose($fp);
|
|
|
31 |
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
if (substr($this->config['base_url'],0,4)!="http") { // Wakka.config mal configure
|
|
|
35 |
$base_url="http://".$_SERVER["SERVER_NAME"].($_SERVER["SERVER_PORT"] != 80 ? ":".$_SERVER["SERVER_PORT"] : "").$_SERVER["REQUEST_URI"].(preg_match("/".preg_quote("wakka.php")."$/", $_SERVER["REQUEST_URI"]) ? "?wiki=" : "");
|
|
|
36 |
$a = parse_url($base_url);
|
|
|
37 |
}
|
|
|
38 |
else {
|
|
|
39 |
$a = parse_url($this->config['base_url']);
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
$siteurl = ($a['scheme'].'://'.$a['host'].dirname($a['path']));
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
$ChampsHashcash =
|
|
|
46 |
'<script type="text/javascript" src="' . $siteurl . '/tools/hashcash/wp-hashcash-js.php?siteurl='.$siteurl.'"></script>';
|
|
|
47 |
|
|
|
48 |
$plugin_output_new=preg_replace ('/\<input name=\"submit\" type=\"submit\" value=\"Sauver\"/',
|
|
|
49 |
$ChampsHashcash.'<input name="submit" type="submit" value="Sauver"', $plugin_output_new);
|
|
|
50 |
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
?>
|