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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
<?php
/*
* All code copyright 2013-2020 XplorIt LLC llc.
* Created in the Cerebrate Aquarium by douglasrhiner
* createvtour.com
* enc_xml.php
* 2/21/18
* 11:36 AM
*/
include_once $_SERVER['DOCUMENT_ROOT'] . "/conf/loader.inc.php";
ob_start();
include_once XP_LIBRARY . "xml/get_transition_xml.php";
$obContent = ob_get_contents();
ob_end_clean();
if (boolval(SECURE)) {
$rec_log = true;
$log_output .= "as SECURE";
// begin forming the file name
$my_filename = "enc_xml_";
// custom identifier
if (isset($_COOKIE['sess_ref']) && !empty($_COOKIE['sess_ref'])) {
$my_filename .= $_COOKIE['sess_ref'];
} elseif (isset($_GET['xSessionId']) && !empty($_GET['xSessionId'])) {
$my_filename .= $_GET['xSessionId'];
} else {
$my_filename .= md5(microtime());
};
// suffix
$my_filename .= ".xml";
$rec_log = true;
$log_output = 'TRANSITION, ' . date('Y-m-d H:i:s') . ", ";
if ($fpc = file_put_contents($my_filename, $obContent)) {
// lets make sure krpanotools is registered. Over-abundance of caution here.
$reg_code = " ** YOUR REG CODE HERE ** ";
$output = array();
$return_var = 0;
exec(KRTOOLS_PATH . ' register ' . $reg_code, $output, $return_var);
// forming the file name
$my_file_path = KRENC_PATH;
$my_file_path .= $my_filename;
// command string
$this_command = KRTOOLS_PATH . ' encrypt -p -in=' . $my_file_path . ' -out=stdout';
// encrypt
$this_process = new process($this_command);
if (is_resource($this_process->resource)) {
$counter = 0;
while ($this_process->is_running()) {
$counter = $counter + 1;
}
$exit_data = $this_process->get_exitcode();
$log_output .= "command -> " . $exit_data['command'] . ", ";
$log_output .= "\n";
$log_output .= $this_process->get_elapsed();
$log_output .= "\n";
$log_output .= "pid -> " . $exit_data['pid'] . ", ";
$log_output .= "running -> " . $exit_data['running'] . ", ";
$log_output .= "signaled -> " . $exit_data['signaled'] . ", ";
$log_output .= "stopped -> " . $exit_data['stopped'] . ", ";
$log_output .= "exitcode -> " . $exit_data['exitcode'] . ", ";
$log_output .= "termsig -> " . $exit_data['termsig'] . ", ";
$log_output .= "stopsig -> " . $exit_data['stopsig'] . ", ";
if ($err = stream_get_contents($this_process->pipes[2])) {
$log_output .= "PIPED ERROR -> $err, ";
fclose($this_process->pipes[2]);
$the_output = $obContent;
} else {
fclose($this_process->pipes[2]);
if ($out = stream_get_contents($this_process->pipes[1])) {
$the_output = $out;
unlink($my_filename);
$rec_log = false;
} else {
$log_output .= "\nERROR NOT DELETED, ";
}
fclose($this_process->pipes[1]);
}
proc_close($this_process->resource);
}
} else {
$rec_log = true;
$the_output = $obContent;
$log_output .= "file_put_contents ERROR";
};
/*
$rec_log = true;
$the_output = $obContent;
$log_output .= "file_put_contents ERROR";
*/
} else {
$the_output = $obContent;
};
echo $the_output;
if ($rec_log) {
file_put_contents('enc_error_log.txt', $log_output . "\n\n", FILE_APPEND);
}
exit();
|