From f56b4773cbb84950cd9ff07f920dd738c3ea5dbc Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 11 Oct 2016 20:53:13 -0700 Subject: When importing a channel from another server, try to auto-discover the best available api path. --- include/network.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include/network.php') diff --git a/include/network.php b/include/network.php index 7851f8976..97dca2b1a 100644 --- a/include/network.php +++ b/include/network.php @@ -2288,3 +2288,22 @@ function z_mail($params) { logger('notification: z_mail returns ' . $res, LOGGER_DEBUG); return $res; } + +// discover the best API path available for redmatrix/hubzilla servers + +function probe_api_path($host) { + + $schemes = ['https', 'http' ]; + $paths = ['/api/z/1.0/version', '/api/red/version' ]; + + foreach($schemes as $scheme) { + foreach($paths as $path) { + $curpath = $scheme . '://' . $host . $path; + $x = z_fetch_url($curpath); + if($x['success'] && ! strlen($x['body'],'not implemented')) + return str_replace('version','',$curpath); + } + } + + return ''; +} \ No newline at end of file -- cgit v1.2.3 From 7b41839ea8f2aad020444c42f2cba89040ca28b8 Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Sun, 2 Oct 2016 00:41:25 +0200 Subject: [TASK] Update Doxyfile and fix Doxygen errors. Updated Doxyfile to include new folders. Add a list for @hooks tags. Fixed some parsing problems for Doxygen. --- include/network.php | 128 ++++++++++++++++++++++++++-------------------------- 1 file changed, 64 insertions(+), 64 deletions(-) (limited to 'include/network.php') diff --git a/include/network.php b/include/network.php index 97dca2b1a..823427a4a 100644 --- a/include/network.php +++ b/include/network.php @@ -30,12 +30,12 @@ function get_capath() { * * \b filep => stream resource to write body to. header and body are not returned when using this option. * * \b custom => custom request method: e.g. 'PUT', 'DELETE' * * \b cookiejar => cookie file (write) - * * \B cookiefile => cookie file (read) + * * \b cookiefile => cookie file (read) * * @return array an associative array with: * * \e int \b return_code => HTTP return code or 0 if timeout or failure * * \e boolean \b success => boolean true (if HTTP 2xx result) or false - * * \e string \b header => HTTP headers + * * \e string \b header => HTTP headers * * \e string \b body => fetched content */ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { @@ -43,7 +43,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { $ret = array('return_code' => 0, 'success' => false, 'header' => "", 'body' => ""); $ch = @curl_init($url); - if(($redirects > 8) || (! $ch)) + if(($redirects > 8) || (! $ch)) return $ret; @curl_setopt($ch, CURLOPT_HEADER, true); @@ -64,7 +64,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { if(x($opts,'upload')) @curl_setopt($ch, CURLOPT_UPLOAD, $opts['upload']); - + if(x($opts,'infile')) @curl_setopt($ch, CURLOPT_INFILE, $opts['infile']); @@ -104,7 +104,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { if(x($opts,'cookie')) @curl_setopt($ch, CURLOPT_COOKIE, $opts['cookie']); - @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, + @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, ((x($opts,'novalidate') && intval($opts['novalidate'])) ? false : true)); $prx = get_config('system','proxy'); @@ -179,10 +179,10 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { * @param string $url * URL to post * @param mixed $params - * The full data to post in a HTTP "POST" operation. This parameter can - * either be passed as a urlencoded string like 'para1=val1¶2=val2&...' - * or as an array with the field name as key and field data as value. If value - * is an array, the Content-Type header will be set to multipart/form-data. + * The full data to post in a HTTP "POST" operation. This parameter can + * either be passed as a urlencoded string like 'para1=val1¶2=val2&...' + * or as an array with the field name as key and field data as value. If value + * is an array, the Content-Type header will be set to multipart/form-data. * @param int $redirects = 0 * internal use, recursion counter * @param array $opts (optional parameters) @@ -209,7 +209,7 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) { $ret = array('return_code' => 0, 'success' => false, 'header' => "", 'body' => ""); $ch = curl_init($url); - if(($redirects > 8) || (! $ch)) + if(($redirects > 8) || (! $ch)) return $ret; @curl_setopt($ch, CURLOPT_HEADER, true); @@ -232,7 +232,7 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) { if(x($opts,'headers')) { @curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']); } - + if(x($opts,'nobody')) @curl_setopt($ch, CURLOPT_NOBODY, $opts['nobody']); @@ -265,7 +265,7 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) { if(x($opts,'cookie')) @curl_setopt($ch, CURLOPT_COOKIE, $opts['cookie']); - @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, + @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, ((x($opts,'novalidate') && intval($opts['novalidate'])) ? false : true)); $prx = get_config('system','proxy'); @@ -379,8 +379,8 @@ function json_return_and_die($x, $content_type = 'application/json') { // Generic XML return -// Outputs a basic dfrn XML status structure to STDOUT, with a variable -// of $st and an optional text of $message and terminates the current process. +// Outputs a basic dfrn XML status structure to STDOUT, with a variable +// of $st and an optional text of $message and terminates the current process. function xml_status($st, $message = '') { @@ -399,7 +399,7 @@ function xml_status($st, $message = '') { /** - * @brief Send HTTP status header + * @brief Send HTTP status header * * @param int $val * integer HTTP status result value @@ -413,7 +413,7 @@ function http_status($val, $msg = '') { if ($val >= 200 && $val < 300) $msg = (($msg) ? $msg : 'OK'); - logger('http_status_exit ' . $val . ' ' . $msg); + logger('http_status_exit ' . $val . ' ' . $msg); header($_SERVER['SERVER_PROTOCOL'] . ' ' . $val . ' ' . $msg); } @@ -486,14 +486,14 @@ function convert_xml_element_to_array($xml_element, &$recursion_depth=0) { function validate_url(&$url) { - + // no naked subdomains (allow localhost for tests) if(strpos($url,'.') === false && strpos($url,'/localhost/') === false) return false; if(substr($url,0,4) != 'http') $url = 'http://' . $url; $h = @parse_url($url); - + if(($h) && (@dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR) || filter_var($h['host'], FILTER_VALIDATE_IP) )) { return true; } @@ -552,7 +552,7 @@ function allowed_url($url) { foreach($allowed as $a) { $pat = strtolower(trim($a)); if(($fnmatch && fnmatch($pat,$host)) || ($pat == $host)) { - $found = true; + $found = true; break; } } @@ -575,14 +575,14 @@ function allowed_email($email) { $str_allowed = get_config('system','allowed_email'); $str_not_allowed = get_config('system','not_allowed_email'); - + if(! $str_allowed && ! $str_not_allowed) return true; $return = false; - $found_allowed = false; + $found_allowed = false; $found_not_allowed = false; - + $fnmatch = function_exists('fnmatch'); $allowed = explode(',',$str_allowed); @@ -591,7 +591,7 @@ function allowed_email($email) { foreach($allowed as $a) { $pat = strtolower(trim($a)); if(($fnmatch && fnmatch($pat,$email)) || ($pat == $domain)) { - $found_allowed = true; + $found_allowed = true; break; } } @@ -603,16 +603,16 @@ function allowed_email($email) { foreach($not_allowed as $na) { $pat = strtolower(trim($na)); if(($fnmatch && fnmatch($pat,$email)) || ($pat == $domain)) { - $found_not_allowed = true; + $found_not_allowed = true; break; } } - } - + } + if ($found_allowed) { - $return = true; + $return = true; } elseif (!$str_allowed && !$found_not_allowed) { - $return = true; + $return = true; } return $return; } @@ -652,7 +652,7 @@ function scale_external_images($s, $include_link = true, $scale_replace = false) foreach($matches as $mtch) { logger('scale_external_image: ' . $mtch[2] . ' ' . $mtch[3]); - + if(substr($mtch[1],0,1) == '=') { $owidth = intval(substr($mtch[2],1)); if(intval($owidth) > 0 && intval($owidth) < 1024) @@ -686,7 +686,7 @@ function scale_external_images($s, $include_link = true, $scale_replace = false) $type = guess_image_type($mtch[3],$i['header']); if(strpos($type,'image') === false) continue; - + if($i['success']) { $ph = photo_factory($i['body'], $type); if($ph->is_valid()) { @@ -700,7 +700,7 @@ function scale_external_images($s, $include_link = true, $scale_replace = false) $new_height = $ph->getHeight(); logger('scale_external_images: ' . $orig_width . '->' . $new_width . 'w ' . $orig_height . '->' . $new_height . 'h' . ' match: ' . $mtch[0], LOGGER_DEBUG); $s = str_replace($mtch[0],'[' . $tag . '=' . $new_width . 'x' . $new_height. ']' . $scaled . '[/' . $tag . ']' - . "\n" . (($include_link) + . "\n" . (($include_link) ? '[zrl=' . $mtch[2] . ']' . t('view full size') . '[/zrl]' . "\n" : ''),$s); logger('scale_external_images: new string: ' . $s, LOGGER_DEBUG); @@ -728,7 +728,7 @@ function scale_external_images($s, $include_link = true, $scale_replace = false) * Return: The parsed XML in an array form. Use print_r() to see the resulting array structure. * Examples: $array = xml2array(file_get_contents('feed.xml')); * $array = xml2array(file_get_contents('feed.xml', true, 1, 'attribute')); - */ + */ function xml2array($contents, $namespaces = true, $get_attributes=1, $priority = 'attribute') { if(!$contents) return array(); @@ -752,7 +752,7 @@ function xml2array($contents, $namespaces = true, $get_attributes=1, $priority = return array(); } - xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8"); + xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8"); // http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); @@ -786,7 +786,7 @@ function xml2array($contents, $namespaces = true, $get_attributes=1, $priority = $result = array(); $attributes_data = array(); - + if(isset($value)) { if($priority == 'tag') $result = $value; else $result['value'] = $value; // Put the value in a assoc array if we are in the 'Attribute' mode @@ -802,7 +802,7 @@ function xml2array($contents, $namespaces = true, $get_attributes=1, $priority = // See tag status and do the needed. if($namespaces && strpos($tag,':')) { - $namespc = substr($tag,0,strrpos($tag,':')); + $namespc = substr($tag,0,strrpos($tag,':')); $tag = strtolower(substr($tag,strlen($namespc)+1)); $result['@namespace'] = $namespc; } @@ -825,7 +825,7 @@ function xml2array($contents, $namespaces = true, $get_attributes=1, $priority = } else { // This section will make the value an array if multiple tags with the same name appear together $current[$tag] = array($current[$tag],$result); // This will combine the existing item and the new item together to make an array $repeated_tag_index[$tag.'_'.$level] = 2; - + if(isset($current[$tag.'_attr'])) { // The attribute of the last(0th) tag must be moved as well $current[$tag]['0_attr'] = $current[$tag.'_attr']; unset($current[$tag.'_attr']); @@ -848,7 +848,7 @@ function xml2array($contents, $namespaces = true, $get_attributes=1, $priority = // ...push the new element into that array. $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result; - + if($priority == 'tag' and $get_attributes and $attributes_data) { $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data; } @@ -859,11 +859,11 @@ function xml2array($contents, $namespaces = true, $get_attributes=1, $priority = $repeated_tag_index[$tag.'_'.$level] = 1; if($priority == 'tag' and $get_attributes) { if(isset($current[$tag.'_attr'])) { // The attribute of the last(0th) tag must be moved as well - + $current[$tag]['0_attr'] = $current[$tag.'_attr']; unset($current[$tag.'_attr']); } - + if($attributes_data) { $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data; } @@ -876,9 +876,9 @@ function xml2array($contents, $namespaces = true, $get_attributes=1, $priority = $current = &$parent[$level-1]; } } - + return($xml_array); -} +} function email_header_encode($in_str, $charset = 'UTF-8') { @@ -1128,7 +1128,7 @@ function discover_by_webbie($webbie) { $diaspora = false; $gnusoc = false; $dfrn = false; - + $has_salmon = false; $salmon_key = false; $atom_feed = false; @@ -1144,7 +1144,7 @@ function discover_by_webbie($webbie) { if(array_key_exists('rel',$link)) { // If we discover zot - don't search further; grab the info and get out of - // here. + // here. if($link['rel'] === PROTOCOL_ZOT) { logger('discover_by_webbie: zot found for ' . $webbie, LOGGER_DEBUG); @@ -1204,11 +1204,11 @@ function discover_by_webbie($webbie) { $pubkey = ''; if(is_array($x)) { - if(array_key_exists('address',$x)) + if(array_key_exists('address',$x)) $address = $x['address']; - if(array_key_exists('location',$x)) + if(array_key_exists('location',$x)) $location = $x['location']; - if(array_key_exists('nickname',$x)) + if(array_key_exists('nickname',$x)) $nickname = $x['nickname']; } @@ -1216,16 +1216,16 @@ function discover_by_webbie($webbie) { $probe_old = true; - if((! $dfrn) && (! $has_salmon)) + if((! $dfrn) && (! $has_salmon)) $probe_old = true; if($probe_old) { - $y = old_webfinger($webbie); + $y = old_webfinger($webbie); if($y) { logger('old_webfinger: ' . print_r($x,true)); foreach($y as $link) { if($link['@attributes']['rel'] === NAMESPACE_DFRN) - $dfrn = unamp($link['@attributes']['href']); + $dfrn = unamp($link['@attributes']['href']); if($link['@attributes']['rel'] === 'salmon') $notify = unamp($link['@attributes']['href']); if($link['@attributes']['rel'] === NAMESPACE_FEED) @@ -1344,7 +1344,7 @@ function discover_by_webbie($webbie) { if($vcard['fn']) $fullname = $vcard['fn']; if($vcard['photo'] && (strpos($vcard['photo'],'http') !== 0)) - $vcard['photo'] = $diaspora_base . '/' . $vcard['photo']; + $vcard['photo'] = $diaspora_base . '/' . $vcard['photo']; if(($vcard['public_key']) && (! $pubkey)) { $diaspora_key = $vcard['public_key']; if(strstr($diaspora_key,'RSA ')) @@ -1358,7 +1358,7 @@ function discover_by_webbie($webbie) { if(($vcard['uid']) && (! $diaspora_guid)) $diaspora_guid = $vcard['uid']; if(($vcard['url']) && (! $diaspora_base)) - $diaspora_base = $vcard['url']; + $diaspora_base = $vcard['url']; @@ -1372,7 +1372,7 @@ function discover_by_webbie($webbie) { if(($profile) && (! $location)) $location = $profile; - if($location) { + if($location) { $m = parse_url($location); $base = $m['scheme'] . '://' . $m['host']; $host = $m['host']; @@ -1407,7 +1407,7 @@ function discover_by_webbie($webbie) { // if we have everything we need, let's create the records - if($network && $address && $fullname && $pubkey && $location) { + if($network && $address && $fullname && $pubkey && $location) { $r = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($address) ); @@ -1493,7 +1493,7 @@ function webfinger_rfc7033($webbie,$zot = false) { // We could have a number of URL aliases and webbies // make an executive decision about the most likely "best" of each // by comparing against some examples from known networks we're likely to encounter. - // Otherwise we have to store every alias that we may ever encounter and + // Otherwise we have to store every alias that we may ever encounter and // validate every URL we ever find against every possible alias // @fixme pump.io is going to be a real bugger since it doesn't return subject or aliases @@ -1564,7 +1564,7 @@ function match_webfinger_location($s,$h) { return $s; return ''; } - + @@ -1935,7 +1935,7 @@ function format_and_send_email($sender,$xchan,$item) { )); $sender_name = t('Administrator'); - + $hostname = App::get_hostname(); if(strpos($hostname,':')) $hostname = substr($hostname,0,strpos($hostname,':')); @@ -1964,7 +1964,7 @@ function do_delivery($deliveries) { if(! (is_array($deliveries) && count($deliveries))) return; - $interval = ((get_config('system','delivery_interval') !== false) + $interval = ((get_config('system','delivery_interval') !== false) ? intval(get_config('system','delivery_interval')) : 2 ); $deliveries_per_process = intval(get_config('system','delivery_batch_count')); @@ -1993,7 +1993,7 @@ function do_delivery($deliveries) { if($deliver) Zotlabs\Daemon\Master::Summon(array('Deliver',$deliver)); - + } @@ -2002,7 +2002,7 @@ function get_site_info() { $register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'); $directory_mode = Array('DIRECTORY_MODE_NORMAL', 'DIRECTORY_MODE_PRIMARY', 'DIRECTORY_MODE_SECONDARY', 256 => 'DIRECTORY_MODE_STANDALONE'); - + $sql_extra = ''; $r = q("select * from channel left join account on account_id = channel_account_id where ( account_roles & 4096 )>0 and account_default_channel = channel_id"); @@ -2053,7 +2053,7 @@ function get_site_info() { else { $version = $commit = ''; } - + //Statistics $channels_total_stat = intval(get_config('system','channels_total_stat')); $channels_active_halfyear_stat = intval(get_config('system','channels_active_halfyear_stat')); @@ -2073,7 +2073,7 @@ function get_site_info() { } - + $data = Array( 'version' => $version, 'version_tag' => $tag, @@ -2190,7 +2190,7 @@ function deliverable_singleton($channel_id,$xchan) { function get_repository_version($branch = 'master') { $path = "https://raw.githubusercontent.com/redmatrix/hubzilla/$branch/boot.php"; - + $x = z_fetch_url($path); if($x['success']) { $y = preg_match('/define(.*?)STD_VERSION(.*?)([0-9.].*)\'/',$x['body'],$matches); @@ -2199,7 +2199,7 @@ function get_repository_version($branch = 'master') { } return '?.?'; -} +} function network_to_name($s) { @@ -2270,7 +2270,7 @@ function z_mail($params) { return $params['result']; } - $fromName = email_header_encode(html_entity_decode($params['fromName'],ENT_QUOTES,'UTF-8'),'UTF-8'); + $fromName = email_header_encode(html_entity_decode($params['fromName'],ENT_QUOTES,'UTF-8'),'UTF-8'); $messageSubject = email_header_encode(html_entity_decode($params['messageSubject'],ENT_QUOTES,'UTF-8'),'UTF-8'); $messageHeader = -- cgit v1.2.3 From daaefed61bc6a38a102ce2c357278158535a2b27 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 13 Oct 2016 16:47:45 -0700 Subject: provide text log results of email success/failure rather than 1 and 0. --- include/network.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/network.php') diff --git a/include/network.php b/include/network.php index 97dca2b1a..53bb583fa 100644 --- a/include/network.php +++ b/include/network.php @@ -2266,7 +2266,7 @@ function z_mail($params) { call_hooks('email_send', $params); if($params['sent']) { - logger('notification: z_mail returns ' . $params['result'], LOGGER_DEBUG); + logger('notification: z_mail returns ' . (($params['result']) ? 'success' : 'failure'), LOGGER_DEBUG); return $params['result']; } @@ -2285,7 +2285,7 @@ function z_mail($params) { $params['textVersion'], $messageHeader // message headers ); - logger('notification: z_mail returns ' . $res, LOGGER_DEBUG); + logger('notification: z_mail returns ' . (($res) ? 'success' : 'failure'), LOGGER_DEBUG); return $res; } -- cgit v1.2.3 From 88a68b941ff2c8295ac5a6f221855bc4940ddb40 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 25 Oct 2016 18:27:32 -0700 Subject: put all dns checking into one function, allow it to be ignored --- include/network.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'include/network.php') diff --git a/include/network.php b/include/network.php index 6411d6ddf..8c118eff3 100644 --- a/include/network.php +++ b/include/network.php @@ -480,6 +480,23 @@ function convert_xml_element_to_array($xml_element, &$recursion_depth=0) { } } + + +function z_dns_check($h,$check_mx = 0) { + + // dns_get_record() has issues on some platforms + // so allow somebody to ignore it completely + + if(get_config('system','do_not_check_dns')) + return true; + + $opts = DNS_A + DNS_CNAME + DNS_PTR; + if($check_mx) + $opts += DNS_MX; + return((@dns_get_record($h, $opts) || filter_var($h, FILTER_VALIDATE_IP)) ? true : false); + +} + // Take a URL from the wild, prepend http:// if necessary // and check DNS to see if it's real (or check if is a valid IP address) // return true if it's OK, false if something is wrong with it @@ -494,7 +511,7 @@ function validate_url(&$url) { $url = 'http://' . $url; $h = @parse_url($url); - if(($h) && (@dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR) || filter_var($h['host'], FILTER_VALIDATE_IP) )) { + if(($h) && z_dns_check($h['host'])) { return true; } return false; @@ -512,7 +529,7 @@ function validate_email($addr) { return false; $h = substr($addr,strpos($addr,'@') + 1); - if(($h) && (@dns_get_record($h, DNS_A + DNS_CNAME + DNS_PTR + DNS_MX) || filter_var($h, FILTER_VALIDATE_IP) )) { + if(($h) && z_dns_check($h,true)) { return true; } return false; -- cgit v1.2.3 From 33b1c570921d07e0ea1ac492ca6d7b48f6cbd7d5 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 25 Oct 2016 23:32:24 -0700 Subject: For z_dns_check() use config values from memory and ignore DB - as this function can be called in the early stages of Setup when we first try to connect to the database. --- include/network.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include/network.php') diff --git a/include/network.php b/include/network.php index 8c118eff3..24e77527f 100644 --- a/include/network.php +++ b/include/network.php @@ -486,8 +486,13 @@ function z_dns_check($h,$check_mx = 0) { // dns_get_record() has issues on some platforms // so allow somebody to ignore it completely + // Use config values from memory as this can be called during setup + // before a database or even any config structure exists. - if(get_config('system','do_not_check_dns')) + if(is_array(\App::$config) && array_key_exists('system',\App::$config) + && is_array(\App::$config['system']) + && array_key_exists('do_not_check_dns',\App::$config['system']) + && \App::$config['system']['do_not_check_dns']) return true; $opts = DNS_A + DNS_CNAME + DNS_PTR; -- cgit v1.2.3 From c1c96e01fab131dd48cd68cdd9b63639e269d9c8 Mon Sep 17 00:00:00 2001 From: Florian Steinel Date: Thu, 27 Oct 2016 02:41:32 +0200 Subject: sql: limit 1 for UPDATE and DELETE is not supported by the SQL standard and postgresql (see: https://www.postgresql.org/message-id/flat/1291109101.26137.35.camel%40pcd12478 ) --- include/network.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/network.php') diff --git a/include/network.php b/include/network.php index 24e77527f..7cfd3a5e6 100644 --- a/include/network.php +++ b/include/network.php @@ -1434,7 +1434,7 @@ function discover_by_webbie($webbie) { dbesc($address) ); if($r) { - $r = q("update xchan set xchan_name = '%s', xchan_network = '%s', xchan_name_date = '%s' where xchan_hash = '%s' limit 1", + $r = q("update xchan set xchan_name = '%s', xchan_network = '%s', xchan_name_date = '%s' where xchan_hash = '%s'", dbesc($fullname), dbesc($network), dbesc(datetime_convert()), @@ -2328,4 +2328,4 @@ function probe_api_path($host) { } return ''; -} \ No newline at end of file +} -- cgit v1.2.3 From b541351a0a52d156085b0f1e06079c1c2e409eb8 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 2 Nov 2016 23:37:57 -0700 Subject: ignore flags to dns_get_record() and look for anything --- include/network.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'include/network.php') diff --git a/include/network.php b/include/network.php index 7cfd3a5e6..fe360c425 100644 --- a/include/network.php +++ b/include/network.php @@ -495,10 +495,13 @@ function z_dns_check($h,$check_mx = 0) { && \App::$config['system']['do_not_check_dns']) return true; - $opts = DNS_A + DNS_CNAME + DNS_PTR; - if($check_mx) - $opts += DNS_MX; - return((@dns_get_record($h, $opts) || filter_var($h, FILTER_VALIDATE_IP)) ? true : false); + + //$opts = DNS_A + DNS_CNAME + DNS_PTR; + //if($check_mx) + // $opts += DNS_MX; + // Specific record type flags are unreliable on FreeBSD and Mac, + // so now we'll ignore these and just check for the existence of any DNS record. + return((@dns_get_record($h) || filter_var($h, FILTER_VALIDATE_IP)) ? true : false); } -- cgit v1.2.3 From a89772652d14db8196dc6c44f289d44613be2fea Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 15 Dec 2016 16:02:52 -0800 Subject: z_fetch_url incorrect variable --- include/network.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include/network.php') diff --git a/include/network.php b/include/network.php index fe360c425..451ce12a1 100644 --- a/include/network.php +++ b/include/network.php @@ -59,7 +59,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { if(x($opts,'filep')) { @curl_setopt($ch, CURLOPT_FILE, $opts['filep']); - @curl_setopt($ch, CURLOPT_HEADER, $false); + @curl_setopt($ch, CURLOPT_HEADER, false); } if(x($opts,'upload')) @@ -87,7 +87,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { @curl_setopt($ch, CURLOPT_TIMEOUT, $opts['timeout']); } else { - $curl_time = intval(get_config('system','curl_timeout')); + $curl_time = intval(@get_config('system','curl_timeout')); @curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60)); } @@ -107,7 +107,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, ((x($opts,'novalidate') && intval($opts['novalidate'])) ? false : true)); - $prx = get_config('system','proxy'); + $prx = @get_config('system','proxy'); if(strlen($prx)) { @curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); @curl_setopt($ch, CURLOPT_PROXY, $prx); @@ -226,7 +226,7 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) { if(x($opts,'filep')) { @curl_setopt($ch, CURLOPT_FILE, $opts['filep']); - @curl_setopt($ch, CURLOPT_HEADER, $false); + @curl_setopt($ch, CURLOPT_HEADER, false); } if(x($opts,'headers')) { @@ -246,7 +246,7 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) { @curl_setopt($ch, CURLOPT_TIMEOUT, $opts['timeout']); } else { - $curl_time = intval(get_config('system','curl_timeout')); + $curl_time = intval(@get_config('system','curl_timeout')); @curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60)); } -- cgit v1.2.3