-
Notifications
You must be signed in to change notification settings - Fork 1
/
exam_data_soap__bv.php
209 lines (177 loc) · 4.94 KB
/
exam_data_soap__bv.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
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<?php
session_start(); // Initialize session data
ob_start(); // Turn on output buffering
?>
<?php include "ewcfg6.php" ?>
<?php include "ewmysql6.php" ?>
<?php include "phpfn6.php" ?>
<?php include "exam_data_info.php" ?>
<?php include "userfn6.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php
// Define page object
$exam_data_Soap_blobview = new cexam_data_Soap_blobview();
$Page =& $exam_data_Soap_blobview;
// Page init processing
$exam_data_Soap_blobview->Page_Init();
// Page main processing
$exam_data_Soap_blobview->Page_Main();
?>
<?php
//
// Page Class
//
class cexam_data_Soap_blobview {
// Page ID
var $PageID = 'blobview';
// Page Object Name
var $PageObjName = 'exam_data_Soap_blobview';
// Page Name
function PageName() {
return ew_CurrentPage();
}
// Page Url
function PageUrl() {
$PageUrl = ew_CurrentPage() . "?";
return $PageUrl;
}
// Message
function getMessage() {
return @$_SESSION[EW_SESSION_MESSAGE];
}
function setMessage($v) {
if (@$_SESSION[EW_SESSION_MESSAGE] <> "") { // Append
$_SESSION[EW_SESSION_MESSAGE] .= "<br>" . $v;
} else {
$_SESSION[EW_SESSION_MESSAGE] = $v;
}
}
// Show Message
function ShowMessage() {
if ($this->getMessage() <> "") { // Message in Session, display
echo "<p><span class=\"ewMessage\">" . $this->getMessage() . "</span></p>";
$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
}
}
// Validate Page request
function IsPageRequest() {
return TRUE;
}
//
// Class initialize
// - init objects
// - open connection
//
function cexam_data_Soap_blobview() {
global $conn;
// Initialize table object
$GLOBALS["exam_data"] = new cexam_data();
// Intialize page id (for backward compatibility)
if (!defined("EW_PAGE_ID"))
define("EW_PAGE_ID", 'blobview', TRUE);
// Initialize table name (for backward compatibility)
if (!defined("EW_TABLE_NAME"))
define("EW_TABLE_NAME", 'exam_data', TRUE);
// Open connection to the database
$conn = ew_Connect();
}
//
// Page_Init
//
function Page_Init() {
global $gsExport, $gsExportFile, $exam_data;
// Page load event, used in current page
$this->Page_Load();
}
//
// Page_Terminate
// - called when exit page
// - if URL specified, redirect to the URL
//
function Page_Terminate($url = "") {
global $conn;
// Page unload event, used in current page
$this->Page_Unload();
// Close Connection
$conn->Close();
// Go to URL if specified
if ($url <> "") {
ob_end_clean();
header("Location: $url");
}
exit();
}
//
// Page main processing
//
function Page_Main() {
global $conn, $exam_data;
// Get key
if (@$_GET["ExamDataNo"] <> "") {
$exam_data->ExamDataNo->setQueryStringValue($_GET["ExamDataNo"]);
} else {
$this->Page_Terminate(); // Exit
exit();
}
$objBinary = new cUpload('exam_data', 'x_Soap');
// Show thumbnail
$bShowThumbnail = (@$_GET["showthumbnail"] == "1");
if (@$_GET["thumbnailwidth"] == "" && @$_GET["thumbnailheight"] == "") {
$iThumbnailWidth = EW_THUMBNAIL_DEFAULT_WIDTH; // Set default width
$iThumbnailHeight = EW_THUMBNAIL_DEFAULT_HEIGHT; // Set default height
} else {
if (@$_GET["thumbnailwidth"] <> "") {
$iThumbnailWidth = $_GET["thumbnailwidth"];
if (!is_numeric($iThumbnailWidth) || $iThumbnailWidth < 0) $iThumbnailWidth = 0;
}
if (@$_GET["thumbnailheight"] <> "") {
$iThumbnailHeight = $_GET["thumbnailheight"];
if (!is_numeric($iThumbnailHeight) || $iThumbnailHeight < 0) $iThumbnailHeight = 0;
}
}
if (@$_GET["quality"] <> "") {
$quality = $_GET["quality"];
if (!is_numeric($quality)) $quality = 75; // Set Default
} else {
$quality = 75;
}
$sFilter = $exam_data->KeyFilter();
// Set up filter (SQL WHERE clause) and get return SQL
// SQL constructor in exam_data class, exam_datainfo.php
$exam_data->CurrentFilter = $sFilter;
$sSql = $exam_data->SQL();
if ($rs = $conn->Execute($sSql)) {
if (!$rs->EOF) {
if (strpos(ew_ServerVar("HTTP_USER_AGENT"), "MSIE") === FALSE)
header("Content-type: images");
$objBinary->Value = $rs->fields('Soap');
if ($bShowThumbnail) {
ew_ResizeBinary($objBinary->Value, $iThumbnailWidth, $iThumbnailHeight, $quality);
}
$data = $objBinary->Value;
if (substr($data, 0, 2) == "PK" && strpos($data, "[Content_Types].xml") > 0 &&
strpos($data, "_rels") > 0 && strpos($data, "docProps") > 0) { // Fix Office 2007 documents
if (substr($data, -4) <> "\0\0\0\0")
$data .= "\0\0\0\0";
}
echo $data;
}
$rs->Close();
}
}
// Page Load event
function Page_Load() {
//echo "Page Load";
}
// Page Unload event
function Page_Unload() {
//echo "Page Unload";
}
}
?>