aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-09-08 20:14:17 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-09-08 20:14:17 -0700
commitffb1997902facb36b78a7cfa522f41f2b3d71cda (patch)
treee9fe47acf26c5fd2c742677f2610b60d3008eb26 /boot.php
parentb49858b038a0a05bbe7685929e88071d0e125538 (diff)
downloadvolse-hubzilla-ffb1997902facb36b78a7cfa522f41f2b3d71cda.tar.gz
volse-hubzilla-ffb1997902facb36b78a7cfa522f41f2b3d71cda.tar.bz2
volse-hubzilla-ffb1997902facb36b78a7cfa522f41f2b3d71cda.zip
mistpark 2.0 infrasturcture lands
Diffstat (limited to 'boot.php')
-rw-r--r--boot.php80
1 files changed, 76 insertions, 4 deletions
diff --git a/boot.php b/boot.php
index e1b5a8e87..4c2526d66 100644
--- a/boot.php
+++ b/boot.php
@@ -21,8 +21,25 @@ define ( 'NOTIFY_WALL', 0x0004 );
define ( 'NOTIFY_COMMENT', 0x0008 );
define ( 'NOTIFY_MAIL', 0x0010 );
-define ( 'NAMESPACE_DFRN' , 'http://purl.org/macgirvin/dfrn/1.0' );
-define ( 'NAMESPACE_ACTIVITY', 'http://activitystrea.ms/schema/1.0/' );
+define ( 'NAMESPACE_DFRN' , 'http://purl.org/macgirvin/dfrn/1.0' );
+define ( 'NAMESPACE_ACTIVITY', 'http://activitystrea.ms/spec/1.0/' );
+define ( 'NAMESPACE_ACTIVITY_SCHEMA', 'http://activitystrea.ms/schema/1.0/');
+define ( 'ACTIVITY_LIKE', NAMESPACE_ACTIVITY_SCHEMA . 'like' );
+define ( 'ACTIVITY_FRIEND', NAMESPACE_ACTIVITY_SCHEMA . 'make-friend' );
+define ( 'ACTIVITY_POST', NAMESPACE_ACTIVITY_SCHEMA . 'post' );
+define ( 'ACTIVITY_UPDATE', NAMESPACE_ACTIVITY_SCHEMA . 'update' );
+
+define ( 'ACTIVITY_OBJ_COMMENT', NAMESPACE_ACTIVITY_SCHEMA . 'comment' );
+define ( 'ACTIVITY_OBJ_NOTE', NAMESPACE_ACTIVITY_SCHEMA . 'note' );
+define ( 'ACTIVITY_OBJ_PERSON', NAMESPACE_ACTIVITY_SCHEMA . 'person' );
+define ( 'ACTIVITY_OBJ_PHOTO', NAMESPACE_ACTIVITY_SCHEMA . 'photo' );
+define ( 'ACTIVITY_OBJ_P_PHOTO', NAMESPACE_ACTIVITY_SCHEMA . 'profile-photo' );
+define ( 'ACTIVITY_OBJ_ALBUM', NAMESPACE_ACTIVITY_SCHEMA . 'photo-album' );
+
+
+define ( 'ACTIVITY_OBJ_HEART', NAMESPACE_DFRN . '/heart' );
+
+
if(! class_exists('App')) {
class App {
@@ -582,8 +599,11 @@ function get_config($family, $key, $instore = false) {
global $a;
if(! $instore) {
- if(isset($a->config[$family][$key]))
+ if(isset($a->config[$family][$key])) {
+ if($a->config[$family][$key] == '!<unset>!')
+ return false;
return $a->config[$family][$key];
+ }
}
$ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
dbesc($family),
@@ -593,6 +613,9 @@ function get_config($family, $key, $instore = false) {
$a->config[$family][$key] = $ret[0]['v'];
return $ret[0]['v'];
}
+ else {
+ $a->config[$family][$key] = '!<unset>!';
+ }
return false;
}}
@@ -667,8 +690,9 @@ function convert_xml_element_to_array($xml_element, &$recursion_depth=0) {
if(! function_exists('webfinger')) {
function webfinger($s) {
- if(! strstr($s,'@'))
+ if(! strstr($s,'@')) {
return $s;
+ }
$host = substr($s,strpos($s,'@') + 1);
$url = 'http://' . $host . '/.well-known/host-meta' ;
$xml = fetch_url($url);
@@ -714,3 +738,51 @@ function webfinger($s) {
return $link['@attributes']['href'];
return '';
}}
+
+if(! function_exists('perms2str')) {
+function perms2str($p) {
+ $ret = '';
+ $tmp = $p;
+ if(is_array($tmp)) {
+ array_walk($tmp,'sanitise_acl');
+ $ret = implode('',$tmp);
+ }
+ return $ret;
+}}
+
+if(! function_exists('item_new_uri')) {
+function item_new_uri($hostname,$uid) {
+
+ do {
+ $dups = false;
+ $hash = random_string();
+
+ $uri = "urn:X-dfrn:" . $hostname . ':' . $uid . ':' . $hash;
+
+ $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
+ dbesc($uri));
+ if(count($r))
+ $dups = true;
+ } while($dups == true);
+ return $uri;
+}}
+
+if(! function_exists('get_uid')) {
+function get_uid() {
+ return ((x($_SESSION,'uid')) ? intval($_SESSION['uid']) : 0) ;
+}}
+
+if(! function_exists('validate_url')) {
+function validate_url($url) {
+ if(substr($url,0,4) != 'http')
+ $url = 'http://' . $url;
+ $h = parse_url($url);
+
+ if(! $h)
+ return false;
+ if(! checkdnsrr($h['host'], 'ANY'))
+ return false;
+ return true;
+}}
+
+