From c8292b3cddf0a29236cb981111beb4587d7be411 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 26 Dec 2012 03:49:50 -0800 Subject: remove the private keywords stuff to reduce directory and search complexity --- boot.php | 8 ++++---- include/profile_advanced.php | 2 +- install/database.sql | 7 ++----- install/update.php | 10 +++++++++- mod/directory.php | 2 +- mod/hcard.php | 2 +- mod/match.php | 6 +++--- mod/msearch.php | 6 +++--- mod/profiles.php | 18 ++++++------------ view/tpl/profile_advanced.tpl | 6 +++--- view/tpl/profile_edit.tpl | 9 +-------- 11 files changed, 34 insertions(+), 42 deletions(-) diff --git a/boot.php b/boot.php index d85309634..bc5c19dc1 100644 --- a/boot.php +++ b/boot.php @@ -16,9 +16,9 @@ require_once('include/features.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica Red'); define ( 'FRIENDICA_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1008 ); +define ( 'DB_UPDATE_VERSION', 1009 ); -define ( 'EOL', "
\r\n" ); +define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); @@ -1261,11 +1261,11 @@ function profile_load(&$a, $nickname, $profile = 0) { // fetch user tags if this isn't the default profile if(! $r[0]['is_default']) { - $x = q("select `pub_keywords` from `profile` where uid = %d and `is_default` = 1 limit 1", + $x = q("select `keywords` from `profile` where uid = %d and `is_default` = 1 limit 1", intval($profile_uid) ); if($x && count($x)) - $r[0]['pub_keywords'] = $x[0]['pub_keywords']; + $r[0]['keywords'] = $x[0]['keywords']; } $a->profile = $r[0]; diff --git a/include/profile_advanced.php b/include/profile_advanced.php index 8dfb1beec..749c79a3b 100644 --- a/include/profile_advanced.php +++ b/include/profile_advanced.php @@ -49,7 +49,7 @@ function advanced_profile(&$a) { if($a->profile['hometown']) $profile['hometown'] = array( t('Hometown:'), linkify($a->profile['hometown']) ); - if($a->profile['pub_keywords']) $profile['pub_keywords'] = array( t('Tags:'), $a->profile['pub_keywords']); + if($a->profile['keywords']) $profile['keywords'] = array( t('Tags:'), $a->profile['keywords']); if($a->profile['politic']) $profile['politic'] = array( t('Political Views:'), $a->profile['politic']); diff --git a/install/database.sql b/install/database.sql index 5581a27c6..990399bc4 100644 --- a/install/database.sql +++ b/install/database.sql @@ -654,8 +654,7 @@ CREATE TABLE IF NOT EXISTS `profile` ( `sexual` char(255) NOT NULL, `politic` char(255) NOT NULL, `religion` char(255) NOT NULL, - `pub_keywords` text NOT NULL, - `prv_keywords` text NOT NULL, + `keywords` text NOT NULL, `likes` text NOT NULL, `dislikes` text NOT NULL, `about` text NOT NULL, @@ -687,9 +686,7 @@ CREATE TABLE IF NOT EXISTS `profile` ( KEY `hide_friends` (`hide_friends`), KEY `postal_code` (`postal_code`), KEY `country_name` (`country_name`), - KEY `profile_guid` (`profile_guid`), - FULLTEXT KEY `pub_keywords` (`pub_keywords`), - FULLTEXT KEY `prv_keywords` (`prv_keywords`) + KEY `profile_guid` (`profile_guid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `profile_check` ( diff --git a/install/update.php b/install/update.php index bdd687fb3..144a972f9 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ profile,'pub_keywords')) ? $a->profile['pub_keywords'] : ''); + $keywords = ((x($a->profile,'keywords')) ? $a->profile['keywords'] : ''); $keywords = str_replace(array(',',' ',',,'),array(' ',',',','),$keywords); if(strlen($keywords)) $a->page['htmlhead'] .= '' . "\r\n" ; diff --git a/mod/match.php b/mod/match.php index b845b0d46..32d92cdf3 100644 --- a/mod/match.php +++ b/mod/match.php @@ -11,19 +11,19 @@ function match_content(&$a) { $o .= '

' . t('Profile Match') . '

'; - $r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is_default` = 1 AND `uid` = %d LIMIT 1", + $r = q("SELECT `keywords` FROM `profile` WHERE `is_default` = 1 AND `uid` = %d LIMIT 1", intval(local_user()) ); if(! count($r)) return; - if(! $r[0]['pub_keywords'] && (! $r[0]['prv_keywords'])) { + if(! $r[0]['keywords']) { notice( t('No keywords to match. Please add keywords to your default profile.') . EOL); return; } $params = array(); - $tags = trim($r[0]['pub_keywords'] . ' ' . $r[0]['prv_keywords']); + $tags = trim($r[0]['keywords']; if($tags) { $params['s'] = $tags; diff --git a/mod/msearch.php b/mod/msearch.php index 9d587d1e4..b51c4e097 100644 --- a/mod/msearch.php +++ b/mod/msearch.php @@ -10,13 +10,13 @@ function msearch_post(&$a) { if(! strlen($search)) killme(); - $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is_default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') ", + $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is_default` = 1 AND `user`.`hidewall` = 0 AND MATCH `keywords` AGAINST ('%s') ", dbesc($search) ); if(count($r)) $total = $r[0]['total']; - $r = q("SELECT `pub_keywords`, `username`, `nickname`, `user`.`uid` FROM `user` LEFT JOIN `profile` ON `user`.`uid` = `profile`.`uid` WHERE `is_default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') LIMIT %d , %d ", + $r = q("SELECT `keywords`, `username`, `nickname`, `user`.`uid` FROM `user` LEFT JOIN `profile` ON `user`.`uid` = `profile`.`uid` WHERE `is_default` = 1 AND `user`.`hidewall` = 0 AND MATCH `keywords` AGAINST ('%s') LIMIT %d , %d ", dbesc($search), intval($startrec), intval($perpage) @@ -29,7 +29,7 @@ function msearch_post(&$a) { 'name' => $rr['name'], 'url' => $a->get_baseurl() . '/channel/' . $rr['nickname'], 'photo' => $a->get_baseurl() . '/photo/avatar/' . $rr['uid'], - 'tags' => str_replace(array(',',' '),array(' ',' '),$rr['pub_keywords']) + 'tags' => str_replace(array(',',' '),array(' ',' '),$rr['keywords']) ); } diff --git a/mod/profiles.php b/mod/profiles.php index c828941b6..37be9bd08 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -61,8 +61,7 @@ function profiles_post(&$a) { $region = notags(trim($_POST['region'])); $postal_code = notags(trim($_POST['postal_code'])); $country_name = notags(trim($_POST['country_name'])); - $pub_keywords = notags(trim($_POST['pub_keywords'])); - $prv_keywords = notags(trim($_POST['prv_keywords'])); + $keywords = notags(trim($_POST['keywords'])); $marital = notags(trim($_POST['marital'])); $howlong = notags(trim($_POST['howlong'])); $sexual = notags(trim($_POST['sexual'])); @@ -232,8 +231,7 @@ function profiles_post(&$a) { `hometown` = '%s', `politic` = '%s', `religion` = '%s', - `pub_keywords` = '%s', - `prv_keywords` = '%s', + `keywords` = '%s', `likes` = '%s', `dislikes` = '%s', `about` = '%s', @@ -266,8 +264,7 @@ function profiles_post(&$a) { dbesc($hometown), dbesc($politic), dbesc($religion), - dbesc($pub_keywords), - dbesc($prv_keywords), + dbesc($keywords), dbesc($likes), dbesc($dislikes), dbesc($about), @@ -511,13 +508,11 @@ function profiles_content(&$a) { '$lbl_hometown' => t('Hometown:'), '$lbl_politic' => t('Political Views:'), '$lbl_religion' => t('Religious Views:'), - '$lbl_pubkey' => t('Public Keywords:'), - '$lbl_prvkey' => t('Private Keywords:'), + '$lbl_pubkey' => t('Keywords:'), '$lbl_likes' => t('Likes:'), '$lbl_dislikes' => t('Dislikes:'), '$lbl_ex2' => t('Example: fishing photography software'), - '$lbl_pubdsc' => t("\x28Used for suggesting potential friends, can be seen by others\x29"), - '$lbl_prvdsc' => t("\x28Used for searching profiles, never shown to others\x29"), + '$lbl_pubdsc' => t("Used in directory listings"), '$lbl_about' => t('Tell us about yourself...'), '$lbl_hobbies' => t('Hobbies/Interests'), '$lbl_social' => t('Contact information and Social Networks'), @@ -553,8 +548,7 @@ function profiles_content(&$a) { '$hometown' => $r[0]['hometown'], '$politic' => $r[0]['politic'], '$religion' => $r[0]['religion'], - '$pub_keywords' => $r[0]['pub_keywords'], - '$prv_keywords' => $r[0]['prv_keywords'], + '$keywords' => $r[0]['keywords'], '$likes' => $r[0]['likes'], '$dislikes' => $r[0]['dislikes'], '$music' => $r[0]['music'], diff --git a/view/tpl/profile_advanced.tpl b/view/tpl/profile_advanced.tpl index b02b7f27d..0bc4d3fd3 100644 --- a/view/tpl/profile_advanced.tpl +++ b/view/tpl/profile_advanced.tpl @@ -40,10 +40,10 @@ {{ endif }} -{{ if $profile.pub_keywords }} +{{ if $profile.keywords }}
-
$profile.pub_keywords.0
-
$profile.pub_keywords.1
+
$profile.keywords.0
+
$profile.keywords.1
{{ endif }} diff --git a/view/tpl/profile_edit.tpl b/view/tpl/profile_edit.tpl index eb0bb1eed..a0ab681fb 100644 --- a/view/tpl/profile_edit.tpl +++ b/view/tpl/profile_edit.tpl @@ -143,17 +143,10 @@ $sexual
- +
$lbl_pubdsc
-
- - -
$lbl_prvdsc
-
- -
-- cgit v1.2.3