From: Pascal Corpet Date: Wed, 2 Feb 2005 12:15:41 +0000 (+0000) Subject: fiche publique : photo et decos X-Git-Tag: xorg/old~322 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=fb7bfebaca2dc5599d10dacbc535b0eaf2a87846;p=platal.git fiche publique : photo et decos git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-437 --- diff --git a/ChangeLog b/ChangeLog index ac9cf0e..d853949 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,15 @@ VERSION 0.9.5 24 Jan 2004 New : + * Fiche : + - A public fiche is now available for visiters. -Car + + * Profile : + - One can choose precisely which fields appear on his public fiche. -Car + + * Search : + - Public searches display more information. -Car + Bug/Wish : - #270: private/public flags are now used for search. -Car diff --git a/htdocs/fiche.php b/htdocs/fiche.php index 3c80478..ead3201 100644 --- a/htdocs/fiche.php +++ b/htdocs/fiche.php @@ -124,6 +124,9 @@ if (!logged()) { } } } + if ($user['medals_pub'] != 'public') { + unset($user['medals']); + } } foreach($user['adr_pro'] as $i=>$pro) { if ($pro['entreprise'] == '' && $pro['fonction'] == '' diff --git a/htdocs/getphoto.php b/htdocs/getphoto.php index 5283ecf..6e209ef 100644 --- a/htdocs/getphoto.php +++ b/htdocs/getphoto.php @@ -24,20 +24,22 @@ require_once('xorg.inc.php'); new_skinned_page('login.tpl', AUTH_PUBLIC); if (Env::has('x')) { - if (Env::get('req') == "true") { + + $res = $globals->xdb->query("SELECT id, pub FROM aliases INNER JOIN photo ON(id=uid) WHERE alias = {?}", Env::get('x')); + list($uid, $photo_pub) = $res->fetchOneRow(); + + if (Env::get('req') == "true" && logged()) { include 'validations.inc.php'; - $res = $globals->xdb->query("SELECT id FROM aliases WHERE alias = {?}", Env::get('x')); - $myphoto = PhotoReq::get_request($a = $res->fetchOneCell()); + $myphoto = PhotoReq::get_request($uid); Header('Content-type: image/'.$myphoto->mimetype); echo $myphoto->data; } else { $res = $globals->xdb->query( "SELECT attachmime, attach - FROM photo AS p - INNER JOIN aliases AS a ON p.uid=a.id - WHERE alias={?}", Env::get('x')); + FROM photo + WHERE uid={?}", $uid); - if( list($type,$data) = $res->fetchOneRow() ) { + if( (list($type,$data) = $res->fetchOneRow()) && ($photo_pub == 'public' || logged()) ) { Header( "Content-type: image/$type"); echo $data; } else { @@ -46,4 +48,6 @@ if (Env::has('x')) { } } } + +// vim:set et sws=4 sw=4 sts=4: ?> diff --git a/include/profil/assign_deco.inc.php b/include/profil/assign_deco.inc.php index 47ba7f0..8b7191d 100644 --- a/include/profil/assign_deco.inc.php +++ b/include/profil/assign_deco.inc.php @@ -38,6 +38,7 @@ $trad = Array('ordre' => 'Ordres ...', 'croix' => 'Croix ...', 'militaire' => 'M $page->gassign('grades'); $page->gassign('medals'); $page->gassign('trad'); +$page->assign('medals_pub', $medals_pub); $page->assign('medal_list', $mlist); ?> diff --git a/include/profil/assign_general.inc.php b/include/profil/assign_general.inc.php index 1f6d572..f01379a 100644 --- a/include/profil/assign_general.inc.php +++ b/include/profil/assign_general.inc.php @@ -42,6 +42,7 @@ $page->assign('appli_id2',$appli_id2); $page->assign('appli_type1',$appli_type1); $page->assign('appli_type2',$appli_type2); +$page->assign('photo_pub',$photo_pub); $page->assign('nouvellephoto', $nouvellephoto); $page->assign('nickname', $nickname); ?> diff --git a/include/profil/get_deco.inc.php b/include/profil/get_deco.inc.php index 0368f9f..083bbae 100644 --- a/include/profil/get_deco.inc.php +++ b/include/profil/get_deco.inc.php @@ -42,4 +42,11 @@ $res = $globals->xdb->query( $medals = $res->fetchAllAssoc(); +$res = $globals->xdb->query("SELECT profile_medals_pub FROM auth_user_quick WHERE user_id = {?}", Session::getInt('uid', -1)); +$medals_pub = $res->fetchOneCell(); + +if(Env::has('modifier') || Env::has('suivant')) { + $medals_pub = Env::has('medals_pub')?'public':'private'; +} +// vim:set et sws=4 sw=4 sts=4: ?> diff --git a/include/profil/get_general.inc.php b/include/profil/get_general.inc.php index 21957c0..846dba4 100644 --- a/include/profil/get_general.inc.php +++ b/include/profil/get_general.inc.php @@ -34,6 +34,9 @@ list($nom, $prenom, $promo, $epouse, $femme, $nationalite, $mobile, $mobile_pub, $web, $web_pub, $freetext, $freetext_pub, $nickname, $appli_id1,$appli_type1, $appli_id2,$appli_type2) = $result->fetchOneRow(); +$result = $globals->xdb->query("SELECT pub FROM photo WHERE uid = {?}", Session::getInt('uid', -1)); +$photo_pub = $result->fetchOneCell(); + replace_ifset($nationalite,'nationalite'); replace_ifset($mobile,'mobile'); replace_ifset($web,"web"); @@ -48,6 +51,7 @@ if(Env::has('modifier') || Env::has('suivant')) { $mobile_pub = Env::get('mobile_pub'); $web_pub = Env::has('web_pub')?'public':'private'; $freetext_pub = Env::has('freetext_pub')?'public':'private'; + $photo_pub = Env::has('photo_pub')?'public':'private'; } // Y a-t-il une photo en attente de confirmation ? diff --git a/include/profil/update_deco.inc.php b/include/profil/update_deco.inc.php index 330b130..4955c8d 100644 --- a/include/profil/update_deco.inc.php +++ b/include/profil/update_deco.inc.php @@ -19,4 +19,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ +$globals->xdb->execute("UPDATE auth_user_quick SET profile_medals_pub = {?} WHERE user_id = {?}", $medals_pub, Session::getInt('uid', -1)); + +// vim:set et sws=4 sw=4 sts=4: ?> diff --git a/include/profil/update_general.inc.php b/include/profil/update_general.inc.php index 027fc37..f076dad 100644 --- a/include/profil/update_general.inc.php +++ b/include/profil/update_general.inc.php @@ -29,13 +29,22 @@ if ($appli_id2>0) else $globals->xdb->execute("DELETE FROM applis_ins WHERE uid= {?} AND ordre=1", Session::getInt('uid', -1)); -$globals->xdb->execute('UPDATE auth_user_quick SET profile_mobile_pub = {?}, profile_web_pub = {?}, profile_freetext_pub = {?} WHERE user_id = {?}', - $mobile_pub, $web_pub, $freetext_pub, Session::getInt('uid', -1)); - $sql = "UPDATE auth_user_md5 SET nationalite= {?} WHERE user_id= {?}"; $globals->xdb->execute($sql, $nationalite, Session::getInt('uid', -1)); -$globals->xdb->execute("UPDATE auth_user_quick SET profile_nick={?}, profile_mobile={?}, profile_web={?}, profile_freetext={?} WHERE user_id = {?}", $nickname, $mobile, $web, $freetext, Session::getInt('uid', -1)); +$globals->xdb->execute( + "UPDATE auth_user_quick SET + profile_nick={?}, + profile_mobile={?}, profile_mobile_pub={?}, + profile_web={?}, profile_web_pub={?}, + profile_freetext={?} profile_freetext_pub={?} + WHERE user_id = {?}", + $nickname, + $mobile, $mobile_pub, + $web, $web_pub, + $freetext, $freetext_pub, + Session::getInt('uid', -1)); +$globals->xdb->execute("UPDATE photo SET pub = {?} WHERE uid = {?}", $photo_pub, Session::getInt('uid', -1)); // vim:set et sws=4 sts=4 sw=4: ?> diff --git a/include/user.func.inc.php b/include/user.func.inc.php index 8dae224..7960b69 100644 --- a/include/user.func.inc.php +++ b/include/user.func.inc.php @@ -159,6 +159,7 @@ function &get_user_details($login, $from_uid = '') u.perms IN ('admin','user') 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_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, c.uid IS NOT NULL AS is_contact, diff --git a/templates/fiche.tpl b/templates/fiche.tpl index 5c5420b..a72d1a3 100644 --- a/templates/fiche.tpl +++ b/templates/fiche.tpl @@ -97,8 +97,8 @@ function chgMainWinLoc( strPage ) { - {min_auth level="cookie"} Photo de {$x.forlife} + {min_auth level="cookie"} {if $x.section}Section : {$x.section}
{/if} {if $x.binets_join}Binet(s) : {$x.binets_join}
{/if} {if $x.gpxs_join}Groupe(s) X : {$x.gpxs_join|smarty:nodefaults}
{/if} @@ -160,7 +160,6 @@ function chgMainWinLoc( strPage ) { {/if} - {min_auth level="cookie"} {if $x.medals} @@ -182,6 +181,7 @@ function chgMainWinLoc( strPage ) { {/if} + {min_auth level="cookie"} {if $x.cv} diff --git a/templates/profil/deco.tpl b/templates/profil/deco.tpl index aa575d9..72dac3d 100644 --- a/templates/profil/deco.tpl +++ b/templates/profil/deco.tpl @@ -52,11 +52,11 @@ -
- + + - ne peut être ni public ni transmis à l'AX + ces informations sont normalement publiques (JO, ...) mais tu peux choisir de les associer a ta fiche publique
diff --git a/templates/profil/general.tpl b/templates/profil/general.tpl index a30be62..33b439e 100644 --- a/templates/profil/general.tpl +++ b/templates/profil/general.tpl @@ -138,6 +138,16 @@ + + + + + +
+ + + site public +
diff --git a/upgrade/0.9.5/10_auth_user_quick.sql b/upgrade/0.9.5/10_auth_user_quick.sql index 977932b..9830490 100644 --- a/upgrade/0.9.5/10_auth_user_quick.sql +++ b/upgrade/0.9.5/10_auth_user_quick.sql @@ -4,7 +4,8 @@ ADD profile_mobile_pub ENUM('private', 'ax', 'public') DEFAULT 'private' NOT NUL ADD profile_web VARCHAR(255) NOT NULL, ADD profile_web_pub ENUM('private', 'public') DEFAULT 'private' NOT NULL, ADD profile_freetext VARCHAR(255) NOT NULL, -ADD profile_freetext_pub ENUM('private', 'public') DEFAULT 'private' NOT NULL; +ADD profile_freetext_pub ENUM('private', 'public') DEFAULT 'private' NOT NULL, +ADD profile_medals_pub ENUM('private', 'public') DEFAULT 'private' NOT NULL; UPDATE auth_user_quick AS q INNER JOIN auth_user_md5 AS u USING(user_id) SET q.profile_mobile = u.mobile, q.profile_mobile_pub = IF(FIND_IN_SET('mobile_public', u.bits), 'public', IF(FIND_IN_SET('mobile_ax', u.bits), 'ax', 'private')), diff --git a/upgrade/0.9.5/40_photo.sql b/upgrade/0.9.5/40_photo.sql new file mode 100644 index 0000000..ebb21fb --- /dev/null +++ b/upgrade/0.9.5/40_photo.sql @@ -0,0 +1 @@ +ALTER TABLE photo ADD pub ENUM('purivate', 'public') DEFAULT 'private' NOT NULL;