more DB cleanup
This commit is contained in:
@@ -111,7 +111,7 @@ function abook_post(&$a) {
|
||||
|
||||
$info = fix_mce_lf(escape_tags(trim($_POST['info'])));
|
||||
|
||||
$r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s',
|
||||
$r = q("UPDATE `contact` SET `profile_id` = %d, `priority` = %d , `info` = '%s',
|
||||
`hidden` = %d, closeness = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($profile_id),
|
||||
intval($priority),
|
||||
@@ -314,7 +314,7 @@ function abook_content(&$a) {
|
||||
'$updpub' => t('Update public posts'),
|
||||
'$last_update' => $last_update,
|
||||
'$udnow' => t('Update now'),
|
||||
'$profile_select' => contact_profile_assign($contact['profile-id'],(($contact['network'] !== NETWORK_DFRN) ? true : false)),
|
||||
'$profile_select' => contact_profile_assign($contact['profile_id'],(($contact['network'] !== NETWORK_DFRN) ? true : false)),
|
||||
'$contact_id' => $contact['id'],
|
||||
'$block_text' => (($contact['blocked']) ? t('Unblock') : t('Block') ),
|
||||
'$ignore_text' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ),
|
||||
|
||||
@@ -111,7 +111,7 @@ function contacts_post(&$a) {
|
||||
|
||||
$info = fix_mce_lf(escape_tags(trim($_POST['info'])));
|
||||
|
||||
$r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s',
|
||||
$r = q("UPDATE `contact` SET `profile_id` = %d, `priority` = %d , `info` = '%s',
|
||||
`hidden` = %d, closeness = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($profile_id),
|
||||
intval($priority),
|
||||
@@ -288,12 +288,12 @@ function contacts_content(&$a) {
|
||||
|
||||
$insecure = t('Private communications are not available for this contact.');
|
||||
|
||||
$last_update = (($contact['last-update'] == '0000-00-00 00:00:00')
|
||||
$last_update = (($contact['last_update'] == '0000-00-00 00:00:00')
|
||||
? t('Never')
|
||||
: datetime_convert('UTC',date_default_timezone_get(),$contact['last-update'],'D, j M Y, g:i A'));
|
||||
: datetime_convert('UTC',date_default_timezone_get(),$contact['last_update'],'D, j M Y, g:i A'));
|
||||
|
||||
if($contact['last-update'] !== '0000-00-00 00:00:00')
|
||||
$last_update .= ' ' . (($contact['last-update'] == $contact['success_update']) ? t("\x28Update was successful\x29") : t("\x28Update was not successful\x29"));
|
||||
if($contact['last_update'] !== '0000-00-00 00:00:00')
|
||||
$last_update .= ' ' . (($contact['last_update'] == $contact['success_update']) ? t("\x28Update was successful\x29") : t("\x28Update was not successful\x29"));
|
||||
|
||||
$lblsuggest = (($contact['network'] === NETWORK_DFRN) ? t('Suggest friends') : '');
|
||||
|
||||
@@ -340,7 +340,7 @@ function contacts_content(&$a) {
|
||||
$tab_tpl = get_markup_template('common_tabs.tpl');
|
||||
$tab_str = replace_macros($tab_tpl, array('$tabs' => $tabs));
|
||||
|
||||
$lost_contact = (($contact['archive'] && $contact['term-date'] != '0000-00-00 00:00:00' && $contact['term-date'] < datetime_convert('','','now')) ? t('Communications lost with this contact!') : '');
|
||||
$lost_contact = (($contact['archive'] && $contact['term_date'] != '0000-00-00 00:00:00' && $contact['term_date'] < datetime_convert('','','now')) ? t('Communications lost with this contact!') : '');
|
||||
|
||||
$slider_tpl = get_markup_template('contact_slider.tpl');
|
||||
$o .= replace_macros($slider_tpl,array(
|
||||
@@ -382,7 +382,7 @@ function contacts_content(&$a) {
|
||||
'$updpub' => t('Update public posts'),
|
||||
'$last_update' => $last_update,
|
||||
'$udnow' => t('Update now'),
|
||||
'$profile_select' => contact_profile_assign($contact['profile-id'],(($contact['network'] !== NETWORK_DFRN) ? true : false)),
|
||||
'$profile_select' => contact_profile_assign($contact['profile_id'],(($contact['network'] !== NETWORK_DFRN) ? true : false)),
|
||||
'$contact_id' => $contact['id'],
|
||||
'$block_text' => (($contact['blocked']) ? t('Unblock') : t('Block') ),
|
||||
'$ignore_text' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ),
|
||||
|
||||
@@ -83,9 +83,9 @@ function crepair_post(&$a) {
|
||||
$x = q("UPDATE `contact` SET `photo` = '%s',
|
||||
`thumb` = '%s',
|
||||
`micro` = '%s',
|
||||
`name-date` = '%s',
|
||||
`uri-date` = '%s',
|
||||
`avatar-date` = '%s'
|
||||
`name_date` = '%s',
|
||||
`uri_date` = '%s',
|
||||
`avatar_date` = '%s'
|
||||
WHERE `id` = %d LIMIT 1
|
||||
",
|
||||
dbesc($photos[0]),
|
||||
|
||||
@@ -107,7 +107,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||
*
|
||||
*/
|
||||
|
||||
$r = q("SELECT * FROM `contact` WHERE ( ( `issued-id` != '' AND `issued-id` = '%s' ) OR ( `id` = %d AND `id` != 0 ) ) AND `uid` = %d AND `duplex` = 0 LIMIT 1",
|
||||
$r = q("SELECT * FROM `contact` WHERE ( ( `issued_id` != '' AND `issued_id` = '%s' ) OR ( `id` = %d AND `id` != 0 ) ) AND `uid` = %d AND `duplex` = 0 LIMIT 1",
|
||||
dbesc($dfrn_id),
|
||||
intval($cid),
|
||||
intval($uid)
|
||||
@@ -124,11 +124,11 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||
|
||||
$contact_id = $contact['id'];
|
||||
$relation = $contact['rel'];
|
||||
$site_pubkey = $contact['site-pubkey'];
|
||||
$site_pubkey = $contact['site_pubkey'];
|
||||
$dfrn_confirm = $contact['confirm'];
|
||||
$aes_allow = $contact['aes_allow'];
|
||||
|
||||
$network = ((strlen($contact['issued-id'])) ? NETWORK_DFRN : NETWORK_OSTATUS);
|
||||
$network = ((strlen($contact['issued_id'])) ? NETWORK_DFRN : NETWORK_OSTATUS);
|
||||
|
||||
if($contact['network'])
|
||||
$network = $contact['network'];
|
||||
@@ -256,9 +256,9 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||
notice( t('Remote site reported: ') . $message . EOL);
|
||||
break;
|
||||
case 1:
|
||||
// birthday paradox - generate new dfrn-id and fall through.
|
||||
// birthday paradox - generate new dfrn_id and fall through.
|
||||
$new_dfrn_id = random_string();
|
||||
$r = q("UPDATE contact SET `issued-id` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
$r = q("UPDATE contact SET `issued_id` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
dbesc($new_dfrn_id),
|
||||
intval($contact_id),
|
||||
intval($uid)
|
||||
@@ -324,9 +324,9 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||
`thumb` = '%s',
|
||||
`micro` = '%s',
|
||||
`rel` = %d,
|
||||
`name-date` = '%s',
|
||||
`uri-date` = '%s',
|
||||
`avatar-date` = '%s',
|
||||
`name_date` = '%s',
|
||||
`uri_date` = '%s',
|
||||
`avatar_date` = '%s',
|
||||
`blocked` = 0,
|
||||
`pending` = 0,
|
||||
`duplex` = %d,
|
||||
@@ -377,9 +377,9 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||
$r = q("UPDATE `contact` SET `photo` = '%s',
|
||||
`thumb` = '%s',
|
||||
`micro` = '%s',
|
||||
`name-date` = '%s',
|
||||
`uri-date` = '%s',
|
||||
`avatar-date` = '%s',
|
||||
`name_date` = '%s',
|
||||
`uri_date` = '%s',
|
||||
`avatar_date` = '%s',
|
||||
`notify` = '%s',
|
||||
`poll` = '%s',
|
||||
`blocked` = 0,
|
||||
@@ -594,7 +594,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||
|
||||
// Decrypt all this stuff we just received
|
||||
|
||||
$foreign_pubkey = $ret[0]['site-pubkey'];
|
||||
$foreign_pubkey = $ret[0]['site_pubkey'];
|
||||
$dfrn_record = $ret[0]['id'];
|
||||
|
||||
if(! $foreign_pubkey) {
|
||||
@@ -614,16 +614,16 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||
$dfrn_pubkey = $public_key;
|
||||
}
|
||||
|
||||
$r = q("SELECT * FROM `contact` WHERE `dfrn-id` = '%s' LIMIT 1",
|
||||
$r = q("SELECT * FROM `contact` WHERE `dfrn_id` = '%s' LIMIT 1",
|
||||
dbesc($decrypted_dfrn_id)
|
||||
);
|
||||
if(count($r)) {
|
||||
$message = t('The ID provided by your system is a duplicate on our system. It should work if you try again.');
|
||||
xml_status(1,$message); // Birthday paradox - duplicate dfrn-id
|
||||
xml_status(1,$message); // Birthday paradox - duplicate dfrn_id
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$r = q("UPDATE `contact` SET `dfrn-id` = '%s', `pubkey` = '%s' WHERE `id` = %d LIMIT 1",
|
||||
$r = q("UPDATE `contact` SET `dfrn_id` = '%s', `pubkey` = '%s' WHERE `id` = %d LIMIT 1",
|
||||
dbesc($decrypted_dfrn_id),
|
||||
dbesc($dfrn_pubkey),
|
||||
intval($dfrn_record)
|
||||
@@ -634,10 +634,10 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||
}
|
||||
|
||||
// It's possible that the other person also requested friendship.
|
||||
// If it is a duplex relationship, ditch the issued-id if one exists.
|
||||
// If it is a duplex relationship, ditch the issued_id if one exists.
|
||||
|
||||
if($duplex) {
|
||||
$r = q("UPDATE `contact` SET `issued-id` = '' WHERE `id` = %d LIMIT 1",
|
||||
$r = q("UPDATE `contact` SET `issued_id` = '' WHERE `id` = %d LIMIT 1",
|
||||
intval($dfrn_record)
|
||||
);
|
||||
}
|
||||
@@ -672,9 +672,9 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||
`thumb` = '%s',
|
||||
`micro` = '%s',
|
||||
`rel` = %d,
|
||||
`name-date` = '%s',
|
||||
`uri-date` = '%s',
|
||||
`avatar-date` = '%s',
|
||||
`name_date` = '%s',
|
||||
`uri_date` = '%s',
|
||||
`avatar_date` = '%s',
|
||||
`blocked` = 0,
|
||||
`pending` = 0,
|
||||
`duplex` = %d,
|
||||
|
||||
@@ -31,7 +31,7 @@ function dfrn_notify_post(&$a) {
|
||||
$dfrn_id = substr($dfrn_id,2);
|
||||
}
|
||||
|
||||
$r = q("SELECT * FROM `challenge` WHERE `dfrn-id` = '%s' AND `challenge` = '%s' LIMIT 1",
|
||||
$r = q("SELECT * FROM `challenge` WHERE `dfrn_id` = '%s' AND `challenge` = '%s' LIMIT 1",
|
||||
dbesc($dfrn_id),
|
||||
dbesc($challenge)
|
||||
);
|
||||
@@ -40,7 +40,7 @@ function dfrn_notify_post(&$a) {
|
||||
xml_status(3);
|
||||
}
|
||||
|
||||
$r = q("DELETE FROM `challenge` WHERE `dfrn-id` = '%s' AND `challenge` = '%s' LIMIT 1",
|
||||
$r = q("DELETE FROM `challenge` WHERE `dfrn_id` = '%s' AND `challenge` = '%s' LIMIT 1",
|
||||
dbesc($dfrn_id),
|
||||
dbesc($challenge)
|
||||
);
|
||||
@@ -50,13 +50,13 @@ function dfrn_notify_post(&$a) {
|
||||
$sql_extra = '';
|
||||
switch($direction) {
|
||||
case (-1):
|
||||
$sql_extra = sprintf(" AND ( `issued-id` = '%s' OR `dfrn-id` = '%s' ) ", dbesc($dfrn_id), dbesc($dfrn_id));
|
||||
$sql_extra = sprintf(" AND ( `issued_id` = '%s' OR `dfrn_id` = '%s' ) ", dbesc($dfrn_id), dbesc($dfrn_id));
|
||||
break;
|
||||
case 0:
|
||||
$sql_extra = sprintf(" AND `issued-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
$sql_extra = sprintf(" AND `issued_id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
break;
|
||||
case 1:
|
||||
$sql_extra = sprintf(" AND `dfrn-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
$sql_extra = sprintf(" AND `dfrn_id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
break;
|
||||
default:
|
||||
xml_status(3);
|
||||
@@ -190,7 +190,7 @@ function dfrn_notify_content(&$a) {
|
||||
|
||||
$r = q("DELETE FROM `challenge` WHERE `expire` < " . intval(time()));
|
||||
|
||||
$r = q("INSERT INTO `challenge` ( `challenge`, `dfrn-id`, `expire` )
|
||||
$r = q("INSERT INTO `challenge` ( `challenge`, `dfrn_id`, `expire` )
|
||||
VALUES( '%s', '%s', %d ) ",
|
||||
dbesc($hash),
|
||||
dbesc($dfrn_id),
|
||||
@@ -202,15 +202,15 @@ function dfrn_notify_content(&$a) {
|
||||
$sql_extra = '';
|
||||
switch($direction) {
|
||||
case (-1):
|
||||
$sql_extra = sprintf(" AND ( `issued-id` = '%s' OR `dfrn-id` = '%s' ) ", dbesc($dfrn_id), dbesc($dfrn_id));
|
||||
$sql_extra = sprintf(" AND ( `issued_id` = '%s' OR `dfrn_id` = '%s' ) ", dbesc($dfrn_id), dbesc($dfrn_id));
|
||||
$my_id = $dfrn_id;
|
||||
break;
|
||||
case 0:
|
||||
$sql_extra = sprintf(" AND `issued-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
$sql_extra = sprintf(" AND `issued_id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
$my_id = '1:' . $dfrn_id;
|
||||
break;
|
||||
case 1:
|
||||
$sql_extra = sprintf(" AND `dfrn-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
$sql_extra = sprintf(" AND `dfrn_id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
$my_id = '0:' . $dfrn_id;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -52,15 +52,15 @@ function dfrn_poll_init(&$a) {
|
||||
$sql_extra = '';
|
||||
switch($direction) {
|
||||
case (-1):
|
||||
$sql_extra = sprintf(" AND ( `dfrn-id` = '%s' OR `issued-id` = '%s' ) ", dbesc($dfrn_id),dbesc($dfrn_id));
|
||||
$sql_extra = sprintf(" AND ( `dfrn_id` = '%s' OR `issued_id` = '%s' ) ", dbesc($dfrn_id),dbesc($dfrn_id));
|
||||
$my_id = $dfrn_id;
|
||||
break;
|
||||
case 0:
|
||||
$sql_extra = sprintf(" AND `issued-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
$sql_extra = sprintf(" AND `issued_id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
$my_id = '1:' . $dfrn_id;
|
||||
break;
|
||||
case 1:
|
||||
$sql_extra = sprintf(" AND `dfrn-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
$sql_extra = sprintf(" AND `dfrn_id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
$my_id = '0:' . $dfrn_id;
|
||||
break;
|
||||
default:
|
||||
@@ -269,7 +269,7 @@ function dfrn_poll_post(&$a) {
|
||||
}
|
||||
|
||||
|
||||
$r = q("SELECT * FROM `challenge` WHERE `dfrn-id` = '%s' AND `challenge` = '%s' LIMIT 1",
|
||||
$r = q("SELECT * FROM `challenge` WHERE `dfrn_id` = '%s' AND `challenge` = '%s' LIMIT 1",
|
||||
dbesc($dfrn_id),
|
||||
dbesc($challenge)
|
||||
);
|
||||
@@ -280,7 +280,7 @@ function dfrn_poll_post(&$a) {
|
||||
$type = $r[0]['type'];
|
||||
$last_update = $r[0]['last_update'];
|
||||
|
||||
$r = q("DELETE FROM `challenge` WHERE `dfrn-id` = '%s' AND `challenge` = '%s' LIMIT 1",
|
||||
$r = q("DELETE FROM `challenge` WHERE `dfrn_id` = '%s' AND `challenge` = '%s' LIMIT 1",
|
||||
dbesc($dfrn_id),
|
||||
dbesc($challenge)
|
||||
);
|
||||
@@ -289,15 +289,15 @@ function dfrn_poll_post(&$a) {
|
||||
$sql_extra = '';
|
||||
switch($direction) {
|
||||
case (-1):
|
||||
$sql_extra = sprintf(" AND `issued-id` = '%s' ", dbesc($dfrn_id));
|
||||
$sql_extra = sprintf(" AND `issued_id` = '%s' ", dbesc($dfrn_id));
|
||||
$my_id = $dfrn_id;
|
||||
break;
|
||||
case 0:
|
||||
$sql_extra = sprintf(" AND `issued-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
$sql_extra = sprintf(" AND `issued_id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
$my_id = '1:' . $dfrn_id;
|
||||
break;
|
||||
case 1:
|
||||
$sql_extra = sprintf(" AND `dfrn-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
$sql_extra = sprintf(" AND `dfrn_id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
$my_id = '0:' . $dfrn_id;
|
||||
break;
|
||||
default:
|
||||
@@ -397,7 +397,7 @@ function dfrn_poll_content(&$a) {
|
||||
$r = q("DELETE FROM `challenge` WHERE `expire` < " . intval(time()));
|
||||
|
||||
if($type !== 'profile') {
|
||||
$r = q("INSERT INTO `challenge` ( `challenge`, `dfrn-id`, `expire` , `type`, `last_update` )
|
||||
$r = q("INSERT INTO `challenge` ( `challenge`, `dfrn_id`, `expire` , `type`, `last_update` )
|
||||
VALUES( '%s', '%s', '%s', '%s', '%s' ) ",
|
||||
dbesc($hash),
|
||||
dbesc($dfrn_id),
|
||||
@@ -410,17 +410,17 @@ function dfrn_poll_content(&$a) {
|
||||
switch($direction) {
|
||||
case (-1):
|
||||
if($type === 'profile')
|
||||
$sql_extra = sprintf(" AND ( `dfrn-id` = '%s' OR `issued-id` = '%s' ) ", dbesc($dfrn_id),dbesc($dfrn_id));
|
||||
$sql_extra = sprintf(" AND ( `dfrn_id` = '%s' OR `issued_id` = '%s' ) ", dbesc($dfrn_id),dbesc($dfrn_id));
|
||||
else
|
||||
$sql_extra = sprintf(" AND `issued-id` = '%s' ", dbesc($dfrn_id));
|
||||
$sql_extra = sprintf(" AND `issued_id` = '%s' ", dbesc($dfrn_id));
|
||||
$my_id = $dfrn_id;
|
||||
break;
|
||||
case 0:
|
||||
$sql_extra = sprintf(" AND `issued-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
$sql_extra = sprintf(" AND `issued_id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
$my_id = '1:' . $dfrn_id;
|
||||
break;
|
||||
case 1:
|
||||
$sql_extra = sprintf(" AND `dfrn-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
$sql_extra = sprintf(" AND `dfrn_id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
|
||||
$my_id = '0:' . $dfrn_id;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -84,7 +84,7 @@ function dfrn_request_post(&$a) {
|
||||
);
|
||||
|
||||
if(count($r)) {
|
||||
if(strlen($r[0]['dfrn-id'])) {
|
||||
if(strlen($r[0]['dfrn_id'])) {
|
||||
|
||||
/**
|
||||
* We don't need to be here. It has already happened.
|
||||
@@ -98,8 +98,7 @@ function dfrn_request_post(&$a) {
|
||||
}
|
||||
|
||||
if(is_array($contact_record)) {
|
||||
$r = q("UPDATE `contact` SET `ret-aes` = %d, hidden = %d WHERE `id` = %d LIMIT 1",
|
||||
intval($aes_allow),
|
||||
$r = q("UPDATE `contact` SET hidden = %d WHERE `id` = %d LIMIT 1",
|
||||
intval($hidden),
|
||||
intval($contact_record['id'])
|
||||
);
|
||||
@@ -144,7 +143,7 @@ function dfrn_request_post(&$a) {
|
||||
* Create a contact record on our site for the other person
|
||||
*/
|
||||
|
||||
$r = q("INSERT INTO `contact` ( `uid`, `created`,`url`, `nurl`, `name`, `nick`, `photo`, `site-pubkey`,
|
||||
$r = q("INSERT INTO `contact` ( `uid`, `created`,`url`, `nurl`, `name`, `nick`, `photo`, `site_pubkey`,
|
||||
`request`, `confirm`, `notify`, `poll`, `poco`, `network`, `aes_allow`, `hidden`)
|
||||
VALUES ( %d, '%s', '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d)",
|
||||
intval(local_user()),
|
||||
@@ -170,7 +169,7 @@ function dfrn_request_post(&$a) {
|
||||
info( t("Introduction complete.") . EOL);
|
||||
}
|
||||
|
||||
$r = q("select id from contact where uid = %d and url = '%s' and `site-pubkey` = '%s' limit 1",
|
||||
$r = q("select id from contact where uid = %d and url = '%s' and `site_pubkey` = '%s' limit 1",
|
||||
intval(local_user()),
|
||||
dbesc($dfrn_url),
|
||||
$parms['key'] // this was already escaped
|
||||
@@ -401,9 +400,9 @@ function dfrn_request_post(&$a) {
|
||||
`photo` = '%s',
|
||||
`thumb` = '%s',
|
||||
`micro` = '%s',
|
||||
`name-date` = '%s',
|
||||
`uri-date` = '%s',
|
||||
`avatar-date` = '%s',
|
||||
`name_date` = '%s',
|
||||
`uri_date` = '%s',
|
||||
`avatar_date` = '%s',
|
||||
`hidden` = 0,
|
||||
WHERE `id` = %d LIMIT 1
|
||||
",
|
||||
@@ -466,7 +465,7 @@ function dfrn_request_post(&$a) {
|
||||
);
|
||||
|
||||
if(count($ret)) {
|
||||
if(strlen($ret[0]['issued-id'])) {
|
||||
if(strlen($ret[0]['issued_id'])) {
|
||||
notice( t('You have already introduced yourself here.') . EOL );
|
||||
return;
|
||||
}
|
||||
@@ -483,9 +482,9 @@ function dfrn_request_post(&$a) {
|
||||
$issued_id = random_string();
|
||||
|
||||
if(is_array($contact_record)) {
|
||||
// There is a contact record but no issued-id, so this
|
||||
// There is a contact record but no issued_id, so this
|
||||
// is a reciprocal introduction from a known contact
|
||||
$r = q("UPDATE `contact` SET `issued-id` = '%s' WHERE `id` = %d LIMIT 1",
|
||||
$r = q("UPDATE `contact` SET `issued_id` = '%s' WHERE `id` = %d LIMIT 1",
|
||||
dbesc($issued_id),
|
||||
intval($contact_record['id'])
|
||||
);
|
||||
@@ -529,11 +528,11 @@ function dfrn_request_post(&$a) {
|
||||
|
||||
|
||||
$parms['url'] = $url;
|
||||
$parms['issued-id'] = $issued_id;
|
||||
$parms['issued_id'] = $issued_id;
|
||||
|
||||
|
||||
dbesc_array($parms);
|
||||
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`,`name`, `nick`, `issued-id`, `photo`, `site-pubkey`,
|
||||
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`,`name`, `nick`, `issued_id`, `photo`, `site_pubkey`,
|
||||
`request`, `confirm`, `notify`, `poll`, `poco`, `network` )
|
||||
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
|
||||
intval($uid),
|
||||
@@ -542,7 +541,7 @@ function dfrn_request_post(&$a) {
|
||||
dbesc(normalise_link($parms['url'])),
|
||||
$parms['fn'],
|
||||
$parms['nick'],
|
||||
$parms['issued-id'],
|
||||
$parms['issued_id'],
|
||||
$parms['photo'],
|
||||
$parms['key'],
|
||||
$parms['dfrn-request'],
|
||||
@@ -556,10 +555,10 @@ function dfrn_request_post(&$a) {
|
||||
// find the contact record we just created
|
||||
if($r) {
|
||||
$r = q("SELECT `id` FROM `contact`
|
||||
WHERE `uid` = %d AND `url` = '%s' AND `issued-id` = '%s' LIMIT 1",
|
||||
WHERE `uid` = %d AND `url` = '%s' AND `issued_id` = '%s' LIMIT 1",
|
||||
intval($uid),
|
||||
$parms['url'],
|
||||
$parms['issued-id']
|
||||
$parms['issued_id']
|
||||
);
|
||||
if(count($r))
|
||||
$contact_record = $r[0];
|
||||
@@ -725,7 +724,7 @@ function dfrn_request_content(&$a) {
|
||||
$handsfree = array(
|
||||
'uid' => $r[0]['uid'],
|
||||
'node' => $r[0]['nickname'],
|
||||
'dfrn_id' => $r[0]['issued-id'],
|
||||
'dfrn_id' => $r[0]['issued_id'],
|
||||
'intro_id' => $intro[0]['id'],
|
||||
'duplex' => (($r[0]['page-flags'] == PAGE_FREELOVE) ? 1 : 0),
|
||||
'activity' => intval(get_pconfig($r[0]['uid'],'system','post_newfriend'))
|
||||
|
||||
@@ -605,7 +605,7 @@ function network_content(&$a, $update = 0, $load = false) {
|
||||
|
||||
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`writable`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn_id`, `contact`.`self`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
FROM `item`, `contact`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1
|
||||
@@ -667,7 +667,7 @@ function network_content(&$a, $update = 0, $load = false) {
|
||||
|
||||
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`, `contact`.`writable`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn_id`, `contact`.`self`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
FROM `item`, `contact`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
||||
|
||||
@@ -191,7 +191,7 @@ function notifications_content(&$a) {
|
||||
'$str_notifytype' => t('Notification type: '),
|
||||
'$notify_type' => (($rr['network'] !== NETWORK_OSTATUS) ? t('Friend/Connect Request') : t('New Follower')),
|
||||
'$dfrn_text' => $dfrn_text,
|
||||
'$dfrn_id' => $rr['issued-id'],
|
||||
'$dfrn_id' => $rr['issued_id'],
|
||||
'$uid' => $_SESSION['uid'],
|
||||
'$intro_id' => $rr['intro_id'],
|
||||
'$contact_id' => $rr['contact-id'],
|
||||
|
||||
@@ -110,7 +110,7 @@ function profile_photo_post(&$a) {
|
||||
// we'll set the updated profile-photo timestamp even if it isn't the default profile,
|
||||
// so that browsers will do a cache update unconditionally
|
||||
|
||||
$r = q("UPDATE `contact` SET `avatar-date` = '%s' WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||
$r = q("UPDATE `contact` SET `avatar_date` = '%s' WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||
dbesc(datetime_convert()),
|
||||
intval(local_user())
|
||||
);
|
||||
@@ -207,7 +207,7 @@ function profile_photo_content(&$a) {
|
||||
dbesc($resource_id)
|
||||
);
|
||||
|
||||
$r = q("UPDATE `contact` SET `avatar-date` = '%s' WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||
$r = q("UPDATE `contact` SET `avatar_date` = '%s' WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||
dbesc(datetime_convert()),
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
@@ -289,7 +289,7 @@ function profiles_post(&$a) {
|
||||
|
||||
|
||||
if($namechanged && $is_default) {
|
||||
$r = q("UPDATE `contact` SET `name-date` = '%s' WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||
$r = q("UPDATE `contact` SET `name_date` = '%s' WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||
dbesc(datetime_convert()),
|
||||
intval(local_user())
|
||||
);
|
||||
@@ -420,7 +420,7 @@ function profiles_content(&$a) {
|
||||
|
||||
// move every contact using this profile as their default to the user default
|
||||
|
||||
$r = q("UPDATE `contact` SET `profile-id` = (SELECT `profile`.`id` AS `profile-id` FROM `profile` WHERE `profile`.`is_default` = 1 AND `profile`.`uid` = %d LIMIT 1) WHERE `profile-id` = %d AND `uid` = %d ",
|
||||
$r = q("UPDATE `contact` SET `profile_id` = (SELECT `profile`.`id` AS `profile_id` FROM `profile` WHERE `profile`.`is_default` = 1 AND `profile`.`uid` = %d LIMIT 1) WHERE `profile_id` = %d AND `uid` = %d ",
|
||||
intval(local_user()),
|
||||
intval($a->argv[2]),
|
||||
intval(local_user())
|
||||
|
||||
@@ -57,7 +57,7 @@ function profperm_content(&$a) {
|
||||
}
|
||||
$profile = $r[0];
|
||||
|
||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `profile-id` = %d",
|
||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `profile_id` = %d",
|
||||
intval(local_user()),
|
||||
intval($a->argv[1])
|
||||
);
|
||||
@@ -71,13 +71,13 @@ function profperm_content(&$a) {
|
||||
|
||||
if($change) {
|
||||
if(in_array($change,$ingroup)) {
|
||||
q("UPDATE `contact` SET `profile-id` = 0 WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
q("UPDATE `contact` SET `profile_id` = 0 WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($change),
|
||||
intval(local_user())
|
||||
);
|
||||
}
|
||||
else {
|
||||
q("UPDATE `contact` SET `profile-id` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
q("UPDATE `contact` SET `profile_id` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($a->argv[1]),
|
||||
intval($change),
|
||||
intval(local_user())
|
||||
@@ -85,7 +85,7 @@ function profperm_content(&$a) {
|
||||
|
||||
}
|
||||
|
||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `profile-id` = %d",
|
||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `profile_id` = %d",
|
||||
intval(local_user()),
|
||||
intval($a->argv[1])
|
||||
);
|
||||
|
||||
@@ -18,14 +18,14 @@ function redir_init(&$a) {
|
||||
if((! count($r)) || ($r[0]['network'] !== NETWORK_DFRN))
|
||||
goaway(z_root());
|
||||
|
||||
$dfrn_id = $orig_id = (($r[0]['issued-id']) ? $r[0]['issued-id'] : $r[0]['dfrn-id']);
|
||||
$dfrn_id = $orig_id = (($r[0]['issued_id']) ? $r[0]['issued_id'] : $r[0]['dfrn_id']);
|
||||
|
||||
if($r[0]['duplex'] && $r[0]['issued-id']) {
|
||||
$orig_id = $r[0]['issued-id'];
|
||||
if($r[0]['duplex'] && $r[0]['issued_id']) {
|
||||
$orig_id = $r[0]['issued_id'];
|
||||
$dfrn_id = '1:' . $orig_id;
|
||||
}
|
||||
if($r[0]['duplex'] && $r[0]['dfrn-id']) {
|
||||
$orig_id = $r[0]['dfrn-id'];
|
||||
if($r[0]['duplex'] && $r[0]['dfrn_id']) {
|
||||
$orig_id = $r[0]['dfrn_id'];
|
||||
$dfrn_id = '0:' . $orig_id;
|
||||
}
|
||||
|
||||
|
||||
@@ -396,7 +396,7 @@ function settings_post(&$a) {
|
||||
|
||||
|
||||
if($name_change) {
|
||||
q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self` = 1 LIMIT 1",
|
||||
q("UPDATE `contact` SET `name` = '%s', `name_date` = '%s' WHERE `uid` = %d AND `self` = 1 LIMIT 1",
|
||||
dbesc($username),
|
||||
dbesc(datetime_convert()),
|
||||
intval(local_user())
|
||||
|
||||
Reference in New Issue
Block a user