From 8c3c3d5fd7acc5df0aec9c10f8bdd89bedd2060a Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 27 Aug 2012 01:22:08 -0700 Subject: [PATCH] stuff --- boot.php | 2 +- database.sql | 97 ++++++++++------------------------- include/contact_selectors.php | 4 +- include/user.php | 2 +- mod/profile_photo.php | 2 +- mod/profiles.php | 14 ++--- mod/profperm.php | 2 +- 7 files changed, 40 insertions(+), 83 deletions(-) diff --git a/boot.php b/boot.php index b5fd9333c..cfcdbd222 100644 --- a/boot.php +++ b/boot.php @@ -1205,7 +1205,7 @@ if(! function_exists('profile_sidebar')) { 'photo' => $rr['thumb'], 'id' => $rr['id'], 'alt' => t('Profile Image'), - 'profile_name' => $rr['profile-name'], + 'profile_name' => $rr['profile_name'], 'isdefault' => $rr['is-default'], 'visibile_to_everybody' => t('visible to everybody'), 'edit_visibility' => t('Edit visibility'), diff --git a/database.sql b/database.sql index 0e3b585f9..15dbd0789 100644 --- a/database.sql +++ b/database.sql @@ -48,12 +48,13 @@ CREATE TABLE IF NOT EXISTS `addon` ( ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `attach` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `uid` int(11) NOT NULL, - `hash` char(64) NOT NULL, - `filename` char(255) NOT NULL, - `filetype` char(64) NOT NULL, - `filesize` int(11) NOT NULL, + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `aid` int(10) unsigned NOT NULL DEFAULT '0', + `uid` int(10) unsigned NOT NULL DEFAULT '0', + `hash` char(64) NOT NULL DEFAULT '', + `filename` char(255) NOT NULL DEFAULT '', + `filetype` char(64) NOT NULL DEFAULT '', + `filesize` int(10) unsigned NOT NULL DEFAULT '0', `data` longblob NOT NULL, `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', @@ -61,7 +62,10 @@ CREATE TABLE IF NOT EXISTS `attach` ( `allow_gid` mediumtext NOT NULL, `deny_cid` mediumtext NOT NULL, `deny_gid` mediumtext NOT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + KEY `aid` (`aid`), + KEY `uid` (`uid`), + KEY `hash` (`hash`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `auth_codes` ( @@ -437,7 +441,7 @@ CREATE TABLE IF NOT EXISTS `hubloc` ( KEY `hubloc_flags` (`hubloc_flags`), KEY `hubloc_guid_sig` (`hubloc_guid_sig`), KEY `hubloc_url_sig` (`hubloc_url_sig`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `intro` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, @@ -464,6 +468,7 @@ CREATE TABLE IF NOT EXISTS `intro` ( CREATE TABLE IF NOT EXISTS `item` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `uri` char(255) CHARACTER SET ascii NOT NULL, + `aid` int(10) unsigned NOT NULL DEFAULT '0', `uid` int(10) unsigned NOT NULL DEFAULT '0', `contact-id` int(10) unsigned NOT NULL DEFAULT '0', `type` char(255) NOT NULL, @@ -540,6 +545,7 @@ CREATE TABLE IF NOT EXISTS `item` ( KEY `uid_created` (`uid`,`created`), KEY `uid_unseen` (`uid`,`unseen`), KEY `parent_uri` (`parent_uri`), + KEY `aid` (`aid`), FULLTEXT KEY `title` (`title`), FULLTEXT KEY `body` (`body`), FULLTEXT KEY `allow_cid` (`allow_cid`), @@ -568,6 +574,7 @@ CREATE TABLE IF NOT EXISTS `locks` ( CREATE TABLE IF NOT EXISTS `mail` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `aid` int(10) unsigned NOT NULL DEFAULT '0', `uid` int(10) unsigned NOT NULL, `guid` char(64) NOT NULL, `from-name` char(255) NOT NULL, @@ -594,25 +601,8 @@ CREATE TABLE IF NOT EXISTS `mail` ( KEY `convid` (`convid`), KEY `unknown` (`unknown`), KEY `contact-id` (`contact-id`), - KEY `parent_uri` (`parent_uri`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `mailacct` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `uid` int(11) NOT NULL, - `server` char(255) NOT NULL, - `port` int(11) NOT NULL, - `ssltype` char(16) NOT NULL, - `mailbox` char(255) NOT NULL, - `user` char(255) NOT NULL, - `pass` text NOT NULL, - `action` int(11) NOT NULL, - `movetofolder` char(255) NOT NULL, - `reply_to` char(255) NOT NULL, - `pubmail` tinyint(1) NOT NULL DEFAULT '0', - `last_check` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (`id`), - KEY `uid` (`uid`) + KEY `parent_uri` (`parent_uri`), + KEY `aid` (`aid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `manage` ( @@ -673,6 +663,7 @@ CREATE TABLE IF NOT EXISTS `pconfig` ( CREATE TABLE IF NOT EXISTS `photo` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `aid` int(10) unsigned NOT NULL DEFAULT '0', `uid` int(10) unsigned NOT NULL, `contact-id` int(10) unsigned NOT NULL DEFAULT '0', `guid` char(64) NOT NULL, @@ -700,39 +691,15 @@ CREATE TABLE IF NOT EXISTS `photo` ( KEY `scale` (`scale`), KEY `profile` (`profile`), KEY `type` (`type`), - KEY `contact-id` (`contact-id`) + KEY `contact-id` (`contact-id`), + KEY `aid` (`aid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -CREATE TABLE IF NOT EXISTS `poll` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `uid` int(11) NOT NULL, - `q0` mediumtext NOT NULL, - `q1` mediumtext NOT NULL, - `q2` mediumtext NOT NULL, - `q3` mediumtext NOT NULL, - `q4` mediumtext NOT NULL, - `q5` mediumtext NOT NULL, - `q6` mediumtext NOT NULL, - `q7` mediumtext NOT NULL, - `q8` mediumtext NOT NULL, - `q9` mediumtext NOT NULL, - PRIMARY KEY (`id`), - KEY `uid` (`uid`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `poll_result` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `poll_id` int(11) NOT NULL, - `choice` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `poll_id` (`poll_id`), - KEY `choice` (`choice`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - CREATE TABLE IF NOT EXISTS `profile` ( `id` int(11) NOT NULL AUTO_INCREMENT, + `aid` int(10) unsigned NOT NULL DEFAULT '0', `uid` int(11) NOT NULL, - `profile-name` char(255) NOT NULL, + `profile_name` char(255) NOT NULL, `is-default` tinyint(1) NOT NULL DEFAULT '0', `hide-friends` tinyint(1) NOT NULL DEFAULT '0', `name` char(255) NOT NULL, @@ -783,6 +750,7 @@ CREATE TABLE IF NOT EXISTS `profile` ( KEY `sexual` (`sexual`), KEY `publish` (`publish`), KEY `net-publish` (`net-publish`), + KEY `aid` (`aid`), FULLTEXT KEY `pub_keywords` (`pub_keywords`), FULLTEXT KEY `prv_keywords` (`prv_keywords`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -841,19 +809,6 @@ CREATE TABLE IF NOT EXISTS `session` ( KEY `expire` (`expire`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -CREATE TABLE IF NOT EXISTS `sign` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `iid` int(10) unsigned NOT NULL DEFAULT '0', - `retract_iid` int(10) unsigned NOT NULL DEFAULT '0', - `signed_text` mediumtext NOT NULL, - `signature` text NOT NULL, - `signer` char(255) NOT NULL, - PRIMARY KEY (`id`), - KEY `iid` (`iid`), - KEY `retract_iid` (`retract_iid`), - KEY `signer` (`signer`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - CREATE TABLE IF NOT EXISTS `spam` ( `id` int(11) NOT NULL AUTO_INCREMENT, `uid` int(11) NOT NULL, @@ -870,7 +825,8 @@ CREATE TABLE IF NOT EXISTS `spam` ( CREATE TABLE IF NOT EXISTS `term` ( `tid` int(10) unsigned NOT NULL AUTO_INCREMENT, - `uid` int(10) unsigned NOT NULL, + `aid` int(10) unsigned NOT NULL DEFAULT '0', + `uid` int(10) unsigned NOT NULL DEFAULT '0', `oid` int(10) unsigned NOT NULL, `otype` tinyint(3) unsigned NOT NULL, `type` tinyint(3) unsigned NOT NULL, @@ -881,7 +837,8 @@ CREATE TABLE IF NOT EXISTS `term` ( KEY `otype` (`otype`), KEY `type` (`type`), KEY `term` (`term`), - KEY `uid` (`uid`) + KEY `uid` (`uid`), + KEY `aid` (`aid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `tokens` ( diff --git a/include/contact_selectors.php b/include/contact_selectors.php index 4b3ca987a..76d005305 100644 --- a/include/contact_selectors.php +++ b/include/contact_selectors.php @@ -9,13 +9,13 @@ function contact_profile_assign($current,$foreign_net) { $o .= "\r\n"; diff --git a/include/user.php b/include/user.php index 1b497a06e..502384261 100644 --- a/include/user.php +++ b/include/user.php @@ -213,7 +213,7 @@ function create_user($arr) { } if(x($newuid) !== false) { - $r = q("INSERT INTO `profile` ( `uid`, `profile-name`, `is-default`, `name`, `photo`, `thumb`, `publish`, `net-publish` ) + $r = q("INSERT INTO `profile` ( `uid`, `profile_name`, `is-default`, `name`, `photo`, `thumb`, `publish`, `net-publish` ) VALUES ( %d, '%s', %d, '%s', '%s', '%s', %d, %d ) ", intval($newuid), t('default'), diff --git a/mod/profile_photo.php b/mod/profile_photo.php index 97e861bdd..1285bf08e 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -225,7 +225,7 @@ function profile_photo_content(&$a) { // go ahead as we have jus uploaded a new photo to crop } - $profiles = q("select `id`,`profile-name` as `name`,`is-default` as `default` from profile where uid = %d", + $profiles = q("select `id`,`profile_name` as `name`,`is-default` as `default` from profile where uid = %d", intval(local_user()) ); diff --git a/mod/profiles.php b/mod/profiles.php index 2390bc03c..db063cccb 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -213,7 +213,7 @@ function profiles_post(&$a) { } $r = q("UPDATE `profile` - SET `profile-name` = '%s', + SET `profile_name` = '%s', `name` = '%s', `pdesc` = '%s', `gender` = '%s', @@ -453,7 +453,7 @@ function profiles_content(&$a) { $r1 = q("SELECT `name`, `photo`, `thumb` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1", intval(local_user())); - $r2 = q("INSERT INTO `profile` (`uid` , `profile-name` , `name`, `photo`, `thumb`) + $r2 = q("INSERT INTO `profile` (`uid` , `profile_name` , `name`, `photo`, `thumb`) VALUES ( %d, '%s', '%s', '%s', '%s' )", intval(local_user()), dbesc($name), @@ -462,7 +462,7 @@ function profiles_content(&$a) { dbesc($r1[0]['thumb']) ); - $r3 = q("SELECT `id` FROM `profile` WHERE `uid` = %d AND `profile-name` = '%s' LIMIT 1", + $r3 = q("SELECT `id` FROM `profile` WHERE `uid` = %d AND `profile_name` = '%s' LIMIT 1", intval(local_user()), dbesc($name) ); @@ -495,7 +495,7 @@ function profiles_content(&$a) { $r1[0]['is-default'] = 0; $r1[0]['publish'] = 0; $r1[0]['net-publish'] = 0; - $r1[0]['profile-name'] = dbesc($name); + $r1[0]['profile_name'] = dbesc($name); dbesc_array($r1[0]); @@ -505,7 +505,7 @@ function profiles_content(&$a) { . implode("', '", array_values($r1[0])) . "')" ); - $r3 = q("SELECT `id` FROM `profile` WHERE `uid` = %d AND `profile-name` = '%s' LIMIT 1", + $r3 = q("SELECT `id` FROM `profile` WHERE `uid` = %d AND `profile_name` = '%s' LIMIT 1", intval(local_user()), dbesc($name) ); @@ -614,7 +614,7 @@ function profiles_content(&$a) { '$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''), '$baseurl' => $a->get_baseurl(true), '$profile_id' => $r[0]['id'], - '$profile_name' => $r[0]['profile-name'], + '$profile_name' => $r[0]['profile_name'], '$default' => (($is_default) ? '

' . t('This is your public profile.
It may be visible to anybody using the internet.') . '

' : ""), '$name' => $r[0]['name'], '$pdesc' => $r[0]['pdesc'], @@ -678,7 +678,7 @@ function profiles_content(&$a) { '$photo' => $a->get_cached_avatar_image($rr['thumb']), '$id' => $rr['id'], '$alt' => t('Profile Image'), - '$profile_name' => $rr['profile-name'], + '$profile_name' => $rr['profile_name'], '$visible' => (($rr['is-default']) ? '' . t('visible to everybody') . '' : '' . t('Edit visibility') . '') )); diff --git a/mod/profperm.php b/mod/profperm.php index 8d09c429c..c7ab45324 100644 --- a/mod/profperm.php +++ b/mod/profperm.php @@ -100,7 +100,7 @@ function profperm_content(&$a) { $o .= '

' . t('Profile Visibility Editor') . '

'; - $o .= '

' . t('Profile') . ' \'' . $profile['profile-name'] . '\'

'; + $o .= '

' . t('Profile') . ' \'' . $profile['profile_name'] . '\'

'; $o .= '
' . t('Click on a contact to add or remove.') . '
';