aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/account.php6
-rw-r--r--include/acl_selectors.php4
-rw-r--r--include/api.php2
-rw-r--r--include/channel.php20
-rw-r--r--include/contact_widgets.php4
-rwxr-xr-xinclude/dba/dba_driver.php7
-rw-r--r--include/event.php4
-rw-r--r--include/feedutils.php2
-rw-r--r--include/group.php20
-rw-r--r--include/import.php12
-rwxr-xr-xinclude/items.php54
-rw-r--r--include/oauth.php12
-rwxr-xr-xinclude/plugin.php18
-rw-r--r--include/taxonomy.php18
-rw-r--r--include/text.php2
-rw-r--r--include/widgets.php10
-rw-r--r--include/zot.php25
17 files changed, 124 insertions, 96 deletions
diff --git a/include/account.php b/include/account.php
index a442f3073..caf12878e 100644
--- a/include/account.php
+++ b/include/account.php
@@ -229,7 +229,7 @@ function verify_email_address($arr) {
$hash = random_string();
- $r = q("INSERT INTO register ( hash, created, uid, password, language ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ",
+ $r = q("INSERT INTO register ( hash, created, uid, password, lang ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ",
dbesc($hash),
dbesc(datetime_convert()),
intval($arr['account']['account_id']),
@@ -283,7 +283,7 @@ function send_reg_approval_email($arr) {
$hash = random_string();
- $r = q("INSERT INTO register ( hash, created, uid, password, language ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ",
+ $r = q("INSERT INTO register ( hash, created, uid, password, lang ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ",
dbesc($hash),
dbesc(datetime_convert()),
intval($arr['account']['account_id']),
@@ -387,7 +387,7 @@ function account_allow($hash) {
intval($register[0]['uid'])
);
- push_lang($register[0]['language']);
+ push_lang($register[0]['lang']);
$email_tpl = get_intltext_template("register_open_eml.tpl");
$email_tpl = replace_macros($email_tpl, array(
diff --git a/include/acl_selectors.php b/include/acl_selectors.php
index 54ea0304b..89d054e3b 100644
--- a/include/acl_selectors.php
+++ b/include/acl_selectors.php
@@ -15,7 +15,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" >\r\n";
- $r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC",
+ $r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `gname` ASC",
intval(local_channel())
);
@@ -32,7 +32,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
$selected = " selected=\"selected\" ";
else
$selected = '';
- $trimmed = mb_substr($rr['name'],0,12);
+ $trimmed = mb_substr($rr['gname'],0,12);
$o .= "<option value=\"{$rr['id']}\" $selected title=\"{$rr['name']}\" >$trimmed</option>\r\n";
}
diff --git a/include/api.php b/include/api.php
index af5a22a74..0833ae7b9 100644
--- a/include/api.php
+++ b/include/api.php
@@ -368,7 +368,7 @@ require_once('include/api_auth.php');
else
$redirect = trim($_REQUEST['redirect_uris']);
$icon = trim($_REQUEST['logo_uri']);
- $r = q("INSERT INTO clients (client_id, pw, name, redirect_uri, icon, uid)
+ $r = q("INSERT INTO clients (client_id, pw, clname, redirect_uri, icon, uid)
VALUES ('%s','%s','%s','%s','%s',%d)",
dbesc($key),
dbesc($secret),
diff --git a/include/channel.php b/include/channel.php
index 35084741f..0e5490c86 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -337,7 +337,7 @@ function create_identity($arr) {
// Not checking return value.
// It's ok for this to fail if it's an imported channel, and therefore the hash is a duplicate
- $r = q("INSERT INTO profile ( aid, uid, profile_guid, profile_name, is_default, publish, name, photo, thumb)
+ $r = q("INSERT INTO profile ( aid, uid, profile_guid, profile_name, is_default, publish, fullname, photo, thumb)
VALUES ( %d, %d, '%s', '%s', %d, %d, '%s', '%s', '%s') ",
intval($ret['channel']['channel_account_id']),
intval($newuid),
@@ -392,7 +392,7 @@ function create_identity($arr) {
// if our role_permissions indicate that we're using a default collection ACL, add it.
if(is_array($role_permissions) && $role_permissions['default_collection']) {
- $r = q("select hash from groups where uid = %d and name = '%s' limit 1",
+ $r = q("select hash from groups where uid = %d and gname = '%s' limit 1",
intval($newuid),
dbesc( t('Friends') )
);
@@ -561,7 +561,7 @@ function identity_basic_export($channel_id, $items = false) {
// All other term types will be included in items, if requested.
- $r = q("select * from term where type in (%d,%d) and uid = %d",
+ $r = q("select * from term where ttype in (%d,%d) and uid = %d",
intval(TERM_SAVEDSEARCH),
intval(TERM_THING),
intval($channel_id)
@@ -1257,7 +1257,7 @@ function advanced_profile(&$a) {
if(! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),'view_profile'))
return '';
- if(App::$profile['name']) {
+ if(App::$profile['fullname']) {
$profile_fields_basic = get_profile_fields_basic();
$profile_fields_advanced = get_profile_fields_advanced();
@@ -1281,7 +1281,7 @@ function advanced_profile(&$a) {
$profile = array();
- $profile['fullname'] = array( t('Full Name:'), App::$profile['name'] ) ;
+ $profile['fullname'] = array( t('Full Name:'), App::$profile['fullname'] ) ;
if(App::$profile['gender']) $profile['gender'] = array( t('Gender:'), App::$profile['gender'] );
@@ -1329,8 +1329,8 @@ function advanced_profile(&$a) {
if(App::$profile['marital'])
$profile['marital'] = array( t('Status:'), App::$profile['marital']);
- if(App::$profile['with'])
- $profile['marital']['with'] = bbcode(App::$profile['with']);
+ if(App::$profile['partner'])
+ $profile['marital']['partner'] = bbcode(App::$profile['partner']);
if(strlen(App::$profile['howlong']) && App::$profile['howlong'] !== NULL_DATE) {
$profile['howlong'] = relative_date(App::$profile['howlong'], t('for %1$d %2$s'));
@@ -1370,7 +1370,7 @@ function advanced_profile(&$a) {
if($txt = prepare_text(App::$profile['romance'])) $profile['romance'] = array( t('Love/Romance:'), $txt);
- if($txt = prepare_text(App::$profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt);
+ if($txt = prepare_text(App::$profile['employment'])) $profile['employment'] = array( t('Work/employment:'), $txt);
if($txt = prepare_text(App::$profile['education'])) $profile['education'] = array( t('School/education:'), $txt );
@@ -1658,7 +1658,7 @@ function get_profile_fields_basic($filter = 0) {
$profile_fields_basic = (($filter == 0) ? get_config('system','profile_fields_basic') : null);
if(! $profile_fields_basic)
- $profile_fields_basic = array('name','pdesc','chandesc','gender','dob','dob_tz','address','locality','region','postal_code','country_name','marital','sexual','homepage','hometown','keywords','about','contact');
+ $profile_fields_basic = array('fullname','pdesc','chandesc','gender','dob','dob_tz','address','locality','region','postal_code','country_name','marital','sexual','homepage','hometown','keywords','about','contact');
$x = array();
if($profile_fields_basic)
@@ -1673,7 +1673,7 @@ function get_profile_fields_advanced($filter = 0) {
$basic = get_profile_fields_basic($filter);
$profile_fields_advanced = (($filter == 0) ? get_config('system','profile_fields_advanced') : null);
if(! $profile_fields_advanced)
- $profile_fields_advanced = array('with','howlong','politic','religion','likes','dislikes','interest','channels','music','book','film','tv','romance','work','education');
+ $profile_fields_advanced = array('partner','howlong','politic','religion','likes','dislikes','interest','channels','music','book','film','tv','romance','employment','education');
$x = array();
if($basic)
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index 14d26e257..85c46b0d1 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -39,7 +39,7 @@ function fileas_widget($baseurl,$selected = '') {
return '';
$terms = array();
- $r = q("select distinct(term) from term where uid = %d and type = %d order by term asc",
+ $r = q("select distinct(term) from term where uid = %d and ttype = %d order by term asc",
intval(local_channel()),
intval(TERM_FILE)
);
@@ -72,7 +72,7 @@ function categories_widget($baseurl,$selected = '') {
from term join item on term.oid = item.id
where item.uid = %d
and term.uid = item.uid
- and term.type = %d
+ and term.ttype = %d
and term.otype = %d
and item.owner_xchan = '%s'
and item.item_wall = 1
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index 0ab5830ed..df072ed76 100755
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -12,7 +12,7 @@ class DBA {
static public $dba = null;
static public $dbtype = null;
-
+ static public $logging = false;
/**
* @brief Returns the database driver object.
@@ -421,8 +421,13 @@ function db_getfunc($f) {
function db_logger($s,$level = LOGGER_NORMAL,$syslog = LOG_INFO) {
+ if(\DBA::$logging)
+ return;
+
$saved = \DBA::$dba->debug;
\DBA::$dba->debug = false;
+ \DBA::$logging = true;
logger($s,$level,$syslog);
+ \DBA::$logging = false;
\DBA::$dba->debug = $saved;
} \ No newline at end of file
diff --git a/include/event.php b/include/event.php
index db67dac64..81e403d37 100644
--- a/include/event.php
+++ b/include/event.php
@@ -854,12 +854,12 @@ function event_store_item($arr, $event) {
if(($arr['term']) && (is_array($arr['term']))) {
foreach($arr['term'] as $t) {
- q("insert into term (uid,oid,otype,type,term,url)
+ q("insert into term (uid,oid,otype,ttype,term,url)
values(%d,%d,%d,%d,'%s','%s') ",
intval($arr['uid']),
intval($r[0]['id']),
intval(TERM_OBJ_POST),
- intval($t['type']),
+ intval($t['ttype']),
dbesc($t['term']),
dbesc($t['url'])
);
diff --git a/include/feedutils.php b/include/feedutils.php
index f370c540a..fb938cfdd 100644
--- a/include/feedutils.php
+++ b/include/feedutils.php
@@ -515,7 +515,7 @@ function get_atom_elements($feed, $item, &$author) {
if($termterm) {
$terms[] = array(
'otype' => TERM_OBJ_POST,
- 'type' => $termtype,
+ 'ttype' => $termtype,
'url' => $termurl,
'term' => $termterm,
);
diff --git a/include/group.php b/include/group.php
index 748ec0c13..a4938b848 100644
--- a/include/group.php
+++ b/include/group.php
@@ -18,7 +18,7 @@ function group_add($uid,$name,$public = 0) {
intval($r)
);
if(count($z) && $z[0]['deleted']) {
- /*$r = q("UPDATE `groups` SET `deleted` = 0 WHERE `uid` = %d AND `name` = '%s' LIMIT 1",
+ /*$r = q("UPDATE `groups` SET `deleted` = 0 WHERE `uid` = %d AND `gname` = '%s' LIMIT 1",
intval($uid),
dbesc($name)
);*/
@@ -38,7 +38,7 @@ function group_add($uid,$name,$public = 0) {
} while($dups == true);
- $r = q("INSERT INTO `groups` ( hash, uid, visible, name )
+ $r = q("INSERT INTO `groups` ( hash, uid, visible, gname )
VALUES( '%s', %d, %d, '%s' ) ",
dbesc($hash),
intval($uid),
@@ -57,7 +57,7 @@ function group_add($uid,$name,$public = 0) {
function group_rmv($uid,$name) {
$ret = false;
if(x($uid) && x($name)) {
- $r = q("SELECT id, hash FROM `groups` WHERE `uid` = %d AND `name` = '%s' LIMIT 1",
+ $r = q("SELECT id, hash FROM `groups` WHERE `uid` = %d AND `gname` = '%s' LIMIT 1",
intval($uid),
dbesc($name)
);
@@ -108,7 +108,7 @@ function group_rmv($uid,$name) {
);
// remove group
- $r = q("UPDATE `groups` SET `deleted` = 1 WHERE `uid` = %d AND `name` = '%s'",
+ $r = q("UPDATE `groups` SET `deleted` = 1 WHERE `uid` = %d AND `gname` = '%s'",
intval($uid),
dbesc($name)
);
@@ -125,7 +125,7 @@ function group_rmv($uid,$name) {
function group_byname($uid,$name) {
if((! $uid) || (! strlen($name)))
return false;
- $r = q("SELECT * FROM `groups` WHERE `uid` = %d AND `name` = '%s' LIMIT 1",
+ $r = q("SELECT * FROM `groups` WHERE `uid` = %d AND `gname` = '%s' LIMIT 1",
intval($uid),
dbesc($name)
);
@@ -232,13 +232,13 @@ function mini_group_select($uid,$group = '') {
$grps = array();
$o = '';
- $r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC",
+ $r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `gname` ASC",
intval($uid)
);
$grps[] = array('name' => '', 'hash' => '0', 'selected' => '');
if(count($r)) {
foreach($r as $rr) {
- $grps[] = array('name' => $rr['name'], 'id' => $rr['hash'], 'selected' => (($group == $rr['hash']) ? 'true' : ''));
+ $grps[] = array('name' => $rr['gname'], 'id' => $rr['hash'], 'selected' => (($group == $rr['hash']) ? 'true' : ''));
}
}
@@ -271,7 +271,7 @@ function group_side($every="connections",$each="group",$edit = false, $group_id
);
- $r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC",
+ $r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `gname` ASC",
intval($_SESSION['uid'])
);
$member_of = array();
@@ -296,7 +296,7 @@ function group_side($every="connections",$each="group",$edit = false, $group_id
'id' => $rr['id'],
'enc_cid' => base64url_encode($cid),
'cid' => $cid,
- 'text' => $rr['name'],
+ 'text' => $rr['gname'],
'selected' => $selected,
'href' => (($mode == 0) ? $each.'?f=&gid='.$rr['id'] : $each."/".$rr['id']) . ((x($_GET,'new')) ? '&new=' . $_GET['new'] : '') . ((x($_GET,'order')) ? '&order=' . $_GET['order'] : ''),
'edit' => $groupedit,
@@ -340,7 +340,7 @@ function expand_groups($a) {
function member_of($c) {
- $r = q("SELECT `groups`.`name`, `groups`.`id` FROM `groups` LEFT JOIN `group_member` ON `group_member`.`gid` = `groups`.`id` WHERE `group_member`.`xchan` = '%s' AND `groups`.`deleted` = 0 ORDER BY `groups`.`name` ASC ",
+ $r = q("SELECT `groups`.`gname`, `groups`.`id` FROM `groups` LEFT JOIN `group_member` ON `group_member`.`gid` = `groups`.`id` WHERE `group_member`.`xchan` = '%s' AND `groups`.`deleted` = 0 ORDER BY `groups`.`gname` ASC ",
dbesc($c)
);
diff --git a/include/import.php b/include/import.php
index 132306621..d094fb582 100644
--- a/include/import.php
+++ b/include/import.php
@@ -332,7 +332,9 @@ function import_apps($channel,$apps) {
);
if($x) {
foreach($term as $t) {
- store_item_tag($channel['channel_id'],$x[0]['id'],TERM_OBJ_APP,$t['type'],escape_tags($t['term']),escape_tags($t['url']));
+ if(array_key_exists('type',$t))
+ $t['ttype'] = $t['type'];
+ store_item_tag($channel['channel_id'],$x[0]['id'],TERM_OBJ_APP,$t['ttype'],escape_tags($t['term']),escape_tags($t['url']));
}
}
}
@@ -400,7 +402,9 @@ function sync_apps($channel,$apps) {
if($exists && $term) {
foreach($term as $t) {
- store_item_tag($channel['channel_id'],$exists['id'],TERM_OBJ_APP,$t['type'],escape_tags($t['term']),escape_tags($t['url']));
+ if(array_key_exists('type',$t))
+ $t['ttype'] = $t['type'];
+ store_item_tag($channel['channel_id'],$exists['id'],TERM_OBJ_APP,$t['ttype'],escape_tags($t['term']),escape_tags($t['url']));
}
}
@@ -436,7 +440,9 @@ function sync_apps($channel,$apps) {
);
if($x) {
foreach($term as $t) {
- store_item_tag($channel['channel_id'],$x[0]['id'],TERM_OBJ_APP,$t['type'],escape_tags($t['term']),escape_tags($t['url']));
+ if(array_key_exists('type',$t))
+ $t['ttype'] = $t['type'];
+ store_item_tag($channel['channel_id'],$x[0]['id'],TERM_OBJ_APP,$t['ttype'],escape_tags($t['term']),escape_tags($t['url']));
}
}
}
diff --git a/include/items.php b/include/items.php
index a60c10bdd..b283ed3ab 100755
--- a/include/items.php
+++ b/include/items.php
@@ -1182,8 +1182,8 @@ function encode_item_terms($terms,$mirror = false) {
if($terms) {
foreach($terms as $term) {
- if(in_array($term['type'],$allowed_export_terms))
- $ret[] = array('tag' => $term['term'], 'url' => $term['url'], 'type' => termtype($term['type']));
+ if(in_array($term['ttype'],$allowed_export_terms))
+ $ret[] = array('tag' => $term['term'], 'url' => $term['url'], 'ttype' => termtype($term['type']));
}
}
@@ -1240,39 +1240,41 @@ function decode_tags($t) {
$ret = array();
foreach($t as $x) {
$tag = array();
+ if(array_key_exists('type',$x))
+ $x['ttype'] = $x['type'];
$tag['term'] = htmlspecialchars($x['tag'], ENT_COMPAT, 'UTF-8', false);
$tag['url'] = htmlspecialchars($x['url'], ENT_COMPAT, 'UTF-8', false);
- switch($x['type']) {
+ switch($x['ttype']) {
case 'hashtag':
- $tag['type'] = TERM_HASHTAG;
+ $tag['ttype'] = TERM_HASHTAG;
break;
case 'mention':
- $tag['type'] = TERM_MENTION;
+ $tag['ttype'] = TERM_MENTION;
break;
case 'category':
- $tag['type'] = TERM_CATEGORY;
+ $tag['ttype'] = TERM_CATEGORY;
break;
case 'private_category':
- $tag['type'] = TERM_PCATEGORY;
+ $tag['ttype'] = TERM_PCATEGORY;
break;
case 'file':
- $tag['type'] = TERM_FILE;
+ $tag['ttype'] = TERM_FILE;
break;
case 'search':
- $tag['type'] = TERM_SEARCH;
+ $tag['ttype'] = TERM_SEARCH;
break;
case 'thing':
- $tag['type'] = TERM_THING;
+ $tag['ttype'] = TERM_THING;
break;
case 'bookmark':
- $tag['type'] = TERM_BOOKMARK;
+ $tag['ttype'] = TERM_BOOKMARK;
break;
case 'communitytag':
- $tag['type'] = TERM_COMMUNITYTAG;
+ $tag['ttype'] = TERM_COMMUNITYTAG;
break;
default:
case 'unknown':
- $tag['type'] = TERM_UNKNOWN;
+ $tag['ttype'] = TERM_UNKNOWN;
break;
}
$ret[] = $tag;
@@ -1855,12 +1857,12 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
if(($terms) && (is_array($terms))) {
foreach($terms as $t) {
- q("insert into term (uid,oid,otype,type,term,url)
+ q("insert into term (uid,oid,otype,ttype,term,url)
values(%d,%d,%d,%d,'%s','%s') ",
intval($arr['uid']),
intval($current_post),
intval(TERM_OBJ_POST),
- intval($t['type']),
+ intval($t['ttype']),
dbesc($t['term']),
dbesc($t['url'])
);
@@ -2134,12 +2136,12 @@ function item_store_update($arr,$allow_exec = false, $deliver = true) {
if(is_array($terms)) {
foreach($terms as $t) {
- q("insert into term (uid,oid,otype,type,term,url)
+ q("insert into term (uid,oid,otype,ttype,term,url)
values(%d,%d,%d,%d,'%s','%s') ",
intval($uid),
intval($orig_post_id),
intval(TERM_OBJ_POST),
- intval($t['type']),
+ intval($t['ttype']),
dbesc($t['term']),
dbesc($t['url'])
);
@@ -2720,7 +2722,7 @@ function start_delivery_chain($channel, $item, $item_id, $parent) {
foreach($tags as $tt) {
$tt = trim($tt);
if($tt) {
- q("insert into term (uid,oid,otype,type,term,url)
+ q("insert into term (uid,oid,otype,ttype,term,url)
values(%d,%d,%d,%d,'%s','%s') ",
intval($channel['channel_id']),
intval($item_id),
@@ -2863,7 +2865,7 @@ function check_item_source($uid, $item) {
foreach($words as $word) {
if(substr($word,0,1) === '#' && $tags) {
foreach($tags as $t)
- if((($t['type'] == TERM_HASHTAG) || ($t['type'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
+ if((($t['ttype'] == TERM_HASHTAG) || ($t['ttype'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
return true;
}
elseif((strpos($word,'/') === 0) && preg_match($word,$text))
@@ -2916,7 +2918,7 @@ function post_is_importable($item,$abook) {
continue;
if(substr($word,0,1) === '#' && $tags) {
foreach($tags as $t)
- if((($t['type'] == TERM_HASHTAG) || ($t['type'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
+ if((($t['ttype'] == TERM_HASHTAG) || ($t['ttype'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
return false;
}
elseif((strpos($word,'/') === 0) && preg_match($word,$text))
@@ -2937,7 +2939,7 @@ function post_is_importable($item,$abook) {
continue;
if(substr($word,0,1) === '#' && $tags) {
foreach($tags as $t)
- if((($t['type'] == TERM_HASHTAG) || ($t['type'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
+ if((($t['ttype'] == TERM_HASHTAG) || ($t['ttype'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
return true;
}
elseif((strpos($word,'/') === 0) && preg_match($word,$text))
@@ -3214,7 +3216,7 @@ function item_getfeedtags($item) {
if(count($terms)) {
foreach($terms as $term) {
- if(($term['type'] == TERM_HASHTAG) || ($term['type'] == TERM_COMMUNITYTAG))
+ if(($term['ttype'] == TERM_HASHTAG) || ($term['ttype'] == TERM_COMMUNITYTAG))
$ret[] = array('#',$term['url'],$term['term']);
else
$ret[] = array('@',$term['url'],$term['term']);
@@ -3685,7 +3687,7 @@ function fetch_post_tags($items,$link = false) {
for($x = 0; $x < count($items); $x ++) {
if($tags) {
foreach($tags as $t) {
- if(($link) && ($t['type'] == TERM_MENTION))
+ if(($link) && ($t['ttype'] == TERM_MENTION))
$t['url'] = chanlink_url($t['url']);
if(array_key_exists('item_id',$items[$x])) {
if($t['oid'] == $items[$x]['item_id']) {
@@ -3895,8 +3897,8 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
}
$contact_str = '';
- /** @FIXME $group is undefined */
- $contacts = group_get_members($group);
+
+ $contacts = group_get_members($r[0]['id']);
if ($contacts) {
foreach($contacts as $c) {
if($contact_str)
@@ -3913,7 +3915,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str)) or allow_gid like '" . protect_sprintf('%<' . dbesc($r[0]['hash']) . '>%') . "' ) and id = parent $item_normal ) ";
$x = group_rec_byhash($uid,$r[0]['hash']);
- $result['headline'] = sprintf( t('Privacy group: %s'),$x['name']);
+ $result['headline'] = sprintf( t('Privacy group: %s'),$x['gname']);
}
elseif($arr['cid'] && $uid) {
diff --git a/include/oauth.php b/include/oauth.php
index ec41a5dd2..984e0e6c6 100644
--- a/include/oauth.php
+++ b/include/oauth.php
@@ -37,7 +37,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore {
logger(__function__.":".$consumer.", ". $token_type.", ".$token, LOGGER_DEBUG);
- $r = q("SELECT id, secret, scope, expires, uid FROM tokens WHERE client_id = '%s' AND scope = '%s' AND id = '%s'",
+ $r = q("SELECT id, secret, auth_scope, expires, uid FROM tokens WHERE client_id = '%s' AND auth_scope = '%s' AND id = '%s'",
dbesc($consumer->key),
dbesc($token_type),
dbesc($token)
@@ -45,7 +45,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore {
if (count($r)){
$ot=new OAuth1Token($r[0]['id'],$r[0]['secret']);
- $ot->scope=$r[0]['scope'];
+ $ot->scope=$r[0]['auth_scope'];
$ot->expires = $r[0]['expires'];
$ot->uid = $r[0]['uid'];
return $ot;
@@ -79,7 +79,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore {
$k = $consumer;
}
- $r = q("INSERT INTO tokens (id, secret, client_id, scope, expires) VALUES ('%s','%s','%s','%s', %d)",
+ $r = q("INSERT INTO tokens (id, secret, client_id, auth_scope, expires) VALUES ('%s','%s','%s','%s', %d)",
dbesc($key),
dbesc($sec),
dbesc($k),
@@ -110,7 +110,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore {
$key = $this->gen_token();
$sec = $this->gen_token();
- $r = q("INSERT INTO tokens (id, secret, client_id, scope, expires, uid) VALUES ('%s','%s','%s','%s', %d, %d)",
+ $r = q("INSERT INTO tokens (id, secret, client_id, auth_scope, expires, uid) VALUES ('%s','%s','%s','%s', %d, %d)",
dbesc($key),
dbesc($sec),
dbesc($consumer->key),
@@ -249,7 +249,7 @@ class FKOAuth2 extends OAuth2 {
protected function getAuthCode($code) {
- $r = q("SELECT id, client_id, redirect_uri, expires, scope FROM auth_codes WHERE id = '%s'",
+ $r = q("SELECT id, client_id, redirect_uri, expires, auth_scope FROM auth_codes WHERE id = '%s'",
dbesc($code));
if (count($r))
@@ -259,7 +259,7 @@ class FKOAuth2 extends OAuth2 {
protected function setAuthCode($code, $client_id, $redirect_uri, $expires, $scope = NULL) {
$r = q("INSERT INTO auth_codes
- (id, client_id, redirect_uri, expires, scope) VALUES
+ (id, client_id, redirect_uri, expires, auth_scope) VALUES
('%s', '%s', '%s', %d, '%s')",
dbesc($code),
dbesc($client_id),
diff --git a/include/plugin.php b/include/plugin.php
index 5dbfc218a..be4e92f03 100755
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -300,12 +300,18 @@ function call_hooks($name, &$data = null) {
$func($data);
else
$func($a, $data);
- } else {
- q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'",
- dbesc($name),
- dbesc($hook[0]),
- dbesc($origfn)
- );
+ }
+ else {
+
+ // Don't do any DB write calls if we're currently logging a possibly failed DB call.
+ if(! DBA::$logging) {
+ // The hook should be removed so we don't process it.
+ q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'",
+ dbesc($name),
+ dbesc($hook[0]),
+ dbesc($origfn)
+ );
+ }
}
}
}
diff --git a/include/taxonomy.php b/include/taxonomy.php
index e43f5e5d0..177215fe8 100644
--- a/include/taxonomy.php
+++ b/include/taxonomy.php
@@ -20,7 +20,7 @@ function file_tag_file_query($table,$s,$type = 'file') {
else
$termtype = TERM_CATEGORY;
- return sprintf(" AND " . (($table) ? dbesc($table) . '.' : '') . "id in (select term.oid from term where term.type = %d and term.term = '%s' and term.uid = " . (($table) ? dbesc($table) . '.' : '') . "uid ) ",
+ return sprintf(" AND " . (($table) ? dbesc($table) . '.' : '') . "id in (select term.oid from term where term.ttype = %d and term.term = '%s' and term.uid = " . (($table) ? dbesc($table) . '.' : '') . "uid ) ",
intval($termtype),
protect_sprintf(dbesc($s))
);
@@ -29,14 +29,14 @@ function file_tag_file_query($table,$s,$type = 'file') {
function term_query($table,$s,$type = TERM_UNKNOWN, $type2 = '') {
if($type2) {
- return sprintf(" AND " . (($table) ? dbesc($table) . '.' : '') . "id in (select term.oid from term where term.type in (%d, %d) and term.term = '%s' and term.uid = " . (($table) ? dbesc($table) . '.' : '') . "uid ) ",
+ return sprintf(" AND " . (($table) ? dbesc($table) . '.' : '') . "id in (select term.oid from term where term.ttype in (%d, %d) and term.term = '%s' and term.uid = " . (($table) ? dbesc($table) . '.' : '') . "uid ) ",
intval($type),
intval($type2),
protect_sprintf(dbesc($s))
);
}
else {
- return sprintf(" AND " . (($table) ? dbesc($table) . '.' : '') . "id in (select term.oid from term where term.type = %d and term.term = '%s' and term.uid = " . (($table) ? dbesc($table) . '.' : '') . "uid ) ",
+ return sprintf(" AND " . (($table) ? dbesc($table) . '.' : '') . "id in (select term.oid from term where term.ttype = %d and term.term = '%s' and term.uid = " . (($table) ? dbesc($table) . '.' : '') . "uid ) ",
intval($type),
protect_sprintf(dbesc($s))
);
@@ -49,7 +49,7 @@ function store_item_tag($uid,$iid,$otype,$type,$term,$url = '') {
return false;
$r = q("select * from term
- where uid = %d and oid = %d and otype = %d and type = %d
+ where uid = %d and oid = %d and otype = %d and ttype = %d
and term = '%s' and url = '%s' ",
intval($uid),
intval($iid),
@@ -61,7 +61,7 @@ function store_item_tag($uid,$iid,$otype,$type,$term,$url = '') {
if($r)
return false;
- $r = q("insert into term (uid, oid, otype, type, term, url)
+ $r = q("insert into term (uid, oid, otype, ttype, term, url)
values( %d, %d, %d, %d, '%s', '%s') ",
intval($uid),
intval($iid),
@@ -85,7 +85,7 @@ function get_terms_oftype($arr,$type) {
foreach($type as $t)
foreach($arr as $x)
- if($x['type'] == $t)
+ if($x['ttype'] == $t)
$ret[] = $x;
return $ret;
@@ -93,9 +93,9 @@ function get_terms_oftype($arr,$type) {
function format_term_for_display($term) {
$s = '';
- if(($term['type'] == TERM_HASHTAG) || ($term['type'] == TERM_COMMUNITYTAG))
+ if(($term['ttype'] == TERM_HASHTAG) || ($term['ttype'] == TERM_COMMUNITYTAG))
$s .= '#';
- elseif($term['type'] == TERM_MENTION)
+ elseif($term['ttype'] == TERM_MENTION)
$s .= '@';
else
return $s;
@@ -142,7 +142,7 @@ function tagadelic($uid, $count = 0, $authors = '', $owner = '', $flags = 0, $re
// Fetch tags
$r = q("select term, count(term) as total from term left join item on term.oid = item.id
- where term.uid = %d and term.type = %d
+ where term.uid = %d and term.ttype = %d
and otype = %d and item_type = %d and item_private = 0
$sql_options $item_normal
group by term order by total desc %s",
diff --git a/include/text.php b/include/text.php
index 375a89d3f..c57f5fce4 100644
--- a/include/text.php
+++ b/include/text.php
@@ -810,7 +810,7 @@ function get_mentions($item,$tags) {
return $o;
foreach($tags as $x) {
- if($x['type'] == TERM_MENTION) {
+ if($x['ttype'] == TERM_MENTION) {
$o .= "\t\t" . '<link rel="mentioned" href="' . $x['url'] . '" />' . "\r\n";
$o .= "\t\t" . '<link rel="ostatus:attention" href="' . $x['url'] . '" />' . "\r\n";
}
diff --git a/include/widgets.php b/include/widgets.php
index b9cb8e50d..17a76c0f4 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -212,13 +212,13 @@ function widget_savedsearch($arr) {
$search = ((x($_GET,'search')) ? $_GET['search'] : '');
if(x($_GET,'searchsave') && $search) {
- $r = q("select * from `term` where `uid` = %d and `type` = %d and `term` = '%s' limit 1",
+ $r = q("select * from `term` where `uid` = %d and `ttype` = %d and `term` = '%s' limit 1",
intval(local_channel()),
intval(TERM_SAVEDSEARCH),
dbesc($search)
);
if(! $r) {
- q("insert into `term` ( `uid`,`type`,`term` ) values ( %d, %d, '%s') ",
+ q("insert into `term` ( `uid`,`ttype`,`term` ) values ( %d, %d, '%s') ",
intval(local_channel()),
intval(TERM_SAVEDSEARCH),
dbesc($search)
@@ -227,7 +227,7 @@ function widget_savedsearch($arr) {
}
if(x($_GET,'searchremove') && $search) {
- q("delete from `term` where `uid` = %d and `type` = %d and `term` = '%s'",
+ q("delete from `term` where `uid` = %d and `ttype` = %d and `term` = '%s'",
intval(local_channel()),
intval(TERM_SAVEDSEARCH),
dbesc($search)
@@ -254,7 +254,7 @@ function widget_savedsearch($arr) {
$o = '';
- $r = q("select `tid`,`term` from `term` WHERE `uid` = %d and `type` = %d ",
+ $r = q("select `tid`,`term` from `term` WHERE `uid` = %d and `ttype` = %d ",
intval(local_channel()),
intval(TERM_SAVEDSEARCH)
);
@@ -296,7 +296,7 @@ function widget_filer($arr) {
$selected = ((x($_REQUEST,'file')) ? $_REQUEST['file'] : '');
$terms = array();
- $r = q("select distinct(term) from term where uid = %d and type = %d order by term asc",
+ $r = q("select distinct(term) from term where uid = %d and ttype = %d order by term asc",
intval(local_channel()),
intval(TERM_FILE)
);
diff --git a/include/zot.php b/include/zot.php
index 45c9238b2..af79b5723 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1953,7 +1953,7 @@ function remove_community_tag($sender, $arr, $uid) {
return;
}
- q("delete from term where uid = %d and oid = %d and otype = %d and type in ( %d, %d ) and term = '%s' and url = '%s'",
+ q("delete from term where uid = %d and oid = %d and otype = %d and ttype in ( %d, %d ) and term = '%s' and url = '%s'",
intval($uid),
intval($r[0]['id']),
intval(TERM_OBJ_POST),
@@ -3051,7 +3051,7 @@ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) {
}
if($groups_changed) {
- $r = q("select hash as collection, visible, deleted, name from groups where uid = %d",
+ $r = q("select hash as collection, visible, deleted, gname as name from groups where uid = %d",
intval($uid)
);
if($r)
@@ -3344,10 +3344,10 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
}
}
if($found) {
- if(($y['name'] != $cl['name'])
+ if(($y['gname'] != $cl['name'])
|| ($y['visible'] != $cl['visible'])
|| ($y['deleted'] != $cl['deleted'])) {
- q("update groups set name = '%s', visible = %d, deleted = %d where hash = '%s' and uid = %d",
+ q("update groups set gname = '%s', visible = %d, deleted = %d where hash = '%s' and uid = %d",
dbesc($cl['name']),
intval($cl['visible']),
intval($cl['deleted']),
@@ -3363,7 +3363,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
}
}
if(! $found) {
- $r = q("INSERT INTO `groups` ( hash, uid, visible, deleted, name )
+ $r = q("INSERT INTO `groups` ( hash, uid, visible, deleted, gname )
VALUES( '%s', %d, %d, %d, '%s' ) ",
dbesc($cl['collection']),
intval($channel['channel_id']),
@@ -3470,7 +3470,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
if(array_key_exists('profile',$arr) && is_array($arr['profile']) && count($arr['profile'])) {
- $disallowed = array('id','aid','uid');
+ $disallowed = array('id','aid','uid','guid');
foreach($arr['profile'] as $profile) {
$x = q("select * from profile where profile_guid = '%s' and uid = %d limit 1",
@@ -3494,13 +3494,22 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
foreach($profile as $k => $v) {
if(in_array($k,$disallowed))
continue;
+
+ if($k === 'name')
+ $clean['fullname'] = $v;
+ elseif($k === 'with')
+ $clean['partner'] = $v;
+ elseif($k === 'work')
+ $clean['employment'] = $v;
+ elseif(array_key_exists($k,$x[0]))
+ $clean[$k] = $v;
- $clean[$k] = $v;
/**
- * @TODO check if these are allowed, otherwise we'll error
+ * @TODO
* We also need to import local photos if a custom photo is selected
*/
}
+
if(count($clean)) {
foreach($clean as $k => $v) {
$r = dbq("UPDATE profile set `" . dbesc($k) . "` = '" . dbesc($v)