From 386f155e0882a689a57c6045db565e22b0f50e2b Mon Sep 17 00:00:00 2001
From: x2000habouzit
Date: Mon, 26 Jan 2004 12:36:31 +0000
Subject: [PATCH] =?utf8?q?GROS=20COMMIT=20dans=20le=20d=E9sordre=20:=20=20?=
=?utf8?q?*=20modif=20skin=20=20*=20codage=20complet=20de=20login.php/tpl?=
=?utf8?q?=20=20*=20fixes=20dans=20la=20proc=E9dure=20de=20gestion=20de=20?=
=?utf8?q?l'auth=20=20*=20...?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
---
htdocs/css/default.css | 4 +-
htdocs/index.php | 2 +
htdocs/login.php | 77 ++++++++++++++++++++++-
include/auto.prepend.inc.php | 1 +
include/xorg.page.inc.php | 16 ++---
include/xorg.session.inc.php | 15 +----
templates/deconnexion.tpl | 4 ++
templates/form_naissance.tpl | 40 ++++++++++++
templates/index.head.tpl | 3 +-
templates/index.tpl | 5 +-
templates/login.head.tpl | 14 +++++
templates/login.tpl | 101 ++++++++++++++++++++++++++++++
templates/password_prompt.head.tpl | 4 ++
templates/password_prompt.tpl | 3 +
templates/password_prompt_logged.head.tpl | 4 ++
templates/password_prompt_logged.tpl | 10 ++-
templates/skin/common.bandeau.head.tpl | 5 +-
templates/skin/common.bandeau.tpl | 5 +-
templates/skin/common.footer.tpl | 4 +-
templates/skin/common.header.tpl | 5 +-
templates/skin/default.tpl | 5 +-
21 files changed, 287 insertions(+), 40 deletions(-)
create mode 100644 templates/form_naissance.tpl
create mode 100644 templates/login.head.tpl
create mode 100644 templates/login.tpl
diff --git a/htdocs/css/default.css b/htdocs/css/default.css
index c95417c..a85e8d2 100644
--- a/htdocs/css/default.css
+++ b/htdocs/css/default.css
@@ -56,6 +56,7 @@ table.bicol {
color: inherit;
border: 1px solid #336699;
border-collapse: collapse;
+ width: 98%;
}
table.bicol tr.impair {}
table.bicol tr.pair {
@@ -103,6 +104,7 @@ table.bicol td.bouton { text-align: right; }
border-right: 1px solid gray;
text-align: center;
font-family: "MS Sans Serif", sans-serif;
+ padding-top: 4px;
}
#body-top {
@@ -153,6 +155,6 @@ table.bicol td.bouton { text-align: right; }
#content {
width: 600px;
- padding: 4px 10px 4px 10px;
+ padding: 4px 0px 4px 16px;
font-size: 95%;
}
diff --git a/htdocs/index.php b/htdocs/index.php
index def3da0..41fe38e 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -1,5 +1,7 @@
display();
diff --git a/htdocs/login.php b/htdocs/login.php
index 8a054fd..aa0327c 100644
--- a/htdocs/login.php
+++ b/htdocs/login.php
@@ -1,6 +1,81 @@
assign('date', $date);
+ $page->display('non-inscrit');
+ exit;
+}
+
+if ($naissance==0) {
+ $page->assign('ask_naissance', true);
+ $page->display('ask-naissance');
+ exit;
+}
+
+// incitation à mettre à jour la fiche
+
+$res = mysql_query("SELECT date FROM auth_user_md5 WHERE user_id=".$_SESSION["uid"]);
+list($d) = mysql_fetch_row($res);
+$date_maj = mktime(0, 0, 0, substr($d, 5, 2), substr($d, 8, 2), substr($d, 0, 4));
+if(( (time() - $date_maj) > 60 * 60 * 24 * 400)) { // si fiche date de + de 400j;
+ $page->assign('fiche_incitation', $d);
+}
+
+// incitation à mettre une photo
+
+$res = mysql_query("SELECT 1 FROM photo WHERE uid=".$_SESSION["uid"]);
+if (mysql_num_rows($res) == 0)
+ $page->assign('photo_incitation', true);
+mysql_free_result($res);
+
+// affichage de la boîte avec quelques liens
+$res = mysql_query("SELECT id FROM newsletter ORDER BY date DESC");
+list($nb) = mysql_fetch_row($res);
+mysql_free_result($res);
+
+$publicite = Array(Array(), Array());
+$publicite[0]["motdepassemd5.php"] = "Changer mon mot de passe";
+$i = rand(0, 1);
+switch ($i) {
+ case 0 :
+ $publicite[0]["newsletter.php?nl_id=$nb"]="Afficher la dernière newsletter"; break;
+ case 1 :
+ $publicite[0]["http://asso.polytechnique.org\" target=\"new"]="Vers les autres sites polytechniciens"; break;
+}
+$i = rand(0, 1);
+switch ($i) {
+ case 0 :
+ $publicite[1]["trombipromo.php?xpromo={$_SESSION["promo"]}"]="Voir le trombi de ma promo"; break;
+ case 1 :
+ $publicite[1]["banana/"]="Un petit tour du côté des forums !!"; break;
+}
+$publicite[1]["dons.php"] = "Faire un don à l'association Polytechnique.org";
+$page->assign_by_ref('publicite', $publicite);
+
+
+//affichage des evenements
+// annonces promos triées par présence d'une limite sur les promos
+// puis par dates croissantes d'expiration
+$res = mysql_query(
+ "SELECT e.id,e.titre,e.texte,a.username,a.nom,a.prenom,a.promo
+ FROM evenements AS e INNER JOIN auth_user_md5 AS a
+ ON e.user_id=a.user_id
+ WHERE FIND_IN_SET(flags, 'valide') AND peremption >= NOW()
+ AND (e.promo_min = 0 || e.promo_min <= {$_SESSION['promo']})
+ AND (e.promo_max = 0 || e.promo_max >= {$_SESSION['promo']})
+ ORDER BY (e.promo_min != 0 AND e.promo_max != 0) DESC, e.peremption");
+$evenement = Array();
+while($evenement[] = mysql_fetch_assoc($res));
+@array_pop($evenement);
+mysql_free_result($res);
+$page->assign_by_ref('evenement', $evenement);
+
+setlocale(LC_TIME, "fr_FR");
$page->display();
?>
diff --git a/include/auto.prepend.inc.php b/include/auto.prepend.inc.php
index a6a1805..6db6136 100644
--- a/include/auto.prepend.inc.php
+++ b/include/auto.prepend.inc.php
@@ -13,6 +13,7 @@ function _new_page($type, $tpl_name, $tpl_head, $min_auth, $admin=false) {
break;
case AUTH_COOKIE:
$page = new XorgCookie($tpl_name, $type);
+ break;
case AUTH_MDP:
$page = new XorgAuth($tpl_name, $type);
}
diff --git a/include/xorg.page.inc.php b/include/xorg.page.inc.php
index 08e24dd..8be25fe 100644
--- a/include/xorg.page.inc.php
+++ b/include/xorg.page.inc.php
@@ -1,9 +1,9 @@
_tpl = $tpl;
$this->DiogenesCorePage();
- $this->register_block('dynamic', 'dynamic', false);
+ $this->register_block('dynamic', 'block_dynamic', false);
+ $this->register_function('dyn', 'function_dyn', false);
// if necessary, construct new session
if (!session_is_registered('session')) {
@@ -32,11 +33,12 @@ class XorgPage extends DiogenesCorePage {
$this->set_skin();
}
- function display() {
+ function display($append_to_id="") {
+ $id = $this->make_id() . ($append_to_id ? "-$append_to_id" : "");
if($this->_page_type == POPUP)
- parent::display('skin/'.$_SESSION['skin_popup'], $this->make_id());
+ parent::display('skin/'.$_SESSION['skin_popup'], $id);
else
- parent::display('skin/'.$_SESSION['skin'], $this->make_id());
+ parent::display('skin/'.$_SESSION['skin'], $id);
}
function make_id() {
diff --git a/include/xorg.session.inc.php b/include/xorg.session.inc.php
index 782418a..feb8525 100644
--- a/include/xorg.session.inc.php
+++ b/include/xorg.session.inc.php
@@ -111,23 +111,12 @@ class XorgSession extends DiogenesCoreSession {
global $failed_ORGaccess,$site_dev;
if(isset($_COOKIE['ORGaccess']) and isset($_COOKIE['ORGlogin']) and !isset($failed_ORGaccess)) {
+ $page->_tpl = "password_prompt_logged.tpl";
$page->assign("xorg_head", "password_prompt_logged.head.tpl");
$page->assign("xorg_tpl", "password_prompt_logged.tpl");
$page->display();
} else {
- if (isset($_COOKIE['ORGlogin'])) {
- $pre = strtok($_COOKIE['ORGlogin'],".");
- $pre1=strtok($pre,"-");
- $pre2=strtok(" ");
- $pre1=ucfirst($pre1);
- $pre2=ucfirst($pre2);
- if ($pre2) {
- $prenom = $pre1."-".$pre2;
- } else {
- $prenom = $pre1;
- }
- $page->assign('prenom',$prenom);
- }
+ $page->_tpl = "password_prompt.tpl";
$page->assign("xorg_head", "password_prompt.head.tpl");
$page->assign("xorg_tpl", "password_prompt.tpl");
$page->display();
diff --git a/templates/deconnexion.tpl b/templates/deconnexion.tpl
index a2e58f0..a50c094 100644
--- a/templates/deconnexion.tpl
+++ b/templates/deconnexion.tpl
@@ -1,3 +1,5 @@
+{* $Id: deconnexion.tpl,v 1.2 2004-01-26 12:36:32 x2000habouzit Exp $ *}
+
Déconnexion effectuée
@@ -12,3 +14,5 @@ ton navigateur, et en particulier les formulaires post
Merci et à bientôt !
+
+{* vim:set et sw=2 sts=2 sws=2: *}
diff --git a/templates/form_naissance.tpl b/templates/form_naissance.tpl
new file mode 100644
index 0000000..ed52b6a
--- /dev/null
+++ b/templates/form_naissance.tpl
@@ -0,0 +1,40 @@
+{* $Id: form_naissance.tpl,v 1.1 2004-01-26 12:36:32 x2000habouzit Exp $ *}
+
+ Date de naissance
+
+
+
+
+{* vim:set et sw=2 sts=2 sws=2: *}
diff --git a/templates/index.head.tpl b/templates/index.head.tpl
index d615690..d67f53f 100644
--- a/templates/index.head.tpl
+++ b/templates/index.head.tpl
@@ -1,4 +1,4 @@
-{* index.head.tpl *}
+{* $Id: index.head.tpl,v 1.2 2004-01-26 12:36:32 x2000habouzit Exp $ *}
{literal}
{/literal}
{* vim:set et sw=2 sts=2 sws=2: *}
-{* $Id: index.head.tpl,v 1.1 2004-01-25 17:19:21 x2000habouzit Exp $ *}
diff --git a/templates/index.tpl b/templates/index.tpl
index aef1870..31efd98 100644
--- a/templates/index.tpl
+++ b/templates/index.tpl
@@ -1,4 +1,5 @@
-{* index.tpl *}
+{* $Id: index.tpl,v 1.2 2004-01-26 12:36:32 x2000habouzit Exp $ *}
+
Bienvenue sur le portail des élèves et anciens élèves de l'X !
@@ -28,5 +29,5 @@
Bonne visite !
L'équipe Polytechnique.org
+
{* vim:set et sw=2 sts=2 sws=2: *}
-{* $Id: index.tpl,v 1.1 2004-01-25 17:19:21 x2000habouzit Exp $ *}
diff --git a/templates/login.head.tpl b/templates/login.head.tpl
new file mode 100644
index 0000000..70c1c69
--- /dev/null
+++ b/templates/login.head.tpl
@@ -0,0 +1,14 @@
+{* $Id: login.head.tpl,v 1.1 2004-01-26 12:36:32 x2000habouzit Exp $ *}
+
+{literal}
+
+{/literal}
+
+{* vim:set et sw=2 sts=2 sws=2: *}
diff --git a/templates/login.tpl b/templates/login.tpl
new file mode 100644
index 0000000..fdc8b5d
--- /dev/null
+++ b/templates/login.tpl
@@ -0,0 +1,101 @@
+{* $Id: login.tpl,v 1.1 2004-01-26 12:36:32 x2000habouzit Exp $ *}
+
+{if $date}
+
+ Assistant première connexion
+
+
+ Le programme a détecté que tu te connectes pour la première fois
+ sur ce site. Un certain nombre de paramètres ne sont donc pas à
+ jour pour fonctionner correctement. La plupart se mettront eux-mêmes
+ à jour sans que tu t'en aperçoives, mais d'autres nécessitent
+ ton intervention.
+
+
+ Clique ici pour continuer.
+
+{elseif $naissance}
+{include file=form_naissance.tpl}
+{else}
+
+Bienvenue {dyn s=$smarty.session.prenom} :o)
+
+
+ Ta connexion précédente date du
+ {dyn s=$smarty.session.lastlogin|date_format:"%x, %T"}
+ depuis la machine {dyn s=$smarty.session.host}
+
+
+{if $fiche_incitation}
+{dynamic}
+ La dernière mise à jour de ta
+ fiche
+ date du {$fiche_incitation|date_format:"%x"}.
+ Il est possible qu'elle ne soit pas à jour.
+ Si tu souhaites la modifier, clique ici !
+
+{/dynamic}
+{/if}
+
+{if $photo_incitation}
+{dynamic}
+
+ Tu n'as pas mis de photo de toi sur ta fiche, c'est dommage.
+ Clique ici
+ si tu souhaites en ajouter une.
+
+{/dynamic}
+{/if}
+
+
+
+{dynamic}
+
+
+{foreach item=links from=$publicite}
+
+{foreach key=url item=text from=$links}
+ {$text}
+{/foreach}
+ |
+{/foreach}
+
+
+
+ {foreach item=ev from=$evenement}
+
+
+
+ {/foreach}
+{/dynamic}
+
+
+ Nota Bene : les informations présentées ici n'engagent que leurs auteurs
+ respectifs et sont publiées à leur initiative. L'association Polytechnique.org
+ ne pourrait en aucun cas être tenue responsable de la nature des propos relatés
+ sur cet espace d'expression et d'information. Elle se réserve le droit de
+ refuser ou de retirer toute information de nature diffamante ou pouvant être
+ interprétée comme polémique par un membre de la communauté polytechnicienne.
+
+
+
+ Proposer une information événementielle
+
+{/if}
+
+{* vim:set et sw=2 sts=2 sws=2: *}
diff --git a/templates/password_prompt.head.tpl b/templates/password_prompt.head.tpl
index 4062361..60d4001 100644
--- a/templates/password_prompt.head.tpl
+++ b/templates/password_prompt.head.tpl
@@ -1,3 +1,5 @@
+{* $Id: password_prompt.head.tpl,v 1.2 2004-01-26 12:36:32 x2000habouzit Exp $ *}
+
{literal}