fiche publique : photo et decos
authorPascal Corpet <pascal.corpet@m4x.org>
Wed, 2 Feb 2005 12:15:41 +0000 (12:15 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:28:01 +0000 (23:28 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-437

15 files changed:
ChangeLog
htdocs/fiche.php
htdocs/getphoto.php
include/profil/assign_deco.inc.php
include/profil/assign_general.inc.php
include/profil/get_deco.inc.php
include/profil/get_general.inc.php
include/profil/update_deco.inc.php
include/profil/update_general.inc.php
include/user.func.inc.php
templates/fiche.tpl
templates/profil/deco.tpl
templates/profil/general.tpl
upgrade/0.9.5/10_auth_user_quick.sql
upgrade/0.9.5/40_photo.sql [new file with mode: 0644]

index ac9cf0e..d853949 100644 (file)
--- 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
index 3c80478..ead3201 100644 (file)
@@ -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'] == ''
index 5283ecf..6e209ef 100644 (file)
@@ -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:
 ?>
index 47ba7f0..8b7191d 100644 (file)
@@ -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);
 
 ?>
index 1f6d572..f01379a 100644 (file)
@@ -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);
 ?>
index 0368f9f..083bbae 100644 (file)
@@ -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:
 ?>
index 21957c0..846dba4 100644 (file)
@@ -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 ?
index 330b130..4955c8d 100644 (file)
@@ -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:
 ?>
index 027fc37..f076dad 100644 (file)
@@ -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:
 ?>
index 8dae224..7960b69 100644 (file)
@@ -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,
index 5c5420b..a72d1a3 100644 (file)
@@ -97,8 +97,8 @@ function chgMainWinLoc( strPage ) {
       </div>
     </td>
     <td rowspan="4" id='photo'>
-      {min_auth level="cookie"}
       <img alt="Photo de {$x.forlife}" src="{$photo_url}" width="{$x.x}" height="{$x.y}" />
+      {min_auth level="cookie"}
       {if $x.section}<em class="intitule">Section : </em><span>{$x.section}</span><br />{/if}
       {if $x.binets_join}<em class="intitule">Binet(s) : </em><span>{$x.binets_join}</span><br />{/if}
       {if $x.gpxs_join}<em class="intitule">Groupe(s) X : </em><span>{$x.gpxs_join|smarty:nodefaults}</span><br />{/if}
@@ -160,7 +160,6 @@ function chgMainWinLoc( strPage ) {
     </td>
   </tr>
   {/if}
-  {min_auth level="cookie"}
   {if $x.medals}
   <tr>
     <td>
@@ -182,6 +181,7 @@ function chgMainWinLoc( strPage ) {
     </td>
   </tr>
   {/if}
+  {min_auth level="cookie"}
   {if $x.cv}
   <tr>
     <td>
index aa575d9..72dac3d 100644 (file)
       <td colspan="3" class="pflags">
         <table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
           <tr>
-            <td class="rouge">
-              <input type="checkbox" name="accesX" checked="checked" disabled="disabled" />
+            <td class="vert">
+              <input type="checkbox" name="medals_pub"{if $medals_pub eq 'public'} checked="checked"{/if} />
             </td>
             <td class="texte">
-              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
             </td>
           </tr>
         </table>
index a30be62..33b439e 100644 (file)
     </tr>
     <tr>
       <td class="col" colspan="3">
+        <table class="flags" cellspacing="0" summary="Flags">
+          <tr>
+            <td class="vert">
+              <input type="checkbox" name="photo_pub" {if $photo_pub eq 'public'}checked="checked" {/if}/>
+            </td>
+            <td class="texte">
+              site public
+            </td>
+          </tr>
+        </table>
         <table cellspacing="0" cellpadding="0" summary="Trombinoscope">
           <tr>
             <td class="dcold">
index 977932b..9830490 100644 (file)
@@ -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 (file)
index 0000000..ebb21fb
--- /dev/null
@@ -0,0 +1 @@
+ALTER TABLE photo ADD pub ENUM('purivate', 'public') DEFAULT 'private' NOT NULL;