diff options
author | root <root@diekershoff.homeunix.net> | 2010-12-08 06:54:13 +0100 |
---|---|---|
committer | root <root@diekershoff.homeunix.net> | 2010-12-08 06:54:13 +0100 |
commit | a96da925712184eec97f6ca01072b7c2bee92a7e (patch) | |
tree | c0a99dd7bbc6b479b040a8ef08cabee5f0f56e38 /include | |
parent | af48dbec7f87a75a66f79887b6d2419b661e263d (diff) | |
parent | a42b9ea3dea5e1490dd4aa4852760354d569ea51 (diff) | |
download | volse-hubzilla-a96da925712184eec97f6ca01072b7c2bee92a7e.tar.gz volse-hubzilla-a96da925712184eec97f6ca01072b7c2bee92a7e.tar.bz2 volse-hubzilla-a96da925712184eec97f6ca01072b7c2bee92a7e.zip |
Merge branch 'master' of git://github.com/friendika/friendika
Diffstat (limited to 'include')
-rw-r--r-- | include/dba.php | 24 | ||||
-rw-r--r-- | include/items.php | 18 |
2 files changed, 34 insertions, 8 deletions
diff --git a/include/dba.php b/include/dba.php index 4e3f11f7b..fd403b560 100644 --- a/include/dba.php +++ b/include/dba.php @@ -1,12 +1,15 @@ <?php -// MySQL database class -// -// For debugging, insert 'dbg(x);' anywhere in the program flow. -// x = 1: display db success/failure following content -// x = 2: display full queries following content -// x = 3: display full queries using echo; which will mess up display -// really bad but will return output in stubborn cases. +/** + * + * MySQL database class + * + * For debugging, insert 'dbg(1);' anywhere in the program flow. + * dbg(0); will turn it off. Logging is performed at LOGGER_DATA level. + * When logging, all binary info is converted to text and html entities are escaped so that + * the debugging stream is safe to view within both terminals and web pages. + * + */ if(! class_exists('dba')) { class dba { @@ -51,6 +54,13 @@ class dba { logger('dba: ' . $str ); } else { + + /* + * If dbfail.out exists, we will write any failed calls directly to it, + * regardless of any logging that may or may nor be in effect. + * These usually indicate SQL syntax errors that need to be resolved. + */ + if($result === false) { logger('dba: ' . printable($sql) . ' returned false.'); if(file_exists('dbfail.out')) diff --git a/include/items.php b/include/items.php index a4d3953f9..bb1b4f16b 100644 --- a/include/items.php +++ b/include/items.php @@ -367,6 +367,12 @@ function get_atom_elements($feed,$item) { else $res['last-child'] = 0; + $private = $item->get_item_tags(NAMESPACE_DFRN,'private'); + if($private && $private[0]['data'] == 1) + $res['private'] = 1; + else + $res['private'] = 0; + $rawcreated = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10,'published'); if($rawcreated) $res['created'] = unxmlify($rawcreated[0]['data']); @@ -549,6 +555,7 @@ function item_store($arr) { $arr['allow_gid'] = ((x($arr,'allow_gid')) ? trim($arr['allow_gid']) : ''); $arr['deny_cid'] = ((x($arr,'deny_cid')) ? trim($arr['deny_cid']) : ''); $arr['deny_gid'] = ((x($arr,'deny_gid')) ? trim($arr['deny_gid']) : ''); + $arr['private'] = ((x($arr,'private')) ? intval($arr['private']) : 0 ); $arr['body'] = ((x($arr,'body')) ? escape_tags(trim($arr['body'])) : ''); // The content body has been through a lot of filtering and transport escaping by now. @@ -631,15 +638,21 @@ function item_store($arr) { if($arr['parent-uri'] === $arr['uri']) $parent_id = $current_post; + if(strlen($allow_cid) || strlen($allow_gid) || strlen($deny_cid) || strlen($deny_gid)) + $private = 1; + else + $private = $arr['private']; + // Set parent id - and also make sure to inherit the parent's ACL's. $r = q("UPDATE `item` SET `parent` = %d, `allow_cid` = '%s', `allow_gid` = '%s', - `deny_cid` = '%s', `deny_gid` = '%s' WHERE `id` = %d LIMIT 1", + `deny_cid` = '%s', `deny_gid` = '%s', `private` = %d WHERE `id` = %d LIMIT 1", intval($parent_id), dbesc($allow_cid), dbesc($allow_gid), dbesc($deny_cid), dbesc($deny_gid), + intval($private), intval($current_post) ); @@ -1256,6 +1269,9 @@ function atom_entry($item,$type,$author,$owner,$comment = false) { if($item['coord']) $o .= '<georss:point>' . xmlify($item['coord']) . '</georss:point>' . "\r\n"; + if(($item['private']) || strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) + $o .= '<dfrn:private>1</dfrn:private>' . "\r\n"; + $verb = construct_verb($item); $o .= '<as:verb>' . xmlify($verb) . '</as:verb>' . "\r\n"; $actobj = construct_activity_object($item); |