more db column renames

This commit is contained in:
redmatrix 2016-05-31 21:45:33 -07:00
parent dfb6255f59
commit b1259876bf
36 changed files with 210 additions and 163 deletions

View File

@ -53,13 +53,13 @@ class Acl extends \Zotlabs\Web\Controller {
if ($type=='' || $type=='g'){ 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` FROM `groups`,`group_member`
WHERE `groups`.`deleted` = 0 AND `groups`.`uid` = %d WHERE `groups`.`deleted` = 0 AND `groups`.`uid` = %d
AND `group_member`.`gid`=`groups`.`id` AND `group_member`.`gid`=`groups`.`id`
$sql_extra $sql_extra
GROUP BY `groups`.`id` GROUP BY `groups`.`id`
ORDER BY `groups`.`name` ORDER BY `groups`.`gname`
LIMIT %d OFFSET %d", LIMIT %d OFFSET %d",
intval(local_channel()), intval(local_channel()),
intval($count), intval($count),
@ -67,11 +67,11 @@ class Acl extends \Zotlabs\Web\Controller {
); );
foreach($r as $g){ 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( $groups[] = array(
"type" => "g", "type" => "g",
"photo" => "images/twopeople.png", "photo" => "images/twopeople.png",
"name" => $g['name'], "name" => $g['gname'],
"id" => $g['id'], "id" => $g['id'],
"xid" => $g['hash'], "xid" => $g['hash'],
"uids" => group_get_members_xchan($g['id']), "uids" => group_get_members_xchan($g['id']),

View File

@ -243,7 +243,7 @@ class Chat extends \Zotlabs\Web\Controller {
$rooms = Zlib\Chatroom::roomlist(\App::$profile['profile_uid']); $rooms = Zlib\Chatroom::roomlist(\App::$profile['profile_uid']);
$o .= replace_macros(get_markup_template('chatrooms.tpl'), array( $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'), '$name' => t('Name'),
'$baseurl' => z_root(), '$baseurl' => z_root(),
'$nickname' => \App::$profile['channel_address'], '$nickname' => \App::$profile['channel_address'],

View File

@ -41,10 +41,10 @@ class Contactgroup extends \Zotlabs\Web\Controller {
if($change) { if($change) {
if(in_array($change,$preselected)) { if(in_array($change,$preselected)) {
group_rmv_member(local_channel(),$group['name'],$change); group_rmv_member(local_channel(),$group['gname'],$change);
} }
else { else {
group_add_member(local_channel(),$group['name'],$change); group_add_member(local_channel(),$group['gname'],$change);
} }
} }
} }

View File

@ -171,7 +171,7 @@ class Events extends \Zotlabs\Web\Controller {
foreach($cats as $cat) { foreach($cats as $cat) {
$post_tags[] = array( $post_tags[] = array(
'uid' => $profile_uid, 'uid' => $profile_uid,
'type' => TERM_CATEGORY, 'ttype' => TERM_CATEGORY,
'otype' => TERM_OBJ_POST, 'otype' => TERM_OBJ_POST,
'term' => trim($cat), 'term' => trim($cat),
'url' => $channel['xchan_url'] . '?f=&cat=' . urlencode(trim($cat)) 'url' => $channel['xchan_url'] . '?f=&cat=' . urlencode(trim($cat))

View File

@ -39,7 +39,7 @@ class Filer extends \Zotlabs\Web\Controller {
} }
else { else {
$filetags = array(); $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(local_channel()),
intval(TERM_FILE) intval(TERM_FILE)
); );

View File

@ -22,7 +22,7 @@ class Filerm extends \Zotlabs\Web\Controller {
logger('filerm: tag ' . $term . ' item ' . $item_id); logger('filerm: tag ' . $term . ' item ' . $item_id);
if($item_id && strlen($term)) { 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(local_channel()),
intval(($category) ? TERM_CATEGORY : TERM_FILE), intval(($category) ? TERM_CATEGORY : TERM_FILE),
intval($item_id), intval($item_id),

View File

@ -47,8 +47,8 @@ class Group extends \Zotlabs\Web\Controller {
$groupname = notags(trim($_POST['groupname'])); $groupname = notags(trim($_POST['groupname']));
$public = intval($_POST['public']); $public = intval($_POST['public']);
if((strlen($groupname)) && (($groupname != $group['name']) || ($public != $group['visible']))) { if((strlen($groupname)) && (($groupname != $group['gname']) || ($public != $group['visible']))) {
$r = q("UPDATE `groups` SET `name` = '%s', visible = %d WHERE `uid` = %d AND `id` = %d", $r = q("UPDATE `groups` SET `gname` = '%s', visible = %d WHERE `uid` = %d AND `id` = %d",
dbesc($groupname), dbesc($groupname),
intval($public), intval($public),
intval(local_channel()), intval(local_channel()),
@ -106,7 +106,7 @@ class Group extends \Zotlabs\Web\Controller {
intval(local_channel()) intval(local_channel())
); );
if($r) if($r)
$result = group_rmv(local_channel(),$r[0]['name']); $result = group_rmv(local_channel(),$r[0]['gname']);
if($result) if($result)
info( t('Privacy group removed.') . EOL); info( t('Privacy group removed.') . EOL);
else else
@ -156,10 +156,10 @@ class Group extends \Zotlabs\Web\Controller {
if($change) { if($change) {
if(in_array($change,$preselected)) { if(in_array($change,$preselected)) {
group_rmv_member(local_channel(),$group['name'],$change); group_rmv_member(local_channel(),$group['gname'],$change);
} }
else { else {
group_add_member(local_channel(),$group['name'],$change); group_add_member(local_channel(),$group['gname'],$change);
} }
$members = group_get_members($group['id']); $members = group_get_members($group['id']);
@ -181,7 +181,7 @@ class Group extends \Zotlabs\Web\Controller {
$context = $context + array( $context = $context + array(
'$title' => t('Privacy group editor'), '$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'], '$gid' => $group['id'],
'$drop' => $drop_txt, '$drop' => $drop_txt,
'$public' => array('public',t('Members are visible to other channels'), $group['visible'], ''), '$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); $groupeditor['members'][] = micropro($member,true,'mpgroup', $textmode);
} }
else 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", $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",

View File

@ -408,8 +408,12 @@ class Import extends \Zotlabs\Web\Controller {
$saved = array(); $saved = array();
foreach($groups as $group) { foreach($groups as $group) {
$saved[$group['hash']] = array('old' => $group['id']); $saved[$group['hash']] = array('old' => $group['id']);
if(array_key_exists('name',$group)) {
$group['gname'] = $group['name'];
unset($group['name']);
}
unset($group['id']); unset($group['id']);
$group['uid'] = $channel['channel_id']; $group['uid'] = $channel['channel_id'];
dbesc_array($group); dbesc_array($group);
$r = dbq("INSERT INTO groups (`" $r = dbq("INSERT INTO groups (`"
. implode("`, `", array_keys($group)) . implode("`, `", array_keys($group))

View File

@ -581,7 +581,7 @@ class Item extends \Zotlabs\Web\Controller {
if($success['replaced']) { if($success['replaced']) {
$post_tags[] = array( $post_tags[] = array(
'uid' => $profile_uid, 'uid' => $profile_uid,
'type' => $success['termtype'], 'ttype' => $success['termtype'],
'otype' => TERM_OBJ_POST, 'otype' => TERM_OBJ_POST,
'term' => $success['term'], 'term' => $success['term'],
'url' => $success['url'] 'url' => $success['url']
@ -666,7 +666,7 @@ class Item extends \Zotlabs\Web\Controller {
foreach($cats as $cat) { foreach($cats as $cat) {
$post_tags[] = array( $post_tags[] = array(
'uid' => $profile_uid, 'uid' => $profile_uid,
'type' => TERM_CATEGORY, 'ttype' => TERM_CATEGORY,
'otype' => TERM_OBJ_POST, 'otype' => TERM_OBJ_POST,
'term' => trim($cat), 'term' => trim($cat),
'url' => $owner_xchan['xchan_url'] . '?f=&cat=' . urlencode(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) { if($orig_post) {
// preserve original tags // 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($orig_post['id']),
intval(TERM_OBJ_POST), intval(TERM_OBJ_POST),
intval($profile_uid), intval($profile_uid),
@ -688,7 +688,7 @@ class Item extends \Zotlabs\Web\Controller {
foreach($t as $t1) { foreach($t as $t1) {
$post_tags[] = array( $post_tags[] = array(
'uid' => $profile_uid, 'uid' => $profile_uid,
'type' => $t1['type'], 'ttype' => $t1['type'],
'otype' => TERM_OBJ_POST, 'otype' => TERM_OBJ_POST,
'term' => $t1['term'], 'term' => $t1['term'],
'url' => $t1['url'], 'url' => $t1['url'],

View File

@ -88,10 +88,10 @@ class Lockview extends \Zotlabs\Web\Controller {
stringify_array_elms($deny_users,true); stringify_array_elms($deny_users,true);
if(count($allowed_groups)) { 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) if($r)
foreach($r as $rr) foreach($r as $rr)
$l[] = '<li><b>' . $rr['name'] . '</b></li>'; $l[] = '<li><b>' . $rr['gname'] . '</b></li>';
} }
if(count($allowed_users)) { if(count($allowed_users)) {
$r = q("SELECT xchan_name FROM xchan WHERE xchan_hash IN ( " . implode(', ',$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>'; $l[] = '<li>' . $rr['xchan_name'] . '</li>';
} }
if(count($deny_groups)) { 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) if($r)
foreach($r as $rr) 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)) { if(count($deny_users)) {
$r = q("SELECT xchan_name FROM xchan WHERE xchan_hash IN ( " . implode(', ', $deny_users) . " )"); $r = q("SELECT xchan_name FROM xchan WHERE xchan_hash IN ( " . implode(', ', $deny_users) . " )");

View File

@ -223,7 +223,7 @@ class Network extends \Zotlabs\Web\Controller {
if($x) { if($x) {
$title = replace_macros(get_markup_template("section_title.tpl"),array( $title = replace_macros(get_markup_template("section_title.tpl"),array(
'$title' => t('Privacy group: ') . $x['name'] '$title' => t('Privacy group: ') . $x['gname']
)); ));
} }

View File

@ -440,7 +440,7 @@ class Photos extends \Zotlabs\Web\Controller {
if($success['replaced']) { if($success['replaced']) {
$post_tags[] = array( $post_tags[] = array(
'uid' => $profile_uid, 'uid' => $profile_uid,
'type' => $success['termtype'], 'ttype' => $success['termtype'],
'otype' => TERM_OBJ_POST, 'otype' => TERM_OBJ_POST,
'term' => $success['term'], 'term' => $success['term'],
'url' => $success['url'] 'url' => $success['url']

View File

@ -67,16 +67,16 @@ class Profiles extends \Zotlabs\Web\Controller {
$name = t('Profile-') . ($num_profiles + 1); $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())); 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' )", VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s' )",
intval(get_account_id()), intval(get_account_id()),
intval(local_channel()), intval(local_channel()),
dbesc(random_string()), dbesc(random_string()),
dbesc($name), dbesc($name),
dbesc($r1[0]['name']), dbesc($r1[0]['fullname']),
dbesc($r1[0]['photo']), dbesc($r1[0]['photo']),
dbesc($r1[0]['thumb']) dbesc($r1[0]['thumb'])
); );
@ -277,14 +277,14 @@ class Profiles extends \Zotlabs\Web\Controller {
$name = escape_tags(trim($_POST['name'])); $name = escape_tags(trim($_POST['name']));
if($orig[0]['name'] != $name) { if($orig[0]['fullname'] != $name) {
$namechanged = true; $namechanged = true;
$v = validate_channelname($name); $v = validate_channelname($name);
if($v) { if($v) {
notice($v); notice($v);
$namechanged = false; $namechanged = false;
$name = $orig[0]['name']; $name = $orig[0]['fullname'];
} }
} }
@ -350,7 +350,7 @@ class Profiles extends \Zotlabs\Web\Controller {
$withchanged = false; $withchanged = false;
if(strlen($with)) { if(strlen($with)) {
if($with != strip_tags($orig[0]['with'])) { if($with != strip_tags($orig[0]['partner'])) {
$withchanged = true; $withchanged = true;
$prf = ''; $prf = '';
$lookup = $with; $lookup = $with;
@ -382,7 +382,7 @@ class Profiles extends \Zotlabs\Web\Controller {
} }
} }
else else
$with = $orig[0]['with']; $with = $orig[0]['partner'];
} }
$profile_fields_basic = get_profile_fields_basic(); $profile_fields_basic = get_profile_fields_basic();
@ -439,7 +439,7 @@ class Profiles extends \Zotlabs\Web\Controller {
$changes[] = t('Dislikes'); $changes[] = t('Dislikes');
$value = $dislikes; $value = $dislikes;
} }
if($work != $orig[0]['work']) { if($work != $orig[0]['employment']) {
$changes[] = t('Work/Employment'); $changes[] = t('Work/Employment');
} }
if($religion != $orig[0]['religion']) { if($religion != $orig[0]['religion']) {
@ -486,7 +486,7 @@ class Profiles extends \Zotlabs\Web\Controller {
$r = q("UPDATE `profile` $r = q("UPDATE `profile`
SET `profile_name` = '%s', SET `profile_name` = '%s',
`name` = '%s', `fullname` = '%s',
`pdesc` = '%s', `pdesc` = '%s',
`gender` = '%s', `gender` = '%s',
`dob` = '%s', `dob` = '%s',
@ -496,7 +496,7 @@ class Profiles extends \Zotlabs\Web\Controller {
`postal_code` = '%s', `postal_code` = '%s',
`country_name` = '%s', `country_name` = '%s',
`marital` = '%s', `marital` = '%s',
`with` = '%s', `partner` = '%s',
`howlong` = '%s', `howlong` = '%s',
`sexual` = '%s', `sexual` = '%s',
`homepage` = '%s', `homepage` = '%s',
@ -515,7 +515,7 @@ class Profiles extends \Zotlabs\Web\Controller {
`tv` = '%s', `tv` = '%s',
`film` = '%s', `film` = '%s',
`romance` = '%s', `romance` = '%s',
`work` = '%s', `employment` = '%s',
`education` = '%s', `education` = '%s',
`hide_friends` = %d `hide_friends` = %d
WHERE `id` = %d AND `uid` = %d", WHERE `id` = %d AND `uid` = %d",
@ -591,7 +591,7 @@ class Profiles extends \Zotlabs\Web\Controller {
} }
function get() { function get() {
$o = ''; $o = '';
@ -627,8 +627,6 @@ class Profiles extends \Zotlabs\Web\Controller {
} }
$editselect = 'none'; $editselect = 'none';
// if(feature_enabled(local_channel(),'richtext'))
// $editselect = 'textareas';
\App::$page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array( \App::$page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array(
'$baseurl' => z_root(), '$baseurl' => z_root(),
@ -712,7 +710,7 @@ class Profiles extends \Zotlabs\Web\Controller {
'$is_default' => $is_default, '$is_default' => $is_default,
'$default' => t('This is your default profile.') . EOL . translate_scope(map_scope($channel['channel_r_profile'])), '$default' => t('This is your default profile.') . EOL . translate_scope(map_scope($channel['channel_r_profile'])),
'$advanced' => $advanced, '$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']), '$pdesc' => array('pdesc', t('Title/Description'), $r[0]['pdesc']),
'$dob' => dob($r[0]['dob']), '$dob' => dob($r[0]['dob']),
'$hide_friends' => $hide_friends, '$hide_friends' => $hide_friends,
@ -725,7 +723,7 @@ class Profiles extends \Zotlabs\Web\Controller {
'$gender_min' => gender_selector_min($r[0]['gender']), '$gender_min' => gender_selector_min($r[0]['gender']),
'$marital' => marital_selector($r[0]['marital']), '$marital' => marital_selector($r[0]['marital']),
'$marital_min' => marital_selector_min($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']))), '$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' => sexpref_selector($r[0]['sexual']),
'$sexual_min' => sexpref_selector_min($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']), '$film' => array('film', t('Film/Dance/Culture/Entertainment'), $r[0]['film']),
'$interest' => array('interest', t('Hobbies/Interests'), $r[0]['interest']), '$interest' => array('interest', t('Hobbies/Interests'), $r[0]['interest']),
'$romance' => array('romance',t('Love/Romance'), $r[0]['romance']), '$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']), '$education' => array('education', t('School/Education'), $r[0]['education']),
'$contact' => array('contact', t('Contact information and social networks'), $r[0]['contact']), '$contact' => array('contact', t('Contact information and social networks'), $r[0]['contact']),
'$channels' => array('channels', t('My other channels'), $r[0]['channels']), '$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", $r = q("SELECT * FROM `profile` WHERE `uid` = %d",
local_channel()); local_channel());
if(count($r)) { if($r) {
$tpl = get_markup_template('profile_entry.tpl'); $tpl = get_markup_template('profile_entry.tpl');
foreach($r as $rr) { foreach($r as $rr) {
@ -780,10 +778,7 @@ class Profiles extends \Zotlabs\Web\Controller {
'$cr_new' => t('Create New'), '$cr_new' => t('Create New'),
'$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new"), '$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new"),
'$profiles' => $profiles '$profiles' => $profiles
)); ));
} }
return $o; return $o;

View File

@ -79,7 +79,7 @@ class Search extends \Zotlabs\Web\Controller {
return $o; return $o;
if($tag) { 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_OBJ_POST),
intval(TERM_HASHTAG), intval(TERM_HASHTAG),
intval(TERM_COMMUNITYTAG), intval(TERM_COMMUNITYTAG),

View File

@ -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_HASHTAG),
intval(TERM_COMMUNITYTAG) intval(TERM_COMMUNITYTAG)
); );

View File

@ -337,7 +337,7 @@ class Settings extends \Zotlabs\Web\Controller {
} }
$hide_presence = 1 - (intval($role_permissions['online'])); $hide_presence = 1 - (intval($role_permissions['online']));
if($role_permissions['default_collection']) { 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()), intval(local_channel()),
dbesc( t('Friends') ) dbesc( t('Friends') )
); );
@ -345,7 +345,7 @@ class Settings extends \Zotlabs\Web\Controller {
require_once('include/group.php'); require_once('include/group.php');
group_add(local_channel(), t('Friends')); group_add(local_channel(), t('Friends'));
group_add_member(local_channel(),t('Friends'),$channel['channel_hash']); 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()), intval(local_channel()),
dbesc( t('Friends') ) dbesc( t('Friends') )
); );
@ -537,7 +537,7 @@ class Settings extends \Zotlabs\Web\Controller {
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc($channel['channel_hash']) 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), dbesc($username),
intval($channel['channel_id']) intval($channel['channel_id'])
); );
@ -562,7 +562,7 @@ class Settings extends \Zotlabs\Web\Controller {
function get() { function get() {
$o = ''; $o = '';
nav_set_selected('settings'); nav_set_selected('settings');

View File

@ -54,7 +54,7 @@ class Tagrm extends \Zotlabs\Web\Controller {
function get() { function get() {
if(! local_channel()) { if(! local_channel()) {
goaway(z_root() . '/' . $_SESSION['photo_return']); goaway(z_root() . '/' . $_SESSION['photo_return']);

View File

@ -45,10 +45,10 @@ require_once('include/account.php');
define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '1.7.1' ); define ( 'STD_VERSION', '1.7.2' );
define ( 'ZOT_REVISION', 1.1 ); define ( 'ZOT_REVISION', 1.1 );
define ( 'DB_UPDATE_VERSION', 1172 ); define ( 'DB_UPDATE_VERSION', 1173 );
/** /**

View File

@ -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"; $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()) intval(local_channel())
); );
@ -32,7 +32,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
$selected = " selected=\"selected\" "; $selected = " selected=\"selected\" ";
else else
$selected = ''; $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"; $o .= "<option value=\"{$rr['id']}\" $selected title=\"{$rr['name']}\" >$trimmed</option>\r\n";
} }

View File

@ -337,7 +337,7 @@ function create_identity($arr) {
// Not checking return value. // Not checking return value.
// It's ok for this to fail if it's an imported channel, and therefore the hash is a duplicate // 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') ", VALUES ( %d, %d, '%s', '%s', %d, %d, '%s', '%s', '%s') ",
intval($ret['channel']['channel_account_id']), intval($ret['channel']['channel_account_id']),
intval($newuid), 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 our role_permissions indicate that we're using a default collection ACL, add it.
if(is_array($role_permissions) && $role_permissions['default_collection']) { 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), intval($newuid),
dbesc( t('Friends') ) 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. // 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_SAVEDSEARCH),
intval(TERM_THING), intval(TERM_THING),
intval($channel_id) intval($channel_id)
@ -1257,7 +1257,7 @@ function advanced_profile(&$a) {
if(! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),'view_profile')) if(! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),'view_profile'))
return ''; return '';
if(App::$profile['name']) { if(App::$profile['fullname']) {
$profile_fields_basic = get_profile_fields_basic(); $profile_fields_basic = get_profile_fields_basic();
$profile_fields_advanced = get_profile_fields_advanced(); $profile_fields_advanced = get_profile_fields_advanced();
@ -1281,7 +1281,7 @@ function advanced_profile(&$a) {
$profile = array(); $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'] ); if(App::$profile['gender']) $profile['gender'] = array( t('Gender:'), App::$profile['gender'] );
@ -1329,8 +1329,8 @@ function advanced_profile(&$a) {
if(App::$profile['marital']) if(App::$profile['marital'])
$profile['marital'] = array( t('Status:'), App::$profile['marital']); $profile['marital'] = array( t('Status:'), App::$profile['marital']);
if(App::$profile['with']) if(App::$profile['partner'])
$profile['marital']['with'] = bbcode(App::$profile['with']); $profile['marital']['partner'] = bbcode(App::$profile['partner']);
if(strlen(App::$profile['howlong']) && App::$profile['howlong'] !== NULL_DATE) { if(strlen(App::$profile['howlong']) && App::$profile['howlong'] !== NULL_DATE) {
$profile['howlong'] = relative_date(App::$profile['howlong'], t('for %1$d %2$s')); $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['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 ); 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); $profile_fields_basic = (($filter == 0) ? get_config('system','profile_fields_basic') : null);
if(! $profile_fields_basic) 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(); $x = array();
if($profile_fields_basic) if($profile_fields_basic)
@ -1673,7 +1673,7 @@ function get_profile_fields_advanced($filter = 0) {
$basic = get_profile_fields_basic($filter); $basic = get_profile_fields_basic($filter);
$profile_fields_advanced = (($filter == 0) ? get_config('system','profile_fields_advanced') : null); $profile_fields_advanced = (($filter == 0) ? get_config('system','profile_fields_advanced') : null);
if(! $profile_fields_advanced) 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(); $x = array();
if($basic) if($basic)

View File

@ -39,7 +39,7 @@ function fileas_widget($baseurl,$selected = '') {
return ''; return '';
$terms = array(); $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(local_channel()),
intval(TERM_FILE) intval(TERM_FILE)
); );
@ -72,7 +72,7 @@ function categories_widget($baseurl,$selected = '') {
from term join item on term.oid = item.id from term join item on term.oid = item.id
where item.uid = %d where item.uid = %d
and term.uid = item.uid and term.uid = item.uid
and term.type = %d and term.ttype = %d
and term.otype = %d and term.otype = %d
and item.owner_xchan = '%s' and item.owner_xchan = '%s'
and item.item_wall = 1 and item.item_wall = 1

View File

@ -854,12 +854,12 @@ function event_store_item($arr, $event) {
if(($arr['term']) && (is_array($arr['term']))) { if(($arr['term']) && (is_array($arr['term']))) {
foreach($arr['term'] as $t) { 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') ", values(%d,%d,%d,%d,'%s','%s') ",
intval($arr['uid']), intval($arr['uid']),
intval($r[0]['id']), intval($r[0]['id']),
intval(TERM_OBJ_POST), intval(TERM_OBJ_POST),
intval($t['type']), intval($t['ttype']),
dbesc($t['term']), dbesc($t['term']),
dbesc($t['url']) dbesc($t['url'])
); );

View File

@ -515,7 +515,7 @@ function get_atom_elements($feed, $item, &$author) {
if($termterm) { if($termterm) {
$terms[] = array( $terms[] = array(
'otype' => TERM_OBJ_POST, 'otype' => TERM_OBJ_POST,
'type' => $termtype, 'ttype' => $termtype,
'url' => $termurl, 'url' => $termurl,
'term' => $termterm, 'term' => $termterm,
); );

View File

@ -18,7 +18,7 @@ function group_add($uid,$name,$public = 0) {
intval($r) intval($r)
); );
if(count($z) && $z[0]['deleted']) { 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), intval($uid),
dbesc($name) dbesc($name)
);*/ );*/
@ -38,7 +38,7 @@ function group_add($uid,$name,$public = 0) {
} while($dups == true); } 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' ) ", VALUES( '%s', %d, %d, '%s' ) ",
dbesc($hash), dbesc($hash),
intval($uid), intval($uid),
@ -57,7 +57,7 @@ function group_add($uid,$name,$public = 0) {
function group_rmv($uid,$name) { function group_rmv($uid,$name) {
$ret = false; $ret = false;
if(x($uid) && x($name)) { 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), intval($uid),
dbesc($name) dbesc($name)
); );
@ -108,7 +108,7 @@ function group_rmv($uid,$name) {
); );
// remove group // 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), intval($uid),
dbesc($name) dbesc($name)
); );
@ -125,7 +125,7 @@ function group_rmv($uid,$name) {
function group_byname($uid,$name) { function group_byname($uid,$name) {
if((! $uid) || (! strlen($name))) if((! $uid) || (! strlen($name)))
return false; 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), intval($uid),
dbesc($name) dbesc($name)
); );
@ -232,13 +232,13 @@ function mini_group_select($uid,$group = '') {
$grps = array(); $grps = array();
$o = ''; $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) intval($uid)
); );
$grps[] = array('name' => '', 'hash' => '0', 'selected' => ''); $grps[] = array('name' => '', 'hash' => '0', 'selected' => '');
if(count($r)) { if(count($r)) {
foreach($r as $rr) { 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']) intval($_SESSION['uid'])
); );
$member_of = array(); $member_of = array();
@ -296,7 +296,7 @@ function group_side($every="connections",$each="group",$edit = false, $group_id
'id' => $rr['id'], 'id' => $rr['id'],
'enc_cid' => base64url_encode($cid), 'enc_cid' => base64url_encode($cid),
'cid' => $cid, 'cid' => $cid,
'text' => $rr['name'], 'text' => $rr['gname'],
'selected' => $selected, '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'] : ''), '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, 'edit' => $groupedit,
@ -340,7 +340,7 @@ function expand_groups($a) {
function member_of($c) { 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) dbesc($c)
); );

View File

@ -332,7 +332,9 @@ function import_apps($channel,$apps) {
); );
if($x) { if($x) {
foreach($term as $t) { 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) { if($exists && $term) {
foreach($term as $t) { 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) { if($x) {
foreach($term as $t) { 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']));
} }
} }
} }

View File

@ -1182,8 +1182,8 @@ function encode_item_terms($terms,$mirror = false) {
if($terms) { if($terms) {
foreach($terms as $term) { foreach($terms as $term) {
if(in_array($term['type'],$allowed_export_terms)) if(in_array($term['ttype'],$allowed_export_terms))
$ret[] = array('tag' => $term['term'], 'url' => $term['url'], 'type' => termtype($term['type'])); $ret[] = array('tag' => $term['term'], 'url' => $term['url'], 'ttype' => termtype($term['type']));
} }
} }
@ -1240,39 +1240,41 @@ function decode_tags($t) {
$ret = array(); $ret = array();
foreach($t as $x) { foreach($t as $x) {
$tag = array(); $tag = array();
if(array_key_exists('type',$x))
$x['ttype'] = $x['type'];
$tag['term'] = htmlspecialchars($x['tag'], ENT_COMPAT, 'UTF-8', false); $tag['term'] = htmlspecialchars($x['tag'], ENT_COMPAT, 'UTF-8', false);
$tag['url'] = htmlspecialchars($x['url'], ENT_COMPAT, 'UTF-8', false); $tag['url'] = htmlspecialchars($x['url'], ENT_COMPAT, 'UTF-8', false);
switch($x['type']) { switch($x['ttype']) {
case 'hashtag': case 'hashtag':
$tag['type'] = TERM_HASHTAG; $tag['ttype'] = TERM_HASHTAG;
break; break;
case 'mention': case 'mention':
$tag['type'] = TERM_MENTION; $tag['ttype'] = TERM_MENTION;
break; break;
case 'category': case 'category':
$tag['type'] = TERM_CATEGORY; $tag['ttype'] = TERM_CATEGORY;
break; break;
case 'private_category': case 'private_category':
$tag['type'] = TERM_PCATEGORY; $tag['ttype'] = TERM_PCATEGORY;
break; break;
case 'file': case 'file':
$tag['type'] = TERM_FILE; $tag['ttype'] = TERM_FILE;
break; break;
case 'search': case 'search':
$tag['type'] = TERM_SEARCH; $tag['ttype'] = TERM_SEARCH;
break; break;
case 'thing': case 'thing':
$tag['type'] = TERM_THING; $tag['ttype'] = TERM_THING;
break; break;
case 'bookmark': case 'bookmark':
$tag['type'] = TERM_BOOKMARK; $tag['ttype'] = TERM_BOOKMARK;
break; break;
case 'communitytag': case 'communitytag':
$tag['type'] = TERM_COMMUNITYTAG; $tag['ttype'] = TERM_COMMUNITYTAG;
break; break;
default: default:
case 'unknown': case 'unknown':
$tag['type'] = TERM_UNKNOWN; $tag['ttype'] = TERM_UNKNOWN;
break; break;
} }
$ret[] = $tag; $ret[] = $tag;
@ -1855,12 +1857,12 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
if(($terms) && (is_array($terms))) { if(($terms) && (is_array($terms))) {
foreach($terms as $t) { 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') ", values(%d,%d,%d,%d,'%s','%s') ",
intval($arr['uid']), intval($arr['uid']),
intval($current_post), intval($current_post),
intval(TERM_OBJ_POST), intval(TERM_OBJ_POST),
intval($t['type']), intval($t['ttype']),
dbesc($t['term']), dbesc($t['term']),
dbesc($t['url']) dbesc($t['url'])
); );
@ -2134,12 +2136,12 @@ function item_store_update($arr,$allow_exec = false, $deliver = true) {
if(is_array($terms)) { if(is_array($terms)) {
foreach($terms as $t) { 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') ", values(%d,%d,%d,%d,'%s','%s') ",
intval($uid), intval($uid),
intval($orig_post_id), intval($orig_post_id),
intval(TERM_OBJ_POST), intval(TERM_OBJ_POST),
intval($t['type']), intval($t['ttype']),
dbesc($t['term']), dbesc($t['term']),
dbesc($t['url']) dbesc($t['url'])
); );
@ -2720,7 +2722,7 @@ function start_delivery_chain($channel, $item, $item_id, $parent) {
foreach($tags as $tt) { foreach($tags as $tt) {
$tt = trim($tt); $tt = trim($tt);
if($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') ", values(%d,%d,%d,%d,'%s','%s') ",
intval($channel['channel_id']), intval($channel['channel_id']),
intval($item_id), intval($item_id),
@ -2863,7 +2865,7 @@ function check_item_source($uid, $item) {
foreach($words as $word) { foreach($words as $word) {
if(substr($word,0,1) === '#' && $tags) { if(substr($word,0,1) === '#' && $tags) {
foreach($tags as $t) 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; return true;
} }
elseif((strpos($word,'/') === 0) && preg_match($word,$text)) elseif((strpos($word,'/') === 0) && preg_match($word,$text))
@ -2916,7 +2918,7 @@ function post_is_importable($item,$abook) {
continue; continue;
if(substr($word,0,1) === '#' && $tags) { if(substr($word,0,1) === '#' && $tags) {
foreach($tags as $t) 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; return false;
} }
elseif((strpos($word,'/') === 0) && preg_match($word,$text)) elseif((strpos($word,'/') === 0) && preg_match($word,$text))
@ -2937,7 +2939,7 @@ function post_is_importable($item,$abook) {
continue; continue;
if(substr($word,0,1) === '#' && $tags) { if(substr($word,0,1) === '#' && $tags) {
foreach($tags as $t) 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; return true;
} }
elseif((strpos($word,'/') === 0) && preg_match($word,$text)) elseif((strpos($word,'/') === 0) && preg_match($word,$text))
@ -3214,7 +3216,7 @@ function item_getfeedtags($item) {
if(count($terms)) { if(count($terms)) {
foreach($terms as $term) { 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']); $ret[] = array('#',$term['url'],$term['term']);
else else
$ret[] = array('@',$term['url'],$term['term']); $ret[] = array('@',$term['url'],$term['term']);
@ -3685,7 +3687,7 @@ function fetch_post_tags($items,$link = false) {
for($x = 0; $x < count($items); $x ++) { for($x = 0; $x < count($items); $x ++) {
if($tags) { if($tags) {
foreach($tags as $t) { foreach($tags as $t) {
if(($link) && ($t['type'] == TERM_MENTION)) if(($link) && ($t['ttype'] == TERM_MENTION))
$t['url'] = chanlink_url($t['url']); $t['url'] = chanlink_url($t['url']);
if(array_key_exists('item_id',$items[$x])) { if(array_key_exists('item_id',$items[$x])) {
if($t['oid'] == $items[$x]['item_id']) { 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 = ''; $contact_str = '';
/** @FIXME $group is undefined */
$contacts = group_get_members($group); $contacts = group_get_members($r[0]['id']);
if ($contacts) { if ($contacts) {
foreach($contacts as $c) { foreach($contacts as $c) {
if($contact_str) 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 ) "; $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']); $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) { elseif($arr['cid'] && $uid) {

View File

@ -20,7 +20,7 @@ function file_tag_file_query($table,$s,$type = 'file') {
else else
$termtype = TERM_CATEGORY; $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), intval($termtype),
protect_sprintf(dbesc($s)) 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 = '') { function term_query($table,$s,$type = TERM_UNKNOWN, $type2 = '') {
if($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($type),
intval($type2), intval($type2),
protect_sprintf(dbesc($s)) protect_sprintf(dbesc($s))
); );
} }
else { 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), intval($type),
protect_sprintf(dbesc($s)) protect_sprintf(dbesc($s))
); );
@ -49,7 +49,7 @@ function store_item_tag($uid,$iid,$otype,$type,$term,$url = '') {
return false; return false;
$r = q("select * from term $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' ", and term = '%s' and url = '%s' ",
intval($uid), intval($uid),
intval($iid), intval($iid),
@ -61,7 +61,7 @@ function store_item_tag($uid,$iid,$otype,$type,$term,$url = '') {
if($r) if($r)
return false; 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') ", values( %d, %d, %d, %d, '%s', '%s') ",
intval($uid), intval($uid),
intval($iid), intval($iid),
@ -85,7 +85,7 @@ function get_terms_oftype($arr,$type) {
foreach($type as $t) foreach($type as $t)
foreach($arr as $x) foreach($arr as $x)
if($x['type'] == $t) if($x['ttype'] == $t)
$ret[] = $x; $ret[] = $x;
return $ret; return $ret;
@ -93,9 +93,9 @@ function get_terms_oftype($arr,$type) {
function format_term_for_display($term) { function format_term_for_display($term) {
$s = ''; $s = '';
if(($term['type'] == TERM_HASHTAG) || ($term['type'] == TERM_COMMUNITYTAG)) if(($term['ttype'] == TERM_HASHTAG) || ($term['ttype'] == TERM_COMMUNITYTAG))
$s .= '#'; $s .= '#';
elseif($term['type'] == TERM_MENTION) elseif($term['ttype'] == TERM_MENTION)
$s .= '@'; $s .= '@';
else else
return $s; return $s;
@ -142,7 +142,7 @@ function tagadelic($uid, $count = 0, $authors = '', $owner = '', $flags = 0, $re
// Fetch tags // Fetch tags
$r = q("select term, count(term) as total from term left join item on term.oid = item.id $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 and otype = %d and item_type = %d and item_private = 0
$sql_options $item_normal $sql_options $item_normal
group by term order by total desc %s", group by term order by total desc %s",

View File

@ -810,7 +810,7 @@ function get_mentions($item,$tags) {
return $o; return $o;
foreach($tags as $x) { 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="mentioned" href="' . $x['url'] . '" />' . "\r\n";
$o .= "\t\t" . '<link rel="ostatus:attention" href="' . $x['url'] . '" />' . "\r\n"; $o .= "\t\t" . '<link rel="ostatus:attention" href="' . $x['url'] . '" />' . "\r\n";
} }

View File

@ -212,13 +212,13 @@ function widget_savedsearch($arr) {
$search = ((x($_GET,'search')) ? $_GET['search'] : ''); $search = ((x($_GET,'search')) ? $_GET['search'] : '');
if(x($_GET,'searchsave') && $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(local_channel()),
intval(TERM_SAVEDSEARCH), intval(TERM_SAVEDSEARCH),
dbesc($search) dbesc($search)
); );
if(! $r) { 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(local_channel()),
intval(TERM_SAVEDSEARCH), intval(TERM_SAVEDSEARCH),
dbesc($search) dbesc($search)
@ -227,7 +227,7 @@ function widget_savedsearch($arr) {
} }
if(x($_GET,'searchremove') && $search) { 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(local_channel()),
intval(TERM_SAVEDSEARCH), intval(TERM_SAVEDSEARCH),
dbesc($search) dbesc($search)
@ -254,7 +254,7 @@ function widget_savedsearch($arr) {
$o = ''; $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(local_channel()),
intval(TERM_SAVEDSEARCH) intval(TERM_SAVEDSEARCH)
); );
@ -296,7 +296,7 @@ function widget_filer($arr) {
$selected = ((x($_REQUEST,'file')) ? $_REQUEST['file'] : ''); $selected = ((x($_REQUEST,'file')) ? $_REQUEST['file'] : '');
$terms = array(); $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(local_channel()),
intval(TERM_FILE) intval(TERM_FILE)
); );

View File

@ -1953,7 +1953,7 @@ function remove_community_tag($sender, $arr, $uid) {
return; 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($uid),
intval($r[0]['id']), intval($r[0]['id']),
intval(TERM_OBJ_POST), intval(TERM_OBJ_POST),
@ -3051,7 +3051,7 @@ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) {
} }
if($groups_changed) { 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) intval($uid)
); );
if($r) if($r)
@ -3344,10 +3344,10 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
} }
} }
if($found) { if($found) {
if(($y['name'] != $cl['name']) if(($y['gname'] != $cl['name'])
|| ($y['visible'] != $cl['visible']) || ($y['visible'] != $cl['visible'])
|| ($y['deleted'] != $cl['deleted'])) { || ($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']), dbesc($cl['name']),
intval($cl['visible']), intval($cl['visible']),
intval($cl['deleted']), intval($cl['deleted']),
@ -3363,7 +3363,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
} }
} }
if(! $found) { 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' ) ", VALUES( '%s', %d, %d, %d, '%s' ) ",
dbesc($cl['collection']), dbesc($cl['collection']),
intval($channel['channel_id']), 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'])) { 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) { foreach($arr['profile'] as $profile) {
$x = q("select * from profile where profile_guid = '%s' and uid = %d limit 1", $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) { foreach($profile as $k => $v) {
if(in_array($k,$disallowed)) if(in_array($k,$disallowed))
continue; 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 * We also need to import local photos if a custom photo is selected
*/ */
} }
if(count($clean)) { if(count($clean)) {
foreach($clean as $k => $v) { foreach($clean as $k => $v) {
$r = dbq("UPDATE profile set `" . dbesc($k) . "` = '" . dbesc($v) $r = dbq("UPDATE profile set `" . dbesc($k) . "` = '" . dbesc($v)

View File

@ -440,12 +440,13 @@ CREATE TABLE IF NOT EXISTS `groups` (
`uid` int(10) unsigned NOT NULL DEFAULT '0', `uid` int(10) unsigned NOT NULL DEFAULT '0',
`visible` tinyint(1) NOT NULL DEFAULT '0', `visible` tinyint(1) NOT NULL DEFAULT '0',
`deleted` 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`), PRIMARY KEY (`id`),
KEY `uid` (`uid`), KEY `uid` (`uid`),
KEY `visible` (`visible`), KEY `visible` (`visible`),
KEY `deleted` (`deleted`), KEY `deleted` (`deleted`),
KEY `hash` (`hash`) KEY `hash` (`hash`),
KEY `gname` (`gname`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `group_member` ( CREATE TABLE IF NOT EXISTS `group_member` (
@ -979,7 +980,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
`profile_name` char(255) NOT NULL DEFAULT '', `profile_name` char(255) NOT NULL DEFAULT '',
`is_default` tinyint(1) NOT NULL DEFAULT '0', `is_default` tinyint(1) NOT NULL DEFAULT '0',
`hide_friends` 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 '', `pdesc` char(255) NOT NULL DEFAULT '',
`chandesc` text NOT NULL, `chandesc` text NOT NULL,
`dob` char(32) NOT NULL DEFAULT '0000-00-00', `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 '', `hometown` char(255) NOT NULL DEFAULT '',
`gender` char(32) NOT NULL DEFAULT '', `gender` char(32) NOT NULL DEFAULT '',
`marital` char(255) 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', `howlong` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`sexual` char(255) NOT NULL DEFAULT '', `sexual` char(255) NOT NULL DEFAULT '',
`politic` 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, `film` text NOT NULL,
`interest` text NOT NULL, `interest` text NOT NULL,
`romance` text NOT NULL, `romance` text NOT NULL,
`work` text NOT NULL, `employment` text NOT NULL,
`education` text NOT NULL, `education` text NOT NULL,
`contact` text NOT NULL, `contact` text NOT NULL,
`channels` 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', `uid` int(10) unsigned NOT NULL DEFAULT '0',
`oid` int(10) unsigned NOT NULL DEFAULT '0', `oid` int(10) unsigned NOT NULL DEFAULT '0',
`otype` tinyint(3) 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 '', `term` char(255) NOT NULL DEFAULT '',
`url` char(255) NOT NULL DEFAULT '', `url` char(255) NOT NULL DEFAULT '',
`imgurl` char(255) NOT NULL DEFAULT '', `imgurl` char(255) NOT NULL DEFAULT '',
@ -1162,7 +1163,7 @@ CREATE TABLE IF NOT EXISTS `term` (
PRIMARY KEY (`tid`), PRIMARY KEY (`tid`),
KEY `oid` (`oid`), KEY `oid` (`oid`),
KEY `otype` (`otype`), KEY `otype` (`otype`),
KEY `type` (`type`), KEY `ttype` (`ttype`),
KEY `term` (`term`), KEY `term` (`term`),
KEY `uid` (`uid`), KEY `uid` (`uid`),
KEY `aid` (`aid`), KEY `aid` (`aid`),

View File

@ -445,7 +445,7 @@ CREATE TABLE "groups" (
"uid" bigint NOT NULL, "uid" bigint NOT NULL,
"visible" numeric(1) NOT NULL DEFAULT '0', "visible" numeric(1) NOT NULL DEFAULT '0',
"deleted" numeric(1) NOT NULL DEFAULT '0', "deleted" numeric(1) NOT NULL DEFAULT '0',
"name" text NOT NULL, "gname" text NOT NULL,
PRIMARY KEY ("id") PRIMARY KEY ("id")
); );
@ -968,7 +968,7 @@ CREATE TABLE "profile" (
"profile_name" text NOT NULL, "profile_name" text NOT NULL,
"is_default" numeric(1) NOT NULL DEFAULT '0', "is_default" numeric(1) NOT NULL DEFAULT '0',
"hide_friends" 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 '', "pdesc" text NOT NULL DEFAULT '',
"chandesc" text NOT NULL DEFAULT '', "chandesc" text NOT NULL DEFAULT '',
"dob" varchar(32) NOT NULL DEFAULT '', "dob" varchar(32) NOT NULL DEFAULT '',
@ -981,7 +981,7 @@ CREATE TABLE "profile" (
"hometown" text NOT NULL DEFAULT '', "hometown" text NOT NULL DEFAULT '',
"gender" varchar(32) NOT NULL DEFAULT '', "gender" varchar(32) NOT NULL DEFAULT '',
"marital" text 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', "howlong" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"sexual" text NOT NULL DEFAULT '', "sexual" text NOT NULL DEFAULT '',
"politic" text NOT NULL DEFAULT '', "politic" text NOT NULL DEFAULT '',
@ -997,7 +997,7 @@ CREATE TABLE "profile" (
"film" text NOT NULL DEFAULT '', "film" text NOT NULL DEFAULT '',
"interest" text NOT NULL DEFAULT '', "interest" text NOT NULL DEFAULT '',
"romance" text NOT NULL DEFAULT '', "romance" text NOT NULL DEFAULT '',
"work" text NOT NULL DEFAULT '', "employment" text NOT NULL DEFAULT '',
"education" text NOT NULL DEFAULT '', "education" text NOT NULL DEFAULT '',
"contact" text NOT NULL DEFAULT '', "contact" text NOT NULL DEFAULT '',
"channels" text NOT NULL DEFAULT '', "channels" text NOT NULL DEFAULT '',
@ -1137,7 +1137,7 @@ CREATE TABLE "term" (
"uid" bigint NOT NULL DEFAULT '0', "uid" bigint NOT NULL DEFAULT '0',
"oid" bigint NOT NULL, "oid" bigint NOT NULL,
"otype" numeric(3) NOT NULL, "otype" numeric(3) NOT NULL,
"type" numeric(3) NOT NULL, "ttype" numeric(3) NOT NULL,
"term" text NOT NULL, "term" text NOT NULL,
"url" text NOT NULL, "url" text NOT NULL,
"imgurl" text NOT NULL DEFAULT '', "imgurl" text NOT NULL DEFAULT '',
@ -1147,7 +1147,7 @@ CREATE TABLE "term" (
); );
create index "term_oid" on term ("oid"); create index "term_oid" on term ("oid");
create index "term_otype" on term ("otype"); 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_term" on term ("term");
create index "term_uid" on term ("uid"); create index "term_uid" on term ("uid");
create index "term_aid" on term ("aid"); create index "term_aid" on term ("aid");

View File

@ -1,6 +1,6 @@
<?php <?php
define( 'UPDATE_VERSION' , 1172 ); define( 'UPDATE_VERSION' , 1173 );
/** /**
* *
@ -2163,4 +2163,26 @@ function update_r1171() {
} }
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;
}

View File

@ -33,6 +33,7 @@
<div class="section-content-wrapper"> <div class="section-content-wrapper">
{{foreach $fields as $f}} {{foreach $fields as $f}}
{{if $f == 'name'}} {{if $f == 'name'}}
<dl id="aprofile-fullname" class="aprofile"> <dl id="aprofile-fullname" class="aprofile">
<dt>{{$profile.fullname.0}}</dt> <dt>{{$profile.fullname.0}}</dt>
@ -40,6 +41,13 @@
</dl> </dl>
{{/if}} {{/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 $f == 'gender'}}
{{if $profile.gender}} {{if $profile.gender}}
<dl id="aprofile-gender" class="aprofile"> <dl id="aprofile-gender" class="aprofile">
@ -72,7 +80,7 @@
{{if $profile.marital}} {{if $profile.marital}}
<dl id="aprofile-marital" class="aprofile"> <dl id="aprofile-marital" class="aprofile">
<dt><span class="heart"><i class="fa fa-heart"></i>&nbsp;</span>{{$profile.marital.0}}</dt> <dt><span class="heart"><i class="fa fa-heart"></i>&nbsp;</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> </dl>
{{/if}} {{/if}}
{{/if}} {{/if}}
@ -237,11 +245,11 @@
{{/if}} {{/if}}
{{if $f == 'work'}} {{if $f == 'employment'}}
{{if $profile.work}} {{if $profile.employment}}
<dl id="aprofile-work" class="aprofile"> <dl id="aprofile-work" class="aprofile">
<dt>{{$profile.work.0}}</dt> <dt>{{$profile.employment.0}}</dt>
<dd>{{$profile.work.1}}</dd> <dd>{{$profile.employment.1}}</dd>
</dl> </dl>
{{/if}} {{/if}}
{{/if}} {{/if}}

View File

@ -173,7 +173,7 @@
</div> </div>
<div class="clear"></div> <div class="clear"></div>
{{if $fields.with}} {{if $fields.partner}}
{{include file="field_input.tpl" field=$with}} {{include file="field_input.tpl" field=$with}}
{{/if}} {{/if}}
@ -198,7 +198,7 @@
</div> </div>
</div> </div>
{{/if}} {{/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="panel">
<div class="section-subtitle-wrapper" role="tab" id="miscellaneous"> <div class="section-subtitle-wrapper" role="tab" id="miscellaneous">
<h3> <h3>
@ -269,7 +269,7 @@
{{include file="field_textarea.tpl" field=$romance}} {{include file="field_textarea.tpl" field=$romance}}
{{/if}} {{/if}}
{{if $fields.work}} {{if $fields.employment}}
{{include file="field_textarea.tpl" field=$work}} {{include file="field_textarea.tpl" field=$work}}
{{/if}} {{/if}}

View File

@ -1,6 +1,6 @@
<div class="vcard"> <div class="vcard">
{{if ! $zcard}} {{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}}
{{if $connect}} {{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> <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}}
{{if ! $zcard}} {{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 $reddress}}<div class="reddress" oncopy="return false;">{{$profile.reddress}}</div>{{/if}}
{{/if}} {{/if}}
{{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}} {{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}}