diff options
36 files changed, 210 insertions, 163 deletions
diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php index 62ac29286..7bc197a93 100644 --- a/Zotlabs/Module/Acl.php +++ b/Zotlabs/Module/Acl.php @@ -53,13 +53,13 @@ class Acl extends \Zotlabs\Web\Controller { if ($type=='' || $type=='g'){ - $r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`name` + $r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`gname` FROM `groups`,`group_member` WHERE `groups`.`deleted` = 0 AND `groups`.`uid` = %d AND `group_member`.`gid`=`groups`.`id` $sql_extra GROUP BY `groups`.`id` - ORDER BY `groups`.`name` + ORDER BY `groups`.`gname` LIMIT %d OFFSET %d", intval(local_channel()), intval($count), @@ -67,11 +67,11 @@ class Acl extends \Zotlabs\Web\Controller { ); foreach($r as $g){ - // logger('acl: group: ' . $g['name'] . ' members: ' . group_get_members_xchan($g['id'])); + // logger('acl: group: ' . $g['gname'] . ' members: ' . group_get_members_xchan($g['id'])); $groups[] = array( "type" => "g", "photo" => "images/twopeople.png", - "name" => $g['name'], + "name" => $g['gname'], "id" => $g['id'], "xid" => $g['hash'], "uids" => group_get_members_xchan($g['id']), diff --git a/Zotlabs/Module/Chat.php b/Zotlabs/Module/Chat.php index d14c32b7d..026e8369a 100644 --- a/Zotlabs/Module/Chat.php +++ b/Zotlabs/Module/Chat.php @@ -243,7 +243,7 @@ class Chat extends \Zotlabs\Web\Controller { $rooms = Zlib\Chatroom::roomlist(\App::$profile['profile_uid']); $o .= replace_macros(get_markup_template('chatrooms.tpl'), array( - '$header' => sprintf( t('%1$s\'s Chatrooms'), \App::$profile['name']), + '$header' => sprintf( t('%1$s\'s Chatrooms'), \App::$profile['fullname']), '$name' => t('Name'), '$baseurl' => z_root(), '$nickname' => \App::$profile['channel_address'], diff --git a/Zotlabs/Module/Contactgroup.php b/Zotlabs/Module/Contactgroup.php index 497442ff4..bbe56b4ad 100644 --- a/Zotlabs/Module/Contactgroup.php +++ b/Zotlabs/Module/Contactgroup.php @@ -41,10 +41,10 @@ class Contactgroup extends \Zotlabs\Web\Controller { if($change) { if(in_array($change,$preselected)) { - group_rmv_member(local_channel(),$group['name'],$change); + group_rmv_member(local_channel(),$group['gname'],$change); } else { - group_add_member(local_channel(),$group['name'],$change); + group_add_member(local_channel(),$group['gname'],$change); } } } diff --git a/Zotlabs/Module/Events.php b/Zotlabs/Module/Events.php index 2b5e239f9..3996473b7 100644 --- a/Zotlabs/Module/Events.php +++ b/Zotlabs/Module/Events.php @@ -171,7 +171,7 @@ class Events extends \Zotlabs\Web\Controller { foreach($cats as $cat) { $post_tags[] = array( 'uid' => $profile_uid, - 'type' => TERM_CATEGORY, + 'ttype' => TERM_CATEGORY, 'otype' => TERM_OBJ_POST, 'term' => trim($cat), 'url' => $channel['xchan_url'] . '?f=&cat=' . urlencode(trim($cat)) diff --git a/Zotlabs/Module/Filer.php b/Zotlabs/Module/Filer.php index 607d088db..6a57cdb2a 100644 --- a/Zotlabs/Module/Filer.php +++ b/Zotlabs/Module/Filer.php @@ -39,7 +39,7 @@ class Filer extends \Zotlabs\Web\Controller { } else { $filetags = 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/Zotlabs/Module/Filerm.php b/Zotlabs/Module/Filerm.php index eb9a42c1e..cbf6a118d 100644 --- a/Zotlabs/Module/Filerm.php +++ b/Zotlabs/Module/Filerm.php @@ -22,7 +22,7 @@ class Filerm extends \Zotlabs\Web\Controller { logger('filerm: tag ' . $term . ' item ' . $item_id); if($item_id && strlen($term)) { - $r = q("delete from term where uid = %d and type = %d and oid = %d and term = '%s'", + $r = q("delete from term where uid = %d and ttype = %d and oid = %d and term = '%s'", intval(local_channel()), intval(($category) ? TERM_CATEGORY : TERM_FILE), intval($item_id), diff --git a/Zotlabs/Module/Group.php b/Zotlabs/Module/Group.php index 144797baf..254ee6ef2 100644 --- a/Zotlabs/Module/Group.php +++ b/Zotlabs/Module/Group.php @@ -47,8 +47,8 @@ class Group extends \Zotlabs\Web\Controller { $groupname = notags(trim($_POST['groupname'])); $public = intval($_POST['public']); - if((strlen($groupname)) && (($groupname != $group['name']) || ($public != $group['visible']))) { - $r = q("UPDATE `groups` SET `name` = '%s', visible = %d WHERE `uid` = %d AND `id` = %d", + if((strlen($groupname)) && (($groupname != $group['gname']) || ($public != $group['visible']))) { + $r = q("UPDATE `groups` SET `gname` = '%s', visible = %d WHERE `uid` = %d AND `id` = %d", dbesc($groupname), intval($public), intval(local_channel()), @@ -106,7 +106,7 @@ class Group extends \Zotlabs\Web\Controller { intval(local_channel()) ); if($r) - $result = group_rmv(local_channel(),$r[0]['name']); + $result = group_rmv(local_channel(),$r[0]['gname']); if($result) info( t('Privacy group removed.') . EOL); else @@ -156,10 +156,10 @@ class Group extends \Zotlabs\Web\Controller { if($change) { if(in_array($change,$preselected)) { - group_rmv_member(local_channel(),$group['name'],$change); + group_rmv_member(local_channel(),$group['gname'],$change); } else { - group_add_member(local_channel(),$group['name'],$change); + group_add_member(local_channel(),$group['gname'],$change); } $members = group_get_members($group['id']); @@ -181,7 +181,7 @@ class Group extends \Zotlabs\Web\Controller { $context = $context + array( '$title' => t('Privacy group editor'), - '$gname' => array('groupname',t('Privacy group name: '),$group['name'], ''), + '$gname' => array('groupname',t('Privacy group name: '),$group['gname'], ''), '$gid' => $group['id'], '$drop' => $drop_txt, '$public' => array('public',t('Members are visible to other channels'), $group['visible'], ''), @@ -209,7 +209,7 @@ class Group extends \Zotlabs\Web\Controller { $groupeditor['members'][] = micropro($member,true,'mpgroup', $textmode); } else - group_rmv_member(local_channel(),$group['name'],$member['xchan_hash']); + group_rmv_member(local_channel(),$group['gname'],$member['xchan_hash']); } $r = q("SELECT abook.*, xchan.* FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE `abook_channel` = %d AND abook_self = 0 and abook_blocked = 0 and abook_pending = 0 and xchan_deleted = 0 order by xchan_name asc", diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php index 57ced22a3..122e27e90 100644 --- a/Zotlabs/Module/Import.php +++ b/Zotlabs/Module/Import.php @@ -408,8 +408,12 @@ class Import extends \Zotlabs\Web\Controller { $saved = array(); foreach($groups as $group) { $saved[$group['hash']] = array('old' => $group['id']); + if(array_key_exists('name',$group)) { + $group['gname'] = $group['name']; + unset($group['name']); + } unset($group['id']); - $group['uid'] = $channel['channel_id']; + $group['uid'] = $channel['channel_id']; dbesc_array($group); $r = dbq("INSERT INTO groups (`" . implode("`, `", array_keys($group)) diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 041939ad8..2601feb0a 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -581,7 +581,7 @@ class Item extends \Zotlabs\Web\Controller { if($success['replaced']) { $post_tags[] = array( 'uid' => $profile_uid, - 'type' => $success['termtype'], + 'ttype' => $success['termtype'], 'otype' => TERM_OBJ_POST, 'term' => $success['term'], 'url' => $success['url'] @@ -666,7 +666,7 @@ class Item extends \Zotlabs\Web\Controller { foreach($cats as $cat) { $post_tags[] = array( 'uid' => $profile_uid, - 'type' => TERM_CATEGORY, + 'ttype' => TERM_CATEGORY, 'otype' => TERM_OBJ_POST, 'term' => trim($cat), 'url' => $owner_xchan['xchan_url'] . '?f=&cat=' . urlencode(trim($cat)) @@ -676,7 +676,7 @@ class Item extends \Zotlabs\Web\Controller { if($orig_post) { // preserve original tags - $t = q("select * from term where oid = %d and otype = %d and uid = %d and type in ( %d, %d, %d )", + $t = q("select * from term where oid = %d and otype = %d and uid = %d and ttype in ( %d, %d, %d )", intval($orig_post['id']), intval(TERM_OBJ_POST), intval($profile_uid), @@ -688,7 +688,7 @@ class Item extends \Zotlabs\Web\Controller { foreach($t as $t1) { $post_tags[] = array( 'uid' => $profile_uid, - 'type' => $t1['type'], + 'ttype' => $t1['type'], 'otype' => TERM_OBJ_POST, 'term' => $t1['term'], 'url' => $t1['url'], diff --git a/Zotlabs/Module/Lockview.php b/Zotlabs/Module/Lockview.php index 0df0dd4da..4776e1c56 100644 --- a/Zotlabs/Module/Lockview.php +++ b/Zotlabs/Module/Lockview.php @@ -88,10 +88,10 @@ class Lockview extends \Zotlabs\Web\Controller { stringify_array_elms($deny_users,true); if(count($allowed_groups)) { - $r = q("SELECT name FROM `groups` WHERE hash IN ( " . implode(', ', $allowed_groups) . " )"); + $r = q("SELECT gname FROM `groups` WHERE hash IN ( " . implode(', ', $allowed_groups) . " )"); if($r) foreach($r as $rr) - $l[] = '<li><b>' . $rr['name'] . '</b></li>'; + $l[] = '<li><b>' . $rr['gname'] . '</b></li>'; } if(count($allowed_users)) { $r = q("SELECT xchan_name FROM xchan WHERE xchan_hash IN ( " . implode(', ',$allowed_users) . " )"); @@ -100,10 +100,10 @@ class Lockview extends \Zotlabs\Web\Controller { $l[] = '<li>' . $rr['xchan_name'] . '</li>'; } if(count($deny_groups)) { - $r = q("SELECT name FROM `groups` WHERE hash IN ( " . implode(', ', $deny_groups) . " )"); + $r = q("SELECT gname FROM `groups` WHERE hash IN ( " . implode(', ', $deny_groups) . " )"); if($r) foreach($r as $rr) - $l[] = '<li><b><strike>' . $rr['name'] . '</strike></b></li>'; + $l[] = '<li><b><strike>' . $rr['gname'] . '</strike></b></li>'; } if(count($deny_users)) { $r = q("SELECT xchan_name FROM xchan WHERE xchan_hash IN ( " . implode(', ', $deny_users) . " )"); diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 238df3593..87ed326e2 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -223,7 +223,7 @@ class Network extends \Zotlabs\Web\Controller { if($x) { $title = replace_macros(get_markup_template("section_title.tpl"),array( - '$title' => t('Privacy group: ') . $x['name'] + '$title' => t('Privacy group: ') . $x['gname'] )); } diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index 7186209ba..ecf966032 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -440,7 +440,7 @@ class Photos extends \Zotlabs\Web\Controller { if($success['replaced']) { $post_tags[] = array( 'uid' => $profile_uid, - 'type' => $success['termtype'], + 'ttype' => $success['termtype'], 'otype' => TERM_OBJ_POST, 'term' => $success['term'], 'url' => $success['url'] diff --git a/Zotlabs/Module/Profiles.php b/Zotlabs/Module/Profiles.php index 54780499b..06e5cfd7b 100644 --- a/Zotlabs/Module/Profiles.php +++ b/Zotlabs/Module/Profiles.php @@ -67,16 +67,16 @@ class Profiles extends \Zotlabs\Web\Controller { $name = t('Profile-') . ($num_profiles + 1); - $r1 = q("SELECT `name`, `photo`, `thumb` FROM `profile` WHERE `uid` = %d AND `is_default` = 1 LIMIT 1", + $r1 = q("SELECT `fullname`, `photo`, `thumb` FROM `profile` WHERE `uid` = %d AND `is_default` = 1 LIMIT 1", intval(local_channel())); - $r2 = q("INSERT INTO `profile` (`aid`, `uid` , `profile_guid`, `profile_name` , `name`, `photo`, `thumb`) + $r2 = q("INSERT INTO `profile` (`aid`, `uid` , `profile_guid`, `profile_name` , `fullname`, `photo`, `thumb`) VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s' )", intval(get_account_id()), intval(local_channel()), dbesc(random_string()), dbesc($name), - dbesc($r1[0]['name']), + dbesc($r1[0]['fullname']), dbesc($r1[0]['photo']), dbesc($r1[0]['thumb']) ); @@ -277,14 +277,14 @@ class Profiles extends \Zotlabs\Web\Controller { $name = escape_tags(trim($_POST['name'])); - if($orig[0]['name'] != $name) { + if($orig[0]['fullname'] != $name) { $namechanged = true; $v = validate_channelname($name); if($v) { notice($v); $namechanged = false; - $name = $orig[0]['name']; + $name = $orig[0]['fullname']; } } @@ -350,7 +350,7 @@ class Profiles extends \Zotlabs\Web\Controller { $withchanged = false; if(strlen($with)) { - if($with != strip_tags($orig[0]['with'])) { + if($with != strip_tags($orig[0]['partner'])) { $withchanged = true; $prf = ''; $lookup = $with; @@ -382,7 +382,7 @@ class Profiles extends \Zotlabs\Web\Controller { } } else - $with = $orig[0]['with']; + $with = $orig[0]['partner']; } $profile_fields_basic = get_profile_fields_basic(); @@ -439,7 +439,7 @@ class Profiles extends \Zotlabs\Web\Controller { $changes[] = t('Dislikes'); $value = $dislikes; } - if($work != $orig[0]['work']) { + if($work != $orig[0]['employment']) { $changes[] = t('Work/Employment'); } if($religion != $orig[0]['religion']) { @@ -486,7 +486,7 @@ class Profiles extends \Zotlabs\Web\Controller { $r = q("UPDATE `profile` SET `profile_name` = '%s', - `name` = '%s', + `fullname` = '%s', `pdesc` = '%s', `gender` = '%s', `dob` = '%s', @@ -496,7 +496,7 @@ class Profiles extends \Zotlabs\Web\Controller { `postal_code` = '%s', `country_name` = '%s', `marital` = '%s', - `with` = '%s', + `partner` = '%s', `howlong` = '%s', `sexual` = '%s', `homepage` = '%s', @@ -515,7 +515,7 @@ class Profiles extends \Zotlabs\Web\Controller { `tv` = '%s', `film` = '%s', `romance` = '%s', - `work` = '%s', + `employment` = '%s', `education` = '%s', `hide_friends` = %d WHERE `id` = %d AND `uid` = %d", @@ -591,7 +591,7 @@ class Profiles extends \Zotlabs\Web\Controller { } - function get() { + function get() { $o = ''; @@ -627,8 +627,6 @@ class Profiles extends \Zotlabs\Web\Controller { } $editselect = 'none'; - // if(feature_enabled(local_channel(),'richtext')) - // $editselect = 'textareas'; \App::$page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array( '$baseurl' => z_root(), @@ -712,7 +710,7 @@ class Profiles extends \Zotlabs\Web\Controller { '$is_default' => $is_default, '$default' => t('This is your default profile.') . EOL . translate_scope(map_scope($channel['channel_r_profile'])), '$advanced' => $advanced, - '$name' => array('name', t('Your full name'), $r[0]['name'], t('Required'), '*'), + '$name' => array('name', t('Your full name'), $r[0]['fullname'], t('Required'), '*'), '$pdesc' => array('pdesc', t('Title/Description'), $r[0]['pdesc']), '$dob' => dob($r[0]['dob']), '$hide_friends' => $hide_friends, @@ -725,7 +723,7 @@ class Profiles extends \Zotlabs\Web\Controller { '$gender_min' => gender_selector_min($r[0]['gender']), '$marital' => marital_selector($r[0]['marital']), '$marital_min' => marital_selector_min($r[0]['marital']), - '$with' => array('with', t("Who (if applicable)"), $r[0]['with'], t('Examples: cathy123, Cathy Williams, cathy@example.com')), + '$with' => array('with', t("Who (if applicable)"), $r[0]['partner'], t('Examples: cathy123, Cathy Williams, cathy@example.com')), '$howlong' => array('howlong', t('Since (date)'), ($r[0]['howlong'] === NULL_DATE ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))), '$sexual' => sexpref_selector($r[0]['sexual']), '$sexual_min' => sexpref_selector_min($r[0]['sexual']), @@ -743,7 +741,7 @@ class Profiles extends \Zotlabs\Web\Controller { '$film' => array('film', t('Film/Dance/Culture/Entertainment'), $r[0]['film']), '$interest' => array('interest', t('Hobbies/Interests'), $r[0]['interest']), '$romance' => array('romance',t('Love/Romance'), $r[0]['romance']), - '$work' => array('work', t('Work/Employment'), $r[0]['work']), + '$work' => array('work', t('Work/Employment'), $r[0]['employment']), '$education' => array('education', t('School/Education'), $r[0]['education']), '$contact' => array('contact', t('Contact information and social networks'), $r[0]['contact']), '$channels' => array('channels', t('My other channels'), $r[0]['channels']), @@ -759,7 +757,7 @@ class Profiles extends \Zotlabs\Web\Controller { $r = q("SELECT * FROM `profile` WHERE `uid` = %d", local_channel()); - if(count($r)) { + if($r) { $tpl = get_markup_template('profile_entry.tpl'); foreach($r as $rr) { @@ -780,10 +778,7 @@ class Profiles extends \Zotlabs\Web\Controller { '$cr_new' => t('Create New'), '$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new"), '$profiles' => $profiles - )); - - - + )); } return $o; diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php index fcc2506fc..402a27d40 100644 --- a/Zotlabs/Module/Search.php +++ b/Zotlabs/Module/Search.php @@ -79,7 +79,7 @@ class Search extends \Zotlabs\Web\Controller { return $o; if($tag) { - $sql_extra = sprintf(" AND `item`.`id` IN (select `oid` from term where otype = %d and type in ( %d , %d) and term = '%s') ", + $sql_extra = sprintf(" AND `item`.`id` IN (select `oid` from term where otype = %d and ttype in ( %d , %d) and term = '%s') ", intval(TERM_OBJ_POST), intval(TERM_HASHTAG), intval(TERM_COMMUNITYTAG), diff --git a/Zotlabs/Module/Search_ac.php b/Zotlabs/Module/Search_ac.php index 78bcf374d..4e936d97b 100644 --- a/Zotlabs/Module/Search_ac.php +++ b/Zotlabs/Module/Search_ac.php @@ -46,7 +46,7 @@ class Search_ac extends \Zotlabs\Web\Controller { } } - $r = q("select distinct term, tid, url from term where type in ( %d, %d ) $tag_sql_extra group by term order by term asc", + $r = q("select distinct term, tid, url from term where ttype in ( %d, %d ) $tag_sql_extra group by term order by term asc", intval(TERM_HASHTAG), intval(TERM_COMMUNITYTAG) ); diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php index 43162a2b0..875004fae 100644 --- a/Zotlabs/Module/Settings.php +++ b/Zotlabs/Module/Settings.php @@ -337,7 +337,7 @@ class Settings extends \Zotlabs\Web\Controller { } $hide_presence = 1 - (intval($role_permissions['online'])); if($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(local_channel()), dbesc( t('Friends') ) ); @@ -345,7 +345,7 @@ class Settings extends \Zotlabs\Web\Controller { require_once('include/group.php'); group_add(local_channel(), t('Friends')); group_add_member(local_channel(),t('Friends'),$channel['channel_hash']); - $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(local_channel()), dbesc( t('Friends') ) ); @@ -537,7 +537,7 @@ class Settings extends \Zotlabs\Web\Controller { dbesc(datetime_convert()), dbesc($channel['channel_hash']) ); - $r = q("update profile set name = '%s' where uid = %d and is_default = 1", + $r = q("update profile set fullname = '%s' where uid = %d and is_default = 1", dbesc($username), intval($channel['channel_id']) ); @@ -562,7 +562,7 @@ class Settings extends \Zotlabs\Web\Controller { - function get() { + function get() { $o = ''; nav_set_selected('settings'); diff --git a/Zotlabs/Module/Tagrm.php b/Zotlabs/Module/Tagrm.php index 81ae30aa5..42aa6e90f 100644 --- a/Zotlabs/Module/Tagrm.php +++ b/Zotlabs/Module/Tagrm.php @@ -54,7 +54,7 @@ class Tagrm extends \Zotlabs\Web\Controller { - function get() { + function get() { if(! local_channel()) { goaway(z_root() . '/' . $_SESSION['photo_return']); @@ -45,10 +45,10 @@ require_once('include/account.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); -define ( 'STD_VERSION', '1.7.1' ); +define ( 'STD_VERSION', '1.7.2' ); define ( 'ZOT_REVISION', 1.1 ); -define ( 'DB_UPDATE_VERSION', 1172 ); +define ( 'DB_UPDATE_VERSION', 1173 ); /** 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/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/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/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) diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql index 2b48afe98..e5bb7b889 100644 --- a/install/schema_mysql.sql +++ b/install/schema_mysql.sql @@ -440,12 +440,13 @@ CREATE TABLE IF NOT EXISTS `groups` ( `uid` int(10) unsigned NOT NULL DEFAULT '0', `visible` tinyint(1) NOT NULL DEFAULT '0', `deleted` tinyint(1) NOT NULL DEFAULT '0', - `name` char(255) NOT NULL DEFAULT '', + `gname` char(255) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `uid` (`uid`), KEY `visible` (`visible`), KEY `deleted` (`deleted`), - KEY `hash` (`hash`) + KEY `hash` (`hash`), + KEY `gname` (`gname`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `group_member` ( @@ -979,7 +980,7 @@ CREATE TABLE IF NOT EXISTS `profile` ( `profile_name` char(255) NOT NULL DEFAULT '', `is_default` tinyint(1) NOT NULL DEFAULT '0', `hide_friends` tinyint(1) NOT NULL DEFAULT '0', - `name` char(255) NOT NULL DEFAULT '', + `fullname` char(255) NOT NULL DEFAULT '', `pdesc` char(255) NOT NULL DEFAULT '', `chandesc` text NOT NULL, `dob` char(32) NOT NULL DEFAULT '0000-00-00', @@ -992,7 +993,7 @@ CREATE TABLE IF NOT EXISTS `profile` ( `hometown` char(255) NOT NULL DEFAULT '', `gender` char(32) NOT NULL DEFAULT '', `marital` char(255) NOT NULL DEFAULT '', - `with` text NOT NULL, + `partner` text NOT NULL, `howlong` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `sexual` char(255) NOT NULL DEFAULT '', `politic` char(255) NOT NULL DEFAULT '', @@ -1008,7 +1009,7 @@ CREATE TABLE IF NOT EXISTS `profile` ( `film` text NOT NULL, `interest` text NOT NULL, `romance` text NOT NULL, - `work` text NOT NULL, + `employment` text NOT NULL, `education` text NOT NULL, `contact` text NOT NULL, `channels` text NOT NULL, @@ -1153,7 +1154,7 @@ CREATE TABLE IF NOT EXISTS `term` ( `uid` int(10) unsigned NOT NULL DEFAULT '0', `oid` int(10) unsigned NOT NULL DEFAULT '0', `otype` tinyint(3) unsigned NOT NULL DEFAULT '0', - `type` tinyint(3) unsigned NOT NULL DEFAULT '0', + `ttype` tinyint(3) unsigned NOT NULL DEFAULT '0', `term` char(255) NOT NULL DEFAULT '', `url` char(255) NOT NULL DEFAULT '', `imgurl` char(255) NOT NULL DEFAULT '', @@ -1162,7 +1163,7 @@ CREATE TABLE IF NOT EXISTS `term` ( PRIMARY KEY (`tid`), KEY `oid` (`oid`), KEY `otype` (`otype`), - KEY `type` (`type`), + KEY `ttype` (`ttype`), KEY `term` (`term`), KEY `uid` (`uid`), KEY `aid` (`aid`), diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql index 05b53e1a3..bda1b8970 100644 --- a/install/schema_postgres.sql +++ b/install/schema_postgres.sql @@ -445,7 +445,7 @@ CREATE TABLE "groups" ( "uid" bigint NOT NULL, "visible" numeric(1) NOT NULL DEFAULT '0', "deleted" numeric(1) NOT NULL DEFAULT '0', - "name" text NOT NULL, + "gname" text NOT NULL, PRIMARY KEY ("id") ); @@ -968,7 +968,7 @@ CREATE TABLE "profile" ( "profile_name" text NOT NULL, "is_default" numeric(1) NOT NULL DEFAULT '0', "hide_friends" numeric(1) NOT NULL DEFAULT '0', - "name" text NOT NULL, + "fullname" text NOT NULL, "pdesc" text NOT NULL DEFAULT '', "chandesc" text NOT NULL DEFAULT '', "dob" varchar(32) NOT NULL DEFAULT '', @@ -981,7 +981,7 @@ CREATE TABLE "profile" ( "hometown" text NOT NULL DEFAULT '', "gender" varchar(32) NOT NULL DEFAULT '', "marital" text NOT NULL DEFAULT '', - "with" text NOT NULL DEFAULT '', + "partner" text NOT NULL DEFAULT '', "howlong" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', "sexual" text NOT NULL DEFAULT '', "politic" text NOT NULL DEFAULT '', @@ -997,7 +997,7 @@ CREATE TABLE "profile" ( "film" text NOT NULL DEFAULT '', "interest" text NOT NULL DEFAULT '', "romance" text NOT NULL DEFAULT '', - "work" text NOT NULL DEFAULT '', + "employment" text NOT NULL DEFAULT '', "education" text NOT NULL DEFAULT '', "contact" text NOT NULL DEFAULT '', "channels" text NOT NULL DEFAULT '', @@ -1137,7 +1137,7 @@ CREATE TABLE "term" ( "uid" bigint NOT NULL DEFAULT '0', "oid" bigint NOT NULL, "otype" numeric(3) NOT NULL, - "type" numeric(3) NOT NULL, + "ttype" numeric(3) NOT NULL, "term" text NOT NULL, "url" text NOT NULL, "imgurl" text NOT NULL DEFAULT '', @@ -1147,7 +1147,7 @@ CREATE TABLE "term" ( ); create index "term_oid" on term ("oid"); create index "term_otype" on term ("otype"); -create index "term_type" on term ("type"); +create index "term_ttype" on term ("ttype"); create index "term_term" on term ("term"); create index "term_uid" on term ("uid"); create index "term_aid" on term ("aid"); diff --git a/install/update.php b/install/update.php index 4883d6561..dd0131ee8 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ <?php -define( 'UPDATE_VERSION' , 1172 ); +define( 'UPDATE_VERSION' , 1173 ); /** * @@ -2163,4 +2163,26 @@ function update_r1171() { -}
\ No newline at end of file +} + +function update_r1172() { + + $r1 = q("ALTER TABLE term CHANGE `type` `ttype` int(3) NOT NULL DEFAULT '0' "); + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r2 = q("ALTER TABLE groups CHANGE `name` `gname` TEXT NOT NULL "); + $r3 = q("ALTER TABLE profile CHANGE `name` `fullname` TEXT NOT NULL "); + $r4 = q("ALTER TABLE profile CHANGE `with` `partner` TEXT NOT NULL "); + $r5 = q("ALTER TABLE profile CHANGE `work` `employment` TEXT NOT NULL "); + } + else { + $r2 = q("ALTER TABLE groups CHANGE `name` `gname` char(255) NOT NULL DEFAULT '' "); + $r3 = q("ALTER TABLE profile CHANGE `name` `fullname` char(255) NOT NULL DEFAULT '' "); + $r4 = q("ALTER TABLE profile CHANGE `with` `partner` char(255) NOT NULL DEFAULT '' "); + $r5 = q("ALTER TABLE profile CHANGE `work` `employment` TEXT NOT NULL "); + } + if($r1 && $r2 && $r3 && $r4 && $r5) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} diff --git a/view/tpl/profile_advanced.tpl b/view/tpl/profile_advanced.tpl index c617e6c14..a4c98b1d0 100755 --- a/view/tpl/profile_advanced.tpl +++ b/view/tpl/profile_advanced.tpl @@ -33,6 +33,7 @@ <div class="section-content-wrapper"> {{foreach $fields as $f}} + {{if $f == 'name'}} <dl id="aprofile-fullname" class="aprofile"> <dt>{{$profile.fullname.0}}</dt> @@ -40,6 +41,13 @@ </dl> {{/if}} + {{if $f == 'fullname'}} + <dl id="aprofile-fullname" class="aprofile"> + <dt>{{$profile.fullname.0}}</dt> + <dd>{{$profile.fullname.1}}</dd> + </dl> + {{/if}} + {{if $f == 'gender'}} {{if $profile.gender}} <dl id="aprofile-gender" class="aprofile"> @@ -72,7 +80,7 @@ {{if $profile.marital}} <dl id="aprofile-marital" class="aprofile"> <dt><span class="heart"><i class="fa fa-heart"></i> </span>{{$profile.marital.0}}</dt> - <dd>{{$profile.marital.1}}{{if in_array('with',$fields)}}{{if $profile.marital.with}} ({{$profile.marital.with}}){{/if}}{{/if}}{{if in_array('howlong',$fields)}}{{if $profile.howlong}} {{$profile.howlong}}{{/if}}{{/if}}</dd> + <dd>{{$profile.marital.1}}{{if in_array('partner',$fields)}}{{if $profile.marital.partner}} ({{$profile.marital.partner}}){{/if}}{{/if}}{{if in_array('howlong',$fields)}}{{if $profile.howlong}} {{$profile.howlong}}{{/if}}{{/if}}</dd> </dl> {{/if}} {{/if}} @@ -237,11 +245,11 @@ {{/if}} - {{if $f == 'work'}} - {{if $profile.work}} + {{if $f == 'employment'}} + {{if $profile.employment}} <dl id="aprofile-work" class="aprofile"> - <dt>{{$profile.work.0}}</dt> - <dd>{{$profile.work.1}}</dd> + <dt>{{$profile.employment.0}}</dt> + <dd>{{$profile.employment.1}}</dd> </dl> {{/if}} {{/if}} diff --git a/view/tpl/profile_edit.tpl b/view/tpl/profile_edit.tpl index deabc2795..b0211d697 100755 --- a/view/tpl/profile_edit.tpl +++ b/view/tpl/profile_edit.tpl @@ -173,7 +173,7 @@ </div> <div class="clear"></div> - {{if $fields.with}} + {{if $fields.partner}} {{include file="field_input.tpl" field=$with}} {{/if}} @@ -198,7 +198,7 @@ </div> </div> {{/if}} - {{if $fields.keywords || $fields.politic || $fields.religion || $fields.about || $fields.contact || $fields.homepage || $fields.interest || $fields.likes || $fields.dislikes || $fields.channels || $fields.music || $fields.book || $fields.tv || $fields.romance || $fields.education || $extra_fields}} + {{if $fields.keywords || $fields.politic || $fields.religion || $fields.about || $fields.contact || $fields.homepage || $fields.interest || $fields.likes || $fields.dislikes || $fields.channels || $fields.music || $fields.book || $fields.tv || $fields.film || $fields.romance || $fields.employment || $fields.education || $extra_fields}} <div class="panel"> <div class="section-subtitle-wrapper" role="tab" id="miscellaneous"> <h3> @@ -269,7 +269,7 @@ {{include file="field_textarea.tpl" field=$romance}} {{/if}} - {{if $fields.work}} + {{if $fields.employment}} {{include file="field_textarea.tpl" field=$work}} {{/if}} diff --git a/view/tpl/profile_vcard.tpl b/view/tpl/profile_vcard.tpl index b4d21b6e7..7d7d2019a 100755 --- a/view/tpl/profile_vcard.tpl +++ b/view/tpl/profile_vcard.tpl @@ -1,6 +1,6 @@ <div class="vcard"> {{if ! $zcard}} - <div id="profile-photo-wrapper"><img class="photo" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}"></div> + <div id="profile-photo-wrapper"><img class="photo" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.fullname}}"></div> {{/if}} {{if $connect}} <div class="connect-btn-wrapper"><a href="{{$connect_url}}" class="btn btn-block btn-success btn-sm"><i class="fa fa-plus"></i> {{$connect}}</a></div> @@ -25,7 +25,7 @@ {{/if}} {{if ! $zcard}} - <div class="fn">{{$profile.name}}{{if $profile.online}} <i class="fa fa-asterisk online-now" title="{{$profile.online}}"></i>{{/if}}</div> + <div class="fn">{{$profile.fullname}}{{if $profile.online}} <i class="fa fa-asterisk online-now" title="{{$profile.online}}"></i>{{/if}}</div> {{if $reddress}}<div class="reddress" oncopy="return false;">{{$profile.reddress}}</div>{{/if}} {{/if}} {{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}} |