18 require_once SQ_CORE_PACKAGE_PATH.
'/page/page.inc';
19 require_once SQ_FUDGE_PATH.
'/general/www.inc';
20 require_once SQ_FUDGE_PATH.
'/general/text.inc';
21 require_once SQ_INCLUDE_PATH.
'/general_occasional.inc';
24 define (
'SQ_REMOTE_MAX_REDIRECTS', 10);
25 define (
'SQ_REMOTE_SOURCE',
'sq_content_src');
26 define (
'SQ_REMOTE_INPUT_FILE_NAMES',
'sq_remote_input_file_names');
27 define (
'SQ_REMOTE_SESSION_COOKIE_NAME',
'sq-active-remote-session');
44 var $_transformation_options = Array(
48 'do_tag_replacements',
49 'replace_matrix_keywords',
62 $this->_ser_attrs = TRUE;
63 parent::__construct($assetid);
80 $GLOBALS[
'SQ_SYSTEM']->pm->startTimer($this,
'printFrontend');
83 $GLOBALS[
'SQ_SYSTEM']->paintLogin(translate(
'login'), translate(
'cannot_access_asset', $this->name));
89 if ($success === TRUE) {
90 $url = $this->_tmp[
'url'];
91 $this->_tmp[
'success'][$url] = $success;
94 if (!$this->_tmp[
'transform_settings'][
'replace_matrix_keywords']) {
95 $GLOBALS[
'SQ_SYSTEM']->setGlobalDefine(
'SQ_REPLACE_MYSOURCE_LEVEL_KEYWORDS', FALSE);
98 if ($this->_tmp[
'transform_settings'][
'use_design']) {
99 parent::printFrontend();
101 $GLOBALS[
'SQ_SYSTEM']->pm->stopTimer($this,
'printFrontend');
105 $headers_list = array_get_index($this->_tmp,
'headers', Array());
106 $headers = array_get_index($headers_list, $url, Array());
107 foreach ($headers as $name => $value) {
108 header(
"$name: $value");
110 $content = array_get_index($this->_tmp,
'content', Array());
111 echo array_get_index($content, $url,
'');
115 $GLOBALS[
'SQ_SYSTEM']->pm->stopTimer($this,
'printFrontend');
135 $GLOBALS[
'SQ_SYSTEM']->pm->startTimer($this,
'printBody');
138 $GLOBALS[
'SQ_SYSTEM']->setGlobalDefine(
'SQ_REPLACE_MYSOURCE_LEVEL_KEYWORDS', FALSE);
141 $url = array_get_index($this->_tmp,
'url',
'');
143 if ($success === FALSE) {
145 if ($this->
attr(
'display_error')) {
146 echo $this->
attr(
'error_message');
151 if (isset($this->_tmp[
'headers']) === TRUE && isset($this->_tmp[
'content']) === TRUE) {
152 $type = array_get_index($this->_tmp[
'headers'],
'content-type');
153 if (!empty($type) && (0 !== strpos($type,
'text/'))) {
157 $replacements[
'remote_url'] = $url;
158 echo replace_keywords($this->
attr(
'binary_message'), $replacements);
161 echo $this->_tmp[
'content'][$url];
167 $GLOBALS[
'SQ_SYSTEM']->pm->stopTimer($this,
'printBody');
187 $remote_url = trim($this->
attr(
'remote_url'));
188 $remote_source = array_get_index($_REQUEST, SQ_REMOTE_SOURCE);
190 $initial_request = FALSE;
192 $is_post = (isset($_SERVER[
'REQUEST_METHOD']) && $_SERVER[
'REQUEST_METHOD'] ==
'POST');
195 if (is_null($remote_source)) {
196 $initial_request = TRUE;
199 foreach ($this->_transformation_options as $v) {
200 $this->_tmp[
'transform_settings'][$v] = TRUE;
203 $this->_tmp[
'transform_settings'] = $this->
_decodeHash($remote_source);
204 $url = $this->_tmp[
'transform_settings'][
'url'];
205 unset($this->_tmp[
'transform_settings'][
'url']);
209 trigger_localised_error(
'CMS0062', E_USER_WARNING);
214 trigger_localised_error(
'CMS0057', E_USER_WARNING, $url);
222 foreach($_GET as $key => $value) {
224 if(is_array($value)) {
225 $string_param = http_build_query(array($key => $value));
227 $query_string = $string_param;
231 $query_string .=
'&'.$string_param;
236 $query_string = $key.
'='.urlencode($value);
239 $query_string .=
'&'.$key.
'='.urlencode($value);
244 if (!empty($query_string) && !is_null($remote_source)) {
248 $source = $is_post ? $remote_source : urlencode($remote_source);
249 $query_string = trim(str_replace(SQ_REMOTE_SOURCE.
'='.$source,
'', $query_string));
253 $url_parts = explode(
'?', $url);
254 if (isset($url_parts[1])) {
256 replace_global_keywords($url_parts[1]);
257 $query_string = $url_parts[1].
'&'.$query_string;
259 $url = $url_parts[0];
260 if (empty($query_string) === FALSE) {
261 $url .=
'?'.$query_string;
265 $processed = array_get_index($this->_tmp,
'processed', Array());
266 if (isset($processed[$url])) {
268 return $processed[$url] ? NULL : FALSE;
273 $this->_tmp[
'processed'][$url] = FALSE;
276 $post_is_encoded = FALSE;
279 unset($_POST[SQ_REMOTE_SOURCE]);
281 $content_type = array_get_index($_SERVER,
'CONTENT_TYPE',
'');
282 if (strpos(strtolower($content_type),
'multipart/form-data') === FALSE) {
283 $post_data = trim(file_get_contents(
'php://input'));
287 $remote_source_str = SQ_REMOTE_SOURCE.
'='.urlencode($remote_source);
288 $remote_source_str_len = strlen($remote_source_str);
289 if (($pos = strpos($post_data, $remote_source_str)) !== FALSE) {
292 $post_data = substr($post_data, $remote_source_str_len + 1);
293 }
else if ( ($pos + strlen($remote_source_str)) == strlen($post_data) ) {
295 $post_data = substr($post_data, 0, strlen($post_data) - $remote_source_str_len - 1);
298 $post_data = substr($post_data, 0, $pos).substr($post_data, $pos + $remote_source_str_len + 1);
301 $post_is_encoded = TRUE;
311 foreach ($post_data as $name => $value) {
312 if(is_array($value)) {
313 $string_param = http_build_query(array($name => $value));
314 $array_param = explode(
'&', $string_param);
315 foreach ($array_param as $part) {
316 $part_param = explode(
'=', $part);
317 if(isset($part_param[0]) && isset($part_param[1]))
318 $post_data[urldecode($part_param[0])] = urldecode($part_param[1]);
320 unset($post_data[$name]);
329 $post_variables = $this->
attr(
'post_variables');
330 if ($initial_request && !empty($post_variables)) {
332 if ($post_is_encoded) {
333 $addon_array = Array();
334 if (!empty($post_data)) $addon_array[] = $post_data;
335 foreach ($post_variables as $index => $variable) {
336 $addon_array[] = urlencode($variable[
'name']).
'='.urlencode(replace_global_keywords($variable[
'value']));
338 $post_data = implode(
'&', $addon_array);
341 foreach ($post_variables as $index => $variable) {
342 $var_name = $variable[
'name'];
343 $var_value = $variable[
'value'];
344 $var_value = replace_global_keywords($var_value);
345 if (isset($post_data[$var_name])) {
346 if (!is_array($post_data[$var_name])) {
347 $post_data[$var_name] = Array($post_data[$var_name], $var_value);
349 $post_data[$var_name][] = $var_value;
352 $post_data[$var_name] = $var_value;
360 if (!is_dir($this->data_path)) {
361 create_directory($this->data_path);
363 $sessionid = session_id();
364 $cookie_filename = $this->data_path.
"/cookies_".$sessionid;
365 if(isset($_SESSION[
'SQ_REMOTE_CONTENT_COOKIE'][$this->
id])) {
366 string_to_file($_SESSION[
'SQ_REMOTE_CONTENT_COOKIE'][$this->
id], $cookie_filename);
370 'CONNECTTIMEOUT' => $this->
attr(
'timeout'),
371 'COOKIEFILE' => $cookie_filename,
372 'COOKIEJAR' => $cookie_filename,
373 'TIMEOUT' => $this->
attr(
'timeout'),
374 'USERAGENT' => SQ_SYSTEM_LONG_NAME,
375 'RETURNTRANSFER' => 1,
379 $user = $this->
attr(
'username');
381 $options[
'http_authentication'][
'username'] = $user;
382 $options[
'http_authentication'][
'password'] = $this->
attr(
'password');
385 if ($this->
attr(
'allow_redirect')) {
386 $options[
'FOLLOWLOCATION'] =
true;
387 $options[
'MAXREDIRS'] = SQ_REMOTE_MAX_REDIRECTS;
390 setcookie(SQ_REMOTE_SESSION_COOKIE_NAME, 1);
393 $hidden_field_file_name = $this->
getPrefix().
'_'.SQ_REMOTE_INPUT_FILE_NAMES;
394 if (!empty($_POST[$hidden_field_file_name])) {
395 $input_file_names = unserialize($_POST[$hidden_field_file_name]);
397 $input_file_names = Array();
401 if (!empty($input_file_names)) {
402 foreach ($_FILES as $name => $details) {
403 if (in_array($name, $input_file_names)) {
404 if (is_array($details[
'tmp_name'])) {
405 foreach ($details[
'tmp_name'] as $i => $tn) {
406 if ($details[
'error'][$i] != UPLOAD_ERR_OK)
continue;
407 $new_name = SQ_TEMP_PATH.
'/'.basename($details[
'name'][$i]);
408 if (move_uploaded_file($tn, $new_name)) {
409 $post_data[$name.
'['.$i.
']'] =
'@'.$new_name;
413 if ($details[
'error'] != UPLOAD_ERR_OK)
continue;
414 $new_name = SQ_TEMP_PATH.
'/'.basename($details[
'name']);
415 if (move_uploaded_file($details[
'tmp_name'], $new_name)) {
416 $post_data[$name] =
'@'.$new_name;
424 if (empty($post_data) && empty($files)) {
425 if ($post_is_encoded) {
426 $random = md5(rand());
427 $post_data = $random.
'='.$random;
431 $options[
'POST'] =
true;
432 $options[
'POSTFIELDS'] = $post_data;
437 foreach ($myUrls as $urlInfo) {
438 foreach (array(
'http',
'https') as $schema) {
439 if ($urlInfo[$schema] == 0) {
442 $fullUrl = $schema.
'://'.$urlInfo[
'url'];
443 if ($fullUrl == $url) {
444 trigger_localised_error(
'CMS0111', E_USER_WARNING);
450 $options[
'ssl_verifypeer']=$this->
attr(
'verify_ssl');
451 $result = fetch_url($url, $options);
454 if(is_file($cookie_filename)) {
455 $_SESSION[
'SQ_REMOTE_CONTENT_COOKIE'][$this->id] = file_get_contents($cookie_filename);
456 unlink($cookie_filename);
459 if ($result[
'errornumber'] != 0) {
460 trigger_localised_error(
'CMS0063', E_USER_WARNING, $url, $result[
'errorstring']);
464 if (preg_match(
'/^[45].*?/', $result[
'curlinfo'][
'http_code'])) {
465 trigger_localised_error(
'CMS0064', E_USER_WARNING, $result[
'curlinfo'][
'http_code'], $url);
469 $response = $result[
'response'];
471 $this->_tmp[
'url'] = $result[
'curlinfo'][
'url'];
474 if ($this->_tmp[
'url'] != $url) {
476 trigger_localised_error(
'CMS0058', E_USER_WARNING, $this->_tmp[
'url'], $url);
481 $keep_headers = array();
482 foreach (array(
'content_type',
'content_disposition') as $_header) {
483 if (isset($result[
'curlinfo'][$_header]) === TRUE) {
484 $keep_headers[str_replace(
'_',
'-', $_header)] = $result[
'curlinfo'][$_header];
488 $this->_tmp[
'headers'][$this->_tmp[
'url']] = $keep_headers;
489 $this->_tmp[
'content'][$this->_tmp[
'url']] = $response;
494 foreach ($this->_tmp[
'transform_settings'] as $i => $v) {
495 $this->_tmp[
'transform_settings'][$i] = FALSE;
502 $this->_tmp[
'processed'][$url] = TRUE;
520 if ($this->_tmp[
'transform_settings'][
'trim_content']) {
525 if ($this->_tmp[
'transform_settings'][
'do_tag_replacements']) {
530 if ($this->
attr(
'strip_images') && $this->_tmp[
'transform_settings'][
'strip_images']) {
535 if ($this->_tmp[
'transform_settings'][
'rewrite_urls']) {
540 if ($this->_tmp[
'transform_settings'][
'replace_matrix_keywords']) {
541 preg_match_all(
'/%(\w+)%/i', $content, $matches);
542 foreach ($matches[1] as $key => $keyword) {
544 $content = str_replace($matches[0][$key], $rep, $content);
549 $this->_addInputFileNames($content);
560 function _addInputFileNames(&$content) {
561 $pattern =
'/<input\s+[^>]*type\s*=\s*(?:"|\')?file(?:"|\')?[^>]*>/i';
562 $file_names = Array();
563 if (preg_match_all($pattern, $content, $matches)) {
565 $name_pattern =
'/\s+name\s*=\s*(?:"|\')?([^>"\'\s]+)/i';
566 foreach($matches[0] as $match) {
567 if (preg_match($name_pattern, $match, $name_matches)) {
568 $file_names[] = $name_matches[1];
572 if (!empty($file_names)) {
573 $serialized_names = serialize($file_names);
574 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
576 hidden_field($this->
getPrefix().
'_'.SQ_REMOTE_INPUT_FILE_NAMES, $serialized_names);
577 $hidden_field = ob_get_clean();
579 $content = str_replace($matches[0][0], $matches[0][0].$hidden_field, $content);
595 $disposition = array_get_index($headers,
'content-disposition');
596 if (!is_null($disposition) && strpos($disposition,
'attachment') !== FALSE) {
602 $content_type = array_get_index($headers,
'content-type');
603 if (!empty($content_type) && (strpos($content_type,
'text/') === FALSE)) {
626 $start_tag = preg_quote($this->
attr(
'start_tag'),
'/');
627 $end_tag = preg_quote($this->
attr(
'end_tag'),
'/');
628 $multiple = $this->
attr(
'multi_occurence');
632 if (!empty($start_tag) || !empty($end_tag)) {
633 if ($this->
attr(
'include_tags')) {
634 $pattern =
"/($start_tag.*$end_tag)/s";
636 $pattern =
"/$start_tag(.*)$end_tag/s";
641 preg_match_all($pattern, $response_body, $matches);
642 if (count($matches[1])) {
645 foreach ($matches[1] as $match) {
646 $response_body .= $match;
649 $response_body .= $matches[1][0];
651 }
else if ($this->
attr(
'no_tag_clear')) {
671 $replacement_url = $this->
getURL().
'?'.SQ_REMOTE_SOURCE.
'=';
672 $fetch_url = $this->_tmp[
'url'];
675 $parsed_fetch_url = parse_url($fetch_url);
677 $replacements = Array();
684 $patterns[] =
'/(<(?:script|link)\s+.*?(?:src|href)\s*=\s*[\'"]*)\s*([^\'" >]+)([\'"> ]?[^<]*>)/i';
687 $patterns[] =
'/(@import\s+url\s*\([\'"]?\s*)([^\'" ]+)([\'"]?\s*\))/i';
688 $patterns[] =
'/(@import\s+[\'"]\s*)([^\'" ]+)([\'"])/i';
691 foreach ($patterns as $pattern) {
692 preg_match_all($pattern, $content, $matches_local, PREG_SET_ORDER);
693 $matches = array_merge($matches, $matches_local);
696 $matches_local = NULL;
699 foreach ($matches as $data) {
712 $encoded_url = $this->
_encodeHash($url, Array(
'rewrite_urls'));
713 $url = $replacement_url.$encoded_url;
716 $subjects[] = $subject;
717 $replacements[] = $prefix.$url.$postfix;
726 $pattern =
'/(<(?:embed)\s+.*?(?:src)\s*=\s*[\'"]*)\s*([^\'" >]+)([\'"> ]?[^<]*>)/i';
729 preg_match_all($pattern, $content, $matches, PREG_SET_ORDER);
732 foreach ($matches as $data) {
746 $url = $replacement_url.$encoded_url;
749 $subjects[] = $subject;
750 $replacements[] = $prefix.$url.$postfix;
758 $pattern =
'/(<(?:param)\s+.*?(?:value)\s*=\s*[\'"]*)\s*([^\'" >]+)([\'"> ]?[^<]*>)/i';
760 preg_match_all($pattern, $content, $matches, PREG_SET_ORDER);
763 foreach ($matches as $data) {
770 $pattern =
'/name\s*=\s*[\'"]*\s*([^\'" >]+)[\'"> ]+/i';
772 preg_match($pattern, $subject, $name_matches);
773 $param_name = $name_matches[
'1'];
776 if ($param_name !=
'movie')
continue;
786 $url = $replacement_url.$encoded_url;
789 $subjects[] = $subject;
790 $replacements[] = $prefix.$url.$postfix;
793 $name_matches = NULL;
803 $patterns[] =
'/(<(?:img)\s+.*?(?:src)\s*=\s*[\'"]*)\s*([^\'" <>]+)([\'"> ]?[^<>]*>)/i';
805 $patterns[] =
'/(background\s*=\s*[\'"]?)\s*([^\'"<> ]+)([\'" ]?[^<]*>)/i';
807 $patterns[] =
'/((?:background.*?)url\s*\([\'"]?\s*)([^\'"; ]+)([\'"]?\s*\))/i';
808 $patterns[] =
'/((?:list-style-image.*?)url\s*\([\'"]?\s*)([^\'"; ]+)([\'"]?\s*\))/i';
810 $patterns[] =
'/(<(?:input)\s+.*?(?:src)\s*=\s*[\'"]+)\s*([^\'" >]+)([\'"> ]?[^<>]*>)/i';
813 foreach ($patterns as $pattern) {
814 preg_match_all($pattern, $content, $matches_local, PREG_SET_ORDER);
815 $matches = array_merge($matches, $matches_local);
818 $matches_local = NULL;
820 foreach ($matches as $data) {
834 $url = $replacement_url.$encoded_url;
837 $subjects[] = $subject;
838 $replacements[] = $prefix.$url.$postfix;
851 $patterns[] =
'/(<(?:(?:a(?:rea)?[^>]*?href)|(?:i?frame[^>]*?src))\s*=\s*[\'"]?)\s*((?:(?![\#]|mailto|javascript|tel))[^\'"> #]+)([\'"> #]?[^<]*>)/i';
856 $patterns[] =
'/(<input[^>]*?onclick\s*=\s*[\'"]location=\')\s*([^\'"> ]+)([\'"> ]?[^<]*>)/i';
859 foreach ($patterns as $pattern) {
860 preg_match_all($pattern, $content, $matches_local, PREG_SET_ORDER);
861 $matches = array_merge($matches, $matches_local);
865 $matches_local = NULL;
866 $load_links = $this->
attr(
'load_links');
868 foreach ($matches as $data) {
881 $encoded_url = $this->
_encodeHash($url, Array(
'all'));
882 $url = $replacement_url.$encoded_url;
885 $subjects[] = $subject;
886 $replacements[] = $prefix.$url.$postfix;
898 $patterns[] =
'/(<(?:form[^>]*?action)\s*=\s*[\'\"]?)\s*([^\'\"> ]*)([\'\"> ]?[^<]*>)/i';
901 foreach ($patterns as $pattern) {
902 preg_match_all($pattern, $content, $matches_local, PREG_SET_ORDER);
903 $matches = array_merge($matches, $matches_local);
906 $matches_local = NULL;
908 foreach ($matches as $data) {
922 $postfix .=
'<input type="hidden" name="'.SQ_REMOTE_SOURCE.
'" value="'.$this->
_encodeHash($url, Array(
'all')).
'" />';
924 $encoded_url = $this->
_encodeHash($url, Array(
'all'));
925 $url = $replacement_url.$encoded_url;
928 $subjects[] = $subject;
929 $replacements[] = $prefix.$url.$postfix;
935 $content = str_replace($subjects, $replacements, $content);
951 $pattern =
'/(<(?:img)[^>]*?>)/i';
953 $content = preg_replace_callback(
957 'return Page_Remote_Content::_imageStrip($matches[0]);'
963 $pattern =
'/(background\s*=\s*[\'\"]?\s*[^\'\" <>]+[\'\"]?)/i';
964 $content = preg_replace($pattern,
'', $content);
967 $pattern =
'/(background.*?)(url\(.*?\))/i';
968 $content = preg_replace($pattern,
'\$1', $content);
971 $pattern =
'/(<(?:input)[^>]*type=["\' ]image["\' ][^>]*?>)/i';
973 $content = preg_replace_callback(
977 'return Page_Remote_Content::_imageButtonReplace($matches[0]);'
995 $tag_replacements = $this->
attr(
'tag_replacements');
996 if (!empty($tag_replacements)) {
997 foreach ($tag_replacements as $tag => $replace_info) {
998 if ($replace_info[
'remove_content']) {
999 $pattern =
'/(<(?:'.$tag.
')(?:\s+[^>]*?)?>[^<]*)/i';
1001 $pattern =
'/(<(?:'.$tag.
')(?:\s+[^>]*?)?>)/i';
1003 $content = preg_replace($pattern, $replace_info[
'start_tag'], $content);
1004 $pattern =
'/(<(?:\/'.$tag.
')[^>]*?>)/i';
1005 $content = preg_replace($pattern, $replace_info[
'end_tag'], $content);
1023 $alt_pattern =
'/(?:alt\s*=[\'" ]([^\'"><]+)[\'" ])/i';
1024 $type_pattern =
'/(type\s*=[\'" ][^\'"><]+[\'" ])/i';
1026 if (preg_match($alt_pattern, $input_string, $matches)) {
1027 $button_name = ucfirst($matches[1]);
1029 $button_name = $default_button_name;
1032 $type_replacement =
' type="Submit" value="'.$button_name.
'" ';
1034 $result = preg_replace($type_pattern, $type_replacement, $input_string);
1054 $alt_pattern =
'/(?:alt\s*=[\'" ]([^\'"><]+)[\'" ])/i';
1056 if (preg_match($alt_pattern, $image_string, $matches)) {
1057 $image_name = ucfirst($matches[1]);
1059 $image_name = $default_image_name;
1062 return "[$image_name]";
1082 if (!isset($url) || (substr($url, -3) ==
'://' )) {
1086 if (substr($url,0,2) ==
'//') {
1087 $url = $parsed_fetch_url[
'scheme'].
':'.$url;
1091 if (preg_match(
'/^[a-z0-9]+:\/\//i', $url)) {
1096 $full_url = $parsed_fetch_url[
'scheme'].
'://'.$parsed_fetch_url[
'host'];
1097 if (isset($parsed_fetch_url[
'port'])) {
1098 $full_url .=
':'.$parsed_fetch_url[
'port'];
1101 if (strlen($url) && $url{0} ==
'/') {
1104 $path = array_get_index($parsed_fetch_url,
'path',
'/');
1105 if (substr($path,-1) !=
'/' && !preg_match(
'/^\?/', $url)) {
1106 $path = dirname($path);
1107 if (strlen($path) > 1) $path .=
'/';
1110 $final_path = $path.$url;
1144 $path_components = explode(
'/',$path);
1146 if (empty($path_components[0])) {
1148 unset($path_components[0]);
1153 foreach ($path_components as $component) {
1154 switch ($component) {
1156 if (!empty($stack)) array_pop($stack);
1165 array_push($stack, $component);
1169 $new_path = implode(
'/', $stack);
1171 return $root.$new_path;
1193 trigger_localised_error(
'CMS0065', E_USER_WARNING);
1198 if (strpos($url,
'&') !== FALSE) {
1199 $components = Array(
'url' => html_entity_decode($url));
1201 $components = Array(
'url' => $url);
1204 foreach ($transformations as $arg) {
1205 $components[$arg] = 1;
1207 return urlencode(
'+'.base64_encode(make_raw_post_data($components)));
1223 if ($hash{0} !=
'+') $hash = urldecode($hash);
1225 $hash = base64_decode(substr($hash, 1));
1226 $components = Array();
1227 parse_str(html_entity_decode($hash), $components);
1228 if (empty($components[
'url'])) {
1229 trigger_localised_error(
'CMS0065', E_USER_WARNING);
1232 foreach ($this->_transformation_options as $i => $v) {
1233 $components[$v] = !empty($components[$v]) || !empty($components[
'all']);
1250 if ($url == $this->
attr(
'remote_url'))
return TRUE;
1252 $options = $this->
attr(
'url_rewriting_options');
1253 if ($options[
'all'])
return TRUE;
1255 if (!isset($this->_tmp[
'_white_list_'])) {
1256 $url_parts = parse_url($this->
attr(
'remote_url'));
1257 $host = $url_parts[
'host'];
1259 if (isset($url_parts[
'path']) === TRUE) {
1260 $path = $url_parts[
'path'];
1263 $this->_tmp[
'_white_list_'] = Array();
1264 if ($options[
'remote_domain']) {
1265 $this->_tmp[
'_white_list_'][] = strtolower($host);
1267 if ($options[
'remote_url']) {
1268 $this->_tmp[
'_white_list_'][] = strtolower($host.$path);
1270 if ($options[
'white_list']) {
1271 $this->_tmp[
'_white_list_'] = array_merge($this->
attr(
'url_white_list'), $this->_tmp[
'_white_list_']);
1275 if (empty($this->_tmp[
'_white_list_']))
return FALSE;
1277 $url_parts = parse_url($url);
1278 $url = $url_parts[
'host'];
1279 if (isset($url_parts[
'path']) === TRUE) {
1280 $url .= $url_parts[
'path'];
1282 $url = strtolower($url);
1284 foreach ($this->_tmp[
'_white_list_'] as $white_url) {
1285 $white_url_len = strlen(trim($white_url));
1286 if ($white_url_len > strlen($url)) {
1288 }
else if (strtolower(trim($white_url)) == substr($url, 0, $white_url_len)) {