1
|
|
|
<?php |
2
|
|
|
if ($this->CheckLogin("layout") && $this->CheckConfig()) { |
3
|
|
|
// first make sure that the object is clean (data can only be set via |
4
|
|
|
// the defined interface: $arCallArgs) |
5
|
|
|
$this->data=current($this->get(".","system.get.data.phtml")); |
6
|
|
|
|
7
|
|
|
// check arguments, remove ".." |
8
|
|
|
$type=str_replace("..",".",$this->getvar("type")); |
9
|
|
|
$function=str_replace("..",".",$this->getvar("function")); |
10
|
|
|
$language=str_replace("..",".",$this->getvar("language")); |
11
|
|
|
|
12
|
|
|
$template_dir=$this->path."class=/".$type."/"; |
13
|
|
|
$template_path=$template_dir.$function.".".$language; |
14
|
|
|
|
15
|
|
|
if (preg_match("/^[a-z0-9\._-]+$/i",$function)) { |
16
|
|
|
if (isset($this->data->config->pinp[$type][$function][$language])) { |
17
|
|
|
unset($this->data->config->pinp[$type][$function][$language]); |
18
|
|
View Code Duplication |
if (count($this->data->config->pinp[$type][$function])==0) { |
19
|
|
|
unset($this->data->config->pinp[$type][$function]); |
20
|
|
|
if (count($this->data->config->pinp[$type])==0) { |
21
|
|
|
unset($this->data->config->pinp[$type]); |
22
|
|
|
} |
23
|
|
|
} |
24
|
|
|
if (isset($this->data->config->templates[$type][$function][$language])) { |
25
|
|
|
// Store the old template information in deleted_templates for SVN to use. |
26
|
|
|
if ($AR->SVN->enabled) { |
27
|
|
|
is_array($this->data->config->deleted_templates) ? false : $this->data->config->deleted_templates = array(); |
28
|
|
|
is_array($this->data->config->deleted_templates[$type]) ? false : $this->data->config->deleted_templates[$type] = array(); |
29
|
|
|
is_array($this->data->config->deleted_templates[$type][$function]) ? false : $this->data->config->deleted_templates[$type][$function] = array(); |
30
|
|
|
$this->data->config->deleted_templates[$type][$function][$language] = $this->data->config->templates[$type][$function][$language]; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
unset($this->data->config->templates[$type][$function][$language]); |
34
|
|
View Code Duplication |
if (count($this->data->config->templates[$type][$function])==0) { |
35
|
|
|
unset($this->data->config->templates[$type][$function]); |
36
|
|
|
if (count($this->data->config->templates[$type])==0) { |
37
|
|
|
unset($this->data->config->templates[$type]); |
38
|
|
|
} |
39
|
|
|
} |
40
|
|
|
} |
41
|
|
|
if (isset($this->data->config->privatetemplates[$type][$function])) { |
42
|
|
|
// Store the old template information in deleted_privatetemplates for SVN to use. |
43
|
|
|
if ($AR->SVN->enabled) { |
44
|
|
|
is_array($this->data->config->deleted_privatetemplates) ? false : $this->data->config->deleted_privatetemplates = array(); |
45
|
|
|
is_array($this->data->config->deleted_privatetemplates[$type]) ? false : $this->data->config->deleted_privatetemplates[$type] = array(); |
46
|
|
|
$this->data->config->deleted_privatetemplates[$type][$function] = $this->data->config->privatetemplates[$type][$function]; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
unset($this->data->config->privatetemplates[$type][$function][$language]); |
50
|
|
View Code Duplication |
if (count($this->data->config->privatetemplates[$type][$function])==0) { |
51
|
|
|
unset($this->data->config->privatetemplates[$type][$function]); |
52
|
|
|
if (count($this->data->config->privatetemplates[$type])==0) { |
53
|
|
|
unset($this->data->config->privatetemplates[$type]); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
$template=$type.".".$function.".".$language; |
58
|
|
|
$templates=$this->store->get_filestore("templates"); |
59
|
|
|
$templates->remove($this->id, $template); |
60
|
|
|
$templates->remove($this->id, $template.".pinp"); |
61
|
|
|
$templates->remove($this->id, $template.".inc"); |
62
|
|
|
$this->save(); |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
?> |
|
|
|
|
67
|
|
|
|
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.