From 24a9a41f969cfd7625847c77a949e4b279f68406 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 19 Dec 2010 17:46:26 -0800 Subject: [PATCH] added "secret" profile search keywords --- INSTALL | 1 + boot.php | 2 +- database.sql | 1 + mod/directory.php | 2 +- mod/profiles.php | 5 ++++- update.php | 4 ++++ view/en/profile_edit.tpl | 8 ++++++++ view/theme/default/style.css | 9 +++++++++ 8 files changed, 29 insertions(+), 3 deletions(-) diff --git a/INSTALL b/INSTALL index ceb73c3b9c..577f3f354c 100644 --- a/INSTALL +++ b/INSTALL @@ -23,6 +23,7 @@ encryption support - PHP *command line* access with register_argc_argv set to true in the php.ini file - curl, gd, mysql, and openssl extensions + - some form of email server or email gateway such that PHP mail() works - mcrypt (optional; used for end-to-end message encryption) - Mysql 5.x diff --git a/boot.php b/boot.php index 1870e059e9..329165ef8f 100644 --- a/boot.php +++ b/boot.php @@ -2,7 +2,7 @@ set_time_limit(0); -define ( 'BUILD_ID', 1024 ); +define ( 'BUILD_ID', 1025 ); define ( 'DFRN_PROTOCOL_VERSION', '2.0' ); define ( 'EOL', "
\r\n" ); diff --git a/database.sql b/database.sql index dab7c179d9..30edf4189b 100644 --- a/database.sql +++ b/database.sql @@ -292,6 +292,7 @@ CREATE TABLE IF NOT EXISTS `profile` ( `sexual` char(255) NOT NULL, `politic` char(255) NOT NULL, `religion` char(255) NOT NULL, + `keywords` text NOT NULL, `about` text NOT NULL, `summary` char(255) NOT NULL, `music` text NOT NULL, diff --git a/mod/directory.php b/mod/directory.php index e9bbf47ab7..449c89174d 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -37,7 +37,7 @@ function directory_content(&$a) { if($search) $search = dbesc($search); - $sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, `user`.`nickname`, `locality`,`region`,`country-name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`) AGAINST ('$search' IN BOOLEAN MODE) " : ""); + $sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, `user`.`nickname`, `locality`,`region`,`country-name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`,`keywords` ) AGAINST ('$search' IN BOOLEAN MODE) " : ""); $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `publish` = 1 AND `user`.`blocked` = 0 $sql_extra "); diff --git a/mod/profiles.php b/mod/profiles.php index e675af2e48..e99e0f288c 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -52,7 +52,7 @@ function profiles_post(&$a) { $region = notags(trim($_POST['region'])); $postal_code = notags(trim($_POST['postal_code'])); $country_name = notags(trim($_POST['country_name'])); - + $keywords = notags(trim($_POST['keywords'])); $marital = notags(trim($_POST['marital'])); if($marital != $orig[0]['marital']) $maritalchanged = true; @@ -138,6 +138,7 @@ function profiles_post(&$a) { `homepage` = '%s', `politic` = '%s', `religion` = '%s', + `keywords` = '%s', `about` = '%s', `interest` = '%s', `contact` = '%s', @@ -165,6 +166,7 @@ function profiles_post(&$a) { dbesc($homepage), dbesc($politic), dbesc($religion), + dbesc($keywords), dbesc($about), dbesc($interest), dbesc($contact), @@ -369,6 +371,7 @@ function profiles_content(&$a) { '$homepage' => $r[0]['homepage'], '$politic' => $r[0]['politic'], '$religion' => $r[0]['religion'], + '$keywords' => $r[0]['keywords'], '$music' => $r[0]['music'], '$book' => $r[0]['book'], '$tv' => $r[0]['tv'], diff --git a/update.php b/update.php index c5aa561946..382c83e5a0 100644 --- a/update.php +++ b/update.php @@ -243,3 +243,7 @@ function update_1023() { ADD `login_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `register_date` "); } +function update_1024() { + q("ALTER TABLE `profile` ADD `keywords` TEXT NOT NULL AFTER `religion` "); +} + diff --git a/view/en/profile_edit.tpl b/view/en/profile_edit.tpl index c5b24a88ac..ec6cf260a9 100644 --- a/view/en/profile_edit.tpl +++ b/view/en/profile_edit.tpl @@ -40,6 +40,7 @@ $gender
$dob $age
+
$hide_friends @@ -126,6 +127,13 @@ $sexual
+
+ + +
(Used for searching public profiles, never shown to others)
+
+ +
diff --git a/view/theme/default/style.css b/view/theme/default/style.css index 491486794f..627915e643 100644 --- a/view/theme/default/style.css +++ b/view/theme/default/style.css @@ -720,6 +720,7 @@ input#dfrn-url { #profile-edit-sexual-label, #profile-edit-politic-label, #profile-edit-religion-label, +#profile-edit-keywords-label, #profile-edit-homepage-label { float: left; width: 175px; @@ -738,6 +739,7 @@ input#dfrn-url { #sexual-select, #profile-edit-politic, #profile-edit-religion, +#profile-edit-keywords, #profile-in-dir-yes, #profile-in-dir-no, #profile-in-netdir-yes, @@ -768,6 +770,12 @@ input#dfrn-url { margin-left: 20px; } +#profile-edit-keywords-desc { + float: left; + margin-left: 20px; +} + + #profile-edit-homepage { float: left; margin-bottom: 35px; @@ -800,6 +808,7 @@ input#dfrn-url { #profile-edit-sexual-end, #profile-edit-politic-end, #profile-edit-religion-end, +#profile-edit-keywords-end, #profile-edit-homepage-end, #profile-in-dir-break, #profile-in-dir-end,