forked from FreePBX/backup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
page.backup_templates.php
70 lines (62 loc) · 1.6 KB
/
page.backup_templates.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
62
63
64
65
66
67
68
69
70
<?php
if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
$get_vars = array(
'action' => '',
'desc' => '',
'display' => '',
'exclude' => '',
'id' => '',
'name' => '',
'path' => '',
'submit' => '',
'type' => ''
);
foreach ($get_vars as $k => $v) {
$var[$k] = isset($_REQUEST[$k]) ? $_REQUEST[$k] : $v;
}
//set action to delete if delete was pressed instead of submit
if ($var['submit'] == _('Delete') && $var['action'] == 'save') {
$var['action'] = 'delete';
}
//action actions
switch ($var['action']) {
case 'save':
$var['id'] = backup_put_template($var);
break;
case 'delete':
$var['id'] = backup_del_template($var['id']);
break;
}
//view actions
switch ($var['action']) {
case 'edit':
case 'save':
$var = array_merge($var, backup_get_template($var['id']));
//template id's are all prefixed by their module name for hooking reasons. Clear that past this point
if (strpos($var['id'], 'backup-') === 0) {
$var['id'] = substr($var['id'], 7);
}
$content = load_view(dirname(__FILE__) . '/views/templates/template.php', $var);
break;
default:
$content = load_view(dirname(__FILE__) . '/views/templates/templates.php', $var);
break;
}
$heading = _("Templates");
?>
<div class="container-fluid">
<h1><?php echo $heading?></h1>
<div class = "display full-border">
<div class="row">
<div class="col-sm-12">
<div class="fpbx-container">
<div class="display <?php echo !empty($_REQUEST['action']) ? 'full' : 'no'?>-border">
<?php echo $content ?>
</div>
</div>
</div>
</div>
</div>
</div>
</br>
</br>