git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-414
$schoolField = new RefSField('school',array('as.aid'),'applis_ins','`as`','u.user_id=as.uid');
$diplomaField = new RefSField('diploma',array('ad.type'),'applis_ins','ad','u.user_id=ad.uid');
- $freeField = new RefSField('free',array('u.libre'),'','','',false);
+ $freeField = new RefSField('free',array('q.profile_freetext'),'','','',false);
$offset = new NumericSField('offset');
$fields = new SFieldGroup(true, array( $nameField, $firstnameField, $nicknameField, $promo1Field,
}
$new_tab = Env::has('suivant') ? get_next_tab($opened_tab) : $opened_tab;
-// pour tous les tabs, on recupere les bits car on a besoin de tous les bits pour en mettre a jour un, la date d naissance pour verifier
+// pour tous les tabs, la date de naissance pour verifier
// quelle est bien rentree et la date.
$res = $globals->xdb->query(
- "SELECT FIND_IN_SET('mobile_public', bits), FIND_IN_SET('mobile_ax', bits),
- FIND_IN_SET('web_public', bits), FIND_IN_SET('libre_public', bits),
- naissance, DATE_FORMAT(date,'%d.%m.%Y')
+ "SELECT naissance, DATE_FORMAT(date,'%d.%m.%Y')
FROM auth_user_md5
WHERE user_id={?}", Session::getInt('uid'));
-list($mobile_public, $mobile_ax,$web_public, $libre_public, $naissance, $date_modif_profil) = $res->fetchOneRow();
+list($naissance, $date_modif_profil) = $res->fetchOneRow();
// lorsqu'on n'a pas la date de naissance en base de données
if (!$naissance) {
*/
$globals->xdb->execute('REPLACE INTO user_changes SET user_id={?}', Session::getInt('uid'));
- //Mise a jour des bits
- // bits : set('mobile_public','mobile_ax','web_public','libre_public')
- $bits_reply = "";
- if ($mobile_public) $bits_reply .= 'mobile_public,';
- if ($mobile_ax) $bits_reply .= 'mobile_ax,';
- if ($web_public) $bits_reply .= 'web_public,';
- if ($libre_public) $bits_reply .= 'libre_public,';
- if (!empty($bits_reply)) $bits_reply = substr($bits_reply, 0, -1);
- $globals->xdb->execute('UPDATE auth_user_md5 set bits={?} WHERE user_id={?}', $bits_reply, Session::getInt('uid'));
-
if (!Session::has('suid')) {
require_once('notifs.inc.php');
register_watch_op(Session::getInt('uid'), WATCH_FICHE);
$page->assign('onglet_tpl',"profil/$new_tab.tpl");
$page->run();
+// vim:set et sws=4 sw=4 sts=4:
?>
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-$page->assign('mobile_public',$mobile_public);
-$page->assign('mobile_ax',$mobile_ax);
-$page->assign('libre_public',$libre_public);
-$page->assign('web_public',$web_public);
+$page->assign('mobile_pub',$mobile_pub);
+$page->assign('web_pub',$web_pub);
+$page->assign('freetext_pub',$freetext_pub);
$page->assign('nom', $nom);
$page->assign('prenom', $prenom);
$page->assign('web',$web);
-$page->assign('libre',$libre);
+$page->assign('freetext',$freetext);
$page->assign('appli_id1',$appli_id1);
$page->assign('appli_id2',$appli_id2);
$page->assign('appli_type2',$appli_type2);
$page->assign('nouvellephoto', $nouvellephoto);
-$page->assign('surnom', $surnom);
+$page->assign('nickname', $nickname);
?>
***************************************************************************/
// on ramène les données du profil connecté (uid paramètre de session)
-$sql = "SELECT u.nom, u.prenom, u.promo, u.epouse, FIND_IN_SET('femme',u.flags), u.nationalite, u.mobile, u.web, u.libre,
- q.profile_nick,
+$sql = "SELECT u.nom, u.prenom, u.promo, u.epouse, FIND_IN_SET('femme',u.flags), u.nationalite,
+ q.profile_mobile, q.profile_mobile_pub, q.profile_web, q.profile_web_pub, q.profile_freetext, q.profile_freetext_pub, q.profile_nick,
a1.aid, a1.type, a2.aid, a2.type
FROM auth_user_md5 AS u
INNER JOIN auth_user_quick AS q USING(user_id)
WHERE u.user_id = {?}";
$result = $globals->xdb->query($sql, Session::getInt('uid', -1));
-list($nom, $prenom, $promo, $epouse, $femme,
- $nationalite, $mobile, $web, $libre, $surnom,
+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();
replace_ifset($nationalite,'nationalite');
replace_ifset($mobile,'mobile');
replace_ifset($web,"web");
-replace_ifset($libre,"libre");
+replace_ifset($freetext,"freetext");
replace_ifset($appli_id1,"appli_id1");
replace_ifset($appli_id2,"appli_id2");
replace_ifset($appli_type1,"appli_type1");
replace_ifset($appli_type2,"appli_type2");
-replace_ifset($surnom,"surnom");
+replace_ifset($nickname,"nickname");
if(Env::has('modifier') || Env::has('suivant')) {
- $mobile_public = Env::has('mobile_public');
- $mobile_ax = Env::has('mobile_ax');
- $libre_public = Env::has('libre_public');
- $web_public = Env::has('web_public');
+ $mobile_pub = Env::get('mobile_pub');
+ $web_pub = Env::has('web_pub')?'public':'private';
+ $freetext_pub = Env::has('freetext_pub')?'public':'private';
}
// Y a-t-il une photo en attente de confirmation ?
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= {?}, web= {?}, mobile= {?}, libre= {?} WHERE user_id= {?}";
-$globals->xdb->execute($sql, $nationalite, $web, $mobile, $libre, Session::getInt('uid', -1));
-$globals->xdb->execute("UPDATE auth_user_quick SET profile_nick={?} WHERE user_id = {?}", $surnom, Session::getInt('uid', -1));
+ 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));
+// vim:set et sws=4 sts=4 sw=4:
?>
}
//validité du champ libre
-if (strlen(strtok($libre,"<>")) < strlen($libre))
+if (strlen(strtok($freetext,"<>")) < strlen($freetext))
{
$page->trig("Le champ 'Complément libre' contient un caractère interdit.");
}
function &get_user_details($login, $from_uid = '')
{
global $globals;
- $reqsql = "SELECT u.user_id, u.promo, u.prenom, u.nom, u.epouse, u.date, u.cv, u.mobile, u.web, u.libre,
+ $reqsql = "SELECT u.user_id, u.promo, u.prenom, u.nom, u.epouse, u.date, u.cv,
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_nick AS nickname, q.profile_from_ax, q.profile_mobile AS mobile, q.profile_web AS web, q.profile_freetext AS freetext,
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,
{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}
{if $x.web}<em class="intitule">Site Web : </em><a href="{$x.web}" class='popup'>{$x.web}</a>{/if}
- {if $x.libre}<br /><em class="intitule">Commentaires : </em><br /><span>{$x.libre|nl2br}</span>{/if}
+ {if $x.freetext}<br /><em class="intitule">Commentaires : </em><br /><span>{$x.freetext|nl2br}</span>{/if}
</td>
</tr>
{if $x.adr}
<span class="titre">Surnom</span>
</td>
<td class="cold">
- <input type="text" size="35" maxlength="64" name="surnom" value="{$surnom}" />
+ <input type="text" size="35" maxlength="64" name="nickname" value="{$nickname}" />
</td>
</tr>
<tr>
<table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
<tr>
<td class="vert">
- <input type="checkbox" name="mobile_public" {if $mobile_public}checked="checked"{/if} />
+ <input type="radio" name="mobile_pub" {if $mobile_pub eq 'public'}checked="checked"{/if} value='public' />
</td>
<td class="texte">
site public
</td>
<td class="orange">
- <input type="checkbox" name="mobile_ax" {if $mobile_ax}checked="checked"{/if} />
+ <input type="radio" name="mobile_pub" {if $mobile_pub eq 'ax'}checked="checked"{/if} value='ax' />
</td>
<td class="texte">
transmis à l'AX
</td>
+ <td class="rouge">
+ <input type="radio" name="mobile_pub" {if $mobile_pub eq 'private'}checked="checked"{/if} value='private' />
+ </td>
+ <td class="texte">
+ privé
+ </td>
<td class="texte">
<a href="{"docs/faq.php"|url}#flags" class="popup_800x240">Quelle couleur ??</a>
</td>
<table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
<tr>
<td class="vert">
- <input type="checkbox" name="web_public" {if $web_public}checked="checked"{/if} />
+ <input type="checkbox" name="web_pub" {if $web_pub eq 'public'}checked="checked"{/if} />
</td>
<td class="texte">
site public
<table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
<tr>
<td class="vert">
- <input type="checkbox" name="libre_public" {if $libre_public}checked="checked"{/if} />
+ <input type="checkbox" name="freetext_pub" {if $freetext_pub eq 'public'}checked="checked"{/if} />
</td>
<td class="texte">
site public
<span class="comm">Commentaire? ICQ? etc...</span>
</td>
<td class="dcold">
- <textarea name="libre" rows="3" cols="29" >{$libre}</textarea>
+ <textarea name="freetext" rows="3" cols="29" >{$freetext}</textarea>
</td>
</tr>
</table>
--- /dev/null
+ALTER TABLE auth_user_quick
+ADD profile_mobile VARCHAR(20) NOT NULL,
+ADD profile_mobile_pub ENUM('private', 'ax', 'public') DEFAULT 'private' NOT NULL,
+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;
+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')),
+q.profile_web = u.web,
+q.profile_web_pub = IF(FIND_IN_SET('web_public', u.bits), 'public', 'private'),
+q.profile_freetext = u.libre,
+q.profile_freetext_pub = IF(FIND_IN_SET('libre_public', u.bits), 'public', 'private');
+ALTER TABLE auth_user_md5 DROP mobile, DROP web, DROP libre, CHANGE bits bits SET('mail_ax') NOT NULL;
--- /dev/null
+#!/bin/bash
+
+. ../inc/pervasive.sh
+
+mailman_stop
+mailman_templates
+mailman_start
+
+
+###########################################################
+for sql in *.sql
+do
+ echo -n $sql
+ $MYSQL x4dat < $sql &>/dev/null || echo -n " ERROR"
+ echo .
+done
+
+###########################################################
+