some plugins reorg
authorx2000habouzit <x2000habouzit>
Mon, 22 Nov 2004 07:48:49 +0000 (07:48 +0000)
committerx2000habouzit <x2000habouzit>
Mon, 22 Nov 2004 07:48:49 +0000 (07:48 +0000)
include/xorg.common.inc.php
plugins/insert.getName.php [moved from include/insert.password.inc.php with 70% similarity]
plugins/insert.getUserName.php [new file with mode: 0644]
templates/password_prompt.tpl

index 0e8be88..ce43be2 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-    $Id: xorg.common.inc.php,v 1.9 2004-11-22 06:50:03 x2000habouzit Exp $
+    $Id: xorg.common.inc.php,v 1.10 2004-11-22 07:48:49 x2000habouzit Exp $
  ***************************************************************************/
 
 // {{{ defines
@@ -28,6 +28,7 @@ define("AUTH_PUBLIC", $i++);
 define("AUTH_COOKIE", $i++);
 define("AUTH_MDP", $i++);
 
+define("PERMS_EXT", "ext");
 define("PERMS_USER", "user");
 define("PERMS_ADMIN", "admin");
 
similarity index 70%
rename from include/insert.password.inc.php
rename to plugins/insert.getName.php
index 2d53ac0..9ae711c 100644 (file)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: insert.password.inc.php,v 1.6 2004-11-17 10:12:45 x2000habouzit Exp $
+        $Id: insert.getName.php,v 1.1 2004-11-22 07:48:50 x2000habouzit Exp $
  ***************************************************************************/
 
-function smarty_insert_getName() {
+function smarty_insert_getName()
+{
     global $globals;
-    if(empty($_COOKIE['ORGuid'])) return "";
+    if (empty($_COOKIE['ORGuid'])) {
+        return "";
+    }
     $res = $globals->db->query("SELECT prenom FROM auth_user_md5 WHERE user_id='{$_COOKIE['ORGuid']}'");
-    if(list($prenom) = mysql_fetch_row($res)) {
+    if (list($prenom) = mysql_fetch_row($res)) {
        mysql_free_result($res);
        return $prenom;
     }
     return "";
 }
 
-function smarty_insert_getUsername() {
-    global $globals;
-    if(isset($_COOKIE['ORGuid'])) $id = $_COOKIE['ORGuid'];
-    if(isset($_SESSION['uid'])) $id = $_SESSION['uid'];
-    if(empty($id)) return "";
-    $res = $globals->db->query("SELECT  alias
-                                  FROM  aliases
-                                WHERE  id='$id' AND (type='a_vie' OR type='alias')
-                             ORDER BY  !FIND_IN_SET('epouse',flags), LENGTH(alias) LIMIT 1");
-    if(list($uname) = mysql_fetch_row($res)) {
-       mysql_free_result($res);
-       return $uname;
-    }
-    return "";
-}
 ?>
diff --git a/plugins/insert.getUserName.php b/plugins/insert.getUserName.php
new file mode 100644 (file)
index 0000000..6d81679
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2004 Polytechnique.org                              *
+ *  http://opensource.polytechnique.org/                                   *
+ *                                                                         *
+ *  This program is free software; you can redistribute it and/or modify   *
+ *  it under the terms of the GNU General Public License as published by   *
+ *  the Free Software Foundation; either version 2 of the License, or      *
+ *  (at your option) any later version.                                    *
+ *                                                                         *
+ *  This program is distributed in the hope that it will be useful,        *
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
+ *  GNU General Public License for more details.                           *
+ *                                                                         *
+ *  You should have received a copy of the GNU General Public License      *
+ *  along with this program; if not, write to the Free Software            *
+ *  Foundation, Inc.,                                                      *
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
+ ***************************************************************************
+    $Id: insert.getUserName.php,v 1.1 2004-11-22 07:48:50 x2000habouzit Exp $
+ ***************************************************************************/
+
+function smarty_insert_getUsername()
+{
+    global $globals;
+    if (isset($_COOKIE['ORGuid'])) {
+        $id = $_COOKIE['ORGuid'];
+    }
+    if (isset($_SESSION['uid'])) {
+        $id = $_SESSION['uid'];
+    }
+    if (empty($id)) {
+        return "";
+    }
+    $res = $globals->db->query("SELECT  alias
+                                  FROM  aliases
+                                WHERE  id='$id' AND (type IN ('a_vie','alias') AND FIND_IN_SET('bestalias', flags))");
+    if (list($uname) = mysql_fetch_row($res)) {
+       mysql_free_result($res);
+       return $uname;
+    }
+    return "";
+}
+?>
index 0e0f1a6..c51b38b 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: password_prompt.tpl,v 1.24 2004-11-13 13:17:08 x2000habouzit Exp $
+        $Id: password_prompt.tpl,v 1.25 2004-11-22 07:48:50 x2000habouzit Exp $
  ***************************************************************************}
 
 <noscript>
@@ -36,7 +36,7 @@
 {min_auth level="cookie"}
 <p>
 <strong>Merci de rentrer ton mot de passe pour démarrer une connexion au site.</strong>
-Si tu n'es pas {insert name="getName" script="insert.password.inc.php"}, change le login ci-dessous, ou rends-toi sur
+Si tu n'es pas {insert name="getName"}, change le login ci-dessous, ou rends-toi sur
 <a href="{"inscription/"|url}">la page d'inscription</a>.
 </p>
 {/min_auth}
@@ -73,7 +73,7 @@ Si tu n'es pas {insert name="getName" script="insert.password.inc.php"}, change
       </td>
       <td>
         <input type="text" name="username" size="20" maxlength="50"
-          value="{insert name="getUserName" script="insert.password.inc.php"}" />
+          value="{insert name="getUserName"}" />
       </td>
     </tr>
     <tr>