aboutsummaryrefslogtreecommitdiffstats
path: root/include/network.php
diff options
context:
space:
mode:
authorKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2016-10-02 00:41:25 +0200
committerKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2016-10-13 11:27:23 +0200
commit7b41839ea8f2aad020444c42f2cba89040ca28b8 (patch)
treeacf1495c556a0ce82823e47ebcdfa21377f92b61 /include/network.php
parent6532972e61a2aa5e8517ebcca3113adb3c8f336d (diff)
downloadvolse-hubzilla-7b41839ea8f2aad020444c42f2cba89040ca28b8.tar.gz
volse-hubzilla-7b41839ea8f2aad020444c42f2cba89040ca28b8.tar.bz2
volse-hubzilla-7b41839ea8f2aad020444c42f2cba89040ca28b8.zip
[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.
Diffstat (limited to 'include/network.php')
-rw-r--r--include/network.php128
1 files changed, 64 insertions, 64 deletions
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&para2=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&para2=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 <status> variable
-// of $st and an optional text <message> of $message and terminates the current process.
+// Outputs a basic dfrn XML status structure to STDOUT, with a <status> variable
+// of $st and an optional text <message> 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 =