aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-10-25 21:52:30 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-10-25 21:52:30 -0700
commitc16f314ec348205f4741e0171335168720e652d2 (patch)
tree008aaaf38da2b478eca0a91a0cf4de7bb08dd26f /boot.php
parent1335ef759522ef9f877c8e8fd806cf9bba36297d (diff)
downloadvolse-hubzilla-c16f314ec348205f4741e0171335168720e652d2.tar.gz
volse-hubzilla-c16f314ec348205f4741e0171335168720e652d2.tar.bz2
volse-hubzilla-c16f314ec348205f4741e0171335168720e652d2.zip
two-way subscriptions working with federated social accounts
Diffstat (limited to 'boot.php')
-rw-r--r--boot.php23
1 files changed, 21 insertions, 2 deletions
diff --git a/boot.php b/boot.php
index 8c9248703..1c00598b3 100644
--- a/boot.php
+++ b/boot.php
@@ -409,7 +409,7 @@ function fetch_url($url,$binary = false, &$redirects = 0) {
// post request to $url. $params is an array of post variables.
if(! function_exists('post_url')) {
-function post_url($url,$params, &$redirects = 0) {
+function post_url($url,$params, $headers = null, &$redirects = 0) {
$ch = curl_init($url);
if(($redirects > 8) || (! $ch))
return false;
@@ -419,6 +419,9 @@ function post_url($url,$params, &$redirects = 0) {
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
+ if(is_array($headers))
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+
$check_cert = get_config('system','verifyssl');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, (($check_cert) ? true : false));
$prx = get_config('system','proxy');
@@ -446,7 +449,7 @@ function post_url($url,$params, &$redirects = 0) {
$url_parsed = parse_url($url);
if (isset($url_parsed)) {
$redirects++;
- return post_url($url,$binary,$redirects);
+ return post_url($url,$binary,$headers,$redirects);
}
}
$a = get_app();
@@ -1256,4 +1259,20 @@ function load_view_file($s) {
return file_get_contents($s);
}}
+// for html,xml parsing - let's say you've got
+// an attribute foobar="class1 class2 class3"
+// and you want to find out if it contains 'class3'.
+// you can't use a normal sub string search because you
+// might match 'notclass3' and a regex to do the job is
+// possible but a bit complicated.
+// pass the attribute string as $attr and the attribute you
+// are looking for as $s - returns true if found, otherwise false
+
+if(! function_exists('attribute_contains')) {
+function attribute_contains($attr,$s) {
+ $a = explode(' ', $attr);
+ if(count($a) && in_array($s,$a))
+ return true;
+ return false;
+}}