diff options
author | friendica <info@friendica.com> | 2012-08-30 18:47:07 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-08-30 18:47:07 -0700 |
commit | 80bd128425b99d91ddca897bc2cd6dcef5268fe4 (patch) | |
tree | 5d45270dbbdfc12674cd79b580a7fd19c7fa4d9c | |
parent | 08508c4216ba4750fc0f1c0f521a69b0b91090e0 (diff) | |
download | volse-hubzilla-80bd128425b99d91ddca897bc2cd6dcef5268fe4.tar.gz volse-hubzilla-80bd128425b99d91ddca897bc2cd6dcef5268fe4.tar.bz2 volse-hubzilla-80bd128425b99d91ddca897bc2cd6dcef5268fe4.zip |
more DB cleanup
-rw-r--r-- | boot.php | 10 | ||||
-rw-r--r-- | database.sql | 28 | ||||
-rw-r--r-- | include/Contact.php | 8 | ||||
-rw-r--r-- | include/api.php | 16 | ||||
-rw-r--r-- | include/delivery.php | 12 | ||||
-rw-r--r-- | include/follow.php | 19 | ||||
-rw-r--r-- | include/identity.php | 2 | ||||
-rw-r--r-- | include/iquery.php | 2 | ||||
-rwxr-xr-x | include/items.php | 81 | ||||
-rw-r--r-- | include/notifier.php | 12 | ||||
-rw-r--r-- | include/onepoll.php | 61 | ||||
-rw-r--r-- | include/poller.php | 26 | ||||
-rw-r--r-- | include/queue_fn.php | 2 | ||||
-rw-r--r-- | include/user.php | 2 | ||||
-rw-r--r-- | mod/abook.php | 4 | ||||
-rw-r--r-- | mod/contacts.php | 14 | ||||
-rw-r--r-- | mod/crepair.php | 6 | ||||
-rw-r--r-- | mod/dfrn_confirm.php | 40 | ||||
-rw-r--r-- | mod/dfrn_notify.php | 18 | ||||
-rw-r--r-- | mod/dfrn_poll.php | 26 | ||||
-rw-r--r-- | mod/dfrn_request.php | 33 | ||||
-rw-r--r-- | mod/network.php | 4 | ||||
-rw-r--r-- | mod/notifications.php | 2 | ||||
-rw-r--r-- | mod/profile_photo.php | 4 | ||||
-rw-r--r-- | mod/profiles.php | 4 | ||||
-rw-r--r-- | mod/profperm.php | 8 | ||||
-rw-r--r-- | mod/redir.php | 10 | ||||
-rw-r--r-- | mod/settings.php | 2 | ||||
-rw-r--r-- | update.php | 6 |
29 files changed, 184 insertions, 278 deletions
@@ -642,7 +642,7 @@ if(! class_exists('App')) { if($this->cached_profile_picdate[$common_filename]){ $this->cached_profile_image[$avatar_image] = $avatar_image . $this->cached_profile_picdate[$common_filename]; } else { - $r = q("SELECT `contact`.`avatar-date` AS picdate FROM `contact` WHERE `contact`.`thumb` like \"%%/%s\"", + $r = q("SELECT `contact`.`avatar_date` AS picdate FROM `contact` WHERE `contact`.`thumb` like \"%%/%s\"", $common_filename); if(! count($r)){ $this->cached_profile_image[$avatar_image] = $avatar_image; @@ -1063,17 +1063,17 @@ if(! function_exists('get_max_import_size')) { if(! function_exists('profile_load')) { function profile_load(&$a, $nickname, $profile = 0) { if(remote_user()) { - $r = q("SELECT `profile-id` FROM `contact` WHERE `id` = %d LIMIT 1", + $r = q("SELECT `profile_id` FROM `contact` WHERE `id` = %d LIMIT 1", intval($_SESSION['visitor_id'])); if(count($r)) - $profile = $r[0]['profile-id']; + $profile = $r[0]['profile_id']; } $r = null; if($profile) { $profile_int = intval($profile); - $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, entity.* FROM `profile` + $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar_date` AS picdate, entity.* FROM `profile` left join `contact` on `contact`.`uid` = `profile`.`uid` LEFT JOIN entity ON `profile`.`uid` = entity.entity_id WHERE entity.entity_address = '%s' AND `profile`.`id` = %d and `contact`.`self` = 1 LIMIT 1", dbesc($nickname), @@ -1081,7 +1081,7 @@ function profile_load(&$a, $nickname, $profile = 0) { ); } if((! $r) && (! count($r))) { - $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `entity`.* FROM `profile` + $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar_date` AS picdate, `entity`.* FROM `profile` left join `contact` on `contact`.`uid` = `profile`.`uid` LEFT JOIN `entity` ON `profile`.`uid` = entity.entity_id WHERE entity.entity_address = '%s' AND `profile`.`is_default` = 1 and `contact`.`self` = 1 LIMIT 1", dbesc($nickname) diff --git a/database.sql b/database.sql index d96b7b554..cbd2c235e 100644 --- a/database.sql +++ b/database.sql @@ -115,6 +115,7 @@ CREATE TABLE IF NOT EXISTS `config` ( CREATE TABLE IF NOT EXISTS `contact` ( `id` int(11) NOT NULL AUTO_INCREMENT, + `aid` int(10) unsigned NOT NULL DEFAULT '0', `uid` int(11) NOT NULL COMMENT 'owner uid', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `my_perms` int(10) unsigned NOT NULL DEFAULT '0', @@ -130,9 +131,9 @@ CREATE TABLE IF NOT EXISTS `contact` ( `photo` text NOT NULL COMMENT 'remote photo URL initially until approved', `thumb` text NOT NULL, `micro` text NOT NULL, - `site-pubkey` text NOT NULL, - `issued-id` char(255) NOT NULL, - `dfrn-id` char(255) NOT NULL, + `site_pubkey` text NOT NULL, + `issued_id` char(255) NOT NULL, + `dfrn_id` char(255) NOT NULL, `url` char(255) NOT NULL, `nurl` char(255) NOT NULL, `addr` char(255) NOT NULL, @@ -146,16 +147,12 @@ CREATE TABLE IF NOT EXISTS `contact` ( `confirm` text NOT NULL, `poco` text NOT NULL, `aes_allow` tinyint(1) NOT NULL DEFAULT '0', - `ret-aes` tinyint(1) NOT NULL DEFAULT '0', - `usehub` tinyint(1) NOT NULL DEFAULT '0', - `subhub` tinyint(1) NOT NULL DEFAULT '0', - `hub-verify` char(255) NOT NULL, - `last-update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `last_update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `success_update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `name-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `uri-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `avatar-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `term-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `name_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `uri_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `avatar_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `term_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `priority` tinyint(3) NOT NULL, `blocked` tinyint(1) NOT NULL DEFAULT '1', `readonly` tinyint(1) NOT NULL DEFAULT '0', @@ -169,14 +166,12 @@ CREATE TABLE IF NOT EXISTS `contact` ( `reason` text NOT NULL COMMENT 'why a rating was given - will help friends decide to make friends or not', `closeness` tinyint(2) NOT NULL DEFAULT '99', `info` mediumtext NOT NULL, - `profile-id` int(11) NOT NULL DEFAULT '0' COMMENT 'which profile to display - 0 is public default', + `profile_id` int(11) NOT NULL DEFAULT '0' COMMENT 'which profile to display - 0 is public default', `bdyear` char(4) NOT NULL COMMENT 'birthday notify flag', `bd` date NOT NULL, PRIMARY KEY (`id`), KEY `uid` (`uid`), KEY `self` (`self`), - KEY `issued-id` (`issued-id`), - KEY `dfrn-id` (`dfrn-id`), KEY `blocked` (`blocked`), KEY `readonly` (`readonly`), KEY `network` (`network`), @@ -193,7 +188,8 @@ CREATE TABLE IF NOT EXISTS `contact` ( KEY `forum` (`forum`), KEY `notify` (`notify`), KEY `my_perms` (`my_perms`), - KEY `their_perms` (`their_perms`) + KEY `their_perms` (`their_perms`), + KEY `aid` (`aid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `conv` ( diff --git a/include/Contact.php b/include/Contact.php index 9a6c64693..c141fa188 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -139,8 +139,8 @@ function mark_for_death($contact) { if($contact['archive']) return; - if($contact['term-date'] == '0000-00-00 00:00:00') { - q("UPDATE `contact` SET `term-date` = '%s' WHERE `id` = %d LIMIT 1", + if($contact['term_date'] == '0000-00-00 00:00:00') { + q("UPDATE `contact` SET `term_date` = '%s' WHERE `id` = %d LIMIT 1", dbesc(datetime_convert()), intval($contact['id']) ); @@ -151,7 +151,7 @@ function mark_for_death($contact) { // so they won't be surprised when the contact vanishes and can take // remedial action if this was a serious mistake or glitch - $expiry = $contact['term-date'] . ' + 32 days '; + $expiry = $contact['term_date'] . ' + 32 days '; if(datetime_convert() > datetime_convert('UTC','UTC',$expiry)) { // relationship is really truly dead. @@ -172,7 +172,7 @@ function mark_for_death($contact) { if(! function_exists('unmark_for_death')) { function unmark_for_death($contact) { // It's a miracle. Our dead contact has inexplicably come back to life. - q("UPDATE `contact` SET `term-date` = '%s' WHERE `id` = %d LIMIT 1", + q("UPDATE `contact` SET `term_date` = '%s' WHERE `id` = %d LIMIT 1", dbesc('0000-00-00 00:00:00'), intval($contact['id']) ); diff --git a/include/api.php b/include/api.php index b63ae0fee..6b2fd008b 100644 --- a/include/api.php +++ b/include/api.php @@ -326,7 +326,7 @@ 'contact_url' => $a->get_baseurl()."/contacts/".$uinfo[0]['cid'], 'protected' => false, 'friends_count' => intval($countfriends), - 'created_at' => api_date($uinfo[0]['name-date']), + 'created_at' => api_date($uinfo[0]['name_date']), 'utc_offset' => "+00:00", 'time_zone' => 'UTC', //$uinfo[0]['timezone'], 'geo_enabled' => false, @@ -738,7 +738,7 @@ $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, - `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 @@ -808,7 +808,7 @@ /*$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, - `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`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0 @@ -887,7 +887,7 @@ $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, - `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`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0 @@ -932,7 +932,7 @@ $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`nick` as `reply_author`, `contact`.`name`, `contact`.`photo`, `contact`.`url` as `reply_url`, `contact`.`rel`, - `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`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0 @@ -1034,7 +1034,7 @@ $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, - `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 @@ -1100,7 +1100,7 @@ $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, - `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 @@ -1155,7 +1155,7 @@ $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, - `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 diff --git a/include/delivery.php b/include/delivery.php index f6ebe9ded..09448fcae 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -262,9 +262,9 @@ function delivery_run($argv, $argc){ '$profile_page' => xmlify($owner['url']), '$photo' => xmlify($owner['photo']), '$thumb' => xmlify($owner['thumb']), - '$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar-date'] . '+00:00' , ATOM_TIME)) , - '$uridate' => xmlify(datetime_convert('UTC','UTC',$owner['uri-date'] . '+00:00' , ATOM_TIME)) , - '$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name-date'] . '+00:00' , ATOM_TIME)) , + '$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar_date'] . '+00:00' , ATOM_TIME)) , + '$uridate' => xmlify(datetime_convert('UTC','UTC',$owner['uri_date'] . '+00:00' , ATOM_TIME)) , + '$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name_date'] . '+00:00' , ATOM_TIME)) , '$birthday' => $birthday, '$community' => (($owner['page-flags'] == PAGE_COMMUNITY) ? '<dfrn:community>1</dfrn:community>' : '') )); @@ -300,10 +300,10 @@ function delivery_run($argv, $argc){ if(link_compare($basepath,$a->get_baseurl())) { $nickname = basename($contact['url']); - if($contact['issued-id']) - $sql_extra = sprintf(" AND `dfrn-id` = '%s' ", dbesc($contact['issued-id'])); + if($contact['issued_id']) + $sql_extra = sprintf(" AND `dfrn_id` = '%s' ", dbesc($contact['issued_id'])); else - $sql_extra = sprintf(" AND `issued-id` = '%s' ", dbesc($contact['dfrn-id'])); + $sql_extra = sprintf(" AND `issued_id` = '%s' ", dbesc($contact['dfrn_id'])); $x = q("SELECT `contact`.*, `contact`.`uid` AS `importer_uid`, `contact`.`pubkey` AS `cpubkey`, diff --git a/include/follow.php b/include/follow.php index 35dbb0236..8b075c173 100644 --- a/include/follow.php +++ b/include/follow.php @@ -95,7 +95,6 @@ function new_contact($uid,$url,$interactive = false) { $writeable = ((($ret['network'] === NETWORK_OSTATUS) && ($ret['notify'])) ? 1 : 0); - $subhub = (($ret['network'] === NETWORK_OSTATUS) ? true : false); $hidden = 0; @@ -112,9 +111,8 @@ function new_contact($uid,$url,$interactive = false) { if(count($r)) { // update contact if($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) { - q("UPDATE `contact` SET `rel` = %d , `subhub` = %d, `readonly` = 0 WHERE `id` = %d AND `uid` = %d LIMIT 1", + q("UPDATE `contact` SET `rel` = %d , `readonly` = 0 WHERE `id` = %d AND `uid` = %d LIMIT 1", intval(CONTACT_IS_FRIEND), - intval($subhub), intval($r[0]['id']), intval($uid) ); @@ -152,8 +150,8 @@ function new_contact($uid,$url,$interactive = false) { // create contact record $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `photo`, `network`, `pubkey`, `rel`, `priority`, - `writable`, `hidden`, `blocked`, `readonly`, `pending`, `subhub` ) - VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, 0, 0, 0, %d ) ", + `writable`, `hidden`, `blocked`, `readonly`, `pending` ) + VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, 0, 0, 0) ", intval($uid), dbesc(datetime_convert()), dbesc($ret['url']), @@ -172,8 +170,7 @@ function new_contact($uid,$url,$interactive = false) { intval($new_relation), intval($ret['priority']), intval($writeable), - intval($hidden), - intval($subhub) + intval($hidden) ); } @@ -206,9 +203,9 @@ function new_contact($uid,$url,$interactive = false) { $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' WHERE `id` = %d LIMIT 1 ", dbesc($photos[0]), @@ -221,7 +218,7 @@ function new_contact($uid,$url,$interactive = false) { ); - // pull feed and consume it, which should subscribe to the hub. + // pull feed and consume it proc_run('php',"include/poller.php","$contact_id"); diff --git a/include/identity.php b/include/identity.php index 9f262f1c0..7b80d383c 100644 --- a/include/identity.php +++ b/include/identity.php @@ -111,7 +111,7 @@ function create_identity($arr) { dbesc($a->get_baseurl() . "/photo/avatar/{$newuid}") ); - $r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, `name-date`, `uri-date`, `avatar-date`, `closeness` ) + $r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, `name_date`, `uri_date`, `avatar_date`, `closeness` ) VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', 0 ) ", intval($ret['entity']['entity_id']), datetime_convert(), diff --git a/include/iquery.php b/include/iquery.php index dfcba52d9..03264de28 100644 --- a/include/iquery.php +++ b/include/iquery.php @@ -25,7 +25,7 @@ function network_query($a,$arr) { $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 diff --git a/include/items.php b/include/items.php index f3e549e2b..63e9a646d 100755 --- a/include/items.php +++ b/include/items.php @@ -52,15 +52,15 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0) $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: @@ -120,8 +120,8 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0) $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`network`, `contact`.`photo`, `contact`.`url`, - `contact`.`name-date`, `contact`.`uri-date`, `contact`.`avatar-date`, - `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, + `contact`.`name_date`, `contact`.`uri_date`, `contact`.`avatar_date`, + `contact`.`thumb`, `contact`.`dfrn_id`, `contact`.`self`, `contact`.`id` AS `contact-id`, `contact`.`uid` AS `contact-uid`, `sign`.`signed_text`, `sign`.`signature`, `sign`.`signer` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` @@ -162,9 +162,9 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0) '$profile_page' => xmlify($owner['url']), '$photo' => xmlify($owner['photo']), '$thumb' => xmlify($owner['thumb']), - '$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar-date'] . '+00:00' , ATOM_TIME)) , - '$uridate' => xmlify(datetime_convert('UTC','UTC',$owner['uri-date'] . '+00:00' , ATOM_TIME)) , - '$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name-date'] . '+00:00' , ATOM_TIME)) , + '$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar_date'] . '+00:00' , ATOM_TIME)) , + '$uridate' => xmlify(datetime_convert('UTC','UTC',$owner['uri_date'] . '+00:00' , ATOM_TIME)) , + '$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name_date'] . '+00:00' , ATOM_TIME)) , '$birthday' => ((strlen($birthday)) ? '<dfrn:birthday>' . xmlify($birthday) . '</dfrn:birthday>' : ''), '$community' => (($owner['page-flags'] == PAGE_COMMUNITY) ? '<dfrn:community>1</dfrn:community>' : '') )); @@ -1301,11 +1301,11 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) { $a = get_app(); - $idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']); + $idtosend = $orig_id = (($contact['dfrn_id']) ? $contact['dfrn_id'] : $contact['issued_id']); - if($contact['duplex'] && $contact['dfrn-id']) + if($contact['duplex'] && $contact['dfrn_id']) $idtosend = '0:' . $orig_id; - if($contact['duplex'] && $contact['issued-id']) + if($contact['duplex'] && $contact['issued_id']) $idtosend = '1:' . $orig_id; $rino = ((function_exists('mcrypt_encrypt')) ? 1 : 0); @@ -1474,7 +1474,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) { return 3; } - if($contact['term-date'] != '0000-00-00 00:00:00') { + if($contact['term_date'] != '0000-00-00 00:00:00') { logger("dfrn_deliver: $url back from the dead - removing mark for death"); require_once('include/Contact.php'); unmark_for_death($contact); @@ -1568,7 +1568,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) } } - if((is_array($contact)) && ($photo_timestamp) && (strlen($photo_url)) && ($photo_timestamp > $contact['avatar-date'])) { + if((is_array($contact)) && ($photo_timestamp) && (strlen($photo_url)) && ($photo_timestamp > $contact['avatar_date'])) { logger('consume_feed: Updating photo for ' . $contact['name']); require_once("Photo.php"); $photo_failure = false; @@ -1614,7 +1614,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) $a = get_app(); - q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s' + q("UPDATE `contact` SET `avatar_date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1", dbesc(datetime_convert()), dbesc($a->get_baseurl() . '/photo/' . $hash . '-4.'.$img->getExt()), @@ -1626,13 +1626,13 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) } } - if((is_array($contact)) && ($name_updated) && (strlen($new_name)) && ($name_updated > $contact['name-date'])) { + if((is_array($contact)) && ($name_updated) && (strlen($new_name)) && ($name_updated > $contact['name_date'])) { $r = q("select * from contact where uid = %d and id = %d limit 1", intval($contact['uid']), intval($contact['id']) ); - $x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1", + $x = q("UPDATE `contact` SET `name` = '%s', `name_date` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1", dbesc(notags(trim($new_name))), dbesc(datetime_convert()), intval($contact['uid']), @@ -2100,7 +2100,7 @@ function local_delivery($importer,$data) { } } - if(($photo_timestamp) && (strlen($photo_url)) && ($photo_timestamp > $importer['avatar-date'])) { + if(($photo_timestamp) && (strlen($photo_url)) && ($photo_timestamp > $importer['avatar_date'])) { logger('local_delivery: Updating photo for ' . $importer['name']); require_once("Photo.php"); $photo_failure = false; @@ -2146,7 +2146,7 @@ function local_delivery($importer,$data) { $a = get_app(); - q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s' + q("UPDATE `contact` SET `avatar_date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1", dbesc(datetime_convert()), dbesc($a->get_baseurl() . '/photo/' . $hash . '-4.'.$img->getExt()), @@ -2158,13 +2158,13 @@ function local_delivery($importer,$data) { } } - if(($name_updated) && (strlen($new_name)) && ($name_updated > $importer['name-date'])) { + if(($name_updated) && (strlen($new_name)) && ($name_updated > $importer['name_date'])) { $r = q("select * from contact where uid = %d and id = %d limit 1", intval($importer['importer_uid']), intval($importer['id']) ); - $x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1", + $x = q("UPDATE `contact` SET `name` = '%s', `name_date` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1", dbesc(notags(trim($new_name))), dbesc(datetime_convert()), intval($importer['importer_uid']), @@ -2199,7 +2199,7 @@ function local_delivery($importer,$data) { $newloc['confirm'] = notags(unxmlify($base['confirm'][0]['data'])); $newloc['notify'] = notags(unxmlify($base['notify'][0]['data'])); $newloc['poll'] = notags(unxmlify($base['poll'][0]['data'])); - $newloc['site-pubkey'] = notags(unxmlify($base['site-pubkey'][0]['data'])); + $newloc['site_pubkey'] = notags(unxmlify($base['site_pubkey'][0]['data'])); $newloc['pubkey'] = notags(unxmlify($base['pubkey'][0]['data'])); $newloc['prvkey'] = notags(unxmlify($base['prvkey'][0]['data'])); @@ -3168,45 +3168,6 @@ function lose_sharer($importer,$contact,$datarray,$item) { } -function subscribe_to_hub($url,$importer,$contact,$hubmode = 'subscribe') { - - $a = get_app(); - - if(is_array($importer)) { - $r = q("SELECT `nickname` FROM `user` WHERE `uid` = %d LIMIT 1", - intval($importer['uid']) - ); - } - - if(! count($r)) - return; - - $push_url = get_config('system','url') . '/pubsub/' . $r[0]['nickname'] . '/' . $contact['id']; - - // Use a single verify token, even if multiple hubs - - $verify_token = ((strlen($contact['hub-verify'])) ? $contact['hub-verify'] : random_string()); - - $params= 'hub.mode=' . $hubmode . '&hub.callback=' . urlencode($push_url) . '&hub.topic=' . urlencode($contact['poll']) . '&hub.verify=async&hub.verify_token=' . $verify_token; - - logger('subscribe_to_hub: ' . $hubmode . ' ' . $contact['name'] . ' to hub ' . $url . ' endpoint: ' . $push_url . ' with verifier ' . $verify_token); - - if(! strlen($contact['hub-verify'])) { - $r = q("UPDATE `contact` SET `hub-verify` = '%s' WHERE `id` = %d LIMIT 1", - dbesc($verify_token), - intval($contact['id']) - ); - } - - post_url($url,$params); - - logger('subscribe_to_hub: returns: ' . $a->get_curl_code(), LOGGER_DEBUG); - - return; - -} - - function atom_author($tag,$name,$uri,$h,$w,$photo) { $o = ''; if(! $tag) diff --git a/include/notifier.php b/include/notifier.php index 6bc0d98b3..6e3cede56 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -344,9 +344,9 @@ function notifier_run($argv, $argc){ '$profile_page' => xmlify($owner['url']), '$photo' => xmlify($owner['photo']), '$thumb' => xmlify($owner['thumb']), - '$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar-date'] . '+00:00' , ATOM_TIME)) , - '$uridate' => xmlify(datetime_convert('UTC','UTC',$owner['uri-date'] . '+00:00' , ATOM_TIME)) , - '$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name-date'] . '+00:00' , ATOM_TIME)) , + '$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar_date'] . '+00:00' , ATOM_TIME)) , + '$uridate' => xmlify(datetime_convert('UTC','UTC',$owner['uri_date'] . '+00:00' , ATOM_TIME)) , + '$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name_date'] . '+00:00' , ATOM_TIME)) , '$birthday' => $birthday, '$community' => (($owner['page-flags'] == PAGE_COMMUNITY) ? '<dfrn:community>1</dfrn:community>' : '') @@ -520,10 +520,10 @@ function notifier_run($argv, $argc){ if(link_compare($basepath,$a->get_baseurl())) { $nickname = basename($contact['url']); - if($contact['issued-id']) - $sql_extra = sprintf(" AND `dfrn-id` = '%s' ", dbesc($contact['issued-id'])); + if($contact['issued_id']) + $sql_extra = sprintf(" AND `dfrn_id` = '%s' ", dbesc($contact['issued_id'])); else - $sql_extra = sprintf(" AND `issued-id` = '%s' ", dbesc($contact['dfrn-id'])); + $sql_extra = sprintf(" AND `issued_id` = '%s' ", dbesc($contact['dfrn_id'])); $x = q("SELECT `contact`.*, `contact`.`uid` AS `importer_uid`, `contact`.`pubkey` AS `cpubkey`, diff --git a/include/onepoll.php b/include/onepoll.php index 4ba2df515..467bb0f2c 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -38,7 +38,7 @@ function onepoll_run($argv, $argc){ $manual_id = 0; $generation = 0; - $hub_update = false; + $force = false; $restart = false; @@ -73,18 +73,7 @@ function onepoll_run($argv, $argc){ $xml = false; - $t = $contact['last-update']; - - if($contact['subhub']) { - $poll_interval = get_config('system','pushpoll_frequency'); - $contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3); - $hub_update = false; - - if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) - $hub_update = true; - } - else - $hub_update = false; + $t = $contact['last_update']; $importer_uid = $contact['uid']; @@ -99,17 +88,17 @@ function onepoll_run($argv, $argc){ logger("onepoll: poll: ({$contact['id']}) IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}"); - $last_update = (($contact['last-update'] === '0000-00-00 00:00:00') + $last_update = (($contact['last_update'] === '0000-00-00 00:00:00') ? datetime_convert('UTC','UTC','now - 7 days', ATOM_TIME) - : datetime_convert('UTC','UTC',$contact['last-update'], ATOM_TIME) + : datetime_convert('UTC','UTC',$contact['last_update'], ATOM_TIME) ); if($contact['network'] === NETWORK_DFRN) { - $idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']); - if(intval($contact['duplex']) && $contact['dfrn-id']) + $idtosend = $orig_id = (($contact['dfrn_id']) ? $contact['dfrn_id'] : $contact['issued_id']); + if(intval($contact['duplex']) && $contact['dfrn_id']) $idtosend = '0:' . $orig_id; - if(intval($contact['duplex']) && $contact['issued-id']) + if(intval($contact['duplex']) && $contact['issued_id']) $idtosend = '1:' . $orig_id; // they have permission to write to us. We already filtered this in the contact query. @@ -135,8 +124,8 @@ function onepoll_run($argv, $argc){ mark_for_death($contact); - // set the last-update so we don't keep polling - $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1", + // set the last_update so we don't keep polling + $r = q("UPDATE `contact` SET `last_update` = '%s' WHERE `id` = %d LIMIT 1", dbesc(datetime_convert()), intval($contact['id']) ); @@ -149,7 +138,7 @@ function onepoll_run($argv, $argc){ mark_for_death($contact); - $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1", + $r = q("UPDATE `contact` SET `last_update` = '%s' WHERE `id` = %d LIMIT 1", dbesc(datetime_convert()), intval($contact['id']) ); @@ -163,17 +152,17 @@ function onepoll_run($argv, $argc){ logger("poller: $url replied status 1 - marking for death "); // we may not be friends anymore. Will keep trying for one month. - // set the last-update so we don't keep polling + // set the last_update so we don't keep polling - $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1", + $r = q("UPDATE `contact` SET `last_update` = '%s' WHERE `id` = %d LIMIT 1", dbesc(datetime_convert()), intval($contact['id']) ); mark_for_death($contact); } else { - if($contact['term-date'] != '0000-00-00 00:00:00') { + if($contact['term_date'] != '0000-00-00 00:00:00') { logger("poller: $url back from the dead - removing mark for death"); unmark_for_death($contact); } @@ -228,7 +217,7 @@ function onepoll_run($argv, $argc){ logger('poller: received xml : ' . $xml, LOGGER_DATA); if((! strstr($xml,'<?xml')) && (! strstr($xml,'<rss'))) { logger('poller: post_handshake: response from ' . $url . ' did not contain XML.'); - $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1", + $r = q("UPDATE `contact` SET `last_update` = '%s' WHERE `id` = %d LIMIT 1", dbesc(datetime_convert()), intval($contact['id']) ); @@ -243,30 +232,12 @@ function onepoll_run($argv, $argc){ consume_feed($xml,$importer,$contact,$hub,1,2); - $hubmode = 'subscribe'; - if($contact['network'] === NETWORK_DFRN || $contact['blocked'] || $contact['readonly']) - $hubmode = 'unsubscribe'; - - if($contact['network'] === NETWORK_OSTATUS && (! $contact['hub-verify'])) - $hub_update = true; - - if((strlen($hub)) && ($hub_update) && ($contact['rel'] != CONTACT_IS_FOLLOWER)) { - logger('poller: hub ' . $hubmode . ' : ' . $hub . ' contact name : ' . $contact['name'] . ' local user : ' . $importer['name']); - $hubs = explode(',', $hub); - if(count($hubs)) { - foreach($hubs as $h) { - $h = trim($h); - if(! strlen($h)) - continue; - subscribe_to_hub($h,$importer,$contact,$hubmode); - } - } - } + } $updated = datetime_convert(); - $r = q("UPDATE `contact` SET `last-update` = '%s', `success_update` = '%s' WHERE `id` = %d LIMIT 1", + $r = q("UPDATE `contact` SET `last_update` = '%s', `success_update` = '%s' WHERE `id` = %d LIMIT 1", dbesc($updated), dbesc($updated), intval($contact['id']) diff --git a/include/poller.php b/include/poller.php index fefc9b381..d2780be0a 100644 --- a/include/poller.php +++ b/include/poller.php @@ -107,7 +107,7 @@ function poller_run($argv, $argc){ $manual_id = 0; $generation = 0; - $hub_update = false; + $force = false; $restart = false; @@ -179,7 +179,7 @@ function poller_run($argv, $argc){ $xml = false; if($manual_id) - $contact['last-update'] = '0000-00-00 00:00:00'; + $contact['last_update'] = '0000-00-00 00:00:00'; if($contact['network'] === NETWORK_DFRN) $contact['priority'] = 2; @@ -187,29 +187,11 @@ function poller_run($argv, $argc){ if(!get_config('system','ostatus_use_priority') and ($contact['network'] === NETWORK_OSTATUS)) $contact['priority'] = 2; - if($contact['priority'] || $contact['subhub']) { + if($contact['priority']) { - $hub_update = true; $update = false; - $t = $contact['last-update']; - - // We should be getting everything via a hub. But just to be sure, let's check once a day. - // (You can make this more or less frequent if desired by setting 'pushpoll_frequency' appropriately) - // This also lets us update our subscription to the hub, and add or replace hubs in case it - // changed. We will only update hubs once a day, regardless of 'pushpoll_frequency'. - - - if($contact['subhub']) { - $poll_interval = get_config('system','pushpoll_frequency'); - $contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3); - $hub_update = false; - - if((datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) || $force) - $hub_update = true; - } - else - $hub_update = false; + $t = $contact['last_update']; /** * Based on $contact['priority'], should we poll this site now? Or later? diff --git a/include/queue_fn.php b/include/queue_fn.php index e43912431..6e8933aba 100644 --- a/include/queue_fn.php +++ b/include/queue_fn.php @@ -24,7 +24,7 @@ function was_recently_delayed($cid) { if(count($r)) return true; - $r = q("select `term-date` from contact where id = %d and `term-date` != '' and `term-date` != '0000-00-00 00:00:00' limit 1", + $r = q("select `term_date` from contact where id = %d and `term_date` != '' and `term_date` != '0000-00-00 00:00:00' limit 1", intval($cid) ); if(count($r)) diff --git a/include/user.php b/include/user.php index 6514b269a..b94317dab 100644 --- a/include/user.php +++ b/include/user.php @@ -233,7 +233,7 @@ function create_user($arr) { return $result; } $r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, `nurl`, - `request`, `notify`, `poll`, `confirm`, `poco`, `name-date`, `uri-date`, `avatar-date`, `closeness` ) + `request`, `notify`, `poll`, `confirm`, `poco`, `name_date`, `uri_date`, `avatar_date`, `closeness` ) VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 0 ) ", intval($newuid), datetime_convert(), diff --git a/mod/abook.php b/mod/abook.php index 0f69201b0..ee402d394 100644 --- a/mod/abook.php +++ b/mod/abook.php @@ -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') ), diff --git a/mod/contacts.php b/mod/contacts.php index 434de6174..908c348f4 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -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') ), diff --git a/mod/crepair.php b/mod/crepair.php index ec963b105..e5ece0f98 100644 --- a/mod/crepair.php +++ b/mod/crepair.php @@ -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]), diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 7002b870f..b0bea7a61 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -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, diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index e55da5572..94eb3a297 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -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: diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index f3c145410..c26d893e1 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -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: diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index e6c38a772..dc329aa19 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -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')) diff --git a/mod/network.php b/mod/network.php index b37be2fa8..18d5b8e11 100644 --- a/mod/network.php +++ b/mod/network.php @@ -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 diff --git a/mod/notifications.php b/mod/notifications.php index b28b1478d..5bb85085f 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -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'], diff --git a/mod/profile_photo.php b/mod/profile_photo.php index 058948ef0..14277e62e 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -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()) ); diff --git a/mod/profiles.php b/mod/profiles.php index 276fcaf64..d864c18d2 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -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()) diff --git a/mod/profperm.php b/mod/profperm.php index d29581beb..b31dfc128 100644 --- a/mod/profperm.php +++ b/mod/profperm.php @@ -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]) ); diff --git a/mod/redir.php b/mod/redir.php index 0f7b5cc23..113f6c200 100644 --- a/mod/redir.php +++ b/mod/redir.php @@ -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; } diff --git a/mod/settings.php b/mod/settings.php index 0699e94d8..ca70c53cf 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -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()) diff --git a/update.php b/update.php index c5091420e..a2f836885 100644 --- a/update.php +++ b/update.php @@ -48,7 +48,7 @@ function update_1000() { q("ALTER TABLE `intro` ADD `duplex` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `knowyou` "); q("ALTER TABLE `contact` ADD `duplex` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `rel` "); q("ALTER TABLE `contact` CHANGE `issued-pubkey` `issued-pubkey` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL"); - q("ALTER TABLE `contact` ADD `term-date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `avatar-date`"); + q("ALTER TABLE `contact` ADD `term_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `avatar_date`"); } function update_1001() { @@ -64,7 +64,7 @@ function update_1003() { q("ALTER TABLE `contact` DROP `issued-pubkey` , DROP `ret-id` , DROP `ret-pubkey` "); q("ALTER TABLE `contact` ADD `usehub` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `ret-aes`"); q("ALTER TABLE `contact` ADD `hub-verify` CHAR( 255 ) NOT NULL AFTER `usehub`"); - q("ALTER TABLE `contact` ADD INDEX ( `uid` ) , ADD INDEX ( `self` ), ADD INDEX ( `issued-id` ), ADD INDEX ( `dfrn-id` )"); + q("ALTER TABLE `contact` ADD INDEX ( `uid` ) , ADD INDEX ( `self` ), ADD INDEX ( `issued_id` ), ADD INDEX ( `dfrn_id` )"); q("ALTER TABLE `contact` ADD INDEX ( `blocked` ), ADD INDEX ( `readonly` )"); } @@ -281,7 +281,7 @@ function update_1029() { } function update_1030() { - q("ALTER TABLE `contact` ADD `bdyear` CHAR( 4 ) NOT NULL COMMENT 'birthday notify flag' AFTER `profile-id` "); + q("ALTER TABLE `contact` ADD `bdyear` CHAR( 4 ) NOT NULL COMMENT 'birthday notify flag' AFTER `profile_id` "); q("CREATE TABLE IF NOT EXISTS `event` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , |