18 require_once SQ_PACKAGES_PATH.
'/cms/form/form_action/form_action.inc';
19 require_once SQ_ATTRIBUTES_PATH.
'/http_request/http_request.inc';
41 parent::__construct();
54 if (!isset($settings[
'http_request'])) {
55 $req_settings = serialize(Array());
57 $req_settings = $settings[
'http_request'];
63 $http_request->paint($prefix);
76 if (!isset($settings[
'http_request'])) {
77 $req_settings = serialize(Array());
79 $req_settings = $settings[
'http_request'];
85 $http_request->process($prefix);
87 $settings[
'http_request'] = $http_request->value;
102 if (!isset($settings[
'http_request'])) {
103 $req_settings = Array();
105 $req_settings = unserialize($settings[
'http_request']);
108 ?><table
class=
"no-borders">
115 <td
class=
"sq-backend-table-cell" style=
"vertical-align: top"><p><strong><?php echo translate(
'http_request_method'); ?></strong></p></td>
116 <td
class=
"sq-backend-table-cell" style=
"vertical-align: top"><p><?php
119 if (!empty($req_settings[
'method'])) {
120 echo $req_settings[
'method'];
122 ?><span
class=
"sq-backend-warning">No method specified.</span><?php
127 <td
class=
"sq-backend-table-cell" style=
"vertical-align: top"><p><strong><?php echo translate(
'http_request_urls'); ?></strong></p></td>
128 <td
class=
"sq-backend-table-cell" style=
"vertical-align: top"><p><?php
129 if (!empty($req_settings[
'urls'])) {
130 foreach ($req_settings[
'urls'] as $url) {
131 echo ellipsisize($url, 512).
'<br />';
134 ?><span
class=
"sq-backend-warning">No URLs specified.</span><?php
153 $req_settings = $settings[
'http_request'];
158 $current_value = @unserialize($http_request->value);
161 $keywords_list = Array();
162 if (isset($current_value[
'urls'])) {
163 $keywords_list = array_merge(
165 retrieve_keywords_replacements(implode(
', ', $current_value[
'urls']))
169 if (isset($current_value[
'request_headers'])) {
170 $keywords_list = array_merge(
172 retrieve_keywords_replacements(implode(
', ', $current_value[
'request_headers']))
176 if (isset($current_value[
'request_body'])) {
177 $keywords_list = array_merge(
179 retrieve_keywords_replacements($current_value[
'request_body'])
183 if (isset($current_value[
'http_auth_options'])) {
184 $keywords_list = array_merge(
186 retrieve_keywords_replacements(implode(
', ', $current_value[
'http_auth_options']))
190 $keywords_list = array_unique($keywords_list);
193 $replacements = Array();
194 foreach ($keywords_list as $keyword) {
196 if (strlen($keyword_value) > 0) {
197 $replacements[$keyword] = $keyword_value;
201 if ($replacements[$keyword] ==
"%$keyword%" && 0 !== strpos($keyword,
'globals_')) {
202 $replacements[$keyword] =
'';
208 $http_request->setKeywordReplacements($replacements);
211 $res =& $http_request->run();
226 if (!isset($settings[
'http_request'])) {
227 $req_settings = Array();
229 $req_settings = unserialize($settings[
'http_request']);
233 if (empty($req_settings[
'method']))
return FALSE;
234 if (empty($req_settings[
'urls']))
return FALSE;