forked from tatewake/dokuwiki-plugin-backup
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpref_code.php
More file actions
executable file
·62 lines (51 loc) · 1.4 KB
/
Copy pathpref_code.php
File metadata and controls
executable file
·62 lines (51 loc) · 1.4 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
<?php
/**
* Backup Tool for DokuWiki
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Terence J. Grant<tjgrant@tatewake.com>
*/
$bt_loaded = 0;
function bt_load()
{
global $bt_loaded, $bt_settings;
$bt_file = dirname(__FILE__).'/local_pref.php';
if ($bt_loaded == 0)
{
if(file_exists($bt_file))
{
include($bt_file);
$bt_loaded = 1;
}
}
}
function bt_write($fp, $name, $val)
{
fwrite($fp, '$bt_settings[\''.$name.'\'] = \''.$val.'\';'."\n");
}
function bt_save()
{
global $bt_loaded, $bt_settings;
$bt_file = dirname(__FILE__).'/local_pref.php';
if (is_writable($bt_file) || is_writable(dirname(__FILE__)))
{
$fp = fopen($bt_file, "w");
fwrite($fp, '<?php'."\n// This file is automatically generated\n");
bt_write($fp, 'type', $bt_settings['type']);
bt_write($fp, 'pages', $bt_settings['pages']);
bt_write($fp, 'revisions', $bt_settings['revisions']);
bt_write($fp, 'subscriptions', $bt_settings['subscriptions']);
bt_write($fp, 'media', $bt_settings['media']);
bt_write($fp, 'config', $bt_settings['config']);
bt_write($fp, 'templates', $bt_settings['templates']);
bt_write($fp, 'plugins', $bt_settings['plugins']);
fclose($fp);
// ptln('<div class="success">'.'Backup Tool pref saved successfully.'.'</div>');
}
else
{
ptln('<div class="error">'.'Backup Tool pref is not writable by the server.'.'</div>');
}
}
//Load settings
bt_load();