some changes for directory services

This commit is contained in:
friendica 2012-12-19 22:45:49 -08:00
parent ad20e1f617
commit d7c23be8c9
4 changed files with 45 additions and 4 deletions

View File

@ -17,7 +17,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica Red');
define ( 'FRIENDICA_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'ZOT_REVISION', 1 );
define ( 'DB_UPDATE_VERSION', 1003 );
define ( 'DB_UPDATE_VERSION', 1005 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

View File

@ -208,7 +208,6 @@ CREATE TABLE IF NOT EXISTS `config` (
UNIQUE KEY `access` (`cat`,`k`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `event` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`aid` int(10) unsigned NOT NULL DEFAULT '0',
@ -761,6 +760,17 @@ CREATE TABLE IF NOT EXISTS `session` (
KEY `expire` (`expire`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `site` (
`site_url` char(255) NOT NULL,
`site_flags` int(11) NOT NULL DEFAULT '0',
`site_update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`site_directory` char(255) NOT NULL DEFAULT '',
PRIMARY KEY (`site_url`),
KEY `site_flags` (`site_flags`),
KEY `site_update` (`site_update`),
KEY `site_directory` (`site_directory`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `spam` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
@ -834,6 +844,7 @@ CREATE TABLE IF NOT EXISTS `xchan` (
`xchan_url` char(255) NOT NULL DEFAULT '',
`xchan_name` char(255) NOT NULL DEFAULT '',
`xchan_network` char(255) NOT NULL DEFAULT '',
`xchan_flags` int(10) unsigned NOT NULL DEFAULT '0',
`xchan_photo_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`xchan_name_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`xchan_hash`),
@ -841,5 +852,6 @@ CREATE TABLE IF NOT EXISTS `xchan` (
KEY `xchan_addr` (`xchan_addr`),
KEY `xchan_name` (`xchan_name`),
KEY `xchan_network` (`xchan_network`),
KEY `xchan_url` (`xchan_url`)
KEY `xchan_url` (`xchan_url`),
KEY `xchan_flags` (`xchan_flags`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

View File

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1003 );
define( 'UPDATE_VERSION' , 1005 );
/**
*
@ -74,3 +74,28 @@ function update_r1002() {
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1003() {
$r = q("ALTER TABLE `xchan` ADD `xchan_flags` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `xchan_network` ,
ADD INDEX ( `xchan_flags` ) ");
if($r)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1004() {
$r = q("CREATE TABLE if not exists `site` (
`site_url` CHAR( 255 ) NOT NULL ,
`site_flags` INT NOT NULL DEFAULT '0',
`site_update` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`site_directory` CHAR( 255 ) NOT NULL DEFAULT '',
PRIMARY KEY ( `site_url` )
) ENGINE = MYISAM ");
$r2 = q("alter table site add index (site_flags), add index (site_update), add index (site_directory) ");
if($r && $r2)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}

View File

@ -58,6 +58,9 @@ function zfinger_init(&$a) {
$id = $e['channel_id'];
$searchable = (($e['channel_pageflags'] & PAGE_HIDDEN) ? false : true);
// This is for birthdays and keywords, but must check access permissions
// $r = q("select contact.*, profile.*
// from contact left join profile on contact.uid = profile.uid
@ -86,6 +89,7 @@ function zfinger_init(&$a) {
$ret['name_updated'] = $e['xchan_name_date'];
$ret['target'] = $ztarget;
$ret['target_sig'] = $zsig;
$ret['searchable'] = $searchable;
// FIXME encrypt permissions when targeted so that only the target can view them, requires sending the pubkey and also checking that the target_sig is signed with that pubkey and isn't a forgery.