]> git.mxchange.org Git - friendica.git/blobdiff - include/salmon.php
"show all n comments" comes back after toggled and ajax updated, plus connector doc...
[friendica.git] / include / salmon.php
index d998b27043568a2f5a58ae6f2afb5e0e89758312..d7060b0f7a583cb48296c1c2d123f9fd105f0be2 100644 (file)
@@ -18,15 +18,13 @@ function salmon_key($pubkey) {
 }
 
 
-function base64url_encode($s) {
+function base64url_encode($s, $strip_padding = false) {
+
        $s = strtr(base64_encode($s),'+/','-_');
-/*
- *  // placeholder for un-padded base64url_encode 
- *  // per latest salmon rev
- *
- *  $s = str_replace('=','',$s);
- *
- */
+
+       if($strip_padding)
+               $s = str_replace('=','',$s);
+
        return $s;
 }
 
@@ -130,7 +128,8 @@ $namespaces = <<< EOT
       xmlns:dfrn="http://purl.org/macgirvin/dfrn/1.0" 
       xmlns:as="http://activitystrea.ms/spec/1.0/"
       xmlns:georss="http://www.georss.org/georss" 
-      xmlns:poco="http://portablecontacts.net/spec/1.0" >
+      xmlns:poco="http://portablecontacts.net/spec/1.0" 
+      xmlns:ostatus="http://ostatus.org/schema/1.0" >
 EOT;
 
        $slap = str_replace('<entry>',$namespaces,$slap);
@@ -162,7 +161,7 @@ EOT;
 
        $signature2  = base64url_encode($rsa->sign($data));
 
-       $salmon_tpl = load_view_file('view/magicsig.tpl');
+       $salmon_tpl = get_markup_template('magicsig.tpl');
        $salmon = replace_macros($salmon_tpl,array(
                '$data'      => $data,
                '$encoding'  => $encoding,
@@ -182,7 +181,9 @@ EOT;
 
        // check for success, e.g. 2xx
 
-       if(($return_code >= 200) && ($return_code < 300)) {
+       if($return_code > 299) {
+
+               logger('slapper: compliant salmon failed. Falling back to status.net hack');
 
                // Entirely likely that their salmon implementation is
                // non-compliant. Let's try once more, this time only signing