Merge branch 'sabre32' of https://github.com/redmatrix/hubzilla into sabre32

This commit is contained in:
Mario Vavti 2016-06-01 10:00:44 +02:00
commit b4eb9f2a11
46 changed files with 295 additions and 461 deletions

View file

@ -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']),

View file

@ -107,7 +107,7 @@ class Api extends \Zotlabs\Web\Controller {
$r = q("SELECT `clients`.*
FROM `clients`, `tokens`
WHERE `clients`.`client_id`=`tokens`.`client_id`
AND `tokens`.`id`='%s' AND `tokens`.`scope`='request'",
AND `tokens`.`id`='%s' AND `tokens`.`auth_scope`='request'",
dbesc($token));
if (!count($r))

View file

@ -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'],

View file

@ -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);
}
}
}

View file

@ -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))

View file

@ -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)
);

View file

@ -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),

View file

@ -1,117 +0,0 @@
<?php
namespace Zotlabs\Module;
class Fsuggest extends \Zotlabs\Web\Controller {
function post() {
if(! local_channel()) {
return;
}
if(\App::$argc != 2)
return;
$contact_id = intval(\App::$argv[1]);
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id),
intval(local_channel())
);
if(! count($r)) {
notice( t('Contact not found.') . EOL);
return;
}
$contact = $r[0];
$new_contact = intval($_POST['suggest']);
$hash = random_string();
$note = escape_tags(trim($_POST['note']));
if($new_contact) {
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($new_contact),
intval(local_channel())
);
if(count($r)) {
$x = q("INSERT INTO `fsuggest` ( `uid`,`cid`,`name`,`url`,`request`,`photo`,`note`,`created`)
VALUES ( %d, %d, '%s','%s','%s','%s','%s','%s')",
intval(local_channel()),
intval($contact_id),
dbesc($r[0]['name']),
dbesc($r[0]['url']),
dbesc($r[0]['request']),
dbesc($r[0]['photo']),
dbesc($hash),
dbesc(datetime_convert())
);
$r = q("SELECT `id` FROM `fsuggest` WHERE `note` = '%s' AND `uid` = %d LIMIT 1",
dbesc($hash),
intval(local_channel())
);
if(count($r)) {
$fsuggest_id = $r[0]['id'];
q("UPDATE `fsuggest` SET `note` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($note),
intval($fsuggest_id),
intval(local_channel())
);
\Zotlabs\Daemon\Master::Summon(array('Notifier', 'suggest' , $fsuggest_id));
}
info( t('Friend suggestion sent.') . EOL);
}
}
}
function get() {
require_once('include/acl_selectors.php');
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
return;
}
if(\App::$argc != 2)
return;
$contact_id = intval(\App::$argv[1]);
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id),
intval(local_channel())
);
if(! count($r)) {
notice( t('Contact not found.') . EOL);
return;
}
$contact = $r[0];
$o = '<h3>' . t('Suggest Friends') . '</h3>';
$o .= '<div id="fsuggest-desc" >' . sprintf( t('Suggest a friend for %s'), $contact['name']) . '</div>';
$o .= '<form id="fsuggest-form" action="fsuggest/' . $contact_id . '" method="post" >';
// FIXME contact_selector deprecated, removed
// $o .= contact_selector('suggest','suggest-select', false,
// array('size' => 4, 'exclude' => $contact_id, 'networks' => 'DFRN_ONLY', 'single' => true));
$o .= '<div id="fsuggest-submit-wrapper"><input id="fsuggest-submit" type="submit" name="submit" value="' . t('Submit') . '" /></div>';
$o .= '</form>';
return $o;
}
}

View file

@ -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",

View file

@ -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))

View file

@ -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'],

View file

@ -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) . " )");

View file

@ -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']
));
}

View file

@ -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']

View file

@ -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;

View file

@ -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),

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_COMMUNITYTAG)
);

View file

@ -78,7 +78,7 @@ class Settings extends \Zotlabs\Web\Controller {
$r = q("UPDATE clients SET
client_id='%s',
pw='%s',
name='%s',
clname='%s',
redirect_uri='%s',
icon='%s',
uid=%d
@ -91,7 +91,7 @@ class Settings extends \Zotlabs\Web\Controller {
intval(local_channel()),
dbesc($key));
} else {
$r = q("INSERT INTO clients (client_id, pw, name, redirect_uri, icon, uid)
$r = q("INSERT INTO clients (client_id, pw, clname, redirect_uri, icon, uid)
VALUES ('%s','%s','%s','%s','%s',%d)",
dbesc($key),
dbesc($secret),
@ -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');
@ -615,7 +615,7 @@ class Settings extends \Zotlabs\Web\Controller {
'$title' => t('Add application'),
'$submit' => t('Update'),
'$cancel' => t('Cancel'),
'$name' => array('name', t('Name'), $app['name'] , ''),
'$name' => array('name', t('Name'), $app['clname'] , ''),
'$key' => array('key', t('Consumer Key'), $app['client_id'], ''),
'$secret' => array('secret', t('Consumer Secret'), $app['pw'], ''),
'$redirect' => array('redirect', t('Redirect'), $app['redirect_uri'], ''),

View file

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

View file

@ -18,10 +18,10 @@ class SessionHandler implements \SessionHandlerInterface {
function read ($id) {
if($id) {
$r = q("SELECT `data` FROM `session` WHERE `sid`= '%s'", dbesc($id));
$r = q("SELECT `sess_data` FROM `session` WHERE `sid`= '%s'", dbesc($id));
if($r) {
return $r[0]['data'];
return $r[0]['sess_data'];
}
else {
q("INSERT INTO `session` (sid, expire) values ('%s', '%s')",
@ -59,7 +59,7 @@ class SessionHandler implements \SessionHandlerInterface {
}
q("UPDATE `session`
SET `data` = '%s', `expire` = '%s' WHERE `sid` = '%s'",
SET `sess_data` = '%s', `expire` = '%s' WHERE `sid` = '%s'",
dbesc($data),
dbesc($expire),
dbesc($id)

View file

@ -6,7 +6,7 @@ namespace Zotlabs\Zot;
class Verify {
function create($type,$channel_id,$token,$meta) {
return q("insert into verify ( type, channel, token, meta, created ) values ( '%s', %d, '%s', '%s', '%s' )",
return q("insert into verify ( vtype, channel, token, meta, created ) values ( '%s', %d, '%s', '%s', '%s' )",
dbesc($type),
intval($channel_id),
dbesc($token),
@ -16,7 +16,7 @@ class Verify {
}
function match($type,$channel_id,$token,$meta) {
$r = q("select id from verify where type = '%s' and channel = %d and token = '%s' and meta = '%s' limit 1",
$r = q("select id from verify where vtype = '%s' and channel = %d and token = '%s' and meta = '%s' limit 1",
dbesc($type),
intval($channel_id),
dbesc($token),
@ -32,7 +32,7 @@ class Verify {
}
function purge($type,$interval) {
q("delete from verify where type = '%s' and created < %s - INTERVAL %s",
q("delete from verify where vtype = '%s' and created < %s - INTERVAL %s",
dbesc($type),
db_utcnow(),
db_quoteinterval($interval)

View file

@ -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', 1170 );
define ( 'DB_UPDATE_VERSION', 1173 );
/**

View file

@ -229,7 +229,7 @@ function verify_email_address($arr) {
$hash = random_string();
$r = q("INSERT INTO register ( hash, created, uid, password, language ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ",
$r = q("INSERT INTO register ( hash, created, uid, password, lang ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ",
dbesc($hash),
dbesc(datetime_convert()),
intval($arr['account']['account_id']),
@ -283,7 +283,7 @@ function send_reg_approval_email($arr) {
$hash = random_string();
$r = q("INSERT INTO register ( hash, created, uid, password, language ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ",
$r = q("INSERT INTO register ( hash, created, uid, password, lang ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ",
dbesc($hash),
dbesc(datetime_convert()),
intval($arr['account']['account_id']),
@ -387,7 +387,7 @@ function account_allow($hash) {
intval($register[0]['uid'])
);
push_lang($register[0]['language']);
push_lang($register[0]['lang']);
$email_tpl = get_intltext_template("register_open_eml.tpl");
$email_tpl = replace_macros($email_tpl, array(

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";
$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";
}

View file

@ -368,7 +368,7 @@ require_once('include/api_auth.php');
else
$redirect = trim($_REQUEST['redirect_uris']);
$icon = trim($_REQUEST['logo_uri']);
$r = q("INSERT INTO clients (client_id, pw, name, redirect_uri, icon, uid)
$r = q("INSERT INTO clients (client_id, pw, clname, redirect_uri, icon, uid)
VALUES ('%s','%s','%s','%s','%s',%d)",
dbesc($key),
dbesc($secret),

View file

@ -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)

View file

@ -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

View file

@ -12,7 +12,7 @@ class DBA {
static public $dba = null;
static public $dbtype = null;
static public $logging = false;
/**
* @brief Returns the database driver object.
@ -421,8 +421,13 @@ function db_getfunc($f) {
function db_logger($s,$level = LOGGER_NORMAL,$syslog = LOG_INFO) {
if(\DBA::$logging)
return;
$saved = \DBA::$dba->debug;
\DBA::$dba->debug = false;
\DBA::$logging = true;
logger($s,$level,$syslog);
\DBA::$logging = false;
\DBA::$dba->debug = $saved;
}

View file

@ -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'])
);

View file

@ -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,
);

View file

@ -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)
);

View file

@ -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']));
}
}
}

View file

@ -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) {

View file

@ -37,7 +37,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore {
logger(__function__.":".$consumer.", ". $token_type.", ".$token, LOGGER_DEBUG);
$r = q("SELECT id, secret, scope, expires, uid FROM tokens WHERE client_id = '%s' AND scope = '%s' AND id = '%s'",
$r = q("SELECT id, secret, auth_scope, expires, uid FROM tokens WHERE client_id = '%s' AND auth_scope = '%s' AND id = '%s'",
dbesc($consumer->key),
dbesc($token_type),
dbesc($token)
@ -45,7 +45,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore {
if (count($r)){
$ot=new OAuth1Token($r[0]['id'],$r[0]['secret']);
$ot->scope=$r[0]['scope'];
$ot->scope=$r[0]['auth_scope'];
$ot->expires = $r[0]['expires'];
$ot->uid = $r[0]['uid'];
return $ot;
@ -79,7 +79,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore {
$k = $consumer;
}
$r = q("INSERT INTO tokens (id, secret, client_id, scope, expires) VALUES ('%s','%s','%s','%s', %d)",
$r = q("INSERT INTO tokens (id, secret, client_id, auth_scope, expires) VALUES ('%s','%s','%s','%s', %d)",
dbesc($key),
dbesc($sec),
dbesc($k),
@ -110,7 +110,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore {
$key = $this->gen_token();
$sec = $this->gen_token();
$r = q("INSERT INTO tokens (id, secret, client_id, scope, expires, uid) VALUES ('%s','%s','%s','%s', %d, %d)",
$r = q("INSERT INTO tokens (id, secret, client_id, auth_scope, expires, uid) VALUES ('%s','%s','%s','%s', %d, %d)",
dbesc($key),
dbesc($sec),
dbesc($consumer->key),
@ -249,7 +249,7 @@ class FKOAuth2 extends OAuth2 {
protected function getAuthCode($code) {
$r = q("SELECT id, client_id, redirect_uri, expires, scope FROM auth_codes WHERE id = '%s'",
$r = q("SELECT id, client_id, redirect_uri, expires, auth_scope FROM auth_codes WHERE id = '%s'",
dbesc($code));
if (count($r))
@ -259,7 +259,7 @@ class FKOAuth2 extends OAuth2 {
protected function setAuthCode($code, $client_id, $redirect_uri, $expires, $scope = NULL) {
$r = q("INSERT INTO auth_codes
(id, client_id, redirect_uri, expires, scope) VALUES
(id, client_id, redirect_uri, expires, auth_scope) VALUES
('%s', '%s', '%s', %d, '%s')",
dbesc($code),
dbesc($client_id),

View file

@ -300,12 +300,18 @@ function call_hooks($name, &$data = null) {
$func($data);
else
$func($a, $data);
} else {
q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'",
dbesc($name),
dbesc($hook[0]),
dbesc($origfn)
);
}
else {
// Don't do any DB write calls if we're currently logging a possibly failed DB call.
if(! DBA::$logging) {
// The hook should be removed so we don't process it.
q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'",
dbesc($name),
dbesc($hook[0]),
dbesc($origfn)
);
}
}
}
}

View file

@ -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",

View file

@ -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";
}

View file

@ -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)
);

View file

@ -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)

View file

@ -188,7 +188,7 @@ CREATE TABLE IF NOT EXISTS `auth_codes` (
`client_id` varchar(20) NOT NULL DEFAULT '',
`redirect_uri` varchar(200) NOT NULL DEFAULT '',
`expires` int(11) NOT NULL DEFAULT '0',
`scope` varchar(250) NOT NULL DEFAULT '',
`auth_scope` varchar(512) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@ -342,7 +342,7 @@ CREATE TABLE IF NOT EXISTS `clients` (
`client_id` varchar(20) NOT NULL DEFAULT '',
`pw` varchar(20) NOT NULL DEFAULT '',
`redirect_uri` varchar(200) NOT NULL DEFAULT '',
`name` text,
`clname` text,
`icon` text,
`uid` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`client_id`)
@ -434,74 +434,19 @@ CREATE TABLE IF NOT EXISTS `event` (
KEY `event_priority` (`event_priority`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `fcontact` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`url` char(255) NOT NULL,
`name` char(255) NOT NULL,
`photo` char(255) NOT NULL,
`request` char(255) NOT NULL,
`nick` char(255) NOT NULL,
`addr` char(255) NOT NULL,
`batch` char(255) NOT NULL,
`notify` char(255) NOT NULL,
`poll` char(255) NOT NULL,
`confirm` char(255) NOT NULL,
`priority` tinyint(1) NOT NULL,
`network` char(32) NOT NULL,
`alias` char(255) NOT NULL,
`pubkey` text NOT NULL,
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `addr` (`addr`),
KEY `network` (`network`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ffinder` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(10) unsigned NOT NULL,
`cid` int(10) unsigned NOT NULL,
`fid` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
KEY `cid` (`cid`),
KEY `fid` (`fid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `fserver` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`server` char(255) NOT NULL DEFAULT '',
`posturl` char(255) NOT NULL DEFAULT '',
`key` text NOT NULL,
PRIMARY KEY (`id`),
KEY `server` (`server`),
KEY `posturl` (`posturl`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `fsuggest` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL DEFAULT '0',
`cid` int(11) NOT NULL DEFAULT '0',
`name` char(255) NOT NULL DEFAULT '',
`url` char(255) NOT NULL DEFAULT '',
`request` char(255) NOT NULL DEFAULT '',
`photo` char(255) NOT NULL DEFAULT '',
`note` text NOT NULL,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `groups` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`hash` char(255) NOT NULL DEFAULT '',
`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` (
@ -1035,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',
@ -1048,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 '',
@ -1064,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,
@ -1110,7 +1055,7 @@ CREATE TABLE IF NOT EXISTS `register` (
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`uid` int(10) unsigned NOT NULL DEFAULT '0',
`password` char(255) NOT NULL DEFAULT '',
`language` char(16) NOT NULL DEFAULT '',
`lang` char(16) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `hash` (`hash`),
KEY `created` (`created`),
@ -1120,7 +1065,7 @@ CREATE TABLE IF NOT EXISTS `register` (
CREATE TABLE IF NOT EXISTS `session` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`sid` char(255) NOT NULL DEFAULT '',
`data` text NOT NULL,
`sess_data` text NOT NULL,
`expire` bigint(20) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `sid` (`sid`),
@ -1194,20 +1139,6 @@ CREATE TABLE IF NOT EXISTS `source` (
KEY `src_xchan` (`src_xchan`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `spam` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL DEFAULT '0',
`spam` int(11) NOT NULL DEFAULT '0',
`ham` int(11) NOT NULL DEFAULT '0',
`term` char(255) NOT NULL DEFAULT '',
`date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
KEY `spam` (`spam`),
KEY `ham` (`ham`),
KEY `term` (`term`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `sys_perms` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`cat` char(255) NOT NULL DEFAULT '',
@ -1223,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 '',
@ -1232,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`),
@ -1246,7 +1177,7 @@ CREATE TABLE IF NOT EXISTS `tokens` (
`secret` text NOT NULL,
`client_id` varchar(20) NOT NULL DEFAULT '',
`expires` bigint(20) unsigned NOT NULL DEFAULT '0',
`scope` varchar(200) NOT NULL DEFAULT '',
`auth_scope` varchar(512) NOT NULL DEFAULT '',
`uid` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `client_id` (`client_id`),
@ -1274,13 +1205,13 @@ CREATE TABLE IF NOT EXISTS `updates` (
CREATE TABLE IF NOT EXISTS `verify` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`channel` int(10) unsigned NOT NULL DEFAULT '0',
`type` char(32) NOT NULL DEFAULT '',
`vtype` char(32) NOT NULL DEFAULT '',
`token` char(255) NOT NULL DEFAULT '',
`meta` char(255) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `channel` (`channel`),
KEY `type` (`type`),
KEY `vtype` (`vtype`),
KEY `token` (`token`),
KEY `meta` (`meta`),
KEY `created` (`created`)

View file

@ -184,7 +184,7 @@ CREATE TABLE "auth_codes" (
"client_id" varchar(20) NOT NULL,
"redirect_uri" varchar(200) NOT NULL,
"expires" bigint NOT NULL,
"scope" varchar(250) NOT NULL,
"auth_scope" varchar(512) NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "cache" (
@ -333,7 +333,7 @@ CREATE TABLE "clients" (
"client_id" varchar(20) NOT NULL,
"pw" varchar(20) NOT NULL,
"redirect_uri" varchar(200) NOT NULL,
"name" text,
"clname" text,
"icon" text,
"uid" bigint NOT NULL DEFAULT '0',
PRIMARY KEY ("client_id")
@ -428,62 +428,6 @@ create index "event_status_idx" on event ("event_status");
create index "event_sequence_idx" on event ("event_sequence");
create index "event_priority_idx" on event ("event_priority");
CREATE TABLE "fcontact" (
"id" serial NOT NULL,
"url" text NOT NULL,
"name" text NOT NULL,
"photo" text NOT NULL,
"request" text NOT NULL,
"nick" text NOT NULL,
"addr" text NOT NULL,
"batch" text NOT NULL,
"notify" text NOT NULL,
"poll" text NOT NULL,
"confirm" text NOT NULL,
"priority" numeric(1) NOT NULL,
"network" varchar(32) NOT NULL DEFAULT '',
"alias" text NOT NULL,
"pubkey" text NOT NULL,
"updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY ("id")
);
create index "fcontact_addr_idx" on fcontact ("addr");
create index "fcontact_network_idx" on fcontact ("network");
CREATE TABLE "ffinder" (
"id" serial NOT NULL,
"uid" bigint NOT NULL,
"cid" bigint NOT NULL,
"fid" bigint NOT NULL,
PRIMARY KEY ("id")
);
create index "ffinder_uid_idx" on ffinder ("uid");
create index "ffinder_cid_idx" on ffinder ("cid");
create index "ffinder_fid_idx" on ffinder ("fid");
CREATE TABLE "fserver" (
"id" serial NOT NULL,
"server" text NOT NULL,
"posturl" text NOT NULL,
"key" text NOT NULL,
PRIMARY KEY ("id")
);
create index "fserver_server_idx" on fserver ("server");
create index "fserver_posturl_idx" on fserver ("posturl");
CREATE TABLE "fsuggest" (
"id" serial NOT NULL,
"uid" bigint NOT NULL,
"cid" bigint NOT NULL,
"name" text NOT NULL,
"url" text NOT NULL,
"request" text NOT NULL,
"photo" text NOT NULL,
"note" text NOT NULL,
"created" timestamp NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "group_member" (
"id" serial NOT NULL,
"uid" bigint NOT NULL,
@ -501,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")
);
@ -1024,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 '',
@ -1037,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 '',
@ -1053,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 '',
@ -1099,7 +1043,7 @@ CREATE TABLE "register" (
"created" timestamp NOT NULL,
"uid" bigint NOT NULL,
"password" text NOT NULL,
"language" varchar(16) NOT NULL,
"lang" varchar(16) NOT NULL,
PRIMARY KEY ("id")
);
create index "reg_hash" on register ("hash");
@ -1108,7 +1052,7 @@ create index "reg_uid" on register ("uid");
CREATE TABLE "session" (
"id" serial,
"sid" text NOT NULL,
"data" text NOT NULL,
"sess_data" text NOT NULL,
"expire" numeric(20) NOT NULL,
PRIMARY KEY ("id")
);
@ -1179,19 +1123,6 @@ CREATE TABLE "source" (
create index "src_channel_id" on "source" ("src_channel_id");
create index "src_channel_xchan" on "source" ("src_channel_xchan");
create index "src_xchan" on "source" ("src_xchan");
CREATE TABLE "spam" (
"id" serial NOT NULL,
"uid" bigint NOT NULL,
"spam" bigint NOT NULL DEFAULT '0',
"ham" bigint NOT NULL DEFAULT '0',
"term" text NOT NULL,
"date" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY ("id")
);
create index "spam_uid" on spam ("uid");
create index "spam_spam" on spam ("spam");
create index "spam_ham" on spam ("ham");
create index "spam_term" on spam ("term");
CREATE TABLE "sys_perms" (
"id" serial NOT NULL,
"cat" text NOT NULL,
@ -1206,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 '',
@ -1216,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");
@ -1228,7 +1159,7 @@ CREATE TABLE "tokens" (
"secret" text NOT NULL,
"client_id" varchar(20) NOT NULL,
"expires" numeric(20) NOT NULL,
"scope" varchar(200) NOT NULL,
"auth_scope" varchar(512) NOT NULL,
"uid" bigint NOT NULL,
PRIMARY KEY ("id")
);
@ -1255,14 +1186,14 @@ create index "ud_last" on updates ("ud_last");
CREATE TABLE "verify" (
"id" serial NOT NULL,
"channel" bigint NOT NULL DEFAULT '0',
"type" varchar(32) NOT NULL DEFAULT '',
"vtype" varchar(32) NOT NULL DEFAULT '',
"token" text NOT NULL DEFAULT '',
"meta" text NOT NULL DEFAULT '',
"created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY ("id")
);
create index "verify_channel" on verify ("channel");
create index "verify_type" on verify ("type");
create index "verify_vtype" on verify ("vtype");
create index "verify_token" on verify ("token");
create index "verify_meta" on verify ("meta");
create index "verify_created" on verify ("created");

View file

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1170 );
define( 'UPDATE_VERSION' , 1173 );
/**
*
@ -2131,4 +2131,58 @@ function update_r1169() {
if($r1 && $r2 && $r3)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
}
function update_r1170() {
$r1 = q("drop table fcontact");
$r2 = q("drop table ffinder");
$r3 = q("drop table fserver");
$r4 = q("drop table fsuggest");
$r5 = q("drop table spam");
if($r1 && $r2 && $r3 && $r4 && $r5)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1171() {
$r1 = q("ALTER TABLE verify CHANGE `type` `vtype` varchar(32) NOT NULL DEFAULT '' ");
$r2 = q("ALTER TABLE tokens CHANGE `scope` `auth_scope` varchar(512) NOT NULL DEFAULT '' ");
$r3 = q("ALTER TABLE auth_codes CHANGE `scope` `auth_scope` varchar(512) NOT NULL DEFAULT '' ");
$r4 = q("ALTER TABLE clients CHANGE `name` `clname` TEXT ");
$r5 = q("ALTER TABLE session CHANGE `data` `sess_data` TEXT NOT NULL ");
$r6 = q("ALTER TABLE register CHANGE `language` `lang` varchar(16) NOT NULL DEFAULT '' ");
if($r1 && $r2 && $r3 && $r4 && $r5 && $r6)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
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">
{{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>&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>
{{/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}}

View file

@ -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}}

View file

@ -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}}

View file

@ -18,7 +18,7 @@
{{foreach $apps as $app}}
<div class='oauthapp'>
<img src='{{$app.icon}}' class="{{if $app.icon}} {{else}}noicon{{/if}}">
{{if $app.name}}<h4>{{$app.name}}</h4>{{else}}<h4>{{$noname}}</h4>{{/if}}
{{if $app.clname}}<h4>{{$app.clname}}</h4>{{else}}<h4>{{$noname}}</h4>{{/if}}
{{if $app.my}}
{{if $app.oauth_token}}
<div class="settings-submit-wrapper" ><button class="settings-submit" type="submit" name="remove" value="{{$app.oauth_token}}">{{$remove}}</button></div>