From 1052148d9dd86eb14e50baabad6a04e0d49fe140 Mon Sep 17 00:00:00 2001 From: Guillaume Bandet Date: Tue, 10 Jun 2008 15:04:08 +0200 Subject: [PATCH] Removes references to old user web URL --- bin/cron/checkdb.php | 4 ++-- include/notifs.inc.php | 2 +- include/profil.func.inc.php | 2 -- include/user.func.inc.php | 12 +++--------- modules/profile/general.inc.php | 10 +++------- modules/search/classes.inc.php | 2 -- templates/core/vcard.tpl | 6 ++++-- templates/profile/general.tpl | 3 +-- upgrade/fusionax-0.0.1/02_networking.sql | 19 ++++++++++++++++++- 9 files changed, 32 insertions(+), 28 deletions(-) diff --git a/bin/cron/checkdb.php b/bin/cron/checkdb.php index f32ad00..818cf2a 100755 --- a/bin/cron/checkdb.php +++ b/bin/cron/checkdb.php @@ -73,17 +73,17 @@ if ( PEAR::isError($opts) ) { /* Validite des flags de transmission */ check("SELECT u.user_id, nom, prenom, promo, - profile_mobile_pub, emails_alias_pub, profile_web_pub, profile_freetext_pub, profile_medals_pub + profile_mobile_pub, emails_alias_pub, profile_freetext_pub, profile_medals_pub FROM auth_user_md5 AS u INNER JOIN auth_user_quick AS q USING(user_id) WHERE (profile_mobile_pub != 'private' AND profile_mobile_pub != 'ax' AND profile_mobile_pub != 'public') OR (emails_alias_pub != 'private' AND emails_alias_pub != 'public') - OR (profile_web_pub != 'private' AND profile_web_pub != 'public') OR (profile_freetext_pub != 'private' AND profile_freetext_pub != 'public') OR (profile_medals_pub != 'private' AND profile_medals_pub != 'public')", "Utilisateur n'ayant pas de flag de publicite pour leurs donnees de profil"); check("select uid from adresses where pub != 'private' and pub !='ax' and pub != 'public'", "Utiliseur n'ayant pas de flag de publicite pour une adresse"); check("select uid from tels where tel_pub != 'private' and tel_pub !='ax' and tel_pub != 'public'", "Utiliseur n'ayant pas de flag de publicite pour un numero de telephone"); +check("select uid from profile_networking where pub != 'private' and pub != 'public'", "Utiliseur n'ayant pas de flag de publicité pour une adresse de networking"); /* validite de aliases */ check("SELECT a.* diff --git a/include/notifs.inc.php b/include/notifs.inc.php index 0bcf655..9466aa7 100644 --- a/include/notifs.inc.php +++ b/include/notifs.inc.php @@ -144,7 +144,7 @@ $prf_desc = array('nom' => 'Son patronyme', 'mobile' => 'Son numéro de téléphone portable', 'nationalite' => 'Sa nationalité', 'nick' => 'Son surnom', - 'web' => 'L\'adresse de son site web', + 'networking' => 'La liste de ses adresses de networking', 'appli1' => 'Son école d\'application', 'appli2' => 'Son école de post-application', 'addresses' => 'Ses adresses', diff --git a/include/profil.func.inc.php b/include/profil.func.inc.php index 8a5edbf..40fa9c6 100644 --- a/include/profil.func.inc.php +++ b/include/profil.func.inc.php @@ -70,8 +70,6 @@ function diff_user_details(&$a, &$b, $view = 'private') { // compute $c = $a - $ // don't modify mobile if you don't have the right if (isset($b['mobile_pub']) && !has_user_right($b['mobile_pub'], $view) && isset($c['mobile'])) unset($c['mobile']); - if (isset($b['web_pub']) && !has_user_right($b['web_pub'], $view) && isset($c['web'])) - unset($c['web']); if (isset($b['freetext_pub']) && !has_user_right($b['freetext_pub'], $view) && isset($c['freetext'])) unset($c['freetext']); if (!count($c)) diff --git a/include/user.func.inc.php b/include/user.func.inc.php index c05aabb..4ff11ca 100644 --- a/include/user.func.inc.php +++ b/include/user.func.inc.php @@ -390,8 +390,8 @@ function &get_user_details($login, $from_uid = '', $view = 'private') { $reqsql = "SELECT u.user_id, u.promo, u.promo_sortie, u.prenom, u.nom, u.nom_usage, u.date, u.cv, u.perms IN ('admin','user','disabled') AS inscrit, FIND_IN_SET('femme', u.flags) AS sexe, u.deces != 0 AS dcd, u.deces, - q.profile_nick AS nickname, q.profile_from_ax, q.profile_mobile AS mobile, q.profile_web AS web, q.profile_freetext AS freetext, - q.profile_mobile_pub AS mobile_pub, q.profile_web_pub AS web_pub, q.profile_freetext_pub AS freetext_pub, + q.profile_nick AS nickname, q.profile_from_ax, q.profile_mobile AS mobile, q.profile_freetext AS freetext, + q.profile_mobile_pub AS mobile_pub, q.profile_freetext_pub AS freetext_pub, q.profile_medals_pub AS medals_pub, IF(gp.nat='',gp.pays,gp.nat) AS nationalite, gp.a2 AS iso3166, a.alias AS forlife, a2.alias AS bestalias, @@ -429,13 +429,7 @@ function &get_user_details($login, $from_uid = '', $view = 'private') else $user['mobile'] = ''; } - // hide web - if (!has_user_right($user['web_pub'], $view)) { - if ($user['web'] == '') - $user['web_pub'] = $view; - else - $user['web'] = ''; - } + // hide freetext if (!has_user_right($user['freetext_pub'], $view)) { if ($user['freetext'] == '') diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php index 87b1707..066eac6 100644 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@ -191,7 +191,6 @@ class ProfileGeneral extends ProfilePage = new ProfileNom(); $this->settings['naissance'] = new ProfileDate(); $this->settings['mobile_pub'] - = $this->settings['web_pub'] = $this->settings['freetext_pub'] = $this->settings['photo_pub'] = new ProfilePub(); @@ -206,12 +205,11 @@ class ProfileGeneral extends ProfilePage $this->settings['synchro_ax'] = new ProfileBool(); $this->settings['mobile'] = new ProfileTel(); - $this->settings['web'] = new ProfileWeb(); $this->settings['networking'] = new ProfileNetworking(); $this->settings['appli1'] = $this->settings['appli2'] = new ProfileAppli(); - $this->watched= array('nom' => true, 'freetext' => true, 'mobile' => true, 'web' => true, + $this->watched= array('nom' => true, 'freetext' => true, 'mobile' => true, 'networking' => true, 'appli1' => true, 'appli2' => true, 'nationalite' => true, 'nick' => true); } @@ -220,7 +218,6 @@ class ProfileGeneral extends ProfilePage // Checkout all data... $res = XDB::query("SELECT u.promo, u.promo_sortie, u.nom_usage, u.nationalite, u.naissance, q.profile_mobile as mobile, q.profile_mobile_pub as mobile_pub, - q.profile_web as web, q.profile_web_pub as web_pub, q.profile_freetext as freetext, q.profile_freetext_pub as freetext_pub, q.profile_nick as nick, q.profile_from_ax as synchro_ax, u.matricule_ax, IF(a1.aid IS NULL, -1, a1.aid) as appli_id1, a1.type as appli_type1, @@ -278,15 +275,14 @@ class ProfileGeneral extends ProfilePage S::v('uid')); } if ($this->changed['nick'] || $this->changed['mobile'] || $this->changed['mobile_pub'] - || $this->changed['web'] || $this->changed['web_pub'] || $this->changed['freetext'] + || $this->changed['freetext'] || $this->changed['freetext_pub'] || $this->changed['synchro_ax']) { XDB::execute("UPDATE auth_user_quick SET profile_nick= {?}, profile_mobile={?}, profile_mobile_pub={?}, - profile_web={?}, profile_web_pub={?}, profile_freetext={?}, + profile_freetext={?}, profile_freetext_pub={?}, profile_from_ax = {?} WHERE user_id = {?}", $this->values['nick'], $this->values['mobile'], $this->values['mobile_pub'], - $this->values['web'], $this->values['web_pub'], $this->values['freetext'], $this->values['freetext_pub'], $this->values['synchro_ax'], S::v('uid')); } diff --git a/modules/search/classes.inc.php b/modules/search/classes.inc.php index 5ef9fd6..abb6e54 100644 --- a/modules/search/classes.inc.php +++ b/modules/search/classes.inc.php @@ -40,7 +40,6 @@ require_once("xorg.misc.inc.php"); // hide private information if not logged if (S::logged()) $globals->search->result_fields .=' - q.profile_web AS web, q.profile_mobile AS mobile, q.profile_freetext AS freetext, adr.city, gp.pays AS countrytxt, gr.name AS region, @@ -49,7 +48,6 @@ if (S::logged()) nwe.name AS networking_name,'; else $globals->search->result_fields .=" - IF(q.profile_web_pub='public', q.profile_web, '') AS web, IF(q.profile_mobile_pub='public', q.profile_mobile, '') AS mobile, IF(q.profile_freetext_pub='public', q.profile_freetext, '') AS freetext, IF(adr.pub='public', adr.city, '') AS city, diff --git a/templates/core/vcard.tpl b/templates/core/vcard.tpl index c3e3097..f6bef39 100644 --- a/templates/core/vcard.tpl +++ b/templates/core/vcard.tpl @@ -69,9 +69,11 @@ ADR;TYPE=home{if $adr.courier},postal{/if}:{format_adr adr=$adr} {/if} {/foreach} {/foreach} -{if $vcard.web} -URL:{$vcard.web} +{foreach from=$vcard.networking item=nw} +{if $nw.filter eq 'web'} +URL:{$nw.address} {/if} +{/foreach} {if strlen(trim($vcard.freetext)) == 0} NOTE:(X{$vcard.promo}) {else} diff --git a/templates/profile/general.tpl b/templates/profile/general.tpl index 1cbf27f..1128ae3 100644 --- a/templates/profile/general.tpl +++ b/templates/profile/general.tpl @@ -327,8 +327,7 @@ pour les premières lettres : Alfred de Musset" width {icon name="flag_green" title="site public"}   - Complément libre
- Commentaire ? ICQ ? etc... + Commentaire
diff --git a/upgrade/fusionax-0.0.1/02_networking.sql b/upgrade/fusionax-0.0.1/02_networking.sql index cf368ff..0da8e66 100644 --- a/upgrade/fusionax-0.0.1/02_networking.sql +++ b/upgrade/fusionax-0.0.1/02_networking.sql @@ -15,7 +15,7 @@ CREATE TABLE IF NOT EXISTS `profile_networking` ( PRIMARY KEY (`uid`, `nwid`) ) CHARSET=utf8 COMMENT='networking addresses'; - +-- Insert a first address type for old URLs INSERT INTO `profile_networking_enum` (`network_type`, `name`, `icon`, `filter`) VALUES (0, 'Page web', 'web.gif', 'web'); @@ -24,3 +24,20 @@ INSERT INTO `profile_networking` (`uid`, `nwid`, `network_type`, `address`, `pub FROM `auth_user_quick` WHERE `profile_web` <> ""; +-- Modify watch_profile to update 'field' from web to networking +ALTER TABLE `watch_profile` + MODIFY `field` enum('nom', 'freetext', 'mobile', 'nationalite', 'nick', + 'web', 'networking', 'appli1', 'appli2', 'addresses', + 'section', 'binets', 'medals', 'cv', 'jobs', 'photo'); + +UPDATE `watch_profile` SET `field` = 'networking' WHERE `field` = 'web'; + +ALTER TABLE `watch_profile` + MODIFY `field` enum('nom', 'freetext', 'mobile', 'nationalite', 'nick', + 'networking', 'appli1', 'appli2', 'addresses', + 'section', 'binets', 'medals', 'cv', 'jobs', 'photo'); + +-- Drop old web URL columns +ALTER TABLE `auth_user_quick` DROP COLUMN `profile_web`; +ALTER TABLE `auth_user_quick` DROP COLUMN `profile_web_pub`; + -- 2.1.4